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
private String stop; private String run;
public StatusEndPoint(String id) { super(id); System.out.println("id = " + id); // System.out.println("stop = " + stop); // System.out.println("run = " + run); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String stop()\r\n {\r\n return \"{ \\\"action\\\": \\\"stop\\\" }\";\r\n }", "@Override\npublic String stop() {\n\treturn \"the Truck has stopped\";\n}", "public Stop(String name) {\n this.name = name;\n }", "public boolean getAllowStop();", "public void stop(){\n stop = true;\n }", "public String getStopped() {\n return stopped;\n }", "public void setClosedStop(Stop stop)\r\n {\r\n closed_stop = stop;\r\n }", "static void unstop(){\n stop=false;\n }", "public void stop(){\n\t\t\n\t}", "void stop() {\n }", "public void stop(){\n }", "static void stop(){\n stop=true;\n firstPass=true;\n }", "public void setStop(boolean stop) {\n\t\tloopTask.stop = stop;\n\t}", "public void stop()\n {\n }", "public String toString(){\n\t\treturn \"RUN\";\n\t}", "public void stop() {\n\t\t\n\t}", "public String toString() {\n return \"Stop #\" + getID() + \": \" + getName();\n }", "public void setRun(Boolean run){\n runnnig = run;\n }", "@Override\n\tpublic void stop() {\n\t\t\n\t}", "@Override\n\tpublic void stop() {\n\t\t\n\t}", "@Override\n\tpublic void stop() {\n\t\t\n\t}", "@Override\n\tpublic void stop() {\n\t\t\n\t}", "@Override\n\tpublic void stop() {\n\t\t\n\t}", "@Override\n\tpublic void stop() {\n\t\t\n\t}", "@Override\n\tpublic void stop() {\n\t\t\n\t}", "@Override\n\tpublic void stop() {\n\t\t\n\t}", "boolean isStop();", "public void stop() {\n\t}", "public void setStopped(String stopped) {\n this.stopped = stopped == null ? null : stopped.trim();\n }", "public void stop() {\n stop = true;\n }", "public void stop()\r\n\t{\r\n\t\tdoStop = true;\r\n\t}", "public void stop() {}", "@Override\n public void stop() {\n }", "public void stop() {\n }", "public void stop() {\n }", "@Override\n\tpublic void stop() {\n\t}", "@Override\n\tpublic void stop() {\n\t}", "public int getStopSequence() {\n return stopSequence;\n }", "void beforeStop();", "@Override\n public void stop() {\n\n }", "public long getStopped() { return stopped; }", "public void stop() {\n System.out.println(\"stop\");\n }", "@Override\r\n\tpublic void stop() {\n\t\t\r\n\t}", "public BusStopRecord() {\n super(BusStop.BUS_STOP);\n }", "public void setStopSequence(int stopSequence) {\n this.stopSequence = stopSequence;\n }", "@Override\n public void stop() {}", "@Override\n public StopOperator getStopOperator() {\n return null;\n }", "public void setRunning(boolean run)\n\t{\n\t\tmRun=run;\n\t}", "@Override\n public void stop() {\n }", "@Override\n public void stop() {\n }", "@Override\n public void stop() {\n }", "@Override\n public void stop() {\n }", "@Override\n public void stop() {\n }", "@Override\n public void stop() {\n }", "@Override\n public void stop() {\n }", "@Override\n public void stop() {\n }", "@Override\n public void stop() {\n }", "@Override\n public void stop() {\n }", "@Override\n public void stop() {\n }", "@Override\r\n public void stop() {\r\n\r\n }", "public void stop (String message);", "public boolean isStop() {\n\t\treturn stop;\n\t}", "public void stopped();", "public void stop(){\n running = false;\n }", "public void setRunning(boolean run) {\n _run = run;\r\n }", "public void setAllowStop(boolean allowed);", "@Override\r\n public void stop() {\r\n }", "@Override\r\n public void stop() {\r\n }", "public void stop(){\n quit = true;\n }", "@Override\n\tpublic String stopAll() {\n\t\treturn null;\n\t}", "private void stop() {\r\n\t\t\tstopped = true;\r\n\t\t}", "@Override public void stop () {\n }", "@EncoderThread\n protected abstract void onStop();", "public String mayStop() {\n\t return null;\n\t}", "public void stop() { \n System.out.println(\"Inside the stop() method.\"); \n }", "public abstract void stopped();", "public synchronized void requestStop() \n\t{\n\t\tstoprequested = true;\n\t}", "public final void stop() {\n running = false;\n \n \n\n }", "public static void stop(){\n printStatic(\"Stopped vehicle\");\n }", "void setRunning(boolean running) {\n this.running = running;\n }", "void setRunning(boolean running) {\n this.running = running;\n }", "@Override\n public void stopExecute() {\n\n }", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "void stop();", "public String getTask(){\n\treturn task;\n}", "abstract public void stop();" ]
[ "0.6369963", "0.6330678", "0.6189379", "0.60898036", "0.6075603", "0.60719126", "0.604269", "0.5981552", "0.59720564", "0.59550595", "0.59173375", "0.5864645", "0.5851681", "0.58180463", "0.5815192", "0.58028024", "0.57894605", "0.5770054", "0.5769192", "0.5769192", "0.5769192", "0.5769192", "0.5769192", "0.5769192", "0.5769192", "0.5769192", "0.57611823", "0.5759796", "0.5757032", "0.5742253", "0.5737448", "0.5737444", "0.5734887", "0.57302886", "0.57302886", "0.5729578", "0.5729578", "0.5695063", "0.5685847", "0.56856114", "0.56810176", "0.5621935", "0.5618234", "0.5615904", "0.5610743", "0.55801564", "0.5573694", "0.55717725", "0.55706257", "0.55706257", "0.55706257", "0.55706257", "0.55706257", "0.55706257", "0.55706257", "0.55706257", "0.55706257", "0.55706257", "0.55706257", "0.5568956", "0.5565591", "0.5558842", "0.5555568", "0.5552987", "0.5540747", "0.5538323", "0.55300736", "0.55300736", "0.55180424", "0.54968286", "0.54965115", "0.54955226", "0.54891545", "0.5479646", "0.5463766", "0.54467756", "0.54437536", "0.54310095", "0.5427434", "0.54228836", "0.54228836", "0.5417051", "0.54132426", "0.54132426", "0.54132426", "0.54132426", "0.54132426", "0.54132426", "0.54132426", "0.54132426", "0.54132426", "0.54132426", "0.54132426", "0.54132426", "0.54132426", "0.54132426", "0.54132426", "0.54132426", "0.54132426", "0.5401484", "0.5396288" ]
0.0
-1
Simply should not fail and return something.
@Test public void testCreateDocumentChecksumFromContent() throws IOException { String content = "Some content"; CachedInputStream is = new CachedStreamFactory(1024, 1024).newInputStream(content); Doc doc = new Doc("N/A", is); MD5DocumentChecksummer cs = new MD5DocumentChecksummer(); String checksum = cs.createDocumentChecksum(doc); is.dispose(); Assertions.assertTrue(StringUtils.isNotBlank(checksum), "No checksum was generated."); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "boolean getPossiblyBad();", "@Override\n boolean canFail() {\n return true;\n }", "boolean isFail();", "boolean isFailure();", "@Override\n\t\t\t\tpublic void doFail() {\n\t\t\t\t}", "public boolean needsProblem();", "boolean hasPossiblyBad();", "static void return_unconditionally(String passed){\n\t\tcomplete_return_requirements();\n\t}", "public abstract String check() throws Exception;", "public static int methodWithoutReturn(){\n throw new Error();\n }", "public boolean trySuccess()\r\n/* 52: */ {\r\n/* 53: 84 */ return trySuccess(null);\r\n/* 54: */ }", "boolean test() {\n return false; // REPLACE WITH SOLUTION\n }", "static public void fail() {\n fail(null);\n }", "boolean _non_existent();", "public boolean isContentInvalid() {\n/* 1156 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "@Test\n public void should_return_() {\n }", "@Override\n boolean isFailed() {\n return false;\n }", "public boolean queryAfterZeroResults() {\n/* 264 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "public boolean validateInput() {\n/* 158 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "public TestCase fail();", "public void performValidation() {\n/* 623 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "void shouldThrowForBadServerValue() {\n }", "public boolean hasFail() {\n return result.hasFail();\n }", "boolean hasErr();", "void ok();", "public void doTheFaultyThing();", "public void testImproperUseOfTheCircuit() {\n \t fail(\"testImproperUseOfTheCircuit\");\n }", "public void noReturn() {\n\t\tSystem.out.println(\"noReturn method will not returing any thing\");\n\t}", "boolean getIsOk();", "static void return_not_zero(String passed){\n\t\tif(!Z)\n\t\t\tcomplete_return_requirements();\n\t}", "static void return_not_sign(String passed){\n\t\tif(!S)\n\t\t\tcomplete_return_requirements();\n\t}", "boolean isSuccessful();", "public boolean enoughToFilter() {\n/* 468 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "Object getFailonerror();", "Object getFailonerror();", "@Test\r\n\t public void feelingLucky() {\r\n\t \t Assert.fail();\r\n\t Assert.fail();\r\n\t }", "T negativeResult();", "public void testSoThatTestsDoNotFail() {\n\n }", "boolean hasError();", "boolean hasError();", "boolean hasError();", "@Override\n\tpublic void fail(Throwable t) {\n\t}", "boolean hadErrors();", "public void onFailure();", "private Predicate<Response> shouldErrorFailBuild(boolean skipFailures){\n return x -> skipFailures || x.isSuccessful();\n }", "static void perform_ret(String passed){\n\t\tint type = type_of_ret(passed);\n\t\tswitch(type){\n\t\tcase 1:\n\t\t\treturn_unconditionally(passed);\n\t\t\tbreak;\n\t\t}\n\t}", "@SuppressWarnings(\"unchecked\")\n public Q fail() {\n forceFail = true;\n return (Q) this;\n }", "@Override\n\tpublic boolean test() {\n\t\treturn false;\n\t}", "@Test\n public void testFail() {\n fail();\n }", "public boolean wasOkay();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "public abstract boolean repOk();", "Boolean ignoreExceptions();", "protected boolean ignoreFailure() {\n return ignoreFailure;\n }", "public ULocale getFallback() {\n/* 314 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "V result() throws Exception;", "int getReturnCode();", "int getReturnCode();", "void onFailure();", "void onFailure();", "void onFailure();", "public abstract void\n fail(ValidationError error);", "void failed (Exception e);", "boolean processFailure(Throwable t);", "boolean hasIsSuccess();", "public void fail( String reason );", "static void return_not_carry(String passed){\n\t\tif(!CS)\n\t\t\tcomplete_return_requirements();\n\t}", "public boolean hasError();", "@Test\r\n\tvoid testImportSingleRowShouldReturnFalseIfUnsuccessful() {\r\n\t\tRecordParser parser = new RecordParser();\r\n\t\tassertFalse(parser.importSingleRecord(\"This is a row of bad data. There's too much and nothing useful!\"));\r\n\t}", "public static void failUnexpectedToReachThis()\r\n\t{\r\n\t\tfail( \"Unexpected to hit this line, as the previous statement should thrown an exception\" ); \r\n\t}", "public boolean hasResult()\n/* */ {\n/* 119 */ return this.result != RESULT_NONE;\n/* */ }", "String failureReason();", "@Test\n\tpublic void test_returnBooleanFoo_false() {\n\t}", "public boolean test() throws Exception {\n throw new Exception(\"Test funcationality not yet implemented: unclear API\");\n }", "static void return_when_zero(String passed){\n\t\tif(Z)\n\t\t\tcomplete_return_requirements();\n\t}", "public void fail(boolean hcf);", "boolean isError();", "public boolean isFailure( ) {\n\t\treturn failed;\n\t}", "public boolean isCheckable() {\n/* 738 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "abstract int pregnancy();", "@Test\n void fail_the_test() {\n }", "@Test(timeout = 500)\n\tpublic void testGetModuloOne() {\n\t\tAssert.fail();\n\t}", "boolean isBadCommunication();", "public ParseResult failure (Object input) {\n return failure(input, 1);\n }", "void notSupported(String errorcode);", "public static boolean isOK() {return isOK;}", "public void testNoMadeCommunication() {\n\t\t// Arrange\n\t\tString exceptionNumber = null;\n\t\tPhoneNumberDTO dto = new PhoneNumberDTO(EXISTING_NUMBER);\n\t\tGetLastMadeCommunicationService service\n\t\t\t= new GetLastMadeCommunicationService(dto);\n\t\t\n\t\t// Act\n\t\ttry {\n\t\t\tservice.execute();\n\t\t\tfail(\"Should have thrown NoMadeCommunication\");\n\t\t} catch(NoMadeCommunication nmc) {\n\t\t\texceptionNumber = nmc.getNumber();\n\t\t}\n\t\t\n\t\t// Assert\n\t\tassertEquals(\"The phone number in the exception should be \"\n\t\t\t\t+ EXISTING_NUMBER + \" but it was \" + exceptionNumber,\n\t\t\t\tEXISTING_NUMBER, exceptionNumber);\n\t}", "@Override\n\tpublic void fail(Handle msg) {\n\t\t\n\t}", "void checkReturnSt (int ln) {\r\n if (!return_type.isVoid ())\r\n OzcError.needReturnSt (ln);\r\n else \r\n need_return = true;\r\n }", "public int describeContents() {\n/* 1781 */ throw new RuntimeException(\"Stub!\");\n/* */ }" ]
[ "0.7106674", "0.7016902", "0.70101345", "0.70043266", "0.6755166", "0.6563591", "0.65042853", "0.64964217", "0.6443713", "0.639487", "0.6383219", "0.6361692", "0.6309689", "0.6302902", "0.6223239", "0.62038815", "0.61624336", "0.61477894", "0.6137916", "0.6121422", "0.60980904", "0.60775125", "0.6075287", "0.60678774", "0.60508263", "0.6042991", "0.6031307", "0.60063404", "0.60033846", "0.60030025", "0.5997585", "0.5996528", "0.59953654", "0.5994294", "0.5994294", "0.59823465", "0.5971572", "0.59631467", "0.5919684", "0.5919684", "0.5919684", "0.59106714", "0.5901252", "0.5901111", "0.58879066", "0.58872247", "0.58796924", "0.58736897", "0.58449614", "0.58345354", "0.58329785", "0.58329785", "0.58329785", "0.58329785", "0.58329785", "0.58329785", "0.58329785", "0.58329785", "0.58329785", "0.58329785", "0.58329785", "0.58329785", "0.5830834", "0.58105063", "0.5802624", "0.57971567", "0.5793442", "0.5780647", "0.5780647", "0.5776181", "0.5776181", "0.5776181", "0.5770277", "0.5764173", "0.57584417", "0.5755386", "0.57484585", "0.574098", "0.57310855", "0.57171816", "0.5716286", "0.5715007", "0.5712532", "0.57097316", "0.5705011", "0.57041585", "0.5702408", "0.5699892", "0.5695318", "0.56915456", "0.5688504", "0.5672676", "0.5668244", "0.56651545", "0.56585467", "0.5656002", "0.56503844", "0.56502354", "0.56479335", "0.56460446", "0.5636444" ]
0.0
-1
Simply should not fail and return something.
@Test public void testCreateDocumentChecksumFromMeta() throws IOException { CachedInputStream is = new CachedStreamFactory(1024, 1024).newInputStream(); Doc doc = new Doc("N/A", is); doc.getMetadata().add("field1", "value1.1", "value1.2"); doc.getMetadata().add("field2", "value2"); MD5DocumentChecksummer cs = new MD5DocumentChecksummer(); // 2 matching fields cs.setFieldMatcher(TextMatcher.csv("field1,field2")); String checksum1 = cs.createDocumentChecksum(doc); Assertions.assertTrue( StringUtils.isNotBlank(checksum1), "No checksum was generated for two matching fields."); // 1 out of 2 matching fields cs.setFieldMatcher(TextMatcher.csv("field1,field3")); String checksum2 = cs.createDocumentChecksum(doc); Assertions.assertTrue( StringUtils.isNotBlank(checksum2), "No checksum was generated for 1 of two matching fields."); // No matching fields cs.setFieldMatcher(TextMatcher.csv("field4,field5")); String checksum3 = cs.createDocumentChecksum(doc); Assertions.assertNull(checksum3, "Checksum for no matching fields should have been null."); // Regex cs.setFieldMatcher(TextMatcher.regex("field.*")); String checksum4 = cs.createDocumentChecksum(doc); Assertions.assertTrue(StringUtils.isNotBlank(checksum4), "No checksum was generated."); // Regex only no match cs.setFieldMatcher(TextMatcher.regex("NOfield.*")); String checksum5 = cs.createDocumentChecksum(doc); Assertions.assertNull(checksum5, "Checksum for no matching regex should have been null."); is.dispose(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "boolean getPossiblyBad();", "@Override\n boolean canFail() {\n return true;\n }", "boolean isFail();", "boolean isFailure();", "@Override\n\t\t\t\tpublic void doFail() {\n\t\t\t\t}", "public boolean needsProblem();", "boolean hasPossiblyBad();", "static void return_unconditionally(String passed){\n\t\tcomplete_return_requirements();\n\t}", "public abstract String check() throws Exception;", "public static int methodWithoutReturn(){\n throw new Error();\n }", "public boolean trySuccess()\r\n/* 52: */ {\r\n/* 53: 84 */ return trySuccess(null);\r\n/* 54: */ }", "boolean test() {\n return false; // REPLACE WITH SOLUTION\n }", "static public void fail() {\n fail(null);\n }", "boolean _non_existent();", "public boolean isContentInvalid() {\n/* 1156 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "@Test\n public void should_return_() {\n }", "@Override\n boolean isFailed() {\n return false;\n }", "public boolean queryAfterZeroResults() {\n/* 264 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "public boolean validateInput() {\n/* 158 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "public TestCase fail();", "public void performValidation() {\n/* 623 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "void shouldThrowForBadServerValue() {\n }", "public boolean hasFail() {\n return result.hasFail();\n }", "boolean hasErr();", "void ok();", "public void doTheFaultyThing();", "public void testImproperUseOfTheCircuit() {\n \t fail(\"testImproperUseOfTheCircuit\");\n }", "public void noReturn() {\n\t\tSystem.out.println(\"noReturn method will not returing any thing\");\n\t}", "boolean getIsOk();", "static void return_not_zero(String passed){\n\t\tif(!Z)\n\t\t\tcomplete_return_requirements();\n\t}", "boolean isSuccessful();", "static void return_not_sign(String passed){\n\t\tif(!S)\n\t\t\tcomplete_return_requirements();\n\t}", "public boolean enoughToFilter() {\n/* 468 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "Object getFailonerror();", "Object getFailonerror();", "@Test\r\n\t public void feelingLucky() {\r\n\t \t Assert.fail();\r\n\t Assert.fail();\r\n\t }", "T negativeResult();", "public void testSoThatTestsDoNotFail() {\n\n }", "boolean hasError();", "boolean hasError();", "boolean hasError();", "@Override\n\tpublic void fail(Throwable t) {\n\t}", "public void onFailure();", "boolean hadErrors();", "private Predicate<Response> shouldErrorFailBuild(boolean skipFailures){\n return x -> skipFailures || x.isSuccessful();\n }", "static void perform_ret(String passed){\n\t\tint type = type_of_ret(passed);\n\t\tswitch(type){\n\t\tcase 1:\n\t\t\treturn_unconditionally(passed);\n\t\t\tbreak;\n\t\t}\n\t}", "@SuppressWarnings(\"unchecked\")\n public Q fail() {\n forceFail = true;\n return (Q) this;\n }", "@Override\n\tpublic boolean test() {\n\t\treturn false;\n\t}", "@Test\n public void testFail() {\n fail();\n }", "public boolean wasOkay();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "public abstract boolean repOk();", "Boolean ignoreExceptions();", "protected boolean ignoreFailure() {\n return ignoreFailure;\n }", "public ULocale getFallback() {\n/* 314 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "V result() throws Exception;", "int getReturnCode();", "int getReturnCode();", "void onFailure();", "void onFailure();", "void onFailure();", "public abstract void\n fail(ValidationError error);", "void failed (Exception e);", "boolean processFailure(Throwable t);", "boolean hasIsSuccess();", "public void fail( String reason );", "static void return_not_carry(String passed){\n\t\tif(!CS)\n\t\t\tcomplete_return_requirements();\n\t}", "public boolean hasError();", "@Test\r\n\tvoid testImportSingleRowShouldReturnFalseIfUnsuccessful() {\r\n\t\tRecordParser parser = new RecordParser();\r\n\t\tassertFalse(parser.importSingleRecord(\"This is a row of bad data. There's too much and nothing useful!\"));\r\n\t}", "public static void failUnexpectedToReachThis()\r\n\t{\r\n\t\tfail( \"Unexpected to hit this line, as the previous statement should thrown an exception\" ); \r\n\t}", "public boolean hasResult()\n/* */ {\n/* 119 */ return this.result != RESULT_NONE;\n/* */ }", "String failureReason();", "@Test\n\tpublic void test_returnBooleanFoo_false() {\n\t}", "public boolean test() throws Exception {\n throw new Exception(\"Test funcationality not yet implemented: unclear API\");\n }", "public void fail(boolean hcf);", "static void return_when_zero(String passed){\n\t\tif(Z)\n\t\t\tcomplete_return_requirements();\n\t}", "boolean isError();", "public boolean isFailure( ) {\n\t\treturn failed;\n\t}", "public boolean isCheckable() {\n/* 738 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "abstract int pregnancy();", "@Test\n void fail_the_test() {\n }", "@Test(timeout = 500)\n\tpublic void testGetModuloOne() {\n\t\tAssert.fail();\n\t}", "boolean isBadCommunication();", "public ParseResult failure (Object input) {\n return failure(input, 1);\n }", "void notSupported(String errorcode);", "public static boolean isOK() {return isOK;}", "public void testNoMadeCommunication() {\n\t\t// Arrange\n\t\tString exceptionNumber = null;\n\t\tPhoneNumberDTO dto = new PhoneNumberDTO(EXISTING_NUMBER);\n\t\tGetLastMadeCommunicationService service\n\t\t\t= new GetLastMadeCommunicationService(dto);\n\t\t\n\t\t// Act\n\t\ttry {\n\t\t\tservice.execute();\n\t\t\tfail(\"Should have thrown NoMadeCommunication\");\n\t\t} catch(NoMadeCommunication nmc) {\n\t\t\texceptionNumber = nmc.getNumber();\n\t\t}\n\t\t\n\t\t// Assert\n\t\tassertEquals(\"The phone number in the exception should be \"\n\t\t\t\t+ EXISTING_NUMBER + \" but it was \" + exceptionNumber,\n\t\t\t\tEXISTING_NUMBER, exceptionNumber);\n\t}", "@Override\n\tpublic void fail(Handle msg) {\n\t\t\n\t}", "void checkReturnSt (int ln) {\r\n if (!return_type.isVoid ())\r\n OzcError.needReturnSt (ln);\r\n else \r\n need_return = true;\r\n }", "public int describeContents() {\n/* 1781 */ throw new RuntimeException(\"Stub!\");\n/* */ }" ]
[ "0.71075034", "0.701807", "0.7010935", "0.70053214", "0.6755728", "0.6563681", "0.65047634", "0.64954984", "0.6442642", "0.6395718", "0.63832814", "0.6360624", "0.63099146", "0.6301524", "0.6222979", "0.6201706", "0.616339", "0.61467016", "0.6138464", "0.6121988", "0.60990244", "0.6077401", "0.60766923", "0.60677624", "0.6050483", "0.6041866", "0.60313034", "0.600588", "0.6004144", "0.60018194", "0.5996785", "0.59963536", "0.5995426", "0.5994222", "0.5994222", "0.59825873", "0.5971905", "0.59627724", "0.5919436", "0.5919436", "0.5919436", "0.59111553", "0.59016794", "0.5901396", "0.5889184", "0.58867276", "0.5880888", "0.5872887", "0.5844729", "0.58356214", "0.58322227", "0.58322227", "0.58322227", "0.58322227", "0.58322227", "0.58322227", "0.58322227", "0.58322227", "0.58322227", "0.58322227", "0.58322227", "0.58322227", "0.5831028", "0.581083", "0.5803875", "0.57973665", "0.5792871", "0.5780435", "0.5780435", "0.5776488", "0.5776488", "0.5776488", "0.57709396", "0.5764512", "0.57590735", "0.57554173", "0.5749917", "0.57396734", "0.5731276", "0.5717257", "0.57157826", "0.5714099", "0.5712844", "0.5708652", "0.57053554", "0.57035685", "0.57028687", "0.5700177", "0.56969243", "0.5692513", "0.5687084", "0.56721944", "0.5668117", "0.56656724", "0.565973", "0.56558937", "0.56510377", "0.56497097", "0.5648571", "0.56462926", "0.5636333" ]
0.0
-1
Simply should not fail and return something.
@Test @Deprecated public void testCreateDocumentChecksumFromMetaDeprecated() throws IOException { CachedInputStream is = new CachedStreamFactory(1024, 1024).newInputStream(); Doc doc = new Doc("N/A", is); doc.getMetadata().add("field1", "value1.1", "value1.2"); doc.getMetadata().add("field2", "value2"); MD5DocumentChecksummer cs = new MD5DocumentChecksummer(); // 2 matching fields cs.setSourceFields("field1", "field2"); String checksum1 = cs.createDocumentChecksum(doc); Assertions.assertTrue( StringUtils.isNotBlank(checksum1), "No checksum was generated for two matching fields."); // 1 out of 2 matching fields cs.setSourceFields("field1", "field3"); String checksum2 = cs.createDocumentChecksum(doc); Assertions.assertTrue( StringUtils.isNotBlank(checksum2), "No checksum was generated for 1 of two matching fields."); // No matching fields cs.setSourceFields("field4", "field5"); String checksum3 = cs.createDocumentChecksum(doc); Assertions.assertNull(checksum3, "Checksum for no matching fields should have been null."); // Fields + Regex cs.setSourceFieldsRegex("field.*"); String checksum4 = cs.createDocumentChecksum(doc); Assertions.assertTrue(StringUtils.isNotBlank(checksum4), "No checksum was generated."); // Regex only cs.setSourceFields(); cs.setSourceFieldsRegex("field.*"); String checksum5 = cs.createDocumentChecksum(doc); Assertions.assertTrue(StringUtils.isNotBlank(checksum5), "No checksum was generated."); // Regex only no match cs.setSourceFieldsRegex("NOfield.*"); String checksum6 = cs.createDocumentChecksum(doc); Assertions.assertNull(checksum6, "Checksum for no matching regex should have been null."); is.dispose(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "boolean getPossiblyBad();", "@Override\n boolean canFail() {\n return true;\n }", "boolean isFail();", "boolean isFailure();", "@Override\n\t\t\t\tpublic void doFail() {\n\t\t\t\t}", "public boolean needsProblem();", "boolean hasPossiblyBad();", "static void return_unconditionally(String passed){\n\t\tcomplete_return_requirements();\n\t}", "public abstract String check() throws Exception;", "public static int methodWithoutReturn(){\n throw new Error();\n }", "public boolean trySuccess()\r\n/* 52: */ {\r\n/* 53: 84 */ return trySuccess(null);\r\n/* 54: */ }", "boolean test() {\n return false; // REPLACE WITH SOLUTION\n }", "static public void fail() {\n fail(null);\n }", "boolean _non_existent();", "public boolean isContentInvalid() {\n/* 1156 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "@Test\n public void should_return_() {\n }", "@Override\n boolean isFailed() {\n return false;\n }", "public boolean queryAfterZeroResults() {\n/* 264 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "public boolean validateInput() {\n/* 158 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "public TestCase fail();", "public void performValidation() {\n/* 623 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "void shouldThrowForBadServerValue() {\n }", "public boolean hasFail() {\n return result.hasFail();\n }", "boolean hasErr();", "void ok();", "public void doTheFaultyThing();", "public void testImproperUseOfTheCircuit() {\n \t fail(\"testImproperUseOfTheCircuit\");\n }", "public void noReturn() {\n\t\tSystem.out.println(\"noReturn method will not returing any thing\");\n\t}", "boolean getIsOk();", "static void return_not_zero(String passed){\n\t\tif(!Z)\n\t\t\tcomplete_return_requirements();\n\t}", "static void return_not_sign(String passed){\n\t\tif(!S)\n\t\t\tcomplete_return_requirements();\n\t}", "boolean isSuccessful();", "public boolean enoughToFilter() {\n/* 468 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "Object getFailonerror();", "Object getFailonerror();", "@Test\r\n\t public void feelingLucky() {\r\n\t \t Assert.fail();\r\n\t Assert.fail();\r\n\t }", "T negativeResult();", "public void testSoThatTestsDoNotFail() {\n\n }", "boolean hasError();", "boolean hasError();", "boolean hasError();", "@Override\n\tpublic void fail(Throwable t) {\n\t}", "boolean hadErrors();", "public void onFailure();", "private Predicate<Response> shouldErrorFailBuild(boolean skipFailures){\n return x -> skipFailures || x.isSuccessful();\n }", "static void perform_ret(String passed){\n\t\tint type = type_of_ret(passed);\n\t\tswitch(type){\n\t\tcase 1:\n\t\t\treturn_unconditionally(passed);\n\t\t\tbreak;\n\t\t}\n\t}", "@SuppressWarnings(\"unchecked\")\n public Q fail() {\n forceFail = true;\n return (Q) this;\n }", "@Override\n\tpublic boolean test() {\n\t\treturn false;\n\t}", "@Test\n public void testFail() {\n fail();\n }", "public boolean wasOkay();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "boolean hasResult();", "public abstract boolean repOk();", "Boolean ignoreExceptions();", "protected boolean ignoreFailure() {\n return ignoreFailure;\n }", "public ULocale getFallback() {\n/* 314 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "V result() throws Exception;", "int getReturnCode();", "int getReturnCode();", "void onFailure();", "void onFailure();", "void onFailure();", "public abstract void\n fail(ValidationError error);", "void failed (Exception e);", "boolean processFailure(Throwable t);", "boolean hasIsSuccess();", "public void fail( String reason );", "static void return_not_carry(String passed){\n\t\tif(!CS)\n\t\t\tcomplete_return_requirements();\n\t}", "public boolean hasError();", "@Test\r\n\tvoid testImportSingleRowShouldReturnFalseIfUnsuccessful() {\r\n\t\tRecordParser parser = new RecordParser();\r\n\t\tassertFalse(parser.importSingleRecord(\"This is a row of bad data. There's too much and nothing useful!\"));\r\n\t}", "public static void failUnexpectedToReachThis()\r\n\t{\r\n\t\tfail( \"Unexpected to hit this line, as the previous statement should thrown an exception\" ); \r\n\t}", "public boolean hasResult()\n/* */ {\n/* 119 */ return this.result != RESULT_NONE;\n/* */ }", "String failureReason();", "@Test\n\tpublic void test_returnBooleanFoo_false() {\n\t}", "public boolean test() throws Exception {\n throw new Exception(\"Test funcationality not yet implemented: unclear API\");\n }", "static void return_when_zero(String passed){\n\t\tif(Z)\n\t\t\tcomplete_return_requirements();\n\t}", "public void fail(boolean hcf);", "boolean isError();", "public boolean isFailure( ) {\n\t\treturn failed;\n\t}", "public boolean isCheckable() {\n/* 738 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "abstract int pregnancy();", "@Test\n void fail_the_test() {\n }", "@Test(timeout = 500)\n\tpublic void testGetModuloOne() {\n\t\tAssert.fail();\n\t}", "boolean isBadCommunication();", "public ParseResult failure (Object input) {\n return failure(input, 1);\n }", "void notSupported(String errorcode);", "public static boolean isOK() {return isOK;}", "public void testNoMadeCommunication() {\n\t\t// Arrange\n\t\tString exceptionNumber = null;\n\t\tPhoneNumberDTO dto = new PhoneNumberDTO(EXISTING_NUMBER);\n\t\tGetLastMadeCommunicationService service\n\t\t\t= new GetLastMadeCommunicationService(dto);\n\t\t\n\t\t// Act\n\t\ttry {\n\t\t\tservice.execute();\n\t\t\tfail(\"Should have thrown NoMadeCommunication\");\n\t\t} catch(NoMadeCommunication nmc) {\n\t\t\texceptionNumber = nmc.getNumber();\n\t\t}\n\t\t\n\t\t// Assert\n\t\tassertEquals(\"The phone number in the exception should be \"\n\t\t\t\t+ EXISTING_NUMBER + \" but it was \" + exceptionNumber,\n\t\t\t\tEXISTING_NUMBER, exceptionNumber);\n\t}", "@Override\n\tpublic void fail(Handle msg) {\n\t\t\n\t}", "void checkReturnSt (int ln) {\r\n if (!return_type.isVoid ())\r\n OzcError.needReturnSt (ln);\r\n else \r\n need_return = true;\r\n }", "public int describeContents() {\n/* 1781 */ throw new RuntimeException(\"Stub!\");\n/* */ }" ]
[ "0.7106674", "0.7016902", "0.70101345", "0.70043266", "0.6755166", "0.6563591", "0.65042853", "0.64964217", "0.6443713", "0.639487", "0.6383219", "0.6361692", "0.6309689", "0.6302902", "0.6223239", "0.62038815", "0.61624336", "0.61477894", "0.6137916", "0.6121422", "0.60980904", "0.60775125", "0.6075287", "0.60678774", "0.60508263", "0.6042991", "0.6031307", "0.60063404", "0.60033846", "0.60030025", "0.5997585", "0.5996528", "0.59953654", "0.5994294", "0.5994294", "0.59823465", "0.5971572", "0.59631467", "0.5919684", "0.5919684", "0.5919684", "0.59106714", "0.5901252", "0.5901111", "0.58879066", "0.58872247", "0.58796924", "0.58736897", "0.58449614", "0.58345354", "0.58329785", "0.58329785", "0.58329785", "0.58329785", "0.58329785", "0.58329785", "0.58329785", "0.58329785", "0.58329785", "0.58329785", "0.58329785", "0.58329785", "0.5830834", "0.58105063", "0.5802624", "0.57971567", "0.5793442", "0.5780647", "0.5780647", "0.5776181", "0.5776181", "0.5776181", "0.5770277", "0.5764173", "0.57584417", "0.5755386", "0.57484585", "0.574098", "0.57310855", "0.57171816", "0.5716286", "0.5715007", "0.5712532", "0.57097316", "0.5705011", "0.57041585", "0.5702408", "0.5699892", "0.5695318", "0.56915456", "0.5688504", "0.5672676", "0.5668244", "0.56651545", "0.56585467", "0.5656002", "0.56503844", "0.56502354", "0.56479335", "0.56460446", "0.5636444" ]
0.0
-1
Constructor for node that sets all the data.
public Node(String data, Node next, Node prev) { this.data = data; this.next = next; this.prev = prev; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private Node( T data_ )\n {\n data = data_;\n parent = this;\n }", "public Node(T data) {this.data = data;}", "public Node(Object data) {\n\t\t\tthis.data = data;\n\t\t}", "public Node(T data) {\n this(data, null, null, null);\n }", "public Node(){\n\n\t\t}", "public Node(T data) {\r\n this.data = data;\r\n }", "protected Node(T dataPortion) {\n data = dataPortion;\n next = null;\n }", "public Node(T data) {\n\n this.data = data;\n\n\n }", "public Node(T data){\n this.data = data;\n }", "public Node(E data) {\r\n\t\tthis.data = data;\r\n\t}", "Node(T data) {\n\t\t\tthis(data, null);\n\t\t}", "Node(){\r\n\t\tdata = null;\r\n\t\tnext = null;\r\n\t}", "public Node()\r\n {\r\n initialize(null);\r\n lbl = id;\r\n }", "public SNode(T data) {\n this(data, null);\n }", "private Node(Object dataPortion) {\n\t\t\tdata = dataPortion;\n\t\t\tnext = null;\n\t\t}", "private Node(E dataItem)\n {\n data = dataItem;\n next = null;\n }", "public Node(E data) {\n this.data = data;\n }", "Node(String d) {\n data = d;\n }", "public Node(){\n this(9);\n }", "private Node() {\n\n }", "public Node()\n\t{\n\t\toriginalValue = sumValue = 0;\n\t\tparent = -1;\n\t}", "public Node(){}", "public Node() {\n }", "public Node() {\r\n\t}", "public Node() {\r\n\t}", "Node(){\n\t\t\tthis.array = new Node[256];\n\t\t\tthis.val = null;\n\t\t}", "public Node() {}", "public Node() {}", "public Node() {}", "public Node() {}", "public Node(T data) {\n\t\t\tthis.data = data;\n\t\t\tthis.nextNode = null;\n\t\t}", "protected NodeProperties() {\r\n }", "public CassandraNode() {\r\n\t\tthis(null, 0);\r\n\t}", "public Node() {\n\t}", "Node(T data)\n\t{\n\t\tthis.data=data;\n\t\tthis.next=null;\n\t}", "public TreeNode(T nodeData){\n data = nodeData;\n leftNode = rightNode = null;\n }", "public Node(T theData) \n\t{\n\t\tthis.data = theData;\n\t\tthis.next = null;\n\t}", "@Override\r\n\tprotected void initSelfData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initSelfData() {\n\t\t\r\n\t}", "public Node(int data) { // Just data in constructor would suffice, clients wont pass next anyways\n this.data = data;\n }", "public Node(Node<D> n) {\n\t\tdata = n.getData();\n\t\tnext = n.getNext();\n\t}", "public Node() {\n portnum = 0;\n senders = new Hashtable<String, Sender>();\n }", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "public GraphNode(D data) {\n successors = new ArrayList<>();\n this.data = data;\n }", "@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}", "protected GraphNode() {\n }", "protected GraphNode() {\n }", "public Node(){\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\n\tpublic void initData() {\n\n\t}", "@Override\n\tpublic void initData() {\n\n\t}", "@Override\n\tpublic void initData() {\n\n\t}", "@Override\n\tpublic void initData() {\n\t\t\n\t}", "@Override\n protected void initData() {\n }", "@Override\n protected void initData() {\n }", "@Override\n\tpublic void initData() {\n\n\n\n\t}", "public DataNodeTable() {\r\n\t\tnodeMap = new HashMap<String, NodeRef>();\r\n\t}", "private void init() {\n myNodeDetails = new NodeDetails();\n try {\n //port will store value of port used for connection\n //eg: port = 5554*2 = 11108\n String port = String.valueOf(Integer.parseInt(getMyNodeId()) * 2);\n //nodeIdHash will store hash of nodeId =>\n // eg: nodeIdHash = hashgen(5554)\n String nodeIdHash = genHash(getMyNodeId());\n myNodeDetails.setPort(port);\n myNodeDetails.setNodeIdHash(nodeIdHash);\n myNodeDetails.setPredecessorPort(port);\n myNodeDetails.setSuccessorPort(port);\n myNodeDetails.setSuccessorNodeIdHash(nodeIdHash);\n myNodeDetails.setPredecessorNodeIdHash(nodeIdHash);\n myNodeDetails.setFirstNode(true);\n\n if (getMyNodeId().equalsIgnoreCase(masterPort)) {\n chordNodeList = new ArrayList<NodeDetails>();\n chordNodeList.add(myNodeDetails);\n }\n\n } catch (Exception e) {\n Log.e(TAG,\"**************************Exception in init()**********************\");\n e.printStackTrace();\n }\n }", "public Node() {\n\t\tdata = null;\n\t\tnext = null;\n\t\tprevious = null;\n\t}", "public NetworkData() {\n }", "public Node() {\n\n }", "@Override\r\n\tpublic void initData() {\n\t}", "@SuppressWarnings(\"unused\")\n public Node(Object dataValue, Node nextValue) \n {\n next = nextValue;\n data = dataValue;\n }", "public Data() {}", "public Node(int data) {\n this.data = data;\n }", "public Node()\r\n\t{\r\n\t\tnext = null;\r\n\t\tinfo = 0;\r\n\t}", "public DataSet() {\n labels = new HashMap<>();\n locations = new HashMap<>();\n counter= new AtomicInteger(0);\n }", "private Node(E data) {\n this.data = data;\n previous = null;\n next = null;\n }", "public NetworkNode(Node treeNode) {\n height = treeNode.getHeight();\n label = treeNode.getID();\n metaDataString = treeNode.metaDataString;\n for (String metaDataKey: treeNode.getMetaDataNames()) {\n Object metaDataValue = treeNode.getMetaData(metaDataKey);\n metaData.put(metaDataKey, metaDataValue);\n }\n }", "public Node(Node< ? > node)\n {\n id = node.getId();\n name = node.getName();\n idVirtualAppliance = node.getIdVirtualAppliance();\n nodeType = node.getNodeType();\n posX = node.getPosX();\n posY = node.getPosY();\n modified = node.getModified();\n }", "public abstract void setNodes();", "public Node(int data) {\n\t\tthis.data = data;\n\t}", "public NodeInfo() {\n }", "public Node() \r\n\t{\r\n\t\tincludedNode = new ArrayList<Node>();\r\n\t\tin = false; \r\n\t\tout = false;\r\n\t}", "public Graph()\r\n {\r\n this( \"x\", \"y\" );\r\n }", "public Node() {\r\n\t\tthis.input = null;\r\n\t\tthis.inputWeights = null;\r\n\t}", "public TreeNode()\r\n\t\t{\r\n\t\t\thead = null; //no data so set head to null\r\n\t\t}", "public Node()\n {\n\t this.data = 0;\n\t this.prev = null;\n\t this.next = null;\n }", "@Override\n\tprotected void initData(){\n\t\tsuper.initData();\n\t}", "public Node(E data){\n\t\t\tnext = null;\n\t\t\tthis.data = data;\n\t\t}", "public Node(int data) {\n payload = data;\n priority = 0;\n }", "private Noder(E data) {\n this.data = data;\n }", "@Override\n\tprotected void initdata() {\n\n\t}", "private Node(T value) {\n\t\t\tthis.value = value;\n\t\t}", "public Node() {\n name = null;\n missionDescription = null;\n roles = null;\n stateValueBindings = null;\n nodeRuntime = null;\n isNetworkSingleton = false;\n }", "public InitialData(){}", "Node()\r\n { // constructor for head Node \r\n prev = this;\r\n next = this;\r\n trafficEntry = new TrafficEntry();\r\n }", "private void initData() {\n\t}", "public Node()\n {\n this.name=\"/\";\n this.type=0;\n this.stage=0;\n children=new ArrayList<Node>();\n }", "public Node(E data, Node<E> link) {\r\n\t\tthis.data = data;\r\n\t\tthis.link = link;\r\n\t\tthis.counter = 0;\r\n\t}", "public DancingNode()\n {\n L=R=U=D=this;\n }", "public AllOOneDataStructure() {\n\t\thead=new Node(\"\", 0);\n\t\ttail=new Node(\"\", 0);\n\t\thead.next=tail;\n\t\ttail.prev=head;\n\t\tmap=new HashMap<>();\n\t}", "public Node() {\n this.nodeMap = new HashMap<>();\n }", "TreeNode (T data) {\n\t\tthis(data, null, null, null, null);\n\t}", "public DataSet(){\r\n\t\tdocs = Lists.newArrayList();\r\n//\t\t_docs = Lists.newArrayList();\r\n\t\t\r\n\t\tnewId2trnId = HashBiMap.create();\r\n\t\t\r\n\t\tM = 0;\r\n\t\tV = 0;\r\n\t}" ]
[ "0.72843635", "0.71100765", "0.70307475", "0.7018912", "0.6928194", "0.69191253", "0.6915738", "0.6889563", "0.6880367", "0.68614393", "0.6851548", "0.6804839", "0.67967", "0.6785931", "0.6774557", "0.67672604", "0.67603403", "0.67271364", "0.66946244", "0.66853493", "0.6670609", "0.6635965", "0.66253906", "0.6612473", "0.6612473", "0.6595797", "0.65851635", "0.65851635", "0.65851635", "0.65851635", "0.65568656", "0.6545096", "0.65444416", "0.6520171", "0.65141857", "0.65127516", "0.6510836", "0.6496745", "0.6496745", "0.6494315", "0.6489548", "0.6462449", "0.645288", "0.645288", "0.6441902", "0.64363104", "0.64363104", "0.64363104", "0.64363104", "0.64363104", "0.64363104", "0.64303", "0.64303", "0.64292", "0.64284754", "0.6416145", "0.6416145", "0.6416145", "0.64088905", "0.640395", "0.640395", "0.63960385", "0.63914925", "0.6391446", "0.63886094", "0.63865936", "0.6373419", "0.6355621", "0.6353891", "0.6352255", "0.6342825", "0.6340922", "0.63313425", "0.6325905", "0.63160974", "0.630428", "0.630256", "0.6300973", "0.6299569", "0.6288901", "0.62888515", "0.62881047", "0.6286405", "0.62850356", "0.62848127", "0.6284624", "0.62831557", "0.6265418", "0.62643486", "0.62545836", "0.6243538", "0.6237906", "0.6229745", "0.6223927", "0.6219355", "0.62180173", "0.6211514", "0.62110186", "0.6210609", "0.6204933", "0.62040496" ]
0.0
-1
Getter for next node.
public Node getNext() { return next; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Node getNext() { return next; }", "public DNode getNext() { return next; }", "public node getNext() {\n\t\t\treturn next;\n\t\t}", "public Node<E> getNext() { return next; }", "public Node getNextNode() {\n return nextNode;\n }", "public LLNode<T> getNext() {\n return next;\n }", "Node<T> getNext() {\n\t\t\treturn nextNode;\n\t\t}", "public Node getNext() {\r\n\t\treturn next;\r\n\t}", "public Node getNext(){\n\t\treturn next;\n\t}", "public Node getNext() {\n\t\treturn next;\n\t}", "public Node getNext() {\n return next;\n }", "public Node getNext()\r\n\t{\r\n\t\treturn next;\r\n\t}", "public Node getNext()\r\n\t{\r\n\t\treturn next;\r\n\t}", "public Node<E> getNext() {\r\n\t\treturn next;\r\n\t}", "public Node getNext()\n\t{\n\t\treturn next;\n\t}", "public Node getNext()\n\t{\n\t\treturn next;\n\t}", "public Node getNext(){\n\t\t\treturn next;\n\t\t}", "public Node getNext()\n {\n return this.next;\n }", "public Node<T> getNext() {\n\t\treturn next;\n\t}", "public Node getNext() {\n\t\treturn this.next;\n\t}", "public LinkedNode<T> getNext() {\n\t return myNextNode;\n }", "public Node<T> getNext()\n\t{\treturn this.next; }", "public LinearNode<T> getNext() {\r\n\t\t\r\n\t\treturn next;\r\n\t\r\n\t}", "public MyNode<? super E> getNext()\n\t{\n\t\treturn this.next;\n\t}", "public SlideNode getNext() {\n\t\treturn next;\n\t}", "public Node<T> getNextNode() {\n\t\treturn nextNode;\n\t}", "public Node<D> getNext(){\n\t\treturn next;\n\t}", "public Node<S> getNext() { return next; }", "protected final Node<N> getNext() {\n return this.next;\n }", "public SimpleNode getNext() {\n return next;\n }", "public Node<E> nextNode() {\n\t\treturn next_node;\n\t}", "public Node<T> getNext() {\n return this.next;\n }", "public GameNode getNext() {\n return this.next;\n }", "public Nodo getnext ()\n\t\t{\n\t\t\treturn next;\n\t\t\t\n\t\t}", "public ListNode<E> getNext()\n {\n return nextNode;\n }", "public ElectionNode getNextNode() {\r\n return nextNode;\r\n }", "public Node getNext() {\t\t//O(1)\n\t\treturn next;\n\t}", "public Node<T> next() {\r\n return next;\r\n }", "public ListNode getNext()\r\n {\r\n return next;\r\n }", "public ListNode<Item> getNext() {\n return this.next;\n }", "@Override\n\t\tpublic Node next() {\n\t\t\tif (this.next == null) {\n\t\t\t\treturn null;\n\t\t\t} else {\n\t\t\t\tNode element = this.next;\n\t\t\t\tthis.next = (Node) this.next.getNextNode();\n\t\t\t\treturn (Node) element;\n\t\t\t}\n\t\t}", "public DoublyLinkedNode<E> getNext() {\n return nextNode;\n }", "public SortedLinkedListNode getNext() {\n return next;\n }", "public E next(){\r\n E data = node.getData();\r\n node = node.getNext();\r\n return data;\r\n }", "public ListElement getNext()\n\t {\n\t return this.next;\n\t }", "public DoubleNode<T> getNext()\n {\n\n return next;\n }", "public ListElement<T> getNext()\n\t{\n\t\treturn next;\n\t}", "public ShapeNode getNext()\n {\n return next;\n }", "public ListNode<T> getNext();", "public Variable getNext(){\n\t\treturn this.next;\n\t}", "@Override\n public Node next() {\n if (next == null) {\n throw new NoSuchElementException();\n }\n Node current = next;\n next = next.getNextSibling();\n return current;\n }", "public ObjectListNode getNext() {\n return next;\n }", "private Object getNextElement()\n {\n return __m_NextElement;\n }", "public HL7DataTree next() {\n final int size = Util.size(this.list), i = this.next == null ? size : this.list.indexOf(this.next) + 1;\n final HL7DataTree curr = this.next;\n \n this.next = i == size ? more() : this.list.get(i);\n \n return curr;\n }", "public ListNode<V> next()\n\t\t{\n\t\t\treturn _next;\n\t\t}", "public Cell getNext()\n { return next; }", "ListNode getNext() { /* package access */ \n\t\treturn next;\n\t}", "public T next()\r\n { \r\n if (next == null)\r\n throw new NoSuchElementException(\"Attempt to\" +\r\n \" call next when there's no next element.\");\r\n\r\n prev = next;\r\n next = next.next;\r\n return prev.data;\r\n }", "public IDLink<T> getNext(){\n \treturn npointer;\n }", "@Override\r\n\t\tpublic T next() {\r\n\t\t\tNode<T> temp = currentNode;\r\n\t\t\tcurrentNode = currentNode.nextNode;\r\n\t\t\treturn temp.content;\r\n\t\t}", "public Vertex getNext() {\n\t\treturn next;\n\t}", "public com.Node<T> getNextRef() {\n\t\treturn null;\n\t}", "@Override \r\n\tpublic LLNode<T> next() throws NoSuchElementException{\r\n\t\tLLNode<T> node = nodeptr;\r\n\t\tif (nodeptr == null)\r\n\t\t\tthrow new NoSuchElementException();\r\n\t\tnodeptr = nodeptr.getNext();\r\n\t\treturn node;\r\n\t}", "@Override\r\n\tpublic String next() {\n\t\tString nx;\r\n\r\n\t\tnx = p.getNext();\r\n\r\n\t\tif (nx != null) {\r\n\t\t\tthisNext = true;\r\n\t\t\tinput(nx);\r\n\t\t}\r\n\t\treturn nx;\r\n\t}", "public CommitNode getNext(){\r\n\t\treturn next;\r\n\t}", "public Content getNavLinkNext() {\n Content li;\n if (next != null) {\n Content nextLink = getLink(new LinkInfoImpl(configuration,\n LinkInfoImpl.Kind.CLASS, next)\n .label(nextclassLabel).strong(true));\n li = HtmlTree.LI(nextLink);\n }\n else\n li = HtmlTree.LI(nextclassLabel);\n return li;\n }", "public E next() {\r\n\r\n\t\tE result = null;\r\n\t\tif (hasNext()) {\r\n\t\t\tresult = links.get(counter);\r\n\t\t\tcounter++;\r\n\t\t}\r\n\t\treturn result;\r\n\t}", "int getNext(int node_index) {\n\t\treturn m_list_nodes.getField(node_index, 2);\n\t}", "public String nextLink() {\n return this.nextLink;\n }", "public String nextLink() {\n return this.nextLink;\n }", "public String nextLink() {\n return this.nextLink;\n }", "public String nextLink() {\n return this.nextLink;\n }", "public Level getNext() {\n\t\treturn next;\n\t}", "public E next()\r\n {\r\n E valueToReturn;\r\n\r\n if (!hasNext())\r\n throw new NoSuchElementException(\"The lister is empty\");\r\n \r\n // get the string from the node\r\n valueToReturn = cursor.getData();\r\n \r\n // advance the cursor to the next node\r\n cursor = cursor.getLink();\r\n \r\n return valueToReturn;\r\n }", "public T next() {\n T temp = this.curr.next.getData();\n this.curr = this.curr.next;\n return temp;\n }", "public Object getNext() {\n\t\tif (current != null) {\n\t\t\tcurrent = current.next; // Get the reference to the next item\n\t\t}\n\t\treturn current == null ? null : current.item;\n\t}", "public final Node<N> next() {\n final Node<N> sink = this.next;\n this.prepareNext();\n return sink;\n }", "public T next() {\n T temp = this.curr.getData();\n this.curr = this.curr.getNext();\n return temp;\n }", "public Element<T> getNextElement() \n\t{\n\t\treturn nextElement;\n\t}", "public Tile getNext(){\n\t\treturn this.next;\n\t}", "public T next()\n {\n T data = current.item;\n current = current.next;\n return data;\n }", "public E getNext() {\n\t\tif (!super.isEmpty()) {\n\t\t\tif (index >= this.size() - 1)\n\t\t\t\tindex = -1;\n\t\t\treturn this.get(++index);\n\t\t}\n\t\treturn null;\n\t}", "public DependencyElement next() {\n\t\treturn next;\n\t}", "public DListNode2 next(){\r\n return this.next;\r\n }", "public T next()\n\t\t{\n\t\t\tif(hasNext())\n\t\t\t{\n\t\t\t\tT currentData = current.getData(); //the data that will be returned\n\t\t\t\t\n\t\t\t\t// must continue to keep track of the Node that is in front of\n\t\t\t\t// the current Node whose data is must being returned , in case\n\t\t\t\t// its nextNode must be reset to skip the Node whose data is\n\t\t\t\t// just being returned\n\t\t\t\tbeforePrevious = previous;\n\t\t\t\t\n\t\t\t\t// must continue keep track of the Node that is referencing the\n\t\t\t\t// data that was just returned in case the user wishes to remove()\n\t\t\t\t// the data that was just returned\n\t\t\t\t\n\t\t\t\tprevious = current; // get ready to point to the Node with the next data value\n\t\t\t\t\n\t\t\t\tcurrent = current.getNext(); // move to next Node in the chain, get ready to point to the next data item in the list\n\t\t\t\t\n\t\t\t\tthis.removeCalled = false;\n\t\t\t\t// it's now pointing to next value in the list which is not the one that may have been removed\n\t\t\t\t\n\t\t\t\treturn currentData;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\t}\n\t\t}", "public NodeT getNext() {\n String nextItemKey = queue.poll();\n if (nextItemKey == null) {\n return null;\n }\n return nodeTable.get(nextItemKey);\n }", "public E next() \n {\n \tfor(int i = 0; i < size; i++)\n \t\tif(tree[i].order == next) {\n \t\t\tnext++;\n \t\t\ttree[i].position = i;\n \t\t\treturn tree[i].element;\n \t\t}\n \treturn null;\n }", "public Wagon<T> getNext() {\n\t\treturn next;\n\t}", "public String getNextLink() {\n return this.nextLink;\n }", "public MapElement getNext() {\n return next;\n }", "public long next() {\n long ret = prev;\n prev = current;\n current = ret + current;\n return ret;\n }", "public T getNextElement();", "Entry getNext()\n {\n return (Entry) m_eNext;\n }", "@Override\n public T next() {\n current = current.next;\n return current.data;\n }", "@Override\n\t\tpublic int next() {\n\t\t\treturn current++;\n\t\t}", "public BSCObject next()\n {\n if (ready_for_fetch)\n {\n // the next sibling is waiting to be returned, so just return it\n ready_for_fetch = false;\n return sibling;\n }\n else if (hasNext())\n {\n // make sure there is a next sibling; if so, return it\n ready_for_fetch = false;\n return sibling;\n }\n else\n throw new NoSuchElementException();\n }", "@Override\n public NodoL next() {\n posicionActual = posicionActual.getSiguiente();\n return posicionActual;\n }", "public E next() {\r\n current++;\r\n return elem[current];\r\n }", "@Override\n public Integer next() {\n if (next != null) {\n Integer next = this.next;\n this.next = null;\n return next;\n\n }\n\n return iterator.next();\n }", "public int next() {\n\treturn _current < _last ? _data[_current++] : END;\n }" ]
[ "0.8390598", "0.8321453", "0.8295639", "0.8260686", "0.82429385", "0.82372594", "0.8223965", "0.82182163", "0.8214762", "0.8214731", "0.82101434", "0.8208476", "0.8208476", "0.8190305", "0.817502", "0.817502", "0.8141064", "0.8135736", "0.8122429", "0.811924", "0.8094795", "0.80769974", "0.8075909", "0.80727464", "0.8070486", "0.80521405", "0.8036157", "0.8016997", "0.8001658", "0.7992408", "0.7990325", "0.79886377", "0.7931066", "0.7922693", "0.7906811", "0.79061216", "0.7888269", "0.7874438", "0.7843025", "0.77553904", "0.77516794", "0.7739773", "0.77268374", "0.7664617", "0.76469874", "0.76212406", "0.7595191", "0.75519574", "0.75395656", "0.7526409", "0.7494091", "0.74838984", "0.7473665", "0.7419946", "0.7413642", "0.7368608", "0.73598653", "0.7349357", "0.73349327", "0.72960705", "0.7270901", "0.72558886", "0.7255823", "0.7251289", "0.7208498", "0.7205458", "0.71914274", "0.71531343", "0.7114892", "0.7114892", "0.7114892", "0.7114892", "0.70999444", "0.70887387", "0.70803946", "0.707626", "0.7072418", "0.70623344", "0.7029418", "0.7025452", "0.70169955", "0.70046693", "0.6985793", "0.69760275", "0.69748193", "0.69669765", "0.69400936", "0.6924258", "0.69198173", "0.69153196", "0.6892669", "0.687826", "0.68778723", "0.6863519", "0.68410015", "0.6836044", "0.6833091", "0.6832201", "0.6830726", "0.6821057" ]
0.82168937
8
Setter for next node.
public void setNext(Node next) { this.next = next; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setNext(Node<E> next) { this.next = next; }", "public void setNext(Node n) { next = n; }", "public void setNext(Node next){\n\t\tthis.next = next;\n\t}", "public void setNextNode(Node nextNode) {\n this.nextNode = nextNode;\n }", "public void setNextNode(Node<T> next) {\n itsNext = next;\n }", "public void setNext(Node<T> next) {\n this.next = next;\n }", "public void setNextNode(Node<T> nextNode) {\n\t\tthis.nextNode = nextNode;\n\t}", "public void setNext(Node<T> next) {\r\n this.next = next;\r\n }", "public void setNext(Node<T> next) {\n\t\tthis.next = next;\n\t}", "public void setNext(Node next) {\n\t\tthis.next = next;\n\t}", "public Node setNextNode(Node node);", "public void setNext(Node next)\r\n\t{\r\n\t\tthis.next = next;\r\n\t}", "public void setNext(Node next)\n\t{\n\t\tthis.next = next;\n\t}", "public void setNext(MyNode<? super E> _next)\n\t{\n\t\tthis.next = _next;\n\t\t//this.next = _next;\n\t}", "public void setNext(DNode newNext) { next = newNext; }", "public void setNext(Node n) {\n next = n;\n }", "private void setNext(Node n) {\n\t\t\tnext = n;\n\t\t}", "public void setNext(SimpleNode next) {\n this.next = next;\n }", "public void setNext(LLNode<T> next) {\n this.next = next;\n }", "public void setNext(GameNode next) {\n this.next = next;\n }", "public void setNext(Node<D> n){\n\t\tnext = n;\n\t}", "public void setNext(Variable next){\n\t\tthis.next = next;\n\t}", "public void setNext(ListNode<E> next)\n {\n nextNode = next;\n }", "public void setNext(Node n)\r\n\t{\r\n\t\tnext = n;\r\n\t}", "public void setNext(ListElement<T> next)\n\t{\n\t\tthis.next = next;\n\t}", "void setNext(Cell next) {\n if (this.next == null) {\n this.next = next;\n }\n }", "public void setNext(LinearNode<T> node) {\r\n\t\t\r\n\t\tnext = node;\r\n\t\t\r\n\t}", "public void setNext(ListNode<Item> next) {\n this.next = next;\n }", "@Override public void setNextNode(BTreeNode nextNode) {\n // no required in case of non leaf node\n }", "public void setNext(Node newNode){\n\t\t\tnext = newNode;\n\t\t}", "public void setNextNode(Node newnext)\n {\n next = newnext;\n }", "public void setNext(ListNode next)\r\n {\r\n this.next = next;\r\n }", "public void setNext(DoublyLinkedNode<E> next) {\n this.nextNode = next;\n }", "public void setNext(final LinkedNode<T> theNode) {\n\t myNextNode = theNode;\n }", "public void setNext(ListElement next)\n\n\t {\n\t this.next = next;\n\t }", "public void setNext(Level next) {\n\t\tthis.next = next;\n\t}", "public void setNext(Cell link)\n { next = link; }", "public void setNextNode(ElectionNode nextNode) {\r\n this.nextNode = nextNode;\r\n }", "public void setNext(SlideNode node) {\n\t\tthis.next = node;\n\t}", "public void setNext(Vertex next) {\n\t\tthis.next = next;\n\t}", "public void setNext(Node n)\n {\n n.prev = this.next.prev;\n n.next = this.next;\n this.next.prev = n;\n this.next = n;\n }", "void setNext(HashNode newNext){\n\t\tnext = newNext; \n\t}", "public void setNext(ObjectListNode p) {\n next = p;\n }", "public void setNext(Node<T> another)\n\t{\tthis.next = another; }", "public void setNext()\n {\n\t int currentIndex = AL.indexOf(currentObject);\n\t currentObject = AL.get(currentIndex +1);\n\t \n\t// never let currentNode be null, wrap to head\n\tif (currentObject == null)\n\t\tcurrentObject = firstObject;\n }", "public void setNext(Tile next){\n\t\tthis.next=next;\n\t}", "public void setNext(DoubleNode<T> node)\n {\n\n next = node;\n }", "public void setNext(Linkable nextObject);", "public void setNext(SortedLinkedListNode pNode) {\n next = pNode;\n }", "public void setNext(CommitNode x){\r\n\t\tnext = x;\r\n\t}", "public void setNextCell(Cell next)\r\n {\r\n this.next = next;\r\n }", "void setNext(MapElement next) {\n this.next = next;\n }", "public void setNext(DependencyElement next) {\n\t\tthis.next = next;\n\t}", "void setNext (ListNode newNext) { /* package access */ \n\t\tnext = newNext;\n\t}", "public void setNextElement(Element<T> nextElement) \n\t{\n\t\tthis.nextElement = nextElement;\n\t}", "public void setNext(ListEntry next) {\n if (next != null)\n this.next = next;\n else\n this.next = null;\n }", "public void setNext(DListNode2 next1){\r\n this.next = next1;\r\n }", "public boolean setNext (\n\t\t\tfinal ListNode<V> next)\n\t\t{\n\t\t\t_next = next;\n\t\t\treturn true;\n\t\t}", "@SuppressWarnings({ \"unchecked\", \"rawtypes\" })\n\t\tprivate void setNext(k key, v value) {\n\t\t\tnext = new Node (key, value, null);\n\t\t}", "@Override\n public void setNextElement(helpDesk next) {\n this.next = next;\n }", "public void setNext(IDLink<T> c){\n \tnpointer = c;\n }", "public void setNext(Version next){\n\t\tif (next == null){\n\t\t\tLog.e(NAME, \"Invalid parameters for 'setNext' method!\");\n\t\t\treturn;\n\t\t}\n\t\tthis.next = next;\n\t}", "void setNextValue() {\n this.value = this.value * 2;\n }", "public void setNextValue(final String nextValue);", "void setNext(Entry entry)\n {\n m_eNext = entry;\n }", "public void setNode(SubscriptionYear next) {\n\t\tthis.next = next;\n\t}", "public DNode getNext() { return next; }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }", "public boolean SetNext(List v_next){\n\tnext = v_next ;\n\treturn true ;\n }" ]
[ "0.8342445", "0.8319406", "0.826054", "0.81856114", "0.8183229", "0.81703496", "0.81660825", "0.81629014", "0.81414485", "0.81235063", "0.8085059", "0.80717313", "0.8061669", "0.80172503", "0.79935217", "0.79841757", "0.7953313", "0.79465", "0.79315907", "0.79232574", "0.79077584", "0.7880318", "0.7808821", "0.7779834", "0.7776748", "0.7761199", "0.77526945", "0.7749578", "0.7714468", "0.76871014", "0.76702213", "0.7668877", "0.7644708", "0.76396155", "0.76227933", "0.76063526", "0.7594107", "0.75740284", "0.7548163", "0.7536713", "0.75215495", "0.75207996", "0.75040793", "0.74999297", "0.74955165", "0.7459127", "0.745346", "0.7420641", "0.741862", "0.74102026", "0.74065614", "0.73541313", "0.7292481", "0.7279583", "0.7225338", "0.7212068", "0.71561646", "0.7130578", "0.7126752", "0.7112918", "0.70729524", "0.70700103", "0.6947927", "0.6941373", "0.6935391", "0.6926124", "0.69062257", "0.6870866", "0.6870866", "0.6870866", "0.6870866", "0.6870866", "0.6870866", "0.6870866", "0.6870866", "0.6870866", "0.6870866", "0.6870866", "0.6870866", "0.6870866", "0.6870866", "0.6870866", "0.6870866", "0.6870866", "0.6870866", "0.6870866", "0.6870866", "0.6870866", "0.6870866", "0.6870866", "0.6870866", "0.6870866", "0.6870651", "0.6870651", "0.6870651", "0.6870651", "0.6870651", "0.6870651", "0.6870651", "0.6870651" ]
0.8170205
6
Getter for Previous node in the list.
public Node getPrev() { return prev; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public node getPrevious() {\n\t\t\treturn previous;\n\t\t}", "public Node getPrevious() {\n return previous;\n }", "public Node getPrev()\r\n\t{\r\n\t\treturn prev;\r\n\t}", "public Node getPrev()\n {\n return this.prev;\n }", "public DoublyLinkedNode<E> getPrevious() {\n return prevNode;\n }", "public int getPrevNode() {\n\t\treturn this.previousNode;\n\t}", "public Node<T> getPrev() {\n\t\treturn prev;\n\t}", "public Node<T> getPrevNode() {\n\t\treturn prevNode;\n\t}", "public MyNode<? super E> getPrevious()\n\t{\n\t\treturn this.previous;\n\t}", "public ListElement getPrevious()\n\t {\n\t return this.previous;\n\t }", "public Node getPrev() {\n return null;\n }", "public Node<S> getPrev() { return prev; }", "public DSAGraphNode<E> getPrevious()\n {\n return previous;\n }", "public DNode getPrev() { return prev; }", "public Node<T> previous() {\r\n return previous;\r\n }", "public ListElement<T> getPrev()\n\t{\n\t\treturn prev;\n\t}", "public SlideNode getPrev() {\n\t\treturn prev;\n\t}", "public AStarNode getPrevious() {\n return previous;\n }", "public DoubleNode<T> getPrevious()\n {\n\n return previous;\n }", "public Object getPrev() {\n\t\tif (current != null) {\n\t\t\tcurrent = current.prev;\n\t\t} else {\n\t\t\tcurrent = start;\n\t\t}\n\t\treturn current == null ? null : current.item; //Ha nincs még start, akkor null adjon vissza\n\t}", "public E previous(){\n\t\t\tE e = tail.element;\n\t\t\tcurrent = current.next;\n\t\t\treturn e;\n\t\t}", "@Override\n public E previous() throws NoSuchElementException\n { \n if(hasPrevious() == false)\n {\n throw new NoSuchElementException();\n }\n idx = idx - 1;\n Node theNode = getNth(idx);\n left = left.prev;\n right = left;\n canRemove = false;\n forward = false;\n return theNode.getElement(); \n }", "int getPrev(int node_index) {\n\t\treturn m_list_nodes.getField(node_index, 1);\n\t}", "public Vertex getPrev() {\n return prev;\n }", "public DependencyElement previous() {\n\t\treturn prev;\n\t}", "public DListNode2 prev(){\r\n return this.prev;\r\n }", "@Override\n public E getPrevious() {\n if (isCurrent() && prev != null) { return prev.getData(); }\n else { throw new IllegalStateException(\"There is no previous element.\"); }\n }", "@Override\r\n\t\tpublic Node getPreviousSibling()\r\n\t\t\t{\n\t\t\t\treturn null;\r\n\t\t\t}", "public int getPrevious() {\n\t\treturn this.previous;\n\t}", "public TreeNode getPreviousSibling ()\r\n {\r\n if (parent != null) {\r\n int index = parent.children.indexOf(this);\r\n\r\n if (index > 0) {\r\n return parent.children.get(index - 1);\r\n }\r\n }\r\n\r\n return null;\r\n }", "public List getPrevList() {\n\t\treturn prevList;\n\t}", "@Override\n\tpublic Node getPreviousSibling() {\n\t\treturn null;\n\t}", "public Content getNavLinkPrevious() {\n Content li;\n if (prev != null) {\n Content prevLink = getLink(new LinkInfoImpl(configuration,\n LinkInfoImpl.Kind.CLASS, prev)\n .label(prevclassLabel).strong(true));\n li = HtmlTree.LI(prevLink);\n }\n else\n li = HtmlTree.LI(prevclassLabel);\n return li;\n }", "@Override\r\n\t\tpublic E previous() {\n\t\t\tcaret = caret.prev();\r\n\t\t\tif (caret == null)\r\n\t\t\t\tthrow new NoSuchElementException();\r\n\t\t\tnextIndex--;\r\n\t\t\treturn caret.n.data[caret.idx];\r\n\t\t}", "public T previous()\n {\n // TODO: implement this method\n return null;\n }", "@Override\r\n\tpublic String prev() {\n\t\tString pre;\r\n\r\n\t\tpre = p.getPrev();\r\n\r\n\t\tif (pre != null) {\r\n\t\t\tthisPrevious = true;\r\n\t\t\tinput(pre);\r\n\t\t}\r\n\t\treturn pre;\r\n\t}", "@Override\r\n public int previousIndex() {\r\n if (previous == null) {\r\n return -1;\r\n }\r\n return previousIndex;\r\n }", "public E previous() {\r\n current--;\r\n return elem[current];\r\n }", "public void prev() {\r\n\t\tif (curr == head)\r\n\t\t\treturn; // No previous element\r\n\t\tLink<E> temp = head;\r\n\t\t// March down list until we find the previous element\r\n\t\twhile (temp.next() != curr)\r\n\t\t\ttemp = temp.next();\r\n\t\tcurr = temp;\r\n\t}", "HNode getPreviousSibling();", "public AbstractPathElement<V, E> getPrevPathElement()\r\n/* */ {\r\n/* 188 */ return this.prevPathElement;\r\n/* */ }", "private Token previous() {\n return tokens.get(current-1);\n }", "public E getPrevious() {\n\t\tif (!super.isEmpty()) {\n\t\t\tif (index <= 0)\n\t\t\t\tindex = this.size();\n\t\t\treturn this.get(--index);\n\t\t}\n\t\treturn null;\n\t}", "public ExtremeEntry previous() {\n\n\t\tsetLastReturned(getLastReturned().getPrevious());\n//\t\tnextIndex--;\n\t\tcheckForComodification();\n\t\treturn getLastReturned();\n\t}", "public Vertex getPrevious(){\n return previous;\n }", "public T prev() {\n cursor = ((Entry<T>) cursor).prev;\n ready = true;\n return cursor.element;\n }", "public Layer getPrevLayer() {\r\n\t\treturn this.prevLayer;\r\n\t}", "public E previousStep() {\r\n\t\tthis.current = this.values[Math.max(this.current.ordinal() - 1, 0)];\r\n\t\treturn this.current;\r\n\t}", "public PlayerPosition getPrevious() {\n\n\t\tswitch (this) {\n\t\t\tcase BOTTOM:\n\t\t\t\treturn RIGHT;\n\t\t\tcase LEFT:\n\t\t\t\treturn BOTTOM;\n\t\t\tcase TOP:\n\t\t\t\treturn LEFT;\n\t\t\tcase RIGHT:\n\t\t\t\treturn TOP;\n\t\t\tdefault:\n\t\t\t\t// must not happen\n\t\t\t\treturn null;\n\t\t}\n\t}", "public IDLink<T> getPrev(){\n \treturn ppointer;\n }", "String getPrevious();", "public NodeD getSelecPrev(){\n if (this.selec == this.head){\n return this.head;\n }else{\n this.selec = this.selec.getPrev();\n return selec;\n }\n }", "public static Player getPrevPlayer(){\n\t\tif(players.get(curr).getPnum()==1)\n\t\t\treturn players.get(players.size()-1);\n\t\telse return players.get(curr-1);\n\t}", "@Nonnull\n public Optional<ENTITY> previous()\n {\n currentItem = Optional.of(items.get(--index));\n update();\n return currentItem;\n }", "public Index previous() {\n return Index.valueOf(value - 1);\n }", "@JsonProperty(\"previous_sibling\")\n @ApiModelProperty(value = \"The previous dialog node.\")\n public String getPreviousSibling() {\n return previousSibling;\n }", "@Basic\n\tpublic String getPrevMove() {\n\t\treturn prev_move;\n\t}", "Optional<Node<UnderlyingData>> prevNode(Node<UnderlyingData> node);", "public Version getPrev(){\n\t\treturn prev;\n\t}", "public Node setPrevNode(Node node);", "public int previousIndex() {\r\n \treturn index - 1; \r\n }", "public Token getPreviousToken() {\n return previousToken;\n }", "public T previous() {\n\t\t\tif(hasPrevious()) {\n\t\t\t\tT temp = vector.elementAt(previousPosition);\n\t\t\t\tpreviousPosition++;\n\t\t\t\tnextPosition++;\n\t\t\t\treturn temp;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new NoSuchElementException();\n\t\t\t}\n\t\t}", "public Page getPrevPageObject() {\n return getPageObject(this.currentIndex.viewIndex - 1);\n }", "public Integer getPreviousValue() {\n return this.previousValue;\n }", "public K prev();", "public IndexRecord getIteratorPrev() {\n iter = (iter == 0 ? -1 : iter - 1);\n return (iter == -1 ? null : data[iter]);\n }", "public String getPreviousToken() {\n return previousToken;\n }", "protected JButton getPrevious()\n {\n return previous;\n }", "private Node locatePrevNode(K key) { \n\t\tNode p = null; \n\t\tNode current = first; \n\t\twhile (current != null && current.getData().getKey().compareTo(key) < 0) {\n\t\t\tp = current; \n\t\t\tcurrent = current.getNext(); \n\t\t}\n\t\treturn p; \n\t}", "public String getBackwardNode() {\r\n\t\ttry {\r\n\t\t\treturn path.getPreviousNode(procNode);\r\n\t\t} catch (Exception e) {return null; /* In case of an error!*/}\r\n\t}", "public T previous() {\r\n\t\t// aktu == null ist dann, wenn aktu einen schritt zuvor first war;\r\n\t\tif (aktu == null) {\r\n\t\t\treturn null;\r\n\t\t} else if (first.equals(aktu)) {\r\n\t\t\t// wir sind am Ende, deswegen setzen wir aktu auf null (für die\r\n\t\t\t// Abfrage oberhalb) und geben den ersten Wert zurück;\r\n\t\t\taktu = null;\r\n\t\t\treturn (T) first.getData();\r\n\t\t} else if (first.equals(aktu.getPrevious())) {\r\n\t\t\t// überprüft, ob der Knoten vor dem aktuellen der letzte ist, dass\r\n\t\t\t// hat den Grund, dass beim letzten die Methode .getPrevios eine\r\n\t\t\t// NullPointerException wirft;\r\n\t\t\taktu = first;\r\n\t\t\treturn (T) first.getNext().getData();\r\n\t\t} else {\r\n\t\t\t// das ist der Standardfall solange der nicht beim vorletzten Knoten\r\n\t\t\t// angekommen ist.\r\n\t\t\taktu = aktu.getPrevious();\r\n\t\t\treturn (T) aktu.getNext().getData();\r\n\t\t}\r\n\r\n\t}", "public int previousIndex()\n {\n // TODO: implement this method\n return -1;\n }", "public void setPrevious(Node p) {\n previous = p;\n }", "private Cell findPrev(ArrayList<Cell> list, Cell current) {\r\n\t\t\tint index = isInList(list, current);\r\n\t\t\treturn list.get(index).prev;\r\n\t\t}", "Object previous();", "public State getPreviousState()\r\n\t{\r\n\t\treturn previousState;\r\n\t}", "public Position2D getPreviousPosition()\n {\n return previousPosition;\n }", "public void Prev();", "@NotNull\n @JsonProperty(\"previousValue\")\n public String getPreviousValue();", "public E getPrevEdge()\r\n/* */ {\r\n/* 178 */ return (E)this.prevEdge;\r\n/* */ }", "public void prev();", "public Pageable previousOrFirst() {\n\t\t\t\treturn null;\r\n\t\t\t}", "@Field(0) \n\tpublic Pointer<uvc_processing_unit > prev() {\n\t\treturn this.io.getPointerField(this, 0);\n\t}", "public void previous()\n {\n if (size != 0)\n {\n current = current.previous();\n }\n\n }", "ComponentAgent getPreviousSibling();", "public String getPrevHashValue() {\n return prevHashValue;\n }", "public int getPreviousHop() {\n return previousHop;\n }", "public void setPrevNode(int node) {\n\t\tthis.previousNode = node;\n\t}", "public void previous() {\n if (hasPrevious()) {\n setPosition(position - 1);\n }\n }", "private T getPredecessor(BSTNode<T> current) {\n while (current.getRight() != null) {\n current = current.getRight();\n }\n return current.getData();\n }", "public void setPrevious(ListElement previous)\n\t {\n\t this.previous = previous;\n\t }", "public void setPrevious(Node<T> previous) {\r\n this.previous = previous;\r\n }", "protected abstract D getPrevious(D d);", "public Color getPrevColor(){\n\t\treturn prevColor;\n\t}", "public Node getPrev(Node root, int key, Node prev){\n\t\tif(root==nil){\n\t\t\treturn nil;\n\t\t}\n\t\t\n\t\tif(key==root.id){\n\t\t\tif(root.left != nil){\n\t\t\t\tNode temp = root.left;\n\t\t\t\twhile(temp.right != nil){\n\t\t\t\t\ttemp = temp.right;\n\t\t\t\t}\n\t\t\t\tprev = temp;\n\t\t\t}\n\t\t\treturn prev;\n\t\t}\n\t\t\n\t\tif(key>root.id){\n\t\t\tprev = root;\n\t\t\tprev = getPrev(root.right,key,prev);\n\t\t}else{\n\t\t\tprev = getPrev(root.left,key,prev);\n\t\t}\n\t\t\n\t\treturn prev;\n\t}", "private T getPredecessor (BSTNode<T> current) {\n\t\twhile(current.getRight() != null) {\n\t\t\tcurrent = current.getRight();\n\t\t}\n\t\treturn current.getData();\n\n\t}", "private Tab getPrevTab() {\n int pos = mTabControl.getCurrentPosition() - 1;\n if (pos < 0) {\n pos = mTabControl.getTabCount() - 1;\n }\n return mTabControl.getTab(pos);\n }", "@Override\n\tpublic Node getPreviousChild(Node existing) {\n\t\treturn null;\n\t}", "public CellCoord previousRow() {\n return new CellCoord(column, row - 1);\n }" ]
[ "0.8843789", "0.87889", "0.87716115", "0.8759016", "0.8619982", "0.86135626", "0.8596417", "0.8559983", "0.85481393", "0.854293", "0.85094887", "0.8487676", "0.8418937", "0.8415477", "0.8409887", "0.8370842", "0.829932", "0.8277712", "0.8222902", "0.8207123", "0.8005482", "0.7992945", "0.7981907", "0.7908808", "0.7900843", "0.79008", "0.78448397", "0.7832643", "0.77362686", "0.77189356", "0.7717223", "0.77140576", "0.77053094", "0.7698906", "0.76680815", "0.76340747", "0.756674", "0.7521206", "0.7473516", "0.7456678", "0.7425072", "0.74059534", "0.73976886", "0.73828614", "0.7374837", "0.7370185", "0.7357607", "0.73476255", "0.7343883", "0.73367107", "0.7310507", "0.7272309", "0.72507983", "0.7250599", "0.7223976", "0.7189346", "0.71805924", "0.71748364", "0.7173541", "0.71490246", "0.71432436", "0.7131421", "0.71117646", "0.70967764", "0.7083712", "0.7073487", "0.7045459", "0.70348644", "0.697254", "0.6946498", "0.69348735", "0.6927716", "0.692119", "0.6901943", "0.6894401", "0.68890566", "0.6885519", "0.68831015", "0.687608", "0.6867716", "0.6861422", "0.6856743", "0.68441117", "0.6841019", "0.6814974", "0.6811811", "0.68039626", "0.6783769", "0.6770043", "0.6769725", "0.67374986", "0.673429", "0.670712", "0.6702585", "0.6690698", "0.6671039", "0.6655738", "0.66354465", "0.6635315", "0.6605187" ]
0.8703741
4
Setter for previous node.
public void setPrev(Node prev) { this.prev = prev; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setPrevious(Node<T> previous) {\r\n this.previous = previous;\r\n }", "public Node setPrevNode(Node node);", "public void setPrev(Node<T> prev) {\n\t\tthis.prev = prev;\n\t}", "public void setPrev(Node prev)\r\n\t{\r\n\t\tthis.prev = prev;\r\n\t}", "public void setPrevNode(Node<T> prevNode) {\n\t\tthis.prevNode = prevNode;\n\t}", "public void setPrevious(Node p) {\n previous = p;\n }", "public void setPrevious(DoublyLinkedNode<E> prev) {\n this.prevNode = prev;\n }", "public void setPrevNode(int node) {\n\t\tthis.previousNode = node;\n\t}", "public void setPrevious(MyNode<? super E> _previous)\n\t{\n\t\tthis.previous = _previous;\n\t\t//this.previous = _previous;\n\t}", "public\tvoid setprevious (SNode previous) {\r\n\t\tthis.previous=previous;\r\n\t}", "public void setPrevious(AStarNode previous) {\n this.previous = previous;\n }", "public void setPrevious(DSAGraphNode<E> inPrevious)\n {\n previous = inPrevious;\n }", "public void setPrevious(DoubleNode<T> node)\n {\n\n previous = node;\n }", "public void setPrev(DNode newPrev) { prev = newPrev; }", "public void setPrev(SlideNode node) {\n\t\tthis.prev = node;\n\t}", "public node getPrevious() {\n\t\t\treturn previous;\n\t\t}", "public void setPrev(Level previous) {\n\t\tthis.prev = previous;\n\t}", "public Node getPrevious() {\n return previous;\n }", "public Node<T> previous() {\r\n return previous;\r\n }", "public Node getPrev() {\n return prev;\n }", "public Node getPrev()\r\n\t{\r\n\t\treturn prev;\r\n\t}", "public DNode getPrev() { return prev; }", "public Node<S> getPrev() { return prev; }", "public Node getPrev()\n {\n return this.prev;\n }", "public Node<T> getPrevNode() {\n\t\treturn prevNode;\n\t}", "public Node getPrev() {\n return null;\n }", "public void setPrev(Node p)\n {\n p.next = this.prev.next;\n p.prev = this.prev;\n this.prev.next = p;\n this.prev = p;\n }", "public Node<T> getPrev() {\n\t\treturn prev;\n\t}", "public void setPrev(ListElement<T> prev)\n\t{\n\t\tthis.prev = prev;\n\t}", "public void setPrevious(ListElement previous)\n\t {\n\t this.previous = previous;\n\t }", "public DoublyLinkedNode<E> getPrevious() {\n return prevNode;\n }", "public int getPrevNode() {\n\t\treturn this.previousNode;\n\t}", "public void setPrevCell(Cell prev)\r\n {\r\n this.prev = prev;\r\n }", "public void setPrevious()\n {\n\tint currentIndex = AL.indexOf(currentObject);\n\t currentObject = AL.get(currentIndex -1);\n\t\n\t// never let currentNode be null, wrap to head\n\tif (currentObject == null)\n\t\tcurrentObject = lastObject;\n }", "public void setPrev(DListNode2 prev1){\r\n this.prev = prev1;\r\n }", "public AStarNode getPrevious() {\n return previous;\n }", "public void setPrev(ListEntry prev) {\n if (prev != null)\n this.prev = prev;\n else\n this.prev = null;\n }", "public void setPrev(String prev){\n\t\tthis.prev = prev;\n\t}", "public void prev() {\r\n\t\tif (curr == head)\r\n\t\t\treturn; // No previous element\r\n\t\tLink<E> temp = head;\r\n\t\t// March down list until we find the previous element\r\n\t\twhile (temp.next() != curr)\r\n\t\t\ttemp = temp.next();\r\n\t\tcurr = temp;\r\n\t}", "public DSAGraphNode<E> getPrevious()\n {\n return previous;\n }", "public SlideNode getPrev() {\n\t\treturn prev;\n\t}", "public void setPreviousElement(Element<T> previousElement) \n\t{\n\t\tthis.previousElement = previousElement;\n\t}", "public void setPrevious(Vertex v){\n previous = v;\n }", "public DoubleNode<T> getPrevious()\n {\n\n return previous;\n }", "public void setPrev(Position pos) {\n prev = pos;\n }", "public MyNode<? super E> getPrevious()\n\t{\n\t\treturn this.previous;\n\t}", "@Override\r\n\t\tpublic Node getPreviousSibling()\r\n\t\t\t{\n\t\t\t\treturn null;\r\n\t\t\t}", "@Override\n\tpublic Node getPreviousSibling() {\n\t\treturn null;\n\t}", "public DependencyElement previous() {\n\t\treturn prev;\n\t}", "public void previous() {\n if (hasPrevious()) {\n setPosition(position - 1);\n }\n }", "Optional<Node<UnderlyingData>> prevNode(Node<UnderlyingData> node);", "public Vertex getPrev() {\n return prev;\n }", "@Override\r\n\tpublic String prev() {\n\t\tString pre;\r\n\r\n\t\tpre = p.getPrev();\r\n\r\n\t\tif (pre != null) {\r\n\t\t\tthisPrevious = true;\r\n\t\t\tinput(pre);\r\n\t\t}\r\n\t\treturn pre;\r\n\t}", "public void setPrev(Version prev){\n\t\tif (prev == null){\n\t\t\tLog.e(NAME, \"Invalid parameters for 'setPrev' method!\");\n\t\t\treturn;\n\t\t}\n\t\tthis.prev = prev;\n\t}", "public void previous()\n {\n if (size != 0)\n {\n current = current.previous();\n }\n\n }", "public DListNode2 prev(){\r\n return this.prev;\r\n }", "void prevSet(Entry e) {\r\n\t\t\tprev = e;\r\n\t\t}", "public Vertex getPrevious(){\n return previous;\n }", "public void prev();", "public void setPreviousValue(final String previousValue);", "public void setPrevHashValue(String prevHashValue) {\n this.prevHashValue = prevHashValue;\n }", "public E previous(){\n\t\t\tE e = tail.element;\n\t\t\tcurrent = current.next;\n\t\t\treturn e;\n\t\t}", "public void setPrevColor(Color prevColor){\n\t\tthis.prevColor=prevColor;\n\t}", "@JsonProperty(\"previous_sibling\")\n @ApiModelProperty(value = \"The previous dialog node.\")\n public String getPreviousSibling() {\n return previousSibling;\n }", "public ListElement getPrevious()\n\t {\n\t return this.previous;\n\t }", "@Override\n public E previous() throws NoSuchElementException\n { \n if(hasPrevious() == false)\n {\n throw new NoSuchElementException();\n }\n idx = idx - 1;\n Node theNode = getNth(idx);\n left = left.prev;\n right = left;\n canRemove = false;\n forward = false;\n return theNode.getElement(); \n }", "@Override\r\n\t\tpublic E previous() {\n\t\t\tcaret = caret.prev();\r\n\t\t\tif (caret == null)\r\n\t\t\t\tthrow new NoSuchElementException();\r\n\t\t\tnextIndex--;\r\n\t\t\treturn caret.n.data[caret.idx];\r\n\t\t}", "public T previous()\n {\n // TODO: implement this method\n return null;\n }", "public void previous();", "public K prev();", "@Field(0) \n\tpublic uvc_processing_unit prev(Pointer<uvc_processing_unit > prev) {\n\t\tthis.io.setPointerField(this, 0, prev);\n\t\treturn this;\n\t}", "public ListElement<T> getPrev()\n\t{\n\t\treturn prev;\n\t}", "@Override\r\n public int previousIndex() {\r\n if (previous == null) {\r\n return -1;\r\n }\r\n return previousIndex;\r\n }", "HNode getPreviousSibling();", "@Model \n\tprotected void setPrevMove(String prev_move) {\n\t\tassert((prev_move == \"\") || (prev_move == \"left\") || (prev_move == \"right\"));\n\t\t\n\t\tthis.prev_move = prev_move;\n\t}", "public void setPreviousState(State prevState)\r\n\t{\r\n\t\tthis.previousState = new State();\r\n\t\tthis.previousState = prevState;\r\n\t}", "public Layer getPrevLayer() {\r\n\t\treturn this.prevLayer;\r\n\t}", "int getPrev(int node_index) {\n\t\treturn m_list_nodes.getField(node_index, 1);\n\t}", "public void prev()\n {\n if (mHistoryIdx == 0) {\n return;\n }\n\n mCommandList.get(--mHistoryIdx).undo();\n this.setChanged();\n this.notifyObservers(mHistoryIdx);\n }", "public Version getPrev(){\n\t\treturn prev;\n\t}", "public T prev() {\n cursor = ((Entry<T>) cursor).prev;\n ready = true;\n return cursor.element;\n }", "@Override\n public E getPrevious() {\n if (isCurrent() && prev != null) { return prev.getData(); }\n else { throw new IllegalStateException(\"There is no previous element.\"); }\n }", "public void setPreviousPosition(int previousPosition)\n\t{\n\t\tsomethingChanged = true;\n\t\tthis.previousPosition = previousPosition;\n\t}", "public void prevSlide() {\n\t\tif (currentSlideNumber > 0) {\n\t\t\tsetSlideNumber(currentSlideNumber - 1);\n\t }\n\t}", "public void setPreviousHop(int previousHop) {\n this.previousHop = previousHop;\n }", "public void setPrev(IDLink<T> c){\n \tppointer = c;\n }", "public void setBack(Node back){\n this.back = back;\n }", "public E previousStep() {\r\n\t\tthis.current = this.values[Math.max(this.current.ordinal() - 1, 0)];\r\n\t\treturn this.current;\r\n\t}", "public void Prev();", "public AbstractPathElement<V, E> getPrevPathElement()\r\n/* */ {\r\n/* 188 */ return this.prevPathElement;\r\n/* */ }", "@NotNull\n @JsonProperty(\"previousValue\")\n public String getPreviousValue();", "public TreeNode getPreviousSibling ()\r\n {\r\n if (parent != null) {\r\n int index = parent.children.indexOf(this);\r\n\r\n if (index > 0) {\r\n return parent.children.get(index - 1);\r\n }\r\n }\r\n\r\n return null;\r\n }", "public void Previous(int key){\n\t\tif(search(key)!=nil){\n\t\t\tNode res = getPrev(root,key,nil);\n\t\t\tif(res != nil){\n\t\t\t\tSystem.out.println(res.id + \" \" + res.count);\n\t\t\t}else{\n\t\t\t\tSystem.out.println(\"0 0\");\n\t\t\t}\n\t\t}else{\n\t\t\tint prev = findPrev(root,key);\n\t\t\tNode res = getNode(root,prev);\n\t\t\tif(res != nil){\n\t\t\t\tSystem.out.println(res.id + \" \" + res.count);\n\t\t\t}else{\n\t\t\t\tSystem.out.println(\"0 0\");\n\t\t\t}\n\t\t}\n\t}", "private Token previous() {\n return tokens.get(current-1);\n }", "public Object getPrev() {\n\t\tif (current != null) {\n\t\t\tcurrent = current.prev;\n\t\t} else {\n\t\t\tcurrent = start;\n\t\t}\n\t\treturn current == null ? null : current.item; //Ha nincs még start, akkor null adjon vissza\n\t}", "public void movePrevious() throws CurrentNotSetException {\r\n\t\ttry {\r\n\t\t\taktu = aktu.getPrevious();\r\n\t\t} catch (Exception e) {\r\n\t\t\tthrow new CurrentNotSetException();\r\n\t\t}\r\n\r\n\t}", "public Color getPrevColor(){\n\t\treturn prevColor;\n\t}", "@Override\n\tpublic Node getPreviousChild(Node existing) {\n\t\treturn null;\n\t}", "public ExtremeEntry previous() {\n\n\t\tsetLastReturned(getLastReturned().getPrevious());\n//\t\tnextIndex--;\n\t\tcheckForComodification();\n\t\treturn getLastReturned();\n\t}", "public Node getPrev(Node root, int key, Node prev){\n\t\tif(root==nil){\n\t\t\treturn nil;\n\t\t}\n\t\t\n\t\tif(key==root.id){\n\t\t\tif(root.left != nil){\n\t\t\t\tNode temp = root.left;\n\t\t\t\twhile(temp.right != nil){\n\t\t\t\t\ttemp = temp.right;\n\t\t\t\t}\n\t\t\t\tprev = temp;\n\t\t\t}\n\t\t\treturn prev;\n\t\t}\n\t\t\n\t\tif(key>root.id){\n\t\t\tprev = root;\n\t\t\tprev = getPrev(root.right,key,prev);\n\t\t}else{\n\t\t\tprev = getPrev(root.left,key,prev);\n\t\t}\n\t\t\n\t\treturn prev;\n\t}" ]
[ "0.8674817", "0.8620083", "0.86005926", "0.8502014", "0.84892076", "0.8433329", "0.8382148", "0.82613224", "0.8185784", "0.81610805", "0.8077892", "0.80712694", "0.80158293", "0.8006401", "0.79686564", "0.79251254", "0.7916708", "0.78860104", "0.7861295", "0.78393525", "0.7751864", "0.77442974", "0.77379405", "0.77355325", "0.7711817", "0.7675641", "0.76467085", "0.76426977", "0.75298643", "0.75197566", "0.7518319", "0.74934506", "0.74865896", "0.7479713", "0.7473076", "0.74665564", "0.7459716", "0.74221784", "0.738874", "0.73636967", "0.73510253", "0.7321694", "0.72820663", "0.7276371", "0.72745144", "0.7229585", "0.7222278", "0.71735215", "0.7135777", "0.7126058", "0.7125838", "0.708515", "0.70778495", "0.7054201", "0.7039587", "0.70075786", "0.6924289", "0.6910651", "0.68115675", "0.6808692", "0.67928636", "0.67664766", "0.6759991", "0.67334616", "0.66948855", "0.6693975", "0.66641796", "0.6645134", "0.66351396", "0.66318816", "0.6625732", "0.6614746", "0.65829617", "0.6577738", "0.6567013", "0.65608305", "0.65479326", "0.65320283", "0.652793", "0.6522584", "0.64857805", "0.64663446", "0.6455336", "0.6452642", "0.64512455", "0.644973", "0.6449152", "0.64345515", "0.64315975", "0.6415083", "0.6385987", "0.6378671", "0.6363079", "0.6361295", "0.6348064", "0.6331573", "0.62869716", "0.6268198", "0.6263154", "0.6242915" ]
0.8581396
3
/ AI Types 1 = Smart 2 = Random
public TicTacToeAI(String brainFileLocation, int type) { game = null; this.brainLocation = brainFileLocation; this.aiType = type; //Initialize a new long term and short term memory longTermMemory = new HashMap<>(); shortTermMemory = new ArrayList<String>(); //Load the long term memories from the file specified loadMemory(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private Card aiRequestLogic()\n {\n Random randomCard = new Random(); // A placeholder is set aside for generating a random integer.\n return hand.get(randomCard.nextInt(hand.size())); // A card at a randomized index will be returned.\n }", "public abstract void randomize();", "private void random() {\n\n\t}", "private static String getRandomType(){\r\n int index = r.nextInt(typeOfRooms.length);\r\n return typeOfRooms[index];\r\n }", "private static ItemType random() {\n return ITEM_TYPES.get(RANDOM.nextInt(SIZE));\n }", "private void randomBehavior() {\n\t\trandom = rand.nextInt(50);\n\t\tif (random == 0) {\n\t\t\trandom = rand.nextInt(4);\n\t\t\tswitch (random) {\n\t\t\t\tcase 0:\n\t\t\t\t\tchangeFacing(ACTION.DOWN);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\tchangeFacing(ACTION.RIGHT);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\tchangeFacing(ACTION.UP);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\tchangeFacing(ACTION.LEFT);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "AttackResult randomAttack();", "private Astronaut getRandomAstronaut() {\n\t\twhile(roamingAstronauts > 0) {\n\t\t\tint i = random.nextInt(gameObject.size());\n\t\t\tif (gameObject.get(i) instanceof Astronaut)\n\t\t\t\treturn (Astronaut) gameObject.get(i);\n\t\t}\n\t\treturn null;\n\t}", "public abstract boolean isRandom();", "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}", "public void setWhoGoesFirstRandom() {\n Random ran = new Random();\n int i = ran.nextInt(2) + 1;\n if(i == 1) {\n setWhoGoesFirst(humanPlayer);\n } else {\n setWhoGoesFirst(aiPlayer);\n }\n }", "Randomizer getRandomizer();", "Boolean getRandomize();", "RocketInterface getRandomRocket();", "public Item getDropType(int paramInt1, Random paramRandom, int paramInt2) {\n/* 27 */ return Items.MELON;\n/* */ }", "public static Object getRandomValue(final Class type) {\n\n /*\n * String and Character types\n */\n if (type.equals(String.class)) {\n return RandomStringUtils.randomAlphabetic(10);\n }\n if (type.equals(Character.TYPE) || type.equals(Character.class)) {\n return RandomStringUtils.randomAlphabetic(1).charAt(0);\n }\n\n /*\n * Boolean type\n */\n if (type.equals(Boolean.TYPE) || type.equals(Boolean.class)) {\n return RANDOM.nextBoolean();\n }\n\n /*\n * Numeric types\n */\n if (type.equals(Byte.TYPE) || type.equals(Byte.class)) {\n return (byte) (RANDOM.nextInt());\n }\n if (type.equals(Short.TYPE) || type.equals(Short.class)) {\n return (short) (RANDOM.nextInt());\n }\n if (type.equals(Integer.TYPE) || type.equals(Integer.class)) {\n return RANDOM.nextInt();\n }\n if (type.equals(Long.TYPE) || type.equals(Long.class)) {\n return RANDOM.nextLong();\n }\n if (type.equals(Double.TYPE) || type.equals(Double.class)) {\n return RANDOM.nextDouble();\n }\n if (type.equals(Float.TYPE) || type.equals(Float.class)) {\n return RANDOM.nextFloat();\n }\n if (type.equals(BigInteger.class)) {\n return new BigInteger(Math.abs(RANDOM.nextInt(100)), RANDOM);\n }\n if (type.equals(BigDecimal.class)) {\n return new BigDecimal(RANDOM.nextDouble());\n }\n if (type.equals(AtomicLong.class)) {\n return new AtomicLong(RANDOM.nextLong());\n }\n if (type.equals(AtomicInteger.class)) {\n return new AtomicInteger(RANDOM.nextInt());\n }\n\n /*\n * Date and time types\n */\n if (type.equals(java.util.Date.class)) {\n return new java.util.Date(RANDOM.nextLong());\n }\n if (type.equals(java.sql.Date.class)) {\n return new java.sql.Date(RANDOM.nextLong());\n }\n if (type.equals(java.sql.Time.class)) {\n return new java.sql.Time(RANDOM.nextLong());\n }\n if (type.equals(java.sql.Timestamp.class)) {\n return new java.sql.Timestamp(RANDOM.nextLong());\n }\n if (type.equals(Calendar.class)) {\n return Calendar.getInstance();\n }\n\n /*\n * Enum type\n */\n if (type.isEnum() && type.getEnumConstants().length > 0) {\n Object[] enumConstants = type.getEnumConstants();\n return enumConstants[RANDOM.nextInt(enumConstants.length)];\n }\n\n /*\n * Return null for any unsupported type\n */\n return null;\n\n }", "public abstract int getRandomDamage();", "private void random() {\n GameState gs = cc.getGameState();\n ArrayList<int[]> moves = cc.getPlayerMoves(player);\n ArrayList<GameState> states = nextStates(moves, gs);\n for (int[] m : moves) {\n GameState next = checkMove(m, cc);\n states.add(next);\n }\n Random rand = new Random(System.nanoTime());\n int i = rand.nextInt(states.size());\n cc.setAIMove(states.get(i));\n }", "private Type stealResource() {\n \t\tint count = getResourceCount();\n \t\tif (count <= 0)\n \t\t\treturn null;\n \n \t\t// pick random card\n \t\tint select = (int) (Math.random() * count);\n \t\tfor (int i = 0; i < resources.length; i++) {\n \t\t\tif (select < resources[i]) {\n \t\t\t\tuseResources(Type.values()[i], 1);\n \t\t\t\treturn Type.values()[i];\n \t\t\t}\n \n \t\t\tselect -= resources[i];\n \t\t}\n \n \t\treturn null;\n \t}", "public void randomizeHaplotype() {\n if (rand == null) {\n log.error(\"Cannot randomize haplotype\");\n log.error(toString());\n System.exit(1);\n }\n\n isPhased = true;\n if (rand.nextDouble() > 0.5) {\n return;\n }\n byte tmp = paternal;\n paternal = maternal;\n maternal = tmp;\n }", "private Alien getRandomAlien() {\n\t\twhile(roamingAliens >= 0){\n\t\t\tint i = random.nextInt(gameObject.size());\n\t\t\tif(gameObject.get(i)instanceof Alien)\n\t\t\t\treturn (Alien) gameObject.get(i);\n\t\t}\n\t\treturn null;\n\t}", "private void castSpellByAI() {\n\t\tboolean spellIsNotActivated = true;\n\t\tboolean[] spellsFlags = new boolean[3];\n\t\tChampion AI = currentTask.getCurrentChamp();\n\t\tArrayList<Spell> spells = ((Wizard)AI).getSpells();\n\t\twhile(spellIsNotActivated){\n\t\t\t\n\t\t\tint randomAction = (int) (Math.random()*2);\n\t\t\tSpell spell = null;\n\t\t\t\n\t\t\tswitch(randomAction){\n\t\t\tcase 0: if(spellsFlags[0]==false) {spell = spells.get(0); spellsFlags[0]=true; break;}\n\t\t\tcase 1:\tif(spellsFlags[1]==false) {spell = spells.get(1); spellsFlags[1]=true; break;}\n\t\t\tdefault: if(spellsFlags[2]==false) {spell = spells.get(2); spellsFlags[2] =true;}\n\t\t\t}\n\t\t\t\n\t\t\tif(spell instanceof HealingSpell){\n\t\t\t\tcastHealingSpell(spell);\n\t\t\t}else if(spell instanceof DamagingSpell){\n\t\t\t\tDirection direction;\n\t\t\t\tint randomDirection = (int) (Math.random()*3);\n\t\t\t\tswitch(randomDirection){\n\t\t\t\tcase 0: direction = Direction.BACKWARD;\n\t\t\t\tcase 1: direction = Direction.FORWARD;\n\t\t\t\tcase 2: direction = Direction.LEFT;\n\t\t\t\tdefault: direction = Direction.RIGHT;\n\t\t\t\t}\n\t\t\t\tspellInAction = spell;\n\t\t\t\tdirectionsInAction = new ArrayList<Direction>();\n\t\t\t\tdirectionsInAction.add(direction);\n\t\t\t\tcastDamagingSpell();\n\t\t\t}else if(spell instanceof RelocatingSpell){\n\t\t\t\tDirection direction1;\n\t\t\t\tint randomDirection1 = (int) (Math.random()*3);\n\t\t\t\tswitch(randomDirection1){\n\t\t\t\tcase 0: direction1 = Direction.BACKWARD;\n\t\t\t\tcase 1: direction1 = Direction.FORWARD;\n\t\t\t\tcase 2: direction1 = Direction.LEFT;\n\t\t\t\tdefault: direction1 = Direction.RIGHT;\n\t\t\t\t}\n\t\t\t\tDirection direction2;\n\t\t\t\tint randomDirection2 = (int) (Math.random()*3);\n\t\t\t\tswitch(randomDirection2){\n\t\t\t\tcase 0: direction2 = Direction.BACKWARD;\n\t\t\t\tcase 1: direction2 = Direction.FORWARD;\n\t\t\t\tcase 2: direction2 = Direction.LEFT;\n\t\t\t\tdefault: direction2 = Direction.RIGHT;\n\t\t\t\t}\n\t\t\t\tspellInAction = spell;\n\t\t\t\tdirectionsInAction = new ArrayList<Direction>();\n\t\t\t\tdirectionsInAction.add(direction1);\n\t\t\t\tdirectionsInAction.add(direction2);\n\t\t\t\t\n\t\t\t\tint randomRange = (int) (Math.random()*((RelocatingSpell)spell).getRange()) + 1;\n\t\t\t\tcastRelocatingSpell(randomRange);\n\t\t\t\t\n\t\t\t}else{\n\t\t\t\tspellIsNotActivated = false;\n\t\t\t}\n\t\t\tif(AI != currentTask.getCurrentChamp()){\n\t\t\t\tspellIsNotActivated = false;\n\t\t\t}\n\t\t}\n\n\t\t\n\t\t\n\t}", "private static Weapon randomWeapon() {\r\n Random rand = new Random();\r\n int weaponType = rand.nextInt(7);\r\n switch (weaponType) {\r\n case 0: \r\n return new FryingPan();\r\n case 1:\r\n return new SubmachineGun();\r\n case 2:\r\n return new AssaultRifle();\r\n case 3:\r\n return new Pistol();\r\n case 4:\r\n return new Axe();\r\n case 5:\r\n return new Crowbar();\r\n default:\r\n return new Shotgun();\r\n }\r\n }", "private boolean learning()\r\n\t{\r\n\t\tint temp = (int) (Math.random() * 100);\t\t//generate a random int between 0-100\r\n\t\tif(temp<=intelligence)\r\n\t\t\treturn true;\r\n\t\treturn false;\r\n\t}", "private void playAI (int actualAI) {\n }", "public StrategyRandom() {\n name = \"Random\";\n }", "private void generarAno() {\r\n\t\tthis.ano = ANOS[(int) (Math.random() * ANOS.length)];\r\n\t}", "T getRandomAllowedValue();", "private static int randomDirection() {\n return (int) (Math.random() * Direction.values().length);\n }", "public void rollRandom() {\n\t\tthis.strength = randomWithRange();\r\n\t\tthis.wisdom = randomWithRange();\r\n\t\tthis.dexterity = randomWithRange();\r\n\t\tthis.constitution = randomWithRange();\r\n\t\tthis.intelligence = randomWithRange();\r\n\t\tthis.charisma = randomWithRange();\r\n\t}", "public static String RandomSelectMethod(Random random){\n String[] methodArray = new String[] {\"isValid\",\"setDescription\"};// The list of the of methods to be tested in the Appt class\n\n int n = random.nextInt(methodArray.length);// get a random number between 0 (inclusive) and methodArray.length (exclusive)\n\n return methodArray[n] ; // return the method name \n }", "public int monsterAttack(){\n Random ran = new Random();\n return ran.nextInt(4);\n }", "private String RandomGoal() {\n\t\tList<String> list = Arrays.asList(\"m\", \"m\", \"m\", \"m\", \"m\", \"m\", \"m\", \"m\", \"t\", \"t\");\n\t\tRandom rand = new Random();\n\t\tString randomgoal = list.get(rand.nextInt(list.size()));\n\n\t\treturn randomgoal;\n\t}", "public S getRandomState();", "private Action selectRandomAction() {\n int fuel;\n String car, driver;\n Tire tire;\n TirePressure pressure;\n\n // Possible 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 // Possible 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 List<ActionType> validActionTypes = problemSpec.getLevel().getAvailableActions();\n ActionType actionType = getRandomElement(validActionTypes);\n Action action;\n\n // Pick a random action from A1-A8 and then randomize the parameters\n switch (actionType.getActionNo()) {\n case 1:\n action = new Action(actionType);\n break;\n case 2:\n car = getRandomElement(problemSpec.getCarOrder());\n action = new Action(actionType, car);\n break;\n case 3:\n driver = getRandomElement(problemSpec.getDriverOrder());\n action = new Action(actionType, driver);\n break;\n case 4:\n tire = getRandomElement(problemSpec.getTireOrder());\n action = new Action(actionType, tire);\n break;\n case 5:\n fuel = getRandomElement(fuelLevels);\n action = new Action(actionType, fuel);\n break;\n case 6:\n pressure = getRandomElement(tirePressures);\n action = new Action(actionType, pressure);\n break;\n case 7:\n car = getRandomElement(problemSpec.getCarOrder());\n driver = getRandomElement(problemSpec.getDriverOrder());\n action = new Action(actionType, car, driver);\n break;\n default:\n // A8\n tire = getRandomElement(problemSpec.getTireOrder());\n fuel = getRandomElement(fuelLevels);\n pressure = getRandomElement(tirePressures);\n action = new Action(actionType, tire, fuel, pressure);\n }\n\n return action;\n\n }", "public void roam(){\r\n Random rand = new Random();\r\n String aniName = this.getName();\r\n String aniType = this.getAniType();\r\n //Chance will be a number between 1 and 100\r\n int chance = rand.nextInt(100) + 1;\r\n //25% chance that the pachyderm will charge\r\n if (chance <= 25){\r\n System.out.println(aniName + \" the \" + aniType + \" charges.\");\r\n }\r\n //75% chance the method works as originally intended.\r\n else{\r\n System.out.println(aniName + \" the \" + aniType + \" roams.\");\r\n }\r\n }", "private void getRandomSprite(String type) {\n\t\tint randInt = new Random().nextInt(3);\n\t\tspriteNum = randInt;\n\t\tswitch(type){\n\t\tcase \"red\":\n\t\t\tspriteCol = 0;\n\t\t\tbreak;\n\t\tcase \"blue\":\n\t\t\tspriteCol = 1;\n\t\t\tbreak;\n\t\tcase \"green\":\n\t\t\tspriteCol = 2;\n\t\t\tbreak;\n\t\tcase \"black\":\n\t\t\tspriteCol = 3;\n\t\t\tbreak;\n\t\tcase \"grey\":\n\t\t\tspriteCol = 4;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tspriteCol =0;\n\t\t\tbreak;\n\t\t}\n\t}", "private void decideMakeAutomaicMove(){\n\t\t\r\n\t\tif (playerMode != PlayerMode.manual){\r\n\t\t\tif (playerMode == PlayerMode.random) makeRandomMove();\r\n\t\t\telse makeSmartMove();\r\n\t\t}\r\n\t}", "@Override\n\t\t\t\tpublic void action() {\n\t\t\t\t\t\tRandom r = new Random();\n\t\t\t\t\t\tint Low = 1;\n\t\t\t\t\t\tint High = 999;\n\t\t\t\t\t\tint Result = r.nextInt(High-Low) + Low;\n\t\t\t\t\t\tACLMessage msg = new ACLMessage(ACLMessage.REQUEST);\n\t\t\t\t\t\tmsg.setOntology(\"AirConditioner\");\n\t\t\t\t\t\tmsg.addReceiver(new AID(\"da\", AID.ISLOCALNAME));\n//\t\t\t\t\t\tif (Result % 2 == 0){\n//\t\t\t\t\t\t\t//humid mode\n//\t\t\t\t\t\t\tmsg.setContent(\"humid\");\n//\t\t\t\t\t\t\tSystem.out.println(\"Agent \"+ myAgent.getLocalName() + \": operating mode: humid\" );\n//\t\t\t\t\t\t}\n//\t\t\t\t\t\telse if((Result % 3 == 0)) {\n//\t\t\t\t\t\t\t//mid\n//\t\t\t\t\t\t\tmsg.setContent(\"mid\");\n//\t\t\t\t\t\t\tSystem.out.println(\"Agent \"+ myAgent.getLocalName() + \": operating mode: mid\" );\n//\t\t\t\t\t\t}\n//\t\t\t\t\t\telse if((Result % 5 == 0)) {\n//\t\t\t\t\t\t\t//high\n//\t\t\t\t\t\t\tmsg.setContent(\"mid\");\n//\t\t\t\t\t\t\tSystem.out.println(\"Agent \"+ myAgent.getLocalName() + \": operating mode: high\" );\n//\t\t\t\t\t\t}\n//\t\t\t\t\t\telse {\n//\t\t\t\t\t\t\t//low\n//\t\t\t\t\t\t\tmsg.setContent(\"mid\");\n//\t\t\t\t\t\t\tSystem.out.println(\"Agent \"+ myAgent.getLocalName() + \": operating mode: low\" );\n//\t\t\t\t\t\t}\n\t\t\t\t\t\tmsg.setContent(Airconditioner_Agent.mode);\n\t\t\t\t\t\tSystem.out.println(\"Agent \"+ myAgent.getLocalName() + \": operating mode: \"+Airconditioner_Agent.mode );\n\t\t\t\t\t\tmyAgent.send(msg);\n\t\t\t\t\t}", "public static PickupType random(){\n Array<PickupType> types = new Array<PickupType>(PickupType.values());\n types.shuffle();\n return types.random();\n }", "public abstract void randomMoves();", "public String randWeapon() {\n\n\t\t// Generates a random number.\n\t\tRandom rand = new Random();\n\n\t\t// A random number between 0 and 2 is generated, and the value at that index in\n\t\t// the Choice array is then saved to the variable compChoice\n\t\tString compChoice = weapArray[rand.nextInt(3)];\n\n\t\t// Makes the users weapon equal to whichever weapon they inputed\n\t\tswitch (compChoice) {\n\n\t\tcase \"Rock\":\n\t\t\tweapon = new Rock();\n\t\t\tbreak;\n\t\tcase \"Paper\":\n\t\t\tweapon = new Paper();\n\t\t\tbreak;\n\t\tcase \"Scissors\":\n\t\t\tweapon = new Scissors();\n\t\t\tbreak;\n\n\t\t}\n\t\treturn compChoice;\n\t}", "public boolean whatNow (String action, player friday, player you){ // Method which will allow the ia to choose his action\n\t\tString testAction = \"Tank\"; // Create a String we will use a lot to test other string\n\t\tint actionIa; // If the ia is a Tank, forbid him to use his special attack. The purpose is to prevent him from useless turns\n\t\tif (friday.getName().equals(testAction)){ // If the name of the ia's class is Tank\n\t\t\t actionIa = (int)(Math.random() * 2); // His random will be between 0 or 1\n\t\t}\n\t\t\n\t\telse {\n\t\t\t actionIa = (int)(Math.random() * 3); // Else, his random will be between 0, 1 and 2\n\t\t}\n\t\t\n\t\ttestAction = \"attack\"; // Will be use to test if you attacked\n\t\t\n\t\t\n\t\tswitch (actionIa){ // Test ia's action\n\t\t\tcase 0: // 0, the enemy attack\n\t\t\t\tfriday.setSprite(\"attack\");\n\t\t\t\tSystem.out.println(\"The enemy attack\\n\"); // Warns the user\n\t\t\t\ttestAction = \"block\"; // Will be use to test if you block\n\t\t\t\tif (action.equals(testAction)){ // If you block\n\t\t\t\t\tSystem.out.println(\"You blocked the enemy's attack.\"); // Warns the user\n\t\t\t\t\tyou.setHp(you.getHp() - you.getDp()); // You loose as much hp as your dp\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse{\n\t\t\t\t\tyou.setHp(you.getHp() - friday.getAp()); // Else, you loose as much hp as your enemy's ap\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tcase 1: // 1, the enemy block\n\t\t\t\tfriday.setSprite(\"block\");\n\t\t\t\tif (action.equals(testAction)){ // If you attacked\n\t\t\t\t\tfriday.setHp(friday.getHp() - friday.getDp()); // The enemy loose as much hp as his dp\n\t\t\t\t\taction = \"\"; // Prevent you from attack a second time\n\t\t\t\t}\n\t\t\t\tSystem.out.println(\"The enemy blocked your attack\\n\"); // Warns the user\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tcase 2: // 2, the enemy use his special power if he isn't a tank\n\t\t\t\tfriday.setSprite(\"special\");\n\t\t\t\tSystem.out.println(\"The enemy uses his special power.\"); // Warns the user\n\t\t\t\tfriday.special(); // Execute ia's special attack\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t}\n\t\t\n\t\ttestAction = \"attack\"; // Reset testAction\n\t\t\n\t\tif (action.equals(testAction)){ // If you attacked\n\t\t\tfriday.setHp(friday.getHp() - you.getAp()); // The enemy loose as much hp as your ap\n\t\t} // Nota Bene : if the enemy blocked your attack, this won't be executed because 'action = \"\";'\n\t\t\n\t\tSystem.out.println(\"You have \" + you.getHp() + \" HP left.\"); // Warns the user\n\t\tSystem.out.println(\"The ennemy have \" + friday.getHp() + \" HP left.\\n\"); // Warns the user\n\t\t\n\t\tif(you.getHp() <= 0){ // If you or the ia has no hp left, warn the system that the fight is over by setting 'end' on true and tell who died\n\t\t\tend = true;\n\t\t\tSystem.out.println(\"You died!\");\n\t\t\tyou.setSprite(\"dead\");\n\t\t}\n\t\t\n\t\telse if(friday.getHp() <= 0){\n\t\t\tend = true;\n\t\t\tSystem.out.println(\"You killed the ennemy!\");\n\t\t\tfriday.setSprite(\"dead\");\n\t\t}\n\t\t\n\t\telse { // Else, it just asks you what you want to do\n\t\t\tSystem.out.println(\"What do you want to do, attack, block or use your special power ?\"); // Asks what you want to do\n\t\t}\n\t\treturn end;\n\t}", "public Scania() {\r\n\t\tinitList();\r\n\t\tmakerName = \"Scania\";\r\n\t\tRandom rand = new Random();\r\n\t\tint chooseBit = rand.nextInt(2); // higher chance of better one ;)\r\n\t\tif (chooseBit == 1) {\r\n\t\t\tmodelName = \"R 2012\";\r\n\t\t} else {\r\n\t\t\tmodelName = \"Streamline\";\r\n\t\t}\r\n\t}", "SimulatedAnnealing() {\n generator = new Random(System.currentTimeMillis());\n }", "public static Ally getRandomRep () {\n return republican[(int) (Math.random() * republican.length)];\n }", "private void useInventoryByAI() {\n\t\tChampion AI = currentTask.getCurrentChamp();\n\t\tArrayList<Collectible> inventory = ((Wizard)AI).getInventory();\n\t\tif(inventory.size()>0){\n\t\t\tint randomPotion = (int)(Math.random()*inventory.size());\n\t\t\tcurrentTask.usePotion((Potion)inventory.get(randomPotion));\n\t\t}\n\n\t\t\n\t}", "public static void main(String[] args) {\n\n// Random randomizer = new Random();\n// //grab a random noun and adj\n// int randInt = randomizer.nextInt(11);\n// System.out.println(\" random adjective is : \" + adj[randInt]);\n// System.out.println( \" random noun is : \" + noun[randInt]);\n// String randAdj = adj[randInt];\n// String randNoun = noun[randInt];\n// System.out.println();\n// System.out.println(\"Here is your server name: \" + randAdj + \"-\" + randNoun);\n\n //another method\n String nouns = getRandomWord(noun);\n String adjs = getRandomWord(adj);\n System.out.println(adjs + \"-\" + nouns);\n }", "private int createAbilityIndex() {\n if (this.getPokemonInfo().numAbilities() == 2) {\n return RandomUtils.getRandomInt(2);\n } else {\n return RandomUtils.getRandomInt(3);\n }\n }", "private Random rand()\n\t{\n\t\treturn new Random();\n\t}", "public static TradeGood getRandom() {\n TradeGood[] options = new TradeGood[] {WATER, FURS, ORE, FOOD, GAMES, FIREARMS,\n MEDICINE, NARCOTICS, ROBOTS, MACHINES};\n int index = GameState.getState().rng.nextInt(10);\n return options[index];\n }", "public Scenario generate() {\n\n //generate random number of Passenger(all human)\n ArrayList liPsg = new ArrayList();\n int totalNumOfPsg = (int) (rd.nextDouble() * PassengerCountMax + PassengerCountMin); //at least one Psg\n for (int i = 0; i < totalNumOfPsg; i++) {\n liPsg.add(getRandomPerson());\n }\n //System.out.println(\"PassengerNum= \"+totalNumOfPsg);\n\n\n //generate random number of Pedestrians(with Max 5) & allocate person+animal randomly(human+animal)\n ArrayList liPdt = new ArrayList();\n int totalNumOfPdst = (int) (rd.nextDouble() * PedestrianCountMax + PedestrianCountMin);//at least one Pdg\n int NumOfPerson = (int) Math.round(rd.nextDouble() * totalNumOfPdst);//if only 1 pdt,along with randomDouble<0.5 , 0.4x*1 rounded=0, will only an animal\n //so if you are random being in pdt but pdt only an animal, you neither wont be in scenario, so your negative probability in scenario is higher.\n int NumOfAnimal = totalNumOfPdst - NumOfPerson;\n for (int i = 0; i < NumOfPerson; i++) {\n liPdt.add(getRandomPerson());\n }\n for (int i = 0; i < NumOfAnimal; i++) {\n liPdt.add(getRandomAnimal());\n }\n //System.out.println(\"PedestrianNum= \"+totalNumOfPdst+\" with \"+NumOfPerson+\" human and \"+NumOfAnimal+\" animals\");\n\n\n //allocating where you are, 0=you absence & do nothing, 1=you in car, 2=you on road !!!!yeah happy solving\n int allocate_of_user = (int) Math.round(rd.nextDouble() * 2);\n if (allocate_of_user == 1) {\n ((Person) liPsg.get(0)).setAsYou(true); //set the first psg is you. !!!!!important Cast Obj into Person!!!!\n } else if (allocate_of_user == 2) {\n for (int i = 0; i < liPdt.size(); i++) {\n if (liPdt.get(i) instanceof Person) {//check whether a person\n ((Person) liPdt.get(i)).setAsYou(true);\n break; // only set once than break rather than set all of people of pdt is you\n }\n }\n }\n\n //Scenario(ArrayList<Character> passengers, ArrayList<Character> pedestrians, boolean isLegalCrossing)\n S = new Scenario(liPsg, liPdt, rd.nextBoolean()); //isLegalCrossing = red or green light;\n return S;\n }", "public void decideNature()\n {\n String nature = new String(\"\");\n Random rand = new Random();\n int i = rand.nextInt(100);\n if(i <= 25)\n {\n nature = \"Very mischievous. Enjoys hiding objects in plain sight\";\n }//ends the if\n else if(i > 25 && i <= 50)\n {\n nature = \"Loves to spend time sleeping on the clouds\";\n }//ends the else if\n else if(i > 50 && i <= 75)\n {\n nature = \"Is very playful\";\n }//ends the else if\n else\n {\n nature = \"Loves to perform dances in the air\";\n }\n \n setNature(nature);\n }", "public boolean isRandom(){\r\n\t\treturn isRandom;\r\n\t}", "public RandomIA() {\n\t\trandom = new Random();\n\t}", "public void generateComputerChoice() {\n\t\tgetRandomNumber();\n\t\tsetComputerChoice();\n\t}", "private void chooseRandomTweet() {\n if (random.nextBoolean()) {\n realTweet = true;\n displayRandomTrumpTweet();\n } else {\n realTweet = false;\n displayRandomFakeTweet();\n }\n }", "public void randomizeDirection()\n\t{\n\t\txSpeed = (int) (Math.pow(-1, random.nextInt(2)) * speed);\n\t\tySpeed = (int) (Math.pow(-1, random.nextInt(2)) * speed);\n\t}", "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 int dmg(){\r\n dmg = rand.nextInt(att);\r\n if(att == 1)\r\n dmg = 1;\r\n return dmg;\r\n }", "public static Item generate(){\n\n //this method lists a collection of new items. it then uses a random number generator\n //to pick one of the objects, and then returns the object so that the main method\n //can add it to the inventory.\n\n ItemType weapon = ItemType.weapon;\n Item IronSword = new Item(weapon, \"Iron Sword\", 8, 50, 10);\n Item GoldenSword = new Item(weapon, \"Golden Sword\", 10, 75, 15);\n Item AllumSword = new Item(weapon, \"Alluminum Sword\", 6, 35, 8);\n Item BowandQuiver = new Item(weapon, \"Bow & Quiver\", 4, 45, 7);\n Item BattleAxe = new Item(weapon, \"Battle Axe\", 12, 55, 13);\n\n ItemType armor = ItemType.armor;\n Item ChainChest = new Item(armor, \"Chain Mail Chestplate\", 8, 40, 30);\n Item IronChest = new Item(armor, \"Iron Chestplate\", 10, 50, 40);\n Item GoldenChest = new Item(armor, \"Golden Chestplate\", 12, 65, 50);\n Item ChainPants = new Item(armor, \"Chain Mail Pants\", 7, 40, 30);\n Item IronPants = new Item(armor, \"Iron Pants\", 9, 50, 40);\n Item GoldenPants = new Item(armor, \"Golden Pants\", 11, 65, 50);\n Item Helmet = new Item(armor, \"Helmet\", 5, 40, 20);\n\n ItemType other = ItemType.other;\n Item Bandage = new Item(other, \"Bandage\", 1, 2, 0);\n Item Wrench = new Item(other, \"Wrench\", 3, 10, 5);\n Item Bread = new Item(other, \"Bread Loaf\", 2, 4, 0);\n Item Water = new Item(other, \"Water Flask\", 3, 2, 0);\n\n Item Initializer = new Item(other, \"init\", 0, 0, 0);\n\t\tint ItemPick = RandomNum();\n Item chosen = Initializer;\n\n switch (ItemPick){\n case 1:\n chosen = IronSword;\n break;\n case 2:\n chosen = GoldenSword;\n break;\n case 3:\n chosen = AllumSword;\n break;\n case 4:\n chosen = BowandQuiver;\n break;\n case 5:\n chosen = BattleAxe;\n break;\n case 6:\n chosen = ChainChest;\n break;\n case 7:\n chosen = IronChest;\n break;\n case 8:\n chosen = GoldenChest;\n break;\n case 9:\n chosen = ChainPants;\n break;\n\t\t\t case 10:\n chosen = IronPants ;\n break;\n case 11:\n chosen = GoldenPants;\n break;\n case 12:\n chosen = Helmet;\n break;\n case 13:\n chosen = Bandage;\n break;\n case 14:\n chosen = Wrench;\n break;\n case 15:\n chosen = Bread;\n break;\n case 16:\n chosen = Water;\n break;\n }\n\n return chosen;\n }", "public Random getAIRandom() {\n return freeColServer.getServerRandom();\n }", "public void toss()\n {\n rand = new Random();//create an object\n num = rand.nextInt(2);//randomly generate two numbers\n if(num == 0)\n sideUp = \"heads\";\n else\n sideUp = \"tails\";//decide what up side is\n }", "public void SetRandom(boolean random);", "public final int arvoRivinAihe() {\r\n return super.getRandom().nextInt(super.aiheetPerusmuoto().length);\r\n }", "private void getRandomNumber() {\n\t\tRandom generator = new Random();\n\t\trandomNumber = generator.nextInt(POSSIBLE_CHOICE.length);\n\t}", "public interface Treat {\n public static final int GIANT_DONUT = 0;\n public static final int GIANT_MATCHA_PARFAIT = 1;\n public static final int GIANT_MINT_CHIP = 2;\n public static final int CUPCAKE_CHERRY = 0;\n public static final int CUPCAKE_VANILLA = 1;\n public static final int CUPCAKE_SUNDAE = 2;\n public static final int SMALL_DONUT = 3;\n public static final int DONUT_PINK_SPRINKLES = 4;\n public static final int DONUT_CHOCOLATE = 5;\n public static final int MATCHA_CAKE = 6;\n public static final int STRAWBERRY_CAKE = 7;\n public static final int CHOCOLATE_CAKE = 8;\n public static final int CHOCO_BANANA_SANDWICH = 9;\n public static final int MINT_CHIP_SANDWICH = 10;\n public static final int RED_VELVET_CAKE = 11;\n public static final int MATCHA_CAKE_ROUND = 12;\n public static final int DONUT_WHITE_NUTS = 13;\n public static final int DONUT_BERRY_JAM = 14;\n //public static final int DONUT_CARAMEL = 15;\n public static final int DONUT_CEREAL = 15;\n //public static final int DONUT_CHOCOLATE_WHITE = 17;\n public static final int DONUT_HALF = 16;\n public static final int DONUT_JELLY_CHOCOLATE = 17;\n public static final int DONUT_LIGHT_BLUE = 18;\n //public static final int DONUT_RED_POWDER = 21;\n public static final int CUPCAKE_CINNAMON = 19;\n public static final int CUPCAKE_MINT_CHOCOLATE = 20;\n public static final int CUPCAKE_PINK_YELLOW = 21;\n public static final int CUPCAKE_RED_VELVET = 22;\n public static final int CUPCAKE_SMORE = 23;\n public static final int DONUT_BLUE_SPRINKLES = 24;\n //public static final int DONUT_MINT_TRI = 28;\n //public static final int DONUT_PURPLE_FLOWER = 29;\n public static final int CAKE_KIWI_STRAWBERRY = 25;\n public static final int DONUT_SILA_BERRY = 26;\n public static final int MOUSSE_TRIPLE_CHOCOLATE = 27;\n public static final int CAKE_PASTEL_RAINBOW = 28;\n public static final int CAKE_CHEESE_SWIRL = 29;\n public static final int MOUSSE_TRIPLE_RASPBERRY = 30;\n public static final int MOUSSE_TRIPLE_LEMON = 31;\n public static final int MOUSSE_TRIPLE_STRAWBERRY= 32;\n\n\n public static final int NUM_TREAT_TYPES = 33;\n public static final int NULL = 100;\n public static final int RED_BEAN_HEART = 101;\n public static final int RED_BEAN_CAKE = 102;\n public static final int BAD_SHROOM = 103;\n public static final int BUFF_MAGNET = 104;\n public static final int CABBAGE = 105;\n public static final int PARTY_BALL = 106;\n public static final int BUFF_PARTY_BALL = 107;\n\n\n\n public void setMove(IObjectMove objMove);\n public IObjectMove getMove();\n public void draw(Canvas canvas);\n public void update(int elapsedTime);\n public Coordinates getCoordinates();\n public int getPoints();\n public Rect getRect();\n public int getRectTop();\n public boolean isDeleted();\n public void reinit(ITreatTypeGood type, int x, int y);\n public void delete();\n public ITreatTypeGood getType();\n}", "int randomPoint() { return 1 + (int)Math.round((Math.random()*20) % (size - 2)); }", "public static String getRandomAdultAspiration(SimsAssistant assistant) {\n\t\tLegacy legacy = assistant.getLegacy();\n\t\tArrayList<String> aspirations = Aspirations.aspirations;\n\t\t\n\t\tif (Legacy.preventTraitSharing) {\n\t\t\tSystem.out.println(legacy.getAspirations());\n\t\t\taspirations.removeAll(legacy.getAspirations());\n\t\t}\n\t\t\n\t\tif (aspirations.isEmpty()) {\n\t\t\tassistant.getConsole().writeNotification(\"WARNING: Due to current restrictions, there are no more unique aspirations available. A random one will be chosen.\");\n\t\t\taspirations = Aspirations.aspirations;\n\t\t}\n\t\t\n\t\tint size = aspirations.size() - 1;\n\t\tint max = (size - 4);\n\t\t\n\t\treturn aspirations.get(4 + Tools.generateRandomInteger(0, max));\n\t\t\n\t}", "public static String randomRank() {\r\n\t\tString[] rank = {\"assistant\",\"associate\",\"full\"};\r\n\t\treturn rank[(int)(Math.random() * 3)];\r\n\t}", "@Override\n\tpublic boolean isRandomizable() {\n\t\treturn false;\n\t}", "private double getRandom() {\n return 2*Math.random() - 1;\n }", "public void randomizeDirection() {\n\t\tRandom r = new Random();\n\t\tint randomDir = r.nextInt(8);\n\t\tdirection = Direction.values()[randomDir];\n\t}", "private void goRandomDirection() {\n\t\tdesiredDirection = Math.random() * 360.0;\n\t}", "public Area GetNextAreaRandom(Area area)\n\n {\n\n Random rand = new Random();\n\n int i = 0;\n\n switch(area.paths)\n\n {\n\n case Constants.North:\n\n i = rand.nextInt(2);\n\n if(i==0)\n\n return area.areaMap.get(Constants.North);\n\n if(i==1)\n\n return area;\n\n case Constants.South:\n\n if(i==0)\n\n return area.areaMap.get(Constants.South);\n\n if(i==1)\n\n return area;\n\n \n\n case Constants.East:\n\n if(i==0)\n\n return area.areaMap.get(Constants.East);\n\n if(i==1)\n\n return area;\n\n \n\n case Constants.West:\n\n if(i==0)\n\n return area.areaMap.get(Constants.West);\n\n if(i==1)\n\n return area;\n\n \n\n \n\n case Constants.NorthAndSouth:\n\n i = rand.nextInt(3);\n\n if(i == 0)\n\n return area.areaMap.get(Constants.North);\n\n if(i == 1)\n\n return area.areaMap.get(Constants.South);\n\n if(i == 2)\n\n return area;\n\n case Constants.NorthAndEast:\n\n i = rand.nextInt(3);\n\n if(i == 0)\n\n return area.areaMap.get(Constants.North);\n\n if(i == 1)\n\n return area.areaMap.get(Constants.East);\n\n if(i == 2)\n\n return area;\n\n case Constants.NorthAndWest:\n\n i = rand.nextInt(3);\n\n if(i == 0)\n\n return area.areaMap.get(Constants.North);\n\n if(i == 1)\n\n return area.areaMap.get(Constants.West);\n\n if(i == 2)\n\n return area;\n\n case Constants.SouthAndEast:\n\n i = rand.nextInt(3);\n\n if(i == 0)\n\n return area.areaMap.get(Constants.East);\n\n if(i == 1)\n\n return area.areaMap.get(Constants.South);\n\n if(i == 2)\n\n return area;\n\n case Constants.SouthAndWest:\n\n i = rand.nextInt(3);\n\n if(i == 0)\n\n return area.areaMap.get(Constants.West);\n\n if(i == 1)\n\n return area.areaMap.get(Constants.South);\n\n if(i == 2)\n\n return area;\n\n case Constants.EastAndWest:\n\n i = rand.nextInt(3);\n\n if(i == 0)\n\n return area.areaMap.get(Constants.East);\n\n if(i == 1)\n\n return area.areaMap.get(Constants.West);\n\n if(i == 2)\n\n return area;\n\n case Constants.NorthSouthAndEast:\n\n i = rand.nextInt(4);\n\n if(i == 0)\n\n return area.areaMap.get(Constants.North);\n\n if(i == 1)\n\n return area.areaMap.get(Constants.South);\n\n if(i == 2)\n\n return area.areaMap.get(Constants.East);\n\n if(i == 3)\n\n return area;\n\n case Constants.NorthSouthAndWest:\n\n i = rand.nextInt(4);\n\n if(i == 0)\n\n return area.areaMap.get(Constants.North);\n\n if(i == 1)\n\n return area.areaMap.get(Constants.South);\n\n if(i == 2)\n\n return area.areaMap.get(Constants.West);\n\n if(i == 3)\n\n return area;\n\n case Constants.NorthEastAndWest:\n\n i = rand.nextInt(4);\n\n if(i == 0)\n\n return area.areaMap.get(Constants.North);\n\n if(i == 1)\n\n return area.areaMap.get(Constants.East);\n\n if(i == 2)\n\n return area.areaMap.get(Constants.West);\n\n if(i == 3)\n\n return area;\n\n case Constants.SouthEastAndWest:\n\n i = rand.nextInt(4);\n\n if(i == 0)\n\n return area.areaMap.get(Constants.West);\n\n if(i == 1)\n\n return area.areaMap.get(Constants.South);\n\n if(i == 2)\n\n return area.areaMap.get(Constants.East);\n\n if(i == 3)\n\n return area;\n\n \n\n case Constants.NorthSouthEastAndWest:\n\n i = rand.nextInt(5);\n\n if(i == 0)\n\n return area.areaMap.get(Constants.West);\n\n if(i == 1)\n\n return area.areaMap.get(Constants.South);\n\n if(i == 2)\n\n return area.areaMap.get(Constants.North);\n\n if(i == 3)\n\n return area.areaMap.get(Constants.East);\n\n if(i == 4)\n\n return area;\n\n }\n\n \n\n return area;\n\n \n\n \n\n }", "public synchronized String computeMove() {\n if (game == null) {\n System.err.println(\"CODE ERROR: AI is not attached to a game.\");\n return \"0,0\";\n }\n\n char[] board = (char[]) game.getStateAsObject();\n\n //Choose a smart move if that AI is set to \"Smart\" or if the random value equals 2\n if (aiType == 1) {\n if(useHeat && ((int) (Math.random() * heat)) == 2){\n return \"\" + getRandomMove(board);\n }\n else{\n return \"\" + getSmartMove(board);\n }\n } else {\n return \"\" + getRandomMove(board);\n }\n }", "public String generateQuestion(){\r\n qType = rand.nextInt(2);\r\n if (qType ==0)\r\n return \"Multiple choice question.\";\r\n else\r\n return \"Single choice question.\";\r\n }", "void think() {\n //get the output of the neural network\n decision = brain.output(vision);\n\n if (decision[0] > 0.8) {//output 0 is boosting\n boosting = true;\n } else {\n boosting = false;\n }\n if (decision[1] > 0.8) {//output 1 is turn left\n spin = -0.08f;\n } else {//cant turn right and left at the same time\n if (decision[2] > 0.8) {//output 2 is turn right\n spin = 0.08f;\n } else {//if neither then dont turn\n spin = 0;\n }\n }\n //shooting\n if (decision[3] > 0.8) {//output 3 is shooting\n shoot();\n }\n }", "public void setRandom(boolean random){\n this.random = random;\n }", "private Player aiRequestTarget(Player ai){\n // generates a random player index\n int index = (int) (Math.random() * GoFish.Players.length);\n\n // prevents the logic from outputting and index that is equal\n // to the player object\n while (GoFish.Players[index]==ai){\n index = (int) (Math.random() * GoFish.Players.length);\n }// end while\n\n return GoFish.Players[index];\n }", "public Card() {\n var random = new SecureRandom();\n var allTypes = Type.values();\n var allSuits = Suit.values();\n this.type = allTypes[random.nextInt(10)];\n this.suit = allSuits[random.nextInt(4)];\n }", "private void activateTraitByAI() {\n\t\tChampion AI = currentTask.getCurrentChamp();\n\t\t\n\t\tif(AI instanceof GryffindorWizard){\n\t\t\tactivateGryffindorTrait();\n\t\t\t\n\t\t}else if(AI instanceof HufflepuffWizard){\n\t\t\tactivateHufflepuffTrait();\n\t\t\t\n\t\t}else if(AI instanceof SlytherinWizard){\n\t\t\tint randomDirection = (int) (Math.random()*3);\n\t\t\tDirection direction;\n\t\t\tswitch(randomDirection){\n\t\t\tcase 0: direction = Direction.FORWARD; break;\n\t\t\tcase 1: direction = Direction.BACKWARD; break;\n\t\t\tcase 2: direction = Direction.RIGHT; break;\n\t\t\tdefault: direction = Direction.LEFT;\n\t\t\t}\n\t\t\tdirectionsInAction = new ArrayList<Direction>();\n\t\t\tdirectionsInAction.add(direction);\n\t\t\tactivateSlytherinTrait();\n\t\t\n\t\t}else if(AI instanceof RavenclawWizard){\n\t\t\tactivateRavenclawTrait();\t\n\t\t\t\n\t\t}\n\t\t\n\t}", "public static boolean charRNG() { // Character randoms initilization\n Random randomN = new Random();\n \n int speedP1 = randomN.nextInt(5) + 1; // Super 1\n int speedP2 = randomN.nextInt(5) + 1;\n \n int defP1 = randomN.nextInt(5) + 1; // Super 2\n int defP2 = randomN.nextInt(5) + 1;\n \n int attackP1 = randomN.nextInt(5) + 1; // Super 3\n int attackP2 = randomN.nextInt(5) + 1;\n \n int P1stats = ((speedP1 + defP1) + attackP1);\n int P2stats = ((speedP2 + defP2) + attackP2);\n \n return (P1stats > P2stats);\n }", "@Override\n public int getArm(int time, int type, List<Vector> contexts, boolean shouldExploit) {\n Matrix contextMatrix = Utils.stackContexts(contexts);\n Utils.normalizeColumns(contextMatrix);\n\n // Form distribution (K x 1)\n Vector weightVector = Vector.fromArray(this.weights);\n Vector distribution = contextMatrix.multiply(weightVector);\n\n int arm = 0;\n if (shouldExploit || super.shouldActGreedy()) {\n arm = Utils.argMax(distribution);\n } else if (super.shouldActRandom(type)) {\n arm = this.rand.nextInt(this.getNumArms());\n } else {\n // Sample from the distribution\n arm = Utils.sampleDistribution(distribution, this.rand);\n }\n\n return arm;\n }", "@Test\r\n public void testPlayer_setRandomStrategy_2() {\r\n player2 = new Player(\"\", true);\r\n player2.setRandomStrategy();\r\n String firstStrategy = player2.getStrategy();\r\n boolean strategyReplaced = false;\r\n // generate 20 random strategies and assert at least one of them comes back different.\r\n for(int i = 0; i < 20; i++) {\r\n player2.setRandomStrategy();\r\n if (!player2.getStrategy().equalsIgnoreCase(firstStrategy)) {\r\n strategyReplaced = true;\r\n }\r\n }\r\n assertTrue(strategyReplaced);\r\n }", "@Override\n public int attack() {\n return new Random().nextInt(5);\n }", "private void randomMove() {\n }", "public int getRandomBreed() {\n Random r = new Random();\n// displayToast(Integer.toString(getRandomBreed())); // not needed. generates another random number\n return r.nextInt(6);\n }", "@Override\n public int attack(){\n //create an int list to store the numbers\n int[] arr = {zero, six, ten};\n //get a random index of the list\n int index = getRandom().nextInt(arr.length);\n //return the number on that random index\n int damageVal = arr[index];\n return damageVal;\n }", "static Direction randomDirection() {\n\t\treturn new Direction((float)Math.random() * 2 * (float)Math.PI);\n\t}", "private int rand() {\n return (int)(Math.random()*(RAND_MAX + 1));\n }", "@ReflectiveMethod(name = \"a\", types = {Random.class})\n public int a(Random random){\n return (int) NMSWrapper.getInstance().exec(nmsObject, random);\n }", "public static void main(String args[]) throws IOException {\n Character Jill = new Character(\"red\", \"brown:\", \"female\", \"green\", \"Jill\");\n Character Sean = new Character(\"red\", \"green\", \"male\", \"green\", \"Sean\");\n Character Becky = new Character(\"brown\", \"brown\", \"female\", \"blue\", \"Becky\");\n Character Tom = new Character(\"brown\", \"green\", \"male\", \"blue\", \"Tom\");\n Character Caroline = new Character(\"blonde\", \"blue\", \"female\", \"blue\", \"Caroline\");\n Character Curtis = new Character(\"brown\", \"blue\", \"male\", \"red\", \"Curtis\");\n Character Steph = new Character(\"brown\", \"brown\", \"female\", \"red\", \"Steph\");\n\n //Add characters to ArrayList\n Roster people = new Roster();\n people.addChar(Jill);\n people.addChar(Sean);\n people.addChar(Becky);\n people.addChar(Tom);\n people.addChar(Caroline);\n people.addChar(Curtis);\n people.addChar(Steph);\n\n //create AI Object and copy Roster\n Roster possChars = new Roster();\n possChars.addChar(Jill);\n possChars.addChar(Sean);\n possChars.addChar(Becky);\n possChars.addChar(Tom);\n possChars.addChar(Caroline);\n possChars.addChar(Curtis);\n possChars.addChar(Steph);\n AI aibot = new AI(possChars);\n\n //create gameplay loop\n boolean noWinner = true;\n\n //create turn loop\n boolean turn = true;\n\n //Create Random number from array for user and computer\n Random rand = new Random();\n int computerNum = rand.nextInt(people.getSize());\n int userNum = rand.nextInt(people.getSize());\n\n //Set random number from array to specific character\n //call to isPlayer and isComputer from Character class to\n // set boolean switch to true to indicate if it belongs to user or computer\n people.getChar(computerNum).setAsComputer();\n people.getChar(userNum).setAsPlayer();\n\n //These values are for the buffered reader input for AI response\n String q = \"\";\n int answer = 2;\n\n\n //Create Menu and character names\n System.out.println(\"Welcome to Guess Who!\");\n System.out.println(\"You will be assigned a random character from the list of created characters\");\n System.out.println(\"You can either guess who the computer has, or ask a question\");\n System.out.println(\"Once you have either made a guess or asked a question, you turn ends and the computer will go\");\n System.out.println(\"Your goal is to guess who the computer has before it guesses your character first!\");\n System.out.println(\"Good Luck!\\n\");\n System.out.println(\"\\nYour character is: \" + people.getChar(userNum).toString());\n\n //System.out.println(\"//test this is the computer's character//\");\n //System.out.println(people.getChar(computerNum).toString());\n\n\n while (noWinner) {\n printMenu();\n do {\n String s = in.readLine().trim();\n int i = Integer.parseInt(s);\n\n switch (i) {\n //Ask question\n case 1:\n displayQuestions();\n\n String t = in.readLine().trim();\n int j = Integer.parseInt(t);\n\n\n switch (j) {\n case 1:\n //male?\n if (people.getChar(computerNum).isGender(\"male\")) {\n System.out.println(\"Yes!\");\n } else {\n System.out.println(\"No\");\n }\n turn = false;\n break;\n case 2:\n //female?\n if (people.getChar(computerNum).isGender(\"female\")) {\n System.out.println(\"Yes!\");\n } else {\n System.out.println(\"No\");\n }\n turn = false;\n break;\n case 3:\n //red hair?\n if (people.getChar(computerNum).isHair(\"brown\")) {\n System.out.println(\"Yes!\");\n } else {\n System.out.println(\"No\");\n }\n turn = false;\n break;\n case 4:\n //brown hair?\n if (people.getChar(computerNum).isHair(\"red\")) {\n System.out.println(\"Yes!\");\n } else {\n System.out.println(\"No\");\n }\n turn = false;\n break;\n case 5:\n //blonde hair?\n if (people.getChar(computerNum).isHair(\"blonde\")) {\n System.out.println(\"Yes!\");\n } else {\n System.out.println(\"No\");\n }\n turn = false;\n break;\n case 6:\n //brown eyes?\n if (people.getChar(computerNum).isEye(\"green\")) {\n System.out.println(\"Yes!\");\n } else {\n System.out.println(\"No\");\n }\n turn = false;\n break;\n case 7:\n //green eyes?\n if (people.getChar(computerNum).isEye(\"blue\")) {\n System.out.println(\"Yes!\");\n } else {\n System.out.println(\"No\");\n }\n turn = false;\n break;\n case 8:\n //blue eyes?\n if (people.getChar(computerNum).isEye(\"brown\")) {\n System.out.println(\"Yes!\");\n } else {\n System.out.println(\"No\");\n }\n turn = false;\n break;\n case 9:\n //green shirt?\n if (people.getChar(computerNum).isShirt(\"green\")) {\n System.out.println(\"Yes!\");\n\n } else {\n System.out.println(\"No\");\n }\n turn = false;\n break;\n case 10:\n //blue shirt?\n if (people.getChar(computerNum).isShirt(\"blue\")) {\n System.out.println(\"Yes!\");\n } else {\n System.out.println(\"No\");\n }\n\n turn = false;\n break;\n case 11:\n //red shirt?\n if (people.getChar(computerNum).isShirt(\"red\")) {\n\n System.out.println(\"Yes!\");\n } else {\n System.out.println(\"No\");\n }\n turn = false;\n break;\n default:System.out.println(\"Please enter a valid number\");\n }\n\n break;\n //Guess computer's character\n case 2:\n System.out.println(\"Input the character that you believe the AI has\\n First letter capitalized Please :)\");\n String guess = in.readLine().trim();\n if (people.getChar(computerNum).isName(guess)) {\n System.out.println(\"Congratulations! You guessed correctly!\\n You win!!!\\nThanks for Playing :D\");\n noWinner = false;\n } else {\n System.out.println(\"No, try again.\");\n }\n break;\n //See list of playable characters\n\n case 3:\n System.out.println(people.toString());\n\n break;\n //see ALL characters' attributes\n case 4:\n System.out.println(people.getAttributes());\n break;\n //See User's character and their attributes\n case 5:\n System.out.println(people.getMyCharacter(userNum));\n break;\n //Quit game\n case 6:\n System.out.println(\"Goodbye!\");\n turn = false;\n noWinner = false;\n break;\n default:System.out.println(\"Please enter a valid number\");\n }\n } while (turn);\n\n //AI takes turn\n //check for lowest h value in Hashmap to ask question\n //If yes, remove appropriate characters from aiRoster\n //Delete question from Hashmap\n //get traits from remaining characters and update question values\n //If no, do same, but with opposite answers\n if (turn == false) {\n\n if (aibot.aiRoster.getSize() == 1) {\n System.out.println(\"Your character is \" + aibot.aiRoster.getChar(0));\n noWinner = false;\n }\n else {\n String quest = aibot.bestQuestion();\n System.out.println(\"Is \" + quest + \" true?\" + \"\\nType '1' for yes, '0' for no, and 2 to see your Character's attributes\");\n\n do {\n q = in.readLine().trim();\n answer = Integer.parseInt(q);\n\n\n if (answer == 1) {\n aibot.activateBrain(1, quest);\n turn = true;\n } else if (answer == 0) {\n aibot.activateBrain(0, quest);\n turn = true;\n } else if(answer == 2){\n System.out.println(people.getMyCharacter(userNum));\n }\n else {\n System.out.println(\"Please enter a '1' or '0' to answer\");\n }\n } while(turn == false);\n\n }\n\n }\n }\n }", "abstract Truerandomness newInstance();", "public static DealSetup pickOneAtRandom() {\n\t\tfinal Random r = ThreadLocalRandom.current();\n\t\tfinal int dex = r.nextInt(3);\n\t\treturn 0 == dex ? DealSetup.ALPHA : (1 == dex ? DealSetup.BETA\n\t\t\t\t: DealSetup.GAMMA);\n\t}", "public void createRandomPorts() {\n\t\t\n\t\tList<String> types = Arrays.asList(new String[] {\"wood\", \"ore\", \"wheat\", \"sheep\", \"brick\", null, null, null, null});\n\t\tCollections.shuffle(types);\n\t\t\n\t\tports[0] = new Port(types.get(0), -3, 2, \"NE\", 2, \"NE\", \"E\");\n\t\tports[1] = new Port(types.get(1), 3, -3, \"SW\", 3, \"SW\", \"W\");\n\t\tports[2] = new Port(types.get(2), 2, 1, \"NW\", 3, \"W\", \"NW\");\n\t\tports[3] = new Port(types.get(3), 0, 3, \"N\", 3, \"NW\", \"NE\");\n\t\tports[4] = new Port(types.get(4), 1, -3, \"S\", 2, \"SE\", \"SW\");\n\t\tports[5] = new Port(types.get(5), -1, -2, \"S\", 2, \"SE\", \"SW\");\n\t\tports[6] = new Port(types.get(6), 3, -1, \"NW\", 2, \"W\", \"NW\");\n\t\tports[7] = new Port(types.get(7), -2, 3, \"NE\", 2, \"NE\", \"E\");\n\t\tports[8] = new Port(types.get(8), -3, 0, \"SE\", 3, \"E\", \"SE\");\n\t}", "public static void main(String[] args) {\n\r\n\t\tRandom rr=new Random();\r\n\t\t\r\n\t\tSystem.out.println(Math.random());//[0,1)\r\n\t\t \r\n\t\t// 第一种情况 int(强转之后最终的值一定是0)\r\n\t\t// 第二种情况 int(强转之后将小数点舍去 1-5)\r\n\t\tSystem.out.println((int)Math.random()*5);//0.99*5永远到不了5\r\n\t\tSystem.out.println((int)(Math.random()*5+1));//[1,5.)\r\n\t\t\r\n\t\tSystem.out.println(rr.rand107());\r\n\t\tSystem.out.println(rr.rand107());\r\n\t\tSystem.out.println(rr.rand107());\r\n\t\tSystem.out.println(rr.rand107());\r\n\t\t\r\n\t\tfor(int i=0;i<=20;i++){\r\n\t\t\tSystem.out.print(i%7+\"-\");\r\n\t\t\t\r\n\t\t}\r\n\t\t//1-M的随机产生\r\n\t\t//(int)(Math.random()*M+1)\r\n\t\t\r\n\t\t\r\n\t\t//产生0 1的概率不同 Math.random()<p?0:1\r\n\t\tSystem.out.println(\"----\"+rr.rand01p());\r\n\t\tSystem.out.println(\"----\"+rr.rand01());\r\n\t\tfor(int i=0;i<=11;i++){\r\n\t\t\tSystem.out.print(i%6+\"-\");\r\n\t\t \t\r\n\t\t}\r\n\t\tSystem.out.println();\r\n\t\tSystem.out.println(rr.rand106());\r\n\t}", "@Override\r\n public void initCreature() \r\n {\n \t\r\n if ( worldObj.provider.dimensionId == 1 && worldObj.rand.nextInt( 5 ) == 0 )\r\n \t{\r\n \tsetCarried( Block.whiteStone.blockID );\r\n \tsetCarryingData( 0 );\r\n \t}\r\n }", "private static Directions getDirection() {\n\t\t\treturn values()[rand.nextInt(4)];\n\t\t}", "void randomize() {\r\n\t\trandomize(1, this.length());\r\n\t}", "public void makeRandomMove() {\n\t\ttry{\r\n\t\t\tif (playerId == game.getState().getTurn()){\r\n\t\t\t\tgame.execute(randPlayer.requestAction(game.getState()));\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch(IllegalArgumentException e){\r\n\t\t\t\r\n\t\t}\r\n\t}" ]
[ "0.65205616", "0.6455896", "0.6418166", "0.63306665", "0.629475", "0.62851787", "0.62550277", "0.6198587", "0.6181326", "0.6171185", "0.6063036", "0.6056062", "0.59899867", "0.59567076", "0.5936694", "0.5921451", "0.5916746", "0.59002846", "0.5838939", "0.58384115", "0.5836447", "0.5828577", "0.5753522", "0.5749257", "0.57366174", "0.57301277", "0.5689422", "0.5662353", "0.5646313", "0.56440663", "0.5618287", "0.56126547", "0.55993307", "0.55827415", "0.55652773", "0.5564402", "0.5549537", "0.5534003", "0.5522953", "0.5520698", "0.5518007", "0.55157405", "0.5505632", "0.5497987", "0.5491509", "0.5489884", "0.54844695", "0.5471916", "0.547014", "0.5466047", "0.54590017", "0.54587495", "0.5458094", "0.54466295", "0.5441433", "0.5440731", "0.54314756", "0.5426965", "0.54261166", "0.5419884", "0.54101735", "0.5409787", "0.54000694", "0.53970873", "0.5394421", "0.5380373", "0.53741634", "0.536937", "0.53622764", "0.5360517", "0.5357125", "0.53552425", "0.5351149", "0.5347859", "0.53471744", "0.5338458", "0.533373", "0.53258336", "0.5325418", "0.5323118", "0.5318663", "0.5316066", "0.5312785", "0.52984536", "0.5288624", "0.52883196", "0.5281697", "0.5277445", "0.52743614", "0.5267805", "0.5266536", "0.5259307", "0.52579534", "0.5253438", "0.52521336", "0.52425027", "0.5241103", "0.5237209", "0.5234102", "0.52333474", "0.52321196" ]
0.0
-1
Return a move based on the current board configuration
public synchronized String computeMove() { if (game == null) { System.err.println("CODE ERROR: AI is not attached to a game."); return "0,0"; } char[] board = (char[]) game.getStateAsObject(); //Choose a smart move if that AI is set to "Smart" or if the random value equals 2 if (aiType == 1) { if(useHeat && ((int) (Math.random() * heat)) == 2){ return "" + getRandomMove(board); } else{ return "" + getSmartMove(board); } } else { return "" + getRandomMove(board); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract Move getMove(Board board);", "private int getSmartMove(char[] boardConfig) {\n\n ArrayList<Integer> emptySpaces = getEmptySpaces(boardConfig);\n\n double bestScore = -1;\n String bestChoice = \"\";\n int move = 0;\n\n //Loop through each empty space on the board\n for (Integer emptySpace : emptySpaces) {\n int space = emptySpace;\n\n char[] tempBoard = new char[boardConfig.length];\n\n //Create a copy of the board array\n System.arraycopy(boardConfig, 0, tempBoard, 0, boardConfig.length);\n\n //Add the current player's piece to the current empty spot\n tempBoard[space] = game.getPlayer() == 0 ? 'X' : 'O';\n\n //Get a string from the possible move board\n String tempBoardString = boardToString(tempBoard);\n\n //Attempt to get the possible move board configuration data from the long term memory\n BoardRecord record = longTermMemory.get(tempBoardString);\n\n //Check if a record was found\n if (record != null) {\n\n //Calculate the score of the current move in question\n float currentValue = (float) (record.getWins() - record.getLosses()) / (record.getLosses() + record.getWins() + record.getTies());\n\n //If the new move is better than the current best move choose it\n if (currentValue > bestScore) {\n bestScore = currentValue;\n move = space;\n bestChoice = tempBoardString;\n }\n }\n }\n\n if (!Objects.equals(bestChoice, \"\")) {\n shortTermMemory.add(bestChoice);\n return move;\n } else {\n return getRandomMove(boardConfig);\n }\n }", "Move getMove() {\n try {\n boolean playing0 = _playing;\n while (_playing == playing0) {\n prompt();\n\n String line = _input.readLine();\n if (line == null) {\n quit();\n }\n line = line.trim();\n if (!processCommand(line)) {\n Move move = Move.create(line, _board);\n if (move == null) {\n error(\"invalid move: %s%n\", line);\n } else if (!_playing) {\n error(\"game not started\");\n } else if (!_board.isLegal(move)) {\n error(\"illegal move: %s%n\", line);\n } else {\n return move;\n }\n }\n }\n } catch (IOException excp) {\n error(1, \"unexpected I/O error on input\");\n }\n return null;\n }", "@Override\n\tpublic Direction getMove() {\n if (ticks < MAX_TICKS_PER_ROUND - 100) {\n Direction[] dirs = Direction.values();\n return dirs[random.nextInt(dirs.length)];\n } else {\n // Move towards boat\n int deltaX = 0;\n int deltaY = 0;\n if (currentLocation.getX() < 0)\n deltaX = 1;\n else if (currentLocation.getX() > 0)\n deltaX = -1;\n\n if (currentLocation.getY() < 0)\n deltaY = 1;\n else if (currentLocation.getY() > 0)\n deltaY = -1;\n\n if (deltaX > 0 && deltaY == 0) {\n return Direction.E;\n } else if (deltaX > 0 && deltaY > 0) {\n return Direction.NE;\n } else if (deltaX > 0 && deltaY < 0) {\n return Direction.SE;\n } else if (deltaX == 0 && deltaY == 0) {\n return Direction.STAYPUT;\n } else if (deltaX == 0 && deltaY < 0) {\n return Direction.N;\n } else if (deltaX == 0 && deltaY > 0) {\n return Direction.S;\n } else if (deltaX < 0 && deltaY == 0) {\n return Direction.W;\n } else if (deltaX < 0 && deltaY > 0) {\n return Direction.NW;\n } else if (deltaX < 0 && deltaY < 0) {\n return Direction.NE;\n } else {\n throw new RuntimeException(\"I HAVE NO IDEA\");\n }\n }\n\t}", "public Move chooseMove(PentagoBoardState boardState) {\n // You probably will make separate functions in MyTools.\n // For example, maybe you'll need to load some pre-processed best opening\n // strategies...\n \t\n PentagoBoardState cloneBoard = (PentagoBoardState) boardState.clone();\n \n \n Move myMove = null;\n int myPlayer = boardState.getTurnPlayer();\n if(boardState.getTurnNumber() == 0 || boardState.getTurnNumber() == 1) {\n \t//For the first two rounds.\n \t//Place at the center of each quadrant.\n \tif(boardState.getPieceAt(1, 1) == null) {//TL center is null.\n \t\tmyMove = new PentagoMove(1,1,Quadrant.TR,Quadrant.BL,myPlayer);\n \t}else if(boardState.getPieceAt(4, 1) == null) {//TR center is null.\n \t\tmyMove = new PentagoMove(4,1,Quadrant.TL,Quadrant.TR,myPlayer);\n \t}else if(boardState.getPieceAt(1, 4) == null) {//BL center is null\n \t\tmyMove = new PentagoMove(1,4,Quadrant.TL,Quadrant.BL,myPlayer);\n \t}else {myMove = new PentagoMove(4,4,Quadrant.TL,Quadrant.BR,myPlayer);}\n }\n \n else {//Do a-b pruning.\n myMove = MyTools.max_value(cloneBoard, Integer.MIN_VALUE, Integer.MAX_VALUE, 3).getMove();\n }\n \n // Return your move to be processed by the server.\n return myMove;\n }", "@Override\n\tpublic Direction getMove() {\n\t\t//Equal probability for each of the 8 compass direction, as well as staying stationary\n\t\treturn choices[this.random.nextInt(9)];\n\t}", "public Position getNextMove(TicTacToeBoard state) throws Exception {\r\n\t\treturn getRandomMove(state);\r\n\t}", "Move getMove(String str) {\n String line = str;\n Move move = Move.create(line, _board);\n if (move == null) {\n error(\"invalid move: %s%n\", line);\n } else if (!_playing) {\n error(\"game not started\");\n } else if (!_board.isLegal(move)) {\n error(\"illegal move: %s%n\", line);\n } else {\n return move;\n }\n System.out.println();\n prompt();\n return null;\n }", "public Move chooseMove() {\n return new Move();\n }", "public PentagoMove chooseMove(PentagoBoardState boardState) {\n\n // You probably will make separate functions in MyTools.\n // For example, maybe you'll need to load some pre-processed best opening\n // strategies...\n Move myMove = boardState.getRandomMove();\n MyTools.simulateGame(boardState, (PentagoMove) myMove);\n MyTools.setPlayer(player_id);\n\n\n if(boardState.getTurnNumber()<3){\n myMove = MyTools.initialMove(boardState);\n }else{\n myMove = MyTools.myTurn(boardState);\n }\n PentagoMove winningMove = MyTools.gameWinnable(boardState);\n if(winningMove != null){\n System.out.println(\"Game Over!\");\n return winningMove;\n }\n int heuristic = MyTools.getHeuristic((PentagoMove)myMove, boardState);\n System.out.println(\"The heuristic is:\" + heuristic);\n PentagoMove m = (PentagoMove) myMove;\n // Return your move to be processed by the server.\n System.out.println(\"PLaying at: x=\"+ ((PentagoMove) myMove).getMoveCoord().getX()+ \", y=\" +((PentagoMove) myMove).getMoveCoord().getY());\n return ((PentagoMove) myMove);\n }", "@Override\n public Coordinate getMove(ImmutableGameBoard gameBoard, int numInARowToWin) {\n List<Coordinate> availableMoves = getAvailableMoves(gameBoard);\n int randomIndex = Utils.getRandom(0, availableMoves.size() - 1);\n\n return availableMoves.get(randomIndex);\n }", "protected int getMove() \t\t\t\t{\treturn move;\t\t}", "public Move chooseMove(TablutBoardState boardState) {\n \n \tList<TablutMove> options = boardState.getAllLegalMoves();\n\n \n bestMove = options.get(((int) MyTools.getSomething())% (options.size()));\n\n int depth = DEPTH;\n int opponent = boardState.getOpponent();\n boolean isMax;\n if(opponent==1){\n \tisMax = true;\n \t//System.out.println(\"I'm max\");\n }\n else{\n \tisMax = false;\n \t//System.out.println(\"I'm min\");\n }\n //bestMove = \n \n int bestvalue = minimax(boardState,isMax, depth,-10000,10000);\n \n \n //int minNumberOfOpponentPieces = boardState.getNumberPlayerPieces(opponent);\n //boolean moveCaptures = false;\n //System.out.println(\"minimax return value: \"+bestvalue);\n \n \n \n \n return bestMove;\n }", "public int getComMove() {\n\n int move;\n\n // Checks if a computer played a move in that spot\n for (int i = 0; i < getBoardSize(); i++) {\n if (playBoard[i] != REAL_PLAYER && playBoard[i] != COM_PLAYER) {\n char currPlace = playBoard[i];\n playBoard[i] = COM_PLAYER;\n\n if (winCheck() == 3) {\n setMove(COM_PLAYER, i);\n return i;\n }\n else {\n playBoard[i] = currPlace;\n }\n }\n }\n\n // Check to block human player from winning\n for (int i = 0; i < getBoardSize(); i++) {\n if (playBoard[i] != REAL_PLAYER && playBoard[i] != COM_PLAYER) {\n char currPlace = playBoard[i];\n playBoard[i] = REAL_PLAYER;\n\n if (winCheck() == 2) {\n setMove(COM_PLAYER, i);\n return i;\n }\n else {\n playBoard[i] = currPlace;\n }\n }\n }\n\n // If play spot is empty, then make move\n do {\n move = randMove.nextInt(getBoardSize());\n } while (playBoard[move] == REAL_PLAYER || playBoard[move] == COM_PLAYER);\n setMove(COM_PLAYER, move);\n\n return move;\n }", "private Move produceHumanMove(Board board){\n\t\tfinal int PRINT_BOARD = 1, ENTER_A_MOVE = 2;\n\t\twhile(true) // keep asking the user the question below till he make a move.\n\t\t{\n\t\t\tSystem.out.println(\"Press 1 to display the board. Press 2 to make a move:\");\n\t\t\tint userInput = scanner.nextInt();\n\t\t\tif(userInput == PRINT_BOARD){\n\t\t\t\tSystem.out.println(board.toString());\n\t\t\t}\n\t\t\telse if(userInput == ENTER_A_MOVE){\n\t\t\t\tSystem.out.println(\"Enter the row number:\");\n\t\t\t\tint inRow = scanner.nextInt();\n\t\t\t\tSystem.out.println(\"Enter the index of the leftmost stick:\");\n\t\t\t\tint leftMost = scanner.nextInt();\n\t\t\t\tSystem.out.println(\"Enter the index of the rightmost stick:\");\n\t\t\t\tint rightMost = scanner.nextInt();\n\t\t\t\treturn new Move(inRow,leftMost,rightMost);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tSystem.out.println(\"Unsupported command\");\n\t\t\t}\n\t\t}\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 Move produceMove(Board board){\n\t\t\n\t\tswitch(playerType){\n\t\t\n\t\t\tcase RANDOM:\n\t\t\t\treturn produceRandomMove(board);\t\t\t\t\n\t\t\t\t \n\t\t\tcase SMART: \n\t\t\t\treturn produceSmartMove(board);\n\t\t\t\t\n\t\t\tcase HEURISTIC:\n\t\t\t\treturn produceHeuristicMove(board);\n\t\t\t\t\n\t\t\tcase HUMAN:\n\t\t\t\treturn produceHumanMove(board);\n\n\t\t\t//Because we checked for legal player types in the\n\t\t\t//constructor, this line shouldn't be reachable.\n\t\t\tdefault: \n\t\t\t\treturn null;\t\t\t\n\t\t}\n\t}", "@Override\n\tpublic GridCell execute() {\n\t\t//1. if there is a winning position, take it\n\t\tArrayList<GridCell> winningCell = TicTacToeBoardExaminer.getWinningPositions(board, side);\n\t\tif (winningCell.size() > 0) {\n\t\t\tGridCell move = winningCell.get(0);\n\t\t\treturn move;\n\t\t}\n\t\t\n\t\t//2. if there is a losing position, block it\n\t\tArrayList<GridCell> losingCell = TicTacToeBoardExaminer.getLosingPositions(board, side);\n\t\tif (losingCell.size() > 0) {\n\t\t\tGridCell move = losingCell.get(0);\n\t\t\treturn move;\n\t\t}\n\t\t\n\t\t//TODO: Implement checking of forks. This will get you to 100% win or tie rate\n\t\t\n\t\t//3. Otherwise get the optimal position\n\t\tGridCell optimal = TicTacToeBoardExaminer.getOptimal(board, side);\n\t\tif (optimal != null)\n\t\t\treturn optimal;\n\t\t\n\t\t//4. Otherwise just move randomly\n\t\telse \n\t\t\treturn new RandomStrategy(board, side).execute();\n\t\t\n\t}", "public int getMoveMode();", "int chooseMove();", "public String getMove() {\n\t\treturn move;\n\t}", "public int getComputerMove()\n {\n int move;\n\n // First see if there's a move O can make to win\n for (int i = 0; i < BOARD_SIZE; i++) {\n if (mBoard[i] != HUMAN_PLAYER && mBoard[i] != COMPUTER_PLAYER) {\n char curr = mBoard[i];\n mBoard[i] = COMPUTER_PLAYER;\n if (checkForWinner() == 3) {\n mBoard[i] = curr;\n return i;\n }\n else\n mBoard[i] = curr;\n }\n }\n\n // See if there's a move O can make to block X from winning\n for (int i = 0; i < BOARD_SIZE; i++) {\n if (mBoard[i] != HUMAN_PLAYER && mBoard[i] != COMPUTER_PLAYER) {\n char curr = mBoard[i]; // Save the current number\n mBoard[i] = HUMAN_PLAYER;\n if (checkForWinner() == 2) {\n //mBoard[i] = COMPUTER_PLAYER;\n mBoard[i] = curr;\n return i;\n }\n else\n mBoard[i] = curr;\n }\n }\n\n // Generate random move\n do\n {\n move = mRand.nextInt(BOARD_SIZE);\n } while (mBoard[move] == HUMAN_PLAYER || mBoard[move] == COMPUTER_PLAYER);\n\n return move;\n }", "private int getRandomMove(char[] boardConfig) {\n ArrayList<Integer> emptySpaces = getEmptySpaces(boardConfig);\n\n int random = (int) (Math.random() * emptySpaces.size());\n int randomSpace = emptySpaces.get(random);\n char currentPlayer = (game.getPlayer() == 0) ? 'X' : 'O';\n char[] tempBoard = boardConfig.clone();\n\n tempBoard[randomSpace] = currentPlayer;\n shortTermMemory.add(boardToString(tempBoard));\n\n return randomSpace;\n }", "public SinglePieceMove getMove() {\n return move;\n }", "protected int getMove(){\r\n\t\treturn this.move;\r\n\t}", "Move getBestMove() {\n //System.out.println(\"AI chooses: \" + m.toString());\n return moves.get((int) (Math.random() * moves.size()));\n }", "protected Direction selectMove() {\n Map<Integer, Direction> positive, negative;\n // Add the directions that contains negative stations in a negative set\n // And every other direction in a positive set\n positive = new HashMap<Integer,Direction>(16);\n negative = new HashMap<Integer,Direction>(16);\n for (Direction d : Direction.directions) {\n int result = checkMove(d);\n if (result == 1) {\n positive.put(positive.size(), d);\n } else if (result == 0) {\n negative.put(negative.size(), d);\n } else {\n continue;\n }\n }\n // If there is no positive move, choose a RANDOM negative move\n if (positive.isEmpty()) {\n return negative.get(rand.nextInt(negative.size()));\n } else { // Otherwise choose a RANDOM positive move\n return positive.get(rand.nextInt(positive.size()));\n }\n }", "private Board nextBoard () {\n while (!hasExhaustedDirections()) {\n getNextMove();\n directions_checked++;\n if (inBounds(move)) {\n return createMovedBoard(free, move);\n }\n }\n return null;\n }", "public static String defaultMakeMove() {\n \n final int x = Map.MyX();\n final int y = Map.MyY();\n final List<String> validMoves = new ArrayList<String>();\n \n if (!Map.IsWall(x, y - 1)) {\n validMoves.add(\"North\");\n }\n if (!Map.IsWall(x+1, y)) {\n validMoves.add(\"East\");\n }\n if (!Map.IsWall(x,y+1)) {\n validMoves.add(\"South\");\n }\n if (!Map.IsWall(x-1,y)) {\n validMoves.add(\"West\");\n }\n \n if (validMoves.size() == 0) {\n return \"North\"; // Hopeless. Might as well go North!\n } else {\n final Random rand = new Random();\n int whichMove = rand.nextInt(validMoves.size());\n return validMoves.get(whichMove);\n } // End of the if - else //\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 Direction getMove() {\n\n // If 'count' is >= 3, then reset 'value' for next random direction.\n if (this.count >= 3) {\n this.value = this.generator.nextInt(4); // new value\n this.count = 0; // reset count to 0\n }\n \n ++this.count; // increment count for each call\n if (this.value == 0) {\n return Direction.NORTH;\n }\n else if (this.value == 1) {\n return Direction.SOUTH;\n }\n else if (this.value == 2) {\n return Direction.WEST;\n }\n else { // if value == 3\n return Direction.EAST;\n }\n }", "@Override\r\n\t// Precondition: During testing the AI is associated with the 'O', the odd number move.\r\n \tpublic Point desiredMove(TicTacToeGame theGame) {\n\t\t\r\n\t\tchar[][] board = theGame.getTicTacToeBoard();\r\n\t\tPoint dPoint;\r\n\t //check for win\r\n\t\tdPoint = winOrBlock(board,'O');\r\n\t\tif(dPoint != null) {\r\n\t\t\tSystem.out.println(\"winning\");\r\n\t\t\treturn dPoint;\r\n\t\t}\r\n\t\t//check for block\r\n\t\tdPoint = winOrBlock(board,'X');\r\n\t\tif(dPoint != null) {\r\n\t\t\tSystem.out.println(\"blocking\");\r\n\t\t\treturn dPoint;\r\n\t\t}\r\n\t\t//otherwise pick random loc\r\n\t\tRandom randy = new Random(); \r\n\t int randX = randy.nextInt(3);\r\n\t int randY = randy.nextInt(3);\r\n\t while(!theGame.available(randX, randY)) {\r\n\t \trandX = randy.nextInt(3);\r\n\t \trandY = randy.nextInt(3);\r\n\t }\r\n\t System.out.println(\"random\");\r\n\t return new Point(randX, randY);\r\n\t}", "public Direction getMove(){\n\t\tif (diam < 3){\n\t\t\tdiam++;\n\t\t\tjustnow = \"east\";\n\t\t\treturn Direction.EAST;\n\t\t}\n\t\telse if (diam < 6){\n\t\t\tdiam++;\n\t\t\tjustnow = \"south\";\n\t\t\treturn Direction.SOUTH;\n\t\t}\n\t\telse if (diam < 9){\n\t\t\tdiam++;\n\t\t\tjustnow = \"west\";\n\t\t\treturn Direction.WEST;\n\t\t}\n\t\telse if (diam < 12){\n\t\t\tdiam++;\n\t\t\tjustnow = \"north\";\n\t\t\treturn Direction.NORTH;\n\t\t}\n\t\telse {\n\t\t\tdiam = 0;\n\t\t\tdiam++;\n\t\t\tjustnow = \"east\";\n\t\t\treturn Direction.EAST;\n\t\t}\t\n\t}", "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 Location computerMove()\n\t{\n\t\tArrayList<Location> possibleLocs = new ArrayList<Location>();\n\t\tfor (int row = 0; row < grid.length; row++)\n\t\t{\n\t\t\tfor (int col = 0; col < grid[0].length; col++)\n\t\t\t{\n\t\t\t\tLocation temp = new Location(row, col);\n\t\t\t\tif (!isOccupied(temp))\n\t\t\t\t\tpossibleLocs.add(temp);\n\t\t\t}\n\t\t}\n\t\tfor (int count = 0; count < possibleLocs.size(); count++)\n\t\t{\n\t\t\tif (checkWin(1, possibleLocs.get(count)))\n\t\t\t\treturn possibleLocs.get(count);\n\t\t\telse if (checkWin(0, possibleLocs.get(count)))\n\t\t\t\treturn possibleLocs.get(count);\n\t\t}\n\t\treturn possibleLocs.get((int) (Math.random() * possibleLocs.size()));\n\t}", "public int getCurrentMoveIndex() {\n return boardIterator.getPos();\n }", "@Override\r\n\tpublic boolean makeMove(String notation) {\n\t\tif(Castle.isCastlingMove(new ChessCoordinate(notation))) {\r\n\t\t\tKing playerKing = (King) getPlayerTurn().getPieces(\"King\", true).get(0);\r\n\t\t\t//return the result of trying to castle\r\n\t\t\treturn playerKing.move(new ChessCoordinate(notation));\r\n\t\t\t\r\n\t\t}else {\r\n\t\t\t//not a castling move, standard move\r\n\t\t\t\t\r\n\t\t\tString[] notationList = notation.split(\"\");\r\n\t\t\t//find the piece name\r\n\t\t\tString pieceName = ChessPieceNames.getPieceName(notationList[0]);\t\t\r\n\t\t\t\r\n\t\t\tif(pieceName == null && getColumnNames().contains(notationList[0].toLowerCase())) {\r\n\t\t\t\t//if first character is a column and returned null from above\r\n\t\t\t\t//must be a pawn move like e4 or axb2\r\n\t\t\t\tpieceName = ChessPieceNames.PAWN.toString();\r\n\t\t\t}else if(pieceName == null){\r\n\t\t\t\t//not a column and null so invalid move\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\r\n//\t\t\t//capturing move if there is a capture (x)\r\n\t\t\tboolean isCaptureMove = Arrays.asList(notationList).contains(\"x\");\r\n\t\t\t\r\n\t\t\t//final coordinate\r\n\t\t\tString coordinateString = notationList[notationList.length-2] + notationList[notationList.length-1];\r\n\t\t\tChessCoordinate coordinate = new ChessCoordinate(coordinateString);\r\n\t\t\tif(coordinate.isValid()) {\r\n\t\t\t\t//extract players alive pieces of piece name\r\n\t\t\t\tList<Piece> piecesOfType = getPlayerTurn().getPieces(pieceName, true);\r\n\t\t\t\t//list of pieces that can move to the same square\r\n\t\t\t\tList<Piece> piecesCanMoveToSquare = new ArrayList<Piece>();\r\n\t\t\t\tfor (Piece piece : piecesOfType) {\r\n\t\t\t\t\t\r\n\t\t\t\t\t//use valid moves of attacking if capturing move, else use move to\r\n\t\t\t\t\tSet<Coordinate> pieceMoves = isCaptureMove \r\n\t\t\t\t\t\t\t? piece.getValidMoves(Action.ATTACK) : piece.getValidMoves(Action.MOVE_TO);\r\n\t\t\t\t\tif(pieceMoves.contains(coordinate))piecesCanMoveToSquare.add(piece);\r\n\t\t\t\t}\t\r\n\t\t\t\t\r\n\t\t\t\tif (piecesCanMoveToSquare.size() == 1) {\r\n\t\t\t\t\t//only one piece can go to that square, so take piece at 0th index as the list only has one element\r\n\t\t\t\t\tpiecesCanMoveToSquare.get(0).move(coordinate);\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\telse if (piecesCanMoveToSquare.size() > 1) {\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(notation.length() <= 3) {\r\n\t\t\t\t\t\tSystem.out.println(\"Invalid move, specify which piece to move to \" + coordinateString);\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//multiple pieces of the same type can move to that square, check which one to use\r\n\t\t\t\t\t//if pawn, the identifier to use is the 0th index of notationList, eg axb4. use pawn in column a.\r\n\t\t\t\t\t//for other pieces, column to use is the 1st index of notationList. eg Nab4.\r\n\t\t\t\t\t\r\n\t\t\t\t\t//variable called identifier as it can be a row or column value.\r\n\t\t\t\t\tString identifier = (pieceName.equalsIgnoreCase(ChessPieceNames.PAWN.toString()) ?\r\n\t\t\t\t\t\t\tnotationList[0] : notationList[1]).toLowerCase();\r\n\t\t\t\t\t//identifier should be a row value if pieces share the same column\r\n\t\t\t\t\tboolean isRowIdentifier = shareColumn(piecesOfType);\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(isRowIdentifier && getRowNames().contains(identifier)) {\r\n\t\t\t\t\t\t//locate piece by row and move that piece to coordinate\r\n\t\t\t\t\t\tfor (Piece piece : piecesCanMoveToSquare) {\r\n\t\t\t\t\t\t\t//look at the row number of piece coordinate, see if it matches the identifier \r\n\t\t\t\t\t\t\tif(Character.toString(piece.getPosition().toString().charAt(1)).equalsIgnoreCase(identifier)) {\r\n\t\t\t\t\t\t\t\tpiece.move(coordinate);\r\n\t\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tSystem.out.println(\"There is no \" + pieceName + \" on row \" + identifier);\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t}else if(getColumnNames().contains(identifier)) {\r\n\t\t\t\t\t\tfor (Piece piece : piecesCanMoveToSquare) {\r\n\t\t\t\t\t\t\t//look at the column letter of piece coordinate, see if it matches the identifier \r\n\t\t\t\t\t\t\tif(Character.toString(piece.getPosition().toString().charAt(0)).equalsIgnoreCase(identifier)) {\r\n\t\t\t\t\t\t\t\tpiece.move(coordinate);\r\n\t\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tSystem.out.println(\"There is no \" + pieceName + \" on column \" + identifier);\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//invalid identifier\r\n\t\t\t\t\telse return false;\r\n\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\telse {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t//invalid coordinate, move can not be played\r\n\t\t\telse return false;\r\n\t\t}\r\n\t\t\r\n\t}", "public void getMove(){\n\t\t\n\t}", "public abstract String whichToMove(boolean[] available, String lastMove, int whoseTurn, Scanner scanner);", "public int[][] getMove()\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\twhile (br.ready())\r\n\t\t\t\tSystem.out.println(\"Dumping: \" + br.readLine());\r\n\r\n\t\t\tSystem.out.printf(\"Player %d queried for move%n\", colour);\r\n\t\t\tpw.println(\"4\");\r\n\t\t\tpw.flush();\r\n\t\t}\r\n\t\tcatch (IOException e)\r\n\t\t{\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\r\n\t\tlong start = System.currentTimeMillis();\r\n\t\tMoveThread m = new MoveThread();\r\n\t\tThread t = new Thread(m);\r\n\r\n\t\tt.start();\r\n\r\n\t\t// Query for a move every 10ms until the timeout is reached or the move\r\n\t\t// is received\r\n\t\twhile (m.getMove() == null\r\n\t\t\t\t&& System.currentTimeMillis() - start < timeOut)\r\n\t\t{\r\n\t\t\ttry\r\n\t\t\t{\r\n\t\t\t\tThread.sleep(10);\r\n\t\t\t}\r\n\t\t\tcatch (InterruptedException e)\r\n\t\t\t{\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tm.timeout();\r\n\r\n\t\tint[][] move = m.getMove();\r\n\r\n\t\t// Tell a player of timeout\r\n\t\tif (move == null)\r\n\t\t{\r\n\t\t\tSystem.out.printf(\"Player %d timed out while choosing a move%n\",\r\n\t\t\t\t\tcolour);\r\n\t\t\tpw.println(\"6\");\r\n\t\t\tpw.flush();\r\n\t\t}\r\n\r\n\t\treturn move;\r\n\t}", "public Move getMove(int index) {\r\n\t\tif (index < 0 || index > 3)\r\n\t\t\tthrow new IllegalArgumentException(\"Move index must be between 0 and 3\");\r\n\r\n\t\treturn moves[index];\r\n\t}", "public Coordinate getNextMove() {\n\n if (targetMode && salvationMode == false) {\n\n Coordinate bestNextTarget;\n\n if (!fixedDirection) { // direction is not known\n\n int maxCount = 0;\n bestNextTarget = this.previousTarget;\n\n // find the best target around the last target //\n\n if (inBound(this.axis.y + 1, this.axis.x)) {\n maxCount = countGrid[this.axis.y + 1][this.axis.x];\n bestNextTarget = new Coordinate(this.axis.x, this.axis.y + 1);\n direction = 0; // north by default\n }\n\n if (inBound(this.axis.y - 1, this.axis.x)) {\n if (countGrid[this.axis.y - 1][this.axis.x] > maxCount) {\n maxCount = countGrid[this.axis.y - 1][this.axis.x];\n bestNextTarget = new Coordinate(this.axis.x, this.axis.y - 1);\n direction = 2;\n }\n }\n\n if (inBound(this.axis.y, this.axis.x + 1)) { // try east\n if (countGrid[this.axis.y][this.axis.x + 1] > maxCount) {\n maxCount = countGrid[this.axis.y][this.axis.x + 1];\n bestNextTarget = new Coordinate(this.axis.x + 1, this.axis.y);\n direction = 1;\n }\n }\n\n if (inBound(this.axis.y, this.axis.x - 1)) { // try west\n if (countGrid[this.axis.y][this.axis.x - 1] > maxCount) {\n maxCount = countGrid[this.axis.y][this.axis.x - 1];\n bestNextTarget = new Coordinate(this.axis.x - 1, this.axis.y);\n direction = 3;\n }\n }\n\n seekAgain = false;\n\n } else { // direction is known\n\n bestNextTarget = new Coordinate(this.axis.x, this.axis.y);\n\n if (direction == 0) { // north\n if (inBound(this.axis.y + distanceFromHit, this.axis.x)) {\n bestNextTarget = new Coordinate(this.axis.x, this.axis.y + distanceFromHit);\n } else { // else go south\n distanceFromHit = 1;\n bestNextTarget = new Coordinate(this.axis.x, this.axis.y - distanceFromHit);\n direction = 2;\n }\n\n } else if (direction == 1) { // east\n if (inBound(this.axis.y, this.axis.x + distanceFromHit)) {\n bestNextTarget = new Coordinate(this.axis.x + distanceFromHit, this.axis.y);\n } else { // else go west\n distanceFromHit = 1;\n bestNextTarget = new Coordinate(this.axis.x - distanceFromHit, this.axis.y);\n direction = 3;\n }\n\n } else if (direction == 2) { // south\n if (inBound(this.axis.y - distanceFromHit, this.axis.x)) {\n bestNextTarget = new Coordinate(this.axis.x, this.axis.y - distanceFromHit);\n } else { // else go north\n distanceFromHit = 1;\n bestNextTarget = new Coordinate(this.axis.x, this.axis.y + distanceFromHit);\n direction = 0;\n }\n\n } else if (direction == 3) { // west\n if (inBound(this.axis.y, this.axis.x - distanceFromHit)) {\n bestNextTarget = new Coordinate(this.axis.x - distanceFromHit, this.axis.y);\n } else { // else go east\n distanceFromHit = 1;\n bestNextTarget = new Coordinate(this.axis.x + distanceFromHit, this.axis.y);\n direction = 1;\n }\n }\n }\n\n this.previousTarget = bestNextTarget;\n\n } else {\n this.previousTarget = getGlobalHighestCount();\n }\n\n toExclude.add(new Coordinate(this.previousTarget.y, this.previousTarget.x));\n\n this.countGrid[this.previousTarget.y][this.previousTarget.x] = 0;\n\n return this.previousTarget;\n }", "public PuzzleState move(int row, int column, Operation op);", "public Move pickBestMove(Board board) {\n\t\treturn null;\n\t}", "public int getIntelligentMove(int[] availableMoves, int[] board){\n for (int move : availableMoves){\n int[] tempBoard = board.clone();\n tempBoard[move] = 1;\n int result = checkWinner(tempBoard);\n if (result == 1){\n return move;\n }\n \n }\n \n // Check if user can win, if so then block\n \n for (int move : availableMoves){\n int[] tempBoard = board.clone();\n tempBoard[move] = -1;\n int result = checkWinner(tempBoard);\n if (result == 2){\n return move;\n }\n \n }\n \n // If middle is available, take it\n for (int move: availableMoves){\n if (move == 4){\n return move;\n }\n }\n \n // Move into a corner in a row/col that the user is in\n int cornerMove = checkCorners(board, availableMoves);\n if (cornerMove >= 0){\n \n }\n \n // Otherwise, take random move\n Random rand = new Random();\n int possibleMoves = availableMoves.length;\n int moveIndex = rand.nextInt(possibleMoves);\n \n return availableMoves[moveIndex];\n \n \n }", "private Board moveTo(int direction) {\n Board newBoard = new Board(this.state);\n int oZ = this.zero;\n int nZ = oZ;\n switch (direction) {\n case Board.LEFT: nZ = oZ - 1; break;\n case Board.RIGHT: nZ = oZ + 1; break;\n case Board.UP: nZ = oZ - Board.dim; break;\n case Board.DOWN: nZ = oZ + Board.dim; break;\n default: return null;\n }\n newBoard.state[oZ] = state[nZ];\n newBoard.state[nZ] = 0;\n newBoard.zero = nZ;\n\n // update heuristic iteratively except for MAN\n switch(Board.heuristic) {\n case HAM:\n if (state[nZ] == oZ) newBoard.dist = this.dist - 1;\n else if (state[nZ] == nZ) newBoard.dist = this.dist + 1;\n else newBoard.dist = this.dist;\n break;\n case INT: // iterative update the interference\n // this is the most logically complicated code I have\n // done in a while\n int moved = state[nZ];\n int oC;\n newBoard.inter = inter;\n switch (direction) {\n case Board.LEFT:\n case Board.RIGHT: // LEFT AND RIGHT\n if (Board.colOf[state[nZ]] == Board.colOf[nZ]) {\n // we've replaced a piece on its col with a zero\n // interference can only decrease since we know\n // the piece didn't belong to its old column\n //System.out.println(\"Took \" + state[nZ] + \" out of its col\");\n for (int i = Board.colOf[nZ]; i < nZ; i+=Board.dim)\n if (Board.colOf[state[i]] == Board.colOf[nZ] &&\n state[i] > state[nZ])\n newBoard.inter--;\n for (int i = nZ + Board.dim; i < state.length; i+=Board.dim)\n if (Board.colOf[state[i]] == Board.colOf[nZ] &&\n state[i] < state[nZ])\n newBoard.inter--;\n \n } else if (Board.colOf[state[nZ]] == Board.colOf[oZ]) {\n // we've put a piece on its col that was a zero\n // interference can only increase since we know\n // the piece didn't below to its old column\n //System.out.println(\"Put \" + state[nZ] + \" into its col\");\n for (int i = Board.colOf[oZ]; i < oZ; i+=Board.dim)\n if (Board.colOf[state[i]] == Board.colOf[oZ] &&\n state[i] > state[nZ])\n newBoard.inter++;\n for (int i = oZ + Board.dim; i < state.length; i+=Board.dim)\n if (Board.colOf[state[i]] == Board.colOf[oZ] &&\n state[i] < state[nZ])\n newBoard.inter++;\n }\n break;\n default: // UP AND DOWN\n if (Board.rowOf[state[nZ]] == Board.rowOf[nZ]) {\n // we've replaced a piece on its row with a zero\n // interference can only decrease since we know\n // the piece didn't belong to its old row\n //System.out.println(\"Took \" + state[nZ] + \" out of its row\");\n for (int i = Board.dim*Board.rowOf[nZ]; i < nZ; i++)\n if (Board.rowOf[state[i]] == Board.rowOf[nZ] &&\n state[i] > state[nZ])\n newBoard.inter--;\n for (int i = nZ+1; i < Board.dim*(Board.rowOf[nZ]+1); i++)\n if (Board.rowOf[state[i]] == Board.rowOf[nZ] &&\n state[i] < state[nZ])\n newBoard.inter--;\n } else if (Board.rowOf[state[nZ]] == Board.rowOf[oZ]) {\n // we've put a piece on its row that was a zero\n // interference can only increase since we know\n // the piece didn't belong to its old row\n //System.out.println(\"Put \" + state[nZ] + \" into its row\");\n for (int i = Board.dim*Board.rowOf[oZ]; i < oZ; i++)\n if (Board.rowOf[state[i]] == Board.rowOf[oZ] &&\n state[i] > state[nZ])\n newBoard.inter++;\n for (int i = oZ+1; i < Board.dim*(Board.rowOf[oZ]+1); i++)\n if (Board.rowOf[state[i]] == Board.rowOf[oZ] &&\n state[i] < state[nZ])\n newBoard.inter++;\n }\n } \n default: // update the manhattan distance\n newBoard.dist = this.dist - \n Board.manhattanTable[state[nZ]][nZ] +\n Board.manhattanTable[state[nZ]][oZ];\n }\n return newBoard;\n }", "private void easyMove(Board board) {\n\t\t\r\n\t}", "public ArrayList<Coordinate> getPossibleMoveCoordinate() {\n ChessBoard board = this.getChessBoard(); // get chess board\n ArrayList<Coordinate> coords = new ArrayList<Coordinate>(); // create return ArrayList\n int x, y;\n /*\n several cases\n 2 3\n 1 4\n\n 5 8\n 6 7\n\n */\n // case1\n x = this.x_coordinate - 2;\n y = this.y_coordinate + 1;\n if(x >= 0 && y < board.getHeight()){\n addToCoordinatesIfValid(coords, x, y); // add to coords if the piece can move to that coordinate\n }\n // case2\n x = this.x_coordinate - 1;\n y = this.y_coordinate + 2;\n if(x >= 0 && y < board.getHeight()){\n addToCoordinatesIfValid(coords, x, y); // add to coords if the piece can move to that coordinate\n }\n // case3\n x = this.x_coordinate + 1;\n y = this.y_coordinate + 2;\n if(x < board.getWidth() && y < board.getHeight()){\n addToCoordinatesIfValid(coords, x, y); // add to coords if the piece can move to that coordinate\n }\n // case4\n x = this.x_coordinate + 2;\n y = this.y_coordinate + 1;\n if(x < board.getWidth() && y < board.getHeight()){\n addToCoordinatesIfValid(coords, x, y); // add to coords if the piece can move to that coordinate\n }\n // case5\n x = this.x_coordinate - 2;\n y = this.y_coordinate - 1;\n if(x >= 0 && y >= 0 ){\n addToCoordinatesIfValid(coords, x, y); // add to coords if the piece can move to that coordinate\n }\n // case6\n x = this.x_coordinate - 1;\n y = this.y_coordinate - 2;\n if(x >= 0 && y >= 0){\n addToCoordinatesIfValid(coords, x, y); // add to coords if the piece can move to that coordinate\n }\n // case7\n x = this.x_coordinate + 1;\n y = this.y_coordinate - 2;\n if(x < board.getWidth() && y >= 0){\n addToCoordinatesIfValid(coords, x, y); // add to coords if the piece can move to that coordinate\n }\n // case1\n x = this.x_coordinate + 2;\n y = this.y_coordinate - 1;\n if(x < board.getWidth() && y >= 0){\n addToCoordinatesIfValid(coords, x, y); // add to coords if the piece can move to that coordinate\n }\n\n\n return coords;\n }", "@Override\n public IMove doMove(IGameState state) {\n\n //Find macroboard to play in\n for (int[] move : preferredMoves)\n {\n if(state.getField().getMacroboard()[move[0]][move[1]].equals(IField.AVAILABLE_FIELD))\n {\n \n Random rnd = new Random();\n //find move to play\n for (int[] selectedMove : preferredMoves)\n {\n \n int x = move[0]*3 + selectedMove[0];\n int y = move[1]*3 + selectedMove[1];\n if(!state.getField().getBoard()[x][y].contains(IField.EMPTY_FIELD)\n && !state.getField().getBoard()[x][y].contains(IField.AVAILABLE_FIELD))\n {\n try\n {\n x = x + (rnd.nextInt(selectedMove[0] % 2 + 1));\n \n \n } catch (Exception e)\n {\n \n }\n try\n {\n y = y - (rnd.nextInt(selectedMove[0] % 2 - 1));\n \n } catch (Exception e)\n {\n \n }\n try\n {\n x = x - (rnd.nextInt(selectedMove[0] % 2 -1));\n \n \n } catch (Exception e)\n {\n \n }\n \n \n \n \n }\n if(state.getField().getBoard()[x][y].equals(IField.EMPTY_FIELD))\n {\n \n return new Move(x,y);\n }\n }\n }\n }\n\n //NOTE: Something failed, just take the first available move I guess!\n return state.getField().getAvailableMoves().get(0);\n }", "private Move _getNextMovePacket(Packet packet) {\n Move move = new Move();\n\n try {\n switch (packet.command) {\n\n case START:\n move.action = Action.START;\n move.id = packet.getField(\"id\", Integer.class);\n break;\n\n case ANTE:\n move.chips = packet.getField(\"chips\", Integer.class);\n\n // Request the next Move directly, which should be a STAKES\n Move stks = getNextMove();\n if (stks.action != Action.STAKES) {\n System.err.println(\"Invalid packet after ANTE\");\n move.action = Action.NOOP;\n return move;\n }\n\n move.action = Action.ANTE_STAKES;\n move.cStakes = stks.cStakes;\n move.sStakes = stks.sStakes;\n break;\n\n case STAKES:\n move.action = Action.STAKES;\n move.cStakes = packet.getField(\"stakes_client\", Integer.class);\n move.sStakes = packet.getField(\"stakes_server\", Integer.class);\n break;\n\n case ANTE_OK:\n move.action = Action.ANTE_OK;\n break;\n\n case QUIT:\n move.action = Action.QUIT;\n break;\n\n case DEALER:\n move.action = Action.DEALER_HAND;\n move.dealer = packet.getField(\"dealer\", Integer.class);\n Move hand = getNextMove();\n if (hand.cards == null) {\n System.err.println(\"Invalid packet after DEALER\");\n move.action = Action.NOOP;\n return move;\n }\n move.cards = hand.cards;\n break;\n case HAND:\n move.action = Action.DEALER_HAND;\n move.cards = cardsFromCodeString(packet.getField(\"cards\", String.class));\n break;\n\n case RAISE:\n move.action = Action.RAISE;\n move.chips = packet.getField(\"chips\", Integer.class);\n break;\n case BET:\n move.action = Action.BET;\n move.chips = packet.getField(\"chips\", Integer.class);\n break;\n\n case DRAW:\n // If any cards were requested, get the Card array\n move.action = Action.DRAW;\n move.cDrawn = packet.getField(\"number\", Integer.class);\n if (move.cDrawn > 0)\n move.cards = cardsFromCodeString(packet.getField(\"cards\", String.class));\n break;\n\n case DRAW_SERVER:\n move.action = Action.DRAW_SERVER;\n move.sDrawn = packet.getField(\"number\", Integer.class);\n move.cards = cardsFromCodeString(packet.getField(\"cards\", String.class));\n break;\n\n case SHOWDOWN:\n move.action = Action.SHOW;\n move.cards = cardsFromCodeString(packet.getField(\"cards\", String.class));\n break;\n\n case ERROR:\n move.action = Action.ERROR;\n move.error = packet.getField(\"error\", String.class);\n break;\n\n case NET_ERROR:\n // Irrecoverable network error. Terminate the Client Game\n move.action = Action.TERMINATE;\n break;\n\n case PASS:\n move.action = Action.PASS;\n break;\n case CALL:\n move.action = Action.CALL;\n break;\n case FOLD:\n move.action = Action.FOLD;\n break;\n }\n } catch (Exception e) {\n e.printStackTrace();\n NET_ERROR(\"Network Source: Problem reading next Move arguments\");\n move.action = Action.NOOP;\n }\n\n return move;\n }", "public WorldPixel move() {\n this.lastMoveDirection = getDirection();\n\n WorldPixel head = getTrail().peekLast();\n int oldX = head.getX();\n int oldY = head.getY();\n\n int newX = oldX + getDirection().getXDelta();\n int newY = oldY + getDirection().getYDelta();\n if (newX < getSector().getWorldXStart() || newX >= getSector().getWorldXEnd()\n || newY < getSector().getWorldYStart() || newY >= getSector().getWorldYEnd())\n return null;\n\n WorldPixel newPos = getWorld().getPixel(newX, newY);\n getTrail().addLast(newPos);\n return newPos;\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}", "private Move defaultMoveInGoodPlace(PentagoBoard b0) {\n \tPentagoBoard b = (PentagoBoard)b0.clone();\n \tList<Move> moves = b.getMovesFor(getColor());\n \tfor(Move m: moves) {\n \t\tPentagoMove pM = (PentagoMove)m;\n \t\tif(havMyNeighbour(b,getColor(), pM.getPlaceX(), pM.getPlaceY()) == false)\n \t\t\tcontinue;\n \t\tif(canWinInRow(b,pM.getPlaceY(),getColor())) {\n \t\t\tb.doMove(m);\n \t\t\tif(canWinOpponentNow(b) != null) { // przeciwnik nie moze wygrac po moim ruchu\n \t\t\tb.undoMove(m);\n \t\t\tcontinue;\n \t\t}\n \t\t\treturn m;\n \t\t}\n \t\tif(canWinInColumn(b,pM.getPlaceX(),getColor())) {\n \t\t\tb.doMove(m);\n \t\t\tif(canWinOpponentNow(b) != null) { // przeciwnik nie moze wygrac po moim ruchu\n \t\t\tb.undoMove(m);\n \t\t\tcontinue;\n \t\t}\n \t\t\treturn m;\n \t\t}\n \t}\n \treturn null;\n }", "public static void applySingleMove(Move move, BoardView board)\n {\n Space startSpace = board.getTile(move.getStartPosition());\n\n Space finishSpace = board.getTile(move.getEndPosition());\n\n Position between = getPositionBetween(move.getStartPosition(), move.getEndPosition());\n\n if(between != null) //jump move\n {\n Space middle = board.getTile(between);\n middle.setPiece(null);\n }\n\n finishSpace.setPiece(startSpace.getPiece());\n startSpace.setPiece(null);\n\n // promotes the piece to king if they reach the end of board\n if (finishSpace.getPiece().getType() == Piece.PieceEnum.SINGLE) {\n switch (finishSpace.getPiece().getColor()) {\n case RED:\n if (move.getEndPosition().getRow() == 0) {\n finishSpace.getPiece().promote();\n }\n break;\n case WHITE:\n if (move.getEndPosition().getRow() == 7) {\n finishSpace.getPiece().promote();\n }\n break;\n }\n }\n\n }", "public MahjongSolitaireMove findMove()\n {\n // MAKE A MOVE TO FILL IN \n MahjongSolitaireMove move = new MahjongSolitaireMove();\n\n // GO THROUGH THE ENTIRE GRID TO FIND A MATCH BETWEEN AVAILABLE TILES\n for (int i = 0; i < gridColumns; i++)\n {\n for (int j = 0; j < gridRows; j++)\n {\n ArrayList<MahjongSolitaireTile> stack1 = tileGrid[i][j];\n if (stack1.size() > 0)\n {\n // GET THE FIRST TILE\n MahjongSolitaireTile testTile1 = stack1.get(stack1.size()-1);\n for (int k = 0; k < gridColumns; k++)\n {\n for (int l = 0; l < gridRows; l++)\n {\n if (!((i == k) && (j == l)))\n { \n ArrayList<MahjongSolitaireTile> stack2 = tileGrid[k][l];\n if (stack2.size() > 0) \n {\n // AND TEST IT AGAINST THE SECOND TILE\n MahjongSolitaireTile testTile2 = stack2.get(stack2.size()-1);\n \n // DO THEY MATCH\n if (testTile1.match(testTile2))\n {\n // YES, FILL IN THE MOVE AND RETURN IT\n move.col1 = i;\n move.row1 = j;\n move.col2 = k;\n move.row2 = l;\n return move;\n }\n }\n }\n }\n }\n }\n }\n }\n // WE'VE SEARCHED THE ENTIRE GRID AND THERE\n // ARE NO POSSIBLE MOVES REMAINING\n return null;\n }", "public Move getMove() {\n System.out.print(\"Sasso, carta o forbice? \");\n\n // Leggi l'input dell'utente\n String userInput = inputScanner.nextLine();\n userInput = userInput.toUpperCase();\n char firstLetter = userInput.charAt(0);\n if (firstLetter == 'S' || firstLetter == 'C' || firstLetter == 'F') {\n // User has entered a valid input\n switch (firstLetter) {\n case 'S':\n return Move.SASSO;\n case 'C':\n return Move.CARTA;\n case 'F':\n return Move.FORBICE;\n }\n }\n\n // L'utente non ha inserito una mossa valida. Richiedi l'inserimento di una nuova mossa.\n return getMove();\n }", "public boolean GetMove();", "private Position getRandomMove(TicTacToeBoard state) {\r\n\t\tArrayList<Position> availableMoves = new ArrayList<Position>();\r\n\t\tfor( int row = 0; row < TicTacToeBoard.SIZE; row++ ) {\r\n\t\t\tfor( int col = 0; col < TicTacToeBoard.SIZE; col++ ) {\r\n\t\t\t\tif( state.getState(row,col) == TicTacToeBoard.BLANK ) {\r\n\t\t\t\t\tavailableMoves.add(new Position(row,col));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn (Position)availableMoves.get(rand.nextInt(availableMoves.size()));\r\n\t}", "public String getNextMove() {\n int randomIndex = randomizer.generateRandomInt(this.nextMoves.size() - 1);\n System.out.println(\"random = \" + randomIndex + \", max = \" + (nextMoves.size() - 1));\n this.indexSelected = randomIndex;\n return this.nextMoves.get(randomIndex);\n }", "PieceColor whoseMove() {\n return _whoseMove;\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}", "@Override\r\n\tpublic boolean movement(BoardCells[][] chessBoard, Piece targetPiece, int fromX,int fromY,int toX,int toY) {\t\t\r\n\t\t//DEBUG -- System.out.println(\"\"+fromX+fromY+\" \"+toX+toY);\r\n\t\t\r\n\t\tif(fromY == toY){\t\t\t\r\n\t\t\tif(fromX > toX) {\r\n\t\t\t\tfor(int i = fromX-1; i>toX; i--) {\r\n\t\t\t\t\tif(chessBoard[8-fromY][i].getPiece() != null) {\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\treturn false;\t\t\t\t\r\n\t\t\t\t\t}\t\t\t\t\t\r\n\t\t\t\t}\t\t\t\t\r\n\t\t\t} else if (fromX < toX) {\r\n\t\t\t\tfor(int i = fromX+1; i<toX; i++) {\r\n\t\t\t\t\tif(chessBoard[8-fromY][i].getPiece() != null) {\t\t\t\t\t\t\t\r\n\t\t\t\t\t\treturn false;\t\t\t\t\t\t\r\n\t\t\t\t\t}\t\t\t\t\t\r\n\t\t\t\t}\t\t\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(getPieceID().equals(\"bR\")) {\r\n\t\t\t\tfor(int i = 0; i<9 ;i++) {\r\n\t\t\t\t\tfor (int j = 0; j<9; j++){\r\n\t\t\t\t\t\tif(chessBoard[8-i][j].getPiece() != null) {\r\n\t\t\t\t\t\tif(chessBoard[8-i][j].getPiece().getPieceID().equals(\"bKc\")) {\r\n\t\t\t\t\t\t\t//Piece king = chessBoard[8-i][j].getPiece();\t\t\t\t\t\r\n\t\t\t\t\t\t\t//DEBUG -- System.out.println(king.getPieceID()+color+\" \"+king );\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tchessBoard[8-i][j].getPiece().setPieceID(\"bK\");\r\n\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}\r\n\t\t\t}\r\n\r\n\t\t\tif(getPieceID().equals(\"wR\")) {\r\n\t\t\t\tfor(int i = 0; i<9 ;i++) {\r\n\t\t\t\t\tfor (int j = 0; j<9; j++){\r\n\t\t\t\t\t\tif(chessBoard[8-i][j].getPiece() != null) {\r\n\t\t\t\t\t\tif(chessBoard[8-i][j].getPiece().getPieceID().equals(\"wKc\")) {\r\n\t\t\t\t\t\t\t//Piece king = chessBoard[8-i][j].getPiece();\t\t\t\t\t\r\n\t\t\t\t\t\t\t//DEBUG -- System.out.println(king.getPieceID()+color+\" \"+king );\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tchessBoard[8-i][j].getPiece().setPieceID(\"wK\");\r\n\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}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\tif(fromX == toX) {\t\t\t\t\r\n\t\t\tif(fromY > toY) {\t\r\n\t\t\t\tfor(int i = fromY-1; i>toY; i--) {\r\n\t\t\t\t\tif(chessBoard[8-i][toX].getPiece() != null) {\t\t\t\t\t\t\t\r\n\t\t\t\t\t\treturn false;\t\t\t\t\t\t\r\n\t\t\t\t\t}\t\t\t\t\t\r\n\t\t\t\t}\t\t\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t} else if (fromY < toY) {\t\t\t\t\r\n\t\t\t\tfor(int i = fromY+1; i<toY; i++) {\t\t\t\t\t\r\n\t\t\t\t\tif(chessBoard[8-i][toX].getPiece() != null) {\t\t\t\t\t\t\t\r\n\t\t\t\t\t\treturn false;\t\t\t\t\t\t\r\n\t\t\t\t\t}\t\t\t\t\t\r\n\t\t\t\t}\t\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif(getPieceID().equals(\"bR\")) {\r\n\t\t\t\t\tfor(int i = 0; i<9 ;i++) {\r\n\t\t\t\t\t\tfor (int j = 0; j<9; j++){\r\n\t\t\t\t\t\t\tif(chessBoard[8-i][j].getPiece() != null) {\r\n\t\t\t\t\t\t\tif(chessBoard[8-i][j].getPiece().getPieceID().equals(\"bKc\")) {\r\n\t\t\t\t\t\t\t\t//Piece king = chessBoard[8-i][j].getPiece();\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t//DEBUG -- System.out.println(king.getPieceID()+color+\" \"+king );\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tchessBoard[8-i][j].getPiece().setPieceID(\"bK\");\r\n\t\t\t\t\t\t\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}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif(getPieceID().equals(\"wR\")) {\r\n\t\t\t\t\tfor(int i = 0; i<9 ;i++) {\r\n\t\t\t\t\t\tfor (int j = 0; j<9; j++){\r\n\t\t\t\t\t\t\tif(chessBoard[8-i][j].getPiece() != null) {\r\n\t\t\t\t\t\t\tif(chessBoard[8-i][j].getPiece().getPieceID().equals(\"wKc\")) {\r\n\t\t\t\t\t\t\t\t//Piece king = chessBoard[8-i][j].getPiece();\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t//DEBUG -- System.out.println(king.getPieceID()+color+\" \"+king );\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tchessBoard[8-i][j].getPiece().setPieceID(\"wK\");\r\n\t\t\t\t\t\t\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}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\r\n\t\t\treturn true;\t\r\n\t\t}\r\n\t\t\t\t\r\n\t\treturn false;\t\t\r\n\t}", "@Override\n public DirType getMove(GameState state) {\n if (print) System.out.println(\"\\n\\n\");\n this.gb.update(state); // Must be done every turn\n this.findEnemySnake(); // Update Enemy Snake's head Location\n this.markDangerTiles(); // Mark tiles the Enemy Snake can reach and filled\n if (print) this.gb.printBoard();\n if (print) System.out.println(\"DIVEBOMB ENTER -> Us_X: \" + this.us_head_x + \", Us_Y: \" + this.us_head_y + \" -> \" + this.us_num);\n Tile target = this.diveBomb();\n if (print) System.out.print(\"DIVEBOMB EXIT -> Target_X: \" + target.getX() + \" Target_Y: \" + target.getY());\n DirType retVal = getDir(target);\n if (print) System.out.println(\" Dir: \" + retVal);\n\n\n if (this.us_num == 0) {\n System.out.println(\"\\n\\n\\n\");\n GameBoard gb= new GameBoard(state, 1,0);\n gb.update(state);\n float val = USuckUnless.grade(state, this.us_num, DirType.South);\n System.out.println(val);\n this.gb.printBoard();\n }\n return retVal;\n }", "public Move move() {\n\n byte[] piece;\n int pieceIndex;\n Move.Direction direction = null;\n int counter = 0;\n\n Scanner s = new Scanner(System.in);\n\n\n System.out.println(\"Please select piece to move: \");\n\n\n while (true) {\n try {\n pieceIndex = s.nextInt();\n\n if ((piece = getPiece(pieceIndex)) == null) {\n System.out.println(\"invalid index, try again!\");\n// check if selected piece is stuck\n } else if (\n (((player == Board.V) && (piece[1]+1 == Board.getSize()))) || (board.layout[piece[0]][piece[1]+1] == O ) || // UP\n ((player == Board.H) && (piece[1]-1 >=0) && (board.layout[piece[0]][piece[1]-1] == O)) || // DOWN\n ((player == Board.V) && (piece[0]-1 >=0) && (board.layout[piece[0]-1][piece[1]] == O)) || // LEFT\n (((player == Board.H) && (piece[0]+1 == Board.getSize()))) || (board.layout[piece[0]][piece[1]+1] == O )) // RIGHT\n {\n break;\n// if all are stuck pass turn\n } else if (counter + 1 < Board.getSize()) {\n counter++;\n System.out.println(\"Piece is stuck, pick another, \" + counter + \" pieces stuck.\");\n } else {\n System.out.println(\"Passing\");\n return null;\n }\n } catch (Exception e){\n System.out.println(\"Piece index expects int, try again\");\n s = new Scanner(System.in);\n }\n }\n System.out.println(\"Please select direction ('w' // 'a' // 's' // 'd'): \");\n\n boolean valid = false;\n while (!valid) {\n\n switch (s.next().charAt(0)) {\n // if the move requested is valid, break the loop, make the move on our record of layout and return the\n // move made\n case 'w':\n direction = Move.Direction.UP;\n valid = (((player == Board.V) && (piece[1]+1 == Board.getSize()))) || (board.layout[piece[0]][piece[1]+1] == O );\n break;\n\n case 'a':\n direction = Move.Direction.LEFT;\n valid = ((player == Board.V) && (piece[0]-1 >=0) && (board.layout[piece[0]-1][piece[1]] == O));\n break;\n\n case 's':\n direction = Move.Direction.DOWN;\n valid = ((player == Board.H) && (piece[1]-1 >=0) && (board.layout[piece[0]][piece[1]-1] == O));\n break;\n\n case 'd':\n direction = Move.Direction.RIGHT;\n valid = (((player == Board.H) && (piece[0]+1 == Board.getSize()))) || (board.layout[piece[0]][piece[1]+1] == O );\n break;\n default:\n System.out.println(\"Invalid key press, controls are wasd\");\n valid = false;\n }\n }\n Move move = makeMove(direction, pieceIndex);\n board.update(move, player);\n\n return move;\n }", "Move getMove() {\r\n int[] p0 = new int[2];\r\n int[] p1 = new int[3];\r\n\r\n while (_playing) {\r\n while (_playing) {\r\n while (_playing) {\r\n _command.getMouse(p0);\r\n System.out.println(\"_command.getMouse 0\");\r\n if (p0[0] >= 0 && p0[1] >= 0) {\r\n System.out.println(\"We got a mouse move on the board for 0\");\r\n break;\r\n }\r\n try {\r\n Thread.sleep(magic1);\r\n System.out.println(\"This is the thread.sleep.\");\r\n } catch (InterruptedException ex) {\r\n System.out.println(\"This is the interruption.\");\r\n return null;\r\n }\r\n }\r\n if (!_playing) {\r\n return null;\r\n }\r\n if (_board.get(p0[0] + 1, p0[1] + 1) == _board.turn()) {\r\n System.out.print(\"Warning!!!\");\r\n break;\r\n }\r\n }\r\n if (!_playing) {\r\n return null;\r\n }\r\n while (_playing) {\r\n _command.getMouse(p1);\r\n System.out.println(\"_command.getMouse 1\");\r\n if (p1[0] >= 0 && p1[1] >= 0) {\r\n System.out.println(\"We got a mouse move on the board for 1\");\r\n break;\r\n }\r\n try {\r\n Thread.sleep(magic1);\r\n System.out.println(\"This is the thread.sleep.\");\r\n } catch (InterruptedException ex) {\r\n System.out.println(\"This is the interruption.\");\r\n return null;\r\n }\r\n }\r\n if (!_playing) {\r\n return null;\r\n }\r\n if (p0[0] == p1[0] || p0[1] == p1[1]\r\n || Math.abs(p1[0] - p0[0]) == Math.abs(p1[1] - p0[1])) {\r\n Move m = Move.create(p0[0] + 1, p0[1] + 1, p1[0] + 1, p1[1] + 1,\r\n _board);\r\n if (m != null && _board.isLegal(m)) {\r\n return m;\r\n }\r\n }\r\n }\r\n return null;\r\n }", "public interface BoardMoveStrategy {\n\n /**\n * Function that checks if there are any moves possible.\n *\n * <p>Iterates through all gems and looks for pairs or two or\n * constructions like \"xox\" where another x could fill in.\n * For each case a different function is called which checks for\n * a valid move.</p>\n *\n * @return returns two jewels in a list to swap if move is possible.\n */\n List<Jewel> getValidMovePair();\n}", "public Move composeMove(Player player, Board board) {\n Move move = new Move();\n System.out.println(\"Choix des billes à déplacer\");\n System.out.println(\"Instructions :\");\n System.out.println(\"- Veuillez saisir successivemement les coordonnée des billes à déplacer\");\n System.out.println(\"- Commencez toujours par une extrémité du groupe de bille que vous sélectionnez\");\n System.out.println(\"- Pour chaque bille saisissez sa première coordonnée puis faites ENTREE avant de rentrer la seconde\");\n System.out.println(\"- Entre chaque saisie il vous sera demandé si vous souhaitez continuer.\");\n System.out.println();\n chooseMarble(move,1,board,player);\n if(askContinue()){\n chooseMarble(move,2,board,player);\n if(askContinue()){\n chooseMarble(move,3,board,player);\n }\n }\n move.setMoveDirection(chooseDirection());\n System.out.println(\"\");\n System.out.println(\"――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――\");\n return move;\n }", "public Move chooseMove(PentagoBoardState boardState) {\r\n try {\r\n if (heuristicOnly) {\r\n System.out.println(\"chose from heuristic\");\r\n return Heuristics.choseMove(new LowMemoryBoardState(boardState));\r\n }\r\n if (mcts == null) {\r\n mcts = new MonteCarloUCT();\r\n }\r\n return mcts.nextMove(new LowMemoryBoardState(boardState));\r\n } catch (OutOfMemoryError e) {\r\n /*\r\n if the memory limit is exceeded, we *attempt* to free memory\r\n by nullifying our mcts and asking the JVM to garbage collect.\r\n Since this is a serious error, we switch the instance to use\r\n a heuristic exclusively, to prevent going over the memory limit\r\n again.\r\n */\r\n mcts = null;\r\n System.gc();\r\n this.heuristicOnly = true;\r\n return Heuristics.choseMove(new LowMemoryBoardState(boardState));\r\n }\r\n }", "public char makeMove(Coordinate move);", "private Point getMoveDestination(Building b)\n\t{\n\t\tObjectType buildType = b.getObjectType();\n\t\tPoint workPoint = b.getPosition();\n\t\tfor (int i = workPoint.getX(); i < workPoint.getX()\n\t\t\t\t+ getMyPlayer().getPlayerInfo().getBuildingSize()\n\t\t\t\t\t\t.get(buildType) - 1; i++)\n\t\t{\n\t\t\tPoint p1 = new Point(i, workPoint.getY() - 1);\n\t\t\tif (p1.getY() < getMyPlayer().getMyMap().getMapBlocks()[0].length\n\t\t\t\t\t&& (getMyPlayer().getMyMap().getMapBlocks()[i][p1.getY()]\n\t\t\t\t\t\t\t.isWalkableByWorker() || (!getMyPlayer()\n\t\t\t\t\t\t\t.getMapVisiblity()[i][p1.getY()])))\n\t\t\t\treturn p1;\n\t\t\tPoint p2 = new Point(i, workPoint.getY()\n\t\t\t\t\t+ getMyPlayer().getPlayerInfo().getBuildingSize()\n\t\t\t\t\t\t\t.get(buildType));\n\t\t\tif ((p2.getY() < getMyPlayer().getMyMap().getMapBlocks()[0].length)\n\t\t\t\t\t&& (getMyPlayer().getMyMap().getMapBlocks()[i][p2.getY()]\n\t\t\t\t\t\t\t.isWalkableByWorker() || (!getMyPlayer()\n\t\t\t\t\t\t\t.getMapVisiblity()[i][p2.getY()])))\n\t\t\t\treturn p2;\n\n\t\t}\n\t\tfor (int j = workPoint.getY(); j < workPoint.getY()\n\t\t\t\t+ getMyPlayer().getPlayerInfo().getBuildingSize()\n\t\t\t\t\t\t.get(buildType); j++)\n\t\t{\n\t\t\tPoint p1 = new Point(workPoint.getX() - 1, j);\n\t\t\tif (p1.getX() < getMyPlayer().getMyMap().getMapBlocks().length\n\t\t\t\t\t&& (getMyPlayer().getMyMap().getMapBlocks()[p1.getX()][j]\n\t\t\t\t\t\t\t.isWalkableByWorker() || (!getMyPlayer()\n\t\t\t\t\t\t\t.getMapVisiblity()[p1.getX()][j])))\n\t\t\t\treturn p1;\n\t\t\tPoint p2 = new Point(workPoint.getX()\n\t\t\t\t\t+ getMyPlayer().getPlayerInfo().getBuildingSize()\n\t\t\t\t\t\t\t.get(buildType), j);\n\t\t\tif (p2.getX() < getMyPlayer().getMyMap().getMapBlocks().length\n\t\t\t\t\t&& (getMyPlayer().getMyMap().getMapBlocks()[p2.getX()][j]\n\t\t\t\t\t\t\t.isWalkableByWorker() || (!getMyPlayer()\n\t\t\t\t\t\t\t.getMapVisiblity()[p2.getX()][j])))\n\t\t\t\treturn p2;\n\n\t\t}\n\t\treturn null;\n\t}", "public HantoMoveRecord aPossibleMove(HantoCoordinateImpl src, Board board)\n\t{\n\t\treturn moveStrategy.aPossibleMove(src, board);\n\t}", "public final Tile selectComputerMove() {\r\n Tile tile = null;\r\n int count = 0;\r\n String tileName = null;\r\n boolean continueLoop = true;\r\n \r\n // First try to find a winning move\r\n for (Rail rail : rails) {\r\n for (Tile t : rail.getTiles()) {\r\n if (t.getText().equals(\"0\")) count++;\r\n }\r\n if (count == 2) {\r\n for (Tile t : rail.getTiles()) {\r\n if (t.getText().equals(\"\")) {\r\n tileName = t.getName();\r\n return t;\r\n }\r\n }\r\n }\r\n count = 0; \r\n }\r\n \r\n // If none found, try to block \"X\"\r\n for (Rail rail : rails) {\r\n for (Tile t : rail.getTiles()) {\r\n if (t.getText().equals(\"X\")) count++;\r\n }\r\n if (count == 2) {\r\n for (Tile t : rail.getTiles()) {\r\n if (t.getText().equals(\"\")) {\r\n tileName = t.getName();\r\n return t;\r\n }\r\n }\r\n }\r\n count = 0;\r\n }\r\n \r\n // If no blocking move, try to play the center which gives \"O\"\r\n // a statistical advantage\r\n if (!tiles[R2C2].isSelected()) {\r\n return tiles[R2C2];\r\n }\r\n \r\n \r\n // If center move is not available, try to find an open corner tile, \r\n // which might set up an winning combination\r\n if (!tiles[R1C1].isSelected()) {\r\n return tiles[R1C1];\r\n } else if (!tiles[R3C3].isSelected()) {\r\n return tiles[R3C3];\r\n } else if (!tiles[R3C1].isSelected()) {\r\n return tiles[R3C1];\r\n } else if (!tiles[R1C3].isSelected()) {\r\n return tiles[R1C3];\r\n }\r\n \r\n // If none found just pick an empty tile at random\r\n if(tileName == null) {\r\n int row = rand.nextInt(3) + 1;\r\n int col = rand.nextInt(3) + 1;\r\n tileName = \"r\" + row + \"c\" + col;\r\n for (Tile btn: tiles) {\r\n if (btn.getName().equals(tileName)) {\r\n tile = btn;\r\n break;\r\n }\r\n }\r\n }\r\n \r\n return tile;\r\n }", "static public Move fromString(String move) {\n\t\tint player = Board.INVALID;\n\t\tint x = Board.INVALID;\n\t\tint y = Board.INVALID;\n\n\t\tString m = move.toUpperCase();\n\t\tint cut1 = m.indexOf(\"-\");\n\t\tif (cut1<0) cut1 = m.indexOf(\" \");\n\t\tif (cut1<0) return null;\n\t\t\n\t\tString playerSt = m.substring(0,cut1);\n\t\tString possiblePassSt = m.substring(cut1+1,m.length());\n\t\tchar MoveLetterCh = m.charAt(cut1+1);\n\t\tString MoveNumberSt = m.substring(cut1+2,m.length());\n\n\t\tif (\"W\".equals(playerSt) || \"WHITE\".equals(playerSt)) player = Board.WHITE;\n\t\tif (\"B\".equals(playerSt) || \"BLACK\".equals(playerSt)) player = Board.BLACK;\n\t\t\n\t\tif (\"PASS\".equals(possiblePassSt)) {\n\t\t\treturn new MoveImpl(player);\n\t\t}\n\t\tif (player == Board.INVALID) {\n\t\t\treturn null;\n\t\t}\n\t\t\n\t\tx = MoveLetterCh - 65;\n\t\tif (x>'I'-65) x--;//I 和 J是是同一列\n\t\ty = Integer.parseInt(MoveNumberSt) - 1;\n\t\t\n\t\treturn new MoveImpl(x,y,player);\n\t}", "private Move getBestMove(RaceTrack track, CellData[][] cells,\n\t\t\tPair<Integer, Integer> pos, Pair<Integer, Integer> speed, int depth) {\n\t\tCellData cellData = cells[pos.getLeft()][pos.getRight()];\n\n\t\tMap<Pair<Integer, Integer>, Character> availableMoves = new HashMap<>();\n\t\tint contX = pos.getLeft() + speed.getLeft();\n\t\tint contY = pos.getRight() + speed.getRight();\n\n\t\tPair<Integer, Integer> cont0 = Pair.of(contX, contY);\n\t\tif (cellData.getLegalMoves().contains(cont0)) {\n\t\t\tavailableMoves.put(cont0, '0');\n\t\t}\n\t\tPair<Integer, Integer> contL = Pair.of(contX - 1, contY);\n\t\tif (cellData.getLegalMoves().contains(contL)) {\n\t\t\tavailableMoves.put(contL, 'L');\n\t\t}\n\t\tPair<Integer, Integer> contR = Pair.of(contX + 1, contY);\n\t\tif (cellData.getLegalMoves().contains(contR)) {\n\t\t\tavailableMoves.put(contR, 'R');\n\t\t}\n\t\tPair<Integer, Integer> contU = Pair.of(contX, contY - 1);\n\t\tif (cellData.getLegalMoves().contains(contU)) {\n\t\t\tavailableMoves.put(contU, 'U');\n\t\t}\n\t\tPair<Integer, Integer> contD = Pair.of(contX, contY + 1);\n\t\tif (cellData.getLegalMoves().contains(contD)) {\n\t\t\tavailableMoves.put(contD, 'D');\n\t\t}\n\t\tfinal Map<Pair<Integer, Integer>, Integer> moveMap = new HashMap<>();\n\n\t\tfor (Pair<Integer, Integer> move : availableMoves.keySet()) {\n\t\t\tint moveValue = getMoveValue(cells, pos.getLeft(), pos.getRight(),\n\t\t\t\t\tmove.getLeft(), move.getRight());\n\t\t\tmoveMap.put(move, moveValue);\n\t\t}\n\n\t\tList<Pair<Integer, Integer>> allMoves = new ArrayList<>(\n\t\t\t\tmoveMap.keySet());\n\t\tCollections.sort(allMoves, new Comparator<Pair<Integer, Integer>>() {\n\t\t\t@Override\n\t\t\tpublic int compare(Pair<Integer, Integer> o1,\n\t\t\t\t\tPair<Integer, Integer> o2) {\n\t\t\t\treturn Integer.compare(moveMap.get(o2), moveMap.get(o1));\n\t\t\t}\n\t\t});\n\t\tPair<Integer, Integer> bestMove = allMoves.get(0);\n\n\t\tif ((depth == 0) || (moveMap.get(bestMove) > 0)) {\n\t\t\treturn new Move(bestMove, moveMap.get(bestMove),\n\t\t\t\t\tavailableMoves.get(bestMove));\n\t\t}\n\t\tfinal Map<Pair<Integer, Integer>, Integer> newMoveMap = new HashMap<>();\n\t\tfor (Pair<Integer, Integer> move : allMoves) {\n\t\t\tPair<Integer, Integer> newSpeed = Pair.of(\n\t\t\t\t\tmove.getLeft() - pos.getLeft(),\n\t\t\t\t\tmove.getRight() - pos.getRight());\n\t\t\tint moveValue = getBestMove(track, cells, move, newSpeed, depth - 1).value;\n\t\t\tnewMoveMap.put(move, moveValue);\n\t\t}\n\t\tCollections.sort(allMoves, new Comparator<Pair<Integer, Integer>>() {\n\t\t\t@Override\n\t\t\tpublic int compare(Pair<Integer, Integer> o1,\n\t\t\t\t\tPair<Integer, Integer> o2) {\n\t\t\t\treturn Integer.compare(newMoveMap.get(o2), newMoveMap.get(o1));\n\t\t\t}\n\t\t});\n\t\tbestMove = allMoves.get(0);\n\t\treturn new Move(bestMove, moveMap.get(bestMove),\n\t\t\t\tavailableMoves.get(bestMove));\n\t}", "public void applyConvertedMove(String move) {\n\n\t\tString[] moveParts = move.split(\";\");\n\n\t\tint fromRow = Integer.parseInt(moveParts[0].charAt(0) + \"\");\n\t\tint fromCol = Integer.parseInt(moveParts[0].charAt(1) + \"\");\n\n\t\tint toRow = Integer.parseInt(moveParts[1].charAt(0) + \"\");\n\t\tint toCol = Integer.parseInt(moveParts[1].charAt(1) + \"\");\n\n\t\tint piece = board[fromRow][fromCol];//Integer.parseInt(moveParts[2]);\n\t\tint pieceType = Math.abs(board[fromRow][fromCol]);\n\t\tint team = Math.round(Math.signum(board[fromRow][fromCol]));\n\n\t\tboolean doResetEnpassant = true;\n\n\t\tif (pieceType == 1) { //If this is a pawn\n\t\t\tif (Math.abs(board[toRow][toCol]) == 7) { //If it is moving onto an enpassant stored tile\n\t\t\t\tboard[toRow + board[toRow][toCol]/7][toCol] = 0; //Kill the pawn that produced the enpassant tile\n\t\t\t} else if (Math.abs(fromRow - toRow) == 2) { //If it just did the double move thing\n\t\t\t\t//Reset the current enpassant tile\n\t\t\t\tresetEnpassant(team);\n\t\t\t\tdoResetEnpassant = false;\n\n\t\t\t\t//Set an empassant tile\n\t\t\t\tboard[(toRow + fromRow)/2][toCol] = 7 * team;\n\t\t\t\tenpassantCol = toCol;\n\t\t\t}\n\t\t} else if (pieceType == 6) { //If this is a king\n\t\t\tif (fromCol == 4) {\n\t\t\t\tif (doResetEnpassant) resetEnpassant(team);\n\t\t\t\tif (toCol == 7) { //Kingside Castle\n\t\t\t\t\tboard[toRow][6] = piece;\n\t\t\t\t\tboard[toRow][5] = board[toRow][7];\n\t\t\t\t\tboard[toRow][7] = 0;\n\t\t\t\t\tboard[toRow][4] = 0;\n\t\t\t\t\treturn;\n\t\t\t\t} else if (toCol == 0) { //Queenside Castle\n\t\t\t\t\tboard[toRow][2] = piece;\n\t\t\t\t\tboard[toRow][3] = board[toRow][0];\n\t\t\t\t\tboard[toRow][0] = 0;\n\t\t\t\t\tboard[toRow][4] = 0;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (doResetEnpassant) resetEnpassant(team);\n\t\tboard[fromRow][fromCol] = 0;\n\t\tif (moveParts.length > 2 && pieceType == 1 && (team == 1 ? toRow == 7 : team == -1 ? toRow == 0 : false)) {\n\t\t\tpiece = Integer.parseInt(moveParts[2]);\n\t\t}\n\t\tboard[toRow][toCol] = piece;\n\t}", "@Override\n protected String moveSelectionAlgorithm(int pieceID) {\n\n //If there is a winning move, take it\n\n\n // [This is where you should insert the required code for Assignment 1.]\n \n boolean skip = false;\n int row,col=0;\n for (row = 0; row < this.quartoBoard.getNumberOfRows(); row++) {\n for (col = 0; col < this.quartoBoard.getNumberOfColumns(); col++) {\n if (!this.quartoBoard.isSpaceTaken(row, col)) {\n QuartoBoard copyBoard = new QuartoBoard(this.quartoBoard);\n copyBoard.insertPieceOnBoard(row, col, pieceID);\n if (copyBoard.checkRow(row) || copyBoard.checkColumn(col) || copyBoard.checkDiagonals()) {\n skip = true;\n break;\n }\n }\n }\n if (skip) {\n break;\n }\n }\n\tSystem.out.print(\"ROW , COLUMNS = \"+ row+\" , \"+ col);\n\t\n\tif(skip){\n return row +\",\"+ col;}\n\n\n\n // If no winning move is found in the above code, then return a random (unoccupied) square\n\n int[] move = new int[2];\n QuartoBoard copyBoard = new QuartoBoard(this.quartoBoard);\n move = copyBoard.chooseRandomPositionNotPlayed(100);\n\n return move[0] + \",\" + move[1];\n }", "@Override\n\tpublic boolean move(int col, int row, piece[][] board) {\n\t\treturn false;\n\t}", "private CastlingMove getCastlingMove() {\r\n Rook t;\r\n int tx;\r\n int ty;\r\n if (picked.getXPosition() < selected.getX()) {\r\n t = (Rook) getGameState().getChessman(picked.isBlack(), 9);\r\n tx = 5;\r\n } else {\r\n t = (Rook) getGameState().getChessman(picked.isBlack(), 8);\r\n tx = 3;\r\n }\r\n ty = picked.isBlack() ? 0 : 7;\r\n return new CastlingMove(selected.getX(), selected.getY(), t, tx, ty, (King) picked);\r\n }", "public void makeMove(){\n System.out.println(\"Player choose x or o.\");\n String chose = keyword.nextLine();\n int row;\n int column;\n if (chose.equals(\"x\")){\n System.out.println(\"Type coordenates for first move.\");\n System.out.println(\"Type row.\");\n row = keyword.nextInt();\n System.out.println(\"Type column.\");\n column = keyword.nextInt();\n getBoard(row, column, \"x\");\n }\n else if (chose.equals(\"o\")){\n System.out.println(\"Type coordenates for first move.\");\n System.out.println(\"Type row.\");\n row = keyword.nextInt();\n System.out.println(\"Type column.\");\n column = keyword.nextInt();\n getBoard(row, column, \"o\");\n }\n }", "public Action getMove(CritterInfo info) {\n\n turn++;\n\n if (info.getFront() == Neighbor.OTHER) {\n return Action.INFECT;\n } else if (info.getFront() == Neighbor.WALL || info.getRight() == Neighbor.WALL) {\n return Action.LEFT;\n } else if (info.getFront() == Neighbor.SAME) {\n return Action.RIGHT;\n } else {\n return Action.HOP;\n }\n }", "public AgentAction getNextMove(GameTile [][] visibleMap) {\r\n\t\t//Possible things to add to your moves\r\n//\t\tnextMove = AgentAction.doNothing;\r\n//\t\tnextMove = AgentAction.moveDown;\r\n//\t\tnextMove = AgentAction.moveUp;\r\n//\t\tnextMove = AgentAction.moveUp;\r\n//\t\tnextMove = AgentAction.moveLeft;\r\n//\t\tnextMove = AgentAction.pickupSomething;\r\n//\t\tnextMove = AgentAction.declareVictory;\r\n//\r\n//\t\tnextMove = AgentAction.shootArrowNorth;\r\n//\t\tnextMove = AgentAction.shootArrowSouth;\r\n//\t\tnextMove = AgentAction.shootArrowEast;\r\n//\t\tnextMove = AgentAction.shootArrowWest;\r\n//\t\tnextMove = AgentAction.quit\r\n\t\t\r\n\t\t\r\n\r\n\t\t//Ideally you would remove all this code, but I left it in so the keylistener would work\r\n\t\tif(keyboardPlayOnly) {\r\n\t\t\tif(nextMove == null) {\r\n\t\t\t\treturn AgentAction.doNothing;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tAgentAction tmp = nextMove;\r\n\t\t\t\tnextMove = null;\r\n\t\t\t\treturn tmp;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t\telse {\r\n\t\t\t//This code plays 5 \"games\" and then quits\r\n\t\t\t//Just does random things\r\n\t\t\tif(numGamesPlayed > 19) {\r\n\t\t\t\treturn AgentAction.quit;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tif(nextMoves.isEmpty()) {\r\n\t\t\t\t\tsetStartingPosition(visibleMap);\r\n//\t\t\t\t\tfindWumpus(visibleMap);\r\n//\t\t\t\t\tfindWumpus(visibleMap);\r\n//\t\t\t\t\tWumpusState currentState = huntTheWumpus(visibleMap);\r\n//\t\t\t\t\tSystem.out.println(wumpusHunted);\r\n//\t\t\t\t\tif(wumpusHunted) {\r\n//\t\t\t\t\t\tcurrentState.setParent(null);\r\n//\t\t\t\t\t\taddToNextMoves(currentState);\r\n//\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t//this is the code to collect the gold\r\n//\t\t\t\t\tcurrentState.setParent(null);\r\n//\t\t\t\t\tcurrentState = findTheGold(currentState);\r\n//\t\t\t\t\tif(currentState.getGoldCollected()) {\r\n//\t\t\t\t\t\tcurrentState.setParent(null);\r\n//\t\t\t\t\t\taddToNextMoves(currentState);\r\n//\t\t\t\t\t}\r\n\t\t\t\t\tif(!goldCollected) {\r\n\t\t\t\t\t\twellItsDarkNow(visibleMap);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(goldCollected) {\r\n//\t\t\t\t\t\tcurrentState.setParent(null);\r\n\t\t\t\t\t\taddToNextMoves(visibleMap);\r\n//\t\t\t\t\t\tgoldCollected = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\tif(!nextMoves.isEmpty()) {\r\n\t\t\t\t\tSystem.out.println(nextMoves.peek());\r\n\t\t\t\t\tsetNextMove(nextMoves.remove());\r\n//\t\t\t\t\tSystem.out.println(nextMove);\r\n//\t\t\t\t\treturn nextMove;\r\n\t\t\t\t}\r\n\t\t\t\treturn nextMove;\r\n//\t\t\t\tcurrentNumMoves++;\r\n//\t\t\t\tif(currentNumMoves < 20) {\r\n//\t\t\t\t\treturn AgentAction.randomAction();\r\n//\t\t\t\t}\r\n//\t\t\t\telse {\r\n//\t\t\t\t\treturn AgentAction.declareVictory;\r\n//\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t}", "@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 }", "@Override\n public Move determineMove(Board board, Mark myMark) {\n observer.moveRequested(this, board);\n\n return move;\n }", "public Player nextMove() {\n\t\treturn null;\n\t\t\n\t}", "public void move() {\n if (this.nextMove.equals(\"a\")) { // move down\n this.row = row + 1;\n progress += 1;\n if (progress == steps) {\n nextMove = \"b\";\n progress = 0;\n }\n } else if (this.nextMove.equals(\"b\")) { // move right\n this.col = col + 1;\n progress += 1;\n if (progress == steps) {\n nextMove = \"c\";\n progress = 0;\n }\n } else if (this.nextMove.equals(\"c\")) { // move up\n this.row = row - 1;\n progress += 1;\n if (progress == steps) {\n nextMove = \"a\";\n progress = 0;\n }\n }\n }", "public String getValidMove() {\r\n\t\tboolean isValidMove = false;\r\n\t\tString Command = \"\";\r\n\t\twhile(!isValidMove) {\r\n\t\t\ttry {\r\n\t\t\t\tCommand = FromClient.readUTF();\r\n\t\t\t\tString[] parts = Command.split(\" \");\r\n\t\t\t\tint move = Integer.parseInt(parts[1]);\r\n\t\t\t\tisValidMove = engine.ValidPosition(move, User.Iindex, User.Jindex);\r\n\t\t\t\tToClient.writeBoolean(isValidMove);\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t} catch (NumberFormatException e1) {\r\n\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\te1.printStackTrace();\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn Command;\r\n\t}", "void makeMove(String move) {\n if (!isLegal(move)) {\n throw new IllegalArgumentException(\"This is an illegal move.\");\n }\n int column = Integer.parseInt(move.substring(2)) - 1;\n int row = Integer.parseInt(move.substring(0, 1)) - 1;\n _board[column][row] = currPlayer;\n alternatePlayer(currPlayer);\n }", "public abstract void buildMoveData(ChessBoard board);", "private Action doNextMove(Action move){\n\t\t// update east or north\n\t\tif (move == Action.East){\n\t\t\teast++;\n\t\t} else if (move == Action.West){\n\t\t\teast--;\n\t\t} else if (move == Action.North){\n\t\t\tnorth++;\n\t\t} else if (move == Action.South){\n\t\t\tnorth--;\n\t\t}\n\t\treturn move;\n\t}", "public LinkedList<Move> getPossibleMoves() {\n\t\tAIPossibleMoves.clear();\n\t\tint xOrigin = 0, yOrigin = 0, xMove1 = 0, xMove2 = 0, yMove1 = 0, yMove2 = 0;\n\t\tMove move = null;\t\n\t\t\tint type = 0;\n\t\t\tfor(Checker checker: model.whitePieces) {\n\t\t\t\t\n\t\t\t\txOrigin = checker.getCurrentXPosition();\n\t\t\t\tyOrigin = checker.getCurrentYPosition();\n\t\t\t\txMove1 = (checker.getCurrentXPosition() - 1);\n\t\t\t\txMove2 = (checker.getCurrentXPosition() + 1);\n\t\t\t\tyMove1 = (checker.getCurrentYPosition() - 1);\n\t\t\t\tyMove2 = (checker.getCurrentYPosition() + 1);\n\t\t\t\ttype = checker.getType();\n\t\t\t\tswitch(type) {\n\t\t\t\tcase 2:\n\n\t\t\t\t\tif((xMove1 < 0) || (yMove1 <0)) {\n\t\t\t\t\t//\tcontinue;\n\t\t\t\t\t} else {\n\t\t\t\t\tif(isMoveValid(xOrigin,yOrigin, xMove1, yMove1, false, false )) {\n\t\t\t\t\t\tif(!isSpaceTaken(xMove1,yMove1)) {\n\t\t\t\t\t\t\t//System.out.println(\"Space is not Taken\");\n\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove1, yMove1);\n\t\t\t\t\t\t\tAIPossibleMoves.add(move);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif(isPieceEnemy(xMove1,yMove1,checker,2)) {\n\t\t\t\t\t\t\t\tif(isJumpValid(xOrigin, yOrigin, xMove1, yMove1, false, false)) {\n\t\t\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove1, yMove1);\n\t\t\t\t\t\t\t\t\tAIPossibleMoves.add(move);\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\t}\n\t\t\t\t\t}\n \n\t\t\t\t\tif((xMove2 > 7) || (yMove1 < 0)) {\n\t\t\t\t\t//\tcontinue;\n\t\t\t\t\t} else {\n\t\t\t\t\n\t\t\t\t\tif(isMoveValid(xOrigin,yOrigin, xMove2, yMove1, true, false )) {\n\t\t\t\t\t\tif(!isSpaceTaken(xMove2,yMove1)) {\n\t\t\t\t\t\t\t// System.out.println(\"Space is not Taken\");\n\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove2, yMove1);\n\t\t\t\t\t\t\tAIPossibleMoves.add(move);\t\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif(isPieceEnemy(xMove2,yMove1,checker,2)) {\n\t\t\t\t\t\t\t\tif(isJumpValid(xOrigin, yOrigin, xMove2, yMove1, true, false)) {\n\t\t\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove2, yMove1);\n\t\t\t\t\t\t\t\t\tAIPossibleMoves.add(move);\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}\t\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase 4:\n\t\t\t\t\t//Moving up and left isMovingRight,IsMovingDown\n\t\t\t\t\tif((xMove1 <0) || (yMove1 < 0)) {\n\t\t\t\t\t\t//continue;\n\t\t\t\t\t} else {\n\t\t\t\t\tif(isMoveValid(xOrigin,yOrigin, xMove1, yMove1, false, false )) {\n\t\t\t\t\t\tif(!isSpaceTaken(xMove1,yMove1)) {\n\t\t\t\t\t\t//\tSystem.out.println(\"Space is not Taken\");\n\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove1, yMove1);\n\t\t\t\t\t\t\tAIPossibleMoves.add(move);\t\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif(isPieceEnemy(xMove1,yMove1,checker,2)) {\n\t\t\t\t\t\t\t\tif(isJumpValid(xOrigin, yOrigin, xMove1, yMove1, false, false)) {\n\t\t\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove1, yMove1);\n\t\t\t\t\t\t\t\t\tAIPossibleMoves.add(move);\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\n\t\t\t\tif((xMove2 > 7) || (yMove1 < 0)) {\n\t\t\t\t\t//continue;\n\t\t\t\t} else {\n\t\t\t\t\t//moving up and right\n\t\t\t\t\tif(isMoveValid(xOrigin,yOrigin, xMove2, yMove1, true, false )) {\n\t\t\t\t\t\tif(!isSpaceTaken(xMove2,yMove1)) {\n\t\t\t\t\t\t//\tSystem.out.println(\"Space is not Taken\");\n\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove2, yMove1);\n\t\t\t\t\t\t\tAIPossibleMoves.add(move);\t\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif(isPieceEnemy(xMove2,yMove1,checker,2)) {\n\t\t\t\t\t\t\t\tif(isJumpValid(xOrigin, yOrigin, xMove2, yMove1, true, false)) {\n\t\t\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove2, yMove1);\n\t\t\t\t\t\t\t\t\tAIPossibleMoves.add(move);\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}\n\t\t\t\t\n\t\t\t\tif((xMove1 < 0) || (yMove2 > 7)) {\n\t\t\t\t//\tcontinue;\n\t\t\t\t} else {\n\t\t\t\t\t//moving down and left isMovingRight,IsMovingDown\n\t\t\t\t\tif(isMoveValid(xOrigin,yOrigin, xMove1, yMove2, false, true )) {\n\t\t\t\t\t\tif(!isSpaceTaken(xMove1,yMove2)) {\n\t\t\t\t\t\t//\tSystem.out.println(\"Space is not Taken\");\n\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove1, yMove2);\n\t\t\t\t\t\t\tAIPossibleMoves.add(move);\t\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif(isPieceEnemy(xMove1,yMove2,checker,2)) {\n\t\t\t\t\t\t\t\tif(isJumpValid(xOrigin, yOrigin, xMove1, yMove2, false, true)) {\n\t\t\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove1, yMove2);\n\t\t\t\t\t\t\t\t\tAIPossibleMoves.add(move);\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}\n\t\t\t\t\n\t\t\t\tif((xMove2 > 7) || (yMove2 > 7)) {\n\t\t\t\t\t//continue;\n\t\t\t\t} else {\n\t\t\t\t\n\t\t\t\t\t//moving down and right isMovingRight,IsMovingDown\n\t\t\t\t\tif(isMoveValid(xOrigin,yOrigin, xMove2, yMove2, true, true )) {\n\t\t\t\t\t\tif(!isSpaceTaken(xMove2,yMove2)) {\n\t\t\t\t\t\t//\tSystem.out.println(\"Space is not Taken\");\n\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove2, yMove2);\n\t\t\t\t\t\t\tAIPossibleMoves.add(move);\t\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif(isPieceEnemy(xMove2,yMove2,checker,2)) {\n\t\t\t\t\t\t\t\tif(isJumpValid(xOrigin, yOrigin, xMove2, yMove2, true, true)) {\n\t\t\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove2, yMove2);\n\t\t\t\t\t\t\t\t\tAIPossibleMoves.add(move);\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}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\tbreak;\t\n\t\t\t\t}\t\n\t\t\t\n\t\t\t}\n\n\t\t\treturn AIPossibleMoves;\n\t\t\t\n\t\t}", "public Move validateLastMove() {\n Move move = board.getLastMove();\n int movevalue = move.getValue() == 1 ? -1 : 1;\n PieceColor nextplayer = Utility.convertCountToPlayerPiece(movevalue);\n BoardState playerState = (nextplayer == PieceColor.RED ? BoardState.REDWON : BoardState.YELLOWWON);\n BoardState state;\n Move newmove;\n // simulate opponent next move \n for (int column = 0, colSize = board.size()[1]; column < colSize; column++) {\n if (move.getColIndex() != column) {\n try {\n newmove = board.droppiece(column, nextplayer);\n state = board.getState(movevalue);\n board.undoLastMove();\n if (state != BoardState.STILL_PLAYING && playerState == state) {\n return newmove;\n }\n } catch (MoveException e) {\n //ignore\n }\n }\n }\n return null;\n }", "private String hardMove() {\n return super.makeAMove(getBestMoveForBlack(FORESEEN_MOVES * 2));\n }", "public int getMove(){\n return this.move;\n }", "private Move getBestMove() {\r\n\t\tSystem.out.println(\"getting best move\");\r\n\t\tChessConsole.printCurrentGameState(this.chessGame);\r\n\t\tSystem.out.println(\"thinking...\");\r\n\t\t\r\n\t\tList<Move> validMoves = generateMoves(false);\r\n\t\tint bestResult = Integer.MIN_VALUE;\r\n\t\tMove bestMove = null;\r\n\t\t\r\n\t\tfor (Move move : validMoves) {\r\n\t\t\texecuteMove(move);\r\n\t\t\t//System.out.println(\"evaluate move: \"+move+\" =========================================\");\r\n\t\t\tint evaluationResult = -1 * negaMax(this.maxDepth,\"\");\r\n\t\t\t//System.out.println(\"result: \"+evaluationResult);\r\n\t\t\tundoMove(move);\r\n\t\t\tif( evaluationResult > bestResult){\r\n\t\t\t\tbestResult = evaluationResult;\r\n\t\t\t\tbestMove = move;\r\n\t\t\t}\r\n\t\t}\r\n\t\tSystem.out.println(\"done thinking! best move is: \"+bestMove);\r\n\t\treturn bestMove;\r\n\t}", "@Override\r\n\tint[] move( int turnNo ) {\n\t\treturn getUserMove();\r\n\t}", "public void move(FightCell cell);", "@Override\n public Map<Direction, List<Coordinate>> getPossibleMoves() {\n\n Map<Direction, List<Coordinate>> moves = new HashMap<>();\n\n Coordinate coordinate = this.getCoordinate();\n int row = coordinate.getRow();\n int col = coordinate.getCol();\n\n //Jumps\n List<Coordinate> jumps = new ArrayList<>();\n\n //\n //\n ////\n int tempRow1 = row - 2;\n int tempCol1 = col - 1;\n Coordinate tempCoordinate1 = new Coordinate(tempRow1, tempCol1);\n if (Board.inBounds(tempCoordinate1)) {\n jumps.add(tempCoordinate1);\n }\n\n ////\n //\n //\n int tempRow2 = row + 2;\n int tempCol2 = col - 1;\n Coordinate tempCoordinate2 = new Coordinate(tempRow2, tempCol2);\n if (Board.inBounds(tempCoordinate2)) {\n jumps.add(tempCoordinate2);\n }\n\n //////\n //\n int tempRow3 = row - 1;\n int tempCol3 = col - 2;\n Coordinate tempCoordinate3 = new Coordinate(tempRow3, tempCol3);\n if (Board.inBounds(tempCoordinate3)) {\n jumps.add(tempCoordinate3);\n }\n\n ///////\n //\n int tempRow4 = row - 1;\n int tempCol4 = col + 2;\n Coordinate tempCoordinate4 = new Coordinate(tempRow4, tempCol4);\n if (Board.inBounds(tempCoordinate4)) {\n jumps.add(tempCoordinate4);\n }\n\n ////\n //\n //\n int tempRow5 = row + 2;\n int tempCol5 = col + 1;\n Coordinate tempCoordinate5 = new Coordinate(tempRow5, tempCol5);\n if (Board.inBounds(tempCoordinate5)) {\n jumps.add(tempCoordinate5);\n }\n\n //\n //\n ////\n int tempRow6 = row - 2;\n int tempCol6 = col + 1;\n Coordinate tempCoordinate6 = new Coordinate(tempRow6, tempCol6);\n if (Board.inBounds(tempCoordinate6)) {\n jumps.add(tempCoordinate6);\n }\n\n //\n //////\n int tempRow7 = row + 1;\n int tempCol7 = col - 2;\n Coordinate tempCoordinate7 = new Coordinate(tempRow7, tempCol7);\n if (Board.inBounds(tempCoordinate7)) {\n jumps.add(tempCoordinate7);\n }\n\n //\n //////\n int tempRow8 = row + 1;\n int tempCol8 = col + 2;\n Coordinate tempCoordinate8 = new Coordinate(tempRow8, tempCol8);\n if (Board.inBounds(tempCoordinate8)) {\n jumps.add(tempCoordinate8);\n }\n\n if (!jumps.isEmpty()) {\n moves.put(Direction.Jump, jumps);\n }\n return moves;\n }", "private int Block_Move() {\n\t\tfinal int POSSIBLE_BLOCK = 2;\n\t\tint move = NO_MOVE;\n\t\t\n\t\tif(( gameBoard[TOP_LEFT] + gameBoard[TOP_CENTER] + gameBoard[TOP_RIGHT]) == POSSIBLE_BLOCK){\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_BLOCK){\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_BLOCK){\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_BLOCK){\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_BLOCK){\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}\t\t\t\n\t\t}else if((gameBoard[TOP_RIGHT] + gameBoard[CTR_RIGHT] + gameBoard[BTM_RIGHT]) == POSSIBLE_BLOCK){\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_BLOCK){\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_BLOCK){\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}", "private static Image getMovePoint()\n\t{\n\t\ttry {\n\t\t\treturn ImageIO.read(new File(guiDirectory + move));\n\t\t} catch (IOException ioe) {\n\t\t}\n\t\treturn null;\n\t}", "private String mediumMove() {\n int a = getBestMoveForBlack(FORESEEN_MOVES * 2);\n System.out.println(\"Moving \" + a);\n return super.makeAMove(a);\n }" ]
[ "0.7437685", "0.7326363", "0.68912184", "0.68906075", "0.6842904", "0.68356663", "0.6817478", "0.67824656", "0.67610204", "0.6721933", "0.6704862", "0.6667476", "0.66611284", "0.6613201", "0.66114", "0.65858454", "0.6585437", "0.65771693", "0.65412563", "0.6534774", "0.64931136", "0.6481656", "0.6475278", "0.64447635", "0.6439161", "0.64214575", "0.6416054", "0.6402801", "0.6400441", "0.6391217", "0.63823366", "0.6373285", "0.6365856", "0.63646364", "0.63631123", "0.6360239", "0.63597304", "0.6321094", "0.631963", "0.63193893", "0.631054", "0.6303342", "0.63018644", "0.62999725", "0.62981945", "0.62979394", "0.6297021", "0.6270932", "0.6266502", "0.6263038", "0.6261934", "0.6216069", "0.61867905", "0.61795086", "0.6173055", "0.61538965", "0.61510193", "0.6147021", "0.6143274", "0.61427385", "0.6137528", "0.61371905", "0.61242586", "0.61010224", "0.609438", "0.6091807", "0.60880315", "0.60852516", "0.6083795", "0.6075362", "0.60749334", "0.6072038", "0.6065513", "0.6053934", "0.60414475", "0.60251987", "0.6024564", "0.6021692", "0.6021477", "0.60142595", "0.6002599", "0.6002519", "0.6000854", "0.5999889", "0.5998233", "0.5996154", "0.5994081", "0.5988014", "0.59849524", "0.5981788", "0.59813875", "0.59813815", "0.597502", "0.5966028", "0.5963407", "0.59620523", "0.59597534", "0.59582114", "0.5953851", "0.592813" ]
0.6531827
20
Return a random move based on the available spaces
private int getRandomMove(char[] boardConfig) { ArrayList<Integer> emptySpaces = getEmptySpaces(boardConfig); int random = (int) (Math.random() * emptySpaces.size()); int randomSpace = emptySpaces.get(random); char currentPlayer = (game.getPlayer() == 0) ? 'X' : 'O'; char[] tempBoard = boardConfig.clone(); tempBoard[randomSpace] = currentPlayer; shortTermMemory.add(boardToString(tempBoard)); return randomSpace; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private int Rand_Move() {\n\t\tRandom r = new Random();\n\t\tint move = NO_MOVE;\n\t\tdo{\n\t\t\tmove = r.nextInt(9);\n\t\t}while(square_empty[move] == false);\n\t\treturn move;\n\t}", "private void randomMove() {\n }", "public int randomMove()\r\n {\r\n r = new Random();\r\n x = r.nextInt(7);\r\n return x;\r\n }", "private Position getRandomMove(TicTacToeBoard state) {\r\n\t\tArrayList<Position> availableMoves = new ArrayList<Position>();\r\n\t\tfor( int row = 0; row < TicTacToeBoard.SIZE; row++ ) {\r\n\t\t\tfor( int col = 0; col < TicTacToeBoard.SIZE; col++ ) {\r\n\t\t\t\tif( state.getState(row,col) == TicTacToeBoard.BLANK ) {\r\n\t\t\t\t\tavailableMoves.add(new Position(row,col));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn (Position)availableMoves.get(rand.nextInt(availableMoves.size()));\r\n\t}", "public int decideRandomMove() {\n return (int) (Math.random() * 4);\n }", "public void randomMove(){\n ArrayList<Hole> availableHoles = availableMoves(nextToPlay);\n int holeIndex = (int)(Math.random() * (((availableHoles.size()-1) - 0) + 1)) + 0;\n ArrayList<Korgool> korgools = availableHoles.get(holeIndex).getKoorgools();\n while(korgools.size() == 0){\n holeIndex = (int)(Math.random() * (((availableHoles.size()-1) - 0) + 1)) + 0;\n korgools = availableHoles.get(holeIndex).getKoorgools();\n }\n redistribute(availableHoles.get(holeIndex).getHoleIndex());\n }", "static void randomMove() {\n int directionNum; // Randomly set to 0, 1, 2, or 3 to choose direction.\n directionNum = ( int )( Math.random() * 4 );\n\n switch ( directionNum ) {\n case 0: // Move up.\n currentRow--;\n if ( currentRow < 0 )\n currentRow = ROWS - 1;\n break;\n case 1 : // Move right.\n currentColumn++;\n if ( currentColumn >= COLUMNS )\n currentColumn = 0;\n break;\n case 2 : // Move down.\n currentRow++;\n if ( currentRow >= ROWS )\n currentRow = 0;\n break;\n case 3 : // Move left.\n currentColumn--;\n if ( currentColumn < 0 )\n currentColumn = COLUMNS - 1;\n break;\n\n }\n }", "private MoveAction wanderRandomly() {\n\t\tint intDir = rand.nextInt(8) + 1;\n\t\tDirection direction = Direction.fromInt(intDir);\n\t\treturn moveInDirection(direction);\n\t}", "protected Direction selectMove() {\n Map<Integer, Direction> positive, negative;\n // Add the directions that contains negative stations in a negative set\n // And every other direction in a positive set\n positive = new HashMap<Integer,Direction>(16);\n negative = new HashMap<Integer,Direction>(16);\n for (Direction d : Direction.directions) {\n int result = checkMove(d);\n if (result == 1) {\n positive.put(positive.size(), d);\n } else if (result == 0) {\n negative.put(negative.size(), d);\n } else {\n continue;\n }\n }\n // If there is no positive move, choose a RANDOM negative move\n if (positive.isEmpty()) {\n return negative.get(rand.nextInt(negative.size()));\n } else { // Otherwise choose a RANDOM positive move\n return positive.get(rand.nextInt(positive.size()));\n }\n }", "public Move getRandomMove(MachineState state, Role role) throws MoveDefinitionException, StateMachineException\n {\n List<Move> legals = getLegalMoves(state, role);\n return legals.get(new Random().nextInt(legals.size()));\n }", "public void makeRandomMove() {\n\t\ttry{\r\n\t\t\tif (playerId == game.getState().getTurn()){\r\n\t\t\t\tgame.execute(randPlayer.requestAction(game.getState()));\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch(IllegalArgumentException e){\r\n\t\t\t\r\n\t\t}\r\n\t}", "private int randomMove(Box box) {\n if (box == null)\n throw new IllegalArgumentException(\"Error. Null pointer in randomMove(box).\");\n Random random = new Random();\n LinkedList<Integer> movements = new LinkedList<>();\n if (!isNextBoxUsed(box, 0))\n movements.addLast(0);\n if (!isNextBoxUsed(box, 1))\n movements.addLast(1);\n if (!isNextBoxUsed(box, 2))\n movements.addLast(2);\n if (!isNextBoxUsed(box, 3))\n movements.addLast(3);\n return movements.get(random.nextInt(movements.size()));\n }", "public NewMove getRandomMove(char player) {\r\n\t\tint randomIndex;\r\n\t\tRandom random = new Random();\r\n\t\tgenerateLegalMovesPlayer(player);\r\n\t\tNewMove randomMove=null;\r\n\t\twhile(randomMove == null) {\r\n\t\t\trandomIndex = random.nextInt(this.moveList.length);\r\n\t\t\trandomMove = moveList[randomIndex];\r\n\t\t}\r\n\t\treturn randomMove;\r\n\t}", "public abstract void randomMoves();", "private Move produceRandomMove(Board board){\n\t\tint row = this.rowFinder(board); // find random row with unmarked stick.\n\t\tRandom myRandom = new Random();\n\t\tint stick1,stick2;\n\t\tint[] unmarkedStickArray = new int[board.getRowLength(row)+1];\n\t\tfinal int MARKED_STICK = 0; /* MARKED_STICK has the same value as the default value of the initialized\n\t\t array */\n\t\tfinal int UNMARKED_STICK = 1;\n\t\tfor(int stickNum=1; stickNum<board.getRowLength(row)+1; stickNum++){ /* the location in the array\n\t\t represent the stick in the row, if the value at that location is 1, then the stick in unmarked, else\n\t\t the value at the location in 0 (the default initialized value) */\n\t\t\tif(board.isStickUnmarked(row,stickNum)){\n\t\t\t\tunmarkedStickArray[stickNum] = UNMARKED_STICK;\n\t\t\t}\n\t\t}\n\t\twhile(true){\n\t\t\tint tempStick1 = myRandom.nextInt(board.getRowLength(row))+1;\n\t\t\tint tempStick2 = myRandom.nextInt(board.getRowLength(row))+1;\n\t\t\t// this if, check if the stick are legal, if not, jump to get another two random sticks\n\t\t\tif(unmarkedStickArray[tempStick1] == UNMARKED_STICK &&\n\t\t\t\t\tunmarkedStickArray[tempStick2] == UNMARKED_STICK){\n\t\t\t\t// do nothing\n\t\t\t}\n\t\t\telse{ continue;} // search for other sticks\n\t\t\tif(tempStick1 == tempStick2){ /* if the random sticks number are the same, so return a move that\n\t\t\t contain only one sticks */\n\t\t\t\treturn new Move(row,tempStick1,tempStick1);\n\t\t\t}\n\t\t\tif(tempStick1 < tempStick2){ /* this find the min number between the temp sticks and put the lower\n\t\t\t\t number at stick1 and the higher number at stick2, I could use Math.min(), but wasn't sure\n\t\t\t\t if it is allowed */\n\t\t\t\t stick1 = tempStick1;\n\t\t\t\t stick2 = tempStick2;\n\t\t\t}\n\t\t\telse{\n\t\t\t\t stick1 = tempStick2;\n\t\t\t\t stick2 = tempStick1;\n\t\t\t}\n\t\t\tfor(int i=1; i<(stick2-stick1)+1; i++){\n\t\t\t\tint locationInArray = stick1 + i;\n\t\t\t\tif(unmarkedStickArray[locationInArray] == MARKED_STICK){ /* if there is no legal sequence\n\t\t\t\t between stick1 and stick 2, then return a move that contain only one legal stick */\n\t\t\t\t\treturn new Move(row,stick1,stick1);\n\t\t\t\t}\n\t\t\t}\n\t\t\t/* if there is a legal sequence then return a move that contain that sequence */\n\t\t\treturn new Move(row,stick1,stick2);\n\t\t}\n\t}", "public Location computerMove()\n\t{\n\t\tArrayList<Location> possibleLocs = new ArrayList<Location>();\n\t\tfor (int row = 0; row < grid.length; row++)\n\t\t{\n\t\t\tfor (int col = 0; col < grid[0].length; col++)\n\t\t\t{\n\t\t\t\tLocation temp = new Location(row, col);\n\t\t\t\tif (!isOccupied(temp))\n\t\t\t\t\tpossibleLocs.add(temp);\n\t\t\t}\n\t\t}\n\t\tfor (int count = 0; count < possibleLocs.size(); count++)\n\t\t{\n\t\t\tif (checkWin(1, possibleLocs.get(count)))\n\t\t\t\treturn possibleLocs.get(count);\n\t\t\telse if (checkWin(0, possibleLocs.get(count)))\n\t\t\t\treturn possibleLocs.get(count);\n\t\t}\n\t\treturn possibleLocs.get((int) (Math.random() * possibleLocs.size()));\n\t}", "@Override\n\tpublic Direction getMove() {\n\t\t//Equal probability for each of the 8 compass direction, as well as staying stationary\n\t\treturn choices[this.random.nextInt(9)];\n\t}", "private void random() {\n GameState gs = cc.getGameState();\n ArrayList<int[]> moves = cc.getPlayerMoves(player);\n ArrayList<GameState> states = nextStates(moves, gs);\n for (int[] m : moves) {\n GameState next = checkMove(m, cc);\n states.add(next);\n }\n Random rand = new Random(System.nanoTime());\n int i = rand.nextInt(states.size());\n cc.setAIMove(states.get(i));\n }", "public Move randomMove(Stack possibilities) {\r\n\t\tint moveID = rand.nextInt(possibilities.size());\r\n\t\tSystem.out.println(\"Agent randomly selected move : \" + moveID);\r\n\t\tfor (int i = 1; i < (possibilities.size() - (moveID)); i++) {\r\n\t\t\tpossibilities.pop();\r\n\t\t}\r\n\t\tMove selectedMove = (Move) possibilities.pop();\r\n\t\treturn selectedMove;\r\n\t}", "public void randomWalk() {\n if (getX() % GameUtility.GameUtility.TILE_SIZE < 5 && getY() % GameUtility.GameUtility.TILE_SIZE < 5) {\n if (canChangeDirection) {\n direction = (int) (Math.random() * 3);\n direction += 1;\n direction *= 3;\n canChangeDirection = false;\n }\n }\n move(direction);\n if (timer >= timeTillChanngeDirection) {\n canChangeDirection = true;\n timer = 0;\n }\n\n if (lastLocation.x == this.getLocation().x && lastLocation.y == this.getLocation().y) {\n direction = (direction + 3) % 15;\n canChangeDirection = false;\n\n }\n lastLocation = this.getLocation();\n\n }", "@Override\n public Move makeMove() {\n Random random = new Random();\n int max = this.board.getBoardDimension()*4 - 1;\n int row = random.nextInt(max);\n int col = random.nextInt(max);\n Point point = new Point(row, col);\n\n while (!this.board.validPoint(point)) {\n row = random.nextInt(max);\n col = random.nextInt(max);\n point.setPoint(row, col);\n }\n\n Move m = new Move();\n m.P = this.player;\n m.Row = row;\n m.Col = col;\n\n this.board.update(m);\n return m;\n }", "private void moveRandomly()\r\n {\r\n if (Greenfoot.getRandomNumber (100) == 50)\r\n turn(Greenfoot.getRandomNumber(360));\r\n else\r\n move(speed);\r\n }", "public void randomMove(Random choiceGen){\n\tint choice = choiceGen.nextInt(4);\n\tswitch(choice){\n case 0:\n\tif(position[0] < worldEdge[0]){\n\t position[0] += 1;\n\t break;\n\t}\n\t\n\tcase 1:\n\t if(position[0] > 0){\n\t\tposition[0] -= 1;\n\t }\n\t else{\n\t position[0] += 1;\n\t }\n\t break;\n\tcase 2:\n\t if(position[1] < worldEdge[1]){\n\t\tposition[1] += 1;\n\t\tbreak;\n\t}\n\tcase 3:\n\t if(position[1] > 0){\n\t\tposition[1] -= 1;\n\t }\n\t else{\n\t\tposition[1] += 1;\n\t }\n\t break;\n\t}\n }", "Move getBestMove() {\n //System.out.println(\"AI chooses: \" + m.toString());\n return moves.get((int) (Math.random() * moves.size()));\n }", "public void move() {\n super.move(DIRECTION.getRandom());\n }", "public int getIntelligentMove(int[] availableMoves, int[] board){\n for (int move : availableMoves){\n int[] tempBoard = board.clone();\n tempBoard[move] = 1;\n int result = checkWinner(tempBoard);\n if (result == 1){\n return move;\n }\n \n }\n \n // Check if user can win, if so then block\n \n for (int move : availableMoves){\n int[] tempBoard = board.clone();\n tempBoard[move] = -1;\n int result = checkWinner(tempBoard);\n if (result == 2){\n return move;\n }\n \n }\n \n // If middle is available, take it\n for (int move: availableMoves){\n if (move == 4){\n return move;\n }\n }\n \n // Move into a corner in a row/col that the user is in\n int cornerMove = checkCorners(board, availableMoves);\n if (cornerMove >= 0){\n \n }\n \n // Otherwise, take random move\n Random rand = new Random();\n int possibleMoves = availableMoves.length;\n int moveIndex = rand.nextInt(possibleMoves);\n \n return availableMoves[moveIndex];\n \n \n }", "@Override\n public IMove doMove(IGameState state) {\n\n //Find macroboard to play in\n for (int[] move : preferredMoves)\n {\n if(state.getField().getMacroboard()[move[0]][move[1]].equals(IField.AVAILABLE_FIELD))\n {\n \n Random rnd = new Random();\n //find move to play\n for (int[] selectedMove : preferredMoves)\n {\n \n int x = move[0]*3 + selectedMove[0];\n int y = move[1]*3 + selectedMove[1];\n if(!state.getField().getBoard()[x][y].contains(IField.EMPTY_FIELD)\n && !state.getField().getBoard()[x][y].contains(IField.AVAILABLE_FIELD))\n {\n try\n {\n x = x + (rnd.nextInt(selectedMove[0] % 2 + 1));\n \n \n } catch (Exception e)\n {\n \n }\n try\n {\n y = y - (rnd.nextInt(selectedMove[0] % 2 - 1));\n \n } catch (Exception e)\n {\n \n }\n try\n {\n x = x - (rnd.nextInt(selectedMove[0] % 2 -1));\n \n \n } catch (Exception e)\n {\n \n }\n \n \n \n \n }\n if(state.getField().getBoard()[x][y].equals(IField.EMPTY_FIELD))\n {\n \n return new Move(x,y);\n }\n }\n }\n }\n\n //NOTE: Something failed, just take the first available move I guess!\n return state.getField().getAvailableMoves().get(0);\n }", "public void randomTeleport() {\n Random random = new Random(seed);\n seed = random.nextInt(10000);\n int randomY = RandomUtils.uniform(random, 0, worldHeight);\n int randomX = RandomUtils.uniform(random, 0, worldWidth);\n int randomDirection = RandomUtils.uniform(random, 0, 4);\n move(randomX, randomY);\n turn(randomDirection);\n }", "public void randomMove() {\r\n\t\tRandom rand = new Random();\r\n\t\tint moveNum = rand.nextInt(100)+100;\r\n\t\tcheck++;\r\n\t\tif(check >= moveNum) {\r\n\t\t\tspeed = speed*-1;\r\n\t\t\tcheck =0;\r\n\r\n\t\t}\r\n\r\n\t\tif(speed > 0) {\r\n\t\t\tsetIcon(rightImage);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tsetIcon(leftImage);\r\n\t\t}\r\n\t\tx += speed; setLocation(x,y); repaint();\r\n\t}", "public static String defaultMakeMove() {\n \n final int x = Map.MyX();\n final int y = Map.MyY();\n final List<String> validMoves = new ArrayList<String>();\n \n if (!Map.IsWall(x, y - 1)) {\n validMoves.add(\"North\");\n }\n if (!Map.IsWall(x+1, y)) {\n validMoves.add(\"East\");\n }\n if (!Map.IsWall(x,y+1)) {\n validMoves.add(\"South\");\n }\n if (!Map.IsWall(x-1,y)) {\n validMoves.add(\"West\");\n }\n \n if (validMoves.size() == 0) {\n return \"North\"; // Hopeless. Might as well go North!\n } else {\n final Random rand = new Random();\n int whichMove = rand.nextInt(validMoves.size());\n return validMoves.get(whichMove);\n } // End of the if - else //\n }", "private Vector3 randomLocationMonster() {\n\t\t\n\t\tVector3 center = this.getEngine().getSceneManager().getRootSceneNode().getLocalPosition();\n\t\tVector3 randomPosition;\n\t\tfloat[] randomFloat;\n\t\tdo {\n\t\t\trandomFloat = randomFloatArray(1000);\n\t\t\trandomPosition = Vector3f.createFrom(randomFloat[0], 1.5f, randomFloat[2]);\n\t\t} while (distanceFrom(center, randomPosition) > 380f);\n\t\treturn randomPosition;\n\t}", "@Override\n public Coordinate getMove(ImmutableGameBoard gameBoard, int numInARowToWin) {\n List<Coordinate> availableMoves = getAvailableMoves(gameBoard);\n int randomIndex = Utils.getRandom(0, availableMoves.size() - 1);\n\n return availableMoves.get(randomIndex);\n }", "public Location getRandomLocation() {\n\t\tint x = rand.nextInt(WORLD_SIZE);\n\t\tint y = 12;\n\t\tint z = rand.nextInt(WORLD_SIZE);\n\t\treturn new Location(x, y, z);\n\t}", "public Location getRandomLocationForPlayers() {\n\t\tfinal Location temp = getRandomLocationForMobs();\n\t\t\n\t\treturn new Location(temp.getWorld(), temp.getBlockX(), temp.getBlockY() + 1, temp.getBlockZ());\n\t}", "public int[] move(){\n double inProb = Math.random();\n if (inProb < .25){\n y--;\n }\n else if (inProb < .5){\n y ++;\n }\n else if (inProb <.75){\n x--;\n }\n else {\n x++;\n }\n int[]loc = new int[2];\n loc[0] = x;\n loc[1] = y;\n \n return loc;\n }", "@Override\n\tpublic Direction getMove() {\n if (ticks < MAX_TICKS_PER_ROUND - 100) {\n Direction[] dirs = Direction.values();\n return dirs[random.nextInt(dirs.length)];\n } else {\n // Move towards boat\n int deltaX = 0;\n int deltaY = 0;\n if (currentLocation.getX() < 0)\n deltaX = 1;\n else if (currentLocation.getX() > 0)\n deltaX = -1;\n\n if (currentLocation.getY() < 0)\n deltaY = 1;\n else if (currentLocation.getY() > 0)\n deltaY = -1;\n\n if (deltaX > 0 && deltaY == 0) {\n return Direction.E;\n } else if (deltaX > 0 && deltaY > 0) {\n return Direction.NE;\n } else if (deltaX > 0 && deltaY < 0) {\n return Direction.SE;\n } else if (deltaX == 0 && deltaY == 0) {\n return Direction.STAYPUT;\n } else if (deltaX == 0 && deltaY < 0) {\n return Direction.N;\n } else if (deltaX == 0 && deltaY > 0) {\n return Direction.S;\n } else if (deltaX < 0 && deltaY == 0) {\n return Direction.W;\n } else if (deltaX < 0 && deltaY > 0) {\n return Direction.NW;\n } else if (deltaX < 0 && deltaY < 0) {\n return Direction.NE;\n } else {\n throw new RuntimeException(\"I HAVE NO IDEA\");\n }\n }\n\t}", "private static int randomDirection() {\n return (int) (Math.random() * Direction.values().length);\n }", "private Location generateRandomStartLocation() {\n\t\tif (!atLeastOneNonWallLocation()) {\n\t\t\tthrow new IllegalStateException(\n\t\t\t\t\t\"There is no free tile available for the player to be placed\");\n\t\t}\n\n\t\twhile (true) {\n\t\t\t// Generate a random location\n\t\t\tfinal Random random = new Random();\n\t\t\tfinal int randomRow = random.nextInt(this.map.getMapHeight());\n\t\t\tfinal int randomCol = random.nextInt(this.map.getMapWidth());\n\n\t\t\tfinal Location location = new Location(randomCol, randomRow);\n\n\t\t\tif (this.map.getMapCell(location).isWalkable()\n\t\t\t\t\t&& !otherPlayerOnTile(location, -1)) {\n\t\t\t\t// If it's not a wall then we can put them there\n\t\t\t\treturn location;\n\t\t\t}\n\t\t}\n\t}", "private void moveComputer(String[][] gameState) {\n possiblemoves possibleMoves = new possiblemoves();\r\n String moves = possibleMoves.calculateMoves(gameState);\r\n String[] arrMoves = moves.split(\"\\\\r?\\\\n\");\r\n int randIndex = (int) (Math.random() * arrMoves.length);\r\n // Choose one of the possible moves at random\r\n String choosenSpace = arrMoves[randIndex];\r\n int xPosition = Character.getNumericValue(choosenSpace.charAt(0));\r\n int yPosition = Character.getNumericValue(choosenSpace.charAt(2));\r\n gameState[xPosition][yPosition] = \"o\";\r\n }", "private void goRandomDirection() {\n\t\tdesiredDirection = Math.random() * 360.0;\n\t}", "public Position getNextMove(TicTacToeBoard state) throws Exception {\r\n\t\treturn getRandomMove(state);\r\n\t}", "private Direction selectRandomDirection(List<Direction> possibleDirections) {\n\t\tint random = (int) (Math.random() * possibleDirections.size());\n\t\treturn possibleDirections.get(random);\n\t}", "void move()\n {\n Random rand = new Random();\n int moveOrNot = rand.nextInt(2);//50% chance\n if(moveOrNot == 1)\n super.move();\n }", "public void randomizeDirection()\n\t{\n\t\txSpeed = (int) (Math.pow(-1, random.nextInt(2)) * speed);\n\t\tySpeed = (int) (Math.pow(-1, random.nextInt(2)) * speed);\n\t}", "public synchronized String computeMove() {\n if (game == null) {\n System.err.println(\"CODE ERROR: AI is not attached to a game.\");\n return \"0,0\";\n }\n\n char[] board = (char[]) game.getStateAsObject();\n\n //Choose a smart move if that AI is set to \"Smart\" or if the random value equals 2\n if (aiType == 1) {\n if(useHeat && ((int) (Math.random() * heat)) == 2){\n return \"\" + getRandomMove(board);\n }\n else{\n return \"\" + getSmartMove(board);\n }\n } else {\n return \"\" + getRandomMove(board);\n }\n }", "public Location getRandomLocationForMobs() {\n\t\tfinal Location temp = getRandomLocation();\n\t\t\n\t\treturn new Location(temp.getWorld(), temp.getBlockX() + 0.5, temp.getBlockY() + 0.5, temp.getBlockZ() + 0.5);\n\t}", "public Location getRandomMoveLocation(ArenaWorld world, ArenaAnimal animal) {\n List<Location> surroundingLocations = getSurroundingFourLocations(animal.getLocation());\n List<Location> validSurroundingLocations = getValidSurroundingLocations(world, animal, surroundingLocations);\n\n return getRandomLocation(world, animal, validSurroundingLocations);\n }", "private void move()\r\n {\r\n int num = Game.random(4);\r\n String direction;\r\n if (num == 0)\r\n direction = \"north\";\r\n else if (num == 1)\r\n direction = \"east\";\r\n else if (num == 2)\r\n direction = \"south\";\r\n else //num == 3\r\n direction = \"west\";\r\n Room nextRoom = room.nextRoom(direction);\r\n if (nextRoom != null)\r\n {\r\n changeRoom(nextRoom);\r\n \r\n //Monster or Robot greets everyone was already in the room\r\n ArrayList<Person> peopleList = new ArrayList<Person>();\r\n \r\n peopleList = nextRoom.getPeople();\r\n peopleList.remove(name);\r\n \r\n String greetings =\"Hey \";\r\n for (int i=0; i<peopleList.size(); i++)\r\n \tgreetings += peopleList.get(i).getName() + \", \";\r\n\r\n if (!(peopleList.size()==0))\r\n \tsay(greetings);\r\n } \r\n \r\n }", "public void move() {\n\n int move_position_x = 0;\n int move_postion_y = 0;\n Random random = new Random();\n do {\n\n move_position_x = 0;\n move_postion_y = 0;\n int direction = random.nextInt(6);\n switch (direction) {\n case 0:\n move_postion_y = -1;\n break;\n case 1:\n case 4:\n move_postion_y = 1;\n break;\n case 2:\n case 5:\n move_position_x = 1;\n break;\n case 3:\n move_position_x = -1;\n }\n } while ((this.positionX + move_position_x < 0) || (this.positionX + move_position_x >= size_of_map) || (\n this.positionY + move_postion_y < 0) || (this.positionY + move_postion_y >= size_of_map));\n this.positionX += move_position_x;\n this.positionY += move_postion_y;\n }", "public void generateRandomPosition() {\n\t\tx.set((int)(Math.floor(Math.random()*23+1)));\n\t\ty.set((int)(Math.floor(Math.random()*23+1)));\n\n\t}", "@Test\n public void testplaceRandomChecker()\n {\n player2.placeChecker(0, 0);\n \n // 1) Create Available Moves & Add To Player 1's Moves Collection\n // 2) Pick an Available Move at Random\n Move randomMove = player1.generateRandomMove();\n \n int x = randomMove.getX();\n int y = randomMove.getY();\n \n // Check that X coordinate of Random Move is Up/Down/Unchanged\n assertTrue(x == player2.getXPosition()+1 || x== player2.getXPosition()-1 || x== player2.getXPosition());\n \n // Check that Y coordinate of Random Move is Left/Right/Unchanged\n assertTrue(y == player2.getYPosition()+1 || y== player2.getYPosition()-1 || y== player2.getYPosition());\n \n // Check Random Move Was Successfull\n assertEquals(player1,game.getBoard()[x][y].getOwner()); \n \n }", "private void generateRandomPosition() {\r\n int indexX, indexY;\r\n boolean collidesWithPlayers;\r\n playerState.position.x = Integer.MIN_VALUE; // While we trying...\r\n playerState.position.y = Integer.MIN_VALUE;\r\n final ExtensiveMovingObject testObject = new ExtensiveMovingObject( 0.0f, 0.0f, 0.0f, 0.0f, GeneralConsts.WORM_WIDTH, GeneralConsts.WORM_HEIGHT );\r\n int positionGenerationTrialFailureCounter = 0;\r\n do {\r\n do {\r\n indexX = 1 + (int) ( Math.random() * ( map.getWidth () - 1 ) );\r\n indexY = 1 + (int) ( Math.random() * ( map.getHeight() - 1 ) );\r\n if ( positionGenerationTrialFailureCounter++ == MAX_POSITION_GENERATION_TRIAL_FAILURE_COUNT )\r\n if ( map.getWall( indexX, indexY ) == Map.WALL_STONE )\r\n map.setWall( indexX, indexY, Map.WALL_BRICK ); // Not to empty: it can be under water!!\r\n } while( map.getWall( indexX, indexY ) == Map.WALL_STONE ); // Stone can't be cleared: it can be part of swimming pool boundaries. (But if there isn't other places where to start, we clear it!)\r\n testObject.position.x = ( indexX << GeneralConsts.WALL_WIDTH_SHIFT ) + GeneralConsts.WALL_WIDTH / 2;\r\n testObject.position.y = ( indexY << GeneralConsts.WALL_HEIGHT_SHIFT ) + GeneralConsts.WALL_HEIGHT / 2;\r\n collidesWithPlayers = false;\r\n for ( int playerIndex = 0; playerIndex < players.length && !collidesWithPlayers; playerIndex++ )\r\n if ( playerIndex != ownIndex && players[ playerIndex ] != null && testObject.hitsExtensiveObject( players[ playerIndex ].playerState ) )\r\n collidesWithPlayers = true;\r\n try {\r\n Thread.sleep( 0, 100 );\r\n }\r\n catch( InterruptedException ie ) {\r\n }\r\n } while ( collidesWithPlayers );\r\n playerState.position.x = testObject.position.x;\r\n playerState.position.y = testObject.position.y;\r\n map.clearMapForEnteringPlayer( indexX, indexY );\r\n }", "private String easyMove() {\n int randomHole = evaluate();\n while (!isValidMove(randomHole)) {\n randomHole = evaluate();\n }\n\n return super.makeAMove(randomHole);\n }", "public void move() {\n\t\tif (isLuck) {\n\t\t\tif (rand.nextBoolean()) {\n\t\t\t\txPos++;\n\t\t\t}\n\t\t} else {\n\t\t\tif (rightCount < skill) {\n\t\t\t\trightCount++;\n\t\t\t\txPos++;\n\t\t\t}\n\t\t}\n\t}", "@Override\r\n\t// Precondition: During testing the AI is associated with the 'O', the odd number move.\r\n \tpublic Point desiredMove(TicTacToeGame theGame) {\n\t\t\r\n\t\tchar[][] board = theGame.getTicTacToeBoard();\r\n\t\tPoint dPoint;\r\n\t //check for win\r\n\t\tdPoint = winOrBlock(board,'O');\r\n\t\tif(dPoint != null) {\r\n\t\t\tSystem.out.println(\"winning\");\r\n\t\t\treturn dPoint;\r\n\t\t}\r\n\t\t//check for block\r\n\t\tdPoint = winOrBlock(board,'X');\r\n\t\tif(dPoint != null) {\r\n\t\t\tSystem.out.println(\"blocking\");\r\n\t\t\treturn dPoint;\r\n\t\t}\r\n\t\t//otherwise pick random loc\r\n\t\tRandom randy = new Random(); \r\n\t int randX = randy.nextInt(3);\r\n\t int randY = randy.nextInt(3);\r\n\t while(!theGame.available(randX, randY)) {\r\n\t \trandX = randy.nextInt(3);\r\n\t \trandY = randy.nextInt(3);\r\n\t }\r\n\t System.out.println(\"random\");\r\n\t return new Point(randX, randY);\r\n\t}", "public void move() {\n health -= 2; //health decrement\n age++; //age increment\n if (yPos > 300) {\n speed += 3;\n }\n boolean canMove = false;\n int distancex = (int) (Math.random() * speed);\n int distancey = (int) (Math.random() * speed);\n int counterx = r.nextInt(2);\n int countery = r.nextInt(2);\n while (!canMove) {\n distancex = (int) (Math.random() * speed);\n distancey = (int) (Math.random() * speed);\n counterx = r.nextInt(2);\n countery = r.nextInt(2);\n if (counterx == 0 && this.xPos - distancex > 0\n && countery == 0 && this.yPos - distancey > 0) {\n canMove = true;\n } else if (counterx == 1 && this.xPos + distancex < 510\n && countery == 1 && this.yPos + distancey < 530) {\n canMove = true;\n }\n }\n if (counterx == 0 && countery == 0) {\n xPos -= distancex;\n yPos -= distancey;\n } else if (counterx == 0 && countery == 1) {\n xPos -= distancex;\n yPos += distancey;\n } else if (counterx == 1 && countery == 0) {\n xPos += distancex;\n yPos -= distancey;\n } else if (counterx == 1 && countery == 1) {\n xPos += distancex;\n yPos += distancey;\n }\n }", "int chooseMove();", "public Direction getMove() {\n\n // If 'count' is >= 3, then reset 'value' for next random direction.\n if (this.count >= 3) {\n this.value = this.generator.nextInt(4); // new value\n this.count = 0; // reset count to 0\n }\n \n ++this.count; // increment count for each call\n if (this.value == 0) {\n return Direction.NORTH;\n }\n else if (this.value == 1) {\n return Direction.SOUTH;\n }\n else if (this.value == 2) {\n return Direction.WEST;\n }\n else { // if value == 3\n return Direction.EAST;\n }\n }", "public String getNextMove() {\n int randomIndex = randomizer.generateRandomInt(this.nextMoves.size() - 1);\n System.out.println(\"random = \" + randomIndex + \", max = \" + (nextMoves.size() - 1));\n this.indexSelected = randomIndex;\n return this.nextMoves.get(randomIndex);\n }", "void moveNorthEast(){\n xpos = xpos + 3;\n ypos = ypos-xspeed;\n if (xpos > width){ // 20\n xpos = random(-width/2, width/2); // 25\n ypos = width; // 30\n }\n }", "public void shuffle() {\n\t\t\n\t\tRandom random = new Random();\n\t\tint position;\n\t\t\n\t\tfor(int i = 0; i < 200 * dimension; i++) {\n\t\t\tposition = random.nextInt(numTiles - 1);\n\t\t\tif(isValidMove(position)) {\n\t\t\t\tmakeMove(position);\n\t\t\t}\n\t\t}\n\t\t\n\t\tnumMoves = 0;\n\t}", "@Override\r\n public void move(List<Building> landmark, List<Pair<Integer, Integer>> orderedPath) {\r\n int moveChoice = (new Random()).nextInt(2);\r\n // 50% chance to move or not move\r\n if (moveChoice == 0){\r\n // Does not move, i.e. does nothing\r\n }\r\n else if (moveChoice == 1){\r\n // Move\r\n int directionChoice = (new Random()).nextInt(2);\r\n if (directionChoice == 0) {\r\n moveUpPath();\r\n } else if (directionChoice == 1) {\r\n moveDownPath();\r\n }\r\n }\r\n }", "@Override\r\n\tpublic void makeRandonMove() {\r\n\t\tif (randPlayer.getPlayerNumber() == game.getState().getTurn() && !game.getState().isFinished()) game.execute(randPlayer.requestAction(game.getState()));\r\n\t}", "public void takeStep() {\n \tRandom rand = new Random();\n\t\tint number = rand.nextInt(4);\n\t if(number == 0) {\n\t \tmoveNorth();\n\t \t}\n\t \telse if(number == 1) {\n\t \t\tmoveSouth();\n\t \t}\n \telse if(number == 2) {\n \t\tmoveWest();\n\t }\n\t \telse if(number == 3) {\n\t \t\tmoveEast();\n\t \t}\n }", "private void makeSmartComputerMove() {\n\t\tboolean b;\n\t\tint winningPos = 0;\n\t\tfor (int i = 1; i < board.length; i++) {\n\t\t\tb = isWinningMove(i, computerLetter);\n\t\t\tif (b) {\n\t\t\t\twinningPos = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (winningPos == 0) {\n\t\t\tfor (int i = 1; i < board.length; i++) {\n\t\t\t\tb = isWinningMove(i, playerLetter);\n\t\t\t\tif (b) {\n\t\t\t\t\twinningPos = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (winningPos == 0) {\n\t\t\twinningPos = getPosForWin();\n\t\t\tif (winningPos == 0)\n\t\t\t\twinningPos = (int) (Math.floor(Math.random() * 100) % 9 + 1);\n\t\t}\n\t\tif (winningPos < 0 || winningPos > 9) {\n\t\t\tSystem.out.println(\"Enter a valid position :\");\n\t\t\tmakeSmartComputerMove();\n\t\t} else if (isFree[winningPos]) {\n\t\t\tboard[winningPos] = computerLetter;\n\t\t\tisFree[winningPos] = false;\n\t\t\tSystem.out.println(\"Computer Move :\");\n\t\t\tprintBoard(board);\n\t\t\tisPlayerTurn = true;\n\t\t} else {\n\t\t\tmakeSmartComputerMove();\n\t\t}\n\n\t}", "private static ResourceLocation getRandomMonster(Random rand)\n\t{\n\t\tRandomCollection<ResourceLocation> monsters = new RandomCollection<ResourceLocation>();\n\t\t\n\t\tmonsters.add(10, EntityList.getKey(EntityZombie.class));\n\t\tmonsters.add(10, EntityList.getKey(EntitySkeleton.class));\n\t\tmonsters.add(10, EntityList.getKey(EntitySpider.class));\n\t\tmonsters.add(7, EntityList.getKey(EntityGhost.class));\n\t\tmonsters.add(7, EntityList.getKey(EntityBarbarian.class));\n\t\t//monsters.add(4, EntityList.getKey(EntityBandit.class));\n\t\tmonsters.add(3, EntityList.getKey(EntityBanshee.class));\n\t\tmonsters.add(1, EntityList.getKey(EntityGolem.class));\n\t\t\n\t\treturn monsters.next(rand);\n\t}", "public void act(){\n\t\tTile[] possibleMoves = game.getAllNeighbours(currentPosition);\r\n\t\tTile targetTile = possibleMoves[rng.nextInt(4)];\r\n\t\tmove(targetTile);\r\n\t}", "public Tile getRandomLegalTile(){\n\t\tRandom random = new Random();\n\t\tArrayList<Tile> legalTiles = getAllLegalMoves(Game.getInstance().getCurrentPlayerColor());\n\t\tTile randomTile = legalTiles.get( random.nextInt(legalTiles.size()));\n\t\treturn randomTile;\n\t}", "private static int getRandomNumberOfRooms(){\r\n return r.nextInt(50)+1;\r\n }", "public Room getRandomRoom(){\n return (Room)rooms.get(random.nextInt(rooms.size()));\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}", "private static Position fetchRandomPosition(){\n return new Position(0,0).returnRandomPosition();\n }", "public void positionShipsRandomly() {\r\n\t\tfor(Ship ship:ships) {\r\n\t\t\tpositionShipRandomly(ship,occupiedFields);\r\n\t\t}\r\n\t}", "private void wander(){\n\t\tmonster.moveRandom();\r\n\t\tsaveMove();\r\n\t}", "public void randomizeDirection() {\n\t\tRandom r = new Random();\n\t\tint randomDir = r.nextInt(8);\n\t\tdirection = Direction.values()[randomDir];\n\t}", "private void randMove(Person[] array){\r\n\t\t\tlogger.info(\"randMoving starts\");\r\n\t\t\tArrayList<Integer> remaining = new ArrayList<>();\r\n\t\t\tfor (int i = 0; i < array.length; i++) {\r\n\t\t\t\tremaining.add(i);\r\n\t\t\t}\r\n\t\t\tint step = 0;\r\n\t\t\tboolean isAgentArray = false;\r\n\t\t\tif(array[0] instanceof Agent) isAgentArray = true;\r\n\r\n\t\t\t//select from remaining index when remaining is not empty\r\n\t\t\twhile (step<array.length) {\r\n\t\t\t\tint index = randInt(0,remaining.size()-1);\r\n\t\t\t\tif(remaining.get(index)>=0){\r\n\t\t\t\t\t//move agents and cops here\r\n\t\t\t\t\tif(isAgentArray){\r\n\t\t\t\t\t\tif(agents[index].getJailTerm() == 0)\r\n\t\t\t\t\t\t\tagents[index].move();\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse cops[index].move();\r\n\t\t\t\t\tremaining.set(index,-1);\r\n\t\t\t\t\tstep++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tlogger.info(\"randmove finished after \" + step + \"iterations.\");\r\n\t\t}", "public void makeMove() {\n\t\tif (CheckForVictory(this)) {\n\t\t\t// System.out.println(\"VICTORY\");\n\t\t\tInterface.goalReached = true;\n\t\t\tfor (int i = 0; i < tmpStrings.length; i++) {\n\t\t\t\tif (moveOrder[i] == 0)\n\t\t\t\t\ttmpStrings[i] = \"turn left\";\n\t\t\t\telse if (moveOrder[i] == 1)\n\t\t\t\t\ttmpStrings[i] = \"turn right\";\n\t\t\t\telse\n\t\t\t\t\ttmpStrings[i] = \"go forward\";\n\n\t\t\t\tInterface.info.setText(\"Generation: \" + Parallel.generationNo + 1 + \" and closest distance to goal: \" + 0);\n\t\t\t}\n\t\t} else {\n\t\t\tmoveOrder[this.movesMade] = moves.remove();\n\t\t\tswitch (moveOrder[this.movesMade]) {\n\t\t\tcase (0):\n\t\t\t\tthis.movesMade++;\n\t\t\t\tif (face == 0)\n\t\t\t\t\tface = 3;\n\t\t\t\telse\n\t\t\t\t\tface--;\n\t\t\t\tbreak;\n\t\t\tcase (1):\n\t\t\t\tthis.movesMade++;\n\t\t\t\tif (face == 3)\n\t\t\t\t\tface = 0;\n\t\t\t\telse\n\t\t\t\t\tface++;\n\t\t\t\tbreak;\n\t\t\tcase (2):\n\t\t\t\tthis.movesMade++;\n\t\t\t\tif (face == 0 && Y - 1 >= 0)\n\t\t\t\t\tY--;\n\t\t\t\telse if (face == 1 && X + 1 <= map[0].length - 1)\n\t\t\t\t\tX++;\n\t\t\t\telse if (face == 2 && Y + 1 <= map.length - 1)\n\t\t\t\t\tY++;\n\t\t\t\telse if (face == 3 && X - 1 >= 0)\n\t\t\t\t\tX--;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tSystem.out.println(\"Error making move :(\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "private String RandomGoal() {\n\t\tList<String> list = Arrays.asList(\"m\", \"m\", \"m\", \"m\", \"m\", \"m\", \"m\", \"m\", \"t\", \"t\");\n\t\tRandom rand = new Random();\n\t\tString randomgoal = list.get(rand.nextInt(list.size()));\n\n\t\treturn randomgoal;\n\t}", "public Location selectMoveLocation(ArrayList<Location> locs)\n {\n int n = locs.size();\n if (n == 0)\n return getLocation();\n int r = (int) (Math.random() * n);\n return locs.get(r);\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}", "public Location randomSpawn(Match m) {\r\n\t\treturn randomSpawn(teamName.ALONE, m);\r\n\t}", "@Override\n public Action getRandomAction(Agent r, Maze m) {\n ArrayList<Action> actions = m.getValidActions(r);\n Random rand = new Random();\n return actions.get(rand.nextInt(actions.size()));\n }", "public Move chooseMove() {\n return new Move();\n }", "private Vector3 randomLocationDolphin() {\n\t\tVector3 center = this.getEngine().getSceneManager().getRootSceneNode().getLocalPosition();\n\t\tVector3 randomPosition;\n\t\tfloat[] randomFloat;\n\t\tdo {\n\t\t\trandomFloat = randomFloatArray(1000);\n\t\t\trandomPosition = Vector3f.createFrom(randomFloat[0], 0.0f, randomFloat[2]);\n\t\t} while (distanceFrom(center, randomPosition) < 420f);\n\t\treturn randomPosition;\n\t}", "@Override\r\n\tpublic boolean guardMovement() {\r\n\r\n\t\tif(stop == 0) {\r\n\t\t\tstate = 'G';\r\n\t\t\t\r\n\t\t\tRandom rand = new Random();\r\n\t\t\tint tmp = rand.nextInt(10) + 1;\r\n\t\t\t\r\n\t\t\tif(tmp > 8) { \r\n\t\t\t\tstate = 'g';\r\n\t\t\t\tstop = rand.nextInt(3) + 1;\r\n\t\t\t\tdirection = rand.nextBoolean();\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t\treturn checkAndMove();\r\n\t\t}\r\n\t\telse \r\n\t\t\tstop--;\r\n\r\n\t\treturn false;\r\n\t}", "public void step()\n {\n\t int rows = grid.length-1;\n\t int cols = grid[0].length-1;\n\t int direction = (int) (Math.random()*3);\n\t direction--;\n\t int row = (int) (Math.random()*rows);\n\t //System.out.println(row);\n\t int col = (int) (Math.random()*cols);\n\t //System.out.println(col);\n\t if(grid[row][col] == SAND && (grid[row+1][col] == EMPTY || grid[row+1][col] == WATER)) {\n\t\t grid[row+1][col] = SAND;\n\t\t grid[row][col] = EMPTY;\n\t }\n\t if(grid[row][col] == WATER && grid[row+1][col] == EMPTY) {\n\t\t if(col != 0) {\n\t\t\t grid[row+1][col+direction] = WATER;\n\t\t\t grid[row][col] = EMPTY;\n\t\t }\n\t\t else {\n\t\t\t grid[row+1][col] = WATER;\n\t\t\t grid[row][col] = EMPTY;\n\t\t }\n\t }\n }", "private static String randomDir() {\n int tileNum = random.nextInt(4);\n switch (tileNum) {\n case 0:\n return \"up\";\n case 1:\n return \"down\";\n case 2:\n return \"left\";\n case 3:\n return \"right\";\n default:\n return \"\";\n }\n }", "public static int randomPosition(){\r\n int max = 4;\r\n int min = 1;\r\n int range = max-min+1;\r\n \r\n int randNum = (int)(Math.random()*range) + min;\r\n int pos = randNum;\r\n \r\n return pos;\r\n }", "Chromosome getRandom();", "@Test\n\tpublic void testGenerateMove2() {\n\t\tString posStr = \"WxWWxWWWWWBBBBBBBBxxxxx\";\n\t\tMorrisBoard input = new MorrisBoard(posStr);\n\t\tList<MorrisBoard> output = MorrisBase.generateMove(input);\n\t\tassertTrue(output.size() == 5);\n\t}", "int randomPoint() { return 1 + (int)Math.round((Math.random()*20) % (size - 2)); }", "public Position sampleRandomUniformPosition();", "private void rngDirection() {\r\n Random direction = new Random();\r\n float rngX = (direction.nextFloat() -0.5f) *2;\r\n float rngY = (direction.nextFloat() -0.5f) *2;\r\n\r\n rngX = Float.parseFloat(String.format(java.util.Locale.US, \"%.1f\", rngX));\r\n rngY = Float.parseFloat(String.format(java.util.Locale.US, \"%.1f\", rngY));\r\n\r\n\r\n while(rngX == 0) {\r\n rngX = (direction.nextFloat() -0.5f) *2;\r\n }\r\n\r\n while(rngY == 0) {\r\n rngY = (direction.nextFloat() -0.5f) *2;\r\n }\r\n\r\n setSpeedX(rngX);\r\n setSpeedY(rngY);\r\n }", "@Test\n\tpublic void testGenerateMove1() {\n\t\tString posStr = \"xxxxxBxWWWWWBBBBxxxxxxx\";\n\t\tMorrisBoard input = new MorrisBoard(posStr);\n\t\tList<MorrisBoard> output = MorrisBase.generateMove(input);\n\t\tassertTrue(output.size() == 7);\n\t}", "public abstract void makeBestMove();", "public Position randposition()\r\n\t{\n\t\tRandom random = new Random();\r\n\t\tPosition position = new Position(random.nextInt(7680), random.nextInt(4320), random.nextDouble());\r\n\t\treturn position;\r\n\t}", "static Direction randomDirection() {\n\t\treturn new Direction((float)Math.random() * 2 * (float)Math.PI);\n\t}", "public void PlaceRandomBoard(){\r\n\r\n\t\tString whichShip;\r\n\t\tString coordinate;\r\n\t\t\r\n\t\t\t// Display the random board and the random board menu \r\n\t\t// DISPLAY BOARDS!!!!!\r\n\t\tint whichInput=0;\r\n\t\tShip temp = new Ship();\r\n\t\tRandom generator = new Random();\r\n\t\tint randomIndex = generator.nextInt();\r\n\t\twhile (!this.myBoard.carrier.placed || !this.myBoard.battleship.placed\r\n\t\t\t\t|| !this.myBoard.cruiser.placed || !this.myBoard.submarine.placed\r\n\t\t\t\t|| !this.myBoard.patrolboat.placed) {\r\n\r\n\t\t\twhichInput++;\r\n\r\n\t\t\twhichShip = String.valueOf(whichInput);\r\n\t\t\t\r\n\t\t\tint direction=0;\r\n\r\n\t\t\tboolean placed = false;\r\n\t\t\twhile (!placed) {\r\n\t\t\t\trandomIndex = generator.nextInt(10);\r\n\t\t\t\tcoordinate = this.indexToLetter(randomIndex);\r\n\t\t\t\tcoordinate += String.valueOf(generator.nextInt(10)+1);\r\n\t\t\t\tdirection = generator.nextInt(4) + 1;\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\tswitch (Integer.parseInt(whichShip)) {\r\n\t\t\t\tcase 1:\r\n\t\t\t\t\ttemp = new Carrier();\r\n\t\t\t\t\ttemp.name=\"Carrier\";\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 2:\r\n\t\t\t\t\ttemp = new Battleship();\r\n\t\t\t\t\ttemp.name=\"Battleship\";\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 3:\r\n\t\t\t\t\ttemp = new Cruiser();\r\n\t\t\t\t\ttemp.name=\"Cruiser\";\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 4:\r\n\t\t\t\t\ttemp = new Submarine();\r\n\t\t\t\t\ttemp.name=\"Submarine\";\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 5:\r\n\t\t\t\t\ttemp = new PatrolBoat();\r\n\t\t\t\t\ttemp.name=\"Patrol Boat\";\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t} \r\n\t\t\t\t\r\n\t\t\t\tplaced = this.validateShipPlacement(temp, coordinate, direction);\r\n\r\n\t\t\t\tif (placed) {\r\n\t//\t\t\t\tSystem.out.println(\"Success\");\r\n\t\t\t\t\tthis.placeShip(temp, coordinate, direction);\r\n\t\t\t\t\t\r\n\t\t\t\t} else {\r\n\t//\t\t\t\tdisplay.scroll(\"Invalid coordinate, please enter another\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t}", "private PositionData getRandomPoint() {\r\n int posX = new Random().nextInt(Constants.WIDTH);\r\n int posY = new Random().nextInt(Constants.HEIGHT);\r\n //make sure point is open\r\n while(!isOpenSpace(posX, posY)) {\r\n posX = new Random().nextInt(Constants.WIDTH);\r\n posY = new Random().nextInt(Constants.HEIGHT);\r\n }\r\n return new PositionData(posX, posY, Constants.PLAYER_A_ID);\r\n }", "public final Tile selectComputerMove() {\r\n Tile tile = null;\r\n int count = 0;\r\n String tileName = null;\r\n boolean continueLoop = true;\r\n \r\n // First try to find a winning move\r\n for (Rail rail : rails) {\r\n for (Tile t : rail.getTiles()) {\r\n if (t.getText().equals(\"0\")) count++;\r\n }\r\n if (count == 2) {\r\n for (Tile t : rail.getTiles()) {\r\n if (t.getText().equals(\"\")) {\r\n tileName = t.getName();\r\n return t;\r\n }\r\n }\r\n }\r\n count = 0; \r\n }\r\n \r\n // If none found, try to block \"X\"\r\n for (Rail rail : rails) {\r\n for (Tile t : rail.getTiles()) {\r\n if (t.getText().equals(\"X\")) count++;\r\n }\r\n if (count == 2) {\r\n for (Tile t : rail.getTiles()) {\r\n if (t.getText().equals(\"\")) {\r\n tileName = t.getName();\r\n return t;\r\n }\r\n }\r\n }\r\n count = 0;\r\n }\r\n \r\n // If no blocking move, try to play the center which gives \"O\"\r\n // a statistical advantage\r\n if (!tiles[R2C2].isSelected()) {\r\n return tiles[R2C2];\r\n }\r\n \r\n \r\n // If center move is not available, try to find an open corner tile, \r\n // which might set up an winning combination\r\n if (!tiles[R1C1].isSelected()) {\r\n return tiles[R1C1];\r\n } else if (!tiles[R3C3].isSelected()) {\r\n return tiles[R3C3];\r\n } else if (!tiles[R3C1].isSelected()) {\r\n return tiles[R3C1];\r\n } else if (!tiles[R1C3].isSelected()) {\r\n return tiles[R1C3];\r\n }\r\n \r\n // If none found just pick an empty tile at random\r\n if(tileName == null) {\r\n int row = rand.nextInt(3) + 1;\r\n int col = rand.nextInt(3) + 1;\r\n tileName = \"r\" + row + \"c\" + col;\r\n for (Tile btn: tiles) {\r\n if (btn.getName().equals(tileName)) {\r\n tile = btn;\r\n break;\r\n }\r\n }\r\n }\r\n \r\n return tile;\r\n }" ]
[ "0.7857806", "0.7526575", "0.74671704", "0.74649173", "0.7458852", "0.7271986", "0.7185866", "0.71555036", "0.7013415", "0.699517", "0.6953338", "0.69054574", "0.6892935", "0.6889608", "0.6870371", "0.6837374", "0.6822215", "0.67848", "0.67609656", "0.67608833", "0.6676824", "0.6666627", "0.6626664", "0.6595427", "0.6585006", "0.65510637", "0.6548498", "0.6515832", "0.6514736", "0.6511574", "0.6443962", "0.6438843", "0.6396392", "0.6394648", "0.63634425", "0.63482004", "0.6347224", "0.631225", "0.627875", "0.6274185", "0.62690455", "0.6264121", "0.6240772", "0.62406623", "0.6232766", "0.6229753", "0.62207854", "0.62178063", "0.61968815", "0.6187847", "0.6187487", "0.6177062", "0.6169572", "0.61627275", "0.61464757", "0.6142939", "0.6138855", "0.6130034", "0.6124206", "0.6122439", "0.6115972", "0.6083475", "0.60770315", "0.60692054", "0.6066824", "0.606499", "0.60627323", "0.6062022", "0.60601", "0.60557353", "0.6048508", "0.6026829", "0.6024084", "0.6018855", "0.60122365", "0.60100794", "0.6005386", "0.5998887", "0.599774", "0.597823", "0.5976305", "0.59752256", "0.59665936", "0.59578836", "0.59415245", "0.5934176", "0.5930693", "0.59296817", "0.5928603", "0.5928125", "0.59274167", "0.5921239", "0.59185123", "0.5909962", "0.58982664", "0.58971465", "0.5896062", "0.58950496", "0.58945507", "0.5884891" ]
0.7286806
5
/ Return the optimal move for the current empty spaces if the possible moves are in the long term memory. Otherwise choose a random move.
private int getSmartMove(char[] boardConfig) { ArrayList<Integer> emptySpaces = getEmptySpaces(boardConfig); double bestScore = -1; String bestChoice = ""; int move = 0; //Loop through each empty space on the board for (Integer emptySpace : emptySpaces) { int space = emptySpace; char[] tempBoard = new char[boardConfig.length]; //Create a copy of the board array System.arraycopy(boardConfig, 0, tempBoard, 0, boardConfig.length); //Add the current player's piece to the current empty spot tempBoard[space] = game.getPlayer() == 0 ? 'X' : 'O'; //Get a string from the possible move board String tempBoardString = boardToString(tempBoard); //Attempt to get the possible move board configuration data from the long term memory BoardRecord record = longTermMemory.get(tempBoardString); //Check if a record was found if (record != null) { //Calculate the score of the current move in question float currentValue = (float) (record.getWins() - record.getLosses()) / (record.getLosses() + record.getWins() + record.getTies()); //If the new move is better than the current best move choose it if (currentValue > bestScore) { bestScore = currentValue; move = space; bestChoice = tempBoardString; } } } if (!Objects.equals(bestChoice, "")) { shortTermMemory.add(bestChoice); return move; } else { return getRandomMove(boardConfig); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Move getBestMove() {\n //System.out.println(\"AI chooses: \" + m.toString());\n return moves.get((int) (Math.random() * moves.size()));\n }", "public void performMove() {\n\t\tfor (int x = 0; x <= size-1; x++)\n\t\t\tfor (int y = 0; y <= size-1; y++)\n\t\t\t\tlocalBoard[y][x] = 0;\n\t\t\n\t\t//reset the flag that indicates if a move has been found that decreases the heuristic\n\t\tfoundBetterMove = false;\n\t\t\n\t\t//fill in the appropriate heuristic values\n\t\tpopulateHillValues();\n\t\tArrayList<PotentialMove> myBestList = new ArrayList<PotentialMove>();\n\n\t\t//Find the square with the lowest heuristic value. this should really write the values to an array. \n\t\tint squareDifferential = -1;\n\t\t//String outValue = \"\";\n\t\tfor (int y = 0; y <= size-1; y++) {\n\t\t\tfor (int x = 0; x <= size-1; x++){\n\t\t\t\t//outValue = outValue + localBoard[y][x];\n\t\t\t\tif (squareDifferential < 0) //lowestSquareFound not found yet \n\t\t\t\t{\n\t\t\t\t\tif ((NQueens.queens[x] != y) && //set if the current square isn't already occupied by a queen\n\t\t\t\t\t\t\t(localBoard[NQueens.queens[x]][x] >= localBoard[y][x])) {\n\t\t\t\t\t\tif (localBoard[y][x] == localBoard[NQueens.queens[x]][x])\n\t\t\t\t\t\t\tmyBestList.add(new PotentialMove(x, y, true));\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tmyBestList.add(new PotentialMove(x, y, false));\n\t\t\t\t\t\tsquareDifferential = localBoard[NQueens.queens[x]][x] - localBoard[y][x];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if ((localBoard[NQueens.queens[x]][x] - localBoard[y][x]) > squareDifferential) { // find the square with the largest differential in value from the queen in the column\n\t\t\t\t\tmyBestList.clear();\n\t\t\t\t\tmyBestList.add(new PotentialMove(x, y, false));\n\t\t\t\t\tsquareDifferential = localBoard[NQueens.queens[x]][x] - localBoard[y][x];\n\t\t\t\t}\n\t\t\t\telse if (((localBoard[NQueens.queens[x]][x] - localBoard[y][x]) == squareDifferential) && // the differential is equal to the current best differential\n\t\t\t\t\t\t(NQueens.queens[x] != y)) { // and isn't already occupied by a queen\n\t\t\t\t\tmyBestList.add(new PotentialMove(x, y, true));\n\t\t\t\t}\n\t\t\t\t//else the square is higher, has a queen or isn't marginally better than the current queen's position in the row\n\t\t\t}\n\t\t\t//outValue = outValue + \"\\n\";\n\t\t}\n\t\t//JOptionPane.showMessageDialog(null, outValue);\n\t\t\n\t\tif (myBestList.isEmpty())\n\t\t\treturn;\n\t\t\n\t\tint listSize = myBestList.size();\n\t\tPotentialMove bestMove;\n\t\t\n\t\t//grab the non-Sideways moves first\n\t\tfor (int i = 0; i < listSize; i++) {\n\t\t\tif (!(myBestList.get(i).isSideways)) {\n\t\t\t\tbestMove = myBestList.get(i);\n\t\t\t\tfoundBetterMove = true;\n\t\t\t\tsidewaysMoves = 0;\n\t\t\t\tNQueens.queens[bestMove.xCoordinate] = bestMove.yCoordinate;\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (sidewaysMoves > MAXSIDEWAYSMOVES) { // hit MAXSIDEWAYSMOVES consecutive sideways moves, mark as unsolvable\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t//all available moves sideways moves, let's select one randomly\n\t\tRandom generator = new Random();\n\t\tint randomElement = generator.nextInt(listSize);\n\t\t\n\t\tbestMove = myBestList.get(randomElement);\n\t\tfoundBetterMove = true;\n\t\tsidewaysMoves++;\n\t\tNQueens.queens[bestMove.xCoordinate] = bestMove.yCoordinate;\n\t}", "public Move chooseMove(PentagoBoardState boardState) {\r\n try {\r\n if (heuristicOnly) {\r\n System.out.println(\"chose from heuristic\");\r\n return Heuristics.choseMove(new LowMemoryBoardState(boardState));\r\n }\r\n if (mcts == null) {\r\n mcts = new MonteCarloUCT();\r\n }\r\n return mcts.nextMove(new LowMemoryBoardState(boardState));\r\n } catch (OutOfMemoryError e) {\r\n /*\r\n if the memory limit is exceeded, we *attempt* to free memory\r\n by nullifying our mcts and asking the JVM to garbage collect.\r\n Since this is a serious error, we switch the instance to use\r\n a heuristic exclusively, to prevent going over the memory limit\r\n again.\r\n */\r\n mcts = null;\r\n System.gc();\r\n this.heuristicOnly = true;\r\n return Heuristics.choseMove(new LowMemoryBoardState(boardState));\r\n }\r\n }", "private Move getBestMove() {\r\n\t\tSystem.out.println(\"getting best move\");\r\n\t\tChessConsole.printCurrentGameState(this.chessGame);\r\n\t\tSystem.out.println(\"thinking...\");\r\n\t\t\r\n\t\tList<Move> validMoves = generateMoves(false);\r\n\t\tint bestResult = Integer.MIN_VALUE;\r\n\t\tMove bestMove = null;\r\n\t\t\r\n\t\tfor (Move move : validMoves) {\r\n\t\t\texecuteMove(move);\r\n\t\t\t//System.out.println(\"evaluate move: \"+move+\" =========================================\");\r\n\t\t\tint evaluationResult = -1 * negaMax(this.maxDepth,\"\");\r\n\t\t\t//System.out.println(\"result: \"+evaluationResult);\r\n\t\t\tundoMove(move);\r\n\t\t\tif( evaluationResult > bestResult){\r\n\t\t\t\tbestResult = evaluationResult;\r\n\t\t\t\tbestMove = move;\r\n\t\t\t}\r\n\t\t}\r\n\t\tSystem.out.println(\"done thinking! best move is: \"+bestMove);\r\n\t\treturn bestMove;\r\n\t}", "public Move chooseMove(TablutBoardState boardState) {\n \n \tList<TablutMove> options = boardState.getAllLegalMoves();\n\n \n bestMove = options.get(((int) MyTools.getSomething())% (options.size()));\n\n int depth = DEPTH;\n int opponent = boardState.getOpponent();\n boolean isMax;\n if(opponent==1){\n \tisMax = true;\n \t//System.out.println(\"I'm max\");\n }\n else{\n \tisMax = false;\n \t//System.out.println(\"I'm min\");\n }\n //bestMove = \n \n int bestvalue = minimax(boardState,isMax, depth,-10000,10000);\n \n \n //int minNumberOfOpponentPieces = boardState.getNumberPlayerPieces(opponent);\n //boolean moveCaptures = false;\n //System.out.println(\"minimax return value: \"+bestvalue);\n \n \n \n \n return bestMove;\n }", "PrioritizedMove getBestMoveFor(int player, int desiredLength);", "public Move makeFirstMove(){\n bestWord = new ArrayList<>();\n getStartingWord( tray , bestWord, \"\", 0); //maxScore get's updated in here.\n if (maxScore == 0){ return null; }\n //right now the AI is dumb and always starts on the first tile.... this is only safe with boardSize/2 >= 7\n Move move =\n new Move(bestWord , Constants.BOARD_DIMENSIONS/2 ,\n Constants.BOARD_DIMENSIONS/2 - (bestWord.size() / 2) , true , maxScore , bot);\n //refillTray();\n return move;\n }", "public Move pickBestMove(Board board) {\n\t\treturn null;\n\t}", "private int Rand_Move() {\n\t\tRandom r = new Random();\n\t\tint move = NO_MOVE;\n\t\tdo{\n\t\t\tmove = r.nextInt(9);\n\t\t}while(square_empty[move] == false);\n\t\treturn move;\n\t}", "public abstract void makeBestMove();", "public Move makeSubsequentMove(){\n Move move = null;\n maxScore = 0;\n bestWord = new ArrayList<Tile>();\n for (Anchor anchor : findAnchors()){\n ArrayList<Tile> inputTiles = new ArrayList<Tile>(tray);\n inputTiles.add(anchor.anchorTile);\n findHighestScoringWord(inputTiles, new ArrayList<Tile>(), \"\", 0, anchor);\n }\n if (bestWord == null || bestWord.size() == 0){\n //should i have some kind of get new tray of tiles thing?\n return move;\n } else {\n int startCol;\n int startRow;\n if (currentAnchor.isAcross()){\n startCol = currentAnchor.col - getAnchorPosition(currentAnchor, bestWord);\n startRow = currentAnchor.row;\n } else {\n startCol = currentAnchor.col;\n startRow = currentAnchor.row - getAnchorPosition(currentAnchor, bestWord);\n }\n\n move = new Move(bestWord , startRow , startCol ,currentAnchor.isAcross(), maxScore , bot);\n //move.execute(Board?);\n }\n return move;\n }", "public Location computerMove()\n\t{\n\t\tArrayList<Location> possibleLocs = new ArrayList<Location>();\n\t\tfor (int row = 0; row < grid.length; row++)\n\t\t{\n\t\t\tfor (int col = 0; col < grid[0].length; col++)\n\t\t\t{\n\t\t\t\tLocation temp = new Location(row, col);\n\t\t\t\tif (!isOccupied(temp))\n\t\t\t\t\tpossibleLocs.add(temp);\n\t\t\t}\n\t\t}\n\t\tfor (int count = 0; count < possibleLocs.size(); count++)\n\t\t{\n\t\t\tif (checkWin(1, possibleLocs.get(count)))\n\t\t\t\treturn possibleLocs.get(count);\n\t\t\telse if (checkWin(0, possibleLocs.get(count)))\n\t\t\t\treturn possibleLocs.get(count);\n\t\t}\n\t\treturn possibleLocs.get((int) (Math.random() * possibleLocs.size()));\n\t}", "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 }", "@Override\n /**\n * Selects a move based on the current game state\n */\n public Move selectMove() {\n Game game = this.game.copy();\n List<Move> moves = game.getValidMoves(this.player);\n Collections.shuffle(moves);\n\n // Create a thread pool\n Executor executor = Executors.newFixedThreadPool(this.threadCount);\n CompletionService<MinimaxEngineWorker> service = new ExecutorCompletionService<MinimaxEngineWorker>(executor);\n\n // Determine the value of each move using the thread pool\n for (Move move : moves) {\n service.submit(new MinimaxEngineWorker(game, move, this.hashMap));\n }\n\n Move bestMove = null;\n double bestMoveValue = Double.NEGATIVE_INFINITY;\n int movesSize = moves.size();\n long moveCount = 0;\n long hashMapHits = 0;\n for (int i = 0; i < movesSize; i++) {\n try {\n // Block until a worker thread finishes\n MinimaxEngineWorker worker = service.take().get();\n\n // Report progress\n moveCount += worker.moveCount;\n hashMapHits += worker.hashMapHits;\n this.setProgress((double) i / movesSize, moveCount, hashMapHits);\n\n // Update the best move\n if (bestMove == null || worker.moveValue >= bestMoveValue) {\n bestMove = worker.move;\n bestMoveValue = worker.moveValue;\n }\n } catch (InterruptedException e) {\n e.printStackTrace();\n } catch (ExecutionException e) {\n e.printStackTrace();\n }\n }\n \n // Clear the hashmap\n this.hashMap.clear();\n Runtime.getRuntime().gc();\n\n return bestMove;\n }", "protected Direction selectMove() {\n Map<Integer, Direction> positive, negative;\n // Add the directions that contains negative stations in a negative set\n // And every other direction in a positive set\n positive = new HashMap<Integer,Direction>(16);\n negative = new HashMap<Integer,Direction>(16);\n for (Direction d : Direction.directions) {\n int result = checkMove(d);\n if (result == 1) {\n positive.put(positive.size(), d);\n } else if (result == 0) {\n negative.put(negative.size(), d);\n } else {\n continue;\n }\n }\n // If there is no positive move, choose a RANDOM negative move\n if (positive.isEmpty()) {\n return negative.get(rand.nextInt(negative.size()));\n } else { // Otherwise choose a RANDOM positive move\n return positive.get(rand.nextInt(positive.size()));\n }\n }", "public int getIntelligentMove(int[] availableMoves, int[] board){\n for (int move : availableMoves){\n int[] tempBoard = board.clone();\n tempBoard[move] = 1;\n int result = checkWinner(tempBoard);\n if (result == 1){\n return move;\n }\n \n }\n \n // Check if user can win, if so then block\n \n for (int move : availableMoves){\n int[] tempBoard = board.clone();\n tempBoard[move] = -1;\n int result = checkWinner(tempBoard);\n if (result == 2){\n return move;\n }\n \n }\n \n // If middle is available, take it\n for (int move: availableMoves){\n if (move == 4){\n return move;\n }\n }\n \n // Move into a corner in a row/col that the user is in\n int cornerMove = checkCorners(board, availableMoves);\n if (cornerMove >= 0){\n \n }\n \n // Otherwise, take random move\n Random rand = new Random();\n int possibleMoves = availableMoves.length;\n int moveIndex = rand.nextInt(possibleMoves);\n \n return availableMoves[moveIndex];\n \n \n }", "@Override\r\n\t\tpublic Action BestMove(AI_Domain game) {\r\n\t\t\t return new Action(minimax(game,true,depth,true,null).getPath());\r\n\t\t}", "public static String defaultMakeMove() {\n \n final int x = Map.MyX();\n final int y = Map.MyY();\n final List<String> validMoves = new ArrayList<String>();\n \n if (!Map.IsWall(x, y - 1)) {\n validMoves.add(\"North\");\n }\n if (!Map.IsWall(x+1, y)) {\n validMoves.add(\"East\");\n }\n if (!Map.IsWall(x,y+1)) {\n validMoves.add(\"South\");\n }\n if (!Map.IsWall(x-1,y)) {\n validMoves.add(\"West\");\n }\n \n if (validMoves.size() == 0) {\n return \"North\"; // Hopeless. Might as well go North!\n } else {\n final Random rand = new Random();\n int whichMove = rand.nextInt(validMoves.size());\n return validMoves.get(whichMove);\n } // End of the if - else //\n }", "private Move getBestMove(RaceTrack track, CellData[][] cells,\n\t\t\tPair<Integer, Integer> pos, Pair<Integer, Integer> speed, int depth) {\n\t\tCellData cellData = cells[pos.getLeft()][pos.getRight()];\n\n\t\tMap<Pair<Integer, Integer>, Character> availableMoves = new HashMap<>();\n\t\tint contX = pos.getLeft() + speed.getLeft();\n\t\tint contY = pos.getRight() + speed.getRight();\n\n\t\tPair<Integer, Integer> cont0 = Pair.of(contX, contY);\n\t\tif (cellData.getLegalMoves().contains(cont0)) {\n\t\t\tavailableMoves.put(cont0, '0');\n\t\t}\n\t\tPair<Integer, Integer> contL = Pair.of(contX - 1, contY);\n\t\tif (cellData.getLegalMoves().contains(contL)) {\n\t\t\tavailableMoves.put(contL, 'L');\n\t\t}\n\t\tPair<Integer, Integer> contR = Pair.of(contX + 1, contY);\n\t\tif (cellData.getLegalMoves().contains(contR)) {\n\t\t\tavailableMoves.put(contR, 'R');\n\t\t}\n\t\tPair<Integer, Integer> contU = Pair.of(contX, contY - 1);\n\t\tif (cellData.getLegalMoves().contains(contU)) {\n\t\t\tavailableMoves.put(contU, 'U');\n\t\t}\n\t\tPair<Integer, Integer> contD = Pair.of(contX, contY + 1);\n\t\tif (cellData.getLegalMoves().contains(contD)) {\n\t\t\tavailableMoves.put(contD, 'D');\n\t\t}\n\t\tfinal Map<Pair<Integer, Integer>, Integer> moveMap = new HashMap<>();\n\n\t\tfor (Pair<Integer, Integer> move : availableMoves.keySet()) {\n\t\t\tint moveValue = getMoveValue(cells, pos.getLeft(), pos.getRight(),\n\t\t\t\t\tmove.getLeft(), move.getRight());\n\t\t\tmoveMap.put(move, moveValue);\n\t\t}\n\n\t\tList<Pair<Integer, Integer>> allMoves = new ArrayList<>(\n\t\t\t\tmoveMap.keySet());\n\t\tCollections.sort(allMoves, new Comparator<Pair<Integer, Integer>>() {\n\t\t\t@Override\n\t\t\tpublic int compare(Pair<Integer, Integer> o1,\n\t\t\t\t\tPair<Integer, Integer> o2) {\n\t\t\t\treturn Integer.compare(moveMap.get(o2), moveMap.get(o1));\n\t\t\t}\n\t\t});\n\t\tPair<Integer, Integer> bestMove = allMoves.get(0);\n\n\t\tif ((depth == 0) || (moveMap.get(bestMove) > 0)) {\n\t\t\treturn new Move(bestMove, moveMap.get(bestMove),\n\t\t\t\t\tavailableMoves.get(bestMove));\n\t\t}\n\t\tfinal Map<Pair<Integer, Integer>, Integer> newMoveMap = new HashMap<>();\n\t\tfor (Pair<Integer, Integer> move : allMoves) {\n\t\t\tPair<Integer, Integer> newSpeed = Pair.of(\n\t\t\t\t\tmove.getLeft() - pos.getLeft(),\n\t\t\t\t\tmove.getRight() - pos.getRight());\n\t\t\tint moveValue = getBestMove(track, cells, move, newSpeed, depth - 1).value;\n\t\t\tnewMoveMap.put(move, moveValue);\n\t\t}\n\t\tCollections.sort(allMoves, new Comparator<Pair<Integer, Integer>>() {\n\t\t\t@Override\n\t\t\tpublic int compare(Pair<Integer, Integer> o1,\n\t\t\t\t\tPair<Integer, Integer> o2) {\n\t\t\t\treturn Integer.compare(newMoveMap.get(o2), newMoveMap.get(o1));\n\t\t\t}\n\t\t});\n\t\tbestMove = allMoves.get(0);\n\t\treturn new Move(bestMove, moveMap.get(bestMove),\n\t\t\t\tavailableMoves.get(bestMove));\n\t}", "public Coordinate getNextMove() {\n\n if (targetMode && salvationMode == false) {\n\n Coordinate bestNextTarget;\n\n if (!fixedDirection) { // direction is not known\n\n int maxCount = 0;\n bestNextTarget = this.previousTarget;\n\n // find the best target around the last target //\n\n if (inBound(this.axis.y + 1, this.axis.x)) {\n maxCount = countGrid[this.axis.y + 1][this.axis.x];\n bestNextTarget = new Coordinate(this.axis.x, this.axis.y + 1);\n direction = 0; // north by default\n }\n\n if (inBound(this.axis.y - 1, this.axis.x)) {\n if (countGrid[this.axis.y - 1][this.axis.x] > maxCount) {\n maxCount = countGrid[this.axis.y - 1][this.axis.x];\n bestNextTarget = new Coordinate(this.axis.x, this.axis.y - 1);\n direction = 2;\n }\n }\n\n if (inBound(this.axis.y, this.axis.x + 1)) { // try east\n if (countGrid[this.axis.y][this.axis.x + 1] > maxCount) {\n maxCount = countGrid[this.axis.y][this.axis.x + 1];\n bestNextTarget = new Coordinate(this.axis.x + 1, this.axis.y);\n direction = 1;\n }\n }\n\n if (inBound(this.axis.y, this.axis.x - 1)) { // try west\n if (countGrid[this.axis.y][this.axis.x - 1] > maxCount) {\n maxCount = countGrid[this.axis.y][this.axis.x - 1];\n bestNextTarget = new Coordinate(this.axis.x - 1, this.axis.y);\n direction = 3;\n }\n }\n\n seekAgain = false;\n\n } else { // direction is known\n\n bestNextTarget = new Coordinate(this.axis.x, this.axis.y);\n\n if (direction == 0) { // north\n if (inBound(this.axis.y + distanceFromHit, this.axis.x)) {\n bestNextTarget = new Coordinate(this.axis.x, this.axis.y + distanceFromHit);\n } else { // else go south\n distanceFromHit = 1;\n bestNextTarget = new Coordinate(this.axis.x, this.axis.y - distanceFromHit);\n direction = 2;\n }\n\n } else if (direction == 1) { // east\n if (inBound(this.axis.y, this.axis.x + distanceFromHit)) {\n bestNextTarget = new Coordinate(this.axis.x + distanceFromHit, this.axis.y);\n } else { // else go west\n distanceFromHit = 1;\n bestNextTarget = new Coordinate(this.axis.x - distanceFromHit, this.axis.y);\n direction = 3;\n }\n\n } else if (direction == 2) { // south\n if (inBound(this.axis.y - distanceFromHit, this.axis.x)) {\n bestNextTarget = new Coordinate(this.axis.x, this.axis.y - distanceFromHit);\n } else { // else go north\n distanceFromHit = 1;\n bestNextTarget = new Coordinate(this.axis.x, this.axis.y + distanceFromHit);\n direction = 0;\n }\n\n } else if (direction == 3) { // west\n if (inBound(this.axis.y, this.axis.x - distanceFromHit)) {\n bestNextTarget = new Coordinate(this.axis.x - distanceFromHit, this.axis.y);\n } else { // else go east\n distanceFromHit = 1;\n bestNextTarget = new Coordinate(this.axis.x + distanceFromHit, this.axis.y);\n direction = 1;\n }\n }\n }\n\n this.previousTarget = bestNextTarget;\n\n } else {\n this.previousTarget = getGlobalHighestCount();\n }\n\n toExclude.add(new Coordinate(this.previousTarget.y, this.previousTarget.x));\n\n this.countGrid[this.previousTarget.y][this.previousTarget.x] = 0;\n\n return this.previousTarget;\n }", "@Override\n\tpublic Move stateMachineSelectMove(long timeout)\n\t\t\tthrows TransitionDefinitionException, MoveDefinitionException, GoalDefinitionException {\n\t\tlong start = System.currentTimeMillis();\n\t\tList<Move> moves = getStateMachine().getLegalMoves(getCurrentState(), getRole());\n\t\tMove bestMove = moves.get(0);\n\t\tint bestScore = 0;\n\t\tfor (Move move: moves) {\n\t\t\tint result = getMinScore(getRole(), move, getCurrentState(), 0, 100);\n\t\t\tif (result > bestScore) {\n\t\t\t\tbestScore = result;\n\t\t\t\tbestMove = move;\n\t\t\t}\n\t\t}\n\n\t\tlong stop = System.currentTimeMillis();\n\t\tnotifyObservers(new GamerSelectedMoveEvent(moves, bestMove, stop - start));\n\t\treturn bestMove;\n\t}", "private void intelligentDecideMove() {\n\t\tMonster target=nearestEnemy();\r\n\t\tif(target!=null){\t\t\t\t//FIRST PRIORITY: pursue the target if it can be seen.\r\n\t\t\tswitchStates(PURSUIT);\r\n\t\t\ttargetTile=new Tile(target.currentTile);\r\n\t\t\t//saveMove();\r\n\t\t\tmonster.moveTowards(target);\r\n\t\t}\r\n\t\t\t\r\n\t\telse{\r\n\t\t\ttargetLostResponse();\r\n\t\t\t}\r\n\t}", "private Move defaultMoveInGoodPlace(PentagoBoard b0) {\n \tPentagoBoard b = (PentagoBoard)b0.clone();\n \tList<Move> moves = b.getMovesFor(getColor());\n \tfor(Move m: moves) {\n \t\tPentagoMove pM = (PentagoMove)m;\n \t\tif(havMyNeighbour(b,getColor(), pM.getPlaceX(), pM.getPlaceY()) == false)\n \t\t\tcontinue;\n \t\tif(canWinInRow(b,pM.getPlaceY(),getColor())) {\n \t\t\tb.doMove(m);\n \t\t\tif(canWinOpponentNow(b) != null) { // przeciwnik nie moze wygrac po moim ruchu\n \t\t\tb.undoMove(m);\n \t\t\tcontinue;\n \t\t}\n \t\t\treturn m;\n \t\t}\n \t\tif(canWinInColumn(b,pM.getPlaceX(),getColor())) {\n \t\t\tb.doMove(m);\n \t\t\tif(canWinOpponentNow(b) != null) { // przeciwnik nie moze wygrac po moim ruchu\n \t\t\tb.undoMove(m);\n \t\t\tcontinue;\n \t\t}\n \t\t\treturn m;\n \t\t}\n \t}\n \treturn null;\n }", "protected Object[] getBestMove(Solution soln, Move[] moves, ObjectiveFunction objectiveFunction, TabuList tabuList, AspirationCriteria aspirationCriteria, boolean maximizing, boolean chooseFirstImprovingMove)\n/* */ {\n/* 260 */ int threads = getThreads();\n/* 261 */ if (threads == 1)\n/* */ {\n/* 263 */ return SingleThreadedTabuSearch.getBestMove(soln, moves, objectiveFunction, tabuList, aspirationCriteria, maximizing, chooseFirstImprovingMove, this);\n/* */ }\n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* 271 */ Move bestMove = null;\n/* 272 */ double[] bestMoveVal = null;\n/* 273 */ boolean bestMoveTabu = false;\n/* 274 */ NeighborhoodHelper[] helpers = getHelpers();\n/* */ \n/* */ \n/* 277 */ int numGroups = helpers.length;\n/* 278 */ int nominalSize = moves.length / numGroups;\n/* 279 */ Move[][] moveGroups = new Move[numGroups][];\n/* */ \n/* */ \n/* 282 */ for (int i = 0; i < numGroups - 1; i++)\n/* */ {\n/* 284 */ moveGroups[i] = new Move[nominalSize];\n/* 285 */ System.arraycopy(moves, i * nominalSize, moveGroups[i], 0, nominalSize);\n/* */ }\n/* */ \n/* */ \n/* */ \n/* */ \n/* 291 */ moveGroups[(numGroups - 1)] = new Move[nominalSize + moves.length % numGroups];\n/* 292 */ System.arraycopy(moves, (numGroups - 1) * nominalSize, moveGroups[(numGroups - 1)], 0, moveGroups[(numGroups - 1)].length);\n/* */ \n/* */ \n/* */ \n/* 296 */ for (int i = 0; i < numGroups; i++) {\n/* 297 */ helpers[i].setWork(soln, moveGroups[i], objectiveFunction, tabuList, aspirationCriteria, maximizing, chooseFirstImprovingMove, this);\n/* */ }\n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* 304 */ Object[][] bestMoves = new Object[numGroups][];\n/* 305 */ for (int i = 0; i < numGroups; i++)\n/* */ {\n/* */ \n/* 308 */ Object[] contender = helpers[i].getBestMove();\n/* */ \n/* */ \n/* 311 */ Move newMove = (Move)contender[0];\n/* 312 */ double[] newObjVal = (double[])contender[1];\n/* 313 */ boolean newMoveTabu = ((Boolean)contender[2]).booleanValue();\n/* */ \n/* */ \n/* */ \n/* 317 */ if (bestMove == null)\n/* */ {\n/* 319 */ bestMove = newMove;\n/* 320 */ bestMoveVal = newObjVal;\n/* 321 */ bestMoveTabu = newMoveTabu;\n/* */ \n/* */ \n/* */ \n/* */ \n/* */ }\n/* 327 */ else if (SingleThreadedTabuSearch.isFirstBetterThanSecond(newObjVal, bestMoveVal, maximizing))\n/* */ {\n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* 335 */ if ((bestMoveTabu) || (!newMoveTabu)) {\n/* 336 */ bestMove = newMove;\n/* 337 */ bestMoveVal = newObjVal;\n/* 338 */ bestMoveTabu = newMoveTabu;\n/* */ \n/* */ }\n/* */ \n/* */ \n/* */ }\n/* 344 */ else if ((bestMoveTabu) && (newMoveTabu)) {\n/* 345 */ bestMove = newMove;\n/* 346 */ bestMoveVal = newObjVal;\n/* 347 */ bestMoveTabu = newMoveTabu;\n/* */ }\n/* */ }\n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* 355 */ return new Object[] { bestMove, bestMoveVal, new Boolean(bestMoveTabu) };\n/* */ }", "private Position getRandomMove(TicTacToeBoard state) {\r\n\t\tArrayList<Position> availableMoves = new ArrayList<Position>();\r\n\t\tfor( int row = 0; row < TicTacToeBoard.SIZE; row++ ) {\r\n\t\t\tfor( int col = 0; col < TicTacToeBoard.SIZE; col++ ) {\r\n\t\t\t\tif( state.getState(row,col) == TicTacToeBoard.BLANK ) {\r\n\t\t\t\t\tavailableMoves.add(new Position(row,col));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn (Position)availableMoves.get(rand.nextInt(availableMoves.size()));\r\n\t}", "private Move getBestMove(Node node) {\n Move bestMove = null;\n double best_val = Integer.MIN_VALUE;\n for (Node child : node.getChildren()) {\n double payOff = (child.getPlays() == 0) ? 0 : (child.getWins() / child.getPlays());\n if (child.getPlays() == 0) {\n System.out.println(\"No records for play: \" + \"oldRow: \" + child.getState().getMove().oldRow + \", oldCol: \"\n + child.getState().getMove().oldCol + \", newRow: \" + child.getState().getMove().newRow + \", newCol: \" +\n child.getState().getMove().newCol + \", board: \" + Arrays.deepToString(child.getState().getBoard()));\n } else {\n System.out.println(\"payOff: \" + payOff + \", play: \" + \"oldRow: \" + child.getState().getMove().oldRow + \", oldCol: \"\n + child.getState().getMove().oldCol + \", newRow: \" + child.getState().getMove().newRow + \", newCol: \" +\n child.getState().getMove().newCol + \", plays: \" + child.getPlays() + \", wins: \" + child.getWins());\n }\n if (payOff > best_val) {\n best_val = payOff;\n bestMove = child.getState().getMove();\n }\n }\n System.out.println();\n return bestMove;\n }", "public synchronized String computeMove() {\n if (game == null) {\n System.err.println(\"CODE ERROR: AI is not attached to a game.\");\n return \"0,0\";\n }\n\n char[] board = (char[]) game.getStateAsObject();\n\n //Choose a smart move if that AI is set to \"Smart\" or if the random value equals 2\n if (aiType == 1) {\n if(useHeat && ((int) (Math.random() * heat)) == 2){\n return \"\" + getRandomMove(board);\n }\n else{\n return \"\" + getSmartMove(board);\n }\n } else {\n return \"\" + getRandomMove(board);\n }\n }", "private double[] chooseBestMove(List<double[]> possibleMoves) {\n double bestScore = 0;\n int indexBest = 0;\n for (int i = 0; i < possibleMoves.size(); i++) {\n if (possibleMoves.get(i)[4] > bestScore) {\n bestScore = possibleMoves.get(i)[4];\n indexBest = i;\n }\n }\n return possibleMoves.get(indexBest);\n }", "public void makeMove() {\n ArrayList<Field> myFields = new ArrayList<>();\n for (Field[] fieldsRow : fields) {\n for (Field field : fieldsRow) {\n if(field != null && this.equals(field.getPlayer())) {\n myFields.add(field);\n }\n }\n }\n bestMove[0] = myFields.get(0);\n bestMove[1] = myFields.get(0);\n\n Random rand = new Random();\n for(Field destination : destinationFields) {\n if(canMove()) break;\n destinationField = destination;\n for (Field origin : myFields) {\n for(int i = 0; i < origin.getNeighbours().length; ++i) {\n Field neighbour = origin.getNeighbours()[i];\n if(neighbour != null) {\n if(neighbour.getPlayer() == null) {\n if(valueOfMove(origin, neighbour) > valueOfMove(bestMove[0], bestMove[1])) {\n bestMove[0] = origin;\n bestMove[1] = neighbour;\n } else if(valueOfMove(origin, neighbour) == valueOfMove(bestMove[0], bestMove[1])) {\n if(rand.nextBoolean()) {\n bestMove[0] = origin;\n bestMove[1] = neighbour;\n }\n }\n } else {\n Field nextField = neighbour.getNeighbours()[i];\n if(nextField != null) {\n correctJumpPaths(origin,null, origin);\n }\n }\n }\n }\n }\n }\n }", "@Override\n public IMove doMove(IGameState state) {\n\n //Find macroboard to play in\n for (int[] move : preferredMoves)\n {\n if(state.getField().getMacroboard()[move[0]][move[1]].equals(IField.AVAILABLE_FIELD))\n {\n \n Random rnd = new Random();\n //find move to play\n for (int[] selectedMove : preferredMoves)\n {\n \n int x = move[0]*3 + selectedMove[0];\n int y = move[1]*3 + selectedMove[1];\n if(!state.getField().getBoard()[x][y].contains(IField.EMPTY_FIELD)\n && !state.getField().getBoard()[x][y].contains(IField.AVAILABLE_FIELD))\n {\n try\n {\n x = x + (rnd.nextInt(selectedMove[0] % 2 + 1));\n \n \n } catch (Exception e)\n {\n \n }\n try\n {\n y = y - (rnd.nextInt(selectedMove[0] % 2 - 1));\n \n } catch (Exception e)\n {\n \n }\n try\n {\n x = x - (rnd.nextInt(selectedMove[0] % 2 -1));\n \n \n } catch (Exception e)\n {\n \n }\n \n \n \n \n }\n if(state.getField().getBoard()[x][y].equals(IField.EMPTY_FIELD))\n {\n \n return new Move(x,y);\n }\n }\n }\n }\n\n //NOTE: Something failed, just take the first available move I guess!\n return state.getField().getAvailableMoves().get(0);\n }", "public Move calculateMove(Location location) {\r\n\t\tDirection newDirection;\r\n\r\n\t\tArrayList<Location> neighbors = location.getNeighbors(location, map, 2);\r\n\t\t// remove neighbors that are mine or neutral\r\n\t\tneighbors = location.getEnemies(location, map, myID);\r\n\r\n\t\tif (location.getSite().strength == 0) {\r\n\t\t\tLocation.planMove(location, Direction.STILL);\r\n\t\t\treturn new Move(location, Direction.STILL);\r\n\t\t}\r\n\t\tif ((location.getSite().strength < 5 || location.getSite().strength < 4 * location.getSite().production)\r\n\t\t\t\t&& location.getSite().isAllowed(location.getSite().production)) {\r\n\t\t\tLocation.planMove(location, Direction.STILL);\r\n\t\t\treturn new Move(location, Direction.STILL);\r\n\t\t}\r\n\r\n\t\tif(neighbors.size() == 0) {\r\n\r\n\t\t\tif (isSafe(location)) {\r\n\t\t\t\tnewDirection = getClosestBoundary(location);\r\n\t\t\t\tLocation.planMove(location, newDirection);\r\n\t\t\t\treturn new Move(location, newDirection);\r\n\t\t\t}\r\n\r\n\r\n\r\n\t\t\tnewDirection = getBestNeighbor(location);\r\n\t\t\tif (newDirection != Direction.STILL) {\r\n\t\t\t\tLocation.planMove(location, newDirection);\r\n\t\t\t\treturn new Move(location, newDirection);\r\n\t\t\t}\r\n\t\t\tnewDirection = chooseBestDirection(location);\r\n\t\t\tLocation.planMove(location, newDirection);\r\n\t\t\treturn new Move(location, newDirection);\r\n\t\t}\r\n\t\tnewDirection = getClosestEnemy(location);\r\n\t\tLocation.planMove(location, newDirection);\r\n\t\treturn new Move(location, newDirection);\r\n\t}", "@Override\n\tpublic Move getMove(Board game) {\n\t\t\n\t\tthis.maximumDepthReachedThisTurn = 0;\n\t\tArrayList<Move> moveList = game.getLegalMoves();\n\t\t/* tell the player what her options are */\n\t\tSystem.out.println(\"Turn \" + game.getTurn() + \", legal moves (\" + moveList.size() + \"): \");\n\t\tfor(Move m : moveList) {\n\t\t\tSystem.out.println(m.toString());\n\t\t}\n\t\t\n\t\tthis.nodesExploredThisTurn = 0;\n\t\tthis.isEndGameStatusFound = false;\n\t\tthis.maxDepth = 1;\n\t\tthis.bestMoveSoFar = null;\n\t\tthis.startMili = System.currentTimeMillis();\n\t\n\t\twhile (System.currentTimeMillis() - startMili < this.maxTime * 1000) {\n\t\t\tNode state = new Node(game, null, 0);\n\t\t\tthis.bestMoveSoFar = this.alphaBetaSearch(state);\n\t\t\t\n\t\t\tif (this.isEndGameStatusFound)\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tthis.maxDepth++;\n\t\t}\n\n\t\tlong endMili=System.currentTimeMillis();\n\t\tdouble duration = ((double)(endMili - startMili)) / 1000.0;\n\t\t\n\t\tthis.maximumDepthReached += this.maximumDepthReachedThisTurn;\n\t\tSystem.out.println(\"Maximum depth reached at this turn: \" + this.maximumDepthReachedThisTurn);\n\t\tSystem.out.println(\"Maximum depth reached from game start state: \" + this.maximumDepthReached);\n\t\tSystem.out.println(\"Nodes explored at this turn: \" + this.nodesExploredThisTurn);\n\t\tSystem.out.println(\"Total nodes explored: \" + this.nodesExplored);\n\t\tSystem.out.println(\"Time to decide on a move: \" + duration);\n\n\t\treturn this.bestMoveSoFar;\n\t\t\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}", "private Pair<Double, Move> minimax(OthelloBoard board, OthelloSide side, int depth, int max_depth, \n\t\t\t\t\t\t\t\tMove m, double alpha, double beta) {\n\t\tdouble bestScore;\n\t\tint turncount = turn;\n\t\tMove bestMove;\n\t\t//System.out.println(\"Start of minimax. Depth: \" + depth + \" Side: \" + side);\n\t /* int state = board.getState();\n\t\tif (state == OthelloBoard.DRAW)\n\t return new Pair<Double, Move>(0, m);\n\t if ((state == OthelloBoard.BLACK_WINS) && (side == OthelloSide.BLACK)) \n\t return new Pair<Double, Move>(Double.POSITIVE_INFINITY, m); \n\t if ((state == OthelloBoard.WHITE_WINS) && (side == OthelloSide.WHITE))\n\t return new Pair<Double, Move>(Double.POSITIVE_INFINITY, m);\n\t if ((state == OthelloBoard.BLACK_WINS) && (side == OthelloSide.WHITE))\n\t return new Pair<Double, Move>(Double.NEGATIVE_INFINITY, m);\n\t if ((state == OthelloBoard.WHITE_WINS) && (side == OthelloSide.BLACK))\n\t return new Pair<Double, Move>(Double.NEGATIVE_INFINITY, m);*/\n\t\tif(board.isDone()) {\n\t\t\tdouble endgame = board.countBlack() - board.countWhite();\n\t\t\treturn new Pair<Double, Move>(endgame, m);\n\t\t}\n\t\tif(depth == max_depth) {\n\t\t\tdouble mdScore = evaluator(board, side);\n\t\t\treturn new Pair<Double, Move>(mdScore, m);\t\t\t\n\t\t} else {\n\t\t\tLinkedList<Move> moveList = getMoveList(board, side);\n\t\t\tif(depth == 0) {\n\t \t\t\tLinkedList<Move> corners = new LinkedList<Move>();\n\t\t\t\tfor(Move mv : moveList) {\n\t\t\t\t\tif(board.isCorner(mv)) {\n\t\t\t\t\t\tcorners.add(mv);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(corners.size() != 0) {\n\t\t\t\t\tMove bcorner = null;\n\t\t\t\t\tdouble best = -Double.MAX_VALUE;\n\t\t\t\t\tfor(Move ml : corners) {\n\t\t\t\t\t\tdouble temp = evalMove(board, side, ml);\n\t\t\t\t\t\tif(temp > best) {\n\t\t\t\t\t\t\tbest = temp;\n\t\t\t\t\t\t\tbcorner = ml;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn new Pair<Double, Move>(best, bcorner);\n\t\t\t\t}\n\t\t\t}\n\t\t\t//System.out.println(moveList.toString());\n\t\t\tbestScore = -Double.MAX_VALUE;\n\t\t\tbestMove = new Move(1,1);\n\t\t\tif(moveList.size() == 0) {\n\t\t\t\tdouble mdScore = evaluator(board, side);\n\t\t\t\treturn new Pair<Double, Move>(mdScore, m);\n\t\t\t} else {\n\t\t\t\tfor(int i = 0; i < moveList.size(); i++) {\n\t\t\t\t\tOthelloBoard tempBoard = board.copy();\n\t\t\t\t\tMove move = moveList.get(i);\n\t\t\t\t\ttempBoard.move(move, side);\n\t\t\t\t\talpha = -(minimax(tempBoard, side.opposite(), depth + 1, max_depth, move, -beta, -alpha)).score;\n\t\t\t\t\t//System.out.println(\"Side: \" + side);\n\t\t\t\t\t//System.out.println(\"alpha (before IF): \" + alpha);\n\t\t\t\t\t//System.out.println(\"bestScore (before IF): \" + bestScore);\n\t\t\t\t\tif(beta <= alpha) {\n\t\t\t\t\t\treturn new Pair<Double, Move>(alpha, move);\n\t\t\t\t\t}\n\t\t\t\t\tif(alpha > bestScore ) {\n\t\t\t\t\t\tbestScore = alpha;\n\t\t\t\t\t\tbestMove = move;\n\t\t\t\t\t\t//bestMove.copy(move);\n\t\t\t\t\t\t//System.out.println(\"theScore(IF): \" + alpha);\n\t\t\t\t\t\t//System.out.println(\"bestScore(IF): \" + bestScore);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn new Pair<Double, Move>(bestScore, bestMove);\n\t\t\t}\n\t\t}\n\t}", "@Override\r\n\tpublic int move(int lastMove, int[] takenList, int depthLimit) \r\n\t{\r\n\t\tGameState myState = new GameState(takenList, lastMove);\r\n\t\tdouble maxValue = max_value(myState, depthLimit);\r\n\t\tint myBestMove = myState.bestMove;\r\n\t\tif (myState.leaf) //why did i do this\r\n\t\t{\r\n\t\t\treturn -1;\r\n\t\t}\r\n\t\treturn myBestMove;\r\n\t}", "public MoveNode getBestMove() {\n if (rootValues.isEmpty()) {\n return null;\n }\n\n MoveNode moveNode = rootValues.get(0);\n int maxScore = moveNode.getMinimaxValue();\n\n for(MoveNode m : rootValues) {\n if(m.getMinimaxValue() > maxScore) {\n moveNode = m;\n maxScore = m.getMinimaxValue();\n }\n }\n\n return moveNode;\n }", "public Move chooseMove(PentagoBoardState boardState) {\n // You probably will make separate functions in MyTools.\n // For example, maybe you'll need to load some pre-processed best opening\n // strategies...\n \t\n PentagoBoardState cloneBoard = (PentagoBoardState) boardState.clone();\n \n \n Move myMove = null;\n int myPlayer = boardState.getTurnPlayer();\n if(boardState.getTurnNumber() == 0 || boardState.getTurnNumber() == 1) {\n \t//For the first two rounds.\n \t//Place at the center of each quadrant.\n \tif(boardState.getPieceAt(1, 1) == null) {//TL center is null.\n \t\tmyMove = new PentagoMove(1,1,Quadrant.TR,Quadrant.BL,myPlayer);\n \t}else if(boardState.getPieceAt(4, 1) == null) {//TR center is null.\n \t\tmyMove = new PentagoMove(4,1,Quadrant.TL,Quadrant.TR,myPlayer);\n \t}else if(boardState.getPieceAt(1, 4) == null) {//BL center is null\n \t\tmyMove = new PentagoMove(1,4,Quadrant.TL,Quadrant.BL,myPlayer);\n \t}else {myMove = new PentagoMove(4,4,Quadrant.TL,Quadrant.BR,myPlayer);}\n }\n \n else {//Do a-b pruning.\n myMove = MyTools.max_value(cloneBoard, Integer.MIN_VALUE, Integer.MAX_VALUE, 3).getMove();\n }\n \n // Return your move to be processed by the server.\n return myMove;\n }", "private Pair decideMovement(Entity e) {\n Pair pos = gameMap.getCoordinatesFor(e.getId());\n Movable movable = mm.get(e);\n Array<Pair> reachableCells = gameMap.pathFinder.getReachableCells(pos.x, pos.y, movable);\n ImmutableBag<Integer> enemies = groupAI.getEnemies(e);\n if (enemies.size() == 0) return reachableCells.get(MathUtils.random(reachableCells.size-1));\n\n // The best enemy you are considering chasing and its score\n int targetEnemy = -1;\n float bestScore = 0f;\n\n // The current enemy you are checking out and its score\n int id;\n float score;\n\n // How far away is the enemy? How many enemies are within a small radius of it?\n int distance, count;\n\n for (int i = 0; i < enemies.size(); i++) {\n count = 1;\n Pair target = gameMap.getCoordinatesFor(enemies.get(i));\n distance = MapTools.distance(pos.x, pos.y, target.x, target.y);\n for (Pair cell : MapTools.getNeighbors(target.x, target.y, 6)) {\n id = gameMap.getEntityAt(cell.x, cell.y);\n if (!enemies.contains(id)) continue;\n count++;\n }\n\n score = groupAI.entityScores.get(enemies.get(i)) * count / (1 + distance / 5);\n if (score > bestScore) {\n bestScore = score;\n targetEnemy = enemies.get(i);\n }\n }\n\n if (targetEnemy > -1) {\n Pair target = gameMap.getCoordinatesFor(targetEnemy);\n Path path = gameMap.pathFinder.findPath(pos.x, pos.y, target.x, target.y, movable, true);\n for (int i = 0; i < path.getLength(); i++) {\n Step step = path.getStep(i);\n Pair p = new Pair(step.getX(),step.getY());\n if (reachableCells.contains(p, false)) return p;\n }\n }\n return reachableCells.get(MathUtils.random(reachableCells.size-1));\n }", "public PossibleMove getBestCatMove(int[][] currentBoard, int round){\n\t\t//looks at each option\n\t\troundLims.put(round, -10000);\n\t\tint bestscore = -10000;\n\t\tPossibleMove bestmove = null;\n\t\t\n\t\tArrayList<PossibleMove> moves;\n\t\tmoves = Dog.allLegalMoves(currentBoard);\n\t\t\n\t\tfor(PossibleMove option: moves){\n\t\t\tint score;\n\t\t\tif(Cat.wins(option.getBoard())){\n\t\t\t\tscore = -1000;\n\t\t\t}\n\t\t\telse if(Dog.wins(option.getBoard())){\n\t\t\t\tscore = 1000;\n\t\t\t\treturn option;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tscore = miniMax(option, (round+1), currentBoard);\n\t\t\t}\n\t\t\tif (score > bestscore){\n\t\t\t\t\tbestscore = score; \n\t\t\t\t\tbestmove = option;\n\t\t\t\t}\n\t\t\tif(score>roundLims.get(round)){\n\t\t\t\troundLims.put(round, score);\n\t\t\t}\n\t\t}\n\t recursiveLimit= recursiveLimitOrig;\n\t return bestmove;\n\t}", "public final Tile selectComputerMove() {\r\n Tile tile = null;\r\n int count = 0;\r\n String tileName = null;\r\n boolean continueLoop = true;\r\n \r\n // First try to find a winning move\r\n for (Rail rail : rails) {\r\n for (Tile t : rail.getTiles()) {\r\n if (t.getText().equals(\"0\")) count++;\r\n }\r\n if (count == 2) {\r\n for (Tile t : rail.getTiles()) {\r\n if (t.getText().equals(\"\")) {\r\n tileName = t.getName();\r\n return t;\r\n }\r\n }\r\n }\r\n count = 0; \r\n }\r\n \r\n // If none found, try to block \"X\"\r\n for (Rail rail : rails) {\r\n for (Tile t : rail.getTiles()) {\r\n if (t.getText().equals(\"X\")) count++;\r\n }\r\n if (count == 2) {\r\n for (Tile t : rail.getTiles()) {\r\n if (t.getText().equals(\"\")) {\r\n tileName = t.getName();\r\n return t;\r\n }\r\n }\r\n }\r\n count = 0;\r\n }\r\n \r\n // If no blocking move, try to play the center which gives \"O\"\r\n // a statistical advantage\r\n if (!tiles[R2C2].isSelected()) {\r\n return tiles[R2C2];\r\n }\r\n \r\n \r\n // If center move is not available, try to find an open corner tile, \r\n // which might set up an winning combination\r\n if (!tiles[R1C1].isSelected()) {\r\n return tiles[R1C1];\r\n } else if (!tiles[R3C3].isSelected()) {\r\n return tiles[R3C3];\r\n } else if (!tiles[R3C1].isSelected()) {\r\n return tiles[R3C1];\r\n } else if (!tiles[R1C3].isSelected()) {\r\n return tiles[R1C3];\r\n }\r\n \r\n // If none found just pick an empty tile at random\r\n if(tileName == null) {\r\n int row = rand.nextInt(3) + 1;\r\n int col = rand.nextInt(3) + 1;\r\n tileName = \"r\" + row + \"c\" + col;\r\n for (Tile btn: tiles) {\r\n if (btn.getName().equals(tileName)) {\r\n tile = btn;\r\n break;\r\n }\r\n }\r\n }\r\n \r\n return tile;\r\n }", "private String hardMove() {\n return super.makeAMove(getBestMoveForBlack(FORESEEN_MOVES * 2));\n }", "public Move findOptimalMove(String board[][], int computerMoves, boolean isPruning) {\n\t\tint bestVal = -Integer.MAX_VALUE;\n\n\t\tint moveI = -9;\n\t\tint moveJ = -9;\n\n\t\tint step = 0;\n\t\tint alpha = -Integer.MAX_VALUE;\n\t\tint beta = Integer.MAX_VALUE;\n\n\t\tboard = buildSmallBoard(board);\n\n\t\tfor (int i = startI; i < endI; i++) {\n\n\t\t\tfor (int j = startJ; j < endJ; j++) {\n\n\t\t\t\tif (!hasAdjacent(i, j, board, computerMoves))\n\t\t\t\t\tcontinue;\n\n\t\t\t\tif (board[i][j].equals(\"-\")) {\n\n\t\t\t\t\tboard[i][j] = \"X\";\n\n\t\t\t\t\tint moveVal = isPruning ? minimaxAB(board, false, step, alpha, beta, computerMoves)\n\t\t\t\t\t\t\t: minimax(board, false, step, computerMoves);\n\n\t\t\t\t\tboard[i][j] = \"-\";\n\t\t\n\t\t\t\t\tif (moveVal > bestVal) {\n\t\t\t\t\t\tmoveI = i;\n\t\t\t\t\t\tmoveJ = j;\n\t\t\t\t\t\tbestVal = moveVal;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn new Move(moveI, moveJ);\n\t}", "private int getRandomMove(char[] boardConfig) {\n ArrayList<Integer> emptySpaces = getEmptySpaces(boardConfig);\n\n int random = (int) (Math.random() * emptySpaces.size());\n int randomSpace = emptySpaces.get(random);\n char currentPlayer = (game.getPlayer() == 0) ? 'X' : 'O';\n char[] tempBoard = boardConfig.clone();\n\n tempBoard[randomSpace] = currentPlayer;\n shortTermMemory.add(boardToString(tempBoard));\n\n return randomSpace;\n }", "public void randomMove(){\n ArrayList<Hole> availableHoles = availableMoves(nextToPlay);\n int holeIndex = (int)(Math.random() * (((availableHoles.size()-1) - 0) + 1)) + 0;\n ArrayList<Korgool> korgools = availableHoles.get(holeIndex).getKoorgools();\n while(korgools.size() == 0){\n holeIndex = (int)(Math.random() * (((availableHoles.size()-1) - 0) + 1)) + 0;\n korgools = availableHoles.get(holeIndex).getKoorgools();\n }\n redistribute(availableHoles.get(holeIndex).getHoleIndex());\n }", "public Action getBestAction() {\n long startTime = System.currentTimeMillis();\n\n // Continue iterating through the search algorithm until the time limit\n // is reached\n while (System.currentTimeMillis() < startTime + timeLimit) {\n Node newNode = selectAndExpandNewNode();\n double randomPlayout = simulateRandomPlayout(newNode);\n backPropagate(newNode, randomPlayout);\n }\n\n // Technically this function will take us slightly over timeLimit, but\n // that's why a buffer is removed from timeLimit when passed to this\n // class\n return bestActionFromFinishedTree();\n }", "@Override\r\n\t// Precondition: During testing the AI is associated with the 'O', the odd number move.\r\n \tpublic Point desiredMove(TicTacToeGame theGame) {\n\t\t\r\n\t\tchar[][] board = theGame.getTicTacToeBoard();\r\n\t\tPoint dPoint;\r\n\t //check for win\r\n\t\tdPoint = winOrBlock(board,'O');\r\n\t\tif(dPoint != null) {\r\n\t\t\tSystem.out.println(\"winning\");\r\n\t\t\treturn dPoint;\r\n\t\t}\r\n\t\t//check for block\r\n\t\tdPoint = winOrBlock(board,'X');\r\n\t\tif(dPoint != null) {\r\n\t\t\tSystem.out.println(\"blocking\");\r\n\t\t\treturn dPoint;\r\n\t\t}\r\n\t\t//otherwise pick random loc\r\n\t\tRandom randy = new Random(); \r\n\t int randX = randy.nextInt(3);\r\n\t int randY = randy.nextInt(3);\r\n\t while(!theGame.available(randX, randY)) {\r\n\t \trandX = randy.nextInt(3);\r\n\t \trandY = randy.nextInt(3);\r\n\t }\r\n\t System.out.println(\"random\");\r\n\t return new Point(randX, randY);\r\n\t}", "public static int applyMinMax(int d, BoardModel model, boolean maximizingTeam, int alpha, int beta, boolean whiteTeam, int startDepth) {\n //base case, figure out determinaion of game over\n\n // printMap(model);\n // System.out.println(\"Depth: \"+d);\n \n\n //allPossibleMoves moveTree = new allPossibleMoves();\n int[] currentQueen;\n ArrayList<int[]> whiteQueens = new ArrayList<>();\n ArrayList<int[]> blackQueens = new ArrayList<>();\n ArrayList<int[]> myQueens = new ArrayList<>();\n // possibleMove bestestMove = null;\n\n// for (int count = 0; count < model.queenPositions.size(); count++) {\n// if (model.getTile(model.queenPositions.get(count)).equals(POS_MARKED_BLACK)) {\n// blackQueens.add(model.queenPositions.get(count));\n// // System.out.println(\"Black: \"+model.getTile(model.queenPositions.get(count)));\n// } else {\n// whiteQueens.add(model.queenPositions.get(count));\n// // System.out.println(\"White: \"+model.getTile(model.queenPositions.get(count)));\n// }\n// }\n//set black and white queens \n for (int jam = 0; jam < 10; jam++) {\n for (int pb = 0; pb < 10; pb++) {\n if (model.getTile(new int[]{jam, pb}).equals(POS_MARKED_WHITE)) {\n whiteQueens.add(new int[]{jam, pb});\n }\n if (model.getTile(new int[]{jam, pb}).equals(POS_MARKED_BLACK)) {\n blackQueens.add(new int[]{jam, pb});\n }\n }\n }\n if (maximizingTeam){\n if (whiteTeam){\n myQueens = whiteQueens;\n }\n else{\n myQueens = blackQueens;\n }\n }\n if (!maximizingTeam){\n if (whiteTeam){\n myQueens = blackQueens;\n }\n else{\n myQueens = whiteQueens;\n }\n }\n \n if (d == 0 || findAllMoves(model,myQueens).isEmpty() ) {\n return baseCase(model, whiteTeam);\n }\n\n // System.out.println(\"White Queens identified as: \" + whiteQueens.get(0)[0] + \"\" + whiteQueens.get(0)[1] + \" \" + whiteQueens.get(1)[0] + whiteQueens.get(1)[1] + \" \" + whiteQueens.get(2)[0] + whiteQueens.get(2)[1] + \" \" + whiteQueens.get(3)[0] + whiteQueens.get(3)[1]);\n //if (whiteTeam) {\n // myQueens = whiteQueens;\n //} else {\n // myQueens = blackQueens;\n // }\n // perform a check to see which side we are on. \n // System.out.println(\"Status: \"+maximizingTeam);\n if (maximizingTeam) {\n // System.out.println(\"Maximizing turn\");\n if (whiteTeam) {\n myQueens = whiteQueens;\n } else {\n myQueens = blackQueens;\n }\n\n int maxEval = -1000000;\n // considering this move was played. \n\n // printMap(model);\n // System.out.println();\n //find all children from this state\n ArrayList<ArrayList<int[]>> children = findAllMoves(model, myQueens);\n if (children.size() == 0){\n return baseCase(model, whiteTeam);\n }\n if(children.size()==0 && d == startDepth){\n System.out.println(\"We Lost :( \");\n }\n // printMap(model);\n // System.out.println();\n for (int i = 0; i < children.size(); i++) {\n\n String m1 = stringMap(model);\n\n BoardModel recursionModel = new BoardModel(10);\n\n for (int jam = 0; jam < 10; jam++) {\n for (int pb = 0; pb < 10; pb++) {\n recursionModel.setTile(new int[]{jam, pb}, model.getTile(new int[]{jam, pb}));\n }\n }\n recursionModel.queenPositions = new ArrayList<>();\n for (int x = 0; x < model.queenPositions.size(); x++) {\n recursionModel.queenPositions.add(model.queenPositions.get(x));\n }\n\n // printMap(recursionModel);\n recursionModel.moveQueen(children.get(i).get(0), children.get(i).get(1));\n recursionModel.setTile(children.get(i).get(2), POS_MARKED_ARROW);\n // System.out.println(\"max recursive call\");\n int childVal = applyMinMax(d - 1, recursionModel, false, alpha, beta, whiteTeam, startDepth);\n recursionModel.moveQueen(children.get(i).get(1), children.get(i).get(0));\n recursionModel.setTile(children.get(i).get(2), POS_AVAILABLE);\n\n String m2 = stringMap(model);\n // System.out.println(\"Check board Validity Max: \"+m1.equals(m2));\n\n maxEval = max(maxEval, childVal);\n if (d == startDepth) {\n ArrayList<int[]> blah = new ArrayList<int[]>();\n blah.add(children.get(i).get(0));\n blah.add(children.get(i).get(1));\n blah.add(children.get(i).get(2));\n blah.add(new int[]{childVal});\n maxMinMoves.add(blah);\n }\n alpha = max(maxEval, alpha);\n // System.out.println(\"A: \"+alpha);\n if (alpha >= beta) {\n break;\n }\n }\n return maxEval;\n\n } else {\n // System.out.println(\"Minimizing turn\");\n if (!whiteTeam) {\n myQueens = whiteQueens;\n } else {\n myQueens = blackQueens;\n }\n\n int maxEval = 1000000;\n // considering this move was played. \n\n // printMap(model);\n // System.out.println();\n //find all children from this state\n ArrayList<ArrayList<int[]>> children = findAllMoves(model, myQueens);\n if (children.size() == 0){\n return baseCase(model, whiteTeam);\n }\n if(children.size()==0 && d == startDepth){\n System.out.println(\"We Lost :( \");\n }\n // printMap(model);\n // System.out.println();\n for (int i = 0; i < children.size(); i++) {\n\n String m1 = stringMap(model);\n\n BoardModel recursionModel = new BoardModel(10);\n\n for (int jam = 0; jam < 10; jam++) {\n for (int pb = 0; pb < 10; pb++) {\n recursionModel.setTile(new int[]{jam, pb}, model.getTile(new int[]{jam, pb}));\n }\n }\n recursionModel.queenPositions = new ArrayList<>();\n for (int x = 0; x < model.queenPositions.size(); x++) {\n recursionModel.queenPositions.add(model.queenPositions.get(x));\n }\n\n // printMap(recursionModel);\n recursionModel.moveQueen(children.get(i).get(0), children.get(i).get(1));\n recursionModel.setTile(children.get(i).get(2), POS_MARKED_ARROW);\n // System.out.println(\"min recursive call\");\n int childVal = applyMinMax(d - 1, recursionModel, true, alpha, beta, whiteTeam, startDepth);\n recursionModel.moveQueen(children.get(i).get(1), children.get(i).get(0));\n recursionModel.setTile(children.get(i).get(2), POS_AVAILABLE);\n\n String m2 = stringMap(model);\n // System.out.println(\"Check board Validity Max: \"+m1.equals(m2));\n\n maxEval = min(maxEval, childVal);\n if (d == startDepth) {\n ArrayList<int[]> blah = new ArrayList<int[]>();\n blah.add(children.get(i).get(0));\n blah.add(children.get(i).get(1));\n blah.add(children.get(i).get(2));\n blah.add(new int[]{childVal});\n maxMinMoves.add(blah);\n }\n beta = min(maxEval, alpha);\n // System.out.println(\"A: \"+alpha);\n if (alpha >= beta) {\n break;\n }\n }\n return maxEval;\n }\n\n }", "public void getPossibleMoves() { \n\t\t\tsuper.getPossibleMoves();\n\t\t\tfor (int i = 0; i < Math.abs(xrange); i++) {\n\t\t\t\tif (currentx + xrange - ((int) Math.pow(-1,color)*i) >= 0) { \n\t\t\t\t\tGameWindow.potentialMoves.add(GameWindow.GridCells[currentx + xrange - ((int) Math.pow(-1,color)*i) ][currenty]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( currentx - 1 >= 0 && currenty - 1 >= 0 &&\n\t\t\t\t\tGameWindow.GridCells[currentx + ((int) Math.pow(-1,color)) ][currenty - 1].isOccupiedByOpponent()) {\t// Diagonol left space occupied\n\t\t\t\tGameWindow.potentialMoves.add(GameWindow.GridCells[currentx + ((int) Math.pow(-1,color)) ][currenty - 1]);\n\t\t\t}\n\t\t\tif (currentx - 1 >= 0 && currenty + 1 <= 7 &&\n\t\t\t\t\tGameWindow.GridCells[currentx + ((int) Math.pow(-1,color)) ][currenty + 1].isOccupiedByOpponent()) { \t//Diagonol right space occupied\n\t\t\t\tGameWindow.potentialMoves.add(GameWindow.GridCells[currentx + ((int) Math.pow(-1,color)) ][currenty + 1]);\n\t\t\t}\n\t\t\t\n\t}", "@Override\n\tpublic GridCell execute() {\n\t\t//1. if there is a winning position, take it\n\t\tArrayList<GridCell> winningCell = TicTacToeBoardExaminer.getWinningPositions(board, side);\n\t\tif (winningCell.size() > 0) {\n\t\t\tGridCell move = winningCell.get(0);\n\t\t\treturn move;\n\t\t}\n\t\t\n\t\t//2. if there is a losing position, block it\n\t\tArrayList<GridCell> losingCell = TicTacToeBoardExaminer.getLosingPositions(board, side);\n\t\tif (losingCell.size() > 0) {\n\t\t\tGridCell move = losingCell.get(0);\n\t\t\treturn move;\n\t\t}\n\t\t\n\t\t//TODO: Implement checking of forks. This will get you to 100% win or tie rate\n\t\t\n\t\t//3. Otherwise get the optimal position\n\t\tGridCell optimal = TicTacToeBoardExaminer.getOptimal(board, side);\n\t\tif (optimal != null)\n\t\t\treturn optimal;\n\t\t\n\t\t//4. Otherwise just move randomly\n\t\telse \n\t\t\treturn new RandomStrategy(board, side).execute();\n\t\t\n\t}", "public MahjongSolitaireMove findMove()\n {\n // MAKE A MOVE TO FILL IN \n MahjongSolitaireMove move = new MahjongSolitaireMove();\n\n // GO THROUGH THE ENTIRE GRID TO FIND A MATCH BETWEEN AVAILABLE TILES\n for (int i = 0; i < gridColumns; i++)\n {\n for (int j = 0; j < gridRows; j++)\n {\n ArrayList<MahjongSolitaireTile> stack1 = tileGrid[i][j];\n if (stack1.size() > 0)\n {\n // GET THE FIRST TILE\n MahjongSolitaireTile testTile1 = stack1.get(stack1.size()-1);\n for (int k = 0; k < gridColumns; k++)\n {\n for (int l = 0; l < gridRows; l++)\n {\n if (!((i == k) && (j == l)))\n { \n ArrayList<MahjongSolitaireTile> stack2 = tileGrid[k][l];\n if (stack2.size() > 0) \n {\n // AND TEST IT AGAINST THE SECOND TILE\n MahjongSolitaireTile testTile2 = stack2.get(stack2.size()-1);\n \n // DO THEY MATCH\n if (testTile1.match(testTile2))\n {\n // YES, FILL IN THE MOVE AND RETURN IT\n move.col1 = i;\n move.row1 = j;\n move.col2 = k;\n move.row2 = l;\n return move;\n }\n }\n }\n }\n }\n }\n }\n }\n // WE'VE SEARCHED THE ENTIRE GRID AND THERE\n // ARE NO POSSIBLE MOVES REMAINING\n return null;\n }", "public void move(Maze here) {\n\n\t\tCoordinates target = here.getPlayer().find(); // where the player is\n\n\t\tArrayList<Coordinates> canMove = freeMoves(here); // the ways that aren't\n\t\t\t\t\t\t\t\t\t\t\t\t\t// blocked\n\n\t\tif (!canMove.isEmpty()) { // you can move\n\n\t\t\tCoordinates go = find(); // go is the new coordinates\n\n\t\t\tif (here.getMCell(target).dark()) {\n\t\t\t\tthis.sleep = true;\n\t\t\t\tCollections.shuffle(canMove);\n\t\t\t\tgo = charge(canMove.get(0), here);\n\t\t\t}\n\n\t\t\t// only one option\n\t\t\telse if (canMove.size() == 1)\n\t\t\t\tgo = charge(canMove.get(0), here);\n\n\t\t\telse { // select the best\n\n\t\t\t\t// not too dissimilar to the search method in wargames\n\t\t\t\tPair<Coordinates, Double> best = new Pair<>(target, Double.MAX_VALUE);\n\n\t\t\t\tfor (Coordinates options : canMove) {\n\t\t\t\t\tCoordinates guess = go.add(options);\n\n\t\t\t\t\tdouble gDist = guess.dist(target);\n\n\t\t\t\t\tif (gDist < best.second()) {\n\t\t\t\t\t\tbest.first(options);\n\t\t\t\t\t\tbest.second(gDist);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tgo = charge(best.first(), here);\n\t\t\t}\n\t\t\tmove(go, here);\n\t\t}\n\t}", "private synchronized Object[] getBestMove()\n/* */ {\n/* 580 */ while (this.workToDo)\n/* 581 */ synchronized (this) {\n/* 582 */ try { wait();\n/* */ } catch (InterruptedException e) {\n/* 584 */ e.printStackTrace(SingleThreadedTabuSearch.err); } } return this.bestMove;\n/* */ }", "@Override\n\tpublic Direction getMove() {\n\t\t//Equal probability for each of the 8 compass direction, as well as staying stationary\n\t\treturn choices[this.random.nextInt(9)];\n\t}", "private int getBestMove(int[] board, int depth, boolean turn) {\n int boardCopy[];\n if (depth <= 0) {\n return 0;\n }\n if (depth > STEP_BACK_DEPTH) {\n try {\n Thread.sleep(3);\n } catch (InterruptedException e) {\n e.printStackTrace();\n if (shouldStop()) {\n Log.d(Constants.MY_TAG,\"out CalculatingBot\");\n unlock();\n return 0;\n }\n }\n }\n if (turn) {\n int minimum = MAXIMUM_POSSIPLE_SCORE_DIFFERENCE;\n for (int i = 0; i < 5; i++) {\n if (board[i] < 2) {\n continue;\n }\n boardCopy = board.clone();\n int x = playMove(boardCopy, i);\n int y = 0;\n if (!hasPlayer2Move(boardCopy)) {\n if (hasPlayer1Move(boardCopy)) {\n y = getBestMove(boardCopy, depth - 1, turn);\n } else {\n for (int j = 0; j < 5; j++) {\n y = y - boardCopy[j];\n }\n for (int j = 5; j < 10; j++) {\n y = y + boardCopy[j];\n }\n }\n } else {\n y = getBestMove(boardCopy, depth - 1, ! turn);\n }\n int z = y - x;\n if (z < minimum) {\n minimum = z;\n }\n }\n int i = 10;\n if (board[2] < 2) {\n return minimum;\n }\n boardCopy = board.clone();\n int x = playMove(boardCopy, i);\n int y = 0;\n if (!hasPlayer2Move(boardCopy)) {\n if (hasPlayer1Move(boardCopy)) {\n y = getBestMove(boardCopy, depth - 1, turn);\n } else {\n for (int j = 0; j < 5; j++) {\n y = y - boardCopy[j];\n }\n for (int j = 5; j < 10; j++) {\n y = y + boardCopy[j];\n }\n }\n } else {\n y = getBestMove(boardCopy, depth - 1, !turn);\n }\n int z = y - x;\n if (z < minimum) {\n minimum = z;\n }\n return minimum;\n } else {\n int maximum = MINIMUM_POSSIPLE_SCORE_DIFFERENCE;\n for (int i = 5; i < 10; i++) {\n if (board[i] < 2) {\n continue;\n }\n boardCopy = board.clone();\n int x = playMove(boardCopy, i);\n int y = 0;\n if (!hasPlayer1Move(boardCopy)) {\n if (hasPlayer2Move(boardCopy)) {\n y = getBestMove(boardCopy, depth - 1, turn);\n } else {\n for (int j = 0; j < 5; j++) {\n y = y - boardCopy[j];\n }\n for (int j = 5; j < 10; j++) {\n y = y + boardCopy[j];\n }\n }\n } else {\n y = getBestMove(boardCopy, depth - 1, !turn);\n }\n int z = y + x;\n if (z > maximum) {\n maximum = z;\n }\n }\n int i = 11;\n if (board[7] < 2) {\n return maximum;\n }\n boardCopy = board.clone();\n int x = playMove(boardCopy, i);\n int y = 0;\n if (!hasPlayer1Move(boardCopy)) {\n if (hasPlayer2Move(boardCopy)) {\n y = getBestMove(boardCopy, depth - 1, turn);\n } else {\n for (int j = 0; j < 5; j++) {\n y = y - boardCopy[j];\n }\n for (int j = 5; j < 10; j++) {\n y = y + boardCopy[j];\n }\n }\n } else {\n y = getBestMove(boardCopy, depth - 1, !turn);\n }\n int z = y + x;\n if (z > maximum) {\n maximum = z;\n }\n return maximum;\n }\n }", "private int Block_Move() {\n\t\tfinal int POSSIBLE_BLOCK = 2;\n\t\tint move = NO_MOVE;\n\t\t\n\t\tif(( gameBoard[TOP_LEFT] + gameBoard[TOP_CENTER] + gameBoard[TOP_RIGHT]) == POSSIBLE_BLOCK){\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_BLOCK){\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_BLOCK){\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_BLOCK){\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_BLOCK){\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}\t\t\t\n\t\t}else if((gameBoard[TOP_RIGHT] + gameBoard[CTR_RIGHT] + gameBoard[BTM_RIGHT]) == POSSIBLE_BLOCK){\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_BLOCK){\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_BLOCK){\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}", "private String easyMove() {\n int randomHole = evaluate();\n while (!isValidMove(randomHole)) {\n randomHole = evaluate();\n }\n\n return super.makeAMove(randomHole);\n }", "public void actionPerformed(ActionEvent e) {\n timer.stop();\n //get all the available moves\n ArrayList<Point> possibleMoves = getCurrentlyValidMoves();\n canLastPlayerMove = false;\n try {\n //check if we can move\n if( possibleMoves.size() == 0 ){\n return;\n }\n //make an array to store the best moves available\n ArrayList<Point> bestMoves = new ArrayList<Point>();\n //the lower the level, the higher priority is assigned to the move\n //a move of level 10 is the absolute lowest\n //this heuristic follows the strategy I use, omitting situation-specific content\n int level = 10;\n for (Point p : possibleMoves) {\n int x = (int) p.getX();\n int y = (int) p.getY();\n if ((x == 0 || x == 7) && (y == 0 || y == 7)) {\n if (level > 0) {\n bestMoves.clear();\n level = 0;\n }\n bestMoves.add( p );\n } else if (level >= 1 && (x == 0 || y == 0 || x == 7 || y == 7)) {\n if (level > 1) {\n bestMoves.clear();\n level = 1;\n }\n bestMoves.add( p );\n } else if (level >= 2 && (x > 2 && x < 6 && y > 2 && y < 6)) {\n if ( level > 2) {\n bestMoves.clear();\n level = 2;\n }\n bestMoves.add( p );\n } else if (level >= 3 && x != 1 && x != 6 && y != 1 && y != 6) {\n if (level > 3) {\n bestMoves.clear();\n level = 3;\n }\n bestMoves.add(p);\n } else if (level >= 4) {\n bestMoves.add(p);\n }\n }\n //for debugging purposes, output the level of move chosen by the ai\n System.out.println(level);\n //select a random move from the pool of best moves\n Point move = bestMoves.get((int) (Math.random() * bestMoves.size()));\n int aix = (int) move.getX();\n int aiy = (int) move.getY();\n //move there\n attemptMove(aix, aiy);\n gamepieces[aix][aiy] = currentPlayer;\n //the ai moved, so this is true\n canLastPlayerMove = true;\n } finally { //if the ai moved or if it didn't\n //change the player\n currentPlayer = Color.WHITE;\n gameFrame.repaint();\n //if the human player has no moves left\n if( getCurrentlyValidMoves().size() == 0 ){\n if( canLastPlayerMove ){ //... and the ai could move\n //switch players, enable the ai to move again in 1 second\n currentPlayer = Color.BLACK;\n timer.start();\n }else{ //... and the ai couldn't move\n gameOver();\n }\n }\n }\n }", "public void currentSquareIsBadExecute() throws GameActionException {\n\n if (!controller.isReady()) return;\n\n int badSquareMaximizedDistance = Cache.CURRENT_LOCATION.distanceSquaredTo(Cache.myECLocation);;\n Direction badSquareMaximizedDirection = null;\n\n // try to find a good square\n\n // move further or equal to EC\n\n int goodSquareMinimizedDistance = (int) 1E9;\n Direction goodSquareMinimizedDirection = null;\n\n for (Direction direction : Constants.DIRECTIONS) {\n if (controller.canMove(direction)) {\n MapLocation candidateLocation = Cache.CURRENT_LOCATION.add(direction);\n int candidateDistance = candidateLocation.distanceSquaredTo(Cache.myECLocation);\n boolean isGoodSquare = checkIfGoodSquare(candidateLocation);\n\n if (candidateLocation.isAdjacentTo(Cache.myECLocation)) continue;\n\n if (isGoodSquare) {\n if (goodSquareMinimizedDistance > candidateDistance) {\n goodSquareMinimizedDistance = candidateDistance;\n goodSquareMinimizedDirection = direction;\n }\n } else {\n if (badSquareMaximizedDistance <= candidateDistance) {\n badSquareMaximizedDistance = candidateDistance;\n badSquareMaximizedDirection = direction;\n }\n }\n }\n }\n\n if (goodSquareMinimizedDirection != null) {\n controller.move(goodSquareMinimizedDirection);\n } else if (badSquareMaximizedDirection != null) {\n controller.move(badSquareMaximizedDirection);\n }\n\n }", "private Move guessBestMove(Piece player, Board board, double cutoff) {\n Board newBoard = new Board(board);\n Move bestSoFar;\n Iterator<Move> moveIterator = board.iterator();\n bestSoFar = moveIterator.next();\n newBoard.retract();\n while (moveIterator.hasNext()) {\n Move nextMove = moveIterator.next();\n int val = eval(newBoard);\n newBoard.makeMove(nextMove);\n if (eval(newBoard) > val) {\n bestSoFar = nextMove;\n val = eval(newBoard);\n if (val >= cutoff) {\n break;\n }\n }\n newBoard.retract();\n }\n return bestSoFar;\n }", "private void setAvailableFromLastMove(int large, int smallx) {\n clearAvailable();\n // Make all the tiles at the destination available\n if (large != -1) {\n\n\n for (int i = 0; i < 9; i++) {\n for (int dest = 0; dest < 9; dest++) {\n if (!phaseTwo) {\n if (!done) {\n if (i == large) {\n TileAssignment5 tile = mSmallTiles[large][dest];\n if ((tile.getOwner() == TileAssignment5.Owner.NOTCLICKED))\n addAvailable(tile);\n\n switch (smallx) {\n case 0:\n int a[] = adjacencyList.get(0);\n\n for (int x : a) {\n TileAssignment5 tile1 = mSmallTiles[large][x];\n //if(mAvailable.contains(tile1)) {\n mAvailable.remove(tile1);\n //}\n }\n break;\n case 1:\n int a1[] = adjacencyList.get(1);\n\n for (int x : a1) {\n TileAssignment5 tile2 = mSmallTiles[large][x];\n // if(mAvailable.contains(tile2)) {\n mAvailable.remove(tile2);\n //}\n }\n break;\n case 2:\n int a2[] = adjacencyList.get(2);\n for (int x : a2) {\n TileAssignment5 tile3 = mSmallTiles[large][x];\n // if(mAvailable.contains(tile3)) {\n mAvailable.remove(tile3);\n // }\n }\n break;\n case 3:\n int a3[] = adjacencyList.get(3);\n for (int x : a3) {\n TileAssignment5 tile4 = mSmallTiles[large][x];\n //if(mAvailable.contains(tile4)) {\n mAvailable.remove(tile4);\n // }\n }\n break;\n case 4:\n int a4[] = adjacencyList.get(4);\n for (int x : a4) {\n TileAssignment5 tile5 = mSmallTiles[large][x];\n //if(mAvailable.contains(tile5)) {\n mAvailable.remove(tile5);//}\n\n }\n break;\n case 5:\n int a5[] = adjacencyList.get(5);\n for (int x : a5) {\n TileAssignment5 tile6 = mSmallTiles[large][x];\n //if(mAvailable.contains(tile6)) {\n mAvailable.remove(tile6);//}\n\n }\n break;\n case 6:\n int a6[] = adjacencyList.get(6);\n for (int x : a6) {\n TileAssignment5 tile7 = mSmallTiles[large][x];\n //if(mAvailable.contains(tile7)) {\n mAvailable.remove(tile7);//}\n\n }\n break;\n case 7:\n int a7[] = adjacencyList.get(7);\n for (int x : a7) {\n TileAssignment5 tile8 = mSmallTiles[large][x];\n // if(mAvailable.contains(tile8)) {\n mAvailable.remove(tile8);//}\n\n }\n break;\n case 8:\n int a8[] = adjacencyList.get(8);\n for (int x : a8) {\n TileAssignment5 tile9 = mSmallTiles[large][x];\n //if(mAvailable.contains(tile9)) {\n mAvailable.remove(tile9);//}\n\n }\n break;\n }\n\n } else {\n if (DoneTiles.contains(i)) {\n continue;\n }\n TileAssignment5 tile = mSmallTiles[i][dest];\n tile.setOwner(TileAssignment5.Owner.FREEZED);\n tile.updateDrawableState('a', 0);\n }\n } else { //OnDOnePressed\n if (DoneTiles.contains(i)) {\n continue;\n }\n\n // Log.d(\"Comes \", \"Hereeee\");\n if (i != large) {//Correct answer\n TileAssignment5 tile = mSmallTiles[i][dest];\n tile.setOwner(TileAssignment5.Owner.NOTCLICKED);\n addAvailable(tile);\n tile.updateDrawableState('a', 0);\n //done =false;\n }\n }\n\n\n }else {\n/*\n ileAssignment5 thistile = mSmallTiles[i][dest];\n if(((Button)thistile.getView()).getText().charAt(0)==' '){\n mAvailable.remove(thistile);\n thistile.updateDrawableState('a', 0);\n }\n*/\n\n\n if (i == large) {\n if (dest == smallx) {\n TileAssignment5 tile1 = mSmallTiles[large][dest];\n tile1.setOwner(TileAssignment5.Owner.CLICKED);\n if (mAvailable.contains(tile1)) {\n mAvailable.remove(tile1);\n }\n tile1.updateDrawableState('a', 0);\n\n } else {\n TileAssignment5 tile2 = mSmallTiles[large][dest];\n if (!(tile2.getOwner() == TileAssignment5.Owner.CLICKED)) {\n\n tile2.setOwner(TileAssignment5.Owner.FREEZED);\n }\n if (mAvailable.contains(tile2)) {\n mAvailable.remove(tile2);\n }\n tile2.updateDrawableState('a', 0);\n }\n\n\n } else {\n\n\n TileAssignment5 tile3 = mSmallTiles[i][dest];\n if (!(tile3.getOwner() == TileAssignment5.Owner.CLICKED)) {\n tile3.setOwner(TileAssignment5.Owner.NOTCLICKED);\n }\n // if(((((Button)mSmallTiles[i][dest].getView()).getText().toString().equals(null))||((Button)mSmallTiles[i][dest].getView()).getText().toString().charAt(0)==' ')||(((Button)mSmallTiles[i][dest].getView()).getText().toString().equals(\"\"))){\n\n if ((!mAvailable.contains(tile3))&&(tile3.getView().toString().charAt(0)!=' ')){\n mAvailable.add(tile3);\n }\n\n\n tile3.updateDrawableState('a', 0);\n\n\n\n TileAssignment5 tile = mSmallTiles[i][dest];\n if(((Button)mSmallTiles[i][dest].getView()).getText().toString().charAt(0)==' '){\n // Log.d(\"Yes \", \"it came\");\n if(mAvailable.contains(tile)){\n mAvailable.remove(tile);\n }\n\n }\n else{\n if(!mAvailable.contains(tile)){\n addAvailable(tile);}\n }\n\n\n\n\n\n\n\n\n\n /*\n\n\n\n\n\n\n ileAssignment5 tile = mSmallTiles[i][dest];\n ileAssignment5 tile = mSmallTiles[i][dest];\n try{\n if(((((Button)mSmallTiles[i][dest].getView()).getText().toString().equals(null))||((Button)mSmallTiles[i][dest].getView()).getText().toString().charAt(0)==' ')||(((Button)mSmallTiles[i][dest].getView()).getText().toString().equals(\"\"))){\n // Log.d(\"Yes \", \"it came\");\n if(mAvailable.contains(tile)){\n mAvailable.remove(tile);\n }\n }\n else{\n if(!mAvailable.contains(tile)){\n addAvailable(tile);}\n }}catch (ArrayIndexOutOfBoundsException e){\n\n\n }catch ( StringIndexOutOfBoundsException e){\n\n }\n\n*/\n }\n\n }\n }\n }\n }\n // If there were none available, make all squares available\n if (mAvailable.isEmpty()&&large==-1) {\n setAllAvailable();\n }\n }", "static double addHeuristic1(GameState c, boolean isMaxNode) {\n\t\t// Value returned will be absolute. If its max node, this config is good\n\t\t// then value will be positive. If its min node,\n\t\t// and this config is good for min, then value will be negative\n\n\t\tint i, j, vacant_spaces;\n\t\t// Compute : Feasible Moves for self\n\t\tint self_feasible_moves = 0;\n\t\tint self_remaining_moves = 0;\n\t\tint opponent_feasible_moves = 0;\n\t\tint opponent_remaining_moves = 0;\n\n\t\t// Go through the board and figure out vacant spots\n\t\tvacant_spaces = 0;\n\t\tfor (i = -GameState.HALF_BOARD; i <= GameState.HALF_BOARD; i = i + 1) {\n\t\t\tif (c.getWeight(i) == 0) {\n\t\t\t\tvacant_spaces++;\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 1; i <= GameState.MAX_WEIGHT; i = i + 1) {\n\t\t\t// Check if self have the weight\n\t\t\tif (c.IHaveWeight(i)) {\n\t\t\t\tself_remaining_moves++;\n\t\t\t\t// Go through all the possible positions\n\t\t\t\tfor (j = -GameState.HALF_BOARD; j < GameState.HALF_BOARD; j++) {\n\t\t\t\t\tif (c.getWeight(j) == 0) {\n\t\t\t\t\t\t// Place it and see if you tip\n\t\t\t\t\t\tc.makeMove(i, j, PlayerName.none);\n\t\t\t\t\t\tif (!c.isTipping_old()) {\n\t\t\t\t\t\t\tself_feasible_moves++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Now remove the weight\n\t\t\t\t\t\tc.removeMove(j);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Check if opponent has this weight\n\t\t\tif (c.opponentHasWeight(i)) {\n\t\t\t\topponent_remaining_moves++;\n\t\t\t\t// Go through all the possible positions\n\t\t\t\tfor (j = -GameState.HALF_BOARD; j < GameState.HALF_BOARD; j++) {\n\t\t\t\t\t// Place the weight and see if you tip\n\t\t\t\t\tif (c.getWeight(j) == 0) {\n\t\t\t\t\t\tc.makeMove(i, j, PlayerName.none);\n\t\t\t\t\t\tif (!c.isTipping_old()) {\n\t\t\t\t\t\t\topponent_feasible_moves++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Now remove the weight\n\t\t\t\t\t\tc.removeMove(j);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Need to take the max because one of the players may have played one\n\t\t// chance less\n\t\tif (self_remaining_moves == 0 && opponent_remaining_moves == 0) {\n\t\t\treturn 0.0;\n\t\t} else if (self_remaining_moves > opponent_remaining_moves)\n\t\t\treturn (double) (self_feasible_moves - opponent_feasible_moves)\n\t\t\t\t\t/ (double) (self_remaining_moves * vacant_spaces);\n\t\telse\n\t\t\treturn (double) (self_feasible_moves - opponent_feasible_moves)\n\t\t\t\t\t/ (double) (opponent_remaining_moves * vacant_spaces);\n\t}", "private NewMove findBestMove(ChessGameNode node, char player ) {\r\n\t\tChessGameNode[] childrenNodes = node.getChildren();\r\n\t\tint currentValue = this.rootNode.getValue();\r\n\t\tint bestValue = 0;\r\n\t\tNewMove bestMove = null;\r\n\t\tfor( ChessGameNode childNode : childrenNodes) {\r\n\t\t\tif (childNode != null) {\r\n\t\t\t\tif (player == 'w') {\r\n\t\t\t\t\tif (childNode.getValue() >= currentValue) {\r\n\t\t\t\t\t\tbestValue = childNode.getValue();\r\n\t\t\t\t\t\tbestMove = childNode.getOriginalMove();\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if (player == 'b') {\r\n\t\t\t\t\tif (childNode.getValue() <= currentValue) {\r\n\t\t\t\t\t\tbestValue = childNode.getValue();\r\n\t\t\t\t\t\tbestMove = childNode.getOriginalMove();\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 bestMove;\r\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}", "public Move chooseMove() {\n return new Move();\n }", "public Move get1stMove(Game game, CheckersSetup setup, checkersSetup.Board board, ArrayList<Move> choices) {\n\t\tviewedPos = null;\n\t\t//TESTING\n\t\tnumPosRecorded = 0;\n\t\t//END TESTING\n\t\t\n\t\tnumJumpsAlreadyDoneThisTurn = 0;\n\t\t\n\t\tBasicCheckersAIFunctions.printAllAIPlayerOptions(setup, isDarkPlayer);\n\t\t\n\t\tdesiredTurn = getBestMoveBasedOnSearchOfDepthN(setup, isDarkPlayer, this.depth);\n\t\t\n\t\tArrayList<Move> desiredMoves= desiredTurn.getMovesFor1Turn();\n\t\t\n\t\t BasicCheckersAIFunctions.PrintDesiredMoves(desiredMoves);\n\t\t\n\t\tif(desiredMoves.get(0).isJump()) {\n\t\t\tnumJumpsAlreadyDoneThisTurn++;\n\t\t}\n\t\t\n\t\t//TESTING (Display)\n\t\tSystem.out.println(\"Number of positions analysed for AI with Tree: \" + numPosRecorded);\n\t\tif(viewedPos!=null) {\n\t\t\tSystem.out.println(\"Height of tree: \" + viewedPos.getHeightOfTree());\n\t\t}\n\t\tSystem.out.println();\n\t\t//END TESTING\n\t\t\n\t\treturn desiredMoves.get(0);\n\t}", "@Override\n\tpublic Direction nextMove(State state)\n\t{\n\t\t\n\t\tthis.direction = Direction.STAY;\n\t\tthis.hero = state.hero();\n\t\tthis.position = new Point( this.hero.position.right, this.hero.position.left ); //x and y are reversed, really\n\t\t\n\t\tthis.pathMap = new PathMap( state, this.position.x, this.position.y );\n\n\t\t//find the richest hero\n\t\tHero richestHero = state.game.heroes.get(0);\n\t\tif( richestHero == this.hero ) { richestHero = state.game.heroes.get(1); } //just grab another hero if we are #0\n\t\t\n\t\tfor( Hero hero : state.game.heroes )\n\t\t{\n\t\t\tif( hero != this.hero && hero.gold > richestHero.gold )\n\t\t\t{\n\t\t\t\trichestHero = hero;\n\t\t\t}\n\t\t}\n\t\t\n\t\t//get all interesting sites\n\t\tList<TileInfo> minesInRange = this.pathMap.getSitesInRange( TileType.FREE_MINE, 20 );\t//mines in vicinity\n\t\tList<TileInfo> takenMinesInRange = this.pathMap.getSitesInRange( TileType.TAKEN_MINE, (100-richestHero.life)/2 );\t//mines in vicinity\n\t\tList<TileInfo> pubsInRange = this.pathMap.getSitesInRange( TileType.TAVERN, (int)(Math.pow(100-this.hero.life,2)*state.game.board.size/5000) );\t\t//pubs in vicinity\n\t\t\n\t\t//first visit pubs (apparently we need it)\n\t\tif( pubsInRange.size() != 0 )\n\t\t{\n\t\t\tthis.direction = this.pathMap.getDirectionTo( pubsInRange.get(0) );\n\t\t}\n\t\t\n\t\t//then visit the mines\n\t\telse if( minesInRange.size() != 0 )\n\t\t{\n\t\t\tthis.direction = this.pathMap.getDirectionTo( minesInRange.get(0) );\n\t\t}\n\t\t\n\t\t//then visit taken mines\n\t\telse if( takenMinesInRange.size() != 0 )\n\t\t{\n\t\t\tthis.direction = this.pathMap.getDirectionTo( takenMinesInRange.get(0) );\n\t\t}\n\t\t\n\t\t//then hunt for players\n\t\telse\n\t\t{\n\t\t\t//kill the richest hero! (but first full health)\n\t\t\tif( this.hero.life > 85 )\n\t\t\t{\n\t\t\t\tthis.direction = this.pathMap.getDirectionTo( richestHero.position.right, richestHero.position.left );\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t//run away!!!\n\t\t\t\tthis.direction = intToDir( (int)(Math.random()*4) );\n\t\t\t}\n\t\t}\n\t\t\n\t\t//VisualPathMap.getInstance( pathMap );\n\t\t\n\t\treturn this.direction;\n\t}", "private Move alphaBetaSearch(Node state) {\n\t\t\n\t\tint v = this.maxValue(state, Integer.MIN_VALUE, Integer.MAX_VALUE);\n\t\t\n\t\tthis.nodesExplored--;\n\t\tthis.nodesExploredThisTurn--;\n\t\t\n\t\tif (System.currentTimeMillis() - startMili > this.maxTime * 1000) {\n\t\t\treturn this.bestMoveSoFar;\n\t\t}\n\n\t\tif (Math.abs(v) == Integer.MAX_VALUE / 2 || Math.abs(v) == Math.abs(Integer.MIN_VALUE / 2) ) {\n\t\t\t\n\t\t\tthis.isEndGameStatusFound = true;\n\t\t\treturn state.getBestMove();\n\t\t}\n\t\t\n\t\treturn state.getBestMove();\n\t}", "public void paradiseMove(){\n if (!getCurrentMainCellCoordinates().equals(new DiscreteCoordinates(11, 9))) {\n move(30);\n }\n }", "@Override\n\tpublic BoardLocation findBestLocWhenStuck() {\n\t\treturn null;\n\t}", "private MoveEvaluation minimax (int ply, IComparator comp, \n\t\t\tIPlayer player, IPlayer opponent) {\n\n\t\t// Try to improve on this lower-bound (based on selector). Reflects no move possible.\n\t\tMoveEvaluation best = new MoveEvaluation (comp.initialValue());\n\n\t\t// get all moves for this player and generate the boards that result\n\t\t// from making these moves. Select maximum of children if we are MAX\n\t\t// and minimum of children if we are MIN\n\t\tIterator<IGameMove> it = player.validMoves(state).iterator(); \n\t\twhile (it.hasNext()) {\n\t\t\tIGameMove move = it.next();\n\t\t\t\n\t\t\tmove.execute(state);\n\t\t\tnumComputationalStates++;\n\t\t\t\n\t\t\t// debugging output along the way...\n\t\t\tif (numComputationalStates % 100 == 0) {\n\t\t\t\tSystem.out.println (numComputationalStates);\n\t\t\t}\n\t\t\t\n\t\t\tMoveEvaluation pathMove = alreadyDetermined(state);\n\t\t\t\n\t\t\tif (pathMove == null) {\n\t\t\t\tint trial;\n\t\t\t\tif (ply <= 0) {\n\t\t\t\t\ttrial = original.eval(state);\n\t\t\t\t} else {\n\t\t\t\t\t// Recursively evaluate position. Compute MiniMax and swap\n\t\t\t\t\t// player and opponent, synchronously with MIN and MAX. If no move is\n\t\t\t\t\t// associated, then evaluate the generated board from original player\n\t\t\t\t\tMoveEvaluation me = minimax (ply-1, comp.opposite(), opponent, player);\n\t\t\t\t\tif (me.move == null) {\n\t\t\t\t\t\ttrial = original.eval(state);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttrial = me.score;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tpathMove = new MoveEvaluation (move, trial);\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tmove.undo(state);\n\t\t\t\n\t\t\t// If we are selected as the better move, then update accordingly\n\t\t\tif (comp.compare(best.score, pathMove.score) < 0) {\n\t\t\t\tbest = new MoveEvaluation (move, pathMove.score); \n\t\t\t}\n\t\t}\n\t\t\n\t\t// this move was selected for the gameState. record it. If it is null, then the game has\n\t\t// already been won or this is a draw; in either case, we will let recursive parent take\n\t\t// care of the scoring. Even add when no move, so we can keep track of the WON games.\n\t\taddToList(state, best);\n\t\t\n\t\treturn best;\n\t}", "public static PentagoMove excecuteMiniMax(PentagoBoardState bs, int depth) {\n\t\tlong timerStart = System.currentTimeMillis();\n\t\tPentagoMove bestMove = null;\n\t\tint highestVal = Integer.MIN_VALUE;\n\t\tint lowestVal = Integer.MAX_VALUE;\n\t\tint currentVal = 0;\n\t\tint possibleMoves = bs.getAllLegalMoves().size();\n\t\tfor (PentagoMove move : bs.getAllLegalMoves()) {\n\t\t\tPentagoBoardState stateClone = (PentagoBoardState) bs.clone();\n\t\t\tstateClone.processMove(move);\n\t\t\tif(bs.getTurnPlayer() == 0) {\n\t\t\t\tMax(stateClone, depth-1);\n\t\t\t}\n\t\t\telse if(bs.getTurnPlayer() == 1) {\n\t\t\t\tMin(stateClone, depth-1);\n\t\t\t}\n\t\t\tif (bs.getTurnPlayer() == 0 && currentVal >= highestVal) {\n\t\t\t\thighestVal = currentVal;\n\t\t\t\tbestMove = move;\n\t\t\t}\n\t\t\telse if (bs.getTurnPlayer() == 1 && currentVal <= lowestVal) {\n\t\t\t\tlowestVal = currentVal;\n\t\t\t\tbestMove = move;\n\t\t\t}\n\t\t\tif (System.currentTimeMillis() - timerStart >= 1900) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tlong totalTime = System.currentTimeMillis() - timerStart;\n\t\tSystem.out.println(totalTime);\n\t\treturn bestMove;\n\t}", "private static double bestMoveHelper(Board board, int pliesLeft) {\n\t\tif (TRANSPOSITION_TABLE.containsKey(board.getHashCode())) {\n\t\t\treturn TRANSPOSITION_TABLE.get(board.getHashCode());\n\t\t}\n\t\tif (pliesLeft == 1 || board.isOver()) {\n\t\t\treturn recordEvaluation(board, board.evaluate());\n\t\t}\n\t\tBinaryOperator<Double> optimumFinder = board.whoseMove().isWhite() ? Math::max : Math::min;\n\t\treturn recordEvaluation(board, board.getLegalMoves().stream()\n\t\t\t\t.map(bindAtEnd(BasicDepthBasedMinimax::bestMoveHelper, pliesLeft - 1).compose(board::performMove))\n\t\t\t\t.reduce(optimumFinder).get());\n\t}", "public PentagoMove chooseMove(PentagoBoardState boardState) {\n\n // You probably will make separate functions in MyTools.\n // For example, maybe you'll need to load some pre-processed best opening\n // strategies...\n Move myMove = boardState.getRandomMove();\n MyTools.simulateGame(boardState, (PentagoMove) myMove);\n MyTools.setPlayer(player_id);\n\n\n if(boardState.getTurnNumber()<3){\n myMove = MyTools.initialMove(boardState);\n }else{\n myMove = MyTools.myTurn(boardState);\n }\n PentagoMove winningMove = MyTools.gameWinnable(boardState);\n if(winningMove != null){\n System.out.println(\"Game Over!\");\n return winningMove;\n }\n int heuristic = MyTools.getHeuristic((PentagoMove)myMove, boardState);\n System.out.println(\"The heuristic is:\" + heuristic);\n PentagoMove m = (PentagoMove) myMove;\n // Return your move to be processed by the server.\n System.out.println(\"PLaying at: x=\"+ ((PentagoMove) myMove).getMoveCoord().getX()+ \", y=\" +((PentagoMove) myMove).getMoveCoord().getY());\n return ((PentagoMove) myMove);\n }", "private ProblemModel findCheapestNode(){\n\t\tProblemModel ret = unvisitedPM.peek();\n\t\t\n\t\tfor(ProblemModel p : unvisitedPM){ \n\t\t\t//f(s) = depth + cost to make this move\n\t\t\tif(p.getCost() + p.getDepth() <= ret.getCost() + ret.getDepth()) ret = p;\n\t\t}\n\t\tunvisitedPM.remove(ret);\n\t\treturn ret;\n\t}", "public static Move pickMinMaxMove(BoardModel model, boolean isWhite) {\n applyMinMax(2, model, true, -100000, 100000, isWhite, 2);\n ArrayList<int[]> move = playBestMove(model, isWhite);\n for (int i = 0; i < 8; i++) {\n int[][] currentQueenArray = queenMoves(model.queenPositions.get(i), model);\n\n for (int x = 0; x < 10; x++) {\n\n for (int y = 0; y < 10; y++) {\n // System.out.print(currentQueenArray[x][y] + \" \");\n }\n // System.out.println();\n }\n // System.out.println();\n }\n calculateOwnership(model);\n// for (int i = 0; i < ownedBy.length; i++) {\n// for (int j = 0; j < ownedBy.length; j++) {\n// System.out.print(ownedBy[i][j].toString() + \" \");\n// }\n// System.out.println();\n// }\n reset();\n\n return new Move(move.get(0), move.get(1), move.get(2));\n }", "public LinkedList<Move> getPossibleMoves() {\n\t\tAIPossibleMoves.clear();\n\t\tint xOrigin = 0, yOrigin = 0, xMove1 = 0, xMove2 = 0, yMove1 = 0, yMove2 = 0;\n\t\tMove move = null;\t\n\t\t\tint type = 0;\n\t\t\tfor(Checker checker: model.whitePieces) {\n\t\t\t\t\n\t\t\t\txOrigin = checker.getCurrentXPosition();\n\t\t\t\tyOrigin = checker.getCurrentYPosition();\n\t\t\t\txMove1 = (checker.getCurrentXPosition() - 1);\n\t\t\t\txMove2 = (checker.getCurrentXPosition() + 1);\n\t\t\t\tyMove1 = (checker.getCurrentYPosition() - 1);\n\t\t\t\tyMove2 = (checker.getCurrentYPosition() + 1);\n\t\t\t\ttype = checker.getType();\n\t\t\t\tswitch(type) {\n\t\t\t\tcase 2:\n\n\t\t\t\t\tif((xMove1 < 0) || (yMove1 <0)) {\n\t\t\t\t\t//\tcontinue;\n\t\t\t\t\t} else {\n\t\t\t\t\tif(isMoveValid(xOrigin,yOrigin, xMove1, yMove1, false, false )) {\n\t\t\t\t\t\tif(!isSpaceTaken(xMove1,yMove1)) {\n\t\t\t\t\t\t\t//System.out.println(\"Space is not Taken\");\n\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove1, yMove1);\n\t\t\t\t\t\t\tAIPossibleMoves.add(move);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif(isPieceEnemy(xMove1,yMove1,checker,2)) {\n\t\t\t\t\t\t\t\tif(isJumpValid(xOrigin, yOrigin, xMove1, yMove1, false, false)) {\n\t\t\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove1, yMove1);\n\t\t\t\t\t\t\t\t\tAIPossibleMoves.add(move);\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\t}\n\t\t\t\t\t}\n \n\t\t\t\t\tif((xMove2 > 7) || (yMove1 < 0)) {\n\t\t\t\t\t//\tcontinue;\n\t\t\t\t\t} else {\n\t\t\t\t\n\t\t\t\t\tif(isMoveValid(xOrigin,yOrigin, xMove2, yMove1, true, false )) {\n\t\t\t\t\t\tif(!isSpaceTaken(xMove2,yMove1)) {\n\t\t\t\t\t\t\t// System.out.println(\"Space is not Taken\");\n\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove2, yMove1);\n\t\t\t\t\t\t\tAIPossibleMoves.add(move);\t\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif(isPieceEnemy(xMove2,yMove1,checker,2)) {\n\t\t\t\t\t\t\t\tif(isJumpValid(xOrigin, yOrigin, xMove2, yMove1, true, false)) {\n\t\t\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove2, yMove1);\n\t\t\t\t\t\t\t\t\tAIPossibleMoves.add(move);\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}\t\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase 4:\n\t\t\t\t\t//Moving up and left isMovingRight,IsMovingDown\n\t\t\t\t\tif((xMove1 <0) || (yMove1 < 0)) {\n\t\t\t\t\t\t//continue;\n\t\t\t\t\t} else {\n\t\t\t\t\tif(isMoveValid(xOrigin,yOrigin, xMove1, yMove1, false, false )) {\n\t\t\t\t\t\tif(!isSpaceTaken(xMove1,yMove1)) {\n\t\t\t\t\t\t//\tSystem.out.println(\"Space is not Taken\");\n\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove1, yMove1);\n\t\t\t\t\t\t\tAIPossibleMoves.add(move);\t\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif(isPieceEnemy(xMove1,yMove1,checker,2)) {\n\t\t\t\t\t\t\t\tif(isJumpValid(xOrigin, yOrigin, xMove1, yMove1, false, false)) {\n\t\t\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove1, yMove1);\n\t\t\t\t\t\t\t\t\tAIPossibleMoves.add(move);\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\n\t\t\t\tif((xMove2 > 7) || (yMove1 < 0)) {\n\t\t\t\t\t//continue;\n\t\t\t\t} else {\n\t\t\t\t\t//moving up and right\n\t\t\t\t\tif(isMoveValid(xOrigin,yOrigin, xMove2, yMove1, true, false )) {\n\t\t\t\t\t\tif(!isSpaceTaken(xMove2,yMove1)) {\n\t\t\t\t\t\t//\tSystem.out.println(\"Space is not Taken\");\n\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove2, yMove1);\n\t\t\t\t\t\t\tAIPossibleMoves.add(move);\t\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif(isPieceEnemy(xMove2,yMove1,checker,2)) {\n\t\t\t\t\t\t\t\tif(isJumpValid(xOrigin, yOrigin, xMove2, yMove1, true, false)) {\n\t\t\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove2, yMove1);\n\t\t\t\t\t\t\t\t\tAIPossibleMoves.add(move);\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}\n\t\t\t\t\n\t\t\t\tif((xMove1 < 0) || (yMove2 > 7)) {\n\t\t\t\t//\tcontinue;\n\t\t\t\t} else {\n\t\t\t\t\t//moving down and left isMovingRight,IsMovingDown\n\t\t\t\t\tif(isMoveValid(xOrigin,yOrigin, xMove1, yMove2, false, true )) {\n\t\t\t\t\t\tif(!isSpaceTaken(xMove1,yMove2)) {\n\t\t\t\t\t\t//\tSystem.out.println(\"Space is not Taken\");\n\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove1, yMove2);\n\t\t\t\t\t\t\tAIPossibleMoves.add(move);\t\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif(isPieceEnemy(xMove1,yMove2,checker,2)) {\n\t\t\t\t\t\t\t\tif(isJumpValid(xOrigin, yOrigin, xMove1, yMove2, false, true)) {\n\t\t\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove1, yMove2);\n\t\t\t\t\t\t\t\t\tAIPossibleMoves.add(move);\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}\n\t\t\t\t\n\t\t\t\tif((xMove2 > 7) || (yMove2 > 7)) {\n\t\t\t\t\t//continue;\n\t\t\t\t} else {\n\t\t\t\t\n\t\t\t\t\t//moving down and right isMovingRight,IsMovingDown\n\t\t\t\t\tif(isMoveValid(xOrigin,yOrigin, xMove2, yMove2, true, true )) {\n\t\t\t\t\t\tif(!isSpaceTaken(xMove2,yMove2)) {\n\t\t\t\t\t\t//\tSystem.out.println(\"Space is not Taken\");\n\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove2, yMove2);\n\t\t\t\t\t\t\tAIPossibleMoves.add(move);\t\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif(isPieceEnemy(xMove2,yMove2,checker,2)) {\n\t\t\t\t\t\t\t\tif(isJumpValid(xOrigin, yOrigin, xMove2, yMove2, true, true)) {\n\t\t\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove2, yMove2);\n\t\t\t\t\t\t\t\t\tAIPossibleMoves.add(move);\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}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\tbreak;\t\n\t\t\t\t}\t\n\t\t\t\n\t\t\t}\n\n\t\t\treturn AIPossibleMoves;\n\t\t\t\n\t\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 Move produceRandomMove(Board board){\n\t\tint row = this.rowFinder(board); // find random row with unmarked stick.\n\t\tRandom myRandom = new Random();\n\t\tint stick1,stick2;\n\t\tint[] unmarkedStickArray = new int[board.getRowLength(row)+1];\n\t\tfinal int MARKED_STICK = 0; /* MARKED_STICK has the same value as the default value of the initialized\n\t\t array */\n\t\tfinal int UNMARKED_STICK = 1;\n\t\tfor(int stickNum=1; stickNum<board.getRowLength(row)+1; stickNum++){ /* the location in the array\n\t\t represent the stick in the row, if the value at that location is 1, then the stick in unmarked, else\n\t\t the value at the location in 0 (the default initialized value) */\n\t\t\tif(board.isStickUnmarked(row,stickNum)){\n\t\t\t\tunmarkedStickArray[stickNum] = UNMARKED_STICK;\n\t\t\t}\n\t\t}\n\t\twhile(true){\n\t\t\tint tempStick1 = myRandom.nextInt(board.getRowLength(row))+1;\n\t\t\tint tempStick2 = myRandom.nextInt(board.getRowLength(row))+1;\n\t\t\t// this if, check if the stick are legal, if not, jump to get another two random sticks\n\t\t\tif(unmarkedStickArray[tempStick1] == UNMARKED_STICK &&\n\t\t\t\t\tunmarkedStickArray[tempStick2] == UNMARKED_STICK){\n\t\t\t\t// do nothing\n\t\t\t}\n\t\t\telse{ continue;} // search for other sticks\n\t\t\tif(tempStick1 == tempStick2){ /* if the random sticks number are the same, so return a move that\n\t\t\t contain only one sticks */\n\t\t\t\treturn new Move(row,tempStick1,tempStick1);\n\t\t\t}\n\t\t\tif(tempStick1 < tempStick2){ /* this find the min number between the temp sticks and put the lower\n\t\t\t\t number at stick1 and the higher number at stick2, I could use Math.min(), but wasn't sure\n\t\t\t\t if it is allowed */\n\t\t\t\t stick1 = tempStick1;\n\t\t\t\t stick2 = tempStick2;\n\t\t\t}\n\t\t\telse{\n\t\t\t\t stick1 = tempStick2;\n\t\t\t\t stick2 = tempStick1;\n\t\t\t}\n\t\t\tfor(int i=1; i<(stick2-stick1)+1; i++){\n\t\t\t\tint locationInArray = stick1 + i;\n\t\t\t\tif(unmarkedStickArray[locationInArray] == MARKED_STICK){ /* if there is no legal sequence\n\t\t\t\t between stick1 and stick 2, then return a move that contain only one legal stick */\n\t\t\t\t\treturn new Move(row,stick1,stick1);\n\t\t\t\t}\n\t\t\t}\n\t\t\t/* if there is a legal sequence then return a move that contain that sequence */\n\t\t\treturn new Move(row,stick1,stick2);\n\t\t}\n\t}", "public int decideRandomMove() {\n return (int) (Math.random() * 4);\n }", "private MNKCell findOneMoveLoss(final MNKGameState lossState) {\n MNKCell randomCell = null;\n if (board.getFreeCells().length == 1 || (randomCell = pickRandomNonClosingCell(null)) == null)\n return null; // cannot check for enemy's next move when it doesn't exist\n\n board.markCell(randomCell.i, randomCell.j);\n MNKCell c = findOneMoveWin(lossState);\n board.unmarkCell(); // remove the marked randomCell\n if (c != null) return c;\n\n // test the randomCell we selected at first. It may be a one-move loss cell\n // get a new random cell different from the previous and call it cc\n MNKCell cc = pickRandomNonClosingCell(randomCell);\n if (board.markCell(cc.i, cc.j) != MNKGameState.OPEN) {\n // randomCell puts us in a draw, ignore that\n board.unmarkCell();\n return null;\n }\n MNKGameState result =\n board.markCell(randomCell.i, randomCell.j); // let the enemy take the random ane\n board.unmarkCell();\n board.unmarkCell();\n return result == lossState ? randomCell : null;\n }", "private void makeSmartComputerMove() {\n\t\tboolean b;\n\t\tint winningPos = 0;\n\t\tfor (int i = 1; i < board.length; i++) {\n\t\t\tb = isWinningMove(i, computerLetter);\n\t\t\tif (b) {\n\t\t\t\twinningPos = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (winningPos == 0) {\n\t\t\tfor (int i = 1; i < board.length; i++) {\n\t\t\t\tb = isWinningMove(i, playerLetter);\n\t\t\t\tif (b) {\n\t\t\t\t\twinningPos = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (winningPos == 0) {\n\t\t\twinningPos = getPosForWin();\n\t\t\tif (winningPos == 0)\n\t\t\t\twinningPos = (int) (Math.floor(Math.random() * 100) % 9 + 1);\n\t\t}\n\t\tif (winningPos < 0 || winningPos > 9) {\n\t\t\tSystem.out.println(\"Enter a valid position :\");\n\t\t\tmakeSmartComputerMove();\n\t\t} else if (isFree[winningPos]) {\n\t\t\tboard[winningPos] = computerLetter;\n\t\t\tisFree[winningPos] = false;\n\t\t\tSystem.out.println(\"Computer Move :\");\n\t\t\tprintBoard(board);\n\t\t\tisPlayerTurn = true;\n\t\t} else {\n\t\t\tmakeSmartComputerMove();\n\t\t}\n\n\t}", "public AgentAction getNextMove(GameTile [][] visibleMap) {\r\n\t\t//Possible things to add to your moves\r\n//\t\tnextMove = AgentAction.doNothing;\r\n//\t\tnextMove = AgentAction.moveDown;\r\n//\t\tnextMove = AgentAction.moveUp;\r\n//\t\tnextMove = AgentAction.moveUp;\r\n//\t\tnextMove = AgentAction.moveLeft;\r\n//\t\tnextMove = AgentAction.pickupSomething;\r\n//\t\tnextMove = AgentAction.declareVictory;\r\n//\r\n//\t\tnextMove = AgentAction.shootArrowNorth;\r\n//\t\tnextMove = AgentAction.shootArrowSouth;\r\n//\t\tnextMove = AgentAction.shootArrowEast;\r\n//\t\tnextMove = AgentAction.shootArrowWest;\r\n//\t\tnextMove = AgentAction.quit\r\n\t\t\r\n\t\t\r\n\r\n\t\t//Ideally you would remove all this code, but I left it in so the keylistener would work\r\n\t\tif(keyboardPlayOnly) {\r\n\t\t\tif(nextMove == null) {\r\n\t\t\t\treturn AgentAction.doNothing;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tAgentAction tmp = nextMove;\r\n\t\t\t\tnextMove = null;\r\n\t\t\t\treturn tmp;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t\telse {\r\n\t\t\t//This code plays 5 \"games\" and then quits\r\n\t\t\t//Just does random things\r\n\t\t\tif(numGamesPlayed > 19) {\r\n\t\t\t\treturn AgentAction.quit;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tif(nextMoves.isEmpty()) {\r\n\t\t\t\t\tsetStartingPosition(visibleMap);\r\n//\t\t\t\t\tfindWumpus(visibleMap);\r\n//\t\t\t\t\tfindWumpus(visibleMap);\r\n//\t\t\t\t\tWumpusState currentState = huntTheWumpus(visibleMap);\r\n//\t\t\t\t\tSystem.out.println(wumpusHunted);\r\n//\t\t\t\t\tif(wumpusHunted) {\r\n//\t\t\t\t\t\tcurrentState.setParent(null);\r\n//\t\t\t\t\t\taddToNextMoves(currentState);\r\n//\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t//this is the code to collect the gold\r\n//\t\t\t\t\tcurrentState.setParent(null);\r\n//\t\t\t\t\tcurrentState = findTheGold(currentState);\r\n//\t\t\t\t\tif(currentState.getGoldCollected()) {\r\n//\t\t\t\t\t\tcurrentState.setParent(null);\r\n//\t\t\t\t\t\taddToNextMoves(currentState);\r\n//\t\t\t\t\t}\r\n\t\t\t\t\tif(!goldCollected) {\r\n\t\t\t\t\t\twellItsDarkNow(visibleMap);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(goldCollected) {\r\n//\t\t\t\t\t\tcurrentState.setParent(null);\r\n\t\t\t\t\t\taddToNextMoves(visibleMap);\r\n//\t\t\t\t\t\tgoldCollected = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\tif(!nextMoves.isEmpty()) {\r\n\t\t\t\t\tSystem.out.println(nextMoves.peek());\r\n\t\t\t\t\tsetNextMove(nextMoves.remove());\r\n//\t\t\t\t\tSystem.out.println(nextMove);\r\n//\t\t\t\t\treturn nextMove;\r\n\t\t\t\t}\r\n\t\t\t\treturn nextMove;\r\n//\t\t\t\tcurrentNumMoves++;\r\n//\t\t\t\tif(currentNumMoves < 20) {\r\n//\t\t\t\t\treturn AgentAction.randomAction();\r\n//\t\t\t\t}\r\n//\t\t\t\telse {\r\n//\t\t\t\t\treturn AgentAction.declareVictory;\r\n//\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t}", "public Direction nextMove(Game gameState) {\n\n // Create a copy of this game state and walk in the first direction\n Game curr = new Game(gameState);\n curr.step(directions[0]);\n\n // Set the current minimum found cost and index to this first direction's cost\n int minCost = getCost(curr);\n int minIndex = 0;\n\n // Loop through the other directions\n for (int i = 1, max = directions.length; i < max; i++) {\n\n // Create a copy of this game state and walk in a new direction\n curr = new Game(gameState);\n curr.step(directions[i]);\n int thisCost = getCost(curr);\n\n // Check if this new cost is lower than previous ones and if so, update minCost and minIndex accordingly\n if (thisCost < minCost) {\n minCost = thisCost;\n minIndex = i;\n }\n }\n\n // Return the direction corresponding to this minimum cost\n return directions[minIndex];\n }", "public Move leastRoadMove(Building request, Land land) {\n\t\tArrayList<Move> moves = new ArrayList<Move>();\n\t\tif (request.type == Building.Type.FACTORY) {\n\t\t\t// searching top-down, left-right\n\t\t\tfor (int j = 0; j < land.side; j++) {\n\t\t\t\tfor (int i = 0; i < land.side; i++) {\n\t\t\t\t\tCell p = new Cell(i, j);\n\t\t\t\t\tBuilding[] rotations = request.rotations();\n\t\t\t\t\tfor (int ri = 0; ri < rotations.length; ri++) {\n\t\t\t\t\t\tBuilding b = rotations[ri];\n\t\t\t\t\t\tif (land.buildable(b, p))\n\t\t\t\t\t\t\tmoves.add(new Move(true, request, p, ri, new HashSet<Cell>(), new HashSet<Cell>(),\n\t\t\t\t\t\t\t\t\tnew HashSet<Cell>()));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (request.type == Building.Type.RESIDENCE) {\n\t\t\t// Searching top-down, right-left\n\t\t\tfor (int j = land.side; j >= 0; --j) {\n\t\t\t\tfor (int i = 0; i < land.side; ++i) {\n\t\t\t\t\tCell p = new Cell(i, j);\n\t\t\t\t\tBuilding[] rotations = request.rotations();\n\t\t\t\t\tfor (int ri = 0; ri < rotations.length; ri++) {\n\t\t\t\t\t\tBuilding b = rotations[ri];\n\t\t\t\t\t\tif (land.buildable(b, p))\n\t\t\t\t\t\t\tmoves.add(new Move(true, request, p, ri, new HashSet<Cell>(), new HashSet<Cell>(),\n\t\t\t\t\t\t\t\t\tnew HashSet<Cell>()));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Reject is no valid placements exist\n\t\tif (moves.isEmpty())\n\t\t\treturn new Move(false);\n\n\t\tArrayList<Move> moves2 = new ArrayList<Move>();\n\t\tboolean checkEmptyNeighborRoadAdj = true;\n\t\t\n\t\twhile(true){\n\t\t\t// Iterate through the moves and find their shortest roads for each\n\t\t\tfor (Move mc : moves) {\n\t\t\t\t// get coordinates of building placement \n\t\t\t\t// (position plus local building cell coordinates)\n\t\t\t\tSet<Cell> shiftedCells = new HashSet<Cell>();\n\t\t\t\tfor (Cell x : mc.request.rotations()[mc.rotation])\n\t\t\t\t\tshiftedCells.add(new Cell(x.i + mc.location.i, x.j + mc.location.j));\n\t\t\t\t// build a road to connect this building to perimeter\n\t\t\t\tSet<Cell> roadCells = findShortestRoad(shiftedCells, land);\n//\t\t\t\tif (roadCells.size()==0) {\n//\t\t\t\t\tif (!isNextToRoad(mc.location.i, mc.location.j, mc.request, land)) {\n//\t\t\t\t\t\tcontinue;\n//\t\t\t\t\t}\n//\t\t\t\t}\n\t\t\t\tif(roadCells == null){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse if(checkEmptyNeighborRoadAdj && !areNeighborsNextToRoad(mc.location.i, mc.location.j, mc.request.rotations()[mc.rotation], land, roadCells)){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tmc.road = roadCells;\n\t\t\t\t\tmoves2.add(mc);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(checkEmptyNeighborRoadAdj && moves2.isEmpty()){\n\t\t\t\tcheckEmptyNeighborRoadAdj=false;\n\t\t\t\t//System.out.println(\"Failed using neighborsRoadChecking\");\n\t\t\t}\n\t\t\telse{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\tmoves = moves2;\n\n\t\t// Reject if no valid placements exist\n\t\tif (moves.isEmpty())\n\t\t\treturn new Move(false);\n\n\t\t// Find minimum road length move\n\t\tint minimumIndex = 0;\n\t\tfor (int i = 0; i < moves.size(); i++) {\n\t\t\tif (moves.get(i).road.size() < moves.get(minimumIndex).road.size())\n\t\t\t\tminimumIndex = i;\n\t\t}\n\n\t\tMove chosenMove = moves.get(minimumIndex);\n\t\troad_cells.addAll(chosenMove.road); // Adding this road to the set of\n\t\t\t\t\t\t\t\t\t\t\t// roads\n\t\treturn chosenMove;\n\t}", "public static int findBestMove(Board board, PieceType playerPiece) {\n int bestVal = -1000;\n int row = -1;\n int col = -1;\n\n // Traverse all cells, evaluate minimax function\n // for all empty cells. And return the cell\n // with optimal value.\n for (int i = 0; i < 3; i++) {\n for (int j = 0; j < 3; j++) {\n // Check if cell is empty\n if (board.getBoard()[i][j] == 0) {\n // Make the move\n board.getBoard()[i][j] = playerPiece.getValue();\n\n // compute evaluation function for this\n // move.\n int moveVal = minimax(board, playerPiece, 0, false);\n\n // Undo the move\n board.getBoard()[i][j] = 0;\n\n // If the value of the current move is\n // more than the best value, then update\n // best/\n if (moveVal > bestVal) {\n row = i;\n col = j;\n bestVal = moveVal;\n }\n }\n }\n }\n return (col + 1) + (row * board.getGame().getGridType().getSize());\n }", "public MoveEvaluation alreadyDetermined(IGameState state) {\n\t\tNode<Pair> node = list.head();\n\t\t\n\t\twhile (node != null) {\n\t\t\tPair p = node.value();\n\t\t\tif (state.equivalent(p.state)) {\n\t\t\t\treturn p.move;\n\t\t\t}\n\t\t\t\n\t\t\tnode = node.next();\n\t\t}\n\t\t\n\t\treturn null;\n\t}", "private void decideMakeAutomaicMove(){\n\t\t\r\n\t\tif (playerMode != PlayerMode.manual){\r\n\t\t\tif (playerMode == PlayerMode.random) makeRandomMove();\r\n\t\t\telse makeSmartMove();\r\n\t\t}\r\n\t}", "public void AIMakeMove() {\n\t\t\n\t\tRandom randomizer = new Random();\n\t\tint index = randomizer.nextInt(AIPossibleMoves.size());\n\t\tMove move = AIPossibleMoves.get(index);\n\t\tChecker checker = model.findChecker(move.getxOrigin(), move.getyOrigin());\n\t\tint xChange = (move.getxOrigin() - move.getxMove());\n\t\tint yChange = (move.getyOrigin() - move.getyMove());\n\t\t\n\t\tint xMoveNew = 0;\n\t\tint yMoveNew = 0;\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\tif(board.getBoard()[move.getyMove()][move.getxMove()] == 0) {\n\t\t\t//do nothing\n\t\t} else {\n\t\t\t//moving down\n\t\t\tif(yChange < 0) {\n\t\t\t\t//moving right\n\t\t\t\tif(xChange < 0) {\n\t\t\t\t\tremoveTakenPiece(move.getxMove(), move.getyMove());\n\t\t\t\t\txMoveNew = move.getxMove() + 1;\n\t\t\t\t\tyMoveNew = move.getyMove() + 1;\n\t\t\t\t\tmove.setxMove(xMoveNew);\n\t\t\t\t\tmove.setyMove(yMoveNew);\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\t\n\t\t\t\t\t//moving left\n\t\t\t\t\t\n\t\t\t\t\tremoveTakenPiece(move.getxMove(), move.getyMove());\n\t\t\t\t\txMoveNew = move.getxMove() - 1;\n\t\t\t\t\tyMoveNew = move.getyMove() + 1;\n\t\t\t\t\tmove.setxMove(xMoveNew);\n\t\t\t\t\tmove.setyMove(yMoveNew);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t//moving up\n\t\t\t\tif(xChange < 0) {\n\t\t\t\t\t//moving right\n\t\t\t\t\tremoveTakenPiece(move.getxMove(), move.getyMove());\n\t\t\t\t\txMoveNew = move.getxMove() + 1;\n\t\t\t\t\tyMoveNew = move.getyMove() - 1;\n\t\t\t\t\tmove.setxMove(xMoveNew);\n\t\t\t\t\tmove.setyMove(yMoveNew);\n\t\t\t\t} else {\n\t\t\t\t\t//moving left \n\t\t\t\t\tremoveTakenPiece(move.getxMove(), move.getyMove());\n\t\t\t\t\txMoveNew = move.getxMove() - 1;\n\t\t\t\t\tyMoveNew = move.getyMove() - 1;\n\t\t\t\t\tmove.setxMove(xMoveNew);\n\t\t\t\t\tmove.setyMove(yMoveNew);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\t//System.out.println(\"New Move is: \" + xMoveNew + \",\" + yMoveNew);\n\t\tif(canBeKing(checker, move)) {\n\t\t\tchecker = convertToKing(checker, move);\n\t\t\tmodel.updateChecker(move, checker, 2);\n\t\t\t\n\t\t\tprintBoard();\n\t\t\tmodel.moves.add(move);\n\t\t\treturn;\n\t\t}\n\t\tmodel.updateChecker(move, checker, 2);\n\t//\tSystem.out.println(\"AI - DEBUGGING\");\n\t//\tSystem.out.println(\"Origin Piece: \" + move.getxOrigin() + \",\" + move.getyOrigin());\n\t//\tSystem.out.println(\"Move Position: \" + move.getxMove() + \",\" + move.getyMove());\n\t\tupdateBoard(move);\n\t\tmodel.moves.add(move);\n\t\tprintBoard();\n\t\t\n\t}", "private boolean isSpaceFree(Move move) {\n int moveX = move.getMoveX(); \n int moveY = move.getMoveY(); \n if (boardState[moveX][moveY] == 'X' || boardState[moveX][moveY] == 'O') {\n return false; \n }\n return true; \n }", "protected int bestDirection(int _y, int _x)\n {\n int sX = -1, sY = -1;\n for (int i = 0; i < m; i++) {\n boolean breakable = false;\n for (int j = 0; j < n; j++) {\n if (map[i][j] == 'p' || map[i][j] == '5') {\n sX = i;\n sY = j;\n breakable = true;\n break;\n }\n }\n if(breakable) break;\n sX =0; sY = 0;\n }\n Pair s = new Pair(sX, sY);\n Queue<Pair> queue = new Queue<Pair>();\n int[][] distance = new int[m][n];\n for (int i = 0; i < m; i++)\n for (int j = 0; j < n; j++)\n distance[i][j] = -1;\n distance[sX][sY] = 0;\n queue.add(s);\n /*\n System.out.println(\"DEBUG TIME!!!!\");\n for(int i = 0; i < m; i++)\n {\n for(int j = 0; j < n; j++)\n System.out.print(map[i][j]);\n System.out.println();\n }\n System.out.println();\n */\n while (!queue.isEmpty())\n {\n Pair u = queue.remove();\n for (int i = 0; i < 4; i++)\n {\n int x = u.getX() + hX[i];\n int y = u.getY() + hY[i];\n if (!validate(x, y)) continue;\n if (distance[x][y] != -1) continue;\n if (!canGo.get(map[x][y])) continue;\n distance[x][y] = distance[u.getX()][u.getY()] + 1;\n queue.add(new Pair(x, y));\n }\n }\n\n //slove if this enemy in danger\n //System.out.println(_x + \" \" + _y);\n if (inDanger[_x][_y])\n {\n int direction = -1;\n boolean canAlive = false;\n int curDistance = dangerDistance[_x][_y];\n int distanceToBomber = m * n;\n if (curDistance == -1) return 0;\n for (int i = 0; i < 4; i++)\n {\n int x = _x + hX[i];\n int y = _y + hY[i];\n if (!validate(x, y)) continue;\n if (dangerDistance[x][y] == -1) continue;\n if (dangerDistance[x][y] < curDistance)\n {\n curDistance = dangerDistance[x][y];\n direction = i;\n distanceToBomber = distance[x][y];\n } else if (dangerDistance[x][y] == curDistance)\n {\n if (distanceToBomber == -1 || distanceToBomber > distance[x][y])\n {\n direction = i;\n distanceToBomber = distance[x][y];\n }\n }\n }\n if (direction == -1) direction = random.nextInt(4);\n allowSpeedUp = true;\n return direction;\n }\n // or not, it will try to catch bomber\n else\n {\n /*\n System.out.println(\"x = \" + _x + \"y = \" + _y);\n for(int i = 0; i < n; i++) System.out.printf(\"%2d \",i);\n System.out.println();\n for(int i = 0; i < m; i++)\n {\n for(int j = 0; j < n; j++)\n System.out.printf(\"%2d \",distance[i][j]);\n System.out.println();\n }\n System.out.println();\n System.out.println();\n */\n int direction = -1;\n int[] die = new int[4];\n for (int i = 0; i < 4; i++)\n die[i] = 0;\n int curDistance = distance[_x][_y];\n for (int i = 0; i < 4; i++)\n {\n int x = _x + hX[i];\n int y = _y + hY[i];\n if (!validate(x, y))\n {\n die[i] = 1;\n continue;\n }\n ;\n if (inDanger[x][y])\n {\n die[i] = 2;\n continue;\n }\n if (distance[x][y] == -1) continue;\n if (distance[x][y] < curDistance)\n {\n curDistance = distance[x][y];\n direction = i;\n }\n }\n if(curDistance < 4) allowSpeedUp = true;\n else allowSpeedUp = false; //TODO: TEST :))\n if (direction == -1)\n {\n for (int i = 0; i < 4; i++)\n if (die[i] == 0) return i;\n for (int i = 0; i < 4; i++)\n if (die[i] == 1) return i;\n return 0;\n } else return direction;\n }\n }", "private void moveComputer(String[][] gameState) {\n possiblemoves possibleMoves = new possiblemoves();\r\n String moves = possibleMoves.calculateMoves(gameState);\r\n String[] arrMoves = moves.split(\"\\\\r?\\\\n\");\r\n int randIndex = (int) (Math.random() * arrMoves.length);\r\n // Choose one of the possible moves at random\r\n String choosenSpace = arrMoves[randIndex];\r\n int xPosition = Character.getNumericValue(choosenSpace.charAt(0));\r\n int yPosition = Character.getNumericValue(choosenSpace.charAt(2));\r\n gameState[xPosition][yPosition] = \"o\";\r\n }", "public Point findSpace(){\r\n Point toReturn = new Point(-1, -1);\r\n for (int i = 0; i<puzzleSize; i++){\r\n for (int j = 0; j<puzzleSize; j++){\r\n if (this.state[i][j] == 0)\r\n toReturn.setLocation(i,j);\r\n }\r\n }\r\n return toReturn;\r\n }", "private MNKCell findOneMoveWin(final MNKGameState winState) {\n for (MNKCell c : board.getFreeCells()) {\n MNKGameState result = board.markCell(c.i, c.j);\n board.unmarkCell();\n if (result == winState) return c;\n }\n return null;\n }", "@Test\r\n\tpublic void testDefaultMove() {\r\n\t\tTicTacToe game = new TicTacToe(\"XOXOX-OXO\");\r\n\t\tassertEquals(5, game.suggestMove('X'));\r\n\r\n\t\tgame = new TicTacToe(\"XOXOXOOX-\");\r\n\t\tassertEquals(8, game.suggestMove('O'));\r\n\r\n\t\tgame = new TicTacToe(\"---------\");\r\n\t\tassertEquals(0, game.suggestMove('X'));\r\n\r\n\t\tgame = new TicTacToe(\"XXXXXXXXX\");\r\n\t\tassertEquals(-1, game.suggestMove('X'));\r\n\t}", "private Move findBestMove(Piece player, Board board, int depth,\n double cutoff) {\n Board newBoard = new Board(board);\n Move bestSoFar = newBoard.iterator().next();\n Iterator<Move> moveIterator = board.iterator();\n if (newBoard.piecesContiguous(player)) {\n return bestSoFar;\n } else if (newBoard.piecesContiguous(player.opposite())) {\n return guessBestMove(player, newBoard, cutoff);\n } else if (depth == 0) {\n return guessBestMove(player, newBoard, cutoff);\n }\n while (moveIterator.hasNext()) {\n Move nextMove = moveIterator.next();\n newBoard.makeMove(nextMove);\n int boardValue = eval(newBoard);\n Move response = findBestMove(player.opposite(),\n newBoard, depth - 1, -boardValue);\n newBoard.makeMove(response);\n int responseVal = eval(newBoard);\n newBoard.retract();\n newBoard.retract();\n if (-responseVal > boardValue) {\n boardValue = -responseVal;\n bestSoFar = nextMove;\n if (boardValue >= cutoff) {\n break;\n }\n }\n }\n return bestSoFar;\n }", "private ArrayList<Move> generatePossibleMovesFor(Player player) {\n ArrayList<Point> selfStonePlacements = new ArrayList<>();\n ArrayList<Point> opponentStonePlacements = new ArrayList<>();\n for (int x = 0; x < field.length; x++)\n for (int y = 0; y < field[x].length; y++) {\n if (field[x][y] == null)\n continue;\n if (field[x][y] == this.color)\n selfStonePlacements.add(new FieldPoint(x, y));\n if (field[x][y] == opponent.getColor())\n opponentStonePlacements.add(new FieldPoint(x, y));\n }\n\n ArrayList<Move> possibleMoves = new ArrayList<>();\n\n // Check if player is in set phase or only has three stones left\n if (!player.isDoneSetting()) {\n // Every free field is a possible move\n for (Point point : pointsOfMovement) {\n if (opponentStonePlacements.contains(point) || selfStonePlacements.contains(point))\n continue;\n possibleMoves.add(new StoneMove(null, point));\n }\n } else if (player.isDoneSetting() && getCountOfStonesFor(player) > 3) {\n // Move is only possible if the neighbour field of a stone is free\n for (Point point : player == opponent ? opponentStonePlacements : selfStonePlacements) {\n for (Point neighbour : neighbourPoints.get(point)) {\n if (opponentStonePlacements.contains(neighbour) || selfStonePlacements.contains(neighbour))\n continue;\n possibleMoves.add(new StoneMove(point, neighbour));\n }\n }\n } else {\n for (Point point : player == opponent ? opponentStonePlacements : selfStonePlacements) {\n for (Point another : pointsOfMovement) {\n if (opponentStonePlacements.contains(point) || selfStonePlacements.contains(point))\n continue;\n possibleMoves.add(new StoneMove(point, another));\n }\n }\n }\n\n Collections.shuffle(possibleMoves);\n return possibleMoves;\n }", "public static Pair<Integer, PentagoMove> miniMaxAlgo(PentagoBoardState boardState, int depth, int playerTurn) {\n\t\t\n\t\tArrayList<PentagoMove> possibleMoves = boardState.getAllLegalMoves();\n\t\tint score = 0;\n\t\t\n\t\t//assign a high or low value to begin with, no move can have that high/low a value\n\t\tif (playerTurn == 1) {\n\t\t\tscore = Integer.MIN_VALUE;\n\t\t}\n\t\telse {\n\t\t\tscore = Integer.MAX_VALUE;\n\t\t}\n\t\t\n\t\tint currentScore;\n\t\tPentagoMove chosenMove = null;\n\t\t\n\t\t//when all moves have been propagated up to the depth desired, find the most valuated move\n\t\tif (possibleMoves.size() == 0 || depth == 0) {\n\t\t\tscore = heuristic(boardState);\n\t\t}\n\t\telse {\n\t\t\t//iterating through all possible moves\n\t\t\tfor(int i = 0; i < possibleMoves.size(); i++) {\n\t\t\t\t\n\t\t\t\t//cloning board to predict 2 moves ahead (depth is 2)\n\t\t\t\tPentagoBoardState clone = (PentagoBoardState) boardState.clone();\n\t\t\t\tclone.processMove(possibleMoves.get(i));\n\t\t\t\tint player = 1 - playerTurn;\n\t\t\t\t\n\t\t\t\t//0 = white, trying to maximize\n\t\t\t\tif (player == 0) {\n\t\t\t\t\t\n\t\t\t\t\t//if a found score is higher, make it the new current score, then use minimize at the lower depth\n\t\t\t\t\t//player will be \"swapped\" (if opponent is current player, we'll simulate the player's turn) when making the recursive call\n\t\t\t\t\tcurrentScore = miniMaxAlgo(clone, depth - 1, player).getKey();\n\t\t\t\t\t\n\t\t\t\t\tif (currentScore >= score) {\n\t\t\t\t\t\tchosenMove = possibleMoves.get(i);\n\t\t\t\t\t\tscore = currentScore;\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t\t\n\t\t\t\t//1 = black, trying to minimize\n\t\t\t\telse if (player == 1) {\n\t\t\t\t\t\n\t\t\t\t\t//if a found score is lower, make it the new current score, then use maximize at the lower depth\n\t\t\t\t\t//player will be \"swapped\" (if opponent is current player, we'll simulate the player's turn) when making the recursive call\n\t\t\t\t\tcurrentScore = miniMaxAlgo(clone, depth - 1, player).getKey();\n\t\t\t\t\t\n\t\t\t\t\tif (currentScore <= score) {\n\t\t\t\t\t\tchosenMove = possibleMoves.get(i);\n\t\t\t\t\t\tscore = currentScore;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//decided to go with pair to avoid having separated methods for the score and the move\n\t\t//it is easy to extract the required value using .getKey() or .getValue()\n\t\tPair<Integer, PentagoMove> answer = new Pair<>(score, chosenMove);\n\t\treturn answer;\n\t}", "public static void compute_possible_moves(Board s){\n\t\tint b [][] = s.board;\n\t\tint x = -1;\n\t\tint y = -1;\n\t\tfor (int i = 0;i < b.length;i++) {\n\t\t\tfor (int j = 0;j < b[i].length;j++) {\n\t\t\t\tif(b[i][j] == 0){\n\t\t\t\t\tx = i;\n\t\t\t\t\ty = j;\n\t\t\t\t\tbreak;\n\t\t\t\t}\t\n\t\t\t}\n\t\t}\n\n\t\tint left [][];\n\t\tint right [][];\n\t\tint up [][];\n\t\tint down [][];\n\t\tpossible_boards.clear();\n\t\tif(x - 1 != -1 && x >= 0 && x < 3){\n\t\t\t//up is a legal move\n\t\t\tint temporary_board [][] = new int[b.length][];\n\t\t\tfor(int q = 0; q < b.length; q++)\n\t\t\t temporary_board [q] = b[q].clone();\n\t\t\t\n\n\t\t\tint temp = temporary_board[x - 1][y];\n\t\t\ttemporary_board[x - 1][y] = temporary_board[x][y];\n\t\t\ttemporary_board[x][y] = temp;\n\t\t\tup = temporary_board;\n\n\t\t\tBoard up_board = new Board(up);\n\t\t\tpossible_boards.add(up_board);\n\n\t\t}\n\t\tif(x + 1 != 3 && x >= 0 && x < 3){\n\t\t\t//down is a legal move\n\t\t\tint temporary_board [][] = new int[b.length][];\n\t\t\tfor(int q = 0; q < b.length; q++)\n\t\t\t temporary_board [q] = b[q].clone();\n\t\t\t\n\t\t\tint temp = temporary_board[x + 1][y];\n\t\t\ttemporary_board[x + 1][y] = temporary_board[x][y];\n\t\t\ttemporary_board[x][y] = temp;\n\t\t\tdown = temporary_board;\n\t\t\tBoard down_board = new Board(down);\n\t\t\tpossible_boards.add(down_board);\n\t\t}\n\t\tif(y - 1 != -1 && y >= 0 && y < 3){\n\t\t\t//left move is legal\n\t\t\tint temporary_board [][] = new int[b.length][];\n\t\t\tfor(int q = 0; q < b.length; q++)\n\t\t\t temporary_board [q] = b[q].clone();\n\t\t\t\n\t\t\tint temp = temporary_board[x][y - 1];\n\t\t\ttemporary_board[x][y - 1] = temporary_board[x][y];\n\t\t\ttemporary_board[x][y] = temp;\n\t\t\tleft = temporary_board;\n\t\t\tBoard left_board = new Board(left);\n\t\t\tpossible_boards.add(left_board);\n\n\t\t}\n\t\tif(y + 1 != 3 && y >= 0 && y < 3){\n\t\t\t//right move is legal\n\t\t\tint temporary_board [][] = new int[b.length][];\n\t\t\tfor(int q = 0; q < b.length; q++)\n\t\t\t temporary_board [q] = b[q].clone();\n\t\t\t\n\t\t\tint temp = temporary_board[x][y + 1];\n\t\t\ttemporary_board[x][y + 1] = temporary_board[x][y];\n\t\t\ttemporary_board[x][y] = temp;\n\t\t\tright = temporary_board;\n\t\t\tBoard right_board = new Board(right);\n\t\t\tpossible_boards.add(right_board);\n\n\t\t}\n\n\t}", "public static GameState getBestMove(Vector<GameState> states){\n int index = 0;\n double max = 0;\n double v = 0;\n\n // find state with max value and save its index\n for(int i = 0; i < states.size(); i++){\n v = minMaxPruning(states.get(i), depth, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);\n if(max < v){\n max = v;\n index = i;\n }\n }\n return states.get(index);\n }", "public int minimax(Tile[][] board, int depth, boolean isMaximizing) {\n int result = WinnerChecker.checkWinner();\r\n if(result != 2) {\r\n return result;\r\n }\r\n\r\n int bestScore = 0;\r\n if(isMaximizing){\r\n bestScore = 1;\r\n for(int i = 0; i< 3; i++){\r\n for(int j = 0; j< 3; j++){\r\n // Is the spot available?\r\n if(board[i][j].text.getText().isEmpty()){\r\n board[i][j].text.setText(\"O\");\r\n TicTacToeApp.previous_move = board[i][j];\r\n int score = minimax(board, depth+1,false);\r\n board[i][j].text.setText(\"\");\r\n bestScore = Math.min(score, bestScore);\r\n }\r\n }\r\n }\r\n }else{\r\n bestScore = -1;\r\n for(int i = 0; i< 3; i++){\r\n for(int j = 0; j< 3; j++){\r\n // Is the spot available?\r\n if(board[i][j].text.getText().isEmpty()){\r\n board[i][j].text.setText(\"X\");\r\n TicTacToeApp.previous_move = board[i][j];\r\n int score = minimax(board, depth+1,true);\r\n board[i][j].text.setText(\"\");\r\n bestScore = Math.max(score, bestScore);\r\n }\r\n }\r\n }\r\n }\r\n return bestScore;\r\n }" ]
[ "0.71696544", "0.6840756", "0.6811112", "0.6758936", "0.67464465", "0.6734174", "0.6638513", "0.6575392", "0.65339756", "0.65117276", "0.64103866", "0.6375238", "0.6297857", "0.62813514", "0.6230882", "0.6214935", "0.6214179", "0.62011236", "0.61824214", "0.6146412", "0.61372554", "0.6121224", "0.6115354", "0.61137474", "0.6098817", "0.60851353", "0.60696155", "0.60649616", "0.6058601", "0.6052403", "0.5996528", "0.5982838", "0.59703207", "0.5957959", "0.59547055", "0.5929107", "0.59203196", "0.5899674", "0.5892751", "0.5885562", "0.58813787", "0.58607537", "0.58477265", "0.5839084", "0.5830885", "0.58243895", "0.5822366", "0.5803717", "0.5803512", "0.5799547", "0.5778634", "0.57640237", "0.5755398", "0.575479", "0.57535803", "0.57528174", "0.5729771", "0.5722287", "0.570126", "0.5694425", "0.5689426", "0.5669736", "0.56511724", "0.5646699", "0.5621828", "0.5621263", "0.5619609", "0.55882186", "0.5585831", "0.5581337", "0.5574269", "0.5569834", "0.55698246", "0.55630165", "0.555399", "0.55516", "0.5541125", "0.55380344", "0.55304855", "0.5521065", "0.55168825", "0.5516114", "0.5508865", "0.549741", "0.5495191", "0.5483163", "0.54687184", "0.54678714", "0.5466571", "0.54633385", "0.5463243", "0.54621077", "0.5461911", "0.5461313", "0.54599243", "0.5459227", "0.54591435", "0.5458792", "0.5451476", "0.54507595" ]
0.694898
1
/ Input: the current board Output: an ArrayList containing all of the empty spots on the board
private ArrayList<Integer> getEmptySpaces(char[] board) { ArrayList<Integer> emptySpaces = new ArrayList<>(); for (int i = 0; i < board.length; i++) { if (board[i] == ' ') { emptySpaces.add(i); } } return emptySpaces; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public ArrayList<Tile> getEmptyTiles(){\n\t\tArrayList<Tile> emptyTiles = new ArrayList<Tile>();\n\t\tArrayList<Tile> boardTiles = getAllBoardTiles();\n\t\tfor (Tile tile : boardTiles) {\n\t\t\tif(tile.getPiece()== null && tile.getColor1()== PrimaryColor.BLACK) {\n\t\t\t\temptyTiles.add(tile);\n\t\t\t}\n\t\t}\n\t\treturn emptyTiles;\n\t}", "protected ArrayList emptyNeighbors()\n {\n // Get all the neighbors of this fish, empty or not.\n ArrayList nbrs = environment().neighborsOf(location());\n\n // Figure out which neighbors are empty and add those to a new list.\n ArrayList emptyNbrs = new ArrayList();\n for ( int index = 0; index < nbrs.size(); index++ )\n {\n Location loc = (Location) nbrs.get(index);\n if ( environment().isEmpty(loc) )\n emptyNbrs.add(loc);\n }\n\n return emptyNbrs;\n }", "private int[] blankFinder(){\n for(int x = 0; x < n; x++){\n for(int y = 0; y < n; y++){\n if(tiles[x][y] == 0){\n return new int[]{x, y};\n }\n }\n }\n return null;\n }", "private ArrayList<GameSquare> getAdjacentEmptySquares()\n {\n ArrayList<GameSquare> list = new ArrayList<GameSquare>();\n for (GameSquare square : getAdjacentSquares())\n {\n if (!square.mine && square.adjacentMines == 0) //Must check to see if square is a mine, because mines\n {\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t //may not have the correct value for adjacentMines.\n list.add(square);\n }\n }\n return list;\n }", "public List<Piece> allPieces(){\n List<Piece> pieces = new ArrayList<>();\n for (int y = 0; y < 8; y++){\n for (int x = 0; x < 8; x++){\n int val = board[y][x];\n if (val != 0){\n pieces.add(new Piece(val,x,y));\n }\n }\n }\n return pieces;\n }", "private List<Coordinate> getAvailableMoves(ImmutableGameBoard gameBoard) {\n List<Coordinate> availableMoves = new ArrayList<Coordinate>();\n\n for (int x = 0; x < gameBoard.getWidth(); x++) {\n for (int y = 0; y < gameBoard.getHeight(); y++) {\n if(gameBoard.getSquare(x, y) == TicTacToeGame.EMPTY)\n availableMoves.add(new Coordinate(x, y));\n }\n }\n\n return availableMoves;\n }", "public static void blankBoard() {\r\n\t\tfor (int i = 0; i < Spaces.length; i++) {\r\n\t\t\tSpaces[i] = new Piece();\r\n\t\t}\r\n\t}", "private int[][] listEmptyCells() {\n int nbEmpty = 0;\n int[][] emptyCells;\n int k = 0;\n\n for (int i = 0; i < sb.size; i++) {\n for (int j = 0; j < sb.size; j++) {\n if (sb.get(i, j) == 0)\n nbEmpty++;\n }\n }\n emptyCells = new int[nbEmpty][2];\n\n for (int i = 0; i < sb.size; i++) {\n for (int j = 0; j < sb.size; j++) {\n if (sb.get(i, j) == 0) {\n emptyCells[k][0] = i;\n emptyCells[k][1] = j;\n k++;\n }\n }\n }\n return emptyCells;\n }", "public void clear() {\n for (int row = 0; row < 8; ++row) {\n for (int col = 0; col < 8; ++col) {\n board[row][col] = null;\n }\n }\n whitePieces = new LinkedList<Piece>();\n blackPieces = new LinkedList<Piece>();\n }", "private ArrayList<PredatorPreyCell> getEmptyCells(Grid<Integer> grid) {\n\t\tArrayList<PredatorPreyCell> emptyCells = new ArrayList<PredatorPreyCell>();\n\t\tfor(int i = 0; i < grid.getHeight(); i++) {\n\t\t\tfor(int j = 0; j < grid.getWidth(); j++) {\n\t\t\t\tif(grid.getGridMatrix()[i][j].getValue() == EMPTY &&\n\t\t\t\t (grid.getGridMatrix()[i][j].getNewValue() == null || grid.getGridMatrix()[i][j].getNewValue() == EMPTY)) {\n\t\t\t\t\temptyCells.add((PredatorPreyCell) grid.getGridMatrix()[i][j]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn emptyCells;\n\t}", "public void populateLists() {\n\t\tfor (int row = 0; row < 8; row++) {\n\t\t\tfor (int col = 0; col < 8; col++)\n\t\t\t\tif (board[row][col] != null && board[row][col].isWhite())\n\t\t\t\t\twhitePieces.add(board[row][col]);\n\t\t\t\t\t//whitePieces.add(board[row][col]);\n\t\t}\n\t\tfor (int row = 0; row < 8; row++) {\n\t\t\tfor (int col = 0; col < 8; col++){\n\t\t\t\tif (board[row][col] != null && !board[row][col].isWhite())\n\t\t\t\t\tblackPieces.add(board[row][col]);}\n\t\t\t\n\t\t}\n\t}", "public List<TicTacToeCoordinates> getAvailableSpots() {\n List<TicTacToeCoordinates> openSpots = new ArrayList<>();\n for (int x = 0; x < boardLength; x++) {\n for (int y = 0; y < boardWidth; y++) {\n if (board[x][y] == '\\u0000') {\n openSpots.add(new TicTacToeCoordinates(x, y));\n }\n }\n }\n return openSpots;\n }", "private void setEmpty() {\n\t\tfor (int r = 0; r < board.length; r++)\n\t\t\tfor (int c = 0; c < board[r].length; c++)\n\t\t\t\tboard[r][c] = new Cell(false, false,\n\t\t\t\t\t\tfalse, false); // totally clear.\n\t}", "private ArrayList<int[][]> possiblePuzzleMoves(int[][] currentPuzzle) {\n ArrayList<int [][]> possibleMoves = new ArrayList<>();\n //find zero\n int zeroRow = 0;\n int zeroCol = 0;\n for(int i = 0; i < currentPuzzle.length; i++) {\n for (int j = 0; j < currentPuzzle[i].length; j++) {\n if(currentPuzzle[i][j] == 0) {\n zeroRow = i;\n zeroCol = j;\n break;\n }\n }\n }\n\n //check if zero isn't in top row\n if(zeroRow > 0) {\n int [][]newPuzzleConfig = copy(currentPuzzle);\n int tileAbove = newPuzzleConfig[zeroRow - 1][zeroCol];\n newPuzzleConfig[zeroRow - 1][zeroCol] = 0;\n newPuzzleConfig[zeroRow][zeroCol] = tileAbove;\n possibleMoves.add(newPuzzleConfig);\n }\n\n //check if zero isn't in bottom row\n if(zeroRow < 2) {\n int [][]newPuzzleConfig = copy(currentPuzzle);\n int tileBelow = newPuzzleConfig[zeroRow + 1][zeroCol];\n newPuzzleConfig[zeroRow + 1][zeroCol] = 0;\n newPuzzleConfig[zeroRow][zeroCol] = tileBelow;\n possibleMoves.add(newPuzzleConfig);\n\n }\n\n //check if zero isn't in left col\n if(zeroCol > 0) {\n int [][]newPuzzleConfig = copy(currentPuzzle);\n int tileToLeft = newPuzzleConfig[zeroRow][zeroCol-1];\n newPuzzleConfig[zeroRow][zeroCol-1] = 0;\n newPuzzleConfig[zeroRow][zeroCol] = tileToLeft;\n possibleMoves.add(newPuzzleConfig);\n }\n\n //check if zero isn't in right col\n if(zeroCol < 2) {\n int [][]newPuzzleConfig = copy(currentPuzzle);\n int tileToRight = newPuzzleConfig[zeroRow][zeroCol+1];\n newPuzzleConfig[zeroRow][zeroCol+1] = 0;\n newPuzzleConfig[zeroRow][zeroCol] = tileToRight;\n possibleMoves.add(newPuzzleConfig);\n }\n return possibleMoves;\n }", "public List<String> allSquaresNoMove ()\n {\n List<Square> squareList = new ArrayList<>();\n List<String> stringList = new ArrayList<>();\n\n squareList.addAll(player.getSquare().getGameBoard().getArena().squareReachableNoWall(player.getSquare().getX() , player.getSquare().getY(),2));\n\n for (Square square : squareList)\n stringList.add(square.toStringCoordinates());\n\n return stringList;\n\n }", "public void clearBoard() \n {\n\tfor(int i=0;i<rows;i++)\n\t {\n\t\tfor(int j=0;j<cols;j++)\n\t\t {\n\t\t\tfrontBoard[i][j] = \"00\";\n\t\t\tbackBoard[i][j] = \"00\";\n\t\t }\n\t }\n\tunused = new Piece[pieces.length];\n\tfor(int i=0;i<pieces.length;i++)\n\t {\n\t\t\tunused[i] = pieces[i];\n\t }\n }", "public static void clearBoard(){\n for(int i = 0; i < Board.X_UPPER_BOUND * Board.Y_UPPER_BOUND ; i++){\n Board.board[i] = null;\n }\n white_player.setpieceList(null);\n black_player.setpieceList(null);\n }", "void clear() {\n _whoseMove = WHITE;\n _gameOver = false;\n\n for (int i = 0; i <= MAX_INDEX; i += 1) {\n set(i, BLACK);\n }\n for (int i : _initWhite) {\n set(i, WHITE);\n }\n set(12, EMPTY);\n _history.clear();\n\n setInitialDirection(MAX_INDEX);\n\n setChanged();\n notifyObservers();\n }", "ArrayList<ArrayList<GamePiece>> makeBoard() {\n ArrayList<ArrayList<GamePiece>> row = new ArrayList<ArrayList<GamePiece>>();\n for (int i = 0; i < this.width; i++) {\n ArrayList<GamePiece> column = new ArrayList<GamePiece>();\n for (int j = 0; j < this.height; j++) {\n GamePiece temp = new GamePiece(i, j);\n column.add(temp);\n nodes.add(temp);\n }\n row.add(column);\n }\n return row;\n }", "public GameBoard(){\r\n\t\tboard = new Box[boardSize];\r\n\t\tfor(int i = 0; i < boardSize; i++){\r\n\t\t\tboard[i] = Box.EMPTY;\r\n\t\t}\r\n\t}", "public void findBlank () {\n // blank position\n for (int r = 0; r < rows; r++) {\n for (int c = 0; c < columns; c++) {\n if (this.currentState[r][c] == blank) {\n setBlankCoordinates(new int[]{r, c});\n }\n }\n }\n }", "private void clearBoard() {\n for (int i = 0; i < BOARD_HEIGHT * BOARD_WIDTH; ++i) {\n board[i] = Tetrominoe.NoShape;\n }\n }", "public void fillBoard()\r\n {\r\n //fill 2d button array with the cells from bombList\r\n ListIterator itr = gameBoard.bombList.listIterator();\r\n for (int y = 0; y < gameBoard.BOARD_WIDTH; y++)\r\n {\r\n for (int x = 0; x < gameBoard.BOARD_WIDTH; x++)\r\n {\r\n if (itr.hasNext())\r\n {\r\n gameBoard.gameCells[y][x] = (Cell) itr.next();\r\n gameBoard.gameCells[y][x].setX(x);\r\n gameBoard.gameCells[y][x].setY(y);\r\n }\r\n }\r\n }\r\n// // **Debugging** print array to console\r\n// System.out.println(\"****** 2D Array Contents *******\");\r\n// for (int y = 0; y < gameBoard.BOARD_WIDTH; y++)\r\n// {\r\n// for (int x = 0; x < gameBoard.BOARD_WIDTH; x++)\r\n// {\r\n// System.out.print(gameBoard.gameCells[y][x].getText());\r\n// }\r\n// System.out.print(\"\\n\");\r\n// }\r\n\r\n // tell nearby spaces im a bomb\r\n for (int y = 0; y < gameBoard.BOARD_WIDTH; y++)\r\n {\r\n for (int x = 0; x < gameBoard.BOARD_WIDTH; x++)\r\n {\r\n if (gameBoard.gameCells[y][x].isBomb())\r\n {\r\n tellNearby(x, y);\r\n }\r\n }\r\n }\r\n }", "private static ArrayList<Point> getCurrentlyValidMoves(){\n ArrayList<Point> currentlyValidMoves = new ArrayList<Point>();\n //iterate through the gameboard, checking if the move is valid\n for( int row = 0; row < 8; row++ ){\n for( int column = 0; column < 8; column++ ){\n if( gamepieces[ row ][ column ] == BACKGROUND_COLOR && isMoveValid( row, column ) ){\n //if it is valid, add it to our list\n currentlyValidMoves.add( new Point( row, column ) );\n }\n }\n }\n return currentlyValidMoves;\n }", "public void clearTiles() {\r\n\r\n for (int i = 0; i < 16; i += 1) {\r\n tiles[i] = 0;\r\n }\r\n boardView.invalidate();\r\n placedShips = 0;\r\n }", "public void clearGrid() {\n\t\tfor (int i = 0; i < this.board.length; i++) {\n\t\t\tArrays.fill(this.board[i], EMPTY);\n\t\t}\n\n\t\tsetChanged();\n\t\tnotifyObservers();\n\t}", "Board() {\n clear();\n }", "Board() {\n clear();\n }", "public Iterable<Board> neighbors() {\n LinkedList<Board> states = new LinkedList<>();\n LinkedList<int[]> neighbors = neighborFinder();\n int[] curr_loc = blankFinder();\n\n for(int[] temp : neighbors){\n tiles[curr_loc[0]][curr_loc[1]] = tiles[temp[0]][temp[1]];\n tiles[temp[0]][temp[1]] = 0;\n states.add(new Board(deepCopy(tiles)));\n tiles[temp[0]][temp[1]] = tiles[curr_loc[0]][curr_loc[1]];\n tiles[curr_loc[0]][curr_loc[1]] = 0;\n\n }\n return states;\n }", "public void initializeBoard() {\r\n int x;\r\n int y;\r\n\r\n this.loc = this.userColors();\r\n\r\n this.board = new ArrayList<ACell>();\r\n\r\n for (y = -1; y < this.blocks + 1; y += 1) {\r\n for (x = -1; x < this.blocks + 1; x += 1) {\r\n ACell nextCell;\r\n\r\n if (x == -1 || x == this.blocks || y == -1 || y == this.blocks) {\r\n nextCell = new EndCell(x, y);\r\n } else {\r\n nextCell = new Cell(x, y, this.randColor(), false);\r\n }\r\n if (x == 0 && y == 0) {\r\n nextCell.flood();\r\n }\r\n this.board.add(nextCell);\r\n }\r\n }\r\n this.stitchCells();\r\n this.indexHelp(0, 0).floodInitStarter();\r\n }", "public void cleanBoard(){\n\n for(PositionInBoard position : positionsThatArePainted){\n int i = position.row();\n int j = position.column();\n if ((i+j)%2==0) {\n board[i][j].setBackground(Color.BLACK);\n }\n else {\n board[i][j].setBackground(Color.WHITE);\n }\n\n board[i][j].setText(null);\n board[i][j].setIcon(null);\n }\n positionsThatArePainted.clear();\n }", "private boolean isBoardFilled() {\n for (char[] y : board) {\n for (char xy : y) {\n if (xy == 0) {\n return false;\n }\n }\n }\n return true;\n }", "@Test\n public void emptyBoard() {\n Board b = new Board();\n for (int c = 0; c < b.SIZE; c += 1) {\n for (int r = 0; r < b.SIZE; r += 1) {\n assertEquals(EMPTY, b.get(c, r));\n }\n }\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 }", "@Override\n\tpublic void reset() {\n\t\tfor (int i = 0; i < _board.length; i++)\n for (int j = 0; j < _board[i].length; j++)\n \t_board[i][j] = null;\n\n\t\t_columnFull = new HashSet<Integer>();\n\t\t_lastPosition = new HashMap<Integer,Integer>();\n\t}", "@Override\n public Iterable<WorldState> neighbors() {\n Queue<WorldState> neighbor = new ArrayDeque<>();\n int xDim = 0, yDim = 0;\n int[][] tiles = new int[_N][_N];\n\n for (int i = 0; i < _N; i++) {\n for (int j = 0; j < _N; j++) {\n tiles[i][j] = _tiles[i][j];\n if (_tiles[i][j] == 0) {\n xDim = i;\n yDim = j;\n }\n }\n }\n\n for (int i = 0; i < _N; i++) {\n for (int j = 0; j < _N; j++) {\n if (Math.abs(i - xDim) + Math.abs(j - yDim) == 1) {\n tiles[i][j] = _tiles[xDim][yDim];\n tiles[xDim][yDim] = _tiles[i][j];\n neighbor.add(new Board(tiles));\n // System.out.println(new Board(tiles));\n tiles[xDim][yDim] = _tiles[xDim][yDim];\n tiles[i][j] = _tiles[i][j];\n }\n }\n }\n return neighbor;\n }", "private static ArrayList<Position> possibleMovesInEmptySpaces(ItalianBoard board, int posR, int posC) {\n ArrayList<Position> possibleMovementList = new ArrayList<>();\n\n try {\n if (board.getBoard()[posR - 1][posC - 1].getPlace() == PlaceType.EMPTY)//up left\n possibleMovementList.add(new Position(posR - 1, posC - 1));\n } catch (ArrayIndexOutOfBoundsException ignored) {\n }\n\n try {\n if (board.getBoard()[posR - 1][posC + 1].getPlace() == PlaceType.EMPTY)//up right\n possibleMovementList.add(new Position(posR - 1, posC + 1));\n } catch (ArrayIndexOutOfBoundsException ignored) {\n }\n\n if (board.getBoard()[posR][posC].getPiece() == PieceType.KING) {\n try {\n if (board.getBoard()[posR + 1][posC - 1].getPlace() == PlaceType.EMPTY)//down left\n possibleMovementList.add(new Position(posR + 1, posC - 1));\n } catch (ArrayIndexOutOfBoundsException ignored) {\n }\n\n try {\n if (board.getBoard()[posR + 1][posC + 1].getPlace() == PlaceType.EMPTY)//down right\n possibleMovementList.add(new Position(posR + 1, posC + 1));\n } catch (ArrayIndexOutOfBoundsException ignored) {\n }\n }\n return possibleMovementList;\n }", "public Vector<ChessBoardBlock> getReputablePosition() {\r\n\t\tVector<ChessBoardBlock> tmp = new Vector<ChessBoardBlock>();\r\n\t\t\r\n\t\tfor (int i=0; i<8*8; i++) {\r\n\t\t\tif (piece.get(order[i]).chessPlayer.equals(\"empty\") && board.get(order[i]).bgColor.equals(\"red\")) {\r\n\t\t\t\tboard.get(order[i]).setBorder(null);\r\n\t\t\t\ttmp.add(board.get(order[i]));\r\n\t\t\t} else {\r\n\t\t\t\tboard.get(order[i]).setEnabled(false);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn tmp;\r\n\t}", "private boolean isBoardEmpty() {\n for (int i = 0; i < 3; i++) {\n for (int j = 0; j < 3; j++) {\n if (board[i][j].equals(\" \"))\n return false;\n }\n }\n return true;\n }", "public void resetBoard(){\n totalmoves = 0;\n this.board = new Cell[3][3];\n //fill the board with \"-\"\n for (int i = 0; i < 3; i++) {\n for (int j = 0; j < 3; j++) {\n this.board[i][j]=new Cell(new Coordinates(i,j), \"-\");\n }\n }\n }", "private static void createEmptyBoard()\n {\n for (int index = 1; index < board.length; index++)\n {\n board[index] = ' ';\n }\n }", "public boolean isBoardFull() {\n\t\t// REPLACE NEXT LINE WITH YOUR IMPLEMENTATION\n\t\tint boardSize = getBoardSize();\n\t\t\n\t\tfor (int i = 0; i < boardSize; i++) {\n\t\t\t\n\t\t\tfor (int j = 0; j < boardSize; j++) {\n\t\t\t\t\n\t\t\t\tif (isSpotBlank(i,j)) {\n\t\t\t\t\t\n\t\t\t\t\treturn false;\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\treturn true;\n\t\t\n\t}", "private ArrayList<GridPiece> getDirectNeighbors(GridPiece piece) {\n neighbors.clear();\n\n //Top\n if (game.gridMap.size() > piece.row + 1) {\n neighbors.add(game.gridMap.get(piece.row + 1).get(piece.column));\n }\n //Bottom\n if (piece.row > 0) {\n neighbors.add(game.gridMap.get(piece.row - 1).get(piece.column));\n }\n\n //Right\n if (game.gridMap.get(0).size() > piece.column + 1) {\n neighbors.add(game.gridMap.get(piece.row).get(piece.column + 1));\n }\n\n //Left\n if (piece.column > 0) {\n neighbors.add(game.gridMap.get(piece.row).get(piece.column - 1));\n }\n\n return neighbors;\n }", "public ArrayList<Point> moves() {\n\t\tmoves = new ArrayList<Point>();\n\t\tif (point.x > 0 && board.pieceAt(point.x - 1, point.y) == null)\n\t\t\tmoves.add(board.left(point));\n\t\tif (point.x < board.getXDim() - 1 && board.pieceAt(point.x + 1, point.y) == null)\n\t\t\tmoves.add(board.right(point));\n\t\tif (point.y > 0 && board.pieceAt(point.x, point.y - 1) == null)\n\t\t\tmoves.add(board.above(point));\n\t\tif (point.y < board.getYDim() - 1 && board.pieceAt(point.x, point.y + 1) == null)\n\t\t\tmoves.add(board.below(point));\n\t\treturn (ArrayList<Point>) moves.clone();\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 ArrayList<Integer> setUnvisitedNeighbors(int currentIndex) {\n\t\t\n\t\tint row = currentIndex / width;\t\t\t\t\t\t\t\t\t\t\t\t//number of row\n\t\tint column = currentIndex % width;\t\t\t\t\t\t\t\t\t\t\t//number of column\n\t\t\n\t\tArrayList<Integer> neighbors = new ArrayList<Integer>();\n\t\t\n\t\tif(row != 0 && !cells[currentIndex - width].visited ) {\t\t\t\t\t\t// cell has upper neighbor\n\t\t\tint upperIndex = ((row - 1) * width) + column;\n\t\t\tneighbors.add(upperIndex);\n\t\t}\n\t\tif(row != height - 1 && !cells[currentIndex + width].visited ) {\t\t\t//cell has lower neighbor\n\t\t\tint lowerIndex = ((row + 1) * width) + column;\n\t\t\tneighbors.add(lowerIndex);\n\t\t}\n\t\tif(column != 0 && !cells[currentIndex - 1].visited) {\t\t\t\t\t\t//cell has left neighbor\n\t\t\tint leftIndex = currentIndex - 1;\n\t\t\tneighbors.add(leftIndex);\n\t\t}\n\t\tif(column != width - 1 && !cells[currentIndex + 1].visited) {\t\t\t\t//cell has right neighbor\n\t\t\tint rightIndex = currentIndex + 1;\n\t\t\tneighbors.add(rightIndex);\n\t\t}\n\t\treturn neighbors;\n\t}", "public void renderBoard(){\n for (int k = 0; k < grid.length; k++)\n for (int m = 0; m < grid[k].length; m++)\n grid[k][m] = 0;\n\n // fill the 2D array using information for non-empty tiles\n for (Cell c : game.getNonEmptyTiles())\n grid[c.getRow()][c.getCol()] = c.getValue();\n }", "public void clearBoardData()\n {\n player_turn = RED;\n total_moves = 0;\n int[][] clear_board = new int[7][6];\n for (int i = 0; i < clear_board.length; i++)\n current_board[i] = clear_board[i].clone();\n }", "public void reset() {\n for (int r = 0; r < size; r++) {\n for (int c = 0; c < size; c++) {\n board[r][c] = null;\n }\n }\n }", "public void getPossibleMoves() { \n\t\t\tsuper.getPossibleMoves();\n\t\t\tfor (int i = 0; i < Math.abs(xrange); i++) {\n\t\t\t\tif (currentx + xrange - ((int) Math.pow(-1,color)*i) >= 0) { \n\t\t\t\t\tGameWindow.potentialMoves.add(GameWindow.GridCells[currentx + xrange - ((int) Math.pow(-1,color)*i) ][currenty]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( currentx - 1 >= 0 && currenty - 1 >= 0 &&\n\t\t\t\t\tGameWindow.GridCells[currentx + ((int) Math.pow(-1,color)) ][currenty - 1].isOccupiedByOpponent()) {\t// Diagonol left space occupied\n\t\t\t\tGameWindow.potentialMoves.add(GameWindow.GridCells[currentx + ((int) Math.pow(-1,color)) ][currenty - 1]);\n\t\t\t}\n\t\t\tif (currentx - 1 >= 0 && currenty + 1 <= 7 &&\n\t\t\t\t\tGameWindow.GridCells[currentx + ((int) Math.pow(-1,color)) ][currenty + 1].isOccupiedByOpponent()) { \t//Diagonol right space occupied\n\t\t\t\tGameWindow.potentialMoves.add(GameWindow.GridCells[currentx + ((int) Math.pow(-1,color)) ][currenty + 1]);\n\t\t\t}\n\t\t\t\n\t}", "public List<Move> getAvailableSpaces() {\n List<Move> availableMoves = new ArrayList<>();\n for (int i = 0; i < LENGTH; i++) {\n for (int j = 0; j < LENGTH; j++) {\n Move move = new Move(i, j);\n if (isValidMove(move)) {\n availableMoves.add(move);\n }\n }\n }\n return availableMoves;\n }", "public CheckerBoard(){\n mCheckerBoard = new ArrayList<>(64);\n }", "public GameBoard() {\r\n boards = new ArrayList<GameBoard>();\r\n }", "public List<Integer> getLegalMoves()\n\t{\n\t\tArrayList<Integer> moves = new ArrayList<Integer>();\n\t\tfor (int col = 0; col < cols; col++)\n\t\t{\n\t\t\tif (isEmpty(0,col))\n\t\t\t\tmoves.add(col);\n\t\t}\n\t\treturn moves;\n\t}", "ArrayList<Move> legalMoves() {\n ArrayList<Move> result = new ArrayList<Move>();\n int f, b;\n Move m;\n for (int i = 1; i < 8; i++) {\n for (int j = 1; j < 8; j++) {\n if (get(i,j).side() == _turn) {\n f = forward(j, i);\n b = backward(j, i);\n c = _col[j];\n r = _row[i];\n m = Move.create(j, i, j - b, i - b);\n addMove(result, m);\n m = Move.create(j, i, j + b, i + b);\n addMove(result, m);\n m = Move.create(j, i, j + f, i - f);\n addMove(result, m);\n m = Move.create(j, i, j - f, i + f);\n addMove(result, m);\n m = Move.create(j, i, j + c, i);\n addMove(result, m);\n m = Move.create(j, i, j - c, i);\n addMove(result, m);\n m = Move.create(j, i, j, i + r);\n addMove(result, m);\n m = Move.create(j, i, j, i - r);\n addMove(result, m);\n } else {\n continue;\n }\n }\n }\n return result;\n }", "public void clear() {\r\n //This for loop assigns every value in the gameBoard array to -1\r\n //Using the Arrays.fill method and the for loop it fills in all sub arrays\r\n for (int i = 0; i < gameBoard.length; i++) {\r\n Arrays.fill(gameBoard[i], -1);\r\n }\r\n }", "public List<Grid> getPossibleMoves(Grid g){\n\t\tint i=g.row, j=g.col;\n\t\tif(i>=0 && i<data.length && j>=0 && j<data[i].length){\n\t\t\tList<Grid> list=new ArrayList<>();\n\t\t\tif(isFree(i, j-1)) list.add(new Grid(i,j-1));\n\t\t\tif(isFree(i-1, j-1)) list.add(new Grid(i-1,j-1));\n\t\t\tif(isFree(i-1, j)) list.add(new Grid(i-1,j));\n\t\t\tif(isFree(i-1, j+1)) list.add(new Grid(i-1,j+1));\n\t\t\tif(isFree(i, j+1)) list.add(new Grid(i,j+1));\n\t\t\tif(isFree(i+1, j+1)) list.add(new Grid(i+1,j+1));\n\t\t\tif(isFree(i+1, j)) list.add(new Grid(i+1,j));\n\t\t\tif(isFree(i+1, j-1)) list.add(new Grid(i+1,j-1));\n\t\t\treturn list;\n\t\t}\n\t\treturn null;\n\t}", "@Override\n public void reset() {\n emptyBoard();\n drawNewTiles();\n \n moves = Assistant.WordPlay.boardFindall(board, rack, masterDictionary());\n }", "public List<Piece> blackPieces();", "public static SquareBoard getEmptyBoard() {\n\n\t\tSquareBoard emptyBoard = new SquareBoard(BOARD_SIZE);\n\t\t\n\t\treturn emptyBoard;\n\t}", "public List<Cell> getFlaggedCells() {\n List<Cell> gameBoard = new ArrayList<Cell>();\n List<Cell> flaggedCells = new ArrayList<Cell>();\n for (Cell cell : gameBoard)\n if (cell.isFlagged())\n flaggedCells.add(cell);\n return flaggedCells;\n }", "public Iterable<Board> neighbors() {\n int emptyRow = -1; // Row of the empty tile\n int emptyCol = -1; // Column of the empty tile\n\n // Iterate through each tile in the board, searching for empty tile\n search:\n for (int row = 0; row < N; row++) // For each row in the board\n for (int col = 0; col < N; col++) // For each column in the row\n if (tiles[row][col] == 0) { // If the current tile is empty (value of 0)\n emptyRow = row; // Store the row of the empty tile\n emptyCol = col; // Store the column of the empty tile\n break search; // Break from search\n }\n\n Stack<Board> neighbors = new Stack<Board>(); // Initialize a stack of neighboring board states\n\n if (emptyRow - 1 >= 0) // If there is a row of tiles above the empty tile\n neighbors.push(swap(emptyRow, emptyCol, emptyRow - 1, emptyCol)); // Swap empty tile with the above adjacent tile and add to neighbors stack\n\n if (emptyRow + 1 < N) // If there is a row of tiles below the empty tile\n neighbors.push(swap(emptyRow, emptyCol, emptyRow + 1, emptyCol)); // Swap empty tile with the below adjacent tile and add to neighbors stack\n\n if (emptyCol - 1 >= 0) // If there is a column of tiles to the left of the empty tile\n neighbors.push(swap(emptyRow, emptyCol, emptyRow, emptyCol - 1)); // Swap empty tile with the left adjacent tile and add to neighbors stack\n\n if (emptyCol + 1 < N) // If there is a column of tiles to the right of the empty tile\n neighbors.push(swap(emptyRow, emptyCol, emptyRow, emptyCol + 1)); // Swap empty tile with the right adjacent tile and add to neighbors stack\n\n return neighbors; // Return iterable stack of neighboring board states\n }", "public String[][] getBoard() {\n ArrayList<Point<Integer,Integer>> bomb_positions = new ArrayList<>(this.NUMBOMBS);\n\n int size=0;\n while ( size < this.NUMBOMBS) {\n int x=(int)Math.floor(Math.random()*this.SIZE);\n int y=(int)Math.floor(Math.random()*this.SIZE);\n if (!bomb_positions.contains(new Point<>(x,y))) {\n bomb_positions.add(new Point<>(x,y));\n size++;\n }\n }\n // [ , , , ]\n // [ ,cnrXY, , ]\n // [ , ,Bomb, ]\n // [ , , , ]\n for (Point<Integer,Integer> bomb:\n bomb_positions) {\n int cornerX = bomb.getX()-1;\n int cornerY= bomb.getY()-1;\n for (int i = cornerX; i < cornerX+3 ; i++) {\n for (int j = cornerY; j < cornerY+3; j++) {\n if(i>=0 && i<SIZE && j>=0 && j< SIZE){\n if ((new Point<>(i,j)).equals(bomb)){\n board[i][j]=\"B\";\n }else {\n if (!board[i][j].equals(\"B\") && board[i][j].equals(\" \")){\n board[i][j] = \"1\";\n }else if (!board[i][j].equals(\"B\") && !board[i][j].equals(\" \")){\n int n = Integer.parseInt(board[i][j]);\n n=n+1;\n board[i][j] = String.valueOf(n);\n }\n }\n\n }\n }\n }\n }\n return board;\n }", "private ArrayList<Coordinates> freeMoves(Maze maze) {\n\t\tArrayList<Coordinates> dirs = new ArrayList<>();\n\n\t\tfor (int x = -1; x <= 1; x++) {\n\t\t\tfor (int y = -1; y <= 1; y++) {\n\t\t\t\tif (x == 0 ^ y == 0) {\n\t\t\t\t\tCoordinates move = find().add(x, y);\n\t\t\t\t\tif (!maze.outOfRange(move)) {\n\t\t\t\t\t\tif (!maze.getMCell(move).wall()) {\n\t\t\t\t\t\t\tdirs.add(new Coordinates(x, y));\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\treturn dirs;\n\t}", "public void blank() {\r\n\t\trunning = false;// sets the simulation to stopped\r\n\t\tfor (int i = 0; i < TOTAL_TILES; i++)// loops through all tiles\r\n\t\t\tnodes[i] = new Node(new Point(i / WIDTH_TILES * SIZE_TILES, i % HEIGHT_TILES * SIZE_TILES), new ImageIcon(\"empty.png\").getImage(), false, \"empty\");// sets empty tile\r\n\t}", "private int clearLines() {\n\t\tint numGarbageLines = 0;\n\t\tArrayList<Integer> linesToShift = new ArrayList<Integer>();\n\t\tfor (int r = 0; r < matrixHeight; r++) {\n\t\t\tif (isLineFull(r)) {\n\t\t\t\tif (isGarbageLine(r)) {\n\t\t\t\t\tnumGarbageLines++;\n\t\t\t\t}\n\t\t\t\tlinesToShift.add(r);\n\t\t\t\tnumLinesCleared++;\n\t\t\t\tfor (int c = 0; c < matrixWidth; c++) {\n\t\t\t\t\tboardTiles[r][c] = backgroundColor;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (Integer removedRow : linesToShift) {\n\t\t\tshiftDownBoard(removedRow);\n\t\t}\n\t\tupdateView();\n\t\treturn linesToShift.size() - numGarbageLines;\n\t}", "public ArrayList<Move> availableMoves() {\n if (getColour() == PieceCode.WHITE)\n return whiteKing();\n else\n return blackKing();\n }", "public void makeEmpty() {\n // remove Squares until empty\n while (!exploreList.isEmpty()) {\n exploreList.getNext();\n }\n }", "public void resetBoard(){\r\n for(int i = 0;i<6;i++){ //empty board \r\n for (int j = 0; j < 7; j++) {\r\n boardRep[i][j] = 0;\r\n }\r\n }\r\n \r\n for (int i = 0; i < 7; i++) { // set column heights to 0\r\n currentFilled[i] = 0;\r\n }\r\n \r\n blackToPlay = true; //black goes first for now\r\n refreshDisplay(); \r\n \r\n }", "public void clearPieces(){\n for(int i =0; i<WIDTH;i++){\n for(int j = 0 ; j<HEIGHT;j++){\n piecesToSwap[i][j]=null;\n }\n }\n }", "public void fillBoard() {\n List<Integer> fifteen = ArrayUtils.intArrayToList(SOLVED_BOARD);\n Collections.shuffle(fifteen, this.random);\n this.emptyTileIndex = fifteen.indexOf(0);\n this.matrix = fifteen.stream().mapToInt(i -> i).toArray();\n }", "public List<Tile> getNeighbors() {\n List<Tile> list = new ArrayList<Tile>();\n\n if (this.tileNorth != null) {\n list.add(this.tileNorth);\n }\n\n if (this.tileEast != null) {\n list.add(this.tileEast);\n }\n\n if (this.tileSouth != null) {\n list.add(this.tileSouth);\n }\n\n if (this.tileWest != null) {\n list.add(this.tileWest);\n }\n\n return list;\n }", "@Override\r\n\t\t\tpublic boolean isFull() {\r\n\t\t\t\tfor(int row = 0; row +1< 6; row++) {\r\n\t\t\t\t\tfor(int col = 0; col < 7; col++) {\r\n\t\t\t\t\t\tString brick = board[row][col].getText().trim();\r\n\t\t\t\t\t\tif(brick.isEmpty()){\r\n\t\t\t\t\t\t\treturn false;\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\treturn true;\r\n\t\t\t}", "public void initializeDebugBoard() {\n\t\tboolean hasNotMoved = false;\n\t\tboolean hasMoved = true;\n\t\tboolean white = true;\n\t\tboolean black = false;\n\n\t\t// Set empty rows\n\t\tfor (int row = 0; row < 8; row++)\n\t\t\tfor (int col = 0; col < 8; col++)\n\t\t\t\tboard[row][col] = null;\n\n\t\tboard[5][4] = new Piece('k', white, hasMoved, 5, 4, PieceArray.E_kingId);\n//\t\tboard[1][4] = new Piece(\"rook\", white, hasMoved, 1, 4);\n\t\tboard[2][2] = new Piece('q', black, hasMoved, 2, 2, PieceArray.A_rookId);\n//\t\tboard[3][2] = new Piece('q', black, hasMoved, 3, 2, PieceArray.H_rookId);\n\t\t\n\n\t\tboard[0][0] = new Piece('k', black, hasMoved, 0, 0, PieceArray.E_kingId);\n//\t\tboard[7][7] = new Piece('r', black, hasNotMoved, 7, 7, PieceArray.A_rookId);\n//\t\tboard[6][7] = new Piece('p', black, hasNotMoved, 6, 7, PieceArray.A_pawnId);\n//\t\tboard[6][6] = new Piece('p', black, hasNotMoved, 6, 6, PieceArray.B_pawnId);\n//\t\tboard[6][5] = new Piece('p', black, hasNotMoved, 6, 5, PieceArray.C_pawnId);\n//\t\tboard[6][4] = new Piece('p', black, hasNotMoved, 6, 4, PieceArray.D_pawnId);\n\t\n//\t\tboard[6][6] = new Piece(\"pawn\", black, hasMoved, 6, 6);\n//\t\tboard[6][7] = new Piece(\"pawn\", black, hasMoved, 6, 7);\n//\t\tboard[6][4] = new Piece(\"pawn\", black, hasMoved, 6, 4);\n//\t\t\t\n//\t\t\n//\t\tboard[4][4] = new Piece(\"pawn\", black, hasMoved, 4,4);\n//\t\tboard[3][5] = new Piece(\"rook\", white,hasMoved,3,5);\n//\t\tboard[1][7] = new Piece(\"pawn\",black,hasMoved,1,7);\n\n\t}", "public ArrayList<FloorTile> getFixedTilesFromBoard() {\r\n ArrayList<FloorTile> fixedTiles = new ArrayList<FloorTile>();\r\n for(int i = 0; i < board.length; i++) {\r\n for (int j = 0; j < board[i].length; j++) {\r\n if (board[i][j].isFixedTile()) {\r\n fixedTiles.add(board[i][j]);\r\n }\r\n }\r\n }\r\n\r\n return fixedTiles;\r\n }", "public String toString(){\n\t\tString board = \"\";\n\t\tfor(int i = 0; i < rows; i++){\n\t\t\tfor(int j = 0; j < columns; j++){\n\t\t\t\tif(theGrid[i][j]){ //iterate through, if cell is alive, mark with *\n\t\t\t\t\tboard += \"*\";\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tboard += \" \"; //else, [space]\n\t\t\t\t}\n\t\t\t}\n\t\t\tboard += \"\\n\";//create a new line, to create the board\n\t\t}\n\t\treturn board; //return the board\n\t}", "private ArrayList<GameSquare> getAdjacentSquares()\n {\n ArrayList<GameSquare> list = new ArrayList<GameSquare>();\n for (int r = row - 1; r <= row + 1; r++)\n {\n if (r >= 0 && r < grid.length)\n {\n for (int c = col - 1; c <= col + 1; c++)\n {\n if (c >= 0 && c < grid[0].length)\n {\n list.add(grid[r][c]);\n }\n }\n }\n }\n return list;\n }", "private static Boolean isFilled() \n\t{\n\t\tfor(Cells[] cellList : board)\n\t\t{\n\t\t\tfor(Cells cell : cellList)\n\t\t\t{\n\t\t\t\tif(cell==Cells.VOID)\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "private List<Collection<Pixel>> holeFinder() {\n\n\t\tList<Pixel> holePixels = new LinkedList<Pixel>();\n\t\tList<Pixel> boundaryPixels = new LinkedList<Pixel>();\n\t\tQueue<Pixel> bfsQueue = new LinkedList<Pixel>();\n\t\tboolean[][] marked = new boolean[mRows][mCols];\n\n\t\tPixel pixel = findFirstHolePixel();\n\t\tbfsQueue.add(pixel);\n\t\tholePixels.add(pixel);\n\t\tmarked[pixel.getRow()][pixel.getCol()] = true;\n\n\t\twhile (!bfsQueue.isEmpty()) {\n\t\t\tPixel currentPixel = bfsQueue.remove();\n\n\t\t\tList<Pixel> connectedPixels = mConnections.getConnections(currentPixel);\n\n\t\t\t// iterates on the pixels who are connected to current pixel\n\t\t\t// if the pixel was already visited skip it\n\t\t\t// else, if the pixel is a hole add it to the list of the holes and to the BFS Queue to expand the hole\n\t\t\t// \t\t else add it to the result list, the pixel belongs to the boundary\n\t\t\tfor (Pixel p : connectedPixels) {\n\t\t\t\tint indexRow = p.getRow();\n\t\t\t\tint indexCol = p.getCol();\n\n\t\t\t\tif (!marked[indexRow][indexCol]) {\n\t\t\t\t\tmarked[indexRow][indexCol] = true;\n\n\t\t\t\t\tif (mImage[indexRow][indexCol] == HOLE) {\n\t\t\t\t\t\tholePixels.add(p);\n\t\t\t\t\t\tbfsQueue.add(p);\n\t\t\t\t\t}\n\n\t\t\t\t\telse {\n\t\t\t\t\t\tp.setColor(mImage[p.getRow()][p.getCol()]);\n\t\t\t\t\t\tboundaryPixels.add(p);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tList<Collection<Pixel>> result = new LinkedList<Collection<Pixel>>();\n\t\tresult.add(boundaryPixels);\n\t\tresult.add(holePixels);\n\t\treturn result;\n\t}", "private List<Box> initBoxes(List<Integer> deadBoxes){\n List<Box> boxes = new ArrayList<>();\n\n for(int x=0;x<16;x++){\n boxes.add(new Box(x + 1, grid[x]));\n }\n\n\n /**\n * 1 2 3 4\n * 5 6 7 8\n * 9 10 11 12\n * 13 14 15 16\n */\n\n //first row\n addNeighbours(1, new int[]{2,5,6}, boxes);\n addNeighbours(2,new int[]{1,3,5,6,7}, boxes);\n addNeighbours(3,new int[]{2,4,6,7,8}, boxes);\n addNeighbours(4,new int[]{3,7,8}, boxes);\n addNeighbours(5,new int[]{1,2,6,9,10}, boxes);\n addNeighbours(6,new int[]{1,2,3,5,7,9,10,11}, boxes);\n addNeighbours(7,new int[]{2,3,4,6,8,10,11,12}, boxes);\n addNeighbours(8,new int[]{3,4,7,11,12}, boxes);\n addNeighbours(9,new int[]{5,6,10,13,14}, boxes);\n addNeighbours(10,new int[]{5,6,7,9,11,13,14,15}, boxes);\n addNeighbours(11,new int[]{6,7,8,10,12,14,15,16}, boxes);\n addNeighbours(12,new int[]{7,8,11,15,16}, boxes);\n addNeighbours(13,new int[]{9,10,14}, boxes);\n addNeighbours(14,new int[]{9,10,11,13,15}, boxes);\n addNeighbours(15,new int[]{10,11,12,14,16}, boxes);\n addNeighbours(16,new int[]{11,12,15}, boxes);\n\n return removeBoxes(boxes,deadBoxes);\n }", "public ArrayList<ArrayList<Move>> getMoves(int color){//TODO\n \tArrayList<ArrayList<Move>> moves = new ArrayList<ArrayList<Move>>();\n \tboolean jumpsExist = false;\n \t//look for jumps\n \t//search the board for pieces of your color\n for (int i=0; i<8; i++){\n \tfor(int j=0; j<8; j++){\n \t\t//if the piece is the right color\n \t\tif ((gameState.getStateOfSquare(i, j) != 0)&&(gameState.getStateOfSquare(i, j)%2 == color)){\n// \t\t\tSystem.out.println(\"found a piece you own\");\n \t\t\t//find all jumps of that piece\n \t\t\t//get jumps\n \t\t\tArrayList<ArrayList<Move>> jumps = getJumps(color, i, j);\n \t\t\t//if there are jumps return only the jumps\n \t\t\tif (jumps.isEmpty() == false){\n \t\t\t\tmoves.addAll(jumps);\n \t\t\t\tjumpsExist = true;\n \t\t\t}\n \t\t}\n \t}\n }\n if (jumpsExist == false){\n\t //look for diagonals\n\t \t//search the board for pieces of your color\n\t for (int i=0; i<8; i++){\n\t \tfor(int j=0; j<8; j++){\n\t \t\t//if the piece is the right color\n\t \t\tif ((gameState.getStateOfSquare(i, j) != 0)&&(gameState.getStateOfSquare(i, j)%2 == color)){\n//\t \t\t\tSystem.out.println(\"found a piece you own\");\n\t \t\t\t//get diagonals\n\t \t\t\t//try up right\n\t \t\t\tMove tryMove = new Move(i,j,i+1,j+1);\n\t \t\t\tif (attemptMove(tryMove, color)){// if this move is valid add it to moves\n\t \t\t\t\taddMove(tryMove, moves);\n\t \t\t\t}\n\t \t\t\t//try up left\n\t \t\t\ttryMove = new Move(i,j,i-1,j+1);\n\t \t\t\tif (attemptMove(tryMove, color)){// if this move is valid add it to moves\n\t \t\t\t\taddMove(tryMove, moves);\n\t \t\t\t}\n\t \t\t\t//try down right\n\t \t\t\ttryMove = new Move(i,j,i+1,j-1);\n\t \t\t\tif (attemptMove(tryMove, color)){// if this move is valid add it to moves\n\t \t\t\t\taddMove(tryMove, moves);\n\t \t\t\t}\n\t \t\t\t//try down left\n\t \t\t\ttryMove = new Move(i,j,i-1,j-1);\n\t \t\t\tif (attemptMove(tryMove, color)){// if this move is valid add it to moves\n\t \t\t\t\taddMove(tryMove, moves);\n\t \t\t\t}\n\t \t\t\t}\n\t \t\t}\n\t }\n\t }\n if (moves.isEmpty() == true){\n \tnoMoves = true;\n }\n \t\t\t//\n \treturn moves;\n }", "private void clear() {\n for (int i = 0; i < NUMCELLS; i++)\n currentState[i] = 0;\n\n generations = 0;\n }", "private void updateClearedTiles() {\r\n int count = 0;\r\n for (int r = 0; r < gridSize; r++) {\r\n for (int c = 0; c < gridSize; c++) {\r\n if (!grid[r][c].isHidden() && !grid[r][c].isBomb()) {\r\n count++;\r\n }\r\n }\r\n }\r\n clearedTiles = count;\r\n }", "void drawCurrentToBoard () {\n board.clearTemp();\n for (int r = 0; r < currentPiece.height; ++r)\n for (int c = 0; c < currentPiece.width; ++c)\n if (currentPiece.blocks[r][c] == 1)\n board.addBlock(new Block(currentPiece.color), r + currentRow, c + currentColumn);\n }", "public void plantBombsInEmptyCells() {\n\t\tfor (int i = 0; i < r; i++) {\n\t\t\tfor (int j = 0; j < c; j++) {\n\t\t\t\tgrid[i][j] = ( grid[i][j] < 0 ? 0 : grid[i][j] );\n\t\t\t}\n\t\t}\n\t}", "public List<Piece> whitePieces();", "public LinkedList<Move> getPossibleMoves() {\n\t\tAIPossibleMoves.clear();\n\t\tint xOrigin = 0, yOrigin = 0, xMove1 = 0, xMove2 = 0, yMove1 = 0, yMove2 = 0;\n\t\tMove move = null;\t\n\t\t\tint type = 0;\n\t\t\tfor(Checker checker: model.whitePieces) {\n\t\t\t\t\n\t\t\t\txOrigin = checker.getCurrentXPosition();\n\t\t\t\tyOrigin = checker.getCurrentYPosition();\n\t\t\t\txMove1 = (checker.getCurrentXPosition() - 1);\n\t\t\t\txMove2 = (checker.getCurrentXPosition() + 1);\n\t\t\t\tyMove1 = (checker.getCurrentYPosition() - 1);\n\t\t\t\tyMove2 = (checker.getCurrentYPosition() + 1);\n\t\t\t\ttype = checker.getType();\n\t\t\t\tswitch(type) {\n\t\t\t\tcase 2:\n\n\t\t\t\t\tif((xMove1 < 0) || (yMove1 <0)) {\n\t\t\t\t\t//\tcontinue;\n\t\t\t\t\t} else {\n\t\t\t\t\tif(isMoveValid(xOrigin,yOrigin, xMove1, yMove1, false, false )) {\n\t\t\t\t\t\tif(!isSpaceTaken(xMove1,yMove1)) {\n\t\t\t\t\t\t\t//System.out.println(\"Space is not Taken\");\n\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove1, yMove1);\n\t\t\t\t\t\t\tAIPossibleMoves.add(move);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif(isPieceEnemy(xMove1,yMove1,checker,2)) {\n\t\t\t\t\t\t\t\tif(isJumpValid(xOrigin, yOrigin, xMove1, yMove1, false, false)) {\n\t\t\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove1, yMove1);\n\t\t\t\t\t\t\t\t\tAIPossibleMoves.add(move);\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\t}\n\t\t\t\t\t}\n \n\t\t\t\t\tif((xMove2 > 7) || (yMove1 < 0)) {\n\t\t\t\t\t//\tcontinue;\n\t\t\t\t\t} else {\n\t\t\t\t\n\t\t\t\t\tif(isMoveValid(xOrigin,yOrigin, xMove2, yMove1, true, false )) {\n\t\t\t\t\t\tif(!isSpaceTaken(xMove2,yMove1)) {\n\t\t\t\t\t\t\t// System.out.println(\"Space is not Taken\");\n\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove2, yMove1);\n\t\t\t\t\t\t\tAIPossibleMoves.add(move);\t\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif(isPieceEnemy(xMove2,yMove1,checker,2)) {\n\t\t\t\t\t\t\t\tif(isJumpValid(xOrigin, yOrigin, xMove2, yMove1, true, false)) {\n\t\t\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove2, yMove1);\n\t\t\t\t\t\t\t\t\tAIPossibleMoves.add(move);\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}\t\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase 4:\n\t\t\t\t\t//Moving up and left isMovingRight,IsMovingDown\n\t\t\t\t\tif((xMove1 <0) || (yMove1 < 0)) {\n\t\t\t\t\t\t//continue;\n\t\t\t\t\t} else {\n\t\t\t\t\tif(isMoveValid(xOrigin,yOrigin, xMove1, yMove1, false, false )) {\n\t\t\t\t\t\tif(!isSpaceTaken(xMove1,yMove1)) {\n\t\t\t\t\t\t//\tSystem.out.println(\"Space is not Taken\");\n\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove1, yMove1);\n\t\t\t\t\t\t\tAIPossibleMoves.add(move);\t\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif(isPieceEnemy(xMove1,yMove1,checker,2)) {\n\t\t\t\t\t\t\t\tif(isJumpValid(xOrigin, yOrigin, xMove1, yMove1, false, false)) {\n\t\t\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove1, yMove1);\n\t\t\t\t\t\t\t\t\tAIPossibleMoves.add(move);\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\n\t\t\t\tif((xMove2 > 7) || (yMove1 < 0)) {\n\t\t\t\t\t//continue;\n\t\t\t\t} else {\n\t\t\t\t\t//moving up and right\n\t\t\t\t\tif(isMoveValid(xOrigin,yOrigin, xMove2, yMove1, true, false )) {\n\t\t\t\t\t\tif(!isSpaceTaken(xMove2,yMove1)) {\n\t\t\t\t\t\t//\tSystem.out.println(\"Space is not Taken\");\n\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove2, yMove1);\n\t\t\t\t\t\t\tAIPossibleMoves.add(move);\t\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif(isPieceEnemy(xMove2,yMove1,checker,2)) {\n\t\t\t\t\t\t\t\tif(isJumpValid(xOrigin, yOrigin, xMove2, yMove1, true, false)) {\n\t\t\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove2, yMove1);\n\t\t\t\t\t\t\t\t\tAIPossibleMoves.add(move);\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}\n\t\t\t\t\n\t\t\t\tif((xMove1 < 0) || (yMove2 > 7)) {\n\t\t\t\t//\tcontinue;\n\t\t\t\t} else {\n\t\t\t\t\t//moving down and left isMovingRight,IsMovingDown\n\t\t\t\t\tif(isMoveValid(xOrigin,yOrigin, xMove1, yMove2, false, true )) {\n\t\t\t\t\t\tif(!isSpaceTaken(xMove1,yMove2)) {\n\t\t\t\t\t\t//\tSystem.out.println(\"Space is not Taken\");\n\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove1, yMove2);\n\t\t\t\t\t\t\tAIPossibleMoves.add(move);\t\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif(isPieceEnemy(xMove1,yMove2,checker,2)) {\n\t\t\t\t\t\t\t\tif(isJumpValid(xOrigin, yOrigin, xMove1, yMove2, false, true)) {\n\t\t\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove1, yMove2);\n\t\t\t\t\t\t\t\t\tAIPossibleMoves.add(move);\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}\n\t\t\t\t\n\t\t\t\tif((xMove2 > 7) || (yMove2 > 7)) {\n\t\t\t\t\t//continue;\n\t\t\t\t} else {\n\t\t\t\t\n\t\t\t\t\t//moving down and right isMovingRight,IsMovingDown\n\t\t\t\t\tif(isMoveValid(xOrigin,yOrigin, xMove2, yMove2, true, true )) {\n\t\t\t\t\t\tif(!isSpaceTaken(xMove2,yMove2)) {\n\t\t\t\t\t\t//\tSystem.out.println(\"Space is not Taken\");\n\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove2, yMove2);\n\t\t\t\t\t\t\tAIPossibleMoves.add(move);\t\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif(isPieceEnemy(xMove2,yMove2,checker,2)) {\n\t\t\t\t\t\t\t\tif(isJumpValid(xOrigin, yOrigin, xMove2, yMove2, true, true)) {\n\t\t\t\t\t\t\t\t\tmove = new Move(xOrigin, yOrigin, xMove2, yMove2);\n\t\t\t\t\t\t\t\t\tAIPossibleMoves.add(move);\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}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\tbreak;\t\n\t\t\t\t}\t\n\t\t\t\n\t\t\t}\n\n\t\t\treturn AIPossibleMoves;\n\t\t\t\n\t\t}", "public void initPieces() {\r\n\t\tfor (int i = 0; i < 64; i++) {\r\n\t\t\tif (i < 12) {\r\n\t\t\t\tblackPieces[i] = new ChessPiece(\"black\", \"\");\r\n\t\t\t\tblackPieces[i].setBackground(Color.BLACK);\r\n\t\t\t\tblackPieces[i].addMouseMotionListener(this);\r\n\t\t\t\tblackPieces[i].addMouseListener(this);\r\n\t\t\t\tblackPieces[i].setText(null);\r\n\t\t\t\twhitePieces[i] = new ChessPiece(\"white\", \"\");\r\n\t\t\t\twhitePieces[i].setBackground(Color.WHITE);\r\n\t\t\t\twhitePieces[i].addMouseMotionListener(this);\r\n\t\t\t\twhitePieces[i].addMouseListener(this);\r\n\t\t\t\twhitePieces[i].setText(null);\r\n\t\t\t}\r\n\t\t\tspacePieces[i] = new ChessPiece(\"empty\", \"\");\r\n\t\t\tspacePieces[i].setEnabled(false);\r\n\t\t\tspacePieces[i].setVisible(false);\r\n\t\t\tspacePieces[i].setText(null);\r\n\t\t}\r\n\t}", "private void fillBoardWithCells(){\n double posx = MyValues.HORIZONTAL_VALUE*0.5*MyValues.HEX_SCALE + MyValues.DIAGONAL_VALUE*MyValues.HEX_SCALE;\n double posy = 2*MyValues.DIAGONAL_VALUE*MyValues.HEX_SCALE ;\n HexCell startCell = new HexCell(0,0, this);\n startCell.changePosition(posx, posy);\n boardCells[0][0] = startCell;\n for (int i = 0; i< x-1; i++) {\n HexCell currentCell = new HexCell(i+1, 0, this);\n boardCells[i+1][0] = currentCell;\n //i mod 2 = 0: Bottom\n if (i % 2 == 0) {\n boardCells[i][0].placeHexCell(currentCell, MyValues.HEX_POSITION.BOT_RIGHT );\n } else {\n //i mod 2 =1: Top\n boardCells[i][0].placeHexCell(currentCell, MyValues.HEX_POSITION.TOP_RIGHT );\n }\n }\n for(int i = 0; i < x; i++){\n for(int j = 0; j < y-1; j++){\n HexCell currentCell = new HexCell(i, j+1, this);\n //System.out.println(Integer.toString(i) + Integer.toString(j));\n boardCells[i][j+1] = currentCell;\n boardCells[i][j].placeHexCell(currentCell, MyValues.HEX_POSITION.BOT);\n }\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}", "public static ArrayList<int[]> getEmptyCellCoords(int[][] grid) {\n\n ArrayList<int[]> emptyCells = new ArrayList<int[]>();\n for (int i = 0; i < grid.length; i++) {\n for (int j = 0; j < grid[0].length; j++) {\n if (grid[i][j] == 0) {\n int[] arr = {i, j};\n emptyCells.add(0, arr);\n }\n }\n }\n\n return emptyCells;\n }", "public static void clearBoard() {\n\t\tfor(int i = 0; i < display.length; i++){\n\t\t\tfor(int j = 0; j < display[i].length; j++){\n\t\t\t\tdisplay[i][j].setSelected(false);\n\t\t\t\tdisplay[i][j].setIcon(DEFAULT);\n\t\t\t}\n\t\t}\t\n\t\t\n\t}", "public void clearTiles() {\n \tfor (int x = 0; x < (mAbsoluteTileCount.getX()); x++) {\n for (int y = 0; y < (mAbsoluteTileCount.getY()); y++) {\n setTile(0, x, y);\n }\n }\n }", "public List<GameBoard> getBoardList() {\r\n return new ArrayList<GameBoard>(this.boards);\r\n }", "public Board() {\n\t\tthis.table = new int[Constants.SIZE][Constants.SIZE];\n\t\tthis.P1Movable = new boolean[Constants.SIZE][Constants.SIZE];\n\t\tthis.P2Movable = new boolean[Constants.SIZE][Constants.SIZE];\n\t\tP1turn = true;\n\t\tnumPieces = 0;\n\t\t\n\t\tfor(int i=0; i<table.length; i++) {\n\t\t\tfor(int j=0; j<table[i].length; j++) {\n\t\t\t\ttable[i][j] = Constants.EMPTY;\n\t\t\t\tP1Movable[i][j] = true;\n\t\t\t\tP2Movable[i][j] = true;\n\t\t\t}\n\t\t}\n\t\t\n\t}", "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 clearZeros(GridElement original){\n\t\tStack<GridElement> zerosToClear = new Stack<>();\n\t\tzerosToClear.push(original);\n\t\t\n\t\twhile(!zerosToClear.isEmpty()){\n\t\t\tGridElement temp = zerosToClear.pop();\n\t\t\tint x = temp.getxPosition();\n\t\t\tint y = temp.getyPosition();\n\t\t\t\n\t\t\t//up left\n\t\t\tif (x > 0 && y > 0){\n\t\t\t\tJButton upLeftButton = grid[x-1][y-1].getButton();\n\t\t\t\tupLeftButton.setText(neighborCounts[x-1][y-1] + \"\");\n\t\t\t\thandleButton(upLeftButton);\n\t\t\t\tif(neighborCounts[x-1][y-1] == 0 && upLeftButton.isEnabled()){\n\t\t\t\t\tzerosToClear.push(grid[x-1][y-1]);\n\t\t\t\t}\n\t\t\t\tupLeftButton.setEnabled(false);\n\t\t\t}\n\t\t\t//up\n\t\t\tif (y > 0){\n\t\t\t\tJButton upButton = grid[x][y-1].getButton();\n\t\t\t\tupButton.setText(neighborCounts[x][y-1] + \"\");\n\t\t\t\thandleButton(upButton);\n\t\t\t\tif(neighborCounts[x][y-1] == 0 && upButton.isEnabled()){\n\t\t\t\t\tzerosToClear.push(grid[x][y-1]);\n\t\t\t\t}\n\t\t\t\tupButton.setEnabled(false);\n\t\t\t}\n\t\t\t//up right\n\t\t\tif (x < width-1 && y > 0){\n\t\t\t\tJButton upRightButton = grid[x+1][y-1].getButton();\n\t\t\t\tupRightButton.setText(neighborCounts[x+1][y-1] + \"\");\n\t\t\t\thandleButton(upRightButton);\n\t\t\t\tif(neighborCounts[x+1][y-1] == 0 && upRightButton.isEnabled()){\n\t\t\t\t\tzerosToClear.push(grid[x+1][y-1]);\n\t\t\t\t}\n\t\t\t\tupRightButton.setEnabled(false);\n\t\t\t}\n\t\t\t//left\n\t\t\tif (x > 0){\n\t\t\t\tJButton leftButton = grid[x-1][y].getButton();\n\t\t\t\tleftButton.setText(neighborCounts[x-1][y] + \"\");\n\t\t\t\thandleButton(leftButton);\n\t\t\t\tif(neighborCounts[x-1][y] == 0 && leftButton.isEnabled()){\n\t\t\t\t\tzerosToClear.push(grid[x-1][y]);\n\t\t\t\t}\n\t\t\t\tleftButton.setEnabled(false);\n\t\t\t}\n\t\t\t//right\n\t\t\tif (x < width-1){\n\t\t\t\tJButton rightButton = grid[x+1][y].getButton();\n\t\t\t\trightButton.setText(neighborCounts[x+1][y] + \"\");\n\t\t\t\thandleButton(rightButton);\n\t\t\t\tif(neighborCounts[x+1][y] == 0 && rightButton.isEnabled()){\n\t\t\t\t\tzerosToClear.push(grid[x+1][y]);\n\t\t\t\t}\n\t\t\t\trightButton.setEnabled(false);\n\t\t\t}\n\t\t\t//down left\n\t\t\tif (x > 0 && y < height-1){\n\t\t\t\tJButton downLeftButton = grid[x-1][y+1].getButton();\n\t\t\t\tdownLeftButton.setText(neighborCounts[x-1][y+1] + \"\");\n\t\t\t\thandleButton(downLeftButton);\n\t\t\t\tif(neighborCounts[x-1][y+1] == 0 && downLeftButton.isEnabled()){\n\t\t\t\t\tzerosToClear.push(grid[x-1][y+1]);\n\t\t\t\t}\n\t\t\t\tdownLeftButton.setEnabled(false);\n\t\t\t}\n\t\t\t//down\n\t\t\tif (y < height-1){\n\t\t\t\tJButton downButton = grid[x][y+1].getButton();\n\t\t\t\tdownButton.setText(neighborCounts[x][y+1] + \"\");\n\t\t\t\thandleButton(downButton);\n\t\t\t\tif(neighborCounts[x][y+1] == 0 && downButton.isEnabled()){\n\t\t\t\t\tzerosToClear.push(grid[x][y+1]);\n\t\t\t\t}\n\t\t\t\tdownButton.setEnabled(false);\n\t\t\t}\n\t\t\t//down right\n\t\t\tif (x < width-1 && y < height-1){\n\t\t\t\tJButton downRightButton = grid[x+1][y+1].getButton();\n\t\t\t\tdownRightButton.setText(neighborCounts[x+1][y+1] + \"\");\n\t\t\t\thandleButton(downRightButton);\n\t\t\t\tif(neighborCounts[x+1][y+1] == 0 && downRightButton.isEnabled()){\n\t\t\t\t\tzerosToClear.push(grid[x+1][y+1]);\n\t\t\t\t}\n\t\t\t\tdownRightButton.setEnabled(false);\n\t\t\t}\n\t\t}\n\t}", "public List<Tile> getNeighbours() {\n \r\n return neighbours;\r\n }", "public ArrayList<Location> getEmptyAdjacentLocations(Location loc)\n {\n ArrayList<Location> locations = getAdjacentLocations(loc);\n for (Direction d: Direction.values())\n {\n Location temp = loc.farther(d);\n if (getPiece(temp)==null)\n locations.add(temp);\n }\n return locations;\n }", "public Board() {\n for (int y = 0; y < spaces.length; y++) {\n for (int x = 0; x < spaces[0].length; x++) {\n spaces[y][x] = new SubBoard();\n wonBoards[y][x] = ' ';\n }\n }\n }" ]
[ "0.73431057", "0.7143795", "0.71135354", "0.7107761", "0.71047485", "0.70340407", "0.68229574", "0.680377", "0.6791804", "0.6780762", "0.67398286", "0.66870683", "0.6634945", "0.656488", "0.6560722", "0.65537894", "0.6524856", "0.6500448", "0.6480006", "0.6436721", "0.6422956", "0.64221996", "0.641446", "0.640815", "0.6384476", "0.6384369", "0.6372215", "0.6372215", "0.6366752", "0.6359177", "0.63539654", "0.632063", "0.6315126", "0.63144207", "0.62941617", "0.62664515", "0.6246576", "0.6246022", "0.62388206", "0.6230696", "0.6212421", "0.6209155", "0.62076473", "0.62005615", "0.6195403", "0.6175651", "0.6172581", "0.6166469", "0.61643237", "0.6163956", "0.61618084", "0.6154354", "0.61521876", "0.61511546", "0.6149204", "0.61240125", "0.6122784", "0.6121315", "0.6120052", "0.6104614", "0.60871166", "0.6068724", "0.606516", "0.60627764", "0.6060283", "0.6056423", "0.60548407", "0.6047922", "0.60463804", "0.6043451", "0.60432345", "0.60405695", "0.6029552", "0.6029166", "0.6029103", "0.60253614", "0.6004424", "0.60025555", "0.59975255", "0.5996839", "0.5991907", "0.5991704", "0.5991459", "0.59668267", "0.59611833", "0.5953809", "0.59467906", "0.5945612", "0.5942303", "0.59417397", "0.5940319", "0.5939875", "0.59352994", "0.5932052", "0.59309703", "0.5922589", "0.5922175", "0.59204894", "0.5915251", "0.5914347" ]
0.66953534
11
Link the AI to the current game
public void attachGame(Game g) { game = (TicTacToeGame) g; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void playAI (int actualAI) {\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 }", "private void startGame() {\n\t\tmain.next_module = new Game(main, inputs, gameSelectionData);\n\t}", "public void play() {\n List<String> playersData = getGameInput().getPlayersData();\n for (int id = 0; id < playersData.size() / Constants.DATAENTITY; id++) {\n getHeroes().add(getHeroFactory().getHero(\n playersData.get(id * Constants.DATAENTITY),\n Integer.parseInt(\n playersData.get(\n id * Constants.DATAENTITY\n + Constants.INDEXPOSX)),\n Integer.parseInt(\n playersData.get(\n id * Constants.DATAENTITY\n + Constants.INDEXPOSY)),\n id));\n }\n // We create the angels and add them to angels list.\n List<Integer> numOfAngels = getGameInput().getNumOfAngels();\n List<String> angelsData = getGameInput().getAngelsData();\n for (int i = 0; i < angelsData.size() / Constants.DATAENTITY; i++) {\n getAngels().add(getAngelsFactory().getAngel(\n angelsData.get(i * Constants.DATAENTITY),\n Integer.parseInt(\n angelsData.get(\n i * Constants.DATAENTITY\n + Constants.INDEXPOSX)),\n Integer.parseInt(\n angelsData.get(\n i * Constants.DATAENTITY\n + Constants.INDEXPOSY))));\n }\n\n getUtl().prepareAdmins();\n\n int angelCounter = 0; // To iterate through all angels only once.\n // We start the actual game.\n for (int i = 0; i < getMovements().size(); i++) { // For every round.\n\n getUtl().printRound(i + 1); // We start printing from round 1...\n\n for (int j = 0; j < getHeroes().size(); j++) {\n /* Apply overtime ability if the case and then hero chooses\n * strategy and moves if he is not rooted. Lastly we decrease\n * the amount of rounds that a hero must be affected by. */\n if (!getHeroes().get(j).isDead()) {\n if (getHeroes().get(j).isAffectedByAoT()) {\n getUtl().applyAoT(getHeroes().get(j));\n }\n if (!getHeroes().get(j).isRooted()) {\n getHeroes().get(j).chooseStrategy();\n getHeroes().get(j).move(getMovements().get(i).get(j));\n }\n if (getHeroes().get(j).isAffectedByAoT()) {\n getHeroes().get(j).setAffectedByAoTRounds(\n getHeroes().get(j).getAffectedByAoTRounds()\n - 1);\n }\n }\n }\n\n // Check if there are any players on the same terrain.\n for (int j = 0; j < getHeroes().size(); j++) {\n for (int k = 0; k < getHeroes().size(); k++) {\n if (k == j) {\n continue; // So a hero doesn't fight himself.\n }\n if ((getHeroes().get(j).getPosX()\n == getHeroes().get(k).getPosX())\n && (getHeroes().get(j).getPosY()\n == getHeroes().get(k).getPosY())) {\n // If they are both alive, fight.\n if (!getHeroes().get(j).isDead()\n && !getHeroes().get(k).isDead()) {\n getUtl().fight(getHeroes().get(k),\n getHeroes().get(j), getMap());\n }\n }\n }\n }\n\n // Selecting the angels that appear on round i\n for (int j = 0; j < numOfAngels.get(i); j++) {\n getUtl().spawnAngel(getAngels().get(angelCounter));\n for (int k = 0; k < getHeroes().size(); k++) {\n /* Checking if the selected angel and player k are on the\n * same terrain. */\n if (getAngels().get(angelCounter).getPosX()\n == getHeroes().get(k).getPosX()\n && (getAngels().get(angelCounter).getPosY()\n == getHeroes().get(k).getPosY())) {\n getUtl().affectHeroByAngel(\n getAngels().get(angelCounter),\n getHeroes().get(k));\n }\n }\n angelCounter++;\n }\n\n // When round is complete, everyone can fight again\n for (AbstractHero hero : getHeroes()) {\n hero.setFought(false);\n }\n getUtl().getOutput().add(\"\\n\");\n }\n printResults();\n }", "public void launchTurn() {\n \twhile (getCurrentPlayer() instanceof AbstractIA) {\n \t\tSystem.out.println(\"Some thing happen or nothing\");\n \t\tjouerIA();\n \t\tendTurn();\n \t\t//setCurrentPlayer(getJoueur1());\t\n \t}\n \t\n }", "private void gotoPlay() {\n Intent launchPlay = new Intent(this, GameConfig.class);\n startActivity(launchPlay);\n }", "public void startNewGame();", "private void addAI(){\n\n }", "private void joinGame() {\n\t\tgame.connect(list.getSelectedValue());\n\t\tdispose();\n\t}", "public void linkUp(){\n\t\tsocket.setGame(game);\n//\t\tframe.setSocket(socket);\n\t}", "public Game startGame(Game game);", "boolean goHome(IGeneticMob geneticMob);", "private void joinGame(int gameId){\n\n }", "public interface AI {\n\n /**\n * Sets the new enemy position.\n * @param pos the new enemy position\n */\n void setEnemyPos(Point2D pos);\n\n /**\n * Returns the new position for the enemy to\n * move to.\n * @param target the position that wants to be tracked\n * @param pursuit the state in which the enemy is in\n * @param map\n * @return the position to move to\n */\n Point2D getNextMove(Point2D target, boolean pursuit, Set<Point2D> map);\n\n /**\n * Returns the new enemy rotation based on the\n * state in which the enemy is in.\n * @param target the position that wants to be tracked\n * @param pursuit the state in which the enemy is in\n * @return the angle that the enemy should face\n */\n double getRotation(Point2D target, boolean pursuit);\n\n /**\n * Returns if the enemy is in pursuit of the target\n * by calculating if the noise radius overlap with the\n * two.\n * @param target the position that wants to be tracked\n * @param noise the radius of the noise made by a player action\n * @return the state in which the enemy will be in\n * @see Player\n */\n boolean isInPursuit(Point2D target, double noise);\n\n /**\n * Returns if the enemy has the {@code target} in line of\n * sight and is close enough to get the enemy attention\n * to shoot.\n * @param target the position that wants to be tracked\n * @return the action that should be performed by the enemy\n */\n boolean isShooting(Point2D target);\n\n /**\n * Returns the collection of all position to check\n * if target is obscured by a wall used to JUnit\n * tests purpose.\n * @return the collections of all wall objects position\n */\n Set<Point2D> getWallSet();\n\n}", "public void playCvC() {\n isAI[0] = true;\n isAI[1] = true;\n players[0] = new AI();\n players[1] = new AI();\n playerShips[0] = players[0].getShipList();\n playerShips[1] = players[1].getShipList();\n grids[0] = new Grid();\n grids[1] = new Grid();\n currentPlayer = 0;\n playGame();\n }", "public void openMoving() {\n myActivity.setContentView(R.layout.moving);\n Button movingButtonToGame = myActivity.findViewById(R.id.button10);\n\n movingButtonToGame.setOnClickListener(\n new View.OnClickListener() {\n public void onClick(View v) {\n ShogiHumanPlayer.this.setAsGui(myActivity);\n usingRulesScreen = false;\n if (state != null) {\n receiveInfo(state);\n }\n }\n });\n }", "public void newGame();", "public void newGame();", "public void newGame();", "private void setNextGame() {\n Persistence db = Persistence.getInstance();\n game = db.getNextGame();\n\n // set the initial grid in the model\n grid = game.getInitial();\n\n // get rid of everything on the view grid\n view.clearGrid(true);\n\n // put givens for new game into view\n for (int i = 0; i < 9; i++) {\n for (int j = 0; j < 9; j++) {\n if (grid.isGiven(i, j)) {\n view.setGiven(i, j, grid.getNumber(i, j));\n } // if given\n } // for j\n } // for i\n\n }", "public void startGame() {\n\t\t\n\t\tPlayer p1;\n\t\tPlayer p2;\n\t\t\n\t\tif(player1.getSelectionModel().getSelectedItem().equals(_HUMAN)) {\n\t\t\tp1 = new Human(1, main);\n\t\t}\n\t\telse {\n\t\t\tString difficulty = player1Diff.getSelectionModel().getSelectedItem();\n\t\t\t\n\t\t\tint diff = difficulty.equals(_DIFFICULTY1) ? 1 : difficulty.equals(_DIFFICULTY2) ? 2 : 3;\n\t\t\t\n\t\t\tp1 = new AI(1, diff, main);\n\t\t}\n\t\t\n\t\t\n\t\tif(player2.getSelectionModel().getSelectedItem().equals(_HUMAN)) {\n\t\t\tp2 = new Human(2, main);\n\t\t}\n\t\telse {\n\t\t\tString difficulty = player2Diff.getSelectionModel().getSelectedItem();\n\t\t\t\n\t\t\tint diff = difficulty.equals(_DIFFICULTY1) ? 1 : difficulty.equals(_DIFFICULTY2) ? 2 : 3;\n\t\t\t\n\t\t\tp2 = new AI(2, diff, main);\n\t\t}\n\t\t\n\t\t\n\t\tmain.startGame(p1, p2);\n\t\t\n\t}", "public void connect() {\n aiConfiguration = new AIConfiguration(getClientAccessToken(),\n AIConfiguration.SupportedLanguages.English,\n AIConfiguration.RecognitionEngine.System);\n aiService = AIService.getService(context, aiConfiguration);\n aiService.setListener(this);\n aiDataService = new AIDataService(context, aiConfiguration);\n }", "public void switchGame() {\n \tplayerController.clearKeysPressed();\n game.game1 = !game.game1;\n if (game.game1) {\n \tgame.gameSnapshot = game.game1Snapshot;\n \tgame.rooms = game.game1Rooms;\n \tgame.characters = game.game1Characters;\n \tgame.player = game.player1;\n } else {\n \tgame.gameSnapshot = game.game2Snapshot;\n \tgame.rooms = game.game2Rooms;\n \tgame.characters = game.game2Characters;\n \tgame.player = game.player2;\n }\n \n currentNPCs = game.gameSnapshot.map.getNPCs(game.player.getRoom());\n getTileRenderer().setMap(game.player.getRoom().getTiledMap());\n getTileRenderer().clearPeople();\n getTileRenderer().addPerson((List<AbstractPerson>) ((List<? extends AbstractPerson>) currentNPCs));\n getTileRenderer().addPerson(game.player);\n }", "public AI(){\n super();\n }", "private Player aiRequestTarget(Player ai){\n // generates a random player index\n int index = (int) (Math.random() * GoFish.Players.length);\n\n // prevents the logic from outputting and index that is equal\n // to the player object\n while (GoFish.Players[index]==ai){\n index = (int) (Math.random() * GoFish.Players.length);\n }// end while\n\n return GoFish.Players[index];\n }", "void newGame() {\n\t\tstate = new model.State () ; \n\t\tif(host != null ) host.show(state) ; \n\t}", "GameResult start(Player uno , Player due , Model model ,Controller controller , ViewInterface view , gestioneInput io) throws IOException;", "@Override\n\tpublic void start() \n\t{\n\t\tServerPoller.getServerPoller().setObserver(this);\n\t\tList<Game> gamelist = Reference.GET_SINGLETON().proxy.getGameList();\n\t\tGameInfo[] games = new GameInfo[gamelist.size()];\n\t\tint counter = 0;\n\t\tfor(Game game: gamelist)\n\t\t{\n\t\t\tGameInfo thisgame = new GameInfo();\n\t\t\tthisgame.setId(game.getId());\n\t\t\tthisgame.setTitle(game.getTitle());\n\t\t\tfor(Player player : game.getPlayers())\n\t\t\t{\n\t\t\t\tPlayerInfo player_info = new PlayerInfo(player);\n\t\t\t\tplayer_info.setColor(player.getColor());\n\t\t\t\tif(!(player.color == null))thisgame.addPlayer(player_info);\n\t\t\t}\n\t\t\tgames[counter] = thisgame;\n\t\t\tcounter++;\n\t\t}\n\n\t\tif (Reference.GET_SINGLETON().getPlayer_color() != null) return;\n\t\tif (!hasChanged(games, oldGames)) return;\n\t\toldGames = games;\n\t\t\n\t\tReference ref = Reference.GET_SINGLETON();\n\t\t\n\t\tPlayerInfo ourguy = new PlayerInfo();\n\t\t\n\t\tourguy.setId(ref.player_id);\n\t\tourguy.setName(ref.name);\n\t\t\n\t\tgetJoinGameView().setGames(games, ourguy);\n\n\t\tif (getJoinGameView().isModalShowing()) getJoinGameView().closeModal();\n\t\tif(!getJoinGameView().isModalShowing())\n\t\t{\n\t\t\tgetJoinGameView().showModal();\n\t\t}\n\t}", "public boolean gameStart() {\r\n if (game == null) {\r\n board = new Board();\r\n if (ai) {\r\n Logging.log(\"Starting as AI\");\r\n player = new BaasAI(this, \"14ply.book\");\r\n } else {\r\n Logging.log(\"Starting as Human\");\r\n player = new HumanPlayer(this);\r\n }\r\n game = new Game(this);\r\n game.start();\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }", "private void createAgent() {\n logger.info(\"Creating agent\");\n iteration = 0;\n aiManager = new AIManager(configDialogInfo);\n aiManager.getAgent().addObserver(\"gameEngine\", this);\n AIBirth.generate(aiManager.getAgent());\n aiManager.start();\n }", "public void setAI(boolean ai) {\r\n this.ai = ai;\r\n }", "@Override\n public void newGame() {\n //TODO Implement this method\n }", "public static void requestGames() {\n\t\tarcade.requestGames();\n\t}", "public void doAi(){\n\t\t\tif(MathHelper.getRandom(0, Game.FRAMERATE * 5) == 5){\n\t\t\t\tsetScared(true);\n\t\t\t}\n\t\t\n\t\t//Update rectangle\n\t\tsetRectangle(getX(), getY(), getTexture().getWidth(), getTexture().getHeight());\n\t\t\n\t\trect = new Rectangle(getDestinationX(), getDestinationY(), 10, 10);\n\t\t\n\t\tif(rect.intersects(getRectangle())){\n\t\t\t\n\t\t\tif(StateManager.getState() == StateManager.STATE_BOSSTWO){\n\t\t\t\t\n\t\t\t\t\tsetDestinationX(StateGame.player.getX());\n\t\t\t\t\t\n\t\t\t\t\tsetDestinationY(StateGame.player.getY());\n\t\t\t\t\t\n\t\t\t\t\trect = new Rectangle(getDestinationX(), getDestinationY(), 10, 10);\n\t\t\t\t\treachedDestination = (true);\n\t\t\t}\n\t\t}\n\t\t\n\t\t//Check for collision with jelly\n\t\tint checkedJelly = (0);\n\t\twhile(checkedJelly < EntityJelly.JELLY.size() && EntityJelly.JELLY.get(checkedJelly) != null){\n\t\t\tif(EntityJelly.JELLY.get(checkedJelly).getDead() == false){\n\t\t\t\tif(getRectangle().intersects(EntityJelly.JELLY.get(checkedJelly).getRectangle())){\n\t\t\t\t\tsetHealth(getHealth() - 2);\n\t\t\t\t\tif(MathHelper.getRandom(1, 10) == 10){\n\t\t\t\t\tAnnouncer.addAnnouncement(\"-2\", 60, EntityJelly.JELLY.get(checkedJelly).getX(), EntityJelly.JELLY.get(checkedJelly).getY());\n\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t}\n\t\t\tcheckedJelly++;\n\t\t}\n\t\t\n\t\t//If we're out of health, kill the entity\n\t\tif(getHealth() < 0){\n\t\t\tsetDead(true);\n\t\t}\n\t\t\n\t\tif(StateManager.getState() == StateManager.STATE_BOSSTWO){\n\t\t\tif(reachedDestination == true){\n\t\t\t\tif(getScared() == false){\n\t\t\t\tsetY(getY() + getSpeed());\n\t\t\t\t}else{\n\t\t\t\t\tsetY(getY() - getSpeed() * 3);\n\t\t\t\t\tsetX(getX() - getSpeed() * 3);\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tif(getScared() == false){\n\t\t\t\tif(getX() < getDestinationX())\n\t\t\t\t\tsetX(getX() + getSpeed());\n\t\t\t\tif(getX() > getDestinationX())\n\t\t\t\t\tsetX(getX() - getSpeed());\n\t\t\t\tif(getY() < getDestinationY())\n\t\t\t\t\tsetY(getY() + getSpeed());\n\t\t\t\tif(getY() > getDestinationY())\n\t\t\t\t\tsetY(getY() - getSpeed());\n\t\t\t\t}else{\n\t\t\t\t\t\tsetY(getY() - getSpeed() * 3);\n\t\t\t\t\t\tsetX(getX() - getSpeed() * 3);\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public void AI()\r\n\t{\r\n\t\tRandom random = new Random();\r\n\t\tspeed = random.nextInt(2) + 1;\r\n\t\tif (canMove)\r\n\t\t{\r\n\t\t\tif (randomAxis == 1)\r\n\t\t\t{\r\n\t\t\t\tif (xDestination < this.x)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.x -= this.speed;\r\n\t\t\t\t\tthis.hitBox.addX(-(this.speed));\r\n\t\t\t\t\tdirection = KeysDefiner.LEFT;\r\n\t\t\t\t}\r\n\t\t\t\telse if (xDestination > this.x)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.x += this.speed;\r\n\t\t\t\t\tthis.hitBox.addX(this.speed);\r\n\t\t\t\t\tdirection = KeysDefiner.RIGHT;\r\n\t\t\t\t}\r\n\t\t\t\telse if (xDestination == this.x)\r\n\t\t\t\t\trandomAxis = 2;\r\n\t\t\t}\r\n\t\t\telse if (randomAxis == 2)\r\n\t\t\t{\r\n\t\t\t\tif (yDestination < this.y)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.y -= this.speed;\r\n\t\t\t\t\tthis.hitBox.addY(-(this.speed));\r\n\t\t\t\t\tdirection = KeysDefiner.UP;\r\n\t\t\t\t}\r\n\t\t\t\telse if (yDestination > this.y)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.y += this.speed;\r\n\t\t\t\t\tthis.hitBox.addY(this.speed);\r\n\t\t\t\t\tdirection = KeysDefiner.DOWN;\r\n\t\t\t\t}\r\n\t\t\t\telse if (yDestination == this.y)\r\n\t\t\t\t\trandomAxis = 1;\r\n\t\t\t}\r\n\t\t\tif (yDestination == this.y && xDestination == this.x)\r\n\t\t\t{\r\n\t\t\t\tif (spotsNumber == 1)\r\n\t\t\t\t{\r\n\t\t\t\t\txDestination = random.nextInt(SCREEN_W / 2) * 2;\r\n\t\t\t\t\tyDestination = random.nextInt(SCREEN_H / 2) * 2;\r\n\t\t\t\t\tspotsNumber++;\r\n\t\t\t\t}\r\n\t\t\t\telse if (spotsNumber == 2)\r\n\t\t\t\t{\r\n\t\t\t\t\txDestination = -(SCREEN_W / 21);\r\n\t\t\t\t\tyDestination = -(SCREEN_H / 12);\r\n\t\t\t\t\tspotsNumber++;\r\n\t\t\t\t}\r\n\t\t\t\telse lastDestinationReached = true;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private void activateTraitByAI() {\n\t\tChampion AI = currentTask.getCurrentChamp();\n\t\t\n\t\tif(AI instanceof GryffindorWizard){\n\t\t\tactivateGryffindorTrait();\n\t\t\t\n\t\t}else if(AI instanceof HufflepuffWizard){\n\t\t\tactivateHufflepuffTrait();\n\t\t\t\n\t\t}else if(AI instanceof SlytherinWizard){\n\t\t\tint randomDirection = (int) (Math.random()*3);\n\t\t\tDirection direction;\n\t\t\tswitch(randomDirection){\n\t\t\tcase 0: direction = Direction.FORWARD; break;\n\t\t\tcase 1: direction = Direction.BACKWARD; break;\n\t\t\tcase 2: direction = Direction.RIGHT; break;\n\t\t\tdefault: direction = Direction.LEFT;\n\t\t\t}\n\t\t\tdirectionsInAction = new ArrayList<Direction>();\n\t\t\tdirectionsInAction.add(direction);\n\t\t\tactivateSlytherinTrait();\n\t\t\n\t\t}else if(AI instanceof RavenclawWizard){\n\t\t\tactivateRavenclawTrait();\t\n\t\t\t\n\t\t}\n\t\t\n\t}", "public void setUpGame() {\n\t\tGameID = sql.getTheCurrentGameID() + 1;\r\n\t\tSystem.err.println(GameID);\r\n\t\ttheModel.shuffleDeck();\r\n\t\ttheModel.createPlayers();\r\n\t\ttheModel.displayTopCard();\r\n\t\t// theModel.chooseFirstActivePlayer();\r\n\t}", "public void playAI() {\r\n // An item has been added to the ticket. Fire an event and let everyone know.\r\n System.out.println(\"You're going to lose foolish human!\");\r\n }", "private void newGame() {\n\t\t// Firstly, we spawn the player.\n\t\tplayer = new AsteroidsPlayer(GameObject.ROOT, this);\n\t\tspawnPlayer();\n\n\t\t// Make sure that no other objects exist.\n\t\tasteroids.clear();\n\t\tlaserShots.clear();\n\t\totherObjects.clear();\n\n\t\t// Then we create the score text using two strings.\n\t\tAsteroidsString scoreText = new AsteroidsString(GameObject.ROOT, \"SCORE\", true, false);\n\t\tscoreText.translate(new Vector3(-cameraZoom, cameraZoom - 1));\n\t\totherObjects.add(scoreText);\n\t\tscoreString = new AsteroidsString(GameObject.ROOT, Integer.toString(score), true, false);\n\t\tscoreString.translate(new Vector3(-cameraZoom, cameraZoom - 3));\n\t\totherObjects.add(scoreString);\n\n\t\t// We set our starting lives to 3.\n\t\tlives = 3;\n\n\t\t//And we also create the lives text.\n\t\tAsteroidsString livesText = new AsteroidsString(GameObject.ROOT, \"LIVES\", false, true);\n\t\tlivesText.translate(new Vector3(cameraZoom, cameraZoom - 1));\n\t\totherObjects.add(livesText);\n\t\tlivesString = new AsteroidsString(GameObject.ROOT, Integer.toString(lives), false, true);\n\t\tlivesString.translate(new Vector3(cameraZoom, cameraZoom - 3));\n\t\totherObjects.add(livesString);\n\n\t\t// Then we just set the delay to the first asteroid.\n\t\ttimeToNextAsteroid = asteroidDelay;\n\t}", "public void pressNewGame() {\n }", "public void startGame() {\r\n this.setupGame();\r\n }", "private void startGame() {\r\n\t\tthis.gameMap.startGame();\r\n\t}", "public void InitGame(){\n System.out.format(\"New game initiated ...\");\n Game game = new Game(client_List);\n SetGame(game);\n }", "@Override\n\tpublic void createNewGame() \n\t{\n\t\t//Create new game\n\t\tboolean randomhexes = getNewGameView().getRandomlyPlaceHexes();\n\t\tboolean randomnumbers = getNewGameView().getRandomlyPlaceNumbers();\n\t\tboolean randomports = getNewGameView().getUseRandomPorts();\n\t\tString title = getNewGameView().getTitle();\n\t\t\n\t\ttry \n\t\t{\n\t\t\tReference.GET_SINGLETON().proxy.createGame(title, randomhexes, randomnumbers, randomports);\n\t\t} \n\t\tcatch (JoinExceptions e) \n\t\t{\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\t//Refresh game list\n\t\tList<Game> gamelist = Reference.GET_SINGLETON().proxy.getGameList();\n\t\tGameInfo[] games = new GameInfo[gamelist.size()];\n\t\tint counter = 0;\n\t\tfor(Game game: gamelist)\n\t\t{\n\t\t\tGameInfo thisgame = new GameInfo();\n\t\t\tthisgame.setId(game.getId());\n\t\t\tthisgame.setTitle(game.getTitle());\n\t\t\tfor(Player player : game.getPlayers())\n\t\t\t{\n\t\t\t\tPlayerInfo player_info = new PlayerInfo(player);\n\t\t\t\tplayer_info.setColor(player.getColor());\n\t\t\t\tif(!(player.color == null))thisgame.addPlayer(player_info);\n\t\t\t}\n\t\t\tgames[counter] = thisgame;\n\t\t\tcounter++;\n\t\t}\n\t\t\n\t\tReference ref = Reference.GET_SINGLETON();\n\t\t\n\t\tPlayerInfo ourguy = new PlayerInfo();\n\t\t\n\t\tourguy.setId(ref.player_id);\n\t\tourguy.setName(ref.name);\n\t\tif(getNewGameView().isModalShowing())\n\t\t{\n\t\t\tgetNewGameView().closeModal();\n\t\t}\n\t\tif (getNewGameView().isModalShowing())\n\t\t{\n\t\t\tgetNewGameView().closeModal();\n\t\t}\n\n\t\tgetJoinGameView().setGames(games, ourguy);\n\t\t\n\t}", "void startGame();", "void startGame();", "void startGame();", "public void startGame(){\n\t\tIntent intent = new Intent(getApplicationContext(), AndroidLauncher.class);\n\t\tintent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);\n\t\tintent.putExtra(Bluetooth.PRIMARY_BT_GAME, String.valueOf(false));\n\t\tintent.putExtra(Bluetooth.SECONDARY_BT_GAME, String.valueOf(true));\n\t\tstartActivity(intent);\n\t}", "void playGame(MarbleSolitaireModel model);", "public void startAnimation(){\n if (MadBalls.isHost()) {\n for (GameObject obj: gameObjects.values()){\n if (obj instanceof Obstacle){\n for (Player player: MadBalls.getMultiplayerHandler().getPlayers()){\n if (player instanceof BotPlayer){\n player.getRelevantObjIDs().add(obj.getID());\n }\n }\n }\n }\n }\n MadBalls.getGameMode().organize();\n animation.start();\n// Navigation.getInstance().showInterupt(\"\", \"Game started\", \"Let's rock and roll!\", false);\n }", "@Override\r\n public void BuildArena() {\r\n competition.setArena(FactoryArena.buildDefaultArena());\r\n }", "public void abstractUpdateAI()\n {\n player.setClock(player.getClock()+1);\n \n if (player.getClock() > 15 && player.getAlive()) { \n updateAI();\n } \n }", "public abstract void RunOnGameOpen();", "Games game();", "void onNewGame();", "public void click(ToddEthottGame game);", "private void humanTurn() \n {\n \n playTurn();\n }", "void listenAndSwitchNewGame() {\n Button button = findViewById(R.id.newButton2048);\n button.setOnClickListener(new View.OnClickListener() {\n\n @Override\n public void onClick(View v) {\n boardManager = new BoardManager2048();\n switchToActivity(GameActivity2048.class);\n }\n });\n }", "public void showGame(boolean startZoom){\r\n\t\tactiveGame = this;\r\n\t\t\r\n\t\t// Assign AI if needed (needs to be done here to work with deserialization, as the AI engine is not serialized)\r\n\t\tif(aiPlayerIDs != null){\r\n\t\t\tfor(int i : aiPlayerIDs){\r\n\t\t\t\tPlayer p = state.players[i];\r\n\t\t\t\tp.assignAI(new ScriptAI(p));\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tState.activeState = state;\r\n\t\tGEngine.getInstance().init(state, startZoom);\r\n\t\tMain.getInstance().setScreen(GEngine.getInstance());\r\n\t\tGEngine.getInstance().userInterface.updateCurrentPlayer();\r\n\t\tGdx.app.log(\"GameInstane\", \"Game shown using GameInstance\");\r\n\t}", "public void playTurn() {\r\n\r\n }", "@Override\n public void onClick(View v) {\n Intent intent = new Intent(getApplicationContext(), Gametwofive.class);\n startActivity(intent);\n }", "@Override\n public boolean isAiOn()\n {\n return aiIsOn;\n }", "void showActiveGames() {\n\t\tif(gameHelper == null){return;}\n\t\tif (gameHelper.getApiClient().isConnected()) {\n\t\t\tIntent i = Games.TurnBasedMultiplayer.getInboxIntent(gameHelper\n\t\t\t\t\t.getApiClient());\n\t\t\tstartActivityForResult(i, RC_INVITATION_BOX);\n\t\t} else if (gameHelper.isConnecting()) {\n\t\t\tToast.makeText(getActivity(), R.string.wait_connecting_to_google,\n\t\t\t\t\tToast.LENGTH_LONG).show();;\n\t\t}\n\t}", "@Override\r\n\t\t\tpublic void playGame() {\n\t\t\t\tSystem.out.println(\"调用打游戏的功能\");\r\n\t\t\t}", "public final void playGame() {\n\t\tSystem.out.println(\"Welcome to \"+nameOfGame+\"!\");\n\t\tsetup(numberOfPlayers);\n\t\tfor(int i = 0; !isGameOver(); i = (i+1) % numberOfPlayers) {\n\t\t\ttakeTurn(i+1);\n\t\t}\n\t\tfinishGame();\n\t}", "void joinGame(String playeruuid);", "protected boolean isAIEnabled()\n {\n return true;\n }", "public void linkGamePieces() {\n for (int i = 0; i < this.width; i++) {\n for (int j = 0; j < this.height; j++) {\n this.board.get(i).get(j).linkGamePieceHelp(i, j, this.board);\n }\n }\n }", "public void play()\r\n\t{\r\n \r\n\t\tupdateMessage(\"Starting \" + name + \" between \"+ agent[0].name+ \" and \"+ agent[1].name+\".\");\r\n random = new Random(System.currentTimeMillis());\r\n\t\tint turn = random.nextInt(2);\r\n first=turn;\r\n\t\tint dimension=8;\r\n\t\t//System.out.println(agent[turn].name+ \" makes the first move.\");\r\n\t\t//initialize(false,dimension,dimension);\r\n set(agent[first].role);\r\n agent[0].setAvailable(agent[first].role, dimension);\r\n agent[1].setAvailable(agent[first].role, dimension);\r\n \r\n \r\n\t\t//showGameState();\r\n \r\n\t\twhile(!isFinished())\r\n\t\t{\r\n\t\t\tupdateMessage(agent[turn].name+ \"'s turn. \");\r\n\t\t\tagent[turn].makeMove(this);\r\n agent[(turn+1)%2].off(agent[turn].newx,agent[turn].newy );\r\n agent[(turn+1)%2].setNew((OTHELLO)this);\r\n \r\n \r\n\t\t\tshowGameState();\r\n\t\t\t\r\n\t\t\tturn = (turn+1)%2;\r\n\t\t}\r\n\t\t\r\n // System.out.println(\" final winner role: \"+winner.role+\" agent[0]: \"+agent[0].role+\" agent[1]: \"+agent[1].role);\r\n \r\n\t\t\r\n\t\tif(draw)\t\r\n\t\t\tupdateMessage(\"Game drawn!!\");\r\n else updateMessage(winner.name+ \" wins!!!\");\r\n\t\t\r\n\t}", "void askStartGame();", "public abstract void setGame(Gyges game);", "public void PVAI(String name){ //for player vs ai\r\n \r\n welcome.remove(p1first);\r\n welcome.remove(p2first); //removing all necessary buttons\r\n welcome.remove(hORt);\r\n welcome.updateUI();\r\n \r\n if(choseEasyAI == true){ //for easy ai\r\n if(name.equals(name1)&&numTurns==0){\r\n instructions.setText(\"<html>\" + name1 + \"<html> you are going first! <br><br> Please click the column number you wish to place your checker in. </html>\");\r\n whoseTurn = 1; //when the user goes first\r\n welcome.remove(input);\r\n welcome.updateUI();\r\n canGo = true;\r\n }\r\n else if(numTurns==0){\r\n changeBoard(4, 3, color1, color2); //if the AI were to go first, set its checker in the middle (because thats always the best move)\r\n welcome.remove(input);\r\n welcome.updateUI();\r\n whoseTurn = 1; //AI's turn\r\n canGo = true;\r\n instructions.setText(\"<html>Please click the column number\"+\"</br>\"+\" you wish to place your checker in. </html>\");\r\n }\r\n }\r\n //FOR THE HARD AI\r\n else{\r\n AINumber = 4; //if the user chose HARD AI, and the user is going first\r\n if(name.equals(name1)&&numTurns==0){\r\n instructions.setText(\"<html>\" + name1 + \"<html> you are going first! <br><br> Please click the column number you wish to place your checker in. </html>\");\r\n whoseTurn = 1;\r\n welcome.remove(input);\r\n welcome.updateUI();\r\n canGo = true;\r\n }\r\n else{\r\n changeBoard(4,3,color1,color2);\r\n welcome.remove(input);\r\n welcome.updateUI();\r\n whoseTurn = 1; //users turn\r\n canGo = true;\r\n instructions.setText(\"<html>Please click the column number\"+\"</br>\"+\" you wish to place your checker in. </html>\");\r\n }\r\n }\r\n }", "@Override\r\n\t\t\tpublic void playGame() {\n\t\t\t\tSystem.out.println(\"隐式调用接口\");\r\n\t\t\t}", "@Override\n public void run() {\n\n try {\n\n\n game_service game = Game_Server_Ex2.getServer(level); // you have [0,23] games\n game.login(id);\n String g = game.getGraph();\n directed_weighted_graph gg = Ex2.loadgraph(g);\n System.out.println(gg);\n init(game);\n game.startGame();\n window.setTitle(\"Level:\" + level + \" \" + game.toString());\n int ind = 10;\n long dt = 100;\n\n while (game.isRunning()) {\n arna.updateTime(game.timeToEnd());\n Runnable nextstep = new Runnable() {\n @Override\n public void run() {\n moveAgants(game, gg);\n }\n\n };\n\n Thread t = new Thread(nextstep);\n t.start();\n try {\n if (ind % 1 == 0) {\n window.repaint();\n }\n Thread.sleep(dt);\n ind++;\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n\n String res = game.toString();\n\n System.out.println(res);\n window.dispose();\n new myEnd(res);\n } catch (Exception e) {\n System.out.println(\"worng level\");\n JOptionPane.showMessageDialog(null, \"Worng level\", \"pokemon\", JOptionPane.WIDTH);\n System.exit(0);\n }\n }", "public void GameStart()\n\t\t{\n\t\t\tplayers_in_game++;\n\t\t}", "void startGame(int gameId) {\n game = new Game(gameId);\n }", "public void activate(GameStateInterface gsi) {\r\n\t}", "@Override\r\n\tpublic void playGame() {\n\t\tSystem.out.println(\"SmartPhone具有玩游戏的功能\");\r\n\t}", "public static void init(game_service game) {\n String g = game.getGraph();\n String fs = game.getPokemons();\n directed_weighted_graph gg = loadgraph(g);\n arna = new Arena();\n arna.setGraph(gg);\n arna.setPokemons(Arena.json2Pokemons(fs));\n String info = game.toString();\n JSONObject line;\n try {\n line = new JSONObject(info);\n JSONObject json = line.getJSONObject(\"GameServer\");\n int num_agent = json.getInt(\"agents\");\n Comparator<CL_Pokemon> compi = new Comparator<CL_Pokemon>() {\n\n @Override\n public int compare(CL_Pokemon o1, CL_Pokemon o2) {\n return Double.compare(o2.getValue(), o1.getValue());\n }\n };\n PriorityQueue<CL_Pokemon> pokemons_val = new PriorityQueue<CL_Pokemon>(compi);\n ArrayList<CL_Pokemon> pokemons = Arena.json2Pokemons(game.getPokemons());\n for (int a = 0; a < pokemons.size(); a++) {\n Arena.updateEdge(pokemons.get(a), gg);\n pokemons_val.add(pokemons.get(a));\n }\n while (!pokemons_val.isEmpty() && num_agent != 0) {\n CL_Pokemon c = pokemons_val.poll();\n System.out.println(pokemons_val);\n int dest = c.get_edge().getDest();\n if (c.getType() < 0) {\n dest = c.get_edge().getSrc();\n }\n game.addAgent(dest);\n num_agent--;\n }\n arna.setAgents(Arena.getAgents(game.getAgents(), gg));\n } catch (JSONException e) {\n e.printStackTrace();\n }\n window = new MyWindow(arna);\n\n }", "public static void start(GameActivity a) {\n\t\tact = a;\n\t\tgame.start();\n\t}", "@Override\n\tpublic boolean isAIEnabled() {\n\t\treturn true;\n\t}", "void onStartGameRequested();", "public GameTypeWrapper playGame();", "public void startGameSession() {\n\t\tfor (GamePlayer player : listOfPlayers) {\n\t\t\tif (player != null) {\n\t\t\t\t// set to first lap\n\t\t\t\tplayer.currentLap = 1;\n\t\t\t}\n\t\t}\n\t}", "void gameStarted();", "void gameStarted();", "private void getAI(){\n\n }", "public void start() {\n ArrayList<String> names = new ArrayList<>();\n game.initialize(names);\n //game.play(this.mainPkmn, this.attack);\n\n }", "public void nextTurn() {\n visionChanged = true;\n SoundPlayer.playEndTurn();\n // Check if any protection objectives have failed\n gameState.updateAllHeroProtectionGoals(getHeroManager());\n // hook the next turn\n if (!multiplayerGameManager.hookNextTurn()) {\n\n if (map.enemyPerformingMove()) {\n return;\n }\n // Enemy action was made\n if (playerTurn && map.hasEnemy()) {\n try {\n map.enemyTurn(this);\n } catch (InterruptedException e) {\n logger.error(\"ayylmao at the GameManager.nextTurn(..) Method\");\n Platform.exit();\n Thread.currentThread().interrupt();\n }\n } else {\n map.playerTurn(this);\n updateBuffIcons();\n updateTempVisiblePoints();\n map.turnTick();\n for(CurrentHeroChangeListener listener:heroChangeListeners){\n \tlistener.onHeroChange(getHeroManager().getCurrentHero());\n }\n }\n\n } else {\n moveViewTo(getHeroManager().getCurrentHero().getX(), getHeroManager().getCurrentHero().getY());\n updateBuffIcons();\n updateTempVisiblePoints();\n }\n\n map.updateVisibilityArray();\n dayNightClock.tick();\n turnTickLiveTiles();\n abilitySelected = AbilitySelected.MOVE;\n abilitySelectedChanged = true;\n backgroundChanged = true;\n gameChanged = true;\n minimapChanged = true;\n saveOriginator.writeMap(this.map, this.getObjectives(), this.gameState);\n // update(this.tracker,null);\n }", "public void startOfGame() {\r\n\t\tif (enemyTracker.allEnemiesScanned() && oneTime) {\r\n\r\n\t\t\tif (myPlaceInList == 0) {\r\n\t\t\t\tif (!enemyTracker.getEnemyList().isEmpty()) {\r\n\t\t\t\t\tradarTarget = enemyTracker.getEnemyList().get(0);\r\n\r\n\t\t\t\t\ttargetTracking.add(new AllyWithTarget(allyTracker.getMrRobots().get(myPlaceInList), radarTarget));\r\n\t\t\t\t} else {\r\n\t\t\t\t\tradarTarget = enemyTracker.getTarget();\r\n\t\t\t\t\ttargetTracking.add(new AllyWithTarget(allyTracker.getMrRobots().get(myPlaceInList), radarTarget));\r\n\t\t\t\t}\r\n\t\t\t\tgotTarget = true;\r\n\t\t\t\tmrRobot.sendMessage(4, \"2\");\r\n\r\n\t\t\t}\r\n\t\t\toneTime = false;\r\n\t\t}\r\n\t}", "private void linkPlayersToDB(@Nullable Game game) {\n if (game == null) {\n throw new IllegalArgumentException(\"game should not be null.\");\n }\n\n gamesRef.child(game.getId())\n .child(DATABASE_GAME_PLAYERS)\n .addValueEventListener(new ValueEventListener() {\n @Override\n public void onDataChange(@NonNull DataSnapshot snapshot) {\n List<Player> newData = snapshot.getValue(new GenericTypeIndicator<List<Player>>() {\n });\n if (newData != null) {\n game.setPlayers(newData, true);\n }\n }\n\n @Override\n public void onCancelled(@NonNull DatabaseError error) {\n Log.e(TAG, \"failed \" + error.getMessage());\n }\n });\n }", "public abstract void use(Player player) throws GameException;", "public AI(Gameboard g_board, int player) {\n\t\tthis.g_board = g_board;\n\t\tboard = g_board.getBoard();\n\t\tthis.player = player;\n\t\troot = new Node();\n\t}", "public void startNetworkGame(NetworkGame ng) {\n \t\tgameInProgress = true;\n \t\t\n \t\t// controls drawing the opponent's map\n \t\tNetworkGameController networkController = new NetworkGameController(ng);\n \t\t\n \t\t// controls drawing our map\n\t\tlocalGameController = new GameController();\n \t\t\n \t\tMultiplayerGamePanel gamePanel = new MultiplayerGamePanel(localGameController,\n \t\t\t\tnetworkController, ng, this);\n \t\t\n \t\tlocalGameController.start();\n \t\t\n \t\tlocalGameController.setGameMain(gameMain);\n \t\tgameMain.showScreen(gamePanel);\n \t\tgameMain.setSize(1080, 700);\n \t}", "private void goToMenu() {\n game.setScreen(new MainMenuScreen(game));\n\n }", "public void newGame() {\n init();\n updateScoreBoard();\n Toast.makeText(getContext(), \"New Game started\", Toast.LENGTH_LONG).show();\n }", "@Override\n public void loadGame() {\n\n }", "public void startGame(Room room);", "void bindTo(Game currentGame){\n mTitleText.setText(currentGame.getTitle());\n mInfoText.setText(currentGame.getInfo());\n\n //Get the current sport\n mCurrentGame = currentGame;\n\n //Load the images into the ImageView using the Glide library\n Glide.with(mContext).load(currentGame.\n getImageResource()).placeholder(mGradientDrawable).into(mGamesImage);\n }", "public void loadGame() {\n game.loadGame();\n }" ]
[ "0.6398667", "0.6259176", "0.61975896", "0.6192805", "0.61565304", "0.6065297", "0.6062759", "0.60625035", "0.6018016", "0.59761703", "0.5937144", "0.5934206", "0.59321", "0.59314317", "0.58840644", "0.58323836", "0.58161205", "0.58161205", "0.58161205", "0.58158386", "0.5807697", "0.58017194", "0.5791783", "0.57895744", "0.5786406", "0.5770447", "0.5769085", "0.5751813", "0.57464004", "0.57443005", "0.57407767", "0.57223666", "0.56823885", "0.5678538", "0.5676225", "0.56648904", "0.5663456", "0.56612927", "0.56225264", "0.5618813", "0.56114495", "0.5606625", "0.56040794", "0.5602052", "0.5600722", "0.5600722", "0.5600722", "0.5594491", "0.55854726", "0.55846804", "0.55833644", "0.55808514", "0.55730957", "0.5567854", "0.5560529", "0.55544126", "0.5553466", "0.5552017", "0.55495685", "0.55467105", "0.55439657", "0.5543256", "0.5535284", "0.55351144", "0.55324817", "0.5522366", "0.55199635", "0.5515991", "0.5512846", "0.5509874", "0.55071354", "0.55060077", "0.55058986", "0.5497747", "0.54912543", "0.5489981", "0.5487296", "0.54846036", "0.54828084", "0.5479692", "0.5478322", "0.5475696", "0.5475048", "0.5474032", "0.5472051", "0.5472051", "0.5470254", "0.5467565", "0.54633373", "0.5460786", "0.5460664", "0.5448402", "0.5447385", "0.54462177", "0.5445839", "0.54455155", "0.5444537", "0.5442286", "0.5439564", "0.54368085" ]
0.54766566
81
/ Input: the current board Output: an string representation of the referenced board state
private String boardToString(char[] board) { String boardString = ""; for (char aBoard : board) boardString += aBoard; return boardString.replaceAll(" ", "_"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 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 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 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 }", "String getBoardString();", "public String toString() {\r\n\t\treturn gameState;\r\n\t}", "@Override\n public String toString() {\n\n \n String str = \"\";\n for(int rowIndex = 0; rowIndex < this.board.length; rowIndex++) {\n \n for(int columnIndex = 0; columnIndex < this.board[rowIndex].length; columnIndex++) {\n\n switch (this.board[rowIndex][columnIndex]) {\n case IBoardState.symbolOfInactiveCell:\n str += \"*|\";\n break;\n case IBoardState.symbolOfEmptyCell:\n str += \"0|\";\n break;\n case IBoardState.symbolOfFirstPlayer:\n str += \"1|\";\n break;\n case IBoardState.symbolOfSecondPlayer:\n str += \"2|\";\n break;\n }\n\n }\n str +=\"\\n\";\n }\n return str;\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 printCurrentState() {\n\t\tfor (int i = 0; i < 9; i++) {\n\t\t\tfor (int j = 0; j < 9; j++) {\n\t\t\t\tSystem.out.print(this.currentState[i][j] + \" \");\n\t\t\t}\n\t\t\tSystem.out.println(\"\");\n\t\t}\n\t}", "@Override\r\n\tpublic String toString()\r\n\t{\r\n\t\treturn state.toString();\r\n\t}", "public String toString() {\n return String.format(\"Final board:\\n%s\" +\n \"Number of conflicts:%d\\n\" +\n \"Time elapsed: %f seconds\\n\",\n board,\n BoardState.countConflicts(board.getBoard()),\n time * 0.000000001);\n }", "@Override\n\tpublic String toString(){\n\t\t// return a string of the board representation following these rules:\n\t\t// - if printed, it shows the board in R rows and C cols\n\t\t// - every cell should be represented as a 5-character long right-aligned string\n\t\t// - there should be one space between columns\n\t\t// - use \"-\" for empty cells\n\t\t// - every row ends with a new line \"\\n\"\n\t\t\n\t\t\n\t\tStringBuilder sb = new StringBuilder(\"\");\n\t\tfor (int i=0; i<numRows; i++){\n\t\t\tfor (int j =0; j<numCols; j++){\n\t\t\t\tPosition pos = new Position(i,j);\n\t\t\t\t\n\t\t\t\t// use the hash table to get the symbol at Position(i,j)\n\t\t\t\tif (grid.contains(pos))\n\t\t\t\t\tsb.append(String.format(\"%5s \",this.get(pos)));\n\t\t\t\telse\n\t\t\t\t\tsb.append(String.format(\"%5s \",\"-\")); //empty cell\n\t\t\t}\n\t\t\tsb.append(\"\\n\");\n\t\t}\n\t\treturn sb.toString();\n\n\t}", "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\t{\n\t\tString s = \"\";\n\t\tfor(int r = 0; r < board.length; r++)\n\t\t{\n\t\t\tfor(int c = 0; c < board[0].length; c++)\n\t\t\t{\n\t\t\t\ts += \"|\" + board[r][c];\n\t\t\t}\t\t\t\t\n\t\t\ts += \"|\" + \"\\n\" + \"-------------------\" + \"\\n\";\n\t\t}\n\t\treturn s;\n\t}", "@Override\n public String toString()\n {\n return state.toString();\n }", "@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}", "@Override\n public String toString() {\n // | <M,C,B> |\n // | Depth = d |\n // -----------\n return \"\\n ----------- \\n\" + \"| <\" + this.state[0] + \",\" + this.state[1] + \",\" + this.state[2] + \"> |\\n\"\n + \"| Depth = \" + this.depth + \" |\\n\" + \" ----------- \\n\";\n }", "public String toString() {\n\t\tString str = \"\\n \";\n\t\tfor (int i = 1; i <= board.length; i++) {\n\t\t\tstr += i + \" \";\n\t\t}\n\t\tstr = str.stripTrailing() + \"\\n\";\n\t\tfor (int i = 0; i < board.length; i++) {\n\t\t\tstr += (i+1) + \" \";\n\t\t\tfor (int j = 0; j < board.length; j++) {\n\t\t\t\tif (board[i][j] == Disc.WHITE) {\n\t\t\t\t\tstr += \"W \";\n\t\t\t\t} else if (board[i][j] == Disc.BLACK) {\n\t\t\t\t\tstr += \"B \";\n\t\t\t\t} else {\n\t\t\t\t\tstr += \"- \";\n\t\t\t\t}\n\t\t\t}\n\t\t\tstr = str.stripTrailing() + \"\\n\";\n\t\t}\n\t\treturn str;\n\t}", "public String getBoard() {\r\n\t\tString r = \"\";\r\n\t\tfor (int y = 0; y < 3; y++) {\r\n\t\t\tfor (int x = 0; x < 3; x++) {\r\n\t\t\t\tr = r + board[y][x];\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn r;\r\n\t}", "@Override\n public String toString() {\n String returnBoard = \" \";\n for (int i = 1; i <= 3; i++) {\n returnBoard=returnBoard+\" \" +Integer.toString(i);\n }\n returnBoard+=\"\\n\";\n for (int i = 1; i <= 3; i++) {\n returnBoard+= Integer.toString(i);\n for (int j = 1; j <= 3; j++) {\n returnBoard = returnBoard + \" \" + board[i-1][j-1].toString();\n }\n returnBoard+=\"\\n\";\n }\n return returnBoard;\n }", "public String toString() {\n\t\treturn \"PushObstacleState\";\n\t}", "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 String toString() {\n String bs = \" \"; // bs stands for board string\n for (int col = 0; col <= (this.boardSize - 1); col++) {\n bs = bs + (col + 1) + \" \";\n if (col < this.boardSize - 1) {\n bs = bs + \" \";\n }\n }\n bs = bs + \"\\n\";\n char rowHead = 'A';\n for (int row = 0; row <= (this.boardSize - 1); row++) {\n bs = bs + \" \" + rowHead++ + \" \";\n for (int col = 0; col < this.boardSize; ++col) {\n bs = bs + \" \" + this.board[row][col];\n if (col < this.boardSize - 1) {\n bs = bs + \" |\";\n }\n }\n bs = bs + \"\\n\";\n if (row < this.boardSize - 1) {\n bs = bs + \" \";\n for (int col = 0; col < this.boardSize; col++) {\n bs = bs + \"---\";\n if (col < this.boardSize - 1) {\n bs = bs + \"|\";\n }\n }\n }\n bs = bs + \"\\n\";\n }\n return bs;\n }", "@Override\n public String toString() {\n StringBuilder sb = new StringBuilder();\n\n //Print board\n int c = 0;\n for (Piece piece : board) {\n if (piece == null) {\n sb.append(\"\\t\");\n } else {\n sb.append(piece.pieceString()).append(\"\\t\");\n }\n if (++c % 4 == 0) {\n sb.append(\"\\n\");\n }\n }\n sb.append(\"\\n\");\n\n return sb.toString();\n }", "public void showBoardState() {\n System.out.print(\" \");\n //top row X axis\n for(int i = 0; i < boardSize; i++){\n System.out.print(\" \" + i + \" \");\n }\n System.out.println();\n for (int i = 0; i < boardSize; i++) {\n //conversion 0-9 to char for display as Y axis\n System.out.print(\" \" + (char)(i + 'A') + \" \");\n for (int j = 0; j < boardSize; j++) {\n System.out.print(\" \" + board[i][j] + \" \");\n }\n System.out.println();\n\n }\n System.out.println();\n }", "public char[][] getBoardState(){\n\t\treturn board;\n\t}", "public String toString(){\n \tif(state){\n\t\treturn (\"1\");\n\t }\n\t else{\n\t\t return(\"0\");\n\t }\n }", "void printBoardState(Piece[] B,Player J,int N);", "@Override\n public String getState() {\n StringBuilder builder = new StringBuilder();\n StringBuilder listPitches = listAllPitches(this.getFinalBeat());\n int length = this.getFinalBeat();\n\n builder.append(listPitches);\n\n for (int i = 0; i < length; i++) {\n builder.append(\"\\n\" + padded(i, length) + notesToString(getNotesPlayingAtBeat(i), i));\n }\n return builder.toString();\n }", "public void printStateInt() {\n StringBuilder out = new StringBuilder();\n for (int r = 0; r < rows; r++) {\n out.append(\"[\");\n for (int c = 0; c < columns; c++) {\n int number = currentState[r][c];\n out.append(number);\n if (number < 10) {\n out.append(\" \");\n }\n if (c != columns - 1)\n out.append(\" \");\n }\n out.append(\"]\");\n if (r != rows - 1)\n out.append(\"\\n\");\n\n }\n System.out.println(out);\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 }", "String getBoard();", "public String toString(){\n\t\tchar[][] boardRep = new char[yDim + 2][xDim + 2];\n\t\t\n\t\tfor(int i = 0; i < boardRep.length; i++){\n\t\t\tfor(int j = 0; j < boardRep[i].length; j++){\n\t\t\t\tboardRep[i][j] = ' ';\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < yDim + 2; i++){\n\t\t\tboardRep[i][0] = '.';\n\t\t\tboardRep[i][xDim + 1] = '.';\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < xDim + 2; i++){\n\t\t\tboardRep[0][i] = '.';\n\t\t\tboardRep[yDim + 1][i] = '.';\n\t\t}\n\t\t\n\t\tfor (Gadget g : gadgets){\n\t\t\tif(g instanceof SquareBumper){\n\t\t\t\tboardRep[g.getY() + 1][g.getX() + 1]= '#';\n\t\t\t}else if(g instanceof TriangularBumper){\n\t\t\t\tif(((TriangularBumper) g).getOrientation() % 2 == 0)\t\n\t\t\t\t\tboardRep[g.getY() + 1][g.getX() + 1]= '/';\n\t\t\t\tif(((TriangularBumper) g).getOrientation() % 2 == 1)\t\n\t\t\t\t\tboardRep[g.getY() + 1][g.getX() + 1]= '\\\\';\n\t\t\t}else if(g instanceof CircularBumper){\n\t\t\t\tboardRep[g.getY() + 1][g.getX() + 1]= 'O';\n\t\t\t}else if(g instanceof Absorber){\n\t\t\t\tfor(int i=g.getX(); i < g.getX() + g.getWidth(); i++){\n\t\t\t\t\tfor(int j=g.getY(); j < g.getY() + g.getHeight(); j++){\n\t\t\t\t\t\tboardRep[j + 1][i + 1] = '=';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}else if(g instanceof Flipper){\n\t\t\t\tFlipper f = (Flipper) g;\n\t\t\t\tif (f.isLeft && f.orientation == 0){\n\t\t\t\t\tboardRep[f.getY()+1][f.getX()+1] = '|';\n\t\t\t\t\tboardRep[f.getY()+2][f.getX()+1] = '|';\n\t\t\t\t} else if(f.orientation == 0){\n\t\t\t\t\tboardRep[f.getY()+1][f.getX()+2] = '|';\n\t\t\t\t\tboardRep[f.getY()+2][f.getX()+2] = '|';\n\t\t\t\t} else{\n\t\t\t\t\tboardRep[f.getY()+1][f.getX()+1] = '-';\n\t\t\t\t\tboardRep[f.getY()+1][f.getX()+2] = '-';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(Ball b : balls){\n\t\t\tboardRep[(int) (b.getY() + 1)][(int) (b.getX() + 1)]= '*';\n\t\t}\n\t\t\n\t\tStringBuffer boardString = new StringBuffer();\n\t\tfor(char[] row : boardRep){\n\t\t\tfor(char c : row){\n\t\t\t\tboardString.append(c);\n\t\t\t}\n\t\t\tboardString.append('\\n');\n\t\t}\n\t\t\n\t\treturn boardString.toString();\n\t}", "public String toString() {\n \t// string representation of the board (in the output format specified below)\n \tStringBuilder sb = new StringBuilder(dimension() + \" \\n \");\n \t\n \tfor (int row = 0; row < dimension(); row++) {\n \t\tfor (int column = 0; column < dimension(); column++) {\n \t\t\tsb.append(blocks[row][column]);\n \t\t\tsb.append(\" \");\n \t\t}\n \t\t\n \t\tsb.append(\"\\n \");\n \t}\n \t\n \treturn sb.toString();\n }", "public void displayBoard(){\r\n System.out.println(board.toString());\r\n }", "@Override\n\tpublic String toString(){\n\t\treturn \"com.jcdeck.adversary.State Turn: \"+this.getTurn()+\" Depth: \"+this.depth;\n\t}", "public char[][] getBoardState(){\n return board;\n }", "private String encodedBoard() {\r\n char[] result = new char[Square.SQUARE_LIST.size() + 1];\r\n result[0] = turn().toString().charAt(0);\r\n for (Square sq : SQUARE_LIST) {\r\n result[sq.index() + 1] = get(sq).toString().charAt(0);\r\n }\r\n return new String(result);\r\n }", "public String state() {\n\treturn state(points, temperature, currentStateEnergy);\n }", "public String getState() {\r\n StringBuilder builder = new StringBuilder();\r\n builder.append(mLastLarge);\r\n builder.append(',');\r\n builder.append(mLastSmall);\r\n builder.append(',');\r\n for (int large = 0; large < 9; large++) {\r\n for (int small = 0; small < 9; small++) {\r\n builder.append(mSmallTiles[large][small].getOwner().name());\r\n builder.append(',');\r\n }\r\n }\r\n return builder.toString();\r\n }", "public String toString(){\n\t\tString board = \"\";\n\t\tfor(int i = 0; i < rows; i++){\n\t\t\tfor(int j = 0; j < columns; j++){\n\t\t\t\tif(theGrid[i][j]){ //iterate through, if cell is alive, mark with *\n\t\t\t\t\tboard += \"*\";\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tboard += \" \"; //else, [space]\n\t\t\t\t}\n\t\t\t}\n\t\t\tboard += \"\\n\";//create a new line, to create the board\n\t\t}\n\t\treturn board; //return the board\n\t}", "public String toString() {\r\n\treturn \"batch image builder for:\\n\\tnew state: \"/*nonNLS*/ + getNewState();\r\n}", "public String toString() {\n\tString str = \"\";\n\tfor (int i = 0; i < board.length; i++) {\n\t str = str + \"\\n\";\n\t for (int j = 0; j <= (board.length - 1); j++)\n\t\tstr = \" \" + str + board[i][j] + \" \";\n\t}\n\treturn str;\n }", "public static String printOpenBoard(Game board) {\n return board.openBoardToString();\n }", "public String toString() {\r\n\t\tString s = (currentPlayer == getP1() ? \"Cross : \" : \"Nought : \");\r\n\t\tfor (int y = 0; y < 3; y++) {\r\n\t\t\tfor (int x = 0; x < 3; x++) {\r\n\t\t\t\ts = s + board[y][x];\r\n\t\t\t}\r\n\t\t\ts = s + \" \";\r\n\t\t}\r\n\t\treturn s;\r\n\t}", "@Override\n public String toString ()\n {\n StringBuffer buffer = new StringBuffer();\n for (State value : stateMap.values()) {\n buffer.append(value.toString());\n buffer.append(\"\\n\");\n }\n return buffer.toString();\n }", "public static String[][] getBoardState() {\n return boardState;\n }", "private String gameBoardToString(){\n StringBuilder config = new StringBuilder();\n\n //length attribute gets the number of rows in a 2D array. length attribute on a row gets the number of columns in a\n // 2D array. We iterate through all the rows and columns and join all the characters in the array into a single\n // String config\n\n for (int i = 0; i < this.boardRows; i++){\n for (int j =0; j < this.boardColumns; j++){\n config.append(this.gameBoard[i][j]);\n }\n }\n\n // Returns String object representation of StringBuilder object\n return config.toString();\n\n }", "public String showBoard() {\n return name + \"\\r\\n\" + myBoard.displayMyBoard() + \"\\r\\n\" + opponentsBoard.displayShotsTaken();\n }", "public String getSlackRepresentationOfBoard() {\n String boardBorders[] = {\"```| \",\n \" | \",\n \" | \",\n \" |\\n|---+---+---|\\n| \",\n \" | \",\n \" | \",\n \" |\\n|---+---+---|\\n| \",\n \" | \",\n \" | \",\n \" |```\"};\n int boardBordersIndex = 0;\n StringBuilder boardString = new StringBuilder();\n for(int row = 0; row < BOARD_SIZE; row ++ ){\n for(int col = 0; col <BOARD_SIZE; col ++ ){\n boardString.append( boardBorders[boardBordersIndex] );\n boardString.append( getTokenAsCharFromBoardPosition(row, col, boardBordersIndex+1));\n boardBordersIndex++;\n }\n }\n boardString.append( boardBorders[boardBordersIndex] );\n return boardString.toString();\n }", "@Override\n\tpublic String toString() {\n\t\treturn \"New Game State\";\n\t}", "public String toString() {\n StringBuilder s = new StringBuilder(); // Initialize new string builder\n s.append(N + \"\\n\"); // Append board dimension to string\n\n for (int[] row : tiles) {\n for (int tile : row)\n s.append(String.format(\"%2d \", tile)); // Append formatted board tiles string\n s.append(\"\\n\"); // Append new line to string\n }\n return s.toString(); // Return string representation of board\n }", "public String getBoardOverview() {\n String boardOverview = \"\";\n\n for (int y = 0; y < this.boardSize; y++) {\n for (int x = 0; x < this.boardSize; x++) {\n char StoneColor = ' ';\n\n if (!this.fields[x][y].isEmpty()) {\n switch (this.fields[x][y].getStone().getColor()) {\n case BLACK:\n StoneColor = 'B';\n break;\n case WHITE:\n StoneColor = 'W';\n break;\n }\n } else if (this.fields[x][y].isPossibleMove()) {\n StoneColor = 'x';\n }\n\n boardOverview = boardOverview + StoneColor;\n\n }\n // next line\n boardOverview = boardOverview + String.format(\"%n\");\n }\n\n return boardOverview;\n }", "@Override\n public String toString() {\n StringBuilder builder = new StringBuilder();\n\n for (int row = 0; row < this.getNumberOfRows(); row++) {\n for (int column = 0; column < this.getNumberOfCols(); column++) {\n\n if (row == this.getState()[0] && column == this.getState()[1])\n builder.append(\"* \");\n else\n builder.append(Integer.toString(this.getEnvironment()[row][column]) + ' ');\n\n }\n\n if (row != (this.getNumberOfRows() - 1))\n builder.append('\\n');\n }\n\n return builder.toString();\n }", "public String toString() {\n\treturn state.toString() + \" \" + context.toString();\n }", "public String toString() {\r\n\t\treturn (\"State: \" + this.key + \", Value: \" + this.val);\r\n\t}", "@Override\n\tpublic String toString() {\n\t\tString result = \"-------------------\\n\";\n\t\tfor (Cell[] cellRow : board) {\n\t\t\tresult += \"|\";\n\t\t\tfor (Cell cell : cellRow) {\n\t\t\t\tresult += (cell.val == 0 ? \" \" : cell.val) + \"|\";\n\t\t\t}\n\t\t\tresult += \"\\n-------------------\\n\";\n\t\t}\n\t\treturn result += \"\\n\" + toTest();\n\t}", "public String toString(){\n //KEY --------\n // WHITE WALL = WW\n // WHITE ROAD = WR\n // WHITE CAPSTONE = WC\n // BLACK WALL = BW\n // BLACK ROAD = BR\n // BLACK CAPSTONE = BC\n // EMPTY = \"blank\"\n\n StringBuilder builder = new StringBuilder();\n\n /*TOP ROW*/ builder.append(\"\\t\"); for(int i = 0; i < SIZE; i++){ builder.append(i + \"\\t\");} builder.append(\"\\n\\n\");\n /*REST OF THE ROWS*/ \n for(int x = 0; x < SIZE; x++){\n builder.append(x + \"\\t\");\n for(int y = 0; y < SIZE; y++){\n TakStack current = stacks[y][x]; \n if(!current.isEmpty()){\n builder.append(getPieceString(current.top()));\n }\n builder.append(\"\\t\");\n }\n builder.append(\"\\n\\n\");\n }\n\n\n //BUILDER RETURN\n return builder.toString();\n }", "public String toString() {\n\n\t\tString result = \"\";\n\n\t\tfor(Cell[][] dim : board) {\n\t\t\tfor(Cell[] row : dim) {\n\t\t\t\tfor(Cell col : row) {\n\t\t\t\t\tif(col== Cell.E)\n\t\t\t\t\t\tresult += \"-\";\n\t\t\t\t\telse\n\t\t\t\t\t\tresult += col;\t\n\t\t\t\t}\n\t\t\t\tresult += \"\\n\";\n\t\t\t}\n\t\t\tresult += \"\\n\";\n\t\t}\n\n//\t\tSystem.out.println(\"\\n***********\\n\");\n\t\treturn result;\n\n\t}", "public String getPlayerState() {\n String playerState = name + \" \" + actionArray[0] \n + \" \" + actionArray[1] + \" \" + actionArray[2] + \" \" + colorID + \" \";\n return playerState;\n }", "@Override\n public String displayGameBoard(int stage) {\n String out=\"\";\n switch(stage) {\n case 0:\n out = \"Initial State: \";\n for (int i = 0; i < this.squareCount; i++) {\n out = out.concat(this.mySquares[i].statusSquare());\n }\n break;\n case 1:\n out = String.format(\"%s rolls %d:\", this.currentPlayer.getName(), this.numSquares);\n for (int i = 0; i < this.squareCount; i++) {\n out = out.concat(this.mySquares[i].statusSquare());\n }\n break;\n case 2:\n out = \"Final State: \";\n for (int i = 0; i < this.squareCount; i++) {\n out = out.concat(this.mySquares[i].statusSquare());\n }\n break;\n case 3:\n out = String.format(\"%s wins!\",this.currentPlayer.getName());\n break;\n }\n return(out);\n }", "java.lang.String getState();", "public String toString() {\n\t\tString temp = \"\";\n\t\tfor (int i = 0; i < 10; i++) {\n\t\t\ttemp += String.format(\"%d \", i);\n\t\t}\n\t\ttemp += \"\\n\";\n\t\tfor (int i = 0; i < 9; i++) {\n\t\t\ttemp += String.format(\"%d | \", i + 1);\n\t\t\tfor (int j = 0; j < 9; j++) {\n\t\t\t\ttemp += String.format(\"%c | \", board[i][j]);\n\t\t\t}\n\t\t\ttemp += \"\\n\";\n\t\t}\n\t\treturn temp;\n\t}", "public String toString() {\n String returnString = \"\";\n returnString = returnString + \"\\r\\n\";\n for (int i = 0; i < rows + 1; i++) {\n for (int j = 0; j < cols + 1; j++) {\n if (i == 0 && j == 0) {\n returnString = returnString + \" \";\n continue;\n }\n if (i == 0) {\n if (j > 0) {\n returnString = returnString + (j + \" \");\n }\n if (j == 8) {\n returnString = returnString + \"\\r\\n\";\n }\n } else {\n if (j > 0) {\n if (!isEmpty(i - 1, j - 1)) {\n returnString = returnString + (getBoard()[i - 1][j - 1] + \" \");\n } else {\n returnString = returnString + \" \";\n }\n }\n }\n if (j == 0) {\n returnString = returnString + (i + \" \");\n }\n\n }\n returnString = returnString + \"\\r\\n\";\n }\n return returnString;\n }", "private String digestGameBoard() {\n StringBuilder config = new StringBuilder();\n for(char[] gameBoardRow : gameBoard) {\n for(char slot : gameBoardRow) {\n config.append(slot);\n }\n }\n return config.toString();\n }", "@Override\n\tpublic String toString(){\n\t\tString game;\n\t\t\n\t\tgame=this.currentBoard.toString();\n\t\tgame=game+\"best value: \"+this.currentRules.getWinValue(currentBoard)+\" Score: \"+this.points+\"\\n\";\n\t\t\n\t\tif(currentRules.win(currentBoard)){\n\t\t\tgame=game+\"Well done!\\n\";\n\t\t\tfinish=true;\n\t\t}\n\t\telse if(currentRules.lose(currentBoard)){\n\t\t\tgame=game+\"Game over.\\n\";\n\t\t\tfinish=true;\n\t\t}\n\t\t\n\t\treturn game;\n\t}", "public String toString() {\n String boardString = \"\";\n for (int j = 0; j < nRows; j++) {\n String row = \"\";\n for (int i = 0; i < nCols; i++) {\n if (board[j][i] == null) {\n row = row + \"Empty \";\n } else {\n row = row + board[j][i].getType() + \" \";\n }\n }\n boardString = boardString + row + \"\\n\";\n }\n return boardString;\n }", "public String printState(){\n if (this.state.equals(\"unstarted\")) return \"unstarted 0\";\n\n else if (this.state.equals(\"terminated\")) return \"terminated 0\";\n else if (this.state.equals(\"blocked\")) {\n return String.format(\"blocked %d\", ioBurstTime);\n }\n else if (this.state.equals(\"ready\")) {\n if (remainingCPUBurstTime !=null){\n return String.format(\"ready %d\", remainingCPUBurstTime);\n }\n return \"ready 0\";\n }\n\n else if (this.state.equals(\"running\")){\n return String.format(\"running %d\", cpuBurstTime);\n }\n\n else return \"Something went wrong.\";\n }", "public String printPair() {\n\t\treturn \"(\"+leftState.getStateNo() + \",\" + rightState.getStateNo()+\")\";\n\t}", "public String toString() {\n StringBuilder s = new StringBuilder();\n s.append(dim + \"\\n\");\n for (int i = 0; i < dim; i++) {\n for (int j = 0; j < dim; j++) {\n s.append(String.format(\"%2d \", board[i][j]));\n }\n s.append(\"\\n\");\n }\n return s.toString();\n }", "public void printShipBoard() {\n\t\tSystem.out.println(Arrays.deepToString(this.shipBoard));\n\t}", "public final String cur_modstate_string () {\n\t\treturn get_modstate_as_string (modstate);\n\t}", "public String toString() {\n\t\tStringBuilder string = new StringBuilder();\n\t\tstring.append(n + \"\\n\");\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tfor (int j = 0; j < n; j++) \n\t\t\t\tstring.append(String.format(\"%2d \", board[i][j]));\n\t\t\tstring.append(\"\\n\");\n\t\t}\n\t\treturn string.toString();\n\t}", "public String toString() {\n StringBuilder sb = new StringBuilder();\n\n for (int i = 0; i < SIZE; i++) {\n for (int j = 0; j < SIZE; j++) {\n sb.append(board[i][j]);\n sb.append(\" \");\n }\n sb.append(\"\\n\");\n }\n return sb.toString();\n }", "public String getState() {\n\t\treturn state.toString();\n\t}", "@Override\n\tpublic String toString() {\n\t\tfinal StringBuffer buffer = new StringBuffer();\n\t\tbuffer.append(super.toString());\n\t\tbuffer.append('\\n');\n\t\tfor (final State state : getStates()) {\n\t\t\tif (initialState == state) {\n\t\t\t\tbuffer.append(\"--> \");\n\t\t\t}\n\t\t\tbuffer.append(state);\n\t\t\tif (isFinalState(state)) {\n\t\t\t\tbuffer.append(\" **FINAL**\");\n\t\t\t}\n\t\t\tbuffer.append('\\n');\n\t\t\tfor (final Transition transition : getTransitionsFromState(state)) {\n\t\t\t\tbuffer.append('\\t');\n\t\t\t\tbuffer.append(transition);\n\t\t\t\tbuffer.append('\\n');\n\t\t\t}\n\t\t}\n\n\t\treturn buffer.toString();\n\t}", "public static String printBoard(Game board) {\n return board.toString();\n }", "public String toString() {\n try {\n StringBuilder sb = new StringBuilder();\n sb.append((\"STATES\") + System.getProperty(\"line.separator\"));\n sb.append((\"-----------\") + System.getProperty(\"line.separator\"));\n sb.append(statesToString());\n sb.append((\"TRANSITIONS\") + System.getProperty(\"line.separator\"));\n sb.append((\"-------------------\") + System.getProperty(\"line.separator\"));\n sb.append(transitionsToString());\n return sb.toString();\n } catch (RuntimeException sbe) {\n throw sbe;\n } catch (Exception sbe) {\n throw new RuntimeException(sbe);\n }\n }", "String getCurrentState() {\n return context.getString(allStates[currentIdx]);\n }", "@Override\r\n public String toString() {\r\n return String.valueOf(this.m_current);\r\n }", "public String toString() {\n String result=\"Initial state: 0\\nFinal state: \"+(transitionTable.length-1)+\"\\nTransition list:\\n\";\n for (int i=0;i<epsilonTransitionTable.length;i++) for (int state: epsilonTransitionTable[i])\n result+=\" \"+i+\" -- epsilon --> \"+state+\"\\n\";\n for (int i=0;i<transitionTable.length;i++) for (int col = 0; col< NFA.N; col++)\n if (transitionTable[i][col]!=-1) result+=\" \"+i+\" -- \"+(char)col+\" --> \"+transitionTable[i][col]+\"\\n\";\n return result;\n }", "@Override\n public final String toString()\n {\n String str = formatInt(turn)+formatInt(fiftyMove);\n //int counter = 0;\n for (Square[] s1: getSquares())\n {\n for (Square s: s1)\n {\n if (!s.isEmpty())\n {\n str+=\"\"+s;\n //counter++;\n /*if (counter%4==0)\n str+=\"\\n\";*/\n }\n }\n }\n return str;\n }", "String getState();", "String getState();", "String getState();", "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 void printBoard(){\n for (int i = 0; i < boardRows ; i++) {\n for (int j = 0; j < boardColumns; j++) {\n if(this.currentBoardState[i][j] == 0){\n System.out.print(\"0 \");\n }else{\n System.out.print(currentBoardState[i][j] + \" \");\n }\n }\n System.out.println();\n }\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 void displayCurrentState(State game);", "public String toString(){\n\t\tStringBuilder sb = new StringBuilder();\n\t\tif(isFlag()==true){\n\t\t\t\tif(isDownBlock()==true){\n\t\t\t\t\tsb.append(\"g\"); //use G represent the goal\n\t\t\t\t\t\t\t\t\t\t// if down block is a block use small letter\n\t\t\t\t}\n\t\t\t\telse if(isRobot()==true){\n\t\t\t\t\tsb.append(\"V\"); //flag and robot on same position VICTORY!\n\t\t\t\t}\n\t\t\t\telse sb.append(\"G\"); \t\t\n\t\t\t}\n\t\telse if(isRobot()==true){\n\t\t\tif(isDownBlock()==true){\n\t\t\t\tsb.append(\"r\");//use R represent the Robot\n\t\t\t\t\t// if down move is a block use small letter\n\t\t\t}\n\t\t\telse sb.append(\"R\");\n\t\t}\n\t\telse{\n\t\t\tif(isDownBlock()==true){\n\t\t\t\tsb.append(\"_\"); \n\t\t\t\t//if down move is blocked then use underline\n\t\t\t}\n\t\t\telse sb.append(\"O\"); // use o represent the grid\n\t\t}\n\t\t\t\n\t\tif(isRightBlock()==true){\n\t\t\tsb.append(\"|\"); //best way to represent right block\n\t\t}\n\t\telse{\n\t\t\tsb.append(\" \"); // if no block just a space\n\t\t}\n\t\treturn sb.toString();\n\t}", "@Output\n public String getState() {\n return state;\n }", "public String toString()\n\t{\n\t\treturn \"Current Floor: \" + currentFloor +\" Total passangers on board: \" + totalPassengers + \" Direction: \" + currentDirection;\n\t}", "public String getGameBoardState(int requestId) {\n\t\tmarkAsUpToDate(requestId);\n\t\t\n\t\tString info = \"<board_state>\";\n\t\tinfo += (\"<mode>\" + sessionState.name() + \"</mode>\");\n\t\t\n\t\tinfo += getModeInfoXML(requestId);\n\t\t\n\t\tfor(Team team : this.schoolClass.getTeams()) {\n\t\t\tinfo += team.getInfoString();\n\t\t}\n\n\t\tinfo += \"<board_cards>\";\n\n\t\tfor(int i = 0; i < board.BOARD_WIDTH; i++) {\n\t\t\tfor(int j = 0; j < board.BOARD_HEIGHT; j++) {\n\t\t\t\tPoint temp = new Point(i, j);\n\t\t\t\tinfo += board.returnCardAtPos(temp).generateCardXML();\n\t\t\t}\n\t\t}\n\n\t\tinfo += \"</board_cards>\";\n\t\t\n\t\tinfo += \"</board_state>\";\n\t\treturn info;\n\t}", "public String toString()\r\n {\r\n if(_switchedOn)\r\n return _color + \" On\";\r\n else\r\n return _color + \" Off\";\r\n }", "public String toString() {\n PrintfFormat str = new PrintfFormat();\n\n str.append (\"The current state of the MRG32k3a\");\n if (name != null && name.length() > 0)\n str.append (\" \" + name);\n str.append (\":\" + PrintfFormat.NEWLINE + \" Cg = { \");\n str.append ((long) Cg0 + \", \");\n str.append ((long) Cg1 + \", \");\n str.append ((long) Cg2 + \", \");\n str.append ((long) Cg3 + \", \");\n str.append ((long) Cg4 + \", \");\n str.append ((long) Cg5 + \" }\" + PrintfFormat.NEWLINE +\n PrintfFormat.NEWLINE);\n\n return str.toString();\n }", "public String getGameStr() {\n StringBuilder outStr = new StringBuilder();\n for(int i=0;i<ROWS;i++) {\n for(int j=0;j<COLS;j++){ \n outStr.append(\"|\").append(gameBoard[i][j].show());\n }\n outStr.append(\"|\").append(System.getProperty(\"line.separator\"));\n }\n return outStr.toString();\n }", "public String toString() {\n\t\t\n\t\treturn this.getColor() + \"B\";\n\t}", "public String toString() {\n // show marbles on board with indexes\n String s = \"\";\n for (int i = 0; i < DIMENSION; i++) {\n if ((i > 4) && (i != 10)) {\n s += \" \".repeat(i - 2);\n // char index bottom board\n s += \"\\u001b[32m\" + String.valueOf((char) ((char) i + 'A' - 1)) + \"\\u001b[0m \";\n } else {\n s += \" \".repeat(i);\n }\n for (int j = 0; j < DIMENSION; j++) {\n if (i + j == 4) {\n if (i == 0) {\n s += \" \";\n } else {\n // char index top board\n s += \"\\u001b[32m\" + String.valueOf((char) ((char) i + 'A' - 1)) + \"\\u001b[0m\";\n }\n } else if ((i + j < 4) || i + j > 15) {\n s += \"\\u001b[32m\";\n if ((i == 7 && j == 9)) {\n s += \"9\";\n } else if ((i == 8 && j == 8)) {\n s += \"8\";\n } else if ((i == 9 && j == 7)) {\n s += \"7\";\n } else if ((i == 10 && j == 6)) {\n s += \"6\";\n } else {\n s += \" \";\n }\n s += \"\\u001b[0m\";\n } else if (isOutOfBoard(fields[i][j])) {\n \n s += fields[i][j].getMarbleColor().toString().charAt(0);\n } else {\n // show marbles with color\n switch (fields[i][j].getMarbleColor()) {\n case BLACK:\n s += \"\\u001b[30mo\";\n break;\n case WHITE:\n s += \"\\u001b[37mo\";\n break;\n case RED:\n s += \"\\u001b[31mo\";\n break;\n case BLUE:\n s += \"\\u001b[34mo\";\n break;\n case NONE:\n s += \" \";\n break;\n }\n }\n s += \"\\u001b[0m \";\n }\n \n s += \"\\n\";\n }\n \n s += \" \".repeat(13) + \"\\u001b[32m1 2 3 4 5\\u001b[0m\";\n return s;\n\n\n }", "public String toString() {\n\t\treturn (new StringBuilder().append(\"Turn: \")\n\t\t\t.append(turnNumber)\n\t\t\t.append(\"\\n\")\n\t\t\t.append(towerSet.toString())\n\t\t\t.append('\\n')).toString();\n\t}", "public String getCurrentState() {\n\t\treturn currentState;\n\t}", "@Test\n\tpublic void statePrint_test()\n\t{\n\t\tb.set(0,0, 'x');\n\t\tb.set(0,1, 'o');\n\t\tb.set(0,2, 'x');\n\t\tb.set(1,0, 'o');\n\t\tb.set(1,1, 'x');\n\t\tb.statePrint();\n\t\tassertTrue(out.toString().contains(\"x|o|x\\n------\\no|x| \\n------\\n | | \\n\"));\n\t}" ]
[ "0.7754882", "0.744507", "0.7330105", "0.7292678", "0.706085", "0.70298314", "0.7026795", "0.69535774", "0.6942798", "0.6880832", "0.6868008", "0.68422353", "0.6837344", "0.6779664", "0.6772159", "0.67457414", "0.67455757", "0.6745046", "0.67377025", "0.66982865", "0.6629163", "0.6592756", "0.6584214", "0.65747035", "0.65743953", "0.65455073", "0.6535187", "0.65187347", "0.6514589", "0.65055025", "0.64955676", "0.64943254", "0.6490978", "0.6486893", "0.6475639", "0.64734805", "0.6453816", "0.6443391", "0.64399755", "0.6428681", "0.6428005", "0.64199394", "0.64185375", "0.6387101", "0.63825315", "0.63705415", "0.63676685", "0.6366479", "0.6352311", "0.634659", "0.63420993", "0.6338358", "0.63369286", "0.63235116", "0.6312273", "0.6310927", "0.6298765", "0.62896967", "0.62896615", "0.6276431", "0.6271566", "0.62472486", "0.6233384", "0.6230082", "0.6225113", "0.6208239", "0.6172592", "0.617214", "0.61669135", "0.6152131", "0.6137032", "0.61253923", "0.61158824", "0.6114336", "0.6109039", "0.61065656", "0.6106156", "0.6103667", "0.6098708", "0.6097582", "0.6084852", "0.60559094", "0.60505277", "0.60505277", "0.60505277", "0.6033382", "0.60241103", "0.6021228", "0.6012402", "0.6002212", "0.6000918", "0.598262", "0.5977191", "0.5974456", "0.5970834", "0.5959822", "0.59521073", "0.59509933", "0.59343785", "0.59324795", "0.5931945" ]
0.0
-1
Given the result of the game, give each move made either a reward or punishment
private void rememberGame(char result) { char playerPiece = game.getPlayer() == 0 ? 'H' : 'A'; if (result == playerPiece) { wins++; } else if (result == 'T') { ties++; } else { losses++; } // Loop through the short term memory and add each memory to the long term memory for (String memory : shortTermMemory) { BoardRecord boardRecord = longTermMemory.get(memory); //Board found in long term memory if (boardRecord != null) { //Win if (result == playerPiece) { boardRecord.setWins(boardRecord.getWins() + 1); } //Tie else if (result == 'T') { boardRecord.setTies(boardRecord.getTies() + 1); } //Lose else { boardRecord.setLosses(boardRecord.getLosses() + 1); } } // New board configuration else { //Win if (result == playerPiece) { boardRecord = new BoardRecord(1, 0, 0); } //Tie else if (result == 'T') { boardRecord = new BoardRecord(0, 1, 0); } //Lose else { boardRecord = new BoardRecord(0, 0, 1); } longTermMemory.put(memory, boardRecord); } } // Reset the short term memory after each game shortTermMemory = new ArrayList<>(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void noteNewTurn()\n {\n if ( traceStats && stateMachine.getInstanceId() == 1 )\n {\n ForwardDeadReckonLegalMoveInfo[] masterList = stateMachine.getFullPropNet().getMasterMoveList();\n for(int i = 0; i < bestResponseScores.length; i++)\n {\n float best = -Float.MAX_VALUE;\n float bestFollow = -Float.MAX_VALUE;\n int bestIndex = -1;\n int bestFollowIndex = -1;\n for(int j = 0; j < bestResponseScores.length; j++)\n {\n if ( responseSampleSize[i][j] > 0 )\n {\n float score = bestResponseScores[i][j]/responseSampleSize[i][j];\n if ( masterList[i].mRoleIndex != masterList[j].mRoleIndex)\n {\n if ( score > best )\n {\n best = score;\n bestIndex = j;\n }\n }\n else\n {\n if ( score > bestFollow )\n {\n bestFollow = score;\n bestFollowIndex = j;\n }\n }\n }\n }\n\n LOGGER.info(\"Best response to \" + masterList[i].mInputProposition + \": \" + (bestIndex == -1 ? \"NONE\" : masterList[bestIndex].mInputProposition + \" (\" + (100*best) + \"% [\" + responseSampleSize[i][bestIndex] + \"] )\"));\n LOGGER.info(\"Best follow-on to \" + masterList[i].mInputProposition + \": \" + (bestFollowIndex == -1 ? \"NONE\" : masterList[bestFollowIndex].mInputProposition + \" (\" + (100*bestFollow) + \"% [\" + responseSampleSize[i][bestFollowIndex] + \"] )\"));\n if ( bestIndex != -1 && opponentEquivalent[bestIndex] != bestFollowIndex )\n {\n int bestDeny = opponentEquivalent[bestIndex];\n LOGGER.info(\"Best denial to \" + masterList[i].mInputProposition + \": \" + (bestDeny == -1 ? \"NONE\" : masterList[bestDeny].mInputProposition + \" (\" + (100*(bestResponseScores[i][bestDeny]/responseSampleSize[i][bestDeny])) + \"% [\" + responseSampleSize[i][bestDeny] + \"] )\"));\n }\n }\n }\n\n // Reset the stats\n for(int i = 0; i < bestResponseScores.length; i++)\n {\n for(int j = 0; j < bestResponseScores.length; j++)\n {\n bestResponseScores[i][j] /= 2;\n responseSampleSize[i][j] /= 2;\n }\n }\n }", "private void rewardPlayer(Player player) {\n\t\tRandom number = new Random();\n\t\tint num = number.nextInt(100);\n\t\t\n\t\tif(num >= 80 && num < 90) {\n\t\t\tplayer.increaseAttacks();\n\t\t\tserver.addTextToLoggingWindow(\"Player (\" + player.getName() + \") got rewarded one attack\");\n\t\t\tserver.sendMessageToClient(player.getName(), \"@134@\" + \"0\" + \"@\");\n\t\t}\n\t\telse if(num >= 90 && num <= 100) {\n\t\t\tplayer.increaseSafeTP();\n\t\t\tserver.addTextToLoggingWindow(\"Player (\" + player.getName() + \") got rewarded one safe teleport\");\n\t\t\tserver.sendMessageToClient(player.getName(), \"@134@\" + \"1\" + \"@\");\n\t\t}\n\t}", "public void reward(){\n setLastDrop(System.currentTimeMillis());\n collect(1);\n }", "double getTotalReward();", "public void printResult(int result) {\n String message = \"\";\n switch (result) {\n case BattleshipGame.RESULT_HIT:\n message = \"Hit!\";\n break;\n case BattleshipGame.RESULT_MISS:\n message = \"Miss!\";\n break;\n case BattleshipGame.RESULT_SUNK:\n message = \"Sink!\";\n break;\n default:\n message = \"Invalid move!\";\n }\n System.out.println(message);\n }", "public abstract void rewards(Player p);", "public int runFromMuckrakerMove() throws GameActionException {\n\n //flag indicates best direction to move, not direction I am moving...\n\n boolean foundEnemyMuckraker = false;\n double rewardOfStaying = 9999;\n\n int canMoveIndicesSize = 0;\n int idx = 0;\n for (Direction direction : Constants.DIRECTIONS) {\n moveRewards[idx] = 9998;\n moveLocs[idx] = Cache.CURRENT_LOCATION.add(direction);\n if (controller.canMove(direction)) {\n canMoveIndices[canMoveIndicesSize++] = idx;\n }\n ++idx;\n }\n\n for (RobotInfo robotInfo : Cache.ALL_NEARBY_ENEMY_ROBOTS) {\n if (robotInfo.getType() == RobotType.MUCKRAKER) {\n foundEnemyMuckraker = true;\n MapLocation enemyLocation = robotInfo.location;\n //for all valid locations, find travelDistance...\n rewardOfStaying = Math.min(rewardOfStaying, Pathfinding.travelDistance(Cache.CURRENT_LOCATION, enemyLocation) + 0.01 * Cache.CURRENT_LOCATION.distanceSquaredTo(enemyLocation));\n for (int i = 0; i < idx; ++i) {\n moveRewards[i] = Math.min(moveRewards[i], Pathfinding.travelDistance(moveLocs[i], enemyLocation) + 0.01 * moveLocs[i].distanceSquaredTo(enemyLocation));\n }\n }\n }\n\n int flag = CommunicationMovement.encodeMovement(true, true, CommunicationMovement.MY_UNIT_TYPE.SL, CommunicationMovement.MOVEMENT_BOTS_DATA.NOT_MOVING, CommunicationMovement.COMMUNICATION_TO_OTHER_BOTS.NOOP, false, false, 0);\n int bestValidDirection = -1;\n double bestValidReward = rewardOfStaying;\n\n if (foundEnemyMuckraker) {\n int bestDirection = -1;\n double bestReward = rewardOfStaying;\n\n for (int i = 0; i < idx; ++i) {\n if (moveRewards[i] > bestReward) { //find the best direction based on the reward\n bestDirection = i;\n bestReward = moveRewards[i];\n }\n }\n\n /* MOVE TOWARDS ME IS SET SO POLITICANS CAN MOVE TOWARDS THIS BOT (NOT SLANDERERS) -> BE CAREFUL IF/WHEN PARSING THIS SETTING */\n flag = CommunicationMovement.encodeMovement(true, true, CommunicationMovement.MY_UNIT_TYPE.SL, CommunicationMovement.convert_DirectionInt_MovementBotsData(bestDirection), CommunicationMovement.COMMUNICATION_TO_OTHER_BOTS.MOVE_TOWARDS_ME, false, true, 0);\n\n for (int i = 0; i < canMoveIndicesSize; ++i) {\n if (moveRewards[canMoveIndices[i]] > bestValidReward) {\n bestValidDirection = canMoveIndices[i];\n bestValidReward = moveRewards[canMoveIndices[i]];\n }\n }\n }\n\n // if a politician or slanderer has both a muckraker and slanderer in range, then run away opposite of the danger direction\n int bestDirectionBasedOnPoliticianDangerIdx = -1;\n if (!foundEnemyMuckraker) {\n for (RobotInfo robotInfo : Cache.ALL_NEARBY_FRIENDLY_ROBOTS) {\n if (robotInfo.getType() == RobotType.POLITICIAN || robotInfo.getType() == RobotType.MUCKRAKER) {\n\n if (controller.canGetFlag(robotInfo.ID)) {\n int encodedFlag = controller.getFlag(robotInfo.ID);\n if (CommunicationMovement.decodeIsSchemaType(encodedFlag) &&\n CommunicationMovement.decodeIsDangerBit(encodedFlag)) {\n\n if (CommunicationMovement.decodeMyUnitType(encodedFlag) == CommunicationMovement.MY_UNIT_TYPE.PO\n || CommunicationMovement.decodeMyUnitType(encodedFlag) == CommunicationMovement.MY_UNIT_TYPE.MU) {\n //A POLITICIAN OR MUCKRAKER WHO SAYS HE IS IN DANGER (enemy muckraker nearby)\n CommunicationMovement.MOVEMENT_BOTS_DATA badArea = CommunicationMovement.decodeMyPreferredMovement(encodedFlag);\n int badIdx = CommunicationMovement.convert_MovementBotData_DirectionInt(badArea);\n Direction bestDirection = Constants.DIRECTIONS[badIdx].opposite();\n bestDirectionBasedOnPoliticianDangerIdx = bestDirection.ordinal();\n break;\n }\n }\n }\n }\n }\n }\n\n /* Set communication for other slanderers if there is a muckraker within my range */\n if (!Comms.hasSetFlag && controller.canSetFlag(flag)) {\n Comms.hasSetFlag = true;\n controller.setFlag(flag);\n }\n\n /* Below is based on movement */\n if (!controller.isReady()) return 1;\n\n if (foundEnemyMuckraker) {\n if (bestValidDirection != -1) {\n controller.move(Constants.DIRECTIONS[bestValidDirection]);\n return 2;\n }\n return 1;\n }\n\n\n /* No muckrakers were found, so we need to check the flags of nearby slanderer units instead. */\n double closestLocation = 9998;\n int preferedMovementDirectionIdx = -1;\n\n for (RobotInfo robotInfo : Cache.ALL_NEARBY_FRIENDLY_ROBOTS) {\n if (robotInfo.getType() == RobotType.POLITICIAN) { //SLANDERERS THINK ALL SLANDERERS ARE POLITICIANS, so we need to check politicians here...\n double dist = Pathfinding.travelDistance(Cache.CURRENT_LOCATION, robotInfo.location)\n + 0.01 * Cache.CURRENT_LOCATION.distanceSquaredTo(robotInfo.location);\n if (dist < closestLocation && controller.canGetFlag(robotInfo.ID)) { //the closest bot in danger to us is our biggest threat as well\n int encodedFlag = controller.getFlag(robotInfo.ID);\n\n if (CommunicationMovement.decodeIsSchemaType(encodedFlag)) {\n if (CommunicationMovement.decodeMyUnitType(encodedFlag) == CommunicationMovement.MY_UNIT_TYPE.SL && CommunicationMovement.decodeIsDangerBit(encodedFlag)) {\n CommunicationMovement.MOVEMENT_BOTS_DATA movementBotsData = CommunicationMovement.decodeMyPreferredMovement(encodedFlag);\n preferedMovementDirectionIdx = CommunicationMovement.convert_MovementBotData_DirectionInt(movementBotsData);\n closestLocation = dist;\n }\n }\n }\n }\n }\n\n if (preferedMovementDirectionIdx != -1) {\n Direction direction = Pathfinding.toMovePreferredDirection(Constants.DIRECTIONS[preferedMovementDirectionIdx], 1);\n if (direction != null) {\n controller.move(direction);\n return 2;\n }\n return 1;\n }\n\n if (bestDirectionBasedOnPoliticianDangerIdx != -1) {\n Direction direction = Pathfinding.toMovePreferredDirection(Constants.DIRECTIONS[bestDirectionBasedOnPoliticianDangerIdx], 1);\n if (direction != null) {\n controller.move(direction);\n return 2;\n }\n return 1;\n }\n\n return 0; // no reason whatsoever to move\n }", "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 step() {\r\n\t\tcard1 = player1.getCard();\r\n\t\tcard2 = player2.getCard();\r\n\t\twarPile.add(card1);\r\n\t\twarPile.add(card2);\r\n\t\tgameState = \"Player 1: \" + card1 + \"\\n\" + \"Player 2: \" + card2 + \"\\n\";\r\n\t\tif(card1.getRank() == card2.getRank()) {\r\n\t\t\tgameState = \"Cards added to the War Pile\" + \"\\n\";\r\n\t\t}else if(card1.getRank() > card2.getRank()){\r\n\t\t\ttransferCards(player1);\r\n\t\t\tgameState = \"Cards go to Player 1 \\n\";\r\n\t\t}else {\r\n\t\t\ttransferCards(player2);\r\n\t\t\tgameState = \"Cards go to Player 2 \\n\";\r\n\t\t}\r\n\t\tmoves ++;\r\n\t}", "private double getReward(History.HistoryView stateHistory){\n\t\tdouble reward = 0;\n\t\tList<DeathLog> friendlyDeaths = getDeaths(stateHistory, playernum);\n\t\tList<DeathLog> enemyDeaths = getDeaths(stateHistory, getEnemyId());\n\t\tList<DamageLog> friendlyDamages = getDamage(stateHistory, playernum);\n\t\tList<DamageLog> enemyDamages = getDamage(stateHistory, getEnemyId());\n\t\t\n\t\tfor(DeathLog friendlyDeath : friendlyDeaths){\n\t\t\treward -= 100;\n\t\t}\n\t\t\n\t\tfor(DeathLog enemyDeath : enemyDeaths){\n\t\t\treward += 100;\n\t\t}\n\t\t\n\t\tfor(DamageLog friendlyDamage : friendlyDamages){\n\t\t\treward -= friendlyDamage.getDamage();\n\t\t}\n\t\t\n\t\tfor(DamageLog enemyDamage : enemyDamages){\n\t\t\treward += enemyDamage.getDamage();\n\t\t}\n\t\t\n\t\treward -= .1;\n\t\treturn reward;\n\t}", "void giveReward(BPlayer bPlayer, int tier, int status);", "public HashMap<List<Integer>,Double> generateRewards(){\n\t\tHashMap<List<Integer>,Double> futRewards = new HashMap<List<Integer>,Double>();\n\t\tfor (List<Integer> state : this.states) {\n\t\t\tfutRewards.put(state,obtainReward(state));\n\t\t}\n\t\treturn futRewards;\n\t\t\n\t}", "public getEmployeeRewards_result(getEmployeeRewards_result other) {\n if (other.isSetSuccess()) {\n this.success = new com.moseeker.thrift.gen.employee.struct.RewardsResponse(other.success);\n }\n }", "public abstract int getReward(int initialState, int initialAction);", "public void updateResult(Result result) throws Exception {\r\n\t\tdouble normalizedReward = getNormalizedReward(result);\r\n\t\tfor (; stage >= 0; stage--) {\r\n\t\t\tif (result instanceof WinBeforeShowdown)\r\n\t\t\t\ttrees[index()].backtrackWBS(normalizedReward);\r\n\t\t\telse if (result instanceof Showdown)\r\n\t\t\t\ttrees[index()].backtrackSD(normalizedReward,\r\n\t\t\t\t\t\tevaluator.getHandStength(getOpponentHoleCards((Showdown) result), boards[stage], 1));\r\n\t\t}\r\n\t\tfor (int i = 0; i < 4; i++) {\r\n\t\t\ttrees[position + 2 * i].refresh();\r\n\t\t}\r\n\t}", "public double getReward() {\n return reward;\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 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}", "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 }", "public void Move(){\n for(int i = 0; i < moveList.length; i++){\n playerString = \"\";\n switch(moveList[i]) {\n case 1: {\n //TODO: Visited points to others\n System.out.println(\"Moving up!\");\n //Logic for fitness score might need to be moved\n if(!(game.mazeArray[game.playerPosition.getPlayerY() -1][game.playerPosition.getPlayerX()] == 1)){\n playerString.concat(\"game.playerPosition.getPlayerY() - 1 + game.playerPosition.getPlayerX()\");\n if(vistedMoves.contains(playerString)){\n vistedPoints += 2;\n } else {\n freedomPoints += 5;\n vistedMoves.add(playerString);\n }\n } else {\n System.out.println(\"Stuck\");\n wallHugs += 10;\n }\n game.moveUp();\n if(game.checkWin()){\n freedomPoints += 200;\n }\n break;\n }\n case 2: {\n System.out.println(\"Moving left!\");\n if(!(game.mazeArray[game.playerPosition.getPlayerY()][game.playerPosition.getPlayerX() -1] == 1)){\n playerString.concat(\"game.playerPosition.getPlayerY() + game.playerPosition.getPlayerX() -1\");\n if(vistedMoves.contains(playerString)){\n vistedPoints += 2;\n } else {\n freedomPoints += 5;\n vistedMoves.add(playerString);\n }\n } else {\n System.out.println(\"Stuck\");\n wallHugs += 1;\n }\n game.moveLeft();\n if(game.checkWin()){\n freedomPoints += 200;\n }\n break;\n }\n case 3: {\n System.out.println(\"Moving right!\");\n if(!(game.mazeArray[game.playerPosition.getPlayerY()][game.playerPosition.getPlayerX() +1] == 1)){\n playerString.concat(\"game.playerPosition.getPlayerY() + game.playerPosition.getPlayerX() +1\");\n if(vistedMoves.contains(playerString)){\n vistedPoints += 2;\n } else {\n freedomPoints += 5;\n vistedMoves.add(playerString);\n }\n } else {\n System.out.println(\"Stuck\");\n wallHugs += 1;\n }\n game.moveRight();\n if(game.checkWin()){\n freedomPoints += 200;\n }\n break;\n }\n case 4: {\n System.out.println(\"Moving down!\");\n if(!(game.mazeArray[game.playerPosition.getPlayerY() +1][game.playerPosition.getPlayerX()] == 1)){\n playerString.concat(\"game.playerPosition.getPlayerY() + 1 + game.playerPosition.getPlayerX()\");\n if(vistedMoves.contains(playerString)){\n vistedPoints += 2;\n } else {\n freedomPoints += 5;\n vistedMoves.add(playerString);\n }\n freedomPoints += 1;\n } else {\n System.out.println(\"Stuck\");\n wallHugs += 1;\n }\n game.moveDown();\n if(game.checkWin()){\n freedomPoints += 200;\n }\n break;\n }\n default: {\n System.out.println(\"End of line\");\n break;\n //You shouldn't be here mate.\n }\n }\n }\n\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 }", "public void makeMove() {\n\t\tif (CheckForVictory(this)) {\n\t\t\t// System.out.println(\"VICTORY\");\n\t\t\tInterface.goalReached = true;\n\t\t\tfor (int i = 0; i < tmpStrings.length; i++) {\n\t\t\t\tif (moveOrder[i] == 0)\n\t\t\t\t\ttmpStrings[i] = \"turn left\";\n\t\t\t\telse if (moveOrder[i] == 1)\n\t\t\t\t\ttmpStrings[i] = \"turn right\";\n\t\t\t\telse\n\t\t\t\t\ttmpStrings[i] = \"go forward\";\n\n\t\t\t\tInterface.info.setText(\"Generation: \" + Parallel.generationNo + 1 + \" and closest distance to goal: \" + 0);\n\t\t\t}\n\t\t} else {\n\t\t\tmoveOrder[this.movesMade] = moves.remove();\n\t\t\tswitch (moveOrder[this.movesMade]) {\n\t\t\tcase (0):\n\t\t\t\tthis.movesMade++;\n\t\t\t\tif (face == 0)\n\t\t\t\t\tface = 3;\n\t\t\t\telse\n\t\t\t\t\tface--;\n\t\t\t\tbreak;\n\t\t\tcase (1):\n\t\t\t\tthis.movesMade++;\n\t\t\t\tif (face == 3)\n\t\t\t\t\tface = 0;\n\t\t\t\telse\n\t\t\t\t\tface++;\n\t\t\t\tbreak;\n\t\t\tcase (2):\n\t\t\t\tthis.movesMade++;\n\t\t\t\tif (face == 0 && Y - 1 >= 0)\n\t\t\t\t\tY--;\n\t\t\t\telse if (face == 1 && X + 1 <= map[0].length - 1)\n\t\t\t\t\tX++;\n\t\t\t\telse if (face == 2 && Y + 1 <= map.length - 1)\n\t\t\t\t\tY++;\n\t\t\t\telse if (face == 3 && X - 1 >= 0)\n\t\t\t\t\tX--;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tSystem.out.println(\"Error making move :(\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\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}", "public void advanceGame() {\n\t\tthis.status = Status.Active;\n\t\tthis.currentSuggestion = null;\n\t\tfor(User u : this.players) {\n\t\t\tu.availableActions.remove(ACTION.Wait);\n\t\t\tu.availableActions.remove(ACTION.Disprove);\n\t\t}\n\t\t\n\t\t// Next player can always move\n\t\tUser nextPlayer = null;\n\t\tdo {\n\t\t\tnextPlayer = getFollowingPlayer(this, this.getCurrentPlayer());\n\t\t\tif (nextPlayer.isActive) {\n\t\t\t\tnextPlayer.availableActions.add(ACTION.Move);\n\t\t\t\tif (this.board.getLocation(nextPlayer.character).isRoom) {\n\t\t\t\t\tnextPlayer.availableActions.add(ACTION.Accuse);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcurrentMove++;\n\t\t} while (!nextPlayer.isActive);\n\t\t\n\t\tif (activeUserCount(this) == 1) {\n\t\t\t// Last player remaining is the winner (by default)\n\t\t\tthis.status = Status.Complete;\n\t\t\tmessages.add(String.format(\"[ %s ] has won the game (by default)!\", nextPlayer.name));\n\t\t}\n\t}", "public Reward getRewards(){\n reward = ((EnemyRoom)room).giveReward();\n return reward;\n }", "@Override\n\tpublic void happen(int rollResult) {\n\t\tint i = 0;\n\t\tBoolean greaterThan2 = true;\n\t\twhile (i < 4){\n\t\t\tif (rollResult < 2 ){\n\t\t\t\tgreaterThan2 = false;\n\t\t\t\tswitch (i){\n\t\t\t\t\tcase 0: Game.getInstance().getCurrentCharacter().decrementKnowledge(); break;\n\t\t\t\t\tcase 1: Game.getInstance().getCurrentCharacter().decrementMight(); break;\n\t\t\t\t\tcase 2: Game.getInstance().getCurrentCharacter().decrementSanity(); break; \n\t\t\t\t\tcase 3: Game.getInstance().getCurrentCharacter().decrementSpeed(); break;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\t\n\t\tif(greaterThan2){\n\t\t\tGame.getInstance().getCurrentCharacter().incrementKnowledge(); // TODO: Change this to allow player to choose trait\n\t\t}\n\t}", "@Override\n public void gameOver(Result result, Move lastMove) {\n }", "public AgentAction getNextMove(GameTile [][] visibleMap) {\r\n\t\t//Possible things to add to your moves\r\n//\t\tnextMove = AgentAction.doNothing;\r\n//\t\tnextMove = AgentAction.moveDown;\r\n//\t\tnextMove = AgentAction.moveUp;\r\n//\t\tnextMove = AgentAction.moveUp;\r\n//\t\tnextMove = AgentAction.moveLeft;\r\n//\t\tnextMove = AgentAction.pickupSomething;\r\n//\t\tnextMove = AgentAction.declareVictory;\r\n//\r\n//\t\tnextMove = AgentAction.shootArrowNorth;\r\n//\t\tnextMove = AgentAction.shootArrowSouth;\r\n//\t\tnextMove = AgentAction.shootArrowEast;\r\n//\t\tnextMove = AgentAction.shootArrowWest;\r\n//\t\tnextMove = AgentAction.quit\r\n\t\t\r\n\t\t\r\n\r\n\t\t//Ideally you would remove all this code, but I left it in so the keylistener would work\r\n\t\tif(keyboardPlayOnly) {\r\n\t\t\tif(nextMove == null) {\r\n\t\t\t\treturn AgentAction.doNothing;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tAgentAction tmp = nextMove;\r\n\t\t\t\tnextMove = null;\r\n\t\t\t\treturn tmp;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t\telse {\r\n\t\t\t//This code plays 5 \"games\" and then quits\r\n\t\t\t//Just does random things\r\n\t\t\tif(numGamesPlayed > 19) {\r\n\t\t\t\treturn AgentAction.quit;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tif(nextMoves.isEmpty()) {\r\n\t\t\t\t\tsetStartingPosition(visibleMap);\r\n//\t\t\t\t\tfindWumpus(visibleMap);\r\n//\t\t\t\t\tfindWumpus(visibleMap);\r\n//\t\t\t\t\tWumpusState currentState = huntTheWumpus(visibleMap);\r\n//\t\t\t\t\tSystem.out.println(wumpusHunted);\r\n//\t\t\t\t\tif(wumpusHunted) {\r\n//\t\t\t\t\t\tcurrentState.setParent(null);\r\n//\t\t\t\t\t\taddToNextMoves(currentState);\r\n//\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t//this is the code to collect the gold\r\n//\t\t\t\t\tcurrentState.setParent(null);\r\n//\t\t\t\t\tcurrentState = findTheGold(currentState);\r\n//\t\t\t\t\tif(currentState.getGoldCollected()) {\r\n//\t\t\t\t\t\tcurrentState.setParent(null);\r\n//\t\t\t\t\t\taddToNextMoves(currentState);\r\n//\t\t\t\t\t}\r\n\t\t\t\t\tif(!goldCollected) {\r\n\t\t\t\t\t\twellItsDarkNow(visibleMap);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(goldCollected) {\r\n//\t\t\t\t\t\tcurrentState.setParent(null);\r\n\t\t\t\t\t\taddToNextMoves(visibleMap);\r\n//\t\t\t\t\t\tgoldCollected = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\tif(!nextMoves.isEmpty()) {\r\n\t\t\t\t\tSystem.out.println(nextMoves.peek());\r\n\t\t\t\t\tsetNextMove(nextMoves.remove());\r\n//\t\t\t\t\tSystem.out.println(nextMove);\r\n//\t\t\t\t\treturn nextMove;\r\n\t\t\t\t}\r\n\t\t\t\treturn nextMove;\r\n//\t\t\t\tcurrentNumMoves++;\r\n//\t\t\t\tif(currentNumMoves < 20) {\r\n//\t\t\t\t\treturn AgentAction.randomAction();\r\n//\t\t\t\t}\r\n//\t\t\t\telse {\r\n//\t\t\t\t\treturn AgentAction.declareVictory;\r\n//\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t}", "public void gameOutcome(){\n for (Player p : Game.getInstance().getPlayers()){\n\n if (placement.isEmpty()){\n placement.add(p);\n }else {\n int index = getPlacement(p);\n\n if (index != placement.size()) {\n placement.add(index, p);\n }else {\n placement.add(p);\n }\n }\n\n }\n }", "public void createExpReward() {\n try {\n int exp = RandomBenefitModel.getExpReward(encounter, characterVM.getDistance());\n if (exp > 0) characterVM.addExp(exp);\n } catch (JSONException e) {\n e.printStackTrace();\n }\n }", "public void tellPlayerResult(int winner) {\n\t}", "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 void Reinforcements()\n{\n\tSystem.out.println(\"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\");\n\tSystem.out.println(\"$$$$$$$$$$$$$ REINFORCEMENTS $$$$$$$$$$$$$$$$$\\n\\n\");\n\t int answer=1;\n do\n {\n\t System.out.println(name+\", you have \"+wealth+\" gold coins.\\n\" );\n\t System.out.println(\"$$$$$$$$ RATES $$$$$$$$\");\n\t System.out.println(\"1 health potions for 1 gold coin\");\n\t System.out.println(\"An improved weapon for 150 gold coins\");\n\t System.out.println(\"Non-refundable :)\");\n\t System.out.println(\"$$$$$$$$$$$$$$$$$$$$$$$$$\\n\");\n\t\tScanner scan=new Scanner(System.in);\n\n\n\t do\n\t{\n\t if(answer!=0&&answer!=1&&answer!=2)\n\t \tSystem.out.print(\"Error in Input! \");\n\t \tSystem.out.println(\"What would you like to buy (0=nothing/done, 1=health potions, 2=better weapon)?\");\n\t answer=scan.nextInt();\n }while(answer!=0&&answer!=1&&answer!=2);\n\n\n\tif (answer==1)\n\t{\n\t\tint exchange=0;\n\t\t\tdo\n\t\t{\n\t\t\tif(exchange<0||exchange>wealth)\n\t\t\t\tSystem.out.print(\"Error in Input! \");\n\n\t\t\tSystem.out.println(\"How many health potions would you like?(cannot be negative or more than your gold coins)\");\n\t exchange=scan.nextInt();\n\t\t}while(exchange<0||exchange>wealth);\n\n\t\t\twealth-=exchange;\n\t\t\thealth+=exchange;\n\t\t\tSystem.out.println(name+\" increases health by \"+exchange+\" potions.\");\n\t\t\tSystem.out.println(name+\" decreases wealth by \"+exchange+\" gold coins.\\n\");\n\n\t}\n\telse if(answer==2)\n\t{\n\t\tif(weapon<8)\n\t {\n\n\t\t\t weapon++;\n\n\n\t\tif(wealth>=150)\n\t\t{\n\t\t\twealth-=150;\n\n\t\t\tSystem.out.println(name+\"\\'s weapon has been improved to \"+WeaponName(weapon)+\".\");\n\t\t\tSystem.out.println(name+\" decreases wealth by 150 gold coins.\\n\" );\n\t\t}\n\t\telse\n\t\t{\n\t\t\tint temp=wealth;\n\t\t\thealth+=temp-150;\n\t\t\twealth=0;\n\n\t\tSystem.out.println(name+\"\\'s weapon has been improved to \"+WeaponName(weapon));\n\t\tSystem.out.println(name+\" decreases wealth by \"+temp+\" gold coins.\" );\n\t\tSystem.out.println(name+\" decreases health by \"+(150-temp)+\" portions.\\n\");\n\t\t}\n\t }\n\t \telse\n\t {\n\t \t\tweapon=8;\n\t \t\tSystem.out.println(\"You have updated to the most powerful weapon!!!-----\"+WeaponName(weapon)+\".\\n\" );\n\t }\n\n\t }\n\t else\n\t \tanswer=0;\n\n } while(answer!=0);\n}", "@Override\n public synchronized void postWinner(char result) {\n rememberGame(result);\n\n //Increase the heat (decrease randomness) as more games are played\n if (heat < heatMax && gamesPlayed % 50 == 0) heat++;\n\n gamesPlayed++;\n game = null; // No longer playing a game though.\n }", "@Override\r\n\tpublic void nextGuessResult(ResultPegs resultPegs) {\r\n\t\t// TODO Auto-generated method stub\r\n\t\t\r\n\t\t// Not used here\r\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 }", "@Override\n public void onRewarded(RewardItem reward) {\n\n // Reward the user.\n }", "public Tuple move(Board board, Dice dice, BuildDice bdice) {\n // Throw Dice\n int result = dice.roll();\n System.out.println(ANSI() + \"Player\" + id + \" rolls dice\" + ANSI_RESET);\n System.out.println(ANSI() + \"Player\" + id + \" please press any button\" + ANSI_RESET);\n Scanner s = new Scanner(System.in);\n String str = s.nextLine();\n System.out.println(\"Dice: \" + result);\n System.out.println();\n\n // Render legal your previous position\n board.legal[posX][posY] = 0; \n\n boolean capital = false, bank = false;\n Tuple res = new Tuple();\n Tuple player_pos = new Tuple(posX, posY);\n board.setShow(player_pos, board.board[posX][posY]);\n\n for (int i=0; i<result; i++) {\n int x1, x2, y1, y2, x3, y3, x4, y4;\n\n // right\n x1 = posX;\n y1 = posY + 1;\n // up \n x2 = posX - 1;\n y2 = posY;\n // left\n x3 = posX;\n y3 = posY - 1;\n // down\n x4 = posX + 1;\n y4 = posY;\n \n char c1 = board.board[x1][y1];\n char c2 = board.board[x2][y2];\n char c3 = board.board[x3][y3];\n char c4 = board.board[x4][y4];\n\n if (board.board[posX][posY] == 'S') {\n res.a = 6;\n res.b = 11; \n }\n else if ((c1 == 'B' || c1 == 'C' || c1 == 'H' || c1 == 'S' || c1 == 'E' || c1 == 'e') \n && (prevx != x1 || prevy != y1)) {\n res.a = x1;\n res.b = y1;\n }\n else if ((c2 == 'B' || c2 == 'C' || c2 == 'H' || c2 == 'S' || c2 == 'E' || c2 == 'e') \n && (prevx != x2 || prevy != y2)) {\n res.a = x2;\n res.b = y2;\n }\n else if ((c3 == 'B' || c3 == 'C' || c3 == 'H' || c3 == 'S' || c3 == 'E' || c3 == 'e') \n && (prevx != x3 || prevy != y3)) {\n res.a = x3;\n res.b = y3;\n }\n else if ((c4 == 'B' || c4 == 'C' || c4 == 'H' || c4 == 'S' || c4 == 'E' || c4 == 'e') \n && (prevx != x4 || prevy != y4)) {\n res.a = x4;\n res.b = y4;\n }\n\n prevx = posX;\n prevy = posY;\n // (res.a, res.b) is my next position\n posX = res.a;\n posY = res.b;\n\n // Check if player passes Bank ---> + 1000 MLS\n if (posX == board.B.a && posY == board.B.b) \n bank = true;\n \n // Check if player passes Capital ---> entrance ??\n if (posX == board.C.a && posY == board.C.b)\n capital = true;\n\n // if last round of dice result\n if (i == result - 1) {\n int legal = board.setLegal(prevx, prevy, posX, posY);\n if (legal == 0) {\n res.a = posX;\n res.b = posY;\n }\n // Someone else is on this position\n else if (legal == 1) {\n boolean ans = false;\n while (!ans) {\n // right\n x1 = posX;\n y1 = posY + 1;\n // up \n x2 = posX - 1;\n y2 = posY;\n // left\n x3 = posX;\n y3 = posY - 1;\n // down\n x4 = posX + 1;\n y4 = posY;\n \n c1 = board.board[x1][y1];\n c2 = board.board[x2][y2];\n c3 = board.board[x3][y3];\n c4 = board.board[x4][y4];\n \n if (board.board[posX][posY] == 'S') {\n res.a = 6;\n res.b = 11; \n }\n else if ((c1 == 'B' || c1 == 'C' || c1 == 'H' || c1 == 'S' || c1 == 'E' || c1 == 'e') \n && (prevx != x1 || prevy != y1)) {\n res.a = x1;\n res.b = y1;\n }\n else if ((c2 == 'B' || c2 == 'C' || c2 == 'H' || c2 == 'S' || c2 == 'E' || c2 == 'e') \n && (prevx != x2 || prevy != y2)) {\n res.a = x2;\n res.b = y2;\n }\n else if ((c3 == 'B' || c3 == 'C' || c3 == 'H' || c3 == 'S' || c3 == 'E' || c3 == 'e') \n && (prevx != x3 || prevy != y3)) {\n res.a = x3;\n res.b = y3;\n }\n else if ((c4 == 'B' || c4 == 'C' || c4 == 'H' || c4 == 'S' || c4 == 'E' || c4 == 'e') \n && (prevx != x4 || prevy != y4)) {\n res.a = x4;\n res.b = y4;\n }\n\n prevx = posX;\n prevy = posY;\n // (res.a, res.b) is my next position\n posX = res.a;\n posY = res.b;\n\n legal = board.setLegal(prevx, prevy, posX, posY);\n if (legal == 0) {\n ans = true;\n }\n \n // Check if player passes Bank ---> + 1000 MLS\n if (posX == board.B.a && posY == board.B.b) \n bank = true;\n \n // Check if player passes Capital ---> entrance ??\n if (posX == board.C.a && posY == board.C.b)\n capital = true; \n \n } // endwhile\n\n } // endelseif(legal==1)\n\n // Check if player passes Bank ---> + 1000 MLS\n if (posX == board.B.a && posY == board.B.b)\n bank = true;\n // Check if player passes Capital ---> entrance ??\n if (posX == board.C.a && posY == board.C.b)\n capital = true;\n\n } // endif(i==result-1)\n \n } // endfor\n\n /* ΔΙΝΩ ΠΡΟΤΕΡΑΙΟΤΗΤΑ ΠΡΩΤΑ ΣΤΟ ΝΑ ΠΑΙΡΝΩ ΧΡΗΜΑΤΑ ΑΠΟ ΤΗΝ ΤΡΑΠΕΖΑ\n * ΜΕΤΑ ΣΤΟ ΝΑ ΠΛΗΡΩΣΩ ΣΤΟΝ ΑΝΤΙΠΑΛΟ ΜΟΥ\n * ΜΕΤΑ ΣΤΟ ΝΑ ΜΠΟΡΩ ΝΑ ΑΓΟΡΑΣΩ ΕΙΣΟΔΟ Ή ΝΑ ΧΤΙΣΩ Ή ΝΑ ΑΓΟΡΑΣΩ ΞΕΝΟΔΟΧΕΙΟ\n */\n\n System.out.println(ANSI() + \"Player\" + id + \" is moving to position (\" + res.a + \", \" + res.b + \") \" + board.board[res.a][res.b] + \".\" + ANSI_RESET); \n System.out.println();\n if (!hotel_list.isEmpty()) {\n System.out.println(ANSI() + \"Player\" + id + \" hotels:\" + ANSI_RESET);\n for (HotelCard hc : hotel_list) {\n System.out.println(ANSI() + hc.getName() + ANSI_RESET);\n }\n }\n\n // Find player's position on the show board\n board.setShow(res, getMisc());\n\n // Player has passed from Bank, if (bank == true)\n if (bank)\n bank();\n\n // Check if player is on a rival's entrance \n pay(res, dice, board);\n // Check for bankrupt\n if (status == false) return null;\n\n /* Player has passed from Capital, if (capital == true)\n * Player moves to E --> wants to buy an entrance or upgrade??\n */ \n if ((capital || board.board[res.a][res.b] == 'E' || board.board[res.a][res.b] == 'e') \n && !hotel_list.isEmpty()) {\n String cap = null, build = \"no\";\n if (capital) cap = wantsEntrance(\"capital\");\n else if (board.board[res.a][res.b] == 'E' || board.board[res.a][res.b] == 'e') {\n cap = wantsEntrance(\"E\");\n if (cap.equals(\"no\")) {\n System.out.println(ANSI() + \"Want to build or upgrade a hotel?\" + ANSI_RESET);\n build = wantsBuild();\n }\n }\n // wantsEntrance() result\n if (cap.equals(\"yes\")) {\n System.out.println(ANSI() + \"Player\" + id + \" MLS is: \" + mls + \".\" + ANSI_RESET);\n HotelCard cap_hotel = searchHotel();\n System.out.println(ANSI() + \"Give the (line, column) of entrance position\"+ ANSI_RESET);\n int line = -1, column = -1;\n boolean answer = false;\n System.out.println(ANSI() + \"Give line\" + ANSI_RESET);\n while (answer == false) {\n s = new Scanner(System.in);\n str = s.nextLine();\n try {\n line = Integer.parseInt(str);\n answer = true; \n } catch (Exception e) {\n System.out.println(ANSI() + \"Give integer line\" + ANSI_RESET);\n } \n }\n System.out.println(ANSI() + \"Give column\" + ANSI_RESET);\n answer = false;\n while (answer == false) {\n s = new Scanner(System.in);\n str = s.nextLine();\n try {\n column = Integer.parseInt(str);\n answer = true; \n } catch (Exception e) {\n System.out.println(ANSI() + \"Give integer column\" + ANSI_RESET);\n } \n } \n Tuple pos = new Tuple(line, column);\n buyEntrance(cap_hotel, pos, board);\n }\n // wantsBuild() result\n else if (build.equals(\"yes\")) {\n System.out.println(ANSI() + \"Player\" + id + \" MLS is: \" + mls + ANSI_RESET);\n HotelCard cap_hotel = searchHotel();\n build(cap_hotel, bdice);\n }\n }\n \n // Player is on \"H\" --> Wants to buy??\n else if (board.board[res.a][res.b] == 'H') {\n String buy;\n System.out.println(ANSI() + \"Player\" + id + \" MLS is: \" + mls + ANSI_RESET);\n System.out.println(ANSI() + \"Want to buy a hotel?\" + ANSI_RESET);\n buy = wantsBuy();\n if (buy.equals(\"yes\")) { \n HotelCard buy_hotel = searchAdjacentHotels(board, res); \n buyHotel(buy_hotel);\n }\n }\n\n // After all, player's movement reach to an end...\n return res; \n }", "@Override\r\n public void executeReinforcement() {\r\n notifyView();\r\n\r\n Integer getReinforcementCountFromCards = getReinforcementCountFromValidCardsAI();\r\n Integer totalReinforcementArmyCount = getReinforcementCountFromCards + calculateReinforcementArmy();\r\n ReinforcementPhaseState reinforcementPhase = new ReinforcementPhaseState();\r\n reinforcementPhase.setNumberOfArmiesReceived(totalReinforcementArmyCount);\r\n\r\n reinforcementPhaseState.add(reinforcementPhase);\r\n\r\n notifyView();\r\n placeArmy(totalReinforcementArmyCount);\r\n\r\n }", "public void displayReceivedRewards() {\n ;////System.out.println(\"\");\n ;////System.out.println(\"displayReceivedRewards() called...\");\n ;////System.out.println(\"-playerModelDiff1: \" + playerModelDiff1.toString());\n ;////System.out.println(\"-playerModelDiff4: \" + playerModelDiff4.toString());\n ;////System.out.println(\"-playerModelDiff7: \" + playerModelDiff7.toString());\n }", "public void rMadridGoal(View view) {\n scoreForR_madrid = scoreForR_madrid + 1;\n displayForRmadrid(scoreForR_madrid);\n }", "@Override\n protected void performActionResults(Action targetingAction) {\n PhysicalCard cardToSteal = targetingAction.getPrimaryTargetCard(targetGroupId);\n\n // Perform result(s)\n action.appendEffect(\n new StealCardToLocationEffect(action, cardToSteal));\n }", "private int calculateReward(int... person) {\n int reward = 0;\n for (int speed :getRightSide()) reward+=10;\n\n // if there is only one person\n if(person.length == 1) return reward+=highestSpeed-person[0];\n\n // Take the person with the highest time taken / slower speed\n // to be used to determine the speed they cross the bridge\n int speed = (person[0]>person[1]) ? person[0] : person[1];\n\n reward += highestSpeed-speed;\n return reward;\n }", "public abstract void nextGuessResult(ResultPegs resultPegs);", "private static void returnDoMove(String playerName, int kord1,int kord2,HttpServletResponse response, String url) throws IOException {\n GameOptions game = GamesSingleton.games.get(url);\n game.MakeStep(playerName,kord1,kord2);\n response.sendRedirect(url);\n\n }", "private void targetLostResponse(){\n\t\tswitch(state){\r\n\t\tcase(PURSUIT):\r\n\t\t\tstate=HUNTING;\r\n\t\t\tTile[] targetChoices=adjacentUnseenTiles(level(),targetTile);\r\n\t\t\tif(targetChoices[0]==null)\r\n\t\t\t\tstate=IDLE;\r\n\t\t\ttargetLostResponse();\r\n\t\t\tbreak;\r\n\t\tcase(HUNTING):\t//TODO: after reaching target tile, guess a new target tile, up to a point. (define what that point is) Eventually resume wandering.\r\n\t\t\tif(targetTile!=null){\r\n\t\t\t\tif(!targetTile.equalTo(monster.currentTile)){\r\n\t\t\t\t\tsaveMove();\r\n\t\t\t\t\tmonster.moveTowards(targetTile);\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\t//if(!monster.currentTile.equalTo(plannedPath[0]))\r\n\t\t\t\t\t//\tmonster.moveTowards(plannedPath[0]);\r\n\t\t\t\t\tstate=IDLE;\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tstate=IDLE;\r\n\t\t\t\ttargetLostResponse();\r\n\t\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase(IDLE):\r\n\t\t\twander();\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}", "public void createGoldReward() {\n try {\n int gold = RandomBenefitModel.getGoldReward(encounter, characterVM.getDistance());\n if (gold > 0) characterVM.goldChange(gold);\n } catch (JSONException e) {\n e.printStackTrace();\n }\n }", "@Override\n public String sense(String state, double reward) {\n return \"1,1\";\n }", "private void updateRewardsPoints(int amount)\n\t{\n\t\tif(\tfileIO.rewardPoints - amount >= 0){\n\t\t\tfileIO.getPrefs();\n\t\t\tfileIO.rewardPoints = fileIO.rewardPoints - amount;\n\t\t\tfileIO.setPrefs();\n\t\t\trewardPointsTV.setText(Integer.toString(fileIO.rewardPoints));\n\t\t}\n\t\telse\n\t\t{\n\t\t\tmakeToast(\"You don't have enough points for that reward. You can earn more points by completing tasks.\", true);\n\t\t}\n\t}", "public void evaluate(GameState gm, List<ScoredMove> moves) {\n\t\tfloat d = 0;\n\t\tCardSet cs;\n\t\tfloat newBattleListScore = 0;\n\t\t\n\t\tfloat currentHandScore = calcCardSetScore(gm, getHand());\n\t\tfloat currentBattleListScore = calcBattleListScore(gm, gm.getBattleList());\n\t\tfloat unknownCardsScore = calcCardSetScore(gm, getUnknownCards());\n\t\t\n\t\tif (super.getVerbosity()) {\n\t\t\tSystem.out.println(\"Current Hand Score: \" + currentHandScore);\n\t\t\tSystem.out.println(\"Current BattleList Score: \" + currentBattleListScore);\n\t\t\tSystem.out.println(\"UnknownCards Score: \" + unknownCardsScore\n\t\t\t\t+ \" | Count: \" + getUnknownCards().getCount() + \" | Avg/card: \" + \n\t\t\t\tunknownCardsScore/(float)getUnknownCards().getCount());\n\t\t}\n\t\t\n\t\tfor (ScoredMove m: moves) {\n\t\t\tif (m.getMove().getAction() == ACTION.DRAW) {\n\t\t\t\td = calcDrawScore(gm) + currentHandScore + currentBattleListScore;\n\t\t\t}\n\t\t\telse if (m.getMove().getAction() == ACTION.PLAY_ATTACK) {\n\t\t\t\tcs = new CardSet(getHand());\n\t\t\t\tcs.removeCard(m.getMove().getCard());\n\t\t\t\tnewBattleListScore = calcBattleListScore(gm, createNewBattleList(gm, m.getMove()));\n\t\t\t\td= calcCardSetScore(gm, cs) + newBattleListScore; \n\t\t\t}\n\t\t\telse if (m.getMove().getAction() == ACTION.PLAY_MERCHANT_SHIP) {\n\t\t\t\tcs = new CardSet(getHand());\n\t\t\t\tcs.removeCard(m.getMove().getCard());\n\t\t\t\tnewBattleListScore = calcBattleListScore(gm, createNewBattleList(gm, m.getMove()));\n\t\t\t\td= calcCardSetScore(gm, cs) + newBattleListScore;\n\t\t\t}\n\t\t\telse if (m.getMove().getAction() == ACTION.DISCARD) {\n\t\t\t\tcs = new CardSet(getHand());\n\t\t\t\tcs.removeCard(m.getMove().getCard());\n\t\t\t\td = calcCardSetScore(gm, cs) + currentBattleListScore;\n\t\t\t}\n\t\t\t\n\t\t\t// TODO: could be done better somewhere else?\n \t\tif (m.getMove().getAction() != ACTION.PLAY_MERCHANT_SHIP) {\n\t\t\t\td += calcMShipPenaltyScore(gm);\n\t\t\t}\n\t\t\t\n\t\t\tm.setScore(d);\n\t\t\tif (super.getVerbosity()) {\n\t\t\t\tSystem.out.println(m);\n\t\t\t}\n\t\t}\n\t}", "private void rewardTransaction (PublicKey recipient, ArrayList<Transfer> transfers) {\n int rewardTransferId = 0;\n if (!transfers.isEmpty()) {\n Transfer latestTransfer = this.transfers.get(this.transfers.size() - 1);\n rewardTransferId = latestTransfer.transferId + 1;\n }\n\n transfers.add(new Transfer(100, recipient, rewardTransferId));\n }", "@Override\n\t\t\tpublic double reward(State s1, Action a, State s2) {\n\t\t\t\tif ((Double)s2.get(\"x\") >= 0.5) {\n\t\t\t\t\treturn 100;\n\t\t\t\t}\n\t\t\t\tif ((Double)s2.get(\"x\") == mcGen.physParams.xmin) {\n\t\t\t\t\treturn -100;\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t}", "@Override\n protected Move makeDecision() {\n myTurn = index();\n /* block the nearest + most effective player (as in, people who arent blocked) */\n ArrayList<Move> pathMoves = new ArrayList<>();\n ArrayList<Move> playMoves = new ArrayList<>();\n ArrayList<Move> discardMoves = new ArrayList<>();\n Map<Integer, Card> destroyCards = new HashMap<Integer, Card>();\n Map<Integer, Card> repairCards = new HashMap<Integer, Card>();\n Map<Integer, Card> blockCards = new HashMap<Integer, Card>();\n Map<Integer, Card> pathCards = new HashMap<Integer, Card>();\n Set<Position> reachable = game().board().getReachable();\n canSee=false;\n canMove=false;\n canBlock=false;\n canRockfall=false;\n canRepair=false;\n int len = hand().size();\n for (int i = 0; i < len; ++i) {\n Card c = hand().get(i);\n if (c instanceof PathCard && !isSabotaged()) {\n pathCards.put(i,c);\n// pathMoves.addAll(generatePossiblePaths(i, (PathCard) c));\n canMove = true;\n }\n if (c instanceof PlayerActionCard) {\n// playMoves.addAll(generatePossiblePlayerActions(i, (PlayerActionCard) c));\n if(c.type()== Card.Type.BLOCK) {\n blockCards.put(i, c);\n canBlock=true;\n }\n else if(c.type()== Card.Type.REPAIR) {\n repairCards.put(i, c);\n canRepair=true;\n }\n }\n if (c.type() == Card.Type.MAP) {\n// playMoves.addAll(generatePossibleMap(i));\n mapIndex = i;\n canSee = true;\n }\n if (c.type() == Card.Type.ROCKFALL) {\n destroyCards.put(i,c);\n// playMoves.addAll(generatePossibleRockfall(i));\n canRockfall = true;\n }\n discardMoves.add(Move.NewDiscardMove(index(), i));\n }\n\n if(canSee) {\n //sum of all heuristics\n double sumGoal[] = new double[3];\n for (Position h : reachable) {\n sumGoal[0]+=(9-(8-h.x)+ 5-(4-h.y));\n sumGoal[1]+=(9-(8-h.x)+ 5-(2-h.y));\n sumGoal[2]+=(9-(8-h.x)+ 5-(-h.y));\n }\n //update goldProb\n for(int i=0; i<3; i++) {\n int seenSum=0;\n for(int j=0; j<numPlayers; j++) {\n if(j!=myTurn) {\n if(haveSeen.get(j)[i]==1) seenSum++;\n }\n }\n goldProb[i] = (i==1?0.5:1)*(1-haveSeen.get(myTurn)[i])*(mapRate*(seenSum/numPlayers)+(sumGoal[i]/10));\n }\n }\n\n// System.out.println(hand());\n// System.out.println(pathMoves);\n\n\n if (role() == Role.GOLD_MINER) {\n //Path\n if(canSee && !goldFound) {\n int selection=0;\n double maxProb=goldProb[0];\n for(int i=0; i<3; i++) {\n if(goldProb[i]>maxProb) {\n maxProb = goldProb[i];\n selection=i;\n }\n }\n Move look = Move.NewMapMove(index(), mapIndex, Board.GoalPosition.TOP);\n switch(selection) {\n case 0:\n look = Move.NewMapMove(index(), mapIndex, Board.GoalPosition.TOP);\n break;\n case 1:\n look = Move.NewMapMove(index(), mapIndex, Board.GoalPosition.MIDDLE);\n break;\n case 2:\n look = Move.NewMapMove(index(), mapIndex, Board.GoalPosition.BOTTOM);\n break;\n }\n return look;\n }\n if(canMove) {\n int globalIndex = 0;\n double maxH = 0;\n double oldH;\n Position bp = new Position(0,0);\n boolean rotate = false;\n //Find best path to place;\n Board board = game().board().copy();\n oldH = getClosest(board);\n// System.out.print(getClosest(board)+\" : \");\n for( Map.Entry<Integer, Card> p : pathCards.entrySet()) {\n int index = p.getKey();\n Card path = p.getValue();\n ((PathCard)path).setRotated(false);\n Set<Position> placeable = game().board().getPlaceable((PathCard)path);\n for (Position h : placeable) {\n Board simulated = board.simulatePlaceCardAt((PathCard)path, h.x, h.y);\n// System.out.println(path.type());\n double cH = getClosest(simulated);\n if(maxH<cH) {\n bp=h;\n globalIndex = index;\n maxH = cH;\n rotate=false;\n }\n }\n ((PathCard) path).setRotated(true);\n placeable = game().board().getPlaceable((PathCard)path);\n for (Position h : placeable) {\n Board simulated = board.simulatePlaceCardAt((PathCard)path, h.x, h.y);\n// System.out.println(simulated);\n double cH = getClosest(simulated);\n if(maxH<cH) {\n bp=h;\n globalIndex = index;\n rotate=true;\n maxH = cH;\n }\n }\n }\n// System.out.println(oldH+\": \"+maxH+\" (\"+abs(maxH-oldH)+\")\");\n oldBoard = game().board().copy();\n if(maxH>0 && abs(maxH-oldH)>0.01)\n return Move.NewPathMove(index(), globalIndex, bp.x, bp.y, rotate);\n }\n //Unblock\n if(canRepair) {\n double blockMore = 0.0;\n int targetPlayer = -1;\n int cardIndex = 0;\n for(int i=0; i<numPlayers; i++) {\n //heal self\n if(i == myTurn) {\n for(Map.Entry<Integer, Card> r : repairCards.entrySet()) {\n int index = r.getKey();\n// System.out.println(Arrays.toString(game().playerAt(index()).sabotaged()));\n PlayerActionCard repair = (PlayerActionCard) r.getValue();\n if (game().playerAt(index()).isRepairable(repair.effects())) {\n return Move.NewPlayerActionMove(index(),index, index());\n }\n }\n }\n else if(i!=myTurn) {\n for(Map.Entry<Integer, Card> r : repairCards.entrySet()) {\n int index = r.getKey();\n PlayerActionCard repair = (PlayerActionCard) r.getValue();\n// System.out.println(Arrays.toString(game().playerAt(i).sabotaged()));\n if (game().playerAt(i).isRepairable(repair.effects())) {\n //calculate the should i repair? function\n double shouldIBlockMore = Probability[i]+(0.03*(numPlayers-i));\n if(blockMore<shouldIBlockMore) {\n blockMore = shouldIBlockMore;\n targetPlayer = i;\n cardIndex = index;\n }\n }\n }\n }\n }\n if(blockMore>0.75 && targetPlayer>=0)\n return Move.NewPlayerActionMove(index(), cardIndex, targetPlayer);\n }\n //Block Enemy\n if(canBlock) {\n double blockMore = 0.0;\n int targetPlayer = -1;\n int cardIndex = 0;\n for (int i = 0; i < numPlayers; i++) {\n if (i != myTurn) {\n for (Map.Entry<Integer, Card> b : blockCards.entrySet()) {\n int index = b.getKey();\n PlayerActionCard block = (PlayerActionCard) b.getValue();\n if (game().playerAt(i).isSabotageable(block.effects()[0])) {\n //calculate the should i repair? function\n double shouldIBlockMore = (1 - Probability[i]) * ((1 - Probability[i]) + 0.2 * (numPlayers - i));\n if (blockMore < shouldIBlockMore) {\n blockMore = shouldIBlockMore;\n targetPlayer = i;\n cardIndex = index;\n }\n }\n }\n }\n }\n if(blockMore>0.6 && targetPlayer>=0)\n return Move.NewPlayerActionMove(index(), cardIndex, targetPlayer);\n }\n //Fix (Rockfall)\n if(canRockfall) {\n int globalIndex = 0;\n double maxH = 0.0;\n Position bp = new Position(0,0);\n //Find best path to place;\n Board board = game().board().copy();\n for( Map.Entry<Integer, Card> d : destroyCards.entrySet()) {\n int index = d.getKey();\n Set<Position> destroyable = game().board().getDestroyable();\n for (Position h : destroyable) {\n Board simulated = board.simulateRemoveCardAt(h.x, h.y);\n// System.out.println(path.type());\n double cH = getClosest(simulated);\n if(maxH<cH) {\n bp=h;\n globalIndex = index;\n maxH = cH;\n }\n }\n }\n oldBoard = game().board().copy();\n if(maxH>0)\n return Move.NewRockfallMove(index(), globalIndex, bp.x, bp.y);\n }\n //See map\n\n //Conserve (Find the best card to discard)\n\n //calculate the heuristics and adjust accordingly,\n //choose between playing a card or discarding.\n } else if (role() == Role.SABOTEUR) {\n //See map\n if(canSee && !goldFound) {\n int selection=0;\n //specific for saboteurs\n double maxProb=goldProb[0];\n for(int i=0; i<3; i++) {\n if(goldProb[i]>maxProb) {\n maxProb = goldProb[i];\n selection=i;\n }\n }\n Move look = Move.NewMapMove(index(), mapIndex, Board.GoalPosition.TOP);\n switch(selection) {\n case 0:\n look = Move.NewMapMove(index(), mapIndex, Board.GoalPosition.TOP);\n break;\n case 1:\n look = Move.NewMapMove(index(), mapIndex, Board.GoalPosition.MIDDLE);\n break;\n case 2:\n look = Move.NewMapMove(index(), mapIndex, Board.GoalPosition.BOTTOM);\n break;\n }\n return look;\n }\n //Path\n if(canMove) {\n int globalIndex = 0;\n double maxH = 0.0;\n Position bp = new Position(0,0);\n boolean rotate = false;\n //Find best path to place;\n Board board = game().board().copy();\n double oldH = getClosestSabotage(board);\n for( Map.Entry<Integer, Card> p : pathCards.entrySet()) {\n int index = p.getKey();\n Card path = p.getValue();\n ((PathCard)path).setRotated(false);\n Set<Position> placeable = game().board().getPlaceable((PathCard)path);\n for (Position h : placeable) {\n Board simulated = board.simulatePlaceCardAt((PathCard)path, h.x, h.y);\n// System.out.println(path.type());\n double cH = getClosestSabotage(simulated);\n if(maxH<cH) {\n bp=h;\n globalIndex = index;\n maxH = cH;\n rotate=false;\n }\n }\n ((PathCard) path).setRotated(true);\n placeable = game().board().getPlaceable((PathCard)path);\n for (Position h : placeable) {\n Board simulated = board.simulatePlaceCardAt((PathCard)path, h.x, h.y);\n// System.out.println(simulated);\n double cH = getClosestSabotage(simulated);\n if(maxH<cH) {\n bp=h;\n globalIndex = index;\n rotate=true;\n maxH = cH;\n }\n }\n }\n oldBoard = game().board().copy();\n if(maxH>0 && abs(maxH-oldH)>0.01)\n return Move.NewPathMove(index(), globalIndex, bp.x, bp.y, rotate);\n }\n //Unblock Friend\n if(canRepair) {\n double blockMore = 0.0;\n int targetPlayer = -1;\n int cardIndex = 0;\n for(int i=0; i<numPlayers; i++) {\n if(i == myTurn) {\n for(Map.Entry<Integer, Card> r : repairCards.entrySet()) {\n int index = r.getKey();\n PlayerActionCard repair = (PlayerActionCard) r.getValue();\n if (game().playerAt(myTurn).isRepairable(repair.effects())) {\n return Move.NewPlayerActionMove(index(),index, index());\n }\n }\n }\n else if(i!=myTurn) {\n for(Map.Entry<Integer, Card> r : repairCards.entrySet()) {\n int index = r.getKey();\n PlayerActionCard repair = (PlayerActionCard) r.getValue();\n if (game().playerAt(i).isRepairable(repair.effects())) {\n //calculate the should i repair? function\n double shouldIBlockMore = (1-Probability[i])+(0.03*(numPlayers-i));\n if(blockMore<shouldIBlockMore) {\n blockMore = shouldIBlockMore;\n targetPlayer = i;\n cardIndex = index;\n }\n }\n }\n }\n }\n if(blockMore>0.75 && targetPlayer>=0)\n return Move.NewPlayerActionMove(index(), cardIndex, targetPlayer);\n }\n //Block Enemy\n if(canBlock) {\n double blockMore = 0.0;\n int targetPlayer = -1;\n int cardIndex = 0;\n for (int i = 0; i < numPlayers; i++) {\n if (i != myTurn) {\n for (Map.Entry<Integer, Card> b : blockCards.entrySet()) {\n int index = b.getKey();\n PlayerActionCard block = (PlayerActionCard) b.getValue();\n if (game().playerAt(i).isSabotageable(block.effects()[0])) {\n //calculate the should i repair? function\n double shouldIBlockMore = (Probability[i]) * ((Probability[i]) + 0.2 * (numPlayers - i));\n if (blockMore < shouldIBlockMore) {\n blockMore = shouldIBlockMore;\n targetPlayer = i;\n cardIndex = index;\n }\n }\n }\n }\n }\n if(blockMore>0.6 && targetPlayer>=0)\n return Move.NewPlayerActionMove(index(), cardIndex, targetPlayer);\n }\n //Sabotage (Rockfall)\n if(canRockfall) {\n int globalIndex = 0;\n double maxH = 0;\n Position bp = new Position(0,0);\n //Find best path to place;\n Board board = game().board().copy();\n for( Map.Entry<Integer, Card> d : destroyCards.entrySet()) {\n int index = d.getKey();\n Set<Position> destroyable = game().board().getDestroyable();\n for (Position h : destroyable) {\n Board simulated = board.simulateRemoveCardAt(h.x, h.y);\n// System.out.println(path.type());\n double cH = getClosestSabotage(simulated);\n if(maxH<cH) {\n bp=h;\n globalIndex = index;\n maxH = cH;\n }\n }\n }\n oldBoard = game().board().copy();\n if(maxH>0)\n return Move.NewRockfallMove(index(), globalIndex, bp.x, bp.y);\n }\n //Conserve (Find the best card to discard\n\n //calculate the heuristics and adjust accordingly,\n //choose between playing a card or discarding.\n }\n return discardMoves.get(0);\n }", "private void suarez() {\n\t\ttry {\n\t\t\tThread.sleep(5000); // espera, para dar tempo de ver as mensagens iniciais\n\t\t} catch (InterruptedException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\tint xInit = -10;\n\t\tint yInit = 8;\n\t\tplayerDeafaultPosition = new Vector2D(xInit*selfPerception.getSide().value(), yInit*selfPerception.getSide().value());\n\t\twhile (commander.isActive()) {\n\t\t\t\n\t\t\tupdatePerceptions(); // deixar aqui, no começo do loop, para ler o resultado do 'move'\n\t\t\tswitch (matchPerception.getState()) {\n\t\t\tcase BEFORE_KICK_OFF:\n\t\t\t\tcommander.doMoveBlocking(xInit, yInit);\t\t\t\t\t\t\t\t\n\t\t\t\tbreak;\n\t\t\tcase PLAY_ON:\n\t\t\t\t//state = State.FOLLOW;\n\t\t\t\texecuteStateMachine();\n\t\t\t\tbreak;\n\t\t\tcase KICK_OFF_LEFT:\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.LEFT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase KICK_OFF_RIGHT:\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.RIGHT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CORNER_KICK_LEFT: // escanteio time esquerdo\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.LEFT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase CORNER_KICK_RIGHT: // escanteio time direito\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.RIGHT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase KICK_IN_LEFT: // lateral time esquerdo\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.LEFT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\tcase KICK_IN_RIGHT: // lateal time direito\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.RIGHT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase FREE_KICK_LEFT: // Tiro livre time esquerdo\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.LEFT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase FREE_KICK_RIGHT: // Tiro Livre time direito\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.RIGHT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase FREE_KICK_FAULT_LEFT:\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.LEFT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase FREE_KICK_FAULT_RIGHT:\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.RIGHT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase GOAL_KICK_LEFT:\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.LEFT) {\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase GOAL_KICK_RIGHT:\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.RIGHT) {\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase AFTER_GOAL_LEFT:\n\t\t\t\tcommander.doMoveBlocking(xInit, yInit);\n\t\t\t\tbreak;\n\t\t\tcase AFTER_GOAL_RIGHT:\n\t\t\t\tcommander.doMoveBlocking(xInit, yInit);\n\t\t\t\tbreak;\n\t\t\tcase INDIRECT_FREE_KICK_LEFT:\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.LEFT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase INDIRECT_FREE_KICK_RIGHT:\n\t\t\t\tif (selfPerception.getSide() == EFieldSide.RIGHT) {\n\t\t\t\t\tstate = State.PASSING_BALL;\n\t\t\t\t\texecuteStateMachine();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\t}", "@Override\r\n\tpublic void makeRandonMove() {\r\n\t\tif (randPlayer.getPlayerNumber() == game.getState().getTurn() && !game.getState().isFinished()) game.execute(randPlayer.requestAction(game.getState()));\r\n\t}", "public interface FightReward {\n /**\n * The fighter\n */\n public Fighter fighter();\n\n /**\n * Get the reward line type\n */\n public RewardType type();\n\n /**\n * Apply the reward to the fighter\n */\n public void apply();\n\n /**\n * Render the reward line for {@link fr.quatrevieux.araknemu.network.game.out.fight.FightEnd} packet\n */\n public String render();\n}", "Point2D getNextMove(Point2D target, boolean pursuit, Set<Point2D> map);", "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}", "protected void responseMap(String lastAnswer){\n\t\tif (goldLeft != 0){\n\t\t\tstoreMap(lastAnswer, 'G');\n\t\t\tif (destination != null){\n\t\t\t\tmoveToDestination();\n\t\t\t\tqueue.add(\"PICKUP\");\n\t\t\t\tqueue.add(\"HELLO\");\n\t\t\t}\n\t\t}\n\t\t// If all the gold is collected, look for the exit.\n\t\telse{\n\t\t\tstoreMap(lastAnswer, 'E');\n\t\t\tif (destination != null){\n\t\t\t\tmoveToDestination();\n\t\t\t}\n\t\t}\n\t\t// Move 5 times in a random direction\n\t\tchar dir = DIRECTIONS[random.nextInt(4)];\n\t\tint rand = random.nextInt(5);\n\t\tfor (int i = 0; i < rand; i++){\n\t\t\tqueue.add(\"MOVE \" + dir);\n\t\t}\n\t}", "public void disperseRewards(Player player, boolean success){\n if(success){\n //if player is in a role on a scene card\n if(player.getCurrentRole().isOnCard()){\n player.addCredits(2);\n }\n else{\n player.addCredits(1);\n player.addMoney(1);\n }\n }\n else{\n //disperse loss rewards\n //if player is not on a scene card role\n if(!(player.getCurrentRole().isOnCard())){\n player.addMoney(1);\n }\n }\n }", "private void promptTurn()\n \t{\n \t\tUserInfo curr;\n\t\tString meow;\n \t\tcurr = players[turnIndex];\n \t\tString[] tokens;\n \t\tint x;\n \t\tint y;\n \t\n// PROTOCOL \t\n \t\tcurr.sendMessage(prtcl.makePacket(\"Please enter a move\", \"message\")); \n\t\tmeow = curr.getMessage();\n\t\ttokens = meow.split(\" \");\n// PROTOCOL\n \t\tx = Integer.parseInt(tokens[0]);\n \t\ty = Integer.parseInt(tokens[1]);\n \t\n \t\t// Should have a method to process the user's input, and provide an error message back to them if necessary. \n \t\tif(game.remove(x, y))\n \t\t{\n \t\t\tplayers[(turnIndex + 1) % 2].sendMessage(prtcl.makePacket(\"Other player took \" + tokens[0] + \" items from row \" + tokens[1] + \".\", \"message\"));\n \t\t\tbroadcast(prtcl.makePacket(game.toString(), \"message\"));\n \t\t\t// This is where the check to see if the game is won occurs. If so, a winner (the person who just moved) is \n \t\t\t// congratulated. \n \t\t\tif(!game.isDone())\n \t\t\t{\n \t\t\t\tturnIndex += 1;\n \t\t\t\tturnIndex %= 2;\n \t\t\t}\n \t\t} else\n \t\t{\n // PROTOCOL\n \t\t\tplayers[turnIndex].sendMessage(prtcl.makePacket(\"Something was wrong with that. Try again.\", \"ERROR\"));\n // PROTOCOL\n \t\t}\t\n \t}", "public void move() {\n\t\tif (isLuck) {\n\t\t\tif (rand.nextBoolean()) {\n\t\t\t\txPos++;\n\t\t\t}\n\t\t} else {\n\t\t\tif (rightCount < skill) {\n\t\t\t\trightCount++;\n\t\t\t\txPos++;\n\t\t\t}\n\t\t}\n\t}", "private double getReward(Article arm) {\n\t\tif (!trials.containsKey(arm.getId())) {\n\t\t\ttrials.put(arm.getId(), 0);\n\t\t\tclicks.put(arm.getId(), 0);\n\t\t}\n\t\tint trialCount = trials.get(arm.getId());\n\t\tint clickCount = clicks.get(arm.getId());\n\t\tif (clickCount < 1) {\n\t\t\treturn 0;\n\t\t}\n\t\treturn (double) clickCount / (double) trialCount;\n\t}", "public void executegenmoves() {\n \t\tObject state = gm.hashToState(new BigInteger(conf.getProperty(\"gamesman.hash\")));\n \t\tfor (Object nextstate : gm.validMoves(state)) {\n \t\t\tSystem.out.println(gm.stateToHash(nextstate));\n \t\t\tSystem.out.println(gm.displayState(nextstate));\n \t\t}\n \t}", "private void doMatch() {\n // Remember how many games in this session\n mGameCounter++;\n\n PebbleDictionary resultDict = new PebbleDictionary();\n\n switch (mChoice) {\n case Keys.CHOICE_ROCK:\n switch(mP2Choice) {\n case Keys.CHOICE_ROCK:\n mInstructionView.setText(\"It's a tie!\");\n resultDict.addInt32(Keys.KEY_RESULT, Keys.RESULT_TIE);\n break;\n case Keys.CHOICE_PAPER:\n mInstructionView.setText(\"You lose!\");\n resultDict.addInt32(Keys.KEY_RESULT, Keys.RESULT_WIN); // Inform Pebble of opposite result\n break;\n case Keys.CHOICE_SCISSORS:\n mWinCounter++;\n mInstructionView.setText(\"You win! (\" + mWinCounter + \" of \" + mGameCounter + \")\");\n resultDict.addInt32(Keys.KEY_RESULT, Keys.RESULT_LOSE);\n break;\n }\n break;\n case Keys.CHOICE_PAPER:\n switch(mP2Choice) {\n case Keys.CHOICE_ROCK:\n mWinCounter++;\n mInstructionView.setText(\"You win! (\" + mWinCounter + \" of \" + mGameCounter + \")\");\n resultDict.addInt32(Keys.KEY_RESULT, Keys.RESULT_LOSE);\n break;\n case Keys.CHOICE_PAPER:\n mInstructionView.setText(\"It's a tie!\");\n resultDict.addInt32(Keys.KEY_RESULT, Keys.RESULT_TIE);\n break;\n case Keys.CHOICE_SCISSORS:\n mInstructionView.setText(\"You lose!\");\n resultDict.addInt32(Keys.KEY_RESULT, Keys.RESULT_WIN);\n break;\n }\n break;\n case Keys.CHOICE_SCISSORS:\n switch(mP2Choice) {\n case Keys.CHOICE_ROCK:\n mInstructionView.setText(\"You lose!\");\n resultDict.addInt32(Keys.KEY_RESULT, Keys.RESULT_WIN);\n break;\n case Keys.CHOICE_PAPER:\n mWinCounter++;\n mInstructionView.setText(\"You win! (\" + mWinCounter + \" of \" + mGameCounter + \")\");\n resultDict.addInt32(Keys.KEY_RESULT, Keys.RESULT_LOSE);\n break;\n case Keys.CHOICE_SCISSORS:\n mInstructionView.setText(\"It's a tie!\");\n resultDict.addInt32(Keys.KEY_RESULT, Keys.RESULT_TIE);\n break;\n }\n break;\n }\n\n // Inform Pebble of result\n PebbleKit.sendDataToPebble(getApplicationContext(), APP_UUID, resultDict);\n\n // Finally reset both\n mChoice = Keys.CHOICE_WAITING;\n mP2Choice = Keys.CHOICE_WAITING;\n\n // Leave announcement for 5 seconds\n mHandler.postDelayed(new Runnable() {\n\n @Override\n public void run() {\n updateUI();\n }\n\n }, 5000);\n }", "public void updateReward(Instance selectedInstance, boolean doBernoulliRewards, boolean isTrainingInstance, boolean verbose)\n\t{\n\t\tif (verbose);////System.out.println(\"\");\n\t\tif (verbose);////System.out.println(\"updateReward called()\");\n\n\t\t//Determine difficulty level associated to this instance\n\t\tint difficultyLevel;\n\t\tif (isTrainingInstance) {\n\t\t\tdifficultyLevel = Integer.parseInt(selectedInstance.toString(45)); //in this attribute the difficulty level is stored\n\t\t} \n\t\telse {\n\t\t\tdifficultyLevel = getDifficulty(); //now: m.DIFFICULTY. perhaps it should be m.state ?\n\t\t}\n\t\tif (verbose);////System.out.println(\"-calculating reward for previous level segment with difficulty level: \" + difficultyLevel );\n\t\t//double probsAppro = getProbsAppropriateness_ObservationStr(observation_str, false);\n\t\tdouble probsAppro = classifyInstance(selectedInstance, false)[1]; \n\t\tif (verbose);////System.out.println(\"-difficulty of level segment was deemed appropriate with a probability of: \" + probsAppro );\n\n\t\t//Determine rewards according to Bernoulli scheme / proportional reward\n\t\tdouble reward = 0.0;\n\t\tif (doBernoulliRewards) {\n\t\t\tif (verbose);////System.out.println(\"-returning reward of 1 with probablity of \" + probsAppro + \", else reward of 0 (Bernoulli rewards)\");\n\t\t\tboolean returnBernoulliReward;\n\t\t\tif ( Math.random() <= probsAppro ) returnBernoulliReward = true;\n\t\t\telse returnBernoulliReward = false;\n\n\t\t\tif (verbose);////System.out.println(\"-boolean returnBernoulliReward: \" + returnBernoulliReward);\n\t\t\tif (returnBernoulliReward) reward = 1.0;\n\t\t\telse reward = 0.0; \n\t\t}\n\t\telse {\n\t\t\tif (verbose);////System.out.println(\"-returning reward \" + probsAppro + \" (regular non-Bernoulli rewards)\");\n\t\t\treward = probsAppro;\n\t\t}\n\n\t\tif (verbose);////System.out.println(\"-adding reward of \" + reward + \" to arraylist playerModelDiff\" + difficultyLevel);\n\t\tswitch (difficultyLevel) {\n\t\tcase 1: playerModelDiff1.add(reward); break;\n\t\tcase 4: playerModelDiff4.add(reward); break;\n\t\tcase 7: playerModelDiff7.add(reward); break;\n\t\tdefault:;////System.out.println(\"-ERROR! Cannot add reward to concerning playerModelDiff1,4,7 due to incorrect input of difficultyLevel\"); break;\n\t\t}\n\t\t//Note, updating the display of average rewards is performed by updatePlayerModel()\n\t\t//int index = getPlayerModelIndex(difficultyLevel);\n\t\t////System.out.println(\"-updating playerModel[\" + index + \"] with reward: \" + reward);\n\t\t//playerModel[index] += reward;\n\t\tif (verbose);////System.out.println(\"-done\");\n\n\t\t//OLD\n\t\t//Increase reward proportionally to appropriateness of current difficulty level to the specific player\n\t\t//As determed by probabilities in player model\n\t\t/*\n ;////System.out.println(\"\");\n ;////System.out.println(\"updateReward called()\");\n double reward = getPlayerModelElement(m.DIFFICULTY);\n ;////System.out.println(\"-increasing reward by: \" + reward);\n m.REWARD += reward;\n ;////System.out.println(\"-new reward is now: \" + m.REWARD);\n\t\t */\n\n\t\t//OLD OLD\n\t\t/*\n if (m.state == 1) { //SANDER UPDATE - NOT CORRECT AT THE MOMENT\n //Appropriate difficulty - Increase reward\n int rangeMin = 0;\n int rangeMax = 1;\n Random r = new Random();\n double randomValue = rangeMin + (rangeMax - rangeMin) * r.nextDouble();\n ;////System.out.println(\"Increasing reward by: \" + randomValue);\n m.REWARD += randomValue;\n ;////System.out.println(\"New cummulative reward: \" + m.REWARD);\n }\n else {\n //No appropriate difficulty - Do not increase reward for this level block\n m.REWARD += 0; \n }\n\t\t */\n\t}", "private void remindGoal()\n {\n System.out.println(\"you have to Pick up all three items and get back outside!\");\n }", "@Override\r\n public void makeLogicMove() {\r\n\r\n this.printThoughts();\r\n this.printMessages();\r\n \r\n // If dead, don't make a move //\r\n if (this.isDead()) {\r\n return;\r\n } \r\n \r\n if (this.getVerbose()) {\r\n System.err.println(\"Making logic move for aibotscorer - \" + this.getMoves().size());\r\n }\r\n \r\n final AIBotScoreModel scores = scoreAllDirections();\r\n if (this.getVerbose()) {\r\n System.err.println(scores);\r\n }\r\n if (this.getMoves().size() <= 3) {\r\n super.makeLogicMove();\r\n return;\r\n }\r\n \r\n if (this.getMoves().size() == 26) {\r\n this.addMessages(\"-5000-AI: using default move, on 30 clause\");\r\n super.makeLogicMove();\r\n return;\r\n }\r\n \r\n final int randomMoveFlag = random.nextInt(16);\r\n if (randomMoveFlag == 1) {\r\n this.addMessages(\"-4000-AI: using default move, random case\");\r\n super.makeLogicMove();\r\n return;\r\n }\r\n \r\n final Move lastMove = this.getLastMoveNull();\r\n if (lastMove == null) {\r\n this.addMessages(\"-3000-AI: using default move, last move null\");\r\n // Revert back to the default move\r\n super.makeLogicMove();\r\n return;\r\n }\r\n \r\n final Move north = lastMove.decy();\r\n final Move south = lastMove.incy();\r\n final Move east = lastMove.incx();\r\n final Move west = lastMove.decx();\r\n \r\n final LinkedHashMap<Double, Move> map = new LinkedHashMap<Double, Move>();\r\n map.put(new Double(scores.getScoreNorth()), north);\r\n map.put(new Double(scores.getScoreSouth()), south);\r\n map.put(new Double(scores.getScoreEast()), east);\r\n map.put(new Double(scores.getScoreWest()), west);\r\n final LinkedHashMap<Double, Move> scoreMap = BotUtilityMap.sortMapByKey(map);\r\n \r\n if (this.getVerbose()) {\r\n System.err.println(scoreMap);\r\n }\r\n \r\n final boolean validScoreCheck = this.makeLogicMoveAIValidateScores(scoreMap);\r\n if (!validScoreCheck) {\r\n // If on the valid case, the move has already been made \r\n super.makeLogicMove();\r\n return;\r\n } // End of if //\r\n }", "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}", "public int nextAction() {\n double w = random.nextDouble();\n for (int i = 0; i < nMoves; i++) {\n if (w < probabilities[i]) {\n lastMove = i;\n break;\n }\n w -= probabilities[i];\n }\n nIters++;\n\n if (N_SELECTED_ACTIONS > 1) {\n lastNMoves.add(lastMove);\n if (lastNMoves.size() > N_SELECTED_ACTIONS)\n lastNMoves.poll();\n }\n\n if (LOGGING && nIters % 1000 == 0) {\n for (int i = 0; i < nMoves; i++)\n logWriter.printf(\"%.8f;\", probabilities[i]);\n logWriter.println();\n logWriter.flush();\n }\n\n return lastMove;\n }", "@Override\r\n\tpublic void onActivityResult(int requestCode, int resultCode, Intent data) {\n\t\tsuper.onActivityResult(requestCode, resultCode, data);\r\n\r\n\t\tif (HeadhunterPublic.RESULT_ACTIVITY_CODE == requestCode) {\r\n\t\t\tswitch (resultCode) {\r\n\t\t\tcase HeadhunterPublic.RESULT_REWARDINOF_OK: {\r\n\t\t\t\t// 获取悬赏任务详细界面传递过来的数据\r\n\t\t\t\tBundle bundle = data.getExtras();\r\n\t\t\t\tif (null != bundle) {\r\n\t\t\t\t\tString strTaskId = bundle\r\n\t\t\t\t\t\t\t.getString(HeadhunterPublic.REWARD_DATATRANSFER_TASKID);\r\n\t\t\t\t\tif(null == strTaskId){\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(strTaskId.isEmpty()){\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// 获取收藏状态\r\n\t\t\t\t\tString strCollectionStatus = bundle\r\n\t\t\t\t\t\t\t.getString(HeadhunterPublic.REWARD_DATATRANSFER_COLLECTIONFLAG);\r\n\t\t\t\t\t// 获取应聘状态\r\n\t\t\t\t\tString strCandidateStatus = bundle\r\n\t\t\t\t\t\t\t.getString(HeadhunterPublic.REWARD_DATATRANSFER_CANDIDATEFLAG);\r\n\t\t\t\t\t// 获取是否已读状态\r\n//\t\t\t\t\tString strReadStatus = bundle\r\n//\t\t\t\t\t\t\t.getString(HeadhunterPublic.REWARD_DATATRANSFER_REWARDREAD);\r\n\t\t\t\t\t// 获取公司收藏状态\r\n//\t\t\t\t\tString strCompanyCollectionStatus = bundle\r\n//\t\t\t\t\t\t\t.getString(HeadhunterPublic.REWARD_DATATRANSFER_COMPANYCOLLECTIONFLAG);\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(null == m_listRewardInfo){\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tint nChooseItem = m_rifAdapter.getChooseItem();\r\n//\t\t\t\t\tint nChooseItem = m_nChooseItem;\r\n\t\t\t\t\tif(nChooseItem < 0 || nChooseItem > m_listRewardInfo.size() - 1){\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t// 更新状态\r\n\t\t\t\t\tRewardData rld = m_listRewardInfo.get(nChooseItem);\r\n\t\t\t\t\tif (null != rld) {\r\n\t\t\t\t\t\tboolean bChange = false;\r\n\t\t\t\t\t\t// 更新应聘状态\r\n\t\t\t\t\t\tif(null != strCandidateStatus){\r\n\t\t\t\t\t\t\tif(!strCandidateStatus.isEmpty()){\r\n\t\t\t\t\t\t\t\trld.setAction_1(strCandidateStatus);\r\n\t\t\t\t\t\t\t\tbChange = true;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t// 更新收藏状态\r\n\t\t\t\t\t\tif(null != strCollectionStatus){\r\n\t\t\t\t\t\t\tif(!strCollectionStatus.isEmpty()){\r\n\t\t\t\t\t\t\t\trld.setAction_3(strCollectionStatus);\r\n\t\t\t\t\t\t\t\tbChange = true;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// 更新是否已读状态\r\n//\t\t\t\t\t\tif(null != strReadStatus){\r\n//\t\t\t\t\t\t\tif(!strReadStatus.isEmpty()){\r\n//\t\t\t\t\t\t\t\trld.setAction_5(strReadStatus);\r\n//\t\t\t\t\t\t\t\t// 保存已读的任务ID\r\n//\t\t\t\t\t\t\t\tsaveReadRewardID(strTaskId);\r\n//\t\t\t\t\t\t\t\tif(null != m_rifAdapter){\r\n//\t\t\t\t\t\t\t\t\tm_rifAdapter.notifyDataSetChanged();\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}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// 更新公司收藏状态\r\n//\t\t\t\t\t\tif(null != strCompanyCollectionStatus &&\r\n//\t\t\t\t\t\t\t\t!strCompanyCollectionStatus.isEmpty()){\r\n//\t\t\t\t\t\t\trld.setM27_status(strCompanyCollectionStatus);\r\n//\t\t\t\t\t\t\tbChange = true;\r\n//\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif(bChange){\r\n\t\t\t\t\t\t\t// 把状态更新到缓存中\r\n\t\t\t\t\t\t\tupRewardData(rld);\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\tbreak;\r\n\t\t\tcase HeadhunterPublic.RESULT_REWARDSEARCH_OK: {\r\n\t\t\t\t// 获取悬赏任务搜索设置界面传递过来的数据\r\n\t\t\t\tBundle bundle = data.getExtras();\r\n\t\t\t\tif (null != bundle) {\r\n\t\t\t\t\tm_filters = (RewardFilterCondition) bundle\r\n\t\t\t\t\t\t\t.getSerializable(HeadhunterPublic.REWARDSEARCH_DATATRANSFER_FILTERS);\r\n\r\n\t\t\t\t\tm_bIsSearch = true;\r\n\t\t\t\t\t\r\n\t\t\t\t\tm_nListStatus = LISTVIEW_STATUS_ONREFRESH;\r\n\t\t\t\t\tm_lvReward.setLoading();\r\n\t\t\t\t\t\r\n\t\t\t\t\t// 获取悬赏任务列表\r\n\t\t\t\t\tstartGetData(HeadhunterPublic.REWARD_DIRECTIONTYPE_NEW, \"\",\r\n\t\t\t\t\t\t\tm_nRequestType);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase -1: // 登录成功\r\n\t\t\t\t{\r\n\t\t\t\t\t// 检查手机是否认证\r\n//\t\t\t\t\tcheckMobileAuthStatus();\r\n\t\t\t\t\tshowPublishRewardActivity();\r\n\t\t\t\t}\r\n\t\t\tdefault:\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}else if(2 == requestCode){\r\n\t\t\tif(-1 == resultCode){\r\n\t\t\t\t// 进入悬赏发布界面\r\n\t\t\t\tshowPublishRewardActivity();\r\n\t\t\t}\r\n\t\t}\r\n\t\t\t\r\n\t}", "public int learn(double nextReward, int nextState){\n count++;\n int nextAction; \n if (this.state == 3){\n //qvalues[this.state][this.action] = learningRate*nextReward;\n return 4;\n } else {\n //if (this.state != null ){\n nextAction = getAction(nextState);\n //this.N[this.state][this.action] += 1;\n this.qvalues[this.state][this.action] += learningRate*(this.reward + discountFactor*(this.qvalues[nextState][nextAction] - this.qvalues[this.state][this.action]));\n }\n this.state = nextState;\n this.action = nextAction;\n this.reward = nextReward;\n if (count == 100){\n saveQ();\n count = 0;\n }\n return this.action;\n }", "public void updateTeamFromResults(Match m){\r\n \r\n //Update team1\r\n m.getTeam1().setGoalsFor(m.getTeam1().getGoalsFor() + m.getScore1());\r\n m.getTeam1().setGoalsAgainst(m.getTeam1().getGoalsAgainst() + m.getScore2());\r\n \r\n //Update team2\r\n m.getTeam2().setGoalsFor(m.getTeam2().getGoalsFor() + m.getScore2());\r\n m.getTeam2().setGoalsAgainst(m.getTeam2().getGoalsAgainst() + m.getScore1());\r\n \r\n //Add points\r\n if (m.getScore1() < m.getScore2()){\r\n m.getTeam2().setPoints(m.getTeam2().getPoints() + 3);\r\n m.getTeam1().setMatchLost(m.getTeam1().getMatchLost() + 1);\r\n m.getTeam2().setMatchWon(m.getTeam2().getMatchWon() + 1);\r\n }\r\n else if (m.getScore1() > m.getScore2()){\r\n m.getTeam1().setPoints(m.getTeam1().getPoints() + 3);\r\n m.getTeam2().setMatchLost(m.getTeam2().getMatchLost() + 1);\r\n m.getTeam1().setMatchWon(m.getTeam1().getMatchWon() + 1);\r\n }\r\n else {\r\n m.getTeam1().setPoints(m.getTeam1().getPoints() + 1);\r\n m.getTeam2().setPoints(m.getTeam2().getPoints() + 1);\r\n m.getTeam1().setMatchDrawn(m.getTeam1().getMatchDrawn() + 1);\r\n m.getTeam2().setMatchDrawn(m.getTeam2().getMatchDrawn() + 1);\r\n }\r\n \r\n //Update the rankings\r\n this.updateTeamRank();\r\n }", "public static void saveResult (GameType type, GameResult result) {\n Results resultsToUpdate;\n\n if (type == GameType.PVP) {\n resultsToUpdate = humanVsHuman;\n } else if (type == GameType.PVB) {\n resultsToUpdate = humanVsBot;\n } else if (type == GameType.BVP) {\n resultsToUpdate = botVsHuman;\n } else {\n resultsToUpdate = botVsBot;\n }\n\n if (result == GameResult.X_WON) {\n resultsToUpdate.XWins++;\n } else if (result == GameResult.O_WON) {\n resultsToUpdate.OWins++;\n } else {\n resultsToUpdate.draws++;\n }\n }", "@Override\n\tpublic void action() {\n\n\t\tif(this.step.equals(STATE_INIT))\n\t\t{\n\t\t\tthis.nbVoters = 0;\n\t\t\tthis.nbAsynchronousPlayers = 0;\n\t\t\tthis.globalResults = new VoteResults();\n\t\t\tthis.agentSender = null;\n\t\t\tthis.request = null;\n\t\t\tthis.currentTime = -1;\n\t\t\tthis.results = new VoteResults();\n\t\t\tthis.nextStep = STATE_RECEIVE_REQUEST;\n\n\n\t\t}\n\n\t\telse if(this.step.equals(STATE_RECEIVE_REQUEST))\n\t\t{\n\t\t\t/*** reception demande de vote **/\n\t\t\tMessageTemplate mt = MessageTemplate.and(\n\t\t\t\t\tMessageTemplate.MatchPerformative(ACLMessage.REQUEST),\n\t\t\t\t\tMessageTemplate.MatchConversationId(\"VOTE_REQUEST\"));\n\n\t\t\tACLMessage message = this.myAgent.receive(mt);\n\t\t\tif(message != null)\n\t\t\t{\n\t\t\t\tthis.agentSender = message.getSender();\n\n\t\t\t\tObjectMapper mapper = new ObjectMapper();\n\t\t\t\ttry {\n\n\t\t\t\t\t//System.err.println(\"[RQST INITIAL] \"+message.getContent());\n\n\t\t\t\t\tthis.request = mapper.readValue(message.getContent(), VoteRequest.class);\n\t\t\t\t\tthis.request.setLocalVoteResults(this.results);\n\t\t\t\t\tthis.results.initWithChoice(this.request.getChoices());\n\n\t\t\t\t\tFunctions.newActionToLog(\"Début vote \"+this.request.getRequest(),this.myAgent, this.controllerAgent.getGameid());\n\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\n\t\t\t\tthis.nextStep = SEND_REQUEST_GLOBAL_VOTE_RESULTS;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tblock(1000);\n\t\t\t}\n\n\t\t}\n\t\telse if(this.step.equals(SEND_REQUEST_GLOBAL_VOTE_RESULTS))\n\t\t{\n\t\t\tList<AID> agents = DFServices.findGameControllerAgent(\"ENVIRONMENT\", this.myAgent, this.controllerAgent.getGameid());\n\t\t\tif(!agents.isEmpty())\n\t\t\t{\n\t\t\t\tACLMessage message = new ACLMessage(ACLMessage.REQUEST);\n\t\t\t\tmessage.setSender(this.myAgent.getAID());\n\t\t\t\tfor(AID aid : agents)\n\t\t\t\t{\n\t\t\t\t\tmessage.addReceiver(aid);\n\t\t\t\t}\n\t\t\t\tmessage.setConversationId(\"GLOBAL_VOTE_RESULTS\");\n\n\t\t\t\tthis.myAgent.send(message);\n\t\t\t}\n\n\t\t\tthis.nextStep = RECEIVE_REQUEST_GLOBAL_VOTE_RESULTS;\n\t\t}\n\t\telse if(this.step.equals(RECEIVE_REQUEST_GLOBAL_VOTE_RESULTS))\n\t\t{\n\t\t\t/*** reception demande de vote **/\n\t\t\tMessageTemplate mt = MessageTemplate.and(\n\t\t\t\t\tMessageTemplate.MatchPerformative(ACLMessage.REQUEST),\n\t\t\t\t\tMessageTemplate.MatchConversationId(\"GLOBAL_VOTE_RESULTS\"));\n\n\t\t\tACLMessage message = this.myAgent.receive(mt);\n\t\t\tif(message != null)\n\t\t\t{\n\n\t\t\t\t//System.out.println(\"CTRL Reception de global results\");\n\t\t\t\tObjectMapper mapper = new ObjectMapper();\n\t\t\t\ttry {\n\t\t\t\t\tthis.globalResults = mapper.readValue(message.getContent(), VoteResults.class);\n\t\t\t\t\tthis.request.setGlobalCitizenVoteResults(this.globalResults);\n\t\t\t\t} \n\t\t\t\tcatch (IOException e) \n\t\t\t\t{\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t\tthis.nextStep = STATE_GET_SIMPLE_SUSPICION;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tblock(1000);\n\t\t\t}\n\t\t}\t\t\n\t\telse if(this.step.equals(STATE_SEND_REQUEST))\n\t\t{\n\t\t\tACLMessage messageRequest = new ACLMessage(ACLMessage.REQUEST);\n\t\t\tmessageRequest.setSender(this.myAgent.getAID());\n\t\t\tmessageRequest.setConversationId(\"VOTE_REQUEST\");\n\n\t\t\tint reste = this.request.getAIDVoters().size()-this.nbVoters;\n\t\t\tif(false )// reste >= Data.MAX_SYNCHRONOUS_PLAYERS)\n\t\t\t{\n\t\t\t\t/** hybrid synchronous mode **/\n\t\t\t\tthis.nbAsynchronousPlayers = (int) (Math.random()*Math.min(Data.MAX_SYNCHRONOUS_PLAYERS-1, (reste-1)))+1;\n\t\t\t\t//System.err.println(\"HYDBRID ASYNCRHONOUS ENABLED BECAUSE TOO MANY PARTICIPANTS \"+this.nbAsynchronousPlayers+\" in //\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tthis.nbAsynchronousPlayers = 1;\n\t\t\t}\n\n\t\t\tObjectMapper mapper = new ObjectMapper();\n\n\t\t\tString json =\"\";\n\n\t\t\ttry {\t\t\n\t\t\t\tjson = mapper.writeValueAsString(this.request);\t\n\t\t\t\tSystem.err.println(\"[RQST] \"+json);\n\t\t\t} catch (Exception e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\n\t\t\tmessageRequest.setContent(json);\n\t\t\tfor(int i = 0; i<this.nbAsynchronousPlayers; ++i)\n\t\t\t{\n\t\t\t\t//System.err.println(\"DK ENVOI REQUEST \"+this.request.getAIDVoters().get(this.nbVoters+i).getLocalName());\n\t\t\t\tmessageRequest.addReceiver(this.request.getAIDVoters().get(this.nbVoters+i));\t\n\t\t\t}\n\n\t\t\tthis.myAgent.send(messageRequest);\n\n\t\t\tthis.nextStep = STATE_RECEIVE_INFORM;\n\t\t}\n\t\telse if(this.step.equals(STATE_RECEIVE_INFORM))\n\t\t{\n\t\t\tif(this.currentTime == -1)\n\t\t\t{\n\t\t\t\tthis.currentTime = System.currentTimeMillis();\n\t\t\t}\n\n\t\t\tif(System.currentTimeMillis() - this.currentTime > 3000)\n\t\t\t{\n\t\t\t\tthis.currentTime = -1;\n\t\t\t\tACLMessage wakeup = new ACLMessage(ACLMessage.UNKNOWN);\n\t\t\t\twakeup.setSender(this.myAgent.getAID());\n\t\t\t\tif(nbVoters < this.request.getVoters().size())\n\t\t\t\t{\n\t\t\t\t\twakeup.addReceiver(this.request.getAIDVoters().get(nbVoters));\n\t\t\t\t\twakeup.setConversationId(\"WAKEUP\");\n\t\t\t\t\tthis.myAgent.send(wakeup);\n\n\t\t\t\t\tSystem.out.println(\"Relance du joueur \"+this.request.getAIDVoters().get(nbVoters).getLocalName()+\" ...\");\n\t\t\t\t}\n\n\n\t\t\t}\n\n\t\t\tMessageTemplate mt = MessageTemplate.and(\n\t\t\t\t\tMessageTemplate.MatchPerformative(ACLMessage.INFORM),\n\t\t\t\t\tMessageTemplate.MatchConversationId(\"VOTE_INFORM\"));\n\n\t\t\tACLMessage message = this.myAgent.receive(mt);\n\t\t\tif(message!=null)\n\t\t\t{\n\t\t\t\tthis.currentTime = -1;\n\t\t\t\t++this.nbVoters;\n\t\t\t\t--this.nbAsynchronousPlayers;\n\n\t\t\t\tObjectMapper mapper = new ObjectMapper();\n\t\t\t\tVoteResults res = new VoteResults();\n\t\t\t\ttry {\n\t\t\t\t\tres = mapper.readValue(message.getContent(), VoteResults.class);\n\t\t\t\t} \n\t\t\t\tcatch (IOException e) \n\t\t\t\t{\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\n\t\t\t\tAID aidPlayer = message.getSender();\n\n\t\t\t\tthis.results.add(res);\n\n\t\t\t\tif(this.request.getRequest().equals(\"CITIZEN_VOTE\")&&\n\t\t\t\t\t\tDFServices.containsGameAgent(aidPlayer, \"PLAYER\", \"MAYOR\", this.myAgent, this.controllerAgent.getGameid()))\n\t\t\t\t{\n\t\t\t\t\t/** poids double **/\n\t\t\t\t\tthis.results.add(res);\n\t\t\t\t\tthis.globalResults.add(res);\n\t\t\t\t}\n\n\n\t\t\t\t//envoi du resultat partiel \n\t\t\t\tString json = \"\";\n\t\t\t\tmapper = new ObjectMapper();\n\t\t\t\ttry {\n\t\t\t\t\tjson = mapper.writeValueAsString(this.results);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\n\t\t\t\tACLMessage msg = new ACLMessage(ACLMessage.AGREE);\n\t\t\t\tmsg.setContent(json);\n\t\t\t\tmsg.setSender(this.myAgent.getAID());\n\t\t\t\tmsg.setConversationId(\"NEW_VOTE_RESULTS\");\n\n\t\t\t\tList<AID> agents = DFServices.findGameControllerAgent(\"ENVIRONMENT\", this.myAgent, this.controllerAgent.getGameid());\n\t\t\t\tif(!agents.isEmpty())\n\t\t\t\t{\n\t\t\t\t\tfor(AID aid : agents)\n\t\t\t\t\t{\n\t\t\t\t\t\tmsg.addReceiver(aid);\n\t\t\t\t\t}\n\t\t\t\t\tthis.myAgent.send(msg);\n\t\t\t\t}\n\n\t\t\t\t///\tSystem.err.println(\"\\nSV : \"+this.nbVoters+\"/\"+this.request.getAIDVoters().size());\n\n\t\t\t\tif(this.nbVoters >= this.request.getAIDVoters().size())\n\t\t\t\t{\n\t\t\t\t\tthis.nbVoters = 0;\n\t\t\t\t\t//System.err.println(\"SV next step\");\n\t\t\t\t\tthis.nextStep = STATE_RESULTS;\n\t\t\t\t}\n\t\t\t\telse if(this.nbAsynchronousPlayers > 0)\n\t\t\t\t{\n\t\t\t\t\t//System.err.println(\"SV waiting other\");\n\t\t\t\t\tthis.nextStep = STATE_RECEIVE_INFORM;\n\t\t\t\t}\n\t\t\t\telse \n\t\t\t\t{\n\t\t\t\t\tSystem.err.println(\"SV send request to other\");\n\t\t\t\t\tthis.nextStep = STATE_SEND_REQUEST;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tblock(1000);\t\n\t\t\t}\n\t\t}\n\n\n\t\telse if(this.step.equals(STATE_GET_SIMPLE_SUSPICION))\n\t\t{\n\t\t\tACLMessage messageRequest = new ACLMessage(ACLMessage.REQUEST);\n\t\t\tmessageRequest.setSender(this.myAgent.getAID());\n\t\t\tmessageRequest.setConversationId(\"GET_SIMPLE_SUSPICION\");\n\n\t\t\tObjectMapper mapper = new ObjectMapper();\n\n\t\t\tString json =\"\";\n\n\t\t\ttry {\t\t\n\t\t\t\tjson = mapper.writeValueAsString(this.request);\t\t\t\n\t\t\t} catch (Exception e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\n\t\t\tmessageRequest.setContent(json);\n\t\t\tfor(AID aid : this.request.getAIDVoters()){\n\t\t\t\tmessageRequest.addReceiver(aid);\t\n\t\t\t}\n\n\t\t\tthis.nbVoters = 0;\n\t\t\tthis.myAgent.send(messageRequest);\n\t\t\tthis.nextStep = STATE_ADD_SIMPLE_SUSPICION;\n\t\t}\n\t\telse if(this.step.equals(STATE_ADD_SIMPLE_SUSPICION))\n\t\t{\n\t\t\tMessageTemplate mt = MessageTemplate.and(\n\t\t\t\t\tMessageTemplate.MatchPerformative(ACLMessage.INFORM),\n\t\t\t\t\tMessageTemplate.MatchConversationId(\"GET_SIMPLE_SUSPICION\"));\n\n\t\t\tACLMessage message = this.myAgent.receive(mt);\n\t\t\tif(message!=null)\n\t\t\t{\n\t\t\t\t++this.nbVoters;\n\n\t\t\t\tObjectMapper mapper = new ObjectMapper();\n\t\t\t\tSuspicionScore suspicionScore = new SuspicionScore();\n\t\t\t\ttry {\n\t\t\t\t\tsuspicionScore = mapper.readValue(message.getContent(), SuspicionScore.class);\n\t\t\t\t\t//System.err.println(\"ADD PARTIAL SUSPICION \\n\"+message.getContent());\n\t\t\t\t} \n\t\t\t\tcatch (IOException e) \n\t\t\t\t{\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\n\t\t\t\tAID aidPlayer = message.getSender();\n\t\t\t\tthis.request.getCollectiveSuspicionScore().addSuspicionScoreGrid(aidPlayer.getName(), suspicionScore);\n\n\t\t\t\tif(this.nbVoters>= this.request.getAIDVoters().size())\n\t\t\t\t{\n\t\t\t\t\tthis.nbVoters = 0;\n\t\t\t\t\tSystem.err.println(\"SUSPICION COLLECTIVE \\n \"+this.request.getCollectiveSuspicionScore().getScore());\n\n\t\t\t\t\t//sort random\n\t\t\t\t\tCollections.shuffle(this.request.getVoters());\n\t\t\t\t\tthis.nextStep = STATE_SEND_REQUEST;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tthis.nextStep = STATE_ADD_SIMPLE_SUSPICION;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tthis.nextStep = STATE_ADD_SIMPLE_SUSPICION;\n\t\t\t\tblock(1000);\n\t\t\t}\n\t\t}\n\n\t\telse if(this.step.equals(STATE_RESULTS))\n\t\t{\n\t\t\tthis.finalResults = this.results.getFinalResults();\n\n\t\t\t/** equality ? **/\n\t\t\tif(this.finalResults.size() == 1)\n\t\t\t{\n\t\t\t\tthis.nextStep = STATE_SEND_RESULTS;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t//defavorisé le bouc emmissaire\n\t\t\t\tList<AID> scapegoats = DFServices.findGamePlayerAgent(Roles.SCAPEGOAT, this.myAgent, this.controllerAgent.getGameid());\n\t\t\t\tList<String> nameScapegoats = new ArrayList<String>();\n\t\t\t\tfor(AID scapegoat : scapegoats)\n\t\t\t\t{\n\t\t\t\t\tnameScapegoats.add(scapegoat.getName());\n\t\t\t\t}\n\t\t\t\tfor(String scapegoat : nameScapegoats)\n\t\t\t\t{\n\t\t\t\t\tif(this.finalResults.contains(scapegoat))\n\t\t\t\t\t{\n\t\t\t\t\t\tif(this.request.isVoteAgainst())\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tthis.finalResults = nameScapegoats;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(this.finalResults.size()>1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tthis.finalResults.remove(scapegoat);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif(this.lastResults != null && this.lastResults.equals(this.finalResults))\n\t\t\t\t{\n\t\t\t\t\t/** interblocage **/\n\t\t\t\t\tArrayList<String> tmp = new ArrayList<String>();\n\n\t\t\t\t\t//System.err.println(\"INTERBLOCAGE\");\n\n\t\t\t\t\t/** random choice **/\n\t\t\t\t\ttmp.add(this.finalResults.get((int)Math.random()*this.finalResults.size()));\t\t\t\t\n\t\t\t\t\tthis.finalResults = tmp;\n\n\t\t\t\t\tthis.nextStep = STATE_SEND_RESULTS;\n\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// new vote with finalists\n\t\t\t\t\tthis.request.setChoices(this.finalResults);\n\n\t\t\t\t\t//sort random\n\t\t\t\t\tCollections.shuffle(this.request.getVoters());\n\n\t\t\t\t\tthis.results = new VoteResults();\n\t\t\t\t\tthis.results.initWithChoice(this.request.getChoices());\n\t\t\t\t\tthis.request.setLocalVoteResults(this.results);\n\t\t\t\t\tthis.lastResults = this.finalResults;\n\t\t\t\t\tthis.nbVoters = 0;\n\t\t\t\t\tthis.nextStep = STATE_SEND_REQUEST;\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse if(this.step.equals(STATE_SEND_RESULTS))\n\t\t{\n\t\t\tif(this.finalResults.isEmpty())\n\t\t\t{\n\t\t\t\tSystem.err.println(\"ERROR\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tSystem.out.println(\"RESULTS => \"+this.finalResults.get(0));\n\t\t\t}\n\n\t\t\t//envoi resultat final + maj global vote\n\t\t\tif(this.request.getRequest().equals(\"CITIZEN_VOTE\"))\n\t\t\t{\n\t\t\t\tString json = \"\";\n\t\t\t\tObjectMapper mapper = new ObjectMapper();\n\t\t\t\ttry {\n\t\t\t\t\tjson = mapper.writeValueAsString(this.results);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\n\t\t\t\tACLMessage message = new ACLMessage(ACLMessage.AGREE);\n\t\t\t\tmessage.setContent(json);\n\t\t\t\tmessage.setSender(this.myAgent.getAID());\n\t\t\t\tmessage.setConversationId(\"NEW_CITIZEN_VOTE_RESULTS\");\n\n\t\t\t\tList<AID> agents = DFServices.findGameControllerAgent(\"ENVIRONMENT\", this.myAgent, this.controllerAgent.getGameid());\n\t\t\t\tif(!agents.isEmpty())\n\t\t\t\t{\n\t\t\t\t\tfor(AID aid : agents)\n\t\t\t\t\t{\n\t\t\t\t\t\tmessage.addReceiver(aid);\n\t\t\t\t\t}\n\t\t\t\t\tthis.myAgent.send(message);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tACLMessage message = new ACLMessage(ACLMessage.INFORM);\n\t\t\tmessage.setSender(this.myAgent.getAID());\n\t\t\tmessage.addReceiver(this.agentSender);\n\t\t\tmessage.setConversationId(\"VOTE_RESULTS\");\n\t\t\tmessage.setContent(this.finalResults.get(0));\n\n\n\t\t\tString name = this.finalResults.get(0);\n\n\t\t\tif(!this.request.isAskRequest()){\n\t\t\t\tint index = name.indexOf(\"@\");\n\t\t\t\tname = name.substring(0, index);\n\t\t\t\tFunctions.newActionToLog(\"Vote : \"+name, this.getAgent(), this.controllerAgent.getGameid());\n\t\t\t}\n\t\t\t\n\n\t\t\tthis.myAgent.send(message);\t\n\t\t\tthis.nextStep = STATE_INIT;\n\t\t}\n\n\n\n\t\tif(!this.nextStep.isEmpty())\n\t\t{\n\t\t\tthis.step = this.nextStep;\n\t\t\tthis.nextStep =\"\";\n\t\t}\n\n\n\t}", "public void doAttackMoove(Point player, int move){\n MoveAction action = new MoveAction();\n action.setSource(this.player);\n VisualArea tab[] = action.getVisualArea( this.engine.getGameInformation() );\n Point better = player;\n for( int i = 0 ; i < tab.length ; i++ ){\n if( team == 0 ){\n if( tab[i].getX() > better.getX() )better = tab[i];\n }else if ( team == 1 ) {\n if( tab[i].getX() < better.getX() )better = tab[i];\n }else{\n new JOptionPane(\"Error\");\n }\n action.setDestination(better);\n this.engine.performAction( action );\n }\n }", "public void doLearnTrials() {\n //clearAreaReset();\n\n int action = 0;\n float[] checkTable = getRplaceTable(myIal);\n\n for(int trial = 0; trial < learnTrials; trial++) { //For each of the learning trials.....\n\n //myIal.wait(500);\n //Do an IAL action ***************************************************************************************************************************************\n\n //Given the current state... do a random action\n action = getRandAction();\n if(myIal.myState == Agent.State.PLACE) {\n checkTable = myIal.getPlaceTable(myIal.locx, myIal.locy, myIal.locz);\n if(getMaxValue(checkTable) > 0) {\n action = getMaxIndex(checkTable);\n }\n myIal.updateQtable(myIal.getPlaceTable(myIal.locx, myIal.locy, myIal.locz), \n action, getRplaceTable(myIal)); //Ial updates table\n if(getRplaceTable(myIal)[action] > 0) {\n myIal.myState = Agent.State.MOVE;\n }\n }\n else if(myIal.myState == Agent.State.MOVE) {\n checkTable = myIal.getMoveTable(myIal.locx, myIal.locy, myIal.locz);\n if(getMaxValue(checkTable) > 0) {\n action = getMaxIndex(checkTable);\n }\n myIal.updateQtable(myIal.getMoveTable(myIal.locx, myIal.locy, myIal.locz), \n action, getRmoveTable(myIal)); //Ial updates table\n myIal.doAction(action);\n myIal.myState = Agent.State.PLACE;\n }\n \n //my2Ial.wait(500);\n //********************************************************************************************************************************************************\n //Do a 2IAL action\n //Given current state... do an action\n action = getRandAction();\n if(my2Ial.myState == Agent.State.PLACE) {\n checkTable = my2Ial.getPlaceTable(my2Ial.locx, my2Ial.locy, my2Ial.locz);\n if(getMaxValue(checkTable) > 0) {\n action = getMaxIndex(checkTable);\n }\n my2Ial.updateQtable(my2Ial.getPlaceTable(my2Ial.locx, my2Ial.locy, my2Ial.locz),\n action, getRplaceTable(my2Ial)); //2Ial updates table\n if(getRplaceTable(my2Ial)[action] > 0) {\n my2Ial.myState = Agent.State.MOVE;\n }\n } else if(my2Ial.myState == Agent.State.MOVE) {\n checkTable = my2Ial.getPlaceTable(my2Ial.locx, my2Ial.locy, my2Ial.locz);\n if(getMaxValue(checkTable) > 0) {\n action = getMaxIndex(checkTable);\n }\n my2Ial.updateQtable(my2Ial.getMoveTable(my2Ial.locx, my2Ial.locy, my2Ial.locz), \n action, getRmoveTable(my2Ial)); //2Ial updates table\n my2Ial.doAction(action);\n my2Ial.myState = Agent.State.PLACE;\n }\n }\n }", "public double getInstanceReward(Instance selectedInstance, boolean doBernoulliRewards, boolean isTrainingInstance, boolean verbose)\n {\n double[] probDist = classifyInstance(selectedInstance, false); \n \n //Determine Expected Reward from the returned Probability Distribution\n //Note that the following 5-point Likert scale was used\n //1 - Extremely unchallenging for me\n //2 - Somewhat unchallenging for me\n //3 - Appropriately challenging for me\n //4 - Somewhat challenging for me\n //5 - Extremely challenging for me\n double[] rewardsPerClass = new double[]{0, 1d/3d, 1, 1d/3d, 0}; //rewards per class as defined in paper, section 4.2 Phase 1.\n double expectedReward = (probDist[0] * rewardsPerClass[0]) +\n (probDist[1] * rewardsPerClass[1]) +\n (probDist[2] * rewardsPerClass[2]) +\n (probDist[3] * rewardsPerClass[3]) +\n (probDist[4] * rewardsPerClass[4]);\n \n if (verbose) {\n System.out.println(\"\");\n System.out.println(\"getInstanceReward called()...\");\n System.out.println(\"-probability of instance being class 1: \" + probDist[0]);\n System.out.println(\"-probability of instance being class 2: \" + probDist[1]);\n System.out.println(\"-probability of instance being class 3: \" + probDist[2]);\n System.out.println(\"-probability of instance being class 4: \" + probDist[3]);\n System.out.println(\"-probability of instance being class 5: \" + probDist[4]);\n System.out.println(\"-the expected reward for this level segment was determined to be: \" + expectedReward );\n System.out.println(\"-done\");\n }\n \n// //Determine rewards according to Bernoulli scheme / proportional reward\n// double reward = 0.0;\n// if (doBernoulliRewards) {\n// if (verbose) System.out.println(\"-returning reward of 1 with probablity of \" + probChallenging + \", else reward of 0 (Bernoulli rewards)\");\n// boolean returnBernoulliReward;\n// if ( Math.random() <= probChallenging ) returnBernoulliReward = true;\n// else returnBernoulliReward = false;\n// if (verbose) System.out.println(\"-boolean returnBernoulliReward: \" + returnBernoulliReward);\n// if (returnBernoulliReward) reward = 1.0;\n// else reward = 0.0; \n// }\n// else {\n// if (verbose) System.out.println(\"-returning reward \" + probChallenging + \" (regular non-Bernoulli rewards)\");\n// reward = probChallenging;\n// }\n// if (verbose) System.out.println(\"-done\");\n \n return expectedReward;\n }", "public void onComplete(String result) {\n\t\tfileIO.stringToReward(result);\n\t\tfileIO.exportRewards();\n\t\tgetData();\n\t\tinitiateUI();\n\t}", "@Override\n\tpublic void makeMove(Game game) \n\t{\n\t\t\n\t\tint row1,col1,row2,col2;\n\t\tCheckers tttGame = (Checkers) game;\n\t\t\n\t\tboolean first = true;\n\n\t\t\tcorrectmove= false;\n\t\t\tSystem.out.println(\"Insert target (row,column) and destination (row, column) ([0,7])\");\n\n\t\t\trow1 = tttGame.x1;\n\t\t\tcol1 = tttGame.y1;\n\t\t\trow2 = tttGame.x2;\n\t\t\tcol2 = tttGame.y2;\n\t\t\tSystem.out.println(row1 + \" \" + col1 + \" \" + row2 + \" \" + col2 + \" \" + role);\n\t\t\t\n\t\t\tfirst=false;\n\t\tcorrectmove= tttGame.isValidCell(row1, col1, row2, col2,role);\n\t\tSystem.out.println(correctmove);\n\n\t\tif(correctmove)\n\t\t{\n\t\t\ttttGame.board[row2][col2]= tttGame.board[row1][col1];\n\t\t\tif(row2==0 && role==0) \n\t\t\t{\n\t\t\t\tif(role==0) tttGame.board[row2][col2]= 2;\n\t\t\t\telse tttGame.board[row2][col2]= -2;\n\t\t\t}\n\t\t\telse if(row2==7 && role==1) \n\t\t\t{\n\t\t\t\tif(role==0) tttGame.board[row2][col2]= 2;\n\t\t\t\telse tttGame.board[row2][col2]= -2;\n\t\t\t}\n\t\t\ttttGame.board[row1][col1]=0;\n\t\t\tif(abs(row1-row2)==2)\n\t\t\t{\n\t\t\t\tint x= (row1+ row2)/2;\n\t\t\t\tint y= (col1+ col2)/2;\n\t\t\t\ttttGame.board[x][y]=0;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tSystem.out.println(\"invalid move!\");\n\t\t}\n\t\t\n//\t\ttttGame.board[row][col] = role;\n\t}", "@Override\n public void doAction() {\n String move = agent.getBestMove(currentPosition);\n execute(move);\n\n //Location of the player\n int cX = w.getPlayerX();\n int cY = w.getPlayerY();\n\n if (w.hasWumpus(cX, cY)) {\n System.out.println(\"Wampus is here\");\n w.doAction(World.A_SHOOT);\n } else if (w.hasGlitter(cX, cY)) {\n System.out.println(\"Agent won\");\n w.doAction(World.A_GRAB);\n } else if (w.hasPit(cX, cY)) {\n System.out.println(\"Fell in the pit\");\n }\n\n// //Basic action:\n// //Grab Gold if we can.\n// if (w.hasGlitter(cX, cY)) {\n// w.doAction(World.A_GRAB);\n// return;\n// }\n//\n// //Basic action:\n// //We are in a pit. Climb up.\n// if (w.isInPit()) {\n// w.doAction(World.A_CLIMB);\n// return;\n// }\n//\n// //Test the environment\n// if (w.hasBreeze(cX, cY)) {\n// System.out.println(\"I am in a Breeze\");\n// }\n// if (w.hasStench(cX, cY)) {\n// System.out.println(\"I am in a Stench\");\n// }\n// if (w.hasPit(cX, cY)) {\n// System.out.println(\"I am in a Pit\");\n// }\n// if (w.getDirection() == World.DIR_RIGHT) {\n// System.out.println(\"I am facing Right\");\n// }\n// if (w.getDirection() == World.DIR_LEFT) {\n// System.out.println(\"I am facing Left\");\n// }\n// if (w.getDirection() == World.DIR_UP) {\n// System.out.println(\"I am facing Up\");\n// }\n// if (w.getDirection() == World.DIR_DOWN) {\n// System.out.println(\"I am facing Down\");\n// }\n//\n// //decide next move\n// rnd = decideRandomMove();\n// if (rnd == 0) {\n// w.doAction(World.A_TURN_LEFT);\n// w.doAction(World.A_MOVE);\n// }\n//\n// if (rnd == 1) {\n// w.doAction(World.A_MOVE);\n// }\n//\n// if (rnd == 2) {\n// w.doAction(World.A_TURN_LEFT);\n// w.doAction(World.A_TURN_LEFT);\n// w.doAction(World.A_MOVE);\n// }\n//\n// if (rnd == 3) {\n// w.doAction(World.A_TURN_RIGHT);\n// w.doAction(World.A_MOVE);\n// }\n }", "public void train() {\n while (!environment.inTerminalState()) {\n\n Action action = policy.chooseAction(environment);\n List<Double> stateAction = environment.getStateAction(action);\n\n double knownReward = environment.immediateReward(action);\n double totalReward = environment.performAction(action);\n double unknownReward = totalReward - knownReward;\n\n // Next state of environment is implicitly passed.\n backup(stateAction, unknownReward);\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}", "@Override\n\tpublic Map<Integer, Action> initialStep(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 all of your units\n\t\t// Refer to the resource agent example for ways of\n\t\t// differentiating between different unit types based on\n\t\t// the list of IDs\n\t\tList<Integer> myUnitIDs = newstate.getUnitIds(playernum);\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\tif(enemyUnitIDs.size() == 0)\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\n\t\t//This block of text sends all units to the corner, with the ballistas being in the back row.\n\t\tactions.put(myUnitIDs.get(0), Action.createCompoundMove(myUnitIDs.get(0), 1, 16));\n\t\tactions.put(myUnitIDs.get(1), Action.createCompoundMove(myUnitIDs.get(1), 2, 17));\n\t\tactions.put(myUnitIDs.get(2), Action.createCompoundMove(myUnitIDs.get(2), 17, 8));\n\t\tactions.put(myUnitIDs.get(3), Action.createCompoundMove(myUnitIDs.get(3), 0, 16));\n\t\tactions.put(myUnitIDs.get(4), Action.createCompoundMove(myUnitIDs.get(4), 2, 18));\n\t\tactions.put(myUnitIDs.get(5), Action.createCompoundMove(myUnitIDs.get(5), 0, 17));\n\t\tactions.put(myUnitIDs.get(6), Action.createCompoundMove(myUnitIDs.get(6), 1, 18));\n\n\t\treturn actions;\n\t}", "@Override\r\n\tint[] move( int turnNo ) {\n\t\treturn getUserMove();\r\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 boolean takeCardReward(int i){\n if(!isGameOver() || character.getHp() <= 0 )return false;\n if( cardRewardGiven )return false;\n Pile cPile = character.getDeck();\n Card c = reward.getCards().get(i);\n System.out.println(\"**IN takeCardReward, card name is : \" + c.getName());\n character.getDeck().addCard(c);\n cardRewardGiven=true;\n return true;\n }", "List<Ranking> calculateOutcomeRanks(List<Instruction> instructions);", "public void calculateScore() {\n\n turnScore();\n\n if (turn == 1) {\n p1.setScore(p1.getScore() - turnScore);\n\n } else if (turn == 2) {\n p2.setScore(p2.getScore() - turnScore);\n\n }\n\n\n }", "public static void setup(MC hero) \n { \n Scanner scan = new Scanner (System.in); \n String response;\n StoryLine.history();\n boolean nameLoop = false;\n while (!nameLoop) //while you do not choose or like the name you picked.\n {\n System.out.print(\"I see you are the chosen one. I am fate, the decider.\" + \"\\n\" + \"What is your name?\" + \"\\n\" + \"\\n\"\n + \"Name: \");\n hero.setName(scan.nextLine());\n System.out.println(\"Confirming \" + hero.getName() + \" as your name (Y / N)?\");\n response = scan.nextLine();\n nameLoop = (response.equalsIgnoreCase(\"Y\") || response.equalsIgnoreCase(\"Yes\"));\n }\n System.out.println(\"\\n\" + \"\\n\" +\"My \" + hero.getName() + \", your current attributes are - Health: \" + hero.getMaxHP() + \" Strength: \" + hero.getMaxHeal() + \" Strength: \" + hero.getStrength() + \" Agility: \"\n + hero.getAgility() + \" Defence: \"+ hero.getDefence() + \"\\n\\n<press any key to continue>\");\n scan.nextLine();\n System.out.println(\"\\n\" + \"Right now you have \" + hero.getPoints() + \" power-points in storage. You may add them to any of your stats. \\n\\n\"\n + \"Type in these options [health (h), heal (hl), strength (s), agility (a), defence (d), or None(N)]\" + \n \"\\n\" + \"The increase is as follows [health (+10), heal(+1), strength (+1), agility (+1), defence (+1), None(saves points)]\" +\n \"\\n\" + \"When you are complete, please type in done\" + \n \"\\n\" + \"Please choose wisely because you are unable to reset.\" + \"\\n\" + \"\\n\" + \"\\n<press any key to continue>\");\n scan.nextLine();\n boolean loop = true;\n while (loop) //while you still have points or want to use your points\n {\n System.out.print(\"Action: \");\n String action = scan.nextLine();\n loop = Methods.pointDistribute(action, hero);\n }\n System.out.println(\"You, \" + hero.getName() + \", now have \" + hero.getMaxHP() + \" hp, \" + hero.getMaxHeal() + \" max heal, \" + hero.getStrength() + \" strength, \"\n + hero.getAgility() + \" agility, \" + hero.getDefence() + \" defence.\" + \"\\n\"); \n System.out.println(\"\\n\" + \"Congratulations, you have leveled up!\" + \"\\n\");\n MC.levelUp(hero);\n System.out.println(\"As you progress with quests and battles, you will earn enough experience to 'level up' and become stronger.\\n<press any key to continue>\");\n scan.nextLine();\n System.out.println(\"Teleporting to town square...\\n**Note: This is the limited edition, the LITE version. You cannot save and have multiple accounts per game. \\nIf you want the full version, it is only accessible on BlueJ and Eclipse, which you can download both the game and the IDE online. \\n\\n\\nAlso, there may be extra spaces for Java's line eating fault\\nIf this happens, retype your action again.\\n\\nPlease refer to the manuals if you have any confusions before emailing questions.\" + \"\\n\" + \"\\n<press any key to continue>\");\n scan.nextLine();\n }", "private void wander(){\n\t\tmonster.moveRandom();\r\n\t\tsaveMove();\r\n\t}", "public boolean takeRelicReward(){\n if(!isGameOver() || character.getHp() <= 0 )return false;\n if( relicRewardGiven )return false;\n character.addRelic( reward.getRelic() );\n relicRewardGiven=true;\n return true;\n }", "public BigDecimal getReward() {\n return reward;\n }", "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 }", "List<UserReward> getUserRewards(String userName) throws UserNotFoundException;", "public ArrayList<Integer> getRankReward() {\n/* 46 */ return this.rankReward;\n/* */ }", "public boolean plizMovePlayerForward(Player player)\n {\n\n //check if die was rolled\n if (getValue_from_die() > 0)\n {\n int x_cord = player.getX_cordinate();\n int y_cord = player.getY_cordinate();\n int steps = player.getSteps_moved();\n\n //try to get player from color home\n if (attempt2GetPlayerFromHomeSucceds(player))\n {\n return true;\n }\n\n //if player has already reached home do nothing\n if (player.getSteps_moved() >= 58)\n {\n return false;\n }\n //if player is inside home stretch he has to play exact number to go home\n else if (player.getSteps_moved() >= 52)\n {\n if (59 - player.getSteps_moved() <= value_from_die)\n {\n return false;\n }\n }\n\n //if player isnt at home move him\n if (player.getSteps_moved() > 0)\n {\n for (int i = 1; i <= (value_from_die); i++)\n {\n player.movePlayerForward();\n if (roadBlocked(player))\n {\n road_blocked = true;\n }\n player.setHas_not_been_drawn(true);\n }\n\n //roll back changes\n if (road_blocked)\n {\n player.setX_cordinate(x_cord);\n player.setY_cordinate(y_cord);\n player.setSteps_moved(steps);\n ludo.setDrawRoadBlockedSign(true);\n //println(\"ROAD BLOCKED\");\n road_blocked = false;\n return false;\n }\n playPlayerHasMovedMusic();\n //see if player eats someone\n if (getPerson_to_play() == 1)\n {\n BlueEatsPlayer(player);\n }\n else if (getPerson_to_play() == 2)\n {\n RedEatsPlayer(player);\n }\n else if (getPerson_to_play() == 3)\n {\n GreenEatsPlayer(player);\n }\n else if (getPerson_to_play() == 4)\n {\n YellowEatsPlayer(player);\n }\n if (value_from_die == 6)\n {\n resetDieScore();\n ludo.setDrawScoreAllowed(false);\n return true;\n }\n //reset variables and change person to play\n resetDieScore();\n ludo.setDrawScoreAllowed(false);\n changePersonToPlay();\n return true;\n }\n //occurs rarely at the begining of the game\n else\n {\n //println(\"steps less than 0\");\n return false;\n }\n }\n else\n {\n //println(\"PLIZ ROLL DIE FIRST THEN MOVE BUTTON\");\n return false;\n }\n }", "@Override\n public List<String> doAction(){\n destination.setCloakTurns(destination.getCloakTurns() + 3);\n destination.getOwner().getResources().getTechResource().useTech(Constants.CLOAK_COST);\n //Message \"(Player) cloaked (destination) for three more turns.\"\n return Arrays.asList((destination.getOwner().getName() + \" cloaked \" + destination.getName() + \" for three more turns.\"));\n }", "public boolean takePotionReward(){\n if(!isGameOver() || character.getHp() <= 0 )return false;\n if( potRewardGiven )return false;\n boolean isAdded = character.addPotion( reward.getPot() );\n potRewardGiven=true;\n return isAdded;\n }", "public boolean hasReward() {\n return result.hasReward();\n }" ]
[ "0.6254587", "0.6194907", "0.6126895", "0.61254114", "0.59846234", "0.59139806", "0.5882312", "0.5874581", "0.5863343", "0.5842919", "0.58288944", "0.57816213", "0.57767427", "0.5776478", "0.5776448", "0.5749248", "0.57268167", "0.56999105", "0.569595", "0.56411767", "0.5639274", "0.5633172", "0.56249493", "0.5619665", "0.5616077", "0.5615729", "0.5604138", "0.5591262", "0.55836153", "0.5554989", "0.55414283", "0.5536951", "0.55368036", "0.55345243", "0.55278665", "0.5519267", "0.55122656", "0.54867643", "0.54755175", "0.5468165", "0.54653925", "0.54500383", "0.544863", "0.54476607", "0.54427946", "0.54321307", "0.5418492", "0.54106593", "0.54058945", "0.53969693", "0.5396371", "0.5380471", "0.5375654", "0.53742546", "0.5367702", "0.53586453", "0.53578466", "0.5355468", "0.53519297", "0.53491384", "0.5334208", "0.5329284", "0.53192115", "0.53183347", "0.53074217", "0.53034234", "0.52933615", "0.5275955", "0.5274231", "0.5270288", "0.52696806", "0.5264884", "0.526325", "0.52511466", "0.52501667", "0.5244443", "0.5243048", "0.52421105", "0.5239008", "0.5238293", "0.52376074", "0.5233953", "0.5233392", "0.52332735", "0.52321553", "0.52292943", "0.521795", "0.5216486", "0.5205668", "0.5203943", "0.5201104", "0.52006066", "0.5188644", "0.5184962", "0.51843125", "0.5180545", "0.51786005", "0.51743376", "0.5173873", "0.5169532" ]
0.5242913
77
Inform AI who the winner is result is either (H)ome win, (A)way win, (T)ie
@Override public synchronized void postWinner(char result) { rememberGame(result); //Increase the heat (decrease randomness) as more games are played if (heat < heatMax && gamesPlayed % 50 == 0) heat++; gamesPlayed++; game = null; // No longer playing a game though. }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void tellPlayerResult(int winner) {\n\t}", "public int winner() {\n if(humanPlayerHits == 17) {\n return 1;\n }\n if(computerPlayerHits == 17){\n return 2;\n }\n return 0;\n }", "private static void winnerOrTie()\n\t{\n\t\t//Check each row for winning or tie condition.\n\t\tif(tictactoeBoard[0] == tictactoeBoard[1] && tictactoeBoard[1] == tictactoeBoard[2] && tictactoeBoard[0] != 1)\n\t\t{\n\t\t\tSystem.out.println(\"Winner\");\n\t\t}\n\t\tif(tictactoeBoard[3] == tictactoeBoard[4] && tictactoeBoard[4] == tictactoeBoard[5] && tictactoeBoard[3] != 4)\n\t\t{\n\t\t\tSystem.out.println(\"Winner\");\n\t\t}\n\t\tif(tictactoeBoard[6] == tictactoeBoard[7] && tictactoeBoard[7] == tictactoeBoard[8] && tictactoeBoard[6] != 7)\n\t\t{\n\t\t\tSystem.out.println(\"Winner\");\n\t\t}\n\t\t//Check diagonally for winning or tie condition.\n\t\tif(tictactoeBoard[0] == tictactoeBoard[4] && tictactoeBoard[4] == tictactoeBoard[8] && tictactoeBoard[0] != 1)\n\t\t{\n\t\t\tSystem.out.println(\"Winner\");\n\t\t}\n\t\tif(tictactoeBoard[6] == tictactoeBoard[4] && tictactoeBoard[4] == tictactoeBoard[2] && tictactoeBoard[6] != 7)\n\t\t{\n\t\t\tSystem.out.println(\"Winner\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//nobody has won yet.\n\t\t\t//changeTurn();\n\t\t}\n\t}", "public void win() {\n if (turn == 1) {\n p1.incrementLegs();\n if (p1.getLegs() == 5) {\n p1.incrementSets();\n p1.setLegs(0);\n p2.setSets(0);\n\n }\n if (p1LastScore > p1.getHighout()) {\n p1.setHighout(p1LastScore);\n\n }\n\n if (p1.getHighout() > OVERALL_HIGH_OUT) {\n OVERALL_HIGH_OUT = p1.getHighout();\n }\n } else if (turn == 2) {\n p2.incrementLegs();\n if (p2.getLegs() == 5) {\n p2.incrementSets();\n p2.setLegs(0);\n p1.setSets(0);\n\n }\n if (p2LastScore > p2.getHighout()) {\n p2.setHighout(p2LastScore);\n }\n\n if (p2.getHighout() > OVERALL_HIGH_OUT) {\n OVERALL_HIGH_OUT = p2.getHighout();\n }\n\n\n\n }\n changeFirstTurn();\n win = true;\n\n\n\n }", "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 }", "public boolean winner(){\n\t\treturn goals1 > goals2;\n\t}", "private void showChampionshipWinner()\n {\n boolean singleWinner = true;\n String winnerDrivers = getDrivers().getDriver(0).getName();\n for(int j = 1; j < getDrivers().getSize(); j++)\n { \n if(getDrivers().getDriver(0).getAccumulatedScore() == getDrivers().getDriver(j).getAccumulatedScore()) // if multiple winners\n {\n singleWinner = false;\n winnerDrivers += \" and \" + getDrivers().getDriver(j).getName();\n break;\n }\n else\n {\n break;\n }\n\n }\n if(singleWinner)\n System.out.println(winnerDrivers + \" is the winner of the championship with \" + getDrivers().getDriver(0).getAccumulatedScore() + \" points\");\n else // if multiple winner\n System.out.println(\"ITS A CHAMPIONSHIP TIE!!!\" + winnerDrivers + \" are the winners of the championship with \" + getDrivers().getDriver(0).getAccumulatedScore() + \" points\");\n }", "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}", "private void decideWinner() {\n String winnerAnnouncement;\n if(player1Choice.equalsIgnoreCase(\"rock\") && player2Choice.equalsIgnoreCase(\"scissors\")) {\n winnerAnnouncement = \"Player: ROCK vs Computer: SCISSORS ----- PLAYER WINS\";\n } else if(player1Choice.equalsIgnoreCase(\"scissors\") && player2Choice.equalsIgnoreCase(\"rock\")) {\n winnerAnnouncement = \"Player: SCISSORS vs Computer: ROCK ----- COMPUTER WINS\";\n } else if(player1Choice.equalsIgnoreCase(\"paper\") && player2Choice.equalsIgnoreCase(\"rock\")) {\n winnerAnnouncement = \"Player: PAPER vs Computer: ROCK ----- PLAYER WINS\";\n } else if(player1Choice.equalsIgnoreCase(\"rock\") && player2Choice.equalsIgnoreCase(\"paper\")) {\n winnerAnnouncement = \"Player: ROCK vs Computer: PAPER ----- COMPUTER WINS\";\n } else if(player1Choice.equalsIgnoreCase(\"scissors\") && player2Choice.equalsIgnoreCase(\"paper\")) {\n winnerAnnouncement = \"Player: SCISSORS vs Computer: PAPER ----- PLAYER WINS\";\n } else if(player1Choice.equalsIgnoreCase(\"paper\") && player2Choice.equalsIgnoreCase(\"scissors\")) {\n winnerAnnouncement = \"Player: PAPER vs Computer: SCISSORS ----- COMPUTER WINS\";\n } else {\n winnerAnnouncement = \"Its a TIE ---- EVERYONE IS A LOSER\";\n }\n // Print out who won in this format: \"Player: ROCK vs Computer: SCISSORS ----- PLAYER WINS\"\n System.out.println(winnerAnnouncement);\n }", "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}", "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 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}", "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}", "private void win(int winner)\n {\n switch (winner) {\n case PLAYER_1_FLAG:\n player1.gameOver(RESULT_WIN);\n player2.gameOver(RESULT_LOSS);\n winSend.close();\n break;\n case PLAYER_2_FLAG:\n player1.gameOver(RESULT_LOSS);\n player2.gameOver(RESULT_WIN);\n \n winSend.close();\n break;\n }\n }", "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}", "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 int getWinner() {return winner();}", "public final boolean checkForWin() {\r\n boolean result = false;\r\n String player = \"\";\r\n \r\n for (Rail rail : rails) {\r\n if (rail.isWinner()) {\r\n result = true;\r\n for(Tile tile : rail.getTiles()) {\r\n tile.setBackground(Color.GREEN);\r\n player = tile.getText();\r\n }\r\n if (player.equals(\"X\")) {\r\n winningPlayer = \"X\";\r\n this.xWins++;\r\n } else if (player.equals(\"0\")) {\r\n winningPlayer = \"0\";\r\n this.oWins++;\r\n }\r\n break;\r\n }\r\n }\r\n \r\n return result;\r\n }", "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 boolean winner() {\n String result = winType();\n if (result == null || result.equals(\"\"))\n return false;\n if (result.equals(\"horizontal\") || result.equals(\"vertical\") || result.equals(\"diagonal\") || result.equals(\"diagonal2\"))\n return true;\n return false;\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}", "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}", "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 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}", "public void winner() {\n\t\tList<String> authors = new ArrayList<String>(scores_authors.keySet());\n\t\tCollections.sort(authors, new Comparator<String>() {\n\n\t\t\t@Override\n\t\t\tpublic int compare(String o1, String o2) {\n\t\t\t\treturn scores_authors.get(o1).compareTo(scores_authors.get(o2));\n\t\t\t}\n\t\t});\n\t\tSystem.out.println(\"Score des auteurs :\");\n\t\tfor(String a :authors) {\n\t\t\tSystem.out.println(a.substring(0,5)+\" : \"+scores_authors.get(a));\n\t\t}\n\t\t\n\t\tList<String> politicians = new ArrayList<String>(scores_politicians.keySet());\n\t\tCollections.sort(politicians, new Comparator<String>() {\n\n\t\t\t@Override\n\t\t\tpublic int compare(String o1, String o2) {\n\t\t\t\treturn scores_politicians.get(o1).compareTo(scores_politicians.get(o2));\n\t\t\t}\n\t\t});\n\t\tSystem.out.println(\"Score des politiciens :\");\n\t\tfor(String p :politicians) {\n\t\t\tSystem.out.println(p.substring(0,5)+\" : \"+scores_politicians.get(p));\n\t\t}\n\t}", "void checkWinner() {\n\t}", "public void winGame() {\r\n if (data.gameState == 3) \r\n data.winner = 1;\r\n else if (data.gameState == 4) \r\n data.winner = 2;\r\n data.victoryFlag = true;\r\n data.gameState = 5;\r\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 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 int winner() {\n if (player1Wins())\n return 1;\n if (player2Wins())\n return 2;\n return -1; // No one has won\n }", "public void winGame() {\n this.isWinner = true;\n }", "public static String winner() {\n\t\tList<List<Integer>> winCon = new ArrayList<List<Integer>>();\n\t\twinCon.add(Arrays.asList(1, 2, 3, 4, 5)); // first Row of the table\n\t\twinCon.add(Arrays.asList(6, 7, 8, 9, 10)); // Second Row of the table\n\t\twinCon.add(Arrays.asList(11, 12, 13, 14, 15)); // Third Row of the table\n\t\twinCon.add(Arrays.asList(16, 17, 18, 19, 20)); // Fourth Row of the table\n\t\twinCon.add(Arrays.asList(21, 22, 23, 24, 25)); // Fifth Row of the table\n\t\twinCon.add(Arrays.asList(1, 6, 11, 16, 21)); // First Column of the table\n\t\twinCon.add(Arrays.asList(2, 7, 12, 17, 22)); // Second Column of the table\n\t\twinCon.add(Arrays.asList(3, 8, 13, 18, 23)); // Third Column of the table\n\t\twinCon.add(Arrays.asList(4, 9, 14, 19, 24)); // Fourth Column of the table\n\t\twinCon.add(Arrays.asList(5, 10, 15, 20, 25)); // Fifth Column of the table\n\t\twinCon.add(Arrays.asList(1, 7, 13, 19, 25)); // first diagonal of the table\n\t\twinCon.add(Arrays.asList(5, 9, 13, 17, 21)); // Second diagonal of the table\n\n\t\tfor (List<Integer> l : winCon) {\n\t\t\tif (playerPosition.containsAll(l)) {\n\t\t\t\treturn \"Congratulations! \"+user+\", You Won.\";\n\t\t\t} else if (cpuPosition.containsAll(l)) {\n\t\t\t\treturn \"Cpu Won!, Sorry :( \";\n\t\t\t} else if (playerPosition.size() + cpuPosition.size() == 25) {\n\t\t\t\treturn \"Draw!!!\";\n\t\t\t} \n\t\t}\n\t\treturn \"\";\n\t}", "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 winner() {\n\t\tif (numFire == 0 && numWater != 0) {\n\t\t\treturn \"Water\";\n\t\t} else if (numWater == 0 && numFire != 0) {\n\t\t\treturn \"Fire\";\n\t\t} else if (numWater == 00 && numFire == 0) {\n\t\t\treturn \"No one\";\n\t\t}\n\t\treturn null;\n\t}", "private void DeclareWinner(){\n\t\tTextView tvStatus = (TextView) findViewById(R.id.tvStatus);\n\t\tTextView tvP1Score = (TextView) findViewById(R.id.tvP1Score);\n\t\tTextView tvP2SCore = (TextView) findViewById(R.id.tvP2Score);\n\t\tTextView tvTieScore = (TextView) findViewById(R.id.tvTieScore);\n\t\tswitch(winner){\n\t\t\tcase CAT:\n\t\t\t\ttieScore = tieScore + 1;\n\t\t\t\ttvStatus.setText(\"Tie Cat Wins!\");\n\t\t\t\ttvTieScore.setText(String.valueOf(tieScore));\n\t\t\t\tbreak;\n\t\t\tcase P1_WINNER:\n\t\t\t\tp1Score = p1Score + 1;\n\t\t\t\ttvStatus.setText(\"Player 1 Wins!\");\n\t\t\t\ttvP1Score.setText(String.valueOf(p1Score));\n\t\t\t\tbreak;\n\t\t\tcase P2_WINNER:\n\t\t\t\tp2Score = p2Score + 1;\n\t\t\t\ttvStatus.setText(\"Player 2 Wins!\");\n\t\t\t\ttvP2SCore.setText(String.valueOf(p2Score));\n\t\t\t\tbreak;\n\t\t}\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 }", "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 }", "public String getWinner(){\n\tif (p1.getPoints()==p2.getPoints()){\n\t return \"Tie. Good food, bad outcome.\";\n\t}\n\treturn (p1.getPoints()>p2.getPoints()?\"Player Row\":\"Player Column\")+\" is the winner!\";\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 void winAccountant()\r\n {\r\n switch (Win)\r\n {case 1: //A tie with scissors\r\n ties++; uSci++; cSci++;\r\n break;\r\n case 2: //A tie with paper\r\n ties++; uPap++; cPap++;\r\n break;\r\n case 3: //A tie with rock\r\n ties++; uRock++; cRock++;\r\n break;\r\n case 4: //A win for user with Scissors\r\n uWins++; uSci++; uSciW++;\r\n cPap++;\r\n break;\r\n case 5: //A win for user with Paper\r\n uWins++; uPap++; uPapW++;\r\n cRock++;\r\n break;\r\n case 6: //A win for user with Rock\r\n uWins++; uRock++; uRockW++;\r\n cSci++;\r\n break;\r\n case 7: //A win for Comp with Scissors\r\n cWins++; cSci++; cSciW++;\r\n uPap++;\r\n break;\r\n case 8: //A win for Comp with Paper\r\n cWins++; cPap++; cPapW++;\r\n uRock++;\r\n break;\r\n case 9: //A win for Comp with Rock\r\n cWins++; cRock++; cRockW++;\r\n uSci++;\r\n break;\r\n default: JOptionPane.showMessageDialog(null,\r\n \"Error: Unknown Win Value - WinCalc.winAccountant 207\", \r\n \"digiRPS - Error\", \r\n JOptionPane.ERROR_MESSAGE);\r\n break;}\r\n \r\n // Update the last three wins\r\n winThree=winTwo;\r\n winTwo=winOne;\r\n winOne=Win;\r\n \r\n }", "private void checkWinner() {\n\t\tif(player.getHandVal() == BLACKJACK && dealer.getHandVal() == BLACKJACK) {\n\t\t\tSystem.out.println(\"Both players have Blackjack!\\n\");\n\t\t\tresult = \"TIE\";\n\t\t}\n\t\telse if (player.getHandVal() == BLACKJACK) {\n\t\t\tSystem.out.println(\"The Player has Blackjack!\\n\");\n\t\t\tresult = \"PLAYER\";\n\t\t}\n\t\telse if (dealer.getHandVal() == BLACKJACK) {\n\t\t\tSystem.out.println(\"The Dealer has Blackjack!\\n\");\n\t\t\tresult = \"DEALER\";\n\t\t}\n\t\telse if(player.getHandVal() > BLACKJACK && dealer.getHandVal() > BLACKJACK) {\n\t\t\tSystem.out.println(\"Both players bust!\\n\");\n\t\t\tresult = \"DEALER\";\n\t\t}\n\t\telse if(player.getHandVal() > BLACKJACK) {\n\t\t\tSystem.out.println(\"The Player has busted!\\n\");\n\t\t\tresult = \"DEALER\";\n\t\t}\n\t\telse if(dealer.getHandVal() > BLACKJACK) {\n\t\t\tSystem.out.println(\"The Dealer has busted!\\n\");\n\t\t\tresult = \"PLAYER\";\n\t\t}\n\t\telse if(player.getHandVal() > dealer.getHandVal()) {\n\t\t\tSystem.out.println(\"The Player has a higher score!\\n\");\n\t\t\tresult = \"PLAYER\";\n\t\t}\n\t\telse if(player.getHandVal() < dealer.getHandVal()){\n\t\t\tSystem.out.println(\"The dealer has a higher score!\\n\");\n\t\t\tresult = \"DEALER\";\n\t\t}\n\t\telse {\n\t\t\tSystem.out.println(\"Both players have the same score!\\n\");\n\t\t\tresult = \"TIE\";\n\t\t}\n\t}", "public static void declareWinner() {\n if (playerWins > compWins) {\n System.out.println(\"!!!PLAYER WINS THE GAME!!!\");\n } else if (playerWins < compWins) {\n System.out.println(\"Comp wins the game...better luck next time!\");\n } else {\n System.out.println(\"Player and Comp are tied after rounds.\");\n }\n\n if (ties > playerWins && ties > compWins) {\n System.out.println(\"A hard battle...\");\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 }", "String getWinner();", "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 static void winner()\n {\n if ((board[1] == userLetter && board[2] == userLetter && board[3] == userLetter) ||\n (board[4] == userLetter && board[5] == userLetter && board[6] == userLetter) ||\n (board[7] == userLetter && board[8] == userLetter && board[9] == userLetter) ||\n (board[1] == userLetter && board[5] == userLetter && board[9] == userLetter) ||\n (board[3] == userLetter && board[5] == userLetter && board[7] == userLetter))\n {\n showBoard();\n System.out.println(\"Player win the game\");\n System.exit(0);\n }\n }", "public static String winner() {\n\t\t// Behavior if the Player 1 won the most games.\n\t\tif (score1 > score2) {\n\t\t\treturn (player1 + \" is the winner! Congratulations \" + player1 + \" !\");\n\t\t}\n\t\t// Behavior if both players won the same number of games.\n\t\tif (score1 == score2) {\n\t\t\treturn (\"It's a tie! Both players won the same number of games. Congratulations \" + player1 + \" & \" + player2 + \" !\");\n\t\t}\n\t\t// Behavior if the Player 1 won the most games.\n\t\telse {\n\t\t\treturn (player2 + \" is the winner! Congratulations \" + player2 + \" !\");\n\t\t}\n\t}", "public void getScores(){\n String p1 = \"Player 1 has \" + Integer.toString(player1.getWins());\n String p2 = \"Player 2 has \" + Integer.toString(player2.getWins());\n String winner = \"tie\";\n if(player1.getWins()>player2.getWins()){\n winner = player1.getName() + \" wins!!!!\";\n }\n else if(player2.getWins()>player1.getWins()){\n winner = player2.getName() + \" Wins!!!\";\n }\n JOptionPane.showMessageDialog(null, (p1 + \"\\n\" + p2 + \"\\n\" + winner));\n }", "private boolean winGame() {\n if (model.isCompleted()) {\n win.message(\"Winner\");\n return true;\n }\n return false;\n }", "void printWinner(String winner) throws IOException;", "public boolean winner() {\r\n return winner;\r\n }", "public void checkWin(){\n boolean result = false;\n if(game.getTurn() > 3){\n Player currentPlayer = game.getPlayerTurn();\n int playernumber = currentPlayer.getPlayericon();\n result = game.winChecker(game.getBored(),playernumber);\n if(result == true) {\n setWinMsgBox(currentPlayer.getPlayerName() + \" Is victorious :)\",\"WIN\");\n }else if(game.getTurn() == 8 && result == false){\n setWinMsgBox(\"Too bad it is a draw, No one out smarted the other -_-\",\"DRAW\");\n }else{}\n }else{\n result = false;\n }\n }", "public void win() {\n JOptionPane.showConfirmDialog(null, \"You won! You got out with \" + this.player.getGold() + \" gold!\", \"VICTORY!\", JOptionPane.OK_OPTION);\n this.saveScore();\n this.updateScores();\n this.showTitleScreen();\n }", "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 doMatch() {\n // Remember how many games in this session\n mGameCounter++;\n\n PebbleDictionary resultDict = new PebbleDictionary();\n\n switch (mChoice) {\n case Keys.CHOICE_ROCK:\n switch(mP2Choice) {\n case Keys.CHOICE_ROCK:\n mInstructionView.setText(\"It's a tie!\");\n resultDict.addInt32(Keys.KEY_RESULT, Keys.RESULT_TIE);\n break;\n case Keys.CHOICE_PAPER:\n mInstructionView.setText(\"You lose!\");\n resultDict.addInt32(Keys.KEY_RESULT, Keys.RESULT_WIN); // Inform Pebble of opposite result\n break;\n case Keys.CHOICE_SCISSORS:\n mWinCounter++;\n mInstructionView.setText(\"You win! (\" + mWinCounter + \" of \" + mGameCounter + \")\");\n resultDict.addInt32(Keys.KEY_RESULT, Keys.RESULT_LOSE);\n break;\n }\n break;\n case Keys.CHOICE_PAPER:\n switch(mP2Choice) {\n case Keys.CHOICE_ROCK:\n mWinCounter++;\n mInstructionView.setText(\"You win! (\" + mWinCounter + \" of \" + mGameCounter + \")\");\n resultDict.addInt32(Keys.KEY_RESULT, Keys.RESULT_LOSE);\n break;\n case Keys.CHOICE_PAPER:\n mInstructionView.setText(\"It's a tie!\");\n resultDict.addInt32(Keys.KEY_RESULT, Keys.RESULT_TIE);\n break;\n case Keys.CHOICE_SCISSORS:\n mInstructionView.setText(\"You lose!\");\n resultDict.addInt32(Keys.KEY_RESULT, Keys.RESULT_WIN);\n break;\n }\n break;\n case Keys.CHOICE_SCISSORS:\n switch(mP2Choice) {\n case Keys.CHOICE_ROCK:\n mInstructionView.setText(\"You lose!\");\n resultDict.addInt32(Keys.KEY_RESULT, Keys.RESULT_WIN);\n break;\n case Keys.CHOICE_PAPER:\n mWinCounter++;\n mInstructionView.setText(\"You win! (\" + mWinCounter + \" of \" + mGameCounter + \")\");\n resultDict.addInt32(Keys.KEY_RESULT, Keys.RESULT_LOSE);\n break;\n case Keys.CHOICE_SCISSORS:\n mInstructionView.setText(\"It's a tie!\");\n resultDict.addInt32(Keys.KEY_RESULT, Keys.RESULT_TIE);\n break;\n }\n break;\n }\n\n // Inform Pebble of result\n PebbleKit.sendDataToPebble(getApplicationContext(), APP_UUID, resultDict);\n\n // Finally reset both\n mChoice = Keys.CHOICE_WAITING;\n mP2Choice = Keys.CHOICE_WAITING;\n\n // Leave announcement for 5 seconds\n mHandler.postDelayed(new Runnable() {\n\n @Override\n public void run() {\n updateUI();\n }\n\n }, 5000);\n }", "@Override\n public void noteNewTurn()\n {\n if ( traceStats && stateMachine.getInstanceId() == 1 )\n {\n ForwardDeadReckonLegalMoveInfo[] masterList = stateMachine.getFullPropNet().getMasterMoveList();\n for(int i = 0; i < bestResponseScores.length; i++)\n {\n float best = -Float.MAX_VALUE;\n float bestFollow = -Float.MAX_VALUE;\n int bestIndex = -1;\n int bestFollowIndex = -1;\n for(int j = 0; j < bestResponseScores.length; j++)\n {\n if ( responseSampleSize[i][j] > 0 )\n {\n float score = bestResponseScores[i][j]/responseSampleSize[i][j];\n if ( masterList[i].mRoleIndex != masterList[j].mRoleIndex)\n {\n if ( score > best )\n {\n best = score;\n bestIndex = j;\n }\n }\n else\n {\n if ( score > bestFollow )\n {\n bestFollow = score;\n bestFollowIndex = j;\n }\n }\n }\n }\n\n LOGGER.info(\"Best response to \" + masterList[i].mInputProposition + \": \" + (bestIndex == -1 ? \"NONE\" : masterList[bestIndex].mInputProposition + \" (\" + (100*best) + \"% [\" + responseSampleSize[i][bestIndex] + \"] )\"));\n LOGGER.info(\"Best follow-on to \" + masterList[i].mInputProposition + \": \" + (bestFollowIndex == -1 ? \"NONE\" : masterList[bestFollowIndex].mInputProposition + \" (\" + (100*bestFollow) + \"% [\" + responseSampleSize[i][bestFollowIndex] + \"] )\"));\n if ( bestIndex != -1 && opponentEquivalent[bestIndex] != bestFollowIndex )\n {\n int bestDeny = opponentEquivalent[bestIndex];\n LOGGER.info(\"Best denial to \" + masterList[i].mInputProposition + \": \" + (bestDeny == -1 ? \"NONE\" : masterList[bestDeny].mInputProposition + \" (\" + (100*(bestResponseScores[i][bestDeny]/responseSampleSize[i][bestDeny])) + \"% [\" + responseSampleSize[i][bestDeny] + \"] )\"));\n }\n }\n }\n\n // Reset the stats\n for(int i = 0; i < bestResponseScores.length; i++)\n {\n for(int j = 0; j < bestResponseScores.length; j++)\n {\n bestResponseScores[i][j] /= 2;\n responseSampleSize[i][j] /= 2;\n }\n }\n }", "public synchronized void announceWinner(Team team) {\n\n String[] gameStats = new String[players.length];\n for(int i = 0; i < players.length; i++){\n\n String s = players[i].getName() + \": \" + players[i].getCorrectAnswers();\n gameStats[i] = s;\n System.err.println(s);\n }\n\n for (PlayerHandler playerHandler : players) {\n\n if (playerHandler.getTeam() == team) {\n playerHandler.getOutputStream().println(\n GFXGenerator.drawYouWon(playerHandler.getTeam().getColor(), score, teams[0], teams[1]) +\n \"\\n\" + GFXGenerator.drawTable(gameStats, 4, \"GAME STATS (CORRECT ANSWERS)\"));\n\n continue;\n }\n\n playerHandler.getOutputStream().println(\n GFXGenerator.drawGameOver(playerHandler.getTeam().getColor(), score, teams[0], teams[1])+\n \"\\n\" + GFXGenerator.drawTable(gameStats, 4, \"GAME STATS (CORRECT ANSWERS)\"));\n }\n\n }", "public boolean amIWinning(){\n if (playerScore > oppoScore) {\n return true;\n } else {\n return false;\n }\n }", "public void testDetermineLeagueWinner() {\n\t\tassertTrue(\"Error determining correct winner\", false);\r\n\t\t//Check that player records have been updated correctly\r\n\t\tassertTrue(\"Error updating player records\", false);\r\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 }", "public boolean topPlayerWon() {\n return winner == 2;\n }", "public void checkWinner(){\n \n if ((board[0][0] == 'X' && board[0][1] == 'X' && board[0][2] == 'X')||(board[1][0] == 'X' && board[1][1] == 'X' && board[1][2] == 'X')||(board[2][0] == 'X' && board[2][1] == 'X' && board[2][2] == 'X')){\n winner();\n }\n else if ((board[0][0] == 'X' && board[1][0] == 'X' && board[2][0] == 'X')||(board[0][1] == 'X' && board[1][1] == 'X' && board[2][1] == 'X')||(board[0][2] == 'X' && board[1][2] == 'X' && board[2][2] == 'X')){\n winner();\n }\n else if ((board[0][0] == 'X' && board[1][1] == 'X' && board[2][2] == 'X')||(board[0][2] == 'X' && board[1][1] == 'X' && board[2][0] == 'X')){\n winner();\n }\n else if ((board[0][0] == 'O' && board[0][1] == 'O' && board[0][2] == 'O')||(board[1][0] == 'O' && board[1][1] == 'O' && board[1][2] == 'O')||(board[2][0] == 'O' && board[2][1] == 'O' && board[2][2] == 'O')){\n winner();\n }\n else if ((board[0][0] == 'O' && board[1][0] == 'O' && board[2][0] == 'O')||(board[0][1] == 'O' && board[1][1] == 'O' && board[2][1] == 'O')||(board[0][2] == 'O' && board[1][2] == 'O' && board[2][2] == 'O')){\n winner();\n }\n else if ((board[0][0] == 'O' && board[1][1] == 'O' && board[2][2] == 'O')||(board[0][2] == 'O' && board[1][1] == 'O' && board[2][0] == 'O')){\n winner();\n }\n \n }", "@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}", "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 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}", "public static void checkWinner() {\n for (int i = 0; i < 3; i++) {\r\n if (winner) {\r\n break;\r\n }\r\n for (int j = 0; j < 3; j++) {\r\n // Check each row\r\n if (output[i][0] == output[i][1] && output[i][0] == output[i][2]) {\r\n if (output[i][0] != ' ') {\r\n System.out.println(output[i][0] + \" wins!\");\r\n System.exit(0);\r\n winner = true;\r\n }\r\n break;\r\n }\r\n // Check each column\r\n else if (output[0][j] == output[1][j] && output[0][j] == output[2][j]) {\r\n if (output[0][j] != ' ') {\r\n System.out.println(output[0][j] + \" wins!\");\r\n System.exit(0);\r\n winner = true;\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n // Check Diagonals\r\n if (output[0][0] == output[1][1] && output[0][0] == output[2][2]) {\r\n if (output[0][0] != ' ') {\r\n System.out.println(output[0][0] + \" wins!\");\r\n System.exit(0);\r\n winner = true;\r\n }\r\n\r\n } else if (output[2][0] == output[1][1] && output[2][0] == output[0][2]) {\r\n if (output[2][0] != ' ') {\r\n System.out.println(output[2][0] + \" wins!\");\r\n System.exit(0);\r\n winner = true;\r\n }\r\n\r\n } else if (winner = false) {\r\n System.out.println(\"Draw\");\r\n System.exit(0);\r\n }\r\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 static char checkForWinner(char[][] a){\r\n //check AI 'o' first\r\n for (int b = 0; b<a.length; b++){\r\n for (int j = 0; j<a[b].length; j++){\r\n if (b == j && countDiag1(a,'o')==a.length){\r\n return 'o';\r\n }\r\n if (b+j== a.length-1 && countDiag2(a,'o')==a.length){\r\n return 'o';\r\n } \r\n if (countRow(a[b],'o')==a[b].length || countCol(a, b, 'o')==a.length){\r\n return 'o';\r\n } \r\n }\r\n }\r\n //then check user 'x'\r\n for (int p = 0; p<a.length; p++){\r\n for (int q = 0; q<a[p].length; q++){\r\n if (p == q && countDiag1(a,'x')==a.length){\r\n return 'x';\r\n }\r\n if (p+q== a.length-1 && countDiag2(a,'x')==a.length){\r\n return 'x';\r\n }\r\n if (countRow(a[p],'x')==a[p].length || countCol(a, p, 'x')==a.length){\r\n return 'x';\r\n } \r\n }\r\n } \r\n return ' ';\r\n }", "public int whoWin(){\r\n int winner = -1;\r\n \r\n int highest = 0;\r\n \r\n for(Player player : discWorld.getPlayer_HASH().values()){\r\n if(getPlayerPoints(player) > highest){\r\n highest = getPlayerPoints(player);\r\n winner = player.getID();\r\n }\r\n \r\n }\r\n \r\n return winner;\r\n }", "private void computeWinLose() {\n\n if (!id11.getText().isEmpty()) {\n if ((id11.getText().equals(id00.getText()) && id11.getText().equals(id22.getText())) ||\n (id11.getText().equals(id02.getText()) && id11.getText().equals(id20.getText())) ||\n (id11.getText().equals(id10.getText()) && id11.getText().equals(id12.getText())) ||\n (id11.getText().equals(id01.getText()) && id11.getText().equals(id21.getText()))) {\n winner = id11.getText();\n }\n }\n\n if (!id00.getText().isEmpty()) {\n if ((id00.getText().equals(id01.getText()) && id00.getText().equals(id02.getText())) ||\n id00.getText().equals(id10.getText()) && id00.getText().equals(id20.getText())) {\n winner = id00.getText();\n }\n }\n\n if (!id22.getText().isEmpty()) {\n if ((id22.getText().equals(id21.getText()) && id22.getText().equals(id20.getText())) ||\n id22.getText().equals(id12.getText()) && id22.getText().equals(id02.getText())) {\n winner = id22.getText();\n }\n }\n\n // If all the grid entries are filled, it is a draw\n if (!id00.getText().isEmpty() && !id01.getText().isEmpty() && !id02.getText().isEmpty() && !id10.getText().isEmpty() && !id11.getText().isEmpty() && !id12.getText().isEmpty() && !id20.getText().isEmpty() && !id21.getText().isEmpty() && !id22.getText().isEmpty()) {\n winner = \"Draw\";\n }\n\n if (winner != null) {\n if (\"X\".equals(winner)) {\n winner = playerX;\n } else if (\"O\".equals(winner)) {\n winner = playerO;\n } else {\n winner = \"Draw\";\n }\n showWindow(winner);\n }\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 }", "@Override\n\tpublic void win() {\n\t\t\n\t\tfround[fighter1]++;\n\t fplatz[fighter1]=Math.round((float)fplatz[fighter1]/2); \n\t \n\t\tnextRound();\n\t}", "public void playRoundOne() {\r\n\t\t\r\n\t\twhile (!theModel.isGameOver()) {\r\n\t\t\tif (theModel.chooseFirstActivePlayer() == true) {\r\n\t\t\t\t// theModel.selectCategory();\r\n\t\t\t\t// so at this point we have returned strings?\r\n\t\t\t\twinningPlayer = theModel.compareCards(theModel.getSelectedCategory(theModel.selectCategory()));\r\n\t\t\t\tcheckIfWinOrDraw();\r\n\r\n\t\t\t\tSystem.out.println(\"this should be the human\");\r\n\r\n\t\t\t\tplayRound();\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\twinningPlayer = theModel.compareCards(theModel.getSelectedCategory(theModel.autoCategory()));\r\n\t\t\t\tcheckIfWinOrDraw();\r\n\r\n\t\t\t\t// theModel.displayTopCard();\r\n\t\t\t\tSystem.out.println(\"this should be the ai\");\r\n\t\t\t\tplayRound();\r\n\t\t\t\t// return true;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif (theModel.isGameOver()) {\r\n\t\t\tsql.setGameDataToSQL(GameID, RoundID, winningPlayer.getName(), DrawNum, theModel.humanIsActivePlayer);\r\n\t\t}\r\n\t}", "public static String checkWinner(){\n //list winning conditions\n List topRow = Arrays.asList(1,2,3);\n List middleRow = Arrays.asList(4,5,6);\n List bottomRow = Arrays.asList(7,8,9);\n List leftCol = Arrays.asList(1,4,7);\n List middleCol = Arrays.asList(2,5,8);\n List rightCol = Arrays.asList(3,6,9);\n List crossLR = Arrays.asList(1,5,9);\n List crossRL = Arrays.asList(3,5,7);\n //????Why\n List<List> winningCon = new ArrayList<List>(){\n {\n add(topRow);\n add(middleRow);\n add(bottomRow);\n add(leftCol);\n add(middleCol);\n add(rightCol);\n add(crossLR);\n add(crossRL); \n }\n };\n for(List l: winningCon){\n if(Player0Pos.containsAll(l)){\n player0win++;\n return \"✧*。٩(ˊωˋ*)و✧* The winner of this round goes to Player 0, congrats! \";\n }else if(Player1Pos.containsAll(l)){\n player1win++;\n return \"✧*。٩(ˊωˋ*)و✧* The winner of this round goes to Player 1, congrats!\";\n }else if(Player0Pos.size() +Player1Pos.size()==9){\n return \"Game end, no one wins.\";\n }\n }\n return \"\"; \n }", "public char printWinner ()\n {\n\tif (a == b && a == c && a != ' ')\n\t return a;\n\telse if (d == e && d == f && d != ' ')\n\t return d;\n\telse if (g == h && g == i && g != ' ')\n\t return g;\n\telse if (a == d && a == g && a != ' ')\n\t return a;\n\telse if (b == e && b == h && b != ' ')\n\t return b;\n\telse if (c == f && c == i && c != ' ')\n\t return c;\n\telse if (a == e && a == i && a != ' ')\n\t return a;\n\telse if (g == e && g == c && g != ' ')\n\t return g;\n\telse\n\t return t;\n\n\n }", "public String getWinner(){\n\t\tswitch (hatGewonnen) {\n\t\tcase \"Spieler O\":\n\t\t\treturn \"o\";\n\t\tcase \"Spieler X\":\n\t\t\treturn \"x\";\n\t\tdefault:\n\t\t\treturn \"\";\n\t\t}\n\t}", "public int getWinner();", "void printWinner() {\n }", "private int win_determination()\n {\n int flag=0;\n String box1 = jButton1.getText();\n String box2 = jButton2.getText();\n String box3 = jButton3.getText();\n String box4 = jButton4.getText();\n String box5 = jButton5.getText();\n String box6 = jButton6.getText();\n String box7 = jButton7.getText();\n String box8 = jButton8.getText();\n String box9 = jButton9.getText();\n \n \n if(box1==box2 && box1==box3) //check for equality then sign and then declare winner\n {\n if(box1.equalsIgnoreCase(\"X\"))\n {\n Xwins();\n }\n if(box1.equalsIgnoreCase(\"O\"))\n {\n OWins();\n flag=1;\n }\n }\n \n if(box4==box5 && box4==box6) //check for equality then sign and then declare winner\n {\n if(box4.equalsIgnoreCase(\"X\"))\n {\n Xwins();\n }\n if(box4.equalsIgnoreCase(\"O\"))\n {\n OWins();\n flag=1;\n }\n }\n if(box7==box8 && box7==box9) //check for equality then sign and then declare winner\n {\n if(box7.equalsIgnoreCase(\"X\"))\n {\n Xwins();\n }\n if(box7.equalsIgnoreCase(\"O\"))\n {\n OWins();\n flag=1;\n }\n }\n \n if(box1==box4 && box1==box7) //check for equality then sign and then declare winner\n {\n if(box1.equalsIgnoreCase(\"X\"))\n {\n Xwins();\n }\n if(box1.equalsIgnoreCase(\"O\"))\n {\n OWins();\n flag=1;\n }\n }\n if(box2==box5 && box2==box8) //check for equality then sign and then declare winner\n {\n if(box2.equalsIgnoreCase(\"X\"))\n {\n Xwins();\n }\n if(box2.equalsIgnoreCase(\"O\"))\n {\n OWins();\n flag=1;\n }\n }\n if(box3==box6 && box3==box9) //check for equality then sign and then declare winner\n {\n if(box3.equalsIgnoreCase(\"X\"))\n {\n Xwins();\n }\n if(box3.equalsIgnoreCase(\"O\"))\n {\n OWins();\n flag=1;\n }\n }\n if(box1==box5 && box1==box9) //check for equality then sign and then declare winner\n {\n if(box1.equalsIgnoreCase(\"X\"))\n {\n Xwins();\n }\n if(box1.equalsIgnoreCase(\"O\"))\n {\n OWins();\n flag=1;\n }\n }\n if(box3==box5 && box3==box7) //check for equality then sign and then declare winner\n {\n if(box3.equalsIgnoreCase(\"X\"))\n {\n Xwins();\n }\n if(box3.equalsIgnoreCase(\"O\"))\n {\n OWins();\n flag=1;\n }\n }\n return flag;\n }", "@Override\n public boolean isWin() {\n for (Observer winner : winners) {\n if (winner.getName().equals(chosenHorse.getName())) {\n return true;\n }\n }\n return false;\n }", "void playMatch() {\n while (!gameInformation.checkIfSomeoneWonGame() && gameInformation.roundsPlayed() < 3) {\n gameInformation.setMovesToZeroAfterSmallMatch();\n playSmallMatch();\n }\n String winner = gameInformation.getWinner();\n if(winner.equals(\"DRAW!\")){\n System.out.println(messageProvider.provideMessage(\"draw\"));\n }else {\n System.out.println(messageProvider.provideMessage(\"winner\")+\" \"+winner+\"!\");\n }\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 }", "private void reportWinner (Player player) {\n System.out.println();\n System.out.println(\"Player \" + player.name() +\n \" wins.\");\n System.out.println();\n }", "void matchEnd(boolean winner);", "boolean isWinner(GameState state, String username) throws GameStateException;", "public void winner(){\n System.out.println();\n System.out.println(\"You are the winner.!!!CONGRATULATIONS!!!.\");\n System.exit(1); // Close the game\n }", "@Test\r\n\tpublic void testDetermineMatchWinner1() {\n\t\tassertTrue(\"Error determining correct winner\", false);\r\n\t\t//Check that player records have been updated correctly\r\n\t\tassertTrue(\"Error updating player records\", false);\r\n\t}", "private void checkForWin()\n\t\t\t{\n\t\t\t\tfor (j = 0; j < 8; ++j)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (win[j] == 3)\n\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tbugflag = true;\n\t\t\t\t\t\t\t\tresult = j;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tIntent it1 = new Intent(Main.this, Result.class);\n\t\t\t\t\t\t\t\tBundle b = new Bundle();\n\t\t\t\t\t\t\t\tb.putString(\"result\",\n\t\t\t\t\t\t\t\t\t\t\"You were lucky this time \" + name\n\t\t\t\t\t\t\t\t\t\t\t\t+ \". You won!\");\n\t\t\t\t\t\t\t\tit1.putExtras(b);\n\t\t\t\t\t\t\t\tfinish();\n\t\t\t\t\t\t\t\tstartActivity(it1);\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t}", "public static void win()\n\t{\n\t\tGame.setMoney(Game.getMoney()+bet);\n\t\tremainingMoneyN.setText(String.valueOf(Game.getMoney()));\n\t\tbet=0;\n\t\ttfBet.setText(\"0\");\n\t\tif(Game.getMoney()>Game.getHighScore())\n\t\t{\n\t\t\tGame.setHighScore(Game.getMoney());\n\t\t\tlblHighScore.setText(String.valueOf(Game.getHighScore()));\n\t\t}\n\t\tlblUpdate.setText(\"You win!\");\n\n\t}", "public void logGameWinner(Player p){\n\t\t\n\t\tif(p instanceof HumanPlayer) {\n\t\t\tlog += String.format(\"%nUSER WINS GAME\");\n\t\t\twinName =\"Human\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\tAIPlayer ai = (AIPlayer) p;\n\t\t\tlog += String.format(\"%n%s WINS GAME\", ai.getName().toUpperCase());\n\t\t\twinName = ai.getName();\n\t\t}\n\t\tlineBreak();\n\t}", "public static int determineWinner(char char1, int num2){\n int winner = -1;\n \n switch(char1){\n case('r'):\n switch(num2){\n case(0):\n winner = 0;\n JOptionPane.showMessageDialog(null, \"The computer chose rock! \\nIt's a tie!\");\n break;\n case(1):\n winner = 2;\n JOptionPane.showMessageDialog(null, \"The computer chose paper! \\nThe computer wins!\");\n break;\n case(2):\n winner = 1;\n JOptionPane.showMessageDialog(null, \"The computer chose scissors! \\nThe player wins!\");\n break;\n case(3):\n winner = 1;\n JOptionPane.showMessageDialog(null, \"The computer chose lizard! \\nThe player wins!\");\n break;\n case(4):\n winner = 2;\n JOptionPane.showMessageDialog(null,\"The computer chose Spock! \\nThe computer wins!\");\n break; \n }\n }\n // 0 = rock, 1 = paper, 2 = scissors, 3 = lizard, 4 = Spock\n switch(char1){\n case('p'):\n switch(num2){\n case(0):\n winner = 1;\n JOptionPane.showMessageDialog(null, \"The computer chose rock! \\nThe player wins!\");\n break;\n case(1):\n winner = 0;\n JOptionPane.showMessageDialog(null, \"The computer chose paper! \\nIt's a tie!\");\n break;\n case(2):\n winner = 2;\n JOptionPane.showMessageDialog(null, \"The computer chose scissors! \\nThe computer wins!\");\n break;\n case(3):\n winner = 2;\n JOptionPane.showMessageDialog(null, \"The computer chose lizard! \\nThe computer wins!\");\n break;\n case(4):\n winner = 1;\n JOptionPane.showMessageDialog(null,\"The computer chose Spock! \\nThe player wins\");\n break;\n }\n }\n // 0 = rock, 1 = paper, 2 = scissors, 3 = lizard, 4 = Spock\n switch(char1){\n case('s'):\n switch(num2){\n case(0):\n winner = 2;\n JOptionPane.showMessageDialog(null, \"he computer chose rock! \\nThe computer wins!\");\n break;\n case(1):\n winner = 1;\n JOptionPane.showMessageDialog(null, \"The computer chose paper! \\nThe player wins!\");\n break;\n case(2):\n winner = 0;\n JOptionPane.showMessageDialog(null, \"The computer chose scissors! \\nIt's a tie!\");\n break;\n case(3):\n winner = 1;\n JOptionPane.showMessageDialog(null, \"The computer chose lizard! \\nThe player wins!\");\n break;\n case(4):\n winner = 2;\n JOptionPane.showMessageDialog(null,\"The computer Spock! \\nThe computer wins!\");\n break;\n }\n }\n // 0 = rock, 1 = paper, 2 = scissors, 3 = lizard, 4 = Spock\n switch(char1){\n case('l'):\n switch(num2){\n case(0):\n winner = 2;\n JOptionPane.showMessageDialog(null, \"The computer chose rock! \\nThe computer wins!\");\n break;\n case(1):\n winner = 1;\n JOptionPane.showMessageDialog(null, \"The computer chose paper! \\nThe player wins!\");\n break;\n case(2):\n winner = 2;\n JOptionPane.showMessageDialog(null, \"The computer chose scissors! \\nThe computer wins!\");\n break;\n case(3):\n winner = 0;\n JOptionPane.showMessageDialog(null, \"The computer chose lizard! \\nIt's a tie!\");\n break;\n case(4):\n winner = 1;\n JOptionPane.showMessageDialog(null,\"The computer chose Spock! \\nThe player wins\");\n break;\n }\n }\n // 0 = rock, 1 = paper, 2 = scissors, 3 = lizard, 4 = Spock\n switch(char1){\n case('x'):\n switch(num2){\n case(0):\n winner = 1;\n JOptionPane.showMessageDialog(null, \"The computer chose rock! \\nThe player wins!\");\n break;\n case(1):\n winner = 2;\n JOptionPane.showMessageDialog(null, \"The computer chose paper! \\nThe computer wins!\");\n break;\n case(2):\n winner = 1;\n JOptionPane.showMessageDialog(null, \"The computer chose scissors! \\nThe player wins!\");\n break;\n case(3):\n winner = 2;\n JOptionPane.showMessageDialog(null, \"The computer chose lizard! \\nThe computer wins!\");\n break;\n case(4):\n winner = 1;\n JOptionPane.showMessageDialog(null,\"The computer chose Spock!\\nIt's a tie!\");\n break;\n }\n }\n return winner;\n }", "void update(boolean winner);", "public String whoWon()\n { \n String win=\"\";\n if (player1Hand.isEmpty())\n {\n win=(\"player 2 wins!\");\n }\n \n if(player2Hand.isEmpty())\n {\n win=(\"player 1 wins\");\n } \n \n return win;\n }", "public void announceWinner(){\n gameState = GameState.HASWINNER;\n notifyObservers();\n }", "public String getWinner()\n\t{\n\n\n\n\n\n\n\n\n\n\n\n\n\t\treturn \"\";\n\t}", "public Player getWinner();", "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 }", "void win(Player player);", "private int checkWinner() {\n if (this.turnCount >= 2) {\n int colWin = this.checkColumn();\n if (colWin > 0) {\n return colWin;\n }\n\n int rowWin = this.checkRow();\n if (rowWin > 0) {\n return rowWin;\n }\n\n int diagWin = checkDiagonal();\n if (diagWin > 0) {\n return diagWin;\n }\n }\n return 0;\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}", "private String getWinner() {\n\t\treturn winner;\n\t}" ]
[ "0.7473112", "0.7211351", "0.70625156", "0.6983686", "0.6948988", "0.693532", "0.692072", "0.68828005", "0.68686295", "0.6865958", "0.6858123", "0.68339866", "0.68231773", "0.68225276", "0.6816511", "0.68103933", "0.6807445", "0.6805201", "0.6803354", "0.6803209", "0.6748097", "0.6735078", "0.67299974", "0.6727846", "0.6727643", "0.6695599", "0.66849977", "0.66715634", "0.6666643", "0.66579276", "0.6653842", "0.6640648", "0.6628144", "0.6626146", "0.6605447", "0.6593604", "0.6578866", "0.6572356", "0.657016", "0.6567467", "0.6565733", "0.65652096", "0.65608275", "0.6554093", "0.65484387", "0.654112", "0.6516486", "0.6503669", "0.6491176", "0.64804137", "0.64751744", "0.6467837", "0.6457052", "0.6444031", "0.64382935", "0.64286715", "0.64244014", "0.64180523", "0.6405526", "0.6401992", "0.6398813", "0.63897365", "0.6388305", "0.63881934", "0.63801336", "0.6367839", "0.6338967", "0.63379115", "0.63268644", "0.63232267", "0.63116235", "0.63019085", "0.6297956", "0.6296597", "0.62961894", "0.62893057", "0.62770677", "0.627558", "0.6273299", "0.62731296", "0.62582505", "0.6250197", "0.6247795", "0.6241168", "0.6238371", "0.62381965", "0.6236707", "0.62249285", "0.62226945", "0.6214174", "0.62057877", "0.6201661", "0.61988616", "0.61962587", "0.61865133", "0.6175826", "0.617541", "0.6166391", "0.61649585", "0.61455566", "0.6145249" ]
0.0
-1
Shutdown the AI allowing it to save its learned experience
@Override public synchronized void end() { System.out.println("Wins: " + wins + " Ties: " + ties + " Losses: " + losses + " Name: " + brainLocation + " Heat:" + heat); saveMemory(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void shutdown() {\n mGameHandler.shutdown();\n mTerminalNetwork.terminate();\n }", "public void stopTrainingMode() {\n\t\t\r\n\t}", "public void shutDown() {\n isStarted = false;\n logger.info(\"[GAME] shut down\");\n }", "private void shutdown(){\n\t\ttry{\n\t\t\tMainController gainCtr=loader.getController();\n\t\t\tgainCtr.isOnline=false;\n\t\t\tif(!gainCtr.sc.equals(null)) {\n\t\t\t\tgainCtr.sc.close();\n\t\t\t}\n\t\t\t}catch (Exception e) {\n\t\t\t\t\t\n\t\t\t\t}\n\t}", "private void exitGame() {\n System.exit(0);\n }", "protected void takeDown() {\n\t\tSystem.out.println(\"TIAgent \" + getAID().getName() + \" terminating.\");\r\n\t}", "public void exitRoutine() {\n\t\tboardController.saveSampleData();\n\t}", "@Override\n public void stop() {\n leftFrontDrive.setPower(0.0);\n rightFrontDrive.setPower(0.0);\n leftRearDrive.setPower(0.0);\n rightRearDrive.setPower(0.0);\n\n // Disable Tracking when we are done;\n targetsUltimateGoal.deactivate();\n\n //closes object detection to save system resouces\n if (tfod != null) {\n tfod.shutdown();\n }\n }", "protected void end() {\n Robot.wedge.stop();\r\n Robot.driveTrain.stop();\r\n Robot.ballIntake.stop();\r\n }", "public void exit() {\n\tif (hasPlayed) {\n\t hasPlayed = false;\n\t lastExit = System.currentTimeMillis(); // note the time of exit\n\t}\n }", "private static void exit(){\n\t\t\n\t\tMain.run=false;\n\t\t\n\t}", "public void exitProgram() {\n\t\tgoOffline();\n\t\tmainWindow.dispose();\n\t\tif (config_ok)\n\t\t\tsaveConnectionConfiguration();\n\t\tSystem.exit(0);\n\t\t\n\t}", "protected void end() {\n\t\tRobot.conveyor.Stop();\n\t}", "@Override\n public void exit() {\n player.steeringBehaviorsManager.removeBehavior(ballPursuit);\n }", "public void quitGame() {\n\t\tactive = false;\n\t}", "public void stop() {\r\n\t\t// Tell the Gui Agent to shutdown the system\r\n\t\tGui.shutdown = true;\r\n\t}", "public void shutdown() {\r\n System.exit(0);\r\n }", "protected void end() {\n \tRobot.conveyor.stop();\n }", "static void playerLost() {\n\n\t\tSystem.exit(0); // This code ends the program\n\t}", "protected void takeDown() {\n\t\t// Deregister from the yellow pages\n\t\ttry {\n\t\t\tDFService.deregister(this);\n\t\t}\n\t\tcatch (FIPAException fe) {\n\t\t\tfe.printStackTrace();\n\t\t}\n\t\t// Close the GUI\n\t\tmyGui.dispose();\n\t\t// Printout a dismissal message\n\t\tSystem.out.println(\"agent \"+getAID().getName()+\" terminating.\");\n\t}", "private void endGame() {\r\n\t\t// Change state (if not already done)\r\n\t\tstate = GameState.STOPPED;\r\n\t\t\r\n\t\t// End simulator\r\n\t\tsimulator.endGame();\r\n\t}", "protected void end() {\n drivebase.setArcade(0, 0);\n drivebase.disableTurnController();\n }", "public void shutdown() {\n\t\tInput.cleanUp();\n\t\tVAO.cleanUp();\n\t\tTexture2D.cleanUp();\n\t\tResourceLoader.cleanUp();\n\t}", "private void exitCombatPlayerDefeat(){\n\t\tCheckpoint.load();\r\n\t\t//GlobalGameState.setActiveGameState(GameStates.DEFEAT);\r\n\t\tGSTransition.getInstace().prepareTransition( GameStates.DEFEAT );\r\n\t\tGlobalGameState.setActiveGameState(GameStates.TRANSITION);\r\n\t}", "public void shutdown() {\n this.shallRun = false;\n this.interrupt();\n Log.getLog().info(\"catched caretaker termination signal\");\n }", "public void finishGameSession() {\n\t\tthis.agentNeural.storeWeights();\n\t}", "private void exit() {\n this.isRunning = false;\n }", "public void stop(boolean save) {}", "protected void end() {\n \tRobot.driveTrain.stop();\n }", "protected void end() {\n \tRobot.driveTrain.stop();\n }", "void exitSession()\n\t{\n\t\t// clear out our watchpoint list and displays\n\t\t// keep breakpoints around so that we can try to reapply them if we reconnect\n\t\tm_displays.clear();\n\t\tm_watchpoints.clear();\n\n\t\tif (m_fileInfo != null)\n\t\t\tm_fileInfo.unbind();\n\n\t\tif (m_session != null)\n\t\t\tm_session.terminate();\n\n\t\tm_session = null;\n\t\tm_fileInfo = null;\n\t}", "public void quit() {\r\n\t\tSystem.out.println(\"Quitting Game\");\r\n\t\tMain.setModel(new Model());\r\n\t\tMain.changeScene(Main.getMainMenu());\r\n\t}", "public void exit () {\r\n System.out.println(\"Desligando aplicação...\");\r\n this.stub.killStub();\r\n }", "public void ShutDown()\n {\n bRunning = false;\n \n LaunchLog.Log(COMMS, LOG_NAME, \"Shut down instruction received...\");\n\n for(LaunchServerSession session : Sessions.values())\n {\n LaunchLog.Log(COMMS, LOG_NAME, \"Closing session...\");\n session.Close();\n }\n \n LaunchLog.Log(COMMS, LOG_NAME, \"...All sessions are closed.\");\n }", "protected void takeDown() {\n // Deregister from the yellow pages\n try {\n DFService.deregister(this);\n } catch (FIPAException fe) {\n fe.printStackTrace();\n }\n\n // Printout a dismissal message\n System.out.println(\"Dataset-agent \" + getAID().getName() + \" terminating.\");\n }", "protected void end() {\n \tRobot.driveTrain.setPower(0, 0);\n }", "public void shutdown()\n {\n this.running = false;\n }", "public void shutdown(){\n \tSystem.out.println(\"SHUTTING DOWN..\");\n \tSystem.exit(0);\n }", "public void exitProgram() {\n System.out.println(\"Closing Ranking....\");\n ScannerInputs.closeScanner();\n System.exit(0);\n }", "public void shutdown() {\n this.isShutdown = true;\n }", "private void finishReset() {\n DefenceField.fieldActivated = true;\n time.setPaused(false);\n nuiManager.closeScreen(DefenceUris.DEATH_SCREEN);\n }", "public void shutdownNetwork() {\r\n networkPlayer.stop();\r\n }", "protected void end() {\n \tRobot.vision_.stopGearLiftTracker();\n }", "public void quit(){\n\t\tSystem.out.println(\"Quitting game\");\n\t\tSystem.exit(0);\n\t}", "public static void shutdown ()\n\t{\n\t\tif (m_interpreter != null)\n\t\t{\n\t\t\tm_console.dispose ();\n\t\t\tm_interpreter.cleanup ();\n\t\t}\n\t}", "public void endGame() {\n\r\n\t\tplaying = false;\r\n\t\tstopShip();\r\n\t\tstopUfo();\r\n\t\tstopMissle();\r\n\t}", "public static void endGameSequence()\n\t{\n\t\ttfBet.setEnabled(false);\n\t\tbtnPlay.setEnabled(false);\n\t\tbtnHit.setEnabled(false);\n\t\tbtnStay.setEnabled(false);\n\t\tbtnDouble.setEnabled(false);\n\t\tlblUpdate.setText(\"Game over! You are out of money!\");\n\t}", "public void shutdown() {\n shutdown(false);\n }", "void stopGame() {\n leader.disconnect();\n opponent.disconnect();\n }", "public void endGame(){\n updateHighscore();\n reset();\n }", "public static void end() {\n\t\tif(firstTime)\r\n\t\t\tfirstTime=false;\r\n\t\tif (over) {\r\n\t\t\treset();\r\n\t\t\tover = false;\r\n\t\t}\r\n\t\tGUI.panel.changeGame();\r\n\t}", "public void shutDown();", "void stop() {\n\t\texitTesting = true;\n\t}", "public void shutdown()\n {\n // todo\n }", "private void exitConfiguration() {\n checkSave();\n System.exit(0);\n }", "void shutDown();", "public void exitGame() {\n System.out.println(\"Thank you and good bye!\");\n System.exit(0);\n }", "private void exit() {\n audrey.setExtractingSample(false);\n // If we just extracted argument samples, let the following event know that we're done with\n // arguments.\n instrumentationContext.setLookingForFirstStatement(false);\n }", "public void stopExperiment() {\n control.stopExperiment();\n }", "protected void end() {\n // Robot.drive.setMoveVisionAssist(0);\n // Robot.drive.setTurnVisionAssist(0);\n Robot.limelight.setPipeline(1.0); \n }", "@Override\n public void exit() {\n model.exit();\n }", "private void end() {\r\n isRunning = false;\r\n if( mineField.exploder.isRunning() ) mineField.exploder.stop();\r\n if( settingsOpen ) settingsFrame.dispose();\r\n }", "public void endGameFrame() {\r\n\t\tcreateWarning(3000, \"Time Out!\"); //show warning message\r\n\t\t\r\n\t\ttry {\t\t\t\t\t\t\t //creates a file when the game is over\r\n\t\t\tString ExitFilename = \"EXIT.txt\";\r\n\t\t\tFileWriter ExitFile = new FileWriter(\"src/Signals./\"+ExitFilename);\r\n\t\t\tExitFile.write(\"EXIT\");\r\n\t\t\tExitFile.close();\r\n\t\t} \r\n\t\t catch (IOException e) {\r\n\t\t System.out.println(\"An error occurred.\");\r\n\t\t e.printStackTrace();\r\n\t\t }\r\n\t\t//close all interface\r\n\t\tframe.setVisible(false);\r\n\t\tframe.dispose();\r\n\t\tSystem.exit(0);\r\n\t\t\r\n\t\t\r\n\t}", "private void exitApp()\n {\n if(spider.isCrawling())\n {\n stopCrawler();\n showTransition(1000);\n Timer task = new Timer(1000, (ActionEvent e)->\n {\n System.exit(0);\n });\n\n task.setRepeats(false);\n task.start();\n }\n \n else System.exit(0);\n }", "public void endGame() {\n dispose();\n System.out.println(\"Thank you for playing\");\n System.exit(0);\n }", "public synchronized void shutDown() {\n\t state.shutDown();\n\t}", "public void stopEngine(){\r\n isEngineRunning = false;\r\n System.out.println(\"[i] Engine is no longer running.\");\r\n }", "private void shutdown() {\n\t\ttry {\n\t\t\tsock.close();\n\t\t\tgame.handleExit(this);\n\t\t\tstopped = true;\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t} \n\t}", "public void endGame()\r\n {\r\n mode = 2;\r\n }", "public void endTurn() {\n controller.endTurn();\n }", "public void shutdown(boolean endGame) {\n\t\tif (!endGame) trayicon.shutdown();\n\t\t\n\t\tsaveTabs();\n\t\t\n\t\tstatus.shutdown();\n\t\t\n\t\t//do this last:\n\t\tif (!endGame) {\n\t\t\tdispose();\n\t\t}\n\t}", "public void stop() {\n\tanimator = null;\n\toffImage = null;\n\toffGraphics = null;\n }", "private void shutDown() {\r\n\t\t\r\n\t\t// send shutdown to children\r\n\t\tlogger.debug(\"BagCheck \"+ this.lineNumber+\" has sent an EndOfDay message to it's Security.\");\r\n\t\tthis.securityActor.tell(new EndOfDay(1));\r\n\r\n\t\t// clear all references\r\n\t\tthis.securityActor = null;\r\n\t}", "public void finishGame(){\r\n\t\t\t\tgameStarted = false;\r\n\t\t\t}", "private void programShutdown(){\n\n am.finishAllActivity();\n activity .moveTaskToBack(true);\n activity .finish();\n android.os.Process.killProcess(android.os.Process.myPid());\n System.exit(0);\n\n\n }", "protected void end() {\n Robot.shooter.Stop();\n }", "protected void end() {\n \tRobotMap.DRIVETRAIN_SUBSYSTEM.setYTranslation(0.0);\n \tRobotMap.DRIVETRAIN_SUBSYSTEM.stop();\n }", "public void kill() {\r\n\t\t\tfor(Guerre war : aggresiveWar) {\r\n\t\t\t\twar.finalize();\r\n\t\t\t}\r\n\t\t\tfor(Guerre war : defensiveWar) {\r\n\t\t\t\twar.finalize();\r\n\t\t\t}\r\n\t\t\tfor(Case c : caseOwned) {\r\n\t\t\t\tc.liberate();\r\n\t\t\t}\r\n\r\n\t\t\tSystem.out.println(nom + \" n'a pas su s'adapter aux nombreux dangers environnants, l'Histoire oublie les faibles.\");\r\n\t\t\t\r\n\t\t\tfor(String str : saveStats()) System.out.println(str);\r\n\t\t\t//finalisation de la mort\r\n\t\t\tthis.die();\r\n\t\t\tSystem.out.println(\"Une civilisation c'est éteinte...\");\r\n\t\t\t//finalize(); //bloque la sauvegarde et case les relations avec les autres (du à la recherche de la civ par id dans l'arraylist\r\n\t\t}", "public void end() {\n\t\tdrivetrain.stopDrive();\n\t}", "@Override\n\tpublic void endGame() {\n\t\tsuper.endGame();\n\t}", "public void stop() {\n intake(0.0);\n }", "public void shutdown() {\n // For now, do nothing\n }", "public void shutdown() {\n this.dontStop = false;\n }", "protected void end() {\n\t\tcrossLine.cancel();\n\t\tapproachSwitch.cancel();\n\t\tdriveToSwitch.cancel();\n\t\tdriveToScale.cancel();\n\t\tapproachScale.cancel();\n\t\tturnTowardsSwitchOrScale.cancel();\n\t\t\n\t\tdrivetrain.stop();\n\t}", "public void quitNetworkGame() {\n \t\tgameInProgress = false;\n \t\tlocalGameController.stop();\n \t\tlobbyManager.quit();\n \t\tlobby.updateGameListPane();\n \t\tgameMain.showScreen(lobby);\n \t\tgameMain.setSize(800, 600);\n \t}", "public void shutdownNoiseMaker() {\n\t\tcnt.interrupt();\n\t\tsingleNoise.release();\n\t}", "public static void shutdown() {\n\t}", "protected void finalAction(){\n Robot.stop();\n requestOpModeStop();\n }", "private void quit() {\n\t\tmSipSdk = myApplication.getPortSIPSDK();\n\n\t\tif (myApplication.isOnline()) {\n\t\t\tLine[] mLines = myApplication.getLines();\n\t\t\tfor (int i = Line.LINE_BASE; i < Line.MAX_LINES; ++i) {\n\t\t\t\tif (mLines[i].getRecvCallState()) {\n\t\t\t\t\tmSipSdk.rejectCall(mLines[i].getSessionId(), 486);\n\t\t\t\t} else if (mLines[i].getSessionState()) {\n\t\t\t\t\tmSipSdk.hangUp(mLines[i].getSessionId());\n\t\t\t\t}\n\t\t\t\tmLines[i].reset();\n\t\t\t}\n\t\t\tmyApplication.setOnlineState(false);\n\t\t\tmSipSdk.unRegisterServer();\n\t\t\tmSipSdk.DeleteCallManager();\n\t\t}\n\t}", "public void endGame()\n\t{\n\t\tthis.opponent = null;\n\t\tthis.haveGame = false;\n\t\tthis.isTurn = false;\n\t\tfor(int i = 0; i < 3; i++)\n\t\t{\n\t\t\tfor(int j = 0; j < 3; j++)\n\t\t\t{\n\t\t\t\tboard[i][j] = 0;\n\t\t\t}\n\t\t}\n\t}", "public void exit() {\n loader.getApplet().stop();\n loader.getApplet().destroy();\n }", "private void quitGame() {\n this.primaryStage.close();\n }", "@Override\n protected void end() {\n Robot.driveTrain.stop();\n }", "private void resetAfterGame() {\n }", "public void endGame()\n\t{\n\t\tbuttonPanel.endGameButton.setEnabled(false);\n\t\tstopThreads();\n\t\tsendScore();\n\t}", "public synchronized void stop() {\n\t\tif (!running)\n\t\t\treturn;\n\t\ttry {\n\t\t\toptions.save();\n\t\t\twindow.dispose();\n\t\t\trunning = false;\n\t\t\tthread.join();\n\t\t} catch (InterruptedException e) {\n\t\t\te.printStackTrace();\n\t\t} \n\t\tSystem.exit(1);\n\t}", "public void shutdown() {\n\t\t\n\t}", "public void stop() throws CoreHunterException;", "private void safeStop() {\n getRobotDrive().stop();\n //pneumatics.stop();\n }", "public static void shutdown() {\n\t\t// Ignore\n\t}", "public static void shutDown(){\n for(int i = PS3_LIST_.size()-1; i >= 0; i--){\n PS3 instance = PS3_LIST_.get(i);\n instance.setLed(false);\n instance.destroy();\n }\n PS3Logger.log(PS3Logger.TYPE.DEBUG, null, \"PS3 SHUTDOWN\");\n }" ]
[ "0.70055", "0.6884663", "0.6868683", "0.67499155", "0.67471373", "0.66654956", "0.66647846", "0.6656888", "0.6618424", "0.6614583", "0.6610583", "0.65857047", "0.6558745", "0.6553822", "0.65507025", "0.65422857", "0.6534022", "0.6524655", "0.6465975", "0.6446135", "0.64423335", "0.6422524", "0.64172316", "0.6416706", "0.64045274", "0.6389943", "0.63833445", "0.638003", "0.6342381", "0.6342381", "0.6337197", "0.63341177", "0.6330979", "0.6329422", "0.6327229", "0.6318879", "0.62860584", "0.62840176", "0.62767655", "0.6270083", "0.6268759", "0.62676543", "0.62668425", "0.62642807", "0.6260629", "0.6255756", "0.62536997", "0.6246764", "0.624483", "0.62403613", "0.62360024", "0.621319", "0.62099653", "0.6207839", "0.6202561", "0.6198496", "0.61971086", "0.6195015", "0.6194648", "0.61940634", "0.6190567", "0.6188795", "0.61852443", "0.6185152", "0.6178587", "0.6175559", "0.6173915", "0.6171392", "0.61710536", "0.61709726", "0.61672986", "0.61597097", "0.6158167", "0.615655", "0.6149533", "0.61463714", "0.6140463", "0.6140185", "0.61248386", "0.61219734", "0.61118376", "0.6108759", "0.61065125", "0.6097236", "0.608992", "0.60839355", "0.60791725", "0.6075822", "0.60715157", "0.6064909", "0.60637885", "0.6060868", "0.6060146", "0.6059478", "0.60576123", "0.6057273", "0.60559833", "0.6055926", "0.60541695", "0.60537225", "0.60526466" ]
0.0
-1
Serialize the long term memory object to a file
private void saveMemory() { try { File varTmpDir = new File("data/" + brainLocation + ".ser"); if (!varTmpDir.exists()) { varTmpDir.createNewFile(); } FileOutputStream fileOut = new FileOutputStream(varTmpDir); ObjectOutputStream out = new ObjectOutputStream(fileOut); out.writeObject(longTermMemory); out.close(); fileOut.close(); System.out.println("SAVED LONG TERM MEMORIES IN " + brainLocation); } catch (IOException i) { i.printStackTrace(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void serialize() {\n FileOutputStream fileOutput = null;\n ObjectOutputStream outStream = null;\n // attempts to write the object to a file\n try {\n clearFile();\n fileOutput = new FileOutputStream(data);\n outStream = new ObjectOutputStream(fileOutput);\n outStream.writeObject(this);\n } catch (Exception e) {\n } finally {\n try {\n if (outStream != null)\n outStream.close();\n } catch (Exception e) {\n }\n }\n }", "void writeObject(OutputSerializer out) throws java.io.IOException;", "private void writeToFile(String filename, Object object) {\n try {\n FileOutputStream fileOutputStream = openFileOutput(filename, MODE_PRIVATE);\n ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);\n objectOutputStream.writeObject(object);\n objectOutputStream.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "private byte[] serialize(RealDecisionTree object){\n try{\n // Serialize data object to a file\n ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(\"MyObject.ser\"));\n out.writeObject(object);\n out.close();\n\n // Serialize data object to a byte array\n ByteArrayOutputStream bos = new ByteArrayOutputStream() ;\n out = new ObjectOutputStream(bos) ;\n out.writeObject(object);\n out.close();\n\n // Get the bytes of the serialized object\n byte[] buf = bos.toByteArray();\n return buf;\n } catch (IOException e) {\n System.exit(1);\n }\n\n return null;\n }", "private void writeObject(final ObjectOutputStream out) throws IOException {\n try {\n if (location == null) location = IOHelper.serializeData(object);\n IOHelper.writeData(location, new StreamOutputDestination(out));\n } catch (final IOException e) {\n throw e;\n } catch (final Exception e) {\n throw new IOException(e);\n }\n }", "void serialize(Object obj, OutputStream stream) throws IOException;", "public void writeObject ();", "public abstract <T> SerializationStream writeObject(T t);", "public abstract void serialize(OutputStream stream, T object) throws IOException;", "public void writeObject(Object obj) throws IOException;", "private void writeObject(final ObjectOutputStream out) throws IOException\n\t{\n\t\t// Read the data\n\t\tif (dfos.isInMemory())\n\t\t{\n\t\t\tcachedContent = get();\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcachedContent = null;\n\t\t\tdfosFile = dfos.getFile();\n\t\t}\n\n\t\t// write out values\n\t\tout.defaultWriteObject();\n\t}", "private void serialize(String file_name) {\n\t\t//Saving of object in a file\n\t\ttry {\n\t\t\tFileOutputStream file = new FileOutputStream(file_name);\n\t\t\tObjectOutputStream out = new ObjectOutputStream(file);\n\t\t\t// Method for serialization of object\n\t\t\tout.writeObject(this.GA);\n\n\t\t\tout.close();\n\t\t\tfile.close();\n\n\t\t\tSystem.out.println(\"Object has benn serialized\");\n\t\t} catch (IOException e) {\n\t\t\tSystem.err.println(\"IOException is caught,Object didnt save.\");\n\t\t}\n\t}", "OutputStream serialize(OutputStream toSerialize);", "private void serializeObject(String filename, Object content)\n throws IOException\n {\n synchronized(filename)\n {\n FileOutputStream fileOut = new FileOutputStream(filename);\n ObjectOutputStream out = new ObjectOutputStream(fileOut);\n out.writeObject(content);\n out.close();\n fileOut.close();\n }\n }", "public static void writeObjectToDisk(Object obj, String name) throws IOException {\r\n\t\t// Create file output stream\r\n\t\tFileOutputStream fileOutStr = new FileOutputStream(name);\r\n\t\t// Create object output stream and write object\r\n\t\tObjectOutputStream objOutStr = new ObjectOutputStream(fileOutStr);\r\n\t\tobjOutStr.writeObject(obj);\r\n\t\t// Close all streams\r\n\t\tobjOutStr.close();\r\n\t\tfileOutStr.close();\r\n\t\tSystem.out.printf(\"Serialized data is saved in a file - \" + name); // Printing message and file name which is\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// saved\r\n\t}", "@SuppressWarnings(\"PMD.CloseResource\") // PMD does not understand Closer\n protected static void serializeObject(Serializable object, Path outputFile) {\n try {\n try (Closer closer = Closer.create()) {\n OutputStream out = closer.register(Files.newOutputStream(outputFile));\n BufferedOutputStream bout = closer.register(new BufferedOutputStream(out));\n serializeToLz4Data(object, bout);\n }\n } catch (Exception e) {\n throw new BatfishException(\"Failed to serialize object to output file: \" + outputFile, e);\n }\n }", "String objectWrite();", "public void serialize(T t) throws IOException {\n FileOutputStream fileOutputStream = new FileOutputStream(this.mFile);\n BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(fileOutputStream);\n DataOutputStream dataOutputStream = new DataOutputStream(bufferedOutputStream);\n this.mCodec.serialize(t, dataOutputStream);\n dataOutputStream.flush();\n $closeResource(null, dataOutputStream);\n $closeResource(null, bufferedOutputStream);\n $closeResource(null, fileOutputStream);\n }", "public byte[] serialize();", "public void writeObject( Container.ContainerOutputStream cos ) throws SerializationException;", "private void writeObject(String filePath, Object obj) throws IOException {\n OutputStream file = new FileOutputStream(filePath);\n OutputStream buffer = new BufferedOutputStream(file);\n ObjectOutput output = new ObjectOutputStream(buffer);\n output.writeObject(obj);\n output.close();\n }", "ObjectOutputStream newObjectOutputStream(OutputStream out) throws Exception;", "private static void LessonSerialization() {\n PersonDAO personDAO = new PersonDAOImpl();\n Person person = personDAO.getPersonById(1);\n\n // serialize to a text file\n try {\n FileOutputStream fileOut = new FileOutputStream(\"./newfile.txt\");\n ObjectOutputStream out = new ObjectOutputStream(fileOut);\n out.writeObject(person);\n out.close();\n fileOut.close();\n System.out.println(\"Person Object serialized and written to file: newfile.txt\");\n System.out.println(\"Serialized Object: \" + person.ToString());\n } catch(IOException ioEx) {\n System.out.println(ioEx);\n }\n }", "public void serialize() {\n\t\t\n\t}", "private void writeObject(ObjectOutputStream out) throws IOException\r\n\t{\r\n\t\tthis.serialize(out);\r\n\t}", "public void writeObject(ZObjectOutputStream out) throws IOException {\n }", "private static <T extends Serializable> byte[] pickle(T obj)\n throws IOException {\n ByteArrayOutputStream baos = new ByteArrayOutputStream();\n ObjectOutputStream oos = new ObjectOutputStream(baos);\n oos.writeObject(obj);\n oos.close();\n return baos.toByteArray();\n }", "public void writeObject(OutputStream stream, Object object, int format) throws IOException;", "private void writeObject (java.io.ObjectOutputStream out) throws IOException {\n message(AX_PROGRESS,\"Serialize activeX control\");\n if (clientSite != AX_NO_CLIENT_SITE) {\n String componentFileName = generateComponentFileName(\"x0p\");\n message(AX_PROGRESS,componentFileName); \n OleThreadRequest saveRequest = new OleThreadRequest(SAVE,\n componentFileName);\n messagesWaiting.add(saveRequest);\n \n // busy wait - there must be a better way\n while (!saveRequest.finished) {\n synchronized(saveRequest) {\n try {\n saveRequest.wait(POLL_FOR_RESULT_HEARTBEAT);\n }\n catch (InterruptedException e) {\n\n }\n }\n } \n \n componentFileName = saveRequest.name;\n out.defaultWriteObject();\n if (componentFileName.equals(\"\")) {\n message(AX_PROGRESS,\n \"Cannot serialize activeX control, continuing anyway\");\n out.writeLong(0);\n } else {\n File f = new File(componentFileName);\n FileInputStream fi = new FileInputStream(f);\n long sofar = 0;\n int num = -1;\n int filelen = (int)f.length();\n out.writeLong(filelen);\n message(AX_PROGRESS, \"Writing the size of COM storage: \" + filelen);\n byte[] buffer = new byte[1024];\n\n /* The storage file could be many Megs so work in 1K chunks */\n do {\n num = fi.read(buffer,0,1024);\n if (num >= 0) {\n out.write(buffer,0,num);\n sofar += num;\n }\n }\n while (num == 1024);\n\n message(AX_PROGRESS, \"Read \" + sofar + \" bytes from a storage file\");\n\n fi.close();\n if (! f.delete())\n message(AX_ERROR,\"Failed to delete temporary file: \" + \n componentFileName);\n }\n }\n }", "public void writeObject(RandomAccessFile arq) throws IOException{\n byte[] dados = this.getByteArray();\n arq.writeChar(' ');\n arq.writeShort(dados.length);\n arq.write(dados);\n }", "public String getSerializedObj() {\r\n String serializedObject = null;\r\n // serialize the object\r\n // format = file content,size,name\r\n File f = this.fileObject;\r\n serializedObject = f.getBody()+\",\"+f.getFileSize()+\",\"+f.getName();\r\n return serializedObject;\r\n }", "public void writeExternal(ObjectOutput objectOutput)\n throws IOException\n {\n objectOutput.writeLong(serialVersionUID);\n objectOutput.writeObject(_wrapped);\n objectOutput.writeObject(_label);\n }", "@Override\n public void serializeObject(Object o, int hashCode, String destDir) {\n // throw new NotImplementedException();\n }", "private void writeObject(\n \t\t ObjectOutputStream aOutputStream\n\t\t ) throws IOException {\n\t\t //perform the default serialization for all non-transient, non-static fields\n \t\t aOutputStream.defaultWriteObject();\n \t}", "@Override\n\tprotected void write(ObjectOutput out) throws IOException {\n\t\t\n\t}", "public static File writeObjectToTempFile(Serializable o, String filename)\n/* */ throws IOException\n/* */ {\n/* 76 */ File file = File.createTempFile(filename, \".tmp\");\n/* 77 */ file.deleteOnExit();\n/* 78 */ ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(new GZIPOutputStream(new FileOutputStream(file))));\n/* 79 */ oos.writeObject(o);\n/* 80 */ oos.close();\n/* 81 */ return file;\n/* */ }", "public <T> void serialize(T obj, Class<T> type, OutputStream os) throws SerializationException;", "public static void serialize(Object obj, String fileName) throws IOException {\n\t\tFileOutputStream fos = new FileOutputStream(fileName);\n\t\tObjectOutputStream oos = new ObjectOutputStream(fos);\n\t\toos.writeObject(obj);\n\n\t\tfos.close();\n\t}", "public void SerialWriteFile() {\r\n\r\n PrintWriter pwrite = null;\r\n File fileObject = new File(getName());\r\n QuizPlayer q = new QuizPlayer(getName(), getNickname(), getTotalScore());\r\n\r\n try {\r\n ObjectOutputStream outputStream =\r\n new ObjectOutputStream(new FileOutputStream(fileObject));\r\n\r\n outputStream.writeObject(q); //Writes the object to the serialized file.\r\n outputStream.close();\r\n\r\n\r\n } catch (IOException e) {\r\n System.out.println(\"Problem with file output.\");\r\n }\r\n\r\n }", "public static void main(String[] args) throws IOException {\nPerson p=new Person(101,\"reya\");\nFileOutputStream fo=new FileOutputStream(\"something.txt\");\nObjectOutputStream os=new ObjectOutputStream (fo);\nos.writeObject(p);\nSystem.out.println(\"Serialization Success\");//should implemet serializable concept\n\t}", "public abstract Object marshal(Object objO, File objF);", "public void writeUnsafe(UnsafeMemory um) {\n int mySize = getWriteUnsafeSize();\n um.putInt(mySize);\n //serial\n um.putLong(serialVersionUID);\n\n //class member\n um.putString(fileName);\n\n\n //rocksDbKlueFileName\n um.putString(rocksDbKlueFileName);\n //boolean readOnly\n um.putBoolean(readOnly);\n\n um.putInt(last);\n\n //arrays\n um.put(nameIndex, UnsafeMemory.ARRAYLIST_STRING_TYPE);\n um.put(entries, UnsafeMemory.ARRAYLIST_KID_TYPE);\n um.put(kingdoms,UnsafeMemory.HASHMAP_INTEGER_CHARACTER_TYPE);\n\n\n //No longer stored in memory\n //um.put(sequences,UnsafeMemory.ARRAYLIST_DNABITSTRING_TYPE);\n\n\n\n //ArrayList<Integer> sequenceLength = new ArrayList<Integer>();\n um.put(sequenceLength, UnsafeMemory.ARRAYLIST_INT_TYPE);\n //ArrayList<HashMap<Integer,Character>> exceptionsArr;\n\n int total = 0;\n total += UnsafeMemory.SIZE_OF_INT // byte header\n + UnsafeMemory.SIZE_OF_LONG // SerialUID\n + UnsafeMemory.SIZE_OF_INT; // number of entries\n\n for (int z=0; z < exceptionsArr.size(); z++){\n total += UnsafeMemory.getWriteUnsafeSize(exceptionsArr.get(z), UnsafeMemory.HASHMAP_INTEGER_CHARACTER_TYPE);\n }\n\n um.putInt(total);\n um.putLong(serialVersionUID_ArrayListHashMap_INT_CHAR);\n um.putInt(exceptionsArr.size());\n for (int z=0; z < exceptionsArr.size(); z++){\n um.put(exceptionsArr.get(z), UnsafeMemory.HASHMAP_INTEGER_CHARACTER_TYPE);\n }\n\n }", "private void writeObject(ObjectOutputStream _stream)\n/* 428: */ throws IOException\n/* 429: */ {\n/* 430:503 */ _stream.defaultWriteObject();\n/* 431:504 */ writeCustomData(_stream);\n/* 432: */ }", "public void writeObject(Object obj) throws IOException\n\t{\n\t\tif (obj == null) {\n\t\t\twriteMark(Ion.NULL);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof IonBinary) {\n\t\t\tfinal IonBinary iObj = (IonBinary) obj;\n\t\t\t\n\t\t\twriteMark(Ion.getMark(obj));\n\t\t\tiObj.save(this);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof IonBundled) {\n\t\t\tfinal IonBundled iObj = (IonBundled) obj;\n\t\t\t\n\t\t\twriteMark(Ion.getMark(obj));\n\t\t\t\n\t\t\tfinal IonDataBundle bundle = new IonDataBundle();\n\t\t\tiObj.save(bundle);\n\t\t\twriteBundle(bundle);\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (Ion.isObjectIndirectBundled(obj)) {\n\t\t\tfinal IonizerBundled<?> ionizer = Ion.getIonizerBundledForClass(obj.getClass());\n\t\t\t\n\t\t\twriteMark(Ion.getMark(obj));\n\t\t\t\n\t\t\tfinal IonDataBundle bundle = new IonDataBundle();\n\t\t\tionizer._save(obj, bundle);\n\t\t\twriteBundle(bundle);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (Ion.isObjectIndirectBinary(obj)) {\n\t\t\tfinal IonizerBinary<?> ionizer = Ion.getIonizerBinaryForClass(obj.getClass());\n\t\t\t\n\t\t\twriteMark(Ion.getMark(obj));\n\t\t\t\n\t\t\tionizer._save(obj, this);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof Map) {\n\t\t\twriteMark(Ion.MAP);\n\t\t\twriteMap((Map<?, ?>) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof Collection) {\n\t\t\twriteMark(Ion.SEQUENCE);\n\t\t\twriteSequence((Collection<?>) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof Boolean) {\n\t\t\twriteMark(Ion.BOOLEAN);\n\t\t\twriteBoolean((Boolean) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof Byte) {\n\t\t\twriteMark(Ion.BYTE);\n\t\t\twriteByte((Byte) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof Character) {\n\t\t\twriteMark(Ion.CHAR);\n\t\t\twriteChar((Character) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof Short) {\n\t\t\twriteMark(Ion.SHORT);\n\t\t\twriteShort((Short) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof Integer) {\n\t\t\twriteMark(Ion.INT);\n\t\t\twriteInt((Integer) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof Long) {\n\t\t\twriteMark(Ion.LONG);\n\t\t\twriteLong((Long) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof Float) {\n\t\t\twriteMark(Ion.FLOAT);\n\t\t\twriteFloat((Float) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof Double) {\n\t\t\twriteMark(Ion.DOUBLE);\n\t\t\twriteDouble((Double) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof String) {\n\t\t\twriteMark(Ion.STRING);\n\t\t\twriteString((String) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof boolean[]) {\n\t\t\twriteMark(Ion.BOOLEAN_ARRAY);\n\t\t\twriteBooleans((boolean[]) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof byte[]) {\n\t\t\twriteMark(Ion.BYTE_ARRAY);\n\t\t\twriteBytes((byte[]) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof char[]) {\n\t\t\twriteMark(Ion.CHAR_ARRAY);\n\t\t\twriteChars((char[]) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof short[]) {\n\t\t\twriteMark(Ion.SHORT_ARRAY);\n\t\t\twriteShorts((short[]) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof int[]) {\n\t\t\twriteMark(Ion.INT_ARRAY);\n\t\t\twriteInts((int[]) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof long[]) {\n\t\t\twriteMark(Ion.LONG_ARRAY);\n\t\t\twriteLongs((long[]) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof float[]) {\n\t\t\twriteMark(Ion.FLOAT_ARRAY);\n\t\t\twriteFloats((float[]) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof double[]) {\n\t\t\twriteMark(Ion.DOUBLE_ARRAY);\n\t\t\twriteDoubles((double[]) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof String[]) {\n\t\t\twriteMark(Ion.STRING_ARRAY);\n\t\t\twriteStrings((String[]) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (obj instanceof Object[]) {\n\t\t\twriteMark(Ion.OBJECT_ARRAY);\n\t\t\twriteObjects((Object[]) obj);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tthrow new IOException(\"Object \" + obj + \" could not be be written to stream.\");\n\t}", "public void saveAsSerialization() {\n try(ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream(new File(\"saves/data.dat\")))){\n os.writeObject(this);\n } catch (FileNotFoundException e){\n System.out.println(\"Could not create file: \" + e.getMessage());\n } catch (IOException e){\n System.out.println(\"IO exception occurred: \" + e.getMessage());\n }\n\n }", "void serialize(@NotNull OutputStream out) throws IOException;", "void serializeToFile(String fileName, BigInteger mod, BigInteger exp) throws IOException {\r\n ObjectOutputStream ObjOut = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(fileName)));\r\n\r\n try {\r\n ObjOut.writeObject(mod);\r\n ObjOut.writeObject(exp);\r\n System.out.println(\"Key File Created: \" + fileName);\r\n } catch (Exception e) {\r\n throw new IOException(\" Error while writing the key object\", e);\r\n } finally {\r\n ObjOut.close();\r\n }\r\n }", "private void writeObject (ObjectOutputStream out) throws IOException {\n\t\tout.writeInt (CURRENT_SERIAL_VERSION);\n\t\tout.writeObject(inputPipe);\n\t\tout.writeObject(outputPipe);\n\t\tout.writeObject(sumLatticeFactory);\n\t\tout.writeObject(maxLatticeFactory);\n\t}", "public static void serialize(PhotoAlbumManager userdata) throws IOException {\n\t\tObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(storeDir + File.separator + storeFile));\n\t\toos.writeObject(userdata);\n\t\toos.close();\n\t}", "@Override\n public void serialize(ByteBuffer buf) {\n }", "public final void serialize(OutputStream out){\n }", "public void serializeObject(String fileName, Automobile automobile) {\n try {\n String path = System.getProperty(\"user.dir\");\n String fileNameWithPath = path + File.separator + fileName;\n if(DEBUG) {\n System.out.printf(\" File Name with Path : %s\", fileNameWithPath);\n }\n FileOutputStream fileOut = new FileOutputStream(fileNameWithPath);\n ObjectOutputStream out = new ObjectOutputStream(fileOut);\n out.writeObject(automobile);\n out.close();\n fileOut.close();\n System.out.printf(\"Serialized data is saved in automotive.ser %s%n\", fileName);\n } catch (IOException i) {\n i.printStackTrace();\n }\n }", "public void writeObject(Object obj, String path)throws IOException{\n FileOutputStream fos = new FileOutputStream(path);\n ObjectOutputStream oos = new ObjectOutputStream(fos);\n\n oos.writeObject(obj);\n oos.close();\n }", "private void writeObject(ObjectOutputStream stream) throws IOException {\n/* 188 */ stream.defaultWriteObject();\n/* 189 */ stream.writeInt(this.store.size());\n/* 190 */ Set keys = this.store.keySet();\n/* 191 */ Iterator iterator = keys.iterator();\n/* 192 */ while (iterator.hasNext()) {\n/* 193 */ Comparable key = (Comparable)iterator.next();\n/* 194 */ stream.writeObject(key);\n/* 195 */ Stroke stroke = getStroke(key);\n/* 196 */ SerialUtilities.writeStroke(stroke, stream);\n/* */ } \n/* */ }", "public void writeToFile() {\n\t\ttry {\n\t\t\tFileOutputStream file = new FileOutputStream(pathName);\n\t\t\tObjectOutputStream output = new ObjectOutputStream(file);\n\n\t\t\tMap<String, HashSet<String>> toSerialize = tagToImg;\n\t\t\toutput.writeObject(toSerialize);\n\t\t\toutput.close();\n\t\t\tfile.close();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "@Override\r\npublic boolean writeEntries(CacheObject obj) {\n\t\r\n\ttry {\r\n\t\t\r\n\t\tthis.writer.append(\"[\"+obj.toString()+\"]\\r\\n\");\r\n\t\tthis.writer.flush();\r\n\t} catch (IOException e) {\r\n\t\tSystem.out.println(\"Error Occured while writing into File :\"+ e.getMessage());\r\n\t\te.printStackTrace();\r\n\t\t\r\n\t} \r\n\t\r\n\treturn false;\r\n}", "public static void writeObject(Activity activity, Object object, String filename) {\n FileOutputStream fos = null;\n ObjectOutputStream oos = null;\n try {\n fos = activity.openFileOutput(filename, Context.MODE_PRIVATE);\n oos = new ObjectOutputStream(fos);\n oos.writeObject(object);\n } catch (IOException e) {\n e.printStackTrace();\n }\n finally {\n closeOutputStream(fos);\n closeOutputStream(oos);\n }\n }", "private final FileOutputStream zabz() {\n Serializable serializable = this.zalj;\n if (serializable == null) {\n serializable = new IllegalStateException(\"setTempDir() must be called before writing this object to a parcel\");\n throw serializable;\n }\n Object object = \"teleporter\";\n String string2 = \".tmp\";\n try {\n serializable = File.createTempFile((String)object, string2, (File)serializable);\n }\n catch (IOException iOException) {\n object = new IllegalStateException(\"Could not create temporary file\", iOException);\n throw object;\n }\n try {\n object = new FileOutputStream((File)serializable);\n int n10 = 0x10000000;\n string2 = ParcelFileDescriptor.open((File)serializable, (int)n10);\n this.zalg = string2;\n ((File)serializable).delete();\n return object;\n }\n catch (FileNotFoundException fileNotFoundException) {\n serializable = new IllegalStateException(\"Temporary file is somehow already deleted\");\n throw serializable;\n }\n }", "void serialize(OutputStream output, Object graph);", "public void tempSaveToFile() {\n try {\n ObjectOutputStream outputStream = new ObjectOutputStream(\n this.openFileOutput(MenuActivity2048.TEMP_SAVE_FILENAME, MODE_PRIVATE));\n outputStream.writeObject(boardManager);\n outputStream.close();\n } catch (IOException e) {\n Log.e(\"Exception\", \"File write failed: \" + e.toString());\n }\n }", "void serialize(OutputStream out) throws IOException {\n trie.serialize(out);\n }", "public void serialize(final DataOutputStream out) throws IOException {\r\n out.writeInt(this.ramSize);\r\n for (int i = 0; i < this.ramSize; ++i) {\r\n out.writeByte(this.memory[i]);\r\n }\r\n out.writeBoolean(this.isNMILow);\r\n out.writeBoolean(this.lastNMIState);\r\n out.writeBoolean(this.isIRQLow);\r\n out.writeBoolean(this.isCheckInterrupt);\r\n out.writeLong(this.cycles);\r\n out.writeInt(this.pc);\r\n out.writeInt(this.currentInstructionAddress);\r\n out.writeBoolean(this.signFlag);\r\n out.writeBoolean(this.zeroFlag);\r\n out.writeBoolean(this.overflowFlag);\r\n out.writeBoolean(this.carryFlag);\r\n out.writeBoolean(this.decimalFlag);\r\n out.writeBoolean(this.breakFlag);\r\n out.writeBoolean(this.interruptFlag);\r\n out.writeInt(this.ac);\r\n out.writeInt(this.x);\r\n out.writeInt(this.y);\r\n out.writeInt(this.sp);\r\n }", "private void writeObject(\n ObjectOutputStream aOutputStream\n ) throws IOException {\n //perform the default serialization for all non-transient, non-static fields\n aOutputStream.defaultWriteObject();\n }", "private final void writeObject(ObjectOutputStream out) throws java.io.IOException {\n\t\tthrow new java.io.IOException(\"Object cannot be serialized\");\n\t}", "public void save(){\n Player temp = Arena.CUR_PLAYER;\n try{\n FileOutputStream outputFile = new FileOutputStream(\"./data.sec\");\n ObjectOutputStream objectOut = new ObjectOutputStream(outputFile);\n objectOut.writeObject(temp);\n objectOut.close();\n outputFile.close();\n }\n catch(FileNotFoundException e){\n System.out.print(\"Cannot create a file at that location\");\n }\n catch(SecurityException e){\n System.out.print(\"Permission Denied!\");\n }\n catch(IOException e){\n System.out.println(\"Error 203\");\n } \n }", "public void dump() throws IOException;", "byte[] serialize(Serializable object);", "@Override\n\tpublic void save(Object o, String file) {\n\t\t\n\t}", "private void writeObject(ObjectOutputStream out) throws IOException {\n out.defaultWriteObject();\n }", "@Override\n\tpublic void save(String file_name) {\n\t\tserialize(file_name);\n\t}", "public ByteArraySegment serialize(T object) throws IOException {\n val result = new ByteBufferOutputStream();\n serialize(result, object);\n return result.getData();\n }", "protected byte[] serialize(Object o) {\n\t\tif (o == null) {\n\t\t\tthrow new NullPointerException(\"SPYMemcached JAVA Serialization error : Can't serialize null\");\n\t\t}\n\t\tbyte[] rv = null;\n\t\tByteArrayOutputStream bos = null;\n\t\tObjectOutputStream os = null;\n\t\ttry {\n\t\t\tbos = new ByteArrayOutputStream();\n\t\t\tos = new ObjectOutputStream(bos);\n\t\t\tos.writeObject(o);\n\t\t\tos.close();\n\t\t\tbos.close();\n\t\t\trv = bos.toByteArray();\n\t\t} catch (IOException e) {\n\t\t\tthrow new IllegalArgumentException(\"SPYMemcached JAVA Serialization error : Non-serializable object\", e);\n\t\t} finally {\n\t\t\tif (os != null) {\n\t\t\t\ttry {\n\t\t\t\t\tos.close();\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tLOGGER.info(\"JAVA Serializer error : close ObjectOutputStream\", e);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (bos != null) {\n\t\t\t\ttry {\n\t\t\t\t\tbos.close();\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tLOGGER.info(\"JAVA Serializer error : close ByteArrayOutputStream\", e);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn rv;\n\t}", "public void Serialization() {\n\t\tGitlet myGitlet = new Gitlet(1);\n\t\tmyGitlet.myBranch = this.myBranch;\n\t\tmyGitlet.myCommit = this.myCommit;\n\t\tmyGitlet.messageMap = this.messageMap;\n\t\tmyGitlet.myHead = this.myHead;\n\t\tmyGitlet.stagedFiles = this.stagedFiles;\n\t\tmyGitlet.tracked = this.tracked;\n\t\tmyGitlet.stagePath = this.stagePath;\n\t\tmyGitlet.ID = this.ID;\n\t\tmyGitlet.currentBranch = this.currentBranch;\n\t\tmyGitlet.untrackedFiles = this.untrackedFiles;\n\t\tmyGitlet.conflictState = this.conflictState;\n\t\ttry {\n\t\t\tFileOutputStream fileOut = new FileOutputStream(\n\t\t\t\t\t\".gitlet/Serialization.ser\");\n\t\t\tObjectOutputStream outStream = new ObjectOutputStream(fileOut);\n\t\t\toutStream.writeObject(myGitlet);\n\t\t\toutStream.close();\n\t\t\tfileOut.close();\n\n\t\t} catch (IOException i) {\n\t\t\ti.printStackTrace();\n\t\t}\n\n\t}", "private void dumpClassBytesToFile ()\n\t{\n\t\ttry\n\t\t{\n\t\t\tfinal int lastSlash =\n\t\t\t\tclassInternalName.lastIndexOf('/');\n\t\t\tfinal String pkg =\n\t\t\t\tclassInternalName.substring(0, lastSlash);\n\t\t\tfinal Path tempDir = Paths.get(\"debug\", \"jvm\");\n\t\t\tfinal Path dir = tempDir.resolve(Paths.get(pkg));\n\t\t\tFiles.createDirectories(dir);\n\t\t\tfinal String base = classInternalName.substring(lastSlash + 1);\n\t\t\tfinal Path classFile = dir.resolve(base + \".class\");\n\t\t\tFiles.write(classFile, stripNull(classBytes));\n\t\t}\n\t\tcatch (final IOException e)\n\t\t{\n\t\t\tInterpreter.log(\n\t\t\t\tInterpreter.loggerDebugJVM,\n\t\t\t\tLevel.WARNING,\n\t\t\t\t\"unable to write class bytes for generated class {0}\",\n\t\t\t\tclassInternalName);\n\t\t}\n\t}", "public static File writeObjectToFileNoExceptions(Serializable o, String filename)\n/* */ {\n/* 47 */ file = null;\n/* 48 */ ObjectOutputStream oos = null;\n/* */ try {\n/* 50 */ file = new File(filename);\n/* */ \n/* 52 */ oos = new ObjectOutputStream(new BufferedOutputStream(new GZIPOutputStream(new FileOutputStream(file))));\n/* 53 */ oos.writeObject(o);\n/* 54 */ oos.close();\n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* 65 */ return file;\n/* */ }\n/* */ catch (Exception e)\n/* */ {\n/* 56 */ e.printStackTrace();\n/* */ } finally {\n/* 58 */ if (oos != null) {\n/* */ try {\n/* 60 */ oos.close();\n/* */ }\n/* */ catch (Exception ioe) {}\n/* */ }\n/* */ }\n/* */ }", "private void writeObject(java.io.ObjectOutputStream out) throws IOException{\n out.writeInt(p);\n out.writeInt(maxNumBars);\n out.writeObject(bars);\n out.writeInt(rightBoundary);\n out.writeDouble(totalFrequencies);\n }", "public abstract String serialise();", "@Override\n public void writeExternal(ObjectOutput out) throws IOException {\n out.writeInt(model.rank());\n out.writeObject(model.userFeatures().toJavaRDD().collect());\n out.writeObject(model.productFeatures().toJavaRDD().collect());\n\n if (log.isDebugEnabled()) {\n log.debug(\"Rank, user features and product features of MatrixFactorizationModel were serialized \"\n + \"successfully.\");\n }\n }", "private void saveInFile() {\n try {\n FileOutputStream fOut = openFileOutput(FILENAME,\n Context.MODE_PRIVATE);\n\n OutputStreamWriter writer = new OutputStreamWriter(fOut);\n Gson gson = new Gson();\n gson.toJson(counters, writer);\n writer.flush();\n\n fOut.close();\n\n } catch (FileNotFoundException e) {\n throw new RuntimeException();\n } catch (IOException e) {\n throw new RuntimeException();\n }\n }", "private void writeObject(ObjectOutputStream oos) throws IOException {\n\t\toos.defaultWriteObject();\r\n\t\tGdx.app.log(\"L/S\", \"entityInfoCollector size: \" + manList.size() + \":\" + buildingsList.size() + \":\" + buildingsList.size());\r\n\t\t\r\n\t}", "@Override\r\n public void serializar() throws IOException {\n File fich=new File(\"datos.bin\");\r\n FileOutputStream fos = new FileOutputStream(fich);\r\n ObjectOutputStream oos = new ObjectOutputStream(fos);\r\n oos.writeObject(gestor);\r\n oos.close();\r\n }", "void serialize(GeneratedMessage msg, OutputStream out) throws IOException;", "@Override\n public void writeExternal(ObjectOutput out) throws IOException {\n out.writeLong(size);\n out.writeInt(batch);\n\n long remaining = size >> 3;\n int step = 1 << 15;\n w.position(0);\n while (remaining > 0) {\n ByteBuffer buffer = ByteBuffer.allocate(step);\n int byteSize = w.read(buffer);\n remaining -= byteSize;\n out.write(buffer.array());\n }\n }", "private void saveToStorage() {\n FileOutputStream fos = null;\n try {\n fos = context.openFileOutput(\"GeoFences\", Context.MODE_PRIVATE);\n ObjectOutputStream oos = new ObjectOutputStream(fos);\n oos.writeObject(currentList);\n oos.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "@SuppressWarnings(\"PMD.CloseResource\") // PMD does not understand Closer.\n private static void serializeToLz4Data(Serializable object, OutputStream out) {\n try (Closer closer = Closer.create()) {\n OutputStream los = closer.register(new LZ4FrameOutputStream(out));\n ObjectOutputStream oos = closer.register(new ObjectOutputStream(los));\n oos.writeObject(object);\n } catch (Throwable e) {\n throw new BatfishException(\"Failed to convert object to LZ4 data\", e);\n }\n }", "private void writeObject(java.io.ObjectOutputStream s)\n throws java.lang.ClassNotFoundException,\n\t java.io.IOException\n {\n s.defaultWriteObject();\n }", "public void save(OutputStream out) throws IOException {\n\t\ttry (GZIPOutputStream zipOut = new GZIPOutputStream(out)) {\n\t\t\ttry (ObjectOutputStream objOut = new ObjectOutputStream(zipOut)) {\n\t\t\t\tobjOut.writeObject(this);\n\t\t\t}\n\t\t}\n\t}", "private void saveToFileData() {//Context context) {\n try {\n FileOutputStream fileOutputStream = openFileOutput(fileNameData, Context.MODE_PRIVATE);\n ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);\n objectOutputStream.writeObject(Data.userData);\n objectOutputStream.close();\n fileOutputStream.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "public void saveToFile() {\n FileOutputStream fos = null;\n try {\n //write the object into file\n fos = new FileOutputStream(file);\n ObjectOutputStream oos = new ObjectOutputStream(fos);\n oos.writeObject(travelGUI.getTravelAgent());\n oos.flush();\n oos.close();\n }\n catch (IOException ioe) {\n System.out.println(ioe.getMessage());\n if (fos != null) {\n try {\n fos.close();\n }\n catch (IOException ioe2) {\n System.out.println(ioe2.getMessage());\n }\n }\n return;\n }\n finally {\n if (fos != null) {\n try {\n fos.close();\n }\n catch (IOException ioe2) {\n System.out.println(ioe2.getMessage());\n }\n }\n }\n if (fos != null) {\n try {\n fos.close();\n }\n catch (IOException ioe2) {\n System.out.println(ioe2.getMessage());\n }\n }\n }", "private void writeObject(java.io.ObjectOutputStream s)\r\n throws java.io.IOException {\r\n // Write out any hidden serialization magic\r\n s.defaultWriteObject();\r\n\r\n // Write out HashMap capacity and load factor\r\n // s.writeInt(map.capacity());\r\n // s.writeFloat(map.loadFactor());\r\n\r\n // Write out size\r\n s.writeInt(this.map.size());\r\n\r\n // Write out all elements in the proper order.\r\n for (Iterator<E> i = this.map.values().iterator(); i.hasNext();)\r\n s.writeObject(i.next());\r\n }", "private void writeObject(ObjectOutputStream out) throws IOException {\n\tout.defaultWriteObject();\n\tservID.writeBytes(out);\n }", "private void writeObject(ObjectOutputStream out) throws IOException {\n Set<PackageIdentifier> successfulPkgs = transitiveSuccessfulPkgs.toSet();\n out.writeInt(successfulPkgs.size());\n for (PackageIdentifier pkg : successfulPkgs) {\n out.writeObject(pkg);\n }\n\n out.writeObject(transitiveUnsuccessfulPkgs);\n // Deliberately do not write out transitiveTargets. There is a lot of those and they drive\n // serialization costs through the roof, both in terms of space and of time.\n // TODO(bazel-team): Deal with this properly once we have efficient serialization of NestedSets.\n out.writeObject(transitiveRootCauses);\n out.writeObject(errorLoadingTarget);\n }", "private void writeObject(ObjectOutputStream out)\n/* */ throws IOException\n/* */ {\n/* 900 */ out.writeUTF(toString());\n/* 901 */ out.writeObject(this.locale);\n/* */ }", "private void writeObject(\n ObjectOutputStream aOutputStream\n ) throws IOException {\n aOutputStream.defaultWriteObject();\n }", "@Override\r\n\t\t\tpublic void serializar() {\n\r\n\t\t\t}", "public void serialize(RevisionDataOutput dataOutput, T object) throws IOException {\n serialize(dataOutput.getBaseStream(), object);\n }", "private void writeObject(ObjectOutputStream oos) throws IOException {\n oos.defaultWriteObject();\n /*if(serializeEverything) {\n //The cast to Serializable is necessary to avoid Sonar bug issues because List does not implement Serializable but all implementations of List (such as ArrayList) in effect implements Serializable\n //oos.writeObject((Serializable)cardPower);\n oos.writeObject((Serializable)weapons);\n oos.writeInt(points);\n }\n serializeEverything = false;*/\n }", "public static File writeObjectToTempFileNoExceptions(Serializable o, String filename)\n/* */ {\n/* */ try\n/* */ {\n/* 93 */ return writeObjectToTempFile(o, filename);\n/* */ } catch (Exception e) {\n/* 95 */ System.err.println(\"Error writing object to file \" + filename);\n/* 96 */ e.printStackTrace(); }\n/* 97 */ return null;\n/* */ }", "protected byte[] objectToBytes(O object) throws OBException {\r\n try {\r\n return object.store();\r\n\r\n } catch (IOException e) {\r\n throw new OBException(e);\r\n }\r\n }", "private void writeObject(java.io.ObjectOutputStream out) throws IOException {\n throw new NotSerializableException();\n }" ]
[ "0.6990989", "0.68375444", "0.6682146", "0.6646784", "0.6532085", "0.6520243", "0.6493477", "0.64759487", "0.64145714", "0.64097005", "0.6393149", "0.63260007", "0.63051486", "0.62918025", "0.6279077", "0.6270747", "0.6248124", "0.61784655", "0.61630696", "0.6131955", "0.61249673", "0.61225575", "0.61219746", "0.60803837", "0.60733914", "0.6071835", "0.60575867", "0.6040359", "0.603118", "0.60142994", "0.60052484", "0.5990845", "0.59771377", "0.59553397", "0.59541935", "0.59464014", "0.5937262", "0.5932558", "0.59099007", "0.59091645", "0.59068924", "0.59066206", "0.58983916", "0.58847344", "0.58833104", "0.5869923", "0.5865943", "0.58563954", "0.5853151", "0.5844745", "0.5832582", "0.5814661", "0.5812179", "0.5793037", "0.5765908", "0.5765258", "0.5752906", "0.5752301", "0.5752171", "0.57437825", "0.5742174", "0.57325566", "0.5729234", "0.57245255", "0.5719682", "0.57178247", "0.5709051", "0.5708655", "0.57068336", "0.57052857", "0.5699304", "0.56968945", "0.56886494", "0.56877524", "0.56695306", "0.5667392", "0.5665152", "0.56616354", "0.5660133", "0.56572", "0.5652326", "0.56487083", "0.5647027", "0.5641362", "0.5639028", "0.563145", "0.56257606", "0.5618269", "0.56116027", "0.56086916", "0.5604964", "0.5604339", "0.56021714", "0.55920154", "0.55907005", "0.55723304", "0.5562636", "0.5562469", "0.55576587", "0.5554906" ]
0.7050866
0
Load the serialized memory from a file. If the file doesn't exist, create it.
private void loadMemory() { try { File varTmpDir = new File("data/" + brainLocation + ".ser"); if (varTmpDir.exists()) { FileInputStream fileIn = new FileInputStream(varTmpDir); ObjectInputStream in = new ObjectInputStream(fileIn); longTermMemory = (HashMap<String, BoardRecord>) in.readObject(); in.close(); fileIn.close(); } } catch (IOException i) { i.printStackTrace(); return; } catch (ClassNotFoundException c) { System.out.println("File not found"); c.printStackTrace(); return; } System.out.println("RECALLED LONG TERM MEMORIES FROM " + brainLocation + ": " + longTermMemory.toString()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Object loadFromFile(String fileName) {\n\t Object obj = null;\n\t try{\n\t\t FileInputStream FIS = new FileInputStream((defaultPath+\"\\\\\" + fileName));\n\t\t ObjectInputStream onjIn = new ObjectInputStream(FIS);\n\t\t obj = onjIn.readObject();\n\t } catch (NoSuchFileException e){\n\t\t saveToFile(fileName, null); \n\t } catch (IOException e) {\n\t } catch (ClassNotFoundException e) {\n\t } \n\t return obj;\n }", "public static Object load(File mazeFile) throws IOException, ClassNotFoundException {\n\n /* IO stuff */\n ObjectInputStream oi = new ObjectInputStream( new FileInputStream( mazeFile ) );\n\n Object instance = oi.readObject();\n\n oi.close();\n\n return instance;\n }", "private void loadFromFile(String fileName) {\n try {\n InputStream inputStream = this.openFileInput(fileName);\n if (inputStream != null) {\n ObjectInputStream input = new ObjectInputStream(inputStream);\n boardManager = (BoardManager) input.readObject();\n inputStream.close();\n }\n } catch (FileNotFoundException e) {\n Log.e(\"login activity\", \"File not found: \" + e.toString());\n } catch (IOException e) {\n Log.e(\"login activity\", \"Can not read file: \" + e.toString());\n } catch (ClassNotFoundException e) {\n Log.e(\"login activity\", \"File contained unexpected data type: \" + e.toString());\n }\n }", "void load(File file);", "@Override\n\tpublic Object load(String file) {\n\t\treturn null;\n\t}", "public static Object objectLoader(String filename) throws IOException, ClassNotFoundException {\r\n\t\t// Creat file input stream\r\n\t\tFileInputStream fileInStr = new FileInputStream(filename);\r\n\t\t// Create object input steam\r\n\t\tObjectInputStream objInStr = new ObjectInputStream(fileInStr);\r\n\t\tObject obj = (Object) objInStr.readObject();\r\n\t\t// Closing all streams\r\n\t\tobjInStr.close();\r\n\t\tfileInStr.close();\r\n\t\tSystem.out.printf(\"Deserialized data - \" + filename); // Printing message plus file name that was saved\r\n\t\treturn obj;\r\n\t}", "public void loadMem(final String filepath) {\r\n loadMem(new File(filepath));\r\n }", "public static Resource loadFromFile() {\n File file = new File(saveFilePath);\n // create a new file if it doesn't exist\n if (!file.exists()) {\n // save an empty resource object\n Resource resource = new Resource();\n resource.saveToFile();\n }\n\n Resource resource = null;\n try {\n resource = (Resource) loadObjFromFile(saveFilePath);\n } catch (InvalidClassException e) {\n // if resource file is outdated or corrupted reset file\n resource = new Resource();\n resource.saveToFile();\n staticLog(\"resource file was corrupted, cleared with new one\");\n// e.printStackTrace();\n } catch (IOException | ClassNotFoundException e) {\n e.printStackTrace();\n }\n\n resource.activeUsers = new HashMap<>();\n resource.activeProjects = new HashMap<>();\n return resource;\n }", "public static Object loadFromFile(String fileName) {\n File inputFile = new File(fileName);\n FileInputStream fis;\n BufferedInputStream bis;\n ObjectInputStream ois;\n Object o;\n try {\n fis = new FileInputStream(inputFile);\n bis = new BufferedInputStream(fis);\n ois = new ObjectInputStream(bis);\n o = ois.readObject();\n ois.close();\n bis.close();\n fis.close();\n } catch (FileNotFoundException e) {\n MessageGenerator.briefError(\"Could not open file: \" + fileName + \" , does it exist?\");\n return null;\n } catch (IOException e) {\n MessageGenerator.briefError(\"Trouble reading from file: \" + fileName);\n return null;\n } catch (ClassNotFoundException e) {\n MessageGenerator.briefError(\"Improper file found: \");\n return null;\n } catch (OutOfMemoryError e) {\n MessageGenerator.briefError(\"The JVM ran out of memory trying to load the object in \" +\n fileName + \". Try using the JVM switch to increase the heap space (\" +\n \"ex: java -Xmx1600M).\");\n return null;\n }\n return o;\n }", "private Object loadObjectFromFile(String filename) {\n //engine.logMessage(\"Loading cache data from: \"+filename);\n ObjectInputStream inputStream = null;\n try { \n inputStream = new ObjectInputStream(new BufferedInputStream(new FileInputStream(filename)));\n Object value=inputStream.readObject();\n inputStream.close(); \n return value;\n } catch (InvalidClassException e) {\n // this can happen if a data class has been updated in a never version compared to \n // the version of the data object stored in the cache\n try {if (inputStream!=null) inputStream.close();} catch (Exception x){}\n File file=new File(filename);\n file.delete();\n return null;\n } catch (Exception e) {\n engine.logMessage(\"WARNING: Unable to load data from cache: \"+e.getMessage());\n return null;\n } finally {\n try {if (inputStream!=null) inputStream.close();} catch (Exception x) {engine.logMessage(\"SYSTEM WARNING: Unable to close ObjectInputStream in cache: \"+x.getMessage());}\n } \n }", "public void load (File file) throws Exception;", "public void load(String filePath){\r\n File loadFile = new File(filePath);\r\n if (!loadFile.exists()){\r\n System.out.println(\"I failed. There are no saved games.\");\r\n return;\r\n }\r\n FileInputStream fis = null;\r\n ObjectInputStream in = null;\r\n try {\r\n fis = new FileInputStream(filePath);\r\n in = new ObjectInputStream(fis);\r\n long versionUID = (long) in.readObject();\r\n if (versionUID != this.serialVersionUID) {\r\n throw new UnsupportedClassVersionError(\"Version mismatch for save game!\");\r\n }\r\n this.p = (Character) in.readObject();\r\n this.map = (SpecialRoom[][]) in.readObject();\r\n\r\n } catch (FileNotFoundException ex){\r\n System.out.println(\"The saved game was not found!\");\r\n ex.printStackTrace();\r\n } catch (IOException ex) {\r\n System.out.println(\"There was an error reading your save game :(\");\r\n ex.printStackTrace();\r\n System.out.println(\")\");\r\n } catch (ClassNotFoundException ex) {\r\n System.out.println(\"The version of the save game is not compatible with this game!\");\r\n ex.printStackTrace();\r\n } catch (UnsupportedClassVersionError ex) {\r\n System.out.println(ex.getMessage());\r\n ex.printStackTrace();\r\n } catch (Exception ex) {\r\n System.out.println(\"An unknown error occurred!\");\r\n }\r\n\r\n }", "public Serializable readObject(){\n Serializable loadedObject = null;\n try {\n FileInputStream fileIn = new FileInputStream(name);\n ObjectInputStream in = new ObjectInputStream(fileIn);\n loadedObject = (Serializable) in.readObject();\n in.close();\n fileIn.close();\n System.out.println(\"Data loaded from: \"+ name);\n } \n catch (IOException i) {\n System.out.println(\"File not found.\");\n } \n catch (ClassNotFoundException c) {\n System.out.println(\"Class not found\");\n }\n return loadedObject;\n }", "void loadFromFile() {\n\t\ttry {\n\t\t\tFile directory = GameApplication.getInstance().getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS);\n\t\t\tFile source = new File(directory, FILE_NAME);\n\t\t\tMap<String, Scoreboard> scoreboards = new HashMap<String, Scoreboard>();\n\t\t\tif (source.exists()) {\n\t\t\t\tJsonReader reader = new JsonReader(new FileReader(source));\n\t\t\t\treader.beginArray();\n\t\t\t\twhile (reader.hasNext()) {\n\t\t\t\t\tScoreboard scoreboard = readScoreboard(reader);\n\t\t\t\t\tscoreboards.put(scoreboard.getName(), scoreboard);\n\t\t\t\t}\n\t\t\t\treader.endArray();\n\t\t\t\treader.close();\n\t\t\t} else {\n\t\t\t\tsource.createNewFile();\n\t\t\t}\n\t\t\tthis.scoreboards = scoreboards;\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void loadPersistence() {\n\t\tFile file = new File(\"data.txt\");\n\t\tif (file.length() == 0) { // no persistent data to use\n\t\t\treturn;\n\t\t}\n\t\tdeserializeFile(file);\n\t\tloadPersistentSettings();\n\t}", "private static void loadSoFromInternalStorage(String fileName) throws UnsatisfiedLinkError {\n String path = System.getProperties().get(\"java.io.tmpdir\").toString().replace(\"/cache\", \"/files/\" + fileName);\n File file = new File(path);\n SecurityManager security = System.getSecurityManager();\n if (security != null) {\n security.checkLink(file.getAbsolutePath());\n }\n System.load(file.getAbsolutePath());\n }", "private void loadDataFromMemory(String filename){\n shoppingList.clear();\n new ReadFromMemoryAsync(filename, getCurrentContext(), new ReadFromMemoryAsync.AsyncResponse(){\n\n @Override\n public void processFinish(List<ShoppingItem> output) {\n shoppingList.addAll(output);\n sortItems();\n }\n }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);\n// for (ShoppingItem item: items) {\n// shoppingList.add(item);\n// }\n// sortItems();\n }", "@Override\n public boolean load(String file) {\n try {\n FileInputStream streamIn = new FileInputStream(file);\n ObjectInputStream objectinputstream = new ObjectInputStream(streamIn);\n WGraph_Algo readCase = (WGraph_Algo) objectinputstream.readObject();\n this.ga=null;//initialize the graph\n this.ga=readCase.ga;//take the graph from readCase to this.ga\n }\n catch(Exception e) {\n e.printStackTrace();\n }\n return false;\n }", "public void load(String filename) {\n\t\tsetup();\n\t\tparseOBJ(getBufferedReader(filename));\n\t}", "public static Object readObjectFromFile(File file)\n/* */ throws IOException, ClassNotFoundException\n/* */ {\n/* 109 */ ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(new GZIPInputStream(new FileInputStream(file))));\n/* 110 */ Object o = ois.readObject();\n/* 111 */ ois.close();\n/* 112 */ return o;\n/* */ }", "public void load(){\n Player temp;\n try{\n FileInputStream inputFile = new FileInputStream(\"./data.sec\");\n ObjectInputStream objectIn = new ObjectInputStream(inputFile);\n temp = (Player)objectIn.readObject();\n Arena.CUR_PLAYER = temp;\n objectIn.close();\n inputFile.close(); \n }\n catch(FileNotFoundException e ){\n System.err.print(\"data.sec not found\");\n }\n catch(IOException e){\n System.out.println(\"Error 201\");\n }\n catch(ClassNotFoundException e){\n System.out.println(\"Error 202\");\n }\n }", "public static Object loadObject(File file) throws Exception {\n FileInputStream fin = new FileInputStream(file);\n ObjectInputStream ois = new ObjectInputStream(fin);\n Object obj = ois.readObject();\n ois.close();\n return obj;\n }", "void load(final File file) {\n this.file = Preconditions.checkNotNull(file);\n this.gameModelPo = gameModelPoDao.loadFromFile(file);\n visibleAreaService.setMapSize(getMapSize());\n initCache();\n }", "public static Monde loadContext(String filePath) throws IOException, ClassNotFoundException {\n\t\tFileInputStream fin = new FileInputStream(filePath);\n\t\tObjectInputStream ois = new ObjectInputStream(fin);\n\t\tMonde monde = (Monde) ois.readObject();\n\t\tois.close();\n\t\treturn monde;\n\t}", "public abstract Object unMarshal(File pobjFile);", "public static Object openObj(File file, URLClassLoader loader)\n {\n try(ForeignObjectInputStream ois = new ForeignObjectInputStream(new FileInputStream(file), loader))\n {\n return ois.readObject();\n }\n \n catch(Exception e)\n {\n return null;\n }\n }", "public static Object load(String fileName) throws Exception {\r\n\t\ttry (ObjectInputStream in = new ObjectInputStream( Files.newInputStream(Paths.get(fileName)) )) {\r\n\t\t\treturn in.readObject();\r\n\t }\r\n\t}", "public void loadMem(final File file) {\r\n TempMem.clearNamdAddresses();\r\n TempMem.setText(Input.loadFile(file));\r\n }", "public void load() throws ClassNotFoundException, IOException;", "public abstract void load() throws IOException;", "public BrickStructure loadStructureFromBinaryFile(File file) {\n\t\tthrow new NullPointerException();\n\t}", "public static Game loadGame(String fileName){\n Game game = null;\n try {\n File file1 = new File(fileName);\n FileInputStream fileInputStream = new FileInputStream(file1);\n ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);\n game = (Game) objectInputStream.readObject();\n game.makeGUIVisible();\n }catch (Exception e){\n System.err.println(\"Error when loading file\");\n }\n return game;\n }", "@SuppressWarnings(\"unchecked\")\n\tprivate void readFromFile() throws IOException, ClassNotFoundException {\n\t\ttry {\n\t\t\tInputStream file = new FileInputStream(pathName);\n\n\t\t\tInputStream buffer = new BufferedInputStream(file);\n\n\t\t\tObjectInput input = new ObjectInputStream(buffer);\n\n\t\t\ttagToImg = (Map<String, HashSet<String>>) input.readObject();\n\n\t\t\tinput.close();\n\t\t\tfile.close();\n\t\t} catch (EOFException e) {\n\t\t\ttagToImg = new HashMap<String, HashSet<String>>();\n\t\t} catch (InvalidClassException e) {\n\t\t\tSystem.out.println(\"file doesnt match the type\");\n\t\t}\n\t}", "public void load() ;", "public void load(String path) throws IOException, ClassNotFoundException {\n FileInputStream inputFile = new FileInputStream(path);\n ObjectInputStream objectInput = new ObjectInputStream(inputFile);\n\n map = (String[]) objectInput.readObject();\n\n objectInput.close();\n inputFile.close();\n }", "public void loadFile(File p_file) throws IOException;", "public static Object loadObjFromFile(String filePath)\n throws IOException, ClassNotFoundException {\n FileInputStream file = new FileInputStream(filePath);\n ObjectInputStream in = new ObjectInputStream(file);\n Object obj = in.readObject();\n in.close();\n return obj;\n }", "public void loadMaze(){\n try {\n byte savedMazeBytes[] = null;\n InputStream in = new MyDecompressorInputStream(new FileInputStream(\"savedMaze.maze\"));\n savedMazeBytes = new byte[1000012];\n in.read(savedMazeBytes);\n in.close();\n this.maze=new Maze(savedMazeBytes);\n isMazeGenerated=true;\n setChanged();\n notifyObservers();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n }", "public void load (IFile file) throws Exception;", "public static Object loadObject(File file) throws XmlParseException, IOException\n {\n return objectFromXmlElement(Xmlwise.loadXml(file));\n }", "void load();", "void load();", "public int loadFile(File file)\r\n {\r\n try \r\n {\r\n ObjectInputStream src = new ObjectInputStream(new FileInputStream(file));\r\n root = (Person)src.readObject();\r\n return 0;\r\n } \r\n catch (FileNotFoundException ex) \r\n {\r\n System.out.println(\"A file related error has occurred while loading file: \" + ex);\r\n return 1;\r\n } \r\n catch (IOException | ClassNotFoundException ex) \r\n {\r\n System.out.println(\"A file related error has occurred while loading file: \" + ex);\r\n return 1;\r\n }\r\n }", "private Object deserializeObject(String filename)\n throws FileNotFoundException, IOException, ClassNotFoundException\n {\n if (filename == null)\n {\n throw new NullPointerException(\"filename\");\n }\n if (filename.isEmpty())\n {\n throw new IllegalArgumentException(\"filename\");\n }\n synchronized(filename)\n {\n FileInputStream fileIn = new FileInputStream(filename);\n ObjectInputStream in = new ObjectInputStream(fileIn);\n Object result = in.readObject();\n in.close();\n fileIn.close();\n return result;\n }\n }", "private Object loadObject(File dir) throws FileNotFoundException, IOException, ClassNotFoundException {\r\n FileInputStream fis = new FileInputStream(dir);\r\n ObjectInputStream ois = new ObjectInputStream(fis);\r\n Object tmp = ois.readObject();\r\n ois.close();\r\n return tmp;\r\n }", "public void loadMemory(String inputFile){\n\t\tint pc = 0;\n\t\ttry{\n\t\t\tRandomAccessFile raf = new RandomAccessFile(new File(inputFile),\"rw\");\n\t\t\tString strLine;\n\t\t\tint decimalNumber;\n\t\t\twhile ((strLine = raf.readLine())!=null){\n\t\t\t\tstrLine = strLine.substring(0, 8); //get the first 8 char(hex instruction)\n\t\t\t\tdecimalNumber = new BigInteger(strLine, 16).intValue(); //decode the hex into integer\n\t\t\t\tloadInstructionInMemory(pc, decimalNumber);\n\t\t\t\tpc += 4;\n\t\t\t}\n\t\t\traf.close();\n\t\t}\n\t\tcatch (Exception e){\n\t\t\tSystem.out.println(\"Error:\");\n\t\t\tSystem.out.println(e.getMessage());\n\t\t\tSystem.exit(0);\n\t\t}\n\t}", "public static GameWorld loadGame(File gameLoad) throws PersistenceException {\n try {\n // setup: create a save file and a JAXB Unmarshaller for the class\n JAXBContext gameContext = JAXBContext.newInstance(GameWorld.class);\n Unmarshaller gameUnmarshaller = gameContext.createUnmarshaller();\n\n // load a java object from the XML file\n return (GameWorld) gameUnmarshaller.unmarshal(gameLoad);\n\n } catch (JAXBException e) {\n throw new PersistenceException(\"Failed to load the GameWorld file. \\n\", e);\n }\n }", "public void load();", "public void load();", "public MemoryStore(String filename) throws IOException {\n\t\t// create a new input stream\n\t\tFileInputStream input = new FileInputStream(filename);\n\t\t\n\t\t// create a place to store the words we read in\n\t\tbyte[] b = new byte[4];\n\t\t\n\t\t// read in the data in the given file\n\t\twhile (input.read(b) != -1) {\n\t\t\tif (memory.size() == 1027) {\n\t\t\t\tint foo = 1;\n\t\t\t}\n\t\t\t// create a word from the 4 bytes\n\t\t\tlong word = getUnsignedValue(b[0]);\n\t\t\tword += getUnsignedValue(b[1]) << 8;\n\t\t\tword += getUnsignedValue(b[2]) << 16;\n\t\t\tword += getUnsignedValue(b[3]) << 24;\n\t\t\t\n\t\t\t// add the word to our memory store\n\t\t\t//memory.add(word);\n\t\t}\n\t\tlong c;\n //00000001 00101010 01000000 00100000\n c = (((long) 0x01) << 24) + (((long) 0x2A) << 16) + (((long) 0x40) << 8) + ((long) 0x20);\n\t\tmemory.add(new Long(c));\n c = ((long) 0xFC) << 24;\n System.out.println(c);\n\t\tmemory.add(new Long(c));\n\t}", "@Override\n\tpublic void init(String file_name) { deserialize(file_name); }", "public static Object loadObject(String filename) throws XmlParseException, IOException\n {\n return loadObject(new File(filename));\n }", "public static Object readObjectFromFileNoExceptions(File file)\n/* */ {\n/* 133 */ Object o = null;\n/* */ try {\n/* 135 */ ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(new GZIPInputStream(new FileInputStream(file))));\n/* 136 */ o = ois.readObject();\n/* 137 */ ois.close();\n/* */ } catch (IOException e) {\n/* 139 */ e.printStackTrace();\n/* */ } catch (ClassNotFoundException e) {\n/* 141 */ e.printStackTrace();\n/* */ }\n/* 143 */ return o;\n/* */ }", "public void LoadMaze(File file) {\r\n try {\r\n ObjectInputStream in = new ObjectInputStream(new FileInputStream(file));\r\n Maze m = (Maze) in.readObject();\r\n PlayerPositionRow = (int) in.readObject();\r\n PlayerPositionCol = (int) in.readObject();\r\n maze = new Maze(m.Struct);\r\n maze.setStartPotision( new Position(PlayerPositionRow, PlayerPositionCol));\r\n maze.setGoalPosition(new Position(m.getGoalPosition().getRowIndex(), m.getGoalPosition().getColIndex()));\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n } catch (ClassNotFoundException e) {\r\n e.printStackTrace();\r\n }\r\n setChanged();\r\n notifyObservers(\"load\");\r\n }", "public boolean load(String file);", "public void setInMemory(boolean load);", "public Memory(String file) {\n\t\tfor(int i=0; i < Constants.MEM_SIZE; ++i){\n\t\t\tmemory[i] = 0;\n\t\t}\n\t\tinstructions = new FileProcessor(file).fetchInstructions();\n\t}", "public void\tload(String fileName) throws IOException;", "public void load() throws IOException, ClassNotFoundException {\n\t\ttry {\n\t\t\t// use buffering\n\t\t\tFile gamesInFile = new File(\"games.txt\");\n\t\t\tif (!gamesInFile.exists())\n\t\t\t\tSystem.out.println(\"First run\");\n\t\t\telse {\n\t\t\t\tInputStream file = new FileInputStream(gamesInFile);\n\t\t\t\tInputStream buffered = new BufferedInputStream(file);\n\t\t\t\tObjectInput input = new ObjectInputStream(buffered);\n\t\t\t\ttry {\n\t\t\t\t\t// deserialize the List\n\t\t\t\t\tArrayList<MancalaGame> gamesFromFile = (ArrayList<MancalaGame>) input.readObject();\n\t\t\t\t\tgames = gamesFromFile;\n\t\t\t\t} finally {\n\t\t\t\t\tinput.close();\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tSystem.out.println(\"Load successful\");\n\t\t}\n\t}", "public static XmlSerializableCatalogue loadDataFromSaveFile(File file) throws DataConversionException,\n FileNotFoundException {\n try {\n return XmlUtil.getDataFromFile(file, XmlSerializableCatalogue.class);\n } catch (JAXBException e) {\n throw new DataConversionException(e);\n }\n }", "public void loadSaveGameFromFile(File file) {\r\n\t\t//TODO\r\n\t}", "@Override\n\tpublic Object load(String path, Object defaultObject) throws Exception {\n\t\tfinal Object[] object = new Object[1];\n\t\t\n\t\t// Stream\n\t\ttry {\n\t\t\tfinal FileInputStream fis = new FileInputStream(path);\n\t\t\tfinal ObjectInputStream ois = new ObjectInputStream(fis);\n\n\t\t\t// Load an object\n\t\t\tobject[0] = ois.readObject();\n\n\t\t\t// Close stream\n\t\t\tois.close();\n\t\t} catch (FileNotFoundException fileNotFoundException){\n\t\t\t// Assign default object when the file is not found.\n\t\t\tobject[0] = defaultObject;\n\t\t}\n\t\t\n\t\t// Return object\n\t\treturn object[0];\n\t}", "private void loadFromFile() {\n try {\n /* Load in the data from the file */\n FileInputStream fIn = openFileInput(FILENAME);\n BufferedReader inRead = new BufferedReader(new InputStreamReader(fIn));\n\n /*\n * access from the GSON file\n * Taken from lonelyTwitter lab code\n */\n Gson gson = new Gson();\n Type listType = new TypeToken<ArrayList<Counter>>() {}.getType();\n counters = gson.fromJson(inRead, listType);\n\n } catch (FileNotFoundException e) {\n counters = new ArrayList<Counter>();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }", "public void load(){\n\t\n\t\ttry {\n\t\t\t\n\t\t\t// Open Streams\n\t\t\tFileInputStream inFile = new FileInputStream(\"user.ser\");\n\t\t\tObjectInputStream objIn = new ObjectInputStream(inFile);\n\t\t\t\n\t\t\t// Load the existing UserList at the head\n\t\t\tthis.head = (User)objIn.readObject();\n\t\t\t\n\t\t\t// Close Streams\n\t\t\tobjIn.close();\n\t\t\tinFile.close();\n\t\t}\n\n\t\tcatch(Exception d) {\n\t\t System.out.println(\"Error loading\");\n\t\t}\n\n\t}", "public static void load() {\n }", "public static final Object deserializeFromFile(String filename)\n\t{\n\t\tObject object = null;\n\n\t\t// Define local constants.\n\n\t\tString METHOD_NAME = \"deserializeFromFile\";\n\n\t\t// Check the parameters received and throw the appropriate\n\t\t// exception if necessary.\n\n\t\tif (null == filename)\n\t\t{\n\t\t\tthrow new NullPointerException(Messages.buildErrorMessage(CLASS_NAME,\n\t\t\t METHOD_NAME,\n\t\t\t Messages.NULL_PARAMETER_MSG));\n\t\t}\n\n\t\tif (0 == filename.length())\n\t\t{\n\t\t\tthrow new IllegalArgumentException(Messages.buildErrorMessage(CLASS_NAME,\n\t\t\t METHOD_NAME,\n\t\t\t Messages.ZERO_LENGTH_PARAMETER_MSG));\n\t\t}\n\n\t\ttry\n\t\t{\n\t\t\tObjectInputStream objectInputStream =\n\t\t\t\tnew ObjectInputStream(new FileInputStream(filename));\n\t\t\tobject = objectInputStream.readObject();\n\t\t\tobjectInputStream.close();\n\t\t}\n\n\t\tcatch (IOException exception)\n\t\t{\n\t\t\tSystem.out.println(\"Caught: \" + exception);\n\t\t}\n\n\t\tcatch (ClassNotFoundException exception)\n\t\t{\n\t\t\tSystem.out.println(\"Caught: \" + exception);\n\t\t}\n\n\t\treturn object;\n\t}", "public void load() {\n }", "private void loadData(){\n try (BufferedReader br = new BufferedReader(new FileReader(this.fileName))) {\n String line;\n while((line=br.readLine())!=null){\n E e = createEntity(line);\n super.save(e);\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "public static boolean loadManager() {\n\t\tPath filePath = getPath();\n\t\tif (Files.exists(filePath)) {\n\t\t\tbyte[] bytesArray;\n\t\t\ttry {\n\t\t\t\tbytesArray = CompressionUtil.decompressToByteArray(filePath);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t\treturn false;\n\t\t\t}\t \n\t\n\t ObjectManager om = null;\n\t try {\n\t \tByteArrayInputStream bi = new ByteArrayInputStream(bytesArray);\n\t \tObjectInputStream oi = new ObjectInputStream(bi); \n\t\t\t\tom = (ObjectManager) oi.readObject();\n\t\t\t} catch (ClassNotFoundException | IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t\treturn false;\n\t\t\t}\n\t om.recover();\n\t manager = om;\n\t\t} else {\n\t\t\tmanager = new ObjectManager();\n\t\t}\n return true;\n\t}", "public abstract void load();", "@SuppressWarnings(\"unchecked\")\n\tpublic static <T extends Serializable> T deserialize(File file, Object target)\n\t\t\tthrows IOException, ClassNotFoundException, ClassCastException {\n\t\tFileInputStream fileStream = new FileInputStream(file);\n\t\tObjectInputStream inStream = new ObjectInputStream(fileStream);\n\t\tObject o = inStream.readObject();\n\t\tinStream.close();\n\t\tfileStream.close();\n\t\treturn (T) o;\n\t}", "Object loadObject() throws Exception;", "public void LoadBinaryFile(String filename) throws RuntimeException\n {\n byte bytepair[];\n int memPtr = 0;\n\n bytepair = new byte[2];\n File theFile = new File(filename);\n if (!theFile.exists())\n throw new RuntimeException(Constants.Error(Constants.FILE_NOT_FOUND) + \" \" + filename);\n try\n {\n FileInputStream is = new FileInputStream(theFile);\n int readingdata = is.read(bytepair);\n while (readingdata > 0)\n {\n if (memPtr >= PROGRAM_MEMORY_SIZE)\n throw new RuntimeException(Constants.Error(Constants.OUT_OF_MEMORY));\n this.setProgramMemory(memPtr++,Utils.unsigned_byte(bytepair[0]) + (Utils.unsigned_byte(bytepair[1]) << 8));\n readingdata = is.read(bytepair);\n }\n is.close();\n }\n catch (IOException e)\n {\n System.err.println(\"Error reading in binary file \" + filename);\n System.err.println(e.toString());\n System.exit(-1);\n }\n return;\n }", "private DefaultBuildContextState loadState(File stateFile) {\n try {\n ObjectInputStream is =\n new ObjectInputStream(new GZIPInputStream(new BufferedInputStream(new FileInputStream(\n stateFile))));\n try {\n return (DefaultBuildContextState) is.readObject();\n } finally {\n try {\n is.close();\n } catch (IOException e) {\n // ignore secondary exceptions\n }\n }\n } catch (FileNotFoundException e) {\n // this is expected, ignore\n } catch (Exception e) {\n log.debug(\"Could not read build state file {}\", stateFile, e);\n }\n return DefaultBuildContextState.emptyState();\n }", "void massiveModeLoading( File dataPath );", "public static void load() {\n load(false);\n }", "private void Load( String szFileName )\n throws FileNotFoundException, NullPointerException, AppException\n {\n FileInputStream fs = null;\n File f = null;\n long nFileSize;\n \n f = new File( szFileName );\n if( !f.exists() || !f.canRead() )\n throw new FileNotFoundException( \"File \" + f.getPath() );\n\n try\n {\n nFileSize = f.length();\n fs = new FileInputStream( f );\n\n CharsetDecoder utf8Decoder = Charset.forName( \"UTF-8\" ).newDecoder();\n byte[] Data = null;\n\n // Read user name length and user name in UTF8\n if( nFileSize < 2 )\n throw new AppException( \"Bad file \" + f.getPath() );\n int nLength = (fs.read() << 8) | fs.read();\n nFileSize -= 2;\n if( nFileSize < nLength )\n throw new AppException( \"Bad file \" + f.getPath() );\n nFileSize -= nLength;\n Data = new byte[nLength];\n fs.read( Data );\n m_UserName = utf8Decoder.decode( ByteBuffer.wrap( Data ) ).toString();\n\n // Read user unique ID\n if( nFileSize < 16 )\n throw new AppException( \"Bad file \" + f.getPath() );\n nFileSize -= 16;\n m_Key = new byte[16];\n fs.read( m_Key );\n\n // Read template length and template data\n if( nFileSize < 2 )\n throw new AppException( \"Bad file \" + f.getPath() );\n nLength = (fs.read() << 8) | fs.read();\n nFileSize -= 2;\n if( nFileSize != nLength )\n throw new AppException( \"Bad file \" + f.getPath() );\n m_Template = new byte[nLength];\n fs.read( m_Template );\n fs.close();\n }\n catch( SecurityException e )\n {\n if( f == null )\n throw new AppException( \"Denies read access to the file \" + f.getPath() );\n else {\n throw new AppException( \"Denies read access to the file \" + szFileName );\n }\n }\n catch( IOException e)\n {\n if( f == null )\n throw new AppException( \"Bad file \" + f.getPath() );\n else\n throw new AppException( \"Bad file \" + szFileName );\n }\n }", "public static Object deserialize(String fileName) throws IOException, ClassNotFoundException {\n\t\tFileInputStream fis = new FileInputStream(fileName);\n\t\tObjectInputStream ois = new ObjectInputStream(fis);\n\t\tObject obj = ois.readObject();\n\t\tois.close();\n\t\treturn obj;\n\t}", "public void loadScoreFile() {\n try {\n inputStream = new ObjectInputStream(new FileInputStream(HIGHSCORE_FILE));\n scores = (ArrayList<Score>) inputStream.readObject();\n } catch (FileNotFoundException e) {\n } catch (IOException e) {\n } catch (ClassNotFoundException e) {\n } finally {\n try {\n if (outputStream != null) {\n outputStream.flush();\n outputStream.close();\n }\n } catch (IOException e) {\n }\n }\n }", "public static void load() {\r\n\t\tString mar = new String(readMAR().getStr());\r\n\t\tTraceINF.write(\"Read memory \"+mar);\r\n\t\tFormatstr content = new Formatstr();\r\n//\t\tSystem.out.println(\"index\"+Integer.parseInt(mar.substring(0, mar.length() - 2), 2));\r\n\t\tcontent.setStr(getBank(mar)[Integer.parseInt(mar.substring(0, mar.length() - 2), 2)]);\r\n\t\t\r\n\t\twriteMBR(content);\r\n\t\tTraceINF.write(\"Read finished.\");\r\n\t}", "public void load(File source);", "@SuppressWarnings(\"unchecked\")\n public static void load() {\n\n System.out.print(\"Loading team data from file...\");\n\n try {\n\n String team_fil = config.Server.serverdata_file_location + \"/teams.ser\";\n\n FileInputStream fil = new FileInputStream(team_fil);\n ObjectInputStream in = new ObjectInputStream(fil);\n\n team_list = (ConcurrentHashMap<Integer, Team>) in.readObject();\n cleanTeams();\n\n fil.close();\n in.close();\n\n //Gå gjennom alle lagene og registrer medlemmene i team_members.\n Iterator<Team> lag = team_list.values().iterator();\n\n while (lag.hasNext()) {\n\n Team laget = lag.next();\n\n Iterator<TeamMember> medlemmer = laget.getTeamMembers();\n while (medlemmer.hasNext()) {\n registerMember(medlemmer.next().getCharacterID(), laget.getTeamID());\n }\n\n }\n\n System.out.println(\"OK! \" + team_list.size() + \" teams loaded.\");\n\n } catch (Exception e) {\n System.out.println(\"Error loading team data from file.\");\n }\n\n }", "public static Vector<Mesh> loadObj(String filename) {\n MeshReader mr = new MeshReader(filename);\n mr.read();\n return mr.getMeshes();\n }", "private void loadFromDisk(String filename) throws IOException {\n Reader r = new FileReader(filename);\r\n load(r);\r\n }", "public static XmlSerializableResidentBook loadDataFromSaveFile(File file) throws DataConversionException,\n FileNotFoundException {\n try {\n return XmlUtil.getDataFromFile(file, XmlSerializableResidentBook.class);\n } catch (JAXBException e) {\n throw new DataConversionException(e);\n }\n }", "public void load() {\n\t}", "public StillModel loadModel(String filepath);", "private void readFromFile(String path) throws ClassNotFoundException {\n\t\ttry {\n\t\t\tInputStream file = new FileInputStream(path);\n\t\t\tInputStream buffer = new BufferedInputStream(file);\n\t\t\tObjectInput input = new ObjectInputStream(buffer);\n\n\t\t\ttagList = (HashMap<String, Integer>) input.readObject();\n\t\t\tinput.close();\n\t\t} catch (IOException ex) {\n\t\t\tSystem.out.println(\"Cannot read from input.\");\n\t\t}\n\t}", "public void loadFromOBJ(Context context, String filename) {\n loadFromOBJThreaded(context, filename);\n loadObjData();\n }", "public void DesSerializar() throws FileNotFoundException {\n try {\n FileInputStream archivo = new FileInputStream(\"SerializacionEdificios\");\n ObjectInputStream entrada = new ObjectInputStream(archivo);\n ArrayList<Edificio> edificiosDes = (ArrayList<Edificio>) entrada.readObject();\n archivo = new FileInputStream(\"SerializacionEstudiantes\");\n entrada = new ObjectInputStream(archivo);\n ArrayList<Estudiante> estudiantesDes = (ArrayList<Estudiante>) entrada.readObject();\n archivo = new FileInputStream(\"SerializacionProfesores\");\n entrada = new ObjectInputStream(archivo);\n ArrayList<Profesor> profesoresDes = (ArrayList<Profesor>) entrada.readObject();\n archivo = new FileInputStream(\"SerializacionAdministradores\");\n entrada = new ObjectInputStream(archivo);\n ArrayList<Administrador> administradoresDes = (ArrayList<Administrador>) entrada.readObject();\n edificios = edificiosDes;\n estudiantes = estudiantesDes;\n profesores = profesoresDes;\n administradores = administradoresDes;\n entrada.close();\n }\n catch (IOException e){\n e.printStackTrace();\n }\n catch (ClassNotFoundException e){\n e.printStackTrace();\n }\n\n\n }", "public Moment[] loadMomentsFile(){\n //Log.v(\"loadMain\", getApplicationContext().getFilesDir().getAbsolutePath());\n FileInputStream fin = null;\n Moment []pup = null;\n try {\n fin = openFileInput(MomentsFragment.MOMENTS_FILENAME);\n ObjectInputStream ois = new ObjectInputStream(fin);\n pup = (Moment [])ois.readObject();\n ois.close();\n fin.close();\n }catch (FileNotFoundException e) {\n //e.printStackTrace();\n Log.w(LOG_TAG, \"File not found, will be created once data is inserted\");\n } catch (IOException e) {\n e.printStackTrace();\n } catch (ClassNotFoundException e) {\n e.printStackTrace();\n }finally {\n if (pup == null)\n return new Moment[0];\n return pup;\n }\n }", "public static Object readObjectFromFile(String filename)\n/* */ throws IOException, ClassNotFoundException\n/* */ {\n/* 122 */ return readObjectFromFile(new File(filename));\n/* */ }", "public void load( String fileName ) {\n System.out.println( \"Loading: \" + fileName );\n this.name = fileName;\n Object obj = null;\n try {\n FileInputStream fis = new FileInputStream(fileName);\n ObjectInputStream oos = new ObjectInputStream( fis );\n obj = oos.readObject();\n dofs = (double[][]) obj;\n oos.close();\n fis.close();\n } catch ( Exception e ) {\n e.printStackTrace();\n } \n }", "private static Object deserialize(String path) {\n Object e = null;\n try {\n discAccesses++;\n FileInputStream fileIn = new FileInputStream(path);\n ObjectInputStream in = new ObjectInputStream(fileIn);\n e = in.readObject();\n in.close();\n fileIn.close();\n } catch (IOException | ClassNotFoundException i) {\n throw new Error(\"No serialized object for path \" + path);\n }\n return e;\n }", "@SuppressWarnings(\"unchecked\")\r\n\tpublic static Item loadItem(String filename)\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tObjectInputStream ois = new ObjectInputStream(new FileInputStream(new File(filename)));\r\n\t\t\tItem item = (Item)ois.readObject();\r\n\t\t\tois.close();\r\n\t\t\tSystem.out.println(\"Loaded item from disk: \" + item);\r\n\t\t\treturn item;\r\n\t\t} \r\n\t\tcatch (FileNotFoundException e2) \r\n\t\t{\r\n\t\t\tSystem.err.println(\"No locally saved \" + filename + \" - creating a new one: \" + e2.getMessage());\r\n\t\t}\r\n\t\tcatch (IOException e2) \r\n\t\t{\r\n\t\t\tSystem.err.println(\"IO Error: \" + e2.getMessage());\r\n\t\t} \r\n\t\tcatch (ClassNotFoundException e1) \r\n\t\t{\r\n\t\t\tSystem.err.println(\"This copy of the program is missing some files: \" + e1.getMessage());\r\n\t\t}\r\n\t\treturn null;\r\n\t}", "public static HighScoresTable loadFromFile(File filename) {\n HighScoresTable newScoresTable = new HighScoresTable(4);\n ObjectInputStream inputStream = null;\n try {\n inputStream = new ObjectInputStream(new FileInputStream(filename));\n List<ScoreInfo> scoreFromFile = (List<ScoreInfo>) inputStream.readObject();\n if (scoreFromFile != null) {\n //scoreFromFile.clear();\n newScoresTable.scoreInfoList.addAll(scoreFromFile);\n }\n } catch (FileNotFoundException e) { // Can't find file to open\n System.err.println(\"Unable to find file: \" + filename);\n //return scoresTable;\n } catch (ClassNotFoundException e) { // The class in the stream is unknown to the JVM\n System.err.println(\"Unable to find class for object in file: \" + filename);\n //return scoresTable;\n } catch (IOException e) { // Some other problem\n System.err.println(\"Failed reading object\");\n e.printStackTrace(System.err);\n //return scoresTable;\n } finally {\n try {\n if (inputStream != null) {\n inputStream.close();\n }\n } catch (IOException e) {\n System.err.println(\"Failed closing file: \" + filename);\n }\n }\n return newScoresTable;\n\n\n }", "public Graph load(String filename) throws IOException\n {\n return load(filename, new SparseGraph(), null);\n }", "@Override\n public void load() throws IOException, ClassNotFoundException {\n \n }", "protected Object readObject(String fileName) throws IOException, ClassNotFoundException {\r\n\t\tObject o = null;\r\n\t\tFileInputStream fis = new FileInputStream(fileName);\r\n\t\tObjectInputStream ois = new ObjectInputStream(fis);\r\n\t\to = ois.readObject();\r\n\t\tois.close();\r\n\t\tfis.close();\r\n\t\t\r\n\t\treturn (o);\r\n\t}", "@Nullable\n public String readFile(String fileName) throws IOException {\n ObjectId objectId = findFile(fileName);\n if (objectId == null) {\n return null;\n }\n\n ObjectLoader obj = reader.open(objectId, Constants.OBJ_BLOB);\n byte[] raw = obj.getCachedBytes(Integer.MAX_VALUE);\n\n if (raw.length == 0) {\n return null;\n }\n return RawParseUtils.decode(raw);\n }" ]
[ "0.6286914", "0.6272416", "0.61801565", "0.6177695", "0.61447364", "0.61086273", "0.60986733", "0.6090153", "0.60397685", "0.5996801", "0.59695226", "0.5931803", "0.59171474", "0.5897448", "0.57825875", "0.5775248", "0.57692224", "0.5760158", "0.5756674", "0.57294565", "0.5727545", "0.5720196", "0.5714419", "0.57133424", "0.56903267", "0.5682488", "0.5678044", "0.56661046", "0.56596285", "0.56533825", "0.5648837", "0.56230074", "0.5597211", "0.55848104", "0.55840814", "0.55792326", "0.557334", "0.55624586", "0.5557834", "0.5557676", "0.5556269", "0.5556269", "0.5549017", "0.5546088", "0.5545442", "0.55406815", "0.55389076", "0.55297756", "0.55297756", "0.5502551", "0.5491022", "0.54828936", "0.5458013", "0.54563904", "0.5454717", "0.5445126", "0.54393816", "0.54363155", "0.5422376", "0.5421257", "0.54165834", "0.54091424", "0.5404937", "0.54017514", "0.53995633", "0.53993195", "0.5392776", "0.53927565", "0.5381704", "0.536586", "0.5365094", "0.53643167", "0.53517383", "0.5351438", "0.5346259", "0.53459615", "0.53302884", "0.53287804", "0.5319526", "0.53189474", "0.5316833", "0.5313556", "0.53126043", "0.5284306", "0.5283022", "0.52798676", "0.52767986", "0.52734995", "0.5271045", "0.52676624", "0.5265221", "0.5253777", "0.52515507", "0.52508974", "0.52471465", "0.52268153", "0.5198733", "0.51922417", "0.5189001", "0.51810706" ]
0.626707
2
Update the counts of a specific long term memory
public void updateLongTermMemory(String board, int wins, int ties, int losses) { BoardRecord stm = longTermMemory.get(board); stm.setWins(wins); stm.setTies(ties); stm.setLosses(losses); longTermMemory.replace(board, stm); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public synchronized void updateMemory(){\n \tint memory = Math.round(System.getRuntime().totalMemory()/System.getRuntime().freeMemory());\n \tstore(new DisplayableData(\"memory\", \"M\"+memory+\"%\", memory));\n }", "@SuppressWarnings(\"deprecation\")\n private void updateResourceCounters() {\n updateHeapUsageCounter();\n\n // Updating resources specified in ResourceCalculatorProcessTree\n if (pTree == null) {\n return;\n }\n pTree.updateProcessTree();\n long cpuTime = pTree.getCumulativeCpuTime();\n long pMem = pTree.getCumulativeRssmem();\n long vMem = pTree.getCumulativeVmem();\n // Remove the CPU time consumed previously by JVM reuse\n cpuTime -= initCpuCumulativeTime;\n PSAgentContext.get().getMetrics().put(AngelCounter.CPU_MILLISECONDS, Long.toString(cpuTime));\n PSAgentContext.get().getMetrics().put(AngelCounter.PHYSICAL_MEMORY_BYTES, Long.toString(pMem));\n PSAgentContext.get().getMetrics().put(AngelCounter.VIRTUAL_MEMORY_BYTES, Long.toString(vMem));\n }", "@Override\n\tpublic void updateMemory(Map map) {\n\t\tif(!memory.used)\n\t\t\treset(map);\n\t\tspiral();\n\t}", "private void updateMemInfo() {\n\t\tproNum = getRunningNum();\r\n\r\n\t\ttv_pronum.setText(\"进程总数:\" + proNum);\r\n\r\n\t\ttv_mem.setText(\"剩余内存:\" + getRomAvailaleSize());\r\n\t}", "void updateFrequencyCount() {\n //Always increments by 1 so there is no need for a parameter to specify a number\n this.count++;\n }", "public void incrMetaCacheNumClearRegion(int count) {\n metaCacheNumClearRegion.inc(count);\n }", "int updateCount(double dist);", "private synchronized void incVMCount() {\n if (!VMCounted) {\n statistics().incInt(VM_COUNT, 1);\n VMCounted = true;\n }\n }", "long memoryUnused();", "private void incrementUsageCount() {\n usageCount++;\n }", "@Test\n public void testMemoryMetric() {\n MetricValue mv = new MetricValue.Builder().load(40).add();\n\n MEMORY_METRICS.forEach(cmt -> testUpdateMetricWithoutId(cmt, mv));\n MEMORY_METRICS.forEach(cmt -> testLoadMetric(nodeId, cmt, mv));\n }", "public void incrMetaCacheNumClearRegion() {\n metaCacheNumClearRegion.inc();\n }", "public void setMemory(ArrayList<Integer> oldList) {\n\t\tthis.memory = oldList;\n\t}", "private void updateCount(String word) {\n\t\t\tthis.count += invertedIndex.get(word).get(this.location).size();\n\t\t\tthis.score = (double) this.count / counts.get(this.location);\n\t\t}", "public void updateOccupancy() {\n currentOccupancyMatrix = new int[numRows][numCols];\n\n int i, j;\n Bag people = station.area.getAllObjects();\n for (int x = 0; x < people.size(); x++) {\n Double2D location = ((Person) people.get(x)).getLocation();\n i = (int) (location.getY() / (station.area.getHeight() / numRows));\n j = (int) (location.getX() / (station.area.getWidth() / numCols));\n if (j >= numCols) {\n j = numCols - 1;\n }\n occupancyMatrix[i][j]++;\n currentOccupancyMatrix[i][j]++;\n //System.out.println(\"updated\");\n }\n }", "public void updateCounts(WordCounter wordCounter) {\n wordCounter.wordMap.forEach((w, c) -> {\n wordMap.merge(w, c, Double::sum);\n });\n numDocs++;\n }", "long getUpdateCounts(int index);", "public void setUpdateOften(int i){\n countNum = i;\n }", "public void counter(MetricCounter<Long> metric, long value);", "long memoryUsed();", "long getMemory();", "long getMemory();", "public static void initializeMetrics()\n {\n // Get the Java runtime\n Runtime runtime = Runtime.getRuntime();\n // Run the garbage collector\n runtime.gc();\n \tstartingMemory = runtime.totalMemory() - runtime.freeMemory();\n }", "private void resetCurrentMemoryIndex() throws Exception {\n // by using the globalParameters, the memory index can startup counters etc.\n // we set the documentCount to ensure all documents are given a unique number.\n tupleFlowParameters.getJSON().set(\"documentNumberOffset\", this.globalDocumentCount);\n currentMemoryIndex = new MemoryIndex(tupleFlowParameters);\n }", "@Override\n\tpublic void updateStatisticCounts(long topicCoutn, long postCount)\n\t\t\tthrows Exception {\n\n\t}", "private void incrementGcCounter() {\n if (null == PSAgentContext.get().getMetrics()) {\n return; // nothing to do.\n }\n long elapsedGc = getElapsedGc();\n long totalGc = 0;\n String gc_time = PSAgentContext.get().getMetrics().get(AngelCounter.GC_TIME_MILLIS);\n if (gc_time != null) {\n totalGc = elapsedGc + Long.parseLong(gc_time);\n } else {\n totalGc = elapsedGc;\n }\n PSAgentContext.get().getMetrics().put(AngelCounter.GC_TIME_MILLIS, Long.toString(totalGc));\n }", "private void increment() {\n for (int i=0; i < 10000; i++) {\n count++;\n }\n }", "public long memory() {\n\treturn 0;\n }", "@Override\r\n\tpublic void updateCounter(CounterModel cm) {\n\t\thomedao.updateCounter(cm);\r\n\t}", "public abstract long estimateMemorySize();", "private void collectCpuMemoryUsage(){\r\n\t\tHmDomain hmDomain = CacheMgmt.getInstance().getCacheDomainByName(\"home\");\r\n\t\tfloat cpuUsage = LinuxSystemInfoCollector.getInstance().getCpuInfo() * 100;\r\n\t\tfloat memoryUsage = 0;\r\n\t\ttry {\r\n\t\t\tlong count[] = LinuxSystemInfoCollector.getInstance().getMemInfo();\r\n\t\t\tif(count[0] != 0){\r\n\t\t\t\tmemoryUsage = ((float)(count[0] - count[1] - count[2] - count[3]) * 100 / count[0]);\r\n\t\t\t}\r\n\t\t} catch (Exception e) {\r\n\t\t\tBeLogTools.error(HmLogConst.M_PERFORMANCE,\"calculate memory usage failure.\", e);\r\n\t\t}\r\n\t\tCpuMemoryUsage cmu = new CpuMemoryUsage();\r\n\t\tcmu.setCpuUsage(cpuUsage);\r\n\t\tcmu.setMemUsage(memoryUsage);\r\n\t\tcmu.setOwner(hmDomain);\r\n\t\tcmu.setTimeStamp((new Date()).getTime());\r\n\t\ttry {\r\n\t\t\tQueryUtil.createBo(cmu);\r\n\t\t} catch (Exception e) {\r\n\t\t\tBeLogTools.error(HmLogConst.M_PERFORMANCE,\"create CpuMemoryUsage failure.\", e);\r\n\t\t}\r\n\t}", "public void updateCounts() {\n\n Map<Feel, Integer> counts_of = new HashMap<>();\n\n for (Feel feeling : Feel.values()) {\n counts_of.put(feeling, 0);\n }\n\n for (FeelingRecord record : this.records) {\n counts_of.put(record.getFeeling(), counts_of.get(record.getFeeling()) + 1);\n }\n\n this.angry_count.setText(\"Anger: \" + counts_of.get(Feel.ANGER).toString());\n this.fear_count.setText(\"Fear: \" + counts_of.get(Feel.FEAR).toString());\n this.joyful_count.setText(\"Joy: \" + counts_of.get(Feel.JOY).toString());\n this.love_count.setText(\"Love: \" + counts_of.get(Feel.LOVE).toString());\n this.sad_count.setText(\"Sad:\" + counts_of.get(Feel.SADNESS).toString());\n this.suprise_count.setText(\"Suprise: \" + counts_of.get(Feel.SURPRISE).toString());\n }", "private void recalculateWordsInUse(){\n int i;\n for(i=wordsInUse-1;i>=0;i--)\n if(words[i]!=0)\n break;\n wordsInUse=i+1; // The new logical size\n }", "private void setMemorySize() { }", "void incrementCount();", "public static void getMemoryUsage(){\r\n MemoryMeasurement actMemoryStatus = new MemoryMeasurement();\r\n //MemoryMeasurement.printMemoryUsage(actMemoryStatus);\r\n memoryUsageList.add(actMemoryStatus);\r\n }", "public void setOldCardinalityNum(int param){\n \n // setting primitive attribute tracker to true\n localOldCardinalityNumTracker =\n param != java.lang.Integer.MIN_VALUE;\n \n this.localOldCardinalityNum=param;\n \n\n }", "public void setNewCardinalityNum(int param){\n \n // setting primitive attribute tracker to true\n localNewCardinalityNumTracker =\n param != java.lang.Integer.MIN_VALUE;\n \n this.localNewCardinalityNum=param;\n \n\n }", "public void incTotalOfQueueEntries() {\n totalOfQueueEntries++;\n }", "public void setMemoryEntries(MemoryEntry[] inMemory);", "void onUpdate(long diskUsageSample);", "private void updateStatsCAE(){\n\t\tupdateQueueSize();\n\t}", "public void increaseNumHits() {\n\t\tthis.numHits += 1;\n\t}", "public void incrMetaCacheNumClearServer() {\n metaCacheNumClearServer.inc();\n }", "public void resetCounters()\n {\n cacheHits = 0;\n cacheMisses = 0;\n }", "void count(long value);", "private void updateByteCount(Label byteCountLabel, Label byteCountUnit, String unit, Number newByteCount, double offset) {\n double byteCount = newByteCount.longValue() + offset;\n /*\n The size of a kilobyte in bytes\n */\n long kilobyte = 1024;\n double KBCount = byteCount / kilobyte;\n double displayedCount = KBCount;\n if(KBCount > 1024){\n double MBCount = KBCount / kilobyte;\n if(MBCount > 1024){\n displayedCount = MBCount / kilobyte;\n if(unit.compareTo(\"GB\")!=0){\n unit = \"GB\";\n byteCountUnit.setText(unit);\n }\n } else {\n displayedCount = MBCount;\n if(unit.compareTo(\"MB\")!=0){\n unit = \"MB\";\n byteCountUnit.setText(unit);\n }\n }\n }\n byteCountLabel.setText(String.valueOf(df.format(displayedCount)));\n }", "public HitCounterReadWriteLock() {\r\n hits = new int[300];\r\n times = new int[300];\r\n }", "@Override\n public void modify( MemoryGroupByMeta someMeta ) {\n someMeta.allocate( 5, 5 );\n }", "void refreshNodeHostCount(int nodeHostCount);", "public native int getTotalMemory();", "MailboxUsageMailboxCounts put(final MailboxUsageMailboxCounts newMailboxUsageMailboxCounts) throws ClientException;", "@Override\n public void updateProductCounter() {\n\n }", "@Override\n public void update(LabeledText labeledText){\n super.update(labeledText);\n\n /* FILL IN HERE */\n classCounts[labeledText.label]++;\n for (String ng: labeledText.text.ngrams) { \n \tfor (int h=0;h< nbOfHashes;h++) {\n \t\tcounts[labeledText.label][h][hash(ng,h)]++; \n \t}\n \t//System.out.println(\"Hash: \" + hash(ng) + \" Label : \" + labeledText.label + \" Update: \" + counts[labeledText.label][hash(ng)]);\n }\n \n }", "private void updateDDCount(HashMap<String, Integer> countMap, Path p) {\n if (p.size() <= 1)\n return;\n HashMap<GroumNode, String> labelMap = p.getLabelMap();\n GroumNode end = p.get(p.size() - 1);\n for (int i = 0; i < p.size() - 1; i++) {\n GroumNode start = p.get(i);\n String lable = labelMap.get(start) + Path.API_SPLIT + labelMap.get(end);\n Integer count = hasDataDependency(start, end) ? 1 : 0;\n if (countMap.containsKey(lable)) {\n count += countMap.get(lable);\n }\n countMap.put(lable, count);\n }\n }", "void forceStats(long operations, long hits);", "public void setCount(long val)\n\t{\n\t\tcount = val;\n\t}", "public void incrementCount() {\n count++;\n }", "static void inr_mem(String passed){\n\t\tint val = hexa_to_deci(memory.get(memory_address_hl()));\n\t\tval++;\n\t\tmemory.put(memory_address_hl(), decimel_to_hexa_8bit(val));\n\t\tmodify_status(memory.get(memory_address_hl()));\n\t}", "Update withReplicaCount(int count);", "void numberOfOpenMapInformation(int number, int pIndex);", "private void updateMetrics(CPUMetrics.CPU_STATE state, String instruction)\n {\n CPUMetrics metrics = new CPUMetrics(cpuNum);\n metrics.setTotalInstructionsNumber(jobCounter);\n metrics.setProgramCounter(programCounter);\n metrics.setCurrentJobNumber(currentJobNumber());\n metrics.setCurrentState(state);\n metrics.setCurrentInstruction(instruction);\n Driver.updateCpuMetric(metrics);\n }", "public void updateBallCount() {\n mBallCount = (int) NetworkTableInstance.getDefault().getTable(\"SmartDashboard\").getEntry(\"Driver/Set Ball Count\")\n .getDouble(3);\n }", "private void updateOsMetrics()\n {\n Driver.updateOsMetric();\n }", "public void increment(){\n\t\twordCount += 1;\n\t}", "public void setCounter(Short __newValue)\n {\n counter = __newValue;\n }", "public static void update_memory_r(Memory[] memory_r, int[] ncm_per_cycle_r,int cycle_num){\n\t\tfor(int i=0;i<48;i++){\n\t\t\tncm_per_cycle_r[cycle_num]+=memory_r[i].ncm;\n\t\t\tmemory_r[i].ncm=0;\n\t\t}\n\t}", "public void setCount(int newCount) {\r\n\t\tcount = newCount;\r\n\t}", "public void incrementCount(){\n count+=1;\n }", "public void update(long value) {\n\t\tcount.incrementAndGet();\n\t\tsample.update(value);\n\t\tsetMax(value);\n\t\tsetMin(value);\n\t\t_sum.getAndAdd(value);\n\t\tupdateVariance(value);\n\t}", "private void updateCountersOfMaps(final Daily_report report) {\n\n final boolean isHQ = AuthorityLevels.HEAD_QUARTER == report.getEmployee_mst().getEmp_settle_authority();\n final String branchCode = isHQ ? SummaryReportConstants.HQ_CODE : report.getDai_point_code();\n if (!this.reportedCompanies.contains(report.getDai_company_code())) {\n this.reportedCompanies.add(report.getCompany_mst().getCom_company_code());\n }\n this.updateCountersOfMap(this.mapBranchVsVisitTimes, branchCode);\n\n final String branchBusinessKey =\n String.format(SummaryReportService.BRANCH_BUSINESS_KEY_PATTERN, branchCode, report.getDai_bus_code());\n this.updateCountersOfMap(this.mapBranchBusinessTypeVsVisitTimes, branchBusinessKey);\n\n final String branchPurposeKey = String.format(SummaryReportService.BRANCH_PURPOSE_KEY_PATTERN, branchCode,\n report.getDai_work_tancode());\n this.updateCountersOfMap(this.mapBranchPurposeVsVisitTimes, branchPurposeKey);\n\n if (!this.mapBranchVsListEmployee.containsKey(branchCode)) {\n this.mapBranchVsListEmployee.put(branchCode, new ArrayList<Integer>());\n }\n final List<Integer> listEmployeesOfBranch = this.mapBranchVsListEmployee.get(branchCode);\n if (!listEmployeesOfBranch.contains(report.getDai_employee_code())) {\n listEmployeesOfBranch.add(report.getDai_employee_code());\n }\n\n this.mapBranchVsListEmployee.put(branchCode, listEmployeesOfBranch);\n\n final String branchEmployeeKey = String.format(SummaryReportService.BRANCH_EMPLOYEE_KEY_PATTERN, branchCode,\n report.getDai_employee_code());\n this.updateCountersOfMap(this.mapBranchEmployeeVsVisitTimes, branchEmployeeKey);\n\n final String branchEmployeeBusinessKey =\n String.format(SummaryReportService.BRANCH_EMPLOYEE_BUSINESS_KEY_PATTERN, branchCode,\n report.getDai_employee_code(), report.getDai_bus_code());\n this.updateCountersOfMap(this.mapBranchEmployeeBusinessVsVisitTimes, branchEmployeeBusinessKey);\n\n final String branchEmployeePurposeKey = String.format(SummaryReportService.BRANCH_EMPLOYEE_PURPOSE_KEY_PATTERN,\n branchCode, report.getDai_employee_code(), report.getDai_work_tancode());\n this.updateCountersOfMap(this.mapBranchEmployeePurposeVsVisitTimes, branchEmployeePurposeKey);\n\n final String branchCompanyKey = String.format(SummaryReportService.BRANCH_COMPANY_KEY_PATTERN, branchCode,\n report.getDai_company_code());\n this.updateCountersOfMap(this.mapBranchCompanyVsVisitTimes, branchCompanyKey);\n\n final String branchEmployeeCompanyKey = String.format(SummaryReportService.BRANCH_EMPLOYEE_COMPANY_KEY_PATTERN,\n branchCode, report.getDai_employee_code(), report.getDai_company_code());\n this.updateCountersOfMap(this.mapBranchEmployeeCompanyVsVisitTimes, branchEmployeeCompanyKey);\n }", "public void setCount(Long Count) {\n this.Count = Count;\n }", "public native long memoryConsumed();", "private void updateStatusInternal(){\n\t\tFile dataPath = Environment.getDataDirectory();\n\t\tStatFs stat = new StatFs(dataPath.getPath());\n\t\tlong blockSize = stat.getBlockSize();\n\t\tlong availableBlocks = stat.getAvailableBlocks();\n\t\t//show the space of internal storage\n\t\tmExternalTotalSpace=formatSize(availableBlocks * blockSize);\n\t}", "public abstract long count();", "public void updateProductViewCount(Product product) {\n\r\n\t}", "static void core_state_transition_loop(ShortWrapper p, byte[] memblock, int[] track_counts, int[] final_counts) {\n\t\twhile (memblock[p.value]!=0) {\n\t\t\tbyte fstate=core_state_transition(p,memblock,track_counts);\n\t\t\tfinal_counts[fstate]++;\n\t\t}\n\t}", "private void _updateCount(int classType) {\n int subClass, superClass;\n\n instances_[classType].count++;\n subClass = classType;\n while ( (superClass = CLASS_INFO[subClass][INDEX_SUPER]) != CS_C_NULL) {\n instances_[superClass].count++;\n subClass = superClass;\n }\n }", "void put(final MailboxUsageMailboxCounts newMailboxUsageMailboxCounts, final ICallback<? super MailboxUsageMailboxCounts> callback);", "public native long memoryRemaining();", "public void defaultUpdateCount(AcBatchFlight e)\n {\n }", "public void increseHitCount() {\n\r\n\t}", "public void defaultUpdateCount(AcProperty e)\n {\n }", "@Override\n\tpublic void count() {\n\t\t\n\t}", "private void updateRecordCount() {\n // Set the count to 0, if the storage can not be accessed then the stored record count\n // will be left as 0\n mStoredRecordCount = 0;\n File rootFolder = getBaseFolder();\n if (rootFolder == null) {\n return;\n }\n\n // Each directory in this folder represents one record.\n File[] fileList = rootFolder.listFiles();\n if (fileList != null) {\n for (File eachFile : fileList) {\n if (eachFile.isDirectory()) {\n mStoredRecordCount++;\n }\n }\n }\n }", "public abstract void setCntRod(int cntRod);", "@Override\r\n\tpublic void increaseViewcnt(int r_idx) {\n\r\n\t}", "private void setMemory() {\n\t\tlong allMemory = MemoryManager.getPhoneTotalRamMemory();\n\t\tlong freeMemory = MemoryManager.getPhoneFreeRamMemory(this);\n\t\tlong usedMemory = allMemory - freeMemory;\n\t\tint angle = (int) (usedMemory*360/allMemory);\n\t\tclearView.setAngleWithAnim(angle);\n\t}", "@Test\n public void testLIFOStatsUpdation() {\n try {\n assertNotNull(cache);\n LocalRegion rgn = (LocalRegion) cache.getRegion(SEPARATOR + regionName);\n assertNotNull(rgn);\n\n // check for is LIFO Enable\n assertTrue(\"Eviction Algorithm is not LIFO\",\n (((EvictionAttributesImpl) rgn.getAttributes().getEvictionAttributes()).isLIFO()));\n\n // put four entries into the region\n for (int i = 0; i < 8; i++) {\n rgn.put((long) i, (long) i);\n }\n\n assertTrue(\"In Memory entry count not 5 \",\n new Long(5).equals(lifoStats.getCounter()));\n\n // varifies evicted entry values are null in memory\n assertTrue(\"In memory \", rgn.entries.getEntry(5L).isValueNull());\n assertTrue(\"In memory \", rgn.entries.getEntry(6L).isValueNull());\n assertTrue(\"In memory \", rgn.entries.getEntry(7L).isValueNull());\n\n // get an entry back\n Long value = (Long) rgn.get(4L);\n value = (Long) rgn.get(5L);\n value = (Long) rgn.get(6L);\n\n // check for entry value\n assertTrue(\"Value not matched \", value.equals(6L));\n assertNull(\"Entry value in VM is not null\", rgn.getValueInVM(7L));\n\n assertTrue(\"Entry count not 7 \", new Long(7).equals(lifoStats.getCounter()));\n // check for destory\n rgn.destroy(3L);\n assertTrue(\"Entry count not 6 \", new Long(6).equals(lifoStats.getCounter()));\n // check for invalidate\n rgn.invalidate(1L);\n assertTrue(\"Entry count not 5 \", new Long(5).equals(lifoStats.getCounter()));\n // check for remove\n rgn.put(8L, 8L);\n rgn.remove(2L);\n assertTrue(\"Entry count not 4 \", new Long(4).equals(lifoStats.getCounter()));\n } catch (Exception ex) {\n ex.printStackTrace();\n fail(\"Test failed\");\n }\n\n }", "private synchronized void incrementCount()\n\t{\n\t\tcount++;\n\t}", "private final Map<String, String> memoryStats() {\n HashMap<String, String> map = new HashMap<String, String>();\r\n map.put(\"tableIndexChunkSize\", (!RAMIndex) ? \"0\" : Integer.toString(index.row().objectsize));\r\n map.put(\"tableIndexCount\", (!RAMIndex) ? \"0\" : Integer.toString(index.size()));\r\n map.put(\"tableIndexMem\", (!RAMIndex) ? \"0\" : Integer.toString((int) (index.row().objectsize * index.size() * kelondroRowCollection.growfactor)));\r\n return map;\r\n }", "public void incCount() { }", "public static void update_memory_rp(Memory[] memory_rp, int[] ncm_per_cycle_rp,int cycle_num){\n\t\tfor(int i=0;i<48;i++){\n\t\t\tncm_per_cycle_rp[cycle_num]+=memory_rp[i].ncm;\n\t\t\tmemory_rp[i].priority=threshold(memory_rp[i].ncm);\n\t\t\tmemory_rp[i].ncm=0;\n\t\t}\n\t}", "int fillCount();", "public long count() ;", "int getUpdateCountsCount();", "public void growStats() {\r\n\t\tLIFE += increment;\r\n\t\tSTRENGTH += increment;\r\n\t}", "public void incrementCount() {\n\t\tcount++;\n\t}", "public void increaseFeatureCount() {\n this.featureCount++;\n }", "private int retrieveCountFromMemory(String useridMin, String useridMax){\n int count = 0;\n int minCount = 0;\n int maxOneMoreCount = 0;\n\n String minKey = wholeCountData.ceilingKey(useridMin);\n String maxKey = wholeCountData.floorKey(useridMax);\n String maxOneMoreKey = wholeCountData.higherKey(maxKey);\n minCount = wholeCountData.get(minKey);\n maxOneMoreCount = wholeCountData.get(maxOneMoreKey);\n\n count = maxOneMoreCount - minCount;\n return count;\n }" ]
[ "0.6660036", "0.61332273", "0.59868675", "0.59372574", "0.58567405", "0.58271635", "0.58128035", "0.57339114", "0.57297313", "0.57154524", "0.5710903", "0.5709188", "0.5672283", "0.5653198", "0.56523454", "0.56366694", "0.55535626", "0.5488108", "0.548535", "0.5476312", "0.54655755", "0.54655755", "0.54605144", "0.54329836", "0.5416626", "0.54076725", "0.5400268", "0.5399715", "0.53973085", "0.5387133", "0.53625387", "0.5357008", "0.53455025", "0.53361297", "0.53293943", "0.53132355", "0.52817076", "0.52761465", "0.5274938", "0.5274534", "0.5266707", "0.5262785", "0.52571106", "0.52568597", "0.5253054", "0.5251447", "0.5242852", "0.52387786", "0.5236015", "0.52307945", "0.52307737", "0.5225321", "0.5224895", "0.52147466", "0.5213295", "0.5210253", "0.5198022", "0.51790917", "0.51775795", "0.5172503", "0.5168149", "0.51680505", "0.5161527", "0.51600885", "0.5158818", "0.5148593", "0.51450807", "0.51441985", "0.5141947", "0.5136123", "0.51353693", "0.51353395", "0.51238066", "0.51223654", "0.51202536", "0.5117665", "0.5117144", "0.5113092", "0.51098746", "0.5104126", "0.5100443", "0.50923425", "0.5085209", "0.50835943", "0.5079255", "0.5075221", "0.5073146", "0.5071853", "0.50671625", "0.5066037", "0.50648946", "0.5064051", "0.5061904", "0.5058875", "0.5051208", "0.5050861", "0.50484526", "0.50438243", "0.50418043", "0.5035927" ]
0.54710066
20
Print the value in a long term memory
private void getLongTermMemory(String board) { BoardRecord stm = longTermMemory.get(board); System.out.println(stm.getWins()); System.out.println(stm.getTies()); System.out.println(stm.getLosses()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void print()\n {\n StringBuffer buffer = new StringBuffer();\n for (int i = 0; i < memorySize; i++)\n {\n buffer.append(mainMemory[i]);\n }\n System.out.println(buffer.toString());\n }", "public void smem_print_store(StringBuilder return_val) throws SoarException\n {\n smem_attach();\n \n // id, soar_letter, number\n PreparedStatement q = db.vis_lti;\n \n try(ResultSet rs = q.executeQuery())\n {\n while(rs.next())\n {\n _smem_print_lti(rs.getLong(0 + 1), (char) rs.getInt(1 + 1), rs.getLong(2 + 1), rs.getDouble(3 + 1), return_val);\n }\n }\n catch(SQLException e)\n {\n throw new SoarException(e);\n }\n }", "T print(long data) throws PrintingException;", "public void dumpValue() {\n // an implementation is only needed for very large hashrecords\n }", "public String memoryDisplayBin()\n {\n int pos = startingPos;\n String ret = \"\";\n while(pos <= endingPos)\n {\n String instruction = mem.getFourBytes(pos);\n String bin = BinaryFormater.format(Integer.toBinaryString(Integer.parseInt(instruction, 16)),32);\n ret += \"0x\"+Integer.toHexString(pos) + \": \" + bin.substring(0,16) + \" \" + bin.substring(16,32)+\"\\n\";\n pos += 4;\n }\n return ret;\n }", "private String result(int i) {\r\n\t\tswitch(sim40.memory[i]){\r\n\r\n\t\tcase 1: /* print */\r\n\t\t\treturn (\"\"+sim40.memory[Simulator.ACCUMULATOR_ADDRESS]);\r\n\r\n\t\tcase 2: /* printch */\r\n\t\t\treturn (\"\"+(char)sim40.memory[Simulator.ACCUMULATOR_ADDRESS]);\r\n\r\n\t\tcase 3: /* printb */\r\n\t\t\treturn (Integer.toBinaryString(sim40.memory[Simulator.ACCUMULATOR_ADDRESS]));\r\n\t\t}\r\n\r\n\t\treturn \"\";\r\n\t}", "public void printResult(){\n StringBuilder sb = new StringBuilder(20);\n sb.append(left_value)\n .append(space)\n .append(symbol)\n .append(space)\n .append(right_value)\n .append(space)\n .append('=')\n .append(space)\n .append(result);\n System.out.println(sb);\n }", "T println(long data) throws PrintingException;", "public void printMemory(){\n\t\t\n\t\tint bank =0;\n\t\tfor (int i = 0; i < MEMORY_ADDRESS_LIMIT; i++) {\n\t\t\tbank = i % numOfbank;\n\t\t\t\n\t\t\tMap<Integer,Entry> value = contentInBank.get(bank);\n\t\t\tEntry data = value.get(i);\n\n \t\tif (!(data.type == MemoryType.UNDEF) ) {\n \t\t\tlogger.debug(\"In bank \"+bank+\" at \"+ i + \" \" + data.type + \" \" + data.data);\n \t\t}\n\t\t}\n\t\t\n// for (Map.Entry<Integer, Map<Integer,Entry>> entry : contentInBank.entrySet()) {\n// \tbank = entry.getKey();\n// \tMap<Integer,Entry> value = entry.getValue();\n//\n// \tfor(Map.Entry<Integer,Entry> e: value.entrySet()){\n// \t\tint address = e.getKey();\n// \t\tEntry data =e.getValue();\n// \t\tif (!(data.type == MemoryType.UNDEF) ) {\n// \t\t\tlogger.debug(\"In bank \"+bank+\" at \"+ address + \" \" + data.type + \" \" + data.data);\n// \t\t}\n// \t}\n// }\n\t}", "public String toString() {\n\t String outPut = \"byteValue(): \" + byteValue()\n\t \t\t+ \"\\nshortValue(): \" + shortValue()\n\t \t\t+ \"\\nintValue(): \" + intValue()\n\t \t\t+ \"\\nlongValue(): \" + longValue()\n\t \t\t+ \"\\nfloatValue(): \" + floatValue()\n\t \t\t+ \"\\ndoubleValue(): \" + doubleValue();\n\t \n\t return outPut;\n }", "public String toString()\n {\n return storageInt+\"\";\n }", "public void printVal()\n {\n for (int i=0;i<intData.length;i++)\n System.out.print(intData[i] + \" \");\n System.out.println();\n System.out.println(\"Sum: \" + sum + \", Avg: \" + avg + \", Prod: \" + prod);\n }", "@Override\n\tpublic String getMemoryValue() {\n\t\treturn null;\n\t}", "public void Display(){\n System.out.println(a);\n }", "public static void display_memory_r(Memory[] memory_r){\n\t\tSystem.out.println(\"\\n>>>---Memory -r --------------------------------------\");\n\t\tSystem.out.println(\"[Address][Content][ncm][Priority]\");\n\t\tfor(int i=0;i<10;i++){\n\t\t\tSystem.out.println(\" [\"+memory_r[i].address+\"] \"+\" [\"+memory_r[i].content+\"] \"+\" [\"+memory_r[i].ncm+\"] \"+\" [\"+memory_r[i].priority+\"]\");\n\t\t}\n\t\tfor(int i=10;i<48;i++){\n\t\t\t\tSystem.out.println(\"[\"+memory_r[i].address+\"] \"+\" [\"+memory_r[i].content+\"] \"+\" [\"+memory_r[i].ncm+\"] \"+\" [\"+memory_r[i].priority+\"]\");\n\t\t}\n\t\tSystem.out.println(\">>>---------------------------------------------------\");\n\t}", "public void printInfo(){\n System.out.println(\" this is my y \"+(y+1)+\" this is my x \"+ X.valueOfInt(x));\n System.out.println(\"i am full: \"+ isFull);\n }", "@Override\n\tpublic void display() {\n\t\tSystem.out.println(valueType+\": \"+value);\n\t}", "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}", "long getMemory();", "long getMemory();", "public String toString() {\n return value;\r\n }", "public String toString()\n {\n return getValue(12);\n }", "static void print() {\n\t\tSystem.out.println(\"Value of x1 = \" +x1);\n\t}", "private void printLongField(String name, long value, String groupName, String units) {\n sendToGanglia(name, GANGLIA_INT_TYPE, String.format(locale, \"%d\", value), groupName, units);\n }", "public long getValue() {\n\treturn value;\n }", "public void dump(){\r\n\t\tString str = \"\";\r\n\t\tfor(int i = 0; i < M; i++){\r\n\t\t\tstr = str + i + \". \" + vals[i];\r\n\t\t\tif(keys[i] != null){\r\n\t\t\t\tstr = str + \" \" + keys[i] + \" (\";\r\n\t\t\t\tstr = str + hash(keys[i]) + \")\";\r\n\t\t\t}else\r\n\t\t\t\tstr = str + \" -\";\r\n\t\t\tSystem.out.println(str);\r\n\t\t\tstr = \"\";\r\n\t\t}\r\n\t\tSystem.out.println(\"Size: \" + N + \"\\n\"); //La till denna för enkelhetens skull\r\n\t}", "String longWrite();", "public String toString() {\n return value;\n }", "private static void showvalue(int n) {\n\t\tSystem.out.println(\"n is\"+ n);\r\n\t}", "public long memory() {\n\treturn 0;\n }", "public String memoryDisplayHex()\n {\n int pos = startingPos;\n String ret = \"\";\n while(pos <= endingPos)\n {\n String instruction = mem.getFourBytes(pos);\n ret += \"0x\"+Integer.toHexString(pos) + \": \" + instruction.substring(0,4) + \" \" + instruction.substring(4,8)+\"\\n\";\n pos += 4;\n }\n return ret;\n }", "public static void dumpMem() {\n\t\tRuntime runtime = Runtime.getRuntime();\n\n\t\t// Print used memory\n\t\tSystem.out.println(\"Used Memory:\" + (runtime.totalMemory() - runtime.freeMemory()) / mb);\n\n\t\t// Print free memory\n\t\tSystem.out.println(\"Free Memory:\" + runtime.freeMemory() / mb);\n\n\t\t// Print total available memory\n\t\tSystem.out.println(\"Total Memory:\" + runtime.totalMemory() / mb);\n\n\t\t// Print Maximum available memory\n\t\tSystem.out.println(\"Max Memory:\" + runtime.maxMemory() / mb);\n\n\t}", "@Override\r\n\tpublic void Print() {\r\n\t\tSystem.out.print(this.tav+\" \");\r\n\t\t\r\n\t}", "private static void Display()\n\t{\n\t\tStringBuilder memoryValues = new StringBuilder();\n\t\tSystem.out.println(\"\\nPipleline Stages: \");\n\t\tif (stages.get(\"F\") != null)\n\t\t\tSystem.out.println(\"--------Fetch-----------> \" + stages.get(\"F\").getContent());\n\t\tif (stages.get(\"D\") != null)\n\t\t\tSystem.out.println(\"--------Decode----------> \" + stages.get(\"D\").getContent());\n\t\tif (stages.get(\"E\") != null)\n\t\t\tSystem.out.println(\"--------Execution1------> \" + stages.get(\"E\").getContent());\n\t\tif (stages.get(\"E2\") != null)\n\t\t\tSystem.out.println(\"--------Execution2------> \" + stages.get(\"E2\").getContent());\n\t\tif (stages.get(\"B1\") != null)\n\t\t\tSystem.out.println(\"--------Branch----------> \" + stages.get(\"B1\").getContent());\n\t\tif (stages.get(\"Dly\") != null)\n\t\t\tSystem.out.println(\"--------Delay-----------> \" + stages.get(\"Dly\").getContent());\n\t\tif (stages.get(\"M\") != null)\n\t\t\tSystem.out.println(\"--------Memory----------> \" + stages.get(\"M\").getContent());\n\t\tif (stages.get(\"W\") != null)\n\t\t\tSystem.out.println(\"--------Writeback-------> \" + stages.get(\"W\").getContent());\n\n\t\tSystem.out.println(\"\\nRegister File Details: \\n\");\n\t\tfor (Entry<String, Integer> register : registerFile.entrySet())\n\t\t{\n\t\t\tSystem.out.print(register.getKey() + \" : \" + register.getValue() + \"|\\t|\");\n\t\t}\n\t\tSystem.out.println(\"Special Register X:\" + specialRegister);\n\t\tSystem.out.println(\"\\n0 to 99 Memory Address Details: \");\n\t\tfor (int i = 0; i < 100; i++)\n\t\t{\n\t\t\tmemoryValues.append(\" [\" + i + \" - \" + memoryBlocks[i] + \"] \");\n\t\t\tif (i > 0 && i % 10 == 0)\n\t\t\t\tmemoryValues.append(\"\\n\");\n\t\t}\n\t\tSystem.out.println(memoryValues);\n\n\t}", "public void printLongBinary(long l) {\n\t}", "public String toString()\n\t{\n\t\treturn Integer.toString(bitHolder.getValue());\n\t}", "public void print() {\r\n\t\t System.out.println(toString());\r\n\t }", "static void print(BigInteger[] P) \r\n{\r\n\tString a = P[0].toString(16);\r\n\tString b = P[1].toString(16);\r\n\tSystem.out.printf(\" |%S|\",a); \r\n\tSystem.out.printf(\" |%S| \\n\",b);\r\n}", "public static String prettyPrintMemory(long size)\n {\n return prettyPrintMemory(size, \"\");\n }", "public long getValue();", "public void display()\n\t{\n\t\tSystem.out.println(data+\" \");\n\t}", "public static void print(Object val) {\n Builtins.print(val);\n }", "public void print(){\r\n System.out.println(toString());\r\n }", "public double recallMemory() {\n return memoryValue;\n }", "public void executeOUT(){\n\t\tint asciiVal = mRegisters[0].getValue();\n\t\tchar toPrint = (char)asciiVal;\n\t\tSystem.out.print(toPrint);\n\t}", "public void print(long someLong) {\r\n print(someLong + \"\");\r\n }", "private void printNode() {\n System.out.println(\"value:\" + value + \" next:\" + nextNode);\n }", "public String toString(){\n\t\treturn getValue();\n\t}", "protected void displayOperatedValue(int value) {\n \tstack.push(value);\n \tcurrent = value;\n \tshow(current);\n \tcurrent = 0;\n }", "public String toString() {\n/* 67 */ return String.valueOf(this.val);\n/* */ }", "public long getValue() {\n return value_;\n }", "public static void print(String uniqueMark ,String id,String name ,double value ,byte[] statusAddition, int statusAdditionIndex ){\n\t}", "T print(short data) throws PrintingException;", "@Override\r\n public void infixDisplay() {\r\n System.out.print(value);\r\n }", "public void dump ()\n {\n StringBuilder b = new StringBuilder ();\n dump (b, 0);\n System.out.print (b);\n }", "public void dump ()\n {\n StringBuilder b = new StringBuilder ();\n dump (b, 0);\n System.out.print (b);\n }", "public void dump ()\n {\n StringBuilder b = new StringBuilder ();\n dump (b, 0);\n System.out.print (b);\n }", "public void dump ()\n {\n StringBuilder b = new StringBuilder ();\n dump (b, 0);\n System.out.print (b);\n }", "public void dump ()\n {\n StringBuilder b = new StringBuilder ();\n dump (b, 0);\n System.out.print (b);\n }", "public void dump ()\n {\n StringBuilder b = new StringBuilder ();\n dump (b, 0);\n System.out.print (b);\n }", "public void dump ()\n {\n StringBuilder b = new StringBuilder ();\n dump (b, 0);\n System.out.print (b);\n }", "public void dump ()\n {\n StringBuilder b = new StringBuilder ();\n dump (b, 0);\n System.out.print (b);\n }", "public void dump ()\n {\n StringBuilder b = new StringBuilder ();\n dump (b, 0);\n System.out.print (b);\n }", "public void print() {\n\t\tSystem.out.println(\"[System] 펫 정보입니다.\\n 이름 : \"+TMGCSYS.tmgcName+\", 레벨 : \"+TMGCSYS.tmgcLV+\", 경험치 : \"+TMGCSYS.tmgcEXP+\"/\"+(100*TMGCSYS.tmgcLV)+\", 체력 : \"+TMGCSYS.tmgcHP+\", 스트레스 : \"+TMGCSYS.tmgcStress);\r\n\t}", "@Override\r\n public String toString() {\r\n if (value == (long) value) {\r\n //if the number`s decimal is 0 will print it like a long one\r\n return super.toString() + \":\" + String.format(\"%d\",(long)value);\r\n } else\r\n return super.toString() + \":\" + value;\r\n }", "public String toString() {\n\t\treturn String.valueOf(this.currentValue);\n\t}", "@Override\n public String toString() {\n \treturn String.valueOf(val);\n }", "@Override\r\n\tpublic void show(Integer t) {\n\t\tSystem.out.println(\"show:\" + t * t);\r\n\t}", "public abstract void printOneValue(int index);", "public void Display() {\n\t\tSystem.out.println(Integer.toHexString(PID) + \"\\t\" + Integer.toString(CreationTime) + \"\\t\"+ Integer.toHexString(CommandCounter) + \"\\t\" + ProcessStatus.toString() \n\t\t+ \"\\t\" + Integer.toString(MemoryVolume) + \"\\t\" + Integer.toHexString(Priority) + \"\\t\" + ((MemorySegments != null)? MemorySegments.toString() : \"null\"));\n\t}", "public String toString()\r\n\t{\r\n\t\treturn \" \" + this.value;\r\n\t}", "public void print() {\n\t\tSystem.out.println(\"针式打印机打印了\");\n\t\t\n\t}", "public void display() {\n System.out.println(toString());\n }", "public void view(){\r\n System.out.println(\"\tNombre: \"+name);\r\n\t\tSystem.out.println(\"\tTipo: \"+type.id);\r\n\t\tSystem.out.println(\"\tVal: \"+((Integer)val).intValue());\r\n\t\tif(block==true){\r\n\t\t\tSystem.out.println(\"\tBLOQUEADA\");\r\n\t\t}else{\r\n\t\t\tSystem.out.println(\"\tDESBLOQUEADO\");\r\n\t\t}\r\n //System.out.println(\"\tTipo2: \"+kind);\r\n //System.out.println(\"\tAnidamiento: \"+level);\r\n //System.out.println(\"\tSigDireccion: \"+nextAdr);\r\n System.out.println(\"\t*********************\");\r\n\t\tSystem.out.println();\r\n }", "public void print() {\n\t\t\n\t\tfor (int j = 0; j < height(); j++) {\n\t\t\tfor (int i = 0; i < width(); i++) {\n\t\t\t\tSystem.out.printf(\"%3d \", valueAt(i, j));\n\t\t\t}\n\t\t\tSystem.out.printf(\"\\n\");\n\t\t}\n\t\tSystem.out.printf(\"\\n\");\t\n\t}", "public String toString()\n\t{\n\t\treturn \"\" + val;\n\t}", "public void print() {\n mat.print();\n }", "@Override\n\tpublic String toString() {\n\t\treturn value;\n\t}", "private static void showSpr(MicroBlazeProcessor mb) {\r\n SpecialPurposeRegisters spr = mb.getSpecialRegisters();\r\n //System.out.println(\"Special Register Values:\");\r\n console.print(\"Special Register Values:\");\r\n for (SpecialRegister reg : SpecialRegister.values()) {\r\n int value = spr.read(reg);\r\n String stringValue;\r\n switch(reg) {\r\n case rmsr:\r\n stringValue = Integer.toBinaryString(value);\r\n stringValue = BitOperations.padBinaryString(stringValue, 32);\r\n //System.out.println(reg.name() + \":\" + stringValue);\r\n console.print(reg.name() + \":\" + stringValue);\r\n break;\r\n case resr:\r\n stringValue = Integer.toBinaryString(value);\r\n stringValue = BitOperations.padBinaryString(stringValue, 32);\r\n //System.out.println(reg.name() + \":\" + stringValue);\r\n console.print(reg.name() + \":\" + stringValue);\r\n break;\r\n case rpc:\r\n stringValue = Integer.toHexString(value);\r\n stringValue = BitOperations.padHexString(stringValue, 8);\r\n //System.out.println(reg.name() + \":\" + stringValue);\r\n console.print(reg.name() + \":\" + stringValue);\r\n break;\r\n default:\r\n //System.out.println(reg.name() + \":\" + value);\r\n console.print(reg.name() + \":\" + value);\r\n break;\r\n\r\n }\r\n \r\n }\r\n }", "private String read(int address)\n {\n return MMU.read(VMA.get( address/RAM.getPageSize()) * RAM.getPageSize() + (address % RAM.getPageSize()));\n }", "public long getValue() {\n return value_;\n }", "public void printArray(long[] array) {\n System.out.println(Arrays.toString(array));\n }", "public String print() {\n return print(new StringBuffer()).toString();\n }", "@Override\r\n\tpublic String toString() {\r\n\t\treturn val.toString();\r\n\t}", "public String\ttoString() { return Integer.toString(value); }", "public Inatnum print() {\n return this;}", "void smem_visualize_store(PrintWriter return_val) throws SoarException\n {\n try\n {\n smem_visualize_store_safe(return_val);\n }\n catch(SQLException e)\n {\n throw new SoarException(e);\n }\n }", "public String getString() { \n return new BigInteger(this.value).toString();\n }", "static void take_memory_values() throws IOException{\n\t\tSystem.out.print(\"ENTER THE ADDRESS : \");\n\t\tString input = scan.readLine();\n\t\tif(input.equals(\"N\"))\n\t\t\treturn;\n\t\taddress = hexa_to_deci(input);\n\t\tprint_the_address(address);\n\t\tinput = scan.readLine();\n\t\tif(input.length()==2)\n\t\t\tmemory.put(address,input);\n\t\telse{\n\t\t\tmemory.put(address,input.substring(2));\n\t\t\tmemory.put(address+1,input.substring(0,2));\n\t\t}\n\t\t//System.out.println(address+\" \"+memory.get(address));\n\t\ttake_memory_values();\n\t}", "public void print() {\r\n System.out.print(\"[id: <\" + this.id + \"> \");\r\n if (this.dimension > 0) {\r\n System.out.print(this.data[0]);\r\n }\r\n for (int i = 1; i < this.dimension * 2; i++) {\r\n System.out.print(\" \" + this.data[i]);\r\n }\r\n System.out.println(\"]\");\r\n }", "public String toString()\n {\n String string = new Integer(this.getValue()).toString();\n return string; \n }", "T println(short data) throws PrintingException;", "public void print() {\n // char letter = (char)\n // (this.registers.get(this.registerPointer).intValue());\n char letter = (char) this.registers[this.registerPointer];\n this.intOutput.add(this.registers[this.registerPointer]);\n // System.out.println(\"print: \" + this.registers[this.registerPointer]);\n this.output.add(Character.toString(letter));\n }", "public String get(){\n\t\tString s = value%13+1+\"\"+suits[value/13]+\" \";\r\n\t\treturn s;\r\n\t}", "public String toString() {\n\t\treturn String.format(\"%s = %d\",name,value);\n\t}", "public int Print(){\n\tint j ;\n\n\tj = 1 ;\n\twhile (j < (size)) {\n\t System.out.println(number[j]);\n\t j = j + 1 ;\n\t}\n\tSystem.out.println(99999);\n\treturn 0 ;\n }", "public int Print(){\n\tint j ;\n\n\tj = 1 ;\n\twhile (j < (size)) {\n\t System.out.println(number[j]);\n\t j = j + 1 ;\n\t}\n\tSystem.out.println(99999);\n\treturn 0 ;\n }", "public int Print(){\n\tint j ;\n\n\tj = 1 ;\n\twhile (j < (size)) {\n\t System.out.println(number[j]);\n\t j = j + 1 ;\n\t}\n\tSystem.out.println(99999);\n\treturn 0 ;\n }", "public int Print(){\n\tint j ;\n\n\tj = 1 ;\n\twhile (j < (size)) {\n\t System.out.println(number[j]);\n\t j = j + 1 ;\n\t}\n\tSystem.out.println(99999);\n\treturn 0 ;\n }", "public int Print(){\n\tint j ;\n\n\tj = 1 ;\n\twhile (j < (size)) {\n\t System.out.println(number[j]);\n\t j = j + 1 ;\n\t}\n\tSystem.out.println(99999);\n\treturn 0 ;\n }" ]
[ "0.65877354", "0.64525825", "0.6425168", "0.63983923", "0.6305268", "0.615572", "0.611622", "0.60744315", "0.6061534", "0.6011434", "0.5941939", "0.59335047", "0.5906248", "0.5889627", "0.5864824", "0.58416516", "0.5836772", "0.58331203", "0.5831319", "0.5831319", "0.5826006", "0.5823022", "0.5805549", "0.5785657", "0.57813674", "0.57668656", "0.57639986", "0.5726487", "0.5724317", "0.57015413", "0.56925136", "0.5672115", "0.56701744", "0.56686497", "0.56575036", "0.5653501", "0.56467074", "0.56345975", "0.56200767", "0.5614734", "0.5610619", "0.5592137", "0.55776376", "0.5571167", "0.5566335", "0.5551952", "0.55469006", "0.5532297", "0.5524222", "0.5524127", "0.5498148", "0.54919183", "0.5491818", "0.5480274", "0.54686093", "0.54686093", "0.54686093", "0.54686093", "0.54686093", "0.54686093", "0.54686093", "0.54686093", "0.54686093", "0.5458062", "0.54468286", "0.54407334", "0.5434341", "0.5431979", "0.5428175", "0.54230404", "0.5416394", "0.54134786", "0.5406679", "0.53999174", "0.53994876", "0.53989196", "0.5391248", "0.53897357", "0.53894246", "0.5387795", "0.5384835", "0.5378299", "0.5377546", "0.537657", "0.5375019", "0.53748655", "0.5374518", "0.53586936", "0.5357511", "0.53549075", "0.53530514", "0.5351177", "0.5344769", "0.53438663", "0.5337917", "0.5334458", "0.5334458", "0.5334458", "0.5334458", "0.5333432" ]
0.6144963
6
It formulates a new path when the agent is done with its previous one.
public void findNewAStarPath(PedSimCity state) { RouteData route = new RouteData(); route.origin = originNode.getID(); route.destination = destinationNode.getID(); // originNode = PedSimCity.nodesMap.get(9406); // destinationNode = PedSimCity.nodesMap.get(4456); if (UserParameters.empiricalABM) { System.out.println(" Agent nr. "+this.agentID + " group " + this.agp.groupName + " OD " + originNode.getID()+" " +destinationNode.getID()); agp.defineRouteChoiceParameters(); CombinedNavigation combinedNavigation = new CombinedNavigation(); newPath = combinedNavigation.path(originNode, destinationNode, agp); route.group = this.agp.groupID; route.localH = this.agp.localHeuristic; route.routeID = this.agentID.toString()+"-"+originNode.getID().toString()+"-"+destinationNode.getID().toString(); } else { System.out.println(originNode.getID() + " "+ destinationNode.getID()+ " "+ap.routeChoice); selectRouteChoice(); route.routeChoice = ap.routeChoice; // route.routeID = numTrips; } List<Integer> sequenceEdges = new ArrayList<Integer>(); for (GeomPlanarGraphDirectedEdge o : newPath) { // update edge data updateEdgeData((EdgeGraph) o.getEdge()); int edgeID = ((EdgeGraph) o.getEdge()).getID(); sequenceEdges.add(edgeID); } route.sequenceEdges = sequenceEdges; PedSimCity.routesData.add(route); indexOnPath = 0; path = newPath; // set up how to traverse this first link EdgeGraph firstEdge = (EdgeGraph) newPath.get(0).getEdge(); setupEdge(firstEdge); //Sets the Agent up to proceed along an Edge // update the current position for this link updatePosition(segment.extractPoint(currentIndex)); numTrips += 1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void finalizePath(){\n\t\tif(getCompletePath()||temp.isEmpty())\n\t\t\treturn;//path has already been finalized or there is no path defined\n\t\telse{\n\t\t\tint LastPos=temp.peekLast().getPos();\n\t\t\tint d = currentPath.getDirection(LastPos);\n\t\t\tPathType type = Map.createPathTileOfType(d,caseEdge);\n\t\t\tPath p = PathFactory.makePath(type,currentPos);\n\t\t\t\n\t\t\tif(p.getEntry()!= LastPos)\n\t\t\t\tp.rotate();\n\t\t\tp.setEnd();\n\t\t\tsetExitPoint(p);\n\t\t\tp.storePathTile();\n\t\t\t\n\t\t\tsetCompletePath(true);\n\t\t\tsetRemainingToScenery();\n\t\t}\n\t\t\n\t\t\n\t}", "private void setPath(){\r\n // get the reversed path\r\n ArrayList<Grid> reversedPath = new ArrayList<>();\r\n int index = _endIndex;\r\n reversedPath.add(_map.get_grid(index));\r\n while(index != _startIndex){\r\n index = _map.get_grid(index).get_parent();\r\n reversedPath.add(_map.get_grid(index));\r\n }\r\n\r\n // get the final path in the correct order\r\n int length = reversedPath.size();\r\n for(int i=length-1;i>=0;i--){\r\n _path.add(reversedPath.get(i));\r\n }\r\n }", "public void updatePath() {\n\t\tString oldPath = this.path;\n\t\tif (materializePath()) {\n\t\t\tPageAlias.create(this, oldPath);\n\t\t\tupdateChildPaths();\n\t\t}\n\t}", "public void ungeneratePath() {\n path = oldPaths.pop();\n }", "public void clearNewPaths() {\n this.newPaths = new MazeArray<>();\n }", "@Override\n protected void processPathAction(GridNode start, GridNode goal, Stack<GridNode> path) {\n path.pop();\n\n // Make the robot follow the path\n Mover mover = new Mover(\n robot.getDifferentialPilot(),\n new LightSensor(leftSensorPort),\n new LightSensor(rightSensorPort),\n path,\n initialDirection);\n mover.run();\n }", "public void closepath() \n {\n\tLine line = new Line(_currentx, _currenty, _startx, _starty);\n\t_currentPath.add(line);\n\t_currentx = _startx;\n\t_currenty = _starty;\n\t_closedPath = true;\n }", "private void atEndOfPathIsDetected() {\n \t\tmoveUltrasonicSensorToDefaultPosition();\n \t\trecursiveDepth = 0;\n \t\tturn = -15;\n \t}", "public void endpath()\n {\n\t closepath();\n\t//stroke();\n\tfor(Line line : _currentPath) {\n\t System.out.println(\"EndPath: \" + line.toString());\n\t}\n\t_currentPath.clear();\n\t_closedPath=false;\n }", "public void resetPath();", "private void traversePath()\n\t{\n\t\trobot.forward(50);\n\t\trobot.right(90);\n\t\trobot.forward(50);\n\t\trobot.right(90);\n\t\trobot.forward(50);\n\t\trobot.left(90);\n\t\trobot.forward(50);\n\t\trobot.left(90);\n\t}", "void addPathFromStart() {\n for (String aPathFromStart : pathFromStart) {\n newFutureTargets.push(aPathFromStart);\n }\n }", "final public void updatePath(EventPacket<?> in) {\n if (!pathsEnabled) {\n return;\n }\n path.add(new PathPoint(location.x, location.y, in.getLastTimestamp(), numEvents - previousNumEvents));\n previousNumEvents = numEvents;\n if (path.size() > getPathLength()) {\n path.remove(path.get(0));\n }\n updateVelocity();\n }", "public void makePath() {\n\t\tQueue<GamePoint> newPath = new LinkedList<GamePoint>();\n\t\ttarget.setOnMouseEntered(e -> target.getGrid().setGridLinesVisible(true));\n\t\ttarget.setOnMouseExited(e -> target.getGrid().setGridLinesVisible(false));\n\t\ttarget.setOnMouseDragged(e -> targetSetOnMouseDragged(target, e, newPath));\n\t\ttarget.setOnMouseReleased(e -> replacePath(newPath));\n\t}", "@Override\n public synchronized void runOnce() {\n Drive.getInstance().EndPath(true);\n }", "private void arrived(DevicePath devicePath, String location, String finishLocation) {\n\t\tif(!location.equals(finishLocation)) {\n\t\t\ttry {\n\t\t\t\tDeviceMover finishDeviceMover =\n\t\t\t\t\t(DeviceMover)subEndpointTable.get(finishLocation);\n\t\t\t\tHashSet nameSet = createNameSet(finishDeviceMover);\n\t\t\t\tif(nameSet.contains(location)) {\n\t\t\t\t\tcreatePath(devicePath, finishDeviceMover, finishDeviceMover,\n\t\t\t\t\tlocation, finishLocation);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tcreatePath(devicePath, root, finishDeviceMover, location,\n\t\t\t\t\tfinishLocation);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch(UnknownLocationException e) {\n\t\t\t\tthrow new IllegalArgumentException(e.toString());\n\t\t\t}\n\t\t}\n\t\t//else {\n\t\t\t//if(arrivalListener != null) {\n\t\t\t//\tarrivalListener.arrived(device, finish);\n\t\t\t//}\n\t\t//}\n\t}", "public void pushCurPath()\n\t {\n\t \t this.currentpath.simpleAppend((SoNode)( null), -1);\n\t \t}", "public void\nsetPath(SoPath path)\n{\n // ref the input path\n if (path != null)\n path.ref();\n\n // nuke the old path\n if (pathOfInterest != null) {\n pathOfInterest.unref();\n pathOfInterest = null;\n }\n // and copy the new path\n if (path != null) {\n pathOfInterest = path.copy();\n pathOfInterest.ref();\n }\n\n // unref the input path\n if (path != null)\n path.unref();\n\n}", "private synchronized void updatePathFollower() {\n TrajectoryStatus leftUpdate = pathFollower\n .getLeftVelocity(leftDrive.getPosition(), leftDrive.getSpeed(), -navX.getYaw());\n TrajectoryStatus rightUpdate = pathFollower\n .getRightVelocity(rightDrive.getPosition(), rightDrive.getSpeed(), -navX.getYaw());\n leftStatus = leftUpdate;\n rightStatus = rightUpdate;\n if (isEncodersConnected()) {\n setVelocitySetpoint(\n new DriveSignal(leftUpdate.getOutput(), rightUpdate.getOutput(), brakePath),\n leftUpdate.getArbFeed(), rightUpdate.getArbFeed());\n } else {\n leftDrive.set(ControlMode.PercentOutput,\n ((1.0 / MkMath.RPMToInchesPerSec(DRIVE.RIGHT_RPM_MAX)) * leftUpdate.getOutput()), false,\n leftUpdate.getArbFeed());\n rightDrive.set(ControlMode.PercentOutput,\n ((1.0 / MkMath.RPMToInchesPerSec(DRIVE.LEFT_RPM_MAX)) * rightUpdate.getOutput()), false,\n rightUpdate.getArbFeed());\n }\n }", "private void upPath() {\n if (!path.equals(FilePathUtil.getRootPath())) {\n onPathChanged(path, new File(path.getParent()));\n path = new File(path.getParent());\n load(null);\n }\n }", "void setPath() {\n\t\tif(from.getSelectedItem() != null){\n\t\t\tint ifrom = (int) from.getSelectedItem();\n\t\t\tint ito = (int) to.getSelectedItem();\n\t\t\tPathFinder finder = new BellmanFord(this.app.graph, ifrom-1);\n\t\t\tfinder.findAll();\n\t\t\tArrayList<Integer> path = finder.getPath(ito-1);\n\t\t\tStringBuilder pathStr = new StringBuilder(\"[\");\n\t\t\tif(path != null){\n\t\t\t\tfor(int i = path.size()-1; i >= 0 ; i--){\n\t\t\t\t\tpathStr.append((path.get(i)+1) + \" \");\n\t\t\t\t}\n\t\t\t\tpathStr.append(\"]\");\n\t\t\t\t\n\t\t\t}\n\t\t\tthis.pathLabel.setText(pathStr.toString());\n\t\t}\n\t\t\n\t}", "public void initPath() {\r\n\t\tpath = new Path();\r\n\t}", "protected void report() {\n\t\tif (pathCompleted()) {\n\t\t\t// Finished\n\t\t\tfinish();\n\t\t\treturn;\n\t\t}\n\n\t\t// Report\n\t\treportAtWaypoint();\n\n\t\ttransition(NavigatorState.NEXT);\n\t}", "void setChosenPath(Path path) throws Exception {\r\n\t\t// Changing direction, assume we need to clear current set of choices\r\n\t\tcurrentChoices.clear();\r\n\r\n\t\tsetCurrentPath(path);\r\n\r\n\t\tcurrentTurnIndex++;\r\n\t}", "static private void npcPath() {\n\n if (Time.secondsPassed % 45 == 44) {\n Random picker = new Random();\n while (true) {\n if (josephSchnitzel.getCurrentRoom().equals(mountain)) {\n String[] newRoomString = {\"south\"};\n int index = picker.nextInt(newRoomString.length);\n Room next = josephSchnitzel.getCurrentRoom().getExit(newRoomString[index]);\n josephSchnitzel.setCurrentRoom(next);\n break;\n }\n\n if (josephSchnitzel.getCurrentRoom().equals(beach)) {\n String[] newRoomString = {\"north\"};\n int indexOfNewRoomString = picker.nextInt(newRoomString.length);\n Room nextRoom = josephSchnitzel.getCurrentRoom().getExit(newRoomString[indexOfNewRoomString]);\n josephSchnitzel.setCurrentRoom(nextRoom);\n break;\n }\n\n if (josephSchnitzel.getCurrentRoom().equals(jungle)) {\n String[] newRoomString = {\"north\", \"south\"};\n int indexOfNewRoomString = picker.nextInt(newRoomString.length);\n Room nextRoom = josephSchnitzel.getCurrentRoom().getExit(newRoomString[indexOfNewRoomString]);\n josephSchnitzel.setCurrentRoom(nextRoom);\n break;\n }\n }\n }\n }", "void updatePathListings() {\n\t\tpathSelector.updatePathListings();\n\t}", "public void back() {\n\t\tif (path.isEmpty()) {\n\t\t\tpath = crossLocation.pop();\n\t\t\tLocation loc = path.get(path.size() - 1);\n\t\t\tint dir = getLocation().getDirectionToward(loc);\n\t\t\tif (dir == Location.HALF_CIRCLE) {\n\t\t\t\tdirsCount[0]--;\n\t\t\t} else if (dir == Location.AHEAD) {\n\t\t\t\tdirsCount[1]--;\n\t\t\t} else if (dir == Location.RIGHT) {\n\t\t\t\tdirsCount[2]--;\n\t\t\t} else {\n\t\t\t\tdirsCount[3]--;\n\t\t\t}\n\t\t}\n\t\tnext = path.remove(path.size() - 1);\n\t\tmove();\n\t}", "private void performUnloadPathRecheck() {\r\n\t\trecheckUnloadPath = false;\r\n\t\tTile oldTile = gameMap.get(myRC.getLocation());\r\n\t\tTile actTile;\r\n\t\t\r\n\t\t/* cut where path is not accessible */\r\n\t\tfor (MapLocation loc : path) {\r\n\t\t\tactTile = gameMap.get(loc);\r\n\t\t\tif (actTile.totalHeight - oldTile.totalHeight > WORKER_MAX_HEIGHT_DELTA) {\r\n\t\t\t\tpath = path.subList(0, path.indexOf(loc));\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\toldTile = actTile;\r\n\t\t}\r\n\t\t\r\n\t\t/* cut where we can unload */\r\n\t\tpath.add(0, myRC.getLocation());\r\n\t\tif (path.size() >= 2)\r\n\t\t\tif (gameMap.get(path.get(path.size() - 1)).totalHeight - \r\n\t\t\t\tgameMap.get(path.get(path.size() - 2)).totalHeight >= WORKER_MAX_HEIGHT_DELTA) {\r\n\t\t\t\t/* we can't unload at the end of the path. get to the end and drop it */\r\n\t\t\t\tpath.add(path.get(path.size() - 2));\r\n\t\t\t}\r\n\t\tpath.remove(0);\r\n//\t\tpath.add(0, myRC.getLocation());\r\n//\t\tint size = path.size();\r\n//\t\toldTile = gameMap.get(path.get(size - 1));\r\n//\t\twhile(size >= 2){\r\n//\t\t\tactTile = gameMap.get(path.get(size - 2));\r\n//\t\t\tif (gameMap.get(path.get(path.size() - 1)).totalHeight - gameMap.get(path.get(path.size() - 2)).totalHeight >= WORKER_MAX_HEIGHT_DELTA) {\r\n//\t\t\t\tpath.remove(size - 1);\r\n//\t\t\t\tsize--;\r\n//\t\t\t} else\r\n//\t\t\t\tbreak;\r\n//\t\t\toldTile = actTile;\r\n//\t\t}\r\n//\t\tpath.remove(0);\r\n\t}", "private void triggerPathUpdate() {\n\t\tPathwayPathSelectionEvent pathEvent = new PathwayPathSelectionEvent();\n\n\t\tif (selectedPath != null) {\n\t\t\tif (pathSegments.size() > 0)\n\t\t\t\tpathSegments.set(pathSegments.size() - 1, new PathSegment(selectedPath));\n\t\t\telse\n\t\t\t\tpathSegments.add(new PathSegment(selectedPath));\n\t\t}\n\t\tpathEvent.setPath(pathSegments);\n\t\tpathEvent.setSender(this);\n\t\tpathEvent.setEventSpace(pathwayPathEventSpace);\n\t\teventPublisher.triggerEvent(pathEvent);\n\t}", "private void followPath(){\r\n\t\tif(noBeepersPresent()){\r\n\t\t\twhile(frontIsClear() && leftIsBlocked() && rightIsBlocked() && noBeepersPresent()){\r\n\t\t\t\tmakeMove();\r\n\t\t\t}\r\n\t\t\tif(frontIsBlocked() && leftIsBlocked() && rightIsBlocked() && noBeepersPresent()){\r\n\t\t\t\tturnAround();\r\n\t\t\t\tpaintCorner(RED);\r\n\t\t\t\tfollowPath();\r\n\t\t\t}else{\r\n\t\t\t\tcheckPaths();\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void initPath() {\n\t//path = new SplinePath2D();\n\tpath = newSplinePath2D();\n\tcplist.clear();\n }", "public void clearPaths() {\n _thePaths.clear();\n }", "@Override\n\t\t\t\tpublic void run() {\n\t\t\t\t\tsetPath(null);\n\t\t\t\t}", "public void replacePath(Queue<GamePoint> newPath) {\n\t\tmyPath = newPath;\n\t}", "public void step(){\n if (this.jobs.contains(this.currentFloor)){ //we arrived at our destination\n this.openDoor();\n this.leavePeople();\n this.deleteJob(this.currentFloor);\n } else {\n this.closeDoor();\n this.changeState();\n this.move();\n }\n }", "public void setPath(Square finish) {\n // TODO\n \tpath = \"Found Nemo!\\n\" + \"Path from start to finish: \";\n \tString extnPAth = \"\";\n \twhile(finish != null) {\n \tSquare realSquare = sea.getSea()[finish.getRow()][finish.getCol()];\n \t\trealSquare.setFinalPath();\n \t\t//Add to stack\n \t\tstack.push(finish);\n \t\tfinish = finish.getPrevious();\n \t}\n \t\n \t//get start and add start\n \twhile(!stack.empty()) {\n \t\tSquare c = stack.pop();\n \t\textnPAth = extnPAth + \"[\" + c.getRow() + \",\" + c.getCol() + \"] \"; \n \t}\n\t\tpath = path + extnPAth;\n }", "public static void back() {\n\t\tString[] parts = MenuPath.path.split(\"_\");\n\t\tint len = parts.length;\n\t\t\n\t\tMenuPath.path = parts[0];\n\t\t\n\t\tfor(int i = 1; i < (len - 1); i++) {\t\t\t\n\t\t\tMenuPath.path = MenuPath.path + \"_\" + parts[i];\n\t\t}\t\n\t}", "public void clearPathData()\r\n {\r\n // Clear out all paths\r\n for(String key: network_topology.keyset())\r\n {\r\n //System.out.println(\"Clearing : \"+ key);\r\n network_topology.get(key).previous=null;\r\n network_topology.get(key).minDistance = Double.POSITIVE_INFINITY;\r\n }\r\n }", "protected void reversePath() {\n\t\t\n\t\tif(_reverse) {\n\t\t\t\n\t\t\tif(_nextMove + 1 > movingPattern.size() - 1)\n\t\t\t\t_nextMove = 0;\n\t\t\telse\n\t\t\t\t_nextMove++;\n\t\t\t\n\t\t\t_reverse = false;\n\t\t}\n\t\telse {\n\t\t\t\n\t\t\tif(_nextMove - 1 < 0)\n\t\t\t\t_nextMove = movingPattern.size() - 1;\n\t\t\telse\n\t\t\t\t_nextMove--;\n\t\t\t\n\t\t\t_reverse = true;\n\t\t}\n\t}", "private void findPath()\n\t{\n\t\tpathfinding = true;\n\n\t\tmoves = Pathfinder.calcOneWayMove(city.getDrivingMap(), x, y, destX, destY);\n\t\tpathfinding = false;\n\t}", "private void update_location() throws Exception {\r\n\t\tif (children.size() == 1) {\r\n\t\t\tCLocation bloc = children.get(0).get_location();\r\n\t\t\tthis.location = bloc.get_source().get_location(bloc.get_bias(), bloc.get_length());\r\n\t\t} else if (children.size() > 1) {\r\n\t\t\tCLocation eloc = children.get(children.size() - 1).get_location();\r\n\t\t\tint beg = this.location.get_bias(), end = eloc.get_bias() + eloc.get_length();\r\n\t\t\tthis.location.set_location(beg, end - beg);\r\n\t\t}\r\n\t}", "public void setPath(int sender, Stack<Integer> prevPath)\n { \n if (prevPath.isEmpty() || prevPath.peek()!=sender)\n prevPath.push(sender);\n path = (Stack)prevPath.clone();\n }", "public MazeArray<Cell> getNewPaths() {\n return newPaths;\n }", "private void tracePath(Node lastVisitedNode)\r\n {\r\n Node pathPtr = lastVisitedNode;\r\n while (pathPtr != Start)\r\n {\r\n pathPtr.isVisited = true;\r\n pathPtr = pathPtr.parent;\r\n }\r\n }", "public void followPath(List<Node> path) {\r\n\t\tfloat xlocation = creature.getXlocation();\r\n\t\tfloat ylocation = creature.getYlocation();\r\n\t\t//Path check timer\r\n\t\t/*-------------------------------------------------------------*/\r\n\t\tpathCheck += System.currentTimeMillis() - lastPathCheck;\r\n\t\tlastPathCheck = System.currentTimeMillis();\r\n\t\tif(pathCheck >= pathCheckCooldown) {\r\n\t\t/*-------------------------------------------------------------*/\r\n\t\t\tcreature.xMove = 0;\r\n\t\t\tcreature.yMove = 0;\r\n\t\t\tcreature.path = path;\r\n\t\t\tif (creature.path != null) {\r\n\t\t\t\tif (creature.path.size() > 0) {\r\n\t\t\t\t\tVector2i vec = creature.path.get(creature.path.size() - 1).tile;\r\n\t\t\t\t\tif (xlocation / Tile.TILEWIDTH < vec.getX() + .5) creature.xMove = creature.speed;\t\t//Right\r\n\t\t\t\t\telse if (xlocation / Tile.TILEWIDTH > vec.getX() + .5) creature.xMove = -creature.speed;\t//Left\t\t/\r\n\t\t\t\t\tif (ylocation / Tile.TILEHEIGHT < vec.getY() + .5) creature.yMove = creature.speed;\t\t//Down\r\n\t\t\t\t\telse if (ylocation / Tile.TILEHEIGHT > vec.getY() + .5) creature.yMove = -creature.speed;\t//Up\t\t/\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\tPoint p = moveToCenter(2, creature);\r\n\t\t\t\t\tif(p.getX() == 0 && p.getY() == 0) {\r\n\t\t\t\t\t\tcreature.travelling = false;\r\n\t\t\t\t\t} else {\t\t\t\t\r\n\t\t\t\t\tcreature.xMove = creature.speed * p.getX();\r\n\t\t\t\t\tcreature.yMove = creature.speed * p.getY();\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 undo(){\n if(!isFreeDraw) { //in waypoint mode delete the last point\n int size = mMapInterface.getPathFrame().size();\n if (size >= 1) {\n isPathReady=false;\n mMapInterface.getPathFrame().remove(size - 1);\n pointsCounter--;\n googleMap.clear();\n drawLine();\n }\n }\n else{ //in continu mode delete all path\n deletePath();\n drawFree();\n }\n }", "private void pathFill(Vertex<E> src, Vertex<E> dst, ArrayList<E> path) {\r\n\t\tif(src == dst) {\r\n\t\t\tpath.add(src.getElement());\r\n\t\t} else {\r\n\t\t\tpathFill(src, dst.getPredecessor(), path);\r\n\t\t\tpath.add(dst.getElement());\r\n\t\t}\r\n\t}", "public void appendPath(LinkedList newTree) {\n EtmPoint current = (EtmPoint) newTree.removeFirst();\n\n ExecutionAggregate aggregate = getChild(current.getName());\n\n if (newTree.isEmpty()) {\n aggregate.addTransaction(current);\n } else {\n aggregate.appendPath(newTree);\n }\n }", "private void Create_Path() {\n lines = new Line[getPoints().size()];\n for (int i = 1; i < getLines().length; i++) {\n lines[i] = new Line(getPoints().get(way[i]).getX(), getPoints().get(way[i]).getY(), getPoints().get(way[i - 1]).getX(), getPoints().get(way[i - 1]).getY());\n }\n lines[0] = new Line(getPoints().get(way[getLines().length - 1]).getX(), getPoints().get(way[getLines().length - 1]).getY(), getPoints().get(way[0]).getX(), getPoints().get(way[0]).getY());\n\n }", "private void carvePath(Cell cell) {\n\n\t\tsetCellVisited(cell);\n\t\tif (cell.tunnelTo != null) {\n\t\t\tcell = cell.tunnelTo;\n\t\t\tsetCellVisited(cell);\n\t\t}\n\t\tint dir = randomlyChoseNeighbour(cell);\n\t\tCell neigh;\n\t\twhile (dir != -1) {\n\t\t\tneigh = cell.neigh[dir];\n\t\t\tcell.wall[dir].present = false;\n\t\t\tcarvePath(neigh);\n\t\t\tdir = randomlyChoseNeighbour(cell);\n\n\t\t}\n\t}", "public void changePath(String newPath){\n this.path=newPath;\n }", "private void selectNextPath(boolean inc) {\n\t\tif (this.allPathsList.size() < 1)\n\t\t\treturn;\n\t\tList<GraphPath<PathwayVertexRep, DefaultEdge>> paths = this.allPathsList.get(this.allPathsList.size() - 1)\n\t\t\t\t.getFirst();\n\t\tif (paths.size() > 1) {\n\t\t\t// System.out.println(\"allPaths.size() > 1\");\n\n\t\t\tif (inc)\n\t\t\t\tselectedPathID++;\n\t\t\telse\n\t\t\t\tselectedPathID--;\n\n\t\t\tif (selectedPathID < 0)\n\t\t\t\tselectedPathID = paths.size() - 1;\n\t\t\tif (selectedPathID > paths.size() - 1)\n\t\t\t\tselectedPathID = 0;\n\n\t\t\tif (allPaths.size() > 0) {\n\t\t\t\tselectedPath = paths.get(selectedPathID);\n\t\t\t\t// System.out.println(\"selectedPathID\"+selectedPathID);\n\t\t\t\tif (selectedPath.getEdgeList().size() > 0 && !isShiftKeyDown) {\n\t\t\t\t\tPathwayVertexRep startPrevVertex = selectedPath.getStartVertex();\n\t\t\t\t\tPathwayVertexRep endPrevVertex = selectedPath.getEndVertex();\n\t\t\t\t\tList<DefaultEdge> edgePrevList = selectedPath.getEdgeList();\n\t\t\t\t\tpreviousSelectedPath = new GraphPathImpl<PathwayVertexRep, DefaultEdge>(pathway, startPrevVertex,\n\t\t\t\t\t\t\tendPrevVertex, edgePrevList, 0);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tselectedPathID = 0;\n\t\t}\n\n\t\t// System.out.println(\"selectedPathID=\"+selectedPathID);\n\t\tthis.allPathsList.get(this.allPathsList.size() - 1).setSecond(selectedPathID);\n\t\tisBubbleTextureDirty = true;\n\t\tsetDisplayListDirty();\n\t\ttriggerPathUpdate();\n\t}", "private boolean shouldReplanPath(State.StateView state, History.HistoryView history, Stack<MapLocation> currentPath)\n {\n \t\t/* TODO: Write this method\n \t\t * Check if the path is blocked every step or check if the next spot is blocked?\n \t\t * Does enemy attack if you get too close?\n \t\t */\n \t\n \t\n \t\t//checking if the next step is blocked\n \t\t//setting up local fields\n \t\tUnitView enemy = state.getUnit(enemyFootmanID);\n \t\tMapLocation next;\n \t\tif (!path.isEmpty()) {\n \t\t\tnext = path.peek();\n \t\t\n \t\t\tif(next.x == enemy.getXPosition() && next.y == enemy.getYPosition()) \n \t\t\t\treturn true;\n \t\t\t\n \t\t}\n \t\t\n return false;\n }", "public void deleteLastPathTile(){\n\t\tif(temp.isEmpty()){\n\t\t\tif(currentPos!=-1){\n\t\t\t\tcurrentPos=-1;\n\t\t\t\tsetEntryPoint(null);//start has been deleted\n\t\t\t\tgrid[currentPath.getRow()][currentPath.getCol()]= null;\n\t\t\t\tcurrentPath=null;\n\t\t\t}\n\t\t\treturn;//the list is empty\n\t\t}\n\t\telse {//\n\t\t\tif(getCompletePath()){\n\t\t\t\t\tsetCompletePath(false);\n\t\t\t\t\tsetExitPoint(null);\n\t\t\t\t\tremoveScenery();\n\t\t\t\t\t\n\t\t\t}//since the last node was removed\n\t\t\telse//if the path wasn't complete (should it be scenery?)\n\t\t\t\tgrid[currentPath.getRow()][currentPath.getCol()]= null;\n\t\t\t\tcurrentPath=null;\n\t\t\t\n\t\t\tPath removedPath=temp.removeLast();\n\t\t\tcurrentPos=removedPath.getPos();\n\t\t\tcurrentPath=new Path(currentPos);\n\t\t}\n\t}", "public void withdrawPath(AS peer, int dest) {\n this.incUpdateQueue.add(new BGPUpdate(dest, peer));\n }", "void transitionToNextEdge(double residualMove) {\n\n\t\t// update the counter for where the index on the path is\n\t\tindexOnPath += pathDirection;\n\n\t\t// check to make sure the Agent has not reached the end of the path already\n\t\t// depends on where you're going!\n\t\tif ((pathDirection > 0 && indexOnPath >= path.size()) || (pathDirection < 0 && indexOnPath < 0)) {\n\t\t\treachedDestination = true;\n\t\t\tindexOnPath -= pathDirection; // make sure index is correct\n\t\t\treturn;\n\t\t}\n\n\t\t// move to the next edge in the path\n\t\tEdgeGraph edge = (EdgeGraph) path.get(indexOnPath).getEdge();\n\t\tsetupEdge(edge);\n\t\tspeed = progress(residualMove);\n\t\tcurrentIndex += speed;\n\n\t\t// check to see if the progress has taken the current index beyond its goal\n\t\t// given the direction of movement. If so, proceed to the next edge\n\t\tif (linkDirection == 1 && currentIndex > endIndex) transitionToNextEdge(currentIndex - endIndex);\n\t\telse if (linkDirection == -1 && currentIndex < startIndex) transitionToNextEdge(startIndex - currentIndex);\n\t}", "public static String getNewPath() {\n return homePath + Integer.toString(++elementCounter) + \".ser\";\n }", "public void initRobotPath() {\n for (int i = 0; i < my_game.getRobot_size(); i++) {\n Robot robot = my_game.getRobots().get(i);\n // Fruit fruit = my_game.getFruits().get(i);\n Fruit fruit = findClosestFruit(robot);\n List<node_data> tmp = algo_g.shortestPath(robot.getSrc(), fruit.getEdge().getDest());\n robots_paths.put(robot.getId(), tmp);\n fruits_status.put(robot.getId(),fruit);\n }\n }", "private static void createPath(Path path) {\r\n\t\tString tempStr = \"\";\r\n\t\tint finished = 1;\r\n\t\tint tempId = -1;\r\n\t\tList<GeoCoordinate> polyline = new ArrayList<GeoCoordinate>();\r\n\t\tList<Place> placeList = new ArrayList<Place>();\r\n\t\tContainerNII pathNii = new ContainerNII();\r\n\t\tPlace place;\r\n\t\t\r\n\t\twhile (finished == 1){\r\n\t\t\t\r\n\t\t\tplace = new Place();\r\n\t\t\tcreatePlace(place);\r\n\t\t\tplaceList.add(place);\r\n\t\t\tfinished = checkContinue(\"place\");\r\n\t\t}\r\n\t\tpath.setPlaces(placeList);\r\n\t\t\r\n\t\tif ((tempId = insertInteger(\"path id: \")) != -1)\r\n\t\t\tpath.setId(tempId);\t\r\n\t\t\r\n\t\tinsertNIIValues(pathNii, \"path\");\r\n\t\tpath.setNii(pathNii);\r\n\t\t\r\n\t\tif ((tempStr = insertString(\"path length: \")) != null)\r\n\t\t\tpath.setLength(tempStr);\r\n\t\t\r\n\t\tinsertPolyline(polyline, strPath);\r\n\t\tpath.setPolyline(polyline);\r\n\t\t\r\n\t\tif ((tempStr = insertString(\"path duration: \")) != null)\r\n\t\t\tpath.setDuration(tempStr);\r\n\t\t\r\n\t}", "public void closePath() {\n\t\tif (this.lastType == Type.CLOSE) \n\t\t\treturn;\n\t\tthis.segments.add(new ClosingSegment());\n\t}", "org.openxmlformats.schemas.drawingml.x2006.main.CTPath2D addNewPath();", "private boolean[][] reconstructPath(String[][] prev,int currentX,int currentY,int goalX, int goalY, Level level) {\n\t\tboolean[][] path = new boolean[level.getWidth()+2][level.getHeight()+2];\n\t\tfor (int x = 0; x < level.getHeight(); x++) {\n\t\t\tfor (int y = 0; y < level.getWidth(); y++) {\n\t\t\t\tpath[y][x] = false;\n\t\t\t}\n\t\t} String parentString = prev[goalX][goalY];\n\t\twhile (parentString != null) {\n\t\t\tScanner in = new Scanner(parentString);\n\t\t\tin.useDelimiter(\",\");\n\t\t\tint parentX = in.nextInt();\n\t\t\tint parentY = in.nextInt();\n\t\t\tparentString = prev[parentX][parentY];\n\t\t\tpath[parentX][parentY] = true;\n\t\t\tif (parentString != null) {\n\t\t\t\tin.close();\n\t\t\t}\n\t\t} return path;\n\t}", "private void start() {\n\t\twhile(!navi.pathCompleted())\n\t\t{\n\t\t\tThread.yield();\n\t\t\t\n\t\t}\n\t\t// TODO Auto-generated method stub\n\t\t\n\t}", "public void setPath(Path path)\n\t{\n\t\tpathList.clear();\n\t\tpathList.add(path);\n\t}", "public void moveToOrigin() {\n for(Waypoint waypoint : path)\n waypoint.setCoordinates(waypoint.getX() - path.get(0).getX(),\n waypoint.getY() - path.get(0).getY());\n }", "public void pathChanged(){\r\n ctrlDomain.pathChanged();\r\n }", "public void CLOSE ()\r\n\t{\r\n\t\tif (Path.size()!=0){\r\n\t\tActualNode=Path.get(Path.size()-1);\r\n\t\tPath.remove(Path.size()-1);\r\n\t\t}\r\n\t}", "private void printPath() {\n // generate and print the shortest path.\n if (this == this.previous) {\n graphPathRef.add(this);\n } else if (this.previous == null) {\n System.out.print(\"\");\n } else {\n graphPathRef.add(this);\n this.previous.printPath();\n }\n }", "private void move() {\n System.out.println(\"current dir= \" + head.dir);\n addToHead();\n deleteFromTail();\n }", "private void showFinalPath() // run after end dest has been set\n {\n for(int i = 0; i < cities.size(); i++)\n System.out.println(cities.get(i));\n }", "public static void pathMethod (int x, int y, int rows, int columns, int startPointX, int startPointY, int endPointX, int endPointY, String [][]copyArray, String [][]realArray, int decider) throws Exception{ \r\n \r\n String up = copyArray[y-1][x];\r\n String down = copyArray[y+1][x];\r\n String right = copyArray[y][x+1]; //moves the coordinate up one, down one, right one, left one and stores it into up down left right; \r\n String left = copyArray[y][x-1];\r\n \r\n if(up.equals(\"X\")||down.equals(\"X\")||right.equals(\"X\")||left.equals(\"X\")){ //if up right left or down is equal to the endpoint, the maze is solvable, and we can now print the final array\r\n System.out.println(\"\\nThe maze is solvable!\");\r\n// printFinalArray(realArray, counter, xvalues, yvalues); //solution is found already - sends back to another method to print final solution\r\n regenerate(decider); //then sends to regenerate method where it asks if user would like to create another maze\r\n }\r\n \r\n else if(copyArray[startPointY+1][startPointX].equals(\"B\")&&copyArray[startPointY-1][startPointX].equals(\"B\")&&copyArray[startPointY][startPointX+1].equals(\"B\")&&copyArray[startPointY][startPointX-1].equals(\"B\")){\r\n \r\n System.out.println(\"\\nSorry, your maze is unsolvable.\\n\\n\"); //if at the start point we cannot go up down left or right - no possible moves - not solvable - end of maze \r\n regenerate(decider); //call the method that gives users the option to recreate the maze if it was unsolvable \r\n } \r\n \r\n else if(up.equals(\"O\")){ //if the coordinate in the up direction is O\r\n counter=counter+1; //incrementing counter so we can input it the coordinate arrays\r\n copyArray[y][x] = \"V\"; //changing the values to 'V' so we can know that we already visited it\r\n y=y-1; //moving coordinate up one \r\n xvalues[counter]=x; //storing this coordinate into the arrays with the counter\r\n yvalues[counter]=y;\r\n pathMethod(x, y, rows, columns, startPointX, startPointY, endPointX, endPointY, copyArray, realArray, decider); //recalling method\r\n }\r\n \r\n else if(down.equals(\"O\")){ //if down = O\r\n copyArray[y][x] = \"V\";\r\n counter=counter+1;\r\n y=y+1; \r\n xvalues[counter]=x;\r\n yvalues[counter]=y;\r\n pathMethod(x, y, rows, columns, startPointX, startPointY, endPointX, endPointY, copyArray, realArray, decider);\r\n }\r\n \r\n else if(right.equals(\"O\")){ //if right equals O\r\n copyArray[y][x] = \"V\";\r\n counter=counter+1;\r\n x=x+1;\r\n xvalues[counter]=x;\r\n yvalues[counter]=y;\r\n pathMethod(x, y, rows, columns, startPointX, startPointY, endPointX, endPointY, copyArray, realArray, decider);\r\n }\r\n \r\n else if(left.equals(\"O\")){ //if left equals O\r\n copyArray[y][x] = \"V\";\r\n counter=counter+1;\r\n x=x-1;\r\n xvalues[counter]=x;\r\n yvalues[counter]=y;\r\n pathMethod(x, y, rows, columns, startPointX, startPointY, endPointX, endPointY, copyArray, realArray, decider);\r\n }\r\n \r\n else { //if neither up down left or right work\r\n for(int i = 0; i<rows; i++){ //makes all the 'V's go back to O\r\n for(int j = 0; j<columns; j++){\r\n if(copyArray[i][j].equals(\"V\")){\r\n copyArray[i][j] = \"O\";\r\n }\r\n }\r\n }\r\n copyArray[y][x] = \"B\"; //make the coordinate that you cant make a move with B, so it shortens the possible path options\r\n for(int i = 0 ; i<counter; i++){\r\n xvalues[i] = 0; //resets the coordinate arrays back to 0\r\n yvalues[i] = 0;\r\n }\r\n counter=0; //resets counter back to 0;\r\n pathMethod(startPointX, startPointY, rows, columns, startPointX, startPointY, endPointX, endPointY, copyArray, realArray, decider); //resends the startpoints instead of x and y; only thing different is that one coordinate is now marked \"B\"\r\n } \r\n }", "public void advPath(BGPPath incPath) {\n this.incUpdateQueue.add(new BGPUpdate(incPath));\n }", "private void computePath(){\n LinkedStack<T> reversePath = new LinkedStack<T>();\n // adding end vertex to reversePath\n T current = end; // first node is the end one\n while (!current.equals(start)){\n reversePath.push(current); // adding current to path\n current = closestPredecessor[vertexIndex(current)]; // changing to closest predecessor to current\n }\n reversePath.push(current); // adding the start vertex\n \n while (!reversePath.isEmpty()){\n path.enqueue(reversePath.pop());\n }\n }", "private void buildPath() {\r\n int xNext = 1;\r\n int yNext = map.getStartPos() + 1;\r\n CellLayered before = cells[yNext][xNext];\r\n while(true)\r\n {\r\n Byte[] xy = map.getDirection(xNext-1, yNext-1);\r\n xNext = xNext + xy[0];\r\n yNext = yNext + xy[1];\r\n\r\n CellLayered next = cells[yNext][xNext];\r\n\r\n if(xy[0]==-1)\r\n before.setRight(false);\r\n else\r\n before.setRight(true);\r\n before.setPath(true);\r\n if(next==null)\r\n break;\r\n\r\n before.setNextInPath(next);\r\n before = next;\r\n }\r\n }", "public void step() {\n\t\tint step = rand.nextInt(2);\n\t\t\n\t\tif (step==0) {\n\t\t\t\n\t\t\tPoint moveRight = new Point(++x,y);\n\t\t\t\n\t\t\tif(x<=size-1) {\n\t\t\t\tpath.add(moveRight);\n\t\t\t}\n\t\t\telse --x;\n\t\t}\n\t\telse { \n\t\t\tPoint topStep = new Point(x,--y);\n\t\t\t\n\t\t\tif(y>=0) {\n\t\t\t\tpath.add(topStep);\n\t\t\t}\n\t\t\telse ++y;\n\t\t}\n\t\tif (x==size-1 && y==0) {\n\t\t\tsetDone(true);\n\t\t}\n\t\t\n\t\t\n\t}", "protected void next() {\n\t\t// Next node\n\t\tnode = path.remove(0);\n\t\ttransition(NavigatorState.ROTATE_TO);\n\t}", "@Override protected void pathStop() {\r\n\r\n // stop your robot here\r\n\r\n }", "@Override\n\tpublic void pathGenerated() {\n\n\t}", "public List<ArmConfig> splitDirectPath(ArmConfig init, ArmConfig goal){\n\t\t//System.out.println(path);\n\t\tArrayList<ArmConfig>result = new ArrayList<ArmConfig>();\n\t\tresult.add(init);\n\t\tArmConfig step = init;\n\t\tif(!isValidStep(init, goal)){\n\t\t\tAffineTransform af = new AffineTransform();\n\t\t\tdouble distX = goal.getBaseCenter().getX()- init.getBaseCenter().getX();\n\t\t\tdouble distY = goal.getBaseCenter().getY()- init.getBaseCenter().getY();\n\t\t\tint signX = (int) (distX/Math.abs(distX));\n\t\t\tint signY = (int)(distY/Math.abs(distY));\n\t\t\tList<Double> angleToCover = new ArrayList<Double>();\n\t\t\tfor(int i =0; i<goal.getJointCount();i++){\n\t\t\t\tangleToCover.add(goal.getJointAngles().get(i)-init.getJointAngles().get(i));\n\t\t\t}\n\t\t\t//need to change this so that only X or Y is changed\n\t\t\twhile(!isValidStep(step, goal)){\n\t\t\t\t//System.out.println(result);\n\t\t\t\tif(distY>=Sampler.CHAIR_STEP&& distX>=Sampler.CHAIR_STEP){\n\t\t\t\t\taf.setToTranslation(Sampler.CHAIR_STEP*signX, Sampler.CHAIR_STEP*signY);\n\t\t\t\t\tdistX=distX-Sampler.CHAIR_STEP;\n\t\t\t\t\tdistY= distY-Sampler.CHAIR_STEP;\n\t\t\t\t}else{\n\t\t\t\t\tif(distY>=Sampler.CHAIR_STEP&& distX<Sampler.CHAIR_STEP){\n\t\t\t\t\t\taf.setToTranslation(distX*signX, Sampler.CHAIR_STEP*signY);\n\t\t\t\t\t\tdistX=0;\n\t\t\t\t\t\tdistY=distY-Sampler.CHAIR_STEP;\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\tif(distY<Sampler.CHAIR_STEP&& distX>=Sampler.CHAIR_STEP){\n\t\t\t\t\t\taf.setToTranslation(Sampler.CHAIR_STEP*signX, distY*signY);\n\t\t\t\t\t\tdistX= distX-Sampler.CHAIR_STEP;\n\t\t\t\t\t\tdistY=0;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif(distY<Sampler.CHAIR_STEP&& distX<Sampler.CHAIR_STEP){\n\t\t\t\t\t\taf.setToTranslation(distX*signX,distY*signY);\n\t\t\t\t\t\tdistX=0;\n\t\t\t\t\t\tdistY=0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t Point2D base = new Point2D.Double();\n\t\t\t\t if(af.getTranslateX()!=0 && af.getTranslateY()!=0){\n\t\t\t\t\t if(Math.random()>0.5){\n\t\t\t\t\t\t distY+=af.getTranslateY();\n\t\t\t\t\t\t af.setToTranslation(af.getTranslateX(), 0);\n\t\t\t\t\t }else{\n\t\t\t\t\t\t distX+= af.getTranslateX();\n\t\t\t\t\t\t af.setToTranslation(0, af.getTranslateY());\n\t\t\t\t\t }\n\t\t\t\t }\n\t\t\t\t af.transform(step.getBaseCenter(), base);\n\t\t\t\t List<Double>rotate = new ArrayList<Double>();\n\t\t\t\t for(int i =0;i<angleToCover.size();i++){\n\t\t\t\t\t double remaining = angleToCover.get(i);\n\t\t\t\t\t if(remaining<Sampler.ANGLE_STEP){\n\t\t\t\t\t \trotate.add(step.getJointAngles().get(i)+remaining);\n\t\t\t\t\t}else{\n\t\t\t\t\t\trotate.add(step.getJointAngles().get(i)+Sampler.ANGLE_STEP);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t ArmConfig nextStep = new ArmConfig(base,rotate);\n\t\t\t\t result.add(nextStep);\n\t\t\t\t step = nextStep;\n\t\t\t}\n\t\t}\n\t\tresult.add(goal);\n\t\treturn result;\n\t\t\t \n\t}", "@Override\n\tpublic void getPathToMRT() {\n\n\t}", "private static void mutateRoute(Chromosome chromosome) {\n int pathLength = chromosome.path.length;\n\n // setting position a for the RSM mutation as a random city between the first and penultimate city in the route\n int a = ThreadLocalRandom.current().nextInt(0, pathLength-1);\n // setting position b for the RSM mutation as a random city between a and the last city in the route\n int b = ThreadLocalRandom.current().nextInt(a, pathLength);\n\n while (a < b){\n int temp = chromosome.path[a];\n chromosome.path[a] = chromosome.path[b];\n chromosome.path[b] = temp;\n\n a++;\n b--;\n }\n }", "public void descend() {\n \t\n elevator1.set(-0.9);\n elevator2.set(-0.9); \n }", "void reconstruct(HashMap<Integer, Vertex> h, Vertex next) {\n while (h.containsKey(next.toIdentifier())) {\n next.path = true;\n next = h.get(next.toIdentifier());\n }\n }", "void reconstruct(HashMap<Integer, Vertex> h, Vertex next) {\n while (h.containsKey(next.toIdentifier())) {\n next.path = true;\n next = h.get(next.toIdentifier());\n }\n }", "private final void generatePath(final Playfield playfield) {\n //neo will start at (0,0)\n // coordinates for the goal are random in range of 4-14\n int randomX = 4 + 10 * (int) Math.random();\n int randomY = 4 + 10 * (int) Math.random();\n this.goal = new Position(randomX, randomY);\n // goal =(randomX,randomY);\n // place pills\n playfield.addEntity(new Position(randomX, randomY / 2), new Pill(Color.RED));\n playfield.addEntity(new Position(0, randomY / 2), new Pill(Color.RED));\n playfield.addEntity(new Position(randomX / 2, randomY / 2), new Pill(Color.RED));\n playfield.addEntity(new Position(0, randomY / 2 + 1), new Pill(Color.RED));\n playfield.addEntity(new Position(randomX / 2, 0), new Pill(Color.RED));\n }", "@Override\n public void handle(long now) {\n OneIteration();\n if (current.getRow() == ia && current.getCol() == ja) {\n drawPath();\n this.stop();\n }\n }", "@Override\n public void continueTour(int timeout){\n long startTime = System.currentTimeMillis();\n LinkedList<Path> tourCalculated = deliveryGraph.solveTSP(timeout, false);\n this.timedOutError = deliveryGraph.getTimedOutError();\n tour = new Tour(tourCalculated);\n this.setChanged();\n this.notifyObservers();\n long totalTime = System.currentTimeMillis() - startTime;\n System.out.println(\"Tour (re)computed in \" + totalTime+\" ms with a timeout of \" + timeout + \" ms\");\n }", "public void setPath(String path)\r\n/* 21: */ {\r\n/* 22:53 */ this.path = path;\r\n/* 23: */ }", "private void resetRoute() {\n\t\troute = new Route[] {new Route(distanceMatrix)};\n\t\ttotalCost = 0;\n\t}", "private void recalcBestPath(int dest) {\n boolean changed;\n\n List<BGPPath> possList = this.inRib.get(dest);\n BGPPath currentBest = this.pathSelection(possList);\n BGPPath currentInstall = this.locRib.get(dest);\n\n /*\n * We need to handle advertisements in one of two cases a) we have found\n * a new best path and it's not the same as our current best path b) we\n * had a best path prior, but currently do not\n */\n changed = (currentBest != null && (currentInstall == null || !currentBest.equals(currentInstall)))\n || (currentBest == null && currentInstall != null);\n this.locRib.put(dest, currentBest);\n if (this.isWardenAS()) {\n if (currentBest == null) {\n this.routeStatusMap.put(dest, AS.RS_NULL);\n } else if (this.botSet == null) {\n this.routeStatusMap.put(dest, AS.RS_CLEAN);\n } else if (currentBest.containsAnyOf(this.botSet)) {\n this.routeStatusMap.put(dest, AS.RS_DIRTY);\n } else {\n this.routeStatusMap.put(dest, AS.RS_CLEAN);\n }\n }\n\n /*\n * If we have a new path, mark that we have a dirty destination\n */\n if (changed) {\n this.dirtyDest.add(dest);\n }\n }", "public void RecordDeadlockPath() {\r\n myNode currentNode; //The current node we're considering\r\n int pos; //position in path array\r\n int i;\r\n \r\n //Set up array to return\r\n tree.pathToDeadlock = new int[depth - 1];\r\n pos = depth - 2; // Start filling in at the end of the array\r\n \r\n currentNode = this;\r\n \r\n //For each ancestor node until root\r\n while(currentNode != tree.root) {\r\n // Work out which transition we followed to get to to currentNode\r\n loop: for(i = 0; i < tree.transitionCount; i++) {\r\n if (currentNode.parent.transArray[i]\r\n && currentNode.parent.children[i] == currentNode ) {\r\n // That's the one!\r\n break loop;\r\n }\r\n }\r\n \r\n tree.pathToDeadlock[pos] = i;\r\n pos--;\r\n //Update current node to look at an earlier ancestor\r\n currentNode = currentNode.parent;\r\n }\r\n \r\n //print(\"Path to deadlock is: \", tree.pathToDeadlock);//debug\r\n }", "protected void end() {\n\t\tdrive.setBoth(0);\n\t}", "public boolean pathCompleted() {\n\t\treturn path == null || path.isEmpty();\n\t}", "private void gotoPath() {\n\t\tfinal String hdfs = getFullPath(txtRootPath.getText().trim());\n\t\tif (StringUtils.isEmpty(hdfs)) {\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tFileStatus fs = getFileStatusWithProgress(hdfs);\n\t\t\tgotoPath(fs);\n\t\t} catch (Exception e) {\n\t\t\tMessageDialog.openError(getShell(), Messages.msgError, e.getMessage());\n\t\t}\n\t}", "@Override\n public void run() {\n\n // Define vehicle label if undefined\n if (this.label == null) {\n this.label = \"Vehicle_\" + this.getId();\n }\n\n // Ask roundabout object for path\n Deque<Vertex<AtomicReference>> path = this.getVehicleRoute(this.source, this.destination);\n Vertex<AtomicReference> last = null;\n\n // Get entry queue\n ConcurrentLinkedQueue<Vehicle> entry = this.roundabout.queueOnEntry(this, this.source);\n\n // Wait for first in queue\n while (entry.peek() != this) this.vehicleSleep(waitOnQueue());\n\n // Traverse Path\n for (Vertex<AtomicReference> v : path) {\n\n // Accelerate between path nodes\n if (this.speed < this.maxSpeed) this.speed = accelerate(this.speed);\n\n // Move to node\n while (!v.getValue().compareAndSet(null, this)) {\n\n // Decelerate to not crash into another vehicle\n while (this.speed > 0) this.speed = decelerate(this.speed);\n\n System.out.println(this.label + \": Waiting for next node \" + v.getKey());\n\n // Wait\n this.vehicleSleep(waitToTravel());\n }\n\n // Accelerate for next in case it has stopped\n while (this.speed <= 0) this.speed = accelerate(this.speed);\n\n System.out.println(this.label + \": Moving to node \" + v.getKey() + \" for \" + travel());\n\n // Moving from node to node\n this.vehicleSleep(travel());\n\n // Remove myself from queue only after locking the first node\n if (path.peekFirst() == v) entry.remove(this);\n\n // Release last node\n while (last != null && !last.getValue().compareAndSet(this, null)) ;\n\n // Assign v as the last node which it travelled to\n last = v;\n }\n\n // Release last node\n while (!last.getValue().compareAndSet(this, null)) ;\n }", "private void generatePath(List<Coordinate> source, List<Coordinate> path) {\n for (int i = 0; i < source.size() - 1; i++) {\n Graph graph = new Graph(getEdge(map));\n Coordinate start = source.get(i);\n Coordinate end = source.get(i + 1);\n graph.dijkstra(start);\n graph.printPath(end);\n for (Graph.Node node : graph.getPathReference()) {\n path.add(node.coordinate);\n }\n }\n }", "public synchronized boolean isPathFinished() {\n if (pathFollower.getFinished()) {\n lastAngle = pathFollower.getEndHeading();\n RobotState.mDriveControlState = DriveControlState.OPEN_LOOP;\n pathFollower = null;\n leftStatus = TrajectoryStatus.NEUTRAL;\n rightStatus = TrajectoryStatus.NEUTRAL;\n return true;\n }\n return false;\n }", "public void followPath(Path path) {\n\t\tdrive.resetDriveEncoders();\n\t\tswitch(path.getMode()) {\n\t\tcase BACKWARD_HIGH:\n\t\t\tleft = new EncoderFollower(Pathfinder.readFromCSV(path.getRightPath()));\n\t\t\tright = new EncoderFollower(Pathfinder.readFromCSV(path.getLeftPath()));\n\t\t\tleft.configurePIDVA(Constants.kMotionProfile_kP, Constants.kMotionProfile_kI, Constants.kMotionProfile_kD, Constants.kMotionProfileLeftBackHigh_kV / 12, Constants.kMotionProfileLeftBackHigh_kA / 12);\n\t\t\tright.configurePIDVA(Constants.kMotionProfile_kP, Constants.kMotionProfile_kI, Constants.kMotionProfile_kD, Constants.kMotionProfileRightBackHigh_kV / 12, Constants.kMotionProfileRightBackHigh_kA / 12);\n\t\t\tleftVIntercept = Constants.kMotionProfileLeftBackHigh_Intercept / 12;\n\t\t\trightVIntercept = Constants.kMotionProfileRightBackHigh_Intercept / 12;\n\t\t\tdirection = -1;\n\t\t\tbreak;\n\t\tcase BACKWARD_LOW:\n\t\t\tleft = new EncoderFollower(Pathfinder.readFromCSV(path.getRightPath()));\n\t\t\tright = new EncoderFollower(Pathfinder.readFromCSV(path.getLeftPath()));\n\t\t\tleft.configurePIDVA(Constants.kMotionProfile_kP, Constants.kMotionProfile_kI, Constants.kMotionProfile_kD, Constants.kMotionProfileLeftBackLow_kV / 12, Constants.kMotionProfileLeftBackLow_kA / 12);\n\t\t\tright.configurePIDVA(Constants.kMotionProfile_kP, Constants.kMotionProfile_kI, Constants.kMotionProfile_kD, Constants.kMotionProfileRightBackLow_kV / 12, Constants.kMotionProfileRightBackLow_kA / 12);\n\t\t\tleftVIntercept = Constants.kMotionProfileLeftBackLow_Intercept / 12;\n\t\t\trightVIntercept = Constants.kMotionProfileRightBackLow_Intercept / 12;\n\t\t\tdirection = -1;\n\t\t\tbreak;\n\t\tcase FORWARD_HIGH:\n\t\t\tleft = new EncoderFollower(Pathfinder.readFromCSV(path.getLeftPath()));\n\t\t\tright = new EncoderFollower(Pathfinder.readFromCSV(path.getRightPath()));\n\t\t\tleft.configurePIDVA(Constants.kMotionProfile_kP, Constants.kMotionProfile_kI, Constants.kMotionProfile_kD, Constants.kMotionProfileLeftForeHigh_kV / 12, Constants.kMotionProfileLeftForeHigh_kA / 12);\n\t\t\tright.configurePIDVA(Constants.kMotionProfile_kP, Constants.kMotionProfile_kI, Constants.kMotionProfile_kD, Constants.kMotionProfileRightForeHigh_kV / 12, Constants.kMotionProfileRightForeHigh_kA / 12);\n\t\t\tleftVIntercept = Constants.kMotionProfileLeftForeHigh_Intercept / 12;\n\t\t\trightVIntercept = Constants.kMotionProfileRightForeHigh_Intercept / 12;\n\t\t\tdirection = 1;\n\t\t\tbreak;\n\t\tcase FORWARD_LOW:\n\t\t\tleft = new EncoderFollower(Pathfinder.readFromCSV(path.getLeftPath()));\n\t\t\tright = new EncoderFollower(Pathfinder.readFromCSV(path.getRightPath()));\n\t\t\tleft.configurePIDVA(Constants.kMotionProfile_kP, Constants.kMotionProfile_kI, Constants.kMotionProfile_kD, Constants.kMotionProfileLeftForeLow_kV / 12, Constants.kMotionProfileLeftForeLow_kA / 12);\n\t\t\tright.configurePIDVA(Constants.kMotionProfile_kP, Constants.kMotionProfile_kI, Constants.kMotionProfile_kD, Constants.kMotionProfileRightForeLow_kV / 12, Constants.kMotionProfileRightForeLow_kA / 12);\n\t\t\tleftVIntercept = Constants.kMotionProfileLeftForeLow_Intercept / 12;\n\t\t\trightVIntercept = Constants.kMotionProfileRightForeLow_Intercept / 12;\n\t\t\tdirection = 1;\n\t\t\tbreak;\n\t\t}\n\t\tif(Constants.kNEOEncoders) {\n\t\t\tencoderCodesPerRev = Constants.kNEODriveEncoderCodesPerRev;\n\t\t}\n\t\telse {\n\t\t\tencoderCodesPerRev = Constants.kDriveEncoderCodesPerRev;\n\t\t}\n\t\tleft.configureEncoder((int)drive.getLeftRioPositionTicks(), encoderCodesPerRev, Constants.kWheelDiameter / 12);\n\t\tright.configureEncoder((int)drive.getRightRioPositionTicks(), encoderCodesPerRev, Constants.kWheelDiameter / 12);\n\t\tpathFinished = false;\n\t\t\n\t\tdrive.set(0, 0);\n\t\tdrive.setDriveMode(DriveMode.MOTION_PROFILE);\n\t\tnotifier.startPeriodic(0.01);\n\t}", "private void finishBuilding() {\n buildTarget = null;\n buildStep = 0;\n buildInstructions = null;\n buildLocation = null;\n buildHeight = null;\n\n knowledge.myState = RobotState.IDLE;\n }", "@Override\n\tprotected void pathDestinationReached() {\n\t\tif (Util.rand.nextFloat() < 0.3f)\n\t\t\trestartAnimation(dancingAnim);\n\t\telse\n\t\t\trandomMove();\n\t}" ]
[ "0.7234013", "0.66378725", "0.6504491", "0.6450179", "0.63537586", "0.63157415", "0.6201582", "0.61919385", "0.6134449", "0.6103762", "0.6026457", "0.59080315", "0.59074277", "0.5850241", "0.5795253", "0.57616204", "0.5736046", "0.57192826", "0.5708641", "0.5703777", "0.57030994", "0.5694656", "0.5690412", "0.5632637", "0.5610337", "0.55796266", "0.55692166", "0.5566646", "0.5538751", "0.5537898", "0.552628", "0.5525136", "0.55201447", "0.551409", "0.5475656", "0.54642415", "0.5457828", "0.5454148", "0.5422026", "0.54055965", "0.5405585", "0.5401799", "0.5396308", "0.5380469", "0.53749585", "0.536466", "0.5362519", "0.5362019", "0.5360511", "0.5358961", "0.5352856", "0.5347813", "0.534385", "0.53406024", "0.53337824", "0.53239435", "0.5321491", "0.53099865", "0.5308879", "0.5303051", "0.5273082", "0.52637184", "0.52585775", "0.52481365", "0.5236751", "0.52250296", "0.5199311", "0.5197578", "0.5184631", "0.51844704", "0.51814675", "0.5164585", "0.51591766", "0.514985", "0.51403165", "0.51271147", "0.5122428", "0.5106001", "0.51009715", "0.5100888", "0.5094576", "0.50911206", "0.50870115", "0.50870115", "0.5086403", "0.50853884", "0.5084993", "0.50823957", "0.5081848", "0.5069213", "0.50648606", "0.5062891", "0.50556684", "0.50497216", "0.5034995", "0.50308865", "0.50101537", "0.5001169", "0.49983543", "0.49945378" ]
0.5830018
14
This is called every tick by the scheduler. It moves the agent along the path.
@Override public void step(SimState state) { PedSimCity stateSchedule = (PedSimCity) state; minutesSoFar += UserParameters.minutesPerStep; if (UserParameters.activityBased && minutesSoFar == UserParameters.endingHour) { System.out.println("End of the day - calling finish"); stateSchedule.finish(); } else if ((reachedDestination || destinationNode == null) && !UserParameters.activityBased) { if (reachedDestination) reachedDestination = false; if ((numTrips == ap.OD.size() && !UserParameters.empiricalABM) || (UserParameters.empiricalABM && this.numTrips == UserParameters.numTrips)) { stateSchedule.agentsList.remove(this); if (stateSchedule.agentsList.size() == 0) { System.out.println("calling finish"); stateSchedule.finish(); } killAgent.stop(); return; } else if (UserParameters.empiricalABM) { originNode = destinationNode = null; while (originNode == null) originNode = NodesLookup.randomNode(PedSimCity.network); while (destinationNode == null) destinationNode = NodesLookup.randomNodeBetweenLimits(PedSimCity.network, originNode, UserParameters.minDistance, UserParameters.maxDistance); } else { originNode = (NodeGraph) ap.OD.get(numTrips).getValue(0); destinationNode = (NodeGraph) ap.OD.get(numTrips).getValue(1); } updatePosition(originNode.getCoordinate()); findNewAStarPath(stateSchedule); return; } else if (UserParameters.activityBased) { ap.totalTimeAway += UserParameters.minutesPerStep; if (!reachedDestination & !ap.atPlace) keepWalking(); else { ActivityPlanner activityPlanner = new ActivityPlanner(); activityPlanner.checkRoutine(state, this); if (ap.atPlace) return; } } else keepWalking(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void move() {\n\n\tGrid<Actor> gr = getGrid();\n\tif (gr == null) {\n\n\t return;\n\t}\n\n\tLocation loc = getLocation();\n\tif (gr.isValid(next)) {\n\n\t setDirection(loc.getDirectionToward(next));\n\t moveTo(next);\n\n\t int counter = dirCounter.get(getDirection());\n\t dirCounter.put(getDirection(), ++counter);\n\n\t if (!crossLocation.isEmpty()) {\n\t\t\n\t\t//reset the node of previously occupied location\n\t\tArrayList<Location> lastNode = crossLocation.pop();\n\t\tlastNode.add(next);\n\t\tcrossLocation.push(lastNode);\t\n\t\t\n\t\t//push the node of current location\n\t\tArrayList<Location> currentNode = new ArrayList<Location>();\n\t\tcurrentNode.add(getLocation());\n\t\tcurrentNode.add(loc);\n\n\t\tcrossLocation.push(currentNode);\t\n\t }\n\n\t} else {\n\t removeSelfFromGrid();\n\t}\n\n\tFlower flower = new Flower(getColor());\n\tflower.putSelfInGrid(gr, loc);\n\t\n\tlast = loc;\n\t\t\n }", "protected void move()\n {\n // Find a location to move to.\n Debug.print(\"Fish \" + toString() + \" attempting to move. \");\n Location nextLoc = nextLocation();\n\n // If the next location is different, move there.\n if ( ! nextLoc.equals(location()) )\n {\n // Move to new location.\n Location oldLoc = location();\n changeLocation(nextLoc);\n\n // Update direction in case fish had to turn to move.\n Direction newDir = environment().getDirection(oldLoc, nextLoc);\n changeDirection(newDir);\n Debug.println(\" Moves to \" + location() + direction());\n }\n else\n Debug.println(\" Does not move.\");\n }", "public void move() {\n\t\tGrid<Actor> gr = getGrid();\n\t\tif (gr == null) {\n\t\t\treturn;\n\t\t}\n\t\tLocation loc = getLocation();\n\t\tLocation next = loc.getAdjacentLocation(getDirection());\n\t\t\n\t\tLocation next2 = next.getAdjacentLocation(getDirection());\n\t\tif (gr.isValid(next2)) {\n\t\t\tmoveTo(next2);\n\t\t} else {\n\t\t\tremoveSelfFromGrid();\n\t\t}\n\t}", "public void act(){\n // Removing object, if out of the simulated zone\n if (atWorldEdge()){\n getWorld().removeObject(this);\n return;\n }\n\n //Move Thanos up\n setLocation (getX(), getY() - speed);\n }", "public void move() {\n\t\tthis.position.stepForwad();\n\t\tthis.position.spin();\n\t}", "public void move() {\n\t\tGrid<Actor> gr = getGrid();\n\t\tif (gr == null) {\n\t\t\treturn;\n\t\t}\n\t\tLocation loc = getLocation();\n\t\tif (gr.isValid(next)) {\n\t\t\tsetDirection(getLocation().getDirectionToward(next));\n\t\t\tmoveTo(next);\n\t\t} else {\n\t\t\tremoveSelfFromGrid();\n\t\t}\n\t\tFlower flower = new Flower(getColor());\n\t\tflower.putSelfInGrid(gr, loc);\n\t}", "private void move() {\n\t\t\tx += Math.PI/12;\n\t\t\thead.locY = intensity * Math.cos(x) + centerY;\n\t\t\thead.yaw = spinYaw(head.yaw, 3f);\n\t\t\t\t\t\n\t\t\tPacketHandler.teleportFakeEntity(player, head.getId(), \n\t\t\t\tnew Location(player.getWorld(), head.locX, head.locY, head.locZ, head.yaw, 0));\n\t\t}", "public void move() {\n Grid<Actor> gr = getGrid();\n if (gr == null) {\n return;\n }\n Location loc = getLocation();\n if (gr.isValid(next)) {\n setDirection(getLocation().getDirectionToward(next));\n moveTo(next);\n } else {\n removeSelfFromGrid();\n }\n Flower flower = new Flower(getColor());\n flower.putSelfInGrid(gr, loc);\n }", "public void move()\n {\n move(WALKING_SPEED);\n }", "public void move() {\n\t\tmoveX();\n\t\tmoveY();\n\t}", "@Override\n protected void processPathAction(GridNode start, GridNode goal, Stack<GridNode> path) {\n path.pop();\n\n // Make the robot follow the path\n Mover mover = new Mover(\n robot.getDifferentialPilot(),\n new LightSensor(leftSensorPort),\n new LightSensor(rightSensorPort),\n path,\n initialDirection);\n mover.run();\n }", "@Override\r\n public void move() {\r\n Grid<Actor> gr = getGrid();\r\n if (gr == null) {\r\n return;\r\n }\r\n Location loc = getLocation();\r\n if (gr.isValid(next)) {\r\n setDirection(getLocation().getDirectionToward(next));\r\n moveTo(next);\r\n } else {\r\n removeSelfFromGrid();\r\n }\r\n Flower flower = new Flower(getColor());\r\n flower.putSelfInGrid(gr, loc);\r\n }", "public void updatemove() {\n\t\tmove = new Movement(getX(), getY(),dungeon,this);\n\t\t//System.out.println(\"Updated\");\n\t\tnotifys();\n\t\tif(this.getInvincible()) {\n\t\t\tsteptracer++;\n\t\t}\n\t\tdungeon.checkGoal();\n\t}", "@Override\n public void act(AgentImp agent) {\n Coordinate coordinate = agent.generateRandomMove();\n if (coordinate != null)\n agent.step(coordinate.getX(), coordinate.getY());\n else\n agent.skip();\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}", "@Override\n public void timePassed() {\n moveOneStep();\n }", "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 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 void move() {\n\t\tthis.hero.setPF(1);\n\t\tthis.hero.setState(this.hero.getMoved());\n\t}", "public void move(){\n \n currentFloor = currentFloor + ( 1 * this.direction);\n //if we're at the bottom or top after move, flip the bit\n if(Elevator.MIN_FLOOR == currentFloor \n || currentFloor == Elevator.MAX_FLOOR)\n this.direction *= -1;\n \n if(destinedPassengers[ currentFloor ] > 0)\n elevatorStop( currentFloor, true );\n \n if(building.floor(currentFloor).passengersWaiting() > 0)\n elevatorStop(currentFloor, false);\n \n }", "void move() {\n\t\tif (reachedEdge()) {\n\t\t\tvelocityX = velocityX * -1;\n\t\t\ty = y + 50;\n\t\t}\n\t\tif (reachedLeft()) {\n\t\t\tvelocityX = velocityX * -1;\n\t\t\ty = y + 50;\n\t\t}\n\n\t\tx = x + velocityX;\n\t}", "public void move() {\r\n\t\tSystem.out.print(\"This Goose moves forward\");\r\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 move()\n\t{\n time++;\n\t\tif (time % 10 == 0)\n\t\t{\n\t\t\thistogramFrame.clearData();\n\t\t}\n\t\tfor (int i = 0; i < nwalkers; i++)\n\t\t{\n\t\t\tdouble r = random.nextDouble();\n\t\t\tif (r <= pRight)\n\t\t\t{\n\t\t\t\txpositions[i] = xpositions[i] + 1;\n\t\t\t}\n\t\t\telse if (r < pRight + pLeft)\n\t\t\t{\n\t\t\t\txpositions[i] = xpositions[i] - 1;\n\t\t\t}\n\t\t\telse if (r < pRight + pLeft + pDown)\n\t\t\t{\n\t\t\t\typositions[i] = ypositions[i] - 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\typositions[i] = ypositions[i] + 1;\n\t\t\t}\n\t\t\tif (time % 10 == 0)\n\t\t\t{\n\t\t\t\thistogramFrame.append(Math.sqrt(xpositions[i] * xpositions[i]\n\t\t\t\t\t\t+ ypositions[i] * ypositions[i]));\n\t\t\t}\n\t\t\txmax = Math.max(xpositions[i], xmax);\n\t\t\tymax = Math.max(ypositions[i], ymax);\n\t\t\txmin = Math.min(xpositions[i], xmin);\n\t\t\tymin = Math.min(ypositions[i], ymin);\n\t\t}\n\t}", "public void move() {\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t}", "@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 void act() \n {\n move(-16);\n \n \n if (isAtEdge())\n {\n setLocation(700,getY());\n }\n \n if (isTouching(Shots.class))\n {\n getWorld().addObject(new SpaceObject(), 500,Greenfoot.getRandomNumber(400));\n }\n \n }", "private void move() {\n System.out.println(\"current dir= \" + head.dir);\n addToHead();\n deleteFromTail();\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 }", "@Override\n public void move(){\n setDirectionSpeed(180, 7);\n this.moveTowardsAPoint(target.getCenterX(), target.getCenterY());\n }", "public void move() {\n if(Objects.nonNull(this.position)) {\n Position position = this.getPosition();\n Function<Position, Position> move = moveRobotInDirectionMap.get(position.getDirection());\n this.position = move.apply(position);\n }\n }", "public void move() {\n\t\tif (type.equals(\"Fast\")) {\n\t\t\tspeed = 2;\n\t\t}else if (type.equals(\"Slow\")){\n\t\t\tspeed = 4;\n\t\t}\n\t\t\n\t\tif (rand.nextInt(speed) == 1){\n\t\t\tif (currentLocation.x - ChristopherColumbusLocation.x < 0) {\n\t\t\t\tif (currentLocation.x + 1 < oceanMap.getDimensions()) {\n\t\t\t\t\tcurrentLocation.x++;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (currentLocation.x != 0) {\t\t\t\t\n\t\t\t\t\tcurrentLocation.x--;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (currentLocation.y - ChristopherColumbusLocation.y < 0) {\n\t\t\t\tif (currentLocation.y + 1 < oceanMap.getDimensions()) {\n\t\t\t\t\tcurrentLocation.y++;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (currentLocation.y != 0) {\n\t\t\t\t\tcurrentLocation.y--;\n\t\t\t\t}\n\t\t\t} \n\t\t}\n\t}", "public void move()\n\t{\n\t\tVector v = ship.v;\n\t\tb = b.getLocation().add(v).getBlock();\n\t\tif(triangle != null) triangle.move();\n\t\tif(rear != null) rear.move();\n\t\tif(foreAndAft != null) foreAndAft.move();\n\t\tif(sails != null) for(int i = 0; i < sails.size(); i++)\n\t\t{\n\t\t\tSail sail = sails.get(i);\n\t\t\tsail.move();\n\t\t}\n\t}", "public void moveAgentTo(Agent ag, int door) throws InterruptedException {\n ProcessData data = (ProcessData) agents.get(ag);\n Vertex vertexFrom, vertexTo;\n Message msg;\n MessagePacket msgPacket;\n \n \n if( door < 0 || door >= getArity(ag))\n throw new IllegalArgumentException(\"This door doesn't exist !\");\n\n vertexFrom = data.vertex;\n vertexTo = vertexFrom.neighbour(door);\n\n msg = new StringMessage(ag.toString());\n msgPacket = new MessagePacket(vertexFrom.identity(), door, \n vertexTo.identity(), msg);\n\t\n\tpushMessageSendingEvent(msgPacket,ag);\n\t\n\n\tdata.vertex = vertexTo;\n\tdata.lastVertexSeen = vertexFrom;\n\n stats.add(new MoveStat(ag.getClass()));\n }", "public void step(){\n if (this.jobs.contains(this.currentFloor)){ //we arrived at our destination\n this.openDoor();\n this.leavePeople();\n this.deleteJob(this.currentFloor);\n } else {\n this.closeDoor();\n this.changeState();\n this.move();\n }\n }", "@Override\n\tpublic void move() {\n\t\tCoordinate currPos = new Coordinate(control.getPosition());\n\t\t\n\t\t// if we have enough packages head to the exit\n\t\tif (control.numParcels() <= control.numParcelsFound()) {\n\t\t\t// if we don't have a path to the exit\n\t\t\tif (control.currentPath == null || !control.isHeadingToFinish) {\t\n\t\t\t\t// find path to exit\n\t\t\t\tArrayList<Coordinate> tempPath = null;\n\t\t\t\t// See if there's a path without needing to go through hazards\n\t\t\t\ttempPath = control.findPath(currPos, control.finish.get(0), control.hazardsMap.keySet());\n\t\t\t\tSet<Coordinate> tempHazards = new HashSet<>(control.hazardsMap.keySet());\n\t\t\t\t// If no path without going through hazards, just go through them\n\t\t\t\tif (tempPath == null || tempPath.size() == 0) {\n\t\t\t\t\tfor (Coordinate coord : control.hazardsMap.keySet()) {\n\t\t\t\t\t\ttempHazards.remove(coord);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// If it's a valid map, there should be a path now\n\t\t\t\tcontrol.setPath(control.findPath(currPos, control.finish.get(0), tempHazards));\n\t\n\t\t\t\tcontrol.isHeadingToFinish = true;\n\t\t\t}\n\t\t}\n\t\t\n\t\theadTowardsPackages(currPos);\n\t\t\n\t\texploreUnseenMap(currPos);\n\t\t\n\t\tMapTile currTile = control.getView().get(currPos);\n\t\tboolean isHealth = false;\n\t\tif (currTile.getType() == MapTile.Type.TRAP) {\n\t\t\tTrapTile trap = (TrapTile) currTile;\n\t\t\tif (trap.getTrap().equals(\"health\")) {\n\t\t\t\tisHealth = true;\n\t\t\t}\n\t\t}\n\t\tif (isHealth && (control.getHealth() < HEALTH_TRAP_THRESHOLD)) {\n\t\t\t// do nothing\n\t\t\treturn;\n\t\t} else {\n\t\t\tisHealth = false;\n\t\t\tcontrol.moveTowards(control.dest);\n\t\t}\n\t\t\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 }", "private void traversePath()\n\t{\n\t\trobot.forward(50);\n\t\trobot.right(90);\n\t\trobot.forward(50);\n\t\trobot.right(90);\n\t\trobot.forward(50);\n\t\trobot.left(90);\n\t\trobot.forward(50);\n\t\trobot.left(90);\n\t}", "public void move() {\n\t\tthis.move(velocity.x, velocity.y);\n\t}", "public void move() {\n\t\t// Override move so we don't move, then get location set by owner.\n\t}", "public void walk(Agent agent) throws RemoteException {\nSystem.out.println(\"Em walk: agent = \" + agent.toXml());\n\t\tint currRow = agent.getRow();\n\t\tint currCol = agent.getColumn();\n\t\tint oldRow = currRow;\n\t\tint oldCol = currCol;\n\t\tswitch (agent.getDirection()) {\n\t\t\tcase UP: oldRow--; break;\n\t\t\tcase DOWN: oldRow++; break;\n\t\t\tcase LEFT: oldCol++; break;\n\t\t\tcase RIGHT: oldCol--; break;\n\t\t}\n\t\tString agentName = agent.getName();\n\t\tObject obj = agents.get(agentName);\n\t\tPoint p = (Point) obj;\n\t\tif (oldRow != p.x || oldCol != p.y) {\n\t\t\tSystem.out.println(\"Incompativeis!!! \");\n\t\t\treturn;\n\t\t}\n\t\tp.x = currRow;\n\t\tp.y = currCol;\n\t\tremoveImage(oldRow, oldCol, agentName);\n\t\tif (agent instanceof Wumpus) {\n\t\t\taddImage(currRow, currCol, agentName, WUMPUS_FILE);\n\t\t\tcheckStench(currRow + 1, currCol - 1, currRow - 1, currCol + 1);\n\t\t} else {\n\t\t\taddImage(currRow, currCol, agentName, EXPLORER_FILE);\n\t\t}\n\t\tsetDirection(currRow, currCol, agentName, agent.getDirection());\n\t}", "public void move() {\n\t\t\tar.setAhead(10 * fahrtrichtung);\n\n\t\t\t// Wie schnell sich der Roboter drehen soll\n\t\t\tar.setTurnRight(45 * drehrichtung);\n\t\t\tar.execute();\n\t\t\tfarbschema = farbschema * (-1);\n\t\t}", "public void moveAllAgents() {\n\t\tPoint moveTo \t\t= null;\n\t\tGameClient client \t= null;\n\t\t\n\t\tfor(Player p : playerList) {\n\t\t\tif(p.getType() == PlayerType.Agent) {\n\t\t\t\tclient = HandleCommunication.findClient(p.getName(), server.getConnectedClientList());\n\t\t\t\tmoveTo = getSafeTeleportPosition();\n\t\t\t\tmovePlayer(p.getName(), p.getPosition(), moveTo, false);\n\t\t\t\tserver.sendMessageToClient(client.getClientSocket(), \"@124@\" + moveTo.x + \"@\" + moveTo.y + \"@\");\n\t\t\t}\n\t\t}\n\t}", "public void move(int tick) {\n moveMade = true;\n Location newTail;\n if (grow) {\n\n switch (body.getLast().direction) {\n case RIGHT:\n newTail = new Location(body.getLast().locX - GraphicsBounds.spriteSize,\n body.getLast().locY, body.getLast().direction);\n break;\n case LEFT:\n newTail = new Location(body.getLast().locX + GraphicsBounds.spriteSize,\n body.getLast().locY, body.getLast().direction);\n break;\n case UP:\n newTail = new Location(body.getLast().locX, body.getLast().locY\n + GraphicsBounds.spriteSize, body.getLast().direction);\n break;\n case DOWN:\n newTail = new Location(body.getLast().locX, body.getLast().locY\n - GraphicsBounds.spriteSize, body.getLast().direction);\n break;\n default:\n newTail = new Location(0,0);\n break;\n\n }\n\n\n body.addLast(newTail);\n }\n\n for (int i = body.size() - 1; i > 0; i--) {\n body.get(i).direction = body.get(i - 1).direction;\n }\n\n switch (direction) {\n case RIGHT:\n body.getFirst().direction = Direction.RIGHT;\n break;\n case LEFT:\n body.getFirst().direction = Direction.LEFT;\n break;\n case UP:\n body.getFirst().direction = Direction.UP;\n break;\n case DOWN:\n body.getFirst().direction = Direction.DOWN;\n break;\n default:\n break;\n }\n\n\n\n for (int i = body.size() - 1; i >= 0; i--) {\n Direction dir = body.get(i).direction;\n Location segment = body.get(i);\n switch (dir) {\n case RIGHT:\n segment.locX += snakeSpeed;\n break;\n case LEFT:\n segment.locX -= snakeSpeed;\n break;\n case UP:\n segment.locY -= snakeSpeed;\n break;\n case DOWN:\n segment.locY += snakeSpeed;\n break;\n default:\n break;\n }\n }\n\n\n\n grow = false;\n }", "public void move(){\n\t\tif (currentFloor == TOTALFLOORS) currentDirection = \"DOWN\"; else currentDirection =\"UP\";\t\t//sets inital direction for the elevator.\n\t\tfor (int x = 1; x <= TOTALFLOORS; x++){\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//This loop will move the elevator through each floor. \n\t\t\tif (getTotalPassDestFloor()[currentFloor] >0 || destRequest[currentFloor] == 'Y')this.stop(); \t//Checks for the destined passengers or registered request for the current floor.\n\t\t\tif (currentDirection == \"UP\") currentFloor++; else currentFloor--;\t\t\t\t\t\t\t//Moves the elevator up/down based on the direction\n\t\t}\n\t\tif (currentFloor == 8) currentFloor--;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//Adjusts currentfloor value when elevator-\n\t\tif (currentFloor == 0) currentFloor++;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//-is at first or top most floor\n\t}", "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}", "@Override\r\n public void act() {\r\n boolean willMove = canMove();\r\n if (isEnd) {\r\n // to show step count when reach the goal\r\n if (!hasShown) {\r\n String msg = stepCount.toString() + \" steps\";\r\n JOptionPane.showMessageDialog(null, msg);\r\n hasShown = true;\r\n }\r\n } else if (willMove) {\r\n move();\r\n // increase step count when move\r\n stepCount++;\r\n // 把当前走过的位置加入栈顶的arrayList\r\n crossLocation.peek().add(getLocation());\r\n // 当前方向的概率+1\r\n probablyDir[getDirection() / 90]++;\r\n } else if (!willMove) {\r\n // 这时候必须一步一步返回栈顶arrayList的开头\r\n ArrayList<Location> curCrossed = crossLocation.peek();\r\n curCrossed.remove(curCrossed.size() - 1);\r\n next = curCrossed.get(curCrossed.size() - 1);\r\n move();\r\n stepCount++;\r\n // 当前方向反向的概率-1\r\n probablyDir[((getDirection() + Location.HALF_CIRCLE)\r\n % Location.FULL_CIRCLE) / Location.RIGHT]--;\r\n if (curCrossed.size() == 1) {\r\n // 返回之后pop\r\n crossLocation.pop();\r\n }\r\n }\r\n }", "private void move() {\n acceleration.accelerate(velocity, position);\r\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 void move() {\n super.move(DIRECTION.getRandom());\n }", "public void move() {\n\r\n\t}", "public void move() {\r\n\t\tSystem.out.print(\"This Tiger moves forward\");\r\n\t}", "@Override\r\n\tpublic void move()\r\n\t{\r\n\t\t//Updates the X and Y position by using dx and dy\r\n float x = location.getX() + dx;\r\n float y = location.getY() + dy;\r\n \r\n //Updates the particle emitter's position to the missiles current position\r\n emitter.setPosition(this.getPositionX(), this.getPositionY(),false);\r\n \r\n //Updates the location of the missile\n setLocation(x, y);\n\t}", "public void move() {\r\n\t\tSystem.out.print(\"This animal moves forward\");\r\n\t}", "public void followPath(List<Node> path) {\r\n\t\tfloat xlocation = creature.getXlocation();\r\n\t\tfloat ylocation = creature.getYlocation();\r\n\t\t//Path check timer\r\n\t\t/*-------------------------------------------------------------*/\r\n\t\tpathCheck += System.currentTimeMillis() - lastPathCheck;\r\n\t\tlastPathCheck = System.currentTimeMillis();\r\n\t\tif(pathCheck >= pathCheckCooldown) {\r\n\t\t/*-------------------------------------------------------------*/\r\n\t\t\tcreature.xMove = 0;\r\n\t\t\tcreature.yMove = 0;\r\n\t\t\tcreature.path = path;\r\n\t\t\tif (creature.path != null) {\r\n\t\t\t\tif (creature.path.size() > 0) {\r\n\t\t\t\t\tVector2i vec = creature.path.get(creature.path.size() - 1).tile;\r\n\t\t\t\t\tif (xlocation / Tile.TILEWIDTH < vec.getX() + .5) creature.xMove = creature.speed;\t\t//Right\r\n\t\t\t\t\telse if (xlocation / Tile.TILEWIDTH > vec.getX() + .5) creature.xMove = -creature.speed;\t//Left\t\t/\r\n\t\t\t\t\tif (ylocation / Tile.TILEHEIGHT < vec.getY() + .5) creature.yMove = creature.speed;\t\t//Down\r\n\t\t\t\t\telse if (ylocation / Tile.TILEHEIGHT > vec.getY() + .5) creature.yMove = -creature.speed;\t//Up\t\t/\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\tPoint p = moveToCenter(2, creature);\r\n\t\t\t\t\tif(p.getX() == 0 && p.getY() == 0) {\r\n\t\t\t\t\t\tcreature.travelling = false;\r\n\t\t\t\t\t} else {\t\t\t\t\r\n\t\t\t\t\tcreature.xMove = creature.speed * p.getX();\r\n\t\t\t\t\tcreature.yMove = creature.speed * p.getY();\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}", "@Override\r\n public void move(List<Building> landmark, List<Pair<Integer, Integer>> orderedPath) {\r\n int moveChoice = (new Random()).nextInt(2);\r\n // 50% chance to move or not move\r\n if (moveChoice == 0){\r\n // Does not move, i.e. does nothing\r\n }\r\n else if (moveChoice == 1){\r\n // Move\r\n int directionChoice = (new Random()).nextInt(2);\r\n if (directionChoice == 0) {\r\n moveUpPath();\r\n } else if (directionChoice == 1) {\r\n moveDownPath();\r\n }\r\n }\r\n }", "@Override\n public void move()\n {\n System.out.println(\"tightrope walking\");\n }", "public void moving()\n {\n if(onPlatform()&&endPlatform()){\n direction();\n }\n if(onPlatform()&&!endPlatform()){\n changeDirection();\n direction();\n }\n collideMoveLocation(horzVelocity,1);\n //sharaz\n if(isTouching(PushObject.class)){\n changeDirection();\n direction();\n }\n \n \n }", "public void move(){\n\t\t\n\t}", "protected void execute() {\r\n \tmanipulator.moveElevator(speed);\r\n }", "public void move() {\n\t\tdy += acceleration;\n\t\tupdateTail();\n\t\ty += dy;\n\t}", "public void act() {\n\n\tif (0 == stepCount) {\n\n\t ArrayList<Location> node = new ArrayList<Location>();\n\t node.add(getLocation());\n\t crossLocation.push(node);\n\t}\n\n\tboolean willMove = canMove();\n\tif (isEnd == true) {\n\t //to show step count when reach the goal\t\t\n\t if (hasShown == false) {\n\t\tString msg = stepCount.toString() + \" steps\";\n\t\tJOptionPane.showMessageDialog(null, msg);\n\t\thasShown = true;\n\t }\n\t} else if (willMove) {\n\t\n\t move();\n\t //increase step count when move \n\t stepCount++;\n\t} else {\n\t \n\t back();\n\t stepCount++;\n\t}\n\n }", "@Override\n\tpublic void move(){\n\t\tSector tail = null;\n\t\tif(hit){\n\t\t\ttail = getNext();\n\t\t\tif(tail == null){\t\n\t\t\t\tselfDestruct();\n\t\t\t} else {\t\t\n\t\t\t\tsector.setInhabitant(null);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tsectors.add(sector);\n\t\tSector nextSector = quadrant.getNext(sector, velocity[0]);\t\n\t\tif(nextSector == null){\n\t\t\thit = true;\n\t\t} else {\n\t\t\tSpaceObject object = nextSector.getInhabitant();\n\t\t\tif(object != null) {\n\t\t\t\tobject.bump(this);\n\t\t\t} else {\n\t\t\t\tsetSector(nextSector); \n\t\t\t}\n\t\t} \n\t}", "public void move() {\n\t\tif(path.size() != 0) {\n\t\t\tCoordinate c = path.get(0);\n\t\t\tint x1 = c.x;\n\t\t\tint y1 = c.y;\n\t\t\t\t\n\t\t\tif(Math.abs(x1 - x) > speed || Math.abs(y1 - y) > speed) {\n\t\t\t\tif(this.x > x1) {\n\t\t\t\t\tvy = 0;\n\t\t\t\t\ttx.translate(-speed, vy);\n\t\t\t\t\tthis.x -= speed;\n\t\t\t\t}\n\t\t\t\n\t\t\t\telse if(this.x < x1) {\n\t\t\t\t\t//this.x += speed;\n\t\t\t\t\tvy = 0;\n\t\t\t\t\ttx.translate(speed, vy);\n\t\t\t\t\tthis.x += speed;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse if(this.y > y1) {\n\t\t\t\t\t//vx = 0;\n\t\t\t\t\ttx.translate(0, -speed);\n\t\t\t\t\tthis.y -= speed;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse if(this.y < y1) {\n\t\t\t\t\t//vx = 0;\n\t\t\t\t\ttx.translate(0, speed);\n\t\t\t\t\tthis.y += speed;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\telse {\n\t\t\t\tpath.remove(0);\n\t\t\t}\n\t\t\t\t\n\t\t}\n\t}", "@Override\r\n public void run() {\r\n move();\r\n }", "@Override\n\tpublic void doTick(long time) {\n\n\t\tPoint2D.Float nextDest = getNextDestination();\n\t\tif(nextDest == null)\n\t\t\treturn;\n\t\tPoint endLocation = gMap.toGridLocation(nextDest);\n\t\tPoint plLoc = gMap.toGridLocation(thePlayer.getLocation());\n\n\t\tif (plLoc.equals(endLocation))\n\t\t\treturn; // We are done here o.o\n\n\t\tPathStep nextStep = null;\n\t\tif (path != null && !path.getLastStepLocation().equals(plLoc))\n\t\t\tnextStep = path.getNextStep(plLoc.x, plLoc.y);\n\t\tif (path == null || nextStep == null\n\t\t\t\t|| time - lastRecalculate > MINIMUM_RECALCULATE_DELAY\n\t\t\t\t&& !endLocation.equals(path.getLastStepLocation())) {\n\t\t\t\n\t\t\trevalueSteps();\n\t\t\tpath = ((AStarGameMap) gMap).findBestPath(plLoc.x, plLoc.y,\n\t\t\t\t\tendLocation.x, endLocation.y);\n\t\t\tif(path != null)\n\t\t\t\tnextStep = path.getNextStep(plLoc.x, plLoc.y);\n\t\t\t\n//\t\t\tSystem.out.println(\"Next step is \" + nextStep);\n\t\t\tlastRecalculate = time;\n\t\t\tindex++;\n\t\t}\n\t\t\n\t\tif (nextStep != null && !path.getLastStepLocation().equals(plLoc))\n\t\t\tmoveTowards(plLoc, nextStep);\n\t}", "public void moveRobber(HexLocation loc) {\n\n\t}", "public void move() {\n energy -= 0.03;\n if (energy < 0) {\n energy = 0;\n }\n }", "public void step() {\n\t\tint step = rand.nextInt(2);\n\t\t\n\t\tif (step==0) {\n\t\t\t\n\t\t\tPoint moveRight = new Point(++x,y);\n\t\t\t\n\t\t\tif(x<=size-1) {\n\t\t\t\tpath.add(moveRight);\n\t\t\t}\n\t\t\telse --x;\n\t\t}\n\t\telse { \n\t\t\tPoint topStep = new Point(x,--y);\n\t\t\t\n\t\t\tif(y>=0) {\n\t\t\t\tpath.add(topStep);\n\t\t\t}\n\t\t\telse ++y;\n\t\t}\n\t\tif (x==size-1 && y==0) {\n\t\t\tsetDone(true);\n\t\t}\n\t\t\n\t\t\n\t}", "public void move()\n {\n universe.erase(this);\n \n // compute new position\n \n yPosition += ySpeed;\n xPosition += xSpeed;\n\n // check if it has hit the ground\n if(yPosition >= (groundPosition - diameter) && ySpeed > 0) {\n yPosition = groundPosition - diameter;\n ySpeed = -ySpeed; \n }\n // check if top\n if(yPosition <= 0 && ySpeed < 0){\n ySpeed = -ySpeed; \n }\n //check right\n if(xPosition >= (universe.getLength() - diameter) && xSpeed >0){\n xSpeed = -xSpeed;\n }\n //check left\n if(xPosition <= 0 && xSpeed < 0){\n xSpeed = -xSpeed;\n }\n \n // draw again at new position\n universe.draw(this);\n }", "public void move() {\n switch (dir) {\n case 1:\n this.setX(getX() + this.speed);\n moveHistory.add(new int[] {getX() - this.speed, getY()});\n moveHistory.add(new int[] {getX(), getY()});\n break;\n case 2:\n this.setY(getY() - this.speed);\n moveHistory.add(new int[] {getX(), getY() + this.speed});\n moveHistory.add(new int[] {getX(), getY()});\n break;\n case 3:\n this.setX(getX() - this.speed);\n moveHistory.add(new int[] {getX() + this.speed, getY()});\n moveHistory.add(new int[] {getX(), getY()});\n break;\n case 4:\n this.setY(getY() + this.speed);\n moveHistory.add(new int[] {getX(), getY() - this.speed});\n moveHistory.add(new int[] {getX(), getY()});\n break;\n default:\n break;\n }\n }", "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 }", "@Override\n public void runMovingTest() {\n long now;\n int count, search;\n elapsedTime.clear();\n expandedCells.clear();\n GraphPath<Integer,DefaultWeightedEdge> agentPath=null;\n GraphPath<Integer,DefaultWeightedEdge> targetPath=null;\n //Integer agentNode, targetNode;\n List<Integer> pathToFollow = null;\n for(Point[] p : points){\n pathfinder = new LazyMovingTargetAdaptiveAStarShortestPath<Integer, DefaultWeightedEdge>(map);\n count=0;\n search=0;\n agentNode = p[0].toNode();\n targetNode = p[1].toNode();\n LinkedList<Integer> movingExpCell = new LinkedList<>();\n LinkedList<Long> movingElapsTime = new LinkedList<>();\n targetThread r = new targetThread();\n evadeThread = new Thread(r);\n evadeThread.start();\n while(!agentNode.equals(targetNode)){\n if(pathToFollow==null || !agentPath.getEndVertex().equals(targetNode)) {\n agentPath = pathfinder.getShortestPath(agentNode, targetNode, new OctileDistance());\n if(pathfinder.getElapsedTime() > Long.valueOf(1900))\n continue;\n movingElapsTime.add(pathfinder.getElapsedTime());\n movingExpCell.add(pathfinder.getNumberOfExpandedNodes());\n search++;\n }\n Integer targetNext = null;\n Integer agentNext = null;\n if(count%2==0) {\n /*targetPath = new Trailmax<Integer,DefaultWeightedEdge>(map).getShortestPath(agentNode,targetNode,null);\n pathToFollow = Graphs.getPathVertexList(targetPath);\n if (!pathToFollow.isEmpty()) targetNext = pathToFollow.remove(0);\n if (targetNext.equals(targetNode) && !pathToFollow.isEmpty()) targetNext = pathToFollow.remove(0);\n targetNode = targetNext;*/\n synchronized(moveTarget) {\n moveTarget = new Boolean(true);\n }\n\n try {\n Thread.sleep(12);\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n }\n pathToFollow=Graphs.getPathVertexList(agentPath);\n if(!pathToFollow.isEmpty()){\n int i = pathToFollow.lastIndexOf(agentNode);\n agentNext=pathToFollow.remove(i+1);\n }\n agentNode = agentNext;\n count++;\n //System.out.println(agentNode+\",\"+targetNode);\n\n }\n\n r.terminate();\n try {\n evadeThread.join();\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n pathToFollow=null;\n movingElapsedTime.put(p, movingElapsTime);\n movingExpandedCells.put(p, movingExpCell);\n movesMap.put(p, count);\n searchesMap.put(p, search);\n if(verbose) {\n Long totElaps = Long.valueOf(0);\n Integer totExp = 0;\n for (Long l : movingElapsTime) totElaps += l;\n for (Integer i : movingExpCell) totExp += i;\n System.out.println(\"total elapsed: \" + totElaps + \" total expanded \" + totExp);\n }\n }\n }", "public void move(String direction) {\n \n }", "public void timePassed() {\n this.moveOneStep();\n }", "public void moveObjsToGoals() {\n\t\tMap<Integer, MovingFObject> map = sc.getInitPos();\r\n\t\tfor(int i = 0; i < map.size(); i++) {\r\n\t\t\tMovingFObject temp = map.get(i);\r\n\t\t\tsc.moveAtVelAtTimeToLoc(i, sc.getMaxVelocity(), 0, (Location)temp.getGoal());\r\n\t\t}\r\n\t}", "@Override\n public void move() {\n System.out.println(\"I roam here and there\");\n }", "public void move()\n\t{\n\t\tx = x + dx;\n\t}", "@Override\n\tprotected void pathDestinationReached() {\n\t\tif (Util.rand.nextFloat() < 0.3f)\n\t\t\trestartAnimation(dancingAnim);\n\t\telse\n\t\t\trandomMove();\n\t}", "@Override\n public void move(double xa, double ya) {\n if (alive) {\n y += ya;\n x += xa;\n }\n }", "@Override\r\n\tpublic Behaviour update(GameContext context) {\n\t\tif (Math.abs(thing.getX() - moveToX) < thing.getSpeed().getXv() / context.getTimeSinceLastUpdate()) {\r\n\t\t\tthing.setX(moveToX);\r\n\t\t}\r\n\t\tif (Math.abs(thing.getY() - moveToY) < thing.getSpeed().getYv() / context.getTimeSinceLastUpdate()) {\r\n\t\t\tthing.setY(moveToY);\r\n\t\t};\r\n\t\t\r\n\t\tif (!isContinueAfterTarget()) {\r\n\t\t\tthing.changeDirection(moveToX, moveToY, thing.getX(), thing.getY());\r\n\t\t}\r\n\t\tthing.updatePositionBasedOnSpeed(context);\r\n\t\t\r\n\t\tif (!isContinueAfterTarget()) {\r\n\t\t\tif ((int) thing.getX() == (int) moveToX) { // && thing.getY() == moveToLocation.y){\r\n\t\t\t\treturn new IdleBehaviour(thing);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}", "@Override\n\tpublic void movment() {\n\t\tif(ghost.shot && fired) {\n\t\t\tif(direction == RIGHT)\n\t\t\t\tmove(RIGHT);\n\t\t\telse if(direction == LEFT)\n\t\t\t\tmove(LEFT);\n\t\t\telse if(direction == UP)\n\t\t\t\tmove(UP);\n\t\t\telse if(direction == DOWN)\n\t\t\t\tmove(DOWN);\n\t\t}\n\t}", "public void moveToOrigin() {\n for(Waypoint waypoint : path)\n waypoint.setCoordinates(waypoint.getX() - path.get(0).getX(),\n waypoint.getY() - path.get(0).getY());\n }", "@Override\n public void startExecuting()\n {\n this.entity.getNavigator().tryMoveToXYZ(this.xPosition, this.yPosition, this.zPosition, this.speed);\n }", "public void move() {\n\t\tdouble xv = 0;\r\n\t\tdouble yv = 0;\r\n\t\t//this method allows the entity to hold both up and down (or left and right) and not move. gives for smooth direction change and movement\r\n\t\tif (moveRight) {\r\n\t\t\txv+=getSpeed();\r\n\t\t\torientation = Orientation.EAST;\r\n\t\t}\r\n\t\tif (moveLeft) {\r\n\t\t\txv-=getSpeed();\r\n\t\t\torientation = Orientation.WEST;\r\n\t\t}\r\n\t\tif (moveUp)\r\n\t\t\tyv-=getSpeed();\r\n\t\tif (moveDown)\r\n\t\t\tyv+=getSpeed();\r\n\t\tif (!doubleEquals(xv,0) || !doubleEquals(yv,0)) {\r\n\t\t\t((Player)this).useMana(0.1);\r\n\t\t\tImageIcon img = new ImageIcon(\"lib/assets/images/fireball.png\");\r\n\t\t\tBufferedImage image = new BufferedImage(32,32,BufferedImage.TYPE_INT_ARGB);\r\n\t\t\tGraphics g = image.getGraphics();\r\n\t\t\tg.drawImage(img.getImage(), 0, 0, image.getWidth(), image.getHeight(), null);\r\n\t\t\tColor n = loop[ind%loop.length];\r\n\t\t\tind++;\r\n\t\t\timage = ImageProcessor.scaleToColor(image, n);\r\n\t\t\t//PopMessage.addPopMessage(new PopMessage(image,getX(),getY()));\r\n\t\t}\r\n\t\telse\r\n\t\t\t((Player)this).useMana(-0.1);\r\n\t\tmove(xv,yv);\r\n\t}", "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 }", "public void act() \n {\n setLocation(getX() + Hur_Speed, getY());\n }", "public void move(Actor actor)\n\t\t {\n\t\t\t \t//PO: updated the methods after the move from the Bug Class to be called from\n\t\t \t//PO: the passed actor\n\t\t Grid<Actor> gr = actor.getGrid();\n\t\t if (gr == null)\n\t\t return;\n\t\t Location loc = actor.getLocation();\n\t\t Location next = loc.getAdjacentLocation(actor.getDirection());\n\t\t if (gr.isValid(next))\n\t\t \t//PO: alter the original code instead of calling the \n\t\t \t//PO: moveTo method in Actor call the method that is from this current behaviour\n\t\t this.moveTo(actor, next);\n\t\t else\n\t\t actor.removeSelfFromGrid();\n\t\t Flower flower = new Flower(actor.getColor());\n\t\t flower.putSelfInGrid(gr, loc);\n\t\t \n\t\t }", "public void move_to_gantry() {\n\t\tstop_moving();\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\tmove(gpX, gpY, gpZ);\n\t}", "public void moveActor();", "public void act()\n {\n setPosition(posX + liftDirection[0] * liftSpeed, posY\n + liftDirection[1] * liftSpeed);\n setLocation(posToLoc(posX, posY));\n\n if (posY < 50)\n removeSelf();\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 synchronized void follow(Vehicle vehicle){\n \n distance = distance - (float)((float)vehicle.getCurrentSpeed()*1000f/3600f)/100f;\n \n //System.out.println(\"Distance to drive: \" + distance);\n if (distance <= 0){\n \n Settings.messageLog.AddMessage(\"Reached end of path\");\n //System.out.println(\"weg.size() == \" + weg.size());\n try{\n vehicle.setPosition(weg.get(weg.size()-1));\n }\n catch(Exception e){vehicle.setPosition(new Vector3f(10.3f, 5.5f, 156.2f));}\n vehicle.stopDriving();\n if (destinationPlatform == null && destinationParkingSpot == null){}\n else if (destinationParkingSpot == null){\n //motionpath from waypoint to platform\n //platform sign in\n vehicle.setCurrentPlatform(destinationPlatform);\n \n } //meldt aan voor platform nieuwe route\n else {\n \n //motionpath from waypoint to parkingspot\n if (destinationPlatform == null)\n {\n try\n {\n this.destinationParkingSpot.ParkVehicle(vehicle);\n vehicle.setPosition(this.destinationParkingSpot.getPosition());\n Settings.messageLog.AddMessage(\"Park vehicle\");\n }\n catch(Exception e)\n {\n \n ErrorLog.logMsg(e.getMessage());\n }\n \n }\n \n //hier kraan geparkeerd ... ga unload\n try\n {\n this.destinationParkingSpot.ParkVehicle(vehicle);\n vehicle.setPosition(this.destinationParkingSpot.getPosition());\n }\n catch(InvalidVehicleException ie)\n {\n System.out.println(ie.getMessage());\n \n }\n\n }\n \n }\n }", "public void move() {\r\n\r\n\t\tif(x < 0) {\r\n\t\t\tx = 400;\r\n\t\t}\r\n\r\n\t\t// factor for speed increase\r\n\t\tx -= 1 * factor;\r\n\t}", "public void act() \r\n {\r\n move();\r\n }", "@Override\n public void run() {\n\n // Define vehicle label if undefined\n if (this.label == null) {\n this.label = \"Vehicle_\" + this.getId();\n }\n\n // Ask roundabout object for path\n Deque<Vertex<AtomicReference>> path = this.getVehicleRoute(this.source, this.destination);\n Vertex<AtomicReference> last = null;\n\n // Get entry queue\n ConcurrentLinkedQueue<Vehicle> entry = this.roundabout.queueOnEntry(this, this.source);\n\n // Wait for first in queue\n while (entry.peek() != this) this.vehicleSleep(waitOnQueue());\n\n // Traverse Path\n for (Vertex<AtomicReference> v : path) {\n\n // Accelerate between path nodes\n if (this.speed < this.maxSpeed) this.speed = accelerate(this.speed);\n\n // Move to node\n while (!v.getValue().compareAndSet(null, this)) {\n\n // Decelerate to not crash into another vehicle\n while (this.speed > 0) this.speed = decelerate(this.speed);\n\n System.out.println(this.label + \": Waiting for next node \" + v.getKey());\n\n // Wait\n this.vehicleSleep(waitToTravel());\n }\n\n // Accelerate for next in case it has stopped\n while (this.speed <= 0) this.speed = accelerate(this.speed);\n\n System.out.println(this.label + \": Moving to node \" + v.getKey() + \" for \" + travel());\n\n // Moving from node to node\n this.vehicleSleep(travel());\n\n // Remove myself from queue only after locking the first node\n if (path.peekFirst() == v) entry.remove(this);\n\n // Release last node\n while (last != null && !last.getValue().compareAndSet(this, null)) ;\n\n // Assign v as the last node which it travelled to\n last = v;\n }\n\n // Release last node\n while (!last.getValue().compareAndSet(this, null)) ;\n }", "protected void onTick() {\n\t\tif(car.drivingInfo.pathToGet.size() == 0 && car.carData.to == null) {\n\t\t\tcar.state = Car.WAIT_PASSENGER_TO_GO_INSIDE;\n\t\t\tSystem.out.println(\"engaged with from drive\" + car.engagedWithAID.toString());\n\t\t\tcar.addBehaviour(new TakePassenger());\n\t\t\tthis.stop();\n\t\t\treturn;\n\t\t}\n\t\t\t\t\n\t\tif(car.carData.to == null) {\n\t\t\tHouseData nextHouseToGo = car.drivingInfo.pathToGet.remove(0);\n\t\t\tcar.carData.to = nextHouseToGo;\n\t\t}\n\t\t\n\t\tint distanceDone = car.carData.distance;\n\t\tint distanceToDo = (int) SmaUtils.computeDistance(car.carData.from.position, car.carData.to.position);\n\t\t\n\t\t// if the distance left is higher than the distance the car can do in one tick, we increment the distance\n\t\tif(distanceDone+Car.CAR_SPEED < distanceToDo) {\n\t\t\tcar.carData.distance += Car.CAR_SPEED;\n\t\t\treturn;\n\t\t} \n\t\t// else, we put the car on the next house\n\t\telse if(distanceDone <= distanceToDo) {\n\t\t\tcar.carData.from = car.carData.to;\n\t\t\tcar.carData.to = null;\n\t\t\tcar.carData.distance = 0;\n\t\t\treturn;\n\t\t}\n\t}", "@Override\n\tpublic void move() {\n\t\t\n\t}", "public void run() {\n if(_dest!=null) {\n approachDest();\n return;\n }\n if(Rand.d100(_frequency)) {\n MSpace m = in.b.getEnvironment().getMSpace();\n if(!m.isOccupied()) {\n Logger.global.severe(in.b+\" has come unstuck\");\n return;\n }\n MSpace[] sur = m.surrounding();\n int i = Rand.om.nextInt(sur.length);\n for(int j=0;j<sur.length;j++) {\n if(sur[i]!=null&&sur[i].isWalkable()&&accept(sur[i])) {\n in.b.getEnvironment().face(sur[i]);\n MSpace sp = in.b.getEnvironment().getMSpace().move(in.b.getEnvironment().getFacing());\n if(sp!=null&&(in.b.isBlind()||!sp.isOccupied())) {\n _move.setBot(in.b);\n _move.perform();\n }\n break;\n }\n if(++i==sur.length) {\n i = 0;\n }\n }\n }\n else if(_dest==null&&Rand.d100(_travel)) {\n _dest = findNewSpace();\n //System.err.println(in.b+\" DEST: \"+_dest);\n }\n }", "private void atEndOfPathIsDetected() {\n \t\tmoveUltrasonicSensorToDefaultPosition();\n \t\trecursiveDepth = 0;\n \t\tturn = -15;\n \t}", "@Override\n\tpublic void move() {\n\n\t}" ]
[ "0.7059321", "0.69565356", "0.68175936", "0.68081236", "0.68018603", "0.67860985", "0.67068726", "0.6681601", "0.66618353", "0.6653907", "0.6568021", "0.65518355", "0.65489924", "0.65440214", "0.65292037", "0.6514056", "0.65106416", "0.65069014", "0.64986235", "0.6480785", "0.64704347", "0.6455347", "0.6440214", "0.64208794", "0.64102614", "0.6406777", "0.6401504", "0.639316", "0.639143", "0.63847613", "0.638026", "0.6366823", "0.63618046", "0.63607913", "0.63578176", "0.63231134", "0.63087094", "0.62981737", "0.6281762", "0.62806916", "0.62789494", "0.6275588", "0.6251761", "0.62494564", "0.62413657", "0.6220258", "0.62194204", "0.62159264", "0.62155896", "0.62090755", "0.6205554", "0.6198683", "0.61904", "0.61838835", "0.61810863", "0.61749876", "0.61670077", "0.61530614", "0.6151704", "0.6141627", "0.61301637", "0.61300504", "0.6128906", "0.61278206", "0.6121162", "0.6110175", "0.6104383", "0.609198", "0.6080693", "0.60791075", "0.6074915", "0.6074387", "0.6054525", "0.60535353", "0.603821", "0.6036435", "0.6034337", "0.6026982", "0.60269165", "0.60253894", "0.60244143", "0.6022854", "0.60180056", "0.6012325", "0.60110897", "0.6011059", "0.6008578", "0.6004448", "0.6001388", "0.5993024", "0.5992091", "0.5990463", "0.5987961", "0.5983897", "0.59801114", "0.5976765", "0.5975667", "0.5972371", "0.5968206", "0.5966591", "0.5951388" ]
0.0
-1
Transition to the next edge in the path
void transitionToNextEdge(double residualMove) { // update the counter for where the index on the path is indexOnPath += pathDirection; // check to make sure the Agent has not reached the end of the path already // depends on where you're going! if ((pathDirection > 0 && indexOnPath >= path.size()) || (pathDirection < 0 && indexOnPath < 0)) { reachedDestination = true; indexOnPath -= pathDirection; // make sure index is correct return; } // move to the next edge in the path EdgeGraph edge = (EdgeGraph) path.get(indexOnPath).getEdge(); setupEdge(edge); speed = progress(residualMove); currentIndex += speed; // check to see if the progress has taken the current index beyond its goal // given the direction of movement. If so, proceed to the next edge if (linkDirection == 1 && currentIndex > endIndex) transitionToNextEdge(currentIndex - endIndex); else if (linkDirection == -1 && currentIndex < startIndex) transitionToNextEdge(startIndex - currentIndex); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected void next() {\n\t\t// Next node\n\t\tnode = path.remove(0);\n\t\ttransition(NavigatorState.ROTATE_TO);\n\t}", "private void selectNextPath(boolean inc) {\n\t\tif (this.allPathsList.size() < 1)\n\t\t\treturn;\n\t\tList<GraphPath<PathwayVertexRep, DefaultEdge>> paths = this.allPathsList.get(this.allPathsList.size() - 1)\n\t\t\t\t.getFirst();\n\t\tif (paths.size() > 1) {\n\t\t\t// System.out.println(\"allPaths.size() > 1\");\n\n\t\t\tif (inc)\n\t\t\t\tselectedPathID++;\n\t\t\telse\n\t\t\t\tselectedPathID--;\n\n\t\t\tif (selectedPathID < 0)\n\t\t\t\tselectedPathID = paths.size() - 1;\n\t\t\tif (selectedPathID > paths.size() - 1)\n\t\t\t\tselectedPathID = 0;\n\n\t\t\tif (allPaths.size() > 0) {\n\t\t\t\tselectedPath = paths.get(selectedPathID);\n\t\t\t\t// System.out.println(\"selectedPathID\"+selectedPathID);\n\t\t\t\tif (selectedPath.getEdgeList().size() > 0 && !isShiftKeyDown) {\n\t\t\t\t\tPathwayVertexRep startPrevVertex = selectedPath.getStartVertex();\n\t\t\t\t\tPathwayVertexRep endPrevVertex = selectedPath.getEndVertex();\n\t\t\t\t\tList<DefaultEdge> edgePrevList = selectedPath.getEdgeList();\n\t\t\t\t\tpreviousSelectedPath = new GraphPathImpl<PathwayVertexRep, DefaultEdge>(pathway, startPrevVertex,\n\t\t\t\t\t\t\tendPrevVertex, edgePrevList, 0);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tselectedPathID = 0;\n\t\t}\n\n\t\t// System.out.println(\"selectedPathID=\"+selectedPathID);\n\t\tthis.allPathsList.get(this.allPathsList.size() - 1).setSecond(selectedPathID);\n\t\tisBubbleTextureDirty = true;\n\t\tsetDisplayListDirty();\n\t\ttriggerPathUpdate();\n\t}", "public Vertex moveDown() {\n for (Edge e : current.outEdges) {\n move(e.to.y == current.y + 1, e);\n }\n return current;\n }", "private void traversePath()\n\t{\n\t\trobot.forward(50);\n\t\trobot.right(90);\n\t\trobot.forward(50);\n\t\trobot.right(90);\n\t\trobot.forward(50);\n\t\trobot.left(90);\n\t\trobot.forward(50);\n\t\trobot.left(90);\n\t}", "public void goToNext() {\r\n\t\tif (curr == null)\r\n\t\t\treturn;\r\n\t\tprev = curr;\r\n\t\tcurr = curr.link;\r\n\t}", "public void followEdge(int e) {\r\n\t\tfor (int i = 0; i < currentVertex.outList.size(); i++) {\r\n\t\t\tNeighbor neighbor = currentVertex.outList.get(i);\r\n\t\t\tif (neighbor.edge == e) {\r\n\t\t\t\tcurrentVertex = neighbor.vertex;\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t\tSystem.out.println(\"Edge to \" + e + \" not exist.\");\r\n\t}", "public void gotoNext(){\r\n if(curr == null){\r\n return;\r\n }\r\n prev = curr;\r\n curr = curr.link;\r\n }", "@Test\n public void forcingDirectionDoesNotMeanWeCannotUseEdgeAtAll() {\n int north = graph.edge(1, 0).setDistance(1).set(speedEnc, 10, 10).getEdge();\n int south = graph.edge(1, 2).setDistance(1).set(speedEnc, 10, 10).getEdge();\n graph.edge(2, 5).setDistance(1).set(speedEnc, 10, 0);\n graph.edge(5, 4).setDistance(1).set(speedEnc, 10, 0);\n graph.edge(4, 3).setDistance(1).set(speedEnc, 10, 0);\n graph.edge(3, 2).setDistance(1).set(speedEnc, 10, 0);\n graph.edge(1, 0).setDistance(1).set(speedEnc, 10, 0);\n graph.edge(0, 6).setDistance(1).set(speedEnc, 10, 0);\n int targetEdge = graph.edge(6, 7).setDistance(1).set(speedEnc, 10, 0).getEdge();\n assertPath(calcPath(1, 7, north, targetEdge), 0.3, 3, 300, nodes(1, 0, 6, 7));\n assertPath(calcPath(1, 7, south, targetEdge), 0.9, 9, 900, nodes(1, 2, 5, 4, 3, 2, 1, 0, 6, 7));\n }", "protected void nextDirection()\n {\n if (this.lastKeyDirection == Canvas.LEFT)\n {\n this.lastKeyDirection = keyDirection = Canvas.RIGHT;\n xTotalDistance = 0;\n //yTotalDistance = 0;\n }\n else if (this.lastKeyDirection == Canvas.RIGHT)\n {\n this.lastKeyDirection = keyDirection = Canvas.LEFT;\n xTotalDistance = 0;\n //yTotalDistance = 0;\n }\n }", "void setupEdge(EdgeGraph edge) {\n\n\t\tif (UserParameters.socialInteraction) updateCrowdness(edge);\n\t\tcurrentEdge = edge;\n\t\t//transform GeomPlanarGraphEdge in Linestring\n\t\tLineString line = edge.getLine();\n\t\t//index the Linestring\n\t\tsegment = new LengthIndexedLine(line);\n\t\tstartIndex = segment.getStartIndex();\n\t\tendIndex = segment.getEndIndex();\n\t\tlinkDirection = 1;\n\n\t\t// check to ensure that Agent is moving in the right direction (direction)\n\t\tdouble distanceToStart = line.getStartPoint().distance(agentLocation.geometry);\n\t\tdouble distanceToEnd = line.getEndPoint().distance(agentLocation.geometry);\n\n\t\tif (distanceToStart <= distanceToEnd) {\n\t\t\t// closer to start\n\t\t\tcurrentIndex = startIndex;\n\t\t\tlinkDirection = 1;\n\t\t}\n\t\telse if (distanceToEnd < distanceToStart) {\n\t\t\t// closer to end\n\t\t\tcurrentIndex = endIndex;\n\t\t\tlinkDirection = -1;\n\t\t}\n\n\t}", "public void move() {\n\n\tGrid<Actor> gr = getGrid();\n\tif (gr == null) {\n\n\t return;\n\t}\n\n\tLocation loc = getLocation();\n\tif (gr.isValid(next)) {\n\n\t setDirection(loc.getDirectionToward(next));\n\t moveTo(next);\n\n\t int counter = dirCounter.get(getDirection());\n\t dirCounter.put(getDirection(), ++counter);\n\n\t if (!crossLocation.isEmpty()) {\n\t\t\n\t\t//reset the node of previously occupied location\n\t\tArrayList<Location> lastNode = crossLocation.pop();\n\t\tlastNode.add(next);\n\t\tcrossLocation.push(lastNode);\t\n\t\t\n\t\t//push the node of current location\n\t\tArrayList<Location> currentNode = new ArrayList<Location>();\n\t\tcurrentNode.add(getLocation());\n\t\tcurrentNode.add(loc);\n\n\t\tcrossLocation.push(currentNode);\t\n\t }\n\n\t} else {\n\t removeSelfFromGrid();\n\t}\n\n\tFlower flower = new Flower(getColor());\n\tflower.putSelfInGrid(gr, loc);\n\t\n\tlast = loc;\n\t\t\n }", "public Stack<Vertex> next() {\n Vertex u = lov.pop();\n for (Edge e : u.outEdges) {\n if (!e.to.visited) {\n cameFromEdge.put(e.to.toIdentifier(), e.from);\n if (e.to.x == MazeWorld.width - 1 && e.to.y == MazeWorld.height - 1) {\n reconstruct(cameFromEdge, e.to);\n lov = new Stack<Vertex>();\n }\n else {\n lov.push(u);\n e.to.visited = true;\n lov.push(e.to);\n break;\n }\n }\n }\n return lov;\n }", "public void step() {\n\t\tint step = rand.nextInt(2);\n\t\t\n\t\tif (step==0) {\n\t\t\t\n\t\t\tPoint moveRight = new Point(++x,y);\n\t\t\t\n\t\t\tif(x<=size-1) {\n\t\t\t\tpath.add(moveRight);\n\t\t\t}\n\t\t\telse --x;\n\t\t}\n\t\telse { \n\t\t\tPoint topStep = new Point(x,--y);\n\t\t\t\n\t\t\tif(y>=0) {\n\t\t\t\tpath.add(topStep);\n\t\t\t}\n\t\t\telse ++y;\n\t\t}\n\t\tif (x==size-1 && y==0) {\n\t\t\tsetDone(true);\n\t\t}\n\t\t\n\t\t\n\t}", "public void next() {\n Solver<ArrayList<Integer>> mySolver =\n new Solver<ArrayList<Integer>>();\n ArrayList<ArrayList<Integer>> Solution =\n mySolver.SolveBFS(this);\n\n //Reset 'tried' to none\n tried = new HashSet<ArrayList<Integer>>();\n\n //Set up the nextState\n ArrayList<Integer> nextState = new ArrayList<Integer>();\n\n if(Solution.size() == 0) {\n //No Solution\n } else if (Solution.size() == 1) {\n nextState = Solution.get(0);\n curBoard = nextState;\n } else {\n nextState = Solution.get(1);\n curBoard = nextState;\n moveCount++;\n }\n clearStack();\n\n\tsetChanged();\n\tnotifyObservers();\n }", "public void followEdgeInReverse(int e) {\r\n\t\tfor (int i = 0; i < currentVertex.inList.size(); i++) {\r\n\t\t\tNeighbor neighbor = currentVertex.inList.get(i);\r\n\t\t\tif (neighbor.edge == e) {\r\n\t\t\t\tcurrentVertex = neighbor.vertex;\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t\tSystem.out.println(\"Edge from \" + e + \" does not exist.\");\r\n\t}", "void downgradeLastEdge();", "public void keepWalking() {\n\t\t// move along the current segment\n\t\tif (UserParameters.socialInteraction) speed = progressSocial(moveRate);\n\t\telse speed = progress(moveRate);\n\t\tcurrentIndex += speed;\n\t\t// check to see if the progress has taken the current index beyond its goal\n\t\t// given the direction of movement. If so, proceed to the next edge\n\t\tif (linkDirection == 1 && currentIndex > endIndex) {\n\t\t\tCoordinate currentPos = segment.extractPoint(endIndex);\n\t\t\tupdatePosition(currentPos);\n\t\t\ttransitionToNextEdge(currentIndex - endIndex);\n\t\t}\n\t\telse if (linkDirection == -1 && currentIndex < startIndex) {\n\t\t\tCoordinate currentPos = segment.extractPoint(startIndex);\n\t\t\tupdatePosition(currentPos);\n\t\t\ttransitionToNextEdge(startIndex - currentIndex);\n\t\t}\n\t\telse {\n\t\t\t// just update the position!\n\t\t\tCoordinate currentPos = segment.extractPoint(currentIndex);\n\t\t\tupdatePosition(currentPos);\n\t\t}\n\t}", "public Queue<Vertex> next() {\n\n Vertex u = lov.dequeue();\n for (Edge e : u.outEdges) {\n if (!e.to.visited) {\n cameFromEdge.put(e.to.toIdentifier(), e.from);\n if (e.to.x == MazeWorld.width - 1 && e.to.y == MazeWorld.height - 1) {\n reconstruct(cameFromEdge, e.to);\n lov = new Queue<Vertex>();\n }\n else {\n e.to.visited = true;\n lov.enqueue(e.to);\n }\n }\n }\n return lov;\n }", "@Override\n public MFEDirection next()\n {\n if (!this.isPathValid()) {\n String msg = \"Annotated Path\" + this.getStart().getLocation() + \"->\" +\n this.getGoal().getLocation() + \": Cannot get next step \" +\n \"when path is invalid.\";\n logger.severe(msg);\n throw new IllegalStateException(msg);\n }\n final MFEDirection dir = this.path.poll();\n\n if (dir == null) {\n String msg = \"Annotated Path \" + this.getStart().getLocation() + \"->\" +\n this.getGoal().getLocation() + \": No more steps.\";\n logger.severe(msg);\n throw new NoSuchElementException(msg);\n }\n\n return dir;\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 }", "@Override\n protected void processPathAction(GridNode start, GridNode goal, Stack<GridNode> path) {\n path.pop();\n\n // Make the robot follow the path\n Mover mover = new Mover(\n robot.getDifferentialPilot(),\n new LightSensor(leftSensorPort),\n new LightSensor(rightSensorPort),\n path,\n initialDirection);\n mover.run();\n }", "public void act() \n {\n move(-2);\n if(isAtEdge())\n {\n turn(180);\n getImage().mirrorVertically();\n }\n }", "private void nextStep(){\n if(vMaze == null)\n mainMessage.setText(\"You must load a maze first!\");\n else try{\n vMaze.step();\n tileBox.getChildren().clear();\n tileBox.getChildren().add(vMaze.getTiles());\n\n mainMessage.setText(\"You took one step.\");\n if(vMaze.getRouteFinder().isFinished())\n mainMessage.setText(\"You reached the end!\");\n } catch (NoRouteFoundException e){\n mainMessage.setText(e.getMessage());\n }\n }", "public CrossRoad getNextIntermediateDestination()\n\t{\n\t\treturn this.getHead().getIntermediate();\n\t}", "private void followPath(){\r\n\t\tif(noBeepersPresent()){\r\n\t\t\twhile(frontIsClear() && leftIsBlocked() && rightIsBlocked() && noBeepersPresent()){\r\n\t\t\t\tmakeMove();\r\n\t\t\t}\r\n\t\t\tif(frontIsBlocked() && leftIsBlocked() && rightIsBlocked() && noBeepersPresent()){\r\n\t\t\t\tturnAround();\r\n\t\t\t\tpaintCorner(RED);\r\n\t\t\t\tfollowPath();\r\n\t\t\t}else{\r\n\t\t\t\tcheckPaths();\r\n\t\t\t}\r\n\t\t}\r\n\t}", "@Test\n public void directedRouting() {\n EdgeIteratorState rightNorth, rightSouth, leftSouth, leftNorth;\n graph.edge(0, 1).setDistance(1).set(speedEnc, 10, 10);\n graph.edge(1, 2).setDistance(1).set(speedEnc, 10, 10);\n graph.edge(2, 3).setDistance(1).set(speedEnc, 10, 10);\n graph.edge(3, 4).setDistance(3).set(speedEnc, 10, 10);\n rightNorth = graph.edge(4, 10).setDistance(1).set(speedEnc, 10, 10);\n rightSouth = graph.edge(10, 5).setDistance(1).set(speedEnc, 10, 10);\n graph.edge(5, 6).setDistance(2).set(speedEnc, 10, 10);\n graph.edge(6, 2).setDistance(1).set(speedEnc, 10, 10);\n graph.edge(2, 7).setDistance(1).set(speedEnc, 10, 10);\n graph.edge(7, 8).setDistance(9).set(speedEnc, 10, 10);\n leftSouth = graph.edge(8, 9).setDistance(1).set(speedEnc, 10, 10);\n leftNorth = graph.edge(9, 0).setDistance(1).set(speedEnc, 10, 10);\n\n // make paths fully deterministic by applying some turn costs at junction node 2\n setTurnCost(7, 2, 3, 1);\n setTurnCost(7, 2, 6, 3);\n setTurnCost(1, 2, 3, 5);\n setTurnCost(1, 2, 6, 7);\n setTurnCost(1, 2, 7, 9);\n\n final double unitEdgeWeight = 0.1;\n assertPath(calcPath(9, 9, leftNorth.getEdge(), leftSouth.getEdge()),\n 23 * unitEdgeWeight + 5, 23, (long) ((23 * unitEdgeWeight + 5) * 1000),\n nodes(9, 0, 1, 2, 3, 4, 10, 5, 6, 2, 7, 8, 9));\n assertPath(calcPath(9, 9, leftSouth.getEdge(), leftNorth.getEdge()),\n 14 * unitEdgeWeight, 14, (long) ((14 * unitEdgeWeight) * 1000),\n nodes(9, 8, 7, 2, 1, 0, 9));\n assertPath(calcPath(9, 10, leftSouth.getEdge(), rightSouth.getEdge()),\n 15 * unitEdgeWeight + 3, 15, (long) ((15 * unitEdgeWeight + 3) * 1000),\n nodes(9, 8, 7, 2, 6, 5, 10));\n assertPath(calcPath(9, 10, leftSouth.getEdge(), rightNorth.getEdge()),\n 16 * unitEdgeWeight + 1, 16, (long) ((16 * unitEdgeWeight + 1) * 1000),\n nodes(9, 8, 7, 2, 3, 4, 10));\n }", "public void\nswitchToNodeTraversal(SoNode node)\n{\n // Store current state.\n SoActionP.AppliedData storeddata = new SoActionP.AppliedData(this.pimpl.applieddata);\n AppliedCode storedcode = this.pimpl.appliedcode;\n PathCode storedpathcode = this.currentpathcode;\n SoTempPath storedpath = new SoTempPath(this.currentpath);\n\n this.pimpl.appliedcode = SoAction.AppliedCode.NODE;\n this.pimpl.applieddata.node = node;\n this.currentpathcode = SoAction.PathCode.NO_PATH;\n this.currentpath.truncate(0);\n\n this.traverse(node);\n\n // Restore previous state.\n this.currentpath.copyFrom(storedpath);\n this.currentpathcode = storedpathcode;\n this.pimpl.applieddata.copyFrom(storeddata);\n this.pimpl.appliedcode = storedcode;\n}", "public void addEdge( EdgeIntf edge ) throws Exception {\r\n DirectedEdge dEdge = ( DirectedEdge ) edge;\r\n Vertex fromVertex = dEdge.getSource();\r\n Vertex toVertex = dEdge.getSink();\r\n\r\n if( !isPath( toVertex, fromVertex ))\r\n super.addEdge( dEdge );\r\n else\r\n throw new CycleException();\r\n }", "public void nextTurn(){\n\t\tthis.setCurrentElement(this.getCurrentElement().getNext());\n\t}", "public static Path getOnePathTo(ARGState pLastElement) {\n Path path = new Path();\n Set<ARGState> seenElements = new HashSet<ARGState>();\n\n // each element of the path consists of the abstract state and the outgoing\n // edge to its successor\n\n ARGState currentARGState = pLastElement;\n // add the error node and its -first- outgoing edge\n // that edge is not important so we pick the first even\n // if there are more outgoing edges\n\n CFANode loc = extractLocation(currentARGState);\n CFAEdge lastEdge = null;\n if (loc.getNumLeavingEdges() > 0) {\n lastEdge = loc.getLeavingEdge(0);\n }\n /*\n\n */\n path.addFirst(Pair.of(currentARGState, lastEdge));\n seenElements.add(currentARGState);\n\n while (!currentARGState.getParents().isEmpty()) {\n Iterator<ARGState> parents = currentARGState.getParents().iterator();\n\n ARGState parentElement = parents.next();\n //System.out.println(currentARGState.getStateId()+\":\"+parentElement);\n while (!seenElements.add(parentElement) && parents.hasNext()) {\n // while seenElements already contained parentElement, try next parent\n parentElement = parents.next();\n // System.out.println(currentARGState.getStateId()+\":\"+parentElement);\n }\n\n CFAEdge edge = parentElement.getEdgeToChild(currentARGState);\n path.addFirst(Pair.of(parentElement, edge));\n //输出当前路径\n //System.out.println(currentARGState.getStateId()+\",\"+currentARGState.getValuesOfKeyVariables());\n //System.out.println(edge);\n currentARGState = parentElement;\n\n //测试用\n /*if(!(edge instanceof CAssumeEdge) &&edge.getRawStatement().contains(\"a3\")){\n System.out.println(currentARGState.getStateId()+\":\"+currentARGState.getValuesOfKeyVariables());\n }*/\n\n }\n // System.out.println(\"跳出getOnePathTo\");\n return path;\n }", "public void flowAlgorithm(){\n while(!augmentedPath()){\n ArrayList<Integer> flowList = new ArrayList<>();//this is here just so we can print out the path\n int minFlow = 10000;\n int currentID = t;\n GraphNode node = graphNode[currentID];\n //very simply this part will start at the last node and go back through the path that was selected and fin the minimum flow\n flowList.add(t);\n while(node != graphNode[s]){\n int parent = node.parent;\n flowList.add(parent);\n if(graph.flow[parent][currentID][1] < minFlow){\n minFlow = graph.flow[parent][currentID][1];\n }\n node = graphNode[parent];\n currentID = parent;\n }\n currentID = t;//should this be here\n displayMaxFlow(flowList, minFlow);\n node = graphNode[t];\n //this will go back through the same list as the one up above and change their current value\n while(node != graphNode[s]){\n int parent = node.parent;\n graph.flow[parent][currentID][1] = graph.flow[parent][currentID][1] - minFlow;\n node = graphNode[parent];\n currentID = parent;\n }\n }\n }", "public void nextLevelTogo() {\n if (this.myClearedLines % 2 == 0) {\n myLinesToGo = 2;\n } else {\n myLinesToGo = 1;\n }\n }", "@Override\n\tpublic Direction nextMove(State state)\n\t{\n\t\t\n\t\tthis.direction = Direction.STAY;\n\t\tthis.hero = state.hero();\n\t\tthis.position = new Point( this.hero.position.right, this.hero.position.left ); //x and y are reversed, really\n\t\t\n\t\tthis.pathMap = new PathMap( state, this.position.x, this.position.y );\n\n\t\t//find the richest hero\n\t\tHero richestHero = state.game.heroes.get(0);\n\t\tif( richestHero == this.hero ) { richestHero = state.game.heroes.get(1); } //just grab another hero if we are #0\n\t\t\n\t\tfor( Hero hero : state.game.heroes )\n\t\t{\n\t\t\tif( hero != this.hero && hero.gold > richestHero.gold )\n\t\t\t{\n\t\t\t\trichestHero = hero;\n\t\t\t}\n\t\t}\n\t\t\n\t\t//get all interesting sites\n\t\tList<TileInfo> minesInRange = this.pathMap.getSitesInRange( TileType.FREE_MINE, 20 );\t//mines in vicinity\n\t\tList<TileInfo> takenMinesInRange = this.pathMap.getSitesInRange( TileType.TAKEN_MINE, (100-richestHero.life)/2 );\t//mines in vicinity\n\t\tList<TileInfo> pubsInRange = this.pathMap.getSitesInRange( TileType.TAVERN, (int)(Math.pow(100-this.hero.life,2)*state.game.board.size/5000) );\t\t//pubs in vicinity\n\t\t\n\t\t//first visit pubs (apparently we need it)\n\t\tif( pubsInRange.size() != 0 )\n\t\t{\n\t\t\tthis.direction = this.pathMap.getDirectionTo( pubsInRange.get(0) );\n\t\t}\n\t\t\n\t\t//then visit the mines\n\t\telse if( minesInRange.size() != 0 )\n\t\t{\n\t\t\tthis.direction = this.pathMap.getDirectionTo( minesInRange.get(0) );\n\t\t}\n\t\t\n\t\t//then visit taken mines\n\t\telse if( takenMinesInRange.size() != 0 )\n\t\t{\n\t\t\tthis.direction = this.pathMap.getDirectionTo( takenMinesInRange.get(0) );\n\t\t}\n\t\t\n\t\t//then hunt for players\n\t\telse\n\t\t{\n\t\t\t//kill the richest hero! (but first full health)\n\t\t\tif( this.hero.life > 85 )\n\t\t\t{\n\t\t\t\tthis.direction = this.pathMap.getDirectionTo( richestHero.position.right, richestHero.position.left );\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t//run away!!!\n\t\t\t\tthis.direction = intToDir( (int)(Math.random()*4) );\n\t\t\t}\n\t\t}\n\t\t\n\t\t//VisualPathMap.getInstance( pathMap );\n\t\t\n\t\treturn this.direction;\n\t}", "public void findNewAStarPath(PedSimCity state) {\n\n\t\tRouteData route = new RouteData();\n\t\troute.origin = originNode.getID();\n\t\troute.destination = destinationNode.getID();\n\t\t//\t\toriginNode = PedSimCity.nodesMap.get(9406);\n\t\t//\t\tdestinationNode = PedSimCity.nodesMap.get(4456);\n\n\t\tif (UserParameters.empiricalABM) {\n\t\t\tSystem.out.println(\" Agent nr. \"+this.agentID + \" group \" + this.agp.groupName + \" OD \" + originNode.getID()+\" \" +destinationNode.getID());\n\t\t\tagp.defineRouteChoiceParameters();\n\t\t\tCombinedNavigation combinedNavigation = new CombinedNavigation();\n\t\t\tnewPath = combinedNavigation.path(originNode, destinationNode, agp);\n\t\t\troute.group = this.agp.groupID;\n\t\t\troute.localH = this.agp.localHeuristic;\n\t\t\troute.routeID = this.agentID.toString()+\"-\"+originNode.getID().toString()+\"-\"+destinationNode.getID().toString();\n\t\t}\n\t\telse {\n\t\t\tSystem.out.println(originNode.getID() + \" \"+ destinationNode.getID()+ \" \"+ap.routeChoice);\n\t\t\tselectRouteChoice();\n\t\t\troute.routeChoice = ap.routeChoice;\n\t\t\t//\t\t\troute.routeID = numTrips;\n\t\t}\n\n\t\tList<Integer> sequenceEdges = new ArrayList<Integer>();\n\n\t\tfor (GeomPlanarGraphDirectedEdge o : newPath) {\n\t\t\t// update edge data\n\t\t\tupdateEdgeData((EdgeGraph) o.getEdge());\n\t\t\tint edgeID = ((EdgeGraph) o.getEdge()).getID();\n\t\t\tsequenceEdges.add(edgeID);\n\t\t}\n\t\troute.sequenceEdges = sequenceEdges;\n\t\tPedSimCity.routesData.add(route);\n\t\tindexOnPath = 0;\n\t\tpath = newPath;\n\n\t\t// set up how to traverse this first link\n\t\tEdgeGraph firstEdge = (EdgeGraph) newPath.get(0).getEdge();\n\t\tsetupEdge(firstEdge); //Sets the Agent up to proceed along an Edge\n\n\t\t// update the current position for this link\n\t\tupdatePosition(segment.extractPoint(currentIndex));\n\t\tnumTrips += 1;\n\t}", "public void move() {\n\t\tGrid<Actor> gr = getGrid();\n\t\tif (gr == null) {\n\t\t\treturn;\n\t\t}\n\t\tLocation loc = getLocation();\n\t\tif (gr.isValid(next)) {\n\t\t\tsetDirection(getLocation().getDirectionToward(next));\n\t\t\tmoveTo(next);\n\t\t} else {\n\t\t\tremoveSelfFromGrid();\n\t\t}\n\t\tFlower flower = new Flower(getColor());\n\t\tflower.putSelfInGrid(gr, loc);\n\t}", "public void loopThroughEdge()\n {\n int margin = 2;\n\n if (getX() < margin) //left side\n { \n setLocation(getWorld().getWidth()+ margin, getY());\n }\n else if (getX() > getWorld().getWidth() - margin) //right side\n {\n setLocation(margin, getY());\n }\n\n if (getY() < margin) //top side\n { \n setLocation(getX(), getWorld().getHeight() - margin);\n }\n else if(getY() > getWorld().getHeight() - margin) //bottom side\n { \n setLocation(getX(), margin);\n }\n }", "private RouteStep getIntermediateRouteStep(Network roadNetwork, IntersectionEntity currentIntersection, IntersectionEntity nextIntersectoin) {\n Long roadId = (Long) roadNetwork.getEdge(currentIntersection.getId(), nextIntersectoin.getId()).info;\n RoadEntity road = roadPersister.getRoad(roadId);\n MutableInt2D destination = new MutableInt2D(nextIntersectoin.getX(), nextIntersectoin.getY());\n MutableInt2D currentLocation = new MutableInt2D(currentIntersection.getX(), currentIntersection.getY());\n int currentLength = (int) currentLocation.distance(destination);\n\n RouteStep routeStep = getCurrentRouteStep(road, destination, currentLocation, currentLength);\n return routeStep;\n }", "protected void randomStep() {\n\t\tint n = curNode.getDegree();\n\t\tint r = 0;\n\n\t\tif (n > 0) {\n\t\t\tr = ctx.random().nextInt(n);\n\n\t\t\tAntCo2Edge curEdge = (AntCo2Edge) curNode.getEdge(r);\n\n\t\t\tassert curEdge != null : \"found no edge\";\n\n\t\t\tcross(curEdge, true);\n\t\t}\n\t}", "public void move() {\n if (this.nextMove.equals(\"a\")) { // move down\n this.row = row + 1;\n progress += 1;\n if (progress == steps) {\n nextMove = \"b\";\n progress = 0;\n }\n } else if (this.nextMove.equals(\"b\")) { // move right\n this.col = col + 1;\n progress += 1;\n if (progress == steps) {\n nextMove = \"c\";\n progress = 0;\n }\n } else if (this.nextMove.equals(\"c\")) { // move up\n this.row = row - 1;\n progress += 1;\n if (progress == steps) {\n nextMove = \"a\";\n progress = 0;\n }\n }\n }", "public void move() {\n Grid<Actor> gr = getGrid();\n if (gr == null) {\n return;\n }\n Location loc = getLocation();\n if (gr.isValid(next)) {\n setDirection(getLocation().getDirectionToward(next));\n moveTo(next);\n } else {\n removeSelfFromGrid();\n }\n Flower flower = new Flower(getColor());\n flower.putSelfInGrid(gr, loc);\n }", "private void moveToNextStoryNode(StoryPaths storyPath) {\n System.out.println(\"moving to next storynode\"); //debug\n //Depletes resources\n Resource resourceNeeded=storyPath.getResourceNeeded();\n if (resourceNeeded!=null) {\n int amountNeeded=storyPath.getAmountNeeded();\n if (resourceNeeded.getDepletable()) {\n resourceNeeded.decreaseStock(amountNeeded);\n resourceManager.updateDatabase(resourceNeeded);\n }\n }\n int nextPage=storyPath.getNextPage();\n // for chane event: decide success or failure\n if (storyPath.isChanceEvent()) {\n double chance=storyPath.getChance();\n boolean failure=Math.random()<chance;\n if (failure) {\n nextPage=storyPath.getNextPage2();\n Toast.makeText(getApplicationContext(),\"Failure\",Toast.LENGTH_SHORT).show();\n } else {\n Toast.makeText(getApplicationContext(),\"Succeed\",Toast.LENGTH_SHORT).show();\n }\n }\n // Move to next story node\n user.setCurrentStoryNode(nextPage);\n user.updateDatabase();\n refresh();\n //Obtain new items\n //TODO: let user click something to obtain the item instead of obtaining automatically\n Resource resourceObtained=currentStory.getResourceGained();\n if (resourceObtained!=null) {\n int amountGained = currentStory.getAmountGained();\n resourceObtained.increaseStock(amountGained);\n resourceManager.updateDatabase(resourceObtained);\n }\n updateResourceText();\n }", "public void actionPerformed(ActionEvent e) {\r\n mode = InputMode.S_PATH;\r\n instr.setText(\"Drag from one node to another to find their shortest path.\");\r\n }", "public void moveVertex() {\r\n\t\tPriorityQueue<Vertex2D> pq = new PriorityQueue<Vertex2D>(3,(a,b) -> a.id - b.id);\r\n\t\tpq.add(this); pq.add(this.previous); pq.add(this.next);\r\n\t\t\r\n\t\tsynchronized(pq.poll()) {\r\n\t\t\tsynchronized(pq.poll()) {\r\n\t\t\t\tsynchronized(pq.poll()) {\r\n\t\t\t\t\t//Actually move the vertex \"this\"\r\n\t\t\t\t\tdouble r1 = Star.rnd.nextDouble();\r\n\t\t\t\t\tdouble r2 = Star.rnd.nextDouble();\r\n\t\t\t\t\tdouble newX = (1 - Math.sqrt(r1)) * previous.x + (Math.sqrt(r1) * (1 - r2)) * this.x + (Math.sqrt(r1) * r2) * next.x;\r\n\t\t\t\t\tdouble newY = (1 - Math.sqrt(r1)) * previous.y + (Math.sqrt(r1) * (1 - r2)) * this.y + (Math.sqrt(r1) * r2) * next.y;\r\n\t\t\t\t\tthis.x = newX;\r\n\t\t\t\t\tthis.y = newY;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private void releasedSelect(MouseEvent e) {\r\n if (e.getModifiers() >= MouseEvent.BUTTON1_MASK) {\r\n /* End the move (do not need any recourse) or resize the node */\r\n try {\r\n /* End the move of the edge. Set the new adjacents */\r\n if (graphX.isAnyEdgeSelected() && ctrlPressed == false && moveingGraph == false) {\r\n EdgeX edgeX = graphX.getSelectedEdge();\r\n if (graphX.nodesContains(e.getPoint())) {\r\n NodeX nodeX = graphX.getNode(e.getPoint());\r\n\r\n boolean exist = false;\r\n /* Verify if the edge exist */\r\n if (edgeX.getPointToMove() == EdgeX.FIRST_POINT) {\r\n for (int i = 0; i < graphX.edgesNumber(); i++) {\r\n if (graphX.isEdgeInList(nodeX, edgeX.getSeccondAdjacent()) == true) {\r\n exist = true;\r\n break;\r\n }\r\n }\r\n } else if (edgeX.getPointToMove() == EdgeX.SECCOND_POINT) {\r\n for (int i = 0; i < graphX.edgesNumber(); i++) {\r\n if (graphX.isEdgeInList(edgeX.getFirstAdjacent(), nodeX) == true) {\r\n exist = true;\r\n break;\r\n }\r\n }\r\n }\r\n /* Set the new edge only if it doesn't exist */\r\n if (!edgeX.getFirstAdjacent().equals(nodeX) && !edgeX.getSeccondAdjacent().equals(nodeX)\r\n && exist == false) {\r\n Edge edge = edgeOf(edgeX);\r\n\r\n deleteEdge(); // Delete the selected edge\r\n\r\n if (edgeX.getPointToMove() == EdgeX.SECCOND_POINT) {\r\n edge.setSeccondAdjacent(nodeOf(graphX.getNode(e.getPoint())));\r\n edgeX.setSeccondAdjacent(graphX.getNode(e.getPoint()));\r\n addEdge(edge, edgeX);\r\n } else if (edgeX.getPointToMove() == EdgeX.FIRST_POINT) {\r\n edge.setFirstAdjacent(nodeOf(graphX.getNode(e.getPoint())));\r\n edgeX.setFirstAdjacent(graphX.getNode(e.getPoint()));\r\n addEdge(edge, edgeX);\r\n }\r\n\r\n edgeX = graphX.edgeAt(graphX.edgesNumber() - 1);\r\n edgeX.setState(true);\r\n }\r\n }\r\n edgeX.setPointToMove(EdgeX.NONE_POINT);\r\n edgeX.setMoveState(false);\r\n }\r\n /* End the resize of the node */\r\n else if (graphX.isOneNodeSelected()) {\r\n if (graphX.getSelectedNode().isResize()) {\r\n graphX.getSelectedNode().setResize(false);\r\n }\r\n }\r\n /* Select only one node from the multiple selection */\r\n else {\r\n if (ctrlPressed == false && dragMultiple == false) {\r\n graphX.deselectAll();\r\n graphX.selectNode(e.getPoint());\r\n }\r\n }\r\n } catch (NullPointerException e1) {\r\n }\r\n /* Select multiple nodes */\r\n if (selectTool.isMultiple()) {\r\n selectTool.setSeccondPoint(e.getPoint());\r\n graphX.selectNodes(selectTool.getRectangle());\r\n graphX.selectEdgesFromNodes();\r\n }\r\n\r\n selectTool.setMultiple(false);\r\n selectTool.reset();\r\n\r\n moveingGraph = false;\r\n\r\n /* Set the cursor */\r\n if (graphX.nodesResizeContains(e.getPoint()) && graphX.isOneNodeSelected() && !ctrlPressed) {\r\n this.setCursor(GraphBuilder.resizeSE);\r\n } else if (graphX.overSplitPoints(e.getPoint())) {\r\n this.setCursor(GraphBuilder.move);\r\n } else if (graphX.nodesContains(e.getPoint())\r\n || graphX.edgesContains(e.getPoint(), graph instanceof GraphOriented)) {\r\n this.setCursor(GraphBuilder.hand);\r\n } else {\r\n /* Set no split point for the edges */\r\n for (int i = 0; i < graphX.edgesNumber(); i++) {\r\n graphX.edgeAt(i).setNoCurrentPoint();\r\n }\r\n this.setCursor(GraphBuilder.arrow);\r\n }\r\n\r\n } else if (e.getModifiers() >= MouseEvent.BUTTON3_MASK) {\r\n try {\r\n graphX.getSelectedEdge().setNoCurrentPoint();\r\n } catch (NullPointerException e1) {\r\n }\r\n }\r\n }", "public Node<S> next() {\n Node<S> current = popUnvisited();\n // Take the associated state\n S currentState = current.transition().to();\n // Explore the adjacent neighbors\n for(Transition<S> successor : this.successors.from(currentState)){\n // If the neighbor is still unexplored\n if (!this.visited.containsKey(successor.to())){\n // Create the associated neighbor\n Node<S> successorNode = factory.node(current, successor);\n this.stack.push(successorNode);\n }\n }\n this.visited.put(currentState, current);\n return current;\n }", "public void act() {\n\t\tboolean willMove = canMove();\n\t\tif (isEnd) {\n\t\t//to show step count when reach the goal\n\t\t\tif (!hasShown) {\n\t\t\t\tString msg = stepCount.toString() + \" steps\";\n\t\t\t\tJOptionPane.showMessageDialog(null, msg);\n\t\t\t\thasShown = true;\n\t\t\t}\n\t\t} else if (willMove) {\n\t\t\t//visit the next node\n\t\t\tisVisited[next.getRow()][next.getCol()] = true;\n\t\t\tmove();\n\t\t\tstepCount++;\n\t\t} else {\n\t\t\t// back to the cross location\n\t\t\tback();\n\t\t\tstepCount++;\n\t\t}\n\t}", "public void moveTo(double x, double y)\n {\n\t_closedPath = false;\n\tPoint2D pos = transformedPoint(x,y);\n\t_startx = pos.getX();\n\t_starty = pos.getY();\n\t_currentx = pos.getX();\n\t_currenty = pos.getY();\n\t_currentPath.clear();\n }", "@Override\n\tprotected void pathDestinationReached() {\n\t\tif (Util.rand.nextFloat() < 0.3f)\n\t\t\trestartAnimation(dancingAnim);\n\t\telse\n\t\t\trandomMove();\n\t}", "public EdgeIntf addEdge( Vertex fromVertex, Vertex toVertex ) throws Exception {\r\n if( !isPath( toVertex, fromVertex ))\r\n return super.addEdge( fromVertex, toVertex );\r\n else\r\n throw new CycleException();\r\n }", "@Override\n protected KPMPSolution nextNeighbour() {\n List<KPMPSolutionWriter.PageEntry> edgePartition = bestSolution.getEdgePartition().stream().map(KPMPSolutionWriter.PageEntry::clone).collect(toCollection(ArrayList::new));\n KPMPSolution neighbourSolution = new KPMPSolution(bestSolution.getSpineOrder(), edgePartition, bestSolution.getNumberOfPages());\n edge = edgePartition.get(index);\n originalPageIndex = edge.page;\n newPageIndex = pageCounter;\n edgePartition.get(index).page = newPageIndex;\n index++;\n numberOfIterations++;\n return neighbourSolution;\n }", "public Vertex moveUp() {\n for (Edge e : current.outEdges) {\n move(e.to.y == current.y - 1, e);\n }\n return current;\n }", "@Override\r\n public void move() {\r\n Grid<Actor> gr = getGrid();\r\n if (gr == null) {\r\n return;\r\n }\r\n Location loc = getLocation();\r\n if (gr.isValid(next)) {\r\n setDirection(getLocation().getDirectionToward(next));\r\n moveTo(next);\r\n } else {\r\n removeSelfFromGrid();\r\n }\r\n Flower flower = new Flower(getColor());\r\n flower.putSelfInGrid(gr, loc);\r\n }", "protected void reversePath() {\n\t\t\n\t\tif(_reverse) {\n\t\t\t\n\t\t\tif(_nextMove + 1 > movingPattern.size() - 1)\n\t\t\t\t_nextMove = 0;\n\t\t\telse\n\t\t\t\t_nextMove++;\n\t\t\t\n\t\t\t_reverse = false;\n\t\t}\n\t\telse {\n\t\t\t\n\t\t\tif(_nextMove - 1 < 0)\n\t\t\t\t_nextMove = movingPattern.size() - 1;\n\t\t\telse\n\t\t\t\t_nextMove--;\n\t\t\t\n\t\t\t_reverse = true;\n\t\t}\n\t}", "public Vertex moveRight() {\n for (Edge e : current.outEdges) {\n move(e.to.x == current.x + 1, e);\n }\n return current;\n }", "private void carvePath(Cell cell) {\n\n\t\tsetCellVisited(cell);\n\t\tif (cell.tunnelTo != null) {\n\t\t\tcell = cell.tunnelTo;\n\t\t\tsetCellVisited(cell);\n\t\t}\n\t\tint dir = randomlyChoseNeighbour(cell);\n\t\tCell neigh;\n\t\twhile (dir != -1) {\n\t\t\tneigh = cell.neigh[dir];\n\t\t\tcell.wall[dir].present = false;\n\t\t\tcarvePath(neigh);\n\t\t\tdir = randomlyChoseNeighbour(cell);\n\n\t\t}\n\t}", "public void crossEdge(Edge e) {}", "public void setNext(Vertex next) {\n\t\tthis.next = next;\n\t}", "public TraversalThread(LinkedList<Graph<NodeData,EdgeData>.Edge> path){\r\n this.path = path;\r\n }", "public abstract void goNext();", "private Action doNextMove(Action move){\n\t\t// update east or north\n\t\tif (move == Action.East){\n\t\t\teast++;\n\t\t} else if (move == Action.West){\n\t\t\teast--;\n\t\t} else if (move == Action.North){\n\t\t\tnorth++;\n\t\t} else if (move == Action.South){\n\t\t\tnorth--;\n\t\t}\n\t\treturn move;\n\t}", "@Override\r\n\tpublic void nextStep() {\n\t\tif (this.oldX == this.coord.x && this.oldY == this.coord.y) { \r\n\t\t\tthis.currentPoint = (int) (Math.random()*this.patrol.size());\r\n\t\t\tthis.targetX = this.patrol.get(currentPoint).x;\r\n\t\t\tthis.targetY = this.patrol.get(currentPoint).y;\r\n\r\n\t\t}\r\n\r\n\t\t// target point reached, make new random target point\r\n\t\tif (this.targetX == this.coord.x && this.targetY == this.coord.y) {\r\n\t\t\tif (this.currentPoint < patrol.size() - 1)\r\n\t\t\t\tthis.currentPoint++;\r\n\t\t\telse\r\n\t\t\t\tthis.currentPoint = 0;\r\n\r\n\t\t\tthis.targetX = this.patrol.get(currentPoint).x;\r\n\t\t\tthis.targetY = this.patrol.get(currentPoint).y;\r\n\t\t}\r\n\t\tint step = (this.speed == Speed.fast ? 8 : 4);\r\n\t\t// int stepX = (int) (1 + Math.random() * step);\r\n\t\t// int stepY = (int) (1 + Math.random() * step);\r\n\t\tint x0 = (int) (this.coord.getX());\r\n\t\tint y0 = (int) (this.coord.getY());\r\n\r\n\t\tint dx = this.targetX - x0;\r\n\t\tint signX = Integer.signum(dx); // get the sign of the dx (1-, 0, or\r\n\t\t\t\t\t\t\t\t\t\t// +1)\r\n\t\tint dy = this.targetY - y0;\r\n\t\tint signY = Integer.signum(dy);\r\n\t\tthis.nextX = x0 + step * signX;\r\n\t\tthis.nextY = y0 + step * signY;\r\n\t\tthis.oldX = this.coord.x;\r\n\t\tthis.oldY = this.coord.y;\r\n\t\t// System.err.println(\"targetX,targetY \"+targetX+\" \"+targetY);\r\n\t}", "public void move() {\n\t\tGrid<Actor> gr = getGrid();\n\t\tif (gr == null) {\n\t\t\treturn;\n\t\t}\n\t\tLocation loc = getLocation();\n\t\tLocation next = loc.getAdjacentLocation(getDirection());\n\t\t\n\t\tLocation next2 = next.getAdjacentLocation(getDirection());\n\t\tif (gr.isValid(next2)) {\n\t\t\tmoveTo(next2);\n\t\t} else {\n\t\t\tremoveSelfFromGrid();\n\t\t}\n\t}", "public void advance( )\r\n {\r\n\t if(isCurrent() != true){// Implemented by student.\r\n\t throw new IllegalStateException(\"no current element\");\r\n\t }\r\n\t else\r\n\t \t precursor = cursor;\r\n\t \t cursor = cursor.getLink(); // Implemented by student.\r\n }", "public void grip(){\n\t\tthis.motor.backward();\n\t}", "private void buildPath() {\r\n int xNext = 1;\r\n int yNext = map.getStartPos() + 1;\r\n CellLayered before = cells[yNext][xNext];\r\n while(true)\r\n {\r\n Byte[] xy = map.getDirection(xNext-1, yNext-1);\r\n xNext = xNext + xy[0];\r\n yNext = yNext + xy[1];\r\n\r\n CellLayered next = cells[yNext][xNext];\r\n\r\n if(xy[0]==-1)\r\n before.setRight(false);\r\n else\r\n before.setRight(true);\r\n before.setPath(true);\r\n if(next==null)\r\n break;\r\n\r\n before.setNextInPath(next);\r\n before = next;\r\n }\r\n }", "@Override\n public void run() {\n\n // Define vehicle label if undefined\n if (this.label == null) {\n this.label = \"Vehicle_\" + this.getId();\n }\n\n // Ask roundabout object for path\n Deque<Vertex<AtomicReference>> path = this.getVehicleRoute(this.source, this.destination);\n Vertex<AtomicReference> last = null;\n\n // Get entry queue\n ConcurrentLinkedQueue<Vehicle> entry = this.roundabout.queueOnEntry(this, this.source);\n\n // Wait for first in queue\n while (entry.peek() != this) this.vehicleSleep(waitOnQueue());\n\n // Traverse Path\n for (Vertex<AtomicReference> v : path) {\n\n // Accelerate between path nodes\n if (this.speed < this.maxSpeed) this.speed = accelerate(this.speed);\n\n // Move to node\n while (!v.getValue().compareAndSet(null, this)) {\n\n // Decelerate to not crash into another vehicle\n while (this.speed > 0) this.speed = decelerate(this.speed);\n\n System.out.println(this.label + \": Waiting for next node \" + v.getKey());\n\n // Wait\n this.vehicleSleep(waitToTravel());\n }\n\n // Accelerate for next in case it has stopped\n while (this.speed <= 0) this.speed = accelerate(this.speed);\n\n System.out.println(this.label + \": Moving to node \" + v.getKey() + \" for \" + travel());\n\n // Moving from node to node\n this.vehicleSleep(travel());\n\n // Remove myself from queue only after locking the first node\n if (path.peekFirst() == v) entry.remove(this);\n\n // Release last node\n while (last != null && !last.getValue().compareAndSet(this, null)) ;\n\n // Assign v as the last node which it travelled to\n last = v;\n }\n\n // Release last node\n while (!last.getValue().compareAndSet(this, null)) ;\n }", "private void turnOverItself() {\n byte tmp = leftEdge;\n leftEdge = reversedRightEdge;\n reversedRightEdge = tmp;\n\n tmp = rightEdge;\n rightEdge = reversedLeftEdge;\n reversedLeftEdge = tmp;\n\n tmp = topEdge;\n topEdge = reversedTopEdge;\n reversedTopEdge = tmp;\n\n tmp = botEdge;\n botEdge = reversedBotEdge;\n reversedBotEdge = tmp;\n\n tmp = ltCorner;\n ltCorner = rtCorner;\n rtCorner = tmp;\n\n tmp = lbCorner;\n lbCorner = rbCorner;\n rbCorner = tmp;\n }", "private void computePath(){\n LinkedStack<T> reversePath = new LinkedStack<T>();\n // adding end vertex to reversePath\n T current = end; // first node is the end one\n while (!current.equals(start)){\n reversePath.push(current); // adding current to path\n current = closestPredecessor[vertexIndex(current)]; // changing to closest predecessor to current\n }\n reversePath.push(current); // adding the start vertex\n \n while (!reversePath.isEmpty()){\n path.enqueue(reversePath.pop());\n }\n }", "private static void follow(Node node, EDirection dir, Node start, Collection<Vec2f> r) {\n\t\tNode next = node.getNeighbor(dir);\n\t\tif (node == start && dir == EDirection.EAST && !r.isEmpty()) // starting point\n\t\t\treturn;\n\t\tif (next == null) { // no neighbor change direction\n\t\t\tr.add(corner(node.getRectBounds(), dir));\n\t\t\tfollow(node, dir.rot90(), start, r);\n\t\t} else if (next.getNeighbor(dir.opposite().rot90()) != null) {\n\t\t\tr.add(corner(node.getRectBounds(), dir));\n\t\t\tfollow(next.getNeighbor(dir.opposite().rot90()), dir.opposite().rot90(), start, r);\n\t\t} else {\n\t\t\tVec2f my = node.getLocation();\n\t\t\tVec2f ne = next.getLocation();\n\t\t\tEDimension shiftDir = dir.asDim().opposite();\n\t\t\tfloat shift = shiftDir.select(my) - shiftDir.select(ne);\n\t\t\tif (shift != 0) {\n\t\t\t\tr.add(corner(node.getRectBounds(), dir));\n\t\t\t\tr.add(corner(next.getRectBounds(), dir.opposite().rot90()));\n\t\t\t}\n\t\t\tfollow(next, dir, start, r);\n\t\t}\n\t}", "public boolean step() {\n Tile nextTile;\n Direction d;\n int directionCount = 0;\n try {\n if (finished == true) {\n return true;\n }\n if (route.empty()) {\n route.push(maze.getEntrance());\n return false;\n } else {\n while (true) {\n if (directionCount == 0) {\n d = Direction.NORTH;\n } else if (directionCount == 1) {\n d = Direction.EAST;\n } else if (directionCount == 2) {\n d = Direction.SOUTH;\n } else if (directionCount == 3) {\n d = Direction.WEST;\n } else {\n if (!popped.isEmpty()) {\n if (popped.peek().getType() == Type.ENTRANCE) {\n throw new NoRouteFoundException();\n }\n }\n popped.push(route.pop());\n break;\n }\n nextTile = maze.getAdjacentTile(route.peek(), d);\n if (nextTile.isNavigable() && !route.contains(nextTile) && !popped.contains(nextTile)) {\n route.push(maze.getAdjacentTile(route.peek(), d));\n break;\n } else {\n directionCount += 1;\n continue;\n }\n }\n\n if (!route.isEmpty()) {\n if (route.peek().getType() == Type.EXIT) {\n finished = true;\n return true;\n }\n }\n return false;\n\n }\n } catch (NoRouteFoundException e) {\n System.out.println(e);\n throw e;\n }\n }", "private void atEndOfPathIsDetected() {\n \t\tmoveUltrasonicSensorToDefaultPosition();\n \t\trecursiveDepth = 0;\n \t\tturn = -15;\n \t}", "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 }", "private void goKnight(Board B, Graph G) {\n\n int start = B.knight;\n int end = B.gold;\n\n Queue<Integer> q = new Queue<Integer>();\n for (int v = 0; v < G.V(); v++)\n distTo[v] = INFINITY;\n\n int v = -1;\n distTo[start] = 0;\n marked[start] = true;\n q.enqueue(start);\n\n while (!q.isEmpty() && end != v) {\n v = q.dequeue();\n\n\n int tl_dest_R = (v / B.width);\n int tl_dest_C = (v % B.width);\n\n ArrayList<Integer> destinations = new ArrayList<Integer>();\n\n for (Move M : G.moves) {\n\n\n if (validateMove(M, v, G, B)) {\n\n if (true) {\n\n //System.out.println(thereispath(M, B.a.get(tl_dest_R).get(tl_dest_C), newDestination(M, v, G, B), G, B));\n\n if (!marked[newDestination(M, v, G, B)]) {\n\n\n q.enqueue(newDestination(M, v, G, B));\n marked[newDestination(M, v, G, B)] = true;\n edgeTo[newDestination(M, v, G, B)] = v;\n distTo[newDestination(M, v, G, B)] = distTo[v] + 1;\n\n // System.out.println(newDestination(M, v, G, B) + \" \" + edgeTo[newDestination(M, v, G, B)]);\n\n }\n\n\n }\n\n // System.out.println();\n\n }\n\n }\n\n\n //break;\n }\n\n System.out.println();\n\n Stack<Integer> reverse = new Stack<Integer>();\n\n\n int temp = end;\n reverse.push(temp);\n\n while (true) {\n\n\n temp = edgeTo[temp];\n reverse.push(temp);\n\n if (temp == start)\n break;\n }\n\n int last = 0;\n\n int temp_row = 0, temp_column = 0;\n\n String te = \"\";\n\n while (!reverse.isEmpty()) {\n\n if (last != 0) {\n te += \" -> \";\n }\n\n\n last = reverse.pop();\n\n\n temp_row = last / B.width;\n temp_column = last % B.width;\n\n\n te += B.a.get(temp_row).get(temp_column).toT();\n\n\n }\n\n if (distTo[last] == INFINITY) {\n System.out.println(\"No path to the target.\");\n } else {\n\n int a = 0, b = 0;\n\n a = B.gold / B.width;\n b = B.gold % B.width;\n int c = 0, d = 0;\n\n c = B.knight / B.width;\n d = B.knight % B.width;\n\n System.out.println(distTo[last] + \" steps\");\n System.out.println(B.a.get(c).get(d).toT() + \" to \" + B.a.get(a).get(b).toT() + \": \" + te);\n\n }\n\n\n }", "public void middleJourney(String path){\n System.out.print(\"You walk towards your direction\");\n while(test) {\n if (three!=0){\n System.out.println(\"Now lets try this again\");\n System.out.println(\"F/L/B/R?\");\n three=0;\n }\n path = sc.nextLine();\n if(path.toLowerCase().equals(\"f\")){\n System.out.println(\"Straight it is\");\n laterJourney(path);\n break;\n }\n else if (path.toLowerCase().equals(\"l\")){\n System.out.println(\"Left, let's go\");\n laterJourney(path);\n break;\n }\n\n else if (path.toLowerCase().equals(\"b\")){\n System.out.println(\"Backwards the way\");\n three++;\n }\n else if (path.toLowerCase().equals(\"r\")){\n System.out.println(\"Right Right Right. Alrighty then\");\n laterJourney(path);\n break;\n }\n else{\n System.out.println(\"Come on now, choose from the list\");\n }\n }\n }", "public Node setNextNode(Node node);", "private void pathFill(Vertex<E> src, Vertex<E> dst, ArrayList<E> path) {\r\n\t\tif(src == dst) {\r\n\t\t\tpath.add(src.getElement());\r\n\t\t} else {\r\n\t\t\tpathFill(src, dst.getPredecessor(), path);\r\n\t\t\tpath.add(dst.getElement());\r\n\t\t}\r\n\t}", "public void followPath(Path path) {\n\t\tdrive.resetDriveEncoders();\n\t\tswitch(path.getMode()) {\n\t\tcase BACKWARD_HIGH:\n\t\t\tleft = new EncoderFollower(Pathfinder.readFromCSV(path.getRightPath()));\n\t\t\tright = new EncoderFollower(Pathfinder.readFromCSV(path.getLeftPath()));\n\t\t\tleft.configurePIDVA(Constants.kMotionProfile_kP, Constants.kMotionProfile_kI, Constants.kMotionProfile_kD, Constants.kMotionProfileLeftBackHigh_kV / 12, Constants.kMotionProfileLeftBackHigh_kA / 12);\n\t\t\tright.configurePIDVA(Constants.kMotionProfile_kP, Constants.kMotionProfile_kI, Constants.kMotionProfile_kD, Constants.kMotionProfileRightBackHigh_kV / 12, Constants.kMotionProfileRightBackHigh_kA / 12);\n\t\t\tleftVIntercept = Constants.kMotionProfileLeftBackHigh_Intercept / 12;\n\t\t\trightVIntercept = Constants.kMotionProfileRightBackHigh_Intercept / 12;\n\t\t\tdirection = -1;\n\t\t\tbreak;\n\t\tcase BACKWARD_LOW:\n\t\t\tleft = new EncoderFollower(Pathfinder.readFromCSV(path.getRightPath()));\n\t\t\tright = new EncoderFollower(Pathfinder.readFromCSV(path.getLeftPath()));\n\t\t\tleft.configurePIDVA(Constants.kMotionProfile_kP, Constants.kMotionProfile_kI, Constants.kMotionProfile_kD, Constants.kMotionProfileLeftBackLow_kV / 12, Constants.kMotionProfileLeftBackLow_kA / 12);\n\t\t\tright.configurePIDVA(Constants.kMotionProfile_kP, Constants.kMotionProfile_kI, Constants.kMotionProfile_kD, Constants.kMotionProfileRightBackLow_kV / 12, Constants.kMotionProfileRightBackLow_kA / 12);\n\t\t\tleftVIntercept = Constants.kMotionProfileLeftBackLow_Intercept / 12;\n\t\t\trightVIntercept = Constants.kMotionProfileRightBackLow_Intercept / 12;\n\t\t\tdirection = -1;\n\t\t\tbreak;\n\t\tcase FORWARD_HIGH:\n\t\t\tleft = new EncoderFollower(Pathfinder.readFromCSV(path.getLeftPath()));\n\t\t\tright = new EncoderFollower(Pathfinder.readFromCSV(path.getRightPath()));\n\t\t\tleft.configurePIDVA(Constants.kMotionProfile_kP, Constants.kMotionProfile_kI, Constants.kMotionProfile_kD, Constants.kMotionProfileLeftForeHigh_kV / 12, Constants.kMotionProfileLeftForeHigh_kA / 12);\n\t\t\tright.configurePIDVA(Constants.kMotionProfile_kP, Constants.kMotionProfile_kI, Constants.kMotionProfile_kD, Constants.kMotionProfileRightForeHigh_kV / 12, Constants.kMotionProfileRightForeHigh_kA / 12);\n\t\t\tleftVIntercept = Constants.kMotionProfileLeftForeHigh_Intercept / 12;\n\t\t\trightVIntercept = Constants.kMotionProfileRightForeHigh_Intercept / 12;\n\t\t\tdirection = 1;\n\t\t\tbreak;\n\t\tcase FORWARD_LOW:\n\t\t\tleft = new EncoderFollower(Pathfinder.readFromCSV(path.getLeftPath()));\n\t\t\tright = new EncoderFollower(Pathfinder.readFromCSV(path.getRightPath()));\n\t\t\tleft.configurePIDVA(Constants.kMotionProfile_kP, Constants.kMotionProfile_kI, Constants.kMotionProfile_kD, Constants.kMotionProfileLeftForeLow_kV / 12, Constants.kMotionProfileLeftForeLow_kA / 12);\n\t\t\tright.configurePIDVA(Constants.kMotionProfile_kP, Constants.kMotionProfile_kI, Constants.kMotionProfile_kD, Constants.kMotionProfileRightForeLow_kV / 12, Constants.kMotionProfileRightForeLow_kA / 12);\n\t\t\tleftVIntercept = Constants.kMotionProfileLeftForeLow_Intercept / 12;\n\t\t\trightVIntercept = Constants.kMotionProfileRightForeLow_Intercept / 12;\n\t\t\tdirection = 1;\n\t\t\tbreak;\n\t\t}\n\t\tif(Constants.kNEOEncoders) {\n\t\t\tencoderCodesPerRev = Constants.kNEODriveEncoderCodesPerRev;\n\t\t}\n\t\telse {\n\t\t\tencoderCodesPerRev = Constants.kDriveEncoderCodesPerRev;\n\t\t}\n\t\tleft.configureEncoder((int)drive.getLeftRioPositionTicks(), encoderCodesPerRev, Constants.kWheelDiameter / 12);\n\t\tright.configureEncoder((int)drive.getRightRioPositionTicks(), encoderCodesPerRev, Constants.kWheelDiameter / 12);\n\t\tpathFinished = false;\n\t\t\n\t\tdrive.set(0, 0);\n\t\tdrive.setDriveMode(DriveMode.MOTION_PROFILE);\n\t\tnotifier.startPeriodic(0.01);\n\t}", "private void driveToNextNode(){\n updateAngles();\n computeDriveMechanics();\n\n //Set Speeds and drive\n double[] speedValues = getSpeedValues();\n setRobotSpeed(speedValues[0], speedValues[1]);\n //long end2 = System.nanoTime();\n\n //Update Metrics\n this.nodeCount = currentTree.size();\n this.nodeExploredCount = bestTree.size();\n //this.nodeGenTime += end1 - start1;\n //this.nodeDriveTime += end2 - start2;\n\n System.out.println(\"currenenenen:: \"+ currentNode.getPosition());\n System.out.println(\"currenenenen:: \"+ nextNode.getPosition());\n\n this.cumulativeEuclidean += getDistanceBetween(\n currentNode.getPosition(), nextNode.getPosition());\n\n //updateMetrics();\n\n //set current node as next node\n currentNode = nextNode;\n\n this.cumulativeTurnAngle += this.bearingAngle;\n }", "private void transPose(graph g) {\n\t\tIterator it = g.getV().iterator();\n\t\twhile (it.hasNext()) {\n\t\t\tnode_data temp = (node_data) it.next();\n\t\t\tif(g.getE(temp.getKey())!=null) {\n\t\t\t\tIterator it1 = g.getE(temp.getKey()).iterator();\n\t\t\t\twhile (it1.hasNext()) {\n\t\t\t\t\tedge_data temp1 = (edge_data) it1.next();\n\t\t\t\t\tif (temp1 != null && temp1.getTag() == 0) {\n\t\t\t\t\t\tif (g.getEdge(temp1.getDest(), temp1.getSrc()) != null) {\n\t\t\t\t\t\t\tEdge temps = new Edge((Edge)g.getEdge(temp1.getSrc(),temp1.getDest()));\n\t\t\t\t\t\t\tdouble weight1 = g.getEdge(temp1.getSrc(),temp1.getDest()).getWeight();\n\t\t\t\t\t\t\tdouble weight2 = g.getEdge(temp1.getDest(),temp1.getSrc()).getWeight();\n\t\t\t\t\t\t\tg.connect(temp1.getSrc(),temp1.getDest(),weight2);\n\t\t\t\t\t\t\tg.connect(temps.getDest(),temps.getSrc(),weight1);\n\t\t\t\t\t\t\tg.getEdge(temps.getDest(), temps.getSrc()).setTag(1);\n\t\t\t\t\t\t\tg.getEdge(temps.getSrc(),temps.getDest()).setTag(1);\n\t\t\t\t\t\t\tit1 = g.getE(temp.getKey()).iterator();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tg.connect(temp1.getDest(), temp1.getSrc(), temp1.getWeight());\n\t\t\t\t\t\t\tg.getEdge(temp1.getDest(), temp1.getSrc()).setTag(1);\n\t\t\t\t\t\t\tg.removeEdge(temp1.getSrc(), temp1.getDest());\n\t\t\t\t\t\t\tit1 = g.getE(temp.getKey()).iterator();\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}", "void shortestPath( final VertexType fromNode, Integer node );", "protected void processEdge(Edge e) {\n\t}", "@Override\n List<NodeData> pathFind() throws NoPathException {\n System.out.println(\"Starting Scenic\");\n\n frontier.add(start);\n\n while(!frontier.isEmpty()) {\n StarNode current = frontier.getLast();\n frontier.removeLast(); // pop the priority queue\n if(current.getXCoord() == goal.getXCoord() && current.getYCoord() == goal.getYCoord()) {\n // If we are at the goal, we need to backtrack through the shortest path\n System.out.println(\"At target!\");\n finalList.add(current); // we have to add the goal to the path before we start backtracking\n while(!(current.getXCoord() == start.getXCoord() && current.getYCoord() == start.getYCoord())) {\n finalList.add(current.getPreviousNode());\n current = current.getPreviousNode();\n System.out.println(current.getNodeID());\n }\n return finalList;\n }\n else {\n // we need to get all the neighbor nodes, identify their costs, and put them into the queue\n LinkedList<StarNode> neighbors = current.getNeighbors();\n // we also need to remove the previous node from the list of neighbors because we do not want to backtrack\n neighbors.remove(current.getPreviousNode());\n\n for (StarNode newnode : neighbors) {\n int nodePlace = this.listContainsId(frontier, newnode);\n if(nodePlace > -1) {\n if (frontier.get(nodePlace).getF() > actionCost(newnode) + distanceToGo(newnode, goal)) {\n System.out.println(\"Here\");\n frontier.remove(frontier.get(nodePlace));\n newnode.setPreviousNode(current);\n frontier.add(newnode);\n newnode.setF(actionCost(newnode) + distanceToGo(newnode, goal));\n }\n }\n else {\n newnode.setPreviousNode(current);\n frontier.add(newnode);\n newnode.setF(actionCost(newnode) + distanceToGo(newnode, goal));\n }\n\n // This fixes the problem with infinitely looping elevators (I hope)\n if(current.getNodeType().equals(\"ELEV\") && newnode.getNodeType().equals(\"ELEV\")) {\n for (Iterator<StarNode> iterator = newnode.neighbors.iterator(); iterator.hasNext();) {\n StarNode newneighbor = iterator.next();\n if (newneighbor.getNodeType().equals(\"ELEV\")) {\n // Remove the current element from the iterator and the list.\n iterator.remove();\n }\n }\n }\n if(current.getNodeType().equals(\"STAI\") && newnode.getNodeType().equals(\"STAI\")) {\n for (Iterator<StarNode> iterator = newnode.neighbors.iterator(); iterator.hasNext();) {\n StarNode newneighbor = iterator.next();\n if (newneighbor.getNodeType().equals(\"STAI\")) {\n // Remove the current element from the iterator and the list.\n iterator.remove();\n }\n }\n }\n // this is where the node is put in the right place in the queue\n Collections.sort(frontier);\n }\n }\n }\n throw new NoPathException(start.getLongName(), goal.getLongName());\n }", "private void setPath(){\r\n // get the reversed path\r\n ArrayList<Grid> reversedPath = new ArrayList<>();\r\n int index = _endIndex;\r\n reversedPath.add(_map.get_grid(index));\r\n while(index != _startIndex){\r\n index = _map.get_grid(index).get_parent();\r\n reversedPath.add(_map.get_grid(index));\r\n }\r\n\r\n // get the final path in the correct order\r\n int length = reversedPath.size();\r\n for(int i=length-1;i>=0;i--){\r\n _path.add(reversedPath.get(i));\r\n }\r\n }", "public void stepForward() {\n\t\tposition = forwardPosition();\n\t}", "public void moveNext() {\n\t\tcurrentElement++;\n\t}", "public void back() {\n\t\tif (path.isEmpty()) {\n\t\t\tpath = crossLocation.pop();\n\t\t\tLocation loc = path.get(path.size() - 1);\n\t\t\tint dir = getLocation().getDirectionToward(loc);\n\t\t\tif (dir == Location.HALF_CIRCLE) {\n\t\t\t\tdirsCount[0]--;\n\t\t\t} else if (dir == Location.AHEAD) {\n\t\t\t\tdirsCount[1]--;\n\t\t\t} else if (dir == Location.RIGHT) {\n\t\t\t\tdirsCount[2]--;\n\t\t\t} else {\n\t\t\t\tdirsCount[3]--;\n\t\t\t}\n\t\t}\n\t\tnext = path.remove(path.size() - 1);\n\t\tmove();\n\t}", "public Iterable<Edge> pathTo(final int one) {\n if (!hasPath(one)) {\n return null;\n }\n Stack<Edge> sta = new Stack<Edge>();\n int two = one;\n for (Edge each = edge[one]; each != null; each = edge[two]) {\n sta.push(each);\n two = each.other(two);\n }\n return sta;\n }", "public void movePointerForward() throws EndTaskException {\n\t\tpickBeeper();\n\t\tmove();\n\t\tputBeeper();\n\t}", "@Override\n\tpublic void onNextRoadClick() {\n\t\t\n\t}", "public void treeEdge(Edge e) {}", "private static Node updateNextNodeAlgo1(Node nextNode, Node destination) {\n if (nextNode.getDistanceToZ() > destination.getDistanceToZ()) {\n return destination;\n }\n return nextNode;\n }", "public Iterator trip() {\n\t\tStack path = new Stack();\n\t\ttry {\n\t\t\t// initializes path to the stack of nodes from starting point to end\n\t\t\t// point\n\t\t\tpath = path(BusLines, BusLines.getNode(start), BusLines.getNode(dest));\n\n\t\t\t// checks if there is a path, otherwise return null\n\t\t\tif (path == null) {\n\t\t\t\treturn null;\n\t\t\t} else {\n\t\t\t\treturn path.iterator();\n\t\t\t}\n\t\t} catch (GraphException e) {\n\t\t\tSystem.out.println(\"Error: the path does not exists.\");\n\t\t}\n\t\treturn null;\n\n\t}", "void transit();", "public void goToPointer() throws EndTaskException {\n\t\twhile (notNextToABeeper()) {\n\t\t\tmove();\n\t\t}\n\t}", "private List<List<Edge>> walker(String sourceNode, String destNode, List<Edge> currentPath, List<List<Edge>> paths) {\n if (currentPath == null) {\n currentPath = new ArrayList<>();\n }\n if (paths == null) {\n paths = new ArrayList<>();\n }\n\n if (sourceNode.equals(destNode)) {\n return paths;\n }\n\n\n// List<Edge> edges = findByNodeA(sourceNode);\n List<Edge> edges = allEdges.stream().filter(edge -> edge.nodeA.equals(sourceNode)).collect(Collectors.toList());\n\n\n for (Edge edge : edges) {\n if (!currentPath.contains(edge)&&!containsBidirectionalRef(currentPath,edge)) {\n List<Edge> forkPath = (List<Edge>) ((ArrayList<Edge>) currentPath).clone();\n\n forkPath.add(edge);\n\n if (edge.getNodeB().equals(destNode)) {\n paths.add(forkPath);\n } else {\n walker(edge.getNodeB(), destNode,forkPath,paths);\n }\n }\n }\n\n return paths;\n }", "public void actionPerformed(ActionEvent e) {\r\n mode = InputMode.DFS;\r\n instr.setText(\"Click one node to start Depth First Traversal from it.\");\r\n }", "@Override\n\tpublic void bellmanFord(IWeightedGraph<N, E> graph, int startnode) {\n\t\tif(graph == null){\n\t\t\tthrow new NullPointerException();\n\t\t}else if (startnode < 0 || startnode > graph.numberOfNodes()-1){\n\t\t\tthrow new IllegalArgumentException();\n\t\t}\n\n\n\t\tfor(int i= 0; i<shortestPaths.length;i++){\n\t\t\tshortestPaths[i] = Double.POSITIVE_INFINITY;\n\t\t}\n\t\tshortestPaths[startnode] = 0;\n\n\t\tfor(int i= 1; i<graph.numberOfNodes(); i++){\n\t\t\tIterator<IEdge<E>> edgesIterator = graph.edgeIterator();\n\t\t\twhile(edgesIterator.hasNext()){\n\t\t\t\tIEdge<E> edge = edgesIterator.next();\n\t\t\t\tif(shortestPaths[edge.getSource()] + edge.getWeight() < shortestPaths[edge.getDestination()]){\n\t\t\t\t\tshortestPaths[edge.getDestination()] = shortestPaths[edge.getSource()] + edge.getWeight();\n\t\t\t\t\tpreviousNode[edge.getDestination()] = edge.getSource();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}", "public void addEdge(DirectedEdge e) \n {\n int v = e.from();\n adj[v].add(e);\n E++;\n }", "private void findPath1(List<Coordinate> path) {\n\n // records the start coordinate in a specific sequence.\n ArrayList<Coordinate> starts = new ArrayList<>();\n // records the end coordinate in a specific sequence.\n ArrayList<Coordinate> ends = new ArrayList<>();\n // records the total cost of the path in a specific sequence.\n ArrayList<Integer> cost = new ArrayList<>();\n\n for (Coordinate o1 : originCells) {\n for (Coordinate d1 : destCells) {\n Graph graph = new Graph(getEdge(map));\n graph.dijkstra(o1);\n graph.printPath(d1);\n starts.add(o1);\n ends.add(d1);\n cost.add(graph.getPathCost(d1));\n }\n }\n int index = getMinIndex(cost);\n\n Graph graph = new Graph(getEdge(map));\n graph.dijkstra(starts.get(index));\n graph.printPath(ends.get(index));\n for (Graph.Node node : graph.getPathReference()) {\n path.add(node.coordinate);\n }\n setSuccess(path);\n }", "public void compNextMove(){\r\n int flatNextMove;\r\n\r\n /* transfer the matrix to an array */\r\n Sign[] flatBoard = flattenBoard();\r\n\r\n /* choose best next move according to difficulty */\r\n flatNextMove = CompPlayer.nextMove(flatBoard,moves,playerSign,difficulty);\r\n\r\n /* set the sign in the correct place in the matrix */\r\n for (int i=0;i<3;i++)\r\n for (int j=0;j<3;j++){\r\n flatNextMove--;\r\n if (flatNextMove == 0)\r\n setSign(i,j,compSign);\r\n }\r\n }" ]
[ "0.7252566", "0.6821686", "0.6330777", "0.61816376", "0.6159228", "0.61315405", "0.6060969", "0.6042948", "0.5997076", "0.59740156", "0.5919283", "0.5913824", "0.5903942", "0.58859944", "0.5877571", "0.58580816", "0.5849799", "0.58418167", "0.5787682", "0.5782554", "0.57439226", "0.5714866", "0.5713999", "0.5712304", "0.5687171", "0.56860864", "0.566239", "0.56592196", "0.56528515", "0.56485564", "0.56469315", "0.5641271", "0.5640233", "0.5631708", "0.56207174", "0.5618611", "0.56161994", "0.5616154", "0.5583486", "0.5581396", "0.5575582", "0.5570956", "0.55690557", "0.5552246", "0.55438566", "0.5542909", "0.5536909", "0.5516919", "0.5508729", "0.5508223", "0.55069727", "0.5505758", "0.5502361", "0.5486602", "0.5462177", "0.54612064", "0.5461169", "0.5458468", "0.5452615", "0.5451396", "0.54501504", "0.5434652", "0.54275477", "0.5419165", "0.5417422", "0.5414315", "0.54141676", "0.54114926", "0.54099053", "0.5403729", "0.5396205", "0.539402", "0.5388758", "0.5376302", "0.5375849", "0.5370632", "0.53666127", "0.53559464", "0.53468746", "0.5346855", "0.53406554", "0.53375745", "0.5331198", "0.5328339", "0.53279334", "0.532608", "0.53221905", "0.5318045", "0.53176606", "0.53100836", "0.5303744", "0.5302668", "0.530044", "0.52971375", "0.5295732", "0.5295718", "0.5294491", "0.52940875", "0.52921885", "0.5291589" ]
0.7956939
0
Sets the Agent up to proceed along an Edge.
void setupEdge(EdgeGraph edge) { if (UserParameters.socialInteraction) updateCrowdness(edge); currentEdge = edge; //transform GeomPlanarGraphEdge in Linestring LineString line = edge.getLine(); //index the Linestring segment = new LengthIndexedLine(line); startIndex = segment.getStartIndex(); endIndex = segment.getEndIndex(); linkDirection = 1; // check to ensure that Agent is moving in the right direction (direction) double distanceToStart = line.getStartPoint().distance(agentLocation.geometry); double distanceToEnd = line.getEndPoint().distance(agentLocation.geometry); if (distanceToStart <= distanceToEnd) { // closer to start currentIndex = startIndex; linkDirection = 1; } else if (distanceToEnd < distanceToStart) { // closer to end currentIndex = endIndex; linkDirection = -1; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected void setup(){\n\n\t\tsuper.setup();\n\n\t\tfinal Object[] args = getArguments();\n\t\tif(args!=null && args[0]!=null && args[1]!=null){\n\t\t\tdeployAgent((Environment) args[0],(EntityType)args[1]);\n\t\t}else{\n\t\t\tSystem.err.println(\"Malfunction during parameter's loading of agent\"+ this.getClass().getName());\n System.exit(-1);\n }\n\t\t\n\t\t//############ PARAMS ##########\n\n\t\tthis.nbmodifsmin \t\t= 30;\t\t\t//nb modifs minimum pour renvoyer la carte\n\t\tthis.timeOut \t\t\t= 1000 * 4;\t\t//secondes pour timeout des messages (*1000 car il faut en ms)\n\t\tthis.sleepbetweenmove \t= 200;\t\t\t//in MS\n\t\tthis.nbmoverandom\t\t= 4;\t\t\t// nb random moves by default\n\t\t\n\t\t//#############################\n\t\t//setup graph\n\t\t//setupgraph();\n\t\tthis.graph = new SingleGraph(\"graphAgent\");\n\t\tinitMyGraph();\n\t\tthis.step = 0;\n\t\tthis.stepMap = new HashMap<String, Integer>();\n\t\tthis.path = new ArrayList<String>();\n\t\tthis.mailbox = new Messages(this);\n\t\tthis.lastMsg = null;\n\t\tthis.switchPath = true;\n\t\tthis.lastsender = null;\n\t\tthis.lastSentMap = new HashMap<String, Integer>(); //nbmodifs\n\t\tthis.remakepath = false; // changes to true if the map changed in a way that requires a new path\n\t\tthis.nbmoverandomoriginal = this.nbmoverandom;\n\t\t\n\t\tthis.toSendMap = new HashMap<String, Graph>(); //actual hashmap graph\n\t\t\n\t\tSystem.out.println(\"the agent \"+this.getLocalName()+ \" is started\");\n\t}", "@Override\r\n\tprotected void setup()\r\n\t{\r\n\r\n\t\t//adding the desired behaviour to the agent\r\n\t\taddBehaviour(new RoadAgentBehaviour(this));\r\n\t}", "@Override\n\tpublic void setup() {\n\t\tObjectSpace objectSpace = Blackboard.inst().getSpace(ObjectSpace.class, \"object\");\n\t\tList<PhysicsObject> objects = objectSpace.getCognitiveAgents();\n\n\t\tif (objects.size() != 2)\n\t\t\tthrow new RuntimeException(\"Need two agents in order to run PathScenario4!\");\n\t\t\n\t\t// first we determine the line between their two points.\n\t\tPhysicsObject obj1 = objects.get(0);\n\t\tPhysicsObject obj2 = objects.get(1);\n\t\t\t\t\n\t\tVec2 direction = obj1.getPPosition().sub(obj2.getPPosition());\n\t\tVec2 nDirection = new Vec2(direction);\n\t\tnDirection.normalize();\n\t\tfloat radians = (float) Math.atan2(nDirection.y, nDirection.x);\n\t\tfloat PI = (float) Math.PI;\n\t\tfloat PI2 = PI * 0.5f;\n\n\t\tfloat perp = radians + PI2;\n\t\tVec2 v = new Vec2((float) Math.cos(perp), (float) Math.sin(perp));\n\t\tVec2 offset1 = new Vec2(obj1.getPPosition().add(v));\n\n\t\tList<Vec2> waypoints1 = new ArrayList<Vec2>();\n\t\twaypoints1.add(obj2.getPPosition());\n\n\t\tList<Vec2> waypoints2 = new ArrayList<Vec2>();\n\t\twaypoints2.add(offset1);\n\t\t\n\t\t// Set positions and orientations\n\t\tobj1.getBody().setXForm(obj1.getPPosition(), radians + (float) Math.PI);\n\t\tobj2.getBody().setXForm(obj2.getPPosition(), radians);\n\n\t\tEventManager.inst().dispatch(new SetWaypoints(waypoints1, obj1));\n\t\tEventManager.inst().dispatch(new SetWaypoints(waypoints2, obj2));\n\t}", "public void setEdge(int start, int target){\n\t\tthis.graph.elementAt(start).insert(target);\n\t}", "@Override\r\n public void execute() {\r\n if (newSource != null) {\r\n edge.setSource(newSource);\r\n } else if (newTarget != null) {\r\n edge.setTarget(newTarget);\r\n }\r\n }", "@Override\n\tpublic void agentSetup() {\n\n\t\t// load the class names of each object\n\t\tString os = dagent.getOfferingStrategy().getClassname();\n\t\tString as = dagent.getAcceptanceStrategy().getClassname();\n\t\tString om = dagent.getOpponentModel().getClassname();\n\t\tString oms = dagent.getOMStrategy().getClassname();\n\n\t\t// createFrom the actual objects using reflexion\n\n\t\tofferingStrategy = BOAagentRepository.getInstance().getOfferingStrategy(os);\n\t\tacceptConditions = BOAagentRepository.getInstance().getAcceptanceStrategy(as);\n\t\topponentModel = BOAagentRepository.getInstance().getOpponentModel(om);\n\t\tomStrategy = BOAagentRepository.getInstance().getOMStrategy(oms);\n\n\t\t// init the components.\n\t\ttry {\n\t\t\topponentModel.init(negotiationSession, dagent.getOpponentModel().getParameters());\n\t\t\topponentModel.setOpponentUtilitySpace(fNegotiation);\n\t\t\tomStrategy.init(negotiationSession, opponentModel, dagent.getOMStrategy().getParameters());\n\t\t\tofferingStrategy.init(negotiationSession, opponentModel, omStrategy,\n\t\t\t\t\tdagent.getOfferingStrategy().getParameters());\n\t\t\tacceptConditions.init(negotiationSession, offeringStrategy, opponentModel,\n\t\t\t\t\tdagent.getAcceptanceStrategy().getParameters());\n\t\t\tacceptConditions.setOpponentUtilitySpace(fNegotiation);\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\t// remove the reference to the information object such that the garbage\n\t\t// collector can remove it.\n\t\tdagent = null;\n\t}", "public void setTargetAgent(final Agent agent) {\r\n mTargetAgent = agent;\r\n }", "public void loadEdge()\r\n {\r\n town.createConnection();\r\n }", "void transitionToNextEdge(double residualMove) {\n\n\t\t// update the counter for where the index on the path is\n\t\tindexOnPath += pathDirection;\n\n\t\t// check to make sure the Agent has not reached the end of the path already\n\t\t// depends on where you're going!\n\t\tif ((pathDirection > 0 && indexOnPath >= path.size()) || (pathDirection < 0 && indexOnPath < 0)) {\n\t\t\treachedDestination = true;\n\t\t\tindexOnPath -= pathDirection; // make sure index is correct\n\t\t\treturn;\n\t\t}\n\n\t\t// move to the next edge in the path\n\t\tEdgeGraph edge = (EdgeGraph) path.get(indexOnPath).getEdge();\n\t\tsetupEdge(edge);\n\t\tspeed = progress(residualMove);\n\t\tcurrentIndex += speed;\n\n\t\t// check to see if the progress has taken the current index beyond its goal\n\t\t// given the direction of movement. If so, proceed to the next edge\n\t\tif (linkDirection == 1 && currentIndex > endIndex) transitionToNextEdge(currentIndex - endIndex);\n\t\telse if (linkDirection == -1 && currentIndex < startIndex) transitionToNextEdge(startIndex - currentIndex);\n\t}", "public void setAgent(Agent agent) {\n\t\tthis.agent = agent;\n\t}", "public void setEdgeDirecter( EdgeDirecter directer )\n \t{\n \t\tedgeDirecter = directer;\n \t}", "@Override\r\n\tprotected void setup() {\n\t\tlog=LogManager.getLogger();\r\n\t\tmyAgent.addGoal(new SendMsgGoal());\r\n//\t\tlog.info(\"Send message goal is added\");\r\n\t\t\r\n\t}", "public synchronized void setAgentCoordinate() {\n agentCoordinate = getCoordinate(agentState);\n }", "protected void processEdge(Edge e) {\n\t}", "protected void attachEdgeTargetAnchor(String edge, String oldTargetPin, String targetPin) {\n ((ConnectionWidget) findWidget(edge)).setTargetAnchor(getPinAnchor(targetPin));\n }", "void setBestIncoming(E edge);", "public void moveAgentTo(Agent ag, int door) throws InterruptedException {\n ProcessData data = (ProcessData) agents.get(ag);\n Vertex vertexFrom, vertexTo;\n Message msg;\n MessagePacket msgPacket;\n \n \n if( door < 0 || door >= getArity(ag))\n throw new IllegalArgumentException(\"This door doesn't exist !\");\n\n vertexFrom = data.vertex;\n vertexTo = vertexFrom.neighbour(door);\n\n msg = new StringMessage(ag.toString());\n msgPacket = new MessagePacket(vertexFrom.identity(), door, \n vertexTo.identity(), msg);\n\t\n\tpushMessageSendingEvent(msgPacket,ag);\n\t\n\n\tdata.vertex = vertexTo;\n\tdata.lastVertexSeen = vertexFrom;\n\n stats.add(new MoveStat(ag.getClass()));\n }", "public void setEdge(IEdge<?> edge) {\n\t\tthis.edge = edge;\n\t}", "public Edge(){\n\t\tvertices = null;\n\t\tnext = this;\n\t\tprev = this;\n\t\tpartner = null;\n\t\tweight = 0;\n\t}", "@Override\r\n\tpublic void setup(Topology topology, TaskDistribution td, Agent agent) {\r\n\t\tSystem.out.println(\"Seting up...\");\r\n\t\t// Reads the discount factor from the agents.xml file.\r\n\t\t// If the property is not present it defaults to 0.95\r\n\t\tthis.discount = agent.readProperty(\"discount-factor\", \r\n\t\t\t\t\t\t\t\t\t\t\tDouble.class,\r\n\t\t\t\t\t\t\t\t\t\t\t0.95);\r\n\t\tthis.epsilon = 0.001;\r\n\t\tthis.numActions = 0;\r\n\t\tthis.myAgent = agent;\r\n\t\tthis.topology = topology;\r\n\t\tthis.td = td;\r\n\t\t\r\n\t\tRouteState.initializeStates(this.topology.cities());\r\n\t\tRouteAction.initializeActions(this.topology.cities());\r\n\t\t\r\n\t\tthis.Q = Tables.initializeQ();\r\n\t\tthis.V = Tables.initializeV();\r\n\t\tthis.R = Tables.initializeR(this.myAgent, this.td);\r\n\r\n\t\tSystem.out.println(\"Start RLA...\");\r\n\t\trla();\r\n\t}", "public Node(Edge edge) {\n this.edge = edge;\n }", "protected void setup() {\n\t\tSystem.out.println(\"Messenger agent \"+getAID().getName()+\" is ready.\");\r\n\t\tagentList = new ArrayList();\r\n\t\trefreshActiveAgents();\r\n\r\n\t\tmessageGUI = new MessageAgentGui(this);\r\n\t\tmessageGUI.displayGUI();\r\n\r\n\t\tDFAgentDescription dfd = new DFAgentDescription();\r\n\t\tdfd.setName(getAID());\r\n\t\tServiceDescription sd = new ServiceDescription();\r\n\t\tsd.setType(\"messenger-agent\");\r\n\t\tsd.setName(getLocalName()+\"-Messenger agent\");\r\n\t\tdfd.addServices(sd);\r\n\t\ttry {\r\n\t\t\tDFService.register(this, dfd);\r\n\t\t}\r\n\t\tcatch (FIPAException fe) {\r\n\t\t\tfe.printStackTrace();\r\n\t\t}\r\n\t\taddBehaviour(new ReceiveMessage());\r\n\t}", "public void setEdgeWeight(double edgeWeight) {\n this.edgeWeight = edgeWeight;\n }", "public void changeDoorState(Agent ag, int door, EdgeState state) \n throws InterruptedException {\n\n Vertex vertexFrom, vertexTo;\n Long key = new Long(numGen.alloc());\n EdgeStateChangeEvent event;\n\n vertexFrom = getVertexFor(ag);\n vertexTo = vertexFrom.neighbour(door);\n\n event = new EdgeStateChangeEvent(key, \n vertexFrom.identity(),\n vertexTo.identity(),\n state);\n evtQ.put(event);\n movingMonitor.waitForAnswer(key);\n stats.add(new EdgeStateStat(ag.getClass()));\n }", "@Test\n public void forcingDirectionDoesNotMeanWeCannotUseEdgeAtAll() {\n int north = graph.edge(1, 0).setDistance(1).set(speedEnc, 10, 10).getEdge();\n int south = graph.edge(1, 2).setDistance(1).set(speedEnc, 10, 10).getEdge();\n graph.edge(2, 5).setDistance(1).set(speedEnc, 10, 0);\n graph.edge(5, 4).setDistance(1).set(speedEnc, 10, 0);\n graph.edge(4, 3).setDistance(1).set(speedEnc, 10, 0);\n graph.edge(3, 2).setDistance(1).set(speedEnc, 10, 0);\n graph.edge(1, 0).setDistance(1).set(speedEnc, 10, 0);\n graph.edge(0, 6).setDistance(1).set(speedEnc, 10, 0);\n int targetEdge = graph.edge(6, 7).setDistance(1).set(speedEnc, 10, 0).getEdge();\n assertPath(calcPath(1, 7, north, targetEdge), 0.3, 3, 300, nodes(1, 0, 6, 7));\n assertPath(calcPath(1, 7, south, targetEdge), 0.9, 9, 900, nodes(1, 2, 5, 4, 3, 2, 1, 0, 6, 7));\n }", "public void assignLane() {\n\t\tIterator<Lane> it = lanes.iterator();\n\n\t\twhile (it.hasNext() && partyQueue.getPartyQueue().hasMoreElements()) {\n\t\t\tLane curLane = it.next();\n\n\t\t\tif (!curLane.isPartyAssigned()) {\n\t\t\t\tSystem.out.println(\"ok... assigning this party\");\n\t\t\t\tcurLane.assignParty(((Party) partyQueue.getPartyQueue().next()));\n\t\t\t}\n\t\t}\n\t\tif (cdView != null)\n\t\t\tcdView.receiveControlDeskEvent(new ControlDeskEvent(partyQueue.getPartyQueueDisplay()));\n\t}", "public void Elevator() {\n // Use these to get going:\n // setSetpoint() - Sets where the PID controller should move the system\n // to\n // enable() - Enables the PID controller.\n \t\n }", "public void addEdge(StubEdge e) {\n }", "@Override\n public void placeRoad(EdgeLocation edge) throws ModelException {\n assert edge != null;\n\n if (!GameModelFacade.instance().canPlaceRoad(edge)) {\n throw new ModelException(\"Preconditions for action not met.\");\n }\n\n try {\n String clientModel = m_theProxy.buildRoad(GameModelFacade.instance().getLocalPlayer().getIndex(), edge, GameModelFacade.instance().isFreeRound());\n new ModelInitializer().initializeClientModel(clientModel, m_theProxy.getPlayerId());\n } catch (NetworkException e) {\n throw new ModelException(e);\n }\n }", "static public void edge(Edge edge,float dx,float dy){\n edge.aX+=dx;\n edge.aY+=dy;\n edge.bX+=dx;\n edge.bY+=dy;\n edge.ghostAY+=dx;\n edge.ghostAY+=dy;\n edge.ghostBX+=dx;\n edge.ghostBY+=dy;\n }", "protected void setup(){\n this.setEnabledO2ACommunication(true, 0);\n \n showMessage(\"Agent (\" + getLocalName() + \") .... [OK]\");\n \n // Register the agent to the DF\n ServiceDescription sd1 = new ServiceDescription();\n sd1.setType(UtilsAgents.BOAT_COORDINATOR);\n sd1.setName(getLocalName());\n sd1.setOwnership(UtilsAgents.OWNER);\n DFAgentDescription dfd = new DFAgentDescription();\n dfd.addServices(sd1);\n dfd.setName(getAID());\n try {\n DFService.register(this, dfd);\n showMessage(\"Registered to the DF\");\n }catch (FIPAException e) {\n System.err.println(getLocalName() + \" registration with DF \" + \"unsucceeded. Reason: \" + e.getMessage());\n doDelete();\n }\n \n //Search for the CentralAgent\n ServiceDescription searchBoatCoordCriteria = new ServiceDescription();\n searchBoatCoordCriteria.setType(UtilsAgents.COORDINATOR_AGENT);\n this.coordinatorAgent = UtilsAgents.searchAgent(this, searchBoatCoordCriteria);\n\n // Register response behaviours\n //TODO canviar i posar l'altra content\n MessageTemplate mt = MessageTemplate.MatchContent(\"Movement request\");\n this.addBehaviour(new RequestResponseBehaviour(this,mt ));\n }", "public void followEdge(int e) {\r\n\t\tfor (int i = 0; i < currentVertex.outList.size(); i++) {\r\n\t\t\tNeighbor neighbor = currentVertex.outList.get(i);\r\n\t\t\tif (neighbor.edge == e) {\r\n\t\t\t\tcurrentVertex = neighbor.vertex;\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t\tSystem.out.println(\"Edge to \" + e + \" not exist.\");\r\n\t}", "@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 }", "@Override\r\n protected void setup() {\n Number = Double.valueOf((String) getArguments()[0]);\r\n String Name = getAID().getLocalName();\r\n\r\n System.out.println(\"Agent Id: \" + Name +\" number = \" + Number);\r\n\r\n linkedAgents = Arrays.copyOfRange(getArguments(), 1,\r\n getArguments().length, String[].class);\r\n\r\n addBehaviour(new FindAverage\r\n (this, TimeUnit.SECONDS.toMillis(1)));\r\n }", "public void setAsUp () \n\t{ \n\t\tn.setFailureState(true);\n\t\tfinal SortedSet<WLightpathRequest> affectedDemands = new TreeSet<> ();\n\t\tgetOutgoingFibers().forEach(f->affectedDemands.addAll(f.getTraversingLpRequestsInAtLeastOneLp()));\n\t\tgetIncomingFibers().forEach(f->affectedDemands.addAll(f.getTraversingLpRequestsInAtLeastOneLp()));\n\t\tfor (WLightpathRequest lpReq : affectedDemands)\n\t\t\tlpReq.internalUpdateOfRoutesCarriedTrafficFromFailureState();\n\t}", "public Edge()\r\n {\r\n }", "void addEdge(Edge e) {\n\t\t\tif(!_edges.containsKey(e.makeKey())) {\n\t\t\t\t_edges.put(e.makeKey(),e);\n\t\t\t\te._one.addNeighborEdge(e);\n\t\t\t\te._two.addNeighborEdge(e);\n\t\t\t}\n\t\t}", "public void setAgentEventListener(AgentEventListener ael) {\r\n agentEventListener = ael;\r\n }", "public abstract boolean putEdge(Edge incomingEdge);", "public RoadAgentBehaviour(Agent a)\r\n\t\t{\r\n\t\t\tsuper(a);\r\n\t\t}", "public void setupPortrayals()\n {\n edgePortrayal.setField(new SpatialNetwork2D(((ACOSim)state).environment, \n\t\t\t\t\t\t((ACOSim)state).network));\n\n SimpleEdgePortrayal2D p = new SimpleEdgePortrayal2D(Color.lightGray, \n\t\t\t\t\t\t\tColor.lightGray, \n\t\t\t\t\t\t\tColor.black);\n p.setShape(SimpleEdgePortrayal2D.SHAPE_LINE);\n edgePortrayal.setPortrayalForAll(p);\n nodePortrayal.setField(((ACOSim)state).environment);\n\n // reschedule the displayer\n display.reset();\n display.setBackdrop(Color.white);\n\n // redraw the display\n display.repaint();\n }", "public void setAgent(String agent)\n {\n this.agent = agent;\n }", "public void addEdge(Edge e){\n\t\tedges.put(e.hashCode(), e);\n\t\te.getHead().addConnection(e);\n\t\te.getTail().addConnection(e);\n\t}", "@Setup(Level.Trial)\n public void setupGraph() {\n initializeMethod();\n prepareRequest();\n emitFrontEnd();\n }", "@Setup(Level.Trial)\n public void setupGraph() {\n initializeMethod();\n prepareRequest();\n emitFrontEnd();\n }", "@Setup(Level.Trial)\n public void setupGraph() {\n initializeMethod();\n prepareRequest();\n emitFrontEnd();\n }", "EdgeNode(VertexNode correspondingVertex){\n setCorrespondingVertex(correspondingVertex);\n }", "public void setNextRoad(CarAcceptor r) {\n\t\tthis.firstRoad = r;\n\t}", "public void editEdge(){\n\t}", "@Override\r\n public void attachEdgeTargetAnchor(JPAModelerScene scene, IEdgeWidget edgeWidget, INodeWidget targetNodeWidget) {\n edgeWidget.setTargetAnchor(((IPNodeWidget) targetNodeWidget).getNodeAnchor());\r\n }", "public void buildInitialRoad(Edge edge) throws CannotBuyException, InsufficientPlayerResourcesException, AllPiecesPlayedException {\n\t\t if(canDoBuildInitialRoad() == false) {\n\t\t\t throw new CannotBuyException(\"Cannot Buy Road, possibly no edge to place a road\");\n\t\t }\n\t\t playerPieces.placeRoad(edge);\n\t }", "public Edge(Edge other) {\n __isset_bitfield = other.__isset_bitfield;\n this.vertexOrigin = other.vertexOrigin;\n this.vertexDestiny = other.vertexDestiny;\n if (other.isSetDescription()) {\n this.description = other.description;\n }\n this.weight = other.weight;\n this.isDirected = other.isDirected;\n }", "public void addEdge(Edge edge){\n \n synchronized(vertexes){\n Long start = edge.getStart();\n Vertex sVertex = vertexes.get(start);\n if(sVertex != null){\n sVertex.addEdge(edge, true);\n }\n// if undirected graph then adds edge to the finish vertex too \n if(!edge.isDirected()){\n Long finish = edge.getFinish();\n Vertex fVertex = vertexes.get(finish);\n if(fVertex != null){\n fVertex.addEdge(edge, false);\n }\n }\n }\n \n }", "public void setEdge(int i, int j, int wt){\r\n\t\tif(wt!=0){\r\n\t\t\tSystem.out.println(\"Cannot set weight to 0!\");\r\n\t\t}\r\n\t\telse{\r\n\t\t\tif(matrix[i][j]==0){\r\n\t\t\t\tnumEdge++;\r\n\t\t\t\tmatrix[i][j]=wt;\r\n\t\t\t}\r\n\t\t}\t\r\n\t}", "private void setupAgents() {\r\n try {\r\n setupJade();\r\n //createAgent(Bank.class, \"Bank\");\r\n createAgent(ProductionAgent.class, \"Res1\");\r\n createAgent(ProductionAgent.class, \"Res2\");\r\n createAgent(SocialAgent.class, \"Soc\");\r\n createAgent(ClientAgent.class, \"Client\");\r\n\r\n } catch (Exception e) {\r\n e.printStackTrace(System.err);\r\n }\r\n }", "void setEdgeLabel(int edge, String label);", "private void initializeAgent() {\n if (Math.random() < PROBABILITY_START_WITH_AGENT) {\n agent = new SugarscapeAgent();\n }\n }", "protected void setup() {\n\t\tSystem.out.println(\"Broker Agent \"+getAID().getName()+\" is ready.\");\r\n\t\tthis.getContentManager().registerLanguage(new SLCodec());\r\n\t\tthis.getContentManager().registerOntology(RequestOntology.getInstance());\r\n\t\t\r\n\t\tObject[] args = getArguments();\r\n\t\tif (args != null && args.length > 0) {\r\n\t\t\tprice = (String) args[0];\r\n\t\t\tvolume= (String) args[1];\r\n\t\t\t\r\n\t\t\tDFAgentDescription dfd = new DFAgentDescription();\r\n\t\t\tdfd.setName(getAID());\r\n\t\t\tServiceDescription sd = new ServiceDescription();\r\n\t\t\tsd.setType(\"energy-selling\");\r\n\t\t\tsd.setName(\"Energy-Broker\");\r\n\t\t\tdfd.addServices(sd);\r\n\t\t\ttry {\r\n\t\t\t\tDFService.register(this, dfd);\r\n\t\t\t}\r\n\t\t\tcatch (FIPAException fe) {\r\n\t\t\t\tfe.printStackTrace();\r\n\t\t\t}\t\t\t\r\n\t\t}\r\n\t\telse{\r\n\t\t\tSystem.out.println(getAID().getName()+\" No available arguments\");\r\n\t\t\tdoDelete();\r\n\t\t}\r\n\t\taddBehaviour(new BOReply(this));\r\n\t}", "void addEdge(Edge e) {\n if (e.getTail().equals(this)) {\n outEdges.put(e.getHead(), e);\n\n return;\n } else if (e.getHead().equals(this)) {\n indegree++;\n inEdges.put(e.getTail(), e);\n\n return;\n }\n\n throw new RuntimeException(\"Cannot add edge that is unrelated to current node.\");\n }", "public void treeEdge(Edge e) {}", "public void setAgent(Integer agent) {\r\n this.agent = agent;\r\n }", "public void clickContinueInAgentPage() throws Exception {\n\n\t\twdriver.findElement(By.xpath(\"//button[@type='submit']\")).click();\n\n\t}", "@Test\r\n public void testAttachAgentToMission() {\r\n Agent agent = jamesBond;\r\n Mission mission = infiltrateSPD;\r\n missionManager.createMission(mission);\r\n agentManager.create(agent);\r\n manager.attachAgentToMission(agent, mission);\r\n \r\n }", "public Edge(int weight){\n\t\tthis.EDGE_ID = IDToGive;\n\t\tthis.edgeWeight = weight;\n\t\tIDToGive++;\n\t}", "public interface Edge\n{\n\t/**\n\t * Returns the node that the <i>head</i> of the head\n\t * is connected to.\n\t * @return The head Node.\n\t */\n\tpublic Node getHeadNode();\n\n\t/**\n\t * Returns the node that the <i>tail</i> of the edge\n\t * is connected to.\n\t * @return The tail Node.\n\t */\n\tpublic Node getTailNode();\n\n\t/**\n\t * Allows an object to be associated with the <code>Edge</code>\n\t * @param o The object to be set as the userObject\n\t */\n\tpublic void setUserObject(Object o);\n\n\t/**\n\t * Gets the userObject, previously set with <code>setUserObject(Object o)</code>\n\t * @return The userObject, or <code>null</code> if no object has been set.\n\t */\n\tpublic Object getUserObject();\n\n\t/**\n\t * Causes any information in the path that represents the <code>Egde</code>\n\t * to be cleared, such as origin location and any control points.\n\t */\n\tpublic void resetPath();\n\n\t/**\n\t * Sets the location of the start of the path that represents\n\t * the <code>Edge</code>.\n\t * @param x The horizontal location.\n\t * @param y The vertical location.\n\t */\n\tpublic void setPathOrigin(int x, int y);\n\n\t/**\n\t * Extends the <code>Edge</code> using the following control points to\n\t * form a Bezier curve extension to the end point (x3, y3).\n\t * @param x1 Horizontal location of control point 1\n\t * @param y1 Vertical location of control point 1\n\t * @param x2 Horizontal location of control point 2\n\t * @param y2 Vertical location of control point 2\n\t * @param x3 Horizontal location of the end point.\n\t * @param y3 Vertical location of the end point.\n\t */\n\tpublic void pathTo(int x1, int y1, int x2, int y2, int x3, int y3);\n\n\t/**\n\t * Extends the <code>Edge</code> to the specified location using\n\t * a straight line.\n\t * @param x The horizontal location of the end point.\n\t * @param y The vertical location of the end point.\n\t */\n\tpublic void pathTo(int x, int y);\n\n\t/**\n\t * Sets the <code>Edge's</code> arrowhead.\n\t * @param baseX The x location of the centre of the arrowhead baseline.\n\t * @param baseY The y location of the centre of the arrowhead tip.\n\t * @param tipX The x location of the tip of the arrowhead.\n\t * @param tipY The y location of the tip of the arrowhead.\n\t */\n\tpublic void setArrowHead(int baseX, int baseY, int tipX, int tipY);\n\n\t/**\n\t * Sets the <code>Edge's</code> arrowtail\n\t * @param baseX The x location of the centre of the arrowhead baseline.\n\t * @param baseY The y location of the centre of the arrowhead tip.\n\t * @param tipX The x location of the tip of the arrowhead.\n\t * @param tipY The y location of the tip of the arrowhead.\n\t */\n\tpublic void setArrowTail(int baseX, int baseY, int tipX, int tipY);\n\n\t/**\n\t * Sets the <code>Edge</code>'s label position.\n\t * @param x The horizontal location (in pixels).\n\t * @param y The vertical location (in pixels).\n\t */\n\tpublic void setLabelPosition(int x, int y);\n\n\t/**\n\t * Retrieves the position of the <code>Edge's</code> label.\n\t * @return A <code>Point</code> containing the position of\n\t * the label.\n\t */\n\tpublic Point getLabelPosition();\n\n\t/**\n\t * Gets the <code>Shape</code> that represents the <code>Edge</code>.\n\t * @return The <code>Shape</code> of the <code>Edge</code>.\n\t */\n\tpublic Shape getShape();\n\n\t/**\n\t * Gets the direction of the <code>Edge</code>. This is one of the\n\t * predefined direction from the <code>GraphModel</code> interface.\n\t * @return The direction of the <code>Edge</code>.\n\t */\n\tpublic int getDirection();\n\n\n}", "public void join(Agent agent) throws RemoteException {\nSystem.out.println(\"Em join: agent = \" + agent.toXml());\n\t\tint row = agent.getRow();\n\t\tint col = agent.getColumn();\n\t\tPoint pos = new Point(row, col);\n\t\tagents.put(agent.getName(), pos);\n\t\tSet s = (Set) agentPositions.get(pos);\n\t\ts.add(agent);\n\t\tString fileName;\n\t\tif (agent instanceof Explorer) {\n\t\t\tfileName = EXPLORER_FILE;\n\t\t} else {\n\t\t\tfileName = WUMPUS_FILE;\n\t\t}\n\t\taddImage(row, col, agent.getName(), fileName);\n\t\tsetDirection(row, col, agent.getName(), agent.getDirection());\n\t\tif (agent instanceof Wumpus) {\n\t\t\tcheckStench(row + 1, col - 1, row - 1, col + 1);\n\t\t}\n\t}", "public void addEdge(Edge e){\n\t\tadjacentEdges.add(e);\n\t}", "void addEdge(JNode edge) {\n List<JNode> newEdges = this.getEdges();\n newEdges.add(edge);\n this.setEdges(newEdges);\n }", "public void Build() {\n OCCwrapJavaJNI.ShapeFix_EdgeConnect_Build(swigCPtr, this);\n }", "public void setDirectedEdge(Vertex start, Vertex end, int weight) \n\t{\n\t\ttry {\n\t\t\tint vI = vertices.indexOf(start);\n\t\t\tint uI = vertices.indexOf(end);\n\t\t\tedges[vI][uI] = weight;\n\t\t} \n\t\tcatch (Exception e) {\n\t\t\treturn;\n\t\t}\n\t\t\n\n\t}", "public void addEdge(Edge e){\n edgeList.add(e);\n }", "public void act() \n {\n move(-2);\n if(isAtEdge())\n {\n turn(180);\n getImage().mirrorVertically();\n }\n }", "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 }", "public void descend() {\n \t\n elevator1.set(-0.9);\n elevator2.set(-0.9); \n }", "public void addEdge(Edge e) {\n incident.add(e);\n }", "public void testContainsEdgeEdge( ) {\n init( );\n\n //TODO Implement containsEdge().\n }", "public void setEdgeDirectory(String edgeDirectory) {\n this.edgeDirectory = edgeDirectory;\n }", "void addEdge(Edge e) {\n edges.add(e);\n addVerticle(e.v1);\n addVerticle(e.v2);\n }", "public void addEdge(){\n Node[] newAdjacent = new Node[adjacent.length + 1];\n for (int i = 0; i < adjacent.length; i++) {\n newAdjacent[i] = adjacent[i];\n }\n adjacent = newAdjacent;\n }", "public void makeComplete() {\n\t\t// A complete graph has N(N-1)/2 edges. Create an ArrayList for those\n\t\t// for performance.\n\t\tint n = nodeArray.size();\n\t\tthis.edges = new ArrayList<Edge>(n * (n - 1) / 2);\n\n\t\t// Connect every node to the others\n\t\tfor (int i = 0; i < nodeArray.size(); i++) {\n\t\t\tfor (int k = i + 1; k < nodeArray.size(); k++) {\n\n\t\t\t\tEdge edge = new Edge(nodeArray.get(i), nodeArray.get(k));\n\t\t\t\tedges.add(edge);\n\t\t\t}\n\t\t}\n\t}", "public Edge() {}", "public void setEndVertex(int e) {\n\t\tendVertex = e;\n\t}", "private void astarSetup(AStarNode end){\n\tfor(AStarNode node : getNodes()){\n node.setVisited(false);\n node.setFound(false);\n node.updateDist(Float.POSITIVE_INFINITY);\n\t}\n }", "public void setEdges(List<E> edges) {\n\t\tthis.edges = edges;\n\t\tvirtualEdges = new ArrayList<E>();\n\t}", "public void setAgent(String agent) {\n this.agent = agent;\n }", "public void setAgent(String agent) {\n this.agent = agent;\n }", "void updateEdgeData(EdgeGraph edge) {\n\t\tedge = PedSimCity.edgesMap.get(edge.getID()); //in case it was a subgraph edge\n\t\tif (UserParameters.empiricalABM) edge.densities.replace(agp.groupName, edge.densities.get(agp.groupName)+1);\n\t\telse edge.densities.replace(ap.routeChoice, edge.densities.get(ap.routeChoice)+1);\n\t}", "private void pressedEdge(MouseEvent e) {\r\n if (e.getModifiers() >= MouseEvent.BUTTON1_MASK) {\r\n /* Click on a node */\r\n if (graphX.nodesContains(e.getPoint()) == true) {\r\n /* Set the first point in the tool */\r\n edgeTool.setFirstPoint(e.getPoint());\r\n }\r\n }\r\n }", "void sendMessage(Edge edgeToJ) throws FactorException {\n\t\t\tSystem.out.printf(\"sending message from %s to %s, upward? %s\\n\", this.toString(), edgeToJ.getOtherVertex(this), _bumpOnUpwardPass);\n\t\t\t// compose the message\n\t\t\tFactor message = new Factor(_initialBelief);\n\t\t\t// multiply initial belief with all incoming messages.\n\t\t\t// each incoming message is on a neighboring edge\n//\t\t\tSet<Edge> incomingEdges = getIncomingNeighborEdges(_bumpOnUpwardPass);\n//\t\t\tfor(Edge e : incomingEdges) {\n//\t\t\t\tmessage = message.product(e);\n//\t\t\t}\n\t\t\t// marginalize out all variables but what's in the sepset\n\t\t\tArrayList<Integer> elimVar = this.difference(edgeToJ._variables);\n\t\t\tmessage = message.maxMarginalize(elimVar);\n\t\t\tif(_bumpOnUpwardPass) {\n\t\t\t\tedgeToJ.setUpwardMessage(message);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tedgeToJ.setDownwardMessage(message);\n\t\t\t}\n\t\t\tedgeToJ.getOtherVertex(this).onReceiveMessage(edgeToJ);\n\t\t\tedgeToJ._timesMessagesSentAcrossMe++;\n\t\t}", "public void addEdge(E e){\n\t\tedges.add(e);\n\t}", "public de.hpi.msd.salsa.serde.avro.Edge.Builder setEdgeType(int value) {\n validate(fields()[2], value);\n this.edgeType = value;\n fieldSetFlags()[2] = true;\n return this;\n }", "private void addEdge() {\n childMatrix[randomParent][childMatrix[randomParent][0]] = randomChild;\n childMatrix[randomParent][0]++;\n parentMatrix[randomChild][parentMatrix[randomChild][0]] = randomParent;\n parentMatrix[randomChild][0]++;\n }", "public Edge(Node from, Node to) {\n fromNode = from;\n toNode = to;\n }", "protected void end() {\n \tif (waitForMovement) Robot.intake.setHopperTracker(deploy ? Status.deployed : Status.stowed);\n }", "public void setAuctioneer(AID agentAID) {\n this.AuctioneerAID = agentAID;\n }", "@Override\r\n public void actionEnd() {\n robot.leftDrive.setPower(0);\r\n robot.rightDrive.setPower(0);\r\n\r\n robot.leftDrive.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\r\n robot.rightDrive.setMode(DcMotor.RunMode.RUN_USING_ENCODER);\r\n }", "public void setOther( Node other ) {\n Change change;\n if ( other.isConnector() && getFlow().hasConnector() ) {\n Connector connector = (Connector) other;\n Flow need = isSend() ? connector.getInnerFlow() : getFlow();\n Flow capability = isSend() ? getFlow() : connector.getInnerFlow();\n change = doCommand( new SatisfyNeed( getUser().getUsername(), need,\n capability,\n SatisfyNeed.KEEP_CAPABILITY,\n SatisfyNeed.KEEP_NEED ) );\n } else {\n change = doCommand( new RedirectFlow( getUser().getUsername(), getFlow(), other, isSend() ) );\n }\n Flow newFlow = (Flow) change.getSubject( getQueryService() );\n if ( newFlow != null ) { // TODO Find out why this has happened...\n // requestLockOn( newFlow );\n setFlow( newFlow );\n }\n }", "public void setAgent(String agent) {\r\n\t\tthis.agent = agent;\r\n\t}", "public ActStep(CharacterEvent actor, EightDir dir) {\n\t\tthis(actor);\n\t\tthis.dir = dir;\n\t}", "public void setEdgeWeight(Edge p_edge, double p_weight) {\n\t\tint id = p_edge.hashCode();\n\t\tweights.put(id, p_weight);\n\t}" ]
[ "0.6291797", "0.5766119", "0.5751221", "0.57245517", "0.57113016", "0.5710157", "0.5689873", "0.56653833", "0.56620437", "0.5645107", "0.56423026", "0.5624952", "0.55713433", "0.5558551", "0.5557259", "0.5548124", "0.55245894", "0.5495834", "0.54957837", "0.5456445", "0.54268354", "0.54230034", "0.5407631", "0.5378519", "0.5367427", "0.5364167", "0.53351367", "0.5328537", "0.5328272", "0.53279775", "0.53238493", "0.53119266", "0.52995783", "0.5294509", "0.5252207", "0.5239554", "0.5233728", "0.5232615", "0.5229804", "0.52122796", "0.5185707", "0.5175972", "0.51612276", "0.51589376", "0.51589376", "0.51589376", "0.51586485", "0.51571167", "0.5156539", "0.51452416", "0.51435524", "0.5143282", "0.5142527", "0.51414096", "0.51411784", "0.5130118", "0.51266533", "0.5124562", "0.5119017", "0.51157486", "0.5100947", "0.50986516", "0.50867176", "0.50862855", "0.50838226", "0.5079599", "0.50752264", "0.50731355", "0.50702095", "0.5062948", "0.5052858", "0.50428635", "0.5037313", "0.50306576", "0.5027354", "0.50270605", "0.50173926", "0.5017109", "0.5011964", "0.49977997", "0.4995946", "0.49954408", "0.49945173", "0.49918056", "0.4988855", "0.4988855", "0.49863043", "0.49833226", "0.49829265", "0.49804926", "0.4980255", "0.49769968", "0.4973032", "0.49632093", "0.49626908", "0.49617288", "0.49535766", "0.49528292", "0.49446088", "0.49433443" ]
0.7328203
0
It moves the agent to the given coordinates.
public void updatePosition(Coordinate c) { pointMoveTo.setCoordinate(c); PedSimCity.agents.setGeometryLocation(agentLocation, pointMoveTo); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void move() {\n\t\tmoveX();\n\t\tmoveY();\n\t}", "public void move() {\n\t\tGrid<Actor> gr = getGrid();\n\t\tif (gr == null) {\n\t\t\treturn;\n\t\t}\n\t\tLocation loc = getLocation();\n\t\tLocation next = loc.getAdjacentLocation(getDirection());\n\t\t\n\t\tLocation next2 = next.getAdjacentLocation(getDirection());\n\t\tif (gr.isValid(next2)) {\n\t\t\tmoveTo(next2);\n\t\t} else {\n\t\t\tremoveSelfFromGrid();\n\t\t}\n\t}", "public void move() {\n this.pposX = this.posX;\n this.pposY = this.posY;\n this.posX = newPosX;\n this.posY = newPosY;\n }", "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 setMoveTo(Coordinate coordinate);", "public void move() {\n if(Objects.nonNull(this.position)) {\n Position position = this.getPosition();\n Function<Position, Position> move = moveRobotInDirectionMap.get(position.getDirection());\n this.position = move.apply(position);\n }\n }", "public void move(GeoCoordFine geoCoord) throws ARDInstanceException;", "protected void moveTo (int x, int y) {\r\n\t\tthis.x = x;\r\n\t\tthis.y = y;\r\n\t}", "public abstract void moveTo(double x, double y);", "public void moveTo(Actor actor, Location newLocation)\n\t {\n\t\t \t//creating the variables to make the code easier to read\n\t\t \tGrid<Actor> grid = actor.getGrid();\n\t\t \tLocation location = actor.getLocation();\n\t\t \n\t if (grid == null)\n\t throw new IllegalStateException(\"This actor is not in a grid.\");\n\t if (grid.get(location) != actor)\n\t throw new IllegalStateException(\n\t \"The grid contains a different actor at location \"\n\t + location + \".\");\n\t if (!grid.isValid(newLocation))\n\t throw new IllegalArgumentException(\"Location \" + newLocation\n\t + \" is not valid.\");\n\n\t if (newLocation.equals(location))\n\t return;\n\t \n\t //this line below was added\n\t actor.removeSelfFromGrid();\n\t //changed the code slightly to make sure now that not being called from within the actor that we refer to the\n\t //actor itself when removing and placing actor on grid\n\t //grid.remove(location);\n\t Actor other = grid.get(newLocation);\n\t if (other != null)\n\t other.removeSelfFromGrid();\n\t location = newLocation;\n\t actor.putSelfInGrid(grid, location);\n\t //grid.put(location, actor);\n\t }", "void moveTo(int dx, int dy);", "public final void move(Coordinates coordinates) throws Exception {\n if (!canMove(coordinates))\n throw new Exception(\"Entity cannot move there! \" + this + \", \"\n + coordinates);\n this.coordinates = coordinates;\n EventManager.onEntityMove(this);\n }", "void makeMove(Location loc);", "public void move(int x, int y) {\n\t\tthis.x = x;\r\n\t\tthis.y = y;\r\n\t}", "public void move() {\n\n\tGrid<Actor> gr = getGrid();\n\tif (gr == null) {\n\n\t return;\n\t}\n\n\tLocation loc = getLocation();\n\tif (gr.isValid(next)) {\n\n\t setDirection(loc.getDirectionToward(next));\n\t moveTo(next);\n\n\t int counter = dirCounter.get(getDirection());\n\t dirCounter.put(getDirection(), ++counter);\n\n\t if (!crossLocation.isEmpty()) {\n\t\t\n\t\t//reset the node of previously occupied location\n\t\tArrayList<Location> lastNode = crossLocation.pop();\n\t\tlastNode.add(next);\n\t\tcrossLocation.push(lastNode);\t\n\t\t\n\t\t//push the node of current location\n\t\tArrayList<Location> currentNode = new ArrayList<Location>();\n\t\tcurrentNode.add(getLocation());\n\t\tcurrentNode.add(loc);\n\n\t\tcrossLocation.push(currentNode);\t\n\t }\n\n\t} else {\n\t removeSelfFromGrid();\n\t}\n\n\tFlower flower = new Flower(getColor());\n\tflower.putSelfInGrid(gr, loc);\n\t\n\tlast = loc;\n\t\t\n }", "public void moveRobber(HexLocation loc) {\n\n\t}", "public void move(int x, int y)\r\n\t{\r\n\t\ttheX = x;\r\n\t\ttheY = y;\r\n\t}", "public void movePiece(Coordinate from, Coordinate to);", "public void moveTo(double x, double y) {\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t}", "public void move(){\n x+=xDirection;\n y+=yDirection;\n }", "@Override\r\n\tpublic void moveTo(float x, float y) {\n\t\t\r\n\t}", "protected abstract void moveTo(final float x, final float y);", "public void move(double x, double y, double z) {\n\t\tPublisher move_base = new Publisher(\"/ariac_human/goal_position\", \"geometry_msgs/Point\", bridge);\t\n\t\tmove_base.publish(new Point(x,y,z));\n\t}", "public void moveAllAgents() {\n\t\tPoint moveTo \t\t= null;\n\t\tGameClient client \t= null;\n\t\t\n\t\tfor(Player p : playerList) {\n\t\t\tif(p.getType() == PlayerType.Agent) {\n\t\t\t\tclient = HandleCommunication.findClient(p.getName(), server.getConnectedClientList());\n\t\t\t\tmoveTo = getSafeTeleportPosition();\n\t\t\t\tmovePlayer(p.getName(), p.getPosition(), moveTo, false);\n\t\t\t\tserver.sendMessageToClient(client.getClientSocket(), \"@124@\" + moveTo.x + \"@\" + moveTo.y + \"@\");\n\t\t\t}\n\t\t}\n\t}", "@Override\n public void move(double xa, double ya) {\n if (alive) {\n y += ya;\n x += xa;\n }\n }", "private void move() {\n\t\t\tx += Math.PI/12;\n\t\t\thead.locY = intensity * Math.cos(x) + centerY;\n\t\t\thead.yaw = spinYaw(head.yaw, 3f);\n\t\t\t\t\t\n\t\t\tPacketHandler.teleportFakeEntity(player, head.getId(), \n\t\t\t\tnew Location(player.getWorld(), head.locX, head.locY, head.locZ, head.yaw, 0));\n\t\t}", "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 }", "public void move(Location moveTo){\n if(canMove(moveTo)){\n removeFromGrid();\n setDirection(Location.NORTH);\n getLocation().setX(moveTo.getX());\n getLocation().setY(moveTo.getY());\n theWorld.add(this, getLocation().getX(), getLocation().getY());\n putInGrid(theWorld,getLocation().getX(),getLocation().getY());\n }\n }", "public void move() {\r\n posX += movementX;\r\n posY += movementY;\r\n anchorX += movementX;\r\n anchorY += movementY;\r\n }", "public void move(){\n\t\t\n\t}", "public void moveTo(int newX, int newY) {\n xPosition = newX-radius;\n yPosition = newY-radius;\n }", "@Override\n\tpublic void move(int xPos, int yPos) {\n\t}", "public void moveTo(Vector position) {\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 void move()\n {\n x = x + unitVector.getValue(1)*speed;\n y = y + unitVector.getValue(2)*speed;\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 move(int distance);", "public void move(String direction) {\n \n }", "void move(int dx, int dy) {\n position = position.addX(dx);\n position = position.addY(dy);\n }", "public abstract void move(Position position);", "public void move() {\n\r\n\t}", "public void move() {\n\t\t// Override move so we don't move, then get location set by owner.\n\t}", "public void moveTo(int x, int y) {\n\t\tx2 = x;\n\t\ty2 = y;\n\t}", "public void move(int x, int y) {\n \tint xOld = this.x;\n \tint yOld = this.y;\n \tthis.x = x;\n \tthis.y = y;\n \tSystem.out.print (\"point moved from (\" + xOld + \",\" + yOld + \") to (\" + this.x + \",\" + this.y + \")\");\n }", "public void move();", "public void move();", "public void moveActor();", "public void moveToDestination(Move move) {\r\n\t\tx = move.getToX();\r\n\t\ty = move.getToY();\r\n\r\n\t}", "@Override\n public void startExecuting()\n {\n this.entity.getNavigator().tryMoveToXYZ(this.xPosition, this.yPosition, this.zPosition, this.speed);\n }", "public void move() {\n spriteBase.move();\n\n Double newX = spriteBase.getXCoordinate() + spriteBase.getDxCoordinate();\n Double newY = spriteBase.getYCoordinate() + spriteBase.getDyCoordinate();\n\n if (!newX.equals(spriteBase.getXCoordinate())\n || !newY.equals(spriteBase.getYCoordinate())) {\n Logger.log(String.format(\"Monster moved from (%f, %f) to (%f, %f)\",\n spriteBase.getXCoordinate(), spriteBase.getYCoordinate(), newX, newY));\n }\n }", "void moveToPoint(float x, float y) {\n _x = x;\n _y = y;\n }", "public void moveToPosition( int xCoordinate, int yCoordinate ) {\n setXPosition( xCoordinate );\n setYPosition( yCoordinate );\n }", "public void move()\n {\n move(WALKING_SPEED);\n }", "public void move(Vector start,Vector dist);", "private void move(double newXPos){\n this.setX(newXPos);\n }", "public void move() {\n\t\tthis.position.stepForwad();\n\t\tthis.position.spin();\n\t}", "public abstract Point move(Point position);", "public void move(int x, int y){\n universe.erase(this);\n this.yPosition = y;\n this.xPosition = x;\n universe.draw(this);\n }", "public void moveTo(float x, float y) {\n \tposition.set(x,y);\n \tif (mouseJoint != null) {\n \t\tmouseJoint.setTarget(position);\n \t}\n }", "public void move(int dx, int dy) {\n this.x = this.x + dx;\n this.y = this.y + dy;\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 setCoords(int coords)\n\t{\n\t\tmoveCoords = coords;\n\t}", "public void move()\n\t{\n\t\tVector v = ship.v;\n\t\tb = b.getLocation().add(v).getBlock();\n\t\tif(triangle != null) triangle.move();\n\t\tif(rear != null) rear.move();\n\t\tif(foreAndAft != null) foreAndAft.move();\n\t\tif(sails != null) for(int i = 0; i < sails.size(); i++)\n\t\t{\n\t\t\tSail sail = sails.get(i);\n\t\t\tsail.move();\n\t\t}\n\t}", "public void move()\n\t{\n\t\tx = x + dx;\n\t}", "protected void move()\n {\n // Find a location to move to.\n Debug.print(\"Fish \" + toString() + \" attempting to move. \");\n Location nextLoc = nextLocation();\n\n // If the next location is different, move there.\n if ( ! nextLoc.equals(location()) )\n {\n // Move to new location.\n Location oldLoc = location();\n changeLocation(nextLoc);\n\n // Update direction in case fish had to turn to move.\n Direction newDir = environment().getDirection(oldLoc, nextLoc);\n changeDirection(newDir);\n Debug.println(\" Moves to \" + location() + direction());\n }\n else\n Debug.println(\" Does not move.\");\n }", "void move() {\n\t\tif (reachedEdge()) {\n\t\t\tvelocityX = velocityX * -1;\n\t\t\ty = y + 50;\n\t\t}\n\t\tif (reachedLeft()) {\n\t\t\tvelocityX = velocityX * -1;\n\t\t\ty = y + 50;\n\t\t}\n\n\t\tx = x + velocityX;\n\t}", "public void move(int dx, int dy) {\n this.xPosition += dx;\n this.yPosition += dy;\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 }", "void moveElement(int elementId, double xCoordinate, double yCoordinate);", "@Override\n\tvoid move(int x, int y) {\n\n\t}", "public void move(float x, float y) {\n\t\tthis.position.set(this.position.x + x, this.position.y + y, 0);\n\t}", "public void move(String direction);", "public void move(int x_pos1, int y_pos1)throws Exception{\n //check if its a legal move.\n if(isLegal(x_pos1, y_pos1)) {\n x_pos = x_pos1;\n y_pos = y_pos1;\n }\n else throw new Exception(\"Illegal move.\");\n }", "public void moveTo (Coordinate c) throws Exception\n\t{\n\t\tcurrentLocation = c;\n\t\tgrid[c.x][c.y] = GridChar.VISITED;\n\t}", "void move(double dx, double dy);", "public void move()\r\n\t{\r\n\t\tmoveHor(xVel);\r\n\t\tmoveVert(yVel);\r\n\t}", "public void move() {\n\n }", "public void move(Point p);", "protected void moveTo(int x, int y) {\n\n if (x < 0 || x > 2)\n throw new IllegalArgumentException(\"x is out of bound\");\n\n if (y < 0 || y > 3)\n throw new IllegalArgumentException(\"y is out of bound\");\n\n this.xPosition = x;\n this.yPosition = y;\n }", "void move();", "public void act() \n {\n move(-16);\n \n \n if (isAtEdge())\n {\n setLocation(700,getY());\n }\n \n if (isTouching(Shots.class))\n {\n getWorld().addObject(new SpaceObject(), 500,Greenfoot.getRandomNumber(400));\n }\n \n }", "private void placeRobot(List<String> args) {\n int x;\n int y;\n Position.Direction direction;\n\n try {\n x = Integer.parseInt(args.get(0));\n y = Integer.parseInt(args.get(1));\n direction = Position.Direction.valueOf(args.get(2));\n } catch (NumberFormatException e) {\n System.out.println(\"x and y accept only numbers\");\n return;\n } catch (IllegalArgumentException e) {\n System.out.println(args.get(2) + \" looks an unsupported direction\");\n return;\n }\n\n if(x >= lowerBound.getX() && y >= lowerBound.getY() &&\n x <= upperBound.getX() && y <= upperBound.getY() ) {\n currentPosition.setX(x);\n currentPosition.setY(y);\n currentPosition.setDirection(direction);\n } else {\n System.out.println(\"Cannot position the robot outside the table\");\n }\n }", "public void move() {\n super.move(DIRECTION.getRandom());\n }", "public void moveAgentTo(Agent ag, int door) throws InterruptedException {\n ProcessData data = (ProcessData) agents.get(ag);\n Vertex vertexFrom, vertexTo;\n Message msg;\n MessagePacket msgPacket;\n \n \n if( door < 0 || door >= getArity(ag))\n throw new IllegalArgumentException(\"This door doesn't exist !\");\n\n vertexFrom = data.vertex;\n vertexTo = vertexFrom.neighbour(door);\n\n msg = new StringMessage(ag.toString());\n msgPacket = new MessagePacket(vertexFrom.identity(), door, \n vertexTo.identity(), msg);\n\t\n\tpushMessageSendingEvent(msgPacket,ag);\n\t\n\n\tdata.vertex = vertexTo;\n\tdata.lastVertexSeen = vertexFrom;\n\n stats.add(new MoveStat(ag.getClass()));\n }", "@Override\r\n public void act() \r\n {\n int posx = this.getX();\r\n int posy = this.getY();\r\n //calculamos las nuevas coordenadas\r\n int nuevox = posx + incx;\r\n int nuevoy = posy + incy;\r\n \r\n //accedemos al mundo para conocer su tamaño\r\n World mundo = this.getWorld();\r\n if(nuevox > mundo.getWidth())//rebota lado derecho\r\n {\r\n incx = -incx;\r\n }\r\n if(nuevoy > mundo.getHeight())//rebota en la parte de abajo\r\n {\r\n incy = -incy;\r\n }\r\n \r\n if(nuevoy < 0)//rebota arriba\r\n {\r\n incy = -incy;\r\n }\r\n if(nuevox < 0)//rebota izquierda\r\n {\r\n incx = -incx;\r\n }\r\n //cambiamos de posicion a la pelota\r\n this.setLocation(nuevox,nuevoy);\r\n }", "public void move(){\n \n currentFloor = currentFloor + ( 1 * this.direction);\n //if we're at the bottom or top after move, flip the bit\n if(Elevator.MIN_FLOOR == currentFloor \n || currentFloor == Elevator.MAX_FLOOR)\n this.direction *= -1;\n \n if(destinedPassengers[ currentFloor ] > 0)\n elevatorStop( currentFloor, true );\n \n if(building.floor(currentFloor).passengersWaiting() > 0)\n elevatorStop(currentFloor, false);\n \n }", "@Override\n public void move() {\n _location.x++;\n }", "void move(int dx, int dy);", "@Test\n\tpublic final void testMoveTo() {\n\t\tRoom testRoom = new Room(\"247\", 2, \"Computer Lab\");\n\t\t\n\t\tanimal.moveTo(testForest);\n\t\tassertEquals(\"Move To Forest\", animal.location(), testForest);\n\t\t\n\t\tanimal.moveTo(testRoom);\n\t\tassertEquals(\"Move To Room\", animal.location(), testForest);\t\n\t\t\n\t}", "public void moveBy(int dx, int dy){\n x += dx;\n y += dy;\n }", "public void setLocation(float x, float y);", "void setPosition(double xPos, double yPos);", "public final void move(Direction direction) throws Exception {\n move(getCoordinatesRelative(direction));\n }", "void setLocation(int x, int y);", "public void movePositionBy(int x, int y) {\n\t\tthis.setX(getX() + x);\r\n\t\tthis.setY(getY() + y);\r\n\t}", "private static Activity moveInDirection(int x, int y) {\n return Activity.newBuilder()\n .addSubActivity(() -> {\n Position pos = Players.getLocal().getPosition();\n while(pos.isPositionWalkable()) {\n pos = pos.translate(x, y);\n }\n pos = pos.translate(-x, -y);\n while(!Movement.setWalkFlagWithConfirm(pos)) {\n pos = pos.translate(-x, -y);\n }\n Time.sleepUntil(() -> !Movement.isDestinationSet(), 1000 * 10);\n })\n .build();\n }", "public void move() {\n\t\tthis.move(velocity.x, velocity.y);\n\t}", "public void move() {\n\t\tthis.hero.setPF(1);\n\t\tthis.hero.setState(this.hero.getMoved());\n\t}", "public void updatePositionOnMap(RVOAgent agent, double x, double y) {\n agentSpace.setObjectLocation(agent, new Double2D(x, y));\n if(agent.hasDevice()){\n deviceSpace.setObjectLocation(agent.getDevice(), new Double2D(x, y));\n }\n }", "@Override\n\tpublic void moveTo(int x, int y) {\n\t\tstartPoint.moveTo(x,y);\n\t\tendPoint.moveTo(x,y);\n\t}" ]
[ "0.71339065", "0.6963379", "0.68941045", "0.68855697", "0.6862072", "0.6859203", "0.6858495", "0.68132794", "0.68072164", "0.6796319", "0.6795778", "0.6792442", "0.67909664", "0.67763126", "0.67666596", "0.67306554", "0.67171633", "0.6704896", "0.66894996", "0.66856563", "0.6680504", "0.6679092", "0.6670638", "0.66620076", "0.6622133", "0.6613626", "0.6607456", "0.6603759", "0.6580086", "0.65767264", "0.65711653", "0.65620965", "0.6549232", "0.6546814", "0.65467256", "0.65401894", "0.6526438", "0.6506163", "0.6505691", "0.6503774", "0.64982724", "0.64910495", "0.6484131", "0.6482242", "0.6480332", "0.6480332", "0.6475317", "0.64400613", "0.6435286", "0.64351135", "0.64330375", "0.6432741", "0.6421501", "0.64175034", "0.6401062", "0.6396109", "0.6375528", "0.63696605", "0.6366208", "0.6363498", "0.63631934", "0.6355483", "0.6355337", "0.63430196", "0.6340903", "0.6334259", "0.63330746", "0.6330477", "0.63163877", "0.6313326", "0.630994", "0.6307838", "0.6304706", "0.6303982", "0.62878585", "0.62852764", "0.62851727", "0.6284977", "0.62792945", "0.62693995", "0.626011", "0.6252439", "0.6251618", "0.62502754", "0.6247842", "0.62428933", "0.6234817", "0.6229133", "0.62277687", "0.6220434", "0.621767", "0.6217605", "0.62158936", "0.62150156", "0.6212359", "0.6209295", "0.62060523", "0.6205204", "0.62048405", "0.61996114" ]
0.6268962
80
It updates the volumes on a given edge, on the basis of the agent's route choice model.
void updateEdgeData(EdgeGraph edge) { edge = PedSimCity.edgesMap.get(edge.getID()); //in case it was a subgraph edge if (UserParameters.empiricalABM) edge.densities.replace(agp.groupName, edge.densities.get(agp.groupName)+1); else edge.densities.replace(ap.routeChoice, edge.densities.get(ap.routeChoice)+1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void updateCrowdness(EdgeGraph newEdge) {\n\t\tif (currentEdge != null) {\n\t\t\tArrayList<Pedestrian> currentVolume = PedSimCity.edgesVolume.get(currentEdge);\n\t\t\tcurrentVolume.remove(this);\n\t\t}\n\n\t\t// update new edge traffic\n\t\tif (PedSimCity.edgesVolume.get(newEdge) == null) PedSimCity.edgesVolume.put(newEdge, new ArrayList<Pedestrian>());\n\t\tPedSimCity.edgesVolume.get(newEdge).add(this);\n\t}", "public void updateGraphEdges(ArrayList<Edge> edges) {\n graph.updateEdges(edges);\n }", "public void setEdges(List<E> edges) {\n\t\tthis.edges = edges;\n\t\tvirtualEdges = new ArrayList<E>();\n\t}", "public void setEdgeWeight(double edgeWeight) {\n this.edgeWeight = edgeWeight;\n }", "public void editEdge(){\n\t}", "void setupEdge(EdgeGraph edge) {\n\n\t\tif (UserParameters.socialInteraction) updateCrowdness(edge);\n\t\tcurrentEdge = edge;\n\t\t//transform GeomPlanarGraphEdge in Linestring\n\t\tLineString line = edge.getLine();\n\t\t//index the Linestring\n\t\tsegment = new LengthIndexedLine(line);\n\t\tstartIndex = segment.getStartIndex();\n\t\tendIndex = segment.getEndIndex();\n\t\tlinkDirection = 1;\n\n\t\t// check to ensure that Agent is moving in the right direction (direction)\n\t\tdouble distanceToStart = line.getStartPoint().distance(agentLocation.geometry);\n\t\tdouble distanceToEnd = line.getEndPoint().distance(agentLocation.geometry);\n\n\t\tif (distanceToStart <= distanceToEnd) {\n\t\t\t// closer to start\n\t\t\tcurrentIndex = startIndex;\n\t\t\tlinkDirection = 1;\n\t\t}\n\t\telse if (distanceToEnd < distanceToStart) {\n\t\t\t// closer to end\n\t\t\tcurrentIndex = endIndex;\n\t\t\tlinkDirection = -1;\n\t\t}\n\n\t}", "public void increaseVolume() {\n String json = new Gson().toJson(new TelevisionModel(TelevisionModel.Action.INCREASE_VOLUME));\n String a = sendMessage(json);\n TelevisionModel teleM = new Gson().fromJson(a, TelevisionModel.class);\n System.out.println(\"Client Received \" + json);\n\n if (teleM.getAction() == TelevisionModel.Action.INCREASE_VOLUME) {\n isIncreasingVolume = teleM.getValue();\n ui.updateArea(teleM.getMessage());\n };\n }", "private void applyFlow(List<Edge> edges, int capacity) {\n\t\t\n\t\tfor (Edge edge : edges) {\t\n\t\t\tint startVertexIndex = edge.getStartVertex().getIndex();\n\t\t\tint endVertexIndex = edge.getEndVertex().getIndex();\n\t\t\t//ustawienie przeplywu we wlasciwym grafie\n\t\t\tEdge graphEdge = graph.findEdge(startVertexIndex, endVertexIndex, EdgeType.DIRECTED);\n\t\t\tint graphEdgeFlow = graphEdge.getFlow();\n\t\t\tint resultFlow = graphEdgeFlow+capacity;\n\t\t\tgraphEdge.setFlow(resultFlow);\n\t\t\t\n\t\t\tEdge residualEdge = residualNetwork.findEdge(startVertexIndex, endVertexIndex, EdgeType.DIRECTED);\n\t\t\tif(residualEdge!=null) {\n\t\t\t\tint residualEdgeCapacity = residualEdge.getCapacity();\n\t\t\t\tresidualEdge.setCapacity(residualEdgeCapacity-capacity); //odjecie\n\t\t\t\tif (residualEdge.getCapacity() == 0){\n\t\t\t\t\tresidualNetwork.removeEdge(residualEdge);\n\t\t\t\t}\n\t\t\t}\n\t\t\tresidualEdge = residualNetwork.findEdge(endVertexIndex, startVertexIndex, EdgeType.DIRECTED);\n\t\t\tif(residualEdge!=null){\n\t\t\t\tint residualEdgeCapacity = residualEdge.getCapacity();\n\t\t\t\tresidualEdge.setCapacity(residualEdgeCapacity+capacity); //dodanie \n\t\t\t} else {\n\t\t\t\tEdge tmpEdge= new SwingEdge(); //kanal przeciwyny\n\t\t\t\ttmpEdge.getDataModel().setStartingVertex(edge.getEndVertex());\n\t\t\t\ttmpEdge.getDataModel().setEndingVertex(edge.getStartVertex());\n\t\t\t\ttmpEdge.setCapacity(capacity);\n\t\t\t\tresidualNetwork.addEdge(tmpEdge);\n\t\t\t}\n\t\t\t\n\t\t}\n\t}", "void setBestIncoming(E edge);", "public void setEdge(IEdge<?> edge) {\n\t\tthis.edge = edge;\n\t}", "protected void update_flow(Long eID, String direction, int restCap) {\n\t\tint currentFlow = f(eID);\n\t\tif (direction == \"+\") {\n\t\t\tf_set(eID, currentFlow + restCap);\n\t\t} else if (direction == \"-\") {\n\t\t\tf_set(eID, currentFlow - restCap);\n\t\t} else {\n\t\t\tSystem.err.println(\"ALERT! NULL_DIRECTION in AugPath\");\n\t\t}\n\t}", "public void addEdge(Edge edgeToAdd){\n for(int i = 0; i<edges.size(); i++){\n Edge edge = edges.get(i);\n if(edge.end() == edgeToAdd.end()){\n edge.setWeight(edgeToAdd.weight()); // Change weight and return if edge is present\n return;\n }\n }\n this.edges.add(edgeToAdd); // Add edge normally\n }", "public abstract boolean putEdge(Edge incomingEdge);", "public void setEdgeWeight(Edge p_edge, double p_weight) {\n\t\tint id = p_edge.hashCode();\n\t\tweights.put(id, p_weight);\n\t}", "private void initializeVolumeFields() {\n s_logger.info(\"Updating detached full copy volumes.\");\n DbClient dbClient = this.getDbClient();\n List<URI> volumeURIs = dbClient.queryByType(Volume.class, true);\n\n Iterator<Volume> volumes =\n dbClient.queryIterativeObjects(Volume.class, volumeURIs);\n while (volumes.hasNext()) {\n Volume volume = volumes.next();\n boolean volumeUpdated = false;\n\n s_logger.info(\"Examining Volume (id={}) for upgrade\", volume.getId().toString());\n String replicaState = volume.getReplicaState();\n // Check if the replicate state is detached.\n if ((NullColumnValueGetter.isNotNullValue(replicaState)) &&\n (ReplicationState.DETACHED.name().equals(replicaState))) {\n URI sourceURI = volume.getAssociatedSourceVolume();\n if (!NullColumnValueGetter.isNullURI(sourceURI)) {\n // We make sure the associated source volume is null.\n // This change was made in ViPR 2.3 for Jira 12659, but\n // the 2.3 upgrade callback never marked the associated\n // source volume null for existing, detached full copies\n // in the database, which all full copies were prior to 2.3.\n // See class FullCopyVolumeReplicaStateMigration.\n s_logger.info(\"Setting associated source volume to null\");\n volume.setAssociatedSourceVolume(NullColumnValueGetter.getNullURI());\n volumeUpdated = true;\n }\n }\n\n // For any volume that has full copies, make sure none of those full copies\n // are in a detached state.\n HashSet<String> fullCopiesToRemove = new HashSet<String>();\n StringSet fullCopies = volume.getFullCopies();\n if (fullCopies != null) {\n for (String fullCopyId : fullCopies) {\n Volume fullCopy = dbClient.queryObject(Volume.class, URI.create(fullCopyId));\n if (fullCopy != null) {\n replicaState = fullCopy.getReplicaState();\n // Check if the replicate state is detached.\n if ((NullColumnValueGetter.isNotNullValue(replicaState)) &&\n (ReplicationState.DETACHED.name().equals(replicaState))) {\n fullCopiesToRemove.add(fullCopyId);\n }\n } else {\n fullCopiesToRemove.add(fullCopyId);\n }\n }\n\n // Existing, detached full copies in the database should be\n // removed from the full copies list of their source volume.\n // This is the change for Jira 12766 (COP-13552) which is\n // made in the Darth (2.4) ViPR release.\n s_logger.info(\"Removing {} from full copies list of source volume {}:{}\", fullCopiesToRemove, volume.getId());\n fullCopies.removeAll(fullCopiesToRemove);\n volumeUpdated = true;\n }\n\n // Persist the changes if necessary.\n if (volumeUpdated) {\n dbClient.persistObject(volume);\n }\n }\n }", "public void setEdgeCapacity(double capacity) {\n\t\tthis.capacity = capacity;\r\n\r\n\t}", "protected void processEdge(Edge e) {\n\t}", "public void addVirtualEdge(E e){\n\t\tedges.add(e);\n\t\tvirtualEdges.add(e);\n\t}", "public void setEdges( List<EdgeType> edges )\n {\n this.edges = edges;\n }", "public BindState updateBinding(AccessPath ap, CFAEdge edge, List<AbstractState> otherStates) {\n if (ap.startFromGlobal()) {\n return addGlobalBinding(ap, edge, otherStates);\n } else {\n return addLocalBinding(ap, edge, otherStates);\n }\n }", "public void addEdge(Edge edge){\n \n synchronized(vertexes){\n Long start = edge.getStart();\n Vertex sVertex = vertexes.get(start);\n if(sVertex != null){\n sVertex.addEdge(edge, true);\n }\n// if undirected graph then adds edge to the finish vertex too \n if(!edge.isDirected()){\n Long finish = edge.getFinish();\n Vertex fVertex = vertexes.get(finish);\n if(fVertex != null){\n fVertex.addEdge(edge, false);\n }\n }\n }\n \n }", "public void treeEdge(Edge e) {}", "void addEdge(Edge e) {\n edges.add(e);\n addVerticle(e.v1);\n addVerticle(e.v2);\n }", "public void setEdgeLen(double len) {\n fEdgeLen = len;\n }", "void addEdge(JNode edge) {\n List<JNode> newEdges = this.getEdges();\n newEdges.add(edge);\n this.setEdges(newEdges);\n }", "public void calculateEdgeWeights() {\n\n\t// Use a ListIterator so that we can modify the list\n\t// as we go\n\tListIterator<LayoutEdge>iter = edgeList.listIterator();\n\twhile (iter.hasNext()) {\n\t LayoutEdge edge = iter.next();\n\n\t // If we're only dealing with selected nodes, drop any edges\n\t // that don't have any selected nodes\n\t if (edge.getSource().isLocked() && edge.getTarget().isLocked()) {\n\t\titer.remove();\n\t } else if (edgeWeighter != null && edgeWeighter.normalizeWeight(edge) == false)\n\t\titer.remove();\n\n\t //logger.debug(\"Edge \"+edge.getEdge().getIdentifier()+\" now has weight \"+edge.getWeight());\n\t // logger.info( edge.toString() + \" now has weight \"+edge.getWeight());\n\t}\n }", "public void decreaseVolume() {\n String json = new Gson().toJson(new TelevisionModel(TelevisionModel.Action.DECREASE_VOLUME));\n String a = sendMessage(json);\n TelevisionModel teleM = new Gson().fromJson(a, TelevisionModel.class);\n System.out.println(\"Client Received \" + json);\n\n if (teleM.getAction() == TelevisionModel.Action.DECREASE_VOLUME) {\n isDecreasingVolume = teleM.getValue();\n ui.updateArea(teleM.getMessage());\n };\n }", "public void updateWeightEdge(String srcLabel, String tarLabel, int weight) {\n // Implement me!\n\n String e = srcLabel + tarLabel;\n if (indexOf(e, edges) < 0) {\n return;\n }\n\n\n int srcInt = indexOf(srcLabel, vertices);\n int tarInt = indexOf(tarLabel, vertices);\n weights[srcInt][edges.get(e)] = weight;\n weights[tarInt][edges.get(e)] = weight * (-1);\n\n if (weight == 0) {\n edges.remove(e);\n return;\n }\n\n\n\n }", "public void addSize(double edgeSize)\r\n\t{\r\n\t\tsize= size + edgeSize;\r\n\t}", "@Override\r\n\tpublic void changeVolume(int volume) {\n\t\tSystem.out.println(\"볼륨을 조절하다\");\r\n\t}", "public void setEdgeFlow(double flow) throws Exception {\r\n\t\tif (this.capacity < flow || flow < 0)\r\n\t\t\tthrow new IndexOutOfBoundsException();\r\n\t\tthis.flow = flow;\r\n\t}", "public void addEdge(Edge edge) {\n\t\tthis.edges.add(edge);\n\t\tnrOfEdges++;\n\t}", "public void setEdges(ArrayList<? extends Edge> edges)\n\tthrows InconsistencyException\n\t{\n\t\tthis.edges = edges;\n\t\t\n\t\tif(edges != null)\n\t\t{\n\t\t\t// make sure that all edges link back to this simplicial complex\n\t\t\tfor(Edge edge : edges) edge.setSimplicialComplex(this);\n\n\t\t\tcheckEdges();\n\t\t}\n\t}", "@Override\n public void placeRoad(EdgeLocation edge) throws ModelException {\n assert edge != null;\n\n if (!GameModelFacade.instance().canPlaceRoad(edge)) {\n throw new ModelException(\"Preconditions for action not met.\");\n }\n\n try {\n String clientModel = m_theProxy.buildRoad(GameModelFacade.instance().getLocalPlayer().getIndex(), edge, GameModelFacade.instance().isFreeRound());\n new ModelInitializer().initializeClientModel(clientModel, m_theProxy.getPlayerId());\n } catch (NetworkException e) {\n throw new ModelException(e);\n }\n }", "protected void addEdge(CyEdge edge) {\n\tLayoutEdge newEdge = new LayoutEdge(edge);\n\tupdateWeights(newEdge);\n\tedgeList.add(newEdge);\n }", "static public void edge(Edge edge,float dx,float dy){\n edge.aX+=dx;\n edge.aY+=dy;\n edge.bX+=dx;\n edge.bY+=dy;\n edge.ghostAY+=dx;\n edge.ghostAY+=dy;\n edge.ghostBX+=dx;\n edge.ghostBY+=dy;\n }", "public void updateVolume() {\n\t\tMixer.Info[] mixerInfos = AudioSystem.getMixerInfo();\n\n\t\tfor (Mixer.Info mixerInfo : mixerInfos) {\n\t\t\tMixer mixer = AudioSystem.getMixer(mixerInfo);\n\t\t\tLine.Info[] lineInfos = mixer.getTargetLineInfo();\n\n\t\t\tfor (Line.Info lineInfo : lineInfos) {\n\t\t\t\ttry {\n\t\t\t\t\tLine line = mixer.getLine(lineInfo);\n\t\t\t\t\tline.open();\n\t\t\t\t\tif (line.isControlSupported(FloatControl.Type.VOLUME)) {\n\t\t\t\t\t\tFloatControl volumeControl = (FloatControl) line.getControl(FloatControl.Type.VOLUME);\n\t\t\t\t\t\tvolumeControl.setValue((float) volume);\n\t\t\t\t\t}\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "protected void addEdge(CyEdge edge, LayoutNode v1, LayoutNode v2) {\n\tLayoutEdge newEdge = new LayoutEdge(edge, v1, v2);\n\tupdateWeights(newEdge);\n\tedgeList.add(newEdge);\n }", "public void increaseVolume() {\r\n\t\tvolume++;\r\n\t}", "public void addEdge(DirectedEdge edge){\r\n\t\tmEdgeList.offer(edge);\r\n\t\t\r\n\t\tint src=edge.from();\r\n\t\tint dest = edge.to();\r\n\t\t\r\n\t\tmVisitStatus.put(src,false);\r\n\t\tmVisitStatus.put(dest,false);\r\n\t\t\r\n\t\tmVertexList.add(src);\r\n\t\tmVertexList.add(dest);\r\n\t\t\r\n\t\t/* Forward Edge */\r\n\t\tList<DirectedEdge> edgeList = adjList.get(src);\r\n\t\tif(edgeList==null)\r\n\t\t\tedgeList = new ArrayList<DirectedEdge>();\r\n\t\t\r\n\t\tedgeList.add(edge);\r\n\t\tadjList.put(src, edgeList);\r\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}", "@Override\n \tpublic void onUpdateVolume(double arg0) {\n \t}", "void setRemainingVolume(int newRemainingVolume) throws Exception;", "@Override\n\tpublic void calcularVolume() {\n\t\t\n\t}", "public void addEdge(StubEdge e) {\n }", "private void discount(Edge edge) {\n\t\tedge.setElement(edge.getElement()*Constants.DISCOUNT);\n\t}", "public void addEdge(Edge e) {\n int v = e.either();\n int w = e.other(v);\n adj[v].add(e);\n adj[w].add(e);\n E++;\n }", "void addEdge(Edge e) {\n\t\t\tif(!_edges.containsKey(e.makeKey())) {\n\t\t\t\t_edges.put(e.makeKey(),e);\n\t\t\t\te._one.addNeighborEdge(e);\n\t\t\t\te._two.addNeighborEdge(e);\n\t\t\t}\n\t\t}", "void changeVolume(int newVolume) {\n if (newVolume < 0) {\n throw new IllegalArgumentException(\"Invalid volume\");\n }\n this.volume = newVolume;\n }", "public void updateAllVolumes() {\n for (final DrbdVolumeInfo dvi : drbdVolumes) {\n for (final BlockDevInfo bdi : dvi.getBlockDevInfos()) {\n if (bdi != null) {\n bdi.checkResourceFieldsChanged(null,\n bdi.getParametersFromXML());\n bdi.updateAdvancedPanels();\n }\n }\n }\n }", "void addEdge(Edge e) {\n if (e.getTail().equals(this)) {\n outEdges.put(e.getHead(), e);\n\n return;\n } else if (e.getHead().equals(this)) {\n indegree++;\n inEdges.put(e.getTail(), e);\n\n return;\n }\n\n throw new RuntimeException(\"Cannot add edge that is unrelated to current node.\");\n }", "UpdateNetworkResponse updateVirtualisedNetworkResource(\n UpdateNetworkRequest updateNetworkRequest, PoP poP);", "public void gain(Object kState, PTAEdge edge) {\n\t\tfor (IInductionListener l: listeners) {\n\t\t\tl.gain(kState, edge);\n\t\t}\n\t}", "public void addEdge(Edge e){\n\t\tedges.put(e.hashCode(), e);\n\t\te.getHead().addConnection(e);\n\t\te.getTail().addConnection(e);\n\t}", "public void requestUpdateVolume(int delta) {\n }", "public void setEdgeDirectory(String edgeDirectory) {\n this.edgeDirectory = edgeDirectory;\n }", "public void update(HashMap um) {\n if (TRACE_INTRA) out.println(\"Updating edges for node \"+this.toString_long());\n Map m = this.predecessors;\n if (m != null) {\n this.predecessors = new LinkedHashMap();\n updateMap(um, m.entrySet().iterator(), this.predecessors);\n }\n m = this.addedEdges;\n if (m != null) {\n this.addedEdges = new LinkedHashMap();\n updateMap(um, m.entrySet().iterator(), this.addedEdges);\n }\n m = this.accessPathEdges;\n if (m != null) {\n this.accessPathEdges = new LinkedHashMap();\n updateMap(um, m.entrySet().iterator(), this.accessPathEdges);\n }\n if (this.passedParameters != null) {\n Set pp = SortedArraySet.FACTORY.makeSet(HashCodeComparator.INSTANCE);\n pp.addAll(this.passedParameters);\n this.passedParameters = pp;\n }\n addGlobalEdges(this);\n }", "private void processOverlay(){\n \n // go for as long as edges still exist.\n while(this.availableVertices.size() > 0)\n {\n \n // pick the least weight vertex.\n Vertex next = this.availableVertices.poll(); // finding the least weight vertex.\n int distanceToNext = this.distances.get(convertToString(next.getVertexPortNum())); // must use the string version of the portnum.\n \n // and for each available squad member of the chosen vertex\n List<Edge> nextSquad = next.getSquad(); \n for(Edge e: nextSquad)\n {\n Vertex other = e.getNeighbor(next);\n if(this.visitedVertices.contains(other))\n {\n continue; // continue the while loop in this case.\n }\n \n // check for a shorter path, update if a new path is found within the overlay.\n int currentWeight = this.distances.get(convertToString(other.getVertexPortNum())); // using string version of the port number.\n int newWeight = distanceToNext + e.getWeight();\n \n if(newWeight < currentWeight){\n this.predecessors.put(convertToString(other.getVertexPortNum()), convertToString(next.getVertexPortNum())); // use the string versions of the port numbers.\n this.distances.put(convertToString(other.getVertexPortNum()), newWeight); // use the string version of the port numbers.\n // updating here.\n this.availableVertices.remove(other);\n this.availableVertices.add(other);\n }\n \n }\n \n this.visitedVertices.add(next); // add this vertex as \"visited\" so we do not visit it again.\n }\n }", "org.landxml.schema.landXML11.TrafficVolumeDocument.TrafficVolume addNewTrafficVolume();", "public void setEdgeCollection(String edgeCollection) {\n this.edgeCollection = edgeCollection;\n }", "public void changeDoorState(Agent ag, int door, EdgeState state) \n throws InterruptedException {\n\n Vertex vertexFrom, vertexTo;\n Long key = new Long(numGen.alloc());\n EdgeStateChangeEvent event;\n\n vertexFrom = getVertexFor(ag);\n vertexTo = vertexFrom.neighbour(door);\n\n event = new EdgeStateChangeEvent(key, \n vertexFrom.identity(),\n vertexTo.identity(),\n state);\n evtQ.put(event);\n movingMonitor.waitForAnswer(key);\n stats.add(new EdgeStateStat(ag.getClass()));\n }", "private int populateEdges(List<Graph.Edge> edges) {\n expand(source, null);\n graph.enableGraphVertices();\n int weight = 0;\n for (Graph.Vertex v : graph) {\n\n Graph.Edge edge = ((XGraph.XVertex) v).stEdge;\n if (edge != null) {\n weight += edge.getWeight();\n }\n edges.add(edge);\n }\n return weight;\n }", "public void setEdgeType(java.lang.Integer value) {\n this.edgeType = value;\n }", "void add(Edge edge);", "public void update(HashMap um) {\n if (false) {\n if (TRACE_INTRA) out.println(\"Updating edges for node \"+this.toString_long());\n Map m = this.predecessors;\n if (m != null) {\n this.predecessors = new LinkedHashMap();\n updateMap_unknown(um, m.entrySet().iterator(), this.predecessors);\n }\n m = this.addedEdges;\n if (m != null) {\n this.addedEdges = new LinkedHashMap();\n updateMap_unknown(um, m.entrySet().iterator(), this.addedEdges);\n }\n m = this.accessPathEdges;\n if (m != null) {\n this.accessPathEdges = new LinkedHashMap();\n updateMap_unknown(um, m.entrySet().iterator(), this.accessPathEdges);\n }\n if (this.passedParameters != null) {\n Set pp = SortedArraySet.FACTORY.makeSet(HashCodeComparator.INSTANCE);\n pp.addAll(this.passedParameters); \n this.passedParameters = pp;\n }\n addGlobalEdges(this);\n }\n }", "public void update(HashMap um) {\n if (false) {\n if (TRACE_INTRA) out.println(\"Updating edges for node \"+this.toString_long());\n Map m = this.predecessors;\n if (m != null) {\n this.predecessors = new LinkedHashMap();\n updateMap_unknown(um, m.entrySet().iterator(), this.predecessors);\n }\n m = this.addedEdges;\n if (m != null) {\n this.addedEdges = new LinkedHashMap();\n updateMap_unknown(um, m.entrySet().iterator(), this.addedEdges);\n }\n m = this.accessPathEdges;\n if (m != null) {\n this.accessPathEdges = new LinkedHashMap();\n updateMap_unknown(um, m.entrySet().iterator(), this.accessPathEdges);\n }\n if (this.passedParameters != null) {\n Set pp = SortedArraySet.FACTORY.makeSet(HashCodeComparator.INSTANCE);\n pp.addAll(this.passedParameters); \n this.passedParameters = pp;\n }\n addGlobalEdges(this);\n }\n }", "public void addEdge( Edge edge ) {\r\n if ( edge == null ) return;\r\n edges.addElement(edge);\r\n }", "public void setVolume(StarObjectClass self,float leftVolume, float rightVolume){ \r\n \t\tStarCLEMediaPlayer mediaplayer = (StarCLEMediaPlayer)WrapAndroidClass.GetAndroidObject(self,\"AndroidObject\");\r\n \t\tif( mediaplayer == null )\r\n \t\t\treturn;\r\n \t\tmediaplayer.setVolume(leftVolume,rightVolume);\r\n \t}", "public void setEdgeWeighter(EdgeWeighter edgeWeighter) {\n\tthis.edgeWeighter = edgeWeighter;\n }", "public void handleAdvertisement() {\n BGPUpdate nextUpdate = this.incUpdateQueue.poll();\n if (nextUpdate == null) {\n return;\n }\n\n /*\n * Fetch some fields in the correct form\n */\n int advPeer, dest;\n if (nextUpdate.isWithdrawal()) {\n advPeer = nextUpdate.getWithdrawer().asn;\n dest = nextUpdate.getWithdrawnDest();\n } else {\n advPeer = nextUpdate.getPath().getNextHop();\n dest = nextUpdate.getPath().getDest();\n }\n\n /*\n * Setup some objects if this the first time seeing a peer/dest\n */\n if (this.inRib.get(dest) == null) {\n this.inRib.put(dest, new ArrayList<BGPPath>());\n }\n\n /*\n * If there was a rotue to remove from the adjInRib, clean up the inRib\n * as well\n */\n List<BGPPath> destRibList = this.inRib.get(dest);\n for (int counter = 0; counter < destRibList.size(); counter++) {\n if (destRibList.get(counter).getNextHop() == advPeer) {\n destRibList.remove(counter);\n\n break;\n }\n }\n\n /*\n * Add the new route to the ribs, if it is a loop then DON'T add it to\n * ribs\n */\n if ((!nextUpdate.isWithdrawal()) && (!nextUpdate.getPath().containsLoop(this.asn))) {\n destRibList.add(nextUpdate.getPath());\n }\n\n recalcBestPath(dest);\n }", "public void edgeTailChanged(GraphEvent e);", "public void addVolume(StandAlone newVolume) {\r\n volumes.add(newVolume);\r\n }", "public void addEdge(E e){\n\t\tedges.add(e);\n\t}", "public void addEdge(DrawView edge){\n drawnEdges.add(edge);\n }", "private void updateVehicles() {\n OffloaderSyncAdapter.syncImmediately(getContext());\n Log.w(LOG_TAG, \"updateVehicles: \");\n }", "@Override\r\n public void update(Vehicle vehicle) {\n }", "public void addEdge(Edge e){\n edgeList.add(e);\n }", "public void actionPerformed(ActionEvent e) {\r\n mode = InputMode.RMV_EDGES;\r\n instr.setText(\"Drag from one node to another to remove an edge.\");\r\n }", "public void gain(PTAState state, PTAEdge edge) {\n\t\tfor (IInductionListener l: listeners) {\n\t\t\tl.gain(state, edge);\n\t\t}\n\t}", "public void addEdge(Edge e)\r\n\t{\n\t\tint v = e.either(), w = e.other(v);\r\n\t\tadj[v].add(e);\r\n\t\tadj[w].add(e);\r\n\t}", "@Override\n\tpublic void setVehicleLoad(int van, int railway, int airplane) {\n\t\tconstantPO.setVanLoad(van);\n\t\tconstantPO.setRailwayLoad(railway);\n\t\tconstantPO.setAirplaneLoad(airplane);\n\t}", "public void updateDrive () {\n leftCurrSpeed = scale (leftCurrSpeed, leftTargetSpeed, Constants.Drivetrain.ACCELERATION_SCALING, Constants.Drivetrain.ACCELERATION_THRESHOLD);\n rightCurrSpeed = scale (rightCurrSpeed, rightTargetSpeed, Constants.Drivetrain.ACCELERATION_SCALING, Constants.Drivetrain.ACCELERATION_THRESHOLD);\n driveRaw (leftCurrSpeed, rightCurrSpeed);\n }", "private void calculateVolume() {\n\n\t\t/*\n\n\t\t */\n\t\tfor(int i=0; i<this._prismoidsLength.size(); i++) \n\t\t\tthis._prismoidsVolumes.add(\n\t\t\t\t\tAmount.valueOf(\n\t\t\t\t\t\t\tthis._prismoidsLength.get(i).divide(3)\n\t\t\t\t\t\t\t.times(\n\t\t\t\t\t\t\t\t\tthis._prismoidsSectionsAreas.get(i).getEstimatedValue()\n\t\t\t\t\t\t\t\t\t+ this._prismoidsSectionsAreas.get(i+1).getEstimatedValue()\n\t\t\t\t\t\t\t\t\t+ Math.sqrt(\n\t\t\t\t\t\t\t\t\t\t\tthis._prismoidsSectionsAreas.get(i)\n\t\t\t\t\t\t\t\t\t\t\t.times(this._prismoidsSectionsAreas.get(i+1))\n\t\t\t\t\t\t\t\t\t\t\t.getEstimatedValue()\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t).getEstimatedValue(),\n\t\t\t\t\t\t\tSI.CUBIC_METRE\n\t\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\n\t\tfor(int i=0; i<this._prismoidsVolumes.size(); i++)\n\t\t\tthis._fuelVolume = this._fuelVolume\n\t\t\t\t\t\t\t\t\t\t.plus(this._prismoidsVolumes.get(i));\n\t\tthis._fuelVolume = this._fuelVolume.times(2);\n\t\t\n\t}", "public void increaseVolume()\r\n {\r\n volume++;\r\n }", "public void setEnergy(double energy) { this.energy = energy; }", "boolean addEdge(E edge);", "protected void addEdge(IEdge edge) {\n\n if (edge != null) {\n\n this.ids.add(edge.getID());\n this.edgeMap.put(edge.getID(), edge);\n }\n }", "public void updateBridgePart(BridgePart bridgePart) {\n/* 4011 */ if (!isOnSurface() && !Features.Feature.CAVE_BRIDGES.isEnabled()) {\n/* */ \n/* 4013 */ getSurfaceTile().updateBridgePart(bridgePart);\n/* */ \n/* */ \n/* */ }\n/* 4017 */ else if (this.structure != null) {\n/* */ \n/* 4019 */ if (this.watchers != null)\n/* */ {\n/* 4021 */ for (VirtualZone vz : getWatchers()) {\n/* */ \n/* */ \n/* */ try {\n/* 4025 */ vz.updateBridgePart(this.structure.getWurmId(), bridgePart);\n/* */ }\n/* 4027 */ catch (Exception e) {\n/* */ \n/* 4029 */ logger.log(Level.WARNING, e.getMessage(), e);\n/* */ } \n/* */ } \n/* */ }\n/* */ \n/* */ try {\n/* 4035 */ bridgePart.save();\n/* */ }\n/* 4037 */ catch (IOException iox) {\n/* */ \n/* 4039 */ logger.log(Level.WARNING, \"Failed to save structure bridge part: \" + bridgePart.getId() + '.', iox);\n/* */ } \n/* 4041 */ if (bridgePart.getState() != BridgeConstants.BridgeState.COMPLETED.getCode()) {\n/* */ \n/* */ \n/* 4044 */ if (this.vitems != null) {\n/* */ \n/* 4046 */ for (Item item : this.vitems.getAllItemsAsArray()) {\n/* */ \n/* 4048 */ if (item.onBridge() == this.structure.getWurmId()) {\n/* */ \n/* 4050 */ item.setOnBridge(-10L);\n/* 4051 */ for (VirtualZone vz : getWatchers()) {\n/* */ \n/* */ \n/* */ try {\n/* 4055 */ if (item.getParentId() == -10L && vz.isVisible(item, this))\n/* */ {\n/* 4057 */ vz.removeItem(item);\n/* 4058 */ item.setPosZ(-3000.0F);\n/* 4059 */ vz.addItem(item, this, true);\n/* */ }\n/* */ \n/* 4062 */ } catch (Exception e) {\n/* */ \n/* 4064 */ logger.log(Level.WARNING, e.getMessage(), e);\n/* */ } \n/* */ } \n/* */ } \n/* */ } \n/* 4069 */ for (Item pile : this.vitems.getPileItems()) {\n/* */ \n/* 4071 */ if (pile.onBridge() == this.structure.getWurmId()) {\n/* */ \n/* 4073 */ pile.setOnBridge(-10L);\n/* 4074 */ for (VirtualZone vz : getWatchers()) {\n/* */ \n/* */ \n/* */ try {\n/* 4078 */ if (vz.isVisible(pile, this))\n/* */ {\n/* 4080 */ pile.setPosZ(-3000.0F);\n/* 4081 */ vz.removeItem(pile);\n/* 4082 */ vz.addItem(pile, this, true);\n/* */ }\n/* */ \n/* 4085 */ } catch (Exception e) {\n/* */ \n/* 4087 */ logger.log(Level.WARNING, e.getMessage(), e);\n/* */ } \n/* */ } \n/* */ } \n/* */ } \n/* */ } \n/* */ \n/* 4094 */ if (this.creatures != null)\n/* */ {\n/* 4096 */ for (Creature c : this.creatures) {\n/* */ \n/* 4098 */ if (c.getBridgeId() == this.structure.getWurmId()) {\n/* */ \n/* 4100 */ c.setBridgeId(-10L);\n/* 4101 */ if (!c.isPlayer()) {\n/* */ \n/* 4103 */ float oldposz = c.getPositionZ();\n/* 4104 */ float newPosz = c.calculatePosZ();\n/* 4105 */ float diffz = newPosz - oldposz;\n/* 4106 */ c.setPositionZ(newPosz);\n/* 4107 */ c.moved(0.0F, 0.0F, diffz, 0, 0);\n/* */ } \n/* */ } \n/* */ } \n/* */ }\n/* */ } \n/* */ } \n/* */ }", "public void setEnergy (double energy) {\n\t this.energy = energy;\n\t}", "public void setVolume(float newVolume) {\n\t\tthis.volume = newVolume;\n\t}", "public void setWeight(int weightIn){\n\t\tthis.edgeWeight = weightIn;\n\t}", "public void setListEdge (ArrayList<Edge> list){\r\n this.listEdges = list;\r\n }", "public void setEnergy(Energy energy) {\n this.energy = energy;\n }", "public void addEdge(FlowEdge e){\n int v = e.getFrom();\n int w = e.getTo();\n adj[v].add(e); //add forward edge\n adj[w].add(e); //add backward edge\n }", "@Override\n\tpublic void volume() {\n\t\tsolido.volume = (solido.areaBase * altura) / 3;\n\t}", "public RMShape divideShapeFromEdge(double anAmount, byte anEdge, RMShape aNewShape)\n{\n // Get NewShape (if aNewShape is null, create one)\n RMShape newShape = aNewShape!=null? aNewShape : createDivideShapeRemainder(anEdge);\n\n // Get bounds for this shape and remainder bounds (divide bounds by amount from edge)\n RMRect bounds = getFrame();\n RMRect remainder = bounds.divideRect(anAmount, anEdge);\n \n // Set this shape's new bounds and NewShape bounds as remainder\n setFrame(bounds);\n newShape.setFrame(remainder);\n return newShape;\n}", "void setTrafficVolumeArray(org.landxml.schema.landXML11.TrafficVolumeDocument.TrafficVolume[] trafficVolumeArray);", "public void addEdge(edge_type edge) {\n //first make sure the from and to nodes exist within the graph\n assert (edge.getFrom() < nextNodeIndex) && (edge.getTo() < nextNodeIndex) :\n \"<SparseGraph::AddEdge>: invalid node index\";\n\n //make sure both nodes are active before adding the edge\n if ((nodeVector.get(edge.getTo()).getIndex() != invalid_node_index)\n && (nodeVector.get(edge.getFrom()).getIndex() != invalid_node_index)) {\n //add the edge, first making sure it is unique\n if (isEdgeNew(edge.getFrom(), edge.getTo())) {\n edgeListVector.get(edge.getFrom()).add(edge);\n }\n\n //if the graph is undirected we must add another connection in the opposite\n //direction\n if (!isDirectedGraph) {\n //check to make sure the edge is unique before adding\n if (isEdgeNew(edge.getTo(), edge.getFrom())) {\n GraphEdge reversedEdge = new GraphEdge(edge.getTo(),edge.getFrom(),edge.getCost());\n edgeListVector.get(edge.getTo()).add(reversedEdge);\n }\n }\n }\n }", "@Override\n public void addEdge(E pEdge, TimeFrame tf) {\n \n // If The Edge ID is not initialized yet, initalialize it\n if (pEdge.getId() < 0) {\n int id = edgeIdGen.getNextAvailableID();\n pEdge.setId(id);\n mapAllEdges.add(id, pEdge);\n //System.out.println(\"\\t\\t\\t\\t\\t\\t====***************** DynamicGraph.addEdge() edge (id, mapAllEdges.size) = \" + id + \", \" + mapAllEdges.size());\n }\n // Adding to the adjacent list\n if (!darrGlobalAdjList.get(pEdge.getSource().getId()).get(tf).contains(pEdge)) {\n darrGlobalAdjList.get(pEdge.getSource().getId()).get(tf).add(pEdge);\n //System.out.println(\"\\t\\t\\t\\t\\t\\t====***************** DynamicGraph.addEdge() ading to darrGlobalAdjList \");\n if(!pEdge.isDirected() &&\n !darrGlobalAdjList.get(pEdge.getDestination().getId()).get(tf).contains(pEdge)) {\n darrGlobalAdjList.get(pEdge.getDestination().getId()).get(tf).add(pEdge);\n }\n }\n \n hmpGraphsAtTimeframes.get(tf).addEdge(pEdge);\n \n }", "@Override\n \tpublic void onSetVolume(double arg0) {\n \t}" ]
[ "0.5847958", "0.55869496", "0.5501072", "0.5473177", "0.5394926", "0.5393179", "0.5365799", "0.53326833", "0.5331536", "0.5319934", "0.5252718", "0.5208703", "0.5156453", "0.50916773", "0.50753117", "0.5067313", "0.50571555", "0.4978622", "0.49463823", "0.49328616", "0.49229398", "0.48851365", "0.48784104", "0.48746213", "0.48606598", "0.48354536", "0.48353255", "0.48196205", "0.48159713", "0.47961333", "0.47694892", "0.4768248", "0.47634992", "0.47592017", "0.47272003", "0.47230592", "0.47178888", "0.47141844", "0.47053146", "0.4691823", "0.46822432", "0.46644303", "0.46637487", "0.46560532", "0.46513095", "0.46345484", "0.462633", "0.4625687", "0.46244818", "0.4609491", "0.46077606", "0.4592818", "0.45913988", "0.45879817", "0.45830998", "0.45826593", "0.45704305", "0.45667487", "0.45652634", "0.4565087", "0.45648032", "0.4562675", "0.45551616", "0.45521826", "0.45508245", "0.45508245", "0.4550529", "0.45432413", "0.4526921", "0.4526828", "0.45200142", "0.45177215", "0.45173752", "0.45153242", "0.45138294", "0.45102394", "0.45075476", "0.45059538", "0.45058757", "0.45048088", "0.45047835", "0.45041376", "0.45026684", "0.44997084", "0.44959176", "0.44914162", "0.4481666", "0.44765761", "0.4465417", "0.44585416", "0.44544226", "0.44516677", "0.4451554", "0.44472134", "0.44395986", "0.44267905", "0.4426757", "0.4421431", "0.44166276", "0.44116682" ]
0.63549745
0
It returns the geometry representing agent location
public MasonGeometry getGeometry() {return agentLocation;}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Geometry getGeometry();", "public AreaGeometry getGeometry() {\n return this.geometry;\n }", "public PlaceGeometry getGeometry() {\n return geometry;\n }", "public GeoOrigin getGeoOrigin();", "public GridLocation getLocation();", "public geo_location getLocation() {\n return _pos;\n }", "public Coordinate getLocation();", "public double[] getHitGeoCoord();", "public List<LatLng> getCoordinates() {\n return getGeometryObject();\n }", "public Rectangle getBoundingBox() {\n return location;\n }", "public abstract com.jme.scene.Geometry getJMEGeometry();", "public Vector getLocation();", "BodyPart getGearLocation();", "public GeographicPosition getGeoPosition()\n {\n return myGeoPosition;\n }", "public String getLocation() {\n\t\treturn \"-12.9990189,-38.5140298\";\n\t}", "public Point getLocation() { return loc; }", "@Override\r\n public String toString() {\r\n return \"Location:: xPos: \" + xPos + \" yPos: \" + yPos + \"\\nBoundingBox: \" + boundingBox;\r\n }", "private Geometry getGeom2() {\n return DefaultReference.getGeometryFactory().toGeometry(new ReferencedEnvelope(\n DefaultEnvMinX + 4,\n DefaultEnvMinX + 9,\n DefaultEnvMinY + 4,\n DefaultEnvMinY + 9,\n CRS\n ));\n }", "public Double2D getCentral() {\n\n int width = (int)Math.sqrt(state.numAgents);\n if (Math.sqrt(state.numAgents) / width == 1.0) {\n\n double halfWidth = width / 2.0;\n int x = id / width;\n int y = id % width;\n\n double length = state.simWidth / width;\n double halfLength = length / 2.0;\n\n double dx = ((x - halfWidth) * length + halfLength) + meanLocation.getX();\n double dy = ((y - halfWidth) * length + halfLength) + meanLocation.getY();\n //state.printlnSynchronized(\"Dx = \" + dx + \" dy = \" + dy);\n return new Double2D(dx, dy);\n }else {\n return meanLocation;\n }\n }", "public double getLocation(){\n\t\treturn location;\n\t}", "@Override\n public PointF getLocation() {\n return location;\n }", "Vec3 getHomeCoords(IGeneticMob geneticMob);", "@Override\r\n public Point getRelatedSceneLocation() {\r\n return getLocationPoint(locationRatio);\r\n }", "public Point getLocation();", "public Point getRobotLocation();", "@Override\n public geo_location getLocation() {\n return location;\n }", "public final Coord getLocation() {\n return location;\n }", "public PVector getLoc() {\n return location;\n }", "public PVector getLoc() {\n return location;\n }", "public double[] getLocation()\n\t{\n\t\treturn location;\n\t}", "public String getLocationString() {\n return getCenter().toString();\n }", "public String getLocationArea() {\n return locationArea;\n }", "public Location getBedSpawnLocation ( ) {\n\t\treturn extract ( handle -> handle.getBedSpawnLocation ( ) );\n\t}", "public GeoPoint position(){\n return position;\n }", "public abstract Geometry computeGeometry();", "public GeometryType getCMUGeometry() {\n return geometry;\n }", "public final double getX() { return location.getX(); }", "@Override \n public Vector getLocation() {\n return this.getR();\n }", "public PVector getLocation()\n\t{\n\t\treturn location;\n\t}", "public LatLng getGeolocation() {\n\t\treturn LatLng.toLatLng(geolocation);\n\n\t}", "public Point getTopLeft() {\n return location.topLeft();\n }", "private Geometry getGeom1() {\n // A 2x2 geometry with centroid 2,2\n return DefaultReference.getGeometryFactory().toGeometry(new ReferencedEnvelope(\n DefaultEnvMinX + 1,\n DefaultEnvMinX + 3,\n DefaultEnvMinY + 1,\n DefaultEnvMinY + 3,\n CRS\n ));\n }", "public Point[] getLocation()\n {\n return shipLocation.clone();\n }", "public Coordinate getLocation() {\n return location;\n }", "public Location getEnterLocation() {\r\n return location;\r\n }", "public Location getBedLocation ( ) {\n\t\treturn extract ( handle -> handle.getBedLocation ( ) );\n\t}", "@Override\n\tpublic Geometry getGeometria() {\n\t\treturn null;\n\t}", "Location createLocation();", "Location createLocation();", "Location createLocation();", "public Planet getLocation() {\r\n return location;\r\n }", "public Point getLocation() {\n return location;\n }", "public Point2D getLocation();", "public Vector2f getLocation() {\r\n\t\treturn location.getLocation();\r\n\t}", "long getCoordinates();", "long getCoordinates();", "public final Point getLocation() {\n return this.location ;\n }", "public Point getCarLocation() {\r\n\r\n SQLiteQueryBuilder builder = new SQLiteQueryBuilder();\r\n builder.setTables(FTS_VIRTUAL_TABLE_CAR);\r\n builder.setProjectionMap(mColumnMapCar);\r\n\r\n Cursor cursor = builder.query(mDatabaseOpenHelper.getReadableDatabase(),\r\n null, null, null, null, null, null);\r\n\r\n if (cursor == null) {\r\n return null;\r\n } else if (!cursor.moveToFirst()) {\r\n cursor.close();\r\n return null;\r\n }\r\n\r\n String point_str = cursor.getString(1);\r\n\r\n point_str = point_str.trim();\r\n String[] coordinates = point_str.split(\",\");\r\n String lon = coordinates[0];\r\n String lat = coordinates[1];\r\n\r\n double flon = Float.valueOf(lon);\r\n double flat = Float.valueOf(lat);\r\n\r\n return (new Point(flon, flat));\r\n }", "@Override\n\tpublic Point getLocation() {\n\t\treturn new Point(x,y);\n\t}", "public Point getLocation() {\r\n return new Point((int)x,(int)y);\r\n }", "public Point getLocation() {\n\t\treturn location;\n\t}", "public Coordinates getCoordinates()\r\n {\r\n return new Coordinates(r.getX(), r.getY());\r\n }", "Location getLocation();", "Location getLocation();", "Location getLocation();", "Location getLocation();", "public Location getSpawnLocation() {\n return this.spawnLocation;\n }", "protected SceneLocation locationForBody (int bodyOid)\n {\n return (SceneLocation)_ssobj.occupantLocs.get(new Integer(bodyOid));\n }", "public Point getLocation() {\n\t\treturn location.getCopy();\n\t}", "public Point3D getLocation() {\n\t\treturn p;\n\t}", "public double[] getLocation() {\n return new double[]{longitude,latitude};\n }", "godot.wire.Wire.Vector3 getOrigin();", "public Vector2F getWorldLocation() {\n\t\treturn new Vector2F(xPos, yPos);\n\t}", "public int getLocation()\r\n {\n }", "Report.LocationOuterClass.WGS84 getWgs84();", "String getArrivalLocation();", "public abstract Vec2 doorPosition();", "public Location getLocation() {\n\t\treturn location.clone();\n\t}", "String getLocation();", "String getLocation();", "String getLocation();", "@Override\n public Geometry getGeometry() {\n return null;\n }", "public LatLng getLocation() {\n\t\treturn location;\n\t}", "public Point getElevatorPosition() {\n return this.elevator.getOrigin();\n }", "@Override\n\tpublic Point getLocation() {\n\t\treturn position;\n\t}", "public EarthGeometry(){\n\t\tgcl1 = new GeodeticCalculator();\n\t\trnd1 = new Random(56789);\n\t}", "public synchronized void setAgentCoordinate() {\n agentCoordinate = getCoordinate(agentState);\n }", "public GeoPoint getStart(){\n return getOrigin();\n }", "@Override\r\n\t@JsonIgnore\r\n\tpublic Geometry getEnvelope() {\n\t\treturn null;\r\n\t}", "public String getType() {\n return getGeometryType();\n }", "public Location getLocation() \n\t{\n\t\treturn location;\n\t}", "public WotlasLocation getObjectLocation() { return objectLocation; }", "public Location getCenterLocation() \n\t{\n\t\treturn factoryLocation;\n\t}", "public GeoCoordinate getGeoCoordinate() {\n\t\treturn geoCoordinate;\n\t}", "@Override\n\tpublic String getHierarchicalGeometryQuery() {\n\t\treturn \"\";\n\t}", "public double getX_location() {\n return x_location;\n }", "public String getLocationString(){\n return \"(\" + x + \", \" + y + \")\";\n }", "public Continuous2D getGeographySpace() {\n return obstacleSpace;\n }", "IntPoint getLocation();", "@Override\r\n\tpublic String toString() {\r\n\t\treturn getLocation();\r\n\t}" ]
[ "0.6915802", "0.63575715", "0.6230512", "0.61473405", "0.60812384", "0.60618794", "0.6046632", "0.60291487", "0.60019493", "0.59939545", "0.5957237", "0.5946694", "0.5911702", "0.5878252", "0.587438", "0.5873447", "0.5859106", "0.584013", "0.5808647", "0.580755", "0.5798784", "0.5798671", "0.57930475", "0.57923865", "0.57890576", "0.5760603", "0.5755577", "0.5746679", "0.5746679", "0.57438374", "0.57291394", "0.5727969", "0.57128465", "0.5712341", "0.5705708", "0.56892323", "0.568574", "0.56796783", "0.5679306", "0.5676628", "0.5671226", "0.5666991", "0.56573474", "0.56542736", "0.5652061", "0.5649828", "0.5646975", "0.5632061", "0.5632061", "0.5632061", "0.56030655", "0.55986017", "0.55985945", "0.5585172", "0.5583193", "0.5583193", "0.5575338", "0.5573547", "0.55708236", "0.5569623", "0.55664474", "0.5550764", "0.5538909", "0.5538909", "0.5538909", "0.5538909", "0.55320376", "0.552543", "0.5511872", "0.5506948", "0.5494318", "0.5482051", "0.5480826", "0.54678917", "0.54669917", "0.54577017", "0.54337806", "0.54310286", "0.54304105", "0.54304105", "0.54304105", "0.54270786", "0.54161906", "0.5415115", "0.54100657", "0.54077756", "0.54064226", "0.5391347", "0.5390151", "0.53898764", "0.538698", "0.5378815", "0.5378484", "0.53705066", "0.5363815", "0.5356683", "0.53526723", "0.53517276", "0.5346422", "0.5341685" ]
0.8686108
0
It select the route choice model and it calls the path formulation algorithm
public void selectRouteChoice() { RoutePlanner planner = new RoutePlanner(); this.sequence = ap.listSequences.get(numTrips); // only minimisation if (ap.routeChoice.equals("DS")) newPath = planner.roadDistance(originNode, destinationNode, ap); else if (ap.routeChoice.equals("AC")) newPath = planner.angularChangeBased(originNode, destinationNode, ap); else if (ap.routeChoice.equals("TS")) newPath = planner.angularChangeBased(originNode, destinationNode, ap); // minimisation plus only global landmarks else if (ap.routeChoice.equals("DG")) newPath = planner.roadDistance(originNode, destinationNode, ap); else if (ap.routeChoice.equals("AG")) newPath = planner.angularChangeBased(originNode, destinationNode, ap); // minimisation plus local and (optionally) global landmarks else if (ap.routeChoice.contains("D") && ap.routeChoice.contains("L")) newPath = planner.roadDistanceSequence(sequence, ap); else if (ap.routeChoice.contains("A") && ap.routeChoice.contains("L")) newPath = planner.angularChangeBasedSequence(sequence, ap); // anything with regions and/or barriers, or just barriers else if (ap.routeChoice.contains("R")) newPath = planner.regionBarrierBasedPath(originNode, destinationNode, ap); else if (ap.routeChoice.contains("B")) newPath = planner.barrierBasedPath(originNode, destinationNode, ap); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void findNewAStarPath(PedSimCity state) {\n\n\t\tRouteData route = new RouteData();\n\t\troute.origin = originNode.getID();\n\t\troute.destination = destinationNode.getID();\n\t\t//\t\toriginNode = PedSimCity.nodesMap.get(9406);\n\t\t//\t\tdestinationNode = PedSimCity.nodesMap.get(4456);\n\n\t\tif (UserParameters.empiricalABM) {\n\t\t\tSystem.out.println(\" Agent nr. \"+this.agentID + \" group \" + this.agp.groupName + \" OD \" + originNode.getID()+\" \" +destinationNode.getID());\n\t\t\tagp.defineRouteChoiceParameters();\n\t\t\tCombinedNavigation combinedNavigation = new CombinedNavigation();\n\t\t\tnewPath = combinedNavigation.path(originNode, destinationNode, agp);\n\t\t\troute.group = this.agp.groupID;\n\t\t\troute.localH = this.agp.localHeuristic;\n\t\t\troute.routeID = this.agentID.toString()+\"-\"+originNode.getID().toString()+\"-\"+destinationNode.getID().toString();\n\t\t}\n\t\telse {\n\t\t\tSystem.out.println(originNode.getID() + \" \"+ destinationNode.getID()+ \" \"+ap.routeChoice);\n\t\t\tselectRouteChoice();\n\t\t\troute.routeChoice = ap.routeChoice;\n\t\t\t//\t\t\troute.routeID = numTrips;\n\t\t}\n\n\t\tList<Integer> sequenceEdges = new ArrayList<Integer>();\n\n\t\tfor (GeomPlanarGraphDirectedEdge o : newPath) {\n\t\t\t// update edge data\n\t\t\tupdateEdgeData((EdgeGraph) o.getEdge());\n\t\t\tint edgeID = ((EdgeGraph) o.getEdge()).getID();\n\t\t\tsequenceEdges.add(edgeID);\n\t\t}\n\t\troute.sequenceEdges = sequenceEdges;\n\t\tPedSimCity.routesData.add(route);\n\t\tindexOnPath = 0;\n\t\tpath = newPath;\n\n\t\t// set up how to traverse this first link\n\t\tEdgeGraph firstEdge = (EdgeGraph) newPath.get(0).getEdge();\n\t\tsetupEdge(firstEdge); //Sets the Agent up to proceed along an Edge\n\n\t\t// update the current position for this link\n\t\tupdatePosition(segment.extractPoint(currentIndex));\n\t\tnumTrips += 1;\n\t}", "private void launchAlternativeRouteCalculation() {\n SKRouteSettings route = new SKRouteSettings();\n route.setStartCoordinate(new SKCoordinate(-122.392284, 37.787189));\n route.setDestinationCoordinate(new SKCoordinate(-122.484378, 37.856300));\n // number of alternative routes specified here\n route.setNoOfRoutes(3);\n route.setRouteMode(SKRouteSettings.SKROUTE_CAR_FASTEST);\n route.setRouteExposed(true);\n SKRouteManager.getInstance().setRouteListener(this);\n SKRouteManager.getInstance().calculateRoute(route);\n }", "public void solve() {\n /** To solve the traveling salesman problem:\n * Set up the graph, choose a starting node, then call the recursive backtracking method and pass it the starting node.\n */\n\n // We need to pass a starting node to recursive backtracking method\n Node startNode = null;\n\n // Grab a node, any node...\n for( Node n : graph.nodes() ) {\n startNode = n;\n break;\n }\n\n // Visit the first node\n startNode.visit();\n\n // Add first node to the route\n this.route[0] = startNode;\n\n // Pass the number of choices made\n int nchoices = 1;\n\n // Recursive backtracking\n explore(startNode, nchoices );\n\n\n }", "public void getPath()\n {\n if(bruteForceJRadioButton.isSelected())//brute force method\n {\n methodJLabel.setText(\"Brute Force\");\n startTime = System.nanoTime();//times should be in class where brute force is found\n pathList = graph.getBruteForcePath();\n stopTime = System.nanoTime();\n timePassed = stopTime - startTime;\n }\n else if(nearestJRadioButton.isSelected())//nearest neighbor method\n {\n methodJLabel.setText(\"Nearest Neighbor\");\n startTime = System.nanoTime();\n pathList = graph.getNearestNeighbourPath();\n stopTime = System.nanoTime();\n timePassed = stopTime - startTime;\n }\n else //sorted edges method\n {\n methodJLabel.setText(\"Sorted Edges\");\n startTime = System.nanoTime();\n pathList = graph.getSortedEdgePath();\n stopTime = System.nanoTime();\n timePassed = stopTime - startTime;\n }\n displayStats();\n }", "public void calculateRoute() {\n SKRouteSettings route = new SKRouteSettings();\n route.setStartCoordinate(start);\n route.setDestinationCoordinate(end);\n route.setNoOfRoutes(1);\n switch (routingType) {\n case SHORTEST:\n route.setRouteMode(SKRouteSettings.SKRouteMode.BICYCLE_SHORTEST);\n break;\n case FASTEST:\n route.setRouteMode(SKRouteSettings.SKRouteMode.BICYCLE_FASTEST);\n break;\n case QUIET:\n route.setRouteMode(SKRouteSettings.SKRouteMode.BICYCLE_QUIETEST);\n break;\n }\n route.setRouteExposed(true);\n SKRouteManager.getInstance().calculateRoute(route);\n }", "private void travelMethod(RouteFinder routeFinder){\n routeFinder.carPressed(); //by default\n HashMap<JButton, Boolean> buttonMap = routePanel.getButtonDownMap();\n for (JButton button : buttonMap.keySet()) {\n boolean isPressed = buttonMap.get(button);\n if (button.equals(routePanel.getBicycleButton()) && isPressed) routeFinder.bikePressed();\n else if (button.equals(routePanel.getFootButton()) && isPressed) routeFinder.walkPressed();\n else if (button.equals(routePanel.getCarButton()) && isPressed) routeFinder.carPressed();\n }\n }", "public static void main(String[] args) {\n\t\tint grid[][] = new int[][]\n\t\t\t { \n\t\t\t { 1, 1, 0, 0, 0, 0, 1, 0, 0, 0 }, \n\t\t\t { 0, 1, 0, 1, 0, 0, 0, 1, 0, 0 }, \n\t\t\t { 0, 0, 0, 1, 0, 0, 1, 0, 1, 0 }, \n\t\t\t { 1, 1, 1, 1, 0, 1, 1, 1, 1, 0 }, \n\t\t\t { 0, 0, 0, 1, 0, 0, 0, 1, 0, 1 }, \n\t\t\t { 0, 1, 0, 0, 0, 0, 1, 0, 1, 1 }, \n\t\t\t { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, \n\t\t\t { 0, 1, 0, 0, 0, 0, 1, 0, 0, 0 }, \n\t\t\t { 0, 0, 1, 1, 1, 1, 0, 1, 1, 0 } \n\t\t\t };\n\t\t\n // Step 1: Obtain an instance of GridBasedTrafficControl.\n Configurator cfg = new DefaultConfigurator();\n GridBasedTrafficControl gbtc = cfg.getGridBasedTrafficControl(grid);\n\t\t\n\t // Step 2: Obtain path for Journey-1.\n\t Point source1 = new Point(0, 0);\n\t Point dest1 = new Point(3,4);\t \n\t String vehicleId1 = formVehicleId(source1);\n\t List<Point> path1 = gbtc.allocateRoute(vehicleId1, source1, dest1);\n\t System.out.println(\"Route for Journey-1:\" + path1);\n\t \n\t // Step 3: Obtain path for Journey-2.\n\t // This call will not return a route as the available route conflicts with the route\n\t // allocated for Journey-1.\n\t Point source2 = new Point(3, 0);\n\t Point dest2 = new Point(2,4);\n\t String vehicleId2 = formVehicleId(source2);\n\t List<Point> path2 = gbtc.allocateRoute(vehicleId2, source2, dest2);\n\t System.out.println(\"Route for Journey-2:\" + path2);\n\t \n\t // Step 4: Start Journey-1 and mark Journey-1 as complete.\n\t GridConnectedVehicle vehicle1 = new GridConnectedVehicle(vehicleId1, gbtc);\n\t vehicle1.selfDrive(path1);\n\t gbtc.markJourneyComplete(vehicleId1, source1, dest1);\n\t \n\t // Step 5: Retry call to obtain path for Journey-2.\n\t // This call should return a valid path as Journey-1 was marked as complete.\n\t path2 = gbtc.allocateRoute(formVehicleId(source2), source2, dest2);\n\t System.out.println(\"Route for Journey-2:\" + path2);\n\t \n\t // Step 6: Start Journey-2 and mark Journey-2 as complete.\n\t GridConnectedVehicle vehicle2 = new GridConnectedVehicle(vehicleId2, gbtc);\n\t vehicle2.selfDrive(path2);\n\t gbtc.markJourneyComplete(vehicleId2, source2, dest2);\n\t}", "@FXML\n public void getDirections(ActionEvent event) throws IOException {\n\n if (selectedBtnStart == null) {\n errorLabel.setText(\"Please Choose Start\");\n } else if (selectedBtnDest == null) {\n errorLabel.setText(\"Please Choose Destination\");\n } else if (selectedBtnStart.equals(selectedBtnDest)) {\n errorLabel.setText(\"Please Choose Different Locations\");\n } else {\n //create path finding object\n PathFinding pf = PathFindingFactory.makePathFinding((ArrayList<Node>) nodes,\n selectedBtnStart, selectedBtnDest);\n pf.pathFind();\n PathFindController.setPath(pf.getPath());\n\n\n if (pf.getPath().size() < 2) {\n errorLabel.setText(\"Invalid Path\");\n } else {\n KioskApplication.getHistory().push(() -> {\n KioskApplication.getMainScreenController().changeToDirections(\n pf.getStart(), pf.getDest());\n Platform.runLater(() -> {\n try {\n ((PathFindStartController) KioskApplication.getController())\n .getDirections(null);\n } catch (IOException ex) {\n //wont\n }\n });\n });\n KioskApplication.getMapController().drawPath(PathFindController.getPath());\n\n AnchorPane pathFindText = FXMLLoader.load(getClass()\n .getResource(\"/layout/UI_SoftEng_PathFindText.fxml\"));\n\n KioskApplication.switchPanel(mainAnchorPane, pathFindText);\n }\n }\n }", "public void routeSelector(Menu menu) throws IOException,InvalidPathFactoryException,InterruptedException\n {\n String search;\n boolean done = false;\n System.out.println(\"# Route Tracker - Main Menu #\\n\");\n manager.displayRoutes();\n System.out.println(\"# Choose what route you want to take\\n\");\n while(!done)\n {\n search = input.nextLine();\n if(manager.containsRoute(search))\n {\n TrackingProgress trackingProgress = new TrackingProgress(manager.getRoute(search),manager.getGeoUtils(),search);\n GPSWrapper wrapper = new GPSWrapper();\n TrackingMenuState trackingMenuState = new TrackingMenuState(trackingProgress,wrapper);\n menu.setState(trackingMenuState);\n menu.showMenu();\n done = true;\n\n }\n else\n {\n System.out.println(\"Invalid Route name, Enter Valid Route name\");\n\n }\n\n }\n\n\n\n }", "public static void main(String[] args) {\n PointNode A = new PointNode(\"A\",0,0);\r\n PointNode B = new PointNode(\"B\",20,10);\r\n PointNode C = new PointNode(\"C\",40,20);\r\n PointNode D = new PointNode(\"D\",30,30);\r\n PointNode E = new PointNode(\"E\",20,50);\r\n PointNode F = new PointNode(\"F\",-10,40);\r\n PointNode G = new PointNode(\"G\",10,20);\r\n PointNode H = new PointNode(\"H\",10,40);\r\n PointNode I = new PointNode(\"I\",30,40);\r\n PointNode K = new PointNode(\"K\",30,20);\r\n PointNode L = new PointNode(\"L\",40,40);\r\n\r\n A.connectWithPoint(B);\r\n A.connectWithPoint(G);\r\n G.connectWithPoint(F);\r\n G.connectWithPoint(H);\r\n G.connectWithPoint(D);\r\n K.connectWithPoint(L);\r\n B.connectWithPoint(C);\r\n D.connectWithPoint(I);\r\n D.connectWithPoint(E);\r\n L.connectWithPoint(E);\r\n F.connectWithPoint(E);\r\n H.connectWithPoint(E);\r\n I.connectWithPoint(E);\r\n A.connectWithPoint(K);\r\n\r\n Route route = searchWay(A, E);\r\n System.out.println(route);\r\n }", "private void traversePath()\n\t{\n\t\trobot.forward(50);\n\t\trobot.right(90);\n\t\trobot.forward(50);\n\t\trobot.right(90);\n\t\trobot.forward(50);\n\t\trobot.left(90);\n\t\trobot.forward(50);\n\t\trobot.left(90);\n\t}", "void setPath() {\n\t\tif(from.getSelectedItem() != null){\n\t\t\tint ifrom = (int) from.getSelectedItem();\n\t\t\tint ito = (int) to.getSelectedItem();\n\t\t\tPathFinder finder = new BellmanFord(this.app.graph, ifrom-1);\n\t\t\tfinder.findAll();\n\t\t\tArrayList<Integer> path = finder.getPath(ito-1);\n\t\t\tStringBuilder pathStr = new StringBuilder(\"[\");\n\t\t\tif(path != null){\n\t\t\t\tfor(int i = path.size()-1; i >= 0 ; i--){\n\t\t\t\t\tpathStr.append((path.get(i)+1) + \" \");\n\t\t\t\t}\n\t\t\t\tpathStr.append(\"]\");\n\t\t\t\t\n\t\t\t}\n\t\t\tthis.pathLabel.setText(pathStr.toString());\n\t\t}\n\t\t\n\t}", "public void calculateRoute(View view){\r\n int tripTime;\r\n try{\r\n String endString = ((Spinner)findViewById(R.id.trip_time)).getSelectedItem().toString();\r\n tripTime = Integer.parseInt(endString.split(\":\")[0]) * 60 + Integer.parseInt(endString.split(\":\")[1]);\r\n }catch(Exception ex){\r\n Toast.makeText(getApplicationContext(), getApplicationContext().getString(R.string.exception_trip_time_format), Toast.LENGTH_LONG).show();\r\n return;\r\n }\r\n\r\n Category c = (Category)((Spinner) findViewById(R.id.focus)).getSelectedItem();\r\n\r\n TripConfigurations tc = TripConfigurations.getDefaultTripConfigurations(c, tripTime, manager.getAnySight(), manager.getAnySight());\r\n\r\n tc.setStartSight((Sight)((Spinner)findViewById(R.id.arrival_place)).getSelectedItem());\r\n tc.setEndSight((Sight)((Spinner)findViewById(R.id.departure_place)).getSelectedItem());\r\n\r\n try{\r\n this.pathChanger.setTripCofigurations(tc);\r\n this.pathChanger.calculateRoute(manager);\r\n findViewById(R.id.view_route_on_map).setEnabled(true);\r\n }catch(Exception e){\r\n changeToErrorActivity(e);\r\n }\r\n }", "private void planningPaths(String url) {\n removePolyline();\n JSONObject json = new JSONObject();\n JSONObject origin = new JSONObject();\n JSONObject destination = new JSONObject();\n try {\n origin.put(\"lng\", 2.334595);\n origin.put(\"lat\", 48.893478);\n destination.put(\"lng\", destinationLng);\n destination.put(\"lat\", destinationLat);\n json.put(\"origin\", origin);\n json.put(\"destination\", destination);\n } catch (JSONException e) {\n }\n RequestBody body = RequestBody.create(MediaType.parse(\"application/json; charset=utf-8\"), String.valueOf(json));\n OkHttpClient client = new OkHttpClient();\n Request request = new Request.Builder().url(url).post(body).build();\n client.newCall(request).enqueue(new Callback() {\n @Override\n public void onFailure(Call call, IOException e) {\n Message msg = Message.obtain();\n Bundle bundle = new Bundle();\n bundle.putString(\"errorMsg\", e.getMessage());\n msg.what = ROUTE_PLANNING_FAILED;\n msg.setData(bundle);\n mHandler.sendMessage(msg);\n }\n\n @Override\n public void onResponse(Call call, Response response) throws IOException {\n try {\n String json = response.body().string();\n generateRoute(json);\n } catch (Exception e) {\n e.getMessage();\n }\n }\n });\n }", "public static void pathMenu() {\n boolean quit = false;\n do {\n System.out.println(\"==================================================\");\n System.out.println(\"Building Path Menu\");\n System.out.println(\"==================================================\");\n System.out.println();\n System.out.println(\"Please Make a selection:\");\n System.out.println(\"[1] Standard\");\n System.out.println(\"[2] Reduce Double Edges\");\n System.out.println(\"[3] Reduce Double Edges & use LSI Weights\");\n System.out.println(\"[0] back\");\n System.out.print(\"Selection: \");\n int menu = scan.nextInt();\n String name, filename;\n double w;\n int limit;\n switch (menu) {\n case 1:\n System.out.print(\"Name: \");\n name = scan.next();\n System.out.print(\"Filename: \");\n filename = scan.next();\n System.out.print(\"W: \");\n w = scan.nextDouble();\n System.out.print(\"Open List Limit: \");\n limit = scan.nextInt();\n try {\n Application.findPath(filename, name, w, limit, true, true, false);\n } catch (Exception e) {\n System.out.println(\"Error running A-Star: \" + e.getMessage());\n }\n break;\n case 2:\n System.out.print(\"Name: \");\n name = scan.next();\n System.out.print(\"Filename: \");\n filename = scan.next();\n System.out.print(\"W: \");\n w = scan.nextDouble();\n System.out.print(\"Open List Limit: \");\n limit = scan.nextInt();\n try {\n Application.findPath(filename, name, w, limit, true, true, false);\n } catch (Exception e) {\n System.out.println(\"Error running A-Star: \" + e.getMessage());\n }\n break;\n case 3:\n System.out.print(\"Name: \");\n name = scan.next();\n System.out.print(\"Filename: \");\n filename = scan.next();\n System.out.print(\"W: \");\n w = scan.nextDouble();\n System.out.print(\"Open List Limit: \");\n limit = scan.nextInt();\n try {\n Application.findPath(filename, name, w, limit, true, true, true);\n } catch (Exception e) {\n System.out.println(\"Error running A-Star: \" + e.getMessage());\n }\n break;\n case 0:\n quit = true;\n break;\n default:\n System.out.println(\"Invalid Entry!\");\n }\n }\n while (!quit);\n }", "public void solver(){\n\n tohSolver(noDisks,1,3,2);\n\n }", "public OptInfo createInitialRoutes() {\t\n\t\t//OptInfo has old and new attributes\n\t\tOptInfo info = new OptInfo();\n\t\tTSPDepot currDepot = null; //current depot\n\t\tTSPShipment currShip = null; //current shipment\n\t\t//int countLoop=0;\n\n\t\t//check if selection and insertion type methods have been selected\n\t\tif (ProblemInfo.selectShipType == null) {\n\t\t\tSettings.printDebug(Settings.ERROR,\n\t\t\t\t\t\"No selection shipment type has been assigned\");\n\n\t\t}\n\t\tif (ProblemInfo.insertShipType == null) {\n\t\t\tSettings.printDebug(Settings.ERROR,\n\t\t\t\t\t\"No insertion shipment type has been assigned\");\n\t\t}\n\n\t\t//capture the old attributes\n\t\tinfo.setOldAttributes(mainDepots.getAttributes());\n\t\twhile (!mainShipments.isAllShipsAssigned()) {\n\n\n\t\t\tcurrDepot = (TSPDepot) mainDepots.getTSPHead();\n\t\t\t//Send the entire mainDepots and mainShipments to get the next shipment\n\t\t\t//to be inserted including the current depot\n\t\t\tTSPShipment theShipment = mainShipments.getNextInsertShipment(mainDepots,\n\t\t\t\t\tcurrDepot, mainShipments, currShip);\n\t\t\tif (theShipment == null) { //shipment is null, print error message\n\t\t\t\tSettings.printDebug(Settings.COMMENT, \"No shipment was selected\");\n\t\t\t}\n\t\t\t//The selected shipment will be inserted into the route\n\t\t\tif (!mainDepots.insertShipment(theShipment)) {\n\t\t\t\tSettings.printDebug(Settings.COMMENT, \"The Shipment: <\" + theShipment.getIndex() +\n\t\t\t\t\t\t\"> cannot be routed\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\t//Settings.printDebug(Settings.COMMENT,\n\t\t\t\t//\t\t\"The Shipment: <\" + theShipment.getIndex() +// \" \" + theShipment +\n\t\t\t\t//\t\t\"> was routed\");\n\t\t\t\t//tag the shipment as being routed\n\t\t\t\ttheShipment.setIsAssigned(true);\n\t\t\t}\n\t\t}\n\t\tProblemInfo.depotLLLevelCostF.calculateTotalsStats(mainDepots);\n\t\tinfo.setNewAtributes(mainDepots.getAttributes());\n\t\treturn info;\n\t}", "public void chooseAlgorithm() {\n boolean runloop = true;\n CustomArrayList<Integer>[] graph = null;\n graph = util.initializeCNF(statement);\n while (runloop) {\n io.println(\"Which algorithm do you want to use to solve this?\");\n io.println(\"1: Tarjan algorithm\\n2: Kosaraju algorithm\\n3: Brute force method\\n4: Print the truth distribution that solves the CNF\\n5: return\");\n String selection = io.nextLine();\n switch (selection) {\n case (\"1\"):\n tarjan = new TarjanAlgorithm(graph, numVariables);\n TarjanPrint();\n break;\n case (\"2\"):\n kosaraju = new KosarajuAlgorithm(graph, numVariables);\n KosarajuPrint();\n break;\n case (\"3\"):\n io.println(\"Warning! Brute force method has an exponential time complexity. Using this with CNF with more than 20 variables will take a really long time. \");\n io.println(\"Continue? y/n\");\n String affirmate = io.nextLine();\n switch (affirmate) {\n case (\"y\"):\n bruteForcePrint();\n break;\n case (\"n\"):\n break;\n }\n break;\n case (\"4\"):\n tarjan = new TarjanAlgorithm(graph, numVariables);\n if (tarjan.checkSatisfiability()) {\n printTruthAssesment();\n } else {\n io.println(\"Not satisfiable\");\n }\n break;\n case (\"5\"):\n io.println(\"Returning to main menu...\");\n runloop = false;\n break;\n }\n }\n }", "public static void runStaticSimulation(String path) {\n HashMap<String, Integer> lowerBounds = readInFJSSBounds();\n\n Objective objective = MAKESPAN;\n// List<AbstractRule> sequencingRules = new ArrayList();\n// List<AbstractRule> routingRules = new ArrayList();\n\n //objectives.add(Objective.MAKESPAN);\n //AbstractRule sequencingRule = new FCFS(RuleType.SEQUENCING);\n AbstractRule sequencingRule = new FCFS(RuleType.SEQUENCING);\n AbstractRule routingRule = new WIQ(RuleType.ROUTING);\n System.out.println(\"Running static simulation for objective: \"+objective.getName());\n System.out.println(\"Sequencing rule: \"+sequencingRule.getName());\n System.out.println(\"Routing rule: \"+routingRule.getName());\n\n //routingRules.add(GPRule.readFromLispExpression(RuleType.ROUTING,\" (+ (max WIQ DD) (- (/ AT PT) (min SL NOR)))\"));\n\n //routingRules.add(new SBT(RuleType.ROUTING));\n //sequencingRules.add(GPRule.readFromLispExpression(RuleType.SEQUENCING,\" (+ (min (min (max (min WIQ t) (max NOR SL)) MRT) (max DD WKR)) (* (+ SL SL) (- WIQ PT)))\"));\n //sequencingRules.add(GPRule.readFromLispExpression(RuleType.SEQUENCING,\" (/ WKR rDD)\"));\n// routingRules.add(GPRule.readFromLispExpression(RuleType.ROUTING,\" (max (max NINQ PT) (max (- (/ (min t NINQ)\" +\n// \" (max AT W)) (min (max NOR FDD) (* MRT (- SL W)))) AT))\"));\n\n// sequencingRules.add(new AVPRO(RuleType.SEQUENCING));\n// sequencingRules.add(new CR(RuleType.SEQUENCING));\n// sequencingRules.add(new EDD(RuleType.SEQUENCING));\n// sequencingRules.add(new FCFS(RuleType.SEQUENCING));\n// sequencingRules.add(new FDD(RuleType.SEQUENCING));\n// sequencingRules.add(new LCFS(RuleType.SEQUENCING));\n// sequencingRules.add(new LPT(RuleType.SEQUENCING));\n// sequencingRules.add(new LWKR(RuleType.SEQUENCING));\n// sequencingRules.add(new MOPNR(RuleType.SEQUENCING));\n// sequencingRules.add(new MWKR(RuleType.SEQUENCING));\n// sequencingRules.add(new NPT(RuleType.SEQUENCING));\n// sequencingRules.add(new PW(RuleType.SEQUENCING));\n// sequencingRules.add(new SL(RuleType.SEQUENCING));\n// sequencingRules.add(new Slack(RuleType.SEQUENCING));\n// sequencingRules.add(new SPT(RuleType.SEQUENCING));\n//\n// sequencingRules.add(new ATC(RuleType.SEQUENCING));\n// sequencingRules.add(new COVERT(RuleType.SEQUENCING));\n// sequencingRules.add(new CRplusPT(RuleType.SEQUENCING));\n// sequencingRules.add(new LWKRplusPT(RuleType.SEQUENCING));\n// sequencingRules.add(new OPFSLKperPT(RuleType.SEQUENCING));\n// sequencingRules.add(new PTplusPW(RuleType.SEQUENCING));\n// sequencingRules.add(new PTplusPWplusFDD(RuleType.SEQUENCING));\n// sequencingRules.add(new SlackperOPN(RuleType.SEQUENCING));\n// sequencingRules.add(new SlackperRPTplusPT(RuleType.SEQUENCING));\n//\n// sequencingRules.add(new WATC(RuleType.SEQUENCING));\n// sequencingRules.add(new WCOVERT(RuleType.SEQUENCING));\n// sequencingRules.add(new WSPT(RuleType.SEQUENCING));\n//\n// //add work center specific rules, as other rules will always give the same values\n// routingRules.add(new LBT(RuleType.ROUTING));\n// routingRules.add(new LRT(RuleType.ROUTING));\n// routingRules.add(new NIQ(RuleType.ROUTING));\n// routingRules.add(new SBT(RuleType.ROUTING));\n// routingRules.add(new SRT(RuleType.ROUTING));\n// routingRules.add(new WIQ(RuleType.ROUTING));\n\n //get the Filenames of all static FJSS instances in the relevant directory\n List<Path> directoryNames = getDirectoryNames(new ArrayList(), Paths.get(path),\".fjs\");\n\n //List<String> instanceFileNames = getFileNames(new ArrayList(), Paths.get(path), \".fjs\");\n for (int i = 0; i < directoryNames.size(); ++i) {\n Path directoryName = directoryNames.get(i);\n List<String> instanceFileNames = getFileNames(new ArrayList(), directoryName, \".fjs\");\n int numInstances = instanceFileNames.size();\n System.out.println(numInstances +\" FJSS instances in \"+directoryName.toString());\n double[] makeSpanRatios = new double[numInstances];\n for (int j = 0; j < numInstances; ++j) {\n String instanceFileName = instanceFileNames.get(j);\n //System.out.println(\"\\nInstance \"+(i+1)+\" - Path: \"+instanceFileName);\n double objectiveVal =\n calculateFitness(instanceFileName, objective, sequencingRule, routingRule);\n String formattedFileName = formatFileName(instanceFileName);\n double lowerBound = lowerBounds.get(formattedFileName);\n double ratio = objectiveVal/lowerBound;\n makeSpanRatios[j] = ratio;\n }\n double ratioSum = 0.0;\n for (int j = 0; j < numInstances; ++j) {\n ratioSum += makeSpanRatios[j];\n }\n System.out.println(\"Mean lb/objective value is: \"+ratioSum/numInstances);\n System.out.println();\n }\n\n //want to be able to feed in a sequencing rule and a routing rule\n //and be able to find out the makespan of that pair on a given instance\n //should then store that, as well a ratio of that to the lower bound,\n //in a file, and aggregate by directory\n\n //EvaluateOutput(\"/out/rule_comparisons/\", \"RR\");\n }", "public abstract interface PathfindController extends Controller {\n // Public Abstract Methods\n \n /**\n * Block next coordinate in path.\n */\n public abstract void blockNext();\n \n /**\n * Calculate pathfinding and the states for visited and blocked of the\n * back, front, left, right respectively.\n *\n * @return the array of states\n */\n public abstract boolean[] calculate();\n \n /**\n * Go to next coordinate in path.\n */\n public abstract void goNext();\n \n /**\n * Checks if next coordinate in path is blocked.\n *\n * @return true, if next coordinate in path is blocked\n */\n public abstract boolean isNextBlocked();\n \n /**\n * Checks if next coordinate in path is visited.\n *\n * @return true, if next coordinate in path is visited\n */\n public abstract boolean isNextVisited();\n \n /**\n * String representation of the raw graph.\n *\n * @return the string\n */\n public abstract String rawGraphToString();\n \n /**\n * Reset pathfinding.\n */\n public abstract void reset();\n \n /**\n * Rotate to the left coordinate in path.\n */\n public abstract void rotateLeft();\n \n /**\n * Rotate to the right coordinate in path.\n */\n public abstract void rotateRight();\n \n /**\n * Unblock next coordinate in path.\n */\n public abstract void unblockNext();\n \n /**\n * Visit current coordinate in path.\n */\n public abstract void visit();\n}", "@Override\n public void run() {\n\n // Define vehicle label if undefined\n if (this.label == null) {\n this.label = \"Vehicle_\" + this.getId();\n }\n\n // Ask roundabout object for path\n Deque<Vertex<AtomicReference>> path = this.getVehicleRoute(this.source, this.destination);\n Vertex<AtomicReference> last = null;\n\n // Get entry queue\n ConcurrentLinkedQueue<Vehicle> entry = this.roundabout.queueOnEntry(this, this.source);\n\n // Wait for first in queue\n while (entry.peek() != this) this.vehicleSleep(waitOnQueue());\n\n // Traverse Path\n for (Vertex<AtomicReference> v : path) {\n\n // Accelerate between path nodes\n if (this.speed < this.maxSpeed) this.speed = accelerate(this.speed);\n\n // Move to node\n while (!v.getValue().compareAndSet(null, this)) {\n\n // Decelerate to not crash into another vehicle\n while (this.speed > 0) this.speed = decelerate(this.speed);\n\n System.out.println(this.label + \": Waiting for next node \" + v.getKey());\n\n // Wait\n this.vehicleSleep(waitToTravel());\n }\n\n // Accelerate for next in case it has stopped\n while (this.speed <= 0) this.speed = accelerate(this.speed);\n\n System.out.println(this.label + \": Moving to node \" + v.getKey() + \" for \" + travel());\n\n // Moving from node to node\n this.vehicleSleep(travel());\n\n // Remove myself from queue only after locking the first node\n if (path.peekFirst() == v) entry.remove(this);\n\n // Release last node\n while (last != null && !last.getValue().compareAndSet(this, null)) ;\n\n // Assign v as the last node which it travelled to\n last = v;\n }\n\n // Release last node\n while (!last.getValue().compareAndSet(this, null)) ;\n }", "private void select_trains_route() throws SQLException {\r\n int selected_index = train_cbox.getSelectionModel().getSelectedIndex();\r\n if (selected_index != -1)\r\n tbl_route.setItems(FXCollections.observableArrayList(DatabaseQuerySF.fillRoute(\r\n trainsList.get(selected_index).getTrain_id(),\r\n trainsList.get(selected_index).getDeparture_station_id(),\r\n trainsList.get(selected_index).getArrival_station_id()))\r\n );\r\n }", "private void installRoute(List<NodePortTuple> path, OFMatch match) {\r\n\r\n\t\tOFMatch m = new OFMatch();\r\n\r\n\t\tm.setDataLayerType(Ethernet.TYPE_IPv4)\r\n\t\t\t\t.setNetworkSource(match.getNetworkSource())\r\n\t\t\t\t.setNetworkDestination(match.getNetworkDestination());\r\n\r\n\t\tfor (int i = 0; i <= path.size() - 1; i += 2) {\r\n\t\t\tshort inport = path.get(i).getPortId();\r\n\t\t\tm.setInputPort(inport);\r\n\t\t\tList<OFAction> actions = new ArrayList<OFAction>();\r\n\t\t\tOFActionOutput outport = new OFActionOutput(path.get(i + 1)\r\n\t\t\t\t\t.getPortId());\r\n\t\t\tactions.add(outport);\r\n\r\n\t\t\tOFFlowMod mod = (OFFlowMod) floodlightProvider\r\n\t\t\t\t\t.getOFMessageFactory().getMessage(OFType.FLOW_MOD);\r\n\t\t\tmod.setCommand(OFFlowMod.OFPFC_ADD)\r\n\t\t\t\t\t.setIdleTimeout((short) 0)\r\n\t\t\t\t\t.setHardTimeout((short) 0)\r\n\t\t\t\t\t.setMatch(m)\r\n\t\t\t\t\t.setPriority((short) 105)\r\n\t\t\t\t\t.setActions(actions)\r\n\t\t\t\t\t.setLength(\r\n\t\t\t\t\t\t\t(short) (OFFlowMod.MINIMUM_LENGTH + OFActionOutput.MINIMUM_LENGTH));\r\n\t\t\tflowPusher.addFlow(\"routeFlow\" + uniqueFlow, mod,\r\n\t\t\t\t\tHexString.toHexString(path.get(i).getNodeId()));\r\n\t\t\tuniqueFlow++;\r\n\t\t}\r\n\t}", "private void drawRoutes () {\n // Lay ngay cua tour\n Date tourDate = OnlineManager.getInstance().mTourList.get(tourOrder).getmDate();\n // Kiem tra xem ngay dien ra tour la truoc hay sau hom nay. 0: hom nay, 1: sau, -1: truoc\n int dateEqual = Tour.afterToday(tourDate);\n // Kiem tra xem tour da dien ra chua\n if (dateEqual == -1) {\n // Tour da dien ra, khong ve gi ca\n } else if (dateEqual == 1) {\n // Tour chua dien ra, khong ve gi ca\n } else {\n // Tour dang dien ra thi kiem tra gio\n /* Chang sap toi mau do, today nam trong khoang src start va src end\n Chang dang di chuyen mau xanh, today nam trong khoang src end va dst start\n Chang vua di qua mau xam, today nam trong khoang dst start va dst end */\n ArrayList<TourTimesheet> timesheets = OnlineManager.getInstance().mTourList.get(tourOrder).getmTourTimesheet();\n // Danh dau chang dang di qua\n int changDangDiQuaOrder = -1;\n // Danh dau chang sap di qua\n int changSapDiQuaOrder = -1;\n if(Tour.afterCurrentHour(timesheets.get(0).getmStartTime()) == 1){\n // Chang sap di qua mau do\n // Neu chua ve chang sap di, ve duong mau do\n if (timesheets.size() >= 2) {\n drawRoute(Color.RED, timesheets.get(0).getmBuildingLocation(), timesheets.get(1).getmBuildingLocation());\n }\n } else {\n for (int i = 0; i < timesheets.size() - 1; i++) {\n // Kiem tra xem chang hien tai la truoc hay sau gio nay. 0: gio nay, 1: gio sau, -1: gio truoc\n int srcStartEqual = Tour.afterCurrentHour(timesheets.get(i).getmStartTime());\n int srcEndEqual = Tour.afterCurrentHour(timesheets.get(i).getmEndTime());\n int dstStartEqual = Tour.afterCurrentHour(timesheets.get(i + 1).getmStartTime());\n // 2 vi tri chang\n LatLng srcLocation = timesheets.get(i).getmBuildingLocation();\n LatLng dstLocation = timesheets.get(i + 1).getmBuildingLocation();\n if (srcStartEqual == -1 && srcEndEqual == 1) {\n // Chang dang di qua mau xanh\n // Neu chua ve chang dang di, ve duong mau xanh\n drawRoute(Color.BLUE, srcLocation, dstLocation);\n // Danh dau chang dang di qua\n changDangDiQuaOrder = i;\n // Thoat khoi vong lap\n break;\n } else if (srcEndEqual == -1 && dstStartEqual == 1) {\n // Chang sap toi mau do\n // Neu chua ve chang sap toi, ve duong mau do\n drawRoute(Color.RED, srcLocation, dstLocation);\n // Danh dau chang sap di qua\n changSapDiQuaOrder = i;\n // Thoat khoi vong lap\n break;\n }\n }\n }\n // Kiem tra xem da ve duoc nhung duong nao roi\n if (changDangDiQuaOrder != - 1) {\n // Neu ve duoc chang dang di qua roi thi ve tiep 2 chang con lai\n if (changDangDiQuaOrder < timesheets.size() - 2) {\n // Neu khong phai chang ket thuc thi ve tiep chang sap di qua\n // 2 vi tri chang\n LatLng srcLocation = timesheets.get(changDangDiQuaOrder + 1).getmBuildingLocation();\n LatLng dstLocation = timesheets.get(changDangDiQuaOrder + 2).getmBuildingLocation();\n drawRoute(Color.RED, srcLocation, dstLocation);\n }\n if (changDangDiQuaOrder > 0) {\n // Neu khong phai chang bat dau thi ve tiep chang da di qua\n // 2 vi tri chang\n LatLng srcLocation = timesheets.get(changDangDiQuaOrder - 1).getmBuildingLocation();\n LatLng dstLocation = timesheets.get(changDangDiQuaOrder).getmBuildingLocation();\n drawRoute(Color.GRAY, srcLocation, dstLocation);\n }\n }\n if (changSapDiQuaOrder != - 1) {\n // Neu ve duoc chang sap di qua roi thi ve tiep 2 chang con lai\n if (changSapDiQuaOrder > 0) {\n // Neu khong phai chang bat dau thi ve tiep chang dang di qua\n // 2 vi tri chang\n LatLng srcLocation = timesheets.get(changSapDiQuaOrder - 1).getmBuildingLocation();\n LatLng dstLocation = timesheets.get(changSapDiQuaOrder).getmBuildingLocation();\n drawRoute(Color.BLUE, srcLocation, dstLocation);\n }\n if (changSapDiQuaOrder > 1) {\n // Neu khong phai chang bat dau thi ve tiep chang da di qua\n // 2 vi tri chang\n LatLng srcLocation = timesheets.get(changSapDiQuaOrder - 2).getmBuildingLocation();\n LatLng dstLocation = timesheets.get(changSapDiQuaOrder - 1).getmBuildingLocation();\n drawRoute(Color.GRAY, srcLocation, dstLocation);\n }\n }\n }\n }", "@Override\n\tpublic void solve() {\n\t\tlong startTime = System.nanoTime();\n\n\t\twhile(!unvisitedPM.isEmpty()){\n\t\t\tProblemModel current = findCheapestNode();\n\t\n\t\t\tfor(ProblemModel pm : current.getSubNodes()){\n\t\t\n\t\t\t\tif(!visited.contains(pm) && !unvisitedPM.contains(pm)){\n\t\t\t\t\t\n\t\t\t\t\tunvisitedPM.add(pm);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif(current.getSideStart().isEmpty()){\n\t\t\t\tSystem.out.print( \"\\n\"+ \"StartSide Runners: \");\n\t\t\t\tfor(Integer r: current.getSideStart()){\n\t\t\t\t\tSystem.out.print( \" \" +r) ;\n\t\t\t\t}\n\t\t\t\tSystem.out.print( \"\\n\" + \"EndSide Runners: \");\n\t\t\t\tfor(Integer r: current.getSideEnd()){\n\t\t\t\t\tSystem.out.print( \" \" + r);\n\t\t\t\t}\n\n\t\t\t\tprintPathTaken(current);\n\t\t\t\tSystem.out.print( \"\\n\" + \"------------done--------------\");\n\t\t\t\tlong endTime = System.nanoTime();\n\t\t\t\tlong duration = ((endTime - startTime)/1000000);\n\t\t\t\tSystem.out.print( \"\\n\" + \"-AS1 Time taken: \" + duration + \"ms\");\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tvisited.add(current);\n\t\t\n\t\t}\n\t\t\n\n\t}", "public void shortestRouteDijkstra(){\n int landmark1 = l1.getSelectionModel().getSelectedIndex();\n int landmark2 = l2.getSelectionModel().getSelectedIndex();\n GraphNodeAL<MapPoint> lm1 = landmarkList.get(landmark1);\n GraphNodeAL<MapPoint> lm2 = landmarkList.get(landmark2);\n\n shortestRouteDij(lm1, lm2);\n }", "private BGPPath internalPathSelection(Collection<BGPPath> possList, boolean avoidDecoys) {\n BGPPath currentBest = null;\n int currentRel = -4;\n\n for (BGPPath tPath : possList) {\n\n /*\n * If we're doing avoidance based on ignoring local preference, then\n * for the first pass we're literally just going to throw out all\n * routes that are NOT clean, this is corrected in path selection if\n * this leaves us w/ no viable routes\n */\n if (avoidDecoys && (this.avoidMode == AS.AvoidMode.LOCALPREF || this.avoidMode == AS.AvoidMode.LEGACY)) {\n if (tPath.containsAnyOf(this.botSet)) {\n continue;\n }\n }\n\n /*\n * If we have no best path currently selected, the first one is best\n * by default\n */\n if (currentBest == null) {\n currentBest = tPath;\n currentRel = this.getRel(currentBest.getNextHop());\n continue;\n }\n\n /*\n * Local pref based on relationship step\n */\n int newRel = this.getRel(tPath.getNextHop());\n if (newRel > currentRel) {\n currentBest = tPath;\n currentRel = newRel;\n continue;\n }\n\n /*\n * If local pref is the same, move on to the next critera\n */\n if (newRel == currentRel) {\n /*\n * If we're inserting the decision to route around decoys after\n * local pref, but before path length, do so here\n */\n if (this.avoidMode == AS.AvoidMode.PATHLEN) {\n if (avoidDecoys && currentBest.containsAnyOf(this.botSet) && !tPath.containsAnyOf(this.botSet)) {\n currentBest = tPath;\n currentRel = newRel;\n continue;\n }\n if (avoidDecoys && !currentBest.containsAnyOf(this.botSet) && tPath.containsAnyOf(this.botSet)) {\n continue;\n }\n }\n\n if (currentBest.getPathLength() > tPath.getPathLength()) {\n currentBest = tPath;\n currentRel = newRel;\n continue;\n } else if (currentBest.getPathLength() == tPath.getPathLength()) {\n if (avoidDecoys && this.avoidMode == AS.AvoidMode.TIEBREAK\n && currentBest.containsAnyOf(this.botSet) && !tPath.containsAnyOf(this.botSet)) {\n currentBest = tPath;\n currentRel = newRel;\n continue;\n }\n if (avoidDecoys && this.avoidMode == AS.AvoidMode.TIEBREAK\n && !currentBest.containsAnyOf(this.botSet) && tPath.containsAnyOf(this.botSet)) {\n continue;\n }\n\n if (tPath.getNextHop() < currentBest.getNextHop()) {\n currentBest = tPath;\n currentRel = newRel;\n }\n }\n }\n }\n\n return currentBest;\n }", "public void model() \n\t{\n\t\t\n\t\ttry \n\t\t{\n\t\t GRBEnv env = new GRBEnv();\n\t\t GRBModel model = new GRBModel(env, \"resources/students.lp\");\n\n\t\t model.optimize();\n\n\t\t int optimstatus = model.get(GRB.IntAttr.Status);\n\n\t\t if (optimstatus == GRB.Status.INF_OR_UNBD) {\n\t\t model.getEnv().set(GRB.IntParam.Presolve, 0);\n\t\t model.optimize();\n\t\t optimstatus = model.get(GRB.IntAttr.Status);\n\t\t }\n\n\t\t if (optimstatus == GRB.Status.OPTIMAL) {\n\t\t double objval = model.get(GRB.DoubleAttr.ObjVal);\n\t\t System.out.println(\"Optimal objective: \" + objval);\n\t\t } else if (optimstatus == GRB.Status.INFEASIBLE) {\n\t\t System.out.println(\"Model is infeasible\");\n\n\t\t // Compute and write out IIS\n\t\t model.computeIIS();\n\t\t model.write(\"model.ilp\");\n\t\t } else if (optimstatus == GRB.Status.UNBOUNDED) {\n\t\t System.out.println(\"Model is unbounded\");\n\t\t } else {\n\t\t System.out.println(\"Optimization was stopped with status = \"\n\t\t + optimstatus);\n\t\t }\n\n\t\t // Dispose of model and environment\n\t\t model.write(\"resources/model.sol\");\n\t\t model.dispose();\n\t\t env.dispose();\n\n\t\t } catch (GRBException e) {\n\t\t System.out.println(\"Error code: \" + e.getErrorCode() + \". \" +\n\t\t e.getMessage());\n\t\t }\n\t\t\n\t}", "private void QueryDirections() {\n\t\tshowProgress(true, \"正在搜索导航路线...\");\n\t\t// Spawn the request off in a new thread to keep UI responsive\n\t\tfor (final FloorInfo floorInfo : floorList) {\n\t\t\tif (floorInfo.getPoints() != null\n\t\t\t\t\t&& floorInfo.getPoints().length >= 2) {\n\n\t\t\t\tThread t = new Thread() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t// Start building up routing parameters\n\t\t\t\t\t\t\tRouteTask routeTask = RouteTask\n\t\t\t\t\t\t\t\t\t.createOnlineRouteTask(\n\t\t\t\t\t\t\t\t\t\t\tfloorInfo.getRouteServerPath(),\n\t\t\t\t\t\t\t\t\t\t\tnull);\n\n\t\t\t\t\t\t\tRouteParameters rp = routeTask\n\t\t\t\t\t\t\t\t\t.retrieveDefaultRouteTaskParameters();\n\t\t\t\t\t\t\tNAFeaturesAsFeature rfaf = new NAFeaturesAsFeature();\n\t\t\t\t\t\t\t// Convert point to EGS (decimal degrees)\n\t\t\t\t\t\t\t// Create the stop points (start at our location, go\n\t\t\t\t\t\t\t// to pressed location)\n\t\t\t\t\t\t\t// StopGraphic point1 = new StopGraphic(mLocation);\n\t\t\t\t\t\t\t// StopGraphic point2 = new StopGraphic(p);\n\t\t\t\t\t\t\trfaf.setFeatures(floorInfo.getPoints());\n\t\t\t\t\t\t\trfaf.setCompressedRequest(true);\n\t\t\t\t\t\t\trp.setStops(rfaf);\n\n\t\t\t\t\t\t\t// Set the routing service output SR to our map\n\t\t\t\t\t\t\t// service's SR\n\t\t\t\t\t\t\trp.setOutSpatialReference(wm);\n\t\t\t\t\t\t\trp.setFindBestSequence(true);\n\t\t\t\t\t\t\trp.setPreserveFirstStop(true);\n\t\t\t\t\t\t\tif (floorInfo.getEndPoint() != null) {\n\t\t\t\t\t\t\t\trp.setPreserveLastStop(true);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Solve the route and use the results to update UI\n\t\t\t\t\t\t\t// when received\n\t\t\t\t\t\t\tfloorInfo.setRouteResult(routeTask.solve(rp));\n\n\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\tmException = e;\n\t\t\t\t\t\t\t// mHandler.post(mUpdateResults);\n\t\t\t\t\t\t}\n\t\t\t\t\t\trouteIndex++;\n\t\t\t\t\t\tif (routeIndex >= routeCount) {\n\t\t\t\t\t\t\tmHandler.post(mSetCheckMap);\n\t\t\t\t\t\t\tmHandler.post(mUpdateResults);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\t// Start the operation\n\t\t\t\tt.start();\n\t\t\t}\n\t\t}\n\n\t}", "@Override\n\tpublic void seeRoute() {\n\t\tRoute route = game.getIncidentRoutes();\n\t\tSystem.out.println(route);\n\t\tSystem.out.println(\"Total sailing days required is \"+ game.calculateSailingDays(route)+\" days\");\n\t\tboolean state = false;\n\t\twhile (state == false) {\n\t\t\tSystem.out.println(\"Choose your actions: \");\n\t\t\tSystem.out.println(\"(1) Go back!\");\n\t\t\tSystem.out.println(\"(2) Set Sail\");\n\t\t\ttry { \n\t\t\t\tint selectedAction = scanner.nextInt();\n\t\t\t\tif (selectedAction <= 2 && selectedAction > 0) {\n\t\t\t\tstate = true;\n\t\t\t\tif (selectedAction == 1) {\n\t\t\t\t\tgame.backToMain();\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (game.isIslandReachable(route)) {\n\t\t\t\t\t\tif (game.checkMyShipHealth()) {\n\t\t\t\t\t\t\tgame.payCrew(route);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tSystem.out.println(\"You should repair your ship first!\" + \"\\n\" + \"you will be redirected to store at your current Island\" + \"\\n\");\n\t\t\t\t\t\t\tgame.repairMyShip();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tSystem.out.println(\"This Island is not accessible because you don't have enough days left, you can choose other Island\");\n\t\t\t\t\t\tgame.backToMain();\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t\telse {\n\t\t\t\t\tSystem.out.println(\"Please choose from actions above\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t} catch (Exception e) {\n\t\t\t\tSystem.out.println(INPUT_REQUIREMENTS);\n\t\t\t\tscanner.nextLine();\n\t\t\t}\n\t\t}\n\t\t\n\t}", "void makeService(int loc_temp,int des_temp,ArrayList<Coordinate> path)\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tint last_direction = 0;\r\n\t\t\tint[] shortest_path = new int[6400];\r\n\t\t\tint j_current = loc_temp % 80;\r\n\t\t\tint i_current = loc_temp / 80;\r\n\t\t\tBFS.setShortest(des_temp,shortest_path,BFS.adj_const);\r\n\t\t\tint temp = shortest_path[loc_temp];\r\n\t\t\twhile(temp != -1)\r\n\t\t\t{\r\n\t\t\t\tint length_min = BFS.getShortest(temp, des_temp,BFS.adj_const);\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((i_current-1)>=0 && BFS.adj_const[(i_current-1)*80+j_current][i_current*80+j_current]==1 && Flow.flows[i_current-1][j_current][1]<flow_min)\r\n\t\t\t\t{\r\n\t\t\t\t\tint length_temp = BFS.getShortest((i_current-1)*80+j_current, des_temp, BFS.adj_const);\r\n\t\t\t\t\tif(length_temp <= length_min)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdirection = 0;//up\r\n\t\t\t\t\t\tflow_min = Flow.flows[i_current-1][j_current][1];\r\n\t\t\t\t\t\tlength_min = length_temp;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif((i_current+1)<80 && BFS.adj_const[(i_current+1)*80+j_current][i_current*80+j_current]==1 && Flow.flows[i_current][j_current][1]<flow_min)\r\n\t\t\t\t{\r\n\t\t\t\t\tint length_temp = BFS.getShortest((i_current+1)*80+j_current, des_temp, BFS.adj_const);\r\n\t\t\t\t\tif(length_temp <= length_min)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdirection = 1;//down\r\n\t\t\t\t\t\tflow_min = Flow.flows[i_current][j_current][1];\r\n\t\t\t\t\t\tlength_min = length_temp;\r\n\t\t\t\t\t}\t\r\n\t\t\t\t}\r\n\t\t\t\tif((j_current-1)>=0 && BFS.adj_const[i_current*80+j_current-1][i_current*80+j_current]==1 && Flow.flows[i_current][j_current-1][0]<flow_min)\r\n\t\t\t\t{\t\r\n\t\t\t\t\tint length_temp = BFS.getShortest(i_current*80+j_current-1, des_temp, BFS.adj_const);\r\n\t\t\t\t\tif(length_temp <= length_min)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdirection = 2;//left\r\n\t\t\t\t\t\tflow_min = Flow.flows[i_current][j_current-1][0];\r\n\t\t\t\t\t\tlength_min = length_temp;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\tif((j_current+1)<80 && BFS.adj_const[i_current*80+j_current+1][i_current*80+j_current]==1 && Flow.flows[i_current][j_current][0]<flow_min)\r\n\t\t\t\t{\r\n\t\t\t\t\tint length_temp = BFS.getShortest(i_current*80+j_current+1, des_temp, BFS.adj_const);\r\n\t\t\t\t\tif(length_temp <= length_min)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdirection = 3;//right\r\n\t\t\t\t\t\tflow_min = Flow.flows[i_current][j_current][0];\r\n\t\t\t\t\t\tlength_min = length_temp;\r\n\t\t\t\t\t}\t\r\n\t\t\t\t}\r\n\t\t\t\tLight light = Traffic.findLight(i_current,j_current);\r\n\t\t\t\tif(light != null)\r\n\t\t\t\t{\r\n\t\t\t\t\tboolean first = true;\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\tif(first)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tSystem.out.println(\"Taxi-\" + id + loc + \": Waiting at a traffic light\");\r\n\t\t\t\t\t\t\tfirst = false;\r\n\t\t\t\t\t\t}\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\tSystem.out.println(\"Taxi-\" + id + loc + \": Going through a traffic light\");\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[(i_current-1)*80+j_current][i_current*80+j_current] == 1)//open_road\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tFlow.flows[i_current-1][j_current][1]++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\ti_current -= 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[(i_current+1)*80+j_current][i_current*80+j_current] == 1)//open_road\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tFlow.flows[i_current][j_current][1]++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\ti_current += 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[i_current*80+j_current][i_current*80+j_current-1] == 1)//open_road\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tFlow.flows[i_current][j_current-1][0]++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tj_current -= 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[i_current*80+j_current][i_current*80+j_current+1] == 1)//open_road\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tFlow.flows[i_current][j_current][0]++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tj_current += 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\tloc = new Coordinate(i_current,j_current);\r\n\t\t\t\tpath.add(loc);\r\n\t\t\t\tSystem.out.println(\"Taxi-\" + id + loc);\r\n\t\t\t\ttemp = shortest_path[i_current*80+j_current];\r\n\t\t\t}\t\t\r\n\t\t\tSystem.out.println(\"Passenger\" + passenger.loc + passenger.des + \": Taxi-\" + id + \" arrives at \" + des);\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}", "public ComputingResponse call(){\n\t\tlong tiempoini =System.nanoTime();\n\t\tlog.info(\"Starting DynamicRSA Algorithm\");\n\t\t//Create the response message\n\t\t//It will contain either the path or noPath\n\t\tComputingResponse m_resp=new ComputingResponse();\n\t\tm_resp.setEncodingType(pathReq.getEcodingType());\n\t\t//The request that needs to be solved\n\t\tRequest req=pathReq.getRequestList().get(0);\n\t\t\n\t\t//Request Id, needed for the response\n\t\tlong reqId=req.getRequestParameters().getRequestID();\n\t\tlog.info(\"Request id: \"+reqId+\", getting endpoints\");\n\t\t//Start creating the response\n\t\tResponse response=new Response();\n\t\tRequestParameters rp = new RequestParameters();\n\t\trp.setRequestID(reqId);\n\t\tresponse.setRequestParameters(rp);\n\t\tm_resp.addResponse(response);\n\t\tSSONInfo= new SSONInformation();\n\t\tSSONInfo=((DomainTEDB)ted).getSSONinfo();\n\t\t\n\t\t//esto hay que cambiarlo para poder leer del GENERALIZED END POINTS\n\t\t//if (getObjectType(req.getEndPoints()))\n\t\tEndPoints EP= req.getEndPoints();\n\t\tBandwidthRequested Bw= (BandwidthRequested)req.getBandwidth(); // Objeto bandwidth para saber la demanda de la peticion.\n\t\tObject source_router_id_addr = null;\n\t\tObject dest_router_id_addr = null;\n\n\t\tGraphPath<Object,IntraDomainEdge> gp_chosen=null;\n\t\n\t\tint cs;\n\t\tboolean end=false;//The search has not ended yet\n\t\tint num_labels=0;\n\t\tint m=0;\n\t\tint Bmod=0; // Spectrum efficiency b/s/Hz (Modulation formats: 16-QAM, QPSK)\n\t\t\n\t\tnum_labels = SSONInfo.getNumLambdas();\n\t\tlog.info(\"Num_lambdas \"+num_labels);\n\t\t\n\n\t\tbandwidthToSlotConversion conversion= new bandwidthToSlotConversion();\n\t\t\n\t\t// Conversión Bw a numero de slots en función de la grid.\t\n\t\tif (Bw.getBw()!=0){\n\t\t\tSSONInfo=((DomainTEDB)ted).getSSONinfo();\n\t\t\tcs = SSONInfo.getCs();\n\t\t\tnum_slots=conversion.getNumSlots(Bw.getBw(), cs);\n\t\t}\n\t\t\t\n\t\t/* The set of request-channels will be bounded by the total number of frequency slots\n\t\t* less the number of contiguous frequency slot required for serve the demand plus one.\n\t\t*/\n\t\tlog.info(\"Request num_slots: \"+num_slots);\n\t\tsetChannels = preComp.getTotalSetChannels().get(num_slots-1);\n\n\t\t\n\t\tif (EP.getOT()==ObjectParameters.PCEP_OBJECT_TYPE_ENDPOINTS_IPV4){\n\t\t\tEndPointsIPv4 ep=(EndPointsIPv4) req.getEndPoints();\n\t\t\tsource_router_id_addr=ep.getSourceIP();\n\t\t\tdest_router_id_addr=ep.getDestIP();\n\t\t}else if (EP.getOT()==ObjectParameters.PCEP_OBJECT_TYPE_ENDPOINTS_IPV6){\n\n\t\t}else if (EP.getOT()==ObjectParameters.PCEP_OBJECT_TYPE_GENERALIZED_ENDPOINTS){\n\t\t\tGeneralizedEndPoints gep=(GeneralizedEndPoints) req.getEndPoints();\n\t\t\tif(gep.getGeneralizedEndPointsType()==ObjectParameters.PCEP_GENERALIZED_END_POINTS_TYPE_P2P){\n\t\t\t\tP2PEndpoints p2pep= gep.getP2PEndpoints();\n\t\t\t\tEndPoint sourceep=p2pep.getSourceEndPoint();\n\t\t\t\tEndPoint destep=p2pep.getDestinationEndPoint();\n\t\t\t\tsource_router_id_addr=sourceep.getEndPointIPv4TLV().IPv4address;\n\t\t\t\tdest_router_id_addr=destep.getEndPointIPv4TLV().IPv4address;\n\t\t\t}\n\t\t\tif(gep.getGeneralizedEndPointsType()==ObjectParameters.PCEP_GENERALIZED_END_POINTS_TYPE_P2MP_NEW_LEAVES){\n\t\t\t\tP2MPEndpoints p2mpep= gep.getP2MPEndpoints();\n\t\t\t\tEndPointAndRestrictions epandrest=p2mpep.getEndPointAndRestrictions();\n\t\t\t\tEndPoint sourceep=epandrest.getEndPoint();\n\t\t\t\tsource_router_id_addr=sourceep.getEndPointIPv4TLV().IPv4address;\n\t\t\t\tint cont=0;\n\t\t\t\twhile (cont<=p2mpep.getEndPointAndRestrictionsList().size()){ //esto est� mal\n\t\t\t\t\tepandrest=p2mpep.getEndPointAndRestrictionsList().get(cont);\n\t\t\t\t\tEndPoint destep=epandrest.getEndPoint();\n\t\t\t\t\tsource_router_id_addr=sourceep.getEndPointIPv4TLV().IPv4address;\n\t\t\t\t\tdest_router_id_addr=destep.getEndPointIPv4TLV().IPv4address;\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//Now, check if the source and destination are in the TED.\n\t\tlog.info(\"Source: \"+source_router_id_addr+\"; Destination:\"+dest_router_id_addr);\n\t\tif (!(((ted.containsVertex(source_router_id_addr))&&(ted.containsVertex(dest_router_id_addr))))){\n\t\t\tlog.warn(\"Source or destination are NOT in the TED\");\t\n\t\t\tNoPath noPath= new NoPath();\n\t\t\tnoPath.setNatureOfIssue(ObjectParameters.NOPATH_NOPATH_SAT_CONSTRAINTS);\n\t\t\tNoPathTLV noPathTLV=new NoPathTLV();\n\t\t\tif (!((ted.containsVertex(source_router_id_addr)))){\n\t\t\t\tlog.debug(\"Unknown source\");\t\n\t\t\t\tnoPathTLV.setUnknownSource(true);\t\n\t\t\t}\n\t\t\tif (!((ted.containsVertex(dest_router_id_addr)))){\n\t\t\t\tlog.debug(\"Unknown destination\");\n\t\t\t\tnoPathTLV.setUnknownDestination(true);\t\n\t\t\t}\n\n\t\t\tnoPath.setNoPathTLV(noPathTLV);\n\t\t\tresponse.setNoPath(noPath);\n\t\t\treturn m_resp;\n\t\t}\n\t\t// check if src and dst are the same \n\t\tif (source_router_id_addr.equals(dest_router_id_addr)){\n\t\t\tlog.info(\"Source and destination are the same!\");\n\t\t\tPath path=new Path();\n\t\t\tExplicitRouteObject ero= new ExplicitRouteObject();\n\t\t\tIPv4prefixEROSubobject eroso= new IPv4prefixEROSubobject();\n\t\t\teroso.setIpv4address((Inet4Address)source_router_id_addr);\n\t\t\teroso.setPrefix(32);\n\t\t\tero.addEROSubobject(eroso);\n\t\t\tpath.setEro(ero);\n\t\t\t\n\t\t\tif (req.getMetricList().size()!=0){\n\t\t\t\tMetric metric=new Metric();\n\t\t\t\tmetric.setMetricType(req.getMetricList().get(0).getMetricType() );\n\t\t\t\tlog.debug(\"Number of hops \"+0);\n\t\t\t\tfloat metricValue=0;\n\t\t\t\tmetric.setMetricValue(metricValue);\n\t\t\t\tpath.getMetricList().add(metric);\n\t\t\t}\n\t\t\tresponse.addPath(path);\n\t\t\tlong tiempofin =System.nanoTime();\n\t\t\tlong tiempotot=tiempofin-tiempoini;\n\t\t\tlog.info(\"Ha tardado \"+tiempotot+\" nanosegundos\");\n\t\t\tMonitoring monitoring=pathReq.getMonitoring();\n\t\t\tif (monitoring!=null){\n\t\t\t\tif (monitoring.isProcessingTimeBit()){\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\tm_resp.addResponse(response);\n\t\t\treturn m_resp;\n\t\t\t\n\t\t}\n\n\n\t\tboolean nopath=true;//Initially, we still have no path\n\n\t\tint central_freq=0; // It represents the central frequency slot n.\n\t\t\n\t\tdouble max_metric=Integer.MAX_VALUE;\t\n\t\t\n\t\tpreComp.getGraphLock().lock();\n\t\ttry{\n\t\t\twhile (!end){\n\t\t\t\t//SimpleDirectedWeightedGraph<Object,IntraDomainEdge> graphLambda=preComp.getNetworkGraphs().get(0);\n\t\t\t\tSimpleDirectedWeightedGraph<Object,IntraDomainEdge> graphLambda=preComp.getbaseSimplegraph();\n\t\t\t\t\n\t\t\t\t//networkGraph=PCEPUtils.duplicateTEDDB(((SimpleTEDB)ted).getNetworkGraph());\n//\t\t\t\tSet<IntraDomainEdge> fiberEdges= preComp.getNetworkGraphs().get(0).edgeSet();\n//\t\t\t\tIterator<IntraDomainEdge> Iterator = fiberEdges.iterator();\n//\t\t\t\twhile(Iterator.hasNext()){\n//\t\t\t\tIntraDomainEdge fiberEdge =Iterator.next();\n//\t\t\t\tFuncionesUtiles.printByte(((BitmapLabelSet)fiberEdge.getTE_info().getAvailableLabels().getLabelSet()).getBytesBitMap(), \"Bitmap edge \"+fiberEdge.toString()+\".\", log);\n//\t\t\t\t}\n\t\t\t\tlog.info(\"Antes de DSP\"+preComp.printTopology(0));\n\t\t\t\tModifiedDijkstraSP dsp=new ModifiedDijkstraSP(graphLambda, source_router_id_addr, dest_router_id_addr, Double.POSITIVE_INFINITY, setChannels, num_slots);\n\t\t\t\tlog.info(\"Fin MDSP\");\n\t\t\t\tGraphPath<Object,IntraDomainEdge> gp=dsp.getPath();\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tif (gp==null){\n\t\t\t\t\tlog.debug(\"No path found\");\n\t\t\t\t\tNoPath noPath= new NoPath();\n\t\t\t\t\tnoPath.setNatureOfIssue(ObjectParameters.NOPATH_NOPATH_SAT_CONSTRAINTS);\n\t\t\t\t\tNoPathTLV noPathTLV=new NoPathTLV();\n\t\t\t\t\tnoPath.setNoPathTLV(noPathTLV);\t\t\t\t\n\t\t\t\t\tresponse.setNoPath(noPath);\n\t\t\t\t\tnopath=true;\n\t\t\t\t\treturn m_resp;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tBitmapChannelState valid_channels = new BitmapChannelState(dsp.getVertexSpectrumState().get(dest_router_id_addr).getLength());\n\t\t\t\t\tvalid_channels.setBytesBitmap(dsp.getVertexSpectrumState().get(dest_router_id_addr).getBytesBitmap());\n\t\t\t\t\t\n\t\t\t\t\tfor (int i=0; i<valid_channels.getLength(); i++){\n\t\t\t\t\t\tif ((valid_channels.getBytesBitmap()[i/8]&(0x80>>(i%8))) == (0x80>>i%8)){\n\t\t\t\t\t\t\tBitmapLabelSet chosen_channel=setChannels.get(i);\n\t\t\t\t\t\t\tUtilsFunctions.printByte(chosen_channel.getBytesBitMap(),\"Bitmap Channel \"+i+\">>\", log);\n\t\t\t\t\t\t\tcentral_freq=i+(num_slots+1)/2;\n\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\tif (central_freq!=0){\n\t\t\t\t\t\tgp_chosen=gp;\n\t\t\t\t\t\tmax_metric=gp.getWeight();\n\t\t\t\t\t\tm=(num_slots)/2;\n\t\t\t\t\t\tlog.info(\"Central Frequency\"+central_freq);\n\t\t\t\t\t\tlog.info(\"Frequency width\"+m);\n\t\t\t\t\t\tlog.info(\"Path\"+gp_chosen);\n\t\t\t\t\t\tnopath=false;\n\t\t\t\t\t\tend=true;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tthrow new IllegalArgumentException(\"Invalid central frequency for this request\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfinally{\n\t\t\tpreComp.getGraphLock().unlock();\t\n\t\t}\n\n\t\tif (nopath==false){\n\n\t\t\tPath path=new Path();\n\t\t\tExplicitRouteObject ero= new ExplicitRouteObject();\n\t\t\tList<IntraDomainEdge> edge_list= gp_chosen.getEdgeList();\n\t\t\tint i;\n\t\t\t\n\t\t\tfor (i=0;i<edge_list.size();i++){\n\t\t\t\tUnnumberIfIDEROSubobject eroso= new UnnumberIfIDEROSubobject();\n\t\t\t\teroso.setRouterID((Inet4Address)edge_list.get(i).getSource());\n\t\t\t\teroso.setInterfaceID(edge_list.get(i).getSrc_if_id());\n\t\t\t\teroso.setLoosehop(false);\n\t\t\t\tero.addEROSubobject(eroso);\n\t\t\t\t\n\t\t\t\t//FIXME: Temp, only for HPCE algorithms\n\t\t\t\tpreComp.setReservation(m, (central_freq)+preComp.getWSONInfo().getnMin(), edge_list.get(i).getSource(), edge_list.get(i).getTarget());\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t//ITU-T Format\n\t\t\t\tDWDMWavelengthLabel WDMlabel=new DWDMWavelengthLabel();\n\t\t\t\tWDMlabel.setGrid(preComp.getWSONInfo().getGrid());\n\t\t\t\tWDMlabel.setChannelSpacing(preComp.getWSONInfo().getCs());\n\t\t\t\tWDMlabel.setN((central_freq)+preComp.getWSONInfo().getnMin());\n\t\t\t\tWDMlabel.setIdentifier(0);\n\t\t\t\tWDMlabel.setM(m);\n\t\t\t\ttry {\n\t\t\t\t\tWDMlabel.encode();\n\t\t\t\t} catch (RSVPProtocolViolationException 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\t\tGeneralizedLabelEROSubobject genLabel= new GeneralizedLabelEROSubobject();\n\t\t\t\tero.addEROSubobject(genLabel);\n\t\t\t\tgenLabel.setLabel(WDMlabel.getBytes());\t\n\t\t\t}\n\t\t\t\n\t\t\t//log.info(\"Label bit map: \"+ted.getWSONinfo().getCommonAvailableLabels().getLabelSet().toString());\n\t\t\tBandwidthRequestedGeneralizedBandwidth gb = new BandwidthRequestedGeneralizedBandwidth ();\n\t\t\tpreComp.setTotalBandwidth((m*2*6.25)+preComp.getTotalBandwidth());\n\t\t\t\n\t\t\tGeneralizedBandwidthSSON GB_SSON = new GeneralizedBandwidthSSON(); \n\t GB_SSON.setM(m);\n\t gb.setGeneralizedBandwidth(GB_SSON);\n\n\t\t\t\n\t\t\tIPv4prefixEROSubobject eroso= new IPv4prefixEROSubobject();\n\t\t\teroso.setIpv4address((Inet4Address)edge_list.get(edge_list.size()-1).getTarget());\n\t\t\teroso.setPrefix(32);\n\t\t\tero.addEROSubobject(eroso);\n\t\t\tpath.setEro(ero);\n\t\t\tpath.setBandwidth(gb);\n\t\t\tPCEPUtils.completeMetric(path, req, edge_list);\n\t\t\tresponse.addPath(path);\n\t\t\t\n\t\t\t//FIXME: RESERVATION NEEDS TO BE IMPROVED!!!\n\t\t\tLinkedList<Object> sourceVertexList=new LinkedList<Object>();\n\t\t\tLinkedList<Object> targetVertexList=new LinkedList<Object>();\n\t\t\t\n\t\t\tfor (i=0;i<edge_list.size();i++){\n\t\t\t\tsourceVertexList.add(edge_list.get(i).getSource());\n\t\t\t\ttargetVertexList.add(edge_list.get(i).getTarget());\n\t\t\t}\t\n\t\t\tsourceVertexList.add(edge_list.get(i-1).getSource());\n\t\t\ttargetVertexList.add(edge_list.get(i-1).getTarget());\n\t\t\t\n\t\t\tif (req.getReservation()!=null){\n\t\t\t reserv= new GenericLambdaReservation();\n\t\t\t reserv.setResp(m_resp);\n\t\t\t reserv.setLambda_chosen(central_freq);\n\t\t\t reserv.setBidirectional(req.getRequestParameters().isBidirect());\n\t\t\t reserv.setReservation(req.getReservation());\n\t\t\t reserv.setSourceVertexList(sourceVertexList);\n\t\t\t reserv.setTargetVertexList(targetVertexList);\n\t\t\t //log.info(\"Bidirect = \" +req.getRequestParameters().isBidirect());\n\t\t\t reserv.setReservationManager(reservationManager);\n\t\t\t}\n\t\t\n\t\t}\n\t\tlong tiempofin =System.nanoTime();\n\t\tlong tiempotot=tiempofin-tiempoini;\n\t\tlog.info(\"Ha tardado \"+tiempotot+\" nanosegundos\");\n\t\tlog.info(\"RESPONSE: \"+m_resp.toString());\n\t\treturn m_resp;\n\t}", "public static void main(String[] args) throws Exception {\n final DataModel data = new DataModel();\n GeoApiContext context = new GeoApiContext.Builder().apiKey(\"AIzaSyDWspiiu2xZwfxBCtt4_B9tcdHR-uEZYvY\").build();\n\n long[][] distanceMatrix=null ;\n Gson gson = new Gson();\n String lines = Files.readString(Paths.get(\"out.txt\"), Charset.defaultCharset());\n System.out.println(lines);\n distanceMatrix = gson.fromJson(lines.toString(),long[][].class);\n\n\n data.distanceMatrix = distanceMatrix;\n\n // Create Routing Index Manager\n RoutingIndexManager manager = new RoutingIndexManager(data.distanceMatrix.length, data.vehicleNumber, data.depot);\n\n // Create Routing Model.\n RoutingModel routing = new RoutingModel(manager);\n\n // Create and register a transit callback.\n final int transitCallbackIndex = routing.registerTransitCallback((long fromIndex, long toIndex) -> {\n // Convert from routing variable Index to user NodeIndex.\n int fromNode = manager.indexToNode(fromIndex);\n int toNode = manager.indexToNode(toIndex);\n return data.distanceMatrix[fromNode][toNode];\n });\n\n // Define cost of each arc.\n routing.setArcCostEvaluatorOfAllVehicles(transitCallbackIndex);\n\n // Add Distance constraint.\n routing.addDimension(transitCallbackIndex, 0, 1000000000, true, // start cumul to zero\n \"Distance\");\n RoutingDimension distanceDimension = routing.getMutableDimension(\"Distance\");\n distanceDimension.setGlobalSpanCostCoefficient(100);\n\n // Setting first solution heuristic.\n RoutingSearchParameters searchParameters = main.defaultRoutingSearchParameters().toBuilder()\n .setFirstSolutionStrategy(FirstSolutionStrategy.Value.GLOBAL_CHEAPEST_ARC).build();\n\n // Solve the problem.\n Assignment solution = routing.solveWithParameters(searchParameters);\n\n // Print solution on console.\n printSolution(data, routing, manager, solution);\n }", "private void selectNextPath(boolean inc) {\n\t\tif (this.allPathsList.size() < 1)\n\t\t\treturn;\n\t\tList<GraphPath<PathwayVertexRep, DefaultEdge>> paths = this.allPathsList.get(this.allPathsList.size() - 1)\n\t\t\t\t.getFirst();\n\t\tif (paths.size() > 1) {\n\t\t\t// System.out.println(\"allPaths.size() > 1\");\n\n\t\t\tif (inc)\n\t\t\t\tselectedPathID++;\n\t\t\telse\n\t\t\t\tselectedPathID--;\n\n\t\t\tif (selectedPathID < 0)\n\t\t\t\tselectedPathID = paths.size() - 1;\n\t\t\tif (selectedPathID > paths.size() - 1)\n\t\t\t\tselectedPathID = 0;\n\n\t\t\tif (allPaths.size() > 0) {\n\t\t\t\tselectedPath = paths.get(selectedPathID);\n\t\t\t\t// System.out.println(\"selectedPathID\"+selectedPathID);\n\t\t\t\tif (selectedPath.getEdgeList().size() > 0 && !isShiftKeyDown) {\n\t\t\t\t\tPathwayVertexRep startPrevVertex = selectedPath.getStartVertex();\n\t\t\t\t\tPathwayVertexRep endPrevVertex = selectedPath.getEndVertex();\n\t\t\t\t\tList<DefaultEdge> edgePrevList = selectedPath.getEdgeList();\n\t\t\t\t\tpreviousSelectedPath = new GraphPathImpl<PathwayVertexRep, DefaultEdge>(pathway, startPrevVertex,\n\t\t\t\t\t\t\tendPrevVertex, edgePrevList, 0);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tselectedPathID = 0;\n\t\t}\n\n\t\t// System.out.println(\"selectedPathID=\"+selectedPathID);\n\t\tthis.allPathsList.get(this.allPathsList.size() - 1).setSecond(selectedPathID);\n\t\tisBubbleTextureDirty = true;\n\t\tsetDisplayListDirty();\n\t\ttriggerPathUpdate();\n\t}", "void setRoute(Shape route);", "public interface RoutingAlgorithm {\n public void initMapInfo(int[][] map);\n public int getShortestPath(int start,int end);\n}", "private void recalculateAllRoutes() {\n robotModels.parallelStream().forEach(m -> m.recalculateRoute(target, obstacles));\n }", "public void computeAllPaths(String source)\r\n {\r\n Vertex sourceVertex = network_topology.get(source);\r\n Vertex u,v;\r\n double distuv;\r\n\r\n Queue<Vertex> vertexQueue = new PriorityQueue<Vertex>();\r\n \r\n \r\n // Switch between methods and decide what to do\r\n if(routing_method.equals(\"SHP\"))\r\n {\r\n // SHP, weight of each edge is 1\r\n sourceVertex.minDistance = 0;\r\n vertexQueue.add(sourceVertex);\r\n while(!vertexQueue.isEmpty())\r\n {\r\n u = vertexQueue.remove();\r\n for (String key : u.adjacentVertices.keySet())\r\n {\r\n v = network_topology.get(key);\r\n distuv = u.minDistance + 1;\r\n if(distuv < v.minDistance)\r\n {\r\n v.minDistance = distuv;\r\n v.previous = u;\r\n vertexQueue.add(v);\r\n }\r\n }\r\n \r\n }\r\n \r\n }\r\n \r\n else if (routing_method.equals(\"SDP\"))\r\n {\r\n // SDP, weight of each edge is it's propagation delay\r\n sourceVertex.minDistance = 0;\r\n vertexQueue.add(sourceVertex);\r\n while(!vertexQueue.isEmpty())\r\n {\r\n u = vertexQueue.remove();\r\n for (String key : u.adjacentVertices.keySet())\r\n {\r\n v = network_topology.get(key);\r\n distuv = u.minDistance + u.adjacentVertices.get(key).propDelay;\r\n if(distuv < v.minDistance)\r\n {\r\n v.minDistance = distuv;\r\n v.previous = u;\r\n vertexQueue.add(v);\r\n }\r\n } \r\n }\r\n }\r\n else if (routing_method.equals(\"LLP\"))\r\n {\r\n // LLP, weight each edge is activeCircuits/AvailableCircuits\r\n sourceVertex.minDistance = 0;\r\n vertexQueue.add(sourceVertex);\r\n while(!vertexQueue.isEmpty())\r\n {\r\n u = vertexQueue.remove();\r\n for (String key : u.adjacentVertices.keySet())\r\n {\r\n v = network_topology.get(key);\r\n distuv = Math.max(u.minDistance,u.adjacentGet(key).load());\r\n //System.out.println(u.adjacentGet(key).load());\r\n if(distuv < v.minDistance)\r\n {\r\n v.minDistance = distuv;\r\n v.previous = u;\r\n vertexQueue.add(v);\r\n }\r\n }\r\n }\r\n }\r\n }", "private Route calculate(String fromStation, String toStation) {\n\t\tif (stations==null){\r\n\t\t\tSystem.out.println(\"DEBUG RUN OF DIJKSTRA.\");\r\n\t\t\tstations = new ArrayList<Station>();\r\n\t\t\tcreateDebugMap(stations);\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * Check if the stations exists\r\n\t\t */\r\n\t\tStation startStation = null, endStation = null;\r\n\r\n\t\t// Find starting station\r\n\t\tfor (Station thisStation : stations) {\r\n\t\t\tif (thisStation.stationName.equals(fromStation)) {\r\n\t\t\t\tSystem.out.println(\"Found startStaion in the Database\");\r\n\t\t\t\tstartStation = thisStation;\r\n\t\t\t}\r\n\t\t\tif (thisStation.stationName.equals(toStation)) {\r\n\t\t\t\tSystem.out.println(\"Found endStation in the Database\");\r\n\t\t\t\tendStation = thisStation;\r\n\t\t\t}\r\n\t\t}\r\n\t\t// Station not found. Break\r\n\t\tif (startStation == null || endStation == null) {\r\n\t\t\tSystem.out.println(\"Shit! One of the stations could not be found\");\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * Declare the variables for the algorithm\r\n\t\t */\r\n\r\n\t\t// ArrayList for keeping track of stations we have visited.\r\n\t\tArrayList<Station> visitedStations = new ArrayList<Station>();\r\n\t\t// Array for the DijkstraStations. This type holds the current best cost and best link to it.\r\n\t\tArrayList<DijkstraStation> dijkstraStations = new ArrayList<DijkstraStation>();\r\n\r\n\t\t// The station we are examining neighbors from.\r\n\t\tDijkstraStation currentStation = new DijkstraStation(new Neighbor(startStation, 0, 0), 0, startStation);\r\n\r\n\t\t// PriorityQueue for sorting unvisited DijkstraStations.\r\n\t\tNeighBorDijktstraComparetor Dijkcomparator = new NeighBorDijktstraComparetor();\r\n\t\tPriorityQueue<DijkstraStation> unvisitedDijkstraStations;\r\n\t\tunvisitedDijkstraStations = new PriorityQueue<DijkstraStation>(100, Dijkcomparator);\r\n\r\n\t\t// Variable to keep track of the goal\r\n\t\tboolean goalFound = false; // did we find the goal yet\r\n\t\tint goalBestCost = Integer.MAX_VALUE; // did we find the goal yet\r\n\r\n\t\t// Add the start staion to the queue so that the loop will start with this staiton\r\n\t\tunvisitedDijkstraStations.add(currentStation);\r\n\t\tdijkstraStations.add(currentStation);\r\n\r\n\t\t/***************************\r\n\t\t * The Dijkstra algorithm loop.\r\n\t\t ***************************/\r\n\r\n\t\twhile (!unvisitedDijkstraStations.isEmpty()) {\r\n\t\t\t// Take the next station to examine from the queue and set the next station as the currentStation\r\n\t\t\tcurrentStation = unvisitedDijkstraStations.poll();\r\n\r\n\t\t\tSystem.out.println(\"\\n============= New loop passtrough =============\");\r\n\t\t\tSystem.out.println(\"Analysing neighbors of \" + currentStation.stationRef.stationName + \". Cost to this station is: \" + currentStation.totalCost);\r\n\r\n\t\t\t// Add visited so we dont visit again.\r\n\t\t\tvisitedStations.add(currentStation.stationRef);\r\n\r\n\t\t\t// break the algorithm if the current stations totalcost if bigger than the best cost of the goal\r\n\t\t\tif (goalBestCost < currentStation.totalCost) {\r\n\t\t\t\tSystem.out.println(\"Best route to the goal has been found. Best cost is: \" + goalBestCost\r\n\t\t\t\t\t\t+ \" (To reach current station is: \" + currentStation.totalCost + \")\");\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Check all neighbors from the currentStation to the neighBorQueue so we can examine them\r\n\t\t\tfor (Neighbor thisNeighbor : currentStation.stationRef.neighbors) {\r\n\r\n\t\t\t\t// Skip stations we have already visited\r\n\t\t\t\tif (!visitedStations.contains(thisNeighbor.stationRef)) {\r\n\t\t\t\t\t// If we havent seen this station before\r\n\t\t\t\t\t// Add it to the list of Dijkstrastations and to the PriorityQueue of unvisited stations\r\n\t\t\t\t\tif (getDijkstraStationByID(thisNeighbor.stationRef.stationid, dijkstraStations) == null) {\r\n\t\t\t\t\t\tDijkstraStation thisDijkstraStation = new DijkstraStation(thisNeighbor, currentStation.totalCost\r\n\t\t\t\t\t\t\t\t+ thisNeighbor.cost, currentStation.stationRef);\r\n\t\t\t\t\t\tdijkstraStations.add(thisDijkstraStation);\r\n\t\t\t\t\t\tunvisitedDijkstraStations.offer(thisDijkstraStation);\r\n\r\n\t\t\t\t\t\tif (thisNeighbor.stationRef.equals(endStation)) {\r\n\t\t\t\t\t\t\tgoalFound = true;\r\n\t\t\t\t\t\t\tgoalBestCost = (int) thisDijkstraStation.totalCost;\r\n\t\t\t\t\t\t\tSystem.out.println(\"Goal station found :) Cost to goal is: \" + goalBestCost);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tSystem.out.println(\"New station seen: \" + thisDijkstraStation);\r\n\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// Station has been seen before.\r\n\r\n\t\t\t\t\t\t// Get the station as a DijkstraStation from the array\r\n\t\t\t\t\t\tDijkstraStation thisDijkstraStation = getDijkstraStationByID(thisNeighbor.stationRef.stationid,\r\n\t\t\t\t\t\t\t\tdijkstraStations);\r\n\r\n\t\t\t\t\t\t// Check if the connection is better than the one we already know\r\n\t\t\t\t\t\tif (currentStation.totalCost + thisNeighbor.cost < thisDijkstraStation.totalCost) {\r\n\r\n\t\t\t\t\t\t\t// New best link found\r\n\t\t\t\t\t\t\tSystem.out.println(\"New best route found for \" + thisNeighbor.stationRef.stationName);\r\n\t\t\t\t\t\t\tSystem.out.println(\"Old cost:\" + thisDijkstraStation.totalCost + \", New cost: \"\r\n\t\t\t\t\t\t\t\t\t+ (currentStation.totalCost + thisNeighbor.cost));\r\n\r\n\t\t\t\t\t\t\t// update the cost and via station on the DijkstraStation\r\n\t\t\t\t\t\t\tthisDijkstraStation.updateBestLink((int) (currentStation.totalCost + thisNeighbor.cost),\r\n\t\t\t\t\t\t\t\t\tcurrentStation.stationRef, thisNeighbor);\r\n\r\n\t\t\t\t\t\t\t// if this is the goal station, update the totalCost\r\n\t\t\t\t\t\t\tif (thisNeighbor.stationRef.equals(endStation)) {\r\n\t\t\t\t\t\t\t\tgoalBestCost = (int) thisDijkstraStation.totalCost;\r\n\t\t\t\t\t\t\t\tSystem.out.println(\"Updated cost for the goal to : \" + goalBestCost);\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}\r\n\t\t\t}\r\n\r\n\t\t}// End while\r\n\r\n\t\t// Print the World:\r\n//\t\t System.out.println();\r\n//\t\t System.out.println(\"################# Printing the world ###################\");\r\n//\t\t for (DijkstraStation thisDijkstraStation : dijkstraStations) {\r\n//\t\t System.out.println(thisDijkstraStation.toString());\r\n//\t\t DijkstraStation tempStation = thisDijkstraStation;\r\n//\t\t System.out.print(\"BackTracking route =>\");\r\n//\t\t while (!tempStation.stationRef.equals(startStation)) {\r\n//\t\t System.out.print(\" \" + tempStation.cost + \" to \" + tempStation.viaStation.stationName + \" #\");\r\n//\t\t\r\n//\t\t tempStation = getDijkstraStationByID(tempStation.viaStation.stationid, dijkstraStations);\r\n//\t\t }\r\n//\t\t System.out.print(\" End\");\r\n//\t\t System.out.print(\"\\n\\n\");\r\n//\t\t }\r\n//\r\n\t\tif (goalFound) {\r\n\t\t\tSystem.out.println(\"Generating route to goal\");\r\n\t\t\t// create a route object with all the stations.\r\n\t\t\tRoute routeToGoal = new Route(fromStation, toStation);\r\n\t\t\t// get the goalStation as a DijkstraStation Type\r\n\t\t\tDijkstraStation goalStation = getDijkstraStationByID(endStation.stationid, dijkstraStations);\r\n\r\n\t\t\trouteToGoal.cost = goalStation.totalCost;\r\n\t\t\trouteToGoal.price = (int) goalStation.totalCost;\r\n\r\n\t\t\t// Find the route to the goal\r\n\t\t\tDijkstraStation tempStation = goalStation;\r\n\r\n\t\t\twhile (!tempStation.stationRef.equals(startStation)) {\r\n\t\t\t\t// Add the station to the route table\r\n\t\t\t\tSerializableStation thisStation = new SerializableStation(tempStation.cost, tempStation.cost,\r\n\t\t\t\t\t\ttempStation.stationRef.stationName, tempStation.stationRef.stationid);\r\n\t\t\t\t\r\n\t\t\t\t//Fix region string\r\n\t\t\t\tString regionString=\"\";\r\n\t\t\t\tfor (Integer regionID : tempStation.stationRef.region) {\r\n\t\t\t\t\tregionString.concat(regionID+ \",\");\r\n\t\t\t\t}\t\t\t\t\r\n\t\t\t\tthisStation.region = regionString.substring(0, regionString.length() - 1);\r\n\t\t\t\t\r\n\t\t\t\t//Add the station\r\n\t\t\t\trouteToGoal.route.add(0, thisStation);\r\n\t\t\t\t// Go to the previous station\r\n\t\t\t\ttempStation = getDijkstraStationByID(tempStation.viaStation.stationid, dijkstraStations);\r\n\t\t\t}\r\n\t\t\t// add the starting station\r\n\t\t\tSerializableStation thisStation = new SerializableStation(tempStation.stationRef.latitude, tempStation.stationRef.longitude, tempStation.stationRef.stationName,\r\n\t\t\t\t\ttempStation.stationRef.stationid);\r\n\t\t\trouteToGoal.route.add(0, thisStation);\r\n\r\n\t\t\t// print the route\r\n\t\t\t//System.out.println(\"Printing best route to the Goal:\\n\" + routeToGoal.toString());\r\n\r\n\t\t\treturn routeToGoal;\r\n\t\t}\r\n\r\n\t\treturn null;\r\n\t}", "void setChosenPath(Path path) throws Exception {\r\n\t\t// Changing direction, assume we need to clear current set of choices\r\n\t\tcurrentChoices.clear();\r\n\r\n\t\tsetCurrentPath(path);\r\n\r\n\t\tcurrentTurnIndex++;\r\n\t}", "public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint cities = Integer.parseInt(sc.nextLine());\n\t\tint roads = Integer.parseInt(sc.nextLine());\n\n EdgeWeightedGraph graphObj = new EdgeWeightedGraph(cities);\n for (int i = 0; i < roads; i++) {\n String way = sc.nextLine();\n String[] tokens = way.split(\" \");\n graphObj.addEdge(new Edge(Integer.parseInt(tokens[0]),\n Integer.parseInt(tokens[1]), Double.parseDouble(tokens[2])));\n }\n\n\t\tString caseToGo = sc.nextLine();\n\t\tswitch (caseToGo) {\n\t\tcase \"Graph\":\n\t\t\t//Print the Graph Object.\n\t\t System.out.println(graphObj);\n\t\t\tbreak;\n\n\t\tcase \"DirectedPaths\":\n\t\t\t// Handle the case of DirectedPaths, where two integers are given.\n\t\t\t// First is the source and second is the path[1].\n\t\t\t// If the path exists print the distance between them.\n\t\t\t// Other wise print \"No Path Found.\"\n\t\t String[] path = sc.nextLine().split(\" \");\n\t\t int source = Integer.parseInt(path[0]);\n\t\t int destiny = Integer.parseInt(path[1]);\n\t\t\tDijkstraUndirectedSP pathObj = new DijkstraUndirectedSP(graphObj, source);\n\t\t\tif(pathObj.hasPathTo(destiny)) {\n\t\t\t\tSystem.out.println(pathObj.distTo(destiny));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(\"No Path Found.\");\n\t\t\t}\n\n\t\t\tbreak;\n\n\t\tcase \"ViaPaths\":\n\t\t\t// Handle the case of ViaPaths, where three integers are given.\n\t\t\t// First is the source and second is the via is the one where path should pass throuh.\n\t\t\t// third is the path[1].\n\t\t\t// If the path exists print the distance between them.\n\t\t\t// Other wise print \"No Path Found.\"\n\t\t String[] path1 = sc.nextLine().split(\" \");\n\t\t int source1 = Integer.parseInt(path1[0]);\n\t\t int via = Integer.parseInt(path1[1]);\n\t\t int destiny1 = Integer.parseInt(path1[2]);\n\n\t\t\tDijkstraUndirectedSP path1Obj = new DijkstraUndirectedSP(graphObj, source1);\n\t\t\tif(path1Obj.hasPathTo(via)) {\n\n\t\t\t\tDijkstraUndirectedSP viaObj = new DijkstraUndirectedSP(graphObj, via);\n\t\t\t\tif(viaObj.hasPathTo(destiny1)) {\n\t\t\t\t\tdouble dist = path1Obj.distTo(via);\n\t\t\t\t\tdist += viaObj.distTo(destiny1);\n\t\t\t\t\tSystem.out.println(dist);\n\n\t\t\t\tList<Integer> arraylist = new List<Integer>();\n\t\t\t\t\tString srcvia = path1Obj.pathTo(via)+\"\"+viaObj.pathTo(destiny1);\n\t\t\t\t\t//System.out.println(srcvia);\n\t\t\t\t \tString[] temp = srcvia.split(\" \");\n\t\t\t\t \tString[] temp1 = temp[0].split(\"-\");\n\t\t\t\t \tString[] temp2 = temp[2].split(\"-\");\n\t\t\t\t \tString[] temp3 = temp[4].split(\"-\");\n\t\t\t\t \tString[] temp4 = temp[6].split(\"-\");\n\t\t\t\t \tString[] temp5 = temp[8].split(\"-\");\n\n\t\t\t\t// \tString[] val = temp[1].split(\" \");\n\t\t\t\t \tarraylist.add(Integer.parseInt(temp1[1]));\n\t\t\t\t\tarraylist.add(Integer.parseInt(temp1[0]));\n\t\t\t\t\tarraylist.add(Integer.parseInt(temp3[1]));\n\t\t\t\t\tarraylist.add(Integer.parseInt(temp3[0]));\n\t\t\t\t\tarraylist.add(Integer.parseInt(temp5[1]));\n\t\t\t\t\tarraylist.add(Integer.parseInt(temp5[0]));\n\n\n\n\n\n\n\t\t\t\tSystem.out.println(arraylist);\n\n\n\n\t\t\t\t\t//System.out.println(path1Obj.pathTo(via)+\"\"+viaObj.pathTo(destiny1));\n\t\t\t}\n\n\n\t\t\telse {\n\t\t\t\tSystem.out.println(\"No Path Found.\");\n\t\t\t}\n\t\t}\n\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\n\t}", "public interface PathCalculationStrategy {\n\t\n\t/**\n\t * Returns the shortest path for a Journey.\n\t * \n\t * @param grid the traffic grid.\n\t * @param src the source location.\n\t * @param dest the destination location.\n\t * \n\t * @return a List containing the path for the Journey.\n\t */\n\tList<Point> getPath(int grid[][], Point src, Point dest);\n}", "@Override\r\n\tpublic Answer handle(Request request) throws Exception {\r\n\t\tGPS startPoint = request.getStartPos();\r\n\t\tGPS endPoint = request.getEndPos();\r\n\t\tCurrentDistribution curDis = CurrentDistribution.getInstance();\r\n\t\tArrayList<Station> givenTypeAvaStations = null;// whether this init is a correct choice in case that ArrayList can not be covered directly \r\n\t\tdouble ridingSpeed = 0.00001;//if not given proper bicycle type, time cost would be extremely large\r\n\t\tif(request.getBikeType().equalsIgnoreCase(\"E\")) {\r\n\t\t\tridingSpeed = Server.eleRidingSpeed;\r\n\t\t\tgivenTypeAvaStations = curDis.geteAvaStationList();\r\n\t\t}\r\n\t\t\r\n\t\tif(request.getBikeType().equalsIgnoreCase(\"M\")) {\r\n\t\t\tridingSpeed = Server.mecRidingSpeed;\r\n\t\t\tgivenTypeAvaStations = curDis.getmAvaStationList();\r\n\t\t}\r\n\r\n\t\tif(givenTypeAvaStations.size() == 0) {\r\n\t\t\tServer.error(\"no available station containing given type of bicycle\");\r\n\t\t}\r\n\r\n\t\tStation minStartStation = givenTypeAvaStations.get(0);\r\n\t\tStation minEndStation = curDis.getReturnableStationList().get(0);\r\n\t\t\r\n\t\tdouble minEndDis = Math.sqrt((minEndStation.getPos().getX() - endPoint.getX()) * (minEndStation.getPos().getX() - endPoint.getX()) + \r\n\t\t\t\t(minEndStation.getPos().getY() - endPoint.getY())*(minEndStation.getPos().getY() - endPoint.getY()));\r\n\t\t\r\n\t\tfor(Station s: curDis.getReturnableStationList()) {\r\n\t\t\tdouble endDis = Math.sqrt((s.getPos().getX() - endPoint.getX())*(s.getPos().getX() - endPoint.getX()) + \r\n\t\t\t\t\t(s.getPos().getY() - endPoint.getY()) * (s.getPos().getY() - endPoint.getY()));\r\n\t\t\tif( endDis < minEndDis) {\r\n\t\t\t\tminEndStation = s;\r\n\t\t\t\tminEndDis = endDis; \r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tdouble minWalkRideTime = Math.sqrt((minStartStation.getPos().getX() - startPoint.getX()) * (minStartStation.getPos().getX() - startPoint.getX())+\r\n\t\t\t\t(minStartStation.getPos().getY() - startPoint.getY()) * (minStartStation.getPos().getY() - startPoint.getY()))/\r\n\t\t\t\tServer.walkingSpeed +\r\n\t\t\t\t(Math.abs(minStartStation.getPos().getX() - endPoint.getX())+ \r\n\t\t\t\t\t\tMath.abs(minStartStation.getPos().getY() - endPoint.getY()))/\r\n\t\t\t\tridingSpeed;\r\n\t\t\r\n\t\tfor(Station s: givenTypeAvaStations) {\r\n\t\t\tdouble walkRideTime = Math.sqrt((s.getPos().getX() - startPoint.getX()) * (s.getPos().getX() - startPoint.getX())+\r\n\t\t\t\t\t(s.getPos().getY() - startPoint.getY()) * (s.getPos().getY() - startPoint.getY()))/\r\n\t\t\t\t\tServer.walkingSpeed +\r\n\t\t\t\t\t(Math.abs(s.getPos().getX() - endPoint.getX())+ \r\n\t\t\t\t\t\t\tMath.abs(s.getPos().getY() - endPoint.getY()))/\r\n\t\t\t\t\tridingSpeed;\r\n\t\t\tif( walkRideTime < minWalkRideTime) {\r\n\t\t\t\tminStartStation = s;\r\n\t\t\t\tminWalkRideTime = walkRideTime; \r\n\t\t\t}\r\n\t\t}\t\t\t\r\n\r\n\t\tdouble minStartDis = Math.sqrt((minStartStation.getPos().getX() - startPoint.getX())*(minStartStation.getPos().getX() - startPoint.getX())\r\n\t\t\t\t+ (minStartStation.getPos().getY() - startPoint.getY())*(minStartStation.getPos().getY() - startPoint.getY()));\r\n\t\tdouble minRideDis = (Math.abs(minStartStation.getPos().getX() - minEndStation.getPos().getX())+ \r\n\t\t\t\tMath.abs(minStartStation.getPos().getY() - minEndStation.getPos().getY()));\r\n\t\tdouble minTime = (minEndDis + minStartDis)/ Server.walkingSpeed + minRideDis/ridingSpeed;\r\n\t\tdouble minDis = minStartDis + minEndDis + minRideDis;\r\n\t\tif(minTime > 500) {\r\n\t\t\tthrow new Exception(\"BikeType input illegal.\");\r\n\t\t}\r\n\t\t\r\n\t\tAnswer ans = new Answer(minStartStation, minEndStation, minTime, minDis);\r\n\t\treturn ans;\r\n\t}", "public interface IPathFinderProvider {\n\t\n /**\n * Method for creating a new Maze Path Finder.\n * \n * @param mazeModel to solve\n * @return Used to solve maze\n */\n public IMazePathFinder createInstance(MazeModel mazeModel);\n}", "private void buildRoutes(String type) {\r\n\t\tswitch (type.charAt(0)) {\r\n\t\tcase 'F':\r\n\t\t\tthis.wwd.firePropertyChange(\"step\", \"\", \"Création des routes FIR\");\r\n\t\t\tbreak;\r\n\t\tcase 'U':\r\n\t\t\tthis.wwd.firePropertyChange(\"step\", \"\", \"Création des routes UIR\");\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}", "private void routeDrawing(Location location) {\n\n // validity check in case the first point does not have a previous point\n if (previousLocation == null) {\n // copy the current location to the previous point\n previousLocation = location;\n }\n double lat = location.getLatitude();\n double lon = location.getLongitude();\n\n latitude = lat;\n longitude = lon;\n latList.add(latitude);\n lonList.add(longitude);\n\n // previous coordinates\n //System.out.println(\"previous Location: \" + previousLocation.getLatitude() + \" \" + previousLocation.getLongitude());\n // current coordinates\n //System.out.println(\"Current Location: \" + location.getLatitude() + \" \" + location.getLongitude());\n\n // Polyline Options differ from\n PolylineOptions lineOptions = new PolylineOptions();\n // set the option of each part of polyline\n // 0.03 is the location update interval also the drawing interval\n vdraw = (GetDistance(previousLocation.getLatitude(), previousLocation.getLongitude(), location.getLatitude(), location.getLongitude()))/0.3;\n System.out.println(\"vdraw: \"+vdraw);\n if (vdraw<0.01){\n\n lineOptions.add(new LatLng(previousLocation.getLatitude(), previousLocation.getLongitude()))\n .add(new LatLng(location.getLatitude(), location.getLongitude()))\n // This needs to be beautified\n .color(getResources().getColor(R.color.slow))\n .width(30);\n System.out.print(\"I am running slow\");\n }\n if (vdraw>=0.008 && vdraw<=0.03){\n lineOptions.add(new LatLng(previousLocation.getLatitude(), previousLocation.getLongitude()))\n .add(new LatLng(location.getLatitude(), location.getLongitude()))\n // This needs to be beautified\n .color(getResources().getColor(R.color.commen))\n .width(30);\n System.out.print(\"I am running normally\");\n }\n if (vdraw>0.03){\n lineOptions.add(new LatLng(previousLocation.getLatitude(), previousLocation.getLongitude()))\n .add(new LatLng(location.getLatitude(), location.getLongitude()))\n // This needs to be beautified\n .color(getResources().getColor(R.color.fast))\n .width(30);\n System.out.print(\"I am running fast\");\n }\n\n // add the polyline to the map\n Polyline partOfRunningRoute = mMap.addPolyline(lineOptions);\n // set the zindex so that the poly line stays on top of my tile overlays\n partOfRunningRoute.setZIndex(1000);\n // add the poly line to the array so they can all be removed if necessary\n runningRoute.add(partOfRunningRoute);\n // add the latlng from this point to the array\n points.add(location);\n // store current location as previous location in the end\n previousLocation = location;\n }", "private static void menuSelector(){\r\n\t\tint answer= getNumberAnswer();\r\n\t\tswitch (answer) {\r\n\t\tcase 0:\r\n\t\t\tshowShapeInfo(shapes[0]);\r\n\t\t\tbreak;\r\n\t\tcase 1:\r\n\t\t\tcreateShape();\r\n\t\t\tbreak;\r\n\t\tcase 2:\r\n\t\t\tSystem.out.println(\"Its Perimeter is equal to: \" +calcShapePerimeter(shapes[0]));\r\n\t\t\tbreak;\r\n\t\tcase 3:\r\n\t\t\tSystem.out.println(\"Its Area is equal to: \" +calcShapeArea(shapes[0]));\r\n\t\t\tbreak;\r\n\t\tcase 4:\r\n\t\t\tSystem.out.println(\"Provide integer to use for scaling shape: \");\r\n\t\t\tscaleShape(shapes[0], getNumberAnswer());\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tSystem.out.println(\"That's not actually an option.\");\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}", "private void findPath2(List<Coordinate> path) {\n List<Integer> cost = new ArrayList<>(); // store the total cost of each path\n // store all possible sequences of way points\n ArrayList<List<Coordinate>> allSorts = new ArrayList<>();\n int[] index = new int[waypointCells.size()];\n for (int i = 0; i < index.length; i++) {// generate the index reference list\n index[i] = i;\n }\n permutation(index, 0, index.length - 1);\n for (Coordinate o1 : originCells) {\n for (Coordinate d1 : destCells) {\n for (int[] ints1 : allOrderSorts) {\n List<Coordinate> temp = getOneSort(ints1, waypointCells);\n temp.add(0, o1);\n temp.add(d1);\n int tempCost = 0;\n for (int i = 0; i < temp.size() - 1; i++) {\n Graph graph = new Graph(getEdge(map));\n Coordinate start = temp.get(i);\n graph.dijkstra(start);\n Coordinate end = temp.get(i + 1);\n graph.printPath(end);\n tempCost = tempCost + graph.getPathCost(end);\n if (graph.getPathCost(end) == Integer.MAX_VALUE) {\n tempCost = Integer.MAX_VALUE;\n break;\n }\n }\n cost.add(tempCost);\n allSorts.add(temp);\n }\n }\n }\n System.out.println(\"All sorts now have <\" + allSorts.size() + \"> items.\");\n List<Coordinate> best = allSorts.get(getMinIndex(cost));\n generatePath(best, path);\n setSuccess(path);\n }", "static private void npcPath() {\n\n if (Time.secondsPassed % 45 == 44) {\n Random picker = new Random();\n while (true) {\n if (josephSchnitzel.getCurrentRoom().equals(mountain)) {\n String[] newRoomString = {\"south\"};\n int index = picker.nextInt(newRoomString.length);\n Room next = josephSchnitzel.getCurrentRoom().getExit(newRoomString[index]);\n josephSchnitzel.setCurrentRoom(next);\n break;\n }\n\n if (josephSchnitzel.getCurrentRoom().equals(beach)) {\n String[] newRoomString = {\"north\"};\n int indexOfNewRoomString = picker.nextInt(newRoomString.length);\n Room nextRoom = josephSchnitzel.getCurrentRoom().getExit(newRoomString[indexOfNewRoomString]);\n josephSchnitzel.setCurrentRoom(nextRoom);\n break;\n }\n\n if (josephSchnitzel.getCurrentRoom().equals(jungle)) {\n String[] newRoomString = {\"north\", \"south\"};\n int indexOfNewRoomString = picker.nextInt(newRoomString.length);\n Room nextRoom = josephSchnitzel.getCurrentRoom().getExit(newRoomString[indexOfNewRoomString]);\n josephSchnitzel.setCurrentRoom(nextRoom);\n break;\n }\n }\n }\n }", "private void computePathsForNode(Station curr, Route route, Trip trip, List<Station> visited)\n {\n if (visited.contains(curr)) return; // cycle detected\n\n visited.add(curr); // add current station to visited list\n\n if (route != null) // this is not the source node\n {\n if (trip == null)\n {\n trip = new Trip();\n trip.addHop(route);\n this.tripList.add(trip);\n }\n else\n {\n if (trip.getHopCount() > 0)\n {\n // Intermediate paths within a larger traversal path.\n // Add all the routes from the original traversal and add the current route at the end.\n // This generates all the sub-paths in a traversal.\n Trip newTrip = new Trip();\n for (Route hop : trip.getHops())\n newTrip.addHop(hop);\n\n tripList.add(newTrip);\n }\n\n // original traversal path\n trip.addHop(route);\n }\n }\n\n // if any outbound routes exist, proceed with the next set of nodes in a depth-first manner\n List<Route> outbound = this.graph.getOutboundRoutes(curr);\n if (outbound != null)\n {\n while (!outbound.isEmpty())\n {\n Route outRoute = outbound.remove(0);\n computePathsForNode(outRoute.destination, outRoute, trip, new ArrayList<Station>(visited));\n }\n }\n if (trip != null)\n {\n trip.removeLastHop(); // remove the hop from the trip list\n }\n\n }", "private void processDetect(String destinationIP) {\n WeightedGraph graph = WeightedGraph.createFromLSD(this.routerDesc, this.lsd);\n WeightedGraph.Vertex root = graph.getVertex(this.routerDesc.simulatedIPAddress);\n WeightedGraph.Vertex target = graph.getVertex(destinationIP);\n\n if(target == null) {\n LOG.info(\"No target found\");\n return;\n }\n\n graph.execute(root);\n\n List<WeightedGraph.Vertex> path = graph.getPath(target);\n if(path == null) {\n LOG.info(\"No path found\");\n } else {\n WeightedGraph.Vertex from = null;\n StringBuilder pathBuild = new StringBuilder();\n\n for(WeightedGraph.Vertex v : path) {\n if(from != null) {\n WeightedGraph.Edge e = graph.getEdge(from, v);\n pathBuild.append(\" ->(\").append(e.cost).append(\") \");\n }\n\n pathBuild.append(v.value + \" \");\n from = v;\n }\n\n LOG.info(pathBuild.toString());\n }\n }", "public int Simulate()\r\n {\r\n return town.planRoute();\r\n }", "public void managePlayOptions() {\n\n Object mySavedGameState = GameStateFileStore.ReadObjectFromFile(\"GameState.ser\");\n GameState castedGameState = GameState.class.cast(mySavedGameState);\n currentLocation = castedGameState.getSavedPlayerLocation();\n LocationData[][] storedGameStateMap = castedGameState.getMapState();\n descriptionText = storedGameStateMap[currentLocation.x][currentLocation.y].getDescriptionText();\n System.out.println(descriptionText);\n\n AvailableMovements myMoveSet = new AvailableMovements(currentLocation, storedGameStateMap);\n myMoveSet.printStringDirections();\n availableDirections = myMoveSet.getDirectionalMap();\n choice = sc.nextLine();\n if (availableDirections.containsKey(choice)) {\n currentLocation = availableDirections.get(choice); //refactor this into walkToNewLocation\n castedGameState.setSavedPlayerLocation(currentLocation);\n GameStateFileStore.WriteObjectToFile(castedGameState);\n managePlayOptions();\n } else {\n System.out.println(\"Invalid option\");\n managePlayOptions();\n }\n\n }", "void btnGenerateRoute();", "public void run() {\n\t\tSolver localSolver;\n\t\t\n\t\t// Run forever\n\t\t// This is a daemon thread and should not keep the program from terminating\n\t\twhile (true) {\n\t\t\t\n\t\t\t// Check if paused\n\t\t\t// Wait here if required\n\t\t\tsynchronized(this) {\n\t\t\t\tif (paused) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\twait();\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t}\n\t\t\t\t\tcontinue; // Go back to top of while loop\n\t\t\t\t} else {\n\t\t\t\t\t\n\t\t\t\t\t// Make a copy of the solver to use\n\t\t\t\t\t// Cannot access solver value outside synchronised section\n\t\t\t\t\tlocalSolver = solver;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// Run solver\n\t\t\t// Must not use any values which require synchronisation\n\t\t\t//System.out.println(\"Start \"+localSolver.getType());\n\t\t\tRoute[] newRoute = localSolver.run();\n\t\t\t//System.out.println(\"Finish\");\n\t\t\t\n\t\t\t// Get the total cost of all the routes combined\n\t\t\tint newTotalCost = 0;\n\t\t\tfor (Route r : newRoute) newTotalCost += r.getCost();\n\t\t\t\n\t\t\t// Check if new route is better than previous\n\t\t\t// If so then swap it out\n\t\t\tsynchronized(this) {\n\t\t\t\tif (localSolver == solver) {\n\t\t\t\t\tif ((totalCost >= newTotalCost) || (totalCost < 1)) {\n\t\t\t\t\t\troute = newRoute;\n\t\t\t\t\t\ttotalCost = newTotalCost;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tresetRoute();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public List<Vertex> newPath() {\r\n\t\tList<Vertex> Pathchange = new ArrayList<Vertex>();\r\n\t\tList<Vertex> tempPath = new ArrayList<Vertex>();\r\n\t\tint BestEval = Integer.MAX_VALUE;\r\n\t\tVertex changeVertexV1 = new Vertex();\r\n\t\tVertex changeVertexV2 = new Vertex();\r\n\r\n\t\tfor (int position = 0; position < this.LastPath.size() - 1; position++) {\r\n\t\t\tfor (int changement = position+1; changement < this.LastPath.size(); changement++) {\r\n\r\n\t\t\t\ttempPath.clear();\r\n\t\t\t\ttempPath = new ArrayList<Vertex>(this.LastPath);\r\n\t\t\t\tif (!(this.TabuListV1.contains(tempPath.get(position)) || this.TabuListV1.contains(tempPath.get(changement)) || this.TabuListV2.contains(tempPath.get(position)) || this.TabuListV2.contains(tempPath.get(changement)))) {\r\n\t\t\t\t\t\r\n\t\t\t\t\tCollections.swap(tempPath, position, changement);\r\n\t\t\t\t\tif (this.fit(tempPath) < BestEval) {\r\n\t\t\t\t\t\tPathchange.clear();\r\n\t\t\t\t\t\tPathchange = new ArrayList<Vertex>(tempPath);\r\n\t\t\t\t\t\tchangeVertexV1 = tempPath.get(position);\r\n\t\t\t\t\t\tchangeVertexV2 = tempPath.get(changement);\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\tif(this.tabuElementType == 0) {\r\n\t\t\tthis.TabuListV1.add(0, changeVertexV1);\r\n\t\t}else if(this.tabuElementType == 1) {\r\n\t\t\tthis.TabuListV2.add(0, changeVertexV2);\r\n\t\t}else {\r\n\t\t\tthis.TabuListV1.add(0, changeVertexV1);\r\n\t\t\tthis.TabuListV2.add(0, changeVertexV2);\r\n\t\t}\r\n\t\t\r\n\t\tif (this.TabuListV1.size() > this.TabuListSize) {\r\n\t\t\tthis.TabuListV1.remove(this.TabuListV1.size() - 1);\r\n\t\t}\r\n\t\tif (this.TabuListV2.size() > this.TabuListSize) {\r\n\t\t\tthis.TabuListV2.remove(this.TabuListV2.size() - 1);\r\n\t\t}\r\n\r\n\t\treturn Pathchange;\r\n\t}", "@Listen(\"onClick = #selectModel\")\n\tpublic void selectModel(){\n\t\ttreeModel.setOpenObjects(List.of(treeModel.getRoot().getChildren().get(path[0])));\n\t\ttreeModel.addToSelection(treeModel.getChild(path));\n\t}", "public void chooseMenuOption(Number[] options) {\r\n for (int i = 0; i < options.length; i++) {\r\n switch (options[i].intValue()) {\r\n case 0:\r\n //returns the entered from console Number array corresponding to specific input colour\r\n Number[] numbers = chooseParameters(INTEGER_DELIMITERS, View.INPUT_COLOUR, true);\r\n //if there are any values corresponding to the ordinal of Colour enum,\r\n // the predicate chaining is passed to the model\r\n model.setFilterPredicate(s -> findNumberInArray(numbers, s.getColour().ordinal()));\r\n break;\r\n case 1:\r\n numbers = chooseParameters(INTEGER_DELIMITERS, View.MATERIAL_RANGE, true);\r\n model.setFilterPredicate(s -> findNumberInArray(numbers, s.getMaterial().ordinal()));\r\n break;\r\n case 2:\r\n numbers = chooseParameters(INTEGER_DELIMITERS, View.CUT_RANGE, true);\r\n model.setFilterPredicate(s -> findNumberInArray(numbers, s.getCut().ordinal()));\r\n break;\r\n case 3:\r\n numbers = chooseParameters(DOUBLE_DELIMITERS, View.WEIGHT_RANGE, false);\r\n model.setFilterPredicate(s -> findNumberInArray(numbers, s.getWeight()));\r\n break;\r\n case 4:\r\n numbers = chooseParameters(INTEGER_DELIMITERS, View.CLARITY_RANGE, true);\r\n model.setTranspFilterPredicate(s -> findNumberInArray(numbers, s.getClarity()));\r\n break;\r\n case 5:\r\n view.printMessage(View.BREAK);\r\n return;\r\n }\r\n }\r\n model.build();\r\n view.printMessage(View.SELECTED_GEMS + model.getChain() +\r\n View.NECKLACE_WEIGHT + model.calculateWeight() +\r\n View.NECKLACE_PRICE + model.calculatePrice());\r\n model.sortGems();\r\n view.printMessage(View.SORT_ON_PRICE + model.getChain());\r\n\r\n }", "public static ArrayList<XYLocation> findPath2(String CHAR1, String CHAR2,CampusRouteFindingModel campusModel) {\n\t\t ArrayList<XYLocation> retrn = new ArrayList<XYLocation>();\n\t\t graph<String, Float> g = campusModel.getGraph();\n\t\t Map<String, String> idFirst = campusModel.getName();\n\t\t Map<String,String> nameFirst = campusModel.getID();\n\t\t Map<String, XYLocation> locations = campusModel.getLocations();\n\t\t if(!(nameFirst.containsKey(CHAR1))&&(!(idFirst.containsKey(CHAR1)))) { \n\t\t\t if(!(nameFirst.containsKey(CHAR2))&&(!(idFirst.containsKey(CHAR2)))) {\n\t\t\t\t if (CHAR1.equals(CHAR2)) {\n\t\t\t\t\t retrn.add(locations.get(CHAR1));\n\t\t\t\t\t return retrn;\n\t\t\t\t }\n\t\t\t\t retrn.add(locations.get(CHAR1));\n\t\t\t\t retrn.add(locations.get(CHAR2));\n\t\t\t\t return retrn;\n\t\t\t }\n\t\t\t retrn.add(locations.get(CHAR1));\n\t\t\t return retrn;\n\t\t\t}\n\t\t\tif(!(nameFirst.containsKey(CHAR2))&&(!(idFirst.containsKey(CHAR2)))) {\n\t\t\t\tretrn.add(locations.get(CHAR2));\n\t\t\t\treturn retrn;\n\t\t\t}\n\t\tif (nameFirst.containsKey(CHAR1)) {\n\t\t\tCHAR1 = nameFirst.get(CHAR1);\n\t\t}\n\t\tif (nameFirst.containsKey(CHAR2)) {\n\t\t\tCHAR2 = nameFirst.get(CHAR2);\n\t\t}\n\t\tretrn.add(locations.get(CHAR1));\n\t\tif (!(CHAR1.equals(CHAR2))) {\n\t\t\tArrayList<edges<String, Double>> tmp = Dijkstra(CHAR1,CHAR2,g);\n\t\t\tif (tmp==null) {\n\t\t\t\tretrn.add(locations.get(CHAR1));\n\t\t\t\tretrn.add(locations.get(CHAR1));\n\t\t\t\treturn retrn;\n\t\t\t}\n\t\t\tIterator<edges<String, Double>> print = tmp.iterator();\n\t\t\tprint.next();\n\t\t\twhile (print.hasNext()) {\n\t\t\t\tedges<String, Double> temp = print.next();\n\t\t\t\tretrn.add(locations.get(temp.getDest()));\n\t\t\t}\n\t\t}\n\t\treturn retrn;\n\t}", "public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint cities = sc.nextInt();\n\t\tint roadlines = sc.nextInt();\n\t\tsc.nextLine(); // for reading string in nextline\n\t\tEdgeWeightedGraph edge = new EdgeWeightedGraph(cities);\n\t\t// The Time Complexity is O(E)\n\t\t// The road lines is the number of edges\n\t\tfor (int i = 0; i < roadlines; i++) {\n\t\t\tString[] tokens = sc.nextLine().split(\" \");\n\t\t\tedge.addEdge(new Edge(Integer.parseInt(tokens[0]), Integer.parseInt(tokens[1]),\n\t\t\t\tDouble.parseDouble(tokens[2])));\n\t\t}\n\t\tString caseToGo = sc.nextLine();\n\t\tswitch (caseToGo) {\n\t\tcase \"Graph\":\n\t\t\t//Print the Graph Object.\n\t\t\tSystem.out.println(edge);\n\t\t\tbreak;\n\n\t\tcase \"DirectedPaths\":\n\t\t\t// Handle the case of DirectedPaths, where two integers are given.\n\t\t\t// First is the source and second is the destination.\n\t\t\t// If the path exists print the distance between them.\n\t\t\t// Other wise print \"No Path Found.\"\n\t\t\tString[] input = sc.nextLine().split(\" \");\n\t\t\tDijkstraSP shortest = new DijkstraSP(\n edge, Integer.parseInt(input[0]));\n double distance = shortest.distTo(Integer.parseInt(input[1]));\n // The time complexity is O(1)\n if (!shortest.hasPathTo(Integer.parseInt(input[1]))) {\n \tSystem.out.println(\"No Path Found.\");\n } else {\n \tSystem.out.println(distance);\n }\n\t\t\tbreak;\n\n\t\tcase \"ViaPaths\":\n\t\t\t// Handle the case of ViaPaths, where three integers are given.\n\t\t\t// First is the source and second is the via is the one where path should pass throuh.\n\t\t\t// third is the destination.\n\t\t\t// If the path exists print the distance between them.\n\t\t\t// Other wise print \"No Path Found.\"\n\t\t\tString[] str1 = sc.nextLine().split(\" \");\n\t\t\tboolean flag1 = false;\n\t\t\tboolean flag2 = false;\n\t\t\tdouble distance1 = 0.0;\n\t\t\tdouble distance2 = 0.0;\n\t\t\tDijkstraSP shortest1 = new DijkstraSP(edge, Integer.parseInt(str1[0]));\n\t\t\t// Time Complexity: O(1)\n\t\t\tif (shortest1.hasPathTo(Integer.parseInt(str1[1]))) {\n\t\t\t\tflag1 = true;\n\t\t\t\tdistance1 = shortest1.distance(Integer.parseInt(str1[1]));\n\t\t\t}\n\t\t\tDijkstraSP shortest2 = new DijkstraSP(edge, Integer.parseInt(str1[1]));\n\t\t\t// Time Complexity: O(1)\n\t\t\tif (shortest2.hasPathTo(Integer.parseInt(str1[2]))) {\n\t\t\t\tflag2 = true;\n\t\t\t\tdistance2 = shortest2.distance(Integer.parseInt(str1[2]));\n\t\t\t}\n\t\t\tdouble Distance = distance1 + distance2;\n\t\t\t// Time Complexity: O(1)\n\t\t\tif (flag1 && flag2) {\n\t\t\t// Displays output upto 1 decimal point\n\t\t\tSystem.out.format(\"%.1f\", Distance);\n\t\t\t} else {\n\t\t\t\tSystem.out.println(\"No Path Found.\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tSystem.out.println();\n ArrayList<Integer> path = new ArrayList<>();\n for (Edge eachlink : shortest1.pathTo(Integer.parseInt(str1[1]))) {\n int either = eachlink.either();\n int other = eachlink.other(eachlink.either());\n if (!path.contains(other)) {\n path.add(other);\n }\n if (!path.contains(either)) {\n path.add(either);\n }\n }\n for (Edge eachlink1 : shortest2.pathTo(Integer.parseInt(str1[2]))) {\n int either1 = eachlink1.either();\n int other1 = eachlink1.other(eachlink1.either());\n if (!path.contains(other1)) {\n path.add(other1);\n }\n if (!path.contains(either1)) {\n path.add(either1);\n }\n }\n for (int everyval : path) {\n System.out.print(everyval + \" \");\n }\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t}", "private void triggerPathUpdate() {\n\t\tPathwayPathSelectionEvent pathEvent = new PathwayPathSelectionEvent();\n\n\t\tif (selectedPath != null) {\n\t\t\tif (pathSegments.size() > 0)\n\t\t\t\tpathSegments.set(pathSegments.size() - 1, new PathSegment(selectedPath));\n\t\t\telse\n\t\t\t\tpathSegments.add(new PathSegment(selectedPath));\n\t\t}\n\t\tpathEvent.setPath(pathSegments);\n\t\tpathEvent.setSender(this);\n\t\tpathEvent.setEventSpace(pathwayPathEventSpace);\n\t\teventPublisher.triggerEvent(pathEvent);\n\t}", "private void resetRoute() {\n\t\troute = new Route[] {new Route(distanceMatrix)};\n\t\ttotalCost = 0;\n\t}", "@Test\n public void testTraverserSelection() {\n Model m;\n m = target(\"/by_id/a/johnny1986\").request(\"text/turtle\").get(Model.class);\n try (QueryExecution ex = QueryExecutionFactory.create(PREFIXES + \"ASK {\" +\n \" ?x a foaf:Person.\\n\" +\n \" ?x foaf:account ?a.\\n\" +\n \" ?a foaf:accountName ?name.\\n\" +\n \"}\", m)) {\n Assert.assertTrue(ex.execAsk());\n }\n\n /* for by_id/b/ CBDTraverser has maxPath = 0 */\n m = target(\"/by_id/b/bobby\").request(\"text/turtle\").get(Model.class);\n try (QueryExecution ex = QueryExecutionFactory.create(\n PREFIXES + \"ASK {?x a foaf:Person.}\", m)) {\n Assert.assertTrue(ex.execAsk());\n }\n try (QueryExecution ex = QueryExecutionFactory.create(PREFIXES + \"ASK {\" +\n \" ?x a foaf:Person.\\n\" +\n \" ?x foaf:account ?a.\\n\" +\n \" ?a foaf:accountName ?name.\\n\" +\n \"}\", m)) {\n Assert.assertFalse(ex.execAsk());\n }\n }", "@Test\n public void helloGraph() {\n skynetMedium.SkyNet.Input.GameInput in=new skynetMedium.SkyNet.Input.GameInput(4,4,1);\n in.addLinkDescr(1,2);\n //in.addLinkDescr(0, 2);\n in.addLinkDescr(1, 0);\n //in.addLinkDescr(2, 3);\n in.addGateWay(2);\n in.setAgent(1);\n \n List<SkyNet.Input.PathToGate> path=in.pathToGates();\n for(SkyNet.Input.PathToGate ptg : path){\n System.err.println(\"= \"+ptg);\n }\n }", "@Override\n\tpublic void onReCalculateRouteForTrafficJam() {\n\n\t}", "private void findBestPath(){\n\t\t// The method will try to find the best path for every starting point and will use the minimum\n\t\tfor(int start = 0; start < this.getDimension(); start++){\n\t\t\tfindBestPath(start);\t\n\t\t}\t\n\t}", "public static void pathMethod (int x, int y, int rows, int columns, int startPointX, int startPointY, int endPointX, int endPointY, String [][]copyArray, String [][]realArray, int decider) throws Exception{ \r\n \r\n String up = copyArray[y-1][x];\r\n String down = copyArray[y+1][x];\r\n String right = copyArray[y][x+1]; //moves the coordinate up one, down one, right one, left one and stores it into up down left right; \r\n String left = copyArray[y][x-1];\r\n \r\n if(up.equals(\"X\")||down.equals(\"X\")||right.equals(\"X\")||left.equals(\"X\")){ //if up right left or down is equal to the endpoint, the maze is solvable, and we can now print the final array\r\n System.out.println(\"\\nThe maze is solvable!\");\r\n// printFinalArray(realArray, counter, xvalues, yvalues); //solution is found already - sends back to another method to print final solution\r\n regenerate(decider); //then sends to regenerate method where it asks if user would like to create another maze\r\n }\r\n \r\n else if(copyArray[startPointY+1][startPointX].equals(\"B\")&&copyArray[startPointY-1][startPointX].equals(\"B\")&&copyArray[startPointY][startPointX+1].equals(\"B\")&&copyArray[startPointY][startPointX-1].equals(\"B\")){\r\n \r\n System.out.println(\"\\nSorry, your maze is unsolvable.\\n\\n\"); //if at the start point we cannot go up down left or right - no possible moves - not solvable - end of maze \r\n regenerate(decider); //call the method that gives users the option to recreate the maze if it was unsolvable \r\n } \r\n \r\n else if(up.equals(\"O\")){ //if the coordinate in the up direction is O\r\n counter=counter+1; //incrementing counter so we can input it the coordinate arrays\r\n copyArray[y][x] = \"V\"; //changing the values to 'V' so we can know that we already visited it\r\n y=y-1; //moving coordinate up one \r\n xvalues[counter]=x; //storing this coordinate into the arrays with the counter\r\n yvalues[counter]=y;\r\n pathMethod(x, y, rows, columns, startPointX, startPointY, endPointX, endPointY, copyArray, realArray, decider); //recalling method\r\n }\r\n \r\n else if(down.equals(\"O\")){ //if down = O\r\n copyArray[y][x] = \"V\";\r\n counter=counter+1;\r\n y=y+1; \r\n xvalues[counter]=x;\r\n yvalues[counter]=y;\r\n pathMethod(x, y, rows, columns, startPointX, startPointY, endPointX, endPointY, copyArray, realArray, decider);\r\n }\r\n \r\n else if(right.equals(\"O\")){ //if right equals O\r\n copyArray[y][x] = \"V\";\r\n counter=counter+1;\r\n x=x+1;\r\n xvalues[counter]=x;\r\n yvalues[counter]=y;\r\n pathMethod(x, y, rows, columns, startPointX, startPointY, endPointX, endPointY, copyArray, realArray, decider);\r\n }\r\n \r\n else if(left.equals(\"O\")){ //if left equals O\r\n copyArray[y][x] = \"V\";\r\n counter=counter+1;\r\n x=x-1;\r\n xvalues[counter]=x;\r\n yvalues[counter]=y;\r\n pathMethod(x, y, rows, columns, startPointX, startPointY, endPointX, endPointY, copyArray, realArray, decider);\r\n }\r\n \r\n else { //if neither up down left or right work\r\n for(int i = 0; i<rows; i++){ //makes all the 'V's go back to O\r\n for(int j = 0; j<columns; j++){\r\n if(copyArray[i][j].equals(\"V\")){\r\n copyArray[i][j] = \"O\";\r\n }\r\n }\r\n }\r\n copyArray[y][x] = \"B\"; //make the coordinate that you cant make a move with B, so it shortens the possible path options\r\n for(int i = 0 ; i<counter; i++){\r\n xvalues[i] = 0; //resets the coordinate arrays back to 0\r\n yvalues[i] = 0;\r\n }\r\n counter=0; //resets counter back to 0;\r\n pathMethod(startPointX, startPointY, rows, columns, startPointX, startPointY, endPointX, endPointY, copyArray, realArray, decider); //resends the startpoints instead of x and y; only thing different is that one coordinate is now marked \"B\"\r\n } \r\n }", "public static void main(String[] args) {\n Graph graph = new Graph();\n graph.addEdge(0, 1);\n graph.addEdge(0, 4);\n\n graph.addEdge(1,0);\n graph.addEdge(1,5);\n graph.addEdge(1,2);\n graph.addEdge(2,1);\n graph.addEdge(2,6);\n graph.addEdge(2,3);\n\n graph.addEdge(3,2);\n graph.addEdge(3,7);\n\n graph.addEdge(7,3);\n graph.addEdge(7,6);\n graph.addEdge(7,11);\n\n graph.addEdge(5,1);\n graph.addEdge(5,9);\n graph.addEdge(5,6);\n graph.addEdge(5,4);\n\n graph.addEdge(9,8);\n graph.addEdge(9,5);\n graph.addEdge(9,13);\n graph.addEdge(9,10);\n\n graph.addEdge(13,17);\n graph.addEdge(13,14);\n graph.addEdge(13,9);\n graph.addEdge(13,12);\n\n graph.addEdge(4,0);\n graph.addEdge(4,5);\n graph.addEdge(4,8);\n graph.addEdge(8,4);\n graph.addEdge(8,12);\n graph.addEdge(8,9);\n graph.addEdge(12,8);\n graph.addEdge(12,16);\n graph.addEdge(12,13);\n graph.addEdge(16,12);\n graph.addEdge(16,17);\n graph.addEdge(17,13);\n graph.addEdge(17,16);\n graph.addEdge(17,18);\n\n graph.addEdge(18,17);\n graph.addEdge(18,14);\n graph.addEdge(18,19);\n\n graph.addEdge(19,18);\n graph.addEdge(19,15);\n LinkedList<Integer> visited = new LinkedList();\n List<ArrayList<Integer>> paths = new ArrayList<ArrayList<Integer>>();\n int currentNode = START;\n visited.add(START);\n new searchEasy().findAllPaths(graph, visited, paths, currentNode);\n for(ArrayList<Integer> path : paths){\n for (Integer node : path) {\n System.out.print(node);\n System.out.print(\" \");\n }\n System.out.println();\n }\n }", "@Override\n protected void processPathAction(GridNode start, GridNode goal, Stack<GridNode> path) {\n path.pop();\n\n // Make the robot follow the path\n Mover mover = new Mover(\n robot.getDifferentialPilot(),\n new LightSensor(leftSensorPort),\n new LightSensor(rightSensorPort),\n path,\n initialDirection);\n mover.run();\n }", "@Override\n\tpublic void setup() {\n\t\tObjectSpace objectSpace = Blackboard.inst().getSpace(ObjectSpace.class, \"object\");\n\t\tList<PhysicsObject> objects = objectSpace.getCognitiveAgents();\n\n\t\tif (objects.size() != 2)\n\t\t\tthrow new RuntimeException(\"Need two agents in order to run PathScenario4!\");\n\t\t\n\t\t// first we determine the line between their two points.\n\t\tPhysicsObject obj1 = objects.get(0);\n\t\tPhysicsObject obj2 = objects.get(1);\n\t\t\t\t\n\t\tVec2 direction = obj1.getPPosition().sub(obj2.getPPosition());\n\t\tVec2 nDirection = new Vec2(direction);\n\t\tnDirection.normalize();\n\t\tfloat radians = (float) Math.atan2(nDirection.y, nDirection.x);\n\t\tfloat PI = (float) Math.PI;\n\t\tfloat PI2 = PI * 0.5f;\n\n\t\tfloat perp = radians + PI2;\n\t\tVec2 v = new Vec2((float) Math.cos(perp), (float) Math.sin(perp));\n\t\tVec2 offset1 = new Vec2(obj1.getPPosition().add(v));\n\n\t\tList<Vec2> waypoints1 = new ArrayList<Vec2>();\n\t\twaypoints1.add(obj2.getPPosition());\n\n\t\tList<Vec2> waypoints2 = new ArrayList<Vec2>();\n\t\twaypoints2.add(offset1);\n\t\t\n\t\t// Set positions and orientations\n\t\tobj1.getBody().setXForm(obj1.getPPosition(), radians + (float) Math.PI);\n\t\tobj2.getBody().setXForm(obj2.getPPosition(), radians);\n\n\t\tEventManager.inst().dispatch(new SetWaypoints(waypoints1, obj1));\n\t\tEventManager.inst().dispatch(new SetWaypoints(waypoints2, obj2));\n\t}", "private Stack<Select> selectionPathAux(JoinPointClass current, String joinPointName,\n ArrayList<JoinPointClass> visitedList, Set<JoinPointClass> ignoreSet, SelectionPathV2 selPath) {\n\n Stack<Select> path = new Stack<>();\n\n if (ignoreSet.contains(current) || visitedList.contains(current)) {\n\n return path;\n }\n\n final Select selected = select(current, joinPointName);\n if (selected != null) {\n\n path.push(selected);\n return path;\n }\n\n visitedList.add(current);\n\n // System.out.println(\"SELECTS: \" + current.getSelects());\n for (final Select select : current.getSelects()) {\n final JoinPointClass next = getJoinPoint(select);\n Stack<Select> pathAux = selectionPathAux(next, joinPointName, visitedList, ignoreSet, selPath);\n if (!pathAux.isEmpty()) {\n pathAux.add(select);\n if (selPath.hasSecondaryPath()) {\n selPath.getSecondaryPath().get().add(select);\n }\n if (!path.isEmpty()) {\n if (!alreadyFound) {\n selPath.setSecondaryPath(pathAux);\n selPath.setTieBreakReason(\"use the first path found (from a depth first search)\");\n // System.out.println(\n // \"More than one path for inital join point '\" + joinPointName + \"'. Two of then are: \");\n // Function<Pair<String, String>, String> converted = p -> {\n // if (p.getLeft().equals(p.getRight())) {\n // return p.getLeft();\n // }\n // return \"(\" + p.getRight() + \" as \" + p.getLeft() + \")\";\n // };\n //\n // System.out.println(\"\\t1. \" + StringUtils.join(path, converted, \".\"));\n // System.out.println(\"\\t2. \" + StringUtils.join(pathAux, converted, \".\"));\n //\n // System.out.println(\"Select uses a depth first search. Will use 1.\");\n alreadyFound = true;\n }\n break;\n }\n path = pathAux;\n } else {\n ignoreSet.add(next);\n }\n }\n visitedList.remove(current);\n\n return path;\n }", "public static void CBD(GrafoMatriz G, GrafoMatriz Gaux, ArrayList<ListaEnlazadaAsignadas> lea, int[][] selectos, int capacidad){\n \n Utilitarios.cargarEnGrafo(G,Gaux,capacidad);\n for (int i=0; i<selectos.length; i++){\n Utilitarios.borrarCaminos(Gaux,selectos[i][1], lea, capacidad);\n }\n ListaEnlazada [] ksp;\n Resultado r;\n Resultado [] results = new Resultado[selectos.length];\n Demanda d;\n for (int i=0; i<selectos.length; i++){\n d = lea.get(selectos[i][1]).getDemanda();\n \n ksp = Utilitarios.KSP(Gaux, d.getOrigen(), d.getDestino(), 5);\n r = Utilitarios.buscarEspacioCBD(ksp, d, selectos[i][0], Gaux, capacidad);\n if (r!=null){\n Utilitarios.asignarFS_Defrag(ksp,r,Gaux,d,-1);\n results[i] = r;\n }else{\n results[i] = new Resultado();\n results[i].setCamino(-1);\n }\n }\n \n for (int i=0; i<results.length; i++){\n if (results[i].getCamino()!=-1){\n //Utilitarios.borrarCaminos(G, selectos[i], lea, capacidad);\n \n d = lea.get(selectos[i][1]).getDemanda();\n ksp = Utilitarios.KSP(G, d.getOrigen(), d.getDestino(), 5);\n Utilitarios.asignarFS_saveRoute(ksp,results[i],G,d,lea, -1);\n Utilitarios.limpiarCaminoAnterior(lea.get(selectos[i][1]), G, selectos[i][1], capacidad, lea);\n //System.out.println(\"Se movio \" + selectos[i][1] + \" ahora es \" + (lea.size()-1));\n \n }\n }\n }", "private void computeAllPaths()\n {\n for (Station src : this.graph.stations)\n {\n List<Station> visited = new ArrayList<Station>();\n computePathsForNode(src, null, null, visited);\n }\n Print.printTripList(this.tripList);\n }", "private void requestRoute() {\n Intent requestIntent = new Intent(RouteService.CREATE_ROUTE);\n requestIntent.putExtra(\"startLocation\", mStartLocation);\n requestIntent.putExtra(\"category\", mRouteCategory);\n requestIntent.putExtra(\"limitType\", mLimitType); // Enums are serializable. No probs here.\n requestIntent.putExtra(\"limit\", mLimitType == LimitType.DISTANCE ? mLimit : mLimit * 60);\n\n LocalBroadcastManager.getInstance(getSherlockActivity()).sendBroadcast(requestIntent);\n\n ViewSwitcher bottomSwitcher = (ViewSwitcher) getView().findViewById(R.id.switcher_route_options);\n if (bottomSwitcher.getNextView().getId() == R.id.switcher_item_progress) {\n bottomSwitcher.showNext();\n }\n\n ViewSwitcher topSwitcher = (ViewSwitcher) getView().findViewById(R.id.switcher_route_category);\n if (topSwitcher.getNextView().getId() == R.id.route_info_container) {\n topSwitcher.showNext();\n }\n\n // Set Image\n String categoryString;\n switch (mRouteCategory) {\n case WALKING:\n categoryString = \"walking\";\n break;\n case DRINKS:\n categoryString = \"drinks\";\n break;\n case SHOPPING:\n categoryString = \"shopping\";\n break;\n default:\n categoryString = \"\";\n break;\n }\n\n setRouteInfo(mRouteCategory, \"\", \"\", String.format(\"Creating a %s route...\", categoryString));\n\n ViewGroup buttonsContainer = (ViewGroup) topSwitcher.findViewById(R.id.category_buttons_container);\n for (int i = 0; i < buttonsContainer.getChildCount(); i++) {\n if (buttonsContainer.getChildAt(i) instanceof ImageButton) {\n ImageButton button = (ImageButton) buttonsContainer.getChildAt(i);\n button.setBackgroundResource(R.drawable.abs__list_selector_holo_light);\n }\n }\n }", "public LocalPlannerState update(DriveAction action, Path path,\n CostMap costMap, Transform transform) {\n Log.v(TAG, \"Begin local planner\");\n if (path != null && !path.equals(mCurrentPath)) {\n //noinspection AssignmentToCollectionOrArrayFieldFromParameter\n mCurrentPath = path.copy(); // Copy this since path is an immutable list\n mIsBlocked = false;\n }\n\n Transform goal = action.getTransform();\n if (goal == null || transform == null) {\n setTeleop(new Teleop(0,0,0,0,0,0));\n // TODO (playerfive): We had an error, it should return ERROR to let RecoveryBehavior know\n // TODO: about this event. If this error persists, the robot will remain stopped until\n // TODO: the timeout is reached.\n Log.v(TAG, \"Goal or transform is null, stopping the robot\");\n return LocalPlannerState.RUNNING;\n }\n if (!isGoalReached(transform, goal) || mVelocityGenerator.isStopManager()) {\n Log.v(TAG, \"Computing velocities with velocity generator\");\n long delta = -1;\n long currentTime = System.currentTimeMillis();\n if (mLastUpdatedTime > 0) {\n delta = currentTime - mLastUpdatedTime;\n }\n if (delta > 120) {\n Log.w(TAG, \"Warning - local planner was slow to update, delta = \" + delta + \" ms\");\n }\n boolean isBlocked = mPointCloudSafetyController.isBlocked();\n mPath.clear();\n double[] velocities = mVelocityGenerator.computeVelocities(transform, goal, costMap,\n path, isBlocked, mPointCloudSafetyController.getBinData(),\n mDistanceCloseToGoal, delta, mPath);\n mLastUpdatedTime = currentTime;\n\n if (velocities == null) {\n Log.v(TAG, \"Velocities null\");\n setTeleop(new Teleop(0, 0, 0, 0, 0, 0));\n mPath.clear();\n return mVelocityGenerator.isStopManager() && isGoalReached(transform, goal)\n ? LocalPlannerState.COMPLETED : LocalPlannerState.ERROR;\n }\n if (isBlocked && !mVelocityGenerator.isStopManager()) {\n Log.v(TAG, \"Stopping for block\");\n velocities = velocities.clone();\n velocities[0] = 0;\n }\n if (mBumperSafetyController.updateBumper(mBumperState)) {\n Log.v(TAG, \"Safety controller is active\");\n velocities[0] = mBumperSafetyController.getSafeLinearSpeed();\n velocities[1] = mBumperSafetyController.getSafeAngularSpeed();\n mPath.clear();\n mLastUpdatedTime = -1;\n }\n\n Log.v(TAG, \"Sending linear \" + velocities[0] + \" angular \" + velocities[1]);\n setTeleop(new Teleop(velocities[0], 0, 0, 0, 0, velocities[1]));\n return LocalPlannerState.RUNNING;\n } else {\n mLastUpdatedTime = -1;\n Log.v(TAG, \"Completed\");\n mPath.clear();\n setTeleop(new Teleop(0, 0, 0, 0, 0, 0));\n return LocalPlannerState.COMPLETED;\n }\n }", "public void printRoute() {\n\t\tString route = new String(\"[ROUTE INFO] - Cost: \");\n\t\tif(cost == 0) {\n\t\t\troute += \" Not Yet Calculated, \";\n\t\t}\n\t\telse {\n\t\t\troute += (\"\" + this.cost + \", \");\n\t\t}\n\t\troute += (\"Route Length: \" + solutionLength + \", Route: \");\n\t\troute += \"(\" + solutionRepresentation.get(0).getX() + \",\" + solutionRepresentation.get(0).getY() + \")\";\n\t\tfor(int i = 1; i < solutionLength; i++) {\n\t\t\troute+= \" -> (\" + solutionRepresentation.get(i).getX() + \",\" + solutionRepresentation.get(i).getY() + \")\";\n\t\t}\n\t\tSystem.out.println(route);\n\t}", "private void findPath1(List<Coordinate> path) {\n\n // records the start coordinate in a specific sequence.\n ArrayList<Coordinate> starts = new ArrayList<>();\n // records the end coordinate in a specific sequence.\n ArrayList<Coordinate> ends = new ArrayList<>();\n // records the total cost of the path in a specific sequence.\n ArrayList<Integer> cost = new ArrayList<>();\n\n for (Coordinate o1 : originCells) {\n for (Coordinate d1 : destCells) {\n Graph graph = new Graph(getEdge(map));\n graph.dijkstra(o1);\n graph.printPath(d1);\n starts.add(o1);\n ends.add(d1);\n cost.add(graph.getPathCost(d1));\n }\n }\n int index = getMinIndex(cost);\n\n Graph graph = new Graph(getEdge(map));\n graph.dijkstra(starts.get(index));\n graph.printPath(ends.get(index));\n for (Graph.Node node : graph.getPathReference()) {\n path.add(node.coordinate);\n }\n setSuccess(path);\n }", "public static void main(String[] args) throws Exception {\n\n String[] options=new String[2];\n options[0]=\"Smart\";\n options[1]=\"Dummy\";\n String choice=\"\";\n String availableChars[] = {\"5x5maze.txt\",\"7x7maze.txt\",\"8x8maze.txt\",\"9x9maze.txt\",\"10x10maze.txt\",\"12x12maze.txt\"};\n\n int choiceG = JOptionPane.showOptionDialog(JOptionPane.getRootFrame(),\n \"Would you like to use the smart or dummy solution?\",\n \"Flow Free solver\",0,\n JOptionPane.INFORMATION_MESSAGE,null,options,null\n );\n if(choiceG==0){\n choice = (String) JOptionPane.showInputDialog(JOptionPane.getRootFrame(),\n \"Which puzzle size would you like to solve?\",\n \"Choose puzzle\",\n JOptionPane.PLAIN_MESSAGE,\n null,\n availableChars,\n 2);\n try{\n int[][] numberedMap=loadMap(choice);\n Node[] map=linkNodes(numberedMap);\n height=numberedMap.length;\n width=numberedMap[0].length;\n\n FlowDrawer.getInstance();\n FlowDrawer.setBoard(numberedMap);\n FlowFinder f=new FlowFinder(numberedMap,map,false);\n }\n catch(Exception e){System.out.println(e+\" \"+e.getStackTrace()[0].getLineNumber());}\n }\n else{\n choice = (String) JOptionPane.showInputDialog(JOptionPane.getRootFrame(),\n \"Which puzzle size would you like to solve?\",\n \"Choose puzzle\",\n JOptionPane.PLAIN_MESSAGE,\n null,\n availableChars,\n 2);\n try{\n int[][] numberedMap=loadMap(choice);\n Node[] map=linkNodes(numberedMap);\n height=numberedMap.length;\n width=numberedMap[0].length;\n\n FlowDrawer.getInstance();\n FlowDrawer.setBoard(numberedMap);\n FlowFinder f=new FlowFinder(numberedMap,map,true);\n }\n catch(Exception e){System.out.println(e+\" \"+e.getStackTrace()[0].getLineNumber());}\n }\n\n\n\n }", "public IMazePathFinder createInstance(MazeModel mazeModel);", "private void setupModel() {\n\n //Chooses which model gets prepared\n switch (id) {\n case 2:\n singlePackage = new Node();\n activeNode = singlePackage;\n\n //Builder for model\n ModelRenderable.builder()\n .setSource(ArActivity.this, R.raw.package_solo)\n .build().thenAccept(renderable -> activeRenderable = renderable)\n .exceptionally(\n throwable -> {\n Toast.makeText(this, \"Unable to show \", Toast.LENGTH_SHORT).show();\n return null;\n }\n );\n break;\n\n case 3:\n multiPackage = new Node();\n activeNode = multiPackage;\n\n //Builder for model\n ModelRenderable.builder()\n .setSource(ArActivity.this, R.raw.package_multi_new)\n .build().thenAccept(renderable -> activeRenderable = renderable)\n .exceptionally(\n throwable -> {\n Toast.makeText(this, \"Unable to show \", Toast.LENGTH_SHORT).show();\n return null;\n }\n );\n break;\n\n case 4:\n wagonPackage = new Node();\n activeNode = wagonPackage;\n\n //Builder for model\n ModelRenderable.builder()\n .setSource(ArActivity.this, R.raw.package_car_new)\n .build().thenAccept(a -> activeRenderable = a)\n .exceptionally(\n throwable -> {\n Toast.makeText(this, \"Unable to show \", Toast.LENGTH_SHORT).show();\n return null;\n }\n );\n break;\n\n default:\n mailbox = new Node();\n activeNode = mailbox;\n\n //Builder for model\n ModelRenderable.builder()\n .setSource(ArActivity.this, R.raw.mailbox)\n .build().thenAccept(renderable -> activeRenderable = renderable)\n .exceptionally(\n throwable -> {\n Toast.makeText(this, \"Unable to show \", Toast.LENGTH_SHORT).show();\n return null;\n }\n );\n break;\n }\n }", "private List<Point> getPath(int index) {\n\t\t \n\t \n\t\t Node fromNode = oEdge.fromNode;\n\t\t Node toNode = oEdge.toNode;\n\t\t float x1 = fromNode.longitude;\n\t\t float x2 = toNode.longitude;\n\t\t float y1 = fromNode.latitude;\n\t\t float y2 = toNode.latitude;\n\t\t double slope, angle;\n\t\t if(x1!=x2) {\n\t\t\t slope = (y2-y1)/(x2-x1);\n\t\t\t \tangle = Math.atan(slope);\n\t\t\t \t} else {\n\t\t\t \t\tangle = Math.PI/2;\n\t\t\t \t}\n\t\t Double L = Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));\n\t\t float offsetPixels=0;\n\t\t if(Math.toDegrees(angle)>Math.toDegrees(90)) {\n\t\t\t if (index==0){\n\t\t\t\t offsetPixels=roadWidth*6/10;\n\t\t\t }\n\t\t\t else if(index==1){\n\t\t\t\t offsetPixels=roadWidth*11/10;\n\t\t\t }\n\t\t\t else if(index==-1){\n\t\t\t\t offsetPixels=roadWidth*1/10;\n\t\t\t }\n\t\t\t \n\t\t } else {\n\t\t\t \n\t\t\t if (index==0){\n\t\t\t\t offsetPixels=-roadWidth*6/10;\n\t\t\t }\n\t\t\t else if(index==1){\n\t\t\t\t offsetPixels=-roadWidth*11/10;\n\t\t\t }\n\t\t\t else if(index==-1){\n\t\t\t\t offsetPixels=-roadWidth*1/10;\n\t\t\t }\n\t\t }\n\t\t \n\t\t // This is the first parallel line\n\t\t float x1p1 = x1 + offsetPixels * (y2-y1) / L.floatValue();\n\t\t float x2p1 = x2 + offsetPixels * (y2-y1) / L.floatValue();\n\t\t float y1p1 = y1 + offsetPixels * (x1-x2) / L.floatValue();\n\t\t float y2p1 = y2 + offsetPixels * (x1-x2) / L.floatValue();\n//\t\t if(oEdge.edgeID==16) {\n//\t\t\t System.out.println(\"testing\");\n//\t\t }\n\t\t \n\t\t Point P1 = new Point(x1p1,y1p1);\n\t\t Point P2 = new Point(x2p1,y2p1);\n\t\t List<Point> gP = GetPoints(P1, P2);\n\t\t return gP;\n\t \n\t}", "public static void main(String a[]) throws Exception {\r\n\t\tint option = 0;\r\n\t\tScanner scan = new Scanner(System.in); // Instance for input declared\r\n\t\tSystem.out.println(\"********Please give the inpute file as topology.txt********\");\r\n\t\t\r\n\r\n\t\twhile (option != 6) // Main loop for execution\r\n\t\t{\r\n\t\t\tSystem.out.println( \"\\n\" +\r\n\t\t\t\t\t\"(1) Create a new Network Topology\\n\" +\r\n\t\t\t\t\t\"(2) Build a Connection Table \\n\" +\r\n\t\t\t\t\t\"(3) Distance to all nodes from source node\\n\" +\r\n\t\t\t\t\t\"(4) Shortest Path to Destination Router\\n\" +\r\n\t\t\t\t\t\"(5) Modify Topology \\n\" +\r\n\t\t\t\t\t\"(6) Exit \\n\"); // printing menu\r\n\t\t\t\r\n\t\t\tSystem.out.print(\"Please enter one of the above options :\");\r\n\t\t\t\r\n\t\t\ttry {\r\n\t\t\t\toption = Integer.parseInt(scan.nextLine());// Taking user input \r\n\t\t\t} catch (NumberFormatException ex) {\r\n\t\t\t\tSystem.out.println(\"\\n******** Wrong Input Format! Choose a number from 1 to 6 ******** \");\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\tswitch (option) // Checking for the User input from menu option\r\n\t\t\t{\r\n\t\t\t\tcase 1:\r\n\t\t\t\t\tcreateTopology(); // sending control to create topology code\r\n\t\t\t\t\tbreak; \r\n\t\t\t\tcase 2:\r\n\t\t\t\t\tbuilConnectionTable(); // Sending control to building connection\r\n\t\t\t\t\tbreak; \r\n\t\t\t\tcase 3:\r\n\t\t\t\t\tcomputeDistanceToAllNodes(); // Sending control to find shortest distance to all nodes\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 4:\r\n\t\t\t\t\tgetShortestPath(); // Sending control to find shortest path\r\n\t\t\t\t\tbreak; \r\n\t\t\t\tcase 5:\r\n\t\t\t\t\tmodifyTopology(); // sending control to modify the toplogy\r\n\t\t\t\t\tbreak; \r\n\t\t\t\tcase 6:\r\n\t\t\t\t\tSystem.out.println(\"\\n Exit CS542-04 2016 Fall project. Good Bye!\");\r\n\t\t\t\t\tbreak; // Exiting the main control loop and the code\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tSystem.out.println(\"\\n************ Enter a number from 1 to 6 **************\\n \");\r\n\t\t\t\t\tbreak; // Printing the User input error\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (scan.hasNextLine())\r\n\t\t\treturn;\r\n\t}", "public void runPath()\n\t{\n\t\tinit();\n\t\t\n\t\twhile(_run && (SEQUENCE != null))\n\t\t{\n\t\t\tboolean midLine = LS_MIDDLE.getLightValue() >= s_mid.threshold;\n\t\t\tboolean leftLine = LS_LEFT.getLightValue() >= s_left.threshold;\n\t\t\tboolean rightLine = LS_RIGHT.getLightValue() >= s_right.threshold;\n\t\t\t\n\t\t\tif(!leftLine && !rightLine) handleIntersection();\n\t\t\telse // just a straight line\n\t\t\t{\n\t\t\t\tif (!midLine && !leftLine && !rightLine) turnAround();\n\t\t\t\telse followLine();\n\t\t\t}\n\t\t}\n\t}", "public static void calculate(Route pRoute)\r\n {\r\n //System.out.println(pRoute.size());\r\n for(int i=0; i<pRoute.size()-1; i++)\r\n {\r\n pRoute.addLeg(calculateLeg(pRoute.getWaypoint(i),pRoute.getWaypoint(i+1),pRoute.getSpeed())); \r\n }\r\n }", "private void findPath()\n\t{\n\t\tpathfinding = true;\n\n\t\tmoves = Pathfinder.calcOneWayMove(city.getDrivingMap(), x, y, destX, destY);\n\t\tpathfinding = false;\n\t}", "@FXML\n private void goToSolarSystem() {\n Planet selected = (Planet) planetList.getSelectionModel().getSelectedItem();\n if (selected == null) {\n player.move(selectedSolarSystem);\n } else {\n player.move(selectedSolarSystem, selected);\n }\n if (timer != null) {\n timer.cancel();\n }\n Random rand = new Random();\n if (rand.nextFloat() < 0.3) {\n SpaceTrader.getInstance().goToEncounter();\n return;\n }\n if (player.isDead()) {\n SpaceTrader.getInstance().goToWelcomeScreen();\n return;\n }\n SpaceTrader.getInstance().goToSolarSystemView();\n }", "@Test\r\n void findRouteDifferentLine() {\r\n List<Station> route = model.findRoute(9, 60);\r\n assertNotNull(route);\r\n assertEquals(10, route.size());\r\n assertEquals(\"SuffolkDowns\", route.get(0).getName());\r\n assertEquals(\"Broadway\", route.get(9).getName());\r\n }", "@Override\n\t\t\tpublic void run() \n\t\t\t{\n\t\t\t\tif(!(mazeCollection.containsKey(paramArray[0])))\n\t\t\t\t{\n\t\t\t\t\tc.passError(\"Maze doesn't exist\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\t//if solution for this maze exists\n\t\t\t\tif(mazeSolutions.containsKey(mazeCollection.get(paramArray[0])))\n\t\t\t\t{\n\t\t\t\t\tc.passSolve(\"Solution for \"+paramArray[0]+ \" is ready\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t*/\n\t\t\t\t\n\t\t\t\tif(paramArray[1].toString().equals(\"bfs\"))\n\t\t\t\t{\n\t\t\t\t\tMazeAdapter ms=new MazeAdapter(mazeCollection.get(paramArray[0]));\n\t\t\t\t\t\n\t\t\t\t\tSearcher<Position> bfs=new BFS<Position>();\n\t\t\t\t\tSolution<Position> sol=bfs.search(ms);\n\t\t\t\t\t\n\t\t\t\t\t//check if solution for the maze already exists, if so, replace it with the new one\n\t\t\t\t\tif(mazeSolutions.containsKey(mazeCollection.get(paramArray[0]))) {\n\t\t\t\t\t\tmazeSolutions.remove(mazeCollection.get(paramArray[0]));\n\t\t\t\t\t\tmazeSolutions.put(mazeCollection.get(paramArray[0]), sol);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tmazeSolutions.put(mazeCollection.get(paramArray[0]), sol);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tc.passSolve(\"Solution for \"+paramArray[0]+ \" is ready\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\telse if(paramArray[1].toString().equals(\"dfs\"))\n\t\t\t\t{\n\t\t\t\t\tMazeAdapter ms=new MazeAdapter(mazeCollection.get(paramArray[0]));\n\t\t\t\t\t\n\t\t\t\t\tSearcher<Position> dfs=new DFS<Position>();\n\t\t\t\t\tSolution<Position> sol=dfs.search(ms);\n\t\t\t\t\t\n\t\t\t\t\t//check if solution for the maze already exists, if so, replace it with the new one\n\t\t\t\t\tif(mazeSolutions.containsKey(mazeCollection.get(paramArray[0]))) {\n\t\t\t\t\t\tmazeSolutions.remove(mazeCollection.get(paramArray[0]));\n\t\t\t\t\t\tmazeSolutions.put(mazeCollection.get(paramArray[0]), sol);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tmazeSolutions.put(mazeCollection.get(paramArray[0]), sol);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tc.passSolve(\"Solution for \"+paramArray[0]+ \" is ready\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tc.passError(\"Invalid algorithm\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}", "@Override\n\tpublic void onCalculateRouteSuccess() {\n\t\tnaviActivity();\n\t}", "private void setPath(){\r\n // get the reversed path\r\n ArrayList<Grid> reversedPath = new ArrayList<>();\r\n int index = _endIndex;\r\n reversedPath.add(_map.get_grid(index));\r\n while(index != _startIndex){\r\n index = _map.get_grid(index).get_parent();\r\n reversedPath.add(_map.get_grid(index));\r\n }\r\n\r\n // get the final path in the correct order\r\n int length = reversedPath.size();\r\n for(int i=length-1;i>=0;i--){\r\n _path.add(reversedPath.get(i));\r\n }\r\n }", "public static String findPath(String CHAR1, String CHAR2,CampusRouteFindingModel campusModel) {\n\t\t graph<String, Float> g = campusModel.getGraph();\n\t\t Map<String, String> idFirst = campusModel.getName();\n\t\t Map<String,String> nameFirst = campusModel.getID();\n\t\t Map<String, XYLocation> locations = campusModel.getLocations();\n\t\t if(!(nameFirst.containsKey(CHAR1))&&(!(idFirst.containsKey(CHAR1)))) { \n\t\t\t if(!(nameFirst.containsKey(CHAR2))&&(!(idFirst.containsKey(CHAR2)))) {\n\t\t\t\t if (CHAR1.equals(CHAR2)) {\n\t\t\t\t\t return \"Unknown building: [\"+CHAR1+\"]\\n\";\n\t\t\t\t }\n\t\t\t\t return \"Unknown building: [\"+CHAR1+\"]\\n\"+\"Unknown building: [\"+CHAR2+\"]\\n\";\n\t\t\t }\n\t\t\t\treturn \"Unknown building: [\"+CHAR1+\"]\\n\";\n\t\t\t}\n\t\t\tif(!(nameFirst.containsKey(CHAR2))&&(!(idFirst.containsKey(CHAR2)))) {\n\t\t\t\treturn \"Unknown building: [\"+CHAR2+\"]\\n\";\n\t\t\t}\n\t\tif (nameFirst.containsKey(CHAR1)) {\n\t\t\tCHAR1 = nameFirst.get(CHAR1);\n\t\t}\n\t\tif (nameFirst.containsKey(CHAR2)) {\n\t\t\tCHAR2 = nameFirst.get(CHAR2);\n\t\t}\n\t\tString retrn = \"Path from \"+idFirst.get(CHAR1)+\" to \"+idFirst.get(CHAR2)+\":\\n\";\n\t\tdouble fin = 0;\n\t\tString prev = CHAR1;\n\t\tif (Integer.valueOf(CHAR1) > 92) {\n\t\t\tif (Integer.valueOf(CHAR2) > 92) {\n\t\t\t\tif (CHAR1.equals(CHAR2)) {\n\t\t\t\t\t return \"Unknown building: [\"+CHAR1+\"]\\n\";\n\t\t\t\t }\n\t\t\t\treturn \"Unknown building: [\"+CHAR1+\"]\\n\"+\"Unknown building: [\"+CHAR2+\"]\\n\";\n\t\t\t}\n\t\t\treturn \"Unknown building: [\"+CHAR1+\"]\\n\";\n\t\t}\n\t\tif (Integer.valueOf(CHAR2) > 92) {\n\t\t\treturn \"Unknown building: [\"+CHAR2+\"]\\n\";\n\t\t}\n\t\tif (!(CHAR1.equals(CHAR2))) {\n\t\t\tArrayList<edges<String, Double>> tmp = Dijkstra(CHAR1,CHAR2,g);\n\t\t\tif (tmp==null) {\n\t\t\t\treturn \"There is no path from \"+idFirst.get(CHAR1)+\" to \"+idFirst.get(CHAR2)+\".\\n\";\n\t\t\t}\n\t\t\tIterator<edges<String, Double>> print = tmp.iterator();\n\t\t\tprint.next();\n\t\t\twhile (print.hasNext()) {\n\t\t\t\tedges<String, Double> temp = print.next();\n\t\t\t\tString direction = findDirection(locations.get(prev),locations.get(temp.getDest()));\n\t\t\t\tretrn = retrn+\"\\tWalk \"+direction+\" to (\"+ idFirst.get(temp.getDest())+\")\\n\";\n\t\t\t\tprev = temp.getDest();\n\t\t\t\tfin = temp.getLabel();\n\t\t\t}\n\t\t}\n\t\tretrn = retrn+String.format(\"Total distance: %.3f pixel units.\\n\", fin);\n\t\treturn retrn;\n\t}", "public void suggestTourPlan(Tour alternativeRoute) throws JSONException, ParseException {\n String tourId = alternativeRoute.getTourName(); //get this from session\n Tour tourDetails = new TourDAOs().getTour(alternativeRoute.getTourName());\n System.out.println(\"Tour Details :\" + tourDetails.getStartDate() + \" \" + tourDetails.getEndDate());\n \n String start = tourDetails.getStartDate().substring(8);\n String end = tourDetails.getEndDate().substring(8);\n int tourDuration = Integer.parseInt(end) - Integer.parseInt(start);\n System.out.println(\"REAL DATE :\" + start + \" \" + end + \" \" + tourDuration);\n\n //get premium route details\n List<Route> routeDetails = new LocationRouteDAO().getDefaultRoute(tourId);\n //to print the locations of default route\n for (Route route : routeDetails) {\n System.out.println(\"Default Route list :\" + route.getLocationId());\n //System.out.println(location.getPoints());\n }\n\n int position = 0;\n int i = 0;\n ArrayList<Route> finalRoutes = new ArrayList<Route>();\n Route r = new Route();\n\n Route hotel = new Route();\n hotel.setDestinationPlaceName(routeDetails.get(0).getSourcePlaceName());\n hotel.setDestinationLatitude(routeDetails.get(0).getSourceLatitude());\n hotel.setDestinationLongitude(routeDetails.get(0).getSourceLongitude());\n finalRoutes.add(hotel);\n\n System.out.println(\"before proceeding with the loop :\" + finalRoutes.get(0).getDestinationPlaceName());\n\n //new code starts here\n for (Route route : routeDetails) {\n\n //get the location name of each location of the premium route\n String locName = route.getDestinationPlaceName();\n\n //find the category of the locName\n String locNameCategory = new LocationDAOs().getCategoryLocName(locName);\n\n //get all the locations that belongs to that category\n List<Location> categoryLocList = new ArrayList();\n categoryLocList = new LocationDAOs().getAllLocationsCategory(locNameCategory);\n\n //the location array that sends to the route generator algorithm\n ArrayList<Location> locations_details_ontology = new ArrayList();\n\n //to add the accommodation location as the first to the ontology array\n i++;\n\n Location loc1 = new Location();\n loc1.setLocationName(finalRoutes.get(finalRoutes.size() - 1).getDestinationPlaceName());\n loc1.setLatitude(finalRoutes.get(finalRoutes.size() - 1).getDestinationLatitude());\n loc1.setLongitude(finalRoutes.get(finalRoutes.size() - 1).getDestinationLongitude());\n locations_details_ontology.add(loc1);\n \n \n for (Location loc : categoryLocList) {\n\n if (!locations_details_ontology.get(0).getLocationName().equals(loc.getLocationName())) {\n Location l = new Location();\n l.setLocationName(loc.getLocationName());\n l.setLatitude(loc.getLatitude());\n l.setLongitude(loc.getLongitude());\n locations_details_ontology.add(l);\n }\n }\n \n //to print locations_details_ontology\n for (Location location : locations_details_ontology) {\n System.out.println(location.getLocationName() + \"----\"\n + location.getLatitude() + \"----\" + location.getLongitude());\n //System.out.println(location.getPoints());\n }\n\n //call the lagorithm to find out nearest locations to the first location in ontology array\n ArrayList<Route> routes = new RouteGenerator().RouteFinder(locations_details_ontology);\n\n // Loop all the routes to take the minimum distance of route.\n double min = 0;\n for (int k = 0; k < routes.size(); k++) {\n\n System.out.println(routes.get(k).getDistance());\n min = routes.get(0).getDistance();\n if (min >= routes.get(k).getDistance()) {\n min = routes.get(k).getDistance();\n r = routes.get(k);\n }\n }\n position++;\n r.setPosition(Integer.toString(position));\n\n boolean res = false;\n for (Route avail : finalRoutes) {\n\n if (r.getDestinationPlaceName().equals(avail.getDestinationPlaceName())) {\n res = true;\n }\n\n }\n if (res == false) {\n finalRoutes.add(r);\n }\n \n //to print final routes array\n for (Route fr : finalRoutes) {\n System.out.println(\"FINAL ROUTES ARRAY SANDUNI :\" + fr.getDestinationPlaceName());\n }\n\n }\n\n //get all location list from the database\n List<Location> allLocationList = new LocationDAOs().getAllLocationsList();\n // finalRoutes = new CustomizeRoute().DayPlanner(finalRoutes, allLocationList);\n\n //int m=0;\n //for (int es = 0; es <= m; es++) {\n for (int es = 0; es <= 4; es++) {\n finalRoutes = new CustomizeRoute().DayPlanner(finalRoutes, allLocationList);\n\n int estimatedDuration = Integer.parseInt(finalRoutes.get(finalRoutes.size() - 1).getDate());\n\n if (tourDuration < estimatedDuration) {\n finalRoutes.remove(finalRoutes.size() - 1);\n //m++;\n\n }\n }\n\n //print final routes array after customizing routes\n for (Route fr : finalRoutes) {\n System.out.println(\"FINAL ROUTES ARRAY ACCORDING TO DA PLAN :\" + fr.getDestinationPlaceName() + \" \" + fr.getDate());\n }\n\n //add alternative route to db\n int res = new LocationRouteDAO().addAlternativeRoute(finalRoutes, alternativeRoute.getTourName());\n\n if (res == 1) {\n System.out.println(\"SUCCESS!\");\n } else {\n System.out.println(\"FAILED!\");\n }\n\n }", "public static void calcRoute(Path myPath, int[] visited, int[] unvisited, int dist) {\r\n\t\tif (unvisited.length == 1) {\r\n\t\t\tint overall = dist + myPath.graph[visited[visited.length-1]][unvisited[0]] + myPath.graph[unvisited[0]][myPath.start];\r\n\t\t\tint[] temp_visited = setAdd(visited,unvisited[0]);\r\n\t\t\tif(overall < myPath.min_dist) {\r\n\t\t\t\tmyPath.min_dist = overall;\r\n\t\t\t\tmyPath.best_route = setAdd(temp_visited,myPath.start);\r\n\t\t\t}\r\n\t\t\tmyPath.count++;\r\n\t\t\tSystem.out.println(\"Solution \"+myPath.count+\": Distance = \"+ overall);\r\n\t\t} else if (unvisited.length == myPath.nodes.length-1) {\r\n\t\t\tfor(int loop : unvisited) {\r\n\t\t\t\tint temp_dist = myPath.graph[myPath.start][loop];\r\n\t\t\t\tint[] temp_visited = {myPath.start, loop};\r\n\t\t\t\tint[] temp_unvisited = setDiff(myPath.nodes, temp_visited);\r\n\t\t\t\tcalcRoute(myPath,temp_visited,temp_unvisited,temp_dist);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tfor(int loop : unvisited) {\r\n\t\t\t\tint temp_dist = dist + myPath.graph[visited[visited.length-1]][loop];\r\n\t\t\t\tint[] temp_visited = setAdd(visited,loop);\r\n\t\t\t\tint[] temp_unvisited = setDiff(myPath.nodes, temp_visited);\r\n\t\t\t\tcalcRoute(myPath,temp_visited,temp_unvisited,temp_dist);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t}", "public Solution(){\r\n\r\n this.path_solution =new ArrayList<AState>();\r\n this.sol_for_debbage =new ArrayList<MazeState>();\r\n }", "public void middleJourney(String path){\n System.out.print(\"You walk towards your direction\");\n while(test) {\n if (three!=0){\n System.out.println(\"Now lets try this again\");\n System.out.println(\"F/L/B/R?\");\n three=0;\n }\n path = sc.nextLine();\n if(path.toLowerCase().equals(\"f\")){\n System.out.println(\"Straight it is\");\n laterJourney(path);\n break;\n }\n else if (path.toLowerCase().equals(\"l\")){\n System.out.println(\"Left, let's go\");\n laterJourney(path);\n break;\n }\n\n else if (path.toLowerCase().equals(\"b\")){\n System.out.println(\"Backwards the way\");\n three++;\n }\n else if (path.toLowerCase().equals(\"r\")){\n System.out.println(\"Right Right Right. Alrighty then\");\n laterJourney(path);\n break;\n }\n else{\n System.out.println(\"Come on now, choose from the list\");\n }\n }\n }", "public void setNewGraph() {\n\tresetHints();\r\n Random random = new Random();\r\n if (graphMode == 1) {\r\n if (selectedSize == 1) {\r\n currentGraph = chromaticManager.calculate(random.nextInt(myInformation.smallGraph) + 1, -1);\r\n }\r\n if (selectedSize == 2) {\r\n currentGraph = chromaticManager.calculate(random.nextInt(myInformation.middleGraph - myInformation.smallGraph) + myInformation.smallGraph + 1, -1);\r\n }\r\n if (selectedSize == 3) {\r\n currentGraph = chromaticManager.calculate(random.nextInt(myInformation.bigGraph - myInformation.middleGraph) + myInformation.middleGraph + 1, -1);\r\n }\r\n }\r\n if (graphMode == 2) {\r\n currentGraph = chromaticManager.calculate(myGraph);\r\n }\r\n if (graphMode == 3) {\r\n try {\r\n stackPane.getChildren().removeAll(textFieldHBox, backPane);\r\n myVertices = Integer.parseInt(textFieldVertices.getText());\r\n myEdges = Integer.parseInt(textFieldEdges.getText());\r\n currentGraph = chromaticManager.calculate(myVertices, myEdges);\r\n setDisplay(currentGraph);\r\n } catch (NumberFormatException e) {\r\n\r\n }\r\n }\r\n threadPoolExecutor.execute(() -> {\r\n NewForce newForce = new NewForce();\r\n currentGraph.setCNumer(newForce.doNewForce(currentGraph,currentGraph.getUpperBound(),currentGraph.getLowerBound()));\r\n });\r\n }", "@SuppressWarnings(\"unchecked\")\n\tpublic void searchTraject() throws IOException {\n\n\t\tif (trajectType == null) {\n\t\t\tmessages.warn(\"Gelieve eerst een route- of netwerktype te selecteren alvorens te zoeken.\");\n\t\t}\n\n\t\telse if (trajectType.contains(\"Route\") && trajectNaam == null) {\n\t\t\tmessages.warn(\"Gelieve bij het zoeken naar routes een trajectnaam te selecteren.\");\n\t\t}\n\n\t\telse {\n\t\t\tMapViewer viewer = getViewer();\n\t\t\tMapContext context = viewer.getConfiguration().getContext();\n\n\t\t\t// viewer.setShowSelectControl(false);\n\t\t\t// viewer.setShowDrawPointControl(false);\n\n\t\t\tenvelope = getEnvelopeProvincie();\n\n\t\t\tgetMelding().setProbleem(null);\n\t\t\tprobleemType = \"\";\n\n\t\t\t// Itereren over de lagen en de correcte operaties uitvoeren\n\t\t\tfor (FeatureMapLayer layer : context.getFeatureLayers()) {\n\t\t\t\tlayer.setFilter(null);\n\t\t\t\tlayer.setHidden(true);\n\t\t\t\tlayer.set(\"selectable\", false);\n\t\t\t\t// Provincie altijd zichtbaar\n\t\t\t\tif (layer.getLayerId().equalsIgnoreCase(\"provincie\")) {\n\t\t\t\t\tlayer.setHidden(false);\n\t\t\t\t}\n\n\t\t\t\telse if (layer.getLayerId().equalsIgnoreCase(trajectType)) {\n\t\t\t\t\t// Netwerk\n\t\t\t\t\tif (trajectType.contains(\"Segment\")) {\n\t\t\t\t\t\tsearchNetwerkLayer(layer);\n\t\t\t\t\t}\n\t\t\t\t\t// Route\n\t\t\t\t\telse {\n\t\t\t\t\t\tsearchRouteLayer(layer);\n\t\t\t\t\t\tenvelope = viewer.getContentExtent(layer);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// RouteBord\n\t\t\t\telse if (layer.getLayerId().equalsIgnoreCase(\n\t\t\t\t\t\ttrajectType + \"Bord\")) {\n\t\t\t\t\tsearchRouteBordLayer(layer);\n\t\t\t\t}\n\t\t\t\t// NetwerkBord\n\t\t\t\t// Filtering op de borden\n\t\t\t\telse if (layer.getLayerId().equalsIgnoreCase(\n\t\t\t\t\t\ttrajectType.replace(\"Segment\", \"\") + \"Bord\")) {\n\t\t\t\t\tlayer.setHidden(false);\n\t\t\t\t\tsearchNetwerkBordLayer(layer);\n\t\t\t\t}\n\t\t\t\t// WandelKnooppunt\n\t\t\t\telse if (layer.getLayerId().contains(\"Knooppunt\")\n\t\t\t\t\t\t&& trajectType.contains(\"WandelNetwerk\")) {\n\t\t\t\t\tFeatureMapLayer mapLayer = (FeatureMapLayer) context\n\t\t\t\t\t\t\t.getLayer(\"wandelNetwerkKnooppunt\");\n\t\t\t\t\tsearchKnooppuntLayer(mapLayer);\n\t\t\t\t}\n\n\t\t\t\t// FietsKnooppunt\n\t\t\t\telse if (layer.getLayerId().contains(\"Knooppunt\")\n\t\t\t\t\t\t&& trajectType.contains(\"FietsNetwerk\")) {\n\t\t\t\t\tFeatureMapLayer mapLayer = (FeatureMapLayer) context\n\t\t\t\t\t\t\t.getLayer(\"fietsNetwerkKnooppunt\");\n\t\t\t\t\tsearchKnooppuntLayer(mapLayer);\n\t\t\t\t}\n\n\t\t\t\t// Intekenen Punt\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.setHidden(true);\n\t\t\t\t\tlayer.setFilter(null);\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\n\t\t\tviewer.updateCurrentExtent(envelope);\n\t\t\tviewer.updateContext(null);\n\t\t}\n\t}", "public static void userSelection(){\n\t\tint selection;\n\t\tScanner input = new Scanner(System.in);\n\t\tSystem.out.println(\"Which program would you like to run?\");\n\t\tselection=input.nextInt();\n\n\t\tif(selection == 1)\n\t\t\tmazeUnion();\n\t\tif(selection == 2)\n\t\t\tunionPathCompression();\n\t\tif(selection == 3)\n\t\t\tmazeHeight();\n\t\tif(selection == 4)\n\t\t\tmazeSize();\n\t\tif(selection == 5)\n\t\t\tsizePathCompression();\n\t}", "public RouteFinder(Maze m) {\n maze = m;\n }", "public ArrayList<Vertex> findPath() {\n \n //if we've already been through findPath, then just return it\n if (solutionCalculated) {\n return solution;\n }\n \n //instantiate path\n solution = new ArrayList<Vertex>();\n \n //create boolean array of visited nodes (default: false)\n boolean[] visited = new boolean[arrayOfVertices.length];\n \n //(for testing)\n NavigateMaze.drawMaze(getVertices());\n \n //call dfs\n dfs(visited, arrayOfVertices[0], \n arrayOfVertices[arrayOfVertices.length - 1]);\n \n //update solutionCalculated to true\n solutionCalculated = true;\n \n //return solution\n return solution;\n \n }" ]
[ "0.6437227", "0.6226352", "0.6193227", "0.60500073", "0.5939259", "0.5916624", "0.5880344", "0.58478427", "0.5832727", "0.58221316", "0.5705578", "0.5701128", "0.56924736", "0.5664431", "0.56237835", "0.5610023", "0.55915874", "0.55879134", "0.5564051", "0.5543681", "0.55365485", "0.5531386", "0.55287707", "0.5524554", "0.55181223", "0.55001825", "0.54970187", "0.5477299", "0.5473092", "0.5436818", "0.5402402", "0.54019845", "0.5393979", "0.5391252", "0.53769106", "0.53645384", "0.5364494", "0.53613347", "0.5351919", "0.533746", "0.5319687", "0.5318154", "0.5305083", "0.5285914", "0.52711403", "0.52637655", "0.52582717", "0.5255559", "0.5242192", "0.5236269", "0.52213615", "0.52151495", "0.521425", "0.51967907", "0.5188288", "0.51851594", "0.5182649", "0.5182383", "0.5176372", "0.5155885", "0.5146005", "0.51441973", "0.51334774", "0.51194674", "0.51156855", "0.5110985", "0.51074547", "0.51073116", "0.51046443", "0.50990343", "0.5094319", "0.5089835", "0.508717", "0.5085565", "0.50821424", "0.50785714", "0.50773", "0.5074254", "0.5070237", "0.5063864", "0.5060869", "0.5059547", "0.50485426", "0.50481427", "0.50475067", "0.5046969", "0.5043585", "0.50353014", "0.503258", "0.5028161", "0.50214005", "0.50213104", "0.5018136", "0.5013899", "0.5012268", "0.50101364", "0.5000084", "0.49945033", "0.49888262", "0.49853808" ]
0.7780745
0
It computes the agents' speed
double progress(double val) { return val * linkDirection; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public double getSpeed();", "double getSpeed();", "protected long travel() {\n\n return Math.round(((1 / Factory.VERTEX_PER_METER_RATIO) / (this.speed / 3.6)) * 1000);\n }", "public void calcSpeed(){\r\n Random rand = new Random();\r\n tire = rand.nextInt(10)+1;\r\n engine = rand.nextInt(10)+1;\r\n weight = rand.nextInt(10)+1;\r\n speed = ((double)(tire+engine+weight))/3;\r\n\r\n //round speed to 2 decimal places\r\n speed = speed*100;\r\n speed = Math.round(speed);\r\n speed = speed/100;\r\n }", "protected float getMovementSpeed() {\r\n\t\tfloat speed = getSpeed();\r\n\t\treturn speed / 17f + (float) Math.pow(Math.sqrt(speed), 1.225f) * 0.985f;\r\n\t}", "public abstract double getSpeed();", "public double getSpeed() {\r\n\t\tif (this.base.equals(\"zombie\")) {\r\n\t\t\treturn speed;\r\n\t\t}\r\n\t\treturn 0;\r\n\t}", "@Override\n\t\tpublic int getSpeed() {\n\t\t\treturn i+20;\n\t\t}", "public void calcSpeed() {\n double dist = 0;\n double time = 0;\n for (int i = 0; i < this.length() - 1; i++) {\n dist += get(i).distanceTo(get(i + 1));\n }\n// since it is known that 1ms between frames - calc number of frames * inter_frame_time\n time = (get(length() - 1).getTime() - get(0).getTime()) * INTER_FRAME_TIME;\n\n avgSpeed = dist / time;\n }", "public void setSpeed() {\r\n\t\tthis.currSpeed = this.maxSpeed * this.myStrategy.setEffort(this.distRun);\r\n\t}", "public double speed()\r\n {\r\n return speed;\r\n }", "private int speed() {\n final int slowfactor = 3;\n return speed * (cd.isSlow(curpos) ? slowfactor : 1);\n }", "public void accelerate(){\n speed += 5;\n }", "public double getSpeed() {\n\t\tdouble speed = 0;\n\t\tfor (Motor motor : this) {\n\t\t\tspeed += motor.get();\n\t\t}\n\t\treturn speed / this.size();\n\t}", "@Override\n public double speed() {\n \tif(Robot.drive.getDistance() > 120) {\n \t\treturn 0.2;\n \t}\n \treturn speed;\n }", "int getSpeed();", "int getSpeed();", "int getSpeed();", "int getSpeed();", "int getSpeed();", "int getSpeed();", "int getSimspeed();", "@Override\n\t\tpublic int getSpeed() {\n\t\t\treturn i+30;\n\t\t}", "@Override\r\n\tpublic void speed() {\n\t}", "public float getSpeed (){\n return speed;\n }", "public abstract int getSpeed();", "public abstract int getSpeed();", "public double getCurrentSpeed();", "private void setSpeedValues(){\n minSpeed = trackingList.get(0).getSpeed();\n maxSpeed = trackingList.get(0).getSpeed();\n averageSpeed = trackingList.get(0).getSpeed();\n\n double sumSpeed =0.0;\n for (TrackingEntry entry:trackingList) {\n\n sumSpeed += entry.getSpeed();\n\n //sets min Speed\n if (minSpeed > entry.getSpeed()){\n minSpeed = entry.getSpeed();\n }\n //sets max Speed\n if (maxSpeed < entry.getSpeed()) {\n maxSpeed = entry.getSpeed();\n }\n\n }\n\n averageSpeed = sumSpeed/trackingList.size();\n }", "public double speed() {\n /* dx = sin(angle) * speed\n dy = cos(angle-180) * speed = -cos(angle)\n sqrt((dx)^2 + (-dy)^2 = sin(angle)^2*speed^2 + cos(angle)^2*speed^2)=\n sqrt(speed^2 *(cos(angle)^2+sin(angle)^2) = sqrt(speed^2*1)=speed\n */\n //distance math functions\n //to calculate the square root of the sum of squares of numbers passed to it as arguments.\n return Math.hypot(this.dx, this.dy);\n }", "@Override\n protected double speedFactor() {\n return getEnginePower() * 0.003;\n }", "private void calculateVelocity() {\n\t\tthis.velocity = Math.sqrt((this.roughRange *this.roughRange * this.gravity_Math)\n\t\t\t\t/ ((this.roughRange * Math.sin(2 * angle)) + (2\n\t\t\t\t\t\t* Constant.heroBaseHeight * Math.cos(angle) * Math\n\t\t\t\t\t\t\t.cos(angle))));\n\t\t\n\t}", "private void updatePointSpeeds() {\n\t\tfor (int i = 0; i < locations.size(); i++) {\n\t\t\tLocationStructure loc = locations.get(i);\t\t\n\t\t\tDouble dist = Double.MIN_VALUE;\n\t\t\tDouble lat1 = loc.getLatitude().doubleValue();\n\t\t\tDouble lon1 = loc.getLongitude().doubleValue();\n\t\t\t\n\t\t\tDate d = times.get(i);\n\t\t\t\n\t\t\tif( i+1 < locations.size()) {\n\t\t\t\tloc = locations.get(i+1);\n\t\t\t\tDouble lat2 = loc.getLatitude().doubleValue();\n\t\t\t\tDouble lon2 = loc.getLongitude().doubleValue();\n\t\t\t\tdist = calculateDistance(lat1, lon1, lat2, lon2);\n\t\t\t\t\n\t\t\t\tDate d1 = times.get(i+1);\n\t\t\t\tDateTime dt1 = new DateTime(d);\n\t\t\t\tDateTime dt2 = new DateTime(d1);\n\t\t\t\tint seconds = Seconds.secondsBetween(dt1, dt2).getSeconds();\t\t\t\n\t\t\t\tDouble pd = (dist/seconds)*60;\n\t\t\t\tif(!pd.isNaN()) {\n\t\t\t\t\tpointSpeed.add(pd);\t\t\n\t\t\t\t\tSystem.out.println(\"BUS STATE-- Added point speed of \"+ (dist/seconds)*60 + \" for \" +this.vehicleRef);\n\t\t\t\t}\n\t\t\t} else break;\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\n\t}", "public void performance() {\n\t\tPositionVo s = currentPerformed.getFirst();\n\t\t@SuppressWarnings(\"unused\")\n\t\tPositionVo e = currentPerformed.getLast();\n//\t\tint timeCost = (int) (e.getTime() - s.getTime());\n//\t\tint span = (int) Math.abs(e.getHead().getX() - s.getHead().getX());\n\t\t// TODO according to the moving rate decide how many nodes fill the gap\n\n\t\tint size = currentPerformed.size();\n\n\t\tfor (int i = 1; i < size * 4 - 4; i += 4) {\n\t\t\tPositionVo s1 = currentPerformed.get(i - 1);\n\t\t\tPositionVo s2 = currentPerformed.get(i);\n\n\t\t\tPoint[] delta_Head = sim_dda(s1.getHead(), s2.getHead(), 4);\n\t\t\tPoint[] delta_left_hand = sim_dda(s1.getLeftHand(), s2.getRightHand(), 4);\n\t\t\tPoint[] delta_right_hand = sim_dda(s1.getRightHand(), s2.getRightHand(), 4);\n\n\t\t\tfor (int j = 0; j < 3; j++)\n\t\t\t\tcurrentPerformed.add(i + j, new PositionVo(delta_Head[j], delta_left_hand[j], delta_right_hand[j]));\n\t\t}\n\n\t\tnCount = currentPerformed.size();\n\t\tcursor = 0;\n\n\t\t/* (*)absolute point = initial point - current point */\n\t\treferX -= s.getHead().getX();\n\t\treferY += s.getHead().getY();\n\t\tcurrReferX = referX;\n\t\tcurrReferY = referY;\n\n\t\t/* update gui */\n\t\tmanager.proceBar.setMinimum(0);\n\t\tmanager.proceBar.setMaximum(nCount);\n\t\t/* end */\n\n\t\tstartTimer((int) (ANIMATE_FPS * speedRate));\n\t}", "public Vector2 getSpeed() { return speed; }", "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 }", "@Override\r\n\tpublic void initialise(Agent agent) {\n\t\tthis.maxSpeed = agent.getMaxSpeed();\r\n\t\tsprint = maxSpeed*1.5f;\r\n\t}", "public double getSpeed() {\r\n\t\treturn speed;\r\n\t}", "public float getSpeed(List<Integer> collectTime);", "public int getSpeed()\r\n\t{\n\t\treturn 90;\r\n\t}", "public int speed()\n \n {\n \t\n\t\treturn (((7 - speedClass) * 5 ) + 7);\n }", "private double getElevatorSpeed()\n {\n // if second speed is toggled use second instead of main speed\n if (useSecondSpeed)\n {\n return mSecondSpeed * mDirection * -1;\n }\n else\n { // else just use main speed\n return mSpeed * mDirection * -1;\n }\n }", "public double getSpeed() {\n return speed;\n }", "public void increaseSpeed() {\n\t\tSystem.out.println(\"Cyborg speeds up!!!\");\n\t\tfor (int i = 0; i < gameObjects.size(); i++)\n\t\t{\n\t\t\tif (gameObjects.get(i) instanceof Cyborg)\n\t\t\t{\n\t\t\t\t((Cyborg) gameObjects.get(i)).increaseSpeed();\n\t\t\t}\n\t\t}\n\t}", "@Override\npublic int accelerate(int speed) {\n\tint carSpeed=getSpeed();\n\treturn carSpeed;\n}", "public double getSpeed() {\n return speed;\n }", "public double getSpeed() {\n return speed;\n }", "public double getSpeed() {\n return speed;\n }", "public double getSpeed() {\n return speed;\n }", "public float getSpeed() {\n\t\tfloat result = (float) Math.sqrt(velocity.x * velocity.x + velocity.y * velocity.y);\n\t\treturn result;\n\t}", "public int getSpeed(){\r\n\t\treturn speed;\r\n\t}", "public void faster()\n {\n if(speed < 9){\n speed += 1;\n }\n }", "@Override\r\n\tpublic double getSpeed() {\n\t\treturn this.speed;\r\n\t}", "public int getSpeed()\n {\n return (int) (getMovement().getLength() * 10);\n }", "@Override\n\tpublic double calculateVelocity() {\n\t\tdouble result = distance / time + velocitySame - velocityReverse;\n\t\treturn result;\n\t}", "public float getSpeed() {\n return speed;\n }", "public float getSpeed() {\n return speed;\n }", "public void verifySpeeds() {\n double maxStartSpeed = 0.0;\n double[] startSpeeds = new double[segments.size() + 1];\n startSpeeds[segments.size()] = 0.0;\n for (int i = segments.size() - 1; i >= 0; i--) {\n PathSegment segment = segments.get(i);\n maxStartSpeed += Math\n .sqrt(maxStartSpeed * maxStartSpeed + 2 * maxAccel * segment.getLength());\n startSpeeds[i] = segment.getStartState().vel();\n if (startSpeeds[i] > maxStartSpeed) {\n startSpeeds[i] = maxStartSpeed;\n }\n maxStartSpeed = startSpeeds[i];\n }\n for (int i = 0; i < segments.size(); i++) {\n PathSegment segment = segments.get(i);\n double endSpeed = startSpeeds[i + 1];\n MotionState startState = (i > 0) ? segments.get(i - 1).getEndState() : new MotionState(0, 0, 0, 0);\n startState = new MotionState(0, 0, startState.vel(), startState.vel());\n segment.createMotionProfiler(startState, endSpeed);\n }\n }", "public int getSpeed() {return ship.getSpeed();}", "public int getSpeed() {\r\n return speed;\r\n }", "public double getMovementSpeed() {\n return movementSpeed;\n }", "public int getSpeed(){return this.speed;}", "public static int calculateRobotSpeed(Robot robot, ArrayList<Position> route) {\n\t\t\n\t\tPosition front = robot.getFront(); \n\t\tPosition back = robot.getBack(); \n\t\tPosition in = route.get(1);\t\t \n\t\t\n\t\t// distance from robot's front to back\n\t\tdouble frontToBack = Math.sqrt(Math.pow(back.getX()-front.getX(),2)+\n\t\t\t\tMath.pow(back.getY()-front.getY(),2)); // p0->c (b) \n\t\t// distance from robot's back to in point in port\n\t\tdouble backToIn = Math.sqrt(Math.pow(back.getX()-in.getX(),2)+\n\t\t\t\tMath.pow(back.getY()-in.getY(),2)); // p1->c (a)\n\t\t// distance from robot's front to in point in port\n\t\tdouble frontToIn = Math.sqrt(Math.pow(in.getX()-front.getX(),2)+\n\t\t\t\tMath.pow(in.getY()-front.getY(),2)); // p0->p1 (c)\n\t\t\n\t\t// calculate angle between front/back and back/in\n\t\tdouble angle = Math.toDegrees(Math.acos((backToIn*backToIn+frontToBack*frontToBack-frontToIn*frontToIn)\n\t\t\t\t/(2*backToIn*frontToBack)));\n\t\t\n\t\treturn (int) Math.abs(angle*speedAngleConstant);\t\n\t}", "org.auvua.utils.protobuffer.AUVprotocol.AUVCommand.Movement getSpeed();", "public float getSpeed() {\n return this.speedValue;\n }", "public float getSpeed()\n\t{\n\t\treturn speed;\n\t}", "public double getSpeed(){\r\n double Speed;\r\n Speed = (double)(Distance * TimeConversion)/(getMinutes() * SecondsConversion + getSeconds()); \r\n if ((getMinutes()==0) || (getSeconds() == 0)) {\r\n Speed =0;\r\n } //Closing bracket if statement\r\n return Speed;\r\n }", "public int getSpeed() {\n\t\t\treturn 0;\n\t\t}", "protected void execute() {\n \t// Scales the speed based on a proportion of ideal voltage over actual voltage\n \tRobot.shooter.talon.set(0.59 * (12.5 / Robot.pdp.getVoltage()));\n// \tRobot.shooter.talon.enable();\n// \tRobot.shooter.talon.set(Shooter.IDEAL_SPEED * (12.5 / Robot.pdp.getVoltage()));\n }", "public float getSpeed()\n\t{\n\t\treturn this.speed;\n\t}", "public float getSpeed()\n\t{\n\t\treturn this.speed;\n\t}", "public int getSpeed() {\n return speed;\n }", "public int getSpeed() {\n return speed;\n }", "public int getSpeed() {\n return speed;\n }", "public int getSpeed() {\n return speed;\n }", "public int getSpeed() {\n return speed;\n }", "public int getSpeed()\n\t{\n\t\treturn speed;\n\t}", "public int getSpeed() {\n return speed_;\n }", "public int getSpeed() {\n return speed_;\n }", "public int getSpeed() {\n return speed_;\n }", "public int getSpeed() {\n return speed_;\n }", "public int getSpeed() {\n return speed_;\n }", "public int getSpeed() {\n return speed_;\n }", "public float getSpeed() {\n\t\treturn speed;\n\t}", "protected void accelerate(int direction){\n if (boatStats.getSpeed() < boatStats.getMaxSpeed()) {\n boatStats.setSpeed(boatStats.getSpeed() + boatStats.getAcceleration() * direction);\n }\n }", "@Override\n\tpublic\n\tvoid speed() {\n\t\t\n\t}", "public void setSpeed(float val) {speed = val;}", "public double getCurrentSpeed(){\r\n return speed;\r\n }", "public void startEngine(){\n currentSpeed = 0.1;\n }", "private void setSpeed() {\n double cVel = cAccel*0.1;\n speed += round(mpsToMph(cVel), 2);\n speedOutput.setText(String.valueOf(speed));\n }", "public void setSpeed() {\n\t\tthis.ySpd = this.MINSPEED + randGen.nextFloat() * (this.MAXSPEED - this.MINSPEED);\n\t\tthis.xSpd = this.MINSPEED + randGen.nextFloat() * (this.MAXSPEED - this.MINSPEED);\n\t}", "public int getWalkSpeed()\n{\n return walkSpeed;\n}", "public double getSpeedPerFrame(){\r\n\t\treturn speed;\r\n\t}", "void changeUpdateSpeed();", "@Override\n\tpublic int getMotorSpeed() {\n\t\tupdateIR();\n\t\treturn direction*360;\n\t}", "public static void new_speed( Body body, double t ){\r\n body.currentState.vx = body.currentState.vx + body.currentState.ax * t; // new x velocity\r\n body.currentState.vy = body.currentState.vy + body.currentState.ay * t; // new y velocity\r\n body.currentState.vz = body.currentState.vz + body.currentState.az * t; // new z velocity\r\n }", "public double getSpeed() {\n return m_master.getEncoder().getVelocity() / MotorConstants.kNeoRPM;\n }", "protected void calcVelocity()\n\t{}", "public double getSpeedMach() {\n\t\treturn speedMach;\n\t}", "public double getCommandSpeed();", "public int getSpeed() {\n return speed_;\n }" ]
[ "0.6754982", "0.6750929", "0.67089045", "0.66360086", "0.6623297", "0.66072196", "0.6510198", "0.6507167", "0.65004814", "0.6454249", "0.6450234", "0.64472026", "0.641602", "0.63918614", "0.6389906", "0.6383413", "0.6383413", "0.6383413", "0.6383413", "0.6383413", "0.6383413", "0.6364353", "0.6351402", "0.63283485", "0.63259524", "0.63254714", "0.63254714", "0.6319087", "0.6286487", "0.6266144", "0.62523115", "0.6234947", "0.6233273", "0.62206316", "0.6217968", "0.6203486", "0.6202793", "0.61859286", "0.6177225", "0.61760646", "0.616638", "0.616302", "0.6162168", "0.61564565", "0.6153367", "0.6152913", "0.6152913", "0.6152913", "0.6152913", "0.6137793", "0.6124574", "0.6108446", "0.61052716", "0.61006975", "0.60841876", "0.60766524", "0.60766524", "0.6062675", "0.6044021", "0.6041551", "0.60403574", "0.60393244", "0.60330665", "0.60258484", "0.6023839", "0.6018717", "0.60078114", "0.59909344", "0.598693", "0.5975482", "0.5975482", "0.59701115", "0.59701115", "0.59701115", "0.59701115", "0.59701115", "0.5966635", "0.59658957", "0.59658957", "0.59658957", "0.59658957", "0.59658957", "0.59658957", "0.5965032", "0.5962428", "0.59584606", "0.59541696", "0.59525436", "0.59516084", "0.59442383", "0.59349793", "0.59346", "0.59326494", "0.59262854", "0.5917555", "0.5913451", "0.5912564", "0.5909498", "0.59089357", "0.59051937", "0.5893248" ]
0.0
-1
It makes the agent move along the computed route
public void keepWalking() { // move along the current segment if (UserParameters.socialInteraction) speed = progressSocial(moveRate); else speed = progress(moveRate); currentIndex += speed; // check to see if the progress has taken the current index beyond its goal // given the direction of movement. If so, proceed to the next edge if (linkDirection == 1 && currentIndex > endIndex) { Coordinate currentPos = segment.extractPoint(endIndex); updatePosition(currentPos); transitionToNextEdge(currentIndex - endIndex); } else if (linkDirection == -1 && currentIndex < startIndex) { Coordinate currentPos = segment.extractPoint(startIndex); updatePosition(currentPos); transitionToNextEdge(startIndex - currentIndex); } else { // just update the position! Coordinate currentPos = segment.extractPoint(currentIndex); updatePosition(currentPos); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 void move() {\n\n\tGrid<Actor> gr = getGrid();\n\tif (gr == null) {\n\n\t return;\n\t}\n\n\tLocation loc = getLocation();\n\tif (gr.isValid(next)) {\n\n\t setDirection(loc.getDirectionToward(next));\n\t moveTo(next);\n\n\t int counter = dirCounter.get(getDirection());\n\t dirCounter.put(getDirection(), ++counter);\n\n\t if (!crossLocation.isEmpty()) {\n\t\t\n\t\t//reset the node of previously occupied location\n\t\tArrayList<Location> lastNode = crossLocation.pop();\n\t\tlastNode.add(next);\n\t\tcrossLocation.push(lastNode);\t\n\t\t\n\t\t//push the node of current location\n\t\tArrayList<Location> currentNode = new ArrayList<Location>();\n\t\tcurrentNode.add(getLocation());\n\t\tcurrentNode.add(loc);\n\n\t\tcrossLocation.push(currentNode);\t\n\t }\n\n\t} else {\n\t removeSelfFromGrid();\n\t}\n\n\tFlower flower = new Flower(getColor());\n\tflower.putSelfInGrid(gr, loc);\n\t\n\tlast = loc;\n\t\t\n }", "public void move(){\n \n currentFloor = currentFloor + ( 1 * this.direction);\n //if we're at the bottom or top after move, flip the bit\n if(Elevator.MIN_FLOOR == currentFloor \n || currentFloor == Elevator.MAX_FLOOR)\n this.direction *= -1;\n \n if(destinedPassengers[ currentFloor ] > 0)\n elevatorStop( currentFloor, true );\n \n if(building.floor(currentFloor).passengersWaiting() > 0)\n elevatorStop(currentFloor, false);\n \n }", "public void move()\n\t{\n\t\tVector v = ship.v;\n\t\tb = b.getLocation().add(v).getBlock();\n\t\tif(triangle != null) triangle.move();\n\t\tif(rear != null) rear.move();\n\t\tif(foreAndAft != null) foreAndAft.move();\n\t\tif(sails != null) for(int i = 0; i < sails.size(); i++)\n\t\t{\n\t\t\tSail sail = sails.get(i);\n\t\t\tsail.move();\n\t\t}\n\t}", "public void move() {\n\t\tGrid<Actor> gr = getGrid();\n\t\tif (gr == null) {\n\t\t\treturn;\n\t\t}\n\t\tLocation loc = getLocation();\n\t\tLocation next = loc.getAdjacentLocation(getDirection());\n\t\t\n\t\tLocation next2 = next.getAdjacentLocation(getDirection());\n\t\tif (gr.isValid(next2)) {\n\t\t\tmoveTo(next2);\n\t\t} else {\n\t\t\tremoveSelfFromGrid();\n\t\t}\n\t}", "public void move()\n {\n move(WALKING_SPEED);\n }", "public void move(int distance);", "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 }", "@Override\n public void move(){\n setDirectionSpeed(180, 7);\n this.moveTowardsAPoint(target.getCenterX(), target.getCenterY());\n }", "public void moveAgentTo(Agent ag, int door) throws InterruptedException {\n ProcessData data = (ProcessData) agents.get(ag);\n Vertex vertexFrom, vertexTo;\n Message msg;\n MessagePacket msgPacket;\n \n \n if( door < 0 || door >= getArity(ag))\n throw new IllegalArgumentException(\"This door doesn't exist !\");\n\n vertexFrom = data.vertex;\n vertexTo = vertexFrom.neighbour(door);\n\n msg = new StringMessage(ag.toString());\n msgPacket = new MessagePacket(vertexFrom.identity(), door, \n vertexTo.identity(), msg);\n\t\n\tpushMessageSendingEvent(msgPacket,ag);\n\t\n\n\tdata.vertex = vertexTo;\n\tdata.lastVertexSeen = vertexFrom;\n\n stats.add(new MoveStat(ag.getClass()));\n }", "public void move() {\n\t\t\tar.setAhead(10 * fahrtrichtung);\n\n\t\t\t// Wie schnell sich der Roboter drehen soll\n\t\t\tar.setTurnRight(45 * drehrichtung);\n\t\t\tar.execute();\n\t\t\tfarbschema = farbschema * (-1);\n\t\t}", "protected void move()\n {\n // Find a location to move to.\n Debug.print(\"Fish \" + toString() + \" attempting to move. \");\n Location nextLoc = nextLocation();\n\n // If the next location is different, move there.\n if ( ! nextLoc.equals(location()) )\n {\n // Move to new location.\n Location oldLoc = location();\n changeLocation(nextLoc);\n\n // Update direction in case fish had to turn to move.\n Direction newDir = environment().getDirection(oldLoc, nextLoc);\n changeDirection(newDir);\n Debug.println(\" Moves to \" + location() + direction());\n }\n else\n Debug.println(\" Does not move.\");\n }", "void move() {\n\t\tif (reachedEdge()) {\n\t\t\tvelocityX = velocityX * -1;\n\t\t\ty = y + 50;\n\t\t}\n\t\tif (reachedLeft()) {\n\t\t\tvelocityX = velocityX * -1;\n\t\t\ty = y + 50;\n\t\t}\n\n\t\tx = x + velocityX;\n\t}", "public void move(String direction) {\n \n }", "public void move(){\n\t\tif (currentFloor == TOTALFLOORS) currentDirection = \"DOWN\"; else currentDirection =\"UP\";\t\t//sets inital direction for the elevator.\n\t\tfor (int x = 1; x <= TOTALFLOORS; x++){\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//This loop will move the elevator through each floor. \n\t\t\tif (getTotalPassDestFloor()[currentFloor] >0 || destRequest[currentFloor] == 'Y')this.stop(); \t//Checks for the destined passengers or registered request for the current floor.\n\t\t\tif (currentDirection == \"UP\") currentFloor++; else currentFloor--;\t\t\t\t\t\t\t//Moves the elevator up/down based on the direction\n\t\t}\n\t\tif (currentFloor == 8) currentFloor--;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//Adjusts currentfloor value when elevator-\n\t\tif (currentFloor == 0) currentFloor++;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//-is at first or top most floor\n\t}", "public void move() {\n\t\tthis.position.stepForwad();\n\t\tthis.position.spin();\n\t}", "@Override\n public void act()\n {\n Location loc = getLocation();\n int r = loc.getRow();\n int c = loc.getCol();\n int dir = getDirection();\n if(dir == Location.NORTH)\n {\n if(r - START_ROW + 1 > -2*(address & ADDRESS))\n {\n move();\n }\n else\n {\n setDirection(Location.WEST);\n }\n }\n else if(dir == Location.WEST)\n {\n if(c <= RETURN_COL)\n {\n setDirection(Location.SOUTH);\n }\n else\n {\n Bit b = null;\n Actor a = getGrid().get(loc.getAdjacentLocation(Location.SOUTH));\n if(a instanceof Bit) b = (Bit)a;\n if(b != null)\n {\n processBit(b,-c-1);\n }\n move();\n }\n }\n else if(dir == Location.SOUTH)\n {\n if(r == -1)\n {\n setDirection(Location.EAST);\n }\n else\n {\n move();\n }\n }\n else if(dir == Location.EAST)\n {\n move();\n }\n else\n {\n System.err.println(\"yer bus is on an angle bud\");\n }\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 move(){\n x+=xDirection;\n y+=yDirection;\n }", "public void move() {\n\t\tGrid<Actor> gr = getGrid();\n\t\tif (gr == null) {\n\t\t\treturn;\n\t\t}\n\t\tLocation loc = getLocation();\n\t\tif (gr.isValid(next)) {\n\t\t\tsetDirection(getLocation().getDirectionToward(next));\n\t\t\tmoveTo(next);\n\t\t} else {\n\t\t\tremoveSelfFromGrid();\n\t\t}\n\t\tFlower flower = new Flower(getColor());\n\t\tflower.putSelfInGrid(gr, loc);\n\t}", "public void move(Vector start,Vector dist);", "public void move() {\n Grid<Actor> gr = getGrid();\n if (gr == null) {\n return;\n }\n Location loc = getLocation();\n if (gr.isValid(next)) {\n setDirection(getLocation().getDirectionToward(next));\n moveTo(next);\n } else {\n removeSelfFromGrid();\n }\n Flower flower = new Flower(getColor());\n flower.putSelfInGrid(gr, loc);\n }", "public void act(){\n // Removing object, if out of the simulated zone\n if (atWorldEdge()){\n getWorld().removeObject(this);\n return;\n }\n\n //Move Thanos up\n setLocation (getX(), getY() - speed);\n }", "public void move(){\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 move() {\n if(Objects.nonNull(this.position)) {\n Position position = this.getPosition();\n Function<Position, Position> move = moveRobotInDirectionMap.get(position.getDirection());\n this.position = move.apply(position);\n }\n }", "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 }", "private void move() {\n\t\t\tx += Math.PI/12;\n\t\t\thead.locY = intensity * Math.cos(x) + centerY;\n\t\t\thead.yaw = spinYaw(head.yaw, 3f);\n\t\t\t\t\t\n\t\t\tPacketHandler.teleportFakeEntity(player, head.getId(), \n\t\t\t\tnew Location(player.getWorld(), head.locX, head.locY, head.locZ, head.yaw, 0));\n\t\t}", "public void move() {\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t}", "private static void applyRelocationMove(RelocationMove rm, Solution s, double[][] distanceMatrix) \n\t{\n\t\t//This is the node to be relocated\n\t\tCustomer relocatedNode = s.routes.get(rm.fromRoute).customers.get(rm.positionOfRelocated);\n\n\t\t//Take out the relocated node\n\t\ts.routes.get(rm.fromRoute).customers.remove(rm.positionOfRelocated);\n\n\t\t//Reinsert the relocated node into the appropriate position\n\t\t//Where??? -> after the node that WAS (!!!!) located in the rm.positionToBeInserted of the route\n\n\t\t//Watch out!!! \n\t\t//If the relocated customer is reinserted backwards we have to re-insert it in (rm.positionToBeInserted + 1)\n\t\tif (((rm.positionToBeInserted < rm.positionOfRelocated) && (rm.toRoute == rm.fromRoute))||(rm.toRoute!=rm.fromRoute))\n\t\t{\n\t\t\ts.routes.get(rm.toRoute).customers.add(rm.positionToBeInserted + 1, relocatedNode);\n\t\t}\n\t\t////else (if it is reinserted forward) we have to re-insert it in (rm.positionToBeInserted)\n\t\telse\n\t\t{\n\t\t\ts.routes.get(rm.toRoute).customers.add(rm.positionToBeInserted, relocatedNode);\n\t\t}\n\n\t\tSystem.out.println(\"FROM: Vehicle #\" + (rm.fromRoute+1) + \" Position: \" + (rm.positionOfRelocated+1) + \" --> Updated Load = \" + rm.fromUpdLoad);\n\t\tSystem.out.println(\"TO: Vehicle #\" + (rm.toRoute+1) + \" Position: \" + (rm.positionToBeInserted+1) + \" --> Updated Load = \" + rm.toUpdLoad);\n\t\tSystem.out.println(\"--------------------------------------------------\");\n\t\n\t\t\n\t\t//update the cost of the solution and the corresponding cost of the route object in the solution\n\t\ts.cost = s.cost + rm.moveCost;\n\t\ts.routes.get(rm.toRoute).cost = s.routes.get(rm.toRoute).cost + rm.toMoveCost;\n\t\ts.routes.get(rm.fromRoute).cost = s.routes.get(rm.fromRoute).cost + rm.fromMoveCost;\n\t\tif (rm.toRoute != rm.fromRoute) {\n\t\t\ts.routes.get(rm.toRoute).load = rm.toUpdLoad;\n\t\t\ts.routes.get(rm.fromRoute).load = rm.fromUpdLoad;\n\t\t}\n\t\telse {\n\t\t\ts.routes.get(rm.toRoute).load = rm.toUpdLoad;\t\t\t\n\t\t}\n\n\t}", "@Override\n protected void processPathAction(GridNode start, GridNode goal, Stack<GridNode> path) {\n path.pop();\n\n // Make the robot follow the path\n Mover mover = new Mover(\n robot.getDifferentialPilot(),\n new LightSensor(leftSensorPort),\n new LightSensor(rightSensorPort),\n path,\n initialDirection);\n mover.run();\n }", "public void move() {\n\r\n\t}", "public void move() {\n switch (route) {\n case UP:\n moveBody();\n\n // turn snake direction to the up\n snakeParts.set(0,\n new Ellipse2D.Double(snakeParts.get(0).getMinX(), snakeParts.get(0).getMinY() - 20, SNAKE_X_SIZE, SNAKE_Y_SIZE));\n if (snakeParts.get(0).getMinY() < 0) {\n over = true;\n }\n break;\n\n case DOWN:\n moveBody();\n\n // turn snake direction to the down\n snakeParts.set(0,\n new Ellipse2D.Double(snakeParts.get(0).getMinX(), snakeParts.get(0).getMinY() + 20, SNAKE_X_SIZE, SNAKE_Y_SIZE));\n if (snakeParts.get(0).getMaxY() > gameGround.getBounds().getMaxY()) {\n over = true;\n }\n break;\n\n case LEFT:\n moveBody();\n\n // turn snake direction to the left\n snakeParts.set(0,\n new Ellipse2D.Double(snakeParts.get(0).getMinX() - 20, snakeParts.get(0).getMinY(), SNAKE_X_SIZE, SNAKE_Y_SIZE));\n if (snakeParts.get(0).getMinX() < 0) {\n over = true;\n }\n break;\n\n case RIGHT:\n moveBody();\n\n // turn snake direction to the right\n snakeParts.set(0,\n new Ellipse2D.Double(snakeParts.get(0).getMinX() + 20, snakeParts.get(0).getMinY(), SNAKE_X_SIZE, SNAKE_Y_SIZE));\n if (snakeParts.get(0).getMaxX() > gameGround.getBounds().getMaxX()) {\n over = true;\n }\n break;\n\n default:\n new Exception(\"Unexpected Direction value!\").printStackTrace();\n break;\n }\n }", "public void makeMove(Location loc)\n {\n \tLocation curLoc = getLocation();\n \tint curDirection = getDirection();\n // get 2 left locations\n\t\tLocation leftNeighborLoc = curLoc.getAdjacentLocation(curDirection + Location.LEFT);\n Location leftNextNeighborLoc = leftNeighborLoc.getAdjacentLocation(curDirection + Location.LEFT);\n // get 2 right locations\n Location rightNeighborLoc = curLoc.getAdjacentLocation(curDirection + Location.RIGHT);\n Location rightNextNeighborLoc = rightNeighborLoc.getAdjacentLocation(curDirection + Location.RIGHT);\n // initial a null\n Actor leftNeighborActor = null;\n Actor leftNextNeighborActor = null;\n Actor rightNeighborActor = null;\n Actor rightNextNeighborActor = null;\n\n boolean isLeftValid = false;\n boolean isRightValid = false;\n\n Grid<Actor> grid = getGrid();\n // if left valid\n if (grid.isValid(leftNeighborLoc) && grid.isValid(leftNextNeighborLoc))\n {\n \tleftNeighborActor = grid.get(leftNeighborLoc);\n \tleftNextNeighborActor = grid.get(leftNextNeighborLoc);\n \t\n \tif (leftNeighborActor == null && leftNextNeighborActor == null) {\n \t\tisLeftValid = true;\n }\n }\n // if right valid\n if (grid.isValid(rightNeighborLoc) && grid.isValid(rightNextNeighborLoc))\n {\n \trightNeighborActor = grid.get(rightNeighborLoc);\n \trightNextNeighborActor = grid.get(rightNextNeighborLoc);\n\n \tif (rightNeighborActor == null && leftNextNeighborActor == null) {\n \t\tisRightValid = true;\n }\n }\n // if both valid\n if (isLeftValid && isRightValid)\n {\n\t // move ramdonly\n if (Math.random() < 0.5)\n\t {\n\t \tmoveTo(leftNextNeighborLoc);\n\t \n\t }\n\t else{\n\t \tmoveTo(rightNextNeighborLoc);\n\t }\n }\n // right valid only\n else if (isRightValid && !isLeftValid)\n {\n \tmoveTo(rightNextNeighborLoc);\n }\n // left valid only\n else if (!isRightValid && isLeftValid)\n {\n \tmoveTo(leftNextNeighborLoc);\n }\n else\n {\n \tsuper.makeMove(loc);\n }\n \n }", "public void move() {\n\t\tmoveX();\n\t\tmoveY();\n\t}", "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 }", "public void updatemove() {\n\t\tmove = new Movement(getX(), getY(),dungeon,this);\n\t\t//System.out.println(\"Updated\");\n\t\tnotifys();\n\t\tif(this.getInvincible()) {\n\t\t\tsteptracer++;\n\t\t}\n\t\tdungeon.checkGoal();\n\t}", "void makeMove(Location loc);", "public void move() {\n\t\tif (type.equals(\"Fast\")) {\n\t\t\tspeed = 2;\n\t\t}else if (type.equals(\"Slow\")){\n\t\t\tspeed = 4;\n\t\t}\n\t\t\n\t\tif (rand.nextInt(speed) == 1){\n\t\t\tif (currentLocation.x - ChristopherColumbusLocation.x < 0) {\n\t\t\t\tif (currentLocation.x + 1 < oceanMap.getDimensions()) {\n\t\t\t\t\tcurrentLocation.x++;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (currentLocation.x != 0) {\t\t\t\t\n\t\t\t\t\tcurrentLocation.x--;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (currentLocation.y - ChristopherColumbusLocation.y < 0) {\n\t\t\t\tif (currentLocation.y + 1 < oceanMap.getDimensions()) {\n\t\t\t\t\tcurrentLocation.y++;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (currentLocation.y != 0) {\n\t\t\t\t\tcurrentLocation.y--;\n\t\t\t\t}\n\t\t\t} \n\t\t}\n\t}", "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 }", "public void makeMove() {\n\t\tif (CheckForVictory(this)) {\n\t\t\t// System.out.println(\"VICTORY\");\n\t\t\tInterface.goalReached = true;\n\t\t\tfor (int i = 0; i < tmpStrings.length; i++) {\n\t\t\t\tif (moveOrder[i] == 0)\n\t\t\t\t\ttmpStrings[i] = \"turn left\";\n\t\t\t\telse if (moveOrder[i] == 1)\n\t\t\t\t\ttmpStrings[i] = \"turn right\";\n\t\t\t\telse\n\t\t\t\t\ttmpStrings[i] = \"go forward\";\n\n\t\t\t\tInterface.info.setText(\"Generation: \" + Parallel.generationNo + 1 + \" and closest distance to goal: \" + 0);\n\t\t\t}\n\t\t} else {\n\t\t\tmoveOrder[this.movesMade] = moves.remove();\n\t\t\tswitch (moveOrder[this.movesMade]) {\n\t\t\tcase (0):\n\t\t\t\tthis.movesMade++;\n\t\t\t\tif (face == 0)\n\t\t\t\t\tface = 3;\n\t\t\t\telse\n\t\t\t\t\tface--;\n\t\t\t\tbreak;\n\t\t\tcase (1):\n\t\t\t\tthis.movesMade++;\n\t\t\t\tif (face == 3)\n\t\t\t\t\tface = 0;\n\t\t\t\telse\n\t\t\t\t\tface++;\n\t\t\t\tbreak;\n\t\t\tcase (2):\n\t\t\t\tthis.movesMade++;\n\t\t\t\tif (face == 0 && Y - 1 >= 0)\n\t\t\t\t\tY--;\n\t\t\t\telse if (face == 1 && X + 1 <= map[0].length - 1)\n\t\t\t\t\tX++;\n\t\t\t\telse if (face == 2 && Y + 1 <= map.length - 1)\n\t\t\t\t\tY++;\n\t\t\t\telse if (face == 3 && X - 1 >= 0)\n\t\t\t\t\tX--;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tSystem.out.println(\"Error making move :(\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "public void move() {\n energy -= 0.03;\n if (energy < 0) {\n energy = 0;\n }\n }", "public void move() {\n super.move(DIRECTION.getRandom());\n }", "public void move() throws InstructionExecutionException\r\n\t{\r\n\t\t\r\n\t\ttry \r\n\t\t{\r\n\t\t\tStreet street=this.getHeadingStreet();\r\n\t\t\tif(street==null){\r\n\t\t\t\tString err=\"WALL·E says: There is no street in direction \"+this.getCurrentHeading();\r\n\t\t\t\tif(isSwing()){\r\n\t\t\t\t\tJOptionPane.showMessageDialog(null, err);\r\n\t\t\t\t}\r\n\t\t\t\tthrow new InstructionExecutionException(err);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tPlace nextPlace=street.nextPlace(this.currentPlace);\r\n\t\t\tif (street.isOpen()){\r\n\t\t\t\tthis.currentPlace=nextPlace;\r\n\t\t\t\tif(isSwing()){\r\n\t\t\t\t\tthis.navigationPanel.updateCell(currentDirection, nextPlace);\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}else{\r\n\t\t\t\tString err=\"WALL·E says: Arrggg, there is a street but it is closed!\";\r\n\t\t\t\tif(isSwing()){\r\n\t\t\t\t\tJOptionPane.showMessageDialog(null, err);\r\n\t\t\t\t}\r\n\t\t\t\tthrow new InstructionExecutionException(err);\r\n\t\t\t}\r\n\t\t}catch (Exception e){\r\n\t\t\tthrow e;\r\n\t\t}\r\n\t}", "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 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 move(String direction);", "public void move();", "public void move();", "@Override\r\n public void move(List<Building> landmark, List<Pair<Integer, Integer>> orderedPath) {\r\n int moveChoice = (new Random()).nextInt(2);\r\n // 50% chance to move or not move\r\n if (moveChoice == 0){\r\n // Does not move, i.e. does nothing\r\n }\r\n else if (moveChoice == 1){\r\n // Move\r\n int directionChoice = (new Random()).nextInt(2);\r\n if (directionChoice == 0) {\r\n moveUpPath();\r\n } else if (directionChoice == 1) {\r\n moveDownPath();\r\n }\r\n }\r\n }", "public void move() {\r\n posX += movementX;\r\n posY += movementY;\r\n anchorX += movementX;\r\n anchorY += movementY;\r\n }", "public void move() {\n\tupdateSwapTime();\n\tupdateAttackTime();\n\n\tif (enemyNear) {\n\t if (moved) {\n\t\tstopMove();\n\t\tmoved = false;\n\t }\n\t} else {\n\t if (!moved) {\n\t\tcontinueMove();\n\t\tmoved = true;\n\t }\n\n\t x += dx;\n\t y += dy;\n\n\t if (x < speed) {\n\t\tx = speed;\n\t\tdx = (-1) * dx;\n\t }\n\n\t if (y < speed) {\n\t\ty = speed;\n\t\tdy = (-1) * dy;\n\t }\n\n\t if (x > MapSize.getSIZE().getWidth() - 40) {\n\t\tx = MapSize.getSIZE().getWidth() - 40;\n\t\tdx = (-1) * dx;\n\t }\n\n\t if (y > MapSize.getSIZE().getHeight() - 40) {\n\t\ty = MapSize.getSIZE().getHeight() - 40;\n\t\tdy = (-1) * dy;\n\t }\n\t}\n }", "public void move() {\n\t\tthis.hero.setPF(1);\n\t\tthis.hero.setState(this.hero.getMoved());\n\t}", "@Override\r\n public void move() {\r\n Grid<Actor> gr = getGrid();\r\n if (gr == null) {\r\n return;\r\n }\r\n Location loc = getLocation();\r\n if (gr.isValid(next)) {\r\n setDirection(getLocation().getDirectionToward(next));\r\n moveTo(next);\r\n } else {\r\n removeSelfFromGrid();\r\n }\r\n Flower flower = new Flower(getColor());\r\n flower.putSelfInGrid(gr, loc);\r\n }", "public void makeMove(Location loc)\n {\n if (loc == null)\n removeSelfFromGrid();\n else\n {\n int newDirection = getLocation().getDirectionToward(loc);\n Location nextLocation = getLocation().getAdjacentLocation(newDirection);\n Actor otherActor = getGrid().get(nextLocation);\n if(otherActor != null)\n {\n if(otherActor instanceof AbstractPokemon)\n {\n AbstractPokemon otherPokemon = (AbstractPokemon) otherActor;\n battle(otherPokemon);\n }\n else\n {\n PokemonTrainer otherTrainer = (PokemonTrainer) otherActor;\n battleTrainer(otherTrainer);\n }\n }\n if(getGrid() != null)\n moveTo(loc);\n }\n }", "P applyMovement(M move);", "@Override\n public Status move(){\n\n if(onNode.getNextNode(this)==null){\n return Status.NOT_EMPTY_CAR;\n }\n List<Train> on = onNode.getNextNode(this).getTrains();\n if(!on.isEmpty()) return Status.CRASHED;\n\n Node next = onNode.getNextNode(this);\n prevNode.removeTrain(this);\n next.addTrain(this);\n x=next.getX();\n y=next.getY();\n try {\n ((Station)next).setGetOff();\n }\n catch (Exception e) {}\n \n return nextCar.move();\n }", "public void move() {\r\n\t\tSystem.out.print(\"This Goose moves forward\");\r\n\t}", "public void moveActor();", "public void moveRobber(HexLocation loc) {\n\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\t\tif(path.size() != 0) {\n\t\t\tCoordinate c = path.get(0);\n\t\t\tint x1 = c.x;\n\t\t\tint y1 = c.y;\n\t\t\t\t\n\t\t\tif(Math.abs(x1 - x) > speed || Math.abs(y1 - y) > speed) {\n\t\t\t\tif(this.x > x1) {\n\t\t\t\t\tvy = 0;\n\t\t\t\t\ttx.translate(-speed, vy);\n\t\t\t\t\tthis.x -= speed;\n\t\t\t\t}\n\t\t\t\n\t\t\t\telse if(this.x < x1) {\n\t\t\t\t\t//this.x += speed;\n\t\t\t\t\tvy = 0;\n\t\t\t\t\ttx.translate(speed, vy);\n\t\t\t\t\tthis.x += speed;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse if(this.y > y1) {\n\t\t\t\t\t//vx = 0;\n\t\t\t\t\ttx.translate(0, -speed);\n\t\t\t\t\tthis.y -= speed;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse if(this.y < y1) {\n\t\t\t\t\t//vx = 0;\n\t\t\t\t\ttx.translate(0, speed);\n\t\t\t\t\tthis.y += speed;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\telse {\n\t\t\t\tpath.remove(0);\n\t\t\t}\n\t\t\t\t\n\t\t}\n\t}", "public void move() {\n\n }", "@Override\n\tpublic void move() {\n\t\tSystem.out.println(\"Driving a airplane!\");\n\t}", "RelocationMove() \n\t{\n\t}", "void move();", "public boolean moveStep() {\n\t\t// TODO: take orientation into account\n\t\t\n\t\t// Work out the distance to the destination\n\t\tDouble2D delta = destination.subtract(getPosition());\n//\t\tSystem.out.println(this.toString() + \"has \" + delta.length() + \" to go.\"); // Debug\n\t \n\t // If this is below a small value, we have arrived, return true\n\t if (delta.length() < 4) return true;\n\t \n\t // FIXME: a better model allow different speed for different vehicle class\n\t // update the speed of vehicle\n\t velocity.setTo(delta.x * 0.004, delta.y * 0.004);;\n\t \n\t // FIXME: avoidance?\n\t \n\t // FIXME: orientation?\n//\t\torientation += angularRate;\n\t // update the vehicle location\n\t\tDouble2D location = _siteState.getArea().getObjectLocation(this);\n\t\t_siteState.getArea().setObjectLocation(this, location.add(new Double2D(velocity)));\n\t \n\t\treturn false;\n\t}", "public void step(){\n if (this.jobs.contains(this.currentFloor)){ //we arrived at our destination\n this.openDoor();\n this.leavePeople();\n this.deleteJob(this.currentFloor);\n } else {\n this.closeDoor();\n this.changeState();\n this.move();\n }\n }", "public void moveAllAgents() {\n\t\tPoint moveTo \t\t= null;\n\t\tGameClient client \t= null;\n\t\t\n\t\tfor(Player p : playerList) {\n\t\t\tif(p.getType() == PlayerType.Agent) {\n\t\t\t\tclient = HandleCommunication.findClient(p.getName(), server.getConnectedClientList());\n\t\t\t\tmoveTo = getSafeTeleportPosition();\n\t\t\t\tmovePlayer(p.getName(), p.getPosition(), moveTo, false);\n\t\t\t\tserver.sendMessageToClient(client.getClientSocket(), \"@124@\" + moveTo.x + \"@\" + moveTo.y + \"@\");\n\t\t\t}\n\t\t}\n\t}", "public void act() \n {\n move(-16);\n \n \n if (isAtEdge())\n {\n setLocation(700,getY());\n }\n \n if (isTouching(Shots.class))\n {\n getWorld().addObject(new SpaceObject(), 500,Greenfoot.getRandomNumber(400));\n }\n \n }", "private void traversePath()\n\t{\n\t\trobot.forward(50);\n\t\trobot.right(90);\n\t\trobot.forward(50);\n\t\trobot.right(90);\n\t\trobot.forward(50);\n\t\trobot.left(90);\n\t\trobot.forward(50);\n\t\trobot.left(90);\n\t}", "void move(int steps);", "private void move() {\n acceleration.accelerate(velocity, position);\r\n }", "void move(String direction) {\n \tif (direction.equals(\"A\")) { \n \t\tsetXCoord(getXCoord()-getHSpeed());\n \t} else if (direction.equals(\"D\")) {\n \t\tsetXCoord(getXCoord()+getHSpeed());\n \t}\n }", "public void move() {\n\t\tthis.move(velocity.x, velocity.y);\n\t}", "public void move() {\n float diffX = cDestination.getX() - getCenterX();\n float diffY = cDestination.getY() - getCenterY();\n\n float newX = cPosition.getX() + cSpeed * Math.signum(diffX);\n float newY = cPosition.getY() + cSpeed * Math.signum(diffY);\n\n cPosition.setX(newX);\n cPosition.setY(newY);\n }", "public void paradiseMove(){\n if (!getCurrentMainCellCoordinates().equals(new DiscreteCoordinates(11, 9))) {\n move(30);\n }\n }", "public void move(GeoCoordFine geoCoord) throws ARDInstanceException;", "@Override\n\tpublic Direction nextMove(State state)\n\t{\n\t\t\n\t\tthis.direction = Direction.STAY;\n\t\tthis.hero = state.hero();\n\t\tthis.position = new Point( this.hero.position.right, this.hero.position.left ); //x and y are reversed, really\n\t\t\n\t\tthis.pathMap = new PathMap( state, this.position.x, this.position.y );\n\n\t\t//find the richest hero\n\t\tHero richestHero = state.game.heroes.get(0);\n\t\tif( richestHero == this.hero ) { richestHero = state.game.heroes.get(1); } //just grab another hero if we are #0\n\t\t\n\t\tfor( Hero hero : state.game.heroes )\n\t\t{\n\t\t\tif( hero != this.hero && hero.gold > richestHero.gold )\n\t\t\t{\n\t\t\t\trichestHero = hero;\n\t\t\t}\n\t\t}\n\t\t\n\t\t//get all interesting sites\n\t\tList<TileInfo> minesInRange = this.pathMap.getSitesInRange( TileType.FREE_MINE, 20 );\t//mines in vicinity\n\t\tList<TileInfo> takenMinesInRange = this.pathMap.getSitesInRange( TileType.TAKEN_MINE, (100-richestHero.life)/2 );\t//mines in vicinity\n\t\tList<TileInfo> pubsInRange = this.pathMap.getSitesInRange( TileType.TAVERN, (int)(Math.pow(100-this.hero.life,2)*state.game.board.size/5000) );\t\t//pubs in vicinity\n\t\t\n\t\t//first visit pubs (apparently we need it)\n\t\tif( pubsInRange.size() != 0 )\n\t\t{\n\t\t\tthis.direction = this.pathMap.getDirectionTo( pubsInRange.get(0) );\n\t\t}\n\t\t\n\t\t//then visit the mines\n\t\telse if( minesInRange.size() != 0 )\n\t\t{\n\t\t\tthis.direction = this.pathMap.getDirectionTo( minesInRange.get(0) );\n\t\t}\n\t\t\n\t\t//then visit taken mines\n\t\telse if( takenMinesInRange.size() != 0 )\n\t\t{\n\t\t\tthis.direction = this.pathMap.getDirectionTo( takenMinesInRange.get(0) );\n\t\t}\n\t\t\n\t\t//then hunt for players\n\t\telse\n\t\t{\n\t\t\t//kill the richest hero! (but first full health)\n\t\t\tif( this.hero.life > 85 )\n\t\t\t{\n\t\t\t\tthis.direction = this.pathMap.getDirectionTo( richestHero.position.right, richestHero.position.left );\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t//run away!!!\n\t\t\t\tthis.direction = intToDir( (int)(Math.random()*4) );\n\t\t\t}\n\t\t}\n\t\t\n\t\t//VisualPathMap.getInstance( pathMap );\n\t\t\n\t\treturn this.direction;\n\t}", "public void setDirectionMove(double direction);", "private void turnAround() {\r\n this.setCurrentDirection(-getCurrentDirection());\r\n }", "@Override\n public void act(AgentImp agent) {\n Coordinate coordinate = agent.generateRandomMove();\n if (coordinate != null)\n agent.step(coordinate.getX(), coordinate.getY());\n else\n agent.skip();\n }", "@Override\n public void run() {\n\n // Define vehicle label if undefined\n if (this.label == null) {\n this.label = \"Vehicle_\" + this.getId();\n }\n\n // Ask roundabout object for path\n Deque<Vertex<AtomicReference>> path = this.getVehicleRoute(this.source, this.destination);\n Vertex<AtomicReference> last = null;\n\n // Get entry queue\n ConcurrentLinkedQueue<Vehicle> entry = this.roundabout.queueOnEntry(this, this.source);\n\n // Wait for first in queue\n while (entry.peek() != this) this.vehicleSleep(waitOnQueue());\n\n // Traverse Path\n for (Vertex<AtomicReference> v : path) {\n\n // Accelerate between path nodes\n if (this.speed < this.maxSpeed) this.speed = accelerate(this.speed);\n\n // Move to node\n while (!v.getValue().compareAndSet(null, this)) {\n\n // Decelerate to not crash into another vehicle\n while (this.speed > 0) this.speed = decelerate(this.speed);\n\n System.out.println(this.label + \": Waiting for next node \" + v.getKey());\n\n // Wait\n this.vehicleSleep(waitToTravel());\n }\n\n // Accelerate for next in case it has stopped\n while (this.speed <= 0) this.speed = accelerate(this.speed);\n\n System.out.println(this.label + \": Moving to node \" + v.getKey() + \" for \" + travel());\n\n // Moving from node to node\n this.vehicleSleep(travel());\n\n // Remove myself from queue only after locking the first node\n if (path.peekFirst() == v) entry.remove(this);\n\n // Release last node\n while (last != null && !last.getValue().compareAndSet(this, null)) ;\n\n // Assign v as the last node which it travelled to\n last = v;\n }\n\n // Release last node\n while (!last.getValue().compareAndSet(this, null)) ;\n }", "public void move() {\n\n int move_position_x = 0;\n int move_postion_y = 0;\n Random random = new Random();\n do {\n\n move_position_x = 0;\n move_postion_y = 0;\n int direction = random.nextInt(6);\n switch (direction) {\n case 0:\n move_postion_y = -1;\n break;\n case 1:\n case 4:\n move_postion_y = 1;\n break;\n case 2:\n case 5:\n move_position_x = 1;\n break;\n case 3:\n move_position_x = -1;\n }\n } while ((this.positionX + move_position_x < 0) || (this.positionX + move_position_x >= size_of_map) || (\n this.positionY + move_postion_y < 0) || (this.positionY + move_postion_y >= size_of_map));\n this.positionX += move_position_x;\n this.positionY += move_postion_y;\n }", "public void act() \r\n {\r\n move(5);\r\n if(isAtEdge())\r\n turn(4);\r\n if(Greenfoot.getRandomNumber(35) < 34)\r\n turn(10);\r\n if(Greenfoot.getRandomNumber(20)<5)\r\n turn(-15);\r\n }", "public void move() {\n\t\tif(right) {\n\t\t\tgoRight();\n\t\t\tstate++;\n\t\t\tif(state > 5) {\n\t\t\t\tstate = 3;\n\t\t\t}\n\t\t}\n\t\telse if(left) {\n\t\t\tgoLeft();\n\t\t\tstate++;\n\t\t\tif(state > 2) {\n\t\t\t\tstate = 0;\n\t\t\t}\n\t\t}\n\t}", "public void move()\n {\n x = x + unitVector.getValue(1)*speed;\n y = y + unitVector.getValue(2)*speed;\n }", "public void move(int moveDirection) {\n //if same or opposite direction, check if movable\n if ((direction - moveDirection) % 6 == 0) {\n this.direction = moveDirection;\n if (moveable()) {\n if (direction == 12) {\n this.setLocation(new Point(this.getX(),\n this.getY() - speed));\n }\n //move right\n if (direction == 3) {\n this.setLocation(new Point(this.getX() + speed,\n this.getY()));\n\n }\n //move down\n if (direction == 6) {\n this.setLocation(new Point(this.getX(),\n this.getY() + speed));\n }\n //move left\n if (direction == 9) {\n this.setLocation(new Point(this.getX() - speed,\n this.getY()));\n }\n\n }\n } // if it is turning, check if can turn or not. If can turn then turn and move according to the direction before turn, otherwise, just leave the monster there\n else {\n Point snapToGridPoint = GameUtility.GameUtility.snapToGrid(\n this.getLocation());\n Point gridPoint = GameUtility.GameUtility.toGridCordinate(\n this.getLocation());\n Point nextPoint = new Point(gridPoint.x, gridPoint.y);\n //if the distance is acceptable\n if (GameUtility.GameUtility.distance(snapToGridPoint,\n this.getLocation()) < GameUtility.GameUtility.TILE_SIZE / 2.5) {\n\n if (moveDirection == 3) {\n int x = Math.max(0, gridPoint.x + 1);\n nextPoint = new Point(x, gridPoint.y);\n } else if (moveDirection == 6) {\n int y = Math.max(0, gridPoint.y + 1);\n nextPoint = new Point(gridPoint.x, y);\n } else if (moveDirection == 9) {\n int x = Math.min(19, gridPoint.x - 1);\n nextPoint = new Point(x, gridPoint.y);\n } else if (moveDirection == 12) {\n int y = Math.min(19, gridPoint.y - 1);\n nextPoint = new Point(gridPoint.x, y);\n }\n // if the turn is empty, then snap the monster to the grid location\n if (!(GameManager.getGameMap().getFromMap(nextPoint) instanceof Wall) && !(GameManager.getGameMap().getFromMap(\n nextPoint) instanceof Bomb)) {\n if (GameUtility.GameUtility.distance(snapToGridPoint,\n this.getLocation()) < GameUtility.GameUtility.TILE_SIZE / 10) {\n this.setLocation(snapToGridPoint);\n this.direction = moveDirection;\n } else {\n if (direction == 9 || direction == 3) {\n int directionOfMovement = (snapToGridPoint.x - getX());\n directionOfMovement = directionOfMovement / Math.abs(\n directionOfMovement);\n this.setLocation(new Point(\n this.getX() + directionOfMovement * speed,\n this.getY()));\n } else if (direction == 12 || direction == 6) {\n int directionOfMovement = (snapToGridPoint.y - getY());\n directionOfMovement = directionOfMovement / Math.abs(\n directionOfMovement);\n this.setLocation(new Point(\n this.getX(),\n this.getY() + directionOfMovement * speed));\n }\n }\n }\n }\n }\n }", "public void moveObjsToGoals() {\n\t\tMap<Integer, MovingFObject> map = sc.getInitPos();\r\n\t\tfor(int i = 0; i < map.size(); i++) {\r\n\t\t\tMovingFObject temp = map.get(i);\r\n\t\t\tsc.moveAtVelAtTimeToLoc(i, sc.getMaxVelocity(), 0, (Location)temp.getGoal());\r\n\t\t}\r\n\t}", "public void moveForward(){\n\t\tSystem.out.println(\"Vehicle moved forward\");\n\t}", "@Override\n\tpublic void move() {\n\t\tCoordinate currPos = new Coordinate(control.getPosition());\n\t\t\n\t\t// if we have enough packages head to the exit\n\t\tif (control.numParcels() <= control.numParcelsFound()) {\n\t\t\t// if we don't have a path to the exit\n\t\t\tif (control.currentPath == null || !control.isHeadingToFinish) {\t\n\t\t\t\t// find path to exit\n\t\t\t\tArrayList<Coordinate> tempPath = null;\n\t\t\t\t// See if there's a path without needing to go through hazards\n\t\t\t\ttempPath = control.findPath(currPos, control.finish.get(0), control.hazardsMap.keySet());\n\t\t\t\tSet<Coordinate> tempHazards = new HashSet<>(control.hazardsMap.keySet());\n\t\t\t\t// If no path without going through hazards, just go through them\n\t\t\t\tif (tempPath == null || tempPath.size() == 0) {\n\t\t\t\t\tfor (Coordinate coord : control.hazardsMap.keySet()) {\n\t\t\t\t\t\ttempHazards.remove(coord);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// If it's a valid map, there should be a path now\n\t\t\t\tcontrol.setPath(control.findPath(currPos, control.finish.get(0), tempHazards));\n\t\n\t\t\t\tcontrol.isHeadingToFinish = true;\n\t\t\t}\n\t\t}\n\t\t\n\t\theadTowardsPackages(currPos);\n\t\t\n\t\texploreUnseenMap(currPos);\n\t\t\n\t\tMapTile currTile = control.getView().get(currPos);\n\t\tboolean isHealth = false;\n\t\tif (currTile.getType() == MapTile.Type.TRAP) {\n\t\t\tTrapTile trap = (TrapTile) currTile;\n\t\t\tif (trap.getTrap().equals(\"health\")) {\n\t\t\t\tisHealth = true;\n\t\t\t}\n\t\t}\n\t\tif (isHealth && (control.getHealth() < HEALTH_TRAP_THRESHOLD)) {\n\t\t\t// do nothing\n\t\t\treturn;\n\t\t} else {\n\t\t\tisHealth = false;\n\t\t\tcontrol.moveTowards(control.dest);\n\t\t}\n\t\t\n\t}", "public void move() {\n // Check for collisions and reverse deltas accordingly\n if (collisionWithHorizontalWall()) {\n isFacingRight = !isFacingRight;\n dx *= -1;\n }\n if (collisionWithVerticalWall()) {\n dy *= -1;\n }\n \n // Handle actual movement by updating positional values\n if (dx == 0 || dy == 0) {\n xPos += dx;\n yPos += dy;\n } else {\n // Turn diagonal delta movement into 1 instead of sqrt(2)\n xPos += DIAGONAL_DIVISOR * dx;\n yPos += DIAGONAL_DIVISOR * dy;\n }\n }", "public void act() \r\n {\r\n move();\r\n }", "public void move() {\n\t\t// Override move so we don't move, then get location set by owner.\n\t}", "private void moveMhos() {\n\t\tmoveAllignedMhos();\n\t\tmoveDiagonalMhos();\n\t\tmoveHorizontalMhos();\n\t\tmoveVerticalMhos();\n\t\tmoveRemainingMhos();\n\t\tupdateMhoLocationList();\n\t}", "private void updateMovement() {\n if (_movementTask == null) {\n return;\n }\n\n if (getOwner().isDead() || _followTarget != null && _followTarget.isDead()) {\n cancelMoveTask2(true);\n return;\n }\n\n // Movement is invalid! Queue a new movement and wait again!\n if (_destinationLocation == null)\n {\n if (_waypoints.peek() != null) {\n _destinationLocation = _waypoints.poll();\n\n if (getOwner().getLocation().getGameSector() != null && getOwner().getLocation().getGameSector().hasActiveNeighbours()) {\n double validatedZ = GeoService.getInstance().validateZ(_destinationLocation.getX(), _destinationLocation.getY(), _destinationLocation.getZ());\n if (validatedZ == Double.MIN_VALUE) {\n _movementTick = System.currentTimeMillis();\n getOwner().getAi().setFindPathCompleted(false);\n cancelMoveTask2(true);\n onMovementComplete();\n return;\n }\n\n if (_destinationLocation != null) {\n _destinationLocation.setZ(validatedZ);\n }\n else {\n _movementTick = System.currentTimeMillis();\n getOwner().getAi().setFindPathCompleted(false);\n cancelMoveTask2(true);\n onMovementComplete();\n return;\n }\n _isSectorActive = true;\n }\n else {\n _isSectorActive = false;\n }\n notifySector(true);\n }\n else\n {\n _movementTick = System.currentTimeMillis();\n getOwner().getAi().setFindPathCompleted(true);\n cancelMoveTask2(true);\n onMovementComplete();\n return;\n }\n }\n\n if (_destinationLocation != null) {\n // Update current character movement, the location.\n float deltaTime = (System.currentTimeMillis() - _movementTick) / 1000.0f;\n float movementSpeed = getOwner().getActionStorage().getMoveSpeed();\n if (getOwner().getActionStorage().getAction().getActionChartActionT().getApplySpeedBuffType().isMove()) {\n movementSpeed *= (getOwner().getGameStats().getMoveSpeedRate().getMoveSpeedRate() + 1_000_000.0f) / 1_000_000.0f;\n }\n\n Location ownerLocation = getOwner().getLocation();\n\n double movementDirectionX = _destinationLocation.getX() - ownerLocation.getX();\n double movementDirectionY = _destinationLocation.getY() - ownerLocation.getY();\n double movementDirectionZ = _destinationLocation.getZ() - ownerLocation.getZ();\n\n double directionLength = Math.sqrt(Math.pow(movementDirectionX, 2) + Math.pow(movementDirectionY, 2) + Math.pow(movementDirectionZ, 2));\n movementDirectionX /= directionLength;\n movementDirectionY /= directionLength;\n movementDirectionZ /= directionLength;\n\n ownerLocation.setXYZ(\n ownerLocation.getX() + movementDirectionX * movementSpeed * deltaTime,\n ownerLocation.getY() + movementDirectionY * movementSpeed * deltaTime,\n ownerLocation.getZ() + movementDirectionZ * movementSpeed * deltaTime\n );\n\n if (_isSectorActive && !_navigationType.isAir()) {\n double validatedZ = GeoService.getInstance().validateZ(ownerLocation.getX(), ownerLocation.getY(), ownerLocation.getZ());\n if (validatedZ == Double.MIN_VALUE) {\n getOwner().getAi().setFindPathCompleted(false);\n cancelMoveTask2(true);\n onMovementComplete();\n return;\n }\n\n ownerLocation.setZ(validatedZ);\n }\n\n if (ownerLocation.isValid() && World.getInstance().getWorldMap().updateLocation(getOwner(), ownerLocation.getX(), ownerLocation.getY())) {\n double distanceToPoint = MathUtils.getDistance(ownerLocation, _destinationLocation) - getOwner().getTemplate().getBodySize();\n notifyVehicleMovement();\n\n if (_followTarget != null) {\n distanceToPoint -= _followTarget.getTemplate().getBodySize();\n\n if (!MathUtils.isInRange(_destinationLocation, _followTarget.getLocation(), 150)) {\n _destinationLocation.setLocation(_followTarget.getLocation());\n notifySector(true);\n } else { // No more waypoint's available. Send movement stop and events.\n if (distanceToPoint < 75 || distanceToPoint < getOwner().getTemplate().getAttackRange() && getOwner().getAi().getBehavior().isChase()) {\n getOwner().getAi().setFindPathCompleted(true);\n cancelMoveTask2(false);\n onMovementComplete();\n }\n }\n } else {\n // Check if we are near another destination, then we will\n // switch to another waypoint instead to continue our journey.\n Location nextWaypoint = _waypoints.peek();\n if (nextWaypoint != null) {\n if (distanceToPoint < 100) {\n _destinationLocation = null;\n }\n } else { // No more waypoint's available. Send movement stop and events.\n if (distanceToPoint < 75 || distanceToPoint < getOwner().getTemplate().getAttackRange() && getOwner().getAi().getBehavior().isChase()) {\n getOwner().getAi().setFindPathCompleted(true);\n cancelMoveTask2(false);\n onMovementComplete();\n }\n }\n }\n } else {\n getOwner().getAi().setFindPathCompleted(false);\n cancelMoveTask2(true);\n onMovementComplete();\n }\n }\n _movementTick = System.currentTimeMillis();\n }", "@Override\n\tpublic void setup() {\n\t\tObjectSpace objectSpace = Blackboard.inst().getSpace(ObjectSpace.class, \"object\");\n\t\tList<PhysicsObject> objects = objectSpace.getCognitiveAgents();\n\n\t\tif (objects.size() != 2)\n\t\t\tthrow new RuntimeException(\"Need two agents in order to run PathScenario4!\");\n\t\t\n\t\t// first we determine the line between their two points.\n\t\tPhysicsObject obj1 = objects.get(0);\n\t\tPhysicsObject obj2 = objects.get(1);\n\t\t\t\t\n\t\tVec2 direction = obj1.getPPosition().sub(obj2.getPPosition());\n\t\tVec2 nDirection = new Vec2(direction);\n\t\tnDirection.normalize();\n\t\tfloat radians = (float) Math.atan2(nDirection.y, nDirection.x);\n\t\tfloat PI = (float) Math.PI;\n\t\tfloat PI2 = PI * 0.5f;\n\n\t\tfloat perp = radians + PI2;\n\t\tVec2 v = new Vec2((float) Math.cos(perp), (float) Math.sin(perp));\n\t\tVec2 offset1 = new Vec2(obj1.getPPosition().add(v));\n\n\t\tList<Vec2> waypoints1 = new ArrayList<Vec2>();\n\t\twaypoints1.add(obj2.getPPosition());\n\n\t\tList<Vec2> waypoints2 = new ArrayList<Vec2>();\n\t\twaypoints2.add(offset1);\n\t\t\n\t\t// Set positions and orientations\n\t\tobj1.getBody().setXForm(obj1.getPPosition(), radians + (float) Math.PI);\n\t\tobj2.getBody().setXForm(obj2.getPPosition(), radians);\n\n\t\tEventManager.inst().dispatch(new SetWaypoints(waypoints1, obj1));\n\t\tEventManager.inst().dispatch(new SetWaypoints(waypoints2, obj2));\n\t}", "public abstract void move(int direction, double speed);", "private void move() {\n resetUpdate();\n\n gameMessage.setSpace1(clientMessage.getSpace1());\n gameMessage.resetGameMessage();\n gameMessage.notify(gameMessage);\n\n\n if( liteGame.isWinner() ) endOfTheGame = true;\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 }", "public void move(FightCell cell);" ]
[ "0.72984105", "0.71370465", "0.7055927", "0.70434135", "0.69800705", "0.69718593", "0.6908271", "0.6893375", "0.6758387", "0.6756284", "0.67559296", "0.67340696", "0.66973794", "0.66956717", "0.66908157", "0.6671399", "0.6660531", "0.6647472", "0.66422725", "0.6629346", "0.6612546", "0.6602419", "0.6594709", "0.659459", "0.65811074", "0.65698236", "0.65627325", "0.6557219", "0.65570533", "0.655679", "0.65549725", "0.6536879", "0.65305364", "0.65226364", "0.6518416", "0.651749", "0.6509835", "0.6499032", "0.64934486", "0.6471891", "0.6468904", "0.6467872", "0.64623004", "0.6451984", "0.64316946", "0.6429916", "0.64161104", "0.6410123", "0.6410123", "0.64002454", "0.6391828", "0.6387429", "0.6386739", "0.637972", "0.6377332", "0.6363416", "0.6352267", "0.6347876", "0.63304406", "0.63195175", "0.6317875", "0.63156104", "0.6314315", "0.62942195", "0.6287037", "0.6270008", "0.62697536", "0.6269381", "0.62647164", "0.62623405", "0.6262231", "0.6249893", "0.62475526", "0.6239388", "0.6237134", "0.6236172", "0.623464", "0.62341654", "0.62277246", "0.6221547", "0.6202334", "0.6197441", "0.6197053", "0.6190792", "0.6186435", "0.6184347", "0.6183108", "0.6178662", "0.6178025", "0.6167842", "0.61582434", "0.6156728", "0.61524355", "0.61505985", "0.6141952", "0.6140351", "0.61394435", "0.6133575", "0.6133054", "0.6132322", "0.6121424" ]
0.0
-1
clean up on old edge
public void updateCrowdness(EdgeGraph newEdge) { if (currentEdge != null) { ArrayList<Pedestrian> currentVolume = PedSimCity.edgesVolume.get(currentEdge); currentVolume.remove(this); } // update new edge traffic if (PedSimCity.edgesVolume.get(newEdge) == null) PedSimCity.edgesVolume.put(newEdge, new ArrayList<Pedestrian>()); PedSimCity.edgesVolume.get(newEdge).add(this); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void clean() {\n // TODO: Your code here.\n for (Long id : vertices()) {\n if (adj.get(id).size() == 1) {\n adj.remove(id);\n }\n }\n }", "private void clean() {\n nodesToRemove.clear();\n edgesToRemove.clear();\n }", "private void Clean(){\n \t NodeIterable nodeit = graphModel.getGraph().getNodes();\n \t\n \t for (Node node : nodeit) {\n\t\t\t\n \t\t \n \t\t \n\t\t}\n \t\n }", "void downgradeLastEdge();", "private void clean() {\n Iterable<Long> v = vertices();\n Iterator<Long> iter = v.iterator();\n while (iter.hasNext()) {\n Long n = iter.next();\n if (world.get(n).adj.size() == 0) {\n iter.remove();\n }\n }\n }", "public void removeAllEdges() {\n }", "private void removeNoMoreExistingOriginalEdges() {\n for (MirrorEdge mirrorEdge : directEdgeMap.values()) {\n if (!originalGraph.has(mirrorEdge.original)) {\n for (Edge segment : mirrorEdge.segments) {\n mirrorGraph.forcedRemove(segment);\n reverseEdgeMap.remove(segment);\n }\n for (Node bend : mirrorEdge.bends) {\n mirrorGraph.forcedRemove(bend);\n reverseEdgeMap.remove(bend);\n }\n directEdgeMap.remove(mirrorEdge.original);\n }\n }\n }", "private void clean() {\n //use iterator\n Iterator<Long> it = nodes.keySet().iterator();\n while (it.hasNext()) {\n Long node = it.next();\n if (nodes.get(node).adjs.isEmpty()) {\n it.remove();\n }\n }\n }", "private void removeEdges()\r\n\t{\r\n\t final String edgeTypeName = edgeType.getName();\r\n\t for (final Edge e : eSet)\r\n\t\te.getSource().removeEdge(edgeTypeName, e.getDest());\r\n\t eSet.clear();\r\n\t}", "@Override\n public void cleanup() {\n \n }", "@Override\n public void cleanup() {\n \n }", "public final void clean() {\n distributed_graph.unpersist(true);\n }", "protected void removeEdgeAndVertices(TestbedEdge edge) {\n java.util.Collection<Agent> agents = getIncidentVertices(edge);\n removeEdge(edge);\n for (Agent v : agents) {\n if (getIncidentEdges(v).isEmpty()) {\n removeVertex(v);\n }\n }\n }", "@Override\r\n\tpublic void cleanup() {\n\t\t\r\n\t}", "@Override\n public boolean deleteEdge(Edge edge) {\n return false;\n }", "void reset() {\n\t\t\t_orderID = UNMARKED;\n\t\t\t_outgoingEdges.clear();\n\t\t\t//TODO when do we call this? when should we mark all edges as received?\n\t\t\tfor(Edge e : _neighborEdges.keySet()) {\n\t\t\t\t_neighborEdges.put(e, false);\n\t\t\t}\n\t\t}", "@Override\n\tpublic void cleanup() {\n\n\t}", "@Override\n\tpublic void cleanup() {\n\n\t}", "protected void clearEdgeMap() {\n\n for (String id : this.edgeMap.keySet()) {\n\n this.ids.remove(id);\n }\n this.edgeMap.clear();\n }", "public void cleanUp() {\n if (penv != null) {\n penv.cleanup();\n }\n List<ONDEXGraph> indexed = new LinkedList<ONDEXGraph>();\n Set<String> graphFolders = new HashSet<String>();\n for (Entry<ONDEXGraph, String> ent : indexedGraphs.entrySet()) {\n if (!indeciesToRetain.contains(ent.getValue())) graphFolders.add(new File(ent.getValue()).getParent());\n indexed.add(ent.getKey());\n }\n for (ONDEXGraph graph : indexed) removeIndex(graph, null);\n for (String graphDir : graphFolders) {\n try {\n DirUtils.deleteTree(graphDir);\n } catch (IOException e) {\n }\n }\n }", "@Override\n public void clearEdges() {\n /* remove edges from all graphs */\n for (TimeFrame tf : lstTimeFrameOrdering) {\n hmpGraphsAtTimeframes.get(tf).clearEdges();\n }\n \n /* empty adjacency list */\n for (int i = 0 ; i < darrGlobalAdjList.size() ; i++) {\n for (TimeFrame tf : darrGlobalAdjList.get(i).keySet()) {\n darrGlobalAdjList.get(i).get(tf).clear();\n }\n }\n /* delete all Edge Objects */\n mapAllEdges.clear();\n }", "public boolean resetEdges();", "public void cleanUp() {\n // a quick way to clean the vector\n segments = new Vector();\n // reset the total distance\n totalDistance = 0.0;\n distance = 0.0;\n }", "@Override\n\tpublic void cleanUp() {\n\t\t table = null;\n colFam = null;\n currentEvent = null;\n\t}", "void retainOutlineAndBoundaryGrid() {\n\t\tfor (final PNode child : getChildrenAsPNodeArray()) {\n\t\t\tif (child != selectedThumbOutline && child != yellowSIcolumnOutline && child != boundary) {\n\t\t\t\tremoveChild(child);\n\t\t\t}\n\t\t}\n\t\tcreateOrDeleteBoundary();\n\t}", "protected void processEdge(Edge e) {\n\t}", "@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}", "private void clearEdgeLinks() {\n edges.clear();\n //keep whole tree to maintain its position when it is expanded (within scroll pane bounds)\n Node rootNode = nodes.get(0);\n VBox rootVBox = (VBox) rootNode.getContainerPane().getParent();\n rootVBox.layout();\n Bounds rootNodeChildrenVBoxBounds = rootNode.getChildrenVBox().getBoundsInLocal();\n rootVBox.setLayoutY(Math.abs(rootVBox.getLayoutY() - ((rootNodeChildrenVBoxBounds.getHeight()) - rootNode.getHeight()) / 2 + rootNode.getLayoutY()));\n rootVBox.layout();\n\n for (int i = 0; i < nodes.size(); i++) {\n Pane containerPane = nodes.get(i).getContainerPane();\n //reposition node to the center of its children\n ObservableList<javafx.scene.Node> genericNodes = nodes.get(i).getChildrenVBox().getChildren();\n if (!genericNodes.isEmpty()) {\n nodes.get(i).setLayoutY(((nodes.get(i).getChildrenVBox().getBoundsInLocal().getHeight()) - rootNode.getHeight()) / 2);\n }\n\n for (int j = 0; j < containerPane.getChildren().size(); j++) {\n if (containerPane.getChildren().get(j) instanceof Edge) {\n containerPane.getChildren().remove(j);\n j--;\n }\n }\n }\n redrawEdges(rootNode);\n }", "void unsetFurtherRelations();", "private void removeEdge(Edge edge) {\n\t\tshapes.remove(edge);\n\t\tshapes.remove(edge.getEdgeLabel());\n\t\tremove(edge.getEdgeLabel());\n\t}", "protected void cleaningUp() {\n\t}", "protected void clearHyperEdgeMap() {\n\n for (String id : this.hyperEdgeMap.keySet()) {\n\n this.ids.remove(id);\n }\n this.hyperEdgeMap.clear();\n }", "@Override\n public void cleanup() {\n }", "@Override\n protected void updateEliminations() {\n\n }", "@Override\r\n public void cleanup() {\n }", "private void removeNoMoreExistingOriginalNodes() {\n for (Node mirrorNode : mirrorGraph.nodes()) {\n if (!isPartOfMirrorEdge(mirrorNode) && !originalGraph.has(mirrorNode)) {\n mirrorGraph.remove(mirrorNode);\n }\n }\n }", "public abstract void removeEdge(int from, int to);", "public void cleanUp(){\n\t\t//offset(-1*bounds.left, -1*bounds.top);\n\t}", "public static void cleanEdge(String ID,Context context) {\n DatabaseContext dbContext = new DatabaseContext(context);\n SQLiteHelper helper = new SQLiteHelper(dbContext,\"BLEdevice.db\");\n helper.cleanEdge(ID);\n // Log.w(\"cleanEdge\", \"edge cout = \" + coutEdge(context));\n }", "void reset(boolean preparingForUpwardPass) {\n\t\t\t_orderID = UNMARKED;\n\t\t\t_outgoingEdges.clear();\n\t\t\t//TODO when do we call this? when should we mark all edges as received?\n\t\t\tfor(Edge e : getIncomingNeighborEdges(preparingForUpwardPass)) {\n\t\t\t\t_neighborEdges.put(e, false);\n\t\t\t}\n\t\t}", "@PortedFrom(file = \"Taxonomy.h\", name = \"deFinalise\")\n public void deFinalise() {\n boolean upDirection = true;\n TaxonomyVertex bot = getBottomVertex();\n for (TaxonomyVertex p : bot.neigh(upDirection)) {\n p.removeLink(!upDirection, bot);\n }\n bot.clearLinks(upDirection);\n willInsertIntoTaxonomy = true; // it's possible again to add entries\n }", "public void cleanUp() {\r\n\t\tsuper.cleanUp() ;\r\n\t}", "public void cleanupData() {\n\t}", "void updateEdgeData(EdgeGraph edge) {\n\t\tedge = PedSimCity.edgesMap.get(edge.getID()); //in case it was a subgraph edge\n\t\tif (UserParameters.empiricalABM) edge.densities.replace(agp.groupName, edge.densities.get(agp.groupName)+1);\n\t\telse edge.densities.replace(ap.routeChoice, edge.densities.get(ap.routeChoice)+1);\n\t}", "void removeEdge(int x, int y);", "protected void cleanupFigureLabelEditor()\n {\n if (editor != null) {\n editor.cleanup();\n }\n }", "@Override\n protected void performCleanup() {\n }", "void unlockLastEdge();", "public void revise()\n {\n \n super.revise();\n }", "public void cleanUp()\r\n {\r\n m_aaiNumTris = null;\r\n m_aafRelativeLengths = null;\r\n m_aafMaxDist = null;;\r\n m_aakCurvePos = null;\r\n m_aakTangent = null;\r\n }", "private void truncateLooseEdges(List<Node> eogSources) {\n for (Node eogSourceNode : eogSources) {\n if (eogSourceNode instanceof FunctionDeclaration) continue;\n List<Node> nextNodes = new ArrayList<>(eogSourceNode.getNextEOG());\n eogSourceNode.getNextEOG().clear();\n nextNodes.forEach(node -> node.getPrevEOG().remove(eogSourceNode));\n truncateLooseEdges(\n nextNodes.stream()\n .filter(node -> node.getPrevEOG().isEmpty() && !node.getNextEOG().isEmpty())\n .collect(Collectors.toList()));\n }\n }", "public void suppressionRdV_all() {\n //on vide l'agenda de ses elements\n for (RdV elem_agenda : this.agd) {\n this.getAgenda().remove(elem_agenda);\n }\n //on reinitialise a null l'objet agenda\n //this.agd = null;\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 void fixEdges() {\n\tfor (LayoutEdge lEdge: edgeList) {\n\t // Get the underlying edge\n\t CyEdge edge = lEdge.getEdge();\n\t CyNode target = (CyNode) edge.getTarget();\n\t CyNode source = (CyNode) edge.getSource();\n\n\t if (nodeToLayoutNode.containsKey(source) && nodeToLayoutNode.containsKey(target)) {\n\t\t// Add the connecting nodes\n\t\tlEdge.addNodes((LayoutNode) nodeToLayoutNode.get(source),\n\t\t\t (LayoutNode) nodeToLayoutNode.get(target));\n\t }\n\t}\n }", "public void cleanNodeListToEdges(CircosEdgeList edges){\n\t\tArrayList<CircosNode> tempnodes = new ArrayList<CircosNode>();\n\t\tHashMap<String,String> tempcolors = new HashMap<String,String>();\n\t\t\n\t\tfor(int i = 0; i < nodes.size(); i++){\n\t\t\tif(edges.containsNodeAsSourceOrTarget(nodes.get(i).getID())){\n\t\t\t\ttempnodes.add(nodes.get(i));\n\t\t\t\ttempcolors.put(nodes.get(i).getID(), colors.get(nodes.get(i).getID()));\n\t\t\t}\n\t\t}\n\t\t\t\n\t\tnodes = tempnodes;\n\t\tcolors = tempcolors;\n\t}", "public void testRemoveEdgeObjectObject( ) {\n init( ); //TODO Implement removeEdge().\n }", "public final void clearEdgeAnnotations() {\n for (GraphEdge<N, E> e : getEdges()) {\n e.setAnnotation(null);\n }\n }", "@Override\n public void cleanUp() {\n }", "public void Clear() {\n OCCwrapJavaJNI.ShapeFix_EdgeConnect_Clear(swigCPtr, this);\n }", "public void dispose() {\n parent.removePropertyChangeListener(PNode.PROPERTY_FULL_BOUNDS, this);\n child.removePropertyChangeListener(PNode.PROPERTY_FULL_BOUNDS, this);\n parent.removeEdge(this);\n child.removeEdge(this);\n child.setParentEdge(null);\n }", "public void cleanup() {\n\t}", "@Override\n\tpublic void detalhar() {\n\t\t\n\t}", "private void clean() {\n aggregatedValues.clear();\n this.numMessageSent = 0;\n this.numMessageReceived = 0;\n }", "private void trimX() {\n\t\tint indexIntoBranches = 0;\n\t\tfor (int i = 0; i < this.branches.size(); i++) {\n\t\t\tif (this.branches.get(i).size() == this.numXVertices) {\n\t\t\t\tindexIntoBranches = i;\n\t\t\t}\n\t\t}\n\n\t\tthis.allX = (ArrayList) this.branches.get(indexIntoBranches).clone(); // We need this for a set difference above\n\n\t\tfor (int k = 0; k < this.branches.get(indexIntoBranches).size(); k++) {\n\t\t\tfor (int j = 0; j < this.branches.get(indexIntoBranches).size(); j++) {\n\t\t\t\t// Ignore if the index is the same - otherwise remove the edges\n\t\t\t\tif (!(k == j)) {\n\t\t\t\t\tthis.branches.get(indexIntoBranches).get(k)\n\t\t\t\t\t\t\t.removeNeighbor(this.branches.get(indexIntoBranches).get(j));\n\t\t\t\t\tthis.branches.get(indexIntoBranches).get(j)\n\t\t\t\t\t\t\t.removeNeighbor(this.branches.get(indexIntoBranches).get(k));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public void cleanup() {\r\n }", "protected void trimToSize() {\n\tnodeList.trimToSize();\n\tedgeList.trimToSize();\n }", "public synchronized void cleanup() {\n\t\t// by freeing the mother group we clean up all the nodes we've created\n\t\t// on the SC server\n\t\tsendMessage(\"/g_freeAll\", new Object[] { _motherGroupID });\n\t\tfreeNode(_motherGroupID);\n\t\tfreeAllBuffers();\n\t\t\n\t\t//reset the lists of sound nodes, nodeIds, busses, etc\n\t\tSoundNode sn;\n\t\tEnumeration<SoundNode> e = _soundNodes.elements();\n\t\twhile (e.hasMoreElements()) {\n\t\t\tsn = e.nextElement();\n\t\t\tsn.setAlive(false);\n\t\t}\n\t\t_soundNodes.clear();\n\t\t_nodeIdList.clear();\n\t\t_busList.clear();\n\t\t_bufferMap.clear();\n\t}", "public void cleanUp() {\n logger.info(\"clean up...\");\n this.sequenceNo = calculateSequenceNumber();\n if (this.prevoteStore != null) {\n this.prevoteStore = this.prevoteStore.stream()\n .filter(i -> i.sequence_no >= this.sequenceNo)\n .collect(Collectors.toCollection(ArrayList::new));\n } else {\n this.prevoteStore = new ArrayList<>();\n }\n }", "protected void resetGraph() {\n for (List<Edge> path : graph) {\r\n for (Edge e : path) {\r\n e.flow = 0;\r\n }\r\n }\r\n }", "@Override\n \t\t\t\tpublic void deleteGraph() throws TransformedGraphException {\n \n \t\t\t\t}", "@Override\n public void nullstill() {\n Node<T> curr= hode;\n while (curr!=null){\n Node<T> p= curr.neste;\n curr.forrige=curr.neste= null;\n curr.verdi= null;\n curr= p;\n }\n hode= hale= null;\n endringer++;\n antall=0;\n }", "private AssemblyResult cleanupSeqGraph(final SeqGraph seqGraph, final Haplotype refHaplotype) {\n if (debugGraphTransformations) {\n printDebugGraphTransform(seqGraph, refHaplotype.getLocation() + \"-sequenceGraph.\"+seqGraph.getKmerSize()+\".1.0.non_ref_removed.dot\");\n }\n // the very first thing we need to do is zip up the graph, or pruneGraph will be too aggressive\n seqGraph.zipLinearChains();\n if (debugGraphTransformations) {\n printDebugGraphTransform(seqGraph, refHaplotype.getLocation() + \"-sequenceGraph.\"+seqGraph.getKmerSize()+\".1.1.zipped.dot\");\n }\n\n // now go through and prune the graph, removing vertices no longer connected to the reference chain\n seqGraph.removeSingletonOrphanVertices();\n seqGraph.removeVerticesNotConnectedToRefRegardlessOfEdgeDirection();\n\n if (debugGraphTransformations) {\n printDebugGraphTransform(seqGraph, refHaplotype.getLocation() + \"-sequenceGraph.\"+seqGraph.getKmerSize()+\".1.2.pruned.dot\");\n }\n seqGraph.simplifyGraph();\n if (debugGraphTransformations) {\n printDebugGraphTransform(seqGraph, refHaplotype.getLocation() + \"-sequenceGraph.\"+seqGraph.getKmerSize()+\".1.3.merged.dot\");\n }\n\n // The graph has degenerated in some way, so the reference source and/or sink cannot be id'd. Can\n // happen in cases where for example the reference somehow manages to acquire a cycle, or\n // where the entire assembly collapses back into the reference sequence.\n if ( seqGraph.getReferenceSourceVertex() == null || seqGraph.getReferenceSinkVertex() == null ) {\n return new AssemblyResult(AssemblyResult.Status.JUST_ASSEMBLED_REFERENCE, seqGraph, null);\n }\n\n seqGraph.removePathsNotConnectedToRef();\n seqGraph.simplifyGraph();\n if ( seqGraph.vertexSet().size() == 1 ) {\n // we've perfectly assembled into a single reference haplotype, add a empty seq vertex to stop\n // the code from blowing up.\n // TODO -- ref properties should really be on the vertices, not the graph itself\n final SeqVertex complete = seqGraph.vertexSet().iterator().next();\n final SeqVertex dummy = new SeqVertex(\"\");\n seqGraph.addVertex(dummy);\n seqGraph.addEdge(complete, dummy, new BaseEdge(true, 0));\n }\n if (debugGraphTransformations) {\n printDebugGraphTransform(seqGraph, refHaplotype.getLocation() + \"-sequenceGraph.\"+seqGraph.getKmerSize()+\".1.4.final.dot\");\n }\n return new AssemblyResult(AssemblyResult.Status.ASSEMBLED_SOME_VARIATION, seqGraph, null);\n }", "int removeEdges(ExpLineageEdge.FilterOptions options);", "@Override\n public void remove() {\n deleteFromModel();\n deleteEdgeEndpoints();\n\n setDeleted(true);\n if (!isCached()) {\n HBaseEdge cachedEdge = (HBaseEdge) graph.findEdge(id, false);\n if (cachedEdge != null) cachedEdge.setDeleted(true);\n }\n }", "public void clear(){\n\t\tif(this.isUpgraded){\n\t\t\tthis.linkArray.clear();\n\t\t\tthis.isUpgraded = false;\n\t\t}\n\n\t\tthis.nativeArray.clear();\n\t}", "private static void stripTrivialCycles(CFG cfg) {\n\t\tCollection<SDGEdge> toRemove = new LinkedList<SDGEdge>();\n\t\tfor (SDGEdge e : cfg.edgeSet()) {\n\t\t\tif (e.getSource().equals(e.getTarget())) {\n\t\t\t\ttoRemove.add(e);\n\t\t\t}\n\t\t}\n\t\t\n\t\tcfg.removeAllEdges(toRemove);\n\t}", "@Override \n \tprotected void cleanup(Context context) throws IOException {\n \t rankread.clear();\t \n \t dang.clear();\n }", "public void removeEdge() {\n Graph GO = new Graph(nbOfVertex + 1);\n Value.clear();\n for (int i = 0; i < x.length; i++) {\n for (int j : x[i].getDomain()) {\n Value.add(j);\n if (MaxMatch[i] == Map.get(j)) {\n GO.addEdge(Map.get(j), i);\n } else {\n GO.addEdge(i, Map.get(j));\n }\n }\n }\n\n for (int i : V2) {\n for (int j : Value) {\n if (!V2.contains(j)) {\n GO.addEdge(i, j);\n }\n }\n }\n //System.out.println(\"GO : \");\n //System.out.println(GO);\n int[] map2Node = GO.findStrongConnectedComponent();\n //GO.printSCC();\n\n ArrayList<Integer>[] toRemove = new ArrayList[n];\n for (int i = 0; i < n; i++) {\n toRemove[i] = new ArrayList<Integer>();\n }\n for (int i = 0; i < n; i++) {\n for (int j : x[i].getDomain()) {\n ////System.out.println(i + \" \" + j);\n if (map2Node[i] != map2Node[Map.get(j)] && MaxMatch[i] != Map.get(j)) {\n toRemove[i].add(j);\n if (debug == 1) System.out.println(\"Remove arc : \" + i + \" => \" + j);\n }\n }\n }\n for (int i = 0; i < n; i++) {\n for (int j : toRemove[i]) {\n x[i].removeValue(j);\n }\n }\n }", "public void cleanup() {\n\t\tref.removeEventListener(listener);\n\t\tmodels.clear();\n\t\tmodelNames.clear();\n\t\tmodelNamesMapping.clear();\n\t}", "private void removeRedundantGreyTable()\r\n \t{\r\n \t\tdeleteNodes(XPath.GREY_TABLE.query);\r\n \t}", "void onCleanup() {\n\t\tdimensionMap.forEachValue(e -> {\n\t\t\te.releaseAllChunkData();\n\t\t\treturn true;\n\t\t});\n\t\tdimensionMap.clear();\n\t\tconnectedPlayers.clear();\n\t}", "public void clearRemovalTag() {\n\t levelOfRemoval = 0;\n\t}", "private void nullify() {\n\t\tpaint = null;\n\t\tup = null;\n\t\tdown = null;\n\t\tleft = null;\n\t\tright = null;\n\t\tg_up = null;\n\t\tg_down = null;\n\t\tg_left = null;\n\t\tg_right = null;\n\t\tgrass = null;\n\t\tcake = null;\n\n\t\t// Call garbage collector to clean up memory.\n\t\tSystem.gc();\n\n\t}", "public void mo8778a() {\n try {\n if (this.f1286b != null) {\n this.f1286b.recycle();\n }\n if (this.f1287c != null) {\n this.f1287c.recycle();\n }\n this.f1286b = null;\n this.f1287c = null;\n if (this.f1288d != null) {\n this.f1288d.recycle();\n this.f1288d = null;\n }\n if (this.f1289e != null) {\n this.f1289e.recycle();\n this.f1289e = null;\n }\n this.f1290f = null;\n } catch (Throwable th) {\n SDKLogHandler.m2563a(th, \"WaterMarkerView\", \"destory\");\n th.printStackTrace();\n }\n }", "private void removeEdge() {\n boolean go = true;\n int lastNode;\n int proxNode;\n int atualNode;\n if ((parentMatrix[randomChild][0] != 1) &&\n (childMatrix[randomParent][0] != 1)) {\n lastNode =\n parentMatrix[randomChild][parentMatrix[randomChild][0] - 1];\n for (int i = (parentMatrix[randomChild][0] - 1); (i > 0 && go); i--)\n { // remove element from parentMatrix\n atualNode = parentMatrix[randomChild][i];\n if (atualNode != randomParent) {\n proxNode = atualNode;\n parentMatrix[randomChild][i] = lastNode;\n lastNode = proxNode;\n }\n else {\n parentMatrix[randomChild][i] = lastNode;\n go = false;\n }\n }\n if ((childMatrix[randomParent][0] != 1) &&\n (childMatrix[randomParent][0] != 1)) {\n lastNode = childMatrix[randomParent][\n childMatrix[randomParent][0] - 1];\n go = true;\n for (int i = (childMatrix[randomParent][0] - 1); (i > 0 &&\n go); i--) { // remove element from childMatrix\n atualNode = childMatrix[randomParent][i];\n if (atualNode != randomChild) {\n proxNode = atualNode;\n childMatrix[randomParent][i] = lastNode;\n lastNode = proxNode;\n }\n else {\n childMatrix[randomParent][i] = lastNode;\n go = false;\n }\n } // end of for\n }\n childMatrix[randomParent][(childMatrix[randomParent][0] - 1)] = -4;\n childMatrix[randomParent][0]--;\n parentMatrix[randomChild][(parentMatrix[randomChild][0] - 1)] = -4;\n parentMatrix[randomChild][0]--;\n }\n }", "public void cleanup() {\n }", "public void cleanup() {\n this.index = new TreeMap<String, PostingsList>();\n this.count = 0;\n }", "private static void postProcess() {\n Set<Transition> ts = petrinet.getTransitions();\n for(Transition t : ts) {\n List<Flow> outEdges = new ArrayList<Flow>(t.getPostsetEdges());\n List<Flow> inEdges = new ArrayList<Flow>(t.getPresetEdges());\n try {\n Flow f = petrinet.getFlow(t.getId(), \"void\");\n System.out.println(\"contain void!\");\n assert(f.getWeight() == 1);\n //if (outEdges.size() == 1) { // Delete the transition.\n f.setWeight(0);\n //}\n } catch (NoSuchEdgeException e) {}\n }\n }", "public void clear() {\r\n for (Edge edge : edges)\r\n edge.disconnect();\r\n for (Vertex vertex : vertices)\r\n vertex.disconnect();\r\n edges.clear();\r\n vertices.clear();\r\n getChildren().remove(1, getChildren().size());\r\n }", "@Override\r\n\tpublic void cleanUp(Event event) {\n\t\t\r\n\t}", "public void delIncomingRelations();", "public void doRemove() throws VisADException, RemoteException {\n rangeRings = null;\n super.doRemove();\n }", "@Override\n public void clean() {\n\n }", "public void updateDeleteActiveEdges()\r\n\t{\r\n\t\tupdateDeleteActiveEdges(m_drawRoot);\r\n\t}", "protected void tearDown() throws Exception {\n TestHelper.clearConfig();\n\n offset = null;\n edge = null;\n }", "@Override\n public void purgeFlows() {\n setOfFlowsToAdd.clear();\n setOfFlowsToDelete.clear();\n }", "private void removeUnreachableEOGEdges(TranslationUnitDeclaration tu) {\n List<Node> eognodes =\n SubgraphWalker.flattenAST(tu).stream()\n .filter(node -> !(node.getPrevEOG().isEmpty() && node.getNextEOG().isEmpty()))\n .collect(Collectors.toList());\n Set<Node> validStarts =\n eognodes.stream()\n .filter(node -> node instanceof FunctionDeclaration)\n .collect(Collectors.toSet());\n while (!validStarts.isEmpty()) {\n eognodes.removeAll(validStarts);\n validStarts =\n validStarts.stream()\n .flatMap(node -> node.getNextEOG().stream())\n .filter(eognodes::contains)\n .collect(Collectors.toSet());\n }\n // remaining eognodes were not visited and have to be removed from the EOG\n for (Node unvisitedNode : eognodes) {\n unvisitedNode.getNextEOG().forEach(next -> next.getPrevEOG().remove(unvisitedNode));\n unvisitedNode.getNextEOG().clear();\n }\n }", "void remove(Edge edge);", "@Override\r\n public void undo() {\r\n if (newSource != null) {\r\n edge.setSource(oldSource);\r\n } else if (newTarget != null) {\r\n edge.setTarget(oldTarget);\r\n }\r\n }" ]
[ "0.72632575", "0.69673824", "0.6934367", "0.68585795", "0.66869366", "0.6672074", "0.65085834", "0.6436976", "0.6354367", "0.6339832", "0.6339832", "0.6316334", "0.62722164", "0.62454444", "0.6232163", "0.6172433", "0.6155709", "0.6155709", "0.6153174", "0.6147106", "0.611394", "0.60998523", "0.60844487", "0.6083461", "0.60728365", "0.6058741", "0.60563993", "0.60563993", "0.60563993", "0.60556865", "0.6025095", "0.6019669", "0.6005471", "0.6001406", "0.5997214", "0.5995616", "0.59891504", "0.5974357", "0.5957841", "0.595615", "0.59495366", "0.59349155", "0.5915514", "0.5899657", "0.589958", "0.58945227", "0.58899426", "0.58792716", "0.58731204", "0.5861559", "0.5861092", "0.5857573", "0.58532023", "0.5845478", "0.5843245", "0.5839655", "0.58394694", "0.58357954", "0.5831116", "0.5824635", "0.58213216", "0.58074296", "0.5801634", "0.57985234", "0.57890135", "0.5786383", "0.5781611", "0.5764245", "0.57596254", "0.5759363", "0.5755458", "0.5752364", "0.57466614", "0.5738582", "0.5737191", "0.573316", "0.5727754", "0.57259405", "0.57232577", "0.5719398", "0.5716699", "0.5716436", "0.57133263", "0.5709994", "0.5707538", "0.5706099", "0.5705468", "0.5700685", "0.56984544", "0.5694994", "0.5666986", "0.56653374", "0.5657627", "0.56575733", "0.56543267", "0.565169", "0.56507826", "0.56479746", "0.564079", "0.563357", "0.5631841" ]
0.0
-1
A utility function to check if the given character is operand
private static boolean isOperand(char ch) { return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "boolean operator(Character input){\r\n //detects operands\r\n if(input == '^'||input == '-'||input == '+'||input == '/'||input == '*'|| input =='('|| input ==')'){\r\n return true;\r\n }\r\n else\r\n return false;\r\n }", "public static boolean checkOperator(String inputChar){\r\n\t\tchar tempChar = inputChar.charAt(0);\r\n\t\t\r\n\t\tswitch(tempChar){\r\n\t\t\tcase '+': return true;\r\n\t\t\tcase '-': return true;\r\n\t\t\tcase '*': return true;\r\n\t\t\tcase '/': return true;\r\n\t\t\tcase '%': return true;\r\n\t\t\tcase '&': return true;\r\n\t\t}\r\n\t\t\r\n\t\treturn false;\r\n\t}", "private boolean isOperator(char ch)\n {\n if (ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '^')\n//returns true if either of the operator is found\n return true;\n//else returns false\n return false;\n }", "private boolean isOperator(char x) {\n return (x == '^' ||\n x == '*' ||\n x == '/' ||\n x == '+' ||\n x == '-');\n }", "private static boolean check_if_operator(char c)\n {\n return c == '+' || c == '-' || c == '*' || c == '/' || c == '^'|| c == 'r'\n || c == '(' || c == ')'|| c == 's' || c == 'c' || c == 't' || c == 'l';\n }", "private static boolean isOperator(char c) {\n return c == '+' ||\n c == '-' ||\n c == '*' ||\n c == '/';\n }", "private boolean isOperator(char ch) {\r\n\t\treturn (ch == '+' || ch == '-' || ch == '*' || ch == '/');\r\n\t}", "public boolean isOperator(char ch) {\n if (ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '^' || ch == '(' || ch == ')') {\n return true;\n }\n else {\n return false;\n }\n }", "public static boolean isOperator(char c){\n return c == '+' || c == '-' || c == '*' || c == '/' || c == '%' \n || c == '(' || c == ')';\n }", "public boolean isOperator(char c){\n char[] operator = { '+', '-', '*', '/','^', ')', '(' };\r\n int temp = 0;\r\n for (int i = 0; i < operator.length; i++) {\r\n if (c == operator[i])\r\n temp +=1;\r\n }\r\n return temp != 0;\r\n }", "public boolean isOperator(final char ch) {\n return (ch == '+' || ch == '-' \n || ch == '*' || ch == '/' \n || ch == '^');\n }", "public boolean isOperand(char ch) {\n if (Character.isDigit(ch)) {\n return true;\n }\n else {\n return false;\n }\n }", "static boolean isOperator(char c) {\n return \"+\\u2212\\u00d7\\u00f7/*\".indexOf(c) != -1;\n }", "public static boolean isArithmeticOperand(char c)\n {\n return (c == '+') || (c == '-') || \n (c == '*') || (c == '/');\n }", "public boolean validOperator(char op){\n switch(op){\n case '+':\n case '-':\n case '*':\n case '/':\n case '^':\n case ')':\n case '(':\n return true;\n }\n\n return false;\n }", "private boolean isOperator(char input) {\n\t\tboolean isOperator = false;\n\t\t\n\t\tif((input == '+') || (input == '-') || (input == '*') || (input == '/'))\n\t\t{\n\t\t\tisOperator = true;\n\t\t}\n\t\t\n\t\treturn isOperator;\n\t}", "private boolean isOperator(String s) {\n\t\treturn (s.equals(\"+\") || s.equals(\"-\") || s.equals(\"*\") || s.equals(\"/\") || s.equals(\"^\"));\n\t}", "private boolean isOperator(String op){\n return (op.equals(\"+\") || op.equals(\"-\") || op.equals(\"*\") || op.equals(\"/\"));\n }", "public static boolean checkOperand(String inputChar){\r\n\t\tchar tempChar = inputChar.charAt(0);\r\n\t\t\r\n\t\tif(tempChar >= 48 && tempChar <= 57)\r\n\t\t\treturn true;\r\n\t\telse if(tempChar == 'x' || tempChar == 'X')\r\n\t\t\treturn true;\r\n\t\t\r\n\t\treturn false;\r\n\t}", "private static boolean isOperator(String c)\n\t\t{\t\n\t\t\tif (c.equals(\"+\") || c.equals(\"-\") || c.equals(\"*\") || c.equals(\"/\") ) \n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}", "private boolean isOperator(String value) {\r\n return value.equals(\"*\") || value.equals(\"/\") || value.equals(\"-\") || value.equals(\"+\") || value.equals(\"(\") || value.equals(\")\");\r\n }", "public boolean isOperator() {\n\t\treturn (letter == '+') || (letter == '*') ||\n\t\t\t (letter == '%') || (letter == '-') ? true : false;\n\t}", "public boolean isOperator(char character) {\n\t\tfor (int index= 0; index < JAVA_OPERATORS.length; index++) {\n\t\t\tif (JAVA_OPERATORS[index] == character)\n\t\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "private boolean isOperator(char c) {\n\t\treturn c == '<' || c == '=' || c == '>' || c == '!';\n\t}", "public boolean isOperator(char ch) {\n\t\tString operatorPrefixes = \"=<>+*-/\";\n\t\tif (operatorPrefixes.indexOf(ch) != -1) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public boolean checkOperation(char operation) {\n boolean result = false;\n if (operation == '+' | operation == '-' | operation == '/' | operation == '*') {\n result = true;\n }\n return result;\n }", "private boolean isOperator(String input) {\n return new String(this.operator).contains(input);\n }", "public boolean isOperator(char operator) {\r\n \tif (operator == '+' || operator == '-' ||\r\n \t\t\t\toperator == '*' || operator == '/' || \r\n \t\t\t\toperator == '^' || operator == '%') {\r\n \t\t\r\n \t\treturn true;\r\n \t} else {\r\n \t\treturn false;\r\n \t}\r\n \r\n }", "private static boolean isOperator(String value){\r\n\t\tif (value.equals(\"+\") ||value.equals(\"-\")|| value.equals(\"*\")|| value.equals(\"/\"))\r\n\t\t\treturn true;\r\n\t\telse return false;\r\n\t}", "public boolean isOperand(String s)\n {\n return !Operator.isOperator(s) && !Brackets.isLeftBracket(s) && !Brackets.isRightBracket(s);\n }", "static boolean isaNonMinusOperator(char s){\n boolean nonMinusOperator = false;\n switch (s){\n case '+':nonMinusOperator = true; break;\n case '*':nonMinusOperator = true; break;\n case '/':nonMinusOperator = true; break;\n case '^':nonMinusOperator = true; break;\n }\n return nonMinusOperator;\n }", "private boolean isOperator(String operator)\n {\n switch(operator)\n {\n case \"+\":\n case \"-\":\n case \"*\":\n case \"/\":\n case \"%\":\n return true;\n default:\n return false;\n }\n }", "protected boolean isAddOp(char c) {\r\n\t\treturn (c == '+' || c == '-');\r\n\t}", "private boolean isSign( char in )\r\n\t{\r\n\t\treturn ( in=='*' || in=='/' || in=='+' || in=='-' );\r\n\t}", "boolean hasOperator();", "private boolean isSymbolOperatorAhead() {\r\n\t\treturn expression[currentIndex] == '*' || expression[currentIndex] == '+' || expression[currentIndex] == '!'\r\n\t\t\t\t|| (currentIndex + 2 < expression.length && expression[currentIndex] == ':'\r\n\t\t\t\t\t\t&& expression[currentIndex + 1] == '+' && expression[currentIndex + 2] == ':');\r\n\t}", "public static boolean isOperator(String name) {\n if (name.length() == 0) {\n return false;\n }\n // Pieced together from various sources (JsYaccLexer, DefaultJsParser, ...)\n switch (name.charAt(0)) {\n case '+':\n return name.equals(\"+\") || name.equals(\"+@\");\n case '-':\n return name.equals(\"-\") || name.equals(\"-@\");\n case '*':\n return name.equals(\"*\") || name.equals(\"**\");\n case '<':\n return name.equals(\"<\") || name.equals(\"<<\") || name.equals(\"<=\") || name.equals(\"<=>\");\n case '>':\n return name.equals(\">\") || name.equals(\">>\") || name.equals(\">=\");\n case '=':\n return name.equals(\"=\") || name.equals(\"==\") || name.equals(\"===\") || name.equals(\"=~\");\n case '!':\n return name.equals(\"!=\") || name.equals(\"!~\");\n case '&':\n return name.equals(\"&\") || name.equals(\"&&\");\n case '|':\n return name.equals(\"|\") || name.equals(\"||\");\n case '[':\n return name.equals(\"[]\") || name.equals(\"[]=\");\n case '%':\n return name.equals(\"%\");\n case '/':\n return name.equals(\"/\");\n case '~':\n return name.equals(\"~\");\n case '^':\n return name.equals(\"^\");\n case '`':\n return name.equals(\"`\");\n default:\n return false;\n }\n }", "public void checkOperator (TextView tv){\n String s = tv.getText().toString().substring(tv.getText().length() - 1);\n if (s.equals(\")\") || s.equals(\"!\")) {\n //int a = 1;\n isOperator = false;\n } else if (Character.isDigit(tv.getText().toString().charAt(tv.getText().toString().length() - 1)))\n isOperator = false;\n else\n isOperator = true;\n }", "private boolean isOperator (String s){ \n for (int i = 0; i<operators.length; i++){\n if (s.equals(operators[i])){\n return true;\n }\n }\n return false;\n }", "private boolean containsOperands(final String exp)\n {\n for (int i = 0; i < 10; i++) {\n if (exp.contains(\"\"+i))\n return true; //Expression contains a digit\n }\n return false; //Expression does not contain digits\n }", "public boolean isValidOperator(String op)\n {\n return (normalizeOperator(op) != null);\n }", "private boolean hasPrecedence(char op1, char op2) {\n if (op1 == '(' || op1 == ')') {\n return false;\n }\n if ((op1 == '+' || op1 == '-') && (op2 == '*' || op2 == '/')) {\n return false;\n }\n return true;\n }", "public static boolean isOperator(String token) {\n if (Connective.getValueFromSymbol(token) == null) {\n return false;\n } else {\n return true;\n }\n }", "boolean isLetra(char caracter){\n\r\n if(caracter=='+'||caracter=='-'||caracter=='/'||caracter=='^'||caracter=='*'||caracter=='('||caracter==')'){\r\n return false;\r\n }else{\r\n return true;\r\n }\r\n \r\n }", "private static boolean isOperator(String token) {\n\t\treturn OPERATORS.containsKey(token);\n\t}", "private final boolean IsBinaryOp(String expression, String symbol, String leftExpression, String rightExpression) {\r\n boolean isBinaryOp = false;\r\n if (expression.contains(symbol)) {\r\n int openParanthesisCount = 0;\r\n int closeParanthesisCount = 0;\r\n for (int i = 0; (i < expression.length()); i++) {\r\n String currentChar = expression.substring(i, 1);\r\n if ((currentChar.equals(symbol) \r\n && (openParanthesisCount == closeParanthesisCount))) {\r\n leftExpression = expression.substring(0, i);\r\n rightExpression = expression.substring((i + 1), (expression.length() - (i - 1)));\r\n isBinaryOp = true;\r\n break;\r\n }\r\n else if (currentChar.equals(\"(\")) {\r\n openParanthesisCount++;\r\n }\r\n else if (currentChar.equals(\")\")) {\r\n closeParanthesisCount++;\r\n }\r\n \r\n }\r\n \r\n }\r\n \r\n return isBinaryOp;\r\n }", "private boolean isValid(char input) {\n if (this.isLetter(input) || this.isDigit(input) || this.isOperator(input)\n || this.isIgnored(input)) {\n return true;\n } else return false;\n }", "private static char getOperator() throws ParseError {\n TextIO.skipBlanks(); // Skip past any blanks in the input.\n\n char op = TextIO.peek();\n\n if ( op == '+' || op == '-' || op == '*' || op == '/' )\n TextIO.getAnyChar(); // Read the operator.\n else\n throw new ParseError( \"Found \" + op + \" instead of an operator.\" );\n\n return op;\n\n }", "public static boolean hasPrecedence(char op1, char op2) {\n\n\t\tif (op2 == '(' || op2 == ')') {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ((op1 == '*' || op1 == '/') && (op2 == '+' || op2 == '-')){\n\t\t\treturn false;\n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t}", "private boolean esDelimitador(char c){\n if ((\"+-/*^=%()\".indexOf (c) != -1)){\n return true;\n }else{\n return false;\n }\n }", "public boolean isChar(String x) {\n\t\tfor (int i = 0; i < x.length(); i++) {\n\t\t\tchar c = x.charAt(i);\n\t\t\tif ((c == '-' || c == '+') && x.length() > 1)\n\t\t\t\tcontinue;\n\t\t\tif (((int) c > 64 && (int) c < 90) || ((int) c > 96 && (int) c < 123))\n\t\t\t\tcontinue;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "private boolean isArithmeticCmd() {\r\n for (String cmd : ARITHMETIC_CMDS) {\r\n if (command.equals(cmd)) return true;\r\n }\r\n return false;\r\n }", "boolean hasChar();", "private boolean temMaisQueUmOperador(String currentResult) {\n int contador = 1;\n\n if (currentResult.contains(\"+\")) {\n contador = contador + 1;\n }\n\n if (currentResult.contains(\"-\")) {\n contador = contador + 1;\n }\n\n if (currentResult.contains(\"*\")) {\n contador = contador + 1;\n }\n\n if (contador > 1) {\n return true;\n }\n\n return false;\n }", "private boolean precedence(String input) {\n\t\tboolean complies = true;\n\t\t\n\t\tif(((input.equals(\"+\")) || (input.equals(\"-\"))) && (operationStack.empty() == false))\n\t\t{\n\t\t\tif((operationStack.peek().equals(\"*\")) || (operationStack.peek().equals(\"/\")))\n\t\t\t{\n\t\t\t\tcomplies = false;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn complies;\n\t}", "private boolean hasValidCharacters(final String exp)\n {\n for(int i=0; i<exp.length(); i++)\n {\n /*\n If the character is not a part of an operand, an\n operator, or a space, then expression is invalid\n */\n if(!isNumPart(i,exp)\n && !isOperator(exp.charAt(i))\n && exp.charAt(i) != ' ')\n return false; //Invalid character detected\n }\n return true; //All characters are valid\n }", "private static boolean validOperation(String op) {\n\t\tfor (String goodOp : validOps) {\n\t\t\tif (goodOp.equalsIgnoreCase(op)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "public boolean is(char chIn) {\n for (char ch: allOps) {\n if (chIn == ch){\n return true;\n }\n }\n return false;\n }", "public boolean validate(String userInput){\n int operandCount = 0, operatorCount = 0, leftParenCount = 0, rightParenCount = 0, inputLength = userInput.length();\n char ch;\n\n for(int i = 0; i < inputLength; i++){\n ch = userInput.charAt(i);\n\n if(ch == '('){\n leftParenCount++;\n }\n else if(ch == ')'){\n rightParenCount++;\n }\n\n if(isOperator(ch)){\n operatorCount++;\n }\n if(isOperand(ch)){\n operandCount++;\n }\n }\n\n for(int i = 0; i < inputLength - 1; i++){\n char ch1 = userInput.charAt(i);\n char ch2 = userInput.charAt(i + 1);\n if(isOperator(ch1) && isOperator(ch2)){\n return false;\n }\n }\n\n if(operandCount == 1 && operatorCount == 1){\n return false;\n }\n\n if((operandCount == 0) || (operatorCount == 0) || (leftParenCount != rightParenCount)){\n return false;\n }\n\n else if(isOperator(userInput.charAt(0)) && (userInput.charAt(0) != '(')){\n return false;\n }\n\n return true; // Validation Successful!\n }", "private static boolean c(char paramChar)\r\n/* 680: */ {\r\n/* 681:674 */ return ((paramChar >= '0') && (paramChar <= '9')) || ((paramChar >= 'a') && (paramChar <= 'f')) || ((paramChar >= 'A') && (paramChar <= 'F'));\r\n/* 682: */ }", "public boolean isOperator(){\n return true;\n }", "private static boolean checkPrecedence(String operator1, String operator2){\n\n\t\tif((operator1.equals(\"*\") || operator1.equals(\"/\")) && (operator2.equals(\"*\") || operator2.equals(\"/\"))){\n\t\t\treturn true;\n\t\t}\n\t\telse if((operator1.equals(\"*\") || operator1.equals(\"/\")) && (operator2.equals(\"+\") || operator2.equals(\"-\"))){\n\t\t\treturn true;\n\t\t}\n\t\telse if((operator1.equals(\"+\") || operator1.equals(\"-\")) && (operator2.equals(\"+\") || operator2.equals(\"-\"))){\n\t\t\treturn true;\n\t\t}\n\t\telse if((operator1.equals(\"+\") || operator1.equals(\"-\")) && (operator2.equals(\"*\") || operator2.equals(\"/\"))){\n\t\t\treturn false;\n\t\t}\n\t\telse{\n\t\t\treturn false;\n\t\t}\n\t}", "@Override\r\n\tpublic boolean visit(QualifiedName node) {\r\n\t\toperand(node,node.getFullyQualifiedName());\r\n\t\treturn false;\r\n\t}", "public boolean isOperand(){\n return false;\n }", "public boolean addCharacter(String character)\r\n\t{\r\n\t\tif(character.length() != 1)\r\n\t\t\treturn false;\r\n\t\tif(character.equals(\".\"))\r\n\t\t{\r\n\t\t\tif(isDotAllowed())\r\n\t\t\t{\r\n\t\t\t\texpression += character;\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\t//if the previous character and the current character is a evaluation symbol, change the previous symbol to the new one.\r\n\t\tif(isPreEvalSymobl() && isEvalSymbol(character))\r\n\t\t\texpression = expression.substring(0, expression.length() - 1) + character;\r\n\t\telse\r\n\t\t\texpression += character;\r\n\t\treturn true;\r\n\t}", "private boolean isArithOp() throws IOException\n\t{\n\t\tboolean isValid = false;\n\t\t\n\t\tif(isRelation())\n\t\t{\n\t\t\tif(theNextToken.TokenType == TokenType.PLUS)\n\t\t\t{\n\t\t\t\tupdateToken();\n\t\t\t\tupdateToken();\n\t\t\t\t\n\t\t\t\tif(isArithOp())\n\t\t\t\t{\n\t\t\t\t\tisValid = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(theNextToken.TokenType == TokenType.MINUS)\n\t\t\t{\n\t\t\t\tupdateToken();\n\t\t\t\tupdateToken();\n\t\t\t\t\n\t\t\t\tif(isArithOp())\n\t\t\t\t{\n\t\t\t\t\tisValid = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tisValid = true;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn isValid;\n\t}", "public boolean is(String strIn) {\n for (char ch: allOps) {\n if (strIn.equals(ch + \"\")){\n return true;\n }\n }\n return false;\n }", "int isSymbol(String h) {\r\n\r\n\t\ttry {\r\n\r\n\t\t\tif (h.equals(\"+\") || h.equals(\"-\") || h.equals(\"*\") || h.equals(\"/\") || h.equals(\"=\")) {\r\n\t\t\t\tisToken(h);\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\t\t\tif (h.equals(\";\")) {\r\n\t\t\t\tisToken(h);\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\r\n\t\t\tif (h.contains(\"(){\")) {\r\n\t\t\t\tisToken(\"(\");\r\n\t\t\t\tisToken(\")\");\r\n\t\t\t\tisToken(\"{\");\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\r\n\t\t\tif (h.contains(\"*\")) {\r\n\t\t\t\tisToken(\"*\");\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\t\t\tif (h.contains(\"/\")) {\r\n\t\t\t\tisToken(\"/\");\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\t\t\tif (h.contains(\"-\")) {\r\n\t\t\t\tisToken(\"-\");\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\t\t\tif (h.contains(\"+\")) {\r\n\t\t\t\tisToken(\"+\");\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\r\n\t\t\tif (h.contains(\"(\") || h.equals(\"(\") || h.contains(\")\") || h.equals(\")\")) {\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\r\n\t\t\tisToken(h);\r\n\t\t\treturn 1;\r\n\r\n\t\t} catch (Exception e) {\r\n\r\n\t\t\tSystem.out.println(\"Program will not run because of this symbol = \" + h);\r\n\t\t}\r\n\t\treturn 0;\r\n\t}", "private boolean peekedHasPrecedence(\tchar peeked,\r\n\t\t\t\t\t\t\t\t\t\t\tchar current )\r\n\t{\r\n\t\tif ( ( peeked == '+' || peeked == '-' ) && ( current == '*' || current == '/' ) )\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}//end if\r\n\t\telse\r\n\t\t{\r\n\t\t\treturn true;\r\n\t\t}//end else\r\n\t}", "public static boolean containLogicOperators(String str){\n return contains(str, logicOperatorPattern);\n }", "public boolean isNotOperator(String substring) {\n\t\tString[] Operators = { \"*\", \"-\", \"+\", \"/\" };\n\t\tfor (int i = 0; i < 4; i++) {\n\t\t\tif (substring.equals(Operators[i]))\n\t\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "private boolean dividingByZero(String operator){\n if (numStack.peek() == 0 && operator.equals(\"/\")){\n return true;\n }\n return false;\n }", "boolean checkChar(String s1, String s2);", "private boolean isOperandsValid(String valueEntered, SearchOperator binaryOperator) {\n if (StringUtils.contains(valueEntered, binaryOperator.op())) {\n // using this split method to make sure we test both sides of the operator. Using String.split would\n // throw away empty strings, so e.g. \"&&100\".split(\"&&\") would return an array with one element, [\"100\"].\n String [] l = StringUtils.splitByWholeSeparatorPreserveAllTokens(valueEntered, binaryOperator.op());\n for(String value : l) {\n if (!isPassesDefaultValidation(value)) {\n return false;\n }\n }\n }\n\n return true;\n }", "private void processOperator() {\r\n\t\tif (expression[currentIndex] == '*') {\r\n\t\t\ttoken = new Token(TokenType.OPERATOR, Constants.AND_STRING);\r\n\t\t} else if (expression[currentIndex] == '+') {\r\n\t\t\ttoken = new Token(TokenType.OPERATOR, Constants.OR_STRING);\r\n\t\t} else if (expression[currentIndex] == '!') {\r\n\t\t\ttoken = new Token(TokenType.OPERATOR, Constants.NOT_STRING);\r\n\t\t} else {\r\n\t\t\ttoken = new Token(TokenType.OPERATOR, Constants.XOR_STRING);\r\n\t\t\t// xor operator has 2 characters more than any other operator.\r\n\t\t\tcurrentIndex += 2;\r\n\t\t}\r\n\r\n\t\tcurrentIndex++;\r\n\t}", "private Operator checkOperator(char c){\n if (c == '+'){\n return new AddOperator(); \n }\n else if (c == '-'){\n return new SubOperator(); \n }\n else if (c == '*'){\n return new MulOperator(); \n }\n else if (c == '/'){\n return new DivOperator(); \n }\n else \n return null;\n }", "private static boolean d(char paramChar)\r\n/* 685: */ {\r\n/* 686:678 */ return ((paramChar >= 'k') && (paramChar <= 'o')) || ((paramChar >= 'K') && (paramChar <= 'O')) || (paramChar == 'r') || (paramChar == 'R');\r\n/* 687: */ }", "boolean hasHasCharacter();", "public boolean isSpecialCharacter(String enteredCmd) {\n Pattern regex = Pattern.compile(\"[%@#€]+\");\n Matcher m = regex.matcher(enteredCmd);\n return m.matches();\n }", "private boolean isChar(char c){\n\t\tif(Character.isISOControl(c))\n\t\t\treturn false;\n\t\treturn true;\n\t}", "public boolean characterInput(char c);", "private boolean isParenthesis(char x) {\n return x == '(' || x == ')';\n }", "boolean isOp();", "private boolean isOK(char ch) {\n if(String.valueOf(ch).matches(\"[<|\\\\[|\\\\-|\\\\||&|a-z|!]\")){\n return true;\n }\n return false;\n }", "public boolean preceeds(char a, char b) {\n int first = 0;\n int second = 0;\n \n switch (a) {\n case('+'):\n first = 1;\n break;\n case('-'):\n first = 1;\n break;\n case('*'):\n first = 2;\n break;\n case('/'):\n first = 2;\n break;\n case('%'):\n first = 2;\n break;\n case('('):\n first = 3;\n break;\n case(')'):\n first = 3;\n break;\n default:\n System.out.println(\"Problem with char a in class Operator\");\n }\n switch (b) {\n case('+'):\n second = 1;\n break;\n case('-'):\n second = 1;\n break;\n case('*'):\n second = 2;\n break;\n case('/'):\n second = 2;\n break;\n case('%'):\n second = 2;\n break;\n case('('):\n second = 3;\n break;\n case(')'):\n second = 3;\n break;\n default:\n System.out.println(\"Problem with char b in class Operator\");\n }\n \n return first <= second;\n }", "public boolean isOprBiner() /*const*/{\n\t\treturn Tkn!=TipeToken.Not && Tkn!=TipeToken.Bilangan && !isPunctuator();\n\t}", "boolean ifLegalSign(char ch) {\n\t\tchar[] illegal = { '/', '\\\\', ':', '*', '?', '\"', '<', '>', '|' };\n\t\tfor (char i : illegal) {\n\t\t\tif (ch == i) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "public static boolean checkValid(String text)\r\n {\n if (text.length() == 0)\r\n {\r\n return false;\r\n }\r\n // should only have characters 0, 1, +, -.\r\n int counter = 0; // will count occurrences of + and - characters\r\n for (int i = 0; i < text.length(); i++)\r\n {\r\n char c = text.charAt(i);\r\n if (\"01+-\".indexOf(c) < 0)\r\n {\r\n return false;\r\n } \r\n if (\"+-\".indexOf(c) >= 0)\r\n {\r\n counter++;\r\n }\r\n }\r\n \r\n // should only have one occurrence of a + or - character\r\n if (counter != 1)\r\n {\r\n return false;\r\n }\r\n \r\n // the operator (+ or - character) should not be at the beginning\r\n // or end of the string\r\n char start = text.charAt(0);\r\n char end = text.charAt(text.length() - 1);\r\n if (\"01\".indexOf(start) < 0)\r\n {\r\n return false;\r\n }\r\n if (\"01\".indexOf(end) < 0)\r\n {\r\n return false;\r\n }\r\n \r\n return true;\r\n }", "public boolean validOperands()\r\n {\r\n boolean returnValue = true;\r\n\r\n if (leftOperand == null || leftOperand.trim().equals(\"\") || rightOperand == null\r\n || rightOperand.trim().equals(\"\"))\r\n {\r\n returnValue = false;\r\n }\r\n\r\n return returnValue;\r\n }", "@Override\n protected boolean isValidChar(char character) {\n return character == SQ_BRACKET.getRuleStartChar() || character == BRACES.getRuleStartChar()\n || character == PARENTHESES.getRuleStartChar();\n }", "public boolean isOp(){\n return opSet.contains(symbol());\n }", "public static String SimpleSymbols(String str) {\n \n for(int i = 0; i < str.length(); i++){\n \n if(Character.isLetter(str.charAt(i))){\n \n if(i == 0){\n return \"false\";\n }\n if(str.charAt(i - 1) != '+'){\n return \"false\";\n }\n if((i+ 1) < str.length()){\n if(str.charAt(i+1) != '+'){\n return \"false\";\n }\n }\n }\n }\n \n return \"true\";\n \n }", "private void checkChar(String s) {\n\n\t\t// When it is any digit, just add to queue\n\t\tif (s.matches(\"\\\\d\")) {\n\t\t\tqueue.add(s);\n\n\t\t} else if (s.matches(\"[(]\")) {\n\t\t\tstack.add(s);\n\n\t\t} else if (s.matches(\"[)]\")) {\n\t\t\temptyBracket();\n\n\t\t} else if (s.matches(\"[+-]\")) {\n\t\t\tif (stack.empty()) {\n\t\t\t\tstack.add(s);\n\n\t\t\t} else {\n\t\t\t\tplusMinus(s);\n\t\t\t}\n\n\t\t} else if (s.matches(\"[*/]\")) {\n\t\t\tif (stack.empty()) {\n\t\t\t\tstack.add(s);\n\n\t\t\t} else {\n\t\t\t\tmultiDiv(s);\n\t\t\t}\n\t\t} else if (s.matches(\"[\\\\^]\")) {\n\t\t\tpower(s);\n\t\t}\n\t}", "public boolean validateExp(String expression){\n if(expression.endsWith(\"*\")||\n expression.endsWith(\"+\")||\n expression.endsWith(\"-\")||\n expression.endsWith(\"/\")){\n calculationResult.onExpressionChange(\"Invalid Input\",false);\n return false;\n }\n else if(expression.equals(\"\")){\n calculationResult.onExpressionChange(\"Invalid Input\",false);\n return false;\n }\n else if(expression.length()>16){\n calculationResult.onExpressionChange(\"Invalid Input\",false);\n return false;\n }\n else{\n return true;\n }\n }", "private boolean isExpression() throws IOException\n\t{\n\t\tboolean isValid = false;\n\t\t\n\t\tif(isArithOp())\n\t\t{\n\t\t\tif(theNextToken.TokenType == TokenType.AND)\n\t\t\t{\n\t\t\t\tupdateToken();\n\t\t\t\tupdateToken();\n\t\t\t\t\n\t\t\t\tif(isExpression())\n\t\t\t\t{\n\t\t\t\t\tisValid = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(theNextToken.TokenType == TokenType.OR)\n\t\t\t{\n\t\t\t\tupdateToken();\n\t\t\t\tupdateToken();\n\t\t\t\t\n\t\t\t\tif(isExpression())\n\t\t\t\t{\n\t\t\t\t\tisValid = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tisValid = true;\n\t\t\t}\n\t\t}\n\t\telse if(theCurrentToken.TokenType == TokenType.NOT)\n\t\t{\n\t\t\tupdateToken();\n\t\t\tif(isArithOp())\n\t\t\t{\n\t\t\t\tisValid = true;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn isValid;\n\t}", "public abstract boolean isStarterChar(char c);", "private boolean isAdvancedQuery(String enteredQuery){\n try{\n Character firstChar = enteredQuery.charAt(0);\n Character secondChar = enteredQuery.charAt(1);\n\n return isSignOperator(firstChar.toString()) && secondChar.equals(' ');\n }catch (StringIndexOutOfBoundsException ex){\n return false;\n }\n }", "private boolean slash() {\r\n return MARK(OPERATOR) && CHAR('/') && gap();\r\n }", "public static boolean operationValidator(String str) {\n final Pattern pattern = Pattern.compile(\".\");\n\n return pattern.matcher(str).matches();\n\n }", "private boolean postFixEvalution(char operator) throws ArithmeticException{\n //Pre: Validar que el stack no este vacio y que los operandos sean numeros.\n //Post: Realizar la operacion indicada\n try{\n if(!stack.empty()){\n //Se obtienen los dos operandos mas recientes del stack.\n Integer op2 = stack.pop();\n Integer op1 = stack.pop();\n\n //Se determina la operacion por hacer.\n if(op1 != null && op2 != null){\n switch (operator){\n case '+':\n stack.push(op1 + op2);\n break;\n case '-':\n stack.push(op1 - op2);\n break;\n case '*':\n stack.push(op1 * op2);\n break;\n case '/':\n stack.push(op1 / op2);\n break;\n }\n return true;\n }\n else\n return false;\n }\n else{\n return false;\n }\n }\n catch (ArithmeticException e){\n String ex = \"Error: Division por 0\";\n throw new ArithmeticException(ex);\n }\n }" ]
[ "0.80983895", "0.80913067", "0.8091049", "0.8021369", "0.7934937", "0.79305017", "0.79152375", "0.7911901", "0.79022646", "0.7876445", "0.7858984", "0.78504336", "0.7791002", "0.77500355", "0.7745211", "0.77186036", "0.7653191", "0.7650521", "0.7554993", "0.75278795", "0.7464462", "0.74544215", "0.74404323", "0.7439937", "0.739221", "0.7329651", "0.7304747", "0.72801495", "0.72685003", "0.7235584", "0.71973854", "0.71455956", "0.7073304", "0.69978607", "0.6969961", "0.6898997", "0.6785665", "0.67276645", "0.6723996", "0.66929555", "0.66926914", "0.6637501", "0.662906", "0.65753394", "0.65150136", "0.6407566", "0.63973236", "0.6393797", "0.6383012", "0.6353798", "0.6344531", "0.6316277", "0.63074535", "0.63030505", "0.62888783", "0.62273157", "0.6220574", "0.62062234", "0.6109358", "0.60888255", "0.6078273", "0.60767573", "0.6060399", "0.6054871", "0.6047029", "0.6041373", "0.6038544", "0.603537", "0.5999423", "0.5996463", "0.5978952", "0.59667826", "0.596163", "0.5957681", "0.59433436", "0.59423757", "0.5934702", "0.59324497", "0.59182435", "0.59093225", "0.5899409", "0.5894027", "0.5891954", "0.58864284", "0.58780116", "0.5848344", "0.58131146", "0.5811667", "0.5787637", "0.57869804", "0.5776085", "0.5753863", "0.5749613", "0.5746664", "0.5744536", "0.57085794", "0.5706418", "0.57000095", "0.5696767", "0.5685265" ]
0.8052691
3
Test that, once the queue eclipses the configure size limit, calls to journal more data are rejected.
@Test public void testQueueLimiting() throws Exception { // Block the underlying fake proxy from actually completing any calls. DelayAnswer delayer = new DelayAnswer(LOG); Mockito.doAnswer(delayer).when(mockProxy).journal( Mockito.<RequestInfo>any(), Mockito.eq(1L), Mockito.eq(1L), Mockito.eq(1), Mockito.same(FAKE_DATA)); // Queue up the maximum number of calls. int numToQueue = LIMIT_QUEUE_SIZE_BYTES / FAKE_DATA.length; for (int i = 1; i <= numToQueue; i++) { ch.sendEdits(1L, (long)i, 1, FAKE_DATA); } // The accounting should show the correct total number queued. assertEquals(LIMIT_QUEUE_SIZE_BYTES, ch.getQueuedEditsSize()); // Trying to queue any more should fail. try { ch.sendEdits(1L, numToQueue + 1, 1, FAKE_DATA).get(1, TimeUnit.SECONDS); fail("Did not fail to queue more calls after queue was full"); } catch (ExecutionException ee) { if (!(ee.getCause() instanceof LoggerTooFarBehindException)) { throw ee; } } delayer.proceed(); // After we allow it to proceeed, it should chug through the original queue GenericTestUtils.waitFor(new Supplier<Boolean>() { @Override public Boolean get() { return ch.getQueuedEditsSize() == 0; } }, 10, 1000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void testEnsureBufferSizeExpandsToBeyondMaxBufferSize() {\n assertEnsureBufferSizeExpandsToMaxBufferSize(true);\n }", "private void raiseLimitException() {\n\t\t\tthrow new DataBufferLimitException(\"Exceeded limit on max bytes to buffer : \" + getMaxInMemorySize());\n\t\t}", "@Override\n\tpublic void setWriteQueueMaxSize(int maxSize) {\n\t\t\n\t}", "@Test\n public void testEnsureBufferSizeExpandsToMaxBufferSize() {\n assertEnsureBufferSizeExpandsToMaxBufferSize(false);\n }", "@Test\n public void testMaybeScheduleStartAlarmLocked_SmallRollingQuota_UpdatedBufferSize() {\n setDeviceConfigLong(QcConstants.KEY_IN_QUOTA_BUFFER_MS,\n mQcConstants.IN_QUOTA_BUFFER_MS * 2);\n\n runTestMaybeScheduleStartAlarmLocked_SmallRollingQuota_AllowedTimeCheck();\n mQuotaController.getTimingSessions(SOURCE_USER_ID, SOURCE_PACKAGE).clear();\n runTestMaybeScheduleStartAlarmLocked_SmallRollingQuota_MaxTimeCheck();\n }", "protected abstract boolean reachedContractLimit(int size);", "@Test(timeout = 4000)\n public void test14() throws Throwable {\n ConnectionFactories connectionFactories0 = new ConnectionFactories();\n QueueConnectionFactory queueConnectionFactory0 = new QueueConnectionFactory();\n try { \n connectionFactories0.addQueueConnectionFactory((-4356), queueConnectionFactory0);\n fail(\"Expecting exception: IndexOutOfBoundsException\");\n \n } catch(IndexOutOfBoundsException e) {\n //\n // Index: -4356, Size: 0\n //\n verifyException(\"java.util.ArrayList\", e);\n }\n }", "@Test\n public void testMaxQueue() throws Throwable {\n internalMaxQueue(\"core\");\n internalMaxQueue(\"openwire\");\n internalMaxQueue(\"amqp\");\n }", "@Test\n\tpublic void testLPushLimit() {\n\t\tJedisUtils.del(\"k1\");\n\t\tJedisUtils.HASH.hget(\"k1\", \"k1\");\n\t\tJedisUtils.LIST.lpushLimit(\"gen_rule_file_tasks-ssy1\", 1, \"新增了开启状态规则文件\");\n\t\tJedisUtils.LIST.lpushLimit(\"gen_rule_file_tasks-ssy1\", 1, \"新增了开启状态规则文件\");\n\t}", "@Test\n public void testGetTimeUntilQuotaConsumedLocked_MaxExecution() {\n final long now = JobSchedulerService.sElapsedRealtimeClock.millis();\n // Overlap boundary.\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(\n now - (24 * HOUR_IN_MILLIS + 8 * MINUTE_IN_MILLIS), 4 * HOUR_IN_MILLIS, 5),\n false);\n\n setStandbyBucket(WORKING_INDEX);\n synchronized (mQuotaController.mLock) {\n assertEquals(8 * MINUTE_IN_MILLIS,\n mQuotaController.getRemainingExecutionTimeLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE));\n // Max time will phase out, so should use bucket limit.\n assertEquals(10 * MINUTE_IN_MILLIS,\n mQuotaController.getTimeUntilQuotaConsumedLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE));\n }\n\n mQuotaController.getTimingSessions(SOURCE_USER_ID, SOURCE_PACKAGE).clear();\n // Close to boundary.\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - (24 * HOUR_IN_MILLIS - MINUTE_IN_MILLIS),\n 4 * HOUR_IN_MILLIS - 5 * MINUTE_IN_MILLIS, 5), false);\n\n setStandbyBucket(WORKING_INDEX);\n synchronized (mQuotaController.mLock) {\n assertEquals(5 * MINUTE_IN_MILLIS,\n mQuotaController.getRemainingExecutionTimeLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE));\n assertEquals(10 * MINUTE_IN_MILLIS,\n mQuotaController.getTimeUntilQuotaConsumedLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE));\n }\n\n mQuotaController.getTimingSessions(SOURCE_USER_ID, SOURCE_PACKAGE).clear();\n // Far from boundary.\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(\n now - (20 * HOUR_IN_MILLIS), 4 * HOUR_IN_MILLIS - 3 * MINUTE_IN_MILLIS, 5),\n false);\n\n setStandbyBucket(WORKING_INDEX);\n synchronized (mQuotaController.mLock) {\n assertEquals(3 * MINUTE_IN_MILLIS,\n mQuotaController.getRemainingExecutionTimeLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE));\n assertEquals(3 * MINUTE_IN_MILLIS,\n mQuotaController.getTimeUntilQuotaConsumedLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE));\n }\n }", "private Queue<Integer> addToQueue(Queue<Integer> q, int item, int maxLength){\n q.add(item);\n while(q.size() > maxLength){\n q.remove(); //make sure the queue size isn't larger than its supposed to be\n }\n //System.out.println(\"queue_after_added \" + q);\n return q;\n }", "Integer backlogCapacity();", "@Test\n public void testMaybeScheduleStartAlarmLocked_SmallRollingQuota_UpdatedMaxTime() {\n setDeviceConfigLong(QcConstants.KEY_MAX_EXECUTION_TIME_MS,\n mQcConstants.MAX_EXECUTION_TIME_MS / 2);\n\n runTestMaybeScheduleStartAlarmLocked_SmallRollingQuota_AllowedTimeCheck();\n mQuotaController.getTimingSessions(SOURCE_USER_ID, SOURCE_PACKAGE).clear();\n runTestMaybeScheduleStartAlarmLocked_SmallRollingQuota_MaxTimeCheck();\n }", "private void tryToEnsureAvailableCapacity(final int requestedMaxWorkToRetrieve) {\n // todo this counts all partitions as a whole - this may cause some partitions to starve. need to round robin it?\n int available = sm.getWorkQueuedInShardsCount();\n int extraNeededFromInboxToSatisfy = requestedMaxWorkToRetrieve - available;\n log.debug(\"Requested: {}, available in shards: {}, will try to process from mailbox the delta of: {}\",\n requestedMaxWorkToRetrieve, available, extraNeededFromInboxToSatisfy);\n\n ingestPolledRecordsIntoQueues(extraNeededFromInboxToSatisfy);\n }", "public Queue(int maxsize){\n this.maxsize=maxsize; // sets the limit\n System.out.println(\"The maxsize was set to \"+maxsize);\n }", "public void setLogCollectionMaxFileSize(int size);", "public void setMaxEvictionQueueEntries(int val) {\n this.mMaxEvictionQueueEntries = val;\n }", "int getWriterMaxQueueSize();", "@Test\n public void testSendingDataException_whenTimesOut() throws Throwable {\n final LinkedBlockingQueue<IMetricsUploadService> mockedResultsQueue =\n mock(LinkedBlockingQueue.class);\n when(mockedResultsQueue.poll(anyLong(), any())).thenReturn(null);\n\n AwMetricsLogUploader uploader = new AwMetricsLogUploader(\n /* waitForResults= */ true, /* useDefaultUploadQos= */ false);\n int status = uploader.log(SAMPLE_TEST_METRICS_LOG.toByteArray(), mockedResultsQueue);\n\n Assert.assertEquals(HttpURLConnection.HTTP_CLIENT_TIMEOUT, status);\n }", "@Test\n public void testErrOnMaxPayloadLimit() {\n long expectedMaxPayload = 10;\n String serverInfo =\n \"INFO {\\\"server_id\\\":\\\"foobar\\\",\\\"version\\\":\\\"0.6.6\\\",\\\"go\\\":\\\"go1.5.1\\\",\\\"host\\\":\\\"%s\\\",\\\"port\\\":%d,\\\"auth_required\\\":false,\\\"ssl_required\\\":false,\\\"max_payload\\\":%d}\\r\\n\";\n\n TCPConnectionFactoryMock mcf = new TCPConnectionFactoryMock();\n String infoString = (String.format(serverInfo, \"mockserver\", 2222, expectedMaxPayload));\n // System.err.println(infoString);\n mcf.setServerInfoString(infoString);\n ConnectionFactory cf = new ConnectionFactory();\n try (Connection c = cf.createConnection(mcf)) {\n // Make sure we parsed max payload correctly\n assertEquals(c.getMaxPayload(), expectedMaxPayload);\n\n // Check for correct exception\n boolean exThrown = false;\n try {\n c.publish(\"hello\", \"hello world\".getBytes());\n } catch (IllegalArgumentException e) {\n assertEquals(ERR_MAX_PAYLOAD, e.getMessage());\n exThrown = true;\n } finally {\n assertTrue(\"Should have generated a IllegalArgumentException.\", exThrown);\n }\n\n // Check for success on less than maxPayload\n\n } catch (IOException | TimeoutException e) {\n fail(\"Connection to mock server failed: \" + e.getMessage());\n }\n }", "public HoldingQueue(int maxSize) {\n this.maxSize = maxSize;\n holdingQueue = new ArrayList<Person>(maxSize);\n numPeople = 0;\n }", "void setTransactionLogMaxSize(int maxSize) {\n\t\ttransactionLog.setMaxSize(maxSize);\n\t\t\n\t\tif (maxSize == 0) {\n\t\t\ttransactionMonitor = null;\n\t\t} else {\n\t\t\ttransactionMonitor = new TransactionMonitor(transactionLog);\n\t\t}\n\t}", "public OverflowableTransferQueue(int maximumSize, int resetThreshold)\n {\n mMaximumSize = maximumSize;\n mResetThreshold = resetThreshold;\n }", "protected String queueWarning(Queue checkQueue, String name, int size) throws Exception\r\n\t{\r\n\t\tif (size > warningSize)\r\n\t\t{\r\n\t\t\tString queueWarning = \"\";\r\n\r\n\t\t\tif (size >= maxSize)\r\n\t\t\t{\r\n\t\t\t\tqueueWarning = \"FATAL: queue \" + name + \" is reach to limitation (\" + size + \"/\" + maxSize + \")\\r\\n\";\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tqueueWarning = \"WARNING: queue \" + name + \" may be reach to limitation (\" + size + \"/\" + maxSize + \")\\r\\n\";\r\n\t\t\t}\r\n\r\n\t\t\tlogMonitor(queueWarning);\r\n\t\t\t// alarmMessage += warningMessage;\r\n\r\n\t\t\treturn queueWarning;\r\n\t\t}\r\n\t\treturn \"\";\r\n\t}", "@Test\n public void launchesEventhandlerThreadpoolMaxsizeTest() {\n // TODO: test launchesEventhandlerThreadpoolMaxsize\n }", "private void runTestMaybeScheduleStartAlarmLocked_SmallRollingQuota_MaxTimeCheck() {\n spyOn(mQuotaController);\n doNothing().when(mQuotaController).maybeScheduleCleanupAlarmLocked();\n\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(\n createJobStatus(\"testMaybeScheduleStartAlarmLocked\", 1), null);\n }\n\n final long now = JobSchedulerService.sElapsedRealtimeClock.millis();\n // Working set window size is 2 hours.\n final int standbyBucket = WORKING_INDEX;\n final long contributionMs = mQcConstants.IN_QUOTA_BUFFER_MS / 2;\n final long remainingTimeMs = mQcConstants.MAX_EXECUTION_TIME_MS - contributionMs;\n\n // Session straddles edge of 24 hour window. Only the contribution should be counted towards\n // the quota.\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - (24 * HOUR_IN_MILLIS + 3 * MINUTE_IN_MILLIS),\n 3 * MINUTE_IN_MILLIS + contributionMs, 3), false);\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - 20 * HOUR_IN_MILLIS, remainingTimeMs, 300), false);\n // Expected alarm time should be when the app will have QUOTA_BUFFER_MS time of quota, which\n // is 24 hours + (QUOTA_BUFFER_MS - contributionMs) after the start of the second session.\n final long expectedAlarmTime = now - 20 * HOUR_IN_MILLIS\n + 24 * HOUR_IN_MILLIS\n + (mQcConstants.IN_QUOTA_BUFFER_MS - contributionMs);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeScheduleStartAlarmLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE, standbyBucket);\n }\n verify(mAlarmManager, timeout(1000).times(1)).setWindow(\n anyInt(), eq(expectedAlarmTime), anyLong(), eq(TAG_QUOTA_CHECK), any(), any());\n }", "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 }", "private void m145778h() {\n if (!this.f119477j.mo115499a() && !this.f119478k && mo115435b(\"PRAGMA journal_size_limit\", null, null) != 524288) {\n mo115435b(\"PRAGMA journal_size_limit=524288\", null, null);\n }\n }", "public void testDrainToSelfN() {\n SynchronousQueue q = new SynchronousQueue();\n try {\n q.drainTo(q, 0);\n shouldThrow();\n } catch(IllegalArgumentException success) {\n }\n }", "@Override\n public int getMaxCapacity() {\n return 156250000;\n }", "@Test (expected = QueueEmptyException.class)\n public void testRemoveMaxOnEmpty() {\n this.iPQ.remove();\n this.sPQ.remove();\n }", "@Test\n public void decodePayload_shouldRejectMessagesThatAreTooLong() {\n List<List<ByteBuf>> testByteBufSlices =\n Utils.generateTestSlices(LENGTH_PREFIX_EXCEEDING_MAXIMUM_LENGTH);\n\n for (Iterable<ByteBuf> bufSlices : testByteBufSlices) {\n RpcByteBufDecoder<StatusMessage> decoder = encoding.createDecoder(StatusMessage.class);\n List<ByteBuf> usedBufs = new ArrayList<>();\n assertThatThrownBy(\n () -> {\n for (ByteBuf bufSlice : bufSlices) {\n assertThat(decoder.decodeOneMessage(bufSlice)).isEmpty();\n bufSlice.release();\n usedBufs.add(bufSlice);\n }\n decoder.complete();\n })\n .isInstanceOf(ChunkTooLongException.class);\n assertThat(usedBufs).allMatch(b -> b.refCnt() == 0);\n }\n }", "@Test\n public void testMaybeScheduleStartAlarmLocked_Ej_SmallRollingQuota() {\n // saveTimingSession calls maybeScheduleCleanupAlarmLocked which interferes with these tests\n // because it schedules an alarm too. Prevent it from doing so.\n spyOn(mQuotaController);\n doNothing().when(mQuotaController).maybeScheduleCleanupAlarmLocked();\n\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(\n createJobStatus(\"testMaybeScheduleStartAlarmLocked_Ej_SRQ\", 1), null);\n }\n\n final long now = JobSchedulerService.sElapsedRealtimeClock.millis();\n setStandbyBucket(WORKING_INDEX);\n final long contributionMs = mQcConstants.IN_QUOTA_BUFFER_MS / 2;\n final long remainingTimeMs = mQcConstants.EJ_LIMIT_WORKING_MS - contributionMs;\n\n // Session straddles edge of bucket window. Only the contribution should be counted towards\n // the quota.\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - (24 * HOUR_IN_MILLIS + 3 * MINUTE_IN_MILLIS),\n 3 * MINUTE_IN_MILLIS + contributionMs, 3), true);\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - 23 * HOUR_IN_MILLIS, remainingTimeMs, 2), true);\n // Expected alarm time should be when the app will have QUOTA_BUFFER_MS time of quota, which\n // is 24 hours + (QUOTA_BUFFER_MS - contributionMs) after the start of the second session.\n final long expectedAlarmTime =\n now + HOUR_IN_MILLIS + (mQcConstants.IN_QUOTA_BUFFER_MS - contributionMs);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeScheduleStartAlarmLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE, WORKING_INDEX);\n }\n verify(mAlarmManager, timeout(1000).times(1)).setWindow(\n anyInt(), eq(expectedAlarmTime), anyLong(), eq(TAG_QUOTA_CHECK), any(), any());\n }", "@Test(timeout = 4000)\n public void test40() throws Throwable {\n ConnectionFactories connectionFactories0 = new ConnectionFactories();\n try { \n connectionFactories0.addXAQueueConnectionFactory(457, (XAQueueConnectionFactory) null);\n fail(\"Expecting exception: IndexOutOfBoundsException\");\n \n } catch(IndexOutOfBoundsException e) {\n //\n // Index: 457, Size: 0\n //\n verifyException(\"java.util.ArrayList\", e);\n }\n }", "public BlockingQueue(int maxSize) {\r\n\t\tthis.maxSize = maxSize;\r\n\t\tqueue = new LinkedList<T>();\r\n\t}", "public int drain(MessagePassingQueue.Consumer<E> c, int limit)\r\n/* 362: */ {\r\n/* 363: */ E m;\r\n/* 364:652 */ for (int i = 0; (i < limit) && ((m = relaxedPoll()) != null); i++) {\r\n/* 365:656 */ c.accept(m);\r\n/* 366: */ }\r\n/* 367:658 */ return i;\r\n/* 368: */ }", "@Test\n public void orgApacheFelixEventadminThreadPoolSizeTest() {\n // TODO: test orgApacheFelixEventadminThreadPoolSize\n }", "public Builder setMaxEnvelopeQueueSize(long value) {\n \n maxEnvelopeQueueSize_ = value;\n onChanged();\n return this;\n }", "@Test\n public void testDrain() {\n\tFileBackedBlockingQueue<String> queue = new FileBackedBlockingQueue.Builder<String>()\n\t\t.directory(TEST_DIR)\n\t\t.serializer(new StringSerializer())\n\t\t.segmentSize((TEST_STRING.length() + Segment.ENTRY_OVERHEAD_SIZE + 10) * 100)\n\t\t.build();\n\t// init\n\tfor (int i = 0; i < 2000; i++)\n\t queue.add(TEST_STRING + i);\n\tqueue.drainTo(new ArrayList<String>(), 1000);\n\n\tfor (int i = 1000; i < 2000; i++)\n\t Assert.assertEquals(TEST_STRING + i, queue.poll());\n }", "@Test\n public void sizeTest() {\n assertThat(4, is(this.queue.size()));\n }", "public void testMaximumMessages() throws Exception {\n for (int i = 0; i < 1024 + 1; i++) {\n sendMessage(i);\n waitForMs(50);\n }\n\n sendMessage(0);\n waitForMs(40);\n // Check if the oldest one has been already evicted.\n CellBroadcastMessage cbmTest =\n (CellBroadcastMessage) mServiceIntentToVerify.getExtras().get(\"message\");\n CellBroadcastMessage cbm = new CellBroadcastMessage(createMessage(0));\n\n compareCellBroadCastMessage(cbm, cbmTest);\n mActivityIntentToVerify = null;\n }", "public void setMaxFileSize(int sINGLESIZE) {\n\t\t\r\n\t}", "@Test\n public void testTracking_OutOfQuota() {\n JobStatus jobStatus = createJobStatus(\"testTracking_OutOfQuota\", 1);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(jobStatus, null);\n }\n setStandbyBucket(WORKING_INDEX, jobStatus); // 2 hour window\n setProcessState(ActivityManager.PROCESS_STATE_HOME);\n // Now the package only has two seconds to run.\n final long remainingTimeMs = 2 * SECOND_IN_MILLIS;\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(\n JobSchedulerService.sElapsedRealtimeClock.millis() - HOUR_IN_MILLIS,\n 10 * MINUTE_IN_MILLIS - remainingTimeMs, 1), false);\n\n // Start the job.\n synchronized (mQuotaController.mLock) {\n mQuotaController.prepareForExecutionLocked(jobStatus);\n }\n advanceElapsedClock(remainingTimeMs);\n\n // Wait for some extra time to allow for job processing.\n verify(mJobSchedulerService,\n timeout(remainingTimeMs + 2 * SECOND_IN_MILLIS).times(1))\n .onControllerStateChanged(argThat(jobs -> jobs.size() == 1));\n assertFalse(jobStatus.isConstraintSatisfied(JobStatus.CONSTRAINT_WITHIN_QUOTA));\n assertEquals(JobSchedulerService.sElapsedRealtimeClock.millis(),\n jobStatus.getWhenStandbyDeferred());\n }", "@Test\n public void shouldNotReadWholeStreamWithDefault() {\n final Queue<String> queue = new LinkedBlockingQueue<>();\n\n Executors.newCachedThreadPool().submit(() -> produceData(queue));\n\n final List<String> collected = queue.stream().collect(Collectors.toList());\n assertThat(collected, not(hasItems(\"0\", \"1\", \"2\", \"3\", \"4\")));\n }", "public void setMaxSize(int maxSize) {\n this.maxSize = maxSize;\n }", "@Test\n public void largeMessageVolumeTest_buffered() {\n int batches = 15;\n int batchSize = 5_000;\n List<Long> sendReceiveTimings = new ArrayList<>();\n List<Long> sendTimings = new ArrayList<>();\n for(int i = 0; i< batches; i++) {\n List<String> messages = messages(batchSize, 100);\n long startTime = System.currentTimeMillis();\n for (String message : messages) {\n publisher.publishBuffered(topic, message.getBytes());\n }\n publisher.flushBatchers();\n sendTimings.add(System.currentTimeMillis()-startTime);\n List<NSQMessage> nsqMessages = handler1.drainMessagesOrTimeOut(batchSize);\n sendReceiveTimings.add(System.currentTimeMillis()-startTime);\n\n validateReceivedAllMessages(messages,nsqMessages,true);\n LOGGER.info(\"published batch {} of {}\",i,batches);\n }\n\n double sendAverageMillis = sendTimings.stream().mapToLong(e -> e).average().getAsDouble();\n double throughput = batchSize/sendAverageMillis*1000;\n LOGGER.info(\"Average send time for {} messages: {} millis, {} op/s\", batchSize, sendAverageMillis, throughput);\n\n double totalAverageMillis = sendReceiveTimings.stream().mapToLong(e -> e).average().getAsDouble();\n throughput = batchSize/totalAverageMillis*1000;\n LOGGER.info(\"Average send time for {} messages: {} millis, {} op/s\", batchSize, totalAverageMillis, throughput);\n }", "@Test\n public void testpoll() {\n\tFileBackedBlockingQueue<String> queue = new FileBackedBlockingQueue.Builder<String>()\n\t\t.directory(TEST_DIR)\n\t\t.serializer(new StringSerializer())\n\t\t.segmentSize((TEST_STRING.length() + Segment.ENTRY_OVERHEAD_SIZE) * 100)\n\t\t.build();\n\n\t// init\n\tfor (int i = 0; i < 2000; i++)\n\t queue.add(TEST_STRING);\n\tfor (int i = 0; i < 2000; i++) {\n\t if (i <= 1000)\n\t\tAssert.assertTrue(queue.segments.getActiveSegments() > 10);\n\t else\n\t\tAssert.assertTrue(\n\t\t\t\"size : \" + queue.segments.getInActiveSegments(),\n\t\t\tqueue.segments.getInActiveSegments() >= 9);\n\t Assert.assertEquals(TEST_STRING, queue.poll());\n\t}\n }", "@Test(timeout = 4000)\n public void test72() throws Throwable {\n ConnectionFactories connectionFactories0 = new ConnectionFactories();\n FileSystemHandling.setPermissions((EvoSuiteFile) null, false, false, true);\n QueueConnectionFactory queueConnectionFactory0 = new QueueConnectionFactory();\n connectionFactories0.addQueueConnectionFactory(queueConnectionFactory0);\n QueueConnectionFactory[] queueConnectionFactoryArray0 = connectionFactories0.getQueueConnectionFactory();\n assertEquals(1, queueConnectionFactoryArray0.length);\n }", "@Test\r\n\tpublic void testMoreThan15Items(){\r\n\t\ttry{\r\n\t\t\tPacker.pack(\"./src/test/resources/moreThan15Items.txt\");\r\n\t\t}catch (APIException e) {\r\n\t\t\t// test passed - exception expected when incorrect parameters are being passed\r\n\t\t\tSystem.out.println(\"Test Passed. 15 items limit.\");\r\n\t\t\treturn;\r\n\t\t} catch (Throwable t){\r\n\t\t\tSystem.out.println(\"Unexpected throwable: \" + t.getMessage());\r\n\t\t}\r\n\t\tSystem.out.println(\"\\n\");\r\n\t\tfail(\"APIException was expected\");\r\n\t}", "public test346(int size) {\n \tqueue = new LinkedList<>(); \n \tcap = size;\n }", "protected synchronized boolean isIngestLimitEnabled() {\n return ingestLimit >= 0;\n }", "public void testFairTimedOffer() {\n final SynchronousQueue q = new SynchronousQueue(true);\n Thread t = new Thread(new Runnable() {\n public void run() {\n try {\n\n threadAssertFalse(q.offer(new Object(), SHORT_DELAY_MS, TimeUnit.MILLISECONDS));\n q.offer(new Object(), LONG_DELAY_MS, TimeUnit.MILLISECONDS);\n\t\t\tthreadShouldThrow();\n } catch (InterruptedException success){}\n }\n });\n\n try {\n t.start();\n Thread.sleep(SMALL_DELAY_MS);\n t.interrupt();\n t.join();\n } catch (Exception e){\n unexpectedException();\n }\n }", "@Test(timeout = 4000)\n public void test48() throws Throwable {\n ConnectionFactories connectionFactories0 = new ConnectionFactories();\n connectionFactories0.getQueueConnectionFactoryCount();\n ConnectionFactory connectionFactory0 = new ConnectionFactory();\n try { \n connectionFactories0.setConnectionFactory(0, connectionFactory0);\n fail(\"Expecting exception: IndexOutOfBoundsException\");\n \n } catch(IndexOutOfBoundsException e) {\n //\n // Index: 0, Size: 0\n //\n verifyException(\"java.util.ArrayList\", e);\n }\n }", "@Override\n public boolean offer(E e) {\n if(e== null || (limited && size >= length)) {\n return false;\n }\n queue[size++] = e;\n Arrays.sort(queue, comparator);\n if(size >= queue.length) {\n queueResize();\n }\n return true;\n }", "public void enforceMemoryLimits()\n {\n memoryManager.process(queries.values().stream()\n .filter(query -> query.getState() == RUNNING)\n .collect(toImmutableList()));\n }", "protected abstract int getMaxDesiredSize();", "public BlockingDataSet(int maxSize)\n {\n \t// create an empty queue \n queArray = new ArrayBlockingQueue<Object[]>(maxSize, false);\n \n timeoutGet = Const.toInt(System.getProperty(Const.DATASET_GET_TIMEOUT), Const.TIMEOUT_GET_MILLIS);\n timeoutPut = Const.toInt(System.getProperty(Const.DATASET_PUT_TIMEOUT), Const.TIMEOUT_PUT_MILLIS);\n }", "@Test\n public void testIsWithinEJQuotaLocked_TempAllowlisting() {\n setDischarging();\n JobStatus js = createExpeditedJobStatus(\"testIsWithinEJQuotaLocked_TempAllowlisting\", 1);\n setStandbyBucket(FREQUENT_INDEX, js);\n setDeviceConfigLong(QcConstants.KEY_EJ_LIMIT_FREQUENT_MS, 10 * MINUTE_IN_MILLIS);\n final long now = JobSchedulerService.sElapsedRealtimeClock.millis();\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - (HOUR_IN_MILLIS), 3 * MINUTE_IN_MILLIS, 5), true);\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - (30 * MINUTE_IN_MILLIS), 3 * MINUTE_IN_MILLIS, 5), true);\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - (5 * MINUTE_IN_MILLIS), 4 * MINUTE_IN_MILLIS, 5), true);\n synchronized (mQuotaController.mLock) {\n assertFalse(mQuotaController.isWithinEJQuotaLocked(js));\n }\n\n setProcessState(ActivityManager.PROCESS_STATE_RECEIVER);\n final long gracePeriodMs = 15 * SECOND_IN_MILLIS;\n setDeviceConfigLong(QcConstants.KEY_EJ_GRACE_PERIOD_TEMP_ALLOWLIST_MS, gracePeriodMs);\n Handler handler = mQuotaController.getHandler();\n spyOn(handler);\n\n // Apps on the temp allowlist should be able to schedule & start EJs, even if they're out\n // of quota (as long as they are in the temp allowlist grace period).\n mTempAllowlistListener.onAppAdded(mSourceUid);\n synchronized (mQuotaController.mLock) {\n assertTrue(mQuotaController.isWithinEJQuotaLocked(js));\n }\n advanceElapsedClock(10 * SECOND_IN_MILLIS);\n mTempAllowlistListener.onAppRemoved(mSourceUid);\n advanceElapsedClock(10 * SECOND_IN_MILLIS);\n // Still in grace period\n synchronized (mQuotaController.mLock) {\n assertTrue(mQuotaController.isWithinEJQuotaLocked(js));\n }\n advanceElapsedClock(6 * SECOND_IN_MILLIS);\n // Out of grace period.\n synchronized (mQuotaController.mLock) {\n assertFalse(mQuotaController.isWithinEJQuotaLocked(js));\n }\n }", "private void setMaxCacheMemSize(long maxSize) {\n\t\tif ( maxSize < 25 * 1024 ) {\n\t\t\tthrow new IllegalAccessError(\"Cache size must be at least 25 KB (\"+(25*1024)+\" bytes)\");\n\t\t}\n\t\tlog.info(\"setCacheSize(): New cache size: \"+maxSize+\" bytes.\");\n\t\tfinal boolean shrink = this.maxSize > maxSize;\n\t\tthis.maxSize = maxSize;\n\t\tif ( shrink ) {\n\t\t\tpurgeCache(true);\n\t\t}\n\t}", "@Test\r\n\tpublic void permutationsTestSize5() throws BoundedQueueException {\r\n\t\tbq.enqueue(1);\r\n\t\tbq.enqueue(2);\r\n\t\tbq.enqueue(3);\r\n\t\tbq.enqueue(4);\r\n\t\tbq.enqueue(5);\r\n\t\tbq.permutations();\r\n\t}", "@Test(timeout = 4000)\n public void test57() throws Throwable {\n ConnectionFactories connectionFactories0 = new ConnectionFactories();\n connectionFactories0.getXAQueueConnectionFactory();\n XATopicConnectionFactory xATopicConnectionFactory0 = new XATopicConnectionFactory();\n try { \n connectionFactories0.addXATopicConnectionFactory((-2351), xATopicConnectionFactory0);\n fail(\"Expecting exception: IndexOutOfBoundsException\");\n \n } catch(IndexOutOfBoundsException e) {\n //\n // Index: -2351, Size: 0\n //\n verifyException(\"java.util.ArrayList\", e);\n }\n }", "myQueue(int size){\n }", "@Test\n public void testMaxMessageLength() throws Exception {\n int maxMessageLength = 10;\n CountDownLatch latch = new CountDownLatch(1);\n EventStreamClosedClient eventListener = new EventStreamClosedClient(latch);\n\n try (EventStream streamEvents = new WebSocketEventStream(uri, new Token(\"token\"), 0, 0,\n maxMessageLength, eventListener)) {\n latch.await(30, TimeUnit.SECONDS);\n Assert.assertTrue(streamEvents.isEventStreamClosed());\n Assert.assertEquals(CloseCodes.TOO_BIG.getCode(),\n eventListener.closeCode);\n String message = \"Message length exceeded the configured maximum (\" +\n maxMessageLength + \" characters)\";\n Assert.assertEquals(message, eventListener.closePhrase);\n }\n }", "private void updateQueueSize() {\n\t\tsims.minQS = state.queueSize < sims.minQS ? state.queueSize : sims.minQS;\n\t\tsims.maxQS = state.queueSize > sims.maxQS ? state.queueSize : sims.maxQS;\n\t}", "FindEntriesCondition(long maxSize) {\n this.maxSize = maxSize;\n this.endTime = -1;\n }", "protected void testLessThanMaxLots () throws OutsideMaxLotsException\n {\n if (lots.size() >= MAX_LOTS)\n throw new OutsideMaxLotsException();\n }", "@Test(timeout = 4000)\n public void test69() throws Throwable {\n ConnectionFactories connectionFactories0 = new ConnectionFactories();\n XAQueueConnectionFactory xAQueueConnectionFactory0 = new XAQueueConnectionFactory();\n try { \n connectionFactories0.setXAQueueConnectionFactory(0, xAQueueConnectionFactory0);\n fail(\"Expecting exception: IndexOutOfBoundsException\");\n \n } catch(IndexOutOfBoundsException e) {\n //\n // Index: 0, Size: 0\n //\n verifyException(\"java.util.ArrayList\", e);\n }\n }", "@Test(expected = BoundedQueueException.class)\r\n\tpublic void permutationsTestSize6() throws BoundedQueueException {\r\n\t\tbq.enqueue(1);\r\n\t\tbq.enqueue(2);\r\n\t\tbq.enqueue(3);\r\n\t\tbq.enqueue(4);\r\n\t\tbq.enqueue(5);\r\n\t\tbq.enqueue(6);\r\n\t\tbq.permutations();\r\n\t}", "public void setMaxTextLength(int max) {\n/* 520 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "@Test\n public void testEJTracking_RollingQuota() {\n JobStatus jobStatus = createExpeditedJobStatus(\"testEJTracking_RollingQuota\", 1);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(jobStatus, null);\n }\n setStandbyBucket(WORKING_INDEX, jobStatus);\n setProcessState(ActivityManager.PROCESS_STATE_SERVICE);\n Handler handler = mQuotaController.getHandler();\n spyOn(handler);\n\n long now = JobSchedulerService.sElapsedRealtimeClock.millis();\n final long remainingTimeMs = SECOND_IN_MILLIS;\n // The package only has one second to run, but this session is at the edge of the rolling\n // window, so as the package \"reaches its quota\" it will have more to keep running.\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - mQcConstants.EJ_WINDOW_SIZE_MS,\n 10 * SECOND_IN_MILLIS - remainingTimeMs, 1), true);\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - HOUR_IN_MILLIS,\n mQcConstants.EJ_LIMIT_WORKING_MS - 10 * SECOND_IN_MILLIS, 1), true);\n\n synchronized (mQuotaController.mLock) {\n assertEquals(remainingTimeMs,\n mQuotaController.getRemainingEJExecutionTimeLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE));\n\n // Start the job.\n mQuotaController.prepareForExecutionLocked(jobStatus);\n }\n advanceElapsedClock(remainingTimeMs);\n\n // Wait for some extra time to allow for job processing.\n verify(mJobSchedulerService,\n timeout(remainingTimeMs + 2 * SECOND_IN_MILLIS).times(0))\n .onControllerStateChanged(argThat(jobs -> jobs.size() > 0));\n assertTrue(jobStatus.isExpeditedQuotaApproved());\n // The job used up the remaining quota, but in that time, the same amount of time in the\n // old TimingSession also fell out of the quota window, so it should still have the same\n // amount of remaining time left its quota.\n synchronized (mQuotaController.mLock) {\n assertEquals(remainingTimeMs,\n mQuotaController.getRemainingEJExecutionTimeLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE));\n }\n // Handler is told to check when the quota will be consumed, not when the initial\n // remaining time is over.\n verify(handler, atLeast(1)).sendMessageDelayed(\n argThat(msg -> msg.what == QuotaController.MSG_REACHED_EJ_QUOTA),\n eq(10 * SECOND_IN_MILLIS));\n verify(handler, never()).sendMessageDelayed(any(), eq(remainingTimeMs));\n }", "public void checkCapacity(String target, long size) throws Exception;", "@WithName(\"max.queue.size\")\n @WithDefault(\"2048\")\n Integer maxQueueSize();", "private void runTestMaybeScheduleStartAlarmLocked_SmallRollingQuota_AllowedTimeCheck() {\n spyOn(mQuotaController);\n doNothing().when(mQuotaController).maybeScheduleCleanupAlarmLocked();\n\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(\n createJobStatus(\"testMaybeScheduleStartAlarmLocked\", 1), null);\n }\n\n final long now = JobSchedulerService.sElapsedRealtimeClock.millis();\n // Working set window size is 2 hours.\n final int standbyBucket = WORKING_INDEX;\n final long contributionMs = mQcConstants.IN_QUOTA_BUFFER_MS / 2;\n final long remainingTimeMs =\n mQcConstants.ALLOWED_TIME_PER_PERIOD_WORKING_MS - contributionMs;\n\n // Session straddles edge of bucket window. Only the contribution should be counted towards\n // the quota.\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - (2 * HOUR_IN_MILLIS + 3 * MINUTE_IN_MILLIS),\n 3 * MINUTE_IN_MILLIS + contributionMs, 3), false);\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - HOUR_IN_MILLIS, remainingTimeMs, 2), false);\n // Expected alarm time should be when the app will have QUOTA_BUFFER_MS time of quota, which\n // is 2 hours + (QUOTA_BUFFER_MS - contributionMs) after the start of the second session.\n final long expectedAlarmTime = now - HOUR_IN_MILLIS + 2 * HOUR_IN_MILLIS\n + (mQcConstants.IN_QUOTA_BUFFER_MS - contributionMs);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeScheduleStartAlarmLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE, standbyBucket);\n }\n verify(mAlarmManager, timeout(1000).times(1)).setWindow(\n anyInt(), eq(expectedAlarmTime), anyLong(), eq(TAG_QUOTA_CHECK), any(), any());\n }", "public void setMaxFieldSize(int max) throws SQLException {\n\r\n }", "@Test\n public void testExceedsQuotaOnStartup() throws Exception {\n List<Dag<JobExecutionPlan>> dags = DagManagerTest.buildDagList(2, \"user\", ConfigFactory.empty());\n // Ensure that the current attempt is 1, normally done by DagManager\n dags.get(0).getNodes().get(0).getValue().setCurrentAttempts(1);\n dags.get(1).getNodes().get(0).getValue().setCurrentAttempts(1);\n\n // Should not be throwing the exception\n this._quotaManager.init(dags);\n }", "public void setMaxBufferSize(int value) {\n this.maxBufferSize = value;\n }", "public abstract long getMaxSize();", "public void testTimedOffer() {\n final SynchronousQueue q = new SynchronousQueue();\n Thread t = new Thread(new Runnable() {\n public void run() {\n try {\n\n threadAssertFalse(q.offer(new Object(), SHORT_DELAY_MS, TimeUnit.MILLISECONDS));\n q.offer(new Object(), LONG_DELAY_MS, TimeUnit.MILLISECONDS);\n\t\t\tthreadShouldThrow();\n } catch (InterruptedException success){}\n }\n });\n\n try {\n t.start();\n Thread.sleep(SMALL_DELAY_MS);\n t.interrupt();\n t.join();\n } catch (Exception e){\n unexpectedException();\n }\n }", "@Test(timeout = 4000)\n public void test11() throws Throwable {\n ConnectionFactories connectionFactories0 = new ConnectionFactories();\n try { \n connectionFactories0.getQueueConnectionFactory(0);\n fail(\"Expecting exception: IndexOutOfBoundsException\");\n \n } catch(IndexOutOfBoundsException e) {\n //\n // Index: 0, Size: 0\n //\n verifyException(\"java.util.ArrayList\", e);\n }\n }", "public void setSize(int size) {\n\t\tif (size < 0) {\n\t\t throw new IllegalArgumentException(\"Log cache size can't be negative\");\n\t\t}\n\t\tint delta = this.size - size;\n\t\tthis.size = size;\n\t\tif (delta <= 0) {\n\t\t return;\n\t\t}\n\t\tif (messages.size() < size) {\n\t\t return;\n\t\t}\n\t\twhile (delta-- > 0) {\n\t\t messages.removeFirst();\n\t\t}\n\t}", "public void requestEviction(int cMaximum);", "@Test(expected = IllegalArgumentException.class)\n public void testQueueParsingFailWhenSumOfChildrenNonLabeledCapacityNot100Percent() throws IOException {\n nodeLabelManager.addToCluserNodeLabelsWithDefaultExclusivity(ImmutableSet.of(\"red\", \"blue\"));\n YarnConfiguration conf = new YarnConfiguration();\n CapacitySchedulerConfiguration csConf = new CapacitySchedulerConfiguration(conf);\n setupQueueConfiguration(csConf);\n csConf.setCapacity(((ROOT) + \".c.c2\"), 5);\n CapacityScheduler capacityScheduler = new CapacityScheduler();\n RMContextImpl rmContext = new RMContextImpl(null, null, null, null, null, null, new org.apache.hadoop.yarn.server.resourcemanager.security.RMContainerTokenSecretManager(csConf), new org.apache.hadoop.yarn.server.resourcemanager.security.NMTokenSecretManagerInRM(csConf), new ClientToAMTokenSecretManagerInRM(), null);\n rmContext.setNodeLabelManager(nodeLabelManager);\n capacityScheduler.setConf(csConf);\n capacityScheduler.setRMContext(rmContext);\n capacityScheduler.init(csConf);\n capacityScheduler.start();\n ServiceOperations.stopQuietly(capacityScheduler);\n }", "@Test\n public void testTracking_RollingQuota() {\n JobStatus jobStatus = createJobStatus(\"testTracking_OutOfQuota\", 1);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(jobStatus, null);\n }\n setStandbyBucket(WORKING_INDEX, jobStatus); // 2 hour window\n setProcessState(ActivityManager.PROCESS_STATE_SERVICE);\n Handler handler = mQuotaController.getHandler();\n spyOn(handler);\n\n long now = JobSchedulerService.sElapsedRealtimeClock.millis();\n final long remainingTimeMs = SECOND_IN_MILLIS;\n // The package only has one second to run, but this session is at the edge of the rolling\n // window, so as the package \"reaches its quota\" it will have more to keep running.\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - 2 * HOUR_IN_MILLIS,\n 10 * SECOND_IN_MILLIS - remainingTimeMs, 1), false);\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - HOUR_IN_MILLIS,\n 9 * MINUTE_IN_MILLIS + 50 * SECOND_IN_MILLIS, 1), false);\n\n synchronized (mQuotaController.mLock) {\n assertEquals(remainingTimeMs,\n mQuotaController.getRemainingExecutionTimeLocked(jobStatus));\n\n // Start the job.\n mQuotaController.prepareForExecutionLocked(jobStatus);\n }\n advanceElapsedClock(remainingTimeMs);\n\n // Wait for some extra time to allow for job processing.\n verify(mJobSchedulerService,\n timeout(remainingTimeMs + 2 * SECOND_IN_MILLIS).times(0))\n .onControllerStateChanged(argThat(jobs -> jobs.size() > 0));\n assertTrue(jobStatus.isConstraintSatisfied(JobStatus.CONSTRAINT_WITHIN_QUOTA));\n // The job used up the remaining quota, but in that time, the same amount of time in the\n // old TimingSession also fell out of the quota window, so it should still have the same\n // amount of remaining time left its quota.\n synchronized (mQuotaController.mLock) {\n assertEquals(remainingTimeMs,\n mQuotaController.getRemainingExecutionTimeLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE));\n }\n // Handler is told to check when the quota will be consumed, not when the initial\n // remaining time is over.\n verify(handler, atLeast(1)).sendMessageDelayed(\n argThat(msg -> msg.what == QuotaController.MSG_REACHED_QUOTA),\n eq(10 * SECOND_IN_MILLIS));\n verify(handler, never()).sendMessageDelayed(any(), eq(remainingTimeMs));\n\n // After 10 seconds, the job should finally be out of quota.\n advanceElapsedClock(10 * SECOND_IN_MILLIS - remainingTimeMs);\n // Wait for some extra time to allow for job processing.\n verify(mJobSchedulerService,\n timeout(12 * SECOND_IN_MILLIS).times(1))\n .onControllerStateChanged(argThat(jobs -> jobs.size() == 1));\n assertFalse(jobStatus.isConstraintSatisfied(JobStatus.CONSTRAINT_WITHIN_QUOTA));\n verify(handler, never()).sendMessageDelayed(any(), anyInt());\n }", "public void testFairTimedPollWithOffer() {\n final SynchronousQueue q = new SynchronousQueue(true);\n Thread t = new Thread(new Runnable() {\n public void run() {\n try {\n threadAssertNull(q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS));\n q.poll(LONG_DELAY_MS, TimeUnit.MILLISECONDS);\n q.poll(LONG_DELAY_MS, TimeUnit.MILLISECONDS);\n\t\t\tthreadShouldThrow();\n } catch (InterruptedException success) { }\n }\n });\n try {\n t.start();\n Thread.sleep(SMALL_DELAY_MS);\n assertTrue(q.offer(zero, SHORT_DELAY_MS, TimeUnit.MILLISECONDS));\n t.interrupt();\n t.join();\n } catch (Exception e){\n unexpectedException();\n }\n }", "@java.lang.Override\n public long getMaxEnvelopeQueueSize() {\n return maxEnvelopeQueueSize_;\n }", "public void testDrainToWithActivePut() {\n final SynchronousQueue q = new SynchronousQueue();\n Thread t = new Thread(new Runnable() {\n public void run() {\n try {\n q.put(new Integer(1));\n } catch (InterruptedException ie){\n threadUnexpectedException();\n }\n }\n });\n try {\n t.start();\n ArrayList l = new ArrayList();\n Thread.sleep(SHORT_DELAY_MS);\n q.drainTo(l);\n assertTrue(l.size() <= 1);\n if (l.size() > 0)\n assertEquals(l.get(0), new Integer(1));\n t.join();\n assertTrue(l.size() <= 1);\n } catch(Exception e){\n unexpectedException();\n }\n }", "public void verifyOutstandingPathQLimit() throws IOException {\n long size = pathsToBeTraversed.size();\n // Checking that the SPS call Q exceeds the allowed limit.\n if (outstandingPathsLimit - size <= 0) {\n LOG.debug(\"Satisifer Q - outstanding limit:{}, current size:{}\",\n outstandingPathsLimit, size);\n throw new IOException(\"Outstanding satisfier queue limit: \"\n + outstandingPathsLimit + \" exceeded, try later!\");\n }\n }", "@Override\n public int getMaxJobsPerAcquisition() {\n return myMaxJobsPerAcquisition;\n }", "public void setMaxSize(int size) {\n if (initialized)\n throw new IllegalStateException(INITIALIZED);\n maxSize = size;\n if (maxSize != 0 && minSize > maxSize) {\n minSize = maxSize;\n log.warn(\"pool min size set to \" + minSize + \" to stay <= max size\");\n }\n }", "public void test_4() throws Exception {\n\t\tBoundedSharedQueue theBSQ = new BoundedSharedQueue(MAX_CAPACITY);\n\n\t\ttry {\n\t\t\ttheBSQ.add(null); // null is not an accepted value\n\t\t\tfail(\"should throw an IllegalArgumentException\");\n\t\t}\n\t\tcatch(IllegalArgumentException ex) {\n\t\t\t// OK\n\t\t}\n\t}", "@Test(expected=IndexOutOfBoundsException.class)\n\tpublic void testSettingTheLargeValue()\n\t{\n\t\tData d = new Data();\n\t\t\n\t\td.set(100, 10); //the index is 100, way more than the number of pieces\n\t}", "@Test\n public void testStartAlarmScheduled_JobCount_RateLimitingWindow() {\n // saveTimingSession calls maybeScheduleCleanupAlarmLocked which interferes with these tests\n // because it schedules an alarm too. Prevent it from doing so.\n spyOn(mQuotaController);\n doNothing().when(mQuotaController).maybeScheduleCleanupAlarmLocked();\n\n // Essentially disable session throttling.\n setDeviceConfigInt(QcConstants.KEY_MAX_SESSION_COUNT_WORKING, Integer.MAX_VALUE);\n setDeviceConfigInt(QcConstants.KEY_MAX_SESSION_COUNT_PER_RATE_LIMITING_WINDOW,\n Integer.MAX_VALUE);\n\n final int standbyBucket = WORKING_INDEX;\n setProcessState(ActivityManager.PROCESS_STATE_IMPORTANT_BACKGROUND);\n\n // No sessions saved yet.\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeScheduleStartAlarmLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE, standbyBucket);\n }\n verify(mAlarmManager, timeout(1000).times(0)).setWindow(\n anyInt(), anyLong(), anyLong(), eq(TAG_QUOTA_CHECK), any(), any());\n\n // Ran jobs up to the job limit. All of them should be allowed to run.\n for (int i = 0; i < mQcConstants.MAX_JOB_COUNT_PER_RATE_LIMITING_WINDOW; ++i) {\n JobStatus job = createJobStatus(\"testStartAlarmScheduled_JobCount_AllowedTime\", i);\n setStandbyBucket(WORKING_INDEX, job);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(job, null);\n assertTrue(job.isConstraintSatisfied(JobStatus.CONSTRAINT_WITHIN_QUOTA));\n mQuotaController.prepareForExecutionLocked(job);\n }\n advanceElapsedClock(SECOND_IN_MILLIS);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStopTrackingJobLocked(job, null, false);\n }\n advanceElapsedClock(SECOND_IN_MILLIS);\n }\n // Start alarm shouldn't have been scheduled since the app was in quota up until this point.\n verify(mAlarmManager, timeout(1000).times(0)).setWindow(\n anyInt(), anyLong(), anyLong(), eq(TAG_QUOTA_CHECK), any(), any());\n\n // The app is now out of job count quota\n JobStatus throttledJob = createJobStatus(\n \"testStartAlarmScheduled_JobCount_AllowedTime\", 42);\n setStandbyBucket(WORKING_INDEX, throttledJob);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(throttledJob, null);\n }\n assertFalse(throttledJob.isConstraintSatisfied(JobStatus.CONSTRAINT_WITHIN_QUOTA));\n\n ExecutionStats stats;\n synchronized (mQuotaController.mLock) {\n stats = mQuotaController.getExecutionStatsLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE, standbyBucket);\n }\n final long expectedWorkingAlarmTime = stats.jobRateLimitExpirationTimeElapsed;\n verify(mAlarmManager, timeout(1000).times(1)).setWindow(\n anyInt(), eq(expectedWorkingAlarmTime), anyLong(),\n eq(TAG_QUOTA_CHECK), any(), any());\n }", "public void test_2() throws Exception {\n\t\tBoundedSharedQueue theBSQ = new BoundedSharedQueue(MAX_CAPACITY);\n\n\t\tassertEquals(MAX_CAPACITY, theBSQ.capacity());\n\t\tassertTrue(theBSQ.isEmpty());\n\t\tassertTrue(!theBSQ.isFull());\n\n\t\tfor(int i = 0; i < theBSQ.capacity(); ++i) {\n\t\t\tassertEquals(i, theBSQ.size());\n\t\t\ttheBSQ.add(new Integer(i));\n\t\t}\n\n\t\t// clear the queue\n\t\ttheBSQ.clear();\n\n\t\tcheckEmptyness(theBSQ);\n\t}", "@Override\n public void ensureCapacity(int index) {\n\n }", "public void setMaxCapacity(int max) {\n\t\tbuffer = new Object[max];\n\t\tbufferSize = 0;\n\t}", "@Test\n public void cantAddMoreThanCapacity(){\n for (int i = 0; i<12; i++){\n library.addBook(book);\n }\n assertEquals(10, library.bookCount());\n }", "public ArrayQueue() {\n\t\tthis(Integer.MAX_VALUE);\n\t}", "public native void setDefaultEnqueueTimeout (long enqueueTimeout) throws IOException,IllegalArgumentException;", "public void testTimedPollWithOffer() {\n final SynchronousQueue q = new SynchronousQueue();\n Thread t = new Thread(new Runnable() {\n public void run() {\n try {\n threadAssertNull(q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS));\n q.poll(LONG_DELAY_MS, TimeUnit.MILLISECONDS);\n q.poll(LONG_DELAY_MS, TimeUnit.MILLISECONDS);\n\t\t\tthreadShouldThrow();\n } catch (InterruptedException success) { }\n }\n });\n try {\n t.start();\n Thread.sleep(SMALL_DELAY_MS);\n assertTrue(q.offer(zero, SHORT_DELAY_MS, TimeUnit.MILLISECONDS));\n t.interrupt();\n t.join();\n } catch (Exception e){\n unexpectedException();\n }\n }", "int getQueueSize();" ]
[ "0.65991145", "0.65122545", "0.64931136", "0.64005196", "0.6302009", "0.6280919", "0.5996313", "0.59666634", "0.58924556", "0.5823115", "0.5820635", "0.5787166", "0.5761012", "0.5748183", "0.5745549", "0.57410055", "0.5716088", "0.57092386", "0.57081765", "0.570437", "0.56982636", "0.56768537", "0.5668711", "0.56556916", "0.5649522", "0.5648191", "0.56454635", "0.5645074", "0.5639418", "0.5633069", "0.5632401", "0.5615987", "0.56081235", "0.55947655", "0.559165", "0.55699855", "0.5563128", "0.55564994", "0.55467534", "0.5538274", "0.5532204", "0.5523597", "0.5519418", "0.5514222", "0.55093396", "0.55011725", "0.55001247", "0.54974145", "0.54901844", "0.5475157", "0.5474386", "0.5472747", "0.5464115", "0.5427127", "0.5424054", "0.54233044", "0.54189384", "0.5418865", "0.54150903", "0.541417", "0.5403323", "0.5394382", "0.5386824", "0.5384677", "0.5372724", "0.53637135", "0.5357774", "0.53565204", "0.53540576", "0.53511673", "0.5342787", "0.53416055", "0.5341327", "0.5336003", "0.533537", "0.53350794", "0.5330969", "0.53304577", "0.53195643", "0.53067803", "0.53049886", "0.5300469", "0.5298964", "0.5295664", "0.52943563", "0.5281347", "0.52781105", "0.5277898", "0.5273215", "0.52680176", "0.5267372", "0.52672595", "0.52649266", "0.525273", "0.52463067", "0.52401096", "0.5238965", "0.5233486", "0.5230032", "0.5219951" ]
0.7568555
0
Test that, if the remote node gets unsynchronized (eg some edits were missed or the node rebooted), the client stops sending edits until the next roll. Test for HDFS3726.
@Test public void testStopSendingEditsWhenOutOfSync() throws Exception { Mockito.doThrow(new IOException("injected error")) .when(mockProxy).journal( Mockito.<RequestInfo>any(), Mockito.eq(1L), Mockito.eq(1L), Mockito.eq(1), Mockito.same(FAKE_DATA)); try { ch.sendEdits(1L, 1L, 1, FAKE_DATA).get(); fail("Injected JOOSE did not cause sendEdits() to throw"); } catch (ExecutionException ee) { GenericTestUtils.assertExceptionContains("injected", ee); } Mockito.verify(mockProxy).journal( Mockito.<RequestInfo>any(), Mockito.eq(1L), Mockito.eq(1L), Mockito.eq(1), Mockito.same(FAKE_DATA)); assertTrue(ch.isOutOfSync()); try { ch.sendEdits(1L, 2L, 1, FAKE_DATA).get(); fail("sendEdits() should throw until next roll"); } catch (ExecutionException ee) { GenericTestUtils.assertExceptionContains("disabled until next roll", ee.getCause()); } // It should have failed without even sending the edits, since it was not sync. Mockito.verify(mockProxy, Mockito.never()).journal( Mockito.<RequestInfo>any(), Mockito.eq(1L), Mockito.eq(2L), Mockito.eq(1), Mockito.same(FAKE_DATA)); // It should have sent a heartbeat instead. Mockito.verify(mockProxy).heartbeat( Mockito.<RequestInfo>any()); // After a roll, sending new edits should not fail. ch.startLogSegment(3L, NameNodeLayoutVersion.CURRENT_LAYOUT_VERSION).get(); assertFalse(ch.isOutOfSync()); ch.sendEdits(3L, 3L, 1, FAKE_DATA).get(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n\tpublic void testServerReplicaLeavingDuringWrite() throws Exception {\n\t\tfinal KeyValueServer server = new KeyValueServer();\n\t\tArrayList<String> files = populateServer(server);\n\t\tfinal long TIMEOUT = 100;\n\t\tthis.err = false;\n\t\t//We can make a fake client that blocks in its write then make sure that another client can't get through at the same time\n\t\t// KeyValueClient slowWriter = mock(KeyValueClient.class);\n\n\t\tAtomicInteger startedWrites = new AtomicInteger();\n\t\tAtomicInteger completedWrites = new AtomicInteger();\n\t\tFirstGuyLeavesWhileWritingClient slowWriter1 = new FirstGuyLeavesWhileWritingClient(server, startedWrites, 90490, completedWrites);\n\t\tFirstGuyLeavesWhileWritingClient slowWriter2 = new FirstGuyLeavesWhileWritingClient(server, startedWrites, 90492, completedWrites);\n\t\tserver.registerClient(\"fake client\", 90040, slowWriter1);\n\t\tserver.registerClient(\"fake client\", 90041, slowWriter2);\n\t\tThread writerThread = new Thread(new Runnable() {\n\t\t\tpublic void run() {\n\t\t\t\ttry {\n\t\t\t\t\tserver.set(files.get(0).toString(), \"garbage\");\n\t\t\t} catch (Throwable e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t\terr = true;\n\t\t\t\t}\n\t\t}});\n\t\twriterThread.start();\n\t\twriterThread.join();\n\t\tserver.cacheDisconnect(\"fake client\", 90040);\n\t\tserver.cacheDisconnect(\"fake client\", 90041);\n\t\tassertFalse(\"Expected that client could not disconnect until after pending write completed\", err);\n\t}", "@Test\n public void testWhenDecreasingReplication() throws Exception {\n Configuration conf = new HdfsConfiguration();\n conf.setLong(DFSConfigKeys.DFS_BLOCKREPORT_INTERVAL_MSEC_KEY, 1000L);\n conf.set(DFSConfigKeys.DFS_NAMENODE_RECONSTRUCTION_PENDING_TIMEOUT_SEC_KEY, Integer.toString(2));\n MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(3).build();\n FileSystem fs = cluster.getFileSystem();\n final FSNamesystem namesystem = cluster.getNamesystem();\n\n try {\n final Path fileName = new Path(\"/foo1\");\n DFSTestUtil.createFile(fs, fileName, 2, (short) 3, 0L);\n DFSTestUtil.waitReplication(fs, fileName, (short) 3);\n\n ExtendedBlock block = DFSTestUtil.getFirstBlock(fs, fileName);\n corruptBlock(cluster, fs, fileName, 0, block);\n\n DFSTestUtil.waitReplication(fs, fileName, (short) 2);\n\n assertEquals(2, countReplicas(namesystem, block).liveReplicas());\n assertEquals(1, countReplicas(namesystem, block).corruptReplicas());\n\n namesystem.setReplication(fileName.toString(), (short) 2);\n\n // wait for 3 seconds so that all block reports are processed.\n try {\n Thread.sleep(3000);\n } catch (InterruptedException ignored) {\n }\n\n assertEquals(2, countReplicas(namesystem, block).liveReplicas());\n assertEquals(0, countReplicas(namesystem, block).corruptReplicas());\n\n } finally {\n cluster.shutdown();\n }\n }", "@Test\n public void testWithAllCorruptReplicas() throws Exception {\n Configuration conf = new HdfsConfiguration();\n conf.setLong(DFSConfigKeys.DFS_BLOCKREPORT_INTERVAL_MSEC_KEY, 1000L);\n conf.set(DFSConfigKeys.DFS_NAMENODE_RECONSTRUCTION_PENDING_TIMEOUT_SEC_KEY, Integer.toString(2));\n MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(3).build();\n FileSystem fs = cluster.getFileSystem();\n final FSNamesystem namesystem = cluster.getNamesystem();\n\n try {\n final Path fileName = new Path(\"/foo1\");\n DFSTestUtil.createFile(fs, fileName, 2, (short) 3, 0L);\n DFSTestUtil.waitReplication(fs, fileName, (short) 3);\n\n ExtendedBlock block = DFSTestUtil.getFirstBlock(fs, fileName);\n corruptBlock(cluster, fs, fileName, 0, block);\n\n corruptBlock(cluster, fs, fileName, 1, block);\n\n corruptBlock(cluster, fs, fileName, 2, block);\n\n // wait for 3 seconds so that all block reports are processed.\n try {\n Thread.sleep(3000);\n } catch (InterruptedException ignored) {\n }\n\n assertEquals(0, countReplicas(namesystem, block).liveReplicas());\n assertEquals(3, countReplicas(namesystem, block).corruptReplicas());\n\n namesystem.setReplication(fileName.toString(), (short) 1);\n\n // wait for 3 seconds so that all block reports are processed.\n try {\n Thread.sleep(3000);\n } catch (InterruptedException ignored) {\n }\n\n assertEquals(0, countReplicas(namesystem, block).liveReplicas());\n assertEquals(3, countReplicas(namesystem, block).corruptReplicas());\n\n } finally {\n cluster.shutdown();\n }\n }", "@Test(timeout = 30000)\n public void testDnRestartWithHardLinkInTmp() {\n MiniDFSCluster cluster = null;\n try {\n conf.setBoolean(DFSConfigKeys\n .DFS_DATANODE_ALLOW_SAME_DISK_TIERING, true);\n conf.setDouble(DFSConfigKeys\n .DFS_DATANODE_RESERVE_FOR_ARCHIVE_DEFAULT_PERCENTAGE, 0.5);\n cluster = new MiniDFSCluster.Builder(conf)\n .numDataNodes(1)\n .storageTypes(\n new StorageType[]{StorageType.DISK, StorageType.ARCHIVE})\n .storagesPerDatanode(2)\n .build();\n FileSystem fs = cluster.getFileSystem();\n DataNode dataNode = cluster.getDataNodes().get(0);\n\n Path filePath = new Path(name.getMethodName());\n long fileLen = 100;\n\n ExtendedBlock block = createTestFile(fs, fileLen, filePath);\n\n FsDatasetImpl fsDataSetImpl = (FsDatasetImpl) dataNode.getFSDataset();\n\n ReplicaInfo oldReplicaInfo = fsDataSetImpl.getReplicaInfo(block);\n ReplicaInfo newReplicaInfo =\n createNewReplicaObjWithLink(block, fsDataSetImpl);\n\n // Link exists\n assertTrue(Files.exists(Paths.get(newReplicaInfo.getBlockURI())));\n\n cluster.restartDataNode(0);\n cluster.waitDatanodeFullyStarted(cluster.getDataNodes().get(0), 60000);\n cluster.triggerBlockReports();\n\n // Un-finalized replica data (hard link) is deleted as they were in /tmp\n assertFalse(Files.exists(Paths.get(newReplicaInfo.getBlockURI())));\n\n // Old block is there.\n assertTrue(Files.exists(Paths.get(oldReplicaInfo.getBlockURI())));\n\n validateFileLen(fs, fileLen, filePath);\n\n } catch (Exception ex) {\n LOG.info(\"Exception in testDnRestartWithHardLinkInTmp \", ex);\n fail(\"Exception while testing testDnRestartWithHardLinkInTmp \");\n } finally {\n if (cluster.isClusterUp()) {\n cluster.shutdown();\n }\n }\n }", "@Test\n public void testRelinquishRole()\n throws IOException, InterruptedException, CloneNotSupportedException {\n LightWeightNameNode hdfs1 =\n new LightWeightNameNode(new HdfsLeDescriptorFactory(),\n DFS_LEADER_CHECK_INTERVAL_IN_MS, DFS_LEADER_MISSED_HB_THRESHOLD,\n TIME_PERIOD_INCREMENT, HTTP_ADDRESS, RPC_ADDRESS);\n nnList.add(hdfs1);\n LightWeightNameNode hdfs2 =\n new LightWeightNameNode(new HdfsLeDescriptorFactory(),\n DFS_LEADER_CHECK_INTERVAL_IN_MS, DFS_LEADER_MISSED_HB_THRESHOLD,\n TIME_PERIOD_INCREMENT, HTTP_ADDRESS, RPC_ADDRESS);\n nnList.add(hdfs2);\n\n hdfs1.getLeaderElectionInstance().waitActive();\n hdfs2.getLeaderElectionInstance().waitActive();\n long hdfs1Id = hdfs1.getLeCurrentId();\n long hdfs2Id = hdfs2.getLeCurrentId();\n assertTrue(\"Leader Check Failed \", hdfs1.isLeader() == true);\n assertTrue(\"Leader Check Failed \", hdfs2.isLeader() == false);\n\n\n // relinquish role\n hdfs1.getLeaderElectionInstance().relinquishCurrentIdInNextRound();\n assertTrue(\"Leader Check Failed \", hdfs1.isLeader() == false);\n Thread.sleep(\n DFS_LEADER_CHECK_INTERVAL_IN_MS * (DFS_LEADER_MISSED_HB_THRESHOLD + 1));\n long hdfs1IdNew = hdfs1.getLeCurrentId();\n long hdfs2IdNew = hdfs2.getLeCurrentId();\n assertTrue(\"Leader Check Failed \", hdfs1.isLeader() == false);\n assertTrue(\"Leader Check Failed \", hdfs2.isLeader() == true);\n\n assertTrue(\"ID Check Failed \", hdfs1Id != hdfs1IdNew);\n assertTrue(\"ID Check Failed \", hdfs2Id == hdfs2IdNew);\n\n\n }", "@Test\n public void testFileReadLatestVersion() throws Exception {\n final Coordinator coordinator = new Coordinator(2, 2, 100000);\n try {\n Thread thread = new Thread(new Runnable() {\n @Override\n public void run() {\n coordinator.startCoordinatorService();\n }\n });\n thread.start();\n Thread.sleep(1000);\n\n // server 1\n final int port = Utilities.getRandomPort();\n Thread thread2 = new Thread(new Runnable() {\n @Override\n public void run() {\n FileServer fileServer = new FileServer(\"localhost\");\n fileServer.startService(\"localhost\", port, \"localhost\");\n }\n });\n thread2.start();\n Thread.sleep(1000);\n\n TTransport nodeSocket = new TSocket(\"localhost\", port);\n nodeSocket.open();\n TProtocol protocol = new TBinaryProtocol(nodeSocket);\n FileServerEndPoints.Client client = new FileServerEndPoints.Client(protocol);\n\n // server 2\n final int port2 = Utilities.getRandomPort();\n Thread thread3 = new Thread(new Runnable() {\n @Override\n public void run() {\n FileServer fileServer = new FileServer(\"localhost\");\n fileServer.startService(\"localhost\", port2, \"localhost\");\n }\n });\n thread3.start();\n Thread.sleep(1000);\n\n WriteResponse writeResponse = client.write(\"foo.txt\", \"bar\");\n assertEquals(Status.SUCCESS, writeResponse.getStatus());\n assertEquals(0, writeResponse.getVersion());\n assertEquals(3, writeResponse.getBytesWritten());\n\n writeResponse = client.write(\"foo.txt\", \"bar1\");\n assertEquals(Status.SUCCESS, writeResponse.getStatus());\n assertEquals(1, writeResponse.getVersion());\n assertEquals(4, writeResponse.getBytesWritten());\n\n writeResponse = client.write(\"foo.txt\", \"bar11\");\n assertEquals(Status.SUCCESS, writeResponse.getStatus());\n assertEquals(2, writeResponse.getVersion());\n assertEquals(5, writeResponse.getBytesWritten());\n\n // clients should see latest version\n ReadResponse readResponse = client.read(\"foo.txt\");\n assertEquals(Status.SUCCESS, readResponse.getStatus());\n assertEquals(\"bar11\", readResponse.getContents());\n assertEquals(2, readResponse.getVersion());\n } finally {\n // to make sure 9090 port is closed before next test run\n coordinator.stopCoordinatorService();\n }\n }", "@MediumTest\n public void testRemountOk() throws Exception {\n MountPoint mp = MountPointHelper.getMountPointFromDirectory(getConsole(), MOUNT_POINT_DIR);\n boolean rw = MountPointHelper.isReadWrite(mp);\n boolean ret = CommandHelper.remount(getContext(), mp, !rw, getConsole());\n MountPoint mp2 = MountPointHelper.getMountPointFromDirectory(getConsole(), MOUNT_POINT_DIR);\n boolean rw2 = MountPointHelper.isReadWrite(mp2);\n\n assertTrue(\"response==false\", ret); //$NON-NLS-1$\n assertTrue(\n String.format(\"remount failed: expected: %s, obtain: %s\", //$NON-NLS-1$\n rw ? \"rw\" : \"ro\", //$NON-NLS-1$ //$NON-NLS-2$\n rw2 ? \"rw \" : \"ro\"), //$NON-NLS-1$ //$NON-NLS-2$\n rw != rw2);\n }", "@Test(timeout = 30000)\n public void testDnRestartWithHardLink() throws Exception {\n MiniDFSCluster cluster = null;\n boolean isReplicaDeletionEnabled =\n conf.getBoolean(DFSConfigKeys.DFS_DATANODE_DUPLICATE_REPLICA_DELETION,\n DFSConfigKeys.DFS_DATANODE_DUPLICATE_REPLICA_DELETION_DEFAULT);\n try {\n conf.setBoolean(DFSConfigKeys\n .DFS_DATANODE_ALLOW_SAME_DISK_TIERING, true);\n conf.setDouble(DFSConfigKeys\n .DFS_DATANODE_RESERVE_FOR_ARCHIVE_DEFAULT_PERCENTAGE, 0.5);\n // Since Datanode restart in the middle of block movement may leave\n // uncleaned hardlink, disabling this config (i.e. deletion of duplicate\n // replica) will prevent this edge-case from happening.\n // We also re-enable deletion of duplicate replica just before starting\n // Dir Scanner using setDeleteDuplicateReplicasForTests (HDFS-16213).\n conf.setBoolean(DFSConfigKeys.DFS_DATANODE_DUPLICATE_REPLICA_DELETION,\n false);\n cluster = new MiniDFSCluster.Builder(conf)\n .numDataNodes(1)\n .storageTypes(\n new StorageType[]{StorageType.DISK, StorageType.ARCHIVE})\n .storagesPerDatanode(2)\n .build();\n cluster.waitActive();\n FileSystem fs = cluster.getFileSystem();\n DataNode dataNode = cluster.getDataNodes().get(0);\n\n Path filePath = new Path(name.getMethodName());\n long fileLen = 100;\n\n ExtendedBlock block = createTestFile(fs, fileLen, filePath);\n\n FsDatasetImpl fsDataSetImpl = (FsDatasetImpl) dataNode.getFSDataset();\n\n final ReplicaInfo oldReplicaInfo = fsDataSetImpl.getReplicaInfo(block);\n StorageType oldStorageType = oldReplicaInfo.getVolume().getStorageType();\n\n fsDataSetImpl.finalizeNewReplica(\n createNewReplicaObjWithLink(block, fsDataSetImpl), block);\n\n ReplicaInfo newReplicaInfo = fsDataSetImpl.getReplicaInfo(block);\n StorageType newStorageType = newReplicaInfo.getVolume().getStorageType();\n assertEquals(StorageType.DISK, oldStorageType);\n assertEquals(StorageType.ARCHIVE, newStorageType);\n\n cluster.restartDataNode(0);\n cluster.waitDatanodeFullyStarted(cluster.getDataNodes().get(0), 60000);\n cluster.triggerBlockReports();\n\n assertTrue(Files.exists(Paths.get(newReplicaInfo.getBlockURI())));\n assertTrue(Files.exists(Paths.get(oldReplicaInfo.getBlockURI())));\n\n // Before starting Dir Scanner, we should enable deleteDuplicateReplicas.\n FsDatasetSpi<?> fsDataset = cluster.getDataNodes().get(0).getFSDataset();\n DirectoryScanner scanner = new DirectoryScanner(fsDataset, conf);\n FsVolumeImpl fsVolume =\n (FsVolumeImpl) fsDataset.getFsVolumeReferences().get(0);\n fsVolume.getBlockPoolSlice(fsVolume.getBlockPoolList()[0])\n .setDeleteDuplicateReplicasForTests(true);\n scanner.start();\n scanner.run();\n\n GenericTestUtils.waitFor(\n () -> !Files.exists(Paths.get(oldReplicaInfo.getBlockURI())),\n 100, 10000, \"Old replica is not deleted by DirScanner even after \"\n + \"10s of waiting has elapsed\");\n assertTrue(Files.exists(Paths.get(newReplicaInfo.getBlockURI())));\n\n validateFileLen(fs, fileLen, filePath);\n\n // Additional tests to ensure latest replica gets deleted after file\n // deletion.\n fs.delete(filePath, false);\n GenericTestUtils.waitFor(\n () -> !Files.exists(Paths.get(newReplicaInfo.getBlockURI())),\n 100, 10000);\n } finally {\n conf.setBoolean(DFSConfigKeys.DFS_DATANODE_DUPLICATE_REPLICA_DELETION,\n isReplicaDeletionEnabled);\n if (cluster != null && cluster.isClusterUp()) {\n cluster.shutdown(true, true);\n }\n }\n }", "@Test(timeout = 30000)\n public void testMoveBlockFailure() {\n // Test copy\n testMoveBlockFailure(conf);\n // Test hardlink\n conf.setBoolean(DFSConfigKeys\n .DFS_DATANODE_ALLOW_SAME_DISK_TIERING, true);\n conf.setDouble(DFSConfigKeys\n .DFS_DATANODE_RESERVE_FOR_ARCHIVE_DEFAULT_PERCENTAGE, 0.5);\n testMoveBlockFailure(conf);\n }", "private void checkSyncFlags(GridIoMessage msg) {\n if (!(ClientAbstractMultiNodeSelfTest.commSpiEnabled))\n return;\n\n Object o = msg.message();\n if (!(o instanceof GridDistributedLockRequest))\n return;\n\n IgniteKernal g = ((IgniteKernal) (G.ignite(ignite.configuration().getNodeId())));\n GridCacheContext<Object, Object> cacheCtx = g.internalCache(ClientAbstractMultiNodeSelfTest.REPLICATED_ASYNC_CACHE_NAME).context();\n IgniteTxManager tm = cacheCtx.tm();\n GridCacheVersion v = version();\n IgniteInternalTx t = tm.tx(v);\n if (t.hasWriteKey(cacheCtx.txKey(cacheCtx.toCacheKeyObject(\"x1\"))))\n assertEquals((\"Invalid tx flags: \" + t), CacheWriteSynchronizationMode.FULL_ASYNC, syncMode());\n else\n if (t.hasWriteKey(cacheCtx.txKey(cacheCtx.toCacheKeyObject(\"x2\"))))\n assertEquals((\"Invalid tx flags: \" + t), CacheWriteSynchronizationMode.FULL_SYNC, syncMode());\n else\n if (t.hasWriteKey(cacheCtx.txKey(cacheCtx.toCacheKeyObject(\"x3\"))))\n assertEquals((\"Invalid tx flags: \" + t), CacheWriteSynchronizationMode.FULL_ASYNC, syncMode());\n else\n if (t.hasWriteKey(cacheCtx.txKey(cacheCtx.toCacheKeyObject(\"x4\"))))\n assertEquals((\"Invalid tx flags: \" + t), CacheWriteSynchronizationMode.FULL_SYNC, syncMode());\n\n\n\n\n }", "@Test (timeout=180000)\n public void testNotInHdfsWithReplicas() throws Exception {\n TableName table =\n TableName.valueOf(\"tableNotInHdfs\");\n HBaseAdmin admin = new HBaseAdmin(conf);\n try {\n HRegionInfo[] oldHris = new HRegionInfo[2];\n setupTableWithRegionReplica(table, 2);\n assertEquals(ROWKEYS.length, countRows());\n NavigableMap<HRegionInfo, ServerName> map = MetaScanner.allTableRegions(TEST_UTIL.getConnection(),\n tbl.getName());\n int i = 0;\n // store the HRIs of the regions we will mess up\n for (Map.Entry<HRegionInfo, ServerName> m : map.entrySet()) {\n if (m.getKey().getStartKey().length > 0 &&\n m.getKey().getStartKey()[0] == Bytes.toBytes(\"B\")[0]) {\n LOG.debug(\"Initially server hosting \" + m.getKey() + \" is \" + m.getValue());\n oldHris[i++] = m.getKey();\n }\n }\n // make sure data in regions\n TEST_UTIL.getHBaseAdmin().flush(table.getName());\n\n // Mess it up by leaving a hole in the hdfs data\n deleteRegion(conf, tbl.getTableDescriptor(), Bytes.toBytes(\"B\"),\n Bytes.toBytes(\"C\"), false, false, true); // don't rm meta\n\n HBaseFsck hbck = doFsck(conf, false);\n assertErrors(hbck, new ERROR_CODE[] {ERROR_CODE.NOT_IN_HDFS});\n\n // fix hole\n doFsck(conf, true);\n\n // check that hole fixed\n assertNoErrors(doFsck(conf,false));\n assertEquals(ROWKEYS.length - 2, countRows());\n\n // the following code checks whether the old primary/secondary has\n // been unassigned and the new primary/secondary has been assigned\n i = 0;\n HRegionInfo[] newHris = new HRegionInfo[2];\n // get all table's regions from meta\n map = MetaScanner.allTableRegions(TEST_UTIL.getConnection(), tbl.getName());\n // get the HRIs of the new regions (hbck created new regions for fixing the hdfs mess-up)\n for (Map.Entry<HRegionInfo, ServerName> m : map.entrySet()) {\n if (m.getKey().getStartKey().length > 0 &&\n m.getKey().getStartKey()[0] == Bytes.toBytes(\"B\")[0]) {\n newHris[i++] = m.getKey();\n }\n }\n // get all the online regions in the regionservers\n Collection<ServerName> servers = admin.getClusterStatus().getServers();\n Set<HRegionInfo> onlineRegions = new HashSet<HRegionInfo>();\n for (ServerName s : servers) {\n List<HRegionInfo> list = admin.getOnlineRegions(s);\n onlineRegions.addAll(list);\n }\n // the new HRIs must be a subset of the online regions\n assertTrue(onlineRegions.containsAll(Arrays.asList(newHris)));\n // the old HRIs must not be part of the set (removeAll would return false if\n // the set didn't change)\n assertFalse(onlineRegions.removeAll(Arrays.asList(oldHris)));\n } finally {\n cleanupTable(table);\n admin.close();\n }\n }", "@Test\n public void testOldMemberCantJoinRolledLocators() {\n VM oldServer = Host.getHost(0).getVM(sourceConfiguration, 1);\n Properties props = getSystemProperties(); // uses the DUnit locator\n try {\n oldServer.invoke(invokeCreateCache(props));\n } catch (RMIException e) {\n Throwable cause = e.getCause();\n if ((cause instanceof AssertionError)) {\n cause = cause.getCause();\n if (cause != null && cause.getMessage() != null && !cause.getMessage().startsWith(\n \"Rejecting the attempt of a member using an older version of the product to join the distributed system\")) {\n throw e;\n }\n }\n }\n }", "@Test(timeout=20000)\n public void testWithReplicationFactorAsOne() throws Exception {\n Configuration conf = new HdfsConfiguration();\n conf.setLong(DFSConfigKeys.DFS_BLOCKREPORT_INTERVAL_MSEC_KEY, 1000L);\n conf.set(DFSConfigKeys.DFS_NAMENODE_RECONSTRUCTION_PENDING_TIMEOUT_SEC_KEY, Integer.toString(2));\n MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(2).build();\n FileSystem fs = cluster.getFileSystem();\n final FSNamesystem namesystem = cluster.getNamesystem();\n\n try {\n final Path fileName = new Path(\"/foo1\");\n DFSTestUtil.createFile(fs, fileName, 2, (short) 2, 0L);\n DFSTestUtil.waitReplication(fs, fileName, (short) 2);\n\n ExtendedBlock block = DFSTestUtil.getFirstBlock(fs, fileName);\n corruptBlock(cluster, fs, fileName, 0, block);\n\n DFSTestUtil.waitReplication(fs, fileName, (short) 1);\n\n assertEquals(1, countReplicas(namesystem, block).liveReplicas());\n assertEquals(1, countReplicas(namesystem, block).corruptReplicas());\n\n namesystem.setReplication(fileName.toString(), (short) 1);\n\n // wait for 3 seconds so that all block reports are processed.\n for (int i = 0; i < 10; i++) {\n try {\n Thread.sleep(1000);\n } catch (InterruptedException ignored) {\n }\n if (countReplicas(namesystem, block).corruptReplicas() == 0) {\n break;\n }\n }\n\n assertEquals(1, countReplicas(namesystem, block).liveReplicas());\n assertEquals(0, countReplicas(namesystem, block).corruptReplicas());\n\n } finally {\n cluster.shutdown();\n }\n }", "@Test\n\tpublic void testServerDisconnectedClientsDontGetWrite() throws Exception {\n\t\tKeyValueServer server = new KeyValueServer();\n\t\tArrayList<String> files = populateServer(server);\n\t\t//Set up fake clients\n\t\tKeyValueClient[] clients = new KeyValueClient[N_REPLICAS];\n\t\tString contentToWrite = \"testServerManyClientsRegisterAllGetInnerWrite.\" + System.currentTimeMillis() + \".\";\n\t\tfor (int i = 0; i < N_REPLICAS; i++) {\n\t\t\tclients[i] = mock(KeyValueClient.class);\n\n\t\t\tif (i % 2 == 0) {\n\t\t\t\t//Half of the clients will expect to get the write\n\t\t\t\tfor (String p : files)\n\t\t\t\t\texpect(clients[i].innerWriteKey(eq(p.toString()), eq(contentToWrite + p.toString()), anyLong())).andReturn(true);\n\t\t\t\tclients[i].commitTransaction(anyLong());\n\t\t\t\texpectLastCall().anyTimes();\n\t\t\t\tclients[i].abortTransaction(anyLong());\n\t\t\t\texpectLastCall().anyTimes();\n\t\t\t} else {\n\t\t\t\t//Other half of the clients will expect to get nothing!\n\t\t\t}\n\n\t\t\treplay(clients[i]);\n\t\t}\n\t\tfor (int i = 0; i < N_REPLICAS; i++) {\n\t\t\tserver.registerClient(\"fake hostname\", 9000 + i, clients[i]);\n\t\t}\n\t\tfor (int i = 0; i < N_REPLICAS; i++) {\n\t\t\tif (i % 2 != 0) {\n\t\t\t\tserver.cacheDisconnect(\"fake hostname\", 9000 + i);\n\t\t\t}\n\t\t}\n\t\tfor (String p : files)\n\t\t\tserver.set(p.toString(), contentToWrite + p.toString());\n\t\tfor (int i = 0; i < N_REPLICAS; i++) {\n\t\t\tif (i % 2 == 0)\n\t\t\t\tserver.cacheDisconnect(\"fake hostname\", 9000 + i);\n\t\t}\n\t\tfor (KeyValueClient client : clients)\n\t\t\tverify(client);\n\t}", "@Test\n public void testMultipleAppendsDuringCatchupTailing() throws Exception {\n Configuration conf = new Configuration();\n // Set a length edits tailing period, and explicit rolling, so we can\n // control the ingest of edits by the standby for this test.\n conf.set(DFS_HA_TAILEDITS_PERIOD_KEY, \"5000\");\n conf.setInt(DFS_HA_LOGROLL_PERIOD_KEY, (-1));\n MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).nnTopology(MiniDFSNNTopology.simpleHATopology()).numDataNodes(3).build();\n FileSystem fs = null;\n try {\n cluster.transitionToActive(0);\n fs = HATestUtil.configureFailoverFs(cluster, conf);\n Path fileToAppend = new Path(\"/FileToAppend\");\n Path fileToTruncate = new Path(\"/FileToTruncate\");\n final byte[] data = new byte[1 << 16];\n ThreadLocalRandom.current().nextBytes(data);\n final int[] appendPos = AppendTestUtil.randomFilePartition(data.length, TestHAAppend.COUNT);\n final int[] truncatePos = AppendTestUtil.randomFilePartition(data.length, 1);\n // Create file, write some data, and hflush so that the first\n // block is in the edit log prior to roll.\n FSDataOutputStream out = TestHAAppend.createAndHflush(fs, fileToAppend, data, appendPos[0]);\n FSDataOutputStream out4Truncate = TestHAAppend.createAndHflush(fs, fileToTruncate, data, data.length);\n // Let the StandbyNode catch the creation of the file.\n cluster.getNameNode(0).getRpcServer().rollEditLog();\n cluster.getNameNode(1).getNamesystem().getEditLogTailer().doTailEdits();\n out.close();\n out4Truncate.close();\n // Append and re-close a few time, so that many block entries are queued.\n for (int i = 0; i < (TestHAAppend.COUNT); i++) {\n int end = (i < ((TestHAAppend.COUNT) - 1)) ? appendPos[(i + 1)] : data.length;\n out = fs.append(fileToAppend);\n out.write(data, appendPos[i], (end - (appendPos[i])));\n out.close();\n }\n boolean isTruncateReady = fs.truncate(fileToTruncate, truncatePos[0]);\n // Ensure that blocks have been reported to the SBN ahead of the edits\n // arriving.\n cluster.triggerBlockReports();\n // Failover the current standby to active.\n cluster.shutdownNameNode(0);\n cluster.transitionToActive(1);\n // Check the FSCK doesn't detect any bad blocks on the SBN.\n int rc = ToolRunner.run(new org.apache.hadoop.hdfs.tools.DFSck(cluster.getConfiguration(1)), new String[]{ \"/\", \"-files\", \"-blocks\" });\n Assert.assertEquals(0, rc);\n Assert.assertEquals(\"CorruptBlocks should be empty.\", 0, cluster.getNameNode(1).getNamesystem().getCorruptReplicaBlocks());\n AppendTestUtil.checkFullFile(fs, fileToAppend, data.length, data, fileToAppend.toString());\n if (!isTruncateReady) {\n TestFileTruncate.checkBlockRecovery(fileToTruncate, cluster.getFileSystem(1), 300, 200);\n }\n AppendTestUtil.checkFullFile(fs, fileToTruncate, truncatePos[0], data, fileToTruncate.toString());\n } finally {\n if (null != cluster) {\n cluster.shutdown();\n }\n if (null != fs) {\n fs.close();\n }\n }\n }", "@Test\n public void tesInvalidateMissingBlock() throws Exception {\n long blockSize = 1024;\n int heatbeatInterval = 1;\n HdfsConfiguration c = new HdfsConfiguration();\n c.setInt(DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_KEY, heatbeatInterval);\n c.setLong(DFS_BLOCK_SIZE_KEY, blockSize);\n MiniDFSCluster cluster = new MiniDFSCluster.Builder(c).\n numDataNodes(1).build();\n try {\n cluster.waitActive();\n DFSTestUtil.createFile(cluster.getFileSystem(), new Path(\"/a\"),\n blockSize, (short)1, 0);\n\n String bpid = cluster.getNameNode().getNamesystem().getBlockPoolId();\n DataNode dn = cluster.getDataNodes().get(0);\n FsDatasetImpl fsdataset = (FsDatasetImpl) dn.getFSDataset();\n List<ReplicaInfo> replicaInfos = fsdataset.getFinalizedBlocks(bpid);\n assertEquals(1, replicaInfos.size());\n\n ReplicaInfo replicaInfo = replicaInfos.get(0);\n String blockPath = replicaInfo.getBlockURI().getPath();\n String metaPath = replicaInfo.getMetadataURI().getPath();\n File blockFile = new File(blockPath);\n File metaFile = new File(metaPath);\n\n // Mock local block file not found when disk with some exception.\n fsdataset.invalidateMissingBlock(bpid, replicaInfo);\n\n // Assert local block file wouldn't be deleted from disk.\n assertTrue(blockFile.exists());\n // Assert block info would be removed from ReplicaMap.\n assertEquals(\"null\",\n fsdataset.getReplicaString(bpid, replicaInfo.getBlockId()));\n BlockManager blockManager = cluster.getNameNode().\n getNamesystem().getBlockManager();\n GenericTestUtils.waitFor(() ->\n blockManager.getLowRedundancyBlocksCount() == 1, 100, 5000);\n\n // Mock local block file found when disk back to normal.\n FsVolumeSpi.ScanInfo info = new FsVolumeSpi.ScanInfo(\n replicaInfo.getBlockId(), blockFile.getParentFile().getAbsoluteFile(),\n blockFile.getName(), metaFile.getName(), replicaInfo.getVolume());\n fsdataset.checkAndUpdate(bpid, info);\n GenericTestUtils.waitFor(() ->\n blockManager.getLowRedundancyBlocksCount() == 0, 100, 5000);\n } finally {\n cluster.shutdown();\n }\n }", "@Test(timeout = 30000)\n public void testMoveBlockWithSameMountMoveWithoutSpace() {\n MiniDFSCluster cluster = null;\n try {\n conf.setBoolean(DFSConfigKeys\n .DFS_DATANODE_ALLOW_SAME_DISK_TIERING, true);\n conf.setDouble(DFSConfigKeys\n .DFS_DATANODE_RESERVE_FOR_ARCHIVE_DEFAULT_PERCENTAGE, 0.0);\n cluster = new MiniDFSCluster.Builder(conf)\n .numDataNodes(1)\n .storageTypes(\n new StorageType[]{StorageType.DISK, StorageType.ARCHIVE})\n .storagesPerDatanode(2)\n .build();\n FileSystem fs = cluster.getFileSystem();\n DataNode dataNode = cluster.getDataNodes().get(0);\n Path filePath = new Path(name.getMethodName());\n long fileLen = 100;\n\n ExtendedBlock block = createTestFile(fs, fileLen, filePath);\n\n FsDatasetImpl fsDataSetImpl = (FsDatasetImpl) dataNode.getFSDataset();\n assertEquals(StorageType.DISK,\n fsDataSetImpl.getReplicaInfo(block).getVolume().getStorageType());\n\n FsDatasetImpl fsDataSetImplSpy =\n spy((FsDatasetImpl) dataNode.getFSDataset());\n fsDataSetImplSpy.moveBlockAcrossStorage(\n block, StorageType.ARCHIVE, null);\n\n fail(\"testMoveBlockWithSameMountMoveWithoutSpace operation\" +\n \" should failed\");\n } catch (Exception ex) {\n assertTrue(ex instanceof DiskChecker.DiskOutOfSpaceException);\n } finally {\n if (cluster.isClusterUp()) {\n cluster.shutdown();\n }\n }\n }", "@Test\r\n public void testCopyEdits() throws Exception {\r\n MiniDFSCluster cluster = null;\r\n JournalService service = null;\r\n JournalHttpServer jhs1 = null, jhs2 = null;\r\n\r\n try {\r\n cluster = new MiniDFSCluster.Builder(conf).numDataNodes(0).build();\r\n\r\n // restart namenode, so it will have finalized edit segments\r\n cluster.restartNameNode();\r\n\r\n conf.set(DFSConfigKeys.DFS_JOURNAL_EDITS_DIR_KEY, path1.getPath());\r\n InetSocketAddress nnAddr = cluster.getNameNode(0).getNameNodeAddress();\r\n InetSocketAddress serverAddr = new InetSocketAddress(50900);\r\n JournalListener listener = Mockito.mock(JournalListener.class);\r\n service = new JournalService(conf, nnAddr, serverAddr, listener);\r\n service.start();\r\n \r\n // get namenode clusterID/layoutVersion/namespaceID\r\n StorageInfo si = service.getJournal().getStorage();\r\n JournalInfo journalInfo = new JournalInfo(si.layoutVersion, si.clusterID,\r\n si.namespaceID);\r\n\r\n // start jns1 with path1\r\n jhs1 = new JournalHttpServer(conf, service.getJournal(),\r\n NetUtils.createSocketAddr(\"localhost:50200\"));\r\n jhs1.start();\r\n\r\n // get all edit segments\r\n InetSocketAddress srcRpcAddr = NameNode.getServiceAddress(conf, true);\r\n NamenodeProtocol namenode = NameNodeProxies.createNonHAProxy(conf,\r\n srcRpcAddr, NamenodeProtocol.class,\r\n UserGroupInformation.getCurrentUser(), true).getProxy();\r\n\r\n RemoteEditLogManifest manifest = namenode.getEditLogManifest(1); \r\n jhs1.downloadEditFiles(\r\n conf.get(DFSConfigKeys.DFS_NAMENODE_HTTP_ADDRESS_KEY), manifest);\r\n\r\n // start jns2 with path2\r\n conf.set(DFSConfigKeys.DFS_JOURNAL_EDITS_DIR_KEY, path2.getPath());\r\n Journal journal2 = new Journal(conf);\r\n journal2.format(si.namespaceID, si.clusterID); \r\n jhs2 = new JournalHttpServer(conf, journal2,\r\n NetUtils.createSocketAddr(\"localhost:50300\"));\r\n jhs2.start();\r\n\r\n // transfer edit logs from j1 to j2\r\n JournalSyncProtocol journalp = JournalService.createProxyWithJournalSyncProtocol(\r\n NetUtils.createSocketAddr(\"localhost:50900\"), conf,\r\n UserGroupInformation.getCurrentUser());\r\n RemoteEditLogManifest manifest1 = journalp.getEditLogManifest(journalInfo, 1); \r\n jhs2.downloadEditFiles(\"localhost:50200\", manifest1);\r\n\r\n } catch (IOException e) {\r\n LOG.error(\"Error in TestCopyEdits:\", e);\r\n assertTrue(e.getLocalizedMessage(), false);\r\n } finally {\r\n if (jhs1 != null)\r\n jhs1.stop();\r\n if (jhs2 != null)\r\n jhs2.stop();\r\n if (cluster != null)\r\n cluster.shutdown();\r\n if (service != null)\r\n service.stop();\r\n }\r\n }", "@Test\n public void testKillBadServer()\n throws Exception\n {\n int cServers = 3;\n Properties propsClient = new Properties();\n propsClient.put(\"coherence.distributed.localstorage\", \"false\");\n propsClient.put(\"coherence.cluster\", \"testKillBadServer\");\n Properties propsServer = new Properties();\n propsServer.put(\"coherence.cluster\", \"testKillBadServer\");\n CoherenceClusterMember[] servers = ClusteringTests.startServers(\"server-witness2\", \"witness2\", propsServer, cServers);\n Eventually.assertThat(invoking(servers[cServers-1]).getClusterSize(), is(3));\n\n CoherenceClusterMember badServer = startCacheServer(\"bad-server2\", \"witness2\", null, propsServer);\n Eventually.assertThat(invoking(badServer).getClusterSize(), is(4));\n\n CoherenceClusterMember client = startCacheServer(\"client-witness2\", \"witness2\", null, propsClient);\n Eventually.assertThat(invoking(client).getClusterSize(), is(5));\n\n UID uidServer = badServer.getLocalMemberUID();\n client.invoke(new ConnectionDestroyer(badServer.getLocalMemberId()));\n Thread.sleep(2000); // encourage either failure on this connection\n badServer.invoke(new ConnectionDestroyer(0)); // ensure witnesses will agree\n\n Eventually.assertThat(invoking(client).getClusterMemberUIDs().contains(uidServer), is(false));\n\n badServer.close();\n for (int i = 0; i < cServers; i++)\n {\n servers[i].close();\n }\n client.close();\n ClusteringTests.stopServers(\"server-witness2\", cServers);\n AbstractFunctionalTest.stopCacheServer(\"client-witness2\");\n }", "private boolean server_fresh(Runner runner) throws IOException, BadPathnameException {\n int last_edit_time = get_server_edit_time(runner);\n if (Constants.DEBUG) System.out.println(\"(log) Checking server: our last known edit time is \" + last_known_edit_time +\n \" and the server's last edit time is \" + last_edit_time);\n if (last_known_edit_time == last_edit_time) {\n if (Constants.DEBUG) System.out.println(\"(log) -> fresh at server\");\n return true;\n }\n else{\n if (Constants.DEBUG) System.out.println(\"(log) -> not fresh at server\");\n last_known_edit_time = last_edit_time;\n content = new HashMap<>();\n final_block = -1;\n return false;\n }\n }", "@Test\n public void testBug35945() throws Exception {\n PORT1 = server1.invoke(HAInterestTestCase::createServerCache);\n server1.invoke(HAInterestTestCase::createEntriesK1andK2);\n createClientPoolCacheConnectionToSingleServer(getName(),\n getServerHostName(server1.getHost()));\n registerK1AndK2();\n verifyRefreshedEntriesFromServer();\n\n server1.invoke(HAInterestTestCase::stopServer);\n verifyDeadAndLiveServers(1, 0);\n // put on stopped server\n server1.invoke(HAInterestTestCase::putK1andK2);\n // spawn a thread to put on server , which will acquire a lock on entry\n setClientServerObserverForBeforeInterestRecovery();\n server1.invoke(HAInterestTestCase::startServer);\n verifyDeadAndLiveServers(0, 1);\n waitForBeforeInterestRecoveryCallBack();\n // verify updated value of k1 as a refreshEntriesFromServer\n final Region r1 = cache.getRegion(SEPARATOR + REGION_NAME);\n assertNotNull(r1);\n\n WaitCriterion wc = new WaitCriterion() {\n private String excuse;\n\n @Override\n public boolean done() {\n Entry e1 = r1.getEntry(k1);\n Entry e2 = r1.getEntry(k2);\n Object v1 = null;\n if (e1 != null) {\n try {\n v1 = e1.getValue();\n } catch (EntryDestroyedException ignore) {\n // handled to fix GEODE-296\n }\n }\n if (e1 == null || !server_k1_updated.equals(v1)) {\n excuse = \"v1=\" + v1;\n return false;\n }\n Object v2 = null;\n if (e2 != null) {\n try {\n v2 = e2.getValue();\n } catch (EntryDestroyedException ignore) {\n // handled to fix GEODE-296\n }\n }\n if (e2 == null || !server_k2.equals(v2)) {\n excuse = \"v2=\" + v2;\n return false;\n }\n return true;\n }\n\n @Override\n public String description() {\n return excuse;\n }\n };\n GeodeAwaitility.await().untilAsserted(wc);\n }", "@Test\n public void testAysncDiskServiceDeleteReplica()\n throws IOException, InterruptedException, TimeoutException {\n HdfsConfiguration config = new HdfsConfiguration();\n // Bump up replication interval.\n config.setInt(DFSConfigKeys.DFS_NAMENODE_REDUNDANCY_INTERVAL_SECONDS_KEY, 10);\n MiniDFSCluster cluster = new MiniDFSCluster.Builder(config).numDataNodes(3).build();\n DistributedFileSystem fs = cluster.getFileSystem();\n String bpid = cluster.getNamesystem().getBlockPoolId();\n DataNodeFaultInjector oldInjector = DataNodeFaultInjector.get();\n final Semaphore semaphore = new Semaphore(0);\n try {\n cluster.waitActive();\n final DataNodeFaultInjector injector = new DataNodeFaultInjector() {\n @Override\n public void delayDeleteReplica() {\n // Lets wait for the remove replica process.\n try {\n semaphore.acquire(1);\n } catch (InterruptedException e) {\n // ignore.\n }\n }\n };\n DataNodeFaultInjector.set(injector);\n\n // Create file.\n Path path = new Path(\"/testfile\");\n DFSTestUtil.createFile(fs, path, 1024, (short) 3, 0);\n DFSTestUtil.waitReplication(fs, path, (short) 3);\n LocatedBlock lb = DFSTestUtil.getAllBlocks(fs, path).get(0);\n ExtendedBlock extendedBlock = lb.getBlock();\n DatanodeInfo[] loc = lb.getLocations();\n assertEquals(3, loc.length);\n\n // DN side.\n DataNode dn = cluster.getDataNode(loc[0].getIpcPort());\n final FsDatasetImpl ds = (FsDatasetImpl) DataNodeTestUtils.getFSDataset(dn);\n List<Block> blockList = Lists.newArrayList(extendedBlock.getLocalBlock());\n assertNotNull(ds.getStoredBlock(bpid, extendedBlock.getBlockId()));\n ds.invalidate(bpid, blockList.toArray(new Block[0]));\n\n // Test get blocks and datanodes.\n loc = DFSTestUtil.getAllBlocks(fs, path).get(0).getLocations();\n assertEquals(3, loc.length);\n List<String> uuids = Lists.newArrayList();\n for (DatanodeInfo datanodeInfo : loc) {\n uuids.add(datanodeInfo.getDatanodeUuid());\n }\n assertTrue(uuids.contains(dn.getDatanodeUuid()));\n\n // Do verification that the first replication shouldn't be deleted from the memory first.\n // Because the namenode still contains this replica, so client will try to read it.\n // If this replica is deleted from memory, the client would got an ReplicaNotFoundException.\n assertNotNull(ds.getStoredBlock(bpid, extendedBlock.getBlockId()));\n\n // Make it resume the removeReplicaFromMem method.\n semaphore.release(1);\n\n // Waiting for the async deletion task finish.\n GenericTestUtils.waitFor(() ->\n ds.asyncDiskService.countPendingDeletions() == 0, 100, 1000);\n\n // Sleep for two heartbeat times.\n Thread.sleep(config.getTimeDuration(DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_KEY,\n DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_DEFAULT,\n TimeUnit.SECONDS, TimeUnit.MILLISECONDS) * 2);\n\n // Test get blocks and datanodes again.\n loc = DFSTestUtil.getAllBlocks(fs, path).get(0).getLocations();\n assertEquals(2, loc.length);\n uuids = Lists.newArrayList();\n for (DatanodeInfo datanodeInfo : loc) {\n uuids.add(datanodeInfo.getDatanodeUuid());\n }\n // The namenode does not contain this replica.\n assertFalse(uuids.contains(dn.getDatanodeUuid()));\n\n // This replica has deleted from datanode memory.\n assertNull(ds.getStoredBlock(bpid, extendedBlock.getBlockId()));\n } finally {\n cluster.shutdown();\n DataNodeFaultInjector.set(oldInjector);\n }\n }", "@Test\n public void testFileNotFound() throws Exception {\n final Coordinator coordinator = new Coordinator(2, 2, 100000);\n try {\n Thread thread = new Thread(new Runnable() {\n @Override\n public void run() {\n coordinator.startCoordinatorService();\n }\n });\n thread.start();\n Thread.sleep(1000);\n\n // server 1\n final int port = Utilities.getRandomPort();\n Thread thread2 = new Thread(new Runnable() {\n @Override\n public void run() {\n FileServer fileServer = new FileServer(\"localhost\");\n fileServer.startService(\"localhost\", port, \"localhost\");\n }\n });\n thread2.start();\n Thread.sleep(1000);\n\n TTransport nodeSocket = new TSocket(\"localhost\", port);\n nodeSocket.open();\n TProtocol protocol = new TBinaryProtocol(nodeSocket);\n FileServerEndPoints.Client client = new FileServerEndPoints.Client(protocol);\n\n // server 2\n final int port2 = Utilities.getRandomPort();\n Thread thread3 = new Thread(new Runnable() {\n @Override\n public void run() {\n FileServer fileServer = new FileServer(\"localhost\");\n fileServer.startService(\"localhost\", port2, \"localhost\");\n }\n });\n thread3.start();\n Thread.sleep(1000);\n\n ReadResponse readResponse = client.read(\"foo.txt\");\n assertEquals(Status.FILE_NOT_FOUND, readResponse.getStatus());\n\n coordinator.stopCoordinatorService();\n } finally {\n // to make sure 9090 port is closed before next test run\n coordinator.stopCoordinatorService();\n }\n }", "@Test\n public void testReplicatedClient()\n {\n generateEvents(\"repl-client-test\");\n checkEvents(true, false);\n }", "private void maintain(){\n ArrayList<Integer> shutDown = new ArrayList<Integer>();\n for (String addr : slaveMap.keySet()){\n if (!responderList.containsKey(slaveMap.get(addr))){\n shutDown.add(slaveMap.get(addr));\n }\n }\n //print\n for (Integer id : shutDown){\n synchronized (slaveList) {\n slaveList.remove(id);\n }\n }\n //TODO: one a slave lost control, what should ArcherDFS do?\n }", "public void testNodeNotReachableFromClusterManager() throws Exception {\n startCluster(3);\n\n String clusterManagerNode = internalCluster().getClusterManagerName();\n String nonClusterManagerNode = null;\n while (nonClusterManagerNode == null) {\n nonClusterManagerNode = randomFrom(internalCluster().getNodeNames());\n if (nonClusterManagerNode.equals(clusterManagerNode)) {\n nonClusterManagerNode = null;\n }\n }\n\n logger.info(\"blocking request from cluster-manager [{}] to [{}]\", clusterManagerNode, nonClusterManagerNode);\n MockTransportService clusterManagerTransportService = (MockTransportService) internalCluster().getInstance(\n TransportService.class,\n clusterManagerNode\n );\n if (randomBoolean()) {\n clusterManagerTransportService.addUnresponsiveRule(\n internalCluster().getInstance(TransportService.class, nonClusterManagerNode)\n );\n } else {\n clusterManagerTransportService.addFailToSendNoConnectRule(\n internalCluster().getInstance(TransportService.class, nonClusterManagerNode)\n );\n }\n\n logger.info(\"waiting for [{}] to be removed from cluster\", nonClusterManagerNode);\n ensureStableCluster(2, clusterManagerNode);\n\n logger.info(\"waiting for [{}] to have no cluster-manager\", nonClusterManagerNode);\n assertNoClusterManager(nonClusterManagerNode);\n\n logger.info(\"healing partition and checking cluster reforms\");\n clusterManagerTransportService.clearAllRules();\n\n ensureStableCluster(3);\n }", "@Test\n public void shouldNotDrainTheQueueWhenReloading() throws Exception {\n Project.NameKey targetProject = createTestProject(project + \"replica\");\n String remoteName = \"doNotDrainQueue\";\n setReplicationDestination(remoteName, \"replica\", ALL_PROJECTS);\n\n Result pushResult = createChange();\n shutdownDestinations();\n\n pushResult.getCommit();\n String sourceRef = pushResult.getPatchSet().refName();\n\n assertThrows(\n InterruptedException.class,\n () -> {\n try (Repository repo = repoManager.openRepository(targetProject)) {\n waitUntil(() -> checkedGetRef(repo, sourceRef) != null);\n }\n });\n }", "public void testAddReplicaWhileWritesBlocked() throws Exception {\n final String primaryNode = internalCluster().startNode();\n createIndex(INDEX_NAME);\n ensureYellowAndNoInitializingShards(INDEX_NAME);\n final String replicaNode = internalCluster().startNode();\n ensureGreen(INDEX_NAME);\n\n final IndexShard primaryShard = getIndexShard(primaryNode, INDEX_NAME);\n final List<String> replicaNodes = new ArrayList<>();\n replicaNodes.add(replicaNode);\n assertEqualSegmentInfosVersion(replicaNodes, primaryShard);\n\n final CountDownLatch latch = new CountDownLatch(1);\n final AtomicInteger totalDocs = new AtomicInteger(0);\n try (final Releasable ignored = blockReplication(replicaNodes, latch)) {\n Thread indexingThread = new Thread(() -> { totalDocs.getAndSet(indexUntilCheckpointCount()); });\n indexingThread.start();\n indexingThread.join();\n latch.await();\n indexDoc();\n totalDocs.incrementAndGet();\n refresh(INDEX_NAME);\n // index again while we are stale.\n assertBusy(() -> {\n expectThrows(OpenSearchRejectedExecutionException.class, () -> {\n indexDoc();\n totalDocs.incrementAndGet();\n });\n });\n final String replica_2 = internalCluster().startNode();\n assertAcked(\n client().admin()\n .indices()\n .prepareUpdateSettings(INDEX_NAME)\n .setSettings(Settings.builder().put(SETTING_NUMBER_OF_REPLICAS, 2))\n );\n replicaNodes.add(replica_2);\n }\n ensureGreen(INDEX_NAME);\n waitForSearchableDocs(totalDocs.get(), replicaNodes);\n refresh(INDEX_NAME);\n // wait for the replicas to catch up after block is released.\n assertReplicaCheckpointUpdated(primaryShard);\n\n // index another doc showing there is no pressure enforced.\n indexDoc();\n refresh(INDEX_NAME);\n waitForSearchableDocs(totalDocs.incrementAndGet(), replicaNodes.toArray(new String[] {}));\n verifyStoreContent();\n }", "public void testSimpleMasterEpochHandler() throws Exception {\n final ASCIIString CELL_ID = new ASCIIString(\"testcell\");\n\n final AtomicReference<Flease> result = new AtomicReference();\n\n SimpleMasterEpochHandler meHandler = new SimpleMasterEpochHandler(\"/tmp/xtreemfs-test/\");\n Service.State svcState = meHandler.startAndWait();\n if (svcState != Service.State.RUNNING) {\n LOG.error(\"Unable to start Master Epoch Handler\", meHandler.failureCause());\n }\n\n FleaseStage fs = new FleaseStage(cfg, \"/tmp/xtreemfs-test/\", new FleaseMessageSenderInterface() {\n\n @Override\n public void sendMessage(FleaseMessage message, InetSocketAddress recipient) {\n //ignore me\n }\n }, true, new FleaseViewChangeListenerInterface() {\n\n @Override\n public void viewIdChangeEvent(ASCIIString cellId, int viewId) {\n }\n },new FleaseStatusListener() {\n\n @Override\n public void statusChanged(ASCIIString cellId, Flease lease) {\n // System.out.println(\"state change: \"+cellId+\" owner=\"+lease.getLeaseHolder());\n synchronized (result) {\n result.set(new Flease(cellId, lease.getLeaseHolder(), lease.getLeaseTimeout_ms(),lease.getMasterEpochNumber()));\n result.notify();\n }\n }\n\n @Override\n public void leaseFailed(ASCIIString cellId, FleaseException error) {\n MasterEpochTest.fail(error.toString());\n }\n }, meHandler);\n\n FleaseMessage msg = new FleaseMessage(FleaseMessage.MsgType.EVENT_RESTART);\n msg.setCellId(CELL_ID);\n\n fs.startAndWait();\n\n fs.openCell(CELL_ID, new ArrayList(),true);\n\n synchronized(result) {\n if (result.get() == null)\n result.wait(1000);\n if (result.get() == null)\n fail(\"timeout!\");\n }\n\n assertEquals(result.get().getLeaseHolder(),cfg.getIdentity());\n assertEquals(1, result.get().getMasterEpochNumber());\n\n FleaseFuture f = fs.closeCell(CELL_ID, false);\n f.get();\n\n fs.stopAndWait();\n meHandler.stopAndWait();\n\n Thread.sleep(12000);\n\n //restart\n meHandler = new SimpleMasterEpochHandler(\"/tmp/xtreemfs-test/\");\n if (meHandler.startAndWait() != Service.State.RUNNING) {\n LOG.error(\"Couldnt start meHandler\", meHandler.failureCause());\n }\n\n fs = new FleaseStage(cfg, \"/tmp/xtreemfs-test/\", new FleaseMessageSenderInterface() {\n\n @Override\n public void sendMessage(FleaseMessage message, InetSocketAddress recipient) {\n //ignore me\n }\n }, true, new FleaseViewChangeListenerInterface() {\n\n @Override\n public void viewIdChangeEvent(ASCIIString cellId, int viewId) {\n }\n },new FleaseStatusListener() {\n\n @Override\n public void statusChanged(ASCIIString cellId, Flease lease) {\n // System.out.println(\"state change: \"+cellId+\" owner=\"+lease.getLeaseHolder());\n synchronized (result) {\n result.set(new Flease(cellId, lease.getLeaseHolder(), lease.getLeaseTimeout_ms(),lease.getMasterEpochNumber()));\n result.notify();\n }\n }\n\n @Override\n public void leaseFailed(ASCIIString cellId, FleaseException error) {\n MasterEpochTest.fail(error.toString());\n }\n }, meHandler);\n\n fs.startAndWait();\n\n result.set(null);\n\n fs.openCell(CELL_ID, new ArrayList(), true);\n\n synchronized(result) {\n if (result.get() == null)\n result.wait(1000);\n if (result.get() == null)\n fail(\"timeout!\");\n }\n\n assertEquals(result.get().getLeaseHolder(),cfg.getIdentity());\n assertEquals(result.get().getMasterEpochNumber(),2);\n\n fs.stopAndWait();\n\n }", "protected boolean continueOnWriteError() {\n/* 348 */ return true;\n/* */ }", "public static void customTest() throws IOException, NotBoundException, MessageNotFoundException {\n Client c = new Client();\n String fileName = \"file1\";\n\n char[] ss = \"[INITIAL DATA!]\".toCharArray(); // len = 15\n byte[] data = new byte[ss.length];\n for (int i = 0; i < ss.length; i++) {\n data[i] = (byte) ss[i];\n }\n\n c.write(fileName, data);\n\n c = new Client();\n ss = \"File 1 test test END\".toCharArray(); // len = 20\n data = new byte[ss.length];\n for (int i = 0; i < ss.length; i++) {\n data[i] = (byte) ss[i];\n }\n\n byte[] chunk = new byte[Configurations.CHUNK_SIZE];\n\n int seqN = data.length / Configurations.CHUNK_SIZE;\n int lastChunkLen = Configurations.CHUNK_SIZE;\n\n if (data.length % Configurations.CHUNK_SIZE > 0) {\n lastChunkLen = data.length % Configurations.CHUNK_SIZE;\n seqN++;\n }\n\n WriteAck ackMsg = c.masterStub.write(fileName);\n ReplicaServerClientInterface stub = (ReplicaServerClientInterface) registry.lookup(\"ReplicaClient\" + ackMsg.getLoc().getId());\n\n FileContent fileContent;\n @SuppressWarnings(\"unused\")\n ChunkAck chunkAck;\n //\t\tfor (int i = 0; i < seqN; i++) {\n System.arraycopy(data, 0 * Configurations.CHUNK_SIZE, chunk, 0, Configurations.CHUNK_SIZE);\n fileContent = new FileContent(fileName, chunk);\n chunkAck = stub.write(ackMsg.getTransactionId(), 0, fileContent);\n\n System.arraycopy(data, 1 * Configurations.CHUNK_SIZE, chunk, 0, Configurations.CHUNK_SIZE);\n fileContent = new FileContent(fileName, chunk);\n chunkAck = stub.write(ackMsg.getTransactionId(), 1, fileContent);\n\n // read here \n List<ReplicaLoc> locations = c.masterStub.read(fileName);\n System.err.println(\"[@CustomTest] Read1 started \");\n\n // TODO fetch from all and verify \n ReplicaLoc replicaLoc = locations.get(0);\n ReplicaServerClientInterface replicaStub = (ReplicaServerClientInterface) registry.lookup(\"ReplicaClient\" + replicaLoc.getId());\n fileContent = replicaStub.read(fileName);\n System.err.println(\"[@CustomTest] data:\");\n System.err.println(new String(fileContent.getData()));\n\n // continue write \n for (int i = 2; i < seqN - 1; i++) {\n System.arraycopy(data, i * Configurations.CHUNK_SIZE, chunk, 0, Configurations.CHUNK_SIZE);\n fileContent = new FileContent(fileName, chunk);\n chunkAck = stub.write(ackMsg.getTransactionId(), i, fileContent);\n }\n // copy the last chuck that might be < CHUNK_SIZE\n System.arraycopy(data, (seqN - 1) * Configurations.CHUNK_SIZE, chunk, 0, lastChunkLen);\n fileContent = new FileContent(fileName, chunk);\n chunkAck = stub.write(ackMsg.getTransactionId(), seqN - 1, fileContent);\n\n //commit\n ReplicaLoc primaryLoc = c.masterStub.locatePrimaryReplica(fileName);\n ReplicaServerClientInterface primaryStub = (ReplicaServerClientInterface) registry.lookup(\"ReplicaClient\" + primaryLoc.getId());\n primaryStub.commit(ackMsg.getTransactionId(), seqN);\n\n // read\n locations = c.masterStub.read(fileName);\n System.err.println(\"[@CustomTest] Read3 started \");\n\n replicaLoc = locations.get(0);\n replicaStub = (ReplicaServerClientInterface) registry.lookup(\"ReplicaClient\" + replicaLoc.getId());\n fileContent = replicaStub.read(fileName);\n System.err.println(\"[@CustomTest] data:\");\n System.err.println(new String(fileContent.getData()));\n\n }", "@Test\n public void writeTryLockFailedTest() throws InterruptedException {\n final TestUse testUse = new TestUse();\n int threadNum = 2;\n final CountDownLatch countDownLatch = new CountDownLatch(threadNum);\n for (int i = 0; i < threadNum; i++) {\n new Thread(new Runnable() {\n @Override\n public void run() {\n testUse.minusCountAndSleepInWriteTryLock(2000);\n countDownLatch.countDown();\n }\n }).start();\n }\n countDownLatch.await();\n boolean result = false;\n if (testUse.count == 1000 || testUse.count == 999) {\n result = true;\n }\n Assert.assertTrue(result);\n }", "public void lock_write() {\n boolean update = false;\n logger.log(Level.FINE,\"lock_write() \"+this.lockState+\".\");\n lock.lock();\n logger.log(Level.FINE,\"lock_write : taking mutex \"+this.lockState+\".\");\n switch(this.lockState){\n case WLC:\n this.lockState=State.WLT;\n logger.log(Level.INFO,\"writing with cache\");\n \t break;\n \t\t default: \t\n update = true;\n break;\n \t }\n lock.unlock();\n logger.log(Level.FINE,\"lock_write : the mutex with :\"+lockState+\".\");\n if(update){\n \tlogger.log(Level.INFO,\"Updating lock to WLT \"+lockState+\".\"); //Avant RLC\n \tthis.lockState=State.WLT; \n if(lockState!=State.WLT){\n logger.log(Level.SEVERE,\"Lock = \"+this.lockState+\" instead of WLT\"); //Bien mmis à WLT.\n }\n logger.log(Level.INFO,\"LockState was updated to \"+lockState+\".\");\n this.obj = client.lock_write(this.id); //BUG : se fait invalider en tant que reader et passe à NL entrant dans la boucle suivante \n // A mon avis : se fait invalider en tant que lecteur (d'ou un lock_incohérent = WLT). A voir \n // Est-ce qu'il s'auto-invalide, auquel cas, il faut vérifier invalidate_reader mais je crois qu'il y un test pour ce cas.\n // Quelqu'un d'autre l'invalide mais dans ce cas, le serveur devrait \"séquencer\" cette autre invalidation et le lock_write.\n if(lockState!=State.WLT){\n logger.log(Level.SEVERE,\"Lock = \"+this.lockState+\" instead of WLT\");\n }\n logger.log(Level.INFO,\"lock_write() : end with \"+lockState+\".\");\n }\n }", "@Test\n\tpublic void testTryLockAndRelockAndPass() {\n\n\t\tinstance.lock();\n\n\t\tassertTrue(instance.tryLock());\n\t}", "@Test\n public void testRoundRobinMasters()\n throws Exception {\n\n RepEnvInfo[] repEnvInfo = null;\n Logger logger = LoggerUtils.getLoggerFixedPrefix(getClass(), \"Test\");\n\n try {\n /* Create a replicator for each environment directory. */\n EnvironmentConfig envConfig =\n RepTestUtils.createEnvConfig\n (new Durability(Durability.SyncPolicy.WRITE_NO_SYNC,\n Durability.SyncPolicy.WRITE_NO_SYNC,\n Durability.ReplicaAckPolicy.SIMPLE_MAJORITY));\n envConfig.setConfigParam\n (EnvironmentConfig.LOG_FILE_MAX,\n EnvironmentParams.LOG_FILE_MAX.getDefault());\n\n // TODO: Is this needed now that hard recovery works?\n LocalCBVLSNUpdater.setSuppressGroupDBUpdates(true);\n envConfig.setConfigParam(\"je.env.runCleaner\", \"false\");\n\n repEnvInfo =\n RepTestUtils.setupEnvInfos(envRoot, nNodes, envConfig);\n\n /* Increase the ack timeout, to deal with slow test machines. */\n RepTestUtils.setConfigParam(RepParams.REPLICA_ACK_TIMEOUT, \"30 s\",\n repEnvInfo);\n\n /* Start all members of the group. */\n ReplicatedEnvironment master = RepTestUtils.joinGroup(repEnvInfo);\n assert(master != null);\n\n /* Do work */\n int startVal = 1;\n doWork(master, startVal);\n\n VLSN commitVLSN =\n RepTestUtils.syncGroupToLastCommit(repEnvInfo,\n repEnvInfo.length);\n RepTestUtils.checkNodeEquality(commitVLSN, verbose , repEnvInfo);\n\n logger.fine(\"--> All nodes in sync\");\n\n /*\n * Round robin through the group, letting each one have a turn\n * as the master.\n */\n for (int i = 0; i < nNodes; i++) {\n /*\n * Shut just under a quorum of the nodes. Let the remaining\n * nodes vote, and then do some work. Then bring\n * the rest of the group back in a staggered fashion. Check for\n * consistency among the entire group.\n */\n logger.fine(\"--> Shutting down, oldMaster=\" +\n master.getNodeName());\n int activeNodes =\n shutdownAllButQuorum(logger,\n repEnvInfo,\n RepInternal.getNodeId(master));\n\n master = RepTestUtils.openRepEnvsJoin(repEnvInfo);\n\n assertNotNull(master);\n logger.fine(\"--> New master = \" + master.getNodeName());\n\n startVal += 5;\n\n /*\n * This test is very timing dependent, so\n * InsufficientReplicasException is allowed.\n */\n int retries = 5;\n for (int retry = 0;; retry++) {\n try{\n doWork(master, startVal);\n break;\n } catch (InsufficientReplicasException e) {\n if (retry >= retries) {\n throw e;\n }\n }\n }\n\n /* Re-open the closed nodes and have them re-join the group. */\n logger.fine(\"--> Before closed nodes rejoin\");\n ReplicatedEnvironment newMaster =\n RepTestUtils.joinGroup(repEnvInfo);\n\n assertEquals(\"Round \" + i +\n \" expected master to stay unchanged. \",\n master.getNodeName(),\n newMaster.getNodeName());\n VLSN vlsn =\n RepTestUtils.syncGroupToLastCommit(repEnvInfo,\n activeNodes);\n RepTestUtils.checkNodeEquality(vlsn, verbose, repEnvInfo);\n }\n } catch (Throwable e) {\n e.printStackTrace();\n throw e;\n } finally {\n RepTestUtils.shutdownRepEnvs(repEnvInfo);\n }\n }", "@Test\n public void testPersistentPR_Restart_one_server_while_clean_queue() throws InterruptedException {\n Integer lnPort = vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));\n // create locator on remote site\n Integer nyPort = vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2, lnPort));\n\n // create cache in remote site\n createCacheInVMs(nyPort, vm2, vm3);\n\n // create cache in local site\n createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);\n\n // create senders with disk store\n String diskStore1 = vm4.invoke(() -> WANTestBase.createSenderWithDiskStore(\"ln\", 2,\n true, 100, 10, false, true, null, null, true));\n String diskStore2 = vm5.invoke(() -> WANTestBase.createSenderWithDiskStore(\"ln\", 2,\n true, 100, 10, false, true, null, null, true));\n String diskStore3 = vm6.invoke(() -> WANTestBase.createSenderWithDiskStore(\"ln\", 2,\n true, 100, 10, false, true, null, null, true));\n String diskStore4 = vm7.invoke(() -> WANTestBase.createSenderWithDiskStore(\"ln\", 2,\n true, 100, 10, false, true, null, null, true));\n\n logger\n .info(\"The DS are: \" + diskStore1 + \",\" + diskStore2 + \",\" + diskStore3 + \",\" + diskStore4);\n\n // create PR on remote site\n vm2.invoke(\n () -> WANTestBase.createPartitionedRegion(getTestMethodName(), null, 1, 100, isOffHeap()));\n vm3.invoke(\n () -> WANTestBase.createPartitionedRegion(getTestMethodName(), null, 1, 100, isOffHeap()));\n\n // create PR on local site\n vm4.invoke(createPartitionedRegionRunnable());\n vm5.invoke(createPartitionedRegionRunnable());\n vm6.invoke(createPartitionedRegionRunnable());\n vm7.invoke(createPartitionedRegionRunnable());\n\n\n // start the senders on local site\n startSenderInVMs(\"ln\", vm4, vm5, vm6, vm7);\n\n // wait for senders to become running\n vm4.invoke(waitForSenderRunnable());\n vm5.invoke(waitForSenderRunnable());\n vm6.invoke(waitForSenderRunnable());\n vm7.invoke(waitForSenderRunnable());\n\n logger.info(\"All senders are running.\");\n\n // start puts in region on local site\n vm4.invoke(() -> WANTestBase.doPuts(getTestMethodName(), 3000));\n logger.info(\"Completed puts in the region\");\n\n\n vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName(), 0));\n vm3.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName(), 0));\n logger.info(\"Check that no events are propagated to remote site\");\n\n vm7.invoke(killSenderRunnable());\n\n logger.info(\"Killed vm7 sender.\");\n // --------------------close and rebuild local site\n // -------------------------------------------------\n // stop the senders\n\n vm4.invoke(() -> WANTestBase.stopSender(\"ln\"));\n vm5.invoke(() -> WANTestBase.stopSender(\"ln\"));\n vm6.invoke(() -> WANTestBase.stopSender(\"ln\"));\n\n logger.info(\"Stopped all the senders.\");\n\n // wait for senders to stop\n vm4.invoke(waitForSenderNonRunnable());\n vm5.invoke(waitForSenderNonRunnable());\n vm6.invoke(waitForSenderNonRunnable());\n\n // create receiver on remote site\n createReceiverInVMs(vm2, vm3);\n\n vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName(), 0));\n vm3.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName(), 0));\n\n logger.info(\"Start all the senders.\");\n\n AsyncInvocation<Void> startSenderwithCleanQueuesInVM4 =\n vm4.invokeAsync(() -> startSenderwithCleanQueues(\"ln\"));\n\n AsyncInvocation<Void> startSenderwithCleanQueuesInVM5 =\n vm5.invokeAsync(() -> startSenderwithCleanQueues(\"ln\"));\n AsyncInvocation<Void> startSenderwithCleanQueuesInVM6 =\n vm6.invokeAsync(() -> startSenderwithCleanQueues(\"ln\"));\n\n\n startSenderwithCleanQueuesInVM4.await();\n startSenderwithCleanQueuesInVM5.await();\n startSenderwithCleanQueuesInVM6.await();\n\n logger.info(\"Waiting for senders running.\");\n // wait for senders running\n vm4.invoke(waitForSenderRunnable());\n vm5.invoke(waitForSenderRunnable());\n vm6.invoke(waitForSenderRunnable());\n\n logger.info(\"All the senders are now running...\");\n\n // restart the vm\n vm7.invoke(\"Create back the cache\", () -> createCache(lnPort));\n\n // create senders with disk store\n vm7.invoke(\"Create sender back from the disk store.\",\n () -> WANTestBase.createSenderWithDiskStore(\"ln\", 2, true, 100, 10, false, true,\n null, diskStore4, false));\n\n // create PR on local site\n vm7.invoke(\"Create back the partitioned region\",\n () -> WANTestBase.createPartitionedRegion(getTestMethodName(), \"ln\", 1,\n 100, isOffHeap()));\n\n // wait for senders running\n // ----------------------------------------------------------------------------------------------------\n\n vm2.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName(), 0));\n vm3.invoke(() -> WANTestBase.validateRegionSize(getTestMethodName(), 0));\n\n }", "@Test\n public void testPartialWrite() throws Exception {\n final int port = new Random(System.currentTimeMillis()).nextInt(1024) + 1024;\n final StubServer server = new StubServer(port);\n Thread serverThread = new Thread(server);\n serverThread.start();\n server.awaitForStart();\n final MessageParser<Message> parser = new MessageParser<Message>() {\n @Override public Message parse(ByteBuffer buffer) throws PartialMessageException {\n Assert.fail();\n return null;\n }\n };\n final Callback callback = new Callback();\n final Events events = Events.open();\n Connection<Message> connection = Connection.connect(new InetSocketAddress(\"localhost\", port), parser, callback);\n events.register(connection);\n while (true) {\n if (!events.process(100))\n break;\n }\n server.awaitForStop();\n Assert.assertEquals(callback.total, server.total);\n }", "@Test\n public void testFileRead() throws Exception {\n final Coordinator coordinator = new Coordinator(2, 2, 100000);\n try {\n Thread thread = new Thread(new Runnable() {\n @Override\n public void run() {\n coordinator.startCoordinatorService();\n }\n });\n thread.start();\n Thread.sleep(1000);\n\n // server 1\n final int port = Utilities.getRandomPort();\n Thread thread2 = new Thread(new Runnable() {\n @Override\n public void run() {\n FileServer fileServer = new FileServer(\"localhost\");\n fileServer.startService(\"localhost\", port, \"localhost\");\n }\n });\n thread2.start();\n Thread.sleep(1000);\n\n // server 2\n TTransport nodeSocket = new TSocket(\"localhost\", port);\n nodeSocket.open();\n TProtocol protocol = new TBinaryProtocol(nodeSocket);\n FileServerEndPoints.Client client = new FileServerEndPoints.Client(protocol);\n\n final int port2 = Utilities.getRandomPort();\n Thread thread3 = new Thread(new Runnable() {\n @Override\n public void run() {\n FileServer fileServer = new FileServer(\"localhost\");\n fileServer.startService(\"localhost\", port2, \"localhost\");\n }\n });\n thread3.start();\n Thread.sleep(1000);\n\n WriteResponse writeResponse = client.write(\"foo.txt\", \"bar\");\n assertEquals(Status.SUCCESS, writeResponse.getStatus());\n assertEquals(0, writeResponse.getVersion());\n assertEquals(3, writeResponse.getBytesWritten());\n\n ReadResponse readResponse = client.read(\"foo.txt\");\n assertEquals(Status.SUCCESS, readResponse.getStatus());\n assertEquals(\"bar\", readResponse.getContents());\n assertEquals(0, readResponse.getVersion());\n } finally {\n // to make sure 9090 port is closed before next test run\n coordinator.stopCoordinatorService();\n }\n }", "public void testRestart() throws Exception {\n \t\tsource.open(executionContext);\n \t\tsource.read();\n \t\tsource.update(executionContext);\n \t\tSystem.out.println(executionContext);\n\t\tassertEquals(1, executionContext.getLong(ClassUtils.getShortName(StaxEventItemReader.class) + \".piece.count\"));\n \t\tList expectedAfterRestart = (List) source.read();\n \n \t\tsource = createNewInputSouce();\n \t\tsource.open(executionContext);\n \t\tList afterRestart = (List) source.read();\n \t\tassertEquals(expectedAfterRestart.size(), afterRestart.size());\n \t}", "@Test\n public void testCleanShutdownOfVolume() throws Exception {\n MiniDFSCluster cluster = null;\n try {\n Configuration config = new HdfsConfiguration();\n config.setLong(\n DFSConfigKeys.DFS_DATANODE_XCEIVER_STOP_TIMEOUT_MILLIS_KEY, 1000);\n config.setTimeDuration(\n DFSConfigKeys.DFS_DATANODE_DISK_CHECK_MIN_GAP_KEY, 0,\n TimeUnit.MILLISECONDS);\n config.setInt(DFSConfigKeys.DFS_DATANODE_FAILED_VOLUMES_TOLERATED_KEY, 1);\n\n cluster = new MiniDFSCluster.Builder(config,\n GenericTestUtils.getRandomizedTestDir()).numDataNodes(1).build();\n cluster.waitActive();\n FileSystem fs = cluster.getFileSystem();\n DataNode dataNode = cluster.getDataNodes().get(0);\n Path filePath = new Path(\"test.dat\");\n // Create a file and keep the output stream unclosed.\n FSDataOutputStream out = fs.create(filePath, (short) 1);\n out.write(1);\n out.hflush();\n\n ExtendedBlock block = DFSTestUtil.getFirstBlock(fs, filePath);\n final FsVolumeImpl volume = (FsVolumeImpl) dataNode.getFSDataset().\n getVolume(block);\n File finalizedDir = volume.getFinalizedDir(cluster.getNamesystem()\n .getBlockPoolId());\n LocatedBlock lb = DFSTestUtil.getAllBlocks(fs, filePath).get(0);\n DatanodeInfo info = lb.getLocations()[0];\n\n if (finalizedDir.exists()) {\n // Remove write and execute access so that checkDiskErrorThread detects\n // this volume is bad.\n finalizedDir.setExecutable(false);\n assertTrue(FileUtil.setWritable(finalizedDir, false));\n }\n Assert.assertTrue(\"Reference count for the volume should be greater \"\n + \"than 0\", volume.getReferenceCount() > 0);\n // Invoke the synchronous checkDiskError method\n dataNode.checkDiskError();\n // Sleep for 1 second so that datanode can interrupt and cluster clean up\n GenericTestUtils.waitFor(new Supplier<Boolean>() {\n @Override public Boolean get() {\n return volume.getReferenceCount() == 0;\n }\n }, 100, 1000);\n assertThat(dataNode.getFSDataset().getNumFailedVolumes(), is(1));\n\n try {\n out.close();\n Assert.fail(\"This is not a valid code path. \"\n + \"out.close should have thrown an exception.\");\n } catch (IOException ioe) {\n GenericTestUtils.assertExceptionContains(info.getXferAddr(), ioe);\n }\n assertTrue(FileUtil.setWritable(finalizedDir, true));\n finalizedDir.setExecutable(true);\n } finally {\n cluster.shutdown();\n }\n }", "@Test\n public void setupDeleteInShareUpdateInClient()\n {\n concurrentFolder = getRandomFolderIn(getLocalSiteLocation(), \"conFolder\");\n fileInFolder = getRandomFileIn(concurrentFolder,\"fileInFolder\",\"txt\");\n try\n {\n explorer.openApplication();\n explorer.openFolder(getLocalSiteLocation());\n explorer.createAndOpenFolder(concurrentFolder.getName());\n notepad.openApplication();\n notepad.saveAs(fileInFolder);\n explorer.goBack(getLocalSiteLocation().getName());\n syncWaitTime(CLIENTSYNCTIME);\n\n shareLogin.loginToShare(drone, userInfo, shareUrl);\n share.openSitesDocumentLibrary(drone, siteName);\n share.navigateToFolder(drone, getLocalSiteLocation().getName());\n Assert.assertTrue(share.isFileVisible(drone, concurrentFolder.getName()), \"Client folder is successfully synced in Share.\");\n share.selectContent(drone, concurrentFolder.getName());\n Assert.assertTrue(share.isFileVisible(drone, fileInFolder.getName()), \"Client file is successfully synced in Share.\");\n share.openSitesDocumentLibrary(drone, siteName);\n share.navigateToFolder(drone, getLocalSiteLocation().getName());\n share.deleteContentInDocLib(drone, concurrentFolder.getName());\n notepad.edit(\"added new line of text\");\n notepad.save();\n notepad.close(fileInFolder);\n syncWaitTime(SERVERSYNCTIME);\n //need to verify correct behavior as desktopSync does not trigger conflict\n // the conflictType may be different. Will update it once I can test it\n// Assert.assertTrue(notification.isConflictStatusCorrect(conflictTypeDelete,concurrentFolder.getName()));\n }\n catch (Throwable e)\n {\n e.printStackTrace();\n throw new TestException(\"Test case failed - setupDeleteInShareUpdateInClient\", e);\n }\n finally\n {\n shareLogin.logout(drone);\n }\n }", "@Test\n public void testReplicaMapAfterDatanodeRestart() throws Exception {\n Configuration conf = new HdfsConfiguration();\n MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf, new File(GenericTestUtils.getRandomizedTempPath())).nnTopology(MiniDFSNNTopology.simpleFederatedTopology(2)).build();\n try {\n cluster.waitActive();\n NameNode nn1 = cluster.getNameNode(0);\n NameNode nn2 = cluster.getNameNode(1);\n Assert.assertNotNull(\"cannot create nn1\", nn1);\n Assert.assertNotNull(\"cannot create nn2\", nn2);\n // check number of volumes in fsdataset\n DataNode dn = cluster.getDataNodes().get(0);\n FsDatasetImpl dataSet = ((FsDatasetImpl) (DataNodeTestUtils.getFSDataset(dn)));\n List<FsVolumeSpi> volumes = null;\n try (FsDatasetSpi.FsVolumeReferences referredVols = dataSet.getFsVolumeReferences()) {\n // number of volumes should be 2 - [data1, data2]\n Assert.assertEquals(\"number of volumes is wrong\", 2, referredVols.size());\n volumes = new ArrayList(referredVols.size());\n for (FsVolumeSpi vol : referredVols) {\n volumes.add(vol);\n }\n }\n ArrayList<String> bpList = new ArrayList(Arrays.asList(cluster.getNamesystem(0).getBlockPoolId(), cluster.getNamesystem(1).getBlockPoolId()));\n Assert.assertTrue(\"Cluster should have 2 block pools\", ((bpList.size()) == 2));\n createReplicas(bpList, volumes, cluster.getFsDatasetTestUtils(dn));\n ReplicaMap oldReplicaMap = new ReplicaMap(new AutoCloseableLock());\n oldReplicaMap.addAll(dataSet.volumeMap);\n cluster.restartDataNode(0);\n cluster.waitActive();\n dn = cluster.getDataNodes().get(0);\n dataSet = ((FsDatasetImpl) (dn.getFSDataset()));\n testEqualityOfReplicaMap(oldReplicaMap, dataSet.volumeMap, bpList);\n } finally {\n cluster.shutdown();\n }\n }", "@Test\n\tpublic void testExecuteRequestClientActionParallelPutNoThreading() throws Exception {\n\n\t\tif (!testingPropertiesHelper.isTestParallelTransfer(testingProperties)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// create a local file to put\n\t\t// put a collection out to do a checksum on\n\t\tString testFileName = \"testExecuteRequestClientActionParallelPutNoThreading.txt\";\n\n\t\tString absPath = scratchFileUtils.createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH);\n\t\tString putFileName = FileGenerator.generateFileOfFixedLengthGivenName(absPath, testFileName, 33 * 1024 * 1024);\n\n\t\tString targetIrodsFileName = testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties(\n\t\t\t\ttestingProperties, IRODS_TEST_SUBDIR_PATH) + \"/\" + testFileName;\n\n\t\tIRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties);\n\n\t\tIRODSAccessObjectFactory accessObjectFactory = irodsFileSystem.getIRODSAccessObjectFactory();\n\n\t\tIRODSFile targetFile = accessObjectFactory.getIRODSFileFactory(irodsAccount)\n\t\t\t\t.instanceIRODSFile(targetIrodsFileName);\n\t\tFile sourceFile = new File(putFileName);\n\n\t\tTransferControlBlock tcb = accessObjectFactory.buildDefaultTransferControlBlockBasedOnJargonProperties();\n\t\ttcb.getTransferOptions().setForceOption(ForceOption.USE_FORCE);\n\n\t\tDataTransferOperations dto = accessObjectFactory.getDataTransferOperations(irodsAccount);\n\t\tdto.putOperation(sourceFile, targetFile, null, tcb);\n\n\t\tStringBuilder builder = new StringBuilder();\n\t\tbuilder.append(\"testClientAction||msiDataObjPut(\\\"\");\n\t\tbuilder.append(targetIrodsFileName);\n\t\tbuilder.append(\"\\\",null,\");\n\t\tbuilder.append(\"\\\"localPath=\");\n\t\tbuilder.append(putFileName);\n\t\tbuilder.append(\"++++destRescName=\");\n\t\tbuilder.append(irodsAccount.getDefaultStorageResource());\n\t\tbuilder.append(\"++++numThreads=-1++++forceFlag=\\\"\");\n\t\tbuilder.append(\",*status)|nop\\n\");\n\t\tbuilder.append(\"*A=null\\n\");\n\t\tbuilder.append(\"*ruleExecOut\");\n\t\tRuleProcessingAO ruleProcessingAO = accessObjectFactory.getRuleProcessingAO(irodsAccount);\n\t\tRuleInvocationConfiguration context = new RuleInvocationConfiguration();\n\t\tcontext.setIrodsRuleInvocationTypeEnum(IrodsRuleInvocationTypeEnum.IRODS);\n\t\tcontext.setEncodeRuleEngineInstance(true);\n\n\t\tIRODSRuleExecResult result = ruleProcessingAO.executeRule(builder.toString(), null, context);\n\n\t\tIRODSFile putFile = irodsFileSystem.getIRODSFileFactory(irodsAccount).instanceIRODSFile(targetIrodsFileName);\n\n\t\tAssert.assertTrue(\"file does not exist\", putFile.exists());\n\n\t\tirodsFileSystem.close();\n\n\t\tAssert.assertNotNull(\"did not get a response\", result);\n\t\tAssert.assertEquals(\"did not get results for client side operation\", 1,\n\t\t\t\tresult.getOutputParameterResults().size());\n\n\t}", "@Test\n public void testByAddingAnExtraDataNode() throws Exception {\n Configuration conf = new HdfsConfiguration();\n conf.setLong(DFSConfigKeys.DFS_BLOCKREPORT_INTERVAL_MSEC_KEY, 1000L);\n conf.set(DFSConfigKeys.DFS_NAMENODE_RECONSTRUCTION_PENDING_TIMEOUT_SEC_KEY, Integer.toString(2));\n MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(4).build();\n FileSystem fs = cluster.getFileSystem();\n final FSNamesystem namesystem = cluster.getNamesystem();\n DataNodeProperties dnPropsFourth = cluster.stopDataNode(3);\n\n try {\n final Path fileName = new Path(\"/foo1\");\n DFSTestUtil.createFile(fs, fileName, 2, (short) 3, 0L);\n DFSTestUtil.waitReplication(fs, fileName, (short) 3);\n\n ExtendedBlock block = DFSTestUtil.getFirstBlock(fs, fileName);\n corruptBlock(cluster, fs, fileName, 0, block);\n\n DFSTestUtil.waitReplication(fs, fileName, (short) 2);\n\n assertEquals(2, countReplicas(namesystem, block).liveReplicas());\n assertEquals(1, countReplicas(namesystem, block).corruptReplicas());\n\n cluster.restartDataNode(dnPropsFourth);\n\n DFSTestUtil.waitReplication(fs, fileName, (short) 3);\n\n assertEquals(3, countReplicas(namesystem, block).liveReplicas());\n assertEquals(0, countReplicas(namesystem, block).corruptReplicas());\n } finally {\n cluster.shutdown();\n }\n }", "@Test\n public void testKillClientBeforeServer()\n {\n int cServers = 3;\n Properties propsClient = new Properties();\n propsClient.put(\"coherence.distributed.localstorage\", \"false\");\n propsClient.put(\"coherence.cluster\", \"testKillClientBeforeServer\");\n Properties propsServer = new Properties();\n propsServer.put(\"coherence.cluster\", \"testKillClientBeforeServer\");\n CoherenceClusterMember[] servers = ClusteringTests.startServers(\"server-witness\", \"witness\", propsServer, cServers);\n CoherenceClusterMember client = startCacheServer(\"client-witness\", \"witness\", null, propsClient);\n\n Eventually.assertThat(invoking(servers[cServers-1]).getClusterSize(), is(4));\n\n UID uidClient = client.getLocalMemberUID();\n client.invoke(new ConnectionDestroyer(2));\n\n Eventually.assertThat(invoking(servers[cServers-1]).getClusterMemberUIDs().contains(uidClient), is(false));\n\n for (int i = 0; i < cServers; i++)\n {\n servers[i].close();\n }\n client.close();\n ClusteringTests.stopServers(\"server-witness\", cServers);\n AbstractFunctionalTest.stopCacheServer(\"client-witness\");\n Base.sleep(10000);\n }", "@Test\n public void reconfigurationDuringDataOperations()\n throws Exception {\n addServer(9000);\n addServer(9001);\n addServer(9002);\n Layout l = new TestLayoutBuilder()\n .setEpoch(1L)\n .addLayoutServer(9000)\n .addLayoutServer(9001)\n .addLayoutServer(9002)\n .addSequencer(9000)\n .addSequencer(9001)\n .addSequencer(9002)\n .buildSegment()\n .buildStripe()\n .addLogUnit(9000)\n .addLogUnit(9001)\n .addLogUnit(9002)\n .addToSegment()\n .addToLayout()\n .build();\n bootstrapAllServers(l);\n CorfuRuntime corfuRuntime = getRuntime(l).connect();\n\n // Thread to reconfigure the layout\n CountDownLatch startReconfigurationLatch = new CountDownLatch(1);\n CountDownLatch layoutReconfiguredLatch = new CountDownLatch(1);\n\n Thread t = new Thread(() -> {\n try {\n startReconfigurationLatch.await();\n corfuRuntime.invalidateLayout();\n\n // Fail the network link between the client and test server\n addServerRule(9001, new TestRule().always().drop());\n // New layout removes the failed server 9000\n Layout newLayout = new TestLayoutBuilder()\n .setEpoch(l.getEpoch() + 1)\n .addLayoutServer(9000)\n .addLayoutServer(9002)\n .addSequencer(9000)\n .addSequencer(9002)\n .buildSegment()\n .buildStripe()\n .addLogUnit(9000)\n .addLogUnit(9002)\n .addToSegment()\n .addToLayout()\n .build();\n newLayout.setRuntime(corfuRuntime);\n //TODO need to figure out if we can move to\n //update layout\n newLayout.moveServersToEpoch();\n\n corfuRuntime.getLayoutView().updateLayout(newLayout, newLayout.getEpoch());\n corfuRuntime.invalidateLayout();\n log.debug(\"layout updated new layout {}\", corfuRuntime.getLayoutView().getLayout());\n layoutReconfiguredLatch.countDown();\n } catch (Exception e) {\n e.printStackTrace();\n }\n });\n t.start();\n\n // verify writes and reads happen before and after the reconfiguration\n StreamView sv = corfuRuntime.getStreamsView().get(CorfuRuntime.getStreamID(\"streamA\"));\n // This write will happen before the reconfiguration while the read for this write\n // will happen after reconfiguration\n writeAndReadStream(corfuRuntime, sv, startReconfigurationLatch, layoutReconfiguredLatch);\n // Write and read after reconfiguration.\n writeAndReadStream(corfuRuntime, sv, startReconfigurationLatch, layoutReconfiguredLatch);\n t.join();\n }", "@Test\n public void testLockBatchParticipantsUpdate() throws Exception {\n final String rgnName = getUniqueName();\n Region rgn = getCache().createRegion(rgnName, getRegionAttributes());\n rgn.create(\"key\", null);\n\n Host host = Host.getHost(0);\n VM vm0 = host.getVM(0);\n VM vm1 = host.getVM(1);\n VM vm2 = host.getVM(2);\n SerializableRunnable initRegions =\n new SerializableRunnable(\"testLockBatchParticipantsUpdate: initial configuration\") {\n @Override\n public void run() {\n try {\n Region rgn1 = getCache().createRegion(rgnName, getRegionAttributes());\n rgn1.create(\"key\", null);\n } catch (CacheException e) {\n Assert.fail(\"While creating region\", e);\n }\n }\n };\n vm0.invoke(initRegions);\n vm1.invoke(initRegions);\n rgn.put(\"key\", \"val1\");\n\n // Connect vm2 also since it may have been shutdown when logPerTest\n // is turned on\n vm2.invoke(new SerializableRunnable(\"connect vm2 if not connected\") {\n @Override\n public void run() {\n getCache();\n }\n });\n\n // Make VM0 the Grantor\n vm0.invoke(new SerializableRunnable(\"testLockBatchParticipantsUpdate: remote grantor init\") {\n @Override\n public void run() {\n try {\n Region rgn1 = getCache().getRegion(rgnName);\n final CacheTransactionManager txMgr2 = getCache().getCacheTransactionManager();\n assertEquals(\"val1\", rgn1.getEntry(\"key\").getValue());\n txMgr2.begin();\n rgn1.put(\"key\", \"val2\");\n txMgr2.commit();\n assertNotNull(TXLockService.getDTLS());\n assertTrue(TXLockService.getDTLS().isLockGrantor());\n } catch (CacheException e) {\n fail(\"While performing first transaction\");\n }\n }\n });\n\n // fix for bug 38843 causes the DTLS to be created in every TX participant\n assertNotNull(TXLockService.getDTLS());\n assertFalse(TXLockService.getDTLS().isLockGrantor());\n assertEquals(\"val2\", rgn.getEntry(\"key\").getValue());\n\n // Build sets of System Ids and set them up on VM0 for future batch member checks\n HashSet txMembers = new HashSet(4);\n txMembers.add(getSystemId());\n txMembers.add(vm0.invoke(TXDistributedDUnitTest::getSystemId));\n vm0.invoke(() -> TXDistributedDUnitTest.setPreTXSystemIds(txMembers));\n txMembers.add(vm2.invoke(TXDistributedDUnitTest::getSystemId));\n vm0.invoke(() -> TXDistributedDUnitTest.setPostTXSystemIds(txMembers));\n\n // Don't include the tx host in the batch member set(s)\n Serializable vm1HostId = vm1.invoke(TXDistributedDUnitTest::getSystemId);\n vm0.invoke(() -> TXDistributedDUnitTest.setTXHostSystemId(vm1HostId));\n\n // Create a TX on VM1 (such that it will ask for locks on VM0) that uses the callbacks\n // to pause and give us time to start a GII process on another VM\n vm1.invoke(new SerializableRunnable(\n \"testLockBatchParticipantsUpdate: slow tx (one that detects new member)\") {\n @Override\n public void run() {\n // fix for bug 38843 causes the DTLS to be created in every TX participant\n assertNotNull(TXLockService.getDTLS());\n assertFalse(TXLockService.getDTLS().isLockGrantor());\n\n PausibleTX pauseTXRunnable = new PausibleTX();\n pauseTXRunnable.rgnName = rgnName;\n pauseTXRunnable.myCache = getCache();\n pauseTXRunnable.key = \"key\";\n pauseTXRunnable.value = \"val3\";\n new Thread(pauseTXRunnable, \"PausibleTX Thread\").start();\n synchronized (PausibleTX.class) {\n while (!pauseTXRunnable.getIsRunning()) {\n try {\n PausibleTX.class.wait();\n } catch (InterruptedException ie) {\n fail(\"Did not expect \" + ie);\n }\n }\n }\n }\n });\n\n // Verify that the lock batch exists VM0 and has the size we expect\n vm0.invoke(new SerializableRunnable(\n \"testLockBatchParticipantsUpdate: Verify lock batch exists on VM0 with expected size\") {\n @Override\n public void run() {\n getCache().getRegion(rgnName);\n TXLockServiceImpl dtls = (TXLockServiceImpl) TXLockService.getDTLS();\n assertNotNull(dtls);\n assertTrue(dtls.isLockGrantor());\n DLockService dLockSvc = dtls.getInternalDistributedLockService();\n assertNotNull(TXDistributedDUnitTest.txHostId);\n DLockBatch[] batches = dLockSvc.getGrantor()\n .getLockBatches((InternalDistributedMember) TXDistributedDUnitTest.txHostId);\n assertEquals(batches.length, 1);\n TXLockBatch txLockBatch = (TXLockBatch) batches[0];\n assertNotNull(txLockBatch);\n assertNotNull(TXDistributedDUnitTest.preTXSystemIds);\n assertTrue(\n \"Members in lock batch \" + txLockBatch.getParticipants() + \" not the same as \"\n + TXDistributedDUnitTest.preTXSystemIds,\n txLockBatch.getParticipants().equals(TXDistributedDUnitTest.preTXSystemIds));\n }\n });\n\n // Start a GII process on VM2\n vm2.invoke(new SerializableRunnable(\"testLockBatchParticipantsUpdate: start GII\") {\n @Override\n public void run() {\n try {\n AttributesFactory factory = new AttributesFactory();\n factory.setScope(Scope.DISTRIBUTED_ACK);\n factory.setEarlyAck(false);\n factory.setDataPolicy(DataPolicy.REPLICATE);\n getCache().createRegion(rgnName, factory.create());\n } catch (CacheException e) {\n Assert.fail(\"While creating region\", e);\n }\n }\n });\n\n // Notify TX on VM1 so that it can continue\n vm1.invoke(\n new SerializableRunnable(\"testLockBatchParticipantsUpdate: Notfiy VM1 TX to continue\") {\n @Override\n public void run() {\n synchronized (PausibleTX.class) {\n // Notify VM1 that it should proceed to the TX send\n PausibleTX.class.notifyAll();\n // Wait until VM1 has sent the TX\n try {\n PausibleTX.class.wait();\n } catch (InterruptedException ie) {\n fail(\"Did not expect \" + ie);\n }\n }\n }\n });\n\n // Verify that the batch on VM0 has added VM2 into the set\n vm0.invoke(new SerializableRunnable(\n \"testLockBatchParticipantsUpdate: Verify lock batch contains VM2\") {\n @Override\n public void run() {\n getCache().getRegion(rgnName);\n TXLockServiceImpl dtls = (TXLockServiceImpl) TXLockService.getDTLS();\n assertNotNull(dtls);\n assertTrue(dtls.isLockGrantor());\n DLockService dLockSvc = dtls.getInternalDistributedLockService();\n assertNotNull(TXDistributedDUnitTest.txHostId);\n DLockBatch[] batches = dLockSvc.getGrantor()\n .getLockBatches((InternalDistributedMember) TXDistributedDUnitTest.txHostId);\n assertEquals(batches.length, 1);\n TXLockBatch txLockBatch = (TXLockBatch) batches[0];\n assertNotNull(txLockBatch);\n assertNotNull(TXDistributedDUnitTest.preTXSystemIds);\n assertTrue(\n \"Members in lock batch \" + txLockBatch.getParticipants() + \" not the same as \"\n + TXDistributedDUnitTest.postTXSystemIds,\n txLockBatch.getParticipants().equals(TXDistributedDUnitTest.postTXSystemIds));\n }\n });\n // fix for bug 38843 causes the DTLS to be created in every TX participant\n assertNotNull(TXLockService.getDTLS());\n assertFalse(TXLockService.getDTLS().isLockGrantor());\n assertEquals(\"val3\", rgn.getEntry(\"key\").getValue());\n\n\n // Notify TX on VM1 that it can go ahead and complete the TX\n vm1.invoke(\n new SerializableRunnable(\"testLockBatchParticipantsUpdate: Notfiy VM1 TX to finish\") {\n @Override\n public void run() {\n synchronized (PausibleTX.class) {\n // Notify VM1 that it should finish the TX\n PausibleTX.class.notifyAll();\n }\n }\n });\n\n\n rgn.destroyRegion();\n }", "@Test (timeout=180000)\n public void testNotInHdfs() throws Exception {\n TableName table =\n TableName.valueOf(\"tableNotInHdfs\");\n try {\n setupTable(table);\n assertEquals(ROWKEYS.length, countRows());\n\n // make sure data in regions, if in wal only there is no data loss\n admin.flush(table);\n\n // Mess it up by leaving a hole in the hdfs data\n deleteRegion(conf, tbl.getTableDescriptor(), Bytes.toBytes(\"B\"),\n Bytes.toBytes(\"C\"), false, false, true); // don't rm meta\n\n HBaseFsck hbck = doFsck(conf, false);\n assertErrors(hbck, new ERROR_CODE[] {ERROR_CODE.NOT_IN_HDFS});\n // holes are separate from overlap groups\n assertEquals(0, hbck.getOverlapGroups(table).size());\n\n // fix hole\n doFsck(conf, true);\n\n // check that hole fixed\n assertNoErrors(doFsck(conf,false));\n assertEquals(ROWKEYS.length - 2, countRows());\n } finally {\n cleanupTable(table);\n }\n }", "public boolean shouldHaveArrivedEarlier(int sID){\n Student s = (Student) Thread.currentThread();\n \tCommunicationChannel com = new CommunicationChannel (serverHostName, serverPortNumb);\n \tObject[] params = new Object[0];\n \tObject[] state_fields = new Object[2];\n \tstate_fields[0] = s.getID();\n \tstate_fields[1] = s.getStudentState();\n \t\n Message m_toServer = new Message(11, params, 0, state_fields, 2, null); \n Message m_fromServer; \n \n while (!com.open ()){ \n \ttry{ \n \t\tThread.currentThread ();\n \t\tThread.sleep ((long) (10));\n \t}\n \tcatch (InterruptedException e) {}\n }\n \n com.writeObject (m_toServer);\n \n m_fromServer = (Message) com.readObject(); \n \n s.setState((int) m_fromServer.getStateFields()[1]);\n boolean result = (Boolean) m_fromServer.getReturnValue();\n \n com.close ();\n return result;\n }", "void downgradeToReadLocks();", "@Test\n public void mixedSSTableFailure() throws Exception\n {\n cfs.getCompactionStrategyManager().disable();\n QueryProcessor.executeInternal(\"INSERT INTO ks.tbl (k, v) VALUES (1, 1);\");\n Util.flush(cfs);\n QueryProcessor.executeInternal(\"INSERT INTO ks.tbl (k, v) VALUES (2, 2);\");\n Util.flush(cfs);\n QueryProcessor.executeInternal(\"INSERT INTO ks.tbl (k, v) VALUES (3, 3);\");\n Util.flush(cfs);\n QueryProcessor.executeInternal(\"INSERT INTO ks.tbl (k, v) VALUES (4, 4);\");\n Util.flush(cfs);\n\n List<SSTableReader> sstables = new ArrayList<>(cfs.getLiveSSTables());\n Assert.assertEquals(4, sstables.size());\n\n SSTableReader unrepaired = sstables.get(0);\n SSTableReader repaired = sstables.get(1);\n SSTableReader pending1 = sstables.get(2);\n SSTableReader pending2 = sstables.get(3);\n\n mutateRepaired(repaired, FBUtilities.nowInSeconds(), ActiveRepairService.NO_PENDING_REPAIR, false);\n mutateRepaired(pending1, UNREPAIRED_SSTABLE, nextTimeUUID(), false);\n mutateRepaired(pending2, UNREPAIRED_SSTABLE, nextTimeUUID(), false);\n\n LifecycleTransaction txn = null;\n List<SSTableReader> toCompact = new ArrayList<>(sstables);\n for (int i=0; i<sstables.size(); i++)\n {\n try\n {\n txn = cfs.getTracker().tryModify(sstables, OperationType.COMPACTION);\n Assert.assertNotNull(txn);\n CompactionTask task = new CompactionTask(cfs, txn, 0);\n Assert.fail(\"Expected IllegalArgumentException\");\n }\n catch (IllegalArgumentException e)\n {\n // expected\n }\n finally\n {\n if (txn != null)\n txn.abort();\n }\n Collections.rotate(toCompact, 1);\n }\n }", "protected void checkUpdate() {\n \t\t// only update from remote server every so often.\n \t\tif ( ( System.currentTimeMillis() - lastUpdated ) > refreshInterval ) return;\n \t\t\n \t\tClusterTask task = getSessionUpdateTask();\n \t\tObject o = CacheFactory.doSynchronousClusterTask( task, this.nodeId );\n \t\tthis.copy( (Session) o );\n \t\t\n \t\tlastUpdated = System.currentTimeMillis();\n \t}", "private static void sendReadWriteRequests() throws IOException {\n\t\t\n\t\tScanner input = new Scanner(System.in);\n\t\tString cmdLine = null;\n\t\tSystem.out.println(\"Read: R <consistency_level> <Key_int> Write: W <consistency_level> <Key_int> <Value_String>\");\n\t\tSystem.out.println(\"Type <exit> to exit\");\n\t\twhile(!(cmdLine = input.nextLine().trim().toLowerCase()).equals(\"exit\")) {\n\t\t\tString[] args = cmdLine.split(\" \");\n\t\t\tif(args.length ==3 || args.length>=4 ) {\n\t\t\t\t\n\t\t\t\tif(args[0].equals(\"r\") || args[0].equals(\"w\")) {\n\t\t\t\t\t\n\t\t\t\t\ttry {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tsocket = new Socket(coordIp,coordPort);\n\t\t\t\t\t\t} catch (UnknownHostException e) {\n\t\t\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\t\t\tSystem.out.println(\"Coordinator not available\");\n\t\t\t\t\t\t\tif(socket!=null) {\n\t\t\t\t\t\t\t\tsocket.close();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\t\tSystem.out.println(\"Coordinator not available\");\n\t\t\t\t\t\t\tif(socket!=null) {\n\t\t\t\t\t\t\t\tsocket.close();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(args[0].equals(\"r\") && args.length==3) { // READ BLOCK: READ CMD AND RECIEVE RETURNED VALUE HERE\n\t\t\t\t\t\t\tint cLevel = Integer.parseInt(args[1]);\n\t\t\t\t\t\t\tint key = Integer.parseInt(args[2]);\n\t\t\t\t\t\t\tif(key < 0) {\n\t\t\t\t\t\t\t\tSystem.out.println(\"Enter valid key between 0 to 255 (inclusive)\");\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tCasandra.ReadValue readMsg = Casandra.ReadValue.newBuilder().setKey(key).setLevel(cLevel).build();\n\t\t\t\t\t\t\tCasandra.NodeMessage nodeMsg = Casandra.NodeMessage.newBuilder().setReadValue(readMsg).build();\n\t\t\t\t\t\t\tnodeMsg.writeDelimitedTo(socket.getOutputStream());\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tCasandra.NodeMessage nodeMsgReadValue = Casandra.NodeMessage.parseDelimitedFrom(socket.getInputStream());\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif(nodeMsgReadValue.hasReturnVal()) { // If valid response is returned\n\t\t\t\t\t\t\t\tCasandra.ReturnVal retMsg = nodeMsgReadValue.getReturnVal();\n\t\t\t\t\t\t\t\tSystem.out.println(\"Value for key \"+key+ \" is \"+retMsg.getValue());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if(nodeMsgReadValue.hasSystemException()){ // If exception has occured\n\t\t\t\t\t\t\t\tSystem.out.println(\"Exception occured: \"+nodeMsgReadValue.getSystemException().getMessage());\n\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\t\n\t\t\t\t\t\telse if(args[0].equals(\"w\") && args.length>=4) { // WRITE BLOCK: WRITE CMD AND RECIEVE ACK HERE\n\t\t\t\t\t\t\tint cLevel = Integer.parseInt(args[1]);\n\t\t\t\t\t\t\tint key = Integer.parseInt(args[2]);\n\t\t\t\t\t\t\tif(key < 0) {\n\t\t\t\t\t\t\t\tSystem.out.println(\"Enter valid key between 0 to 255 (inclusive)\");\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tString value = args[3];\n\t\t\t\t\t\t\tfor(int i=4;i<args.length;i++) {\n\t\t\t\t\t\t\t\tvalue+=\" \"+args[i];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tCasandra.Put writeMsg = Casandra.Put.newBuilder().setKey(key).setLevel(cLevel).setValue(value).build();\n\t\t\t\t\t\t\tCasandra.NodeMessage nodeMsg = Casandra.NodeMessage.newBuilder().setPut(writeMsg).build();\n\t\t\t\t\t\t\tnodeMsg.writeDelimitedTo(socket.getOutputStream());\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tCasandra.NodeMessage nodeMsgReadValue = Casandra.NodeMessage.parseDelimitedFrom(socket.getInputStream());\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif(nodeMsgReadValue.hasAckWrite()) { // If valid response is returned\n\t\t\t\t\t\t\t\tCasandra.AckWrite ackWrite = nodeMsgReadValue.getAckWrite();\n\t\t\t\t\t\t\t\tSystem.out.println(\"Key value was successfully inserted: \"+ackWrite.getFrom());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if(nodeMsgReadValue.hasSystemException()){ //If exception has occured\n\t\t\t\t\t\t\t\tSystem.out.println(\"Exception occured: \"+nodeMsgReadValue.getSystemException().getMessage());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tSystem.err.println(\"Invalid input format\");\n\t\t\t\t\t\t\t//continue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsocket.close();\n\t\t\t\t\t}\n\t\t\t\t\tcatch(NumberFormatException nfe) {\n\t\t\t\t\t\tSystem.err.println(\"Invalid input format\");\n\t\t\t\t\t\t//continue;\n\t\t\t\t\t}\n\t\t\t\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tSystem.err.println(\"Invalid input format\");\n\t\t\t\t\t//continue;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\telse {\n\t\t\t\tSystem.err.println(\"Invalid input format\");\n\t\t\t\t//continue;\n\t\t\t}\n\t\t\tif(socket!=null)\n\t\t\t\tsocket.close();\n\t\t\t\n\t\t}\n\t\t\n\t\tinput.close();\n\t\tif(socket!=null)\n\t\tsocket.close();\n\t\t\n\t\t\n\t\t\n\t\t\n\t}", "private void concurrencyWrites2() {\n\t\ttry {\n\t\t\tlog.info(\"Starting TrxTableClient5: concurrencyWrites2\");\n\t\t\tlog.info(\"main--put[v1]\");\n\t\t\tlog.info(\"t1-----------beginTrans---put[v2]---------------------------commit\");\n\t\t\tlog.info(\"t2-------------------------------------beginTrans---put[v3]----------abort\");\n\t\t\tlog.info(\"main---get[v2]\");\n\t\t\tSsccTableClientUtils.initialize();\n\t\t\tputValue();\n\n\t\t\tfinal P0Trx11 t1 = new P0Trx11();\n\t\t\tfinal P0Trx12 t2 = new P0Trx12();\n\n\t\t\tnew Thread(new Runnable() {\n\t\t\t\t@Override\n\t\t\t\tpublic void run() {\n\t\t\t\t\tt1.doWork();\n\t\t\t\t\tlog.info(\" Trx1 finished\");\n\t\t\t\t\tcdl2.countDown();\n\t\t\t\t}\n\t\t\t}, \"Trx1\").start();\n\n\t\t\t// to make sure t2 is later than t1\n\t\t\ttry {\n\t\t\t\tThread.sleep(1000);\n\n\t\t\t} catch (InterruptedException e1) {\n\t\t\t\te1.printStackTrace();\n\t\t\t}\n\n\t\t\tnew Thread(new Runnable() {\n\t\t\t\t@Override\n\t\t\t\tpublic void run() {\n\t\t\t\t\tt2.doWork();\n\t\t\t\t\tlog.info(\" Trx2 finished\");\n\t\t\t\t\tcdl2.countDown();\n\t\t\t\t}\n\t\t\t}, \"Trx2\").start();\n\n\t\t\tcdl2.await();\n\n\t\t\tSsccTableClientUtils.testSsccBeginTransaction();\n\t\t\tInteger[] result = SsccTableClientUtils.testSsccGet();\n\t\t\tSsccTableClientUtils.testSsccCommitIfPossible();\n\t\t\tlog.info(\"Finish TrxTableClient5: concurrencyWrites2\");\n\n\t\t\tif (result.length == 1 && result[0] == 2) {\n\t\t\t\tsuccessNum++;\n\t\t\t\tlog.info(\"=========================================\");\n\t\t\t\tlog.info(\" \");\n\t\t\t\tlog.info(\"SUCCESS\");\n\t\t\t\tlog.info(\" \");\n\t\t\t\tlog.info(\"=========================================\");\n\t\t\t} else {\n\t\t\t\tlog.info(\"=========================================\");\n\t\t\t\tlog.info(\" \");\n\t\t\t\tlog.info(\"FAILURE\");\n\t\t\t\tlog.info(\" \");\n\t\t\t\tlog.info(\"=========================================\");\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "@Test\n public void reregisterWithDelete() throws Exception {\n // Register the worker so the worker is marked active in master\n long workerId = mBlockMaster.getWorkerId(NET_ADDRESS_1);\n List<RegisterWorkerPRequest> requestChunks =\n RegisterStreamTestUtils.generateRegisterStreamForWorker(workerId);\n prepareBlocksOnMaster(requestChunks);\n Queue<Throwable> errorQueue = new ConcurrentLinkedQueue<>();\n sendStreamToMaster(requestChunks,\n RegisterStreamTestUtils.getErrorCapturingResponseObserver(errorQueue));\n assertEquals(0, errorQueue.size());\n assertEquals(1, mBlockMaster.getWorkerCount());\n\n // Find a block to remove\n long blockToRemove = RegisterStreamTestUtils.findFirstBlock(requestChunks);\n\n // Register again\n CountDownLatch latch = new CountDownLatch(1);\n Queue<Throwable> newErrorQueue = new ConcurrentLinkedQueue<>();\n Future f = mExecutorService.submit(() -> {\n sendStreamToMasterAndSignal(requestChunks,\n RegisterStreamTestUtils.getErrorCapturingResponseObserver(newErrorQueue), latch);\n });\n\n // During the register stream, trigger a delete on worker\n latch.await();\n mBlockMaster.removeBlocks(ImmutableList.of(blockToRemove), true);\n\n // Wait for the register to finish\n f.get();\n\n assertThrows(BlockInfoException.class, () -> {\n mBlockMaster.getBlockInfo(blockToRemove);\n });\n MasterWorkerInfo worker = mBlockMaster.getWorker(workerId);\n assertEquals(1, mBlockMaster.getWorkerCount());\n assertEquals(TIER_BLOCK_TOTAL - 1, worker.getBlockCount());\n\n // BlockMaster.removeBlocks() will first remove the block from master metadata\n // (with block lock) then update the block locations (with worker lock).\n // The worker lock is being held by the registering worker, but the 1st part\n // will likely succeed.\n // So during registration when checking on the block, the block is not recognized\n // any more and will remain in MasterWorkerInfo.mToRemoveBlocks.\n // In the next heartbeat the master will issue a command to remove the block\n // from the worker.\n // Even if the block is already removed on the worker it is fine,\n // because deletion of a not-found block is a noop.\n Command command = sendHeartbeatToMaster(workerId);\n assertEquals(Command.newBuilder()\n .addData(blockToRemove).setCommandType(CommandType.Free).build(), command);\n }", "public void checkReadLock() {\r\n return;\r\n }", "@Test(timeout = 30000)\n public void testConcurrentWriteAndDeleteBlock() throws Exception {\n final int numBlocks = 1000;\n final int threadCount = 10;\n // Generate data blocks.\n ExecutorService pool = Executors.newFixedThreadPool(threadCount);\n List<Future<?>> futureList = new ArrayList<>();\n Random random = new Random();\n // Random write block and delete half of them.\n for (int i = 0; i < threadCount; i++) {\n Thread thread = new Thread() {\n @Override\n public void run() {\n try {\n String bpid = BLOCK_POOL_IDS[random.nextInt(BLOCK_POOL_IDS.length)];\n for (int blockId = 0; blockId < numBlocks; blockId++) {\n ExtendedBlock eb = new ExtendedBlock(bpid, blockId);\n ReplicaHandler replica = null;\n try {\n replica = dataset.createRbw(StorageType.DEFAULT, null, eb,\n false);\n if (blockId % 2 > 0) {\n dataset.invalidate(bpid, new Block[]{eb.getLocalBlock()});\n }\n } finally {\n if (replica != null) {\n replica.close();\n }\n }\n }\n // Just keep final consistency no need to care exception.\n } catch (Exception ignore) {}\n }\n };\n thread.setName(\"AddBlock\" + i);\n futureList.add(pool.submit(thread));\n }\n // Wait for data generation\n for (Future<?> f : futureList) {\n f.get();\n }\n // Wait for the async deletion task finish.\n GenericTestUtils.waitFor(() -> dataset.asyncDiskService.countPendingDeletions() == 0,\n 100, 10000);\n for (String bpid : dataset.volumeMap.getBlockPoolList()) {\n assertEquals(numBlocks / 2, dataset.volumeMap.size(bpid));\n }\n }", "@Test\n public void processUpdates_Test() throws Exception {\n try {\n System.out.println(\"processUpdates_Test\");\n\n\n persistManager_Server.registerPersistenceEventListener(PersistenceEventType.Server_Event_ProcessedChunk,\n new PersistentMatricesManager_EventListener() {\n\n public void eventOccurred(PersistentMatricesManager persistenceMatrixManager, PersistenceEventType eventType, Object... eventParams)\n throws Exception_PersistenceEventHandler {\n try {\n serverEvent_ProcessedChunk((Integer)eventParams[0], (File)eventParams[1], (Long)eventParams[2]);\n } catch(Exception e) {\n throw new Exception_PersistenceEventHandler(\"Had ERROR!\", e);\n }\n }\n }\n );\n\n persistManager_Server.registerPersistenceEventListener(PersistenceEventType.Server_Event_ShutDownRequestCompleted,\n new PersistentMatricesManager_EventListener() {\n\n public void eventOccurred(PersistentMatricesManager persistenceMatrixManager, PersistenceEventType eventType, Object... eventParams)\n throws Exception_PersistenceEventHandler {\n try {\n serverEvent_ShutdownRequestCompleted();\n } catch(Exception e) {\n throw new Exception_PersistenceEventHandler(\"Had ERROR!\", e);\n }\n }\n }\n );\n\n super.register_PersistenceMatrixGeneration_ServerEvents();\n\n\n // Wait until all the chunks have been processed\n synchronized(testThread_LockObject) {\n testThread_LockObject.wait();\n }\n System.out.println(\"Waiting for server to terminate inbox monitor thread...\");\n persistManager_Server.awaitTermination();\n // sleep for a couple of secs, in case multiThreaded_AssertEquals() has had an assert failure,\n // is stopping the server, and doing any last operations.\n Thread.sleep(3000);\n\n System.out.println(\"...Test stopped.\");\n\n\n } catch (Exception e) {\n stopPersistenceServer();\n throw e;\n }\n\n }", "private static boolean checkIfToUpdateAfterCreateFailed(LocalRegion rgn, EntryEventImpl ev) {\n boolean doUpdate = true;\n if (ev.oldValueIsDestroyedToken()) {\n if (rgn.getVersionVector() != null && ev.getVersionTag() != null) {\n rgn.getVersionVector().recordVersion(\n (InternalDistributedMember) ev.getDistributedMember(), ev.getVersionTag());\n }\n doUpdate = false;\n }\n if (ev.isConcurrencyConflict()) {\n if (logger.isDebugEnabled()) {\n logger.debug(\"basicUpdate failed with CME, not to retry:\" + ev);\n }\n doUpdate = false;\n }\n return doUpdate;\n }", "public boolean sync() throws VlException \n\t{\n\t return false; \n\t}", "public boolean isConsistent() throws Exception {\n Set<BucketMessage> unconfirmed = messageHandler.getUnconfirmedMessages(receivingPartyID);\n for (BucketMessage temp : unconfirmed) {\n Tuple2<byte[], BigInteger> result = contract.readMessage(sessionID, BigInteger.valueOf(sendingPartyID), BigInteger.valueOf(receivingPartyID),\n BigInteger.valueOf(temp.getMsgNum())).send();\n if (!result.component1().equals(temp.getMsg())) return false;\n if (!result.component2().equals(temp.getBlock()))\n messageHandler.storeMessage(result.component1(), temp.getMsgNum(), receivingPartyID, temp.getBlock()); //restore with the new block\n }\n\n return true;\n }", "@Test\n void renewSessionLockNoSessionId() {\n // Act & Assert\n StepVerifier.create(managementChannel.renewSessionLock(null, LINK_NAME))\n .verifyError(NullPointerException.class);\n\n StepVerifier.create(managementChannel.renewSessionLock(\"\", LINK_NAME))\n .verifyError(IllegalArgumentException.class);\n\n verifyNoInteractions(requestResponseChannel);\n }", "@Test\n public void testSynchronizeNotPaired() throws AuthException, IOException {\n presenter.synchronize();\n try {\n presenter.syncingThread.join();\n } catch (InterruptedException e) {}\n assertEquals(SyncStatusEnum.PREAUTHED, presenter.status);\n }", "public boolean needsResend(){\n return this.getNumNetworkCopies()-this.replicationDegree<0;\n }", "protected boolean upgradeLocks() {\n \t\treturn false;\n \t}", "@Test\n\tpublic void test_synchronization() throws InterruptedException, ExecutionException {\n\t\t\n\t\tIkanowV1SyncService_LibraryJars s1 = new IkanowV1SyncService_LibraryJars(BeanTemplateUtils.clone(_service_config).with(\"v1_enabled\", true).done(), \n\t\t\t\t_service_context);\n\t\tIkanowV1SyncService_LibraryJars s2 = new IkanowV1SyncService_LibraryJars(BeanTemplateUtils.clone(_service_config).with(\"v1_enabled\", true).done(), \n\t\t\t\t_service_context);\n\t\tIkanowV1SyncService_LibraryJars s3 = new IkanowV1SyncService_LibraryJars(BeanTemplateUtils.clone(_service_config).with(\"v1_enabled\", true).done(), \n\t\t\t\t_service_context);\n\t\t\n\t\tint old = IkanowV1SyncService_LibraryJars._num_leader_changes;\n\t\t\n\t\ts1.start(); s2.start(); s3.start();\n\t\tfor (int i = 0; i < 4; ++i) {\n\t\t\ttry { Thread.sleep(1000); } catch (Exception e) {}\n\t\t}\n\t\ts1.stop(); s2.stop(); s3.stop();\n\t\t\n\t\tassertEquals(old + 1, IkanowV1SyncService_LibraryJars._num_leader_changes);\n\t\t\n\t\t@SuppressWarnings(\"unchecked\")\n\t\tfinal ICrudService<JsonNode> v1_config_db = _service_context.getCoreManagementDbService().getUnderlyingPlatformDriver(ICrudService.class, Optional.of(\"social.share\")).get();\t\t\t\t\n\t\t\n\t\tassertTrue(\"Query optimized\", v1_config_db.deregisterOptimizedQuery(Arrays.asList(\"title\")));\n\t\t\n\t}", "@Test(timeout = 60000)\n public void testRemoveVolumeBeingWritten() throws Exception {\n final ExtendedBlock eb = new ExtendedBlock(BLOCK_POOL_IDS[0], 0);\n final CountDownLatch startFinalizeLatch = new CountDownLatch(1);\n final CountDownLatch blockReportReceivedLatch = new CountDownLatch(1);\n final CountDownLatch volRemoveStartedLatch = new CountDownLatch(1);\n final CountDownLatch volRemoveCompletedLatch = new CountDownLatch(1);\n class BlockReportThread extends Thread {\n public void run() {\n // Lets wait for the volume remove process to start\n try {\n volRemoveStartedLatch.await();\n } catch (Exception e) {\n LOG.info(\"Unexpected exception when waiting for vol removal:\", e);\n }\n LOG.info(\"Getting block report\");\n dataset.getBlockReports(eb.getBlockPoolId());\n LOG.info(\"Successfully received block report\");\n blockReportReceivedLatch.countDown();\n }\n }\n\n class ResponderThread extends Thread {\n public void run() {\n try (ReplicaHandler replica = dataset\n .createRbw(StorageType.DEFAULT, null, eb, false)) {\n LOG.info(\"CreateRbw finished\");\n startFinalizeLatch.countDown();\n\n // Slow down while we're holding the reference to the volume.\n // As we finalize a block, the volume is removed in parallel.\n // Ignore any interrupts coming out of volume shutdown.\n try {\n Thread.sleep(1000);\n } catch (InterruptedException ie) {\n LOG.info(\"Ignoring \", ie);\n }\n\n // Lets wait for the other thread finish getting block report\n blockReportReceivedLatch.await();\n\n dataset.finalizeBlock(eb, false);\n LOG.info(\"FinalizeBlock finished\");\n } catch (Exception e) {\n LOG.warn(\"Exception caught. This should not affect the test\", e);\n }\n }\n }\n\n class VolRemoveThread extends Thread {\n public void run() {\n Set<StorageLocation> volumesToRemove = new HashSet<>();\n try {\n volumesToRemove.add(dataset.getVolume(eb).getStorageLocation());\n } catch (Exception e) {\n LOG.info(\"Problem preparing volumes to remove: \", e);\n Assert.fail(\"Exception in remove volume thread, check log for \" +\n \"details.\");\n }\n LOG.info(\"Removing volume \" + volumesToRemove);\n dataset.removeVolumes(volumesToRemove, true);\n volRemoveCompletedLatch.countDown();\n LOG.info(\"Removed volume \" + volumesToRemove);\n }\n }\n\n // Start the volume write operation\n ResponderThread responderThread = new ResponderThread();\n responderThread.start();\n startFinalizeLatch.await();\n\n // Start the block report get operation\n final BlockReportThread blockReportThread = new BlockReportThread();\n blockReportThread.start();\n\n // Start the volume remove operation\n VolRemoveThread volRemoveThread = new VolRemoveThread();\n volRemoveThread.start();\n\n // Let volume write and remove operation be\n // blocked for few seconds\n Thread.sleep(2000);\n\n // Signal block report receiver and volume writer\n // thread to complete their operations so that vol\n // remove can proceed\n volRemoveStartedLatch.countDown();\n\n // Verify if block report can be received\n // when volume is in use and also being removed\n blockReportReceivedLatch.await();\n\n // Verify if volume can be removed safely when there\n // are read/write operation in-progress\n volRemoveCompletedLatch.await();\n }", "@Test\n public void testRemoveCorruptedPendingCleanAction() throws IOException {\n HoodieCLI.conf = hadoopConf();\n\n Configuration conf = HoodieCLI.conf;\n\n HoodieTableMetaClient metaClient = HoodieCLI.getTableMetaClient();\n\n // Create four requested files\n for (int i = 100; i < 104; i++) {\n String timestamp = String.valueOf(i);\n // Write corrupted requested Clean File\n HoodieTestCommitMetadataGenerator.createEmptyCleanRequestedFile(tablePath, timestamp, conf);\n }\n\n // reload meta client\n metaClient = HoodieTableMetaClient.reload(metaClient);\n // first, there are four instants\n assertEquals(4, metaClient.getActiveTimeline().filterInflightsAndRequested().getInstants().count());\n\n CommandResult cr = shell().executeCommand(\"repair corrupted clean files\");\n assertTrue(cr.isSuccess());\n\n // reload meta client\n metaClient = HoodieTableMetaClient.reload(metaClient);\n assertEquals(0, metaClient.getActiveTimeline().filterInflightsAndRequested().getInstants().count());\n }", "@Override\n\tpublic boolean tryLock() {\n\t\treturn false;\n\t}", "@Override\n\tpublic boolean tryLock() {\n\t\treturn false;\n\t}", "@Override\n\tpublic void checkUpdateClient() {\n\t}", "@Test (timeout=180000)\n public void testLingeringSplitParent() throws Exception {\n TableName table =\n TableName.valueOf(\"testLingeringSplitParent\");\n Table meta = null;\n try {\n setupTable(table);\n assertEquals(ROWKEYS.length, countRows());\n\n // make sure data in regions, if in wal only there is no data loss\n admin.flush(table);\n HRegionLocation location = tbl.getRegionLocation(\"B\");\n\n // Delete one region from meta, but not hdfs, unassign it.\n deleteRegion(conf, tbl.getTableDescriptor(), Bytes.toBytes(\"B\"),\n Bytes.toBytes(\"C\"), true, true, false);\n\n // Create a new meta entry to fake it as a split parent.\n meta = connection.getTable(TableName.META_TABLE_NAME, tableExecutorService);\n HRegionInfo hri = location.getRegionInfo();\n\n HRegionInfo a = new HRegionInfo(tbl.getName(),\n Bytes.toBytes(\"B\"), Bytes.toBytes(\"BM\"));\n HRegionInfo b = new HRegionInfo(tbl.getName(),\n Bytes.toBytes(\"BM\"), Bytes.toBytes(\"C\"));\n\n hri.setOffline(true);\n hri.setSplit(true);\n\n MetaTableAccessor.addRegionToMeta(meta, hri, a, b);\n meta.close();\n admin.flush(TableName.META_TABLE_NAME);\n\n HBaseFsck hbck = doFsck(conf, false);\n assertErrors(hbck, new ERROR_CODE[] {\n ERROR_CODE.LINGERING_SPLIT_PARENT, ERROR_CODE.HOLE_IN_REGION_CHAIN});\n\n // regular repair cannot fix lingering split parent\n hbck = doFsck(conf, true);\n assertErrors(hbck, new ERROR_CODE[] {\n ERROR_CODE.LINGERING_SPLIT_PARENT, ERROR_CODE.HOLE_IN_REGION_CHAIN });\n assertFalse(hbck.shouldRerun());\n hbck = doFsck(conf, false);\n assertErrors(hbck, new ERROR_CODE[] {\n ERROR_CODE.LINGERING_SPLIT_PARENT, ERROR_CODE.HOLE_IN_REGION_CHAIN});\n\n // fix lingering split parent\n hbck = new HBaseFsck(conf, hbfsckExecutorService);\n hbck.connect();\n hbck.setDisplayFullReport(); // i.e. -details\n hbck.setTimeLag(0);\n hbck.setFixSplitParents(true);\n hbck.onlineHbck();\n assertTrue(hbck.shouldRerun());\n hbck.close();\n\n Get get = new Get(hri.getRegionName());\n Result result = meta.get(get);\n assertTrue(result.getColumnCells(HConstants.CATALOG_FAMILY,\n HConstants.SPLITA_QUALIFIER).isEmpty());\n assertTrue(result.getColumnCells(HConstants.CATALOG_FAMILY,\n HConstants.SPLITB_QUALIFIER).isEmpty());\n admin.flush(TableName.META_TABLE_NAME);\n\n // fix other issues\n doFsck(conf, true);\n\n // check that all are fixed\n assertNoErrors(doFsck(conf, false));\n assertEquals(ROWKEYS.length, countRows());\n } finally {\n cleanupTable(table);\n IOUtils.closeQuietly(meta);\n }\n }", "public void testClusterJoinDespiteOfPublishingIssues() throws Exception {\n String clusterManagerNode = internalCluster().startClusterManagerOnlyNode();\n String nonClusterManagerNode = internalCluster().startDataOnlyNode();\n\n DiscoveryNodes discoveryNodes = internalCluster().getInstance(ClusterService.class, nonClusterManagerNode).state().nodes();\n\n TransportService clusterManagerTranspotService = internalCluster().getInstance(\n TransportService.class,\n discoveryNodes.getClusterManagerNode().getName()\n );\n\n logger.info(\"blocking requests from non cluster-manager [{}] to cluster-manager [{}]\", nonClusterManagerNode, clusterManagerNode);\n MockTransportService nonClusterManagerTransportService = (MockTransportService) internalCluster().getInstance(\n TransportService.class,\n nonClusterManagerNode\n );\n nonClusterManagerTransportService.addFailToSendNoConnectRule(clusterManagerTranspotService);\n\n assertNoClusterManager(nonClusterManagerNode);\n\n logger.info(\n \"blocking cluster state publishing from cluster-manager [{}] to non cluster-manager [{}]\",\n clusterManagerNode,\n nonClusterManagerNode\n );\n MockTransportService clusterManagerTransportService = (MockTransportService) internalCluster().getInstance(\n TransportService.class,\n clusterManagerNode\n );\n TransportService localTransportService = internalCluster().getInstance(\n TransportService.class,\n discoveryNodes.getLocalNode().getName()\n );\n if (randomBoolean()) {\n clusterManagerTransportService.addFailToSendNoConnectRule(\n localTransportService,\n PublicationTransportHandler.PUBLISH_STATE_ACTION_NAME\n );\n } else {\n clusterManagerTransportService.addFailToSendNoConnectRule(\n localTransportService,\n PublicationTransportHandler.COMMIT_STATE_ACTION_NAME\n );\n }\n\n logger.info(\n \"allowing requests from non cluster-manager [{}] to cluster-manager [{}], waiting for two join request\",\n nonClusterManagerNode,\n clusterManagerNode\n );\n final CountDownLatch countDownLatch = new CountDownLatch(2);\n nonClusterManagerTransportService.addSendBehavior(\n clusterManagerTransportService,\n (connection, requestId, action, request, options) -> {\n if (action.equals(JoinHelper.JOIN_ACTION_NAME)) {\n countDownLatch.countDown();\n }\n connection.sendRequest(requestId, action, request, options);\n }\n );\n\n nonClusterManagerTransportService.addConnectBehavior(clusterManagerTransportService, Transport::openConnection);\n\n countDownLatch.await();\n\n logger.info(\"waiting for cluster to reform\");\n clusterManagerTransportService.clearOutboundRules(localTransportService);\n nonClusterManagerTransportService.clearOutboundRules(localTransportService);\n\n ensureStableCluster(2);\n\n // shutting down the nodes, to avoid the leakage check tripping\n // on the states associated with the commit requests we may have dropped\n internalCluster().stopRandomNonClusterManagerNode();\n }", "@Test (timeout=180000)\n public void testFixHdfsHolesNotWorkingWithNoHdfsChecking() throws Exception {\n TableName table =\n TableName.valueOf(\"testFixHdfsHolesNotWorkingWithNoHdfsChecking\");\n try {\n setupTable(table);\n assertEquals(ROWKEYS.length, countRows());\n\n // Mess it up by creating an overlap in the metadata\n admin.disableTable(table);\n deleteRegion(conf, tbl.getTableDescriptor(), Bytes.toBytes(\"A\"),\n Bytes.toBytes(\"B\"), true, true, false, true, HRegionInfo.DEFAULT_REPLICA_ID);\n TEST_UTIL.getHBaseAdmin().enableTable(table);\n\n HRegionInfo hriOverlap =\n createRegion(tbl.getTableDescriptor(), Bytes.toBytes(\"A2\"), Bytes.toBytes(\"B\"));\n TEST_UTIL.getHBaseCluster().getMaster().assignRegion(hriOverlap);\n TEST_UTIL.getHBaseCluster().getMaster().getAssignmentManager()\n .waitForAssignment(hriOverlap);\n ServerName server = regionStates.getRegionServerOfRegion(hriOverlap);\n TEST_UTIL.assertRegionOnServer(hriOverlap, server, REGION_ONLINE_TIMEOUT);\n\n HBaseFsck hbck = doFsck(conf, false);\n assertErrors(hbck, new ERROR_CODE[] {\n ERROR_CODE.ORPHAN_HDFS_REGION, ERROR_CODE.NOT_IN_META_OR_DEPLOYED,\n ERROR_CODE.HOLE_IN_REGION_CHAIN});\n\n // verify that noHdfsChecking can't detect ORPHAN_HDFS_REGION\n HBaseFsck fsck = new HBaseFsck(conf, hbfsckExecutorService);\n fsck.connect();\n fsck.setDisplayFullReport(); // i.e. -details\n fsck.setTimeLag(0);\n fsck.setCheckHdfs(false);\n fsck.onlineHbck();\n assertErrors(fsck, new ERROR_CODE[] {\n ERROR_CODE.HOLE_IN_REGION_CHAIN});\n fsck.close();\n\n // verify that fixHdfsHoles doesn't work with noHdfsChecking\n fsck = new HBaseFsck(conf, hbfsckExecutorService);\n fsck.connect();\n fsck.setDisplayFullReport(); // i.e. -details\n fsck.setTimeLag(0);\n fsck.setCheckHdfs(false);\n fsck.setFixHdfsHoles(true);\n fsck.setFixHdfsOverlaps(true);\n fsck.setFixHdfsOrphans(true);\n fsck.onlineHbck();\n assertFalse(fsck.shouldRerun());\n assertErrors(fsck, new ERROR_CODE[] { ERROR_CODE.HOLE_IN_REGION_CHAIN});\n fsck.close();\n } finally {\n if (admin.isTableDisabled(table)) {\n admin.enableTable(table);\n }\n cleanupTable(table);\n }\n }", "@Test\n @Timeout(value = 30)\n public void testRemoveNodeDataChangedWatches() throws Exception {\n LOG.info(\"Adding data watcher using getData()\");\n List<EventType> expectedEvents = new ArrayList<>();\n expectedEvents.add(EventType.DataWatchRemoved);\n MyWatcher myWatcher = new MyWatcher(\"/testnode1\", expectedEvents, 1);\n\n zk.create(\"/testnode1\", \"data\".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);\n zk.getData(\"/testnode1\", myWatcher, null);\n\n String cmdstring = \"removewatches /testnode1 -d\";\n LOG.info(\"Remove watchers using shell command : {}\", cmdstring);\n zkMain.cl.parseCommand(cmdstring);\n assertTrue(zkMain.processZKCmd(zkMain.cl), \"Removewatches cmd fails to remove data watches\");\n\n LOG.info(\"Waiting for the DataWatchRemoved event\");\n myWatcher.matches();\n\n // verifying that other path data watches are removed\n assertEquals(0, zk.getDataWatches().size(), \"Data watches are not removed : \" + zk.getDataWatches());\n }", "@Test\n public void testClusterForgetNode() throws InterruptedException {\n node1.clusterMeet(\"127.0.0.1\", nodeInfo4.getPort());\n\n String node7Id = JedisClusterTestUtil.getNodeId(node4.clusterNodes());\n\n JedisClusterTestUtil.assertNodeIsKnown(node3, node7Id, 1000);\n JedisClusterTestUtil.assertNodeIsKnown(node2, node7Id, 1000);\n JedisClusterTestUtil.assertNodeIsKnown(node1, node7Id, 1000);\n\n assertNodeHandshakeEnded(node3, 1000);\n assertNodeHandshakeEnded(node2, 1000);\n assertNodeHandshakeEnded(node1, 1000);\n\n assertEquals(4, node1.clusterNodes().split(\"\\n\").length);\n assertEquals(4, node2.clusterNodes().split(\"\\n\").length);\n assertEquals(4, node3.clusterNodes().split(\"\\n\").length);\n\n // do cluster forget\n node1.clusterForget(node7Id);\n node2.clusterForget(node7Id);\n node3.clusterForget(node7Id);\n\n JedisClusterTestUtil.assertNodeIsUnknown(node1, node7Id, 1000);\n JedisClusterTestUtil.assertNodeIsUnknown(node2, node7Id, 1000);\n JedisClusterTestUtil.assertNodeIsUnknown(node3, node7Id, 1000);\n\n assertEquals(3, node1.clusterNodes().split(\"\\n\").length);\n assertEquals(3, node2.clusterNodes().split(\"\\n\").length);\n assertEquals(3, node3.clusterNodes().split(\"\\n\").length);\n }", "static void waitForBlockCommit() {\n try {\n Thread.sleep(5000);\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n }", "private void concurrencyWrites1() {\n\t\ttry {\n\t\t\tlog.info(\"Starting TrxTableClient5: concurrencyWrites1\");\n\t\t\tlog.info(\"main--put[v1]\");\n\t\t\tlog.info(\"t1-----------beginTrans---put[v2]---------------------------commit\");\n\t\t\tlog.info(\"t2-------------------------------------beginTrans---put[v3]----------commit\");\n\t\t\tlog.info(\"main---get[v2]\");\n\n\t\t\tSsccTableClientUtils.initialize();\n\t\t\tputValue();\n\n\t\t\tfinal P0Trx01 t1 = new P0Trx01();\n\t\t\tfinal P0Trx02 t2 = new P0Trx02();\n\n\t\t\tnew Thread(new Runnable() {\n\t\t\t\t@Override\n\t\t\t\tpublic void run() {\n\t\t\t\t\tt1.doWork();\n\t\t\t\t\tlog.info(\" Trx1 finished\");\n\t\t\t\t\tcdl.countDown();\n\t\t\t\t}\n\t\t\t}, \"Trx1\").start();\n\n\t\t\t// to make sure t2 is later than t1\n\t\t\ttry {\n\t\t\t\tThread.sleep(1000);\n\t\t\t} catch (InterruptedException e1) {\n\t\t\t\te1.printStackTrace();\n\t\t\t}\n\n\t\t\tnew Thread(new Runnable() {\n\t\t\t\t@Override\n\t\t\t\tpublic void run() {\n\t\t\t\t\tt2.doWork();\n\t\t\t\t\tlog.info(\" Trx2 finished\");\n\t\t\t\t\tcdl.countDown();\n\t\t\t\t}\n\t\t\t}, \"Trx2\").start();\n\n\t\t\tcdl.await();\n\t\t\tSsccTableClientUtils.testSsccBeginTransaction();\n\t\t\tInteger[] result = SsccTableClientUtils.testSsccGet();\n\t\t\tSsccTableClientUtils.testSsccCommitIfPossible();\n\t\t\tlog.info(\"Finish TrxTableClient5: concurrencyWrites1\");\n\n\t\t\tif (result.length == 1 && result[0] == 2) {\n\t\t\t\tsuccessNum++;\n\t\t\t\tlog.info(\"=========================================\");\n\t\t\t\tlog.info(\" \");\n\t\t\t\tlog.info(\"SUCCESS\");\n\t\t\t\tlog.info(\" \");\n\t\t\t\tlog.info(\"=========================================\");\n\t\t\t} else {\n\t\t\t\tlog.info(\"=========================================\");\n\t\t\t\tlog.info(\" \");\n\t\t\t\tlog.info(\"FAILURE\");\n\t\t\t\tlog.info(\" \");\n\t\t\t\tlog.info(\"=========================================\");\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "@Test\n public void testUpdateCheckpointBadConcurrencyToken() throws LeasingException {\n TestHarnessBuilder builder = new TestHarnessBuilder();\n builder.withLease(leaseKey, null).build();\n\n coordinator.runLeaseTaker();\n coordinator.runLeaseRenewer();\n Lease lease = coordinator.getCurrentlyHeldLease(leaseKey);\n\n assertNotNull(lease);\n\n ExtendedSequenceNumber newCheckpoint = new ExtendedSequenceNumber(\"newCheckpoint\");\n assertFalse(dynamoDBCheckpointer.setCheckpoint(lease.leaseKey(), newCheckpoint, UUID.randomUUID()));\n\n Lease fromDynamo = leaseRefresher.getLease(lease.leaseKey());\n\n // Owner should be the only thing that changed.\n lease.leaseOwner(coordinator.workerIdentifier());\n assertEquals(lease, fromDynamo);\n }", "@Test\n public void hangingWorkerSessionRecycled() throws Exception {\n long workerId = mBlockMaster.getWorkerId(NET_ADDRESS_1);\n List<RegisterWorkerPRequest> requestChunks =\n RegisterStreamTestUtils.generateRegisterStreamForWorker(workerId);\n prepareBlocksOnMaster(requestChunks);\n\n Queue<Throwable> errorQueue = new ConcurrentLinkedQueue<>();\n StreamObserver<RegisterWorkerPRequest> requestObserver =\n mHandler.registerWorkerStream(getErrorCapturingResponseObserver(errorQueue));\n\n // Feed the chunks into the requestObserver\n for (int i = 0; i < requestChunks.size(); i++) {\n RegisterWorkerPRequest chunk = requestChunks.get(i);\n // From the 2nd request on, the request will be rejected\n requestObserver.onNext(chunk);\n if (i == 0) {\n // Progress the clock so the worker stream expired\n mClock.addTime(Duration.of(100_000_000, ChronoUnit.MILLIS));\n // Sleep and wait for the stream recycler thread heartbeat\n CommonUtils.sleepMs(3000);\n }\n }\n // This will be rejected too\n requestObserver.onCompleted();\n // The 5 requests after expiry will be rejected\n // And the complete message will be rejected too\n // -1 because the 1st request was accepted\n // +1 because master sends the TimeoutException to worker on timeout\n // +count because all following requests are rejected\n // +1 because the onComplete() is also rejected\n assertEquals(requestChunks.size() - 1 + 1 + 1, errorQueue.size());\n\n // Verify the session is recycled\n assertEquals(0, mBlockMaster.getWorkerCount());\n\n // Verify the worker can re-register and be operated, so the locks are managed correctly\n verifyWorkerCanReregister(workerId, requestChunks, TIER_BLOCK_TOTAL);\n verifyWorkerWritable(workerId);\n }", "@Test(timeout = 4000)\n public void test109() throws Throwable {\n Boolean boolean0 = SQLUtil.mutatesDataOrStructure(\"alter sessionrefereznces\");\n assertNotNull(boolean0);\n assertFalse(boolean0);\n }", "private void catchUp(JournalStateMachine stateMachine, RaftJournalAppender client)\n throws TimeoutException, InterruptedException {\n long startTime = System.currentTimeMillis();\n long waitBeforeRetry =\n Configuration.getMs(PropertyKey.MASTER_EMBEDDED_JOURNAL_CATCHUP_RETRY_WAIT);\n // Wait for any outstanding snapshot to complete.\n CommonUtils.waitFor(\"snapshotting to finish\", () -> !stateMachine.isSnapshotting(),\n WaitForOptions.defaults().setTimeoutMs(10 * Constants.MINUTE_MS));\n OptionalLong endCommitIndex = OptionalLong.empty();\n try {\n // raft peer IDs are unique, so there should really only ever be one result.\n // If for some reason there is more than one..it should be fine as it only\n // affects the completion time estimate in the logs.\n synchronized (this) { // synchronized to appease findbugs; shouldn't make any difference\n RaftPeerId serverId = mServer.getId();\n Optional<RaftProtos.CommitInfoProto> commitInfo = getGroupInfo().getCommitInfos().stream()\n .filter(commit -> serverId.equals(RaftPeerId.valueOf(commit.getServer().getId())))\n .findFirst();\n if (commitInfo.isPresent()) {\n endCommitIndex = OptionalLong.of(commitInfo.get().getCommitIndex());\n } else {\n throw new IOException(\"Commit info was not present. Couldn't find the current server's \"\n + \"latest commit\");\n }\n }\n } catch (IOException e) {\n LogUtils.warnWithException(LOG, \"Failed to get raft log information before replay.\"\n + \" Replay statistics will not be available\", e);\n }\n\n RaftJournalProgressLogger progressLogger =\n new RaftJournalProgressLogger(mStateMachine, endCommitIndex);\n\n // Loop until we lose leadership or convince ourselves that we are caught up and we are the only\n // master serving. To convince ourselves of this, we need to accomplish three steps:\n //\n // 1. Write a unique ID to Ratis.\n // 2. Wait for the ID to by applied to the state machine. This proves that we are\n // caught up since Ratis cannot apply commits from a previous term after applying\n // commits from a later term.\n // 3. Wait for a quiet period to elapse without anything new being written to Ratis. This is a\n // heuristic to account for the time it takes for a node to realize it is no longer the\n // leader. If two nodes think they are leader at the same time, they will both write unique\n // IDs to the journal, but only the second one has a chance of becoming leader. The first\n // will see that an entry was written after its ID, and double check that it is still the\n // leader before trying again.\n while (true) {\n if (mPrimarySelector.getState() != NodeState.PRIMARY) {\n return;\n }\n long lastAppliedSN = stateMachine.getLastAppliedSequenceNumber();\n long gainPrimacySN = ThreadLocalRandom.current().nextLong(Long.MIN_VALUE, 0);\n LOG.info(\"Performing catchup. Last applied SN: {}. Catchup ID: {}\",\n lastAppliedSN, gainPrimacySN);\n Exception ex;\n try {\n JournalEntry entry = JournalEntry.newBuilder().setSequenceNumber(gainPrimacySN).build();\n CompletableFuture<RaftClientReply> future = client.sendAsync(\n Message.valueOf(UnsafeByteOperations.unsafeWrap(entry.toByteArray())));\n RaftClientReply reply = future.get(5, TimeUnit.SECONDS);\n ex = reply.getException();\n } catch (TimeoutException | ExecutionException | IOException e) {\n ex = e;\n }\n\n if (ex != null) {\n // LeaderNotReadyException typically indicates Ratis is still replaying the journal.\n if (ex instanceof LeaderNotReadyException) {\n progressLogger.logProgress();\n } else {\n LOG.info(\"Exception submitting term start entry: {}\", ex.toString());\n }\n // avoid excessive retries when server is not ready\n Thread.sleep(waitBeforeRetry);\n continue;\n }\n\n // Wait election timeout so that this master and other masters have time to realize they\n // are not leader.\n try {\n long maxElectionTimeoutMs =\n Configuration.getMs(PropertyKey.MASTER_EMBEDDED_JOURNAL_MAX_ELECTION_TIMEOUT);\n CommonUtils.waitFor(\"check primacySN \" + gainPrimacySN + \" and lastAppliedSN \"\n + lastAppliedSN + \" to be applied to leader\", () ->\n stateMachine.getLastAppliedSequenceNumber() == lastAppliedSN\n && stateMachine.getLastPrimaryStartSequenceNumber() == gainPrimacySN,\n WaitForOptions.defaults()\n .setInterval(Constants.SECOND_MS)\n .setTimeoutMs((int) maxElectionTimeoutMs));\n } catch (TimeoutException e) {\n // Someone has committed a journal entry since we started trying to catch up.\n // Restart the catchup process.\n continue;\n }\n LOG.info(\"Caught up in {}ms. Last sequence number from previous term: {}.\",\n System.currentTimeMillis() - startTime, stateMachine.getLastAppliedSequenceNumber());\n return;\n }\n }", "@Test\n public void undoCkpointTest() throws Exception {\n final int tableSize = PARAMETERS.NUM_ITERATIONS_LOW;\n final int trimPosition = tableSize / 2;\n final int snapshotPosition = trimPosition + 2;\n\n CountDownLatch latch = new CountDownLatch(1);\n\n t(1, () -> {\n\n CorfuRuntime rt = getNewRuntime();\n try {\n PersistentCorfuTable<String, Long> tableA = openTable(rt, streamNameA);\n\n // first, populate the map\n for (int i = 0; i < tableSize; i++) {\n tableA.insert(String.valueOf(i), (long) i);\n }\n\n // now, take a checkpoint and perform a prefix-trim\n MultiCheckpointWriter<PersistentCorfuTable<String, Long>> mcw1 = new MultiCheckpointWriter<>();\n mcw1.addMap(tableA);\n mcw1.appendCheckpoints(rt, author);\n\n // Trim the log\n Token token = new Token(rt.getLayoutView().getLayout().getEpoch(), trimPosition);\n rt.getAddressSpaceView().prefixTrim(token);\n rt.getAddressSpaceView().gc();\n rt.getAddressSpaceView().invalidateServerCaches();\n rt.getAddressSpaceView().invalidateClientCache();\n\n latch.countDown();\n } finally {\n rt.shutdown();\n }\n });\n\n AtomicBoolean trimExceptionFlag = new AtomicBoolean(false);\n\n // start a new runtime\n t(2, () -> {\n latch.await();\n CorfuRuntime rt = getNewRuntime();\n\n PersistentCorfuTable<String, Long> localm2A = openTable(rt, streamNameA);\n\n // start a snapshot TX at position snapshotPosition\n Token timestamp = new Token(0L, snapshotPosition - 1);\n rt.getObjectsView().TXBuild()\n .type(TransactionType.SNAPSHOT)\n .snapshot(timestamp)\n .build()\n .begin();\n\n // finally, instantiate the map for the snapshot and assert is has the right state\n try {\n localm2A.get(String.valueOf(0));\n } catch (TransactionAbortedException te) {\n assertThat(te.getAbortCause()).isEqualTo(AbortCause.TRIM);\n // this is an expected behavior!\n trimExceptionFlag.set(true);\n }\n\n try {\n if (!trimExceptionFlag.get()) {\n assertThat(localm2A.size())\n .isEqualTo(snapshotPosition);\n\n // check map positions 0..(snapshot-1)\n for (int i = 0; i < snapshotPosition; i++) {\n assertThat(localm2A.get(String.valueOf(i)))\n .isEqualTo(i);\n }\n\n // check map positions snapshot..(mapSize-1)\n for (int i = snapshotPosition; i < tableSize; i++) {\n assertThat(localm2A.get(String.valueOf(i))).isNull();\n }\n }\n } finally {\n rt.shutdown();\n }\n });\n }", "private void run() throws IOException, InterruptedException {\n\n\t// Make connection and initialize streams\n\t// TODO - need to close this socket\n\tSocket socket = new Socket(SERVER_ADDRESS, PORT_ADDRESS); // set port\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// here\n\tin = new BufferedReader(new InputStreamReader(socket.getInputStream()));\n\tout = new PrintWriter(socket.getOutputStream(), true);\n\n\t// ******************* SET UP COMMUNICATION MODULE by Shay\n\t// *********************\n\t/* Your Group Info */\n\tGroup group = new Group(rovername, SERVER_ADDRESS, 53702, RoverDriveType.WALKER, RoverToolType.RADIATION_SENSOR,\n\t\t\tRoverToolType.CHEMICAL_SENSOR);\n\n\t/* Setup communication, only communicates with gatherers */\n\trocom = new RoverCommunication(group);\n\trocom.setGroupList(Group.getGatherers());\n\n\t// ******************************************************************\n\n\t// Gson gson = new GsonBuilder().setPrettyPrinting().create();\n\n\t// Process all messages from server, wait until server requests Rover ID\n\t// name\n\twhile (true) {\n\t\tString line = in.readLine();\n\t\tif (line.startsWith(\"SUBMITNAME\")) {\n\t\t\tout.println(rovername); // This sets the name of this instance\n\t\t\t\t\t\t\t\t\t// of a swarmBot for identifying the\n\t\t\t\t\t\t\t\t\t// thread to the server\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// ******** Rover logic *********\n\t// int cnt=0;\n\tString line = \"\";\n\n\tint counter = 0;\n\n\tboolean stuck = false; // just means it did not change locations between\n\t\t\t\t\t\t\t// requests,\n\t\t\t\t\t\t\t// could be velocity limit or obstruction etc.\n\tboolean blocked = false;\n\n\tCoord currentLoc = null;\n\tCoord previousLoc = null;\n\n\ttargetLocations[0] = new Coord(0, 0);\n\n\t// out.println(\"START_LOC\");\n\t// line = in.readLine();\n\t// if (line == null) {\n\t// System.out.println(\"ROVER_02 check connection to server\");\n\t// line = \"\";\n\t// }\n\t// if (line.startsWith(\"LOC\")) {\n\t// // loc = line.substring(4);\n\t// Coord Loc = extractLOC(line);\n\t// targetLocations[2] = new Coord(Loc.xpos, Loc.ypos);\n\t// }\n\n\tSystem.out.println(\"getting target loc\");\n\t\n\t out.println(\"TARGET_LOC\");\n\t line = in.readLine();\n\t System.out.println(\"line =\" + line);\n\t if (line == null) {\n\t System.out.println(\"ROVER_02 check connection to server\");\n\t line = \"\";\n\t }\n\t if (line.startsWith(\"TARGET_LOC\")) {\n\t // loc = line.substring(4);\n\t\t System.out.println(\"inside if\");\n\tSystem.out.println(line);\n\ttarget = extractLOC(line);\n//\t target = Loc;\n\t// target = new Coord(Loc.xpos,Loc.ypos);\n\t }\n//\t System.out.println(target.xpos + \" , \" + target.ypos);\n\n\t//target = new Coord(49, 49);\n\t// start Rover controller process\n\twhile (true) {\n\n\t\t// currently the requirements allow sensor calls to be made with no\n\t\t// simulated resource cost\n\n\t\t// **** location call ****\n\t\tout.println(\"LOC\");\n\t\tline = in.readLine();\n\t\tif (line == null) {\n\t\t\tSystem.out.println(\"ROVER_02 check connection to server\");\n\t\t\tline = \"\";\n\t\t}\n\t\tif (line.startsWith(\"LOC\")) {\n\t\t\t// loc = line.substring(4);\n\t\t\tcurrentLoc = extractLOC(line);\n\t\t}\n//\t\tSystem.out.println(\"ROVER_02 currentLoc at start: \" + currentLoc);\n\n\t\t// after getting location set previous equal current to be able to\n\t\t// check for stuckness and blocked later\n\t\tpreviousLoc = currentLoc;\n\n\t\t// **** get equipment listing ****\n\t\tArrayList<String> equipment = new ArrayList<String>();\n\t\tequipment = getEquipment();\n\t\t// System.out.println(\"ROVER_02 equipment list results drive \" +\n\t\t// equipment.get(0));\n//\t\tSystem.out.println(\"ROVER_02 equipment list results \" + equipment + \"\\n\");\n\n\t\t// ***** do a SCAN *****\n//\t\tSystem.out.println(\"ROVER_02 sending SCAN request\");\n\t\tthis.doScan();\n//\t\tSystem.out.println(\"debug\");\n\t\tscanMap.debugPrintMap();\n\n\t\t// MOVING\n\t\tSystem.out.println(\"moving\");\n\t\tMapTile[][] scanMapTiles = scanMap.getScanMap();\n\t//\tSystem.out.println(\"calling make a star\");\n\t\t\n\t//\tmakeAStarmove(scanMapTiles, currentLoc, target);\n\n\t//\tSystem.out.println(\"Astar done\");\n\n\t\tout.println(\"LOC\");\n\t\tline = in.readLine();\n\t\tif (line == null) {\n\t\t\t\t\t\t\tline = \"\";\n\t\t}\n\t\tif (line.startsWith(\"LOC\")) {\n\t\t\t// loc = line.substring(4);\n\t\t\tcurrentLoc = extractLOC(line);\n\t\t}\n\t\t\n\t\tif(currentLoc.equals(target))\n\t\t{\n\t\t\tout.println(\"START_LOC\");\n\t\t\t line = in.readLine();\n\t\t\t if (line == null) {\n\t\t\t System.out.println(\"ROVER_02 check connection to server\");\n\t\t\t line = \"\";\n\t\t\t }\n\t\t\t if (line.startsWith(\"START_LOC\")) {\n\t\t\t // loc = line.substring(4);\n\t\t\t Coord Loc = extractLOC(line);\n\t\t\t target = Loc;\n\t\t\t }\n\t\t\t continue;\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < 10; i++) {\n\t\t\tout.println(\"LOC\");\n\t\t\tline = in.readLine();\n\t\t\tif (line == null) {\n\t\t\t\t\t\t\t\tline = \"\";\n\t\t\t}\n\t\t\tif (line.startsWith(\"LOC\")) {\n\t\t\t\t// loc = line.substring(4);\n\t\t\t\tcurrentLoc = extractLOC(line);\n\t\t\t}\n\t\t\t//System.out.println(\"ROVER_02 currentLoc at start: \" + currentLoc);\n\t\t\tmake_a_move(scanMapTiles, currentLoc);\n\t\t}\n\n\t\t// test for stuckness\n\n\t\tSystem.out.println(\"ROVER_02 stuck test \" + stuck);\n\t\t// System.out.println(\"ROVER_02 blocked test \" + blocked);\n\n\t\t/* ********* Detect and Share Science by Shay ***************/\n\t\tdoScan();\n\t\trocom.detectAndShare(scanMap.getScanMap(), currentLoc, 3);\n\t\t/* *************************************************/\n\n\t\t// Thread.sleep(sleepTime);\n\n\t\t// System.out.println(\"ROVER_02 ------------ bottom process control\n\t\t// --------------\");\n\n\t}\n\n}", "void tryWriteLockInOMRequest() throws IOException;", "@Test\n public void partialTableRepair()\n {\n long startTime = System.currentTimeMillis();\n long expectedRepairedInterval = startTime - TimeUnit.HOURS.toMillis(1);\n\n TableReference tableReference = new TableReference(\"ks\", \"tb\");\n\n createKeyspace(tableReference.getKeyspace(), 3);\n injectRepairHistory(tableReference, System.currentTimeMillis() - TimeUnit.HOURS.toMillis(2));\n\n Set<TokenRange> expectedRepairedBefore = halfOfTokenRanges(tableReference);\n injectRepairHistory(tableReference, System.currentTimeMillis() - TimeUnit.MINUTES.toMillis(30), expectedRepairedBefore);\n\n Set<TokenRange> allTokenRanges = myMetadata.getTokenRanges(tableReference.getKeyspace(), myLocalHost);\n Set<LongTokenRange> expectedRepairedRanges = Sets.difference(convertTokenRanges(allTokenRanges), convertTokenRanges(expectedRepairedBefore));\n\n createTable(tableReference);\n\n await().pollInterval(1, TimeUnit.SECONDS).atMost(90, TimeUnit.SECONDS).until(() -> isRepairedSince(tableReference, startTime, expectedRepairedRanges));\n\n verifyTableRepairedSince(tableReference, expectedRepairedInterval, expectedRepairedRanges);\n verify(myFaultReporter, never()).raise(any(RepairFaultReporter.FaultCode.class), anyMapOf(String.class, Object.class));\n }", "@Test\n @WithSystemProperty(key = IgniteSystemProperties.IGNITE_DUMP_THREADS_ON_FAILURE, value = \"false\")\n public void testConnectingNodesStopIfNoConnectedNodeIsPresented() throws Exception {\n /*\n Test reproduces the needed behavior (two nodes in CONNECTING state) doing the following:\n - it starts two regular nodes, node0 (coordinator) and node1 (just another server) with special\n discovery SPIs;\n - when node1 receives NodeAddFinished for subsequently started node2, it doesn't send it to the node\n but closes disco socket to node2 leaving it in CONNECTING state and generating NodeFailed for it.\n Also at this moment node3 is started;\n - when node0 receives this NodeFailed it fails (because special SPI throws an exception) and stops;\n - when node1 receives another join request from node2 or NodeAdded from node3 reaches it back,\n node1's special SPI also throws an exception so it goes down as well;\n - as a result, both node2 and node3 get stuck in CONNECTING state and as they use special IpFinders\n they see each other and are able to send join requests to each other back and forth.\n\n The whole purpose of the test is to verify that these two nodes won't stuck in CONNECTING state forever\n and will eventually stop.\n */\n\n usePortFromNodeName = true;\n\n final AtomicInteger joinReqsCntr = new AtomicInteger(0);\n\n final AtomicReference<IgniteInternalFuture> futureRef = new AtomicReference();\n\n final UUID node2Id = UUID.randomUUID();\n\n final TcpDiscoverySpi node0SpecialSpi = new TcpDiscoverySpi() {\n @Override protected void startMessageProcess(TcpDiscoveryAbstractMessage msg) {\n if (msg instanceof TcpDiscoveryNodeFailedMessage) {\n TcpDiscoveryNodeFailedMessage failedMsg = (TcpDiscoveryNodeFailedMessage)msg;\n\n UUID failedNodeId = failedMsg.failedNodeId();\n\n if (failedNodeId.equals(node2Id))\n throw new RuntimeException(\"Stop node0 exception\");\n }\n\n if (msg instanceof TcpDiscoveryJoinRequestMessage) {\n TcpDiscoveryJoinRequestMessage joinReq = (TcpDiscoveryJoinRequestMessage)msg;\n\n if (joinReq.node().id().equals(node2Id))\n joinReqsCntr.incrementAndGet();\n }\n }\n };\n\n final TcpDiscoverySpi node1SpecialSpi = new TcpDiscoverySpi() {\n @Override protected void startMessageProcess(TcpDiscoveryAbstractMessage msg) {\n if (msg instanceof TcpDiscoveryNodeAddFinishedMessage) {\n TcpDiscoveryNodeAddFinishedMessage finishedMsg = (TcpDiscoveryNodeAddFinishedMessage)msg;\n\n UUID nodeId = finishedMsg.nodeId();\n\n if (nodeId.equals(node2Id)) {\n Object workerObj = GridTestUtils.getFieldValue(impl, \"msgWorker\");\n\n OutputStream out = GridTestUtils.getFieldValue(workerObj, \"out\");\n\n try {\n out.close();\n\n log.warning(\"Out to 'sick' node closed\");\n }\n catch (Exception ignored) {\n // No-op.\n }\n\n futureRef.set(GridTestUtils.runAsync(() -> {\n try {\n startGrid(NODE_WITH_PORT_ID_3);\n }\n catch (Exception ignored) {\n //NO-op.\n }\n }));\n }\n }\n\n if (msg instanceof TcpDiscoveryJoinRequestMessage) {\n TcpDiscoveryJoinRequestMessage joinReq = (TcpDiscoveryJoinRequestMessage)msg;\n\n int joinReqsCount = joinReqsCntr.get();\n\n if (joinReq.node().id().equals(node2Id) && joinReqsCount == 1)\n throw new RuntimeException(\"Stop node1 exception by subsequent join req\");\n }\n\n if (msg instanceof TcpDiscoveryNodeAddedMessage) {\n TcpDiscoveryNodeAddedMessage addedMsg = (TcpDiscoveryNodeAddedMessage)msg;\n\n if (addedMsg.node().discoveryPort() == 47503)\n throw new RuntimeException(\"Stop node1 exception by new node added msg\");\n }\n }\n };\n\n specialSpi = node0SpecialSpi;\n\n startGrid(NODE_WITH_PORT_ID_0);\n\n specialSpi = node1SpecialSpi;\n\n startGrid(NODE_WITH_PORT_ID_1);\n\n specialIpFinder0 = new TcpDiscoveryVmIpFinder(false);\n\n ((TcpDiscoveryVmIpFinder)specialIpFinder0).setAddresses(Arrays.asList(\"127.0.0.1:47501\", \"127.0.0.1:47503\"));\n\n specialIpFinder1 = new TcpDiscoveryVmIpFinder(false);\n\n ((TcpDiscoveryVmIpFinder)specialIpFinder1).setAddresses(Arrays.asList(\"127.0.0.1:47502\"));\n\n specialSpi = null;\n\n nodeId = node2Id;\n\n boolean expectedExceptionThrown = false;\n\n try {\n startGrid(NODE_WITH_PORT_ID_2);\n }\n catch (Exception e) {\n Throwable cause0 = e.getCause();\n\n assertNotNull(cause0);\n\n Throwable cause1 = cause0.getCause();\n\n assertNotNull(cause1);\n\n String errorMsg = cause1.getMessage();\n\n assertTrue(\n \"Expected error message was not found: \" + errorMsg,\n errorMsg.contains(\"Failed to connect to any address from IP finder\")\n );\n\n expectedExceptionThrown = true;\n }\n\n assertTrue(\"Expected exception was not thrown.\", expectedExceptionThrown);\n\n IgniteInternalFuture startGridFut = futureRef.get();\n\n if (startGridFut != null)\n startGridFut.get();\n }", "@Test\n public void repairSingleTableRepairedInSubRanges()\n {\n long startTime = System.currentTimeMillis();\n\n TableReference tableReference = new TableReference(\"ks\", \"tb\");\n\n createKeyspace(tableReference.getKeyspace(), 3);\n injectRepairHistory(tableReference, System.currentTimeMillis() - TimeUnit.HOURS.toMillis(2), true);\n createTable(tableReference);\n\n await().pollInterval(1, TimeUnit.SECONDS).atMost(90, TimeUnit.SECONDS).until(() -> isRepairedSince(tableReference, startTime));\n\n verifyTableRepairedSince(tableReference, startTime);\n verify(myFaultReporter, never()).raise(any(RepairFaultReporter.FaultCode.class), anyMapOf(String.class, Object.class));\n }", "void trySynchronizeHostData(DataBuffer buffer);", "@Test\n public void testRefreshEntriesFromPrimaryWhenDSMDetectsServerLive() throws Exception {\n addIgnoredException(ServerConnectivityException.class.getName());\n\n PORT1 = server1.invoke(HAInterestTestCase::createServerCache);\n server1.invoke(HAInterestTestCase::createEntriesK1andK2);\n createClientPoolCacheConnectionToSingleServer(getName(),\n getServerHostName(server1.getHost()));\n registerK1AndK2();\n verifyRefreshedEntriesFromServer();\n\n server1.invoke(HAInterestTestCase::stopServer);\n verifyDeadAndLiveServers(1, 0);\n server1.invoke(HAInterestTestCase::putK1andK2);\n server1.invoke(HAInterestTestCase::startServer);\n verifyDeadAndLiveServers(0, 1);\n final Region r1 = cache.getRegion(SEPARATOR + REGION_NAME);\n assertNotNull(r1);\n // Verify for interest registration after cache-server is started.\n server1.invoke(HAInterestTestCase::verifyInterestRegistration);\n\n WaitCriterion wc = new WaitCriterion() {\n private String excuse;\n\n @Override\n public boolean done() {\n Entry e1;\n Entry e2;\n\n try {\n e1 = r1.getEntry(k1);\n if (e1 == null) {\n excuse = \"Entry for k1 is null\";\n return false;\n }\n } catch (EntryDestroyedException e) {\n excuse = \"Entry destroyed\";\n return false;\n }\n if (!server_k1.equals(e1.getValue())) {\n excuse = \"e1 value is not server_k1\";\n return false;\n }\n try {\n e2 = r1.getEntry(k2);\n if (e2 == null) {\n excuse = \"Entry for k2 is null\";\n return false;\n }\n } catch (EntryDestroyedException e) {\n excuse = \"Entry destroyed\";\n return false;\n }\n if (!server_k2.equals(e2.getValue())) {\n excuse = \"e2 value is not server_k2\";\n return false;\n }\n return true;\n }\n\n @Override\n public String description() {\n return excuse;\n }\n };\n GeodeAwaitility.await().untilAsserted(wc);\n }", "@Test\n public void run() {\n Frame f = new TestUtil().parseTestFile(\"smalldata/junit/syn_2659x1049.csv.gz\");\n // Create two lockable frames in KV store\n Frame fr1 = new Frame(Key.<Frame>make(), f.names(), f.vecs());\n Frame fr2 = new Frame(Key.<Frame>make(), f.names(), f.vecs());\n // Lock the frames against writes\n fr1.delete_and_lock();\n fr2.delete_and_lock();\n int i = 0;\n try {\n // try to delete the write-locked frames -> will throw an exception\n fr1.delete();\n fr2.delete(); // won't be reached\n } catch (Throwable t) {\n Log.info(\"Correctly unable to delete (was locked): \" + t.getClass()); //either AssertionError if local or DistributedException if remote\n i++;\n } finally {\n // second attempt: will unlock and delete properly\n new UnlockTask().doAllNodes(); // without this line, there will be a leak (and assertion won't be shown)\n fr1.delete();\n fr2.delete();\n f.delete();\n Log.info(\"Able to delete after unlocking.\");\n }\n Assert.assertTrue(i == 1);\n }", "static void unSynced () {\n\t\tList<Integer> linkedList = Collections.synchronizedList(new LinkedList<Integer>());\n\n\t\t// fill it with numbers 1 to 100\n\t\tfor (int i = 0; i < 100; i++) {\n\t\t\tlinkedList.add(i);\n\t\t}\n\n\t\t// launch a thread to add 100 more numbers\n\t\tnew Thread(new Runnable () {\n\t\t\t@Override\n\t\t\tpublic void run () {\n\t\t\t\tSystem.out.println(\"starting adding numbers\");\n\t\t\t\tfor (int i = 100; i < 200; i++) {\n\t\t\t\t\tlinkedList.add(i);\n\t\t\t\t\ttry {\n\t\t\t\t\t\tThread.sleep(1);\n\t\t\t\t\t} catch (InterruptedException e) {\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tSystem.out.println(\"ending adding numbers\");\n\t\t\t}\n\t\t}).start();\n\n\t\t// try to iterate through the list in parallel with the numbers being added\n\t\t// interleaving occurs and the iterator throws a CME.\n\t\tIterator<Integer> iterator = linkedList.iterator();\n\t\tSystem.out.println(\"starting iteration\");\n\t\twhile (iterator.hasNext()) { \n\t\t\ttry {\n\t\t\t\tThread.sleep(4);\n\t\t\t} catch (InterruptedException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tSystem.out.println(iterator.next());\n\t\t}\n\t\tSystem.out.println(\"finished iteration\");\n\t}", "public void testOldCacheGetsReusedLocally() throws Exception\n {\n final String asyncContents = \"Async commit contents\";\n\n TestSetup t = new TestSetup().prepare();\n String asyncRev = t.commitTestFileContents(asyncContents, \"Async commit\");\n\n File targetDir = t.createDir(\"target\");\n\n GitOperationHelper goh = createGitOperationHelper();\n goh.fetch(targetDir, t.accessData, false);\n goh.checkout(t.cacheDir, targetDir, asyncRev, null, false);\n\n String contents = FileUtils.readFileToString(new File(targetDir, \"file.txt\"));\n Assert.assertEquals(contents, asyncContents);\n }", "@Test\n public void testEnableReplicationForExplicitSetTableCfs() throws Exception {\n TableName tableName2 = TableName.valueOf(((tableName.getNameAsString()) + \"2\"));\n // Only create table in source cluster\n createTableWithDefaultConf(tableName);\n createTableWithDefaultConf(tableName2);\n Assert.assertFalse(\"Table should not exists in the peer cluster\", TestAsyncReplicationAdminApiWithClusters.admin2.tableExists(tableName).get());\n Assert.assertFalse(\"Table should not exists in the peer cluster\", TestAsyncReplicationAdminApiWithClusters.admin2.tableExists(tableName2).get());\n Map<TableName, ? extends Collection<String>> tableCfs = new HashMap<>();\n tableCfs.put(tableName, null);\n ReplicationPeerConfig rpc = admin.getReplicationPeerConfig(TestAsyncReplicationAdminApiWithClusters.ID_SECOND).get();\n rpc.setReplicateAllUserTables(false);\n rpc.setTableCFsMap(tableCfs);\n try {\n // Only add tableName to replication peer config\n admin.updateReplicationPeerConfig(TestAsyncReplicationAdminApiWithClusters.ID_SECOND, rpc).join();\n admin.enableTableReplication(tableName2).join();\n Assert.assertFalse((\"Table should not be created if user has set table cfs explicitly for the \" + \"peer and this is not part of that collection\"), TestAsyncReplicationAdminApiWithClusters.admin2.tableExists(tableName2).get());\n // Add tableName2 to replication peer config, too\n tableCfs.put(tableName2, null);\n rpc.setTableCFsMap(tableCfs);\n admin.updateReplicationPeerConfig(TestAsyncReplicationAdminApiWithClusters.ID_SECOND, rpc).join();\n admin.enableTableReplication(tableName2).join();\n Assert.assertTrue(\"Table should be created if user has explicitly added table into table cfs collection\", TestAsyncReplicationAdminApiWithClusters.admin2.tableExists(tableName2).get());\n } finally {\n rpc.setTableCFsMap(null);\n rpc.setReplicateAllUserTables(true);\n admin.updateReplicationPeerConfig(TestAsyncReplicationAdminApiWithClusters.ID_SECOND, rpc).join();\n }\n }", "@Test (timeout=180000)\n public void testFixMetaNotWorkingWithNoHdfsChecking() throws Exception {\n TableName table =\n TableName.valueOf(\"testFixMetaNotWorkingWithNoHdfsChecking\");\n try {\n setupTable(table);\n assertEquals(ROWKEYS.length, countRows());\n\n // Mess it up by deleting a region from the metadata\n deleteRegion(conf, tbl.getTableDescriptor(), Bytes.toBytes(\"A\"),\n Bytes.toBytes(\"B\"), false, true, false, false, HRegionInfo.DEFAULT_REPLICA_ID);\n\n // verify there is no other errors\n HBaseFsck hbck = doFsck(conf, false);\n assertErrors(hbck,\n new ERROR_CODE[] { ERROR_CODE.NOT_IN_META, ERROR_CODE.HOLE_IN_REGION_CHAIN });\n\n // verify that noHdfsChecking report the same errors\n HBaseFsck fsck = new HBaseFsck(conf, hbfsckExecutorService);\n fsck.connect();\n fsck.setDisplayFullReport(); // i.e. -details\n fsck.setTimeLag(0);\n fsck.setCheckHdfs(false);\n fsck.onlineHbck();\n assertErrors(fsck,\n new ERROR_CODE[] { ERROR_CODE.NOT_IN_META, ERROR_CODE.HOLE_IN_REGION_CHAIN });\n fsck.close();\n\n // verify that fixMeta doesn't work with noHdfsChecking\n fsck = new HBaseFsck(conf, hbfsckExecutorService);\n fsck.connect();\n fsck.setDisplayFullReport(); // i.e. -details\n fsck.setTimeLag(0);\n fsck.setCheckHdfs(false);\n fsck.setFixAssignments(true);\n fsck.setFixMeta(true);\n fsck.onlineHbck();\n assertFalse(fsck.shouldRerun());\n assertErrors(fsck,\n new ERROR_CODE[] { ERROR_CODE.NOT_IN_META, ERROR_CODE.HOLE_IN_REGION_CHAIN });\n fsck.close();\n\n // fix the cluster so other tests won't be impacted\n fsck = doFsck(conf, true);\n assertTrue(fsck.shouldRerun());\n fsck = doFsck(conf, true);\n assertNoErrors(fsck);\n } finally {\n cleanupTable(table);\n }\n }", "@Test\n public void testBrokenLogger() throws IOException {\n Configuration conf = new HdfsConfiguration();\n conf.set(DFSConfigKeys.DFS_NAMENODE_AUDIT_LOGGERS_KEY, TestAuditLogger.BrokenAuditLogger.class.getName());\n MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).build();\n try {\n cluster.waitClusterUp();\n FileSystem fs = cluster.getFileSystem();\n long time = System.currentTimeMillis();\n fs.setTimes(new Path(\"/\"), time, time);\n Assert.fail(\"Expected exception due to broken audit logger.\");\n } catch (RemoteException re) {\n // Expected.\n } finally {\n cluster.shutdown();\n }\n }", "public static boolean syncUp(ClientResponsePacket res_packet)throws IOException\n {\n Socket mem_conn = null;\n ClientResponsePacket data = null;\n MemNodeSyncHelper sync_nodes_list = res_packet.getMemNodeSyncHelper();\n ClientRequestPacket req_packet = new ClientRequestPacket();\n for(MemNodeSyncDetails node : sync_nodes_list.syncIps)\n {\n req_packet.setCommand(ProjectConstants.SYNC_MEM_NODE);\n req_packet.setStart_range(node.getStart_range());\n req_packet.setEnd_range(node.getEnd_range());\n req_packet.setStorage_type(node.getStorage_type());\n mem_conn = new Socket(node.getIp_Address(),ProjectConstants.MN_LISTEN_PORT);\n PacketTransfer.sendRequest(req_packet,mem_conn);\n data = PacketTransfer.recv_response(mem_conn);\n System.out.println(\"Loading DS with status : \" + data.getResponse_code() + \" and size : \" + data.getSync_data().size() +\n \" and range \" + node.getStart_range() + \":\" + node.getEnd_range() + \" and ip : \" + node.getIp_Address());\n if(data.getResponse_code() != ProjectConstants.SUCCESS)\n return false;\n loadSyncData(data.getSync_data(),node.getStorage_type());\n }\n return true;\n }", "@Test\n @Timeout(value = 30)\n public void testRemoveNodeCreatedWatches() throws Exception {\n List<EventType> expectedEvents = new ArrayList<>();\n expectedEvents.add(EventType.DataWatchRemoved);\n MyWatcher myWatcher1 = new MyWatcher(\"/testnode1\", expectedEvents, 1);\n MyWatcher myWatcher2 = new MyWatcher(\"/testnode1/testnode2\", expectedEvents, 1);\n // Adding pre-created watcher\n LOG.info(\"Adding NodeCreated watcher\");\n zk.exists(\"/testnode1\", myWatcher1);\n zk.exists(\"/testnode1/testnode2\", myWatcher2);\n\n String cmdstring1 = \"removewatches /testnode1 -d\";\n LOG.info(\"Remove watchers using shell command : {}\", cmdstring1);\n zkMain.cl.parseCommand(cmdstring1);\n assertTrue(zkMain.processZKCmd(zkMain.cl), \"Removewatches cmd fails to remove pre-create watches\");\n myWatcher1.matches();\n assertEquals(1, zk.getExistWatches().size(), \"Failed to remove pre-create watches :\" + zk.getExistWatches());\n assertTrue(zk.getExistWatches().contains(\"/testnode1/testnode2\"), \"Failed to remove pre-create watches :\" + zk.getExistWatches());\n\n String cmdstring2 = \"removewatches /testnode1/testnode2 -d\";\n LOG.info(\"Remove watchers using shell command : {}\", cmdstring2);\n zkMain.cl.parseCommand(cmdstring2);\n assertTrue(zkMain.processZKCmd(zkMain.cl), \"Removewatches cmd fails to remove data watches\");\n\n myWatcher2.matches();\n assertEquals(0, zk.getExistWatches().size(), \"Failed to remove pre-create watches : \" + zk.getExistWatches());\n }", "public Boolean outOfSync() {\n return this.outOfSync;\n }", "@Test\n public void testHardClustersWithOverlappingPartitions()\n {\n check(hardClustersWithOverlappingPartitions(), 0.0, 1.0);\n }" ]
[ "0.65554065", "0.6385915", "0.60428077", "0.59956723", "0.5916765", "0.590722", "0.58935595", "0.5867984", "0.5866431", "0.5812901", "0.57881486", "0.57633954", "0.5751304", "0.57085246", "0.5692372", "0.56606334", "0.5658153", "0.56519043", "0.563446", "0.5582188", "0.55750525", "0.55672437", "0.5542118", "0.55262226", "0.5520034", "0.5493061", "0.54900855", "0.54510695", "0.5430693", "0.54099214", "0.5408904", "0.5398156", "0.5389522", "0.5383203", "0.53534144", "0.53474617", "0.53332126", "0.53294206", "0.532756", "0.5323789", "0.53166986", "0.530526", "0.53036165", "0.52828276", "0.5280333", "0.5272283", "0.5269111", "0.52685016", "0.5267276", "0.52605134", "0.5246088", "0.52426213", "0.52420175", "0.52325284", "0.5222702", "0.5218006", "0.52120614", "0.52117735", "0.5208896", "0.52029264", "0.51887923", "0.51779336", "0.51778674", "0.5176585", "0.5172614", "0.51723105", "0.5171358", "0.51707536", "0.51702464", "0.51702464", "0.5166899", "0.51651824", "0.51614684", "0.51590693", "0.51580817", "0.5151113", "0.5145168", "0.514193", "0.513935", "0.51341695", "0.5134083", "0.5128673", "0.51269066", "0.5126109", "0.51239663", "0.51238716", "0.5122099", "0.51201546", "0.510956", "0.5109098", "0.5101763", "0.50990695", "0.5098926", "0.5084944", "0.5080426", "0.50791544", "0.50757724", "0.5074986", "0.50650144", "0.5064419" ]
0.63657403
2
get bean by bean name
public static <T> T getBean(String beanName) { return (T) applicationContext.getBean(beanName); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Object getBean(String name) {\n Object bean = beanMap.get(name);\n if (bean == null) {\n throw new IllegalArgumentException(\"there is no bean with name \" + name);\n }\n\n return bean;\n }", "public static Object getBean(String name) {\r\n\t\tWebApplicationContext wac = ContextLoader.getCurrentWebApplicationContext();\r\n\t\treturn wac.getBean(name);\r\n\t}", "public Object findBean(String beanName) {\n\t\tFacesContext context = FacesContext.getCurrentInstance();\n\t\treturn context.getApplication().evaluateExpressionGet(context, \"#{\" + beanName + \"}\", Object.class);\n\t}", "public Object getBean(String name) {\r\n\t\tif (ctx == null) {\r\n\t\t\tctx = WebApplicationContextUtils\r\n\t\t\t\t\t.getRequiredWebApplicationContext(servlet\r\n\t\t\t\t\t\t\t.getServletContext());\r\n\t\t}\r\n\t\treturn ctx.getBean(name);\r\n\t}", "public static Object lookupBean(String name) {\n BeanManager manager = lookupBeanManager();\n Set<Bean<?>> beans = manager.getBeans(name);\n if (beans != null && !beans.isEmpty()) {\n Bean<?> bean = beans.iterator().next();\n CreationalContext<?> context = manager.createCreationalContext(bean);\n return manager.getReference(bean, Object.class, context);\n }\n return null;\n }", "public static Object getBean(String beanName) {\r\n return CONTEXT.getBean(beanName);\r\n }", "@Override\r\n\tpublic Object getInstance(String beanName) {\n\t\tfor( Scope key : beanFactories.keySet() ){\r\n\t\t\tObject instance = beanFactories.get( key).getInstance(beanName);\r\n\t\t\tif (instance != null) {\r\n\t\t\t\treturn instance;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t}", "public static Object getBean(ExecuteContext context, String beanName) throws Exception {\r\n\t\treturn WebApplicationContextUtils.getRequiredWebApplicationContext(context.getRequest().getSession().getServletContext()).getBean(beanName);\r\n\t}", "@SuppressWarnings(\"unchecked\")\n public static <T> T getBean(String name) {\n assertContextInjected();\n return (T) applicationContext.getBean(name);\n }", "public Object getBean(String name) throws Exception {\n\t\tObject bean = beanMap.get(name);\n\t\tif (bean != null) {\n\t\t\treturn bean;\n\t\t}\n\t\t// 如果实例好的beanMap找不到bean 就先创建再返回\n\t\tbean = createBean(beanDefineMap.get(name));\n\t\n\t\t\n\t\tif(bean != null) {\n\t\t\tpopulatebean(bean);\n\t\t //检查properties中是否有定义代理增强\n\t\t String proxyAdvisorClassName = proxyProp.getProperty(name + \".proxy.class\");\n\t\t\tif (proxyAdvisorClassName != null && proxyAdvisorClassName.trim().length() > 0) {\n\t\t\t Class<?> proxyAdvisorClass = Class.forName(proxyAdvisorClassName);\n\t\t String[] methods = proxyProp.getProperty(name + \".proxy.methods\").split(\",\");\n\n\t\t\t InvocationHandler proxyHandler = (InvocationHandler) proxyAdvisorClass\n\t\t .getConstructors()[0].newInstance(bean, Arrays.asList(methods));\n\t\t\t // 动态代理创建对象\n\t\t Object proxy = Proxy.newProxyInstance(bean.getClass().getClassLoader(),\n\t\t bean.getClass().getInterfaces(), proxyHandler);\n\t\t bean = proxy;\n\t\t\t}\n\t\t\tbeanMap.put(name, bean);\n\t\t}\n\t\t\t\t\n\t\treturn bean;\n\t}", "public <T> T getBean(String beanName, Class<T> ofType) throws CouldNotResolveBeanException;", "ComponentBean getBean();", "Object getBean();", "IBeanConfiguration getBeanConfiguration(String beanName);", "private static SingerWithJSR250 getBean(String beanName, ApplicationContext context) {\n\t\ttry {\n\t\t\tSingerWithJSR250 bean = (SingerWithJSR250) context.getBean(beanName);\n\t\t\treturn bean;\n\t\t} catch (Exception e) {\n\t\t\t// TODO: handle exception\n\t\t\tSystem.out.println(\"An error occured in bean configuration: \" + e.getMessage());\n\t\t\treturn null;\n\t\t}\n\t}", "public java.lang.String getBeanIdentifier();", "public Object getManagedBean(String beanName) {\n\t FacesContext fc = FacesContext.getCurrentInstance();\n\t Object bean;\n\t \n\t try {\n\t ELContext elContext = fc.getELContext();\n\t bean = elContext.getELResolver().getValue(elContext, null, beanName);\n\t } catch (RuntimeException e) {\n\t throw new FacesException(e.getMessage(), e);\n\t }\n\n\t if (bean == null) {\n\t throw new FacesException(\"Managed bean with name '\" + beanName\n\t + \"' was not found. Check your faces-config.xml or @ManagedBean annotation.\");\n\t }\n\t return bean;\n\t}", "public Object getBean(String className) throws BaseException {\r\n\t\ttry {\r\n\t\t\tObject retVal = this.springApplicationContext.getBean(className);\r\n\t\t\tlogger.debug(\"returning an instance of \" + className);\r\n\t\t\treturn retVal;\r\n\t\t} catch (Exception e) {\r\n\t\t\tlogger.error(\"failed retrieving bean from local factory\", e);\r\n\t\t\te.printStackTrace();\r\n\t\t\tthrow new BaseException(e.getMessage(), e);\r\n\t\t}\r\n\t}", "public Object getProperty(String name) {\n\t\treturn beanMap.get(name);\n\t}", "public String getBeanName() {\r\n\t\treturn beanName;\r\n\t}", "protected <T> T getBean( String name, Class<T> t ) {\n try {\n return this.applicationContext.getBean( name, t );\n } catch ( BeansException e ) {\n throw new RuntimeException( e );\n } catch ( Exception e ) {\n throw new RuntimeException( e );\n }\n }", "public String getImplementationBean(String linkName);", "public interface BeanFactory {\n\n// BeanDefinition getBeanDefinition(String beanID);\n\n Object getBean(String beanID);\n}", "private static String beanName(Object bean) {\r\n\t\tString fullClassName = bean.getClass().getName();\r\n\t\tString classNameTemp = fullClassName.substring(fullClassName\r\n\t\t\t\t.lastIndexOf(\".\") + 1, fullClassName.length());\r\n\t\treturn classNameTemp.substring(0, 1) + classNameTemp.substring(1);\r\n\t}", "ComponentBean getReferencedBean();", "public static java.lang.String getBeanIdentifier() {\n\t\treturn getService().getBeanIdentifier();\n\t}", "public static java.lang.String getBeanIdentifier() {\n\t\treturn getService().getBeanIdentifier();\n\t}", "public static java.lang.String getBeanIdentifier() {\n\t\treturn getService().getBeanIdentifier();\n\t}", "public static java.lang.String getBeanIdentifier() {\n\t\treturn getService().getBeanIdentifier();\n\t}", "public static java.lang.String getBeanIdentifier() {\n\t\treturn getService().getBeanIdentifier();\n\t}", "public interface BeanResolver {\n\n\n\t/**\n\t * Returns the bean of the correct type.\n\t * \n\t * @param <T>\t\tClass of bean.\n\t * @param beanName\tName of the bean to return.\n\t * @param ofType\tClass of the bean to get.\n\t * \n\t * @return The bean with matching bean name.\n\t * @throws CouldNotResolveBeanException if bean can not be located.\n\t **/\n\tpublic <T> T getBean(String beanName, Class<T> ofType) throws CouldNotResolveBeanException;\n}", "public interface BeanFactory {\n\n /**\n * @param name\n * @return\n * @throws Exception\n */\n Object getBean(String name) throws Exception;\n\n}", "public static java.lang.String getBeanIdentifier() {\n return getService().getBeanIdentifier();\n }", "public static java.lang.String getBeanIdentifier() {\n return getService().getBeanIdentifier();\n }", "public static java.lang.String getBeanIdentifier() {\n return getService().getBeanIdentifier();\n }", "public static java.lang.String getBeanIdentifier() {\n return getService().getBeanIdentifier();\n }", "public static java.lang.String getBeanIdentifier() {\n return getService().getBeanIdentifier();\n }", "protected <T> T lookupBean(Class<T> beanClass, String beanName)\r\n\t\t\tthrows ServletException {\r\n\t\tHashtable<String, String> env = new Hashtable<String, String>();\r\n\t\tenv.put(Context.INITIAL_CONTEXT_FACTORY,\r\n\t\t\t\t\"org.jnp.interfaces.NamingContextFactory\");\r\n\t\tenv.put(Context.PROVIDER_URL, \"localhost:1099\");\r\n\r\n\t\ttry {\r\n\t\t\tInitialContext jndiContext = new InitialContext(env);\r\n\t\t\treturn beanClass.cast(jndiContext.lookup(beanName));\r\n\t\t} catch (NamingException e) {\r\n\t\t\tthrow new ServletException();\r\n\t\t}\r\n\t}", "public static Object getManagedBean(String beanName) {\r\n\t\tFacesContext fc = FacesContext.getCurrentInstance();\r\n\t\tELContext elc = fc.getELContext();\r\n\t\tExpressionFactory ef = fc.getApplication().getExpressionFactory();\r\n\t\treturn ef.createValueExpression(elc, getJsfEl(beanName), Object.class).getValue(elc);\r\n\t}", "@Nullable\n protected final String getBeanName() {\n return this.beanName;\n }", "protected Object fetchBean()\n {\n if (isAttributeDefined(ATTR_REF))\n {\n return getContext().findVariable(getStringAttr(ATTR_REF));\n }\n\n else\n {\n BeanContext bc = FormBaseTag.getBuilderData(getContext())\n .getBeanContext();\n if (isAttributeDefined(ATTR_BEAN_CLASS))\n {\n Class<?> beanClass = FormBaseTag.convertToClass(getAttributes()\n .get(ATTR_BEAN_CLASS));\n return bc.getBean(beanClass);\n }\n else\n {\n return bc.getBean(getStringAttr(ATTR_BEAN_NAME));\n }\n }\n }", "public interface BeanFactory {\n\n Object getBean(Class<?> clazz);\n\n}", "static private Object lookup(PageContext pageContext, String name, \r\n String scope, String pageParam, Properties prop) throws JspException {\r\n\r\n Object bean = null;\r\n if (scope == null)\r\n bean = pageContext.findAttribute(name);\r\n else if (scope.equalsIgnoreCase(pageParam))\r\n bean = pageContext.getAttribute(name, PageContext.PAGE_SCOPE);\r\n else if (scope.equalsIgnoreCase(\"request\"))\r\n bean = pageContext.getAttribute(name, PageContext.REQUEST_SCOPE);\r\n else if (scope.equalsIgnoreCase(\"session\"))\r\n bean = pageContext.getAttribute(name, PageContext.SESSION_SCOPE);\r\n else if (scope.equalsIgnoreCase(\"application\"))\r\n bean = pageContext.getAttribute(name, PageContext.APPLICATION_SCOPE);\r\n else {\r\n Object[] objs = { name, scope };\r\n String msg = MessageFormat.format(prop.getProperty(\"error.msg.cant_find_bean\"), objs);\r\n throw new JspException(msg);\r\n }\r\n\r\n return (bean);\r\n }", "BeanFactory getBeanFactory();", "FactoryBean getFactoryBean();", "public String getBeanIdentifier() {\n return _beanIdentifier;\n }", "public Object lookup()\r\n {\n if (applicationInstance != null)\r\n return applicationInstance;\r\n\r\n ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(flex.messaging.FlexContext.getServletConfig().getServletContext());\r\n if (appContext == null)\r\n {\r\n if (Log.isError())\r\n Log.getLogger(\"Configuration\").error(\r\n \"SpringFactory - not able to look up the WebApplicationContext for Spring. Check your web.xml to ensure Spring is installed properly in this web application.\");\r\n return null;\r\n }\r\n String beanName = getSource();\r\n\r\n try\r\n {\r\n Object inst;\r\n if (appContext.isSingleton(beanName))\r\n {\r\n if (Log.isDebug())\r\n Log.getLogger(\"Configuration\").debug(\r\n \"SpringFactory creating singleton component with spring id: \" + beanName + \" for destination: \" + getId());\r\n // We have a singleton instance but no one has initialized it yet.\r\n // We need to sync to prevent two threads from potentially initializing\r\n // the instance at the same time and to ensure we only return\r\n // initialized instances.\r\n synchronized (this)\r\n {\r\n // Someone else got to this before us\r\n if (applicationInstance != null)\r\n return applicationInstance;\r\n inst = appContext.getBean(beanName);\r\n if (inst instanceof FlexConfigurable)\r\n ((FlexConfigurable) inst).initialize(getId(), getProperties());\r\n applicationInstance = inst;\r\n }\r\n }\r\n else\r\n {\r\n if (Log.isDebug())\r\n Log.getLogger(\"Configuration\").debug(\r\n \"SpringFactory creating non-singleton component with spring id: \" + beanName + \" for destination: \" + getId());\r\n inst = appContext.getBean(beanName);\r\n if (inst instanceof FlexConfigurable)\r\n ((FlexConfigurable) inst).initialize(getId(), getProperties());\r\n }\r\n return inst;\r\n }\r\n catch (NoSuchBeanDefinitionException nexc)\r\n {\r\n ServiceException e = new ServiceException();\r\n String msg = \"Spring service named '\" + beanName + \"' does not exist.\";\r\n e.setMessage(msg);\r\n e.setRootCause(nexc);\r\n e.setDetails(msg);\r\n e.setCode(\"Server.Processing\");\r\n throw e;\r\n }\r\n catch (BeansException bexc)\r\n {\r\n ServiceException e = new ServiceException();\r\n String msg = \"Unable to create Spring service named '\" + beanName + \"' \";\r\n e.setMessage(msg);\r\n e.setRootCause(bexc);\r\n e.setDetails(msg);\r\n e.setCode(\"Server.Processing\");\r\n throw e;\r\n }\r\n }", "public Object elGetReference(Object bean);", "public static BeanManager lookupBeanManager() {\n BeanManager beanManager = getCDIBeanManager(\"java:comp\");\n if (beanManager == null) {\n beanManager = getCDIBeanManager(\"java:comp/env\");\n }\n if (beanManager == null) {\n beanManager = getOSGICDIBeanManager();\n }\n return beanManager;\n }", "protected Object obtainFreshBean(BeanFactory beanFactory, String beanName)\r\n/* 32: */ {\r\n/* 33:79 */ return super.obtainFreshBean(beanFactory, \r\n/* 34:80 */ this.isFactoryBean ? \"&\" + beanName : beanName);\r\n/* 35: */ }", "public Component getComponent(String name) {\n Optional<Component> component = elements.getComponent(name);\n\n if(component.isPresent()) {\n return component.get();\n } else {\n Assert.fail(\"Missing component \" + name);\n return null;\n }\n\n }", "@Override\n public String getBeanIdentifier() {\n return _beanIdentifier;\n }", "@Override\n public String getBeanIdentifier() {\n return _beanIdentifier;\n }", "@Override\n public String getBeanIdentifier() {\n return _beanIdentifier;\n }", "public static Object getComponentInstance(String name, ServletContext sc) {\r\n\t\tContainerWrapper containerWrapper = scf.findContainer(new ServletContextWrapper(sc));\r\n\t\tif (!containerWrapper.isStart()) {\r\n\t\t\tDebug.logError(\"JdonFramework not yet started, please try later \", module);\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\treturn containerWrapper.lookup(name);\r\n\t}", "RiceCooker getByName(String name);", "public java.lang.String getBeanIdentifier() {\n return _examConfigLocalService.getBeanIdentifier();\n }", "void register(String name, Object bean);", "public static Object getComponentInstance(String name, HttpServletRequest request) {\r\n\t\tServletContext sc = request.getSession().getServletContext();\r\n\t\tContainerWrapper containerWrapper = scf.findContainer(new ServletContextWrapper(sc));\r\n\t\tif (!containerWrapper.isStart()) {\r\n\t\t\tDebug.logError(\"JdonFramework not yet started, please try later \", module);\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\treturn containerWrapper.lookup(name);\r\n\t}", "@Override\n\tpublic java.lang.String getBeanIdentifier() {\n\t\treturn _vanBanPhapQuyLocalService.getBeanIdentifier();\n\t}", "public static Class<?> getType(String beanName) {\n return applicationContext.getType(beanName);\n }", "protected ApplicationBean1 getApplicationBean1() {\n return (ApplicationBean1)getBean(\"ApplicationBean1\");\n }", "protected ApplicationBean1 getApplicationBean1() {\n return (ApplicationBean1)getBean(\"ApplicationBean1\");\n }", "public Object lookup(FactoryInstance inst)\r\n {\r\n SpringFactoryInstance factoryInstance = (SpringFactoryInstance) inst;\r\n return factoryInstance.lookup();\r\n }", "@Bean(name = \"bean\") //name=\" \" to change the bean name\n public Address addressBean() {\n \treturn new Address();\n }", "Object getProperty(String name);", "@Override\n public java.lang.String getBeanIdentifier() {\n return _muQuxianQujianLocalService.getBeanIdentifier();\n }", "@Override\r\n\tpublic <T> T getInstance(Class<T> type) {\n\t\tfor( Scope key : beanFactories.keySet() ){\r\n\t\t\tT instance = beanFactories.get( key).getInstance(type);\r\n\t\t\tif (instance != null) {\r\n\t\t\t\treturn instance;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t}", "public Object getBean(Object obj, Interceptor interceptor) {\n return ProxyBeanUtil.getBean(obj, interceptor);\n }", "public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {\n return bean;\n }", "public static <T> T getBean(String beanName, Class<? extends Annotation> annotationType) {\n T t = (T) applicationContext.getBean(beanName);\n if (!t.getClass().isAnnotationPresent(annotationType)) {\n throw new NoSuchBeanDefinitionException(\"Resources don't exist.\");\n }\n return t;\n }", "public abstract Component getComponentByName(String name);", "@Override\n\tpublic Object getBeanCache(String name) {\n\t\treturn null;\n\t}", "public interface HomeService {\n public HomeBean getHomeBean(String name);\n}", "private <T> T getBean(SpringBootLambdaContainerHandler<AwsProxyRequest, AwsProxyResponse> handler,\n Class<T> beanClass) {\n return WebApplicationContextUtils.getWebApplicationContext(handler.getServletContext())\n .getBean(beanClass);\n }", "@Override\n public Object get(String name, ObjectFactory<?> objectFactory) {\n Map<String, Object> mapForThisThread = beanMap.get();\n\n Object obj = mapForThisThread.get(name);\n if(obj != null) {\n log.info(\"get {} resolved from scope\", name);\n return obj;\n }\n obj = objectFactory.getObject();\n mapForThisThread.put(name, obj);\n log.info(\"get {} resolved from factory\", name);\n return obj;\n }", "@Override\n public Object getProperty(final Object bean,\n final String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {\n\n if (!collections.isEmpty()) {\n final String key = getResolver().getProperty(name);\n Pair<String, Object> collectionInfo = collections.pop();\n if (bean instanceof Map) {\n Map map = (Map) bean;\n if (!map.containsKey(key)) {\n map.put(key, newNamedInstanceForCollection(collectionInfo.getA(), collectionInfo.getB(), key));\n }\n Object value = map.get(key);\n return trackCollectionOrMap(null, value, value);\n } else { // collection\n Object value = findByNameProperty(key, (Collection)bean);\n if (value == null) {\n // create it\n value = newNamedInstanceForCollection(collectionInfo.getA(), collectionInfo.getB(), key);\n ((Collection) bean).add(value);\n }\n return trackCollectionOrMap(null, value, value);\n }\n }\n\n Object resolved = null;\n\n try {\n resolved = getNestedProperty(bean, name);\n } catch (final NoSuchMethodException e) {\n // to avoid it being swallowed by caller wrap\n throw new InvocationTargetException(e, \"Cannot access property with key: \" + name);\n }\n\n return trackCollectionOrMap(name, resolved, bean);\n }", "public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {\n return bean;\n }", "public final BeanDefinition getBeanDefinition()\n/* */ {\n/* 53 */ return this.beanDefinition;\n/* */ }", "public Object elGetValue(Object bean);", "@Override\n\tpublic BeanEntity getBeanDefinition(String name) {\n\t\treturn null;\n\t}", "@Override\n\tpublic java.lang.String getBeanIdentifier() {\n\t\treturn _kpiEntryLocalService.getBeanIdentifier();\n\t}", "protected abstract Object createProcessBean(Name name);", "@Override\n public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {\n return bean;\n }", "public Object getBean(Class<?> clazz) {\n return getBean(clazz, Scope.SINGLETON, null, null);\n }", "@Override\n\tpublic MemberBean[] findByName(String name) {\n\t\treturn null;\n\t}", "@Override\n\tpublic AccountBean[] findByName(String name) {\n\t\treturn null;\n\t}", "public interface BeanFactory {\n Object createBean(String name);\n <T> T createBean(Class<T> t);\n}", "@Override\n public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {\n return bean;\n }", "public final void setBean(String bean) {\n this.bean = bean;\n }", "@Override\n\tpublic java.lang.String getBeanIdentifier() {\n\t\treturn _surveyLocalService.getBeanIdentifier();\n\t}", "public abstract ServiceLocator find(String name);", "public ServiceResultInterface getComponentByName(String name) {\n\t\tfor (ServiceResultInterface res : components) {\n\t\t\tif (res.getName().equals(name)) {\n\t\t\t\treturn res;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "@SuppressWarnings(\"unchecked\")\n @Override\n public <T> T get(String name) {\n Object value = this.transientFacts.get(name);\n if (Objects.isNull(value)) {\n // try to fetch from beanFacts\n value = this.beanFacts.get(name);\n }\n return (T) value;\n }", "@Override\n public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {\n return bean;\n }", "String getProperty(String name);", "public WebServiceEndpoint getEndpointByName(String endpointName) {\n for(Iterator iter = getEndpoints().iterator(); iter.hasNext();) {\n WebServiceEndpoint next = (WebServiceEndpoint) iter.next();\n if( next.getEndpointName().equals(endpointName) ) {\n return next;\n }\n }\n return null;\n }", "public static <T> T getBean(Class<T> cls) {\n\t\treturn ctx.getBean(cls);\n\t}", "Property findProperty(String propertyName);", "@Override\r\n public java.lang.String getBeanIdentifier() {\r\n return _contentHolderService.getBeanIdentifier();\r\n }" ]
[ "0.79964346", "0.786159", "0.77600926", "0.76266176", "0.75355107", "0.7450493", "0.7419184", "0.7288232", "0.7136635", "0.71234405", "0.7065102", "0.67924273", "0.6779629", "0.6707856", "0.67021966", "0.6622216", "0.66143364", "0.6528129", "0.6440731", "0.6407061", "0.63627493", "0.6362016", "0.63233244", "0.62842625", "0.62716687", "0.6242328", "0.6242328", "0.6242328", "0.6242328", "0.6242328", "0.6221012", "0.6210623", "0.62040436", "0.62040436", "0.62040436", "0.62040436", "0.62040436", "0.6174346", "0.6165441", "0.6089586", "0.6080098", "0.6063031", "0.60464984", "0.6029054", "0.6023463", "0.6023085", "0.5899629", "0.5889631", "0.58613646", "0.584793", "0.58180195", "0.5810622", "0.5810622", "0.5810622", "0.57627696", "0.57213646", "0.57140225", "0.56681883", "0.5638068", "0.5630358", "0.55715436", "0.55186605", "0.55186605", "0.55012906", "0.5493254", "0.5484564", "0.5471154", "0.5466243", "0.5463917", "0.54544586", "0.54496187", "0.54115236", "0.54105204", "0.54089224", "0.5390846", "0.53699774", "0.5367088", "0.5316336", "0.53086144", "0.52961355", "0.52882427", "0.5279044", "0.52717084", "0.5270279", "0.5252076", "0.52505064", "0.52187246", "0.5218228", "0.5189305", "0.5175539", "0.5170373", "0.5164768", "0.5164358", "0.51625896", "0.5152935", "0.5146055", "0.5131906", "0.5127117", "0.5118786", "0.5073171" ]
0.6773485
13
get interface all subclass by interface class type
public static String[] getBeanNamesForType(Class clazz) { return applicationContext.getBeanNamesForType(clazz); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Collection<ClassTranslator> getInterfaces();", "private static Class<?>[] getAllInterfacesForClass(Class<?> clazz) {\n return getAllInterfacesForClass(clazz, null);\n }", "TypeInfo[] interfaces();", "Set<Interface> getInterfaces();", "<T> IList<T> getImplementingObjects(Class<T> interfaceType);", "public static Set<Class<?>> getInterfaceClosure(Class<?> clazz) {\n Set<Class<?>> result = new HashSet<>();\n for (Class<?> classToDiscover = clazz; classToDiscover != null; classToDiscover = classToDiscover.getSuperclass()) {\n addInterfaces(classToDiscover, result);\n }\n return result;\n }", "private static Class<?>[] getAllInterfacesForClass(\n Class<?> clazz, @Nullable ClassLoader classLoader) {\n return toClassArray(getAllInterfacesForClassAsSet(clazz, classLoader));\n }", "public Set<Class<?>> getAllInterfaces(Class<?> clazz) {\n\t\tSet<Class<?>> result = new HashSet<Class<?>>();\n\t\tgetAllInterfaces(result, clazz);\n\t\treturn result;\n\t}", "@SuppressWarnings({ \"unchecked\"})\n\tpublic<T extends SubdocumentoIva<?, ?, ?>> List<T> getListaSubdocumentoIva(Class<T> classifClazz) {\n\t\t\n\t\tfinal List<T> result = new ArrayList<T>();\n\t\t\n\t\tfor (SDI c : listaSubdocumentoIva) {\n\t\t\tif(classifClazz.isInstance(c)){\n\t\t\t\tresult.add((T)c);\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn result;\n\t}", "String getInterfaces();", "Interface getInterface();", "Interface getInterface();", "public static Class<?>[] getAllInterfacesForClass(Class<?> clazz) {\n return getAllInterfacesForClass(clazz, null);\n }", "public String[] getInterfaces() {\n return m_classBuilder.getInterfaces();\n }", "private static Stream<Class<?>> superTypes(Class<?> type) {\n Class<?>[] interfaces = type.getInterfaces();\n return Stream.concat(\n Arrays.stream(interfaces).flatMap(SqlObjectFactory::superTypes),\n Arrays.stream(interfaces));\n }", "public Class<?>[] getAllInterfaces(Class<?> aClass) {\n\t\tList<Class<?>> result = new ArrayList<Class<?>>();\n\t\tthis.getAllInterfaces(aClass, result);\n\t\tClass<?> types[] = new Class[0];\n\t\treturn result.toArray(types);\n\t}", "public List<? extends IType> getSubtypes()\n {\n if( _subtypes == null )\n {\n _subtypes = new ArrayList<IGosuClassInternal>();\n Set<? extends CharSequence> typeNames = getTypeLoader().getAllTypeNames();\n for( CharSequence typeName : typeNames )\n {\n IType type = TypeSystem.getByFullNameIfValid(typeName.toString());\n if (type instanceof IGosuClassInternal) {\n IGosuClassInternal gosuClass = (IGosuClassInternal) type;\n if( getOrCreateTypeReference() != gosuClass && isAssignableFrom( gosuClass ) )\n {\n _subtypes.add( gosuClass );\n }\n }\n }\n }\n\n return _subtypes;\n }", "public static Class<?>[] getAllInterfaces(Object instance) {\n Assert.notNull(instance, \"Instance must not be null\");\n\n return getAllInterfacesForClass(instance.getClass());\n }", "public static Class<?>[] getAllInterfacesForClass(Class<?> clazz, ClassLoader classLoader) {\n Set<Class> ifcs = getAllInterfacesForClassAsSet(clazz, classLoader);\n return ifcs.toArray(new Class[ifcs.size()]);\n }", "@SuppressWarnings(\"rawtypes\")\n public static Set<Class> getAllInterfacesForClassAsSet(Class clazz, ClassLoader classLoader) {\n Preconditions.checkNotNull(clazz, \"Class must not be null\");\n if (clazz.isInterface() && isVisible(clazz, classLoader)) {\n return Collections.singleton(clazz);\n }\n Set<Class> interfaces = new LinkedHashSet<>();\n Class sclazz = clazz;\n while (sclazz != null) {\n Class<?>[] ifcs = sclazz.getInterfaces();\n for (Class<?> ifc : ifcs) {\n interfaces.addAll(getAllInterfacesForClassAsSet(ifc, classLoader));\n }\n sclazz = clazz.getSuperclass();\n }\n return interfaces;\n }", "@SuppressWarnings(\"rawtypes\")\n\tpublic List getInterfaces(){\n\t\treturn targetClass.interfaces;\n\t}", "public ArrayList<InterfaceType> getAllInterfaces() {\n HashSet<InterfaceType> set = new HashSet<>();\n ArrayList<InterfaceType> list = new ArrayList<>();\n\n for (InterfaceType interfaceType : getInterfaces()) {\n for (InterfaceType type : interfaceType.getAllInterfaces()) {\n if (set.add(type)) list.add(type);\n }\n }\n\n return list;\n }", "IInterfaceDefinition[] resolveImplementedInterfaces(ICompilerProject project);", "public interface AllClass extends AllClassAndEnum\r\n{\r\n}", "Set<Interface> getInterfacesByIp(IpAddress ip);", "public interface RTTIClass {\n\n /**\n * Get the value of baseClass\n *\n * @return the value of baseClass\n */\n public Class getBaseClass();\n\n /**\n * Set the value of baseClass\n *\n * @param baseClass new value of baseClass\n */\n //public void setBaseClass(Class baseClass);\n\n\n /**\n * Return true if class implements interface\n */\n public boolean isInstanceOf(Class c);\n\n\n public RTTIClass getRTTIClassRoot();\n\n\n public Annotation getAnnotation(Class baseClass) throws Throwable;\n public Collection<Annotation> getAnnotations() throws Throwable;\n\n public Field getField(String name) throws Throwable;\n public Collection<Field> getFields() throws Throwable;\n\n public Method getMethod(String name, Class[] types) throws Throwable;\n public Collection<Method> getMethods() throws Throwable;\n\n\n /*\n * Info\n */\n public Collection<String> getBeanFields() throws Throwable;\n //public Collection<Method> getBeanFieldMethods() throws Throwable;\n\n\n /*\n * Select\n */\n public RTTIClass select(ClassFilter filter);\n\n \n}", "private List<IClass> getChildren(IClass cls) {\n\t\tList<IClass> subclasses = new ArrayList<IClass>();\n\t\tCollections.addAll(subclasses, cls.getDirectSubClasses());\n\t\treturn subclasses;\n\t}", "public Iterator<IEventType<T>> getDeepSuperTypes();", "public Collection getSuperclasses(OWLClass aClass, ReasonerTaskListener taskListener) throws DIGReasonerException;", "Class<?>[] getProxiedInterfaces();", "public static Set<Class<?>> getAllInterfacesAsSet(Object instance) {\n Assert.notNull(instance, \"Instance must not be null\");\n\n return getAllInterfacesForClassAsSet(instance.getClass());\n }", "public abstract Class<?>[] getCoClasses();", "public static List m149887a(Class cls) {\n if (cls == null) {\n return null;\n }\n ArrayList arrayList = new ArrayList();\n while (cls != null) {\n Class[] interfaces = cls.getInterfaces();\n for (int i = 0; i < interfaces.length; i++) {\n if (!arrayList.contains(interfaces[i])) {\n arrayList.add(interfaces[i]);\n }\n for (Class cls2 : m149887a(interfaces[i])) {\n if (!arrayList.contains(cls2)) {\n arrayList.add(cls2);\n }\n }\n }\n cls = cls.getSuperclass();\n }\n return arrayList;\n }", "default List<TypeInfo> allTypes() {\n List<TypeInfo> allTypes = new LinkedList<>();\n allTypes.add(this);\n allTypes.addAll(Arrays.asList(interfaces()));\n allTypes.addAll(superClass().stream().flatMap(s -> s.allTypes().stream()).collect(Collectors.toList()));\n return allTypes;\n }", "public static Set findAllImplementedInterfaces(Class clazz) {\n Set s = new HashSet();\n Class[] interfaces = clazz.getInterfaces();\n for (int i = 0; i < interfaces.length; i++) {\n s.add(interfaces[i]);\n }\n Class superclass = clazz.getSuperclass();\n if (superclass != null) {\n s.addAll(findAllImplementedInterfaces(superclass));\n }\n return s;\n }", "@Override\n public List<JavaType> getInterfaces() {\n return ImmutableList.of();\n }", "private String getBaseInterface(OWLClass owlClass) {\n String baseInterfaceString = \"\";\n for (OWLClass superClass : inference.getSuperClasses(owlClass)) {\n if (inference.getOwlClasses().contains(superClass)) {\n baseInterfaceString += (baseInterfaceString.equals(\"\") ? \"\" : \", \") + names.getInterfaceName(superClass);\n }\n }\n if (baseInterfaceString.equals(\"\")) {\n return null;\n } else {\n return baseInterfaceString;\n }\n }", "public static Set<Class<?>> getAllInterfacesForClassAsSet(\n Class<?> clazz, @Nullable ClassLoader classLoader) {\n Assert.notNull(clazz, \"Class must not be null\");\n\n if (clazz.isInterface() && isVisible(clazz, classLoader)) {\n return Collections.singleton(clazz);\n }\n\n Set<Class<?>> interfaces = new LinkedHashSet<>();\n Class<?> currentClass = clazz;\n\n while (currentClass != null) {\n Class<?>[] interfaceArray = currentClass.getInterfaces();\n for (Class<?> cl : interfaceArray) {\n if (isVisible(cl, classLoader)) {\n interfaces.add(cl);\n }\n }\n currentClass = currentClass.getSuperclass();\n }\n\n return interfaces;\n }", "public List<ClassOrInterfaceDeclaration> getInterfaces() {\n return this.clsOrInterfDeclrs;\n }", "private Map<Class<?>, InterfaceInfo> getInterfaceInfoMap() {\n\t\tif (interfaceInfoMap == null) {\n\t\t\tinterfaceInfoMap = new HashMap<Class<?>, InterfaceInfo>();\n\t\t\tfor (final Class<?> c : packageClasses) {\n\t\t\t\tif (isInterestingInterface(c)) {\n\t\t\t\t\tif (!interfaceInfoMap.containsKey(c)) {\n\t\t\t\t\t\tinterfaceInfoMap.put(c, new InterfaceInfo(c));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tfinal Contract contract = c.getAnnotation(Contract.class);\n\t\t\t\t\tif (contract != null) {\n\t\t\t\t\t\tInterfaceInfo ii = interfaceInfoMap.get(contract\n\t\t\t\t\t\t\t\t.value());\n\t\t\t\t\t\tif (ii == null) {\n\t\t\t\t\t\t\tii = new InterfaceInfo(contract.value());\n\t\t\t\t\t\t\tinterfaceInfoMap.put(contract.value(), ii);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tii.add(c);\n\t\t\t\t\t} \n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn interfaceInfoMap;\n\t}", "private static <T> Collection<Class<?>> getClassHierarchy(T instance) {\n Collection<Class<?>> hierarchy = new LinkedList<>();\n Class<?> clazz = (Class<?>) instance;\n while (clazz != null) {\n hierarchy.add(clazz);\n clazz = clazz.getSuperclass();\n }\n return hierarchy;\n }", "public Class getImplementedInterface()\n {\n // This method will be autogenerated for user classes.\n return G2__Base.class; \n }", "interface NewInterface extends Interface1,Interface2,Interface3{\n\n\tpublic void getD();\n\n}", "public static Set<Class<?>> getAllInterfacesForClassAsSet(Class<?> clazz) {\n return getAllInterfacesForClassAsSet(clazz, null);\n }", "public IEventType<T>[] getSuperTypes();", "public List getInterfaceExtensions();", "Interface_decl getInterface();", "public static List<Class> getLocalRemoteInterfaces(Class toAnalyse) {\r\n\t\tfinal List<Class> back = new ArrayList<Class>();\r\n\t\tif (toAnalyse != null) {\r\n\t\t\tClass[] interfaces = toAnalyse.getInterfaces();\r\n\t\t\tif (interfaces != null) {\r\n\t\t\t\tfor (Class<Object> interf : interfaces) {\r\n\t\t\t\t\tif (interf.getAnnotation(Local.class) != null\r\n\t\t\t\t\t\t\t|| interf.getAnnotation(Remote.class) != null) {\r\n\t\t\t\t\t\tback.add(interf);\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\treturn back;\r\n\t}", "private void getAllInterfaces(Class theClass, Map hInterfaces) {\r\n\t\tClass[] interfaces = theClass.getInterfaces();\r\n\t\tfor (int i = 0; i < interfaces.length; i++) {\r\n\t\t\thInterfaces.put(interfaces[i].getName(), interfaces[i]);\r\n\t\t\tgetAllInterfaces(interfaces[i], hInterfaces);\r\n\t\t}\r\n\t}", "public List<InterfaceBean> readInterface() {\n\t\tlog.info(\"## readInterface() : \");\n\t\treturn sqlSelectForList(\"com.lgcns.ikep4.workflow.engine.model.InterfaceBean.readInterface\");\n\t}", "private Stream<TypeElement> getConcreteSubclassesStream(String baseClassName) {\n final TypeElement baseFlowTypeElement =\n sourceRoot.getElementUtils().getTypeElement(baseClassName);\n return ElementFilter.typesIn(sourceRoot.getIncludedElements()).stream()\n .filter(\n typeElement ->\n sourceRoot\n .getTypeUtils()\n .isSubtype(typeElement.asType(), baseFlowTypeElement.asType())\n && !typeElement.getModifiers().contains(Modifier.ABSTRACT));\n }", "public interface IChildrenQuery<C extends SuperVO> {\n\n List<C> queryByParentPk(String parentPk);\n}", "InstrumentedType withInterfaces(TypeList.Generic interfaceTypes);", "public Collection<BusinessInterfaceDescriptor<?>> getLocalBusinessInterfaces() {\n \n Set<BusinessInterfaceDescriptor<?>> localBusIntfs = new HashSet<BusinessInterfaceDescriptor<?>>();\n\n if( ejbDesc.getType().equals(EjbSessionDescriptor.TYPE) ) {\n\n EjbSessionDescriptor sessionDesc = (EjbSessionDescriptor) ejbDesc;\n Set<String> localNames = sessionDesc.getLocalBusinessClassNames();\n\n // Add superinterfaces that are also marked as Local\n Set<String> extraNames = new HashSet<String>();\n for(String local : localNames) {\n try {\n Class localClass = sessionDesc.getEjbBundleDescriptor().getClassLoader().loadClass(local);\n addIfLocal(localClass.getInterfaces(), extraNames);\n } catch(ClassNotFoundException e) {\n throw new IllegalStateException(e);\n }\n }\n\n localNames.addAll(extraNames);\n\n // Include the no-interface Local view\n if( sessionDesc.isLocalBean() ) {\n localNames.add(sessionDesc.getEjbClassName());\n }\n\n\n for(String local : localNames) {\n try {\n\n Class localClass = sessionDesc.getEjbBundleDescriptor().getClassLoader().loadClass(local);\n BusinessInterfaceDescriptor busIntfDesc =\n new BusinessInterfaceDescriptorImpl(localClass);\n localBusIntfs.add(busIntfDesc);\n\n } catch(ClassNotFoundException e) {\n throw new IllegalStateException(e);\n }\n }\n }\n \n return localBusIntfs;\n }", "Set<Concept> getSubclasses(Concept concept);", "static private void\n ifaces(final Class<?> type, final ArrayBuilder<String> r) {\n if (type == Serializable.class) { return; }\n if (Modifier.isPublic(type.getModifiers())) {\n try { r.append(Reflection.getName(type).replace('$', '-')); }\n catch (final Exception e) {}\n }\n for (final Class<?> i : type.getInterfaces()) { ifaces(i, r); }\n }", "private Stream<Element> superTypeForInheritDoc(JavacTask task, Element type) {\n TypeElement clazz = (TypeElement) type;\n Stream<Element> result = interfaces(clazz);\n result = Stream.concat(result, interfaces(clazz).flatMap(el -> superTypeForInheritDoc(task, el)));\n\n if (clazz.getSuperclass().getKind() == TypeKind.DECLARED) {\n Element superClass = ((DeclaredType) clazz.getSuperclass()).asElement();\n result = Stream.concat(result, Stream.of(superClass));\n result = Stream.concat(result, superTypeForInheritDoc(task, superClass));\n }\n\n return result;\n }", "Set<Interface> getMatchingInterfaces(IpAddress ip);", "public Collection getSubclasses(OWLClass aClass, ReasonerTaskListener taskListener) throws DIGReasonerException;", "private static DocCommentTree searchInInterfaces(\n CompilationInfo javac, TypeElement class2query, TypeElement overriderClass,\n ExecutableElement overrider, Set<TypeElement> exclude) {\n \n // Step 1\n for (TypeMirror ifceMirror : class2query.getInterfaces()) {\n if (ifceMirror.getKind() == TypeKind.DECLARED) {\n TypeElement ifceEl = (TypeElement) ((DeclaredType) ifceMirror).asElement();\n if (exclude.contains(ifceEl)) {\n continue;\n }\n // check methods\n DocCommentTree jdoc = searchInMethods(javac, ifceEl, overriderClass, overrider);\n if (jdoc != null) {\n return jdoc;\n }\n exclude.add(ifceEl);\n }\n }\n // Step 2\n for (TypeMirror ifceMirror : class2query.getInterfaces()) {\n if (ifceMirror.getKind() == TypeKind.DECLARED) {\n TypeElement ifceEl = (TypeElement) ((DeclaredType) ifceMirror).asElement();\n DocCommentTree jdoc = searchInInterfaces(javac, ifceEl, overriderClass, overrider, exclude);\n if (jdoc != null) {\n return jdoc;\n }\n }\n }\n // Step 3\n return searchInSuperclass(javac, class2query, overriderClass, overrider, exclude);\n }", "private EClass[] getTypedRelationships(EClass supertype) {\n ArrayList<EClass> list = new ArrayList<EClass>();\n \n for(EClass eClass : ArchimateModelUtils.getRelationsClasses()) {\n if(supertype.isSuperTypeOf(eClass)) {\n list.add(eClass);\n }\n }\n \n return list.toArray(new EClass[list.size()]);\n }", "public Class getBaseClass();", "public void testObjectSuperclassOfInterface() throws NoSuchMethodException {\n assertEquals(Object.class, GenericTypeReflector.getExactSuperType(ArrayList.class, Object.class));\n assertEquals(Object.class, GenericTypeReflector.getExactSuperType(List.class, Object.class));\n assertEquals(Object.class, GenericTypeReflector.getExactSuperType(String[].class, Object.class));\n }", "public int[] getInterfaces() {\n return interfaces;\n }", "String getInstanceOfClass();", "@Override\n public List<BaiseeClazz> findAllClazzInfo() {\n return claMapper.findAllClazzInfo();\n }", "public IType getType();", "java.util.List<org.mojolang.mojo.lang.NominalType> \n getInheritsList();", "@Override\n\tpublic List<TClassInfo> getClazzs(String hql) {\n\t\tSession session=HibernateSessionFactory.getSession();\n\t\tTransaction transaction=session.beginTransaction();\n\t\tQuery query=session.createQuery(hql);\n\t\tList<TClassInfo> clazzs=new ArrayList<TClassInfo>();\n\t\tclazzs=query.list();\n\t\ttransaction.commit();\n\t\tsession.close();\n\t\treturn clazzs;\n\t}", "public List<Class<?>> getAllSuperTypes(Class<?> aClass) {\n\t\tList<Class<?>> result = new ArrayList<Class<?>>();\n\n\t\tthis.getAllSuperTypes(aClass, result);\n\t\tthis.getAllInterfaces(aClass, result);\n\n\t\treturn result;\n\t}", "interface I6 extends I5, I4 {\n}", "static private PowerlessArray<String>\n types(final Class<?> actual) {\n final Class<?> end =\n Struct.class.isAssignableFrom(actual) ? Struct.class : Object.class;\n final PowerlessArray.Builder<String> r = PowerlessArray.builder(4);\n for (Class<?> i=actual; end!=i; i=i.getSuperclass()) { ifaces(i, r); }\n return r.snapshot();\n }", "public interface a extends IInterface {\n}", "private static Class toConcreteType(Class intf, Map concretes) {\n Class concrete = (Class) concretes.get(intf);\n if (concrete != null)\n return concrete;\n Class[] intfs = intf.getInterfaces();\n for (Class aClass : intfs) {\n concrete = toConcreteType(aClass, concretes);\n if (concrete != null)\n return concrete;\n }\n return null;\n }", "public abstract Object getInterface(String strInterfaceName_p, Object oObject_p) throws Exception;", "public String getClazz();", "List<ITypeDescriptor> getSubTypes(String type) throws StoreException;", "Set<Interface> getInterfacesByPort(ConnectPoint port);", "public void printDetailsInterfaces(Class clstype, int classdepth) {\n\t\tSystem.out.println(\"Class depth is: \" + classdepth + \" Class Name is: \" + clstype.getName());\n\t\t// Recurse to get super class details\n\t\tif (clstype.getSuperclass() != null) {\n\t\t\t// Get all the details\n\t\t\tprintDetailsInterfaces(clstype.getSuperclass(), classdepth + 1);\n\t\t}\n\t\t// Get all the interfaces that the input class implements.\n\t\tClass[] interfacesimp = clstype.getInterfaces();\n\t\tSystem.out.println(\"Printing the implemented interfaces\");\n\t\tfor (int i = 0; i < interfacesimp.length; i++) {\n\t\t\tprintDetailsInterfaces(interfacesimp[i], classdepth + 1);\n\t\t}\n\t}", "@AssignableSubInterfaces(get={})\n\n@ImplementationClass(get=Brain.class)\n public interface IBrain\n extends ICentralNervousSystem{\n\n}", "XClass getSuperclass();", "public abstract List<AbstractNodeTypeImplementation> getImplementations();", "private List<ManagedInterface> getInterfaces(HttpSession userSession, int nodeId) throws SQLException {\n Connection connection = null;\n List<ManagedInterface> allInterfaces = new ArrayList<ManagedInterface>();\n int lineCount = 0;\n\n final DBUtils d = new DBUtils(getClass());\n try {\n connection = DataSourceFactory.getInstance().getConnection();\n d.watch(connection);\n\n PreparedStatement ifaceStmt = connection.prepareStatement(INTERFACE_QUERY);\n d.watch(ifaceStmt);\n ifaceStmt.setInt(1, nodeId);\n\n ResultSet ifaceResults = ifaceStmt.executeQuery();\n d.watch(ifaceResults);\n while (ifaceResults.next()) {\n lineCount++;\n ManagedInterface newInterface = new ManagedInterface();\n newInterface.setNodeid(nodeId);\n newInterface.setAddress(ifaceResults.getString(1));\n newInterface.setStatus(ifaceResults.getString(2));\n allInterfaces.add(newInterface);\n\n PreparedStatement svcStmt = connection.prepareStatement(SERVICE_QUERY);\n d.watch(svcStmt);\n svcStmt.setInt(1, nodeId);\n svcStmt.setString(2, newInterface.getAddress());\n\n ResultSet svcResults = svcStmt.executeQuery();\n d.watch(svcResults);\n while (svcResults.next()) {\n lineCount++;\n ManagedService newService = new ManagedService();\n newService.setId(svcResults.getInt(1));\n newService.setName(svcResults.getString(2));\n newService.setStatus(svcResults.getString(3));\n newInterface.addService(newService);\n }\n }\n userSession.setAttribute(\"lineItems.nodemanagement\", new Integer(lineCount));\n } finally {\n d.cleanUp();\n }\n return allInterfaces;\n }", "HashMap<String, Set<URI>> getExternalSuperClasses();", "java.lang.Class getReceiversImpl();", "public Set<TestInfo> getInfoByInterfaceClass(final Class<?> contract) {\n\t\tfinal Set<TestInfo> ti = interfaceToInfoMap.get(contract);\n\t\tif (ti == null) {\n\t\t\tLOG.debug(String.format(\"Found no tests for interface %s.\", contract));\n\t\t\treturn Collections.emptySet();\n\t\t}\n\t\treturn interfaceToInfoMap.get(contract);\n\t}", "public Collection<Interface> getInterfaces() {\n\t\treturn this.interfaces;\n\t}", "public interface LizaCow extends Cow {\n\n}", "public interface CategoryInterface extends TypeHolder, Typable, Serializable {\r\n\r\n\t/**\r\n\t * Ovoj metod ke kreira igra spored tipot.\r\n\t * @param type tipot na igrata sto treba da se kreira\r\n\t * @param tags tagovite koi potoa ke se predadat na igrata sto se kreira\r\n\t * @return kreiranata igra\r\n\t * @throws GameDoesNotExistException kategorijata od koja sto ja barate igrata ne znae da ja kreira\r\n\t * @throws InvalidViewTypeException ispratenoto view ne moze da se iskoristi za toj tip na igra\r\n\t * @throws MissingTagException nedostiga nekoj tag za definiranje na igrata\r\n\t */\r\n\tpublic Game getGame(String type, Iterator<String> tags, Object view, String question) throws GameDoesNotExistException, InvalidViewTypeException, MissingTagException;\r\n\t\r\n\tpublic String getName();\r\n\t\r\n\tpublic String getResourceName();\r\n}", "public static ArrayList<Class> getClassesFromInstructor(Instructor i)\n\t{\n\t\tint instructorId = i.getUserId();\n\t\tString sql = \"SELECT c.* FROM UserInfo i, Class c WHERE c.instructorID = ? AND i.userID = ?\";\n\t\tArrayList<Class> classes = new ArrayList<Class>();\n\t\ttry(Connection conn = DriverManager.getConnection(db, user, pwd);\n\t\t\t\tPreparedStatement ps = conn.prepareStatement(sql);)\n\t\t{\n\t\t\tps.setInt(1, instructorId);\n\t\t\tps.setInt(2, instructorId);\n\t\t\tResultSet rs = ps.executeQuery();\n\t\t\twhile(rs.next())\n\t\t\t{\n\t\t\t\tString name = rs.getString(\"classname\");\n\t\t\t\tString classcode = rs.getString(\"classcode\");\n\t\t\t\tClass c = new Class(i, name, classcode);\n\t\t\t\tclasses.add(c);\n\t\t\t}\n\t\t} catch (SQLException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn classes;\n\t}", "Set<Interface> getInterfacesByVlan(VlanId vlan);", "public static HashMap getInterfaces() {\n\t\treturn interfacehashmapAlreadyImpl;\r\n\t\t\r\n\t}", "public static void addInterfaces(Model model) throws MolgenisModelException\r\n\t{\r\n\t\tlogger.debug(\"add root entities for interfaces...\");\r\n\t\tfor (Entity entity : model.getEntities())\r\n\t\t{\r\n\t\t\t// Generate the interface if rootAncestor (so has subclasses) and\r\n\t\t\t// itself is not an interface...\r\n\t\t\tif (entity.isRootAncestor())\r\n\t\t\t{\r\n\t\t\t\tEntity rootAncestor = entity;\r\n\t\t\t\tif (!entity.isAbstract())\r\n\t\t\t\t{\r\n\r\n\t\t\t\t\t// generate a new interface\r\n\t\t\t\t\trootAncestor = new Entity(\"_\" + entity.getName() + \"Interface\", entity.getName(),\r\n\t\t\t\t\t\t\tmodel.getDatabase());\r\n\t\t\t\t\trootAncestor\r\n\t\t\t\t\t\t\t.setDescription(\"Identity map table for \"\r\n\t\t\t\t\t\t\t\t\t+ entity.getName()\r\n\t\t\t\t\t\t\t\t\t+ \" and all its subclasses. \"\r\n\t\t\t\t\t\t\t\t\t+ \"For each row that is added to \"\r\n\t\t\t\t\t\t\t\t\t+ entity.getName()\r\n\t\t\t\t\t\t\t\t\t+ \" or one of its subclasses, first a row must be added to this table to get a valid primary key value.\");\r\n\t\t\t\t\t// rootAncestor.setAbstract( true );\r\n\r\n\t\t\t\t\t// copy key fields to interface and unset auto key in child\r\n\t\t\t\t\tVector<Field> keyfields = entity.getKey(0).getFields();\r\n\t\t\t\t\tVector<String> keyfields_copy = new Vector<String>();\r\n\t\t\t\t\tfor (Field f : keyfields)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tField key_field = new Field(rootAncestor, f.getType(), f.getName(), f.getName(), f.isAuto(),\r\n\t\t\t\t\t\t\t\tf.isNillable(), f.isReadOnly(), f.getDefaultValue());\r\n\t\t\t\t\t\tkey_field.setDescription(\"Primary key field unique in \" + entity.getName()\r\n\t\t\t\t\t\t\t\t+ \" and its subclasses.\");\r\n\t\t\t\t\t\tif (key_field.getType() instanceof StringField) key_field.setVarCharLength(key_field\r\n\t\t\t\t\t\t\t\t.getVarCharLength());\r\n\t\t\t\t\t\trootAncestor.addField(key_field);\r\n\t\t\t\t\t\tkeyfields_copy.add(key_field.getName());\r\n\r\n\t\t\t\t\t\tif (f.isAuto())\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t// unset auto key in original, but\r\n\r\n\t\t\t\t\t\t\t// SOLVED BY TRIGGERS Field autoField =\r\n\t\t\t\t\t\t\t// entity.getField(f.getName());\r\n\t\t\t\t\t\t\t// SOLVED BY TRIGGERS autoField.setAuto(false);\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\trootAncestor.addKey(keyfields_copy, entity.getKey(0).isSubclass(), null);\r\n\r\n\t\t\t\t\tVector<String> parents = new Vector<String>();\r\n\t\t\t\t\tparents.add(rootAncestor.getName());\r\n\t\t\t\t\tentity.setParents(parents);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// add the type enum to the root element\r\n\t\t\t\tVector<Entity> subclasses = entity.getAllDescendants();\r\n\t\t\t\tVector<String> enumOptions = new Vector<String>();\r\n\t\t\t\tenumOptions.add(entity.getName());\r\n\t\t\t\tfor (Entity subclass : subclasses)\r\n\t\t\t\t{\r\n\t\t\t\t\tenumOptions.add(subclass.getName());\r\n\t\t\t\t}\r\n\t\t\t\tField type_field = new Field(rootAncestor, new EnumField(), Field.TYPE_FIELD, Field.TYPE_FIELD, true,\r\n\t\t\t\t\t\tfalse, false, null);\r\n\t\t\t\ttype_field.setDescription(\"Subtypes of \" + entity.getName() + \". Have to be set to allow searching\");\r\n\t\t\t\ttype_field.setEnumOptions(enumOptions);\r\n\t\t\t\ttype_field.setHidden(true);\r\n\t\t\t\trootAncestor.addField(0, type_field);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public interface EntidadBase extends EntidadOrdenada {\n enum tipo {\n seccion, informacion\n }\n\n SeccionBase getSeccionBase();\n\n void setSeccionBase(SeccionBase seccionBase);\n\n tipo getTipoEntidad();\n}", "String getClazz();", "Set<Concept> getSuperclasses(Concept concept);", "public interface ITypeRegistry extends IRegistry<ISourceType> {\n}", "public Set<JavaType.ClassJavaType> superTypes() {\n ImmutableSet.Builder<JavaType.ClassJavaType> types = ImmutableSet.builder();\n JavaType.ClassJavaType superClassType = (JavaType.ClassJavaType) this.superClass();\n types.addAll(this.interfacesOfType());\n while (superClassType != null) {\n types.add(superClassType);\n TypeJavaSymbol superClassSymbol = superClassType.getSymbol();\n types.addAll(superClassSymbol.interfacesOfType());\n superClassType = (JavaType.ClassJavaType) superClassSymbol.superClass();\n }\n return types.build();\n }", "public interface InterfaceB extends SuperInterface{\n\n int getB();\n}", "IfaceType findDataType(String cls,List<IfaceAnnotation> annots);", "public int[] getSubclasses() {\n return subclasses;\n }" ]
[ "0.6878797", "0.67680293", "0.6599951", "0.6560383", "0.6541091", "0.64673764", "0.6310602", "0.61826444", "0.6175833", "0.61224127", "0.6109677", "0.6109677", "0.60940444", "0.60816187", "0.6065243", "0.60587126", "0.6011333", "0.6007515", "0.59966296", "0.591689", "0.59066707", "0.5883687", "0.58551025", "0.5831767", "0.5817895", "0.5816661", "0.5794389", "0.57913506", "0.5783297", "0.5763856", "0.5738223", "0.57116663", "0.5694315", "0.567951", "0.5667548", "0.5667009", "0.56567574", "0.5653766", "0.56405467", "0.5618507", "0.5612405", "0.561076", "0.5596165", "0.5586755", "0.5524851", "0.55131614", "0.550607", "0.5495405", "0.5494728", "0.54852927", "0.5469343", "0.5468908", "0.54601127", "0.5456564", "0.54548615", "0.5408585", "0.5406859", "0.5406653", "0.54014206", "0.5399921", "0.5398796", "0.5391642", "0.53861964", "0.5365329", "0.5363188", "0.5344198", "0.5343289", "0.53316927", "0.5329483", "0.53284913", "0.53226787", "0.5310573", "0.53076935", "0.53027874", "0.5296172", "0.52925575", "0.5287512", "0.5281749", "0.5281164", "0.52789146", "0.5273312", "0.5272397", "0.5255681", "0.5250285", "0.52444464", "0.5238472", "0.5217412", "0.52164567", "0.52066064", "0.5206456", "0.5188698", "0.5179198", "0.5173502", "0.5169317", "0.5168634", "0.51450896", "0.5144666", "0.5138764", "0.51369554", "0.5135904", "0.5135624" ]
0.0
-1
get bean class by bean name
public static Class<?> getType(String beanName) { return applicationContext.getType(beanName); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static Object getBean(String name) {\r\n\t\tWebApplicationContext wac = ContextLoader.getCurrentWebApplicationContext();\r\n\t\treturn wac.getBean(name);\r\n\t}", "public <T> T getBean(String beanName, Class<T> ofType) throws CouldNotResolveBeanException;", "public Object findBean(String beanName) {\n\t\tFacesContext context = FacesContext.getCurrentInstance();\n\t\treturn context.getApplication().evaluateExpressionGet(context, \"#{\" + beanName + \"}\", Object.class);\n\t}", "public Object getBean(String name) {\n Object bean = beanMap.get(name);\n if (bean == null) {\n throw new IllegalArgumentException(\"there is no bean with name \" + name);\n }\n\n return bean;\n }", "public static Object lookupBean(String name) {\n BeanManager manager = lookupBeanManager();\n Set<Bean<?>> beans = manager.getBeans(name);\n if (beans != null && !beans.isEmpty()) {\n Bean<?> bean = beans.iterator().next();\n CreationalContext<?> context = manager.createCreationalContext(bean);\n return manager.getReference(bean, Object.class, context);\n }\n return null;\n }", "public Class<?> getBeanClass() {\r\n return beanClass;\r\n }", "public Object getBean(String name) {\r\n\t\tif (ctx == null) {\r\n\t\t\tctx = WebApplicationContextUtils\r\n\t\t\t\t\t.getRequiredWebApplicationContext(servlet\r\n\t\t\t\t\t\t\t.getServletContext());\r\n\t\t}\r\n\t\treturn ctx.getBean(name);\r\n\t}", "@Override\r\n\tpublic Object getInstance(String beanName) {\n\t\tfor( Scope key : beanFactories.keySet() ){\r\n\t\t\tObject instance = beanFactories.get( key).getInstance(beanName);\r\n\t\t\tif (instance != null) {\r\n\t\t\t\treturn instance;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t}", "public static Object getBean(String beanName) {\r\n return CONTEXT.getBean(beanName);\r\n }", "public static Object getBean(ExecuteContext context, String beanName) throws Exception {\r\n\t\treturn WebApplicationContextUtils.getRequiredWebApplicationContext(context.getRequest().getSession().getServletContext()).getBean(beanName);\r\n\t}", "IBeanConfiguration getBeanConfiguration(String beanName);", "public Class<BEAN> getBeanClass() {\n\t\treturn beanClass;\n\t}", "private static String beanName(Object bean) {\r\n\t\tString fullClassName = bean.getClass().getName();\r\n\t\tString classNameTemp = fullClassName.substring(fullClassName\r\n\t\t\t\t.lastIndexOf(\".\") + 1, fullClassName.length());\r\n\t\treturn classNameTemp.substring(0, 1) + classNameTemp.substring(1);\r\n\t}", "@SuppressWarnings(\"unchecked\")\n public static <T> T getBean(String name) {\n assertContextInjected();\n return (T) applicationContext.getBean(name);\n }", "public interface BeanFactory {\n\n Object getBean(Class<?> clazz);\n\n}", "@Override\n\tpublic Class<?> getLogicClassForBeanName(String clsFullName) {\n\t\t\n\t\t// Have we seen this class before?\n\t\tString cachedLogicName = logicClassNames.get(clsFullName);\n\t\tif (cachedLogicName != null && cachedLogicName.length() > 0)\n\t\t\treturn loadClass(cachedLogicName);\n\t\tif (cachedLogicName != null && cachedLogicName.length() == 0) // We've already looked for it, and it's not there\n\t\t\treturn null;\n\t\t\n\t\tString clsName = clsFullName;\n\t\tString clsPackageName = \"\";\n\t\tint lastDotIdx = clsFullName.lastIndexOf('.');\n\t\tif (lastDotIdx >= 0) { // In case the class doesn't have a package. Stranger things have happened.\n\t\t\tclsName = clsFullName.substring(lastDotIdx + 1);\n\t\t\tclsPackageName = clsFullName.substring(0, lastDotIdx);\n\t\t}\n\t\tString logicClassName = null;\n\t\t\n\t\t// We now know the bean's package and the name of the bean class. First of all, has the user specified\n\t\t// where the logic should be found?\n\t\tString possiblePackages = LogicConfiguration.getInstance().getProperty(LogicConfiguration.PropertyName.LOGIC_PACKAGE_NAMES);\n\t\t\n\t\tString parallelPackageName = LogicConfiguration.getInstance().getProperty(PropertyName.PARALLEL_PACKAGE_NAME);\n\t\tString logicClassSuffix = LogicConfiguration.getInstance().getProperty(PropertyName.LOGIC_CLASS_SUFFIX);\n\t\t\n\t\t// If the user has told us where to find the logic classes, look there\n\t\tif (possiblePackages != null && possiblePackages.trim().length() > 0) {\n\t\t\tString[] packages = possiblePackages.split(\",\");\n\t\t\tfor (String pkg : packages) {\n\t\t\t\tString possibleLogicName = pkg.trim() + \".\" + clsName + logicClassSuffix;\n\t\t\t\tif (classExists(possibleLogicName)) {\n\t\t\t\t\tlogicClassName = possibleLogicName;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// No package specified in the configuration file -- assume a parallel package\n\t\telse {\n\t\t\tif (log.isDebugEnabled())\n\t\t\t\tlog.debug(\"Looking for logic class in default package for \" + clsFullName);\n\t\t\tString possibleLogicName = null;\n\t\t\tint lastIdx = clsPackageName.lastIndexOf('.');\n\t\t\tif (lastIdx > 0) { // Package has at least two levels (e.g. a.b)\n\t\t\t\tString logicPkgName = clsPackageName.substring(0, lastIdx) + \".\" + parallelPackageName;\n\t\t\t\tpossibleLogicName = logicPkgName + \".\" + clsName + logicClassSuffix;\n\t\t\t}\n\t\t\telse if (clsPackageName.length() > 0) { // Package has only one level\n\t\t\t\tpossibleLogicName = parallelPackageName + \".\" + clsName + logicClassSuffix;\n\t\t\t}\n\t\t\telse { // No package\n\t\t\t\tpossibleLogicName = clsName + logicClassSuffix;\n\t\t\t}\n\n\t\t\tif (classExists(possibleLogicName)) {\n\t\t\t\tlogicClassName = possibleLogicName;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// No point in doing this again for the same bean class -- cache the result\n\t\tif (logicClassName == null) {\n\t\t\tlogicClassNames.put(clsFullName, \"\"); // Empty string means we've looked for it and it ain't there\n\t\t\treturn null;\n\t\t}\n\n\t\tlogicClassNames.put(clsFullName, logicClassName);\n\t\treturn loadClass(logicClassName);\n\t}", "public interface BeanFactory {\n\n// BeanDefinition getBeanDefinition(String beanID);\n\n Object getBean(String beanID);\n}", "public interface BeanResolver {\n\n\n\t/**\n\t * Returns the bean of the correct type.\n\t * \n\t * @param <T>\t\tClass of bean.\n\t * @param beanName\tName of the bean to return.\n\t * @param ofType\tClass of the bean to get.\n\t * \n\t * @return The bean with matching bean name.\n\t * @throws CouldNotResolveBeanException if bean can not be located.\n\t **/\n\tpublic <T> T getBean(String beanName, Class<T> ofType) throws CouldNotResolveBeanException;\n}", "public Object getBean(String name) throws Exception {\n\t\tObject bean = beanMap.get(name);\n\t\tif (bean != null) {\n\t\t\treturn bean;\n\t\t}\n\t\t// 如果实例好的beanMap找不到bean 就先创建再返回\n\t\tbean = createBean(beanDefineMap.get(name));\n\t\n\t\t\n\t\tif(bean != null) {\n\t\t\tpopulatebean(bean);\n\t\t //检查properties中是否有定义代理增强\n\t\t String proxyAdvisorClassName = proxyProp.getProperty(name + \".proxy.class\");\n\t\t\tif (proxyAdvisorClassName != null && proxyAdvisorClassName.trim().length() > 0) {\n\t\t\t Class<?> proxyAdvisorClass = Class.forName(proxyAdvisorClassName);\n\t\t String[] methods = proxyProp.getProperty(name + \".proxy.methods\").split(\",\");\n\n\t\t\t InvocationHandler proxyHandler = (InvocationHandler) proxyAdvisorClass\n\t\t .getConstructors()[0].newInstance(bean, Arrays.asList(methods));\n\t\t\t // 动态代理创建对象\n\t\t Object proxy = Proxy.newProxyInstance(bean.getClass().getClassLoader(),\n\t\t bean.getClass().getInterfaces(), proxyHandler);\n\t\t bean = proxy;\n\t\t\t}\n\t\t\tbeanMap.put(name, bean);\n\t\t}\n\t\t\t\t\n\t\treturn bean;\n\t}", "public Object getBean(String className) throws BaseException {\r\n\t\ttry {\r\n\t\t\tObject retVal = this.springApplicationContext.getBean(className);\r\n\t\t\tlogger.debug(\"returning an instance of \" + className);\r\n\t\t\treturn retVal;\r\n\t\t} catch (Exception e) {\r\n\t\t\tlogger.error(\"failed retrieving bean from local factory\", e);\r\n\t\t\te.printStackTrace();\r\n\t\t\tthrow new BaseException(e.getMessage(), e);\r\n\t\t}\r\n\t}", "public Class<T> getBeanClass() {\n return this.type;\n }", "Object getBean();", "public java.lang.String getBeanIdentifier();", "public static <T> T getBean(String beanName) {\n return (T) applicationContext.getBean(beanName);\n }", "protected <T> T lookupBean(Class<T> beanClass, String beanName)\r\n\t\t\tthrows ServletException {\r\n\t\tHashtable<String, String> env = new Hashtable<String, String>();\r\n\t\tenv.put(Context.INITIAL_CONTEXT_FACTORY,\r\n\t\t\t\t\"org.jnp.interfaces.NamingContextFactory\");\r\n\t\tenv.put(Context.PROVIDER_URL, \"localhost:1099\");\r\n\r\n\t\ttry {\r\n\t\t\tInitialContext jndiContext = new InitialContext(env);\r\n\t\t\treturn beanClass.cast(jndiContext.lookup(beanName));\r\n\t\t} catch (NamingException e) {\r\n\t\t\tthrow new ServletException();\r\n\t\t}\r\n\t}", "private static SingerWithJSR250 getBean(String beanName, ApplicationContext context) {\n\t\ttry {\n\t\t\tSingerWithJSR250 bean = (SingerWithJSR250) context.getBean(beanName);\n\t\t\treturn bean;\n\t\t} catch (Exception e) {\n\t\t\t// TODO: handle exception\n\t\t\tSystem.out.println(\"An error occured in bean configuration: \" + e.getMessage());\n\t\t\treturn null;\n\t\t}\n\t}", "BeanFactory getBeanFactory();", "ComponentBean getBean();", "protected <T> T getBean( String name, Class<T> t ) {\n try {\n return this.applicationContext.getBean( name, t );\n } catch ( BeansException e ) {\n throw new RuntimeException( e );\n } catch ( Exception e ) {\n throw new RuntimeException( e );\n }\n }", "public interface BeanFactory {\n\n /**\n * @param name\n * @return\n * @throws Exception\n */\n Object getBean(String name) throws Exception;\n\n}", "public String getImplementationBean(String linkName);", "public static java.lang.String getBeanIdentifier() {\n\t\treturn getService().getBeanIdentifier();\n\t}", "public static java.lang.String getBeanIdentifier() {\n\t\treturn getService().getBeanIdentifier();\n\t}", "public static java.lang.String getBeanIdentifier() {\n\t\treturn getService().getBeanIdentifier();\n\t}", "public static java.lang.String getBeanIdentifier() {\n\t\treturn getService().getBeanIdentifier();\n\t}", "public static java.lang.String getBeanIdentifier() {\n\t\treturn getService().getBeanIdentifier();\n\t}", "public String getBeanName() {\r\n\t\treturn beanName;\r\n\t}", "public static java.lang.String getBeanIdentifier() {\n return getService().getBeanIdentifier();\n }", "public static java.lang.String getBeanIdentifier() {\n return getService().getBeanIdentifier();\n }", "public static java.lang.String getBeanIdentifier() {\n return getService().getBeanIdentifier();\n }", "public static java.lang.String getBeanIdentifier() {\n return getService().getBeanIdentifier();\n }", "public static java.lang.String getBeanIdentifier() {\n return getService().getBeanIdentifier();\n }", "protected static Class<?> getLogicClassForBean(Object obj) {\n\t\tString clsName = ClassNameUtil.getEntityNameForBean(obj);\n\t\treturn getInstance().getLogicClassForBeanName(clsName);\n\t}", "FactoryBean getFactoryBean();", "public Object getManagedBean(String beanName) {\n\t FacesContext fc = FacesContext.getCurrentInstance();\n\t Object bean;\n\t \n\t try {\n\t ELContext elContext = fc.getELContext();\n\t bean = elContext.getELResolver().getValue(elContext, null, beanName);\n\t } catch (RuntimeException e) {\n\t throw new FacesException(e.getMessage(), e);\n\t }\n\n\t if (bean == null) {\n\t throw new FacesException(\"Managed bean with name '\" + beanName\n\t + \"' was not found. Check your faces-config.xml or @ManagedBean annotation.\");\n\t }\n\t return bean;\n\t}", "public static java.lang.String getBeanClassName() {\n\treturn \"ch.ehi.umlEdit.application.LogView\";\n}", "ComponentBean getReferencedBean();", "protected Object fetchBean()\n {\n if (isAttributeDefined(ATTR_REF))\n {\n return getContext().findVariable(getStringAttr(ATTR_REF));\n }\n\n else\n {\n BeanContext bc = FormBaseTag.getBuilderData(getContext())\n .getBeanContext();\n if (isAttributeDefined(ATTR_BEAN_CLASS))\n {\n Class<?> beanClass = FormBaseTag.convertToClass(getAttributes()\n .get(ATTR_BEAN_CLASS));\n return bc.getBean(beanClass);\n }\n else\n {\n return bc.getBean(getStringAttr(ATTR_BEAN_NAME));\n }\n }\n }", "public interface BeanFactory {\n Object createBean(String name);\n <T> T createBean(Class<T> t);\n}", "public String beanType() {\n return beanType;\n }", "private Resource getOntClass(Object bean) {\r\n\t\treturn ontClass(bean).addProperty(javaclass, bean.getClass().getName());\r\n\t}", "String getInstanceOfClass();", "@Override\r\n\tpublic <T> T getInstance(Class<T> type) {\n\t\tfor( Scope key : beanFactories.keySet() ){\r\n\t\t\tT instance = beanFactories.get( key).getInstance(type);\r\n\t\t\tif (instance != null) {\r\n\t\t\t\treturn instance;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t}", "private <T> T getBean(SpringBootLambdaContainerHandler<AwsProxyRequest, AwsProxyResponse> handler,\n Class<T> beanClass) {\n return WebApplicationContextUtils.getWebApplicationContext(handler.getServletContext())\n .getBean(beanClass);\n }", "ClassOfService getClassOfService();", "public static BeanManager lookupBeanManager() {\n BeanManager beanManager = getCDIBeanManager(\"java:comp\");\n if (beanManager == null) {\n beanManager = getCDIBeanManager(\"java:comp/env\");\n }\n if (beanManager == null) {\n beanManager = getOSGICDIBeanManager();\n }\n return beanManager;\n }", "public Object lookup()\r\n {\n if (applicationInstance != null)\r\n return applicationInstance;\r\n\r\n ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(flex.messaging.FlexContext.getServletConfig().getServletContext());\r\n if (appContext == null)\r\n {\r\n if (Log.isError())\r\n Log.getLogger(\"Configuration\").error(\r\n \"SpringFactory - not able to look up the WebApplicationContext for Spring. Check your web.xml to ensure Spring is installed properly in this web application.\");\r\n return null;\r\n }\r\n String beanName = getSource();\r\n\r\n try\r\n {\r\n Object inst;\r\n if (appContext.isSingleton(beanName))\r\n {\r\n if (Log.isDebug())\r\n Log.getLogger(\"Configuration\").debug(\r\n \"SpringFactory creating singleton component with spring id: \" + beanName + \" for destination: \" + getId());\r\n // We have a singleton instance but no one has initialized it yet.\r\n // We need to sync to prevent two threads from potentially initializing\r\n // the instance at the same time and to ensure we only return\r\n // initialized instances.\r\n synchronized (this)\r\n {\r\n // Someone else got to this before us\r\n if (applicationInstance != null)\r\n return applicationInstance;\r\n inst = appContext.getBean(beanName);\r\n if (inst instanceof FlexConfigurable)\r\n ((FlexConfigurable) inst).initialize(getId(), getProperties());\r\n applicationInstance = inst;\r\n }\r\n }\r\n else\r\n {\r\n if (Log.isDebug())\r\n Log.getLogger(\"Configuration\").debug(\r\n \"SpringFactory creating non-singleton component with spring id: \" + beanName + \" for destination: \" + getId());\r\n inst = appContext.getBean(beanName);\r\n if (inst instanceof FlexConfigurable)\r\n ((FlexConfigurable) inst).initialize(getId(), getProperties());\r\n }\r\n return inst;\r\n }\r\n catch (NoSuchBeanDefinitionException nexc)\r\n {\r\n ServiceException e = new ServiceException();\r\n String msg = \"Spring service named '\" + beanName + \"' does not exist.\";\r\n e.setMessage(msg);\r\n e.setRootCause(nexc);\r\n e.setDetails(msg);\r\n e.setCode(\"Server.Processing\");\r\n throw e;\r\n }\r\n catch (BeansException bexc)\r\n {\r\n ServiceException e = new ServiceException();\r\n String msg = \"Unable to create Spring service named '\" + beanName + \"' \";\r\n e.setMessage(msg);\r\n e.setRootCause(bexc);\r\n e.setDetails(msg);\r\n e.setCode(\"Server.Processing\");\r\n throw e;\r\n }\r\n }", "public RubyClass getClass(String name) {\n return objectClass.getClass(name);\n }", "@Nullable\n private PsiClass getBeanPsiClass(@NotNull DomElement throwExceptionElement) {\n ThrowException throwException = throwExceptionElement.getParentOfType(ThrowException.class, true);\n\n if(throwException == null) return null;\n BlueprintBean blueprintBean = throwException.getRef().getValue();\n if(blueprintBean == null) return null;\n\n PsiClass classAttribute = blueprintBean.getClassAttribute().getValue();\n return classAttribute;\n }", "public static Class classForName(String nameClass)\n\t\t{\n\t\t\tClass classObject=null;\n\t\t\ttry {\n\t\t\tclassObject = Class.forName(\"com.spring.entity.\"+nameClass);\n\t\t\t} catch (ClassNotFoundException e) {\n\t\t\t\tSystem.out.println(e.getMessage());\n\t\t\t}\n\t\t\treturn classObject;\n\t\t}", "java.lang.String getClassName();", "public String getBeanIdentifier() {\n return _beanIdentifier;\n }", "String generateBeanName(BeanDefinitionV5 definition, BeanDefinitionRegistryV5 registry);", "Class<?> getFactoryClass();", "public Class<?> lookupClass(String name) throws ClassNotFoundException {\n return getClass().getClassLoader().loadClass(name);\n }", "public String getClassName(String name) throws AxisFault {\n\n MessageProcessor processorImpl = getMessageProcessorImpl(name);\n\n if (processorImpl != null) {\n return processorImpl.getClass().getName();\n } else {\n handleException(log, \"Message Processor \" + name + \" does not exist !!!\", null);\n }\n\n //This code block will never reach as handleException method will always returns a Exception\n return null;\n }", "protected Object obtainFreshBean(BeanFactory beanFactory, String beanName)\r\n/* 32: */ {\r\n/* 33:79 */ return super.obtainFreshBean(beanFactory, \r\n/* 34:80 */ this.isFactoryBean ? \"&\" + beanName : beanName);\r\n/* 35: */ }", "private Class<?> findInternalClass(String name){\n Class<?> clazz = null;\n for (int i = 0; i < urls.length; i++) {\n String root = urls[i].getPath();\n clazz = realFindClass(root,name);\n if(clazz != null)\n break;\n }\n if(clazz != null) {\n classes.put(name,clazz);\n return clazz;\n }\n return null;\n }", "public java.lang.String getBeanIdentifier() {\n return _examConfigLocalService.getBeanIdentifier();\n }", "public static Object getManagedBean(String beanName) {\r\n\t\tFacesContext fc = FacesContext.getCurrentInstance();\r\n\t\tELContext elc = fc.getELContext();\r\n\t\tExpressionFactory ef = fc.getApplication().getExpressionFactory();\r\n\t\treturn ef.createValueExpression(elc, getJsfEl(beanName), Object.class).getValue(elc);\r\n\t}", "public final BeanDefinition getBeanDefinition()\n/* */ {\n/* 53 */ return this.beanDefinition;\n/* */ }", "public ClassDefinition getClassByJavaClassName(String cn){\n \treturn(classesByJavaClass.get(cn));\n }", "String getClassName();", "String getClassName();", "String getClassName();", "public static java.lang.Class getBeanClass() {\n\treturn ch.ehi.umleditor.application.LogView.class;\n}", "@Nullable\n protected final String getBeanName() {\n return this.beanName;\n }", "private void checkBeanClass(Object bean) throws JellyTagException\n {\n if (getBaseClass() != null\n && !getBaseClass().isAssignableFrom(bean.getClass()))\n {\n throw new JellyTagException(\"Bean is not of expected base class: \"\n + getBaseClass().getName());\n }\n }", "public ClassLoader getClassLoaderFor(ObjectName mbeanName)\n throws InstanceNotFoundException{\n return mbsInterceptor.getClassLoaderFor(cloneObjectName(mbeanName));\n }", "public static Class getClass(String inKey) {\r\n Object o = getProperties().get(inKey);\r\n\r\n if (o == null) {\r\n if (LOG.isDebugEnabled()) {\r\n LOG.debug(\"getClass: \" + inKey + \", result null\");\r\n }\r\n return null;\r\n }\r\n\r\n if (LOG.isDebugEnabled()) {\r\n LOG.debug(\"getClass: \" + inKey + \", result \" + o);\r\n }\r\n if (o instanceof Class) {\r\n return (Class) o;\r\n }\r\n if (!(o instanceof String)) {\r\n throw new IllegalArgumentException(\"Config property: \" + inKey\r\n + \" is not a Class or String: \" + o.getClass());\r\n }\r\n try {\r\n return Class.forName((String) o);\r\n } catch (Exception e) {\r\n LOG.warn(\"Class not found: \" + o + \" for property \" + inKey);\r\n return null;\r\n }\r\n }", "private static Class<?> tryName(String name) throws ClassNotFoundException {\n return Class.forName(name);\r\n }", "@Override\n\tpublic BeanEntity getBeanDefinition(String name) {\n\t\treturn null;\n\t}", "public ScriptingClass getPropertyClass( final String name )\n {\n ScriptingClass propClass = null;\n if( properties != null )\n {\n propClass = (ScriptingClass) properties.get( name );\n }\n if( propClass == null && ancestors != null )\n {\n final int size = ancestors.size();\n for( int i = 0; i < size && propClass == null; i++ )\n {\n final ScriptingClass clazz = (ScriptingClass)\n ancestors.elementAt( i );\n propClass = clazz.getPropertyClass( name );\n }\n }\n if( propClass == null )\n {\n try\n {\n final ScriptingClass object = getClassLoader().load( \"object\" );\n propClass = object.getPropertyClass( name );\n }\n catch( ScriptingClassNotFoundException e )\n {\n }\n }\n return propClass;\n }", "protected Class< ? extends Object > findClass( String name ) throws ClassNotFoundException {\n\t\tfinal Class< ? extends Object > c = load_classes.get( name );\n\t\tif ( c == null ) throw new ClassNotFoundException();\n\t\treturn c;\n\t}", "public Object getBean(Class<?> clazz) {\n return getBean(clazz, Scope.SINGLETON, null, null);\n }", "Class<?> getComponentType();", "<V> IBeanContextHolder<V> createHolder(String beanName, Class<V> expectedClass);", "@Override\n public String getBeanIdentifier() {\n return _beanIdentifier;\n }", "@Override\n public String getBeanIdentifier() {\n return _beanIdentifier;\n }", "@Override\n public String getBeanIdentifier() {\n return _beanIdentifier;\n }", "void register(String name, Object bean);", "@Override\n public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {\n Class<?> beanClass = bean.getClass();\n if(beanClass.isAnnotationPresent(Profiling.class)){\n map.put(beanName, beanClass);\n }\n return bean;\n }", "public <T extends SocketService> T getSocketService(Class<T> cls){\n\t\ttry{\n\t\t\tfor(T candidate : _context.getBeansOfType(cls).values()){\n\t\t\t\tif(candidate.getClass().equals(cls)){\n\t\t\t\t\treturn candidate;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (BeansException ex){\n\t\t\tLOGGER.warn(ex, ex);\t\t\n\t\t}\n\t\treturn null;\n\t}", "public static <T> T getBean(Class<T> cls) {\n\t\treturn ctx.getBean(cls);\n\t}", "Class<?> getEndpointClass();", "protected abstract Object createProcessBean(Name name);", "public Class<? extends T> getUIBeanClass() {\r\n\t\tif (null == uiBeanClass && null == getEntityMetaModel())\r\n\t\t\treturn null;\r\n\t\treturn null == uiBeanClass ? entityMetaModel.getUIBeanClass() : uiBeanClass;\r\n\t}", "public static Class get_CLASS()\n {\n Class clz;\n try\n {\n clz = Class.forName(\"com.tangosol.coherence/component/manageable/modelAdapter/ReporterMBean\".replace('/', '.'));\n }\n catch (ClassNotFoundException e)\n {\n throw new NoClassDefFoundError(e.getMessage());\n }\n return clz;\n }", "public static Class get_CLASS()\n {\n Class clz;\n try\n {\n clz = Class.forName(\"com.tangosol.coherence/component/net/Security$ConfigAction\".replace('/', '.'));\n }\n catch (ClassNotFoundException e)\n {\n throw new NoClassDefFoundError(e.getMessage());\n }\n return clz;\n }", "public interface BeanDefinitionReader {\n\n void loadBeanDefinitions(String location) throws Exception;\n\n}" ]
[ "0.6871323", "0.67342687", "0.6710013", "0.6689754", "0.66291994", "0.6628337", "0.66251165", "0.66244644", "0.64513314", "0.6440585", "0.6439291", "0.6438513", "0.64070725", "0.63580227", "0.63564754", "0.6269657", "0.6238258", "0.62295604", "0.62163204", "0.62156665", "0.6156305", "0.61168844", "0.6100436", "0.6085453", "0.60688263", "0.60348636", "0.5988871", "0.5909417", "0.5905369", "0.5903692", "0.5894406", "0.587582", "0.587582", "0.587582", "0.587582", "0.587582", "0.5863624", "0.5851053", "0.5851053", "0.5851053", "0.5851053", "0.5851053", "0.5849122", "0.57774127", "0.57372683", "0.57303864", "0.57241166", "0.5708059", "0.5638993", "0.5638869", "0.5638597", "0.5625113", "0.55881166", "0.55164874", "0.5514033", "0.5513296", "0.5499516", "0.5496465", "0.5483643", "0.54577434", "0.54425395", "0.54423356", "0.5400536", "0.5399044", "0.5398812", "0.537449", "0.5365568", "0.5364729", "0.53551596", "0.534457", "0.5342876", "0.5330328", "0.53276134", "0.53276134", "0.53276134", "0.5321965", "0.53141296", "0.5310991", "0.5308988", "0.52974", "0.5273475", "0.52620804", "0.5229", "0.522715", "0.52268314", "0.5211863", "0.52037466", "0.51838714", "0.51838714", "0.51838714", "0.51726234", "0.5165795", "0.516019", "0.51568437", "0.51504457", "0.5144343", "0.51311976", "0.51231146", "0.5117656", "0.51054096" ]
0.6861701
1
get bean by bean name
public static <T> T getBean(String beanName, Class<? extends Annotation> annotationType) { T t = (T) applicationContext.getBean(beanName); if (!t.getClass().isAnnotationPresent(annotationType)) { throw new NoSuchBeanDefinitionException("Resources don't exist."); } return t; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Object getBean(String name) {\n Object bean = beanMap.get(name);\n if (bean == null) {\n throw new IllegalArgumentException(\"there is no bean with name \" + name);\n }\n\n return bean;\n }", "public static Object getBean(String name) {\r\n\t\tWebApplicationContext wac = ContextLoader.getCurrentWebApplicationContext();\r\n\t\treturn wac.getBean(name);\r\n\t}", "public Object findBean(String beanName) {\n\t\tFacesContext context = FacesContext.getCurrentInstance();\n\t\treturn context.getApplication().evaluateExpressionGet(context, \"#{\" + beanName + \"}\", Object.class);\n\t}", "public Object getBean(String name) {\r\n\t\tif (ctx == null) {\r\n\t\t\tctx = WebApplicationContextUtils\r\n\t\t\t\t\t.getRequiredWebApplicationContext(servlet\r\n\t\t\t\t\t\t\t.getServletContext());\r\n\t\t}\r\n\t\treturn ctx.getBean(name);\r\n\t}", "public static Object lookupBean(String name) {\n BeanManager manager = lookupBeanManager();\n Set<Bean<?>> beans = manager.getBeans(name);\n if (beans != null && !beans.isEmpty()) {\n Bean<?> bean = beans.iterator().next();\n CreationalContext<?> context = manager.createCreationalContext(bean);\n return manager.getReference(bean, Object.class, context);\n }\n return null;\n }", "public static Object getBean(String beanName) {\r\n return CONTEXT.getBean(beanName);\r\n }", "@Override\r\n\tpublic Object getInstance(String beanName) {\n\t\tfor( Scope key : beanFactories.keySet() ){\r\n\t\t\tObject instance = beanFactories.get( key).getInstance(beanName);\r\n\t\t\tif (instance != null) {\r\n\t\t\t\treturn instance;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t}", "public static Object getBean(ExecuteContext context, String beanName) throws Exception {\r\n\t\treturn WebApplicationContextUtils.getRequiredWebApplicationContext(context.getRequest().getSession().getServletContext()).getBean(beanName);\r\n\t}", "@SuppressWarnings(\"unchecked\")\n public static <T> T getBean(String name) {\n assertContextInjected();\n return (T) applicationContext.getBean(name);\n }", "public Object getBean(String name) throws Exception {\n\t\tObject bean = beanMap.get(name);\n\t\tif (bean != null) {\n\t\t\treturn bean;\n\t\t}\n\t\t// 如果实例好的beanMap找不到bean 就先创建再返回\n\t\tbean = createBean(beanDefineMap.get(name));\n\t\n\t\t\n\t\tif(bean != null) {\n\t\t\tpopulatebean(bean);\n\t\t //检查properties中是否有定义代理增强\n\t\t String proxyAdvisorClassName = proxyProp.getProperty(name + \".proxy.class\");\n\t\t\tif (proxyAdvisorClassName != null && proxyAdvisorClassName.trim().length() > 0) {\n\t\t\t Class<?> proxyAdvisorClass = Class.forName(proxyAdvisorClassName);\n\t\t String[] methods = proxyProp.getProperty(name + \".proxy.methods\").split(\",\");\n\n\t\t\t InvocationHandler proxyHandler = (InvocationHandler) proxyAdvisorClass\n\t\t .getConstructors()[0].newInstance(bean, Arrays.asList(methods));\n\t\t\t // 动态代理创建对象\n\t\t Object proxy = Proxy.newProxyInstance(bean.getClass().getClassLoader(),\n\t\t bean.getClass().getInterfaces(), proxyHandler);\n\t\t bean = proxy;\n\t\t\t}\n\t\t\tbeanMap.put(name, bean);\n\t\t}\n\t\t\t\t\n\t\treturn bean;\n\t}", "public <T> T getBean(String beanName, Class<T> ofType) throws CouldNotResolveBeanException;", "ComponentBean getBean();", "Object getBean();", "public static <T> T getBean(String beanName) {\n return (T) applicationContext.getBean(beanName);\n }", "IBeanConfiguration getBeanConfiguration(String beanName);", "private static SingerWithJSR250 getBean(String beanName, ApplicationContext context) {\n\t\ttry {\n\t\t\tSingerWithJSR250 bean = (SingerWithJSR250) context.getBean(beanName);\n\t\t\treturn bean;\n\t\t} catch (Exception e) {\n\t\t\t// TODO: handle exception\n\t\t\tSystem.out.println(\"An error occured in bean configuration: \" + e.getMessage());\n\t\t\treturn null;\n\t\t}\n\t}", "public java.lang.String getBeanIdentifier();", "public Object getManagedBean(String beanName) {\n\t FacesContext fc = FacesContext.getCurrentInstance();\n\t Object bean;\n\t \n\t try {\n\t ELContext elContext = fc.getELContext();\n\t bean = elContext.getELResolver().getValue(elContext, null, beanName);\n\t } catch (RuntimeException e) {\n\t throw new FacesException(e.getMessage(), e);\n\t }\n\n\t if (bean == null) {\n\t throw new FacesException(\"Managed bean with name '\" + beanName\n\t + \"' was not found. Check your faces-config.xml or @ManagedBean annotation.\");\n\t }\n\t return bean;\n\t}", "public Object getBean(String className) throws BaseException {\r\n\t\ttry {\r\n\t\t\tObject retVal = this.springApplicationContext.getBean(className);\r\n\t\t\tlogger.debug(\"returning an instance of \" + className);\r\n\t\t\treturn retVal;\r\n\t\t} catch (Exception e) {\r\n\t\t\tlogger.error(\"failed retrieving bean from local factory\", e);\r\n\t\t\te.printStackTrace();\r\n\t\t\tthrow new BaseException(e.getMessage(), e);\r\n\t\t}\r\n\t}", "public Object getProperty(String name) {\n\t\treturn beanMap.get(name);\n\t}", "public String getBeanName() {\r\n\t\treturn beanName;\r\n\t}", "public String getImplementationBean(String linkName);", "protected <T> T getBean( String name, Class<T> t ) {\n try {\n return this.applicationContext.getBean( name, t );\n } catch ( BeansException e ) {\n throw new RuntimeException( e );\n } catch ( Exception e ) {\n throw new RuntimeException( e );\n }\n }", "public interface BeanFactory {\n\n// BeanDefinition getBeanDefinition(String beanID);\n\n Object getBean(String beanID);\n}", "private static String beanName(Object bean) {\r\n\t\tString fullClassName = bean.getClass().getName();\r\n\t\tString classNameTemp = fullClassName.substring(fullClassName\r\n\t\t\t\t.lastIndexOf(\".\") + 1, fullClassName.length());\r\n\t\treturn classNameTemp.substring(0, 1) + classNameTemp.substring(1);\r\n\t}", "ComponentBean getReferencedBean();", "public static java.lang.String getBeanIdentifier() {\n\t\treturn getService().getBeanIdentifier();\n\t}", "public static java.lang.String getBeanIdentifier() {\n\t\treturn getService().getBeanIdentifier();\n\t}", "public static java.lang.String getBeanIdentifier() {\n\t\treturn getService().getBeanIdentifier();\n\t}", "public static java.lang.String getBeanIdentifier() {\n\t\treturn getService().getBeanIdentifier();\n\t}", "public static java.lang.String getBeanIdentifier() {\n\t\treturn getService().getBeanIdentifier();\n\t}", "public interface BeanResolver {\n\n\n\t/**\n\t * Returns the bean of the correct type.\n\t * \n\t * @param <T>\t\tClass of bean.\n\t * @param beanName\tName of the bean to return.\n\t * @param ofType\tClass of the bean to get.\n\t * \n\t * @return The bean with matching bean name.\n\t * @throws CouldNotResolveBeanException if bean can not be located.\n\t **/\n\tpublic <T> T getBean(String beanName, Class<T> ofType) throws CouldNotResolveBeanException;\n}", "public interface BeanFactory {\n\n /**\n * @param name\n * @return\n * @throws Exception\n */\n Object getBean(String name) throws Exception;\n\n}", "public static java.lang.String getBeanIdentifier() {\n return getService().getBeanIdentifier();\n }", "public static java.lang.String getBeanIdentifier() {\n return getService().getBeanIdentifier();\n }", "public static java.lang.String getBeanIdentifier() {\n return getService().getBeanIdentifier();\n }", "public static java.lang.String getBeanIdentifier() {\n return getService().getBeanIdentifier();\n }", "public static java.lang.String getBeanIdentifier() {\n return getService().getBeanIdentifier();\n }", "protected <T> T lookupBean(Class<T> beanClass, String beanName)\r\n\t\t\tthrows ServletException {\r\n\t\tHashtable<String, String> env = new Hashtable<String, String>();\r\n\t\tenv.put(Context.INITIAL_CONTEXT_FACTORY,\r\n\t\t\t\t\"org.jnp.interfaces.NamingContextFactory\");\r\n\t\tenv.put(Context.PROVIDER_URL, \"localhost:1099\");\r\n\r\n\t\ttry {\r\n\t\t\tInitialContext jndiContext = new InitialContext(env);\r\n\t\t\treturn beanClass.cast(jndiContext.lookup(beanName));\r\n\t\t} catch (NamingException e) {\r\n\t\t\tthrow new ServletException();\r\n\t\t}\r\n\t}", "public static Object getManagedBean(String beanName) {\r\n\t\tFacesContext fc = FacesContext.getCurrentInstance();\r\n\t\tELContext elc = fc.getELContext();\r\n\t\tExpressionFactory ef = fc.getApplication().getExpressionFactory();\r\n\t\treturn ef.createValueExpression(elc, getJsfEl(beanName), Object.class).getValue(elc);\r\n\t}", "@Nullable\n protected final String getBeanName() {\n return this.beanName;\n }", "protected Object fetchBean()\n {\n if (isAttributeDefined(ATTR_REF))\n {\n return getContext().findVariable(getStringAttr(ATTR_REF));\n }\n\n else\n {\n BeanContext bc = FormBaseTag.getBuilderData(getContext())\n .getBeanContext();\n if (isAttributeDefined(ATTR_BEAN_CLASS))\n {\n Class<?> beanClass = FormBaseTag.convertToClass(getAttributes()\n .get(ATTR_BEAN_CLASS));\n return bc.getBean(beanClass);\n }\n else\n {\n return bc.getBean(getStringAttr(ATTR_BEAN_NAME));\n }\n }\n }", "public interface BeanFactory {\n\n Object getBean(Class<?> clazz);\n\n}", "static private Object lookup(PageContext pageContext, String name, \r\n String scope, String pageParam, Properties prop) throws JspException {\r\n\r\n Object bean = null;\r\n if (scope == null)\r\n bean = pageContext.findAttribute(name);\r\n else if (scope.equalsIgnoreCase(pageParam))\r\n bean = pageContext.getAttribute(name, PageContext.PAGE_SCOPE);\r\n else if (scope.equalsIgnoreCase(\"request\"))\r\n bean = pageContext.getAttribute(name, PageContext.REQUEST_SCOPE);\r\n else if (scope.equalsIgnoreCase(\"session\"))\r\n bean = pageContext.getAttribute(name, PageContext.SESSION_SCOPE);\r\n else if (scope.equalsIgnoreCase(\"application\"))\r\n bean = pageContext.getAttribute(name, PageContext.APPLICATION_SCOPE);\r\n else {\r\n Object[] objs = { name, scope };\r\n String msg = MessageFormat.format(prop.getProperty(\"error.msg.cant_find_bean\"), objs);\r\n throw new JspException(msg);\r\n }\r\n\r\n return (bean);\r\n }", "BeanFactory getBeanFactory();", "FactoryBean getFactoryBean();", "public String getBeanIdentifier() {\n return _beanIdentifier;\n }", "public Object lookup()\r\n {\n if (applicationInstance != null)\r\n return applicationInstance;\r\n\r\n ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(flex.messaging.FlexContext.getServletConfig().getServletContext());\r\n if (appContext == null)\r\n {\r\n if (Log.isError())\r\n Log.getLogger(\"Configuration\").error(\r\n \"SpringFactory - not able to look up the WebApplicationContext for Spring. Check your web.xml to ensure Spring is installed properly in this web application.\");\r\n return null;\r\n }\r\n String beanName = getSource();\r\n\r\n try\r\n {\r\n Object inst;\r\n if (appContext.isSingleton(beanName))\r\n {\r\n if (Log.isDebug())\r\n Log.getLogger(\"Configuration\").debug(\r\n \"SpringFactory creating singleton component with spring id: \" + beanName + \" for destination: \" + getId());\r\n // We have a singleton instance but no one has initialized it yet.\r\n // We need to sync to prevent two threads from potentially initializing\r\n // the instance at the same time and to ensure we only return\r\n // initialized instances.\r\n synchronized (this)\r\n {\r\n // Someone else got to this before us\r\n if (applicationInstance != null)\r\n return applicationInstance;\r\n inst = appContext.getBean(beanName);\r\n if (inst instanceof FlexConfigurable)\r\n ((FlexConfigurable) inst).initialize(getId(), getProperties());\r\n applicationInstance = inst;\r\n }\r\n }\r\n else\r\n {\r\n if (Log.isDebug())\r\n Log.getLogger(\"Configuration\").debug(\r\n \"SpringFactory creating non-singleton component with spring id: \" + beanName + \" for destination: \" + getId());\r\n inst = appContext.getBean(beanName);\r\n if (inst instanceof FlexConfigurable)\r\n ((FlexConfigurable) inst).initialize(getId(), getProperties());\r\n }\r\n return inst;\r\n }\r\n catch (NoSuchBeanDefinitionException nexc)\r\n {\r\n ServiceException e = new ServiceException();\r\n String msg = \"Spring service named '\" + beanName + \"' does not exist.\";\r\n e.setMessage(msg);\r\n e.setRootCause(nexc);\r\n e.setDetails(msg);\r\n e.setCode(\"Server.Processing\");\r\n throw e;\r\n }\r\n catch (BeansException bexc)\r\n {\r\n ServiceException e = new ServiceException();\r\n String msg = \"Unable to create Spring service named '\" + beanName + \"' \";\r\n e.setMessage(msg);\r\n e.setRootCause(bexc);\r\n e.setDetails(msg);\r\n e.setCode(\"Server.Processing\");\r\n throw e;\r\n }\r\n }", "public Object elGetReference(Object bean);", "public static BeanManager lookupBeanManager() {\n BeanManager beanManager = getCDIBeanManager(\"java:comp\");\n if (beanManager == null) {\n beanManager = getCDIBeanManager(\"java:comp/env\");\n }\n if (beanManager == null) {\n beanManager = getOSGICDIBeanManager();\n }\n return beanManager;\n }", "protected Object obtainFreshBean(BeanFactory beanFactory, String beanName)\r\n/* 32: */ {\r\n/* 33:79 */ return super.obtainFreshBean(beanFactory, \r\n/* 34:80 */ this.isFactoryBean ? \"&\" + beanName : beanName);\r\n/* 35: */ }", "public Component getComponent(String name) {\n Optional<Component> component = elements.getComponent(name);\n\n if(component.isPresent()) {\n return component.get();\n } else {\n Assert.fail(\"Missing component \" + name);\n return null;\n }\n\n }", "@Override\n public String getBeanIdentifier() {\n return _beanIdentifier;\n }", "@Override\n public String getBeanIdentifier() {\n return _beanIdentifier;\n }", "@Override\n public String getBeanIdentifier() {\n return _beanIdentifier;\n }", "public static Object getComponentInstance(String name, ServletContext sc) {\r\n\t\tContainerWrapper containerWrapper = scf.findContainer(new ServletContextWrapper(sc));\r\n\t\tif (!containerWrapper.isStart()) {\r\n\t\t\tDebug.logError(\"JdonFramework not yet started, please try later \", module);\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\treturn containerWrapper.lookup(name);\r\n\t}", "RiceCooker getByName(String name);", "public java.lang.String getBeanIdentifier() {\n return _examConfigLocalService.getBeanIdentifier();\n }", "void register(String name, Object bean);", "public static Object getComponentInstance(String name, HttpServletRequest request) {\r\n\t\tServletContext sc = request.getSession().getServletContext();\r\n\t\tContainerWrapper containerWrapper = scf.findContainer(new ServletContextWrapper(sc));\r\n\t\tif (!containerWrapper.isStart()) {\r\n\t\t\tDebug.logError(\"JdonFramework not yet started, please try later \", module);\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\treturn containerWrapper.lookup(name);\r\n\t}", "@Override\n\tpublic java.lang.String getBeanIdentifier() {\n\t\treturn _vanBanPhapQuyLocalService.getBeanIdentifier();\n\t}", "public static Class<?> getType(String beanName) {\n return applicationContext.getType(beanName);\n }", "protected ApplicationBean1 getApplicationBean1() {\n return (ApplicationBean1)getBean(\"ApplicationBean1\");\n }", "protected ApplicationBean1 getApplicationBean1() {\n return (ApplicationBean1)getBean(\"ApplicationBean1\");\n }", "public Object lookup(FactoryInstance inst)\r\n {\r\n SpringFactoryInstance factoryInstance = (SpringFactoryInstance) inst;\r\n return factoryInstance.lookup();\r\n }", "@Bean(name = \"bean\") //name=\" \" to change the bean name\n public Address addressBean() {\n \treturn new Address();\n }", "Object getProperty(String name);", "@Override\n public java.lang.String getBeanIdentifier() {\n return _muQuxianQujianLocalService.getBeanIdentifier();\n }", "@Override\r\n\tpublic <T> T getInstance(Class<T> type) {\n\t\tfor( Scope key : beanFactories.keySet() ){\r\n\t\t\tT instance = beanFactories.get( key).getInstance(type);\r\n\t\t\tif (instance != null) {\r\n\t\t\t\treturn instance;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t}", "public Object getBean(Object obj, Interceptor interceptor) {\n return ProxyBeanUtil.getBean(obj, interceptor);\n }", "public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {\n return bean;\n }", "@Override\n\tpublic Object getBeanCache(String name) {\n\t\treturn null;\n\t}", "public interface HomeService {\n public HomeBean getHomeBean(String name);\n}", "public abstract Component getComponentByName(String name);", "private <T> T getBean(SpringBootLambdaContainerHandler<AwsProxyRequest, AwsProxyResponse> handler,\n Class<T> beanClass) {\n return WebApplicationContextUtils.getWebApplicationContext(handler.getServletContext())\n .getBean(beanClass);\n }", "@Override\n public Object get(String name, ObjectFactory<?> objectFactory) {\n Map<String, Object> mapForThisThread = beanMap.get();\n\n Object obj = mapForThisThread.get(name);\n if(obj != null) {\n log.info(\"get {} resolved from scope\", name);\n return obj;\n }\n obj = objectFactory.getObject();\n mapForThisThread.put(name, obj);\n log.info(\"get {} resolved from factory\", name);\n return obj;\n }", "@Override\n public Object getProperty(final Object bean,\n final String name) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {\n\n if (!collections.isEmpty()) {\n final String key = getResolver().getProperty(name);\n Pair<String, Object> collectionInfo = collections.pop();\n if (bean instanceof Map) {\n Map map = (Map) bean;\n if (!map.containsKey(key)) {\n map.put(key, newNamedInstanceForCollection(collectionInfo.getA(), collectionInfo.getB(), key));\n }\n Object value = map.get(key);\n return trackCollectionOrMap(null, value, value);\n } else { // collection\n Object value = findByNameProperty(key, (Collection)bean);\n if (value == null) {\n // create it\n value = newNamedInstanceForCollection(collectionInfo.getA(), collectionInfo.getB(), key);\n ((Collection) bean).add(value);\n }\n return trackCollectionOrMap(null, value, value);\n }\n }\n\n Object resolved = null;\n\n try {\n resolved = getNestedProperty(bean, name);\n } catch (final NoSuchMethodException e) {\n // to avoid it being swallowed by caller wrap\n throw new InvocationTargetException(e, \"Cannot access property with key: \" + name);\n }\n\n return trackCollectionOrMap(name, resolved, bean);\n }", "public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {\n return bean;\n }", "public final BeanDefinition getBeanDefinition()\n/* */ {\n/* 53 */ return this.beanDefinition;\n/* */ }", "public Object elGetValue(Object bean);", "@Override\n\tpublic BeanEntity getBeanDefinition(String name) {\n\t\treturn null;\n\t}", "@Override\n\tpublic java.lang.String getBeanIdentifier() {\n\t\treturn _kpiEntryLocalService.getBeanIdentifier();\n\t}", "protected abstract Object createProcessBean(Name name);", "@Override\n public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {\n return bean;\n }", "public Object getBean(Class<?> clazz) {\n return getBean(clazz, Scope.SINGLETON, null, null);\n }", "@Override\n\tpublic MemberBean[] findByName(String name) {\n\t\treturn null;\n\t}", "@Override\n\tpublic AccountBean[] findByName(String name) {\n\t\treturn null;\n\t}", "public interface BeanFactory {\n Object createBean(String name);\n <T> T createBean(Class<T> t);\n}", "@Override\n public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {\n return bean;\n }", "public final void setBean(String bean) {\n this.bean = bean;\n }", "@Override\n\tpublic java.lang.String getBeanIdentifier() {\n\t\treturn _surveyLocalService.getBeanIdentifier();\n\t}", "public abstract ServiceLocator find(String name);", "public ServiceResultInterface getComponentByName(String name) {\n\t\tfor (ServiceResultInterface res : components) {\n\t\t\tif (res.getName().equals(name)) {\n\t\t\t\treturn res;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "@SuppressWarnings(\"unchecked\")\n @Override\n public <T> T get(String name) {\n Object value = this.transientFacts.get(name);\n if (Objects.isNull(value)) {\n // try to fetch from beanFacts\n value = this.beanFacts.get(name);\n }\n return (T) value;\n }", "@Override\n public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {\n return bean;\n }", "String getProperty(String name);", "public WebServiceEndpoint getEndpointByName(String endpointName) {\n for(Iterator iter = getEndpoints().iterator(); iter.hasNext();) {\n WebServiceEndpoint next = (WebServiceEndpoint) iter.next();\n if( next.getEndpointName().equals(endpointName) ) {\n return next;\n }\n }\n return null;\n }", "public static <T> T getBean(Class<T> cls) {\n\t\treturn ctx.getBean(cls);\n\t}", "Property findProperty(String propertyName);", "@Override\r\n public java.lang.String getBeanIdentifier() {\r\n return _contentHolderService.getBeanIdentifier();\r\n }" ]
[ "0.7995118", "0.78612924", "0.77599835", "0.76259434", "0.7534363", "0.74506", "0.74193335", "0.728913", "0.7136137", "0.71225464", "0.7064616", "0.6793508", "0.67810076", "0.6772993", "0.6707734", "0.6703208", "0.6624315", "0.6612891", "0.6528349", "0.6440455", "0.64074963", "0.6362595", "0.6362095", "0.6323595", "0.62853485", "0.627266", "0.6244676", "0.6244676", "0.6244676", "0.6244676", "0.6244676", "0.6221044", "0.621045", "0.6206432", "0.6206432", "0.6206432", "0.6206432", "0.6206432", "0.6174623", "0.6164474", "0.6090486", "0.608098", "0.60629934", "0.6046567", "0.6029932", "0.60250396", "0.6024999", "0.59019285", "0.58915156", "0.586088", "0.58483976", "0.5816051", "0.58127886", "0.58127886", "0.58127886", "0.57621396", "0.5721468", "0.5716121", "0.5669003", "0.5636492", "0.5632928", "0.5570618", "0.5519872", "0.5519872", "0.55038595", "0.54943657", "0.5484288", "0.54735744", "0.5466143", "0.5465732", "0.5455427", "0.5410151", "0.54101163", "0.5409853", "0.5392794", "0.5370176", "0.53677154", "0.53176045", "0.530897", "0.52977854", "0.5287293", "0.5281929", "0.52721614", "0.5271648", "0.5252223", "0.52499837", "0.5218287", "0.5217798", "0.51907355", "0.517692", "0.5173025", "0.516559", "0.5162689", "0.5162129", "0.51545805", "0.51460737", "0.5132767", "0.5126974", "0.5118481", "0.5075211" ]
0.54494375
71
/ Using the Observable.lift() method you can perform multiple queries without breaking method chaining. Observable.lift() requires an Operator parameter which are available via db.select(sql).parameterOperator().getXXX() db.select(sql).parameterListOperator().getXXX() db.select(sql).dependsOnOperator().getXXX() db.update(sql).parameterOperator() db.update(sql).parameterListOperator() db.update(sql).dependsOnOperator()
public static void main(String[] args) { Database db = Database.from("jdbc:mysql://127.0.0.1:3306/alarm_user", "root", ""); Observable<Integer> score = Observable // parameters for coming update .just(4, "FRED") // update Fred's score to 4 .lift(db.update("update person set score=? where name=?") //parameters are pushed .parameterOperator()) // update everyone with score of 4 to 14 .lift(db.update("update person set score=? where score=?") .parameters(14, 4) //wait for completion of previous observable .dependsOnOperator()) // get Fred's score .lift(db.select("select score from person where name=?") .parameters("FRED") //wait for completion of previous observable .dependsOnOperator() .getAs(Integer.class)); //If the query does not require parameters you can push it an empty list and use the parameterListOperator() to force execution. // Observable<Integer> rowsAffected = Observable // //generate two integers // .range(1,2) // //replace the integers with empty observables // .map(toEmpty()) // //execute the update twice with an empty list // .lift(db.update("update person set score = score + 1") // .parameterListOperator()) // // flatten // .lift(RxUtil.<Integer> flatten()) // // total the affected records // .lift(SUM_INTEGER); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void example() {\n Func1<Integer, Observable<Integer>> db1 = param -> Observable.range(1, param);\n\n // ws-kald som funktion der returner en Observable\n Func1<Integer, Observable<Integer>> ws1 = param -> Observable.just(param);\n\n // ws-kald som funktion der returner en Observable\n Func1<Integer, Observable<Integer>> ws2 = param -> Observable.just(param);\n\n // ws-kald som funktion der returner en Observable\n Func1<List<Integer>, Observable<Object>> ws3 = param -> Observable.empty();\n\n db1.call(5)\n .flatMap(row -> {\n if (row % 2 == 0) {\n // ws2 kaldes kun, hvis ws1 ikke var tom\n return Observable.concat(ws1.call(row), ws2.call(row)).first();\n } else {\n // ws1 og ws2 udføres parallelt\n return Observable.zip(ws1.call(10), ws2.call(20), (e1, e2) -> e1 + e2);\n }\n })\n .onErrorResumeNext(err -> {\n log.error(\"error - resume next \", err);\n return Observable.empty();\n })\n .doOnNext(n -> log.info(\"element {}\", n))\n // samle/batche 2 elementer i en liste (men højst vente 1 sekund)\n .buffer(2, 1, TimeUnit.SECONDS)\n // output sendes til en ws3\n .flatMap(ws3)\n // subscribe starter kæden\n .subscribe();\n }", "private void threads()\n {\n {\n Observable myObservable = Observable.create\n (\n new Observable.OnSubscribe<GetArtistQuery>() \n {\n public void call(Subscriber<? super GetArtistQuery> sub) \n { \n //System.out.println(Thread.currentThread().getName());\n sub.onNext(getArtistQuery);\n sub.onCompleted();\n }\n } \n );\n \n Subscriber mySubscriber = new Subscriber<GetArtistQuery>() \n {\n public void onNext(GetArtistQuery s) \n { \n try { \n s.execute();\n } catch (SQLException ex) { System.out.println(ex); }\n }\n public void onCompleted() { \n }\n public void onError(Throwable e) {System.out.println(e); } \n };\n //myObservable.subscribe(mySubscriber); \n try {\n myObservable.\n subscribeOn(Schedulers.io()).\n //observeOn(Schedulers.from(executorService)).\n observeOn(Schedulers.trampoline()).\n subscribe(mySubscriber);\n Thread.sleep(2); \n //executorService.shutdown();\n } catch(InterruptedException ex) {Thread.currentThread().interrupt();}\n }\n \n }", "@Mapper\npublic interface EquipmentDao {\n\n @Select(\"SELECT * FROM `equipment` WHERE `id` = #{id}\")\n Equipment getEquipmentById(int id);\n\n @Select(\"SELECT `equipment`.`id`, `equipment`.`name` \" +\n \"FROM `equipment`, `step_equipment` \" +\n \"WHERE `equipment`.`id` = `step_equipment`.`equipment_id`\" +\n \"AND `step_equipment`.`step_id` = #{stepId}\")\n List<Equipment> listEquipmentsByStepId(int stepId);\n\n @Insert(\"INSERT INTO `equipment`(`id`, `name`) VALUES(#{id}, #{name})\")\n void insertEquipment(Equipment equipment);\n\n}", "public ObservableList<T> execute();", "public interface DbHelper {\n\n Observable<Long> insertTranslation(Translation translation);\n\n Observable<List<Translation>> getAllTranslations();\n\n}", "public interface ShiftLocalRepository {\n\n /**\n * Provides a list of all shifts from local database.\n */\n Observable<ArrayList<Shift>> shifts();\n\n /**\n * Creates new shift in local database.\n * @param shift - shift to create.\n */\n Observable<Shift> createNewShift(Shift shift);\n\n /**\n * Updates currently started shift.\n * @param shift - object contains information of time and location ending.\n */\n Observable<Shift> endCurrentShift(Shift shift);\n\n /**\n * Saves shift for update due to disconnecting from network.\n * @param shift - shift to be updated later.\n */\n Observable<Boolean> storeShiftForUpdate(Shift shift);\n\n /**\n * Overwrites database with updated shifts (if any).\n * @param shifts - list of shifts returned from server.\n * @\n */\n Observable<Boolean> storeAllShifts(ArrayList<Shift> shifts);\n}", "public interface OperatorService {\n\n @GET(\"/api/v0.2/driver/collectionpoint/handover\")\n Observable<BaseEntity<ResScanBean>> getCollection(@Query(\"id\") String id);\n\n @POST(\"/api/v0.2/driver/collectionpoint/handover\")\n Observable<BaseEntity<ResBill>> getCollection(@Body RequestBody param);\n\n @POST(\"/api/v0.2/driver/collectionpoint/handover/verify\")\n Observable<BaseEntity<ResFinalize>> verifyCollection(@Body RequestBody param);\n\n @POST(\"/api/v0.2/driver/collectionpoint/handover/finalize\")\n Observable<BaseEntity<ResFinalize>> finalizeCollection(@Body RequestBody param);\n\n @POST(\"/api/v0.2/driver/signature/collectionpoint/handover\")\n Observable<BaseEntity<ResSignature>> signatureCollection(@Body RequestBody param);\n\n @GET(\"/api/v0.2/driver/collectionpoint/rto\")\n Observable<BaseEntity<ResScanBean>> getRto(@Query(\"id\") String id);\n\n @POST(\"/api/v0.2/driver/collectionpoint/rto\")\n Observable<BaseEntity<ResBill>> getRto(@Body RequestBody param);\n\n @POST(\"/api/v0.2/driver/collectionpoint/rto/verify\")\n Observable<BaseEntity<ResFinalize>> verifyRto(@Body RequestBody param);\n\n @POST(\"/api/v0.2/driver/collectionpoint/rto/finalize\")\n Observable<BaseEntity<ResFinalize>> finalizeRto(@Body RequestBody param);\n\n @POST(\"/api/v0.2/driver/signature/collectionpoint/rto\")\n Observable<BaseEntity<ResSignature>> signatureRto(@Body RequestBody param);\n\n @GET(\"/api/v0.2/driver/client/rto\")\n Observable<BaseEntity<ResScanBean>> getWarehouse(@Query(\"id\") String id);\n\n @POST(\"/api/v0.2/driver/client/rto\")\n Observable<BaseEntity<ResBill>> getWarehouse(@Body RequestBody param);\n\n @POST(\"/api/v0.2/driver/client/rto/verify\")\n Observable<BaseEntity<ResFinalize>> verifyWarehouse(@Body RequestBody param);\n\n @POST(\"/api/v0.2/driver/client/rto/finalize\")\n Observable<BaseEntity<ResFinalize>> finalizeWarehouse(@Body RequestBody param);\n\n @POST(\"/api/v0.2/driver/signature/client/rto\")\n Observable<BaseEntity<ResSignature>> signatureWarehouse(@Body RequestBody param);\n\n @GET(\"/api/v0.2/driver/client/pickup\")\n Observable<BaseEntity<ResScanBean>> getPickup(@Query(\"id\") String id);\n\n @POST(\"/api/v0.2/driver/client/pickup\")\n Observable<BaseEntity<ResBill>> getPickup(@Body RequestBody param);\n\n @POST(\"/api/v0.2/driver/client/pickup/verify\")\n Observable<BaseEntity<ResFinalize>> verifyPickup(@Body RequestBody param);\n\n @POST(\"/api/v0.2/driver/client/pickup/finalize\")\n Observable<BaseEntity<ResFinalize>> finalizePickup(@Body RequestBody param);\n\n @POST(\"/api/v0.2/driver/signature/client/pickup\")\n Observable<BaseEntity<ResSignature>> signaturePickup(@Body RequestBody param);\n\n @POST(\"/training/resetAll\")\n Observable<BaseEntity<Object>> resetAllDataForTraining();\n\n @POST(\"/training/createRto\")\n Observable<BaseEntity<Object>> createRtoDataFroTraning();\n\n @POST(\"/api/v0.2/driver/internalwarehouse/handover\")\n Observable<BaseEntity<ResBill>> internalWarehouseCheckIn(@Body RequestBody param);\n\n @GET(\"/api/v0.2/driver/internalwarehouse/handover\")\n Observable<BaseEntity<ResScanBean>> internalWarehouse();\n\n @GET(\"/api/v0.2/driver/internalwarehouse/pickup\")\n Observable<BaseEntity<ResScanBean>> internalWarehousePickup();\n\n @POST(\"/api/v0.2/driver/internalwarehouse/pickup\")\n Observable<BaseEntity<ResBill>> internalWarehousePickup(@Body RequestBody param);\n\n @POST(\"/api/v0.2/driver/internalwarehouse/handover/verify\")\n Observable<BaseEntity<ResFinalize>> internalWarehouseCheckInVerify(@Body RequestBody param);\n\n @POST(\"/api/v0.2/driver/internalwarehouse/pickup/verify\")\n Observable<BaseEntity<ResFinalize>> internalWarehousePickupVerify(@Body RequestBody param);\n\n @POST(\"/api/v0.2/driver/internalwarehouse/handover/finalize\")\n Observable<BaseEntity<ResFinalize>> internalWarehouseCheckInFinalize(@Body RequestBody param);\n\n @POST(\"/api/v0.2/driver/internalwarehouse/pickup/finalize\")\n Observable<BaseEntity<ResFinalize>> internalWarehousePickupFinalize(@Body RequestBody param);\n\n @POST(\"/api/v0.2/driver/internalwarehouse/pickup/signature\")\n Observable<BaseEntity<ResSignature>> internalWarehousePickupSignature(@Body RequestBody param);\n\n @POST(\"/api/v0.2/driver/internalwarehouse/handover/signature\")\n Observable<BaseEntity<ResSignature>> internalWarehouseCheckInSignature(@Body RequestBody param);\n\n @GET(\"/api/v0.2/driver/invoices\")\n Observable<BaseEntity<ResInvoice>> getInvoices();\n\n @POST(\"/api/v0.2/driver/invoices/putToBankAccount\")\n Observable<BaseEntity<Object>> putToBankAccount(@Body RequestBody param);\n\n @GET(\"/api/v0.2/driver/shipments\")\n Observable<BaseEntity<ResSearchResult>> search(@Query(\"awb\") String awb);\n}", "public interface OrdersDataSource {\n\n /**\n * Query the orders of the product range from beginTime to endTime.\n *\n * @param productId product id\n * @param productType product type\n * @param beginTime begin time\n * @param endTime end time\n * @return The the orders of the product range from beginTime to endTime if exist.\n */\n Observable<List<Order>> queryOrders(@NonNull String productId, @NonNull String productType,\n @NonNull String beginTime, @NonNull String endTime);\n\n /**\n * Get valid orders of the product.\n *\n * @param productId product id\n * @param productType product type\n * @return The valid order of the product or <code>null<code/>.\n */\n Observable<List<Order>> getValidOrders(@NonNull String productId, @NonNull String productType);\n\n /**\n * Get order by order serial.\n *\n * @param orderSerial order serial.\n * @return The order detail or <code>null<code/>.\n */\n Observable<Order> getOrder(@NonNull String orderSerial);\n\n /**\n * Create the order of the product.\n *\n * @return The order(not paid yet) created by Server.\n */\n Observable<Order> createOrder(@NonNull String productId, @Nullable String mediaId,\n @Nullable String encryptionType, @NonNull String productType, @NonNull String quantity);\n\n /**\n * Pay the order.\n *\n * @param orderSerial order number\n * @return Pay status.\n */\n Observable<PayOrderResult> payOrder(@NonNull String orderSerial);\n\n /**\n * Pay the credit order.\n *\n * @param orderSerial order number\n * @return Pay status.\n */\n Observable<PayOrderResult> payCreditOrder(@NonNull String orderSerial);\n\n Observable<Ticket> getPlayTicket(@NonNull String filmId, @Nullable String mediaName,\n @NonNull String orderSerial, @NonNull String licenseId);\n\n Observable<Ticket> getPlayToken(@NonNull String ticket, @NonNull String licenseId,\n @Nullable String checkcode, @Nullable String kdmId);\n\n /**\n * Report the ticket status\n */\n Observable<Response> reportTicketStatus(@NonNull String orderSerial, @NonNull String ticket,\n @NonNull String status, @Nullable String progressrate);\n\n /**\n * refresh order by order serial\n *\n * @param orderSerial order serial\n */\n Observable<Boolean> refreshOrder(@NonNull String orderSerial);\n}", "private static void exSwitchMapThree(){\n Observable<String> intense =\n Observable.just(\"Savi\",\"Healer\",\"Three\",\"Four\",\"Wednesday\",\"Friday\",\"You\",\"Me\")\n .concatMap(result -> Observable.just(result).delay(randomSleepTime(),TimeUnit.MILLISECONDS))\n .doOnDispose(() -> System.out.println(\" * * Disposed * *\"));\n\n //Observable to execute intense task every 5 seconds\n Observable.interval(5,TimeUnit.SECONDS)\n .switchMap(r -> intense)\n .subscribe(System.out::println);\n\n //Sleep the main thread for few seconds\n Take.sleep(20000);\n\n /*\n After every 5 seconds it will dispose the ongoing intense (variable name) process and\n start the same process again.\n */\n\n //Output\n /*\n Savi\n Healer\n Three\n Four\n * * Disposed * *\n Savi\n Healer\n Three\n Four\n Wednesday\n Friday\n You\n * * Disposed * *\n Savi\n Healer\n Three\n Four\n Wednesday\n * * Disposed * *\n */\n }", "public interface QuerySql extends ConditionAble, Stream {\n\n\t/**\n\t * Add parameters to your SQL to replace the question mark?This is a more\n\t * recommended way to replace string splices\n\t * \n\t * @param paramers\n\t * @return\n\t */\n\tQuerySql addParamer(Object... paramers);\n\n\tint update();\n\n\t/**\n\t * \n\t * <p>\n\t * If you need to return a result set instead of a single item; The return type\n\t * is automatically determined by the constructor. If you want to return an\n\t * entity type, add the entity type before the {@link #list(Class)} method\n\t * \n\t * <p>\n\t * The method is equivalent to the integrator of two methods\n\t * \n\t * @see #entities(Class)\n\t * @see #maps()\n\t * \n\t */\n\t<T> List<T> list();\n\n\t<T> List<T> list(Class<T> entityClass);\n\n\t/**\n\t * \n\t * @return Returns a collection of entity class mappings.\n\t */\n\t<T> List<T> entities(Class<T> entityClass);\n\n\t/**\n\t * The result set encapsulated in the form of\n\t * {@code List<Map<String,Object>>}<br>\n\t * This will be an acceptable way to get the mapping of SQL result sets\n\t * \n\t * @return {@link List}{@code <}{@link Map}{@code <}\n\t * {@link String},{@link Object}{@code >}{@code >}\n\t */\n\tList<Map<String, Object>> maps();\n\n\t/**\n\t * \n\t * @param alias - Aliased key-value pairs, returned as aliased key-value if\n\t * matched\n\t * @return\n\t * @since 2.24\n\t */\n\tList<Map<String, Object>> maps(HashMap<String, String> alias);\n\n\t/**\n\t * The result set encapsulated in the form of {@code Map<String,Object>}<br>\n\t * This will be an acceptable way to get the mapping of SQL result sets\n\t * \n\t * @return {@link Map}{@code <} {@link String},{@link Object}{@code >}\n\t */\n\tMap<String, Object> map();\n\n\t/**\n\t * Returns a single result;The return type is automatically determined based on\n\t * the constructor, and if you want to return an entity type, add before that\n\t * \n\t * @return\n\t */\n\t<T> T unique();\n\n\t\n\t/**\n\t * Specify entity class mappings\n\t * @param entityClass - Be sure to include an {@link Id} annotation to declare the primary key\n\t * @return\n\t */\n\t<T> T unique(Class<T> entityClass);\n\t\n\t<T> T entity(Class<T> entityClass);\n\n\t/**\n\t * Gets the columns contained in the query result.\n\t * \n\t * @return\n\t */\n\tList<Column> getQueryColumns();\n\n\t@Override\n\tQuerySql addCondition(Condition cond);\n\n\t@Override\n\tQuerySql addCondition(String fieldName, Cs cs);\n\n\t@Override\n\tQuerySql addCondition(String fieldName, Cs cs, Object value);\n\n\t@Override\n\tQuerySql addCondition(Consumer<List<Condition>> conds);\n\n\t/**\n\t * An extension to the {@link Stream} interface,Returns the specified number of\n\t * results from the SQL statement\n\t * \n\t * @param count\n\t */\n\tList<Map<String, Object>> stream(int count);\n\n}", "public static void main(String[] args) {\n\t\tObservable<String> mObservable = Observable.create(new Observable.OnSubscribe<String>() {\n\t\t\t@Override\n\t\t\tpublic void call(Subscriber<? super String> subscriber) {\n\t\t\t\tsubscriber.onNext(\"hello world\");\n\t\t\t\tsubscriber.onCompleted();\n\t\t\t}\n\t\t}) ;\n\n\t\tSubscriber<String> mSubscriber = new Subscriber<String>() {\n\t\t\t@Override\n\t\t\tpublic void onCompleted() {}\n\n\t\t\t@Override\n\t\t\tpublic void onError(Throwable e) {}\n\n\t\t\t@Override\n\t\t\tpublic void onNext(String s) {System.out.println(s);}\n\t\t} ;\n\n\t\tmObservable.subscribe(mSubscriber);\n\t\t//1.2 abbreviate\n\t\t// TODO: 7/2/15 myObservable.subscribe(onNextAction, onErrorAction, onCompleteAction);\n\t\tObservable<String> mObservable2 = Observable.just(\"Hello RxJava\") ;\n\t\tAction1<String> onNextAction = new Action1<String>() {\n\t\t\t@Override\n\t\t\tpublic void call(String s) {\n\t\t\t\tSystem.out.println(s) ;\n\t\t\t}\n\t\t} ;\n\t\tmObservable2.subscribe(onNextAction);\n\t\t//1.3 simpler code\n\t\tObservable.just(\"simpler code\").subscribe(new Action1<String>() {\n\t\t\t@Override\n\t\t\tpublic void call(String s) {\n\t\t\t\tSystem.out.println(s) ;\n\t\t\t}\n\t\t});\n\t\t//1.4. Java8 lambda\n\t\tObservable.just(\"Hello Rx and lambda\").subscribe(s -> System.out.println(s)) ;\n\t\t//2. transformation\n\t\tObservable.just(\"Hello trans\").subscribe(s -> System.out.println(s+\"formation\")) ;\n\t\t//2.1 map()\n\t\tObservable.just(\"Hello trans\").map(new Func1<String, String>() {\n\t\t\t@Override\n\t\t\tpublic String call(String s) {\n\t\t\t\treturn s+\"formation\";\n\t\t\t}\n\t\t}).subscribe(s -> System.out.println(s));\n//\t\t}).subscribe(System.out::println);\n\t\t//2.2 trans + lambda\n\t\tObservable.just(\"Hello trans\").map(s -> s+\"fromation\").subscribe(s -> System.out.println(s));\n\t\t//or\n\t\tObservable.just(\"Hello trans\").map(s -> s+\"fromation\").subscribe(System.out::println);\n\t\t//2.3 trans String to Integer\n\t\tObservable.just(\"Hello trans!\").map(new Func1<String, Integer>() {\n\t\t\t@Override\n\t\t\tpublic Integer call(String s) {\n\t\t\t\treturn s.hashCode();\n\t\t\t}\n\t\t}).subscribe(i-> System.out.println(Integer.toString(i)));\n\t\tObservable.just(\"Hello trans!\").map(s -> s.hashCode())\n\t\t\t\t.subscribe(i -> System.out.println(Integer.toString(i)));\n\t\tObservable.just(\"Hello trans!\").map(String::hashCode)\n\t\t\t\t.subscribe(i->System.out.println(Integer.toString(i)));\n\t\tObservable.just(\"Hello trans!\").map(String::hashCode).map(i->Integer.toString(i))\n\t\t\t\t.subscribe(System.out::println);\n\t}", "public interface CommonRepository {\n\n Observable<Result<UserInfo>> loginByPassword(String userID, String password);\n\n Observable<Result<UserInfo>> loginByQrCode(String userQrCode);\n\n Observable<Result<List<CarNoListInfo>>> carNoList(String id);\n\n Observable<Result> electCarNo(String id, String carNo);\n\n Observable<Result<GasInfo>> gasMsgByQrCode(String gasQrCode);\n\n Observable<Result<CustomerInfo>> customerMsgByQrCode(String customerQrCode);\n\n Observable<Result<WorkerInfo>> workerMsgByQrCode(String workerQrCode);\n\n Observable<Result<CarInfo>> carMsgByQrCode(String carQrCode);\n\n Observable<Result<OrderInfo>> orderMsgByQrCode(String orderQrCode);\n\n\n Observable<Result<ListResult<TransportTaskInfo>>> transportTaskList(String id, String enterpriseID, int pageIndex,\n int pageSize, int state, String stationID, String shopID,\n String depID);\n\n Observable<Result<TransportTaskDetailInfo>> transportTaskDetail(String transportID, String transportTaskID);\n\n Observable<Result<OrderInfo>> orderMsgByOrderID(String orderID);\n\n Observable<Result<CustomerInfo>> customerMsgByCustomerID(String customerID);\n\n Observable<Result<GasInfo>> gasMsgByLabel(String label);\n\n Observable<Result> transportOfPay(String transportTaskID, String id, String gasData, int count);\n\n Observable<Result> transportOfReclaim(String transportID, String id, String gasData, int count);\n\n Observable<Result<ListResult<TransportTaskInfo>>> transportIdEqTask(String transportID, String customerName, int status);\n\n Observable<Result<CustomerCardNoTaskInfo>> transportByCustomerCardNo(String customerCardNo);\n\n Observable<Result<OrderTaskInfo>> transportByOrderQrCode(String orderQRcode);\n\n Observable<Result<SetUpLabelInfo>> setUpScan(String gasLabe);\n\n Observable<Result<List<GasmoduleList>>> gasModule(String enterpriseID);\n\n Observable<Result> gasMsgChange(String id, String gasLabe, String productFactoryCompany, String productFactoryID, String gasweight,\n String gasModule, String gasSteelcode, String productData,\n String nextTestCompany, String lastTestCompany, String lastTestData,\n String image1, String image2, String image3);\n\n Observable<Result <ListResult <GasSetUpLogListInfo>>> gasSetUpLog(String enterpriseID,\n int pageSize, int pageIndex);\n\n Observable<Result<ListResult<GasSetUpLogListInfo>>> gasLabeEqLog(String gasLabe, String steelCode);\n\n Observable<Result<GasLabeReplaceInfo>> gasLabeReplace(String gasLabe);\n\n Observable<Result<SinceByOrderInfo>> sinceByOder(String orderID);\n\n Observable<Result<SinceByCustomerInfo>> sinceByCustomer(String customerCardNo);\n\n Observable<Result> sinceOfPay(String gasMsg, String orderID, String id);\n\n Observable<Result> sinceOfReclaim(String gasMsg, String orderID, String id);\n\n Observable<Result<ListResult<SinceLogListInfo>>> sinceLog(String id);\n\n\n Observable<Result<ListResult<SinceLogListInfo>>> sinceEqLog(String orderID, String customerName);\n\n Observable<Result<SinceTaskMsgInfo>> sinceTaskMsg(String orderID);\n\n Observable<Result<CheckByCustomercardNoInfo>> checkByCustomercardNo(String customerCardNo);\n\n Observable<Result<CheckByOrderInfo>> checkByOrder(String orderID);\n\n Observable<Result<List<HotWaterHeaterModuleListInfo>>> hotWaterHeaterModule(String orderID);\n\n Observable<Result> checkSubmit(String isAirVents, String isSafetyWarning, String isAlarm,\n String isTrueAlarm, String isFireEquipment, int outTimeGasTotal,\n int scrappingGasTotal, String gasLocation, String spacing,\n String isNearStove, String isAirLeakageValve, String isProtectionDeviceStove,\n String isToolUseYearStove, String isSmokeRoad, String hotWaterToolModule,\n String isHotWaterToolUseYear, String isVoltageRegulatorAirLeakage, String isConnectingPipeAging,\n String checkImageOne, String checkImageTwo, String checkImageThree,\n String oherRemark, String isPass, String address,\n String customerName);\n\n Observable<Result<ListResult<CheckLogInfo>>> checkLog(String enterpriseID);\n\n Observable<Result<ListResult<CheckLogInfo>>> checkLogBySearch(String userName,\n String userNameID);\n\n Observable<Result<CheckLogDetailInfo>> checkLogDetail(String userName,\n String userNameID);\n}", "public interface KamusEngIndHelper {\n\n List<EnglishIndonesia> preLoadRawEngInd();\n\n KamusEngIndHelper openEngInd() throws SQLException;\n\n void closeEngInd();\n\n Observable<List<EnglishIndonesia>> getDataBySearchWordEngInd(String word);\n\n Observable<List<EnglishIndonesia>> getSearchWordEngInd(String word);\n\n Observable<List<EnglishIndonesia>> getAllDataEngInd();\n\n long insertEngInd(EnglishIndonesia englishIndonesia);\n\n void beginTransactionEngInd();\n\n void setTransactionSuccessEngInd();\n\n void endTransactionEngInd();\n\n void insertTransactionEngInd(EnglishIndonesia englishIndonesia);\n\n int updateEngInd(EnglishIndonesia englishIndonesia);\n\n int deleteEngInd(int id);\n\n Observable<List<EnglishIndonesia>> fetchDatabaseEngInd();\n\n// Observable<EnglishIndonesia> fetchDatabaseEngInd();\n}", "public static void zipObservables(CountDownLatch latch) {\n\n Observable<Observable<String>> source = Observable.create(observableEmitter -> {\n System.out.println(\"create\");\n observableEmitter.onNext(Observable.just(\"abc\", \"def\"));\n observableEmitter.onNext(Observable.just(\"123\", \"456\"));\n observableEmitter.onNext(Observable.just(\"alpha\", \"beta\", \"gama\"));\n observableEmitter.onComplete();\n });\n\n source.doOnSubscribe(d -> System.out.println(\"source doOnSubscribe\"));\n source.doOnNext(i -> System.out.println(\"source doOnNext = \" + i.toString()));\n source.doOnComplete(() -> System.out.println(\"source doOnComplete\"));\n\n\n Observable.zip(source, items -> items[0] + \"-\" + items[1] + \"-\" + items[2])\n .doOnSubscribe(d -> System.out.println(\"zip doOnSubscribe\"))\n .doOnNext(i -> System.out.println(\"zip doOnNext\"))\n .subscribe(new MyObserver<>(latch));\n }", "public Join(Operator operator1, Operator operator2, TupleTransformation tupleTrans) {\n o1 = operator1;\n o2 = operator2;\n this.tupleTrans = tupleTrans;\n tuple1 = o1.next();\n }", "@Dao\npublic interface SpacecraftInstrumentsDao {\n \n /**\n * Search for temperature readings with MAPPER\n */\n @Select(customWhereClause = \"spacecraft_name= :spacecraftName AND journey_id= :journeyId\")\n PagingIterable<SpacecraftTemperatureOverTime> getTemperatureReading(\n String spacecraftName, UUID JourneyId,\n Function<BoundStatementBuilder, BoundStatementBuilder> setAttributes);\n \n /**\n * Search for temperature readings with QUERY PROVIDER\n */\n @QueryProvider(providerClass = SpacecraftInstrumentsQueryProvider.class, \n entityHelpers = { SpacecraftTemperatureOverTime.class, SpacecraftPressureOverTime.class, \n SpacecraftLocationOverTime.class, SpacecraftSpeedOverTime.class})\n PagingIterable<SpacecraftTemperatureOverTime> getTemperatureReading(\n String spacecraftName, UUID JourneyId, \n Optional<Integer> pageSize, \n Optional<String> pagingState);\n \n /**\n * Upsert a temperature reading.\n *\n * @param reading\n * The temperature reading\n * @return\n * if statement was applied\n */\n @Insert\n boolean upsertTemperature(SpacecraftTemperatureOverTime reading);\n \n /**\n * Bulk inserts of temperature readings.\n *\n * @param reading\n * The temperature readings\n */\n @QueryProvider(providerClass = SpacecraftInstrumentsQueryProvider.class, \n entityHelpers = { SpacecraftTemperatureOverTime.class, SpacecraftPressureOverTime.class, \n SpacecraftLocationOverTime.class, SpacecraftSpeedOverTime.class})\n CompletionStage<Boolean> insertTemperatureReadingAsync(SpacecraftTemperatureOverTime[] readings);\n \n @QueryProvider(providerClass = SpacecraftInstrumentsQueryProvider.class, \n entityHelpers = { SpacecraftTemperatureOverTime.class, SpacecraftPressureOverTime.class, \n SpacecraftLocationOverTime.class, SpacecraftSpeedOverTime.class})\n CompletionStage<Boolean> insertLocationReadingAsync(SpacecraftLocationOverTime[] readings);\n \n @QueryProvider(providerClass = SpacecraftInstrumentsQueryProvider.class, \n entityHelpers = { SpacecraftTemperatureOverTime.class, SpacecraftPressureOverTime.class, \n SpacecraftLocationOverTime.class, SpacecraftSpeedOverTime.class})\n CompletionStage<Boolean> insertPressureReadingAsync(SpacecraftPressureOverTime[] readings);\n \n @QueryProvider(providerClass = SpacecraftInstrumentsQueryProvider.class, \n entityHelpers = { SpacecraftTemperatureOverTime.class, SpacecraftPressureOverTime.class, \n SpacecraftLocationOverTime.class, SpacecraftSpeedOverTime.class})\n CompletionStage<Boolean> insertSpeedReadingAsync(SpacecraftSpeedOverTime[] readings);\n \n \n \n\n /**\n * Upsert a location reading.\n *\n * @param reading\n * The location reading\n * @return\n * if statement was applied\n */\n @Insert\n boolean upsertLocation(SpacecraftLocationOverTime reading);\n\n /**\n * Upsert a pressure reading.\n *\n * @param reading\n * The pressure reading\n * @return\n * if statement was applied\n */\n @Insert\n boolean upsertPressure(SpacecraftPressureOverTime reading);\n\n /**\n * Upsert a speed reading.\n *\n * @param reading\n * The speed reading\n * @return\n * if statement was applied\n */\n @Insert\n boolean upsertSpeed(SpacecraftSpeedOverTime reading);\n\n /**\n * Search for pressure readings.\n */\n @QueryProvider(providerClass = SpacecraftInstrumentsQueryProvider.class, \n entityHelpers = { SpacecraftTemperatureOverTime.class, SpacecraftPressureOverTime.class, \n SpacecraftLocationOverTime.class, SpacecraftSpeedOverTime.class})\n PagingIterable<SpacecraftPressureOverTime> getPressureReading(\n String spacecraftName, UUID JourneyId, Optional<Integer> pageSize, Optional<String> pagingState);\n \n /**\n * Search for speed readings.\n */\n @QueryProvider(providerClass = SpacecraftInstrumentsQueryProvider.class, \n entityHelpers = { SpacecraftTemperatureOverTime.class, SpacecraftPressureOverTime.class, \n SpacecraftLocationOverTime.class, SpacecraftSpeedOverTime.class})\n PagingIterable<SpacecraftSpeedOverTime> getSpeedReading(\n String spacecraftName, UUID JourneyId, Optional<Integer> pageSize, Optional<String> spagingState);\n \n /**\n * Search for location readings.\n */\n @QueryProvider(providerClass = SpacecraftInstrumentsQueryProvider.class, \n entityHelpers = { SpacecraftTemperatureOverTime.class, SpacecraftPressureOverTime.class, \n SpacecraftLocationOverTime.class, SpacecraftSpeedOverTime.class})\n PagingIterable<SpacecraftLocationOverTime> getLocationReading(\n String spacecraftName, UUID JourneyId, Optional<Integer> pageSize, Optional<String> pagingState);\n \n /**\n * Insert instruments.\n */\n @QueryProvider(providerClass = SpacecraftInstrumentsQueryProvider.class, \n entityHelpers = { SpacecraftTemperatureOverTime.class, SpacecraftPressureOverTime.class, \n SpacecraftLocationOverTime.class, SpacecraftSpeedOverTime.class})\n void insertInstruments(\n SpacecraftTemperatureOverTime temperature, SpacecraftPressureOverTime pressure, \n SpacecraftSpeedOverTime speed, SpacecraftLocationOverTime location);\n}", "@Override\n\tprotected void addRequestedOperators() {\n\t}", "@Dao\npublic interface DairyDao {\n @Query(\"SELECT * FROM dairies where userId = :userId AND diaryId = :diaryId\")\n LiveData<DairyEntity> loadDairies(int userId, int diaryId);\n\n @Query(\"SELECT * FROM dairies where userId = :userId AND diaryId = :diaryId\")\n DairyEntity loadDairiesSync(int userId, int diaryId);\n\n @Query(\"SELECT * FROM dairies where userId = :userId\")\n LiveData<List<DairyEntity>> loadAll(int userId);\n\n @Insert(onConflict = OnConflictStrategy.REPLACE)\n void insertAll(List<DairyEntity> dairyEntities);\n\n @Insert(onConflict = OnConflictStrategy.REPLACE)\n void insert(DairyEntity dairyEntity);\n\n @Update()\n void update(DairyEntity dairyEntity);\n\n @Update\n void updateAll(DairyEntity...dairyEntities);\n\n}", "public interface DiaryEntryRepository {\n\n Observable<Boolean> putDiaryEntry(DiaryEntryDataModel diaryEntryDataModel);\n\n Observable<List<DiaryEntryDataModel>> getAllDiaryEntriesMatching(String meal, String date);\n\n Observable<Boolean> deleteDiaryEntry(int id);\n\n Observable<Boolean> updateMealOfDiaryEntry(int id, MealDataModel mealDataModel);\n\n Observable<DiaryEntryDataModel> getWaterStatus(String date);\n\n Observable<Boolean> updateAmountOfWater(float amount, String date);\n\n Observable<Boolean> addAmountOfWater(float amount, String date);\n\n Observable<DiaryEntryDataModel> getDiaryEntryById(int id);\n\n Observable<Boolean> deleteAllDiaryEntriesMatchingMealId(int mealId);\n}", "public interface CustomerMapper {\n\n public List<Customer> queryByCondition(CustomerDto customerParameter);\n\n public List<Customer> queryByTemp(CustomerDto customerParameter);\n\n public Customer queryById(Long Id);\n\n public void save(CustomerDto customerParameter);\n\n public void update(CustomerDto customerParameter);\n\n public void delete(Long Id);\n\n public List<Long> queryIdsByName(CustomerDto customerParameter);\n}", "public interface CommonMapper {\r\n\r\n public Map selectSingleLine(String sqlStr);\r\n\r\n public List<Map> selectListMap(String sqlStr);\r\n\r\n public Integer selectCount(String sql);\r\n\r\n public Integer insertBatch(String sql);\r\n\r\n public Integer updateBatch(String sql);\r\n}", "public interface KnowledgeRepository {\n Observable<PageEntity<String>> fetchList(Integer pn);\n\n Observable<PageEntity<User>> users(@Body AbstractQry qry);\n}", "@Override\n public void loadPlacesFromDB(DataBaseConnector contactsDB, List<Target> dataTmp, DisposableObserver<String> loadFromDBSubscriber) {\n Observable<String> loadFromDBObservable = Observable.just(loadPlacesFromRepository(contactsDB, dataTmp));\n loadFromDBSubscriber = loadFromDBObservable.subscribeOn(Schedulers.io())\n .observeOn(AndroidSchedulers.mainThread())\n .subscribeWith(new DisposableObserver<String>() {\n @Override\n public void onComplete() {}\n\n @Override\n public void onError(Throwable e) {\n e.printStackTrace();\n }\n\n @Override\n public void onNext(String value) {\n int i = 1;\n }\n });\n }", "public void flatMap() {\r\n\t\tList<Integer> list = Arrays.asList(1, 2, 3, 7, 8, 9, 10);\r\n\t\tList<Integer> list2 = Arrays.asList(4, 5, 6);\r\n\t\tObservable.just(list, list2).flatMap(x -> Observable.from(x)).map(x -> x * 10).subscribe(integerSubscribe());\r\n\t}", "@Mapper\npublic interface VirtualRepayFlowMapper {\n @DataSource(\"bigdata2_jdb\")\n @Select(\"SELECT * FROM virtual_repay_flow WHERE update_time >= #{from_time} and update_time < #{end_time} and id>#{id} limit 1000\")\n List<VirtualRepayFlow> find(@Param(\"from_time\") String from_time,\n @Param(\"end_time\") String end_time,\n @Param(\"id\") long id);\n\n\n @DataSource(\"dmp\")\n @Insert(\"INSERT INTO virtual_repay_flow (id,uuid,virtual_productid,to_user,amount,interest,repay_status,repay_time,create_time,update_time) values\" +\n \"(#{id},#{uuid},#{virtual_productid},#{to_user},#{amount},#{interest},#{repay_status},#{repay_time},#{create_time},#{update_time})\")\n void insert(VirtualRepayFlow virtualRepayFlow);\n\n @DataSource(\"dmp\")\n @Delete(\"DELETE FROM repay_flow where update_time<#{update_time}\")\n void delete(@Param(\"update_time\") String update_time);\n\n @DataSource(\"dmp\")\n @Select(\"SELECT * FROM virtual_repay_flow WHERE id=#{id}\")\n VirtualRepayFlow getById(@Param(\"id\") long id);\n\n\n @DataSource(\"dmp\")\n @Select(\"SELECT * FROM virtual_repay_flow WHERE uuid=#{uuid}\")\n VirtualRepayFlow getByUuid(@Param(\"uuid\") String uuid);\n}", "private static void scenario() {\n\n Observable<String> stringObservable = Observable.just(\"One\",\"Two\",\"Three\",\"Four\",\"Five\",\"Six\",\"Seven\",\"Eight\",\"Nine\");\n\n Observable<String> stringProcessor = stringObservable.concatMap(data -> Observable.just(data).delay(randomSleepTime(),\n TimeUnit.MILLISECONDS));\n\n stringProcessor.subscribe(System.out::println);\n\n sleep(20000);\n\n /* OUTPUT :\n One\n Two\n Three\n Four\n Five\n Six\n Seven\n Eight\n Nine\n */\n }", "@Dao // One Dao per entity\npublic interface PlantDao {\n\n @Insert\n Single<Long> insert(Plant plant);\n\n @Insert\n Single<List<Long>> insert(Collection<Plant> plants);\n\n @Insert\n Single<List<Long>> insert (Plant... plants);\n\n @Update\n Single<Integer> update(Plant plant);\n\n @Update\n Single<Integer> update(Plant... plants);\n\n @Update\n Single<Integer> update(Collection<Plant> plants);\n\n @Delete\n Single<Integer> delete(Plant plant); // a single plant ?\n\n @Delete\n Single<Integer> delete(Plant... plant); // a whole bunch of plants\n\n @Delete\n Single<Integer> delete(Collection<Plant> plant); // a collection of plants\n\n @Query(\"SELECT * FROM Plant ORDER BY timestamp DESC\")\n LiveData<List<Plant>> selectAll();\n\n @Transaction\n @Query(\"SELECT * FROM Plant WHERE plant_id = :plantId\")\n LiveData<PlantWithHistories> selectByHstId(long plantId);\n\n @Transaction\n @Query(\"SELECT * FROM Plant WHERE plant_id = :plantId\")\n LiveData<PlantWithNotes> selectByNoteId(long plantId);\n\n}", "public void concatMap() {\r\n\t\tList<Integer> list1 = Arrays.asList(1, 2, 3, 7, 8, 9, 10);\r\n\t\tList<Integer> list2 = Arrays.asList(4, 5, 6);\r\n\t\tObservable.just(list1, list2).concatMap(x -> Observable.from(x)).map(x -> x * 10).subscribe(integerSubscribe());\r\n\t}", "@Override\n public void emitTuples() {\n\n Statement query = queryToRetrieveData();\n logger.debug(String.format(\"select statement: %s\", query.toString()));\n RecordSet rs;\n try {\n rs = store.getClient().query(null, query);\n while(rs.next()){\n Record rec = rs.getRecord();\n T tuple = getTuple(rec);\n outputPort.emit(tuple);\n }\n }\n catch (Exception ex) {\n store.disconnect();\n DTThrowable.rethrow(ex);\n }\n }", "public interface QueryExecutor {\n \n /**\n * Execute query that has neither request nor response\n *\n * @param noParamQuery query as velocity template string, it may depend on database type or other context parameters\n * @param conn connection to execute query\n */\n void executeUpdate(String noParamQuery, Connection conn);\n \n /**\n * Execute query that has no response parameters\n *\n * @param reqQuery query as velocity template string\n * @param req request query parameters\n * @param conn connection to execute query\n * @param <T> type of request\n */\n <T extends BaseDto> void executeUpdate(String reqQuery, T req, Connection conn);\n \n /**\n * Execute query that has no request parameters\n *\n * @param resQuery query as velocity template string\n * @param transformer transformer for query result\n * @param conn connection to execute query\n * @param <T> type of result\n * @return list of query results\n */\n <T extends BaseDto> List<T> executeQuery(String resQuery, QueryResultTransformer<T> transformer, Connection conn);\n \n /**\n * Execute query that has request and response\n *\n * @param reqResQuery query as velocity template string\n * @param req request query parameters\n * @param transformer transformer for query result\n * @param conn connection to execute query\n * @param <T> type of result\n * @param <V> type of request\n *\n * @return list of query results\n */\n <T extends BaseDto, V extends BaseDto> List<T> executeQuery(String reqResQuery, V req, QueryResultTransformer<T> transformer, Connection conn);\n \n /**\n * Query runner\n *\n * @return instance of query runner\n */\n default QueryRunner getQueryRunner() {\n return new QueryRunner();\n }\n\n}", "public interface Operator {\n\t\n\tpublic ArrayList<LeafValue> readOneTuple(); // Read one row at a time.\n\tpublic ArrayList<Column> getSchema(); // Get the current schema after \"N\" operations.\n\tpublic void reset(); // Reset the iteration pointer.\n\tpublic void dump(); // Print all the rows.\n}", "public interface SQLTransform {\n\n\t/**\n\t * Generate code to put into cursor, the bean property value.\n\t *\n\t * @param tableEntity entity with table to target\n\t * @param methodBuilder the method builder\n\t * @param beanClass the bean class\n\t * @param beanName the bean name\n\t * @param property the property\n\t * @param cursorName the cursor name\n\t * @param indexName the index name\n\t */\n\tvoid generateReadPropertyFromCursor(SQLiteEntity tableEntity, Builder methodBuilder, TypeName beanClass, String beanName, ModelProperty property, String cursorName, String indexName);\n\n\t/**\n\t * Used when you need to use a cursor column as select's result value. \n\t *\n\t * @param methodBuilder the method builder\n\t * @param daoDefinition the dao definition\n\t * @param paramTypeName the param type name\n\t * @param cursorName the cursor name\n\t * @param indexName the index name\n\t */\n\tvoid generateReadValueFromCursor(Builder methodBuilder, SQLiteDaoDefinition daoDefinition, TypeName paramTypeName, String cursorName, String indexName);\n\n\t/**\n\t * Generate default value, null or 0 or ''.\n\t *\n\t * @param methodBuilder the method builder\n\t */\n\tvoid generateDefaultValue(Builder methodBuilder);\n\n\t/**\n\t * Write a bean property to a content writer.\n\t *\n\t * @param methodBuilder the method builder\n\t * @param beanName the bean name\n\t * @param beanClass the bean class\n\t * @param property property to write\n\t */\n\tvoid generateWriteProperty2ContentValues(Builder methodBuilder, String beanName, TypeName beanClass, ModelProperty property);\n\t\n\t/**\n\t * Write a bean property into a where condition.\n\t *\n\t * @param methodBuilder the method builder\n\t * @param beanName the bean name\n\t * @param beanClass the bean class\n\t * @param property the property\n\t */\n\tvoid generateWriteProperty2WhereCondition(Builder methodBuilder, String beanName, TypeName beanClass, ModelProperty property);\n\n\t/**\n\t * <p>\n\t * Generate code to write parameter to where condition\n\t * </p>.\n\t *\n\t * @param methodBuilder the method builder\n\t * @param method the method\n\t * @param paramName the param name\n\t * @param paramTypeName the param type name\n\t */\n\tvoid generateWriteParam2WhereCondition(Builder methodBuilder, SQLiteModelMethod method, String paramName, TypeName paramTypeName);\n\t\n\t/**\n\t * <p>Generate code to write parameter to where statement</p>.\n\t *\n\t * @param methodBuilder the method builder\n\t * @param method the method\n\t * @param paramName the param name\n\t * @param paramType the param type\n\t * @param property the property\n\t */\n\tvoid generateWriteParam2ContentValues(Builder methodBuilder, SQLiteModelMethod method, String paramName, TypeName paramType, ModelProperty property);\n\n\t/**\n\t * Generate code to set property to null value or default value.\n\t *\n\t * @param methodBuilder the method builder\n\t * @param beanClass the bean class\n\t * @param beanName the bean name\n\t * @param property the property\n\t * @param cursorName the cursor name\n\t * @param indexName the index name\n\t */\n\tvoid generateResetProperty(Builder methodBuilder, TypeName beanClass, String beanName, ModelProperty property, String cursorName, String indexName);\n\n\t/**\n\t * Associated column type.\n\t *\n\t * @return column type as string\n\t */\n\tString getColumnTypeAsString();\n\n\t/**\n\t * Gets the column type.\n\t *\n\t * @return column type\n\t */\n\tColumnAffinityType getColumnType();\n\t\n\t/**\n\t * if true, transform can be used as convertion type in a type adapter.\n\t *\n\t * @return true, if is type adapter aware\n\t */\n\tboolean isTypeAdapterAware();\n\n}", "@Override\n public ObservableSource<? extends String> call() throws Exception {\n SystemClock.sleep(2000);\n return Observable.just(\"one\", \"two\", \"three\", \"four\", \"five\");\n }", "public interface IInteractor<R, P> {\n\n Observable<R> execute(P parameter);\n\n}", "@Mapper\npublic interface MusicMapper {\n\n //明星新歌推荐歌曲\n @Select(\"SELECT starPhoto,starName,starMusicName,starMusicAddress,starLyrics,starId FROM starmusic order by starDate DESC\")\n List<StarMusic> suggestStarMusic();\n\n //大众推荐歌曲\n @Select(\"SELECT worksDate,photo,u.userName userName,workName,workAddress,workLyrics FROM works w JOIN user u ON(w.userId = u.userId) order by w.worksDate DESC\")\n List<Works> suggestWorksMusic();\n\n //明星高分榜\n @Select(\"SELECT * FROM starmusic order by starScore\")\n List<StarMusic> listStarMusic();\n\n //附近的人查询\n @SelectProvider(type = SelectSQL.class,method =\"selectNearUser\" )\n List<User> selectNearUser(String address);\n\n //查询当前月份的最好大众歌曲\n @Select(\"SELECT * FROM works\\n\" +\n \"WHERE PERIOD_DIFF( date_format( now( ) , '%Y%m' ) , date_format( worksDate, '%Y%m' ) ) =0 \" +\n \"ORDER BY good DESC\")\n List<Works> bestUserMusic();\n\n //历史最好大众音乐\n @Select(\"SELECT * FROM works order by good DESC\")\n List<Works> bestHistoryMusic();\n\n //查询歌曲信息\n @Select(\"SELECT starName,starMusicName,starLyrics,starPhoto,starMusicAddress from starmusic\")\n List<StarMusic> selectStarMusic();\n\n //查询个人动态\n @Select(\"SELECT userName,userPhoto,userSign,generalMusic,generDate from user JOIN general ON (userId = myId) WHERE userName =#{userName} order by generDate DESC\")\n List<PersonGeneral> selectUserGener(String userName);\n\n //根据发表的动态去作品表查找用户创作的歌曲\n @Select(\"SELECT * FROM works WHERE workName =#{generalMusic}\")\n List<Works> workMusic(String generalMusic);\n\n //根据输入的歌曲名查找歌曲\n @SelectProvider(type=SqlPrivde.class,method = \"getSql\")\n List<Works> seletMulit(String sech);\n\n //根据输入的歌曲名和歌唱者查找\n @SelectProvider(type=SqlPrivde.class,method = \"getSqlMW\")\n List<Works> seletMW(String myName,String WorkName );\n\n //查询用户作品的点赞数\n @Select(\"SELECT good FROM works WHERE workName=#{workName}\")\n Integer selectGood(String workName);\n\n}", "@Dao\npublic interface TripGearDao {\n @Query(\"SELECT * FROM tripgear\")\n List<TripGear> getAll();\n\n\n @Query(\"SELECT * FROM tripgear WHERE tripId = :id\")\n List<TripGear> getAllByTripId(int id);\n\n @Query(\"SELECT tripgear.* FROM tripgear LEFT JOIN catch ON catch.gearId == tripgear.id WHERE tripId = :id AND catch.gearId == tripgear.id\")\n List<TripGear> getAllByCatchedTripId(int id);\n\n\n\n @Query(\"SELECT tripgear.id AS 'lineId', tripgear.tripId AS 'tripId', tripgear.number AS 'number', word.id AS 'gearWordId', word.si_name AS 'gearWordSi', word.en_name AS 'gearWordEn', word.tm_name AS 'gearWordTa' FROM tripgear LEFT JOIN word ON word.id = tripgear.gearType WHERE tripgear.tripId = :tripId\")\n List<ShowTripGearModel> getAll_(int tripId);\n\n @Query(\"SELECT tripgear.id AS 'lineId', tripgear.tripId AS 'tripId', tripgear.number AS 'number', word.id AS 'gearWordId', word.si_name AS 'gearWordSi', word.en_name AS 'gearWordEn', word.tm_name AS 'gearWordTa' FROM tripgear LEFT JOIN word ON word.id = tripgear.gearType WHERE tripgear.tripId = :tripId AND tripgear.number <> '' \")\n List<ShowTripGearModel> getSetDataAll_(int tripId);\n\n @Query(\"SELECT * FROM tripgear WHERE id IN (:id)\")\n List<TripGear> loadAllByIds(int id);\n\n @Insert\n void insert(TripGear tripGear);\n\n @Query(\"DELETE FROM tripgear\")\n void deleteAll();\n\n @Delete\n void delete(TripGear tripGear);\n\n @Query(\"UPDATE tripgear SET number = :number , startDate = :startDate , startGpsLat = :startGpsLat, startGpsLon = :startGpsLon, endGpsLat = :endGpsLat,endGpsLon = :endGpsLon, endDate = :endDate WHERE id = :lineId\")\n void updateSetData(int lineId, String number, String startDate, String startGpsLat, String startGpsLon, String endGpsLat , String endGpsLon, String endDate);\n}", "public interface PromocionQryMapper {\r\n\r\n List<PromocionDetalle> findPromocionDetalleList(PromocionFlt proveedorFlt);\r\n\r\n List<Promocion> findPromocionList(PromocionFlt proveedorFlt);\r\n\r\n void deletePromocion(String coPromocion);\r\n void deletePromocionLocal(String coPromocion);\r\n\r\n List<PromocionLocal> findPromocionDetalleLocalList(PromocionFlt proveedorFlt);\r\n}", "@Override\n protected Flowable<Resource<List<Movie>>> buildUseCaseObservable() {\n return covertObservableToFlowable(searchQuery.getQuery())\n .switchMap(new Function<String, Publisher<Resource<List<Movie>>>>() {\n @Override\n public Publisher<Resource<List<Movie>>> apply(String s) throws Exception {\n searchQuery.setStringQuery(s);\n return repository.getSearch(searchQuery)\n .map(movieApiResponse -> Resource.success(movieApiResponse.getResults()));\n }\n }).startWith(Resource.loading(\"Write something to search films\"));\n }", "public void setOperator(String incomingOperator)\r\n {\r\n \r\n operator = incomingOperator;\r\n \r\n }", "@Mapper\npublic interface ZtreeMapper {\n @Select(\"select * from jy_ztree\")\n List<Ztree> queryZtree();\n}", "public static void main(String[] args) throws InterruptedException {\n\t\tObservable.just(\"hi\",\"hello\",\"okay\").subscribe(z -> System.out.print(z));\n\t\t\n\t\t// creating observable using create in lambda style[Sync]\n\t\tObservable.create( f ->{\n\t\t\t\t\t\t\tf.onNext(\"hello\");\n\t\t\t\t\t\t\tif( f.isUnsubscribed() ){\n\t\t\t\t\t\t\t\treturn; \n\t\t\t\t\t\t\t}}).subscribe( s -> System.out.println(s));\n\t\t\n\t\t\n\t\tExecutorService executor = Executors.newSingleThreadExecutor();\n\t\tSystem.out.println(\"----\"+Thread.currentThread().getName());\n\t\t\n\t\t// creating observable using create in lambda style[Async]\n\t\tObservable.create(f -> {executor.submit(() ->{\n\t\t\t f.onNext(Thread.currentThread().getName());\n\t \t});}).subscribe(s -> {System.out.println(Thread.currentThread().getName()); \n\t \t\t\t\t\t\t\tSystem.out.println(s);} );\n\t\t\n\t\t// creating observable using create in lambda style[Async + observerOn]\n\t\tObservable.create(f -> {executor.submit(() ->{\n\t\t\t f.onNext(Thread.currentThread().getName());\n\t \t});}).observeOn(Schedulers.newThread()).subscribe(s -> {System.out.println(Thread.currentThread().getName()); \n\t \t\t\t\t\t\t\tSystem.out.println(s);} );\n\n\t\t\n\t\t// creating observable using create in lambda style[Async + subscribeOn]\n\t\tObservable.create(f -> {executor.submit(() ->{\n\t\t\t f.onNext(Thread.currentThread().getName());\n\t \t});}).subscribeOn(Schedulers.newThread()).subscribe(s -> {System.out.println(Thread.currentThread().getName()); \n\t \t\t\t\t\t\t\tSystem.out.println(s);} );\n\n\t\t\n\t\tList<Integer> result = new ArrayList<Integer>();\n\t\t//bulk API simulation\n\t\tObservable<Integer> obs = Observable.just(1,2,3,4,5,6).map(userId ->{\n\t\t\t//make mysql call\n\t\t try { System.out.println(\"---\"+Thread.currentThread().getName());\n\t\t\treturn makeSqlCall(userId);\n\t\t\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\treturn 0;\n\t\t});\n\t\t\t\t\n\t obs.subscribeOn(Schedulers.io()).subscribe(id ->{ result.add(id);System.out.println(Thread.currentThread().getName());});\n\t for(Integer x: result){System.out.print(x+\" - \");}\n\t\t\n\t}", "public interface ListInteractor {\n\n Observable<List<Movie>> getListOfMostPopularMovies();\n\n Observable<List<Movie>> getListOfHighestRatedMovies();\n\n Observable<List<Movie>> getListOfUpcomingMovies();\n\n Observable<List<Movie>> getListOfSearchedMovies(String searchQuery);\n\n Observable<List<Genre>> getListOfAllMovieGenres();\n\n\n Observable<List<TvShow>> getListOfMostPopularTvShows();\n\n Observable<List<TvShow>> getListOfHighestRatedTvShows();\n\n Observable<List<TvShow>> getListOfSearchedTvShows(String searchQuery);\n\n Observable<List<Genre>> getListOfAllTvGenres();\n}", "public static Observable fill_Otabel(String Q,String who,List<String> elements,List<String> types) \r\n {\r\n\t String temp;\r\n\t ResultSet rs;\r\n\t //obtain the result set\r\n\t if(elements==null ||elements.size()==0)\r\n\t {\r\n\t rs = DBUtil.excecuteQuery(Q); \r\n\t }\r\n\t else\r\n\t {\r\n\t\t rs= DBUtil.excecuteQuery(Q,elements,types); \r\n\t }\r\n\t Observable result =FXCollections.observableArrayList();\r\n\t try \r\n\t {\r\n\t\t //System.out.println(Q);\r\n\t\t rs.last();\r\n\t\t\tif (rs.getRow() == 0)\r\n\t\t\t{\r\n//\t\t\t JOptionPane.showMessageDialog(null,\"لا يوجد طالب يوافق البيانات المدخلة الرجاء التأكد من صحة البيانات المدخلة\",\"نتيجة فارغة\",JOptionPane.ERROR_MESSAGE);\r\n\t\t\treturn result;\r\n\t\t\t} \r\n\t\t\trs.beforeFirst();\r\n\t } \r\n\t catch (Exception e)\r\n\t {\r\n\t\t System.out.println(e.getMessage()+\" error constructing the result set either its null or connection faild class JDBC\");\r\n\t }\r\n\t \r\n\t //create observable list\r\n\t \r\n\t switch (who) \r\n\t {\r\n///////////////////////////////////////////////////////////////////////////////////////////\r\n \tcase Wizard.Student:\r\n \t{\r\n \t\ttry\r\n \t\t{\r\n\t\t \t ObservableList<Student> students = FXCollections.observableArrayList();\r\n\t\t\t\t while (rs.next())\r\n\t\t\t { \r\n\t\t\t\t\tStudent student = new Student(rs.getInt(\"ID\"),\r\n\t\t\t\t\t\t\trs.getString(\"Name\"));\r\n\t\t\t\t\r\n\t\t\t\t\tstudent.setaddress(rs.getString(\"Address\"));\r\n\t\t\t\t\tstudent.setB_Date(rs.getString(\"B_Date\"));\r\n\t\t\t\t\tstudent.setClass_ID(rs.getInt(\"Class_ID\"));\r\n\t\t\t\t\tstudent.setfather_phone_number(rs\r\n\t\t\t\t\t\t\t.getString(\"father_phone_number\"));\r\n\t\t\t\t\tstudent.setfather_seets_fees(rs\r\n\t\t\t\t\t\t\t.getDouble(\"father_seats_fees\"));\r\n\t\t\t\t\tstudent.setHealth_Status(rs.getString(\"Health_status\"));\r\n\t\t\t\t\tstudent.setphone_number(rs.getString(\"phone_number\"));\r\n\t\t\t\t\tstudent.setClassName(Wizard.getStudentClassName(student\r\n\t\t\t\t\t\t\t.getClass_ID()));\r\n\t\t\t\t\tstudent.setClassLevel(Wizard.getClassLevel(student\r\n\t\t\t\t\t\t\t.getClass_ID()));\r\n\t\t\t\t\tint transp_Id=rs.getInt(\"transp_ID\");\r\n\t\t\t\t\t//System.out.print(transp_Id);\r\n\t\t\t\t\tstudent.settransp_ID(transp_Id);\r\n\t\t\t\t\tstudent.setsummer_course_fees(rs\r\n\t\t\t\t\t\t\t.getDouble(\"summer_course_fees\"));\r\n\t\t\t\t\tstudent.setStudying_fees(rs.getDouble(\"studying_fees\"));\r\n\t\t\t\t\tstudent.settransp_fees(rs.getDouble(\"transp_fees\"));\r\n\t\t\t\t//System.out.println(Wizard.getTransp_Name(transp_Id));\r\n\t\t\t\t\tif(transp_Id!=0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tstudent.setTransp_Name(Wizard.getTransp_Name(transp_Id));\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tstudent.setSupervisorName(Wizard.getTeacherName(student\r\n\t\t\t\t\t\t\t.getClass_ID()));\r\n\t\t\t\t\ttemp = rs.getString(\"specialization\");\r\n\t\t\t\t\tif (temp.equals(\"scientific\"))\r\n\t\t\t\t\t\tstudent.setspecialization(\"علمي\");\r\n\t\t\t\t\telse if (temp.equals(\"Literary\"))\r\n\t\t\t\t\t\tstudent.setspecialization(\"أدبي\");\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tstudent.setspecialization(\"ليس بعد\");\r\n\t\t\t\t\ttemp = rs.getString(\"Student_type\");\r\n\t\t\t\t\tif (temp.equals(\"regular\"))\r\n\t\t\t\t\t\ttemp = \"نظامي\";\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\ttemp = \"اتحادي\";\r\n\t\t\t\t\tstudent.setStudent_type(temp);\r\n\t\t\t\t student.setEmail_Address(rs.getString(\"Email\"));\t\r\n\t\t\t\t student.setImageURL(rs.getString(\"ImageURL\"));\r\n\t\t\t\t students.add(student);\r\n\t\t\t }\t\r\n\t\t\t\t result=students; \r\n \t\t} catch (Exception e) \r\n \t\t{\r\n \t\t\tSystem.out.println(\"error filling student set in JDBC class \"+e.getMessage());\r\n\t\t\t\t}\r\n\t\t break;\r\n \t}\r\n///////////////////////////////////////////////////////////////////////////////////////////\r\n \tcase Wizard.Teacher:\r\n \t{\r\n \t\ttry\r\n \t\t{\r\n\t\t \t ObservableList<Teacher> Teachers = FXCollections.observableArrayList();\r\n\t\t\t\t while (rs.next())\r\n\t\t\t { \r\n\t\t\t\t\tTeacher Teacher = new Teacher(rs.getInt(\"ID\"),\r\n\t\t\t\t\t\t\trs.getString(\"Name\"));\r\n\t\t\t\t\r\n\t\t\t\t\tTeacher.setaddress(rs.getString(\"Address\"));\r\n\t\t\t\t\tTeacher.setClass_ID(rs.getInt(\"Class_ID\"));\r\n\t\t\t\t\tTeacher.setphone_number(rs.getString(\"phone_number\"));\r\n\t\t\t\t\tTeacher.setClassName(Wizard.getTeacherClassName(Teacher\r\n\t\t\t\t\t\t\t.getClass_ID()));\r\n\t\t\t\t\tint transp_Id=rs.getInt(\"transp_ID\");// we need to use it again\r\n\t\t\t\t\tTeacher.settransp_ID(transp_Id);\r\n\t\t\t\t\tTeacher.settransp_fees(rs.getDouble(\"transp_fees\"));\r\n\t\t\t\t\tTeacher.setSalary(rs.getDouble(\"Salary\"));\r\n\t\t\t\t\tTeacher.setalternatives(rs.getDouble(\"alternatives\"));\r\n\t\t\t\t\tif(transp_Id!=0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tTeacher.setTransp_Name(Wizard.getTransp_Name(transp_Id));\r\n\t\t\t\t\t}\r\n\t\t\t\t Teacher.setEmail_Address(rs.getString(\"Email\"));\t\r\n\t\t\t\t Teacher.setImageURL(rs.getString(\"ImageURL\"));\r\n\t\t\t\t Teachers.add(Teacher);\r\n\t\t\t }\t\r\n\t\t\t\t result=Teachers; \r\n \t\t} catch (Exception e) \r\n \t\t{\r\n \t\t\tSystem.out.println(\"error filling Teacher set in JDBC class \"+e.getMessage());\r\n\t\t\t\t}\r\n\t\t break;\r\n \t}\r\n///////////////////////////////////////////////////////////////////////////////////////////\r\n \tcase Wizard.Worker:\r\n \t{\r\n \t\ttry\r\n \t\t{\r\n\t\t \t ObservableList<Worker> workers = FXCollections.observableArrayList();\r\n\t\t\t\t while (rs.next())\r\n\t\t\t { \r\n\t\t\t\t\tWorker worker = new Worker(rs.getInt(\"ID\"),\r\n\t\t\t\t\t\t\trs.getString(\"Name\"));\r\n\t\t\t\t\tworker.setaddress(rs.getString(\"address\"));\r\n\t\t\t\t\tworker.setphone_number(rs.getString(\"phone_number\"));\r\n\t\t\t\t\tint transp_Id=rs.getInt(\"transp_ID\"); // we need to use it again \r\n\t\t\t\t\tworker.settransp_ID(transp_Id);\r\n\t\t\t\t\tworker.settransp_fees(rs.getDouble(\"transp_fees\"));\r\n\t\t\t\t\tworker.setSalary(rs.getDouble(\"Salary\"));\r\n\t\t\t\t\tworker.setalternatives(rs.getDouble(\"alternatives\"));\r\n\t\t\t\t\tworker.setWorksAs(rs.getString(\"works_as\"));\r\n\t\t\t\t\tworker.setNotes(rs.getString(\"notes\"));\r\n\t\t\t\t\tif(transp_Id!=0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tworker.setTransp_Name(Wizard.getTransp_Name(transp_Id));\r\n\t\t\t\t\t}\r\n\t\t\t\t worker.setImageURL(rs.getString(\"ImageURL\"));\r\n\t\t\t\t workers.add(worker);\r\n\t\t\t }\t\r\n\t\t\t\t result=workers; \r\n \t\t} catch (Exception e) \r\n \t\t{\r\n \t\t\tSystem.out.println(\"error filling worker set in JDBC class \"+e.getMessage());\r\n\t\t\t\t}\r\n\t\t break;\r\n \t} \t\r\n///////////////////////////////////////////////////////////////////////////////////////////\r\n \tcase Wizard.SClass:\r\n \t{\r\n \t\ttry \r\n \t\t{\r\n \t\t//System.out.println(\"in\");\r\n \t\t \t ObservableList<SClasses> classes = FXCollections.observableArrayList();\r\n \t\t \tSClasses myclass =new SClasses();\r\n// \t\t\t\tmyclass.setName(\"\");\r\n// \t\t\t\t classes.add(myclass);\r\n \t\t\t\t while (rs.next())\r\n {\r\n\t\t\t\t\t// System.out.println(rs.getString(\"Name\"));\r\n\t\t\t\t\tmyclass = new SClasses();\r\n\t\t\t\t\tmyclass.setid(rs.getInt(\"ID\"));\r\n\t\t\t\t\tmyclass.setName(rs.getString(\"Name\"));\r\n\t\t\t\t\tmyclass.setCapacity(rs.getInt(\"Capacity\"));\r\n\t\t\t\t\tmyclass.setfather_seets_fees(rs\r\n\t\t\t\t\t\t\t.getDouble(\"father_seats_fees\"));\r\n\t\t\t\t\tmyclass.setLevel(rs.getString(\"Level\"));\r\n\t\t\t\t\tmyclass.setStudying_fees(rs.getDouble(\"Studying_fees\"));\r\n\t\t\t\t\tmyclass.setsummer_course_fees(rs\r\n\t\t\t\t\t\t\t.getDouble(\"summer_course_fees\"));\r\n\t\t\t\t\tmyclass.setSupervisorID(rs.getInt(\"supervisor_ID\"));\r\n\t\t\t\t\tclasses.add(myclass);\r\n\r\n\t\t\t\t}\r\n\t\t\t\t// System.out.println(classes.get(0).getName());\r\n\t\t\t\tresult = classes;\r\n \t\t} \r\n \t\tcatch (Exception e) \r\n \t\t{\r\n \t\t\tSystem.out.println(\"error filling Classes set in JDBC class \"+e.getMessage());\r\n\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n///////////////////////////////////////////////////////////////////////////////////////////\r\n \tcase Wizard.TClass:\r\n \t{\r\n \t\ttry \r\n \t\t{\r\n \t\t\tObservableList<TClasses> classes = FXCollections.observableArrayList();\r\n \t\t \tTClasses myclass =new TClasses(\"\",1);\r\n \t\t\t\t // classes.add(myclass);\r\n \t\t\t\t while (rs.next())\r\n {\r\n \t\t\t\t\t myclass = new TClasses(rs.getString(\"Name\"),rs.getInt(\"ID\"));\r\n \t\t\t\t\t\tclasses.add(myclass);\r\n \t\t\t\t\t\t//System.out.println(myclass.getName());\r\n \t\t\t\t }\r\n \t\t\t\t result = classes;\r\n \t\t\t\t \r\n \t\t} \r\n \t\tcatch (Exception e) \r\n \t\t{\r\n \t\t\tSystem.out.println(\"error filling Teacher Classes set in JDBC class \"+e.getMessage());\r\n\t\t\t\t} \t\t\r\n \t\tbreak;\r\n \t}\r\n///////////////////////////////////////////////////////////////////////////////////////////\r\n\t\tcase Wizard.Subject:\r\n\t\t{\r\n\t\t\ttry {\r\n\t\t\t\tObservableList<Subject> subjects = FXCollections\r\n\t\t\t\t\t\t.observableArrayList();\r\n\t\t\t\tSubject mysubject;\r\n\t\t\t\twhile (rs.next()) \r\n\t\t\t\t{\r\n\t\t\t\t\tmysubject = new Subject(rs.getString(\"Name\"),\r\n\t\t\t\t\t\t\trs.getInt(\"ID\"));\r\n\t\t\t\t\tmysubject.setClass_level(rs.getString(\"Class_level\"));\r\n\t\t\t\t\tsubjects.add(mysubject);\r\n\r\n\t\t\t\t}\r\n\t\t\t\tresult = subjects;\r\n\r\n\t\t\t} catch (Exception e)\r\n\t\t\t{\r\n\t\t\t\tSystem.out\r\n\t\t\t\t\t\t.println(\"error filling subject set in JDBC class \"\r\n\t\t\t\t\t\t\t\t+ e.getMessage());\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t}\r\n///////////////////////////////////////////////////////////////////////////////////////////\r\n\t\t\tcase Wizard.transporation: \r\n\t\t\t{ \r\n\t\t\t\ttry\r\n\t\t\t\t{\r\n\t\t\t\tObservableList<Transporation> Transporations = FXCollections.observableArrayList();\r\n\t\t \tTransporation mytransp =new Transporation(0,\"\");\r\n\t\t \t//Transporations.add(mytransp);\r\n\t\t \t while (rs.next())\r\n {\r\n\t\t \t\t mytransp= new Transporation();\r\n\t\t \t\t mytransp.setid(rs.getInt(\"ID\"));\r\n\t\t \t\t mytransp.setDestination(rs.getString(\"Destination\"));\r\n\t\t \t\t mytransp.setDriver_name(rs.getString(\"Driver_name\"));\r\n\t\t \t\t mytransp.setvehicle_type(rs.getString(\"vehicle_type\"));\r\n\t\t \t\t Transporations.add(mytransp);\r\n }\r\n\t\t \tresult=Transporations;\r\n\t\t\t\t}\r\n\t\t \tcatch (Exception e)\r\n\t\t \t{\r\n \t\t\tSystem.out.println(\"error filling transporations set in JDBC class \"+e.getMessage());\r\n\t\t \t}\r\n\t\t\t\t\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n///////////////////////////////////////////////////////////////////////////////////////////\r\n\t\t\tcase Wizard.Result: \r\n\t\t\t{ \r\n\t\t\t\ttry\r\n\t\t\t\t{\r\n\t\t\t\tObservableList<Result> Results = FXCollections.observableArrayList();\r\n\t\t\t\tResult myResult ;\r\n\t\t \t while (rs.next())\r\n {\r\n\t\t \t\t myResult= new Result();\r\n\t\t \t\t myResult.setid(rs.getInt(\"ID\"));\r\n\t\t \t\t myResult.setClass_ID(rs.getInt(\"Class_ID\"));\r\n\t\t \t\t myResult.setdate(rs.getString(\"Date\"));\r\n\t\t \t\t myResult.setSupervisor_1(rs.getInt(\"supervisor_1\"));\r\n\t\t \t\t myResult.setSupervisor_2(rs.getInt(\"supervisor_2\"));\r\n\t\t \t\t myResult.setSemester_ID(rs.getInt(\"semster_ID\"));\r\n\t\t \t\t myResult.setSemester_ID(rs.getInt(\"ExamPrecentage\"));\r\n\t\t \t\t myResult.settype(Wizard.ResultTypeConverter(rs.getString(\"Type\")));\r\n\t\t \t\t myResult.setClassName(Wizard.getStudentClassName(rs.getInt(\"Class_ID\")));\r\n\t\t \t\t myResult.setLevel(Wizard.getClassLevel(rs.getInt(\"Class_ID\")));\r\n\t\t \t\t Results.add(myResult);\r\n }\r\n\t\t \tresult=Results;\r\n\t\t\t\t}\r\n\t\t \tcatch (Exception e)\r\n\t\t \t{\r\n \t\t\tSystem.out.println(\"error filling Results set in JDBC class \"+e.getMessage());\r\n\t\t \t}\r\n\t\t\t\t\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n///////////////////////////////////////////////////////////////////////////////////////////\r\n\t\t\tcase Wizard.GeneralPayment: \r\n\t\t\t{ \r\n\t\t\t\ttry\r\n\t\t\t\t{\r\n\t\t\t\tObservableList<GeneralPayment> GeneralPayments = FXCollections.observableArrayList();\r\n\t\t\t\tGeneralPayment myPayment ;\r\n\t\t \t while (rs.next())\r\n {\r\n\t\t \t\t myPayment= new GeneralPayment();\r\n\t\t \t\t myPayment.settype(Wizard.GeneralPaymentTypeConverter(rs.getString(\"Type\")));\r\n\t\t \t\t myPayment.setdate(rs.getString(\"Date\"));\r\n\t\t \t\t myPayment.setParty(Wizard.GeneralPaymentPartyConverter(rs.getString(\"Party\")));\r\n\t\t \t\t myPayment.setValue(rs.getDouble(\"Value\"));\r\n\t\t \t\t myPayment.setNotes(rs.getString(\"Notes\"));\r\n\t\t \t\t GeneralPayments.add(myPayment);\r\n }\r\n\t\t \tresult=GeneralPayments;\r\n\t\t\t\t}\r\n\t\t \tcatch (Exception e)\r\n\t\t \t{\r\n \t\t\tSystem.out.println(\"error filling GeneralPayments set in JDBC class \"+e.getMessage());\r\n\t\t \t}\r\n\t\t\t\t\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n///////////////////////////////////////////////////////////////////////////////////////////\r\n\t\t\tcase Wizard.StudentPayment: \r\n\t\t\t{ \r\n\t\t\t\ttry\r\n\t\t\t\t{\r\n\t\t\t\t ObservableList<StudentPayment> StudentPayments = FXCollections.observableArrayList();\r\n\t\t\t\t StudentPayment myPayment ;\r\n\t\t \t while (rs.next())\r\n {\r\n\t\t \t\t myPayment= new StudentPayment();\r\n\t\t \t\t myPayment.settype(Wizard.StudentPaymentTypeConverter(rs.getString(\"type\")));\r\n\t\t \t\t myPayment.setdate(rs.getString(\"the_date\"));\r\n\t\t \t\t myPayment.setStudentID(rs.getInt(\"student_ID\"));\r\n\t\t \t\t Student tempstudent = Wizard.getStudentObject(myPayment.getStudentID());\r\n\t\t \t\t myPayment.setStudentName(tempstudent.getName());\r\n\t\t \t\t myPayment.setStudentClassName(Wizard.getStudentClassName(tempstudent.getClass_ID()));\r\n\t\t \t\t myPayment.setValue(rs.getDouble(\"value\"));\r\n\t\t \t\t myPayment.setNotes(rs.getString(\"Notes\"));\r\n\t\t \t\t StudentPayments.add(myPayment);\r\n }\r\n\t\t \tresult=StudentPayments;\r\n\t\t\t\t}\r\n\t\t \tcatch (Exception e)\r\n\t\t \t{\r\n \t\t\tSystem.out.println(\"error filling StudentPayment set in JDBC class \"+e.getMessage());\r\n\t\t \t}\r\n\t\t\t\t\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n///////////////////////////////////////////////////////////////////////////////////////////\r\n \t\tcase Wizard.TeacherPayment: \r\n\t\t\t{ \r\n\t\t\t\ttry\r\n\t\t\t\t{\r\n\t\t\t\t ObservableList<TeacherPayment> TeacherPayments = FXCollections.observableArrayList();\r\n\t\t\t\t TeacherPayment myPayment ;\r\n\t\t \t while (rs.next())\r\n {\r\n\t\t \t\t myPayment= new TeacherPayment();\r\n\t\t \t\t myPayment.settype(Wizard.TeacherPaymentTypeConverter(rs.getString(\"type\")));\r\n\t\t \t\t myPayment.setdate(rs.getString(\"the_date\"));\r\n\t\t \t\t myPayment.setTeacherID(rs.getInt(\"teacher_ID\"));\r\n\t\t \t\t myPayment.setTeacherName(Wizard.getTeacherName(rs.getInt(\"teacher_ID\")));\r\n\t\t \t\t myPayment.setTeacherClassName(Wizard.getTeacherClassName(Integer.parseInt(Wizard.getTeacherClass_ID(myPayment.getTeacherID().toString()))));\r\n\t\t \t\t myPayment.setValue(rs.getDouble(\"value\"));\r\n\t\t \t\t myPayment.setNotes(rs.getString(\"Notes\"));\r\n\t\t \t\t TeacherPayments.add(myPayment);\r\n }\r\n\t\t \tresult=TeacherPayments;\r\n\t\t\t\t}\r\n\t\t \tcatch (Exception e)\r\n\t\t \t{\r\n \t\t\tSystem.out.println(\"error filling TeacherPayment set in JDBC class \"+e.getMessage());\r\n\t\t \t}\r\n\t\t\t\t\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n///////////////////////////////////////////////////////////////////////////////////////////\r\n \t\tcase Wizard.WorkerPayment: \r\n\t\t\t{ \r\n\t\t\t\ttry\r\n\t\t\t\t{\r\n\t\t\t\t ObservableList<WorkerPayment> WorkerPayments = FXCollections.observableArrayList();\r\n\t\t\t\t WorkerPayment myPayment ;\r\n\t\t \t while (rs.next())\r\n {\r\n\t\t \t\t myPayment= new WorkerPayment();\r\n\t\t \t\t myPayment.settype(Wizard.WorkerPaymentTypeConverter(rs.getString(\"type\")));\r\n\t\t \t\t myPayment.setdate(rs.getString(\"the_date\"));\r\n\t\t \t\t myPayment.setWorkerID(rs.getInt(\"worker_ID\"));\r\n\t\t \t\t Worker TempWorker = Wizard.getWorkerObject(myPayment.getWorkerID());\r\n\t\t \t\t myPayment.setWorkerName(TempWorker.getName());\r\n\t\t \t\t myPayment.setJobType(TempWorker.getWorksAs());\r\n\t\t \t\t myPayment.setValue(rs.getDouble(\"value\"));\r\n\t\t \t\t myPayment.setNotes(rs.getString(\"Notes\"));\r\n\t\t \t\t WorkerPayments.add(myPayment);\r\n }\r\n\t\t \tresult=WorkerPayments;\r\n\t\t\t\t}\r\n\t\t \tcatch (Exception e)\r\n\t\t \t{\r\n \t\t\tSystem.out.println(\"error filling WorkerPayment set in JDBC class \"+e.getMessage());\r\n\t\t \t}\r\n\t\t\t\t\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n \tdefault:\r\n \t{\r\n \t}\r\n\t }//end of switch \r\n\t try \r\n\t {\r\n\t\trs.close();\r\n\t } \r\n\t catch (SQLException e) \r\n\t {\r\n\t\t// TODO Auto-generated catch block\r\n\t\te.printStackTrace();\r\n\t}\r\n\t return result; \r\n }", "@Mapper\npublic interface SubscribeMapper {\n @Insert(\"insert into mp_subscribe (email,topics,subdate) values (#{sub.email},#{sub.topics},#{sub.subdate})\")\n void addSubscribe(@Param(\"sub\") Subscribe subscribe) throws Exception;\n\n @Select(\"select * from mp_subscribe where email=#{email}\")\n Subscribe selectByEmail(String email) throws Exception;\n\n @Update(\"update mp_subscribe set flag=#{flag} where email=#{email}\")\n void updateFlagByEmail(@Param(\"email\") String email,@Param(\"flag\") Integer flag) throws Exception;\n\n @Update(\"update mp_subscribe set flag=#{sub.flag},topics=#{sub.topics} where email=#{sub.email}\")\n void updateByEmail(@Param(\"sub\") Subscribe subscribe) throws Exception;\n}", "public interface UserInteractor {\n\n Observable<GetTokenDevResult> executeGetTokenDev(String param1, String param2);\n}", "public interface ApiServer {\n//\n @GET(\"umIPmfS6c83237d9c70c7c9510c9b0f97171a308d13b611?uri=homepage\")\n Observable<HomeBean> getHome();\n @POST\n Observable<Login> getDengLu(@Url String name, @QueryMap Map<String, String> paw);\n @GET(\"product/getCatagory\")\n Observable<Sort_lift> lift();\n @GET\n Observable<Sort_right> right(@Url String s);\n @GET\n Observable<Commodity_pagingBean> xia(@Url String s);\n @GET\n Observable<detailsBean> spxq(@Url String ss);\n @GET\n Observable<AddcartBean> add(@Url String s);\n @GET\n Observable<QurryBean> qurry(@Url String s);\n @GET\n Observable<AddcartBean> delete(@Url String s);\n @GET\n Observable<AddcartBean> addDd(@Url String s);\n @GET\n Observable<OrderBean> Ddlb(@Url String s);\n\n\n\n\n\n\n}", "@UseStringTemplate3StatementLocator\npublic interface CommandDao {\n @SqlUpdate(\"insert into event (id, created, created_by, content) values (:event.id, :event.created, :event.createdBy, :content)\")\n void storeEvent(@BindBean(\"event\") Event event, @Bind(\"content\") String json);\n\n @SqlQuery(\"select content from (select pk, content from event order by pk desc limit <max>) grr order by pk\")\n @Mapper(EventMapper.class)\n Collection<Event> lastEvents(@Define(\"max\") int count);\n\n @SqlQuery(\"select content from event where pk > (select pk from event where id = :id) order by pk limit <max>\")\n @Mapper(EventMapper.class)\n Collection<Event> since(@Bind(\"id\") String id, @Define(\"max\") int count);\n\n @SqlQuery(\"select count(1) from event where pk > (select pk from event where id = :id)\")\n long countSince(@Bind(\"id\") String id);\n}", "private Observable<R> buildUseCaseObservableWithSchedulers(P params) {\n return buildUseCaseObservable(params)\n .subscribeOn(threadExecutorScheduler)\n .observeOn(postExecutionThreadScheduler);\n }", "public ObservableList<twinsTable> getData(){\r\n\t\t\r\n\t\tConnection conn1;\r\n \r\n try{\r\n \tClass.forName(\"com.mysql.cj.jdbc.Driver\");\r\n \tconn1 = DriverManager.getConnection(\"jdbc:mysql://www.db4free.net:3306/project4\", \"mikerolfe\", \"#OnTrack1!\");\r\n \tSystem.out.println(\"Connected\");\r\n String SQL = \"Select * from twinsmn\"; \r\n ResultSet rs = conn1.createStatement().executeQuery(SQL);\r\n System.out.println(\"Query Ran\");\r\n while(rs.next()){ \r\n playerInfo.add( new twinsTable(rs.getInt(1), rs.getInt(2), rs.getString(3), rs.getString(4), rs.getString(5), rs.getString(6), rs.getString(7)));\r\n System.out.println(\"inserted row\");\r\n System.out.println(\"The player id: \" + rs.getInt(1) + \" The Jersey Number: \" +rs.getInt(2) + \" The Player: \" + rs.getString(3) + \" The BT: \"+ rs.getString(4) + \" The Height: \"+ rs.getString(5));\r\n }\r\n filteredData.addAll(playerInfo);\r\n }\r\n catch(Exception e){\r\n e.printStackTrace();\r\n System.out.println(\"Error on Building Data\"); \r\n }\r\n return playerInfo;\r\n }", "@Mapper\n@Repository\npublic interface AdminMapper {\n\n @Select(\"select * from admin where id = #{id} and flag = 1\")\n Admin getAdminById(@Param(\"id\") int id);\n\n @Select(\"select * from admin where police_id = #{id} and flag < 3\")\n Admin getAdminByPoliceId(@Param(\"id\") String id);\n}", "@Dao\npublic interface NoteDao {\n @Query(\"SELECT * FROM Note ORDER BY time_created DESC\")\n LiveData<List<Note>> getNotes();\n\n @RawQuery(observedEntities = Note.class)\n LiveData<List<Note>> filteredNotes(String query);\n\n @Query(\"SELECT * FROM Note WHERE id= :id\")\n LiveData<Note> loadById(int id);\n\n @Insert(onConflict = OnConflictStrategy.REPLACE)\n long insert(Note note);\n\n @Query(\"DELETE FROM Note WHERE id= :id\")\n int delete(int id);\n\n @Update\n void updateNote(Note note);\n}", "public interface SnortLogDao {\n ObservableList<snortLog> selectLogs();\n}", "public interface MovieDbApi {\n\n @GET(\"movie/upcoming\")\n Observable<MovieResponse> getUpcomingMovie(@Query(\"page\") int page);\n\n @GET(\"movie/now_playing\")\n Observable<MovieResponse> getNowPlayingMovie(@Query(\"page\") int page);\n\n @GET(\"search/movie\")\n Observable<MovieResponse> getSearchMovie(@Query(\"query\") String query,@Query(\"page\") int page);\n\n class Creator {\n public static MovieDbApi instance() {\n final HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();\n loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);\n\n final MovieDbInterceptor movieDbInterceptor = new MovieDbInterceptor();\n\n final OkHttpClient okHttpClient = new OkHttpClient.Builder()\n .addInterceptor(loggingInterceptor)\n .addInterceptor(movieDbInterceptor)\n .build();\n\n final Retrofit retrofit = new Retrofit.Builder()\n .addCallAdapterFactory(RxJava2CallAdapterFactory.create())\n .addConverterFactory(GsonConverterFactory.create())\n .client(okHttpClient)\n .baseUrl(BuildConfig.BASE_URL_MOVIE)\n .build();\n return retrofit.create(MovieDbApi.class);\n }\n }\n}", "private RunQueriesEx setupQueries() {\n RunQueriesEx queries = new RunQueriesEx();\n \n //for each column in our table, update one of our lists\n for(int i = 0; i < this.dataTable.getColumnCount(); i++) {\n this.updateList(i);\n }\n \n updateEmptyLists(); //pads any lists that didn't get updates with empty strings\n \n //add a new query for each row in the table\n for(int i = 0; i < this.dataTable.getRowCount(); i++) {\n queries.add(this.createQueryFromRow(i));\n }\n \n return queries;\n }", "public interface MysqldataQueryDao {\n public List<Map<String, Object>> Querydata(String sql);\n public List<Map<String, Object>> Querymaindata(String sql);\n\n}", "public interface BenMeSabeRepository {\n Observable<List<Product>> products();\n Observable<List<Ingredient>> getProductIngredients(Number productId);\n Observable<List<Allergen>> getProductAllergens(Number productId);\n Observable<Order> postOrder(Order order);\n Observable<CustomerRequest> postCustomerRequest(CustomerRequest customerRequest);\n Observable<Product> getProductDetail(Number productId);\n}", "public QueryCore buildQuery() throws SQLException\n {\n if(l != null)\n {\n for(int i=0;i<l.size();i++)\n {\n prepStm.setObject(i+1,l.get(i));\n }\n }\n return this;\n }", "@Mapper\npublic interface OrderMapper {\n @Insert(\" insert into t_order (order_id, order_type, city_id, \\n\" +\n \" platform_id, user_id, supplier_id, \\n\" +\n \" goods_id, order_status, remark, \\n\" +\n \" create_by, create_time, update_by, \\n\" +\n \" update_time)\\n\" +\n \" values (#{orderId}, #{orderType}, #{cityId}, \\n\" +\n \" #{platformId}, #{userId}, #{supplierId}, \\n\" +\n \" #{goodsId}, #{orderStatus}, #{remark}, \\n\" +\n \" #{createBy}, #{createTime}, #{updateBy}, \\n\" +\n \" #{updateTime})\")\n /**\n * statement=\"\":表示定义的子查询语句\n * before=true:表示在之前执行,booler类型的,所以为true\n * keyColumn=\"myNo\":表示查询所返回的类名\n * resultType=int.class:表示返回值得类型\n * keyProperty=\"empNo\" :表示将该查询的属性设置到某个列中,此处设置到empNo中\n * //进行添加、修改等操作的时候只能返回数字,而不能返回java类或其他!\n * // SELECT LAST_INSERT_ID() 适合那种主键是自增的类型\n * // 1 insert语句需要写id字段了,并且 values里面也不能省略\n * // 2 selectKey 的order属性需要写成BEFORE 因为这样才能将生成的uuid主键放入到model中,\n * // 这样后面的insert的values里面的id才不会获取为空\n * // 跟自增主键相比就这点区别,当然了这里的获取主键id的方式为 select uuid()\n */\n @SelectKey(keyColumn = \"id\", keyProperty = \"id\", resultType = long.class, before = false, statement = \"select last_insert_id()\")\n long insertSelective(Order record);\n\n @Update(\"update t_order set order_status=#{status},update_by=#{updateBy},update_time=#{updateTime} where order_id=#{orderId}\")\n int updateOrderStatus(@Param(\"orderId\") String orderId, @Param(\"status\") String status, @Param(\"updateBy\") String updateBy, @Param(\"updateTime\") Date updateTime);\n\n @Select(\"select *from t_order\\n\" +\n \" where order_id = #{orderId}\")\n Order selectByPrimaryKey(String orderId);\n}", "private static void exSwitchMapTwo() {\n\n Observable.interval(5,TimeUnit.SECONDS)\n .switchMap(call -> Observable.just(getResponse()).doOnDispose(() -> System.out.println(\"Disposed\")))\n .subscribe(System.out::println);\n\n //An Observable which performs network call.\n sleep(40000);\n\n\n /* OUTPUT :\n 6\n 10\n 13\n 17\n 26\n 32\n 35\n 42\n\n */\n }", "@Mapper\npublic interface SRDaLeiDAO {\n\n @Select(\"SELECT `px_sr_dalei`.`id`,\\n\" +\n \" `px_sr_dalei`.`institution_code`,\\n\" +\n \" `px_sr_dalei`.`name`,\\n\" +\n \" `px_sr_dalei`.`createDate`,\\n\" +\n \" `px_sr_dalei`.`updateDate`\\n\" +\n \" FROM `px_sr_dalei` \\n\" +\n \" WHERE institution_code = #{institution_code} \")\n List<SRDaLei> querySRDaLeiListByInstitution(@Param(\"institution_code\") String institution_code);\n\n @Select(\"SELECT `px_sr_dalei`.`id`,\\n\" +\n \" `px_sr_dalei`.`institution_code`,\\n\" +\n \" `px_sr_dalei`.`name`,\\n\" +\n \" `px_sr_dalei`.`createDate`,\\n\" +\n \" `px_sr_dalei`.`updateDate`\\n\" +\n \" FROM `px_sr_dalei` \\n\" +\n \" WHERE institution_code = #{institution_code} \\n\" +\n \" AND id = #{id} \\n\")\n SRDaLei querySRDaLeiById(@Param(\"id\") int id, @Param(\"institution_code\") String institution_code);\n\n @Select(\"SELECT `px_sr_dalei`.`id`,\\n\" +\n \" `px_sr_dalei`.`institution_code`,\\n\" +\n \" `px_sr_dalei`.`name`,\\n\" +\n \" `px_sr_dalei`.`createDate`,\\n\" +\n \" `px_sr_dalei`.`updateDate`\\n\" +\n \" FROM `px_sr_dalei` \\n\" +\n \" WHERE institution_code = #{institution_code} \\n\" +\n \" AND name = #{name} \\n\")\n SRDaLei querySRDaLeiByName(@Param(\"name\") String name, @Param(\"institution_code\") String institution_code);\n\n @Select(\"SELECT `px_sr_dalei`.`id`,\\n\" +\n \" `px_sr_dalei`.`institution_code`,\\n\" +\n \" `px_sr_dalei`.`name`,\\n\" +\n \" `px_sr_dalei`.`createDate`,\\n\" +\n \" `px_sr_dalei`.`updateDate`\\n\" +\n \" FROM `px_sr_dalei` \\n\" +\n \" WHERE institution_code = #{institution_code} \\n\" +\n \" AND name like CONCAT('%',#{name},'%') \\n\")\n List<SRDaLei> querySRDaLeiListByNameWithLike(@Param(\"name\") String name, @Param(\"institution_code\") String institution_code);\n\n @Insert(\" INSERT INTO `px_sr_dalei`\\n\" +\n \"( \\n\" +\n \"`institution_code`,\\n\" +\n \"`name`,\\n\" +\n \"`createDate`,\\n\" +\n \"`updateDate`)\\n\" +\n \"VALUES\\n\" +\n \"( \\n\" +\n \"#{institution_code},\\n\" +\n \"#{name},\\n\" +\n \"now(),\\n\" +\n \"now());\\n\"\n )\n public int insertSRDaLei(SRDaLei srDaLei);\n\n @Update(\" UPDATE `px_sr_dalei`\\n\" +\n \"SET\\n\" +\n \"`name` = #{name},\\n\" +\n \"`updateDate` = now()\\n\" +\n \" WHERE id=#{id} and institution_code=#{institution_code} ;\\n \" )\n public int updateSRDaLei(SRDaLei srDaLei);\n\n @Delete(\" DELETE FROM `px_sr_dalei`\\n\" +\n \" WHERE id=#{id} and name=#{name} and institution_code=#{institution_code} ; \")\n public int deleteSRDaLei(SRDaLei srDaLei);\n}", "@Override\n\tsynchronized void execute() {\n\t\t_dataOUTPipe.dataIN(op1.getText());\n\t\t_dataOUTPipe.dataIN(op2.getText());\n\t\t_dataOUTPipe.dataIN(op.getText());\n\t}", "public static void switchOnNext(CountDownLatch latch) {\n\n List<Observable<Long>> collectionOfObservable = new ArrayList<>();\n\n Observable<Long> first = Observable.interval(1L, TimeUnit.SECONDS).take(5)\n .doOnNext((item) -> System.out.println(\"first doOnNext item = \" + item));\n\n Observable<Long> second = Observable.interval(1L, TimeUnit.SECONDS)\n .map(item -> item + 100).take(10);\n\n collectionOfObservable.add(first);\n collectionOfObservable.add(second);\n\n Observable.switchOnNext(Observable.fromIterable(collectionOfObservable))\n .subscribeOn(Schedulers.io()).subscribe(new MyObserver<>(latch));\n }", "void runQueries();", "@Mapper\npublic interface HoPureOfferDao extends TkBaseMapper<HoPureOffer> {\n\n\n List<PureOfferListRepo> listForWeb(@Param(\"productType\") String productType, @Param(\"dateType\") String dateType);\n\n List<PureOfferListRepo> selfListForWeb(@Param(\"userId\") String userId, @Param(\"keys\") String keys,@Param(\"orderBy\") String orderBy);\n\n List<PureOfferListRepo> listForBackend(@Param(\"title\") String title,@Param(\"status\") String status);\n\n List<PureOfferListRepo> snatchListForWeb(@Param(\"userId\") String userId, @Param(\"keys\") String keys,@Param(\"orderBy\") String orderBy);\n}", "public static void compose() {\n Observable.fromIterable(Utils.getData())\n .compose((source) -> {\n source.subscribe(new MyObserver<>());\n return source;\n });\n\n System.out.println(\"# 2\");\n\n Observable.fromIterable(Utils.getData())\n .compose((source) -> {\n Observable<String> observable = Observable.just(\"composed\");\n observable.subscribe(new MyObserver<>());\n return observable;\n });\n }", "Operations operations();", "public interface IPoliceQuery\n{\n MovementUserDto authenticate(String userId, String password);\n\n VehicleDto getStolenCarByLicensePlate(String licensePlate);\n\n VehicleDto getStolenCarByCartrackerId(String cartrackerId);\n\n List<VehicleDto> getAllStolenCars();\n\n VehicleDto getVehicleByLicensePlate(String licensePlate);\n\n VehicleDto getVehicleByCartrackerId(String cartrackerId);\n\n VehicleDto setStolen(VehicleDto vehicleDto);\n\n List<VehicleOwnerDto> getVehicleOwners(String licensePlate);\n\n List<VehicleMovementDto> getVehicleMovements(String licensePlate);\n}", "public void setOperators(List<Operator> operators){\n _operators = operators;\n }", "public interface DataMapper {\n /**\n * 获取全部数据\n *\n * @author casaba-u\n * @date 2018/8/27\n */\n List selectAll();\n\n /**\n * 根据 regCode 查询数据\n *\n * @author casaba-u\n * @date 2018/8/27\n */\n// Data selectByRegCode(String regCode);\n List<Data> selectByRegCode(String regCode);\n\n /**\n * 添加一项数据\n *\n * @author casaba-u\n * @date 2018/8/27\n */\n boolean insert(Data data);\n\n /**\n * 批量添加\n *\n * @author casaba-u\n * @date 2018/8/27\n */\n// boolean insertBatch(List<Data> dataList);\n\n}", "@Nullable\n public ArrayList<Order> doRetrieveByOperator(@NotNull String operatorUsername) {\n try {\n Connection cn = ConPool.getConnection();\n PreparedStatement st;\n Operator op = opd.doRetrieveByUsername(operatorUsername);\n Order o = null;\n User u = null;\n ArrayList<Order> orders = new ArrayList<>();\n if (op != null) {\n st = cn.prepareStatement(\"SELECT * FROM `order` O WHERE O.operator=?;\");\n st.setString(1, operatorUsername);\n ResultSet rs = st.executeQuery();\n while (rs.next()) {\n o = new Order();\n o.setOperator(op);\n o.setId(rs.getInt(2));\n o.setTotPrice(rs.getDouble(3));\n o.setNumberOfItems(rs.getInt(4));\n o.setData(rs.getString(5));\n u = ud.doRetrieveByUsername(rs.getString(1));\n o.setUser(u);\n st = cn.prepareStatement(\n \"SELECT * FROM digitalpurchasing D WHERE D.order=?;\"\n );\n st.setInt(1, o.getId());\n ResultSet rs2 = st.executeQuery();\n DigitalProduct dp = null;\n while (rs2.next()) {\n dp = dpd.doRetrieveById(rs2.getInt(1));\n o.addProduct(dp, rs2.getInt(3));\n }\n st = cn.prepareStatement(\n \"SELECT * FROM physicalpurchasing P WHERE P.order=?;\"\n );\n st.setInt(1, o.getId());\n rs2 = st.executeQuery();\n PhysicalProduct pp = null;\n while (rs2.next()) {\n pp = ppd.doRetrieveById(rs2.getInt(1));\n o.addProduct(pp, rs2.getInt(3));\n }\n orders.add(o);\n }\n st.close();\n cn.close();\n }\n return orders;\n } catch (SQLException e) {\n return null;\n }\n }", "@Dao\npublic interface UserDao {\n @Query(\"SELECT * FROM user\")\n LiveData<List<User>> getAll();\n\n @Insert\n void insertAll(User... users);\n}", "@Dao\npublic interface AssignedCustomerTripDetailsDao {\n\n @Query(\"select * from AssignedCustomerTripDetails\")\n LiveData<List<AssignedCustomerTripDetails>> loadTripDetails();\n\n @Query(\"DELETE FROM AssignedCustomerTripDetails\")\n void deleteEntireTableOfAssignedCustomerTripDetails();\n\n @Insert(onConflict = OnConflictStrategy.REPLACE)\n long insertAssignedCustomerTripDetails(AssignedCustomerTripDetails tripDetails);\n\n}", "public static void main(String[] args) {\n // count operator counter number of elements emmitted,\n Observable<Integer> observable = Observable.just(1,2,3,4);\n observable.count().subscribe(s->System.out.println(s));\n\n // conditional opertors\n // all() -> this operator checks condition for all values and returns false if any condition fails\n observable.all(i->i<3).subscribe(s->System.out.println(s));\n\n // any() -> this operator checks condition for all values and returns true if any condition is true\n // empty() -> checks if observable have empty value and returns true/false \n // contains() -> checks if specified item is contained/emmitted by observable\n // sequenceEqual() -> checks if two sequences are equals (sequences contains same values)\n\n observable.any(i->i<3).subscribe(s->System.out.println(s));\n observable.filter(i->i<5).isEmpty().subscribe(s->System.out.println(s));\n }", "private void registerResultsInDB(Observable<Result> placeObservable, DataBaseConnector contactsDB, Util.Subject subject) {\n\n placesSubscriber = placeObservable.subscribeOn(Schedulers.io())\n .observeOn(Schedulers.io()/*AndroidSchedulers.mainThread()*/)\n .subscribeWith(new DisposableObserver<Result>() {\n @Override\n public void onComplete() {\n Util.getInstance().setConcurrencyFlag(false);\n }\n\n @Override\n public void onError(Throwable e) {\n e.printStackTrace();\n }\n\n @Override\n public void onNext(Result result) { //called each time a new ViewModel is created\n\n int dbSize = getDBSize(contactsDB); //retrieve dbsize\n //2. parse through results\n\n MyLocation mLocation = new MyLocation(result.getGeometry().getLocation().getLat(),\n result.getGeometry().getLocation().getLng());\n String name = result.getName();\n String photo_ref = result.getPhotos()==null?\"\":result.getPhotos().get(0).getPhotoReference();\n double rating = result.getRating()==null?0: result.getRating();\n String vicinity = result.getVicinity();\n String place_id = result.getPlaceId();\n //Add a new Target to the DB\n Target target = new Target(1 + dbSize, name, rating, subject, vicinity, photo_ref, place_id, mLocation);\n\n //insert a contact to the DB\n fillTargetRecordInDB(target, contactsDB);\n\n }\n\n });\n }", "public static void window() {\n\n System.out.println(\"# 1\");\n\n List<String> data = Utils.getData();\n Observable.fromIterable(data)\n .window(2)\n .subscribe((windowStream) -> windowStream.subscribe(new MyObserver<>()));\n\n System.out.println(\"# 2\");\n\n Observable.fromIterable(data)\n .window(2, 3)\n .subscribe((windowStream) -> windowStream.subscribe(new MyObserver<>()));\n\n System.out.println(\"# 3\");\n\n Observable.fromIterable(data)\n .window(2, 3, 1)\n .subscribe((windowStream) -> windowStream.subscribe(new MyObserver<>()));\n\n System.out.println(\"# 4\");\n\n Observable.fromIterable(data)\n .window(100, 100, TimeUnit.MICROSECONDS)\n .subscribe((windowStream) -> windowStream.subscribe(new MyObserver<>()));\n\n System.out.println(\"# 5\");\n\n Observable.fromIterable(data)\n .window((emitter) -> emitter.onNext(1))\n .subscribe((windowStream) -> windowStream.subscribe(new MyObserver<>()));\n\n /*\n Mose of the window operators are similar to buffer.\n */\n }", "public void start() {\n \n for (Object obj: bufferedQueries) {\n \n switch(obj.getClass().getName()) {\n case \"uzh.tomdb.db.operations.Insert\":\n if (inserts == null) {\n inserts = new ArrayList<>();\n }\n inserts.add((Insert) obj);\n break;\n case \"uzh.tomdb.db.operations.CreateTable\":\n if (creates == null) {\n creates = new ArrayList<>();\n }\n creates.add((CreateTable) obj);\n break;\n case \"uzh.tomdb.db.operations.Update\":\n if (updates == null) {\n updates = new ArrayList<>();\n }\n updates.add((Update) obj);\n break;\n case \"uzh.tomdb.db.operations.Delete\":\n if (deletes == null) {\n deletes = new ArrayList<>();\n }\n deletes.add((Delete) obj);\n break;\n }\n }\n \n if (inserts != null) {\n inserts();\n }\n if (creates != null) {\n creates();\n }\n if (updates != null) {\n updates();\n }\n if (deletes != null) {\n deletes();\n }\n }", "@Mapper\npublic interface BillItemMapper {\n int deleteByPrimaryKey(String bill_item_id);\n\n int insert(BillItem record);\n\n int insertSelective(BillItem record);\n\n BillItem selectByPrimaryKey(String bill_item_id);\n\n int updateByPrimaryKeySelective(BillItem record);\n\n int updateByPrimaryKey(BillItem record);\n}", "public interface RechargeListExRepo {\n Observable<RechargeListExEntity> getRechargeListEx();\n}", "Observable<ArrayList<Shift>> shifts();", "public interface BatchMapper {\n\n public List<WriterSO> selectWriterList();\n\n public List<UserTradeHistory> selectUserTradeHistoryBatch();\n\n public List<TradeHistoryBatch> selectTradeHistoryBatch();\n\n public int updateUserTradeHistory(UserTradeHistory userTradeHistory);\n\n public int updateTradeHistory(TradeHistory tradeHistory);\n\n public int deleteUserTradeHistoryBatch(UserTradeHistory userTradeHistory);\n\n public int deleteTradeHistoryBatch(TradeHistory tradeHistory);\n\n public int insertUserTradeHistory(UserTradeHistory userTradeHistory);\n\n public int insertUserTradeHistoryBatch(UserTradeHistory userTradeHistory);\n\n public int insertTradeHistory(TradeHistory tradeHistory);\n\n public int insertTradeHistoryBatch(TradeHistory tradeHistory);\n\n}", "public interface CustomerDAO {\n Customer getCustomer(String customerName);\n\n Customer getCustomer(int customerID);\n\n ObservableList<Customer> getAllCustomers() throws SQLException;\n\n void addCustomer(Customer newCustomer) throws SQLException;\n\n void updateCustomer(Customer toUpdate) throws SQLException;\n\n void deleteCustomer(Customer deleteTarget);\n}", "public interface BattleDao {\n\n @Select(\"SELECT * FROM battle WHERE chapter_id = #{chapterId} order by id\")\n @Results({\n @Result(property = \"battleId\", column = \"battle_id\"),\n @Result(property = \"chapterId\", column = \"chapter_id\"),\n @Result(property = \"battleTitle\", column = \"battle_title\"),\n @Result(property = \"battleDesc\", column = \"battle_desc\"),\n })\n public ArrayList<Battle> getAllBattleByChapterId(String chapterId);\n\n @Select(\"SELECT * FROM battle order by id\")\n @Results({\n @Result(property = \"battleId\", column = \"battle_id\"),\n @Result(property = \"chapterId\", column = \"chapter_id\"),\n @Result(property = \"battleTitle\", column = \"battle_title\"),\n @Result(property = \"battleDesc\", column = \"battle_desc\"),\n })\n public ArrayList<Battle> getAllBattle();\n\n @Select(\"SELECT * FROM battle WHERE battle_id = #{battleId}\")\n @Results({\n @Result(property = \"battleId\", column = \"battle_id\"),\n @Result(property = \"chapterId\", column = \"chapter_id\"),\n @Result(property = \"battleTitle\", column = \"battle_title\"),\n @Result(property = \"battleDesc\", column = \"battle_desc\"),\n })\n public Battle getBattleById(String battleId);\n}", "public interface SelectOneOperation extends QueryOperation<Row, SelectOneOperation> {\n\n\t/**\n\t * Maps first row in ResultSet by RowMapper.\n\t * \n\t * @param rowMapper\n\t * @return ProcessOperation\n\t */\n\t<R> ProcessOperation<R> map(RowMapper<R> rowMapper);\n\n\t/**\n\t * Retrieves first row in the first column, expected type is elementType class.\n\t * \n\t * @param elementType\n\t * @return ProcessOperation\n\t */\n\t<E> ProcessOperation<E> firstColumn(Class<E> elementType);\n\n\t/**\n\t * Maps only first row from ResultSet to Map<String, Object>.\n\t * \n\t * @return ProcessOperation\n\t */\n\tProcessOperation<Map<String, Object>> map();\n\n}", "public static SqlFunction extractSqlOperatorFromWrapper(final SqlFunction sqlFunction) {\n if(sqlFunction instanceof DrillCalciteSqlWrapper) {\n return (SqlFunction) ((DrillCalciteSqlWrapper) sqlFunction).getOperator();\n } else {\n return sqlFunction;\n }\n }", "public Observable<Ribot> syncRibots() {\n return mMulhimService.getRibots()\n .concatMap(new Func1<List<Ribot>, Observable<Ribot>>() {\n @Override\n public Observable<Ribot> call(List<Ribot> ribots) {\n return mDatabaseHelper.setRibots(ribots);\n }\n });\n }", "@Mapper\npublic interface EmployeeMapper {\n\n int deleteByPrimaryKey(Long id);\n\n int insert(Employee record);\n\n int insertSelective(Employee record);\n\n Employee selectByPrimaryKey(Long id);\n\n int updateByPrimaryKeySelective(Employee record);\n\n int updateByPrimaryKey(Employee record);\n\n List<Employee> selectByExample(Employee example);\n\n Employee selectByEmployeeNo(String employeeNo);\n\n List<Employee> selectByUsername(String username);\n\n List<Employee> selectAll();\n}", "public interface Queryable<Ttuple extends Tuple>\n{\n URI QUERYABLE_URI = URIPool.create(\"class:/spiralcraft/data/query/Queryable\");\n \n /**\n * @return An array of all the Types supported by this Queryable\n */\n Type<?>[] getTypes();\n \n /**\n * @return Whether the store contains the specified Type.\n */\n boolean containsType(Type<?> type);\n \n /**\n * Returns all data instances of a specific Type for further manipulation by\n * BoundQueries. This method is used when a Queryable cannot provide\n * an optimized implementation for the simplest of Queries, or if no \n * optimization is needed. \n * \n * @return A boundQuery which provides the set of all instances for a given\n * type. \n */\n BoundQuery<?,Ttuple> getAll(Type<?> type) \n throws DataException;\n \n\n /**\n * Bind the specified Query and parameter context to this Queryable.\n * \n *@return a BoundQuery that implements the data flow path and provides the\n * data requested by the Query\n */\n BoundQuery<?,Ttuple> query(Query q,Focus<?> context)\n throws DataException;\n\n /**\n * Provide a custom binding solution for the root node of the provided Query\n * structure, or return null if this Queryable does not provide a custom\n * binding solution for the provided Query node.\n *\n * @param q\n * @param context\n * @return\n * @throws DataException\n */\n BoundQuery<?,Ttuple> solve(Query q,Focus<?> context)\n throws DataException;\n}", "public <T> Observable.Transformer<T, T> applySchedulers() {\n return observable -> observable.subscribeOn(Schedulers.io())\n .observeOn(AndroidSchedulers.mainThread());\n }", "public interface RetrofitService {\n\n @GET(ApiService.cx)\n Observable<gwc_Bean> getcall(@Query(\"uid\") String uid);\n @GET(ApiService.gx)\n Observable<XG_Bean> getcall1(@Query(\"uid\") String uid,@Query(\"sellerid\") String sellerid,@Query(\"pid\") String pid,@Query(\"selected\") String selected,@Query(\"num\") String num);\n @GET(ApiService.sc)\n Observable<CC_Bean> getcall2(@Query(\"uid\") String uid,@Query(\"pid\") String pid);\n}", "@Insert\n Single<List<Long>> insert(Motivator... motivators);", "@Mapper\npublic interface QuestionMapper {\n\n @Transactional\n @Select(\"select * from questions where categoryid in (select categoryid from category_language where language = #{language})\")\n @Results({\n @Result(property = \"questionId\",column = \"questionid\"),\n @Result(property = \"questionLove\",column = \"questionLove\"),\n @Result(property = \"questionContent\",column = \"questioncontent\"),\n @Result(property = \"categoryLanguage\",column = \"categoryid\",\n one=@One(select=\"com.caixueyuan.mapper.CategoryMapper.getCategoryByIdTrue\",fetchType= FetchType.EAGER)),\n @Result(property = \"userEntity\",column = \"userid\",\n one=@One(select=\"com.caixueyuan.mapper.UserMapper.getOneByIdWithOutPassword\",fetchType = FetchType.EAGER)),\n @Result(property = \"answerEntityList\",column=\"questionid\",javaType = List.class,\n many = @Many(select = \"com.caixueyuan.mapper.AnswerMapper.getAnswersByQuestionIdWithOneAnswer\"))\n\n })\n List<QuestionEntity> getQuestionsByLanguage(String language);\n\n @Transactional\n @Select(\"select * from questions where questionid = #{questionId}\")\n @Results({\n @Result(property = \"questionId\",column = \"questionid\"),\n @Result(property = \"questionLove\",column = \"questionLove\"),\n @Result(property = \"questionContent\",column = \"questioncontent\"),\n @Result(property = \"categoryLanguage\",column = \"categoryid\",\n one=@One(select=\"com.caixueyuan.mapper.CategoryMapper.getCategoryByIdTrue\",fetchType= FetchType.EAGER)),\n @Result(property = \"userEntity\",column = \"userid\",\n one=@One(select=\"com.caixueyuan.mapper.UserMapper.getOneByIdWithOutPassword\",fetchType = FetchType.EAGER)),\n @Result(property = \"answerEntityList\",column=\"questionid\",javaType = List.class,\n many = @Many(select = \"com.caixueyuan.mapper.AnswerMapper.getAnswersByQuestionIdWithQuestions\"))\n })\n QuestionEntity getQuestionsById(Integer questionId);\n\n @Transactional\n @Insert(\"insert into questions(categoryid,questiontitle,userid)\" +\n \"values\" +\n \"(#{categoryLanguage.categoryid},#{questionTitle},#{userEntity.id})\")\n void insertQuestion(QuestionEntity questionEntity);\n\n}", "public interface OneTableDMLMapper{\n int insertVaPlatAccInfo(Map<String, Object> map);\n int insertVaPlatInfo(Map<String,Object> map);\n int insertVaPlatVirtualAcctBal(Map<String, Object> params);\n int updateVaPlatVirtualAcctBalAdd(Map<String, Object> params);\n int updateVaPlatVirtualAcctBalSub(Map<String, Object> params);\n int insertVaPlatVirtualAcct(Map<String,Object> params);\n\n int updateVaMerchVirtualAcctBalAddForRefund(Map<String, Object> map);\n int insertVaMerchAccInfo(Map<String, Object> map);\n int insertVaMerchInfo(Map<String,Object> map);\n int insertVaMerchVirtualAcctBal(Map<String, Object> params);\n int updateVaMerchVirtualAcctBalAdd(Map<String, Object> params);\n int insertVaMerchRechargeSeq(Map<String, Object> params);\n int insertVaMerchWithdrawSeq(Map<String, Object> params);\n int updateVaMerchVirtualAcctBalSub(Map<String, Object> params);\n int insertVaMerchVirtualAcct(Map<String,Object> params);\n int dayEndTransferAmtForMerch(Map<String,Object> params);\n int deleteVaMerchAcctInfo(Map<String,Object> params);\n\n\n int updateVaCustVirtualAcctBalAddForRefund(Map<String, Object> map);\n int insertVaCustAccInfo(Map<String, Object> map);\n int insertVaCustInfo(Map<String,Object> map);\n int insertVaCustVirtualAcctBal(Map<String, Object> params);\n int updateVaCustVirtualAcctBalAdd(Map<String, Object> params);\n int updateVaCustVirtualAcctBalSub(Map<String, Object> params);\n int insertVaCustVirtualAcct(Map<String,Object> params);\n int insertVaCustRechargeSeq(Map<String,Object> params);\n int insertVaCustWithdrawSeq(Map<String,Object> params);\n int dayEndTransferAmtForCust(Map<String,Object> params);\n int deleteVaCustAcctInfo(Map<String,Object> params);\n\n int insertCmAcctTranSeq(Map<String,Object> params);\n int updateCmAcctTranSeq(Map<String,Object> params);\n\n int insertCmTranSeq(Map<String,Object> params);\n int updateCmTranSeq(Map<String,Object> params);\n\n int insertVaOrderInfo(Map<String,Object> params);\n int updateVaOrderInfo(Map<String,Object> params);\n int insertVaOrderSeq(Map<String,Object> params);\n\n int insertVaVirAcctSeq(Map<String,Object> params);\n int updateVaVirAcctSeq(Map<String,Object> params);\n int insertVaBindSeq(Map<String,Object> params);\n\n\n int insertVaTransferSeq(Map<String,Object> params);\n int insertTestUser(Map<String,Object> params);\n int updateProduceDay(Map<String,Object> params);\n\n int insertEodProcPrdLog(Map<String,Object> params);\n int insertEodProcLog(Map<String,Object> params);\n int updateEodProcPrdLog(Map<String,Object> params);\n int updateEodProcLog(Map<String,Object> params);\n\n\n\n}", "public static void just() {\n Observable<List<String>> myObservable = Observable.just(Utils.getData());\n myObservable.subscribe(consumerList);\n }", "public interface RelayDao {\n public void insert(RelayDto relay) throws SQLException;\n\n public void insertTranslation(Long relayId, Long langId, String translation) throws SQLException;\n\n public void update(RelayDto relay) throws SQLException;\n\n public void remove(Long relayId) throws SQLException;\n\n public RelayDto getById(Long id) throws SQLException;\n\n public List<RelayDto> getAll() throws SQLException;\n\n public List<RelayDto> getAll(Long langId) throws SQLException;\n}", "public static void reduceDemo() {\n Observable.range(1, 10).reduce(new Func2<Integer, Integer, Integer>() {\n @Override\n public Integer call(Integer integer, Integer integer2) {\n RxDemo.log(RxDemo.getMethodName() + \" \" + integer + \" \" + integer2);\n return integer + integer2;\n }\n }).subscribe(new RxCreateOperator.Sub());\n }", "@Nonnull\r\n\tpublic static <T, U, V> Observable<V> zip(\r\n\t\t\t@Nonnull final Observable<? extends T> left,\r\n\t\t\t@Nonnull final Iterable<? extends U> right,\r\n\t\t\t@Nonnull final Func2<? super T, ? super U, ? extends V> selector) {\r\n\t\treturn new Zip.ObservableAndIterable<T, U, V>(left, right, selector);\r\n\t}", "public static void main(String[] args) throws Exception {\n\t\tFlowable<String> obs4 = Flowable.just(\"un\", \"deux\", \"trois\", \"quatre\", \"sank\", \"six\", \"sept\", \"huit\", \"neuf\", \"deese\");\n//\t\tobs4.map(mapper -> {\n//\t\t\tif (\"deux\".equals(mapper))\n//\t\t\t\tThread.sleep(2000);\n//\t\t\treturn mapper+\" -- \"+Thread.currentThread().getName();\n//\t\t})\t\n//\t\t.subscribe(System.out::println);\n\t\t\n\t\tObserver<String> observer1 = new Observer<String>() {\n\n\t\t\t@Override\n\t\t\tpublic void onComplete() {\n\t\t\t\tSystem.out.println(\"Completed...\");\n\t\t\t\t\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onError(Throwable arg0) {\n\t\t\t\targ0.printStackTrace();\n\t\t\t\t\n\t\t\t}\n\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onSubscribe(Disposable arg0) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onNext(String arg0) {\n\t\t\t\tSystem.out.println(\"on next -- \"+arg0);\n\t\t\t\t\n\t\t\t}\n\t\t};\n\t\t\n\t\tList<String> list1 = Arrays.asList(\"un\",\"deux\",\"trois\",\"quatre\",\"sank\");\n\t\t\n\t\tObservable obs5 = Observable.fromIterable(list1);\n\t\t\n\t\t//obs5.subscribe(observer1);\n\t\t\n\t\t//Flowable.range(3, 10).subscribe(System.out::println);\n\t\t\n\t\tnew Thread(\n\t\t()->{\n\t\t\tobs4\n\t\t\t.map(mapper ->{\n\t\t\t\tif (\"deux\".equals(mapper) || \"quatre\".equals(mapper))\n\t\t\t\t\tThread.sleep(2000);\n\t\t\t\treturn mapper+\" -- \"+Thread.currentThread().getName();\n\t\t\t})\n\t\t\t.subscribe(System.out::println);\n\t\t\t\n\t\t}).start();\n\t\t\n//\t\tnew Thread() {\n//\t\t\tpublic void run() {\n//\t\t\t\tobs4\n//\t\t\t\t\t.map(mapper ->{\n//\t\t\t\t\t\tif (\"deux\".equals(mapper) || \"quatre\".equals(mapper))\n//\t\t\t\t\t\t\tThread.sleep(2000);\n//\t\t\t\t\t\treturn mapper+\" -- \"+Thread.currentThread().getName();\n//\t\t\t\t\t})\n//\t\t\t\t\t.subscribe(System.out::println);\n//\t\t\t}\n//\t\t}.start();\n\t\t\n//\t\tExecutor exe = Executors.newCachedThreadPool();\n//\t\t\n//\t\texe.execute(()->{\n//\t\t\t\n//\t\t\tobs4\n//\t\t\t.map(mapper ->{\n//\t\t\t\tif (\"deux\".equals(mapper) || \"quatre\".equals(mapper))\n//\t\t\t\t\tThread.sleep(2000);\n//\t\t\t\treturn mapper+\" -- \"+Thread.currentThread().getName();\n//\t\t\t})\n//\t\t\t.subscribe(System.out::println);\n\t\t\t\n//\t\t\tobs4.subscribe();\n//\t\t\tFlowable.zip(obs4, Flowable.interval(2, TimeUnit.SECONDS),(k,v)->k)\n//\t\t\t.subscribe((data)->{\n//\t\t\t\tSystem.out.println(\" \"+data+\" -- \"+Thread.currentThread().getName());\n//\t\t\t});\n//\t\t\tFlowable.interval(1, TimeUnit.SECONDS)\n//\t\t\t.map(mapper -> {\n//\t\t\t\tif (mapper == 3)\n//\t\t\t\t\tthrow new Exception(\" Time is Over !!! \");\n//\t\t\t\treturn mapper;\n//\t\t\t})\n//\t\t\t.subscribe((data)->{\n//\t\t\t\tSystem.out.println(data +\" -- \"+Thread.currentThread().getName());\n//\t\t\t},(e)->{\n//\t\t\t\te.printStackTrace();\n//\t\t\t});\n\t\t\t\n\t\t//});\n\t\t\n//\t\t//Thread.sleep(5000);\t\n//\t\tFlowable<String> flw1 = Flowable.just(\"un\",\"deux\",\"trois\",\"quatre\",\"sank\",\"six\",\"sept\");\n//\t\tflw1\n//\t\t//.subscribeOn(Schedulers.from(Executors.newFixedThreadPool(4)))\n//\t\t.map(mapper ->{\n//\t\t\tif (\"deux\".equals(mapper))\n//\t\t\t\tThread.sleep(1000);\n//\t\t\tif (\"quatre\".equals(mapper))\n//\t\t\t\tThread.sleep(500);\n//\t\t\treturn mapper +\" -- \"+Thread.currentThread().getName();\n//\t\t})\n//\t\t.subscribe(System.out::println);\n//\t\t\n//\t\tThread.sleep(2000);\n\t}", "@Dao\npublic interface ItemDao {\n\n @Insert(onConflict = OnConflictStrategy.REPLACE)\n void insertSingleItem(Item item);\n\n @Insert(onConflict = OnConflictStrategy.REPLACE)\n void insertMultipleItem(List<Item> itemList);\n\n @Query(\"SELECT * FROM Item WHERE item_id = :itemId\")\n Flowable<Item> fetchItemByItemId(int itemId);\n\n @Query(\"SELECT * FROM Item\")\n Flowable<List<Item>> fetchItems();\n\n @Update\n void updateItem(Item item);\n\n @Delete\n void deleteItem(Item item);\n\n}", "private <T, Q extends Query> void executeInsertBatch(Collection<T> objectsToInsert, Function<? super T, ? extends Q> mapFunction) {\n\t\tList<Q> insertStatements = objectsToInsert.stream().map(mapFunction).collect(Collectors.toList());\n\t\tdslContext.batch(insertStatements).execute();\n\t}", "@Mapper\npublic interface BillMapper {\n long countByExample(BillExample example);\n\n int deleteByExample(BillExample example);\n\n int deleteByPrimaryKey(Integer id);\n\n int insert(Bill record);\n\n int insertSelective(Bill record);\n\n List<Bill> selectByExample(BillExample example);\n\n Bill selectByPrimaryKey(Integer id);\n\n int updateByExampleSelective(@Param(\"record\") Bill record, @Param(\"example\") BillExample example);\n\n int updateByExample(@Param(\"record\") Bill record, @Param(\"example\") BillExample example);\n\n int updateByPrimaryKeySelective(Bill record);\n\n int updateByPrimaryKey(Bill record);\n}" ]
[ "0.58075345", "0.544267", "0.5085378", "0.50321555", "0.5011454", "0.49489313", "0.4844218", "0.4842796", "0.47734678", "0.47468552", "0.47328648", "0.4727003", "0.47255653", "0.47017977", "0.46715808", "0.46607605", "0.46524936", "0.4637129", "0.4606826", "0.45846593", "0.4579571", "0.45606878", "0.4543641", "0.45429623", "0.45303953", "0.45274875", "0.45202866", "0.45200515", "0.44899863", "0.44791633", "0.4467394", "0.44622487", "0.4458341", "0.44477034", "0.44412705", "0.44329348", "0.44130367", "0.44091767", "0.44075269", "0.4399264", "0.43990123", "0.4397135", "0.43948054", "0.43886447", "0.4381043", "0.43757302", "0.4374751", "0.4369058", "0.43643937", "0.43642107", "0.4349455", "0.433828", "0.4329971", "0.43262225", "0.43230718", "0.43170285", "0.4315003", "0.4311671", "0.43083203", "0.43044108", "0.42969996", "0.4294164", "0.4292816", "0.42908862", "0.4283776", "0.42788672", "0.4274563", "0.42741373", "0.42678738", "0.4262431", "0.42589977", "0.42582092", "0.42541704", "0.4249812", "0.42495847", "0.42471662", "0.42459464", "0.42425364", "0.42413306", "0.4241296", "0.42385957", "0.42340153", "0.42333126", "0.42310327", "0.42297867", "0.4227932", "0.4227807", "0.42276737", "0.4227574", "0.42274427", "0.42265034", "0.42252493", "0.42147347", "0.4214027", "0.42103994", "0.42071036", "0.42047846", "0.42045546", "0.42032558", "0.41992274" ]
0.60537094
0
Processes requests for both HTTP GET and POST methods.
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ArrayList<Integer> selectedClassrooms = new ArrayList<>(); for(String val: request.getParameterValues("selected")) { selectedClassrooms.add(Integer.parseInt(val)); } response.setContentType("text/html;charset=UTF-8"); try { ClassroomStore store = new ClassroomStore(getDatabaseConnection()); int deleted = store.delete(selectedClassrooms); if(deleted == selectedClassrooms.size()) { // Success! } else { // Error :( } } catch(Exception e) { getServletContext().log("", e); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n protected void doPost(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException {\n final String method = req.getParameter(METHOD);\n if (GET.equals(method)) {\n doGet(req, resp);\n } else {\n resp.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);\n }\n }", "private void processRequest(HttpServletRequest request, HttpServletResponse response) {\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n // only POST should be used\n doPost(request, response);\n }", "@Override\n\tprotected void doPost(HttpServletRequest req, HttpServletResponse resp)\n\t\t\tthrows ServletException, IOException {\nSystem.err.println(\"=====================>>>>>123\");\n\t\tString key=req.getParameter(\"method\");\n\t\tswitch (key) {\n\t\tcase \"1\":\n\t\t\tgetProvinces(req,resp);\n\t\t\tbreak;\n\t\tcase \"2\":\n\t\t\tgetCities(req,resp);\t\t\t\n\t\t\tbreak;\n\t\tcase \"3\":\n\t\t\tgetAreas(req,resp);\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\n\t}", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tprocess(req, resp);\n\t}", "@Override\r\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\r\n\t\tdoPost(req, resp);\r\n\t}", "@Override\r\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\r\n throws ServletException, IOException {\r\n processRequest(request, response);\r\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n\n\tprotected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tdoGet(req, resp);\n\n\t}", "@Override\r\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tdoPost(req, resp);\r\n\t}", "@Override\r\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tdoPost(req, resp);\r\n\t}", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tdoPost(req, resp);\n\t}", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tdoPost(req, resp);\n\t}", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tdoPost(req, resp);\n\t}", "@Override\r\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tdoProcess(req, resp);\r\n\t}", "@Override\r\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\r\n throws ServletException, IOException {\r\n processRequest(request, response);\r\n }", "@Override\r\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\r\n throws ServletException, IOException {\r\n processRequest(request, response);\r\n }", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tdoProcess(req, resp);\n\t}", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp)\n\t\t\tthrows ServletException, IOException {\n\t\tdoPost(req, resp);\n\t}", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp)\n\t\t\tthrows ServletException, IOException {\n\t\tdoPost(req, resp);\n\t}", "@Override\n \tpublic void doGet(HttpServletRequest req, HttpServletResponse resp)\n \t\t\tthrows ServletException, IOException {\n \t\tdoPost(req, resp);\n \t}", "@Override\r\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp)\r\n\t\t\tthrows ServletException, IOException {\n\t\tdoPost(req, resp);\r\n\t}", "@Override\r\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp)\r\n\t\t\tthrows ServletException, IOException {\n\t\tdoPost(req, resp);\r\n\t}", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tthis.doPost(req, resp);\n\t}", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tthis.doPost(req, resp);\n\t}", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tthis.doPost(req, resp);\n\t}", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tthis.doPost(req, resp);\n\t}", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\r\n\tprotected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tsuper.doPost(req, resp);\r\n\t\tdoGet(req, resp);\r\n\t}", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\r\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t\tthis.doPost(req, resp);\r\n\t}", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n\n processRequest(request, response);\n }", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp)\n\t\t\tthrows ServletException, IOException {\n\t\tthis.doPost(req, resp);\n\t\t\n\t}", "@Override\n\tprotected void doGet(HttpServletRequest request,\n\t\t\tHttpServletResponse response) throws ServletException, IOException {\n\t\tprocessRequest(request, response);\n\t}", "@Override\n\tprotected void doGet(HttpServletRequest request,\n\t\t\tHttpServletResponse response) throws ServletException, IOException {\n\t\tprocessRequest(request, response);\n\t}", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp)\n\t\t\tthrows ServletException, IOException {\n\n\t\tprocess(req,resp);\n\t}", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }", "@Override\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n processRequest(request, response);\n }" ]
[ "0.7005406", "0.66572356", "0.6604074", "0.65101326", "0.64464515", "0.64432913", "0.6439602", "0.64311135", "0.642902", "0.6425377", "0.6425377", "0.6420841", "0.6420841", "0.6420841", "0.6417446", "0.64133376", "0.64133376", "0.6399404", "0.6395047", "0.6395047", "0.6393712", "0.6393019", "0.6393019", "0.6391477", "0.6391477", "0.6391477", "0.6391477", "0.6387829", "0.6387829", "0.6379409", "0.63793546", "0.6377228", "0.6377206", "0.63759077", "0.63695353", "0.63625795", "0.6361562", "0.6361562", "0.63547134", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943", "0.63537943" ]
0.0
-1
TODO Autogenerated method stub
@Override public void run() { isAlive = false; }
{ "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
go through each moveable object
private void setNodeConnectors(){ for (MoveableObject moveableObject : gameObjects.getMoveableObjectsList()) { // if the hashmap doesn't contain that radius then make the nodes if (!nodeMap.containsKey(moveableObject.getObjectRadius())){ bufferedStationaryObstacles = new ArrayList(); bufferedNodeConnector = new NodeConnector(); // go through each obstace and buffer it by the object radius -0.5 for (PathBlockingObstacle stationaryObstacle : stationaryObstacles) { KPolygon buffered1 = bufferer.buffer(stationaryObstacle.getPolygon(), moveableObject.getObjectRadius()-0.5, PathBlockingObstacleImpl.NUM_POINTS_IN_A_QUADRANT); bufferedStationaryObstacles.add(PathBlockingObstacleImpl.createObstacleFromInnerPolygon(buffered1)); } // add these obstacles to a buffered node list for (PathBlockingObstacle bufferedStationaryObstacle : bufferedStationaryObstacles) { bufferedNodeConnector.addObstacle(bufferedStationaryObstacle, bufferedStationaryObstacles, maxConnectionDistanceBetweenObstacles); } // add this node list to the hashmap with the radius as key nodeMap.put(moveableObject.getObjectRadius(), bufferedNodeConnector); obstaclesMap.put(moveableObject.getObjectRadius(), bufferedStationaryObstacles); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private boolean updateMovingObjects(double elapsedSeconds) {\n for(Movable movingObj : engine.getMovingObjects()){\n double dx = 0, dy = 0;\n switch (movingObj.getFacing()){\n case UP:\n dy -= movingObj.getSpeed() * GRID_SIZE * elapsedSeconds;\n break;\n case DOWN:\n dy += movingObj.getSpeed() * GRID_SIZE * elapsedSeconds;\n break;\n case LEFT:\n dx -= movingObj.getSpeed() * GRID_SIZE * elapsedSeconds;\n break;\n case RIGHT:\n dx += movingObj.getSpeed() * GRID_SIZE * elapsedSeconds;\n break;\n }\n Node movingNode = getNodeById(movingObj.getObjID());\n if(movingNode == null) break; // if the node is deleted\n double oldX = movingNode.getTranslateX();\n double oldY = movingNode.getTranslateY();\n double newX = oldX + dx;\n double newY = oldY + dy;\n\n // translate objs\n movingNode.setTranslateX(newX);\n movingNode.setTranslateY(newY);\n\n // detect collisions\n for(GameObject anotherObj : engine.getAllObjects()){\n // ignore self with self\n if(movingObj.equals(anotherObj)) continue;\n\n Node anotherNode =\n getNodeById(anotherObj.getObjID());\n\n if(isColliding(movingNode, anotherNode)){\n CollisionResult result = engine.handleCollision(movingObj, anotherObj);\n if(handleCollision(result, movingNode, anotherNode, oldX, oldY))\n return true;\n }\n }\n\n engine.changeObjectLocation(movingObj, getUpdatedPoint(movingObj, newX, newY));\n }\n return false;\n }", "public void moveObjectsAlongPath(){\n for (int i=0; i<gameObjects.getMoveableObjectsList().size(); i++){\r\n \r\n MoveableObject movingOb = gameObjects.getMoveableObjectsList().get(i);\r\n \r\n if (movingOb.getPathDestination()!=null ){\r\n \r\n KPoint start = movingOb.getPathLocation();\r\n KPoint destination = movingOb.getPathDestination();\r\n \r\n ArrayList<KPoint> pathPoints = getPathPoints(start, destination, movingOb.getObjectRadius());\r\n movingOb.setCurrentPathTest(pathPoints);\r\n \r\n }\r\n \r\n if(movingOb.getCurrentPath().size()>0){\r\n // find the angle the moveable object needs to rotate to by comparing start with the next path point\r\n KPoint start = movingOb.getPathLocation();\r\n KPoint nextPoint=movingOb.getCurrentPath().get(1);\r\n double targetAngle = Math.atan2(nextPoint.y-start.y, nextPoint.x-start.x );\r\n double angleRemaining = movingOb.getTransform().getRotation() - targetAngle;\r\n \r\n // fix for beyond pi range\r\n if (angleRemaining>Math.PI)angleRemaining -=2*Math.PI;\r\n if (angleRemaining<-Math.PI)angleRemaining +=2*Math.PI;\r\n \r\n if (angleRemaining > 0.1){ \r\n //movingOb.rotateAboutCenter(-angleRemaining);\r\n movingOb.rotateAboutCenter(-ROTATION_SPEED*movingOb.getSpeed());\r\n } else if (angleRemaining <-0.1){\r\n //movingOb.rotateAboutCenter(-ROTATION_SPEED*movingOb.getSpeed());\r\n movingOb.rotateAboutCenter(ROTATION_SPEED*movingOb.getSpeed());\r\n\r\n } else {\r\n double angle = movingOb.getTransform().getRotation();\r\n int xAdjust = (int)Math.ceil(Math.cos(angle)*FORCE_AMOUNT*movingOb.getSpeed());\r\n int yAdjust = (int)Math.ceil(Math.sin(angle)*FORCE_AMOUNT*movingOb.getSpeed());\r\n movingOb.applyForce(new Vector2(xAdjust,yAdjust));\r\n }\r\n }\r\n \r\n }\r\n }", "private boolean processMovingObject()\n {\n MovingObject[] ap_objects = p_gsb.ap_MovingObjects;\n for (int li = 0;li < ap_objects.length;li++)\n {\n MovingObject p_obj = ap_objects[li];\n\n if (!p_obj.lg_Active) continue;\n\n if (p_obj.process())\n {\n if (p_obj.i_State == MovingObject.STATE_EXPLODE)\n {\n p_obj.lg_Active = false;\n continue;\n }\n }\n\n if (p_obj.i_State == MovingObject.STATE_EXPLODE) continue;\n\n switch (p_obj.i_Type)\n {\n case MovingObject.TYPE_ARROW:\n {\n p_obj.i_scry -= ARROWSPEED;\n if (p_obj.i_scry <= (0 - p_obj.i_height))\n {\n p_obj.lg_Active = false;\n continue;\n }\n }\n ;\n break;\n case MovingObject.TYPE_ASSAULTER:\n {\n if (getRandomInt(1000) <= p_gsb.i_shotfreq)\n {\n MovingObject p_arrow = p_gsb.getInactiveMovingObject();\n if (p_arrow != null)\n {\n p_arrow.activate(MovingObject.TYPE_ARROW,MovingObject.STATE_UP);\n p_arrow.i_scrx = p_obj.i_scrx;\n p_arrow.i_scry = p_obj.i_scry - p_arrow.i_height;\n }\n }\n\n if (p_obj.i_State != MovingObject.STATE_DOWN) generateLadderAndDamForAssaulter(p_obj);\n\n switch (p_obj.i_State)\n {\n case MovingObject.STATE_LEFT:\n {\n if (p_obj.i_scrx - ASSAULTER_HORZSPEED < 0)\n {\n p_obj.setState(MovingObject.STATE_RIGHT,false);\n }\n else\n {\n p_obj.i_scrx -= ASSAULTER_HORZSPEED;\n }\n }\n ;\n break;\n case MovingObject.STATE_RIGHT:\n {\n if (p_obj.i_scrx + p_obj.i_width + ASSAULTER_HORZSPEED >= i_screenWidth)\n {\n p_obj.setState(MovingObject.STATE_LEFT,false);\n }\n else\n {\n p_obj.i_scrx += ASSAULTER_HORZSPEED;\n }\n }\n ;\n break;\n case MovingObject.STATE_UP:\n {\n p_obj.i_scry -= ASSAULTER_VERTSPEED;\n if ((p_obj.i_scry + (p_obj.i_height >> 1)) / VIRTUALCELL_HEIGHT == 0/*p_gsb.i_playeralt*/) return true;\n }\n ;\n break;\n case MovingObject.STATE_DOWN:\n {\n p_obj.i_scry += ASSAULTER_VERTSPEED;\n int i_cellx = p_obj.i_scrx / VIRTUALCELL_WIDTH;\n int i_celly = (p_obj.i_scry + p_obj.i_height - 1) / VIRTUALCELL_HEIGHT;\n boolean lg_stop = false;\n if (i_celly < FIELD_HEIGHT-p_gsb.i_playeralt)\n {\n if (Assault_GSB.getElement(i_cellx,i_celly) != Assault_GSB.CELL_NONE) lg_stop = true;\n }\n else\n {\n lg_stop = true;\n i_celly--;\n }\n\n if (lg_stop)\n {\n p_obj.i_scry = i_celly * VIRTUALCELL_HEIGHT;\n if (getRandomInt(40) >= 20)\n {\n p_obj.setState(MovingObject.STATE_LEFT,false);\n }\n else\n {\n p_obj.setState(MovingObject.STATE_RIGHT,false);\n }\n }\n }\n ;\n break;\n }\n }\n ;\n break;\n case MovingObject.TYPE_STONE:\n {\n if (p_obj.i_State == MovingObject.STATE_DOWN)\n {\n p_obj.i_scry += STONESPEED;\n if ((p_obj.i_scry + p_obj.i_height) >= FIELD_HEIGHT * VIRTUALCELL_HEIGHT)\n {\n p_obj.i_scry = (FIELD_HEIGHT * VIRTUALCELL_HEIGHT) - p_obj.i_height - 1;\n p_obj.setState(MovingObject.STATE_EXPLODE,false);\n }\n }\n }\n ;\n break;\n }\n }\n return false;\n }", "public void moveAllItems() {\n for (BaseObject object : getAllItems()) {\n object.move();\n }\n }", "public void moveObjsToGoals() {\n\t\tMap<Integer, MovingFObject> map = sc.getInitPos();\r\n\t\tfor(int i = 0; i < map.size(); i++) {\r\n\t\t\tMovingFObject temp = map.get(i);\r\n\t\t\tsc.moveAtVelAtTimeToLoc(i, sc.getMaxVelocity(), 0, (Location)temp.getGoal());\r\n\t\t}\r\n\t}", "private void enemyMove() {\n\t\tArrayList<EnemySprite> enemylist = this.model.getEnemy();\n\t\tfor(EnemySprite sp :enemylist) {\n\t\t\tif(sp instanceof NormalEnemySprite) {\n\t\t\t\t\n\t\t\t\t((NormalEnemySprite)sp).move();\n\t\t\t}\n\t\t\t\n\t\t\telse if(sp instanceof PatrollingEnemySprite) {\n\t\t\t\t\n\t\t\t\t((PatrollingEnemySprite) sp).move();\n\t\t\t\t\n\t\t\t} \n\t\t\t\n\t\t\telse if (sp instanceof BigEnemySprite) {\n\t\t\t\t((BigEnemySprite)sp).move();\n\t\t\t}\n\t\t\t\n\t\t\telse if (sp instanceof PatrollingBigEnemySprite) {\n\t\t\t\t((PatrollingBigEnemySprite) sp).move();\n\t\t\t}\n\t\t\t\n\t\t\telse if (sp instanceof CircleBigEnemySprite) {\n\t\t\t\t((CircleBigEnemySprite) sp).move();\n\t\t\t}\n\t\t}\n\t\t\n\t\t\t\t\n\t}", "public void move() {\n for (int i = 0; i < Vampiro.getNumVamp(); i++) {\n\n lista[i].move();\n }\n }", "@Override\n \t\t\t\tpublic void doMove() {\n \n \t\t\t\t}", "public void moveStopped()\n {\n for (GraphElement element : elements) {\n if(element instanceof Moveable) {\n Moveable moveable = (Moveable) element;\n moveable.setPositionToGhost();\n }\n } \n }", "public void moveEverythingALittle(){\n //ponieważ wszystko idealnie jest zsynchronizowane to else nie wykona sie gdy current = getDestination\n if(player.getCurrentX()<player.getDestinationX())\n player.currentX += 1;\n else if(player.getCurrentX()>player.getDestinationX())\n player.currentX -= 1;\n\n if( player.getCurrentY()<player.getDestinationY())\n player.currentY += 1;\n else if( player.getCurrentY()>player.getDestinationY())\n player.currentY -= 1;\n\n for(int i = 0; i < boxes.size(); i++){\n Box item = boxes.get(i);\n if(item.getCurrentX()<item.getDestinationX())\n item.currentX += 1;\n else if(item.getCurrentX()>item.getDestinationX())\n item.currentX -= 1;\n\n if( item.getCurrentY()<item.getDestinationY())\n item.currentY += 1;\n else if ( item.getCurrentY()>item.getDestinationY())\n item.currentY -= 1;\n }\n }", "public void move() {\r\n\t\tmoveCount++;\r\n\t}", "public void moveAll()\n\t{\n\t\tmoveOutput = \"\";\n\t\tfor (int i = 0; i < 20; i++)\n\t\t{\n\t\t\tif (river[i] != null)\n\t\t\t{\n\t\t\t\triver[i].move(i);\n\t\t\t}\n\t\t}\n\t}", "public abstract void doFunction(ArrayList<Movable> movingObjs);", "@Override\n\tpublic void makeNextMove() \n\t{\n\t}", "public void move(){\n\t\t\n\t}", "public void moveObjects() {\n // move ball and paddles\n ball.moveBall();\n playerOnePaddle.movePaddle();\n playerTwoPaddle.movePaddle();\n }", "void moveVehicles() {\n for (int i = roads.size() - 1; i >= 0; i--) {\n roads.get(i).moveVehicles();\n checkTurns(i);\n\n\n }\n\n }", "public void callMoveFromObject() {\r\n try { \r\n if (internalObject instanceof BObject) { \r\n Class [] params = {};\r\n BMethod move = ((BObject) internalObject).getBClass().getDeclaredMethod(\"move\",params);\r\n if (move != null)\r\n move.invoke((BObject)internalObject, params);\r\n }\r\n } catch (Exception e) {\r\n // nothing\r\n //e.printStackTrace();\r\n }\r\n\r\n }", "@Override\n\tpublic void move() {\n\t\t\n\t}", "public void turnoZombie(){\n int cont = 0;\n\n while(cont < zombies.size()){\n Zombie tmp = (Zombie) zombies.get(cont);\n //System.out.println(\"Zombie \" + cont + \" | posx: \" + tmp.posX + \" | posy: \" + tmp.posY);\n\n //===============Ataque=========================\n\n int[] target = objetivoAtaque(tmp);\n\n if(target != null){\n Soldado objetivo = (Soldado) tablero[target[0]][target[1]].personaje;\n tmp.atacar(objetivo);\n if(objetivo.vida <= 0){\n soldados.remove(tablero[target[0]][target[1]].personaje);\n tablero[target[0]][target[1]].personaje = null;\n }\n cont++;\n continue;\n }\n\n //===============Vision=========================\n\n int[] destino = vision(tmp);\n\n if(destino != null){\n moverZombie(tmp, destino[0], destino[1]);\n cont++;\n System.out.println(\"Ví algo\");\n System.out.println(\"Zombie \" + cont + \" | posx: \" + destino[0] + \" | posy: \" + destino[1]);\n }\n\n //===============Escucha=========================\n else{\n\n int[] destino2 = escuchar(tmp);\n\n if(destino2 != null){\n moverZombie(tmp, destino2[0], destino2[1]);\n cont++;\n System.out.println(\"Escuché algo\");\n System.out.println(destino2[0] + \", \" + destino2[1]);\n }\n\n //===============Random=========================\n else{\n\n moverZombie(tmp, tmp.posX, tmp.posY + 2);\n cont++;\n System.out.println(\"Random\");\n System.out.println(tmp.posX + \", \" + tmp.posY);\n }\n\n }\n\n }\n this.mostrar();\n }", "public void updateObjects()\r\n {\r\n //update states\r\n for (Ball ball : balls) {\r\n \tif(ball!=null)\r\n \t{\r\n\t \tif(ball.GetVisible()) ball.MoveDown();\r\n\r\n \t}\r\n \telse ball=null;\r\n }\r\n \r\n }", "@Override\n\tpublic void move() {\n\n\t}", "public boolean moveable() {\n //check reach border\n if (reachBorder()) {\n return false;\n }\n //get the location of the next spot to move to\n //move up\n Point nextLocation = this.getCenterLocation();\n if (direction == 12) {\n nextLocation = new Point(this.getCenterX(),\n this.getCenterY() - speed);\n }\n //move right\n if (direction == 3) {\n nextLocation = new Point(this.getCenterX() + speed,\n this.getCenterY());\n\n }\n //move down\n if (direction == 6) {\n nextLocation = new Point(this.getCenterX(),\n this.getCenterY() + speed);\n\n }\n //move left\n if (direction == 9) {\n nextLocation = new Point(this.getCenterX() - speed,\n this.getCenterY());\n }\n\n // get all objects in a circle of radius tileSize * 2 around the players\n //these objects are those which can possibly colide with the players\n int checkRadius = GameUtility.GameUtility.TILE_SIZE * 2;\n for (GameObject gameObject : GameManager.getGameObjectList()) {\n if (GameUtility.GameUtility.distance(gameObject.getCenterLocation(),\n this.getCenterLocation()) < checkRadius) {\n if ((GameUtility.GameUtility.dectectCollision(\n gameObject.getCenterLocation(),\n nextLocation)) && !(GameUtility.GameUtility.dectectCollision(\n gameObject.getCenterLocation(),\n this.getCenterLocation())) && gameObject.getType() != GameObjectType.POWER_UP && gameObject.getType() != GameObjectType.MONSTER && gameObject.getType() != GameObjectType.PLAYER) {\n return false;\n }\n }\n }\n return true;\n\n }", "public void getMove(){\n\t\t\n\t}", "@Override\r\n\tpublic void move() {\n\r\n\t}", "@Override\n\tpublic void move() {\n\t}", "Object GetMove (Object game_state);", "public void move() {\n\r\n\t}", "private void moveMonsters() {\r\n\t\tfor (AreaOrMonster obj : areas) {\r\n\t\t\tif(obj.getLeftRight()) {\r\n\t\t\t\tif(!pirate1.currentLocation.equals(new Point(obj.getX()+1, obj.getY())) && !pirate2.currentLocation.equals(new Point(obj.getX()+1, obj.getY()))) {\r\n\t\t\t\t\tobj.move();\r\n\t\t\t\t\tobj.getImageView().setX(obj.getX() * scalingFactor);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tif(!pirate1.currentLocation.equals(new Point(obj.getX()-1, obj.getY())) && !pirate2.currentLocation.equals(new Point(obj.getX()-1, obj.getY()))) {\r\n\t\t\t\t\tobj.move();\r\n\t\t\t\t\tobj.getImageView().setX(obj.getX() * scalingFactor);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "@Override\n\tpublic boolean movable(Entity obj) {\n\t\treturn true;\n\t}", "@Override\n public void move () {\n }", "@Override\r\n\tprotected void onMove() {\n\t\t\r\n\t}", "void printObjects(){\r\n\t\tIterator iterator = gc.getIterator();\r\n\t while(iterator.hasNext()){\r\n\t\t GameObject g = iterator.getNext();\r\n\t\t\t if (!(g instanceof Bar))System.out.println(g.toString());\r\n\t\t}\r\n\t}", "public void moveAllDrones() {\n for (Pieces d : drones) {\n d.tryToMove(this);\n }\n }", "private void movementPhase() {\n ClickObserver.getInstance().setCreatureFlag(\"\");\n Platform.runLater(new Runnable() {\n @Override\n public void run() {\n GUI.getDoneButton().setDisable(false);\n TheCupGUI.update();\n Board.removeCovers();\n }\n });\n for (Player p : playerList) {\n \tplayer = p;\n player.flipAllUp();\n\t ClickObserver.getInstance().setActivePlayer(player);\n\t ClickObserver.getInstance().setCreatureFlag(\"Movement: SelectMovers\");\n\t InfoPanel.uncover(player.getName());\n\t if (p.getHexesWithPiece().size() > 0) {\n\t \tClickObserver.getInstance().setClickedTerrain(p.getHexesWithPiece().get(0));\n\t }\n\t pause();\n Platform.runLater(new Runnable() {\n @Override\n public void run() {\n \tClickObserver.getInstance().whenTerrainClicked();\n \t GUI.getHelpText().setText(\"Movement Phase: \" + player.getName()\n + \", Move your armies\");\n \t Game.getRackGui().setOwner(player);\n }\n });\n\t \n\t while (isPaused) {\n \ttry { Thread.sleep(100); } catch( Exception e ){ return; } \n\t }\n\t InfoPanel.cover(player.getName());\n player.flipAllDown();\n }\n Platform.runLater(new Runnable() {\n @Override\n public void run() {\n GUI.getDoneButton().setDisable(true);\n }\n });\n ClickObserver.getInstance().setCreatureFlag(\"\");\n }", "private void gameMove() {\n for (int x = 0; x < list.size() - 2; x++) {\n // check if snake is touch coin\n if (Snake().isTouching(list.get(x))) {\n Snake().collected();\n list.get(x).collected();\n }\n }\n Snake().move();\n }", "void processNextMove(List<Coordinates> moves, Ball color);", "public interface Moveable {\n\n // move method with paramaters for the player to move to.\n void move(int dx, int dy);\n\n // moveTo method adjusts the parameter for the player in the ArrayLists.\n void moveTo(int dx, int dy);\n\n // stepCounter ArrayList that returns the last position of the player of TileX.\n ArrayList<Integer> getStepCounterTileX();\n\n // method that sets the StepCounter with the last position of player.\n void setStepCounterTileXY();\n\n // stepCounter ArrayList that returns the last position of the player of TileY.\n ArrayList<Integer> getStepCounterTileY();\n}", "public void Move()\n {\n \n }", "private void iterateEnemyShots() {\n\t\tfor (Shot s : enemyShotList) {\n\t\t\tfor (ArrayList<Invader> row : enemyArray) {\n\t\t\t\tfor(Invader a : row) {\n\t\t\t\t\ta.shouldAttack(s);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "void move_couple() {\n\t\tfor(int i = 0; i < d; i++){\n\t\t\tif(dancers[i].soulmate == -1) continue;\n\t\t\tPoint curr = this.last_positions[i];\n\t\t\tPoint des = this.dancers[i].des_pos;\n\t\t\tthis.dancers[i].next_pos = findNextPosition(curr, des);\n\t\t}\n\t}", "private void computeMovableTilesToDisplayToPlayer() {\n \tfor (Entity enemyEntity : allCreaturesOfCurrentRoom) {\n \t\tAIComponent aiComponent = Mappers.aiComponent.get(enemyEntity);\n \t\tif (aiComponent.getSubSystem() != null) {\n \t\t\tboolean handledInSubSystem = aiComponent.getSubSystem().computeMovableTilesToDisplayToPlayer(this, enemyEntity, room);\n \t\t\tif (handledInSubSystem) continue;\n \t\t}\n \t\t\n \tMoveComponent moveCompo = Mappers.moveComponent.get(enemyEntity);\n \tAttackComponent attackCompo = Mappers.attackComponent.get(enemyEntity);\n \t\n \t\t//clear the movable tile\n \t\tmoveCompo.clearMovableTiles();\n \t\tif (attackCompo != null) attackCompo.clearAttackableTiles();\n \t\t\n \t\tmoveCompo.setMoveRemaining(moveCompo.getMoveSpeed());\n \t\t\n \t//Build the movable tiles list\n \t\ttileSearchService.buildMoveTilesSet(enemyEntity, room);\n \t\tif (attackCompo != null) attackTileSearchService.buildAttackTilesSet(enemyEntity, room, false, true);\n \t\tmoveCompo.hideMovableTiles();\n \t\tif (attackCompo != null) attackCompo.hideAttackableTiles();\n \t}\n }", "public void move() {\n\n }", "public void move()\r\n\t{\r\n\t\tfor (int a = 0; a < bullets.size(); a++)\r\n\t\t{\r\n\t\t\tBullet bullet = bullets.get(a);\r\n\t\t\tif (!bullet.move())\r\n\t\t\t{\r\n\t\t\t\tbullets.remove(a);\r\n\t\t\t\ta--;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private void handleMovement() {\n if (movements.isEmpty()) return;\n try {\n switch (movements.peek()) {\n case MOVE_UP:\n game.movePlayer(Direction.N);\n break;\n case MOVE_LEFT:\n game.movePlayer(Direction.W);\n break;\n case MOVE_DOWN:\n game.movePlayer(Direction.S);\n break;\n case MOVE_RIGHT:\n game.movePlayer(Direction.E);\n break;\n }\n } catch (Exception ignored) { }\n }", "public void handleItemMovements() {\n\t\tfor (MovingItem item : currentScene.getMovingItems()) {\n\t\t\tmoveItemX(item);\n\t\t\tmoveItemY(item);\n\t\t\tif (nextScene != null) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\titem.simulateGravity();\n\n\t\t\tif (item.getTranslateXProperty().get() < 0 || item.getTranslateYProperty().get() > currentScene.getHeight() || item.getTranslateYProperty().get() < 0 || item.getTranslateXProperty().get() > currentScene.getWidth()) {\n\t\t\t\titemsToDelete.add(item);\n\t\t\t}\n\t\t\tif (item instanceof Projectile) {\n\t\t\t\tif (((Projectile) item).traveledFullDistance()) itemsToDelete.add(item);\n\t\t\t}\n\t\t\tif (item instanceof Enemy) {\n\t\t\t\tif (((Enemy) item).shouldJump() && item.canJump()) {\n\t\t\t\t\titem.jump();\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (item instanceof ProjectileHurler) {\n\t\t\t\tProjectileHurler hurler = (ProjectileHurler) item;\n\t\t\t\tif (hurler.canFire()) {\n\t\t\t\t\titemsToAdd.add(hurler.fire());\n\t\t\t\t\thurler.resetProjectileCooldown();\n\t\t\t\t} else\n\t\t\t\t\thurler.decrementProjectileCooldownTimer();\n\t\t\t}\n\t\t}\n\t\titemsToDelete.forEach(item -> currentScene.removeItem(item));\n\t\titemsToDelete.clear();\n\t\titemsToAdd.forEach(item -> currentScene.addItem(item));\n\t\titemsToAdd.clear();\n\t\tif (nextScene != null) setCurrentScene();\n\t}", "void onMoveTaken(Piece captured);", "public boolean moveNext(\n )\n {\n // Scanning the current graphics object...\n ContentObject currentObject = getCurrent();\n if(currentObject != null)\n {\n \t\n \tString cmdStr = currentObject.toString();\n \t/*\n \tif(cmdStr.contains(\"f*\") || cmdStr.contains(\"{f }\")) {\n \t\tSystem.out.println(cmdStr);\n \t}\n \t*/\n \tif(!cmdStr.contains(\"{re [36, 270, 540, 720]}, {f }\")) {\n \t\tcurrentObject.scan(state);\n \t}\n }\n\n // Moving to the next object...\n if(index < objects.size())\n {index++; refresh();}\n\n return getCurrent() != null;\n }", "public void finalizeMove() {\n return;\n }", "public void Obstaclemove() {\n for (int i = 0; i < getNumberObstacles(); i++) {\n if (ObstacleDeplace.class.isInstance(getObstacle()[i])) {\n getObstacle()[i].setX(getObstacle()[i].getX() - getObstacle()[i].getSpeed());\n\n if (getObstacle()[i].getX() < -200) {\n getObstacle()[i].setX(600);\n getObstacle()[i].setSpeed(randomGenerator.nextFloat());\n }\n }\n setChanged();\n notifyObstacle(i, getObstacle()[i].getX(), getObstacle()[i].getY());\n }\n }", "protected void onMove() {\r\n }", "private void moveRobots() {\n\t\tfor(Player p : playerList) {\n\t\t\tif(p.getType() == Player.PlayerType.Robot) {\n\t\t\t\tPoint old = new Point(p.getX(), p.getY());\n\t\t\t\tPoint newPoint = new Point(p.getX(), p.getY());\n\t\t\t\t\n\t\t\t\toccupiedPositions.remove(old);\n\t\t\t\t\n\t\t\t\tint playerX = p.getPlayerToFollow().getX();\n\t\t\t\tint playerY = p.getPlayerToFollow().getY();\n\t\t\t\t\n\t\t\t\t//move towards the agent\n\t\t\t\tif(p.getX() < playerX)\n\t\t\t\t\tnewPoint.x += 1;\n\t\t\t\telse if(p.getX() > playerX)\n\t\t\t\t\tnewPoint.x -= 1;\n\t\t\t\t\n\t\t\t\tif(p.getY() < playerY)\n\t\t\t\t\tnewPoint.y += 1;\n\t\t\t\telse if(p.getY() > playerY)\n\t\t\t\t\tnewPoint.y -= 1;\n\t\t\t\t\n\t\t\t\tp.setPosition(newPoint);\n\t\t\t\t\n\t\t\t\t//check if the robot has moved on to something\n\t\t\t\tif(occupiedPositions.contains(newPoint)) { \t\t// check if the position is occupied\n\t\t\t\t\tfor(Player p2 : playerList) { \t\t\t\n\t\t\t\t\t\tif(!p.getName().equals(p2.getName())) {\t// check so it not is the robot itself\n\t\t\t\t\t\t\tif(newPoint.equals(p2.getPosition())) {\n\t\t\t\t\t\t\t\tif(p2.getType() == PlayerType.Robot) { // if it is a robot, both should be rubble\n\t\t\t\t\t\t\t\t\tp2.setType(PlayerType.Rubble);\n\t\t\t\t\t\t\t\t\tp2.getPlayerToFollow().decreaseRobotsFollowing();\n\t\t\t\t\t\t\t\t\tp.setType(PlayerType.Rubble);\n\t\t\t\t\t\t\t\t\tp.getPlayerToFollow().decreaseRobotsFollowing();\n\t\t\t\t\t\t\t\t\tHandleCommunication.broadcastToClient(null, server.getConnectedClientList(), SendSetting.ChangedType, p.getName(), p2.getName());\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif(p2.getType() == PlayerType.Rubble) { // if it is rubble\n\t\t\t\t\t\t\t\t\tp.setType(PlayerType.Rubble);\n\t\t\t\t\t\t\t\t\tp.getPlayerToFollow().decreaseRobotsFollowing();\n\t\t\t\t\t\t\t\t\tHandleCommunication.broadcastToClient(null, server.getConnectedClientList(), SendSetting.ChangedType, p.getName(), p2.getName());\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if(p2.getType() == PlayerType.Agent) {\n\t\t\t\t\t\t\t\t\tString send = generateSendableHighscoreList();\n\t\t\t\t\t\t\t\t\tserver.sendMessageToClient(p2.getName(), \"@132@\" + highscore.size() + \"@\" + send);\n\t\t\t\t\t\t\t\t\tserver.addTextToLoggingWindow(\"Robot killed player (\" + p2.getName() + \")\");\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\t\n\t\t\t\toccupiedPositions.add(newPoint);\n\t\t\t\tserver.broadcastToClient(p.getName(), SendSetting.PlayerMoved, old, newPoint);\n\t\t\t}\t\n\t\t}\n\t\t\n\t\t//send that it is agents turn again\n\t\tserver.broadcastToClient(null, SendSetting.AgentsTurnToMove, null, null);\n\t}", "public abstract void doPerMoveWork();", "void move(Tile t);", "private void move(){\n \n currentAnimation = idleDown;\n \n if(playerKeyInput.allKeys[VK_W]){\n int ty = (int) (objectCoordinateY - speed + bounds.y) / 16;\n \n if(!collisionDetection((int) (objectCoordinateX + bounds.x)/16, ty)){\n objectCoordinateY -= speed;\n currentAnimation = upWalk;\n }\n } \n \n if(playerKeyInput.allKeys[VK_S]){\n int ty = (int) (objectCoordinateY + speed + bounds.y + bounds.height) / 16;\n if(!collisionDetection((int) (objectCoordinateX + bounds.x)/16, ty)){\n objectCoordinateY += speed;\n currentAnimation = downWalk;\n }\n } \n \n if(playerKeyInput.allKeys[VK_A]){\n int tx = (int) (objectCoordinateX - speed + bounds.x) / 16;\n if(!collisionDetection(tx, (int) (objectCoordinateY + bounds.y)/16)){\n objectCoordinateX -= speed;\n currentAnimation = sideWalkLeft;\n }\n } \n \n if(playerKeyInput.allKeys[VK_D]){\n int tx = (int) (objectCoordinateX + speed + bounds.x + bounds.width) / 16;\n if(!collisionDetection(tx, (int) (objectCoordinateY + bounds.y)/16)){\n objectCoordinateX += speed;\n currentAnimation = sideWalkRight;\n }\n } \n \n if(playerKeyInput.allKeys[VK_E]){\n currentAnimation = pickUp;\n } \n }", "@Override\r\n public void move(int deltaX, int deltaY) {\r\n\r\n for(IShape shape : children) {\r\n shape.move(deltaX,deltaY);\r\n }\r\n }", "public void move() {\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t}", "void doneMoving();", "public void map() {\n\t\tfor(GameObject object : gameObject)\n\t\t\tSystem.out.println(object);\n\t}", "public List<Blockade> move(PlayingPiece playingPiece, List<Card> cards, HexSpace moveTo) {\n System.out.println(\"Executing move\");\n System.out.println(myTurn());\n\n // is it the players turn\n if (!myTurn()) {\n return new ArrayList<>();\n }\n // are the cards in the hand\n for (Card card : cards) {\n if (!this.handPile.contains(card)) {\n System.out.println(\"hand wrong\");\n return new ArrayList<>();\n }\n }\n // does the player own this playingpiece\n if (!this.playingPieces.contains(playingPiece)) {\n return new ArrayList<>();\n }\n this.removableBlockades = new ArrayList<>(); // parentblockadesID the player can remove in this turn\n Memento memento = board.getMemento();\n // validates if cards and playingpieces are the same for wich the pathfinder was exectued, if not redo pathfinder\n if (!(playingPiece == memento.getPlayingPiece() && cards.equals(memento.getSelectedCards()))) {\n Pathfinder.getWay(board, cards, playingPiece);\n }\n Set<HexSpace> reachables = new HashSet<>(memento.getReachables());\n System.out.println(reachables);\n if (reachables.contains(moveTo)) {\n System.out.println(\"reachables Contains moveto\");\n HexSpace oldPosition = playingPiece.getStandsOn();\n playingPiece.setStandsOn(moveTo);\n for (Card card : cards) {\n card.moveAction(this, moveTo); // for history\n }\n for (HexSpace hexSpace : moveTo.getPrevious()) {\n if (hexSpace.getClass() == BlockadeSpace.class && hexSpace.getStrength() != 0) {\n // if you directly move over blockade\n autoRemoveBlockade(((BlockadeSpace) hexSpace).getParentBlockade());\n }\n }\n searchForRemovableBlockades(playingPiece, cards, moveTo, oldPosition);\n this.board.getMemento().reset(this.board); // reset memento after moving\n }\n if (playingPiece.getStandsOn().getColor() == COLOR.ENDFIELDJUNGLE ||\n playingPiece.getStandsOn().getColor() == COLOR.ENDFIELDRIVER) {\n if (board.getElDoradoSpaces().size() > 0) {\n playingPiece.setStandsOn(board.getElDoradoSpaces().get(0));\n board.getElDoradoSpaces().remove(board.getElDoradoSpaces().get(0));\n //List<HexSpace> newEldoradoSpaces = board.getElDoradoSpaces().subList(0,Math.max(board.getElDoradoSpaces().size()-2,0));\n //board.setElDoradoSpaces(newEldoradoSpaces);\n }\n boolean won = true;\n for (PlayingPiece piece : this.playingPieces) {\n won = won && (piece.getStandsOn().getColor() == COLOR.ELDORADO || piece == playingPiece);\n }\n if (won) {\n this.board.getWinners().add(this);\n }\n }\n return new ArrayList<>(blockadeIdsToBlockades(this.removableBlockades));\n }", "boolean doMove();", "public interface Moveable {\n\n void move();\n\n}", "private void shootMove() {\n for (int i = 0; i < fires.size(); i++) {\n //子弹往上移动\n fires.get(i).move();\n //注意这里remove需要放在下面\n if (fires.get(i).y < -1000) {\n fires.remove(fires.get(i));\n }\n }\n\n }", "abstract void move();", "private void moveInvaders() {\n\t\tfor (ArrayList<Invader> row : enemyArray) {\n\t\t\tfor (Invader a : row) {\n\t\t\ta.move();\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor (ArrayList<Invader> row : enemyArray) {\n\t\t\tfor (Invader a : row) {\n\t\t\t\tif (a.getVisibility()) {\n\t\t\t\t\t\n\t\t\t\t\tcheckLeftWall(a);\n\t\t\t\t\tcheckRightWall(a);\n\t\t\t\t\t\n\t\t\t\t\tif ((a.getY() + PLAYER_WIDTH) >= HEIGHT) {\n\t\t\t\t\t\trunning = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public void moveAllAgents() {\n\t\tPoint moveTo \t\t= null;\n\t\tGameClient client \t= null;\n\t\t\n\t\tfor(Player p : playerList) {\n\t\t\tif(p.getType() == PlayerType.Agent) {\n\t\t\t\tclient = HandleCommunication.findClient(p.getName(), server.getConnectedClientList());\n\t\t\t\tmoveTo = getSafeTeleportPosition();\n\t\t\t\tmovePlayer(p.getName(), p.getPosition(), moveTo, false);\n\t\t\t\tserver.sendMessageToClient(client.getClientSocket(), \"@124@\" + moveTo.x + \"@\" + moveTo.y + \"@\");\n\t\t\t}\n\t\t}\n\t}", "public void move()\n\t{\n\t\tVector v = ship.v;\n\t\tb = b.getLocation().add(v).getBlock();\n\t\tif(triangle != null) triangle.move();\n\t\tif(rear != null) rear.move();\n\t\tif(foreAndAft != null) foreAndAft.move();\n\t\tif(sails != null) for(int i = 0; i < sails.size(); i++)\n\t\t{\n\t\t\tSail sail = sails.get(i);\n\t\t\tsail.move();\n\t\t}\n\t}", "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 void tick()\n\t{\n\t\tgameTime++;\n\t\tif(gameTime == 1)\n\t\t\taddPlayerShip();\n\t\tIIterator iter = gameObj.getIterator();\n\t\twhile(iter.hasNext())\n\t\t{\n\t\t\tGameObject current = (GameObject)iter.getNext();\n\t\t\tif (current instanceof Imovable)\n\t\t\t\t((MovableObject)current).move(fps);\n\t\t\tif (current instanceof SpaceStation)\n\t\t\t\t((SpaceStation)current).checkBlink(gameTime);\n\t\t\tif(current instanceof Missile)\n\t\t\t\tif(((Missile) current).getFuel() <= 0)\n\t\t\t\t\titer.remove();\n\t\t}\n\t\t\n\t\t//Identify collision\n\t\titer = gameObj.getIterator();\n\t\twhile(iter.hasNext())\n\t\t{\n\t\t\tICollider curObj = (ICollider)iter.getNext();\n\t\t\t\n\t\t\tIIterator iter2 = gameObj.getIterator();\n\t\t\twhile(iter2.hasNext())\n\t\t\t{\n\t\t\t\tICollider otherObj = (ICollider)iter2.getNext();\n\t\t\t\tif(otherObj != curObj)\n\t\t\t\t\tif(curObj.collidesWith(otherObj))\n\t\t\t\t\t\tif (curObj instanceof PlayerShip)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcollisionVectorPS.add(curObj);\n\t\t\t\t\t\t\tcollisionVectorPS.add(otherObj);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(curObj instanceof NonPlayerShip)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcollisionVectorNPS.add(curObj);\n\t\t\t\t\t\t\tcollisionVectorNPS.add(otherObj);\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(curObj instanceof Asteroid)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(collisionVectorAsteroid.isEmpty())\n\t\t\t\t\t\t\t\tcollisionVectorAsteroid.add(curObj);\n\t\t\t\t\t\t\tcollisionVectorAsteroid.add(otherObj);\t\t\t\n\t\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//Handle Collisions for playership\n\t\tif(!collisionVectorPS.isEmpty())\n\t\t{\n\t\t\t//return iterator for collion vector\n\t\t\tIterator<ICollider> psIterator = collisionVectorPS.iterator();\n\t\t\tICollider ship = collisionVectorPS.elementAt(0);\n\t\t\twhile(psIterator.hasNext())\n\t\t\t{\n\t\t\t\tICollider curObj = psIterator.next();\n\t\t\t\tif(curObj != ship)\n\t\t\t\t\tship.handleCollision(curObj);\n\t\t\t\t\n\t\t\t\t//if an asteroid is detected\n\t\t\t\tif(curObj instanceof Asteroid)\n\t\t\t\t\tcrashAsteroidPS(psIterator,curObj,ship);\n\t\t\t\t\n\t\t\t\t//if an enemy missile is detected\n\t\t\t\telse if(curObj instanceof Missile && ((Missile)curObj).isEnemy())\n\t\t\t\t\tPSShot(psIterator,curObj,ship);\n\t\t\t\t\n\t\t\t\t//if a non player ship is detected\n\t\t\t\telse if(curObj instanceof NonPlayerShip)\n\t\t\t\t\tthis.crashNPS(psIterator,curObj,ship);\n\t\t\t\t\n\t\t\t\telse if(curObj instanceof SpaceStation)\n\t\t\t\t\tthis.refillMissiles(psIterator,curObj,ship);\n\t\t\t}\n\t\t\t//clear the collision vector and spawn a new ship\n\t\t\tcollisionVectorPS.clear();\n\t\t\t\n\t\t}\n\t\tif(!collisionVectorNPS.isEmpty())\n\t\t{\n\t\t\t//return iterator for collion vector\n\t\t\tIterator<ICollider> npsIterator = collisionVectorNPS.iterator();\n\t\t\tICollider nps = collisionVectorNPS.elementAt(0);\n\t\t\twhile(npsIterator.hasNext())\n\t\t\t{\n\t\t\t\tICollider curObj = npsIterator.next();\n\t\t\t\tif(curObj != nps)\n\t\t\t\t\tnps.handleCollision(curObj);\n\t\t\t\tif(curObj instanceof Missile && !((Missile)curObj).isEnemy())\n\t\t\t\t\tthis.NPSShot(npsIterator,curObj,nps);\n\t\t\t\telse if(curObj instanceof Asteroid)\n\t\t\t\t\tthis.crashAsteroidNPS(npsIterator,curObj,nps);\n\t\t\t\telse if(curObj instanceof SpaceStation)\n\t\t\t\t\tthis.refillMissiles(npsIterator,curObj,nps);\n\t\t\t}\n\t\t\tcollisionVectorNPS.clear();\n\t\t}\n\t\tif(!collisionVectorAsteroid.isEmpty())\n\t\t{\n\t\t\tIterator<ICollider> astIterator = collisionVectorAsteroid.iterator();\n\t\t\tICollider ast = collisionVectorAsteroid.elementAt(0);\n\t\t\twhile(astIterator.hasNext())\n\t\t\t{\n\t\t\t\tICollider curObj = astIterator.next();\n\t\t\t\tif(curObj != ast)\n\t\t\t\t\tast.handleCollision(curObj);\n\t\t\t\tif(curObj instanceof Missile && !((Missile)curObj).isEnemy())\n\t\t\t\t\tthis.asteroidShot(astIterator,curObj,ast);\n\t\t\t\telse if(curObj instanceof Asteroid && curObj != ast)\n\t\t\t\t\tthis.asteroidCol(astIterator,curObj,ast);\n\t\t\t}\n\t\t\tcollisionVectorAsteroid.clear();\n\t\t}\n\t\t//delete collided objects\n\t\tIterator<ICollider> trashIterator = trash.iterator();\n\t\twhile (trashIterator.hasNext())\n\t\t{\n\t\t\tICollider curObj = trashIterator.next();\n\t\t\tremove(curObj);\n\t\t}\n\t\tnotifyObservers();\n\t}", "public void getMovements()\n {\n if(\n Greenfoot.isKeyDown(\"Up\")||Greenfoot.isKeyDown(\"W\")||\n Greenfoot.isKeyDown(\"Down\")||Greenfoot.isKeyDown(\"S\")||\n Greenfoot.isKeyDown(\"Right\")||Greenfoot.isKeyDown(\"D\")||\n Greenfoot.isKeyDown(\"Left\") ||Greenfoot.isKeyDown(\"A\")||\n getWorld().getObjects(Traps.class).isEmpty() == false //car trap engendre un mouvement sans les touches directionnelles\n )\n {\n isMoved = true;\n }\n else{isMoved = false;}\n }", "void positionLoaded(List<Move> orderedMoves);", "public interface Traversable\n{\npublic boolean reset();\n\npublic Player getPlayer();\n\npublic Room[] getAllRooms();\n\npublic MazeRef getMazeSize();\n\npublic Room getRoom(MazeRef location);\n\npublic boolean move(String exitPointName) throws GameException;\n}", "public void makeMove() {\n ArrayList<Field> myFields = new ArrayList<>();\n for (Field[] fieldsRow : fields) {\n for (Field field : fieldsRow) {\n if(field != null && this.equals(field.getPlayer())) {\n myFields.add(field);\n }\n }\n }\n bestMove[0] = myFields.get(0);\n bestMove[1] = myFields.get(0);\n\n Random rand = new Random();\n for(Field destination : destinationFields) {\n if(canMove()) break;\n destinationField = destination;\n for (Field origin : myFields) {\n for(int i = 0; i < origin.getNeighbours().length; ++i) {\n Field neighbour = origin.getNeighbours()[i];\n if(neighbour != null) {\n if(neighbour.getPlayer() == null) {\n if(valueOfMove(origin, neighbour) > valueOfMove(bestMove[0], bestMove[1])) {\n bestMove[0] = origin;\n bestMove[1] = neighbour;\n } else if(valueOfMove(origin, neighbour) == valueOfMove(bestMove[0], bestMove[1])) {\n if(rand.nextBoolean()) {\n bestMove[0] = origin;\n bestMove[1] = neighbour;\n }\n }\n } else {\n Field nextField = neighbour.getNeighbours()[i];\n if(nextField != null) {\n correctJumpPaths(origin,null, origin);\n }\n }\n }\n }\n }\n }\n }", "@Override\r\n\tpublic void move() {\n\t\tPoint target = strategy.search(this.getLocation(), new Point(0,0));\r\n\r\n\t\tint tries = 0;\r\n\t\t\r\n\t\twhile(!state.equals(\"Inactive\") && !game.movement(this, target.x, target.y)){\r\n\t\t\ttarget = strategy.search(new Point(x,y),playerLocation);\r\n\t\t\ttries++;\r\n\t\t\tif(tries > 4) return; // the search strategy has 4 tries to pick a valid location to move to\r\n\t\t}\r\n\t\t\r\n\t\tx = target.x;\r\n\t\ty = target.y;\r\n\r\n\t\tmoveSprite();\r\n\t}", "public abstract void Move();", "boolean prepareToMove();", "public boolean isValidMultiplayerMove(int xMove, int yMove, ArrayList<Entity> objects, \r\n ArrayList<NonPlayerCharacter> npcs, ArrayList<Item> items, World world){\n for (int i = 0; i < objects.size(); i++)//collisioned an object\r\n {\r\n if (x + xMove == objects.get(i).getX() && y + yMove == objects.get(i).getY()) {\r\n objects.get(i).setCollisioned(true);\r\n return false;\r\n } else {\r\n objects.get(i).setCollisioned(false);\r\n }\r\n }\r\n\r\n //ArrayList<NonPlayerCharacter> npcs = ((GameState) game.getGameState()).getNpcs();\r\n for (int i = 0; i < npcs.size(); i++) {\r\n if (x + xMove == npcs.get(i).getX() && y + yMove == npcs.get(i).getY()) {\r\n npcs.get(i).setCollisioned(true);\r\n return false;\r\n }\r\n }\r\n\r\n //ArrayList<Item> items = ((GameState) game.getGameState()).getItems();\r\n for (int i = 0; i < items.size(); i++) {\r\n if (x + xMove == items.get(i).getX() && y + yMove == items.get(i).getY()) {\r\n items.get(i).setCollisioned(true);\r\n return false;\r\n }\r\n }\r\n\r\n /*if (((GameState) game.getGameState()).getWorld().getTile((int) (x + xMove), (int) (y + yMove)).isSolid()) {\r\n return false;\r\n }*/\r\n if (world.getTile((int) (x + xMove), (int) (y + yMove)).isSolid()) {\r\n return false;\r\n }\r\n \r\n if (world.getTile((int) (x + xMove), (int) (y + yMove)).getId() == 2) {\r\n return false;\r\n }\r\n\r\n /*if (x + xMove == ((GameState) game.getGameState()).getPlayer().getX()\r\n && y + yMove == ((GameState) game.getGameState()).getPlayer().getY()) {\r\n return false;\r\n }*/\r\n return true;\r\n }", "void smallgunHandler() {\n for (Sprite smb: smBullets) {\n \n smb.display();\n if(usingCoil){\n smb.forward(120);\n }else{\n smb.forward(40);\n }\n\n }\n}", "public void update()\n\t{\n\t\tgameTime++;\n\t\tfor(int i = 0; i<gameObj.length; i++)\n\t\t{\n\t\t\tfor(int j = 0; j < gameObj[i].size(); j++)\n\t\t\t{\n\t\t\t\t/*If the object implements movable\n\t\t\t\t * call the move method in each object\n\t\t\t\t */\n\t\t\t\tif(gameObj[i].get(j) instanceof Imovable)\n\t\t\t\t\t((MovableObject)gameObj[i].get(j)).move();\n\t\t\t\t/*call CheckBlink() method in SpaceStation\n\t\t\t\t * if the time % blinkRate == 0\n\t\t\t\t * the visibility with be switched\n\t\t\t\t */\n\t\t\t\tif(gameObj[i].get(j) instanceof SpaceStation)\n\t\t\t\t\t((SpaceStation)gameObj[i].get(j)).checkBlink(gameTime);\n\t\t\t\t/*check if missiles are out of fuel\n\t\t\t\tand remove if fuel = 0\n\t\t\t\t*/\n\t\t\t\tif(gameObj[i].get(j) instanceof Missile)\n\t\t\t\t\tif(((Missile)gameObj[i].get(j)).getFuel() <= 0)\n\t\t\t\t\t\tgameObj[i].remove(j);\n\t\t\t}\n\t\t}\t\t\n\t\tSystem.out.println(\"World updated\");\n\t}", "@Override\n public void doMove(List<ICrosser> crossers, boolean fromLeftToRightBank) {\n\n }", "public synchronized boolean MoveThatFigure(Figures.Color color, Figures.Type typ, Point pozice, Point direction, ArrayList<ModelObject> objekty) {\n for (Object obj : objekty) {\r\n objectsForMovement.add((ModelObject) obj);\r\n }\r\n\r\n Point pomPozice = new Point(pozice);\r\n Point pomDirxM = new Point(direction);\r\n Point pomDiryM = new Point(direction);\r\n Point pomDirxP = new Point(direction);\r\n Point pomDiryP = new Point(direction);\r\n Point BeforeLast = new Point();\r\n\r\n pomDirxM.x = pomDirxM.x - 1;\r\n pomDiryM.y = pomDiryM.y - 1;\r\n pomDirxP.x = pomDirxP.x + 1;\r\n pomDiryP.y = pomDiryP.y + 1;\r\n\r\n if (color == Figures.Color.White) {\r\n if (typ == Figures.Type.Pawn) {\r\n if ((direction.x == pozice.x && direction.y == pozice.y - 1)\r\n && free.isFree(direction, objectsForMovement)) {\r\n side = false;\r\n return true;\r\n }\r\n if ((direction.x == pozice.x - 1 && direction.y == pozice.y - 1\r\n || direction.x == pozice.x + 1 && direction.y == pozice.y - 1)\r\n && !free.isFree(direction, objectsForMovement)) {\r\n side = false;\r\n this.pawnTaking = true;\r\n return true;\r\n }\r\n }\r\n\r\n if (typ == Figures.Type.Rook) {\r\n // if ((CanTake(direction, Figures.Color.Black)) || free.isFree(direction, objectsForMovement)) {\r\n if (pozice.equals(pomDirxM)) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.equals(pomDirxP)) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.equals(pomDiryM)) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.equals(pomDiryP)) {\r\n side = false;\r\n return true;\r\n } else {\r\n do {\r\n if ((direction.x == pomPozice.x && direction.y >= pomPozice.y)) {\r\n pomPozice.y = pomPozice.y + 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast = pomDiryM;\r\n } else if (direction.x == pomPozice.x && direction.y <= pomPozice.y) {\r\n pomPozice.y = pomPozice.y - 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast = pomDiryP;\r\n } else if (direction.x <= pomPozice.x && direction.y == pomPozice.y) {\r\n pomPozice.x = pomPozice.x - 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast = pomDirxP;\r\n } else if (direction.x >= pomPozice.x && direction.y == pomPozice.y) {\r\n pomPozice.x = pomPozice.x + 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast = pomDirxM;\r\n }\r\n if (mahmadan == false) {\r\n break;\r\n }\r\n\r\n } while ((pomPozice.x != BeforeLast.x) || (pomPozice.y != BeforeLast.y));\r\n if (mahmadan == true) {\r\n side = false;\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n }\r\n // }\r\n\r\n if (typ == Figures.Type.Knight) {\r\n // if ((CanTake(direction, Figures.Color.Black)) || free.isFree(direction, objectsForMovement)) {\r\n if ((direction.x == pozice.x + 2 && direction.y == pozice.y - 1)\r\n || (direction.x == pozice.x - 2 && direction.y == pozice.y - 1)\r\n || (direction.x == pozice.x - 2 && direction.y == pozice.y + 1)\r\n || (direction.x == pozice.x + 2 && direction.y == pozice.y + 1)\r\n || (direction.x == pozice.x + 1 && direction.y == pozice.y + 2)\r\n || (direction.x == pozice.x + 1 && direction.y == pozice.y - 2)\r\n || (direction.x == pozice.x - 1 && direction.y == pozice.y - 2)\r\n || (direction.x == pozice.x - 1 && direction.y == pozice.y + 2)) {\r\n side = false;\r\n return true;\r\n }\r\n }\r\n // }\r\n\r\n if (typ == Figures.Type.Bishop) {\r\n // if ((CanTake(direction, Figures.Color.Black)) || free.isFree(direction, objectsForMovement)) {\r\n if (Math.abs(pozice.x - direction.x) == Math.abs(pozice.y - direction.y)) {\r\n if (pozice.x == pomDirxM.x && pozice.y == pomDiryM.y) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.x == pomDirxP.x && pozice.y == pomDiryP.y) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.x == pomDiryM.x && pozice.y == pomDiryP.y) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.x == pomDiryP.x && pozice.y == pomDiryM.y) {\r\n side = false;\r\n return true;\r\n } else {\r\n do {\r\n if (direction.x >= pozice.x && direction.y >= pozice.y) {\r\n pomPozice.y = pomPozice.y + 1;\r\n pomPozice.x = pomPozice.x + 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast.x = pomDirxM.x;\r\n BeforeLast.y = pomDiryM.y;\r\n } else if (direction.x <= pozice.x && direction.y >= pozice.y) {\r\n pomPozice.y = pomPozice.y + 1;\r\n pomPozice.x = pomPozice.x - 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast.x = pomDirxP.x;\r\n BeforeLast.y = pomDiryM.y;\r\n } else if (direction.x <= pozice.x && direction.y <= pozice.y) {\r\n pomPozice.y = pomPozice.y - 1;\r\n pomPozice.x = pomPozice.x - 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast.x = pomDirxP.x;\r\n BeforeLast.y = pomDiryP.y;\r\n } else if (direction.x >= pozice.x && direction.y <= pozice.y) {\r\n pomPozice.y = pomPozice.y - 1;\r\n pomPozice.x = pomPozice.x + 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast.x = pomDirxM.x;\r\n BeforeLast.y = pomDiryP.y;\r\n }\r\n if (mahmadan == false) {\r\n break;\r\n }\r\n } while ((pomPozice.x != BeforeLast.x) && (pomPozice.y != BeforeLast.y));\r\n if (mahmadan == true) {\r\n side = false;\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n // }\r\n\r\n if (typ == Figures.Type.Queen) {\r\n // if ((CanTake(direction, Figures.Color.Black)) || free.isFree(direction, objectsForMovement)) {\r\n if (pozice.equals(pomDirxM)) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.equals(pomDirxP)) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.equals(pomDiryM)) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.equals(pomDiryP)) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.x == pomDirxM.x && pozice.y == pomDiryM.y) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.x == pomDirxP.x && pozice.y == pomDiryP.y) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.x == pomDiryM.x && pozice.y == pomDiryP.y) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.x == pomDiryP.x && pozice.y == pomDiryM.y) {\r\n side = false;\r\n return true;\r\n } else {\r\n if (((direction.x >= pozice.x && direction.y >= pozice.y)\r\n || (direction.x <= pozice.x && direction.y >= pozice.y)\r\n || (direction.x <= pozice.x && direction.y <= pozice.y)\r\n || (direction.x >= pozice.x && direction.y <= pozice.y))\r\n && (Math.abs(pozice.x - direction.x) == Math.abs(pozice.y - direction.y))) {\r\n do {\r\n if (direction.x >= pozice.x && direction.y >= pozice.y) {\r\n pomPozice.y = pomPozice.y + 1;\r\n pomPozice.x = pomPozice.x + 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast.x = pomDirxM.x;\r\n BeforeLast.y = pomDiryM.y;\r\n } else if (direction.x <= pozice.x && direction.y >= pozice.y) {\r\n pomPozice.y = pomPozice.y + 1;\r\n pomPozice.x = pomPozice.x - 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast.x = pomDirxP.x;\r\n BeforeLast.y = pomDiryM.y;\r\n } else if (direction.x <= pozice.x && direction.y <= pozice.y) {\r\n pomPozice.y = pomPozice.y - 1;\r\n pomPozice.x = pomPozice.x - 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast.x = pomDirxP.x;\r\n BeforeLast.y = pomDiryP.y;\r\n } else if (direction.x >= pozice.x && direction.y <= pozice.y) {\r\n pomPozice.y = pomPozice.y - 1;\r\n pomPozice.x = pomPozice.x + 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast.x = pomDirxM.x;\r\n BeforeLast.y = pomDiryP.y;\r\n }\r\n if (mahmadan == false) {\r\n break;\r\n }\r\n } while ((pomPozice.x != BeforeLast.x) && (pomPozice.y != BeforeLast.y));\r\n if ((Math.abs(pozice.x - direction.x) == Math.abs(pozice.y - direction.y)) && mahmadan == true) {\r\n side = false;\r\n return true;\r\n }\r\n }\r\n if ((direction.x == pozice.x && direction.y >= pozice.y)\r\n || (direction.x == pozice.x && direction.y <= pozice.y)\r\n || (direction.x <= pozice.x && direction.y == pozice.y)\r\n || (direction.x >= pozice.x && direction.y == pozice.y)) {\r\n do {\r\n if ((direction.x == pomPozice.x && direction.y >= pomPozice.y)) {\r\n pomPozice.y = pomPozice.y + 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast = pomDiryM;\r\n } else if (direction.x == pomPozice.x && direction.y <= pomPozice.y) {\r\n pomPozice.y = pomPozice.y - 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast = pomDiryP;\r\n } else if (direction.x <= pomPozice.x && direction.y == pomPozice.y) {\r\n pomPozice.x = pomPozice.x - 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast = pomDirxP;\r\n } else if (direction.x >= pomPozice.x && direction.y == pomPozice.y) {\r\n pomPozice.x = pomPozice.x + 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast = pomDirxM;\r\n }\r\n if (mahmadan == false) {\r\n break;\r\n }\r\n\r\n } while ((pomPozice.x != BeforeLast.x) || (pomPozice.y != BeforeLast.y));\r\n if (mahmadan == true) {\r\n side = false;\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n // }\r\n\r\n if (typ == Figures.Type.King) {\r\n // if ((CanTake(direction, Figures.Color.Black)) || free.isFree(direction, objectsForMovement)) {\r\n if (direction.x == pozice.x && direction.y == pozice.y - 1 || direction.x == pozice.x - 1 && direction.y == pozice.y - 1\r\n || direction.x == pozice.x && direction.y == pozice.y + 1 || direction.x == pozice.x - 1 && direction.y == pozice.y + 1\r\n || direction.x == pozice.x + 1 && direction.y == pozice.y || direction.x == pozice.x + 1 && direction.y == pozice.y - 1\r\n || direction.x == pozice.x - 1 && direction.y == pozice.y || direction.x == pozice.x + 1 && direction.y == pozice.y + 1) {\r\n side = false;\r\n return true;\r\n }\r\n }\r\n //}\r\n\r\n } else if (color == Figures.Color.Black) {/* && side == false*/\r\n\r\n if (typ == Figures.Type.Pawn) {\r\n if ((direction.x == pozice.x && direction.y == pozice.y + 1)\r\n && free.isFree(direction, objectsForMovement)) {\r\n side = true;\r\n return true;\r\n }\r\n if (CanTake(direction, Figures.Color.White)) {\r\n if ((direction.x == pozice.x - 1 && direction.y == pozice.y + 1\r\n || direction.x == pozice.x + 1 && direction.y == pozice.y + 1)\r\n && !free.isFree(direction, objectsForMovement)) {\r\n side = true;\r\n this.pawnTaking = true;\r\n return true;\r\n }\r\n }\r\n }\r\n if (typ == Figures.Type.Rook) {\r\n if ((CanTake(direction, Figures.Color.White)) || free.isFree(direction, objectsForMovement)) {\r\n if (pozice.equals(pomDirxM)) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.equals(pomDirxP)) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.equals(pomDiryM)) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.equals(pomDiryP)) {\r\n side = false;\r\n return true;\r\n } else {\r\n do {\r\n if ((direction.x == pomPozice.x && direction.y >= pomPozice.y)) {\r\n pomPozice.y = pomPozice.y + 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast = pomDiryM;\r\n } else if (direction.x == pomPozice.x && direction.y <= pomPozice.y) {\r\n pomPozice.y = pomPozice.y - 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast = pomDiryP;\r\n } else if (direction.x <= pomPozice.x && direction.y == pomPozice.y) {\r\n pomPozice.x = pomPozice.x - 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast = pomDirxP;\r\n } else if (direction.x >= pomPozice.x && direction.y == pomPozice.y) {\r\n pomPozice.x = pomPozice.x + 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast = pomDirxM;\r\n }\r\n if (mahmadan == false) {\r\n break;\r\n }\r\n\r\n } while ((pomPozice.x != BeforeLast.x) || (pomPozice.y != BeforeLast.y));\r\n if (mahmadan == true) {\r\n side = false;\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (typ == Figures.Type.Knight) {\r\n if ((CanTake(direction, Figures.Color.White)) || free.isFree(direction, objectsForMovement)) {\r\n if ((direction.x == pozice.x + 2 && direction.y == pozice.y - 1)\r\n || (direction.x == pozice.x - 2 && direction.y == pozice.y - 1)\r\n || (direction.x == pozice.x - 2 && direction.y == pozice.y + 1)\r\n || (direction.x == pozice.x + 2 && direction.y == pozice.y + 1)\r\n || (direction.x == pozice.x + 1 && direction.y == pozice.y + 2)\r\n || (direction.x == pozice.x + 1 && direction.y == pozice.y - 2)\r\n || (direction.x == pozice.x - 1 && direction.y == pozice.y - 2)\r\n || (direction.x == pozice.x - 1 && direction.y == pozice.y + 2)) {\r\n side = true;\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n if (typ == Figures.Type.Bishop) {\r\n if (Math.abs(pozice.x - direction.x) == Math.abs(pozice.y - direction.y)) {\r\n if ((CanTake(direction, Figures.Color.White)) || free.isFree(direction, objectsForMovement)) {\r\n if (pozice.x == pomDirxM.x && pozice.y == pomDiryM.y) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.x == pomDirxP.x && pozice.y == pomDiryP.y) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.x == pomDiryM.x && pozice.y == pomDiryP.y) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.x == pomDiryP.x && pozice.y == pomDiryM.y) {\r\n side = false;\r\n return true;\r\n } else {\r\n do {\r\n if (direction.x >= pozice.x && direction.y >= pozice.y) {\r\n pomPozice.y = pomPozice.y + 1;\r\n pomPozice.x = pomPozice.x + 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast.x = pomDirxM.x;\r\n BeforeLast.y = pomDiryM.y;\r\n } else if (direction.x <= pozice.x && direction.y >= pozice.y) {\r\n pomPozice.y = pomPozice.y + 1;\r\n pomPozice.x = pomPozice.x - 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast.x = pomDirxP.x;\r\n BeforeLast.y = pomDiryM.y;\r\n } else if (direction.x <= pozice.x && direction.y <= pozice.y) {\r\n pomPozice.y = pomPozice.y - 1;\r\n pomPozice.x = pomPozice.x - 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast.x = pomDirxP.x;\r\n BeforeLast.y = pomDiryP.y;\r\n } else if (direction.x >= pozice.x && direction.y <= pozice.y) {\r\n pomPozice.y = pomPozice.y - 1;\r\n pomPozice.x = pomPozice.x + 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast.x = pomDirxM.x;\r\n BeforeLast.y = pomDiryP.y;\r\n }\r\n if (mahmadan == false) {\r\n break;\r\n }\r\n } while ((pomPozice.x != BeforeLast.x) && (pomPozice.y != BeforeLast.y));\r\n if ((Math.abs(pozice.x - direction.x) == Math.abs(pozice.y - direction.y)) && mahmadan == true) {\r\n side = false;\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (typ == Figures.Type.Queen) {\r\n if ((CanTake(direction, Figures.Color.White)) || free.isFree(direction, objectsForMovement)) {\r\n if (pozice.equals(pomDirxM)) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.equals(pomDirxP)) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.equals(pomDiryM)) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.equals(pomDiryP)) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.x == pomDirxM.x && pozice.y == pomDiryM.y) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.x == pomDirxP.x && pozice.y == pomDiryP.y) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.x == pomDiryM.x && pozice.y == pomDiryP.y) {\r\n side = false;\r\n return true;\r\n }\r\n if (pozice.x == pomDiryP.x && pozice.y == pomDiryM.y) {\r\n side = false;\r\n return true;\r\n } else {\r\n if (((direction.x >= pozice.x && direction.y >= pozice.y)\r\n || (direction.x <= pozice.x && direction.y >= pozice.y)\r\n || (direction.x <= pozice.x && direction.y <= pozice.y)\r\n || (direction.x >= pozice.x && direction.y <= pozice.y))\r\n && (Math.abs(pozice.x - direction.x) == Math.abs(pozice.y - direction.y))) {\r\n do {\r\n if (direction.x >= pozice.x && direction.y >= pozice.y) {\r\n pomPozice.y = pomPozice.y + 1;\r\n pomPozice.x = pomPozice.x + 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast.x = pomDirxM.x;\r\n BeforeLast.y = pomDiryM.y;\r\n } else if (direction.x <= pozice.x && direction.y >= pozice.y) {\r\n pomPozice.y = pomPozice.y + 1;\r\n pomPozice.x = pomPozice.x - 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast.x = pomDirxP.x;\r\n BeforeLast.y = pomDiryM.y;\r\n } else if (direction.x <= pozice.x && direction.y <= pozice.y) {\r\n pomPozice.y = pomPozice.y - 1;\r\n pomPozice.x = pomPozice.x - 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast.x = pomDirxP.x;\r\n BeforeLast.y = pomDiryP.y;\r\n } else if (direction.x >= pozice.x && direction.y <= pozice.y) {\r\n pomPozice.y = pomPozice.y - 1;\r\n pomPozice.x = pomPozice.x + 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast.x = pomDirxM.x;\r\n BeforeLast.y = pomDiryP.y;\r\n }\r\n if (mahmadan == false) {\r\n break;\r\n }\r\n } while ((pomPozice.x != BeforeLast.x) && (pomPozice.y != BeforeLast.y));\r\n if ((Math.abs(pozice.x - direction.x) == Math.abs(pozice.y - direction.y)) && mahmadan == true) {\r\n side = false;\r\n return true;\r\n }\r\n }\r\n if ((direction.x == pozice.x && direction.y >= pozice.y)\r\n || (direction.x == pozice.x && direction.y <= pozice.y)\r\n || (direction.x <= pozice.x && direction.y == pozice.y)\r\n || (direction.x >= pozice.x && direction.y == pozice.y)) {\r\n do {\r\n if ((direction.x == pomPozice.x && direction.y >= pomPozice.y)) {\r\n pomPozice.y = pomPozice.y + 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast = pomDiryM;\r\n } else if (direction.x == pomPozice.x && direction.y <= pomPozice.y) {\r\n pomPozice.y = pomPozice.y - 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast = pomDiryP;\r\n } else if (direction.x <= pomPozice.x && direction.y == pomPozice.y) {\r\n pomPozice.x = pomPozice.x - 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast = pomDirxP;\r\n } else if (direction.x >= pomPozice.x && direction.y == pomPozice.y) {\r\n pomPozice.x = pomPozice.x + 1;\r\n mahmadan = free.isWayClear(pomPozice, objectsForMovement);\r\n BeforeLast = pomDirxM;\r\n }\r\n if (mahmadan == false) {\r\n break;\r\n }\r\n\r\n } while ((pomPozice.x != BeforeLast.x) || (pomPozice.y != BeforeLast.y));\r\n if (mahmadan == true) {\r\n side = false;\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (typ == Figures.Type.King) {\r\n if ((CanTake(direction, Figures.Color.White)) || free.isFree(direction, objectsForMovement)) {\r\n if (direction.x == pozice.x && direction.y == pozice.y - 1\r\n || direction.x == pozice.x - 1 && direction.y == pozice.y - 1\r\n || direction.x == pozice.x && direction.y == pozice.y + 1\r\n || direction.x == pozice.x - 1 && direction.y == pozice.y + 1\r\n || direction.x == pozice.x + 1 && direction.y == pozice.y\r\n || direction.x == pozice.x + 1 && direction.y == pozice.y - 1\r\n || direction.x == pozice.x - 1 && direction.y == pozice.y\r\n || direction.x == pozice.x + 1 && direction.y == pozice.y + 1) {\r\n side = true;\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n return false;\r\n }", "public void move();", "public void move();", "private void doMoveIfPossible() {\r\n if (selected != null) {\r\n if (picked != null) {\r\n if (picked.doMove(selected.getX(), selected.getY())) {\r\n client1.write(ClientMessages.Move, picked.getPositionInArray(), selected.getX(), selected.getY());\r\n client2.write(ClientMessages.Move, picked.getPositionInArray(), selected.getX(), selected.getY());\r\n }\r\n if (picked.doCapture(selected.getX(), selected.getY())) {\r\n client1.write(ClientMessages.Capture, picked.getPositionInArray(), selected.getX(), selected.getY());\r\n client2.write(ClientMessages.Capture, picked.getPositionInArray(), selected.getX(), selected.getY());\r\n }\r\n CastlingMove castl;\r\n if (picked.getClass() == King.class && ((King) picked).doCastling(castl = getCastlingMove())) {\r\n client1.write(ClientMessages.Castling, castl.getRook().getPositionInArray(), castl.getRookX(), selected.getX());\r\n client2.write(ClientMessages.Castling, castl.getRook().getPositionInArray(), castl.getRookX(), selected.getX());\r\n }\r\n }\r\n }\r\n }", "public abstract void move();", "public abstract void move();", "public abstract void move();", "public abstract void move();", "public abstract void move();", "public abstract void move();", "public abstract void move();", "public void move() {\n for (EnemyFish currEnemyFish : fEnemyFishList) {\n int movespeed = currEnemyFish.getMoveSpeed();\n if (currEnemyFish.isLefty()) {\n currEnemyFish.getSprite().updateX(movespeed);\n } else {\n currEnemyFish.getSprite().updateX(-movespeed);\n }\n }\n }", "public void Move(){\n for(int i = 0; i < moveList.length; i++){\n playerString = \"\";\n switch(moveList[i]) {\n case 1: {\n //TODO: Visited points to others\n System.out.println(\"Moving up!\");\n //Logic for fitness score might need to be moved\n if(!(game.mazeArray[game.playerPosition.getPlayerY() -1][game.playerPosition.getPlayerX()] == 1)){\n playerString.concat(\"game.playerPosition.getPlayerY() - 1 + game.playerPosition.getPlayerX()\");\n if(vistedMoves.contains(playerString)){\n vistedPoints += 2;\n } else {\n freedomPoints += 5;\n vistedMoves.add(playerString);\n }\n } else {\n System.out.println(\"Stuck\");\n wallHugs += 10;\n }\n game.moveUp();\n if(game.checkWin()){\n freedomPoints += 200;\n }\n break;\n }\n case 2: {\n System.out.println(\"Moving left!\");\n if(!(game.mazeArray[game.playerPosition.getPlayerY()][game.playerPosition.getPlayerX() -1] == 1)){\n playerString.concat(\"game.playerPosition.getPlayerY() + game.playerPosition.getPlayerX() -1\");\n if(vistedMoves.contains(playerString)){\n vistedPoints += 2;\n } else {\n freedomPoints += 5;\n vistedMoves.add(playerString);\n }\n } else {\n System.out.println(\"Stuck\");\n wallHugs += 1;\n }\n game.moveLeft();\n if(game.checkWin()){\n freedomPoints += 200;\n }\n break;\n }\n case 3: {\n System.out.println(\"Moving right!\");\n if(!(game.mazeArray[game.playerPosition.getPlayerY()][game.playerPosition.getPlayerX() +1] == 1)){\n playerString.concat(\"game.playerPosition.getPlayerY() + game.playerPosition.getPlayerX() +1\");\n if(vistedMoves.contains(playerString)){\n vistedPoints += 2;\n } else {\n freedomPoints += 5;\n vistedMoves.add(playerString);\n }\n } else {\n System.out.println(\"Stuck\");\n wallHugs += 1;\n }\n game.moveRight();\n if(game.checkWin()){\n freedomPoints += 200;\n }\n break;\n }\n case 4: {\n System.out.println(\"Moving down!\");\n if(!(game.mazeArray[game.playerPosition.getPlayerY() +1][game.playerPosition.getPlayerX()] == 1)){\n playerString.concat(\"game.playerPosition.getPlayerY() + 1 + game.playerPosition.getPlayerX()\");\n if(vistedMoves.contains(playerString)){\n vistedPoints += 2;\n } else {\n freedomPoints += 5;\n vistedMoves.add(playerString);\n }\n freedomPoints += 1;\n } else {\n System.out.println(\"Stuck\");\n wallHugs += 1;\n }\n game.moveDown();\n if(game.checkWin()){\n freedomPoints += 200;\n }\n break;\n }\n default: {\n System.out.println(\"End of line\");\n break;\n //You shouldn't be here mate.\n }\n }\n }\n\n }", "public void moveActors() {\n\t\tfor (int row = 0; row < battlefield.length; row++) {\n\t\t\tfor (int column = 0; column < battlefield.length; column++) {\n\t\t\t\tif (battlefield[row][column].getElf() != null) {\n\t\t\t\t\tbattlefield[row][column].getElf().move(battlefield, row,\n\t\t\t\t\t\t\tcolumn);\n\t\t\t\t}\n\t\t\t\tif (battlefield[row][column].getOrc() != null) {\n\t\t\t\t\tbattlefield[row][column].getOrc().move(battlefield, row,\n\t\t\t\t\t\t\tcolumn);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}", "public void takeTurnsDebug() {\n boolean antFound = false;\n int gridPos = 0;\n while (antFound == false) {\n if (antGrid[gridPos] != null && antGrid[gridPos].getId() == 14) {\n antGrid[gridPos].moving = true;\n antFound = true;\n } else {\n gridPos++;\n }\n }\n \n takeTurn(antGrid[gridPos], gridPos);\n }", "@Override\n public void onMove(boolean absolute) {\n \n }", "public void move() {\n\t\tif ( board.getLevel() == 5 )\n\t\t\tmovementIndex = ( movementIndex + 1 ) % movement.length;\n\t}", "public void act(){\n\t\tTile[] possibleMoves = game.getAllNeighbours(currentPosition);\r\n\t\tTile targetTile = possibleMoves[rng.nextInt(4)];\r\n\t\tmove(targetTile);\r\n\t}", "private void moveRemainingMhos() {\n\t\t\n\t\t//Iterate through every mho's X and Y values\n\t\tfor(int i = 0; i < mhoLocations.size()/2; i++) {\n\t\t\t\n\t\t\t//Assign mhoX and mhoY to the X and Y values of the mho that is currently being tested\n\t\t\tint mhoX = mhoLocations.get(i*2);\n\t\t\tint mhoY = mhoLocations.get(i*2+1);\n\t\t\t\n\t\t\t//Check if there is a fence 1 block away from the mho\n\t\t\tif(newMap[mhoX][mhoY+1] instanceof Fence || newMap[mhoX][mhoY-1] instanceof Fence || newMap[mhoX-1][mhoY] instanceof Fence || newMap[mhoX-1][mhoY+1] instanceof Fence || newMap[mhoX-1][mhoY-1] instanceof Fence || newMap[mhoX+1][mhoY] instanceof Fence || newMap[mhoX+1][mhoY+1] instanceof Fence || newMap[mhoX+1][mhoY-1] instanceof Fence) {\n\t\t\t\t\n\t\t\t\t//Assign the new map location as a Mho\n\t\t\t\tnewMap[mhoX][mhoY] = new BlankSpace(mhoX, mhoY, board);\n\t\t\t\t\n\t\t\t\t//Set the mho's move in the moveList\n\t\t\t\tmoveList[mhoX][mhoY] = Legend.SHRINK;\n\t\t\t\t\n\t\t\t\t//remove each X and Y from mhoLocations\n\t\t\t\tmhoLocations.remove(i*2+1);\n\t\t\t\tmhoLocations.remove(i*2);\n\t\t\t\t\n\t\t\t\t//Call moveRemainingMhos again, because the list failed to be checked through completely\n\t\t\t\tmoveRemainingMhos();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}", "public void turns() {\n\t\tint temp = 0;\n\t\tthis.startOrder();\n\t\tSystem.out.println(\"_______________________________________________\");\n\t\tfor (Player p : this.playerList) {\n\t\t\ttemp++;\n\t\t\tp.play(this);\n\t\t\t//System.out.println(\"Player \" + temp + \"'s melds: \" + p.getMelds());\n\t\t\tSystem.out.println(\"_______________________________________________\");\n\t\t}\n\t}", "public boolean isMoveable() {\n\t\treturn _moveable;\n\t}" ]
[ "0.66834337", "0.66012746", "0.65674216", "0.6537636", "0.64115244", "0.6395218", "0.63849676", "0.6315673", "0.6312731", "0.6312251", "0.6310383", "0.63078076", "0.6302739", "0.6263179", "0.62549436", "0.6204251", "0.61909366", "0.61547506", "0.6113787", "0.60943073", "0.6090929", "0.60897475", "0.60865915", "0.6082254", "0.607514", "0.60512364", "0.6050804", "0.6040407", "0.6035827", "0.6006849", "0.5977174", "0.5973499", "0.5961249", "0.5935008", "0.59176874", "0.59120977", "0.5907531", "0.5895122", "0.58883387", "0.58861756", "0.5873133", "0.5871484", "0.5871306", "0.58699644", "0.5865571", "0.5854269", "0.5843981", "0.5843396", "0.5837925", "0.58227736", "0.5786445", "0.57827705", "0.578023", "0.5778634", "0.5776871", "0.577641", "0.5771651", "0.5761255", "0.57520574", "0.574856", "0.5728425", "0.5723936", "0.5717259", "0.5710436", "0.57058424", "0.5696635", "0.56860256", "0.5684785", "0.568179", "0.56793976", "0.5672895", "0.56540394", "0.56524545", "0.5650389", "0.565009", "0.56498665", "0.5642549", "0.56264377", "0.5624504", "0.56204104", "0.5603079", "0.55949134", "0.55949134", "0.55859774", "0.557925", "0.557925", "0.557925", "0.557925", "0.557925", "0.557925", "0.557925", "0.55736923", "0.55710775", "0.55705345", "0.5561584", "0.5559837", "0.5559598", "0.555221", "0.55517566", "0.5551406", "0.55453974" ]
0.0
-1
go through the hashmap and get the appropriate nodeConnector
public ArrayList<KPoint> getPathPoints(KPoint startPoint, KPoint endPoint, int objectRadius){ double maxConnectionDistanceFromStartAndEndPointsToObstacles = maxConnectionDistanceBetweenObstacles; NodeConnector node = (NodeConnector) nodeMap.get(objectRadius); ArrayList<PathBlockingObstacle> obstacles = (ArrayList)obstaclesMap.get(objectRadius); return pathFinder.calc(startPoint, endPoint, maxConnectionDistanceFromStartAndEndPointsToObstacles, node, obstacles).points; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Connector getConnector(int index);", "Map getConnectionManagerMap();", "private Client findClient() {\n if ( key != null )\n return clientConnections.getConnection(key);\n else { //use keyCluster to find client\n return clientConnections.getConnection( keyCluster.getCluster(), keyCluster.getIndex());\n }\n }", "UUID getConnectorId();", "private void setNodeConnectors(){\n for (MoveableObject moveableObject : gameObjects.getMoveableObjectsList()) {\r\n // if the hashmap doesn't contain that radius then make the nodes\r\n if (!nodeMap.containsKey(moveableObject.getObjectRadius())){\r\n bufferedStationaryObstacles = new ArrayList();\r\n bufferedNodeConnector = new NodeConnector();\r\n // go through each obstace and buffer it by the object radius -0.5\r\n for (PathBlockingObstacle stationaryObstacle : stationaryObstacles) {\r\n KPolygon buffered1 = bufferer.buffer(stationaryObstacle.getPolygon(), moveableObject.getObjectRadius()-0.5, PathBlockingObstacleImpl.NUM_POINTS_IN_A_QUADRANT);\r\n bufferedStationaryObstacles.add(PathBlockingObstacleImpl.createObstacleFromInnerPolygon(buffered1));\r\n }\r\n // add these obstacles to a buffered node list\r\n for (PathBlockingObstacle bufferedStationaryObstacle : bufferedStationaryObstacles) {\r\n bufferedNodeConnector.addObstacle(bufferedStationaryObstacle, bufferedStationaryObstacles, maxConnectionDistanceBetweenObstacles);\r\n }\r\n // add this node list to the hashmap with the radius as key\r\n nodeMap.put(moveableObject.getObjectRadius(), bufferedNodeConnector);\r\n obstaclesMap.put(moveableObject.getObjectRadius(), bufferedStationaryObstacles);\r\n }\r\n \r\n \r\n }\r\n \r\n }", "public interface IConnectorService<T extends Node> {\r\n\tMap<String, Integer> connect(List<Node> nodes);\r\n\r\n}", "protected abstract Set<T> findNeighbors(T node, Map<T, T> parentMap);", "public void connectClusters()\n\t{\n//\t\tfor(int i = 0; i<edges.size();i++)\n//\t\t{\n//\t\t\tEdgeElement edge = edges.get(i);\n//\t\t\tString fromNodeID = edge.fromNodeID;\n//\t\t\tNodeElement fromNode = findSubNode(fromNodeID);\n//\t\t\tString toNodeID = edge.toNodeID;\n//\t\t\tNodeElement toNode = findSubNode(toNodeID); \n//\t\t\t\n//\t\t\tif(fromNode != null && toNode != null)\n//\t\t\t{\n//\t\t\t\tPortInfo oport = new PortInfo(edge, fromNode);\n//\t\t\t\tfromNode.addOutgoingPort(oport);\n//\t\t\t\tedge.addIncomingPort(oport);\n//\t\t\t\tPortInfo iport = new PortInfo(edge, toNode);\n//\t\t\t\ttoNode.addIncomingPort(iport);\n//\t\t\t\tedge.addOutgoingPort(iport);\n//\t\t\t}\n//\t\t}\n\t}", "public Map getProtocols();", "public Object lookup(String key){\n ListNode<String,Object> temp = getNode(key);\n if(temp != null)\n return temp.value;\n else\n return null;\n }", "private static int getClusterCorrespondance(Integer cl1, Integer cl2,\n HashMap<Integer, HashMap<Integer, Integer>> clusterCorresp, int nextId)\n{\n HashMap<Integer, Integer> map = clusterCorresp.get(cl1);\n if (map == null) {\n map = new HashMap<Integer, Integer>();\n map.put(cl2, nextId);\n clusterCorresp.put(cl1, map);\n return nextId;\n }\n Integer corresp = map.get(cl2);\n if (corresp == null) {\n map.put(cl2, nextId);\n return nextId;\n }\n return corresp.intValue();\n}", "RemoteMapper findMapper(int k) {\n\n RemoteMapper rm = null;\n try {\n ChordInterface c = this.chord.FindSuccessor(k);\n rm = (RemoteMapper) Naming.lookup(\"rmi:/\" + c.getIP() + \":1099/Keys-\" + c.getNodeKey());\n } catch (RemoteException ex) {\n System.err.println(\"findMapper remote exception\");\n } catch (NotBoundException en) {\n System.err.println(\"findMapper notBoundException\");\n } catch (MalformedURLException em) {\n em.printStackTrace();\n }\n return rm;\n }", "public InputConnector getInputConnector(String connectorName);", "@Override\n public Node getNodeByKey(String hashKey) {\n long key = Math.abs(Long.valueOf(hashKey));\n\n if (availableNodes.isEmpty()) {\n return null;\n }\n\n int index = (int) (key % availableNodes.size());\n Node node = availableNodes.get(index);\n if (node == null) {\n logger.error(\"failt to get hash node, the hash key:\" + hashKey);\n }\n return node;\n }", "private Node _locate(Object key){\n\t\tint hashCode = key.hashCode();\r\n\t\tint bucketNum = hashCode % _numBuckets;\r\n\t\treturn _locate(key, bucketNum);\r\n\t}", "List <Connector.Type> getConnectors();", "private OfpConDeviceInfo getLogicalNode(Connection conn, String devName) throws SQLException {\n\t\tfinal String fname = \"getLogicalNode\";\n\t\tif (logger.isDebugEnabled()) {\n\t\t\tlogger.debug(String.format(\"%s(conn=%s, devName=%s) - start\", fname, conn, devName));\n\t\t}\n\t\tMap<String, Object> devDoc = dao.getNodeInfoFromDeviceName(conn, devName);\n\t\tif (devDoc == null) {\n\t\t\treturn null;\n\t\t}\n\t\tOfpConDeviceInfo node = new OfpConDeviceInfo();\n\t\tnode.setDeviceName(devName);\n\t\tnode.setDeviceType((String)devDoc.get(\"type\"));\n\t\tnode.setLocation((String)devDoc.get(\"location\"));\n\t\tnode.setTenant((String)devDoc.get(\"tenant\"));\n\n\t\tList<OfpConPortInfo> portList = new ArrayList<OfpConPortInfo>();\n\t\tList<Map<String, Object>> linkDocList = dao.getCableLinksFromDeviceName(conn, devName);\n\t\tif (linkDocList == null) {\n\t\t\treturn null;\n\t\t}\n\t\tfor (Map<String, Object> linkDoc : linkDocList) {\n\t\t\tString outDevName = (String)linkDoc.get(\"outDeviceName\");\n\n\t\t\tPortData ofpPort = new PortData();\n\t\t\tString outPortName = (String)linkDoc.get(\"outPortName\");\n\t\t\tInteger outPortNmbr = (Integer)linkDoc.get(\"outPortNumber\");\n\t\t\tofpPort.setDeviceName(outDevName);\n\t\t\tofpPort.setPortName(outPortName);\n\t\t\tofpPort.setPortNumber(outPortNmbr);\n\n\t\t\tString inPortName = (String)linkDoc.get(\"inPortName\");\n\t\t\tInteger inPortNmbr = (Integer)linkDoc.get(\"inPortNumber\");\n\t\t\tOfpConPortInfo port = new OfpConPortInfo();\n\t\t\tport.setPortName(inPortName);\n\t\t\tport.setPortNumber(inPortNmbr);\n\t\t\tport.setOfpPortLink(ofpPort);\n\n\t\t\tportList.add(port);\n\t\t}\n\t\tnode.setPorts(portList);\n\t\tif (logger.isDebugEnabled()) {\n\t\t\tlogger.debug(String.format(\"%s(ret=%s) - end\", fname, node));\n\t\t}\n\t\treturn node;\n\t}", "Object getRemoteConnectionContextObject( String key );", "public void list() {\r\n\t\tfor (String key : nodeMap.keySet()) {\r\n\t\t\tNodeRef node = nodeMap.get(key);\r\n\t\t\tSystem.out.println(node.getIp() + \" : \" + node.getPort());\r\n\t\t}\t\t\r\n\t}", "public Connection getConnection(String key) {\n\t\t\tif (keyToConn.containsKey(key)) {\n\t\t\t\treturn keyToConn.get(key);\n\t\t\t}\n\t\t\treturn null;\n\t\t}", "public Graph getGraph4SingleCores(String nodeId, CustRelationshipMapper custRelationshipMapper, CustPropertyMapper custPropertyMapper) throws CustomException {\n if (StringUtils.isBlank(nodeId)) {\n throw new CustomException(\"[nodeId] is blank null or ' '\");\n }\n\n List<CustRelationship> oneDepthRels = custRelationshipMapper.selectAll1DRelByCertNo(nodeId);\n\n //Map<String, Object> graph = new HashMap<>();\n Graph graph = new Graph();\n if (oneDepthRels.size() == 0) {\n log.info(\"当前1度范围内[边]等于0, 将返回null\");\n graph = new Graph(null, null, StatusCode.NO_MATCHES);\n return graph;\n }\n\n\n\n //仅一度边\n Map<String, Edge> oneDepthEdges = new HashMap<>();\n //一度节点, 含中心\n Map<String, Node> oneDepthNodes = new HashMap<>();\n\n Node core = new Node();\n core.setId(nodeId);\n core.setDepth(0);\n //core 并入 onetDepthNodes\n oneDepthNodes.put(core.getId(), core);\n\n //遍历一度边, 封装数据\n gatherNodeEdge(oneDepthRels, oneDepthEdges, oneDepthNodes,1);\n\n Set<String> oneDepthNodesKeySet = oneDepthNodes.keySet();\n\n //判断一度节点个数, 小于阈值才会继续查询二度边\n if (oneDepthNodes.size() > MAX_DISPLAY_NODES_1D) {\n log.info(\"当前一度范围内[节点]个数大于[{}], 将仅返回一度节点和边数据\", MAX_DISPLAY_NODES_1D);\n\n\n List<CustProperty> custProperties = custPropertyMapper.selectByCertNos(oneDepthNodesKeySet);\n\n //封装点属性\n dumpCustPropertyData(oneDepthNodes, custProperties, 1);\n\n graph.setNodes(oneDepthNodes);\n graph.setEdges(oneDepthEdges);\n return graph;\n }\n\n\n // -- 一度范围节点数量在范围之内, 则获取所有二度边 --\n\n //装所有节点\n HashMap<String, Node> nodes = (HashMap<String, Node>) ((HashMap<String, Node>) oneDepthNodes).clone();\n //装所有的边\n HashMap<String, Edge> edges = (HashMap<String, Edge>) ((HashMap<String, Edge>) oneDepthEdges).clone();\n\n List<CustRelationship> allRel = custRelationshipMapper.selectRelByGivenCertNos(oneDepthNodesKeySet);\n if (allRel.size() > MAX_DISPLAY_EDGES) {\n log.info(\"当前二度范围内[边]总数大于[{}], 仅返回一度节点和边数据\", MAX_DISPLAY_EDGES);\n graph.setNodes(oneDepthNodes);\n graph.setEdges(oneDepthEdges);\n return graph;\n }\n\n // -- 二度范围边在范围之内, 则加工边数据集 --\n\n gatherNodeEdge(allRel, edges, nodes,2);\n /* ABANDON: 抽取\n for (CustRelationship rel : allRel) {\n //Note: oneDepthEdges中已有的, 不用再封装了, 没有的, 创建, 封装, 存入edges中, 且depth==2\n if (oneDepthEdges.get(rel.getId()) == null) {\n Edge edge = new Edge(rel.getId(), rel.getuCertNo(), rel.getvCertNo(), rel.getContent(), rel.getContentType(), rel.getRelationType());\n //新建的边, 说明depth==2\n edge.setDepth(2);\n //存入edges\n edges.put(String.valueOf(edge.getId()), edge);\n }\n\n //遇到新节点, 则存入nodes中, 且深度为2 !注意别存错了!\n gatherNodes(nodes, rel, 2);\n }\n */\n\n //查询所有属性: 核, 一度, 二度\n Set<String> allCertNos = nodes.keySet(); //获取所有身份证号, 查取属性数据\n List<CustProperty> custProperties = custPropertyMapper.selectByCertNos(allCertNos);\n\n //封装属性数据\n dumpCustPropertyData(nodes, custProperties, 2);\n\n //判断节点数目\n if (nodes.size() > MAX_DISPLAY_NODES_2D) {\n //0,1,2度节点之和超过阈值, 则只返回一度节点和边\n log.info(\"当前二度范围内[节点]总数大于[{}], 仅返回一度节点和边数据\", MAX_DISPLAY_NODES_2D);\n\n graph.setNodes(oneDepthNodes);\n graph.setEdges(oneDepthEdges);\n } else {\n //没有超限, 则返回1,2度全部\n log.info(\"返回全部二度范围内节点和边数据\");\n graph.setNodes(nodes);\n graph.setEdges(edges);\n }\n\n\n return graph;\n }", "private void refreshNodeListAndTokenMap(Connection connection) throws ConnectionException, BusyConnectionException, ExecutionException, InterruptedException {\n\n ResultSetFuture peersFuture = new ResultSetFuture(null, new QueryMessage(SELECT_PEERS, ConsistencyLevel.DEFAULT_CASSANDRA_CL));\n ResultSetFuture localFuture = new ResultSetFuture(null, new QueryMessage(SELECT_LOCAL, ConsistencyLevel.DEFAULT_CASSANDRA_CL));\n connection.write(peersFuture.callback);\n connection.write(localFuture.callback);\n\n String partitioner = null;\n Map<Host, Collection<String>> tokenMap = new HashMap<Host, Collection<String>>();\n\n // Update cluster name, DC and rack for the one node we are connected to\n Row localRow = localFuture.get().one();\n if (localRow != null) {\n String clusterName = localRow.getString(\"cluster_name\");\n if (clusterName != null)\n cluster.metadata.clusterName = clusterName;\n\n partitioner = localRow.getString(\"partitioner\");\n\n Host host = cluster.metadata.getHost(connection.address);\n // In theory host can't be null. However there is no point in risking a NPE in case we\n // have a race between a node removal and this.\n if (host == null) {\n logger.debug(\"Host in local system table ({}) unknown to us (ok if said host just got removed)\", connection.address);\n } else {\n updateLocationInfo(host, localRow.getString(\"data_center\"), localRow.getString(\"rack\"));\n\n Set<String> tokens = localRow.getSet(\"tokens\", String.class);\n if (partitioner != null && !tokens.isEmpty())\n tokenMap.put(host, tokens);\n }\n }\n\n List<InetAddress> foundHosts = new ArrayList<InetAddress>();\n List<String> dcs = new ArrayList<String>();\n List<String> racks = new ArrayList<String>();\n List<Set<String>> allTokens = new ArrayList<Set<String>>();\n\n for (Row row : peersFuture.get()) {\n\n InetAddress addr = row.getInet(\"rpc_address\");\n if (addr == null) {\n addr = row.getInet(\"peer\");\n logger.error(\"No rpc_address found for host {} in {}'s peers system table. That should not happen but using address {} instead\", addr, connection.address, addr);\n } else if (addr.equals(bindAllAddress)) {\n addr = row.getInet(\"peer\");\n }\n\n foundHosts.add(addr);\n dcs.add(row.getString(\"data_center\"));\n racks.add(row.getString(\"rack\"));\n allTokens.add(row.getSet(\"tokens\", String.class));\n }\n\n for (int i = 0; i < foundHosts.size(); i++) {\n Host host = cluster.metadata.getHost(foundHosts.get(i));\n if (host == null) {\n // We don't know that node, add it.\n host = cluster.addHost(foundHosts.get(i), true);\n }\n updateLocationInfo(host, dcs.get(i), racks.get(i));\n\n if (partitioner != null && !allTokens.get(i).isEmpty())\n tokenMap.put(host, allTokens.get(i));\n }\n\n // Removes all those that seems to have been removed (since we lost the control connection)\n Set<InetAddress> foundHostsSet = new HashSet<InetAddress>(foundHosts);\n for (Host host : cluster.metadata.allHosts())\n if (!host.getAddress().equals(connection.address) && !foundHostsSet.contains(host.getAddress()))\n cluster.removeHost(host);\n\n if (partitioner != null)\n cluster.metadata.rebuildTokenMap(partitioner, tokenMap);\n }", "public Map<Node, Connection> findRouteToExit(Collection<Node> nodes, Collection<Node> exitPoints, Connect connector) {\n\t\tMap<Node, Connection> map = new HashMap<>();\n\t\t\n\t\t//first, we iterate over the exit points.\n\t\tMap<Node, Collection<Connection>> groupedConnections = connector.connect(nodes, exitPoints);\n\t\t\n\t\tif (groupedConnections.size() > 0) {\n\t\t\t//choose the preferred connection based on the comparator on Connect\n\t\t\tgroupedConnections.forEach( (node, nodeConnections) -> {\n\t\t\t\tTreeSet<Connection> exits = new TreeSet<>(nodeConnections);\n\t\t\t\tmap.put(node, exits.first());\n\t\t\t});\n\t\t\t\n\t\t\t//iterate the unconnected nodes with the connected nodes\n\t\t\tCollection<Node> unconnectedNodes = new HashSet<>(nodes);\n\t\t\tunconnectedNodes.removeAll(groupedConnections.keySet());\n\t\t\tmap.putAll(findRouteToExit(unconnectedNodes, groupedConnections.keySet(), connector)); \n\t\t}\n\t\t\n\t\treturn map;\n\t}", "io.netifi.proteus.admin.om.Connection getConnection(int index);", "public node_info getNode(int key)\n{\n\treturn getNodes().get(key);\n\t\n}", "@Override\n\tpublic List<Integer> getMapRelationsNodeForOneMap(int map_id) {\n\t\tResultSet resultSet = null;\n\t\tList<Integer> res = new ArrayList<Integer>();\n\t\ttry {\n\t\t\tString selectAllNodes = \"select distinct(newMap.id) from ((select node.id from maprelations,node \"\n\t\t\t\t\t+ \"where node.map_id = ? and maprelations.node_from=node.id) union \"\n\t\t\t\t\t+ \"(select node.id from maprelations,node where node.map_id = ? and \"\n\t\t\t\t\t+ \"maprelations.node_to =node.id)) as newMap;\";\n\t\t\tpstmt = conn.prepareStatement(selectAllNodes);\n\t\t\t// TODO: potential danger..\n\t\t\tpstmt.setInt(1, map_id);\n\t\t\tpstmt.setInt(2, map_id);\n\t\t\tresultSet = pstmt.executeQuery();\n\t\t\twhile (resultSet.next()) {\n\t\t\t\tres.add(resultSet.getInt(\"id\"));\n\t\t\t}\n\t\t\treturn res;\n\n\t\t} catch (SQLException se) {\n\t\t\tSystem.out.println(\"fail to connect database..\");\n\t\t\tse.printStackTrace();\n\t\t} finally {\n\t\t\tJdbcConnect.resultClose(resultSet, pstmt);\n\t\t\tJdbcConnect.connClose();\n\t\t}\n\t\treturn null;\n\t}", "public Node read_node2(String MAC, String port_number) throws HibernateException\r\n\t\t\t\t{ \r\n\t\t\t\t\tNode node = null; \r\n\t\t\t\t\tString i=null;\r\n\t\t\t\t\tlong id_node=0;\r\n\t\t\t\t try \r\n\t\t\t\t { \r\n\t\t\t\t iniciaOperacion(); //unique result me devuelve el objeto encontrado con dicho correo electronico\r\n\t\t\t\t \r\n\t\t\t\t i= sesion.createQuery(\"SELECT u.id_node FROM Node u WHERE u.MAC_address ='\"+MAC+\"' and u.port_number ='\"+port_number+\"'\").uniqueResult().toString();\r\n\t\t\t\t //una vez encontrado el id del user puedo buscarlo\r\n\t\t\t\t id_node= Integer.parseInt(i);\r\n\t\t\t\t node = (Node) sesion.get(Node.class, id_node); \r\n\t\t\t\t \r\n\t\t\t\t } finally \r\n\t\t\t\t { \r\n\t\t\t\t sesion.close(); \r\n\t\t\t\t } \r\n\t\t\t\t return node; \r\n\t\t\t\t}", "public abstract Map<String, Node> next() throws TrippiException;", "private void initGraph() {\n nodeMap = Maps.newIdentityHashMap();\n stream.forEach(t -> {\n Object sourceKey = sourceId.extractValue(t.get(sourceId.getTableId()));\n Object targetKey = targetId.extractValue(t.get(targetId.getTableId()));\n ClosureNode sourceNode = nodeMap.get(sourceKey);\n ClosureNode targetNode = nodeMap.get(targetKey);\n if (sourceNode == null) {\n sourceNode = new ClosureNode(sourceKey);\n nodeMap.put(sourceKey, sourceNode);\n }\n if (targetNode == null) {\n targetNode = new ClosureNode(targetKey);\n nodeMap.put(targetKey, targetNode);\n }\n sourceNode.next.add(targetNode);\n });\n\n }", "IMappingNode getMappingNode(Object groupID) throws Exception;", "public Object lookupConfigurationEntry(String key);", "public ArrayList<FlowLink> makeHostSwitchLinkPair(ArrayList<Node> topoNodes, IDevice device, SwitchPort ap, Map<DatapathId, IOFSwitch> switchMap, \n\t\t\tHashMap<IOFSwitch, ArrayList<OFPortDesc>> switchPortMap){\n\t\t\n\t\tString deviceName = device.getMACAddressString();\n\t\t\t\t\n\t\tDatapathId switchId = ap.getSwitchDPID();\n\t\tString switchName = switchId.toString();\n\t\t\n\t\tIOFSwitch connectingSwitch = switchMap.get(switchId);\n\t\tArrayList<OFPortDesc> ports = switchPortMap.get(connectingSwitch);\n\t\t\n\t\tOFPort portOnSwitch = ap.getPort();\n\t\tint switchPortNum = portOnSwitch.getPortNumber();\n\t\t\n\t\tString hostSwitchLinkName = \"(\" + deviceName + \", \" + switchName + \")\";\n\t\tString switchHostLinkName = \"(\" + switchName + \", \" + deviceName + \")\";\n\t\t\n\n\t\tNode src = getNodeWithName(topoNodes, deviceName);\n\t\tNode dst = getNodeWithName(topoNodes, switchName);\n\t\t\n\t\tPort srcP = src.getPortByID(1);\n\t\tPort dstP = dst.getPortByID(switchPortNum);\n\t\t\n\t\tlong bandWidth = 0;\n\t\t\n\t\tfor(OFPortDesc portDesc : ports){\n\t\t\tif(portDesc.getPortNo().equals(portOnSwitch)){\n\t\t\t\tbandWidth = convertBandwidth(portDesc.getCurrSpeed());\n\t\t\t}\n\t\t}\n\t\t\n\t\tArrayList<FlowLink> hostSwitchLinks = new ArrayList<FlowLink>();\n\t\thostSwitchLinks.add(new FlowLink(hostSwitchLinkName, src, dst, srcP, dstP, bandWidth));\n\t\thostSwitchLinks.add(new FlowLink(switchHostLinkName, dst, src, dstP, srcP, bandWidth));\n\t\t\n\t\treturn hostSwitchLinks;\n\t}", "List<GraphEdge> getNeighbors(NodeKey key);", "private CommunicationLink getNodeById(Integer id)\n {\n if (allNodes.size() == 0)\n {\n return null;\n }\n try\n {\n return allNodes.get(id);\n } catch (Exception e)\n {\n return null;\n }\n }", "public NodeDB.NodeInfo getResponsibleNode(long hash) { synchronized (this.nodedb) {\n\n\t\tNodeDB.NodeInfo prev = null;\n\t\tfor (NodeDB.NodeInfo ni : this.nodedb.values())\n\t\t\tif (hash >= ni.nodehash)\n\t\t\t\tprev = ni;\n\t\t\telse\n\t\t\t\tbreak;\n\n\t\tif (prev == null)\n\t\t\tthrow new RuntimeException(\"Not entire hash range is covered. Your setup is shit.\");\n\t\t\n\t\treturn prev;\n\t}}", "NodeInformationProvider getNodeInformationProvider();", "entities.Torrent.NodeId getNode();", "entities.Torrent.NodeId getNode();", "Map<String, String> getEndpointMap();", "private Node _locate(Object key, int bucketNum){\n\t\tNode bucketList = _buckets[bucketNum];\r\n\t\twhile(bucketList != null)\r\n\t\t{\r\n\t\t\tif(key == bucketList._key){\t\t\t\t// If the key matches the key of the current node\r\n\t\t\t\tbreak;\t\t\t\t\t\t\t\t// in bucketList, then return the bucketList.\r\n\t\t\t}\r\n\t\t\tbucketList = bucketList._nextNode;\t\t// Otherwise move to the next node.\r\n\t\t}\r\n\t\treturn bucketList;\r\n\t}", "Node findLoopByHash(Node n){\n Hashtable<Node,Integer> nodes = new Hashtable<Node,Integer>();\n while (n.next != null){\n if (nodes.containsKey(n)) break;\n nodes.put(n,1);\n n=n.next;\n }\n if (n.next != null) return n;\n return null;\n }", "@Override\r\n protected Node getStoringNode(Integer key) {\r\n return getNetworkNode();\r\n }", "private Node getNode(String nodeName)\r\n\t{\r\n\t return nodeMap.get(nodeName);\r\n\t}", "UrlMap findByKey(String key);", "public Map getConnectionUsage();", "LaunchingConnector findLaunchingConnector() {\n List<Connector> connectors = Bootstrap.virtualMachineManager().allConnectors();\n for (Connector connector : connectors) {\n if (connector.name().equals(\"com.sun.jdi.CommandLineLaunch\")) {\n return (LaunchingConnector) connector;\n }\n }\n throw new Error(\"No launching connector\");\n }", "public boolean connect( Properties props ) {\n\n //get the subset for the properties\n Properties subset = CommonProperties.matchingSubset( props, PROPERTY_PREFIX, false );\n mLogger.log( \"MRC Properties are \" + subset , LogManager.DEBUG_MESSAGE_LEVEL );\n\n //container for properties for each of the different catalogs\n Map propertiesMap = new HashMap();\n\n //put each of the keys in the correct bin\n for( Iterator it = subset.entrySet().iterator(); it.hasNext(); ){\n Map.Entry entry = ( Map.Entry )it.next();\n String key = ( String ) entry.getKey();\n String value = ( String ) entry.getValue();\n String name = getName( key ); //bin stores the user defined name specified\n //now determine the key\n key = getKey( key, name );\n\n //store the key, value in the correct properties object\n Properties p;\n if( propertiesMap.containsKey( name ) ){\n p = ( Properties )propertiesMap.get( name );\n }\n else{\n p = new Properties( );\n propertiesMap.put( name, p );\n }\n p.setProperty( key, value );\n }\n\n //now that we have all the properties sorted accd to individual catalogs\n //try connecting to them one by one\n boolean result = true;\n for( Iterator it = propertiesMap.entrySet().iterator(); it.hasNext() ; ){\n Map.Entry entry = ( Map.Entry )it.next();\n result &= connect( (String)entry.getKey(), ( Properties )entry.getValue() );\n\n //if unable to connect to any single\n //break out and exit\n if( !result ){\n mLogger.log( \"MRC unable to connect to replica catalog backend \" + entry.getKey() + \" with connection properties \" + entry.getValue() , \n LogManager.ERROR_MESSAGE_LEVEL );\n break;\n }\n mLogger.log( \"MRC Successfully connect to replica catalog backend \" + entry.getKey() + \" with connection properties \" + entry.getValue() , \n LogManager.DEBUG_MESSAGE_LEVEL );\n }\n\n //if the result is false, then disconnect from\n //already connected replica catalogs\n if( !result ){\n close();\n }\n\n return result;\n }", "public static ILayer findLayerByNode(IMap map, Node gisNode) {\r\n try {\r\n for (ILayer layer : map.getMapLayers()) {\r\n IGeoResource resource = layer.findGeoResource(Node.class);\r\n if (resource != null && resource.resolve(Node.class, null).equals(gisNode)) {\r\n return layer;\r\n }\r\n }\r\n return null;\r\n } catch (IOException e) {\r\n // TODO Handle IOException\r\n e.printStackTrace();\r\n return null;\r\n }\r\n }", "public interface ConnectorContext {\n\n\n /**\n * Get a reference to a global state manager for state coordination, dedup and ordering semantics\n *\n * @return global state manager instance\n */\n StateManager getStateManager();\n\n /**\n * Get a Globally unique connector instance identifier for the connector instance\n *\n * @return globally unique uuid\n */\n UUID getConnectorId();\n\n /**\n * Partition id for the connector instance.\n *\n * @return local partition id in cluster\n */\n int getPartitionId();\n\n /**\n * Get expected total instances of this connector type currently active\n *\n * @return total active instance count\n */\n int getInstanceCount();\n\n /**\n * Notifying the external runtime of metrics and other related events\n *\n * @param event Event to Sent\n * @return Error or success code\n */\n Integer publishEvent(SendableEvent event);\n\n /**\n * Receiving events from an external manager post initialization, meant for throttling and config updates.\n *\n * @param listener Local listener object to bind to.\n */\n void subscribeToEvents(Listener listener);\n\n /**\n * Get a reference to the global state manager\n *\n * @return a client object to interact with the scheme registry\n */\n SchemaManager getSchemaManager();\n}", "private ProcessProfile findTargetNode(Set<String> localAddrs, List<ProcessProfile> nodeAddrs) {\n for (String localAddr : localAddrs) {\n for (ProcessProfile node : nodeAddrs) {\n // If this addresses bound to the nics on this host are contained on the current node\n // send back the data object containing the required info.\n if (node.boundAddresses.contains(localAddr)) {\n return node;\n }\n }\n }\n\n // If we got this far and came up empty, signal our displeasure\n logger.error( \"Comparison did not result in an IP or Host match. {} {}\", localAddrs, nodeAddrs);\n throw new RuntimeException(\"Could not find the target node.\");\n }", "public JupiterConnector getConnector(@Nullable String name) {\n if (Strings.isEmpty(name) || DEFAULT_NAME.equals(name)) {\n return getDefault();\n }\n\n return new JupiterConnector(this,\n name,\n redis.getPool(name),\n fallbackPools.computeIfAbsent(name, this::fetchFallbackPool));\n }", "private CommunicationLink getNodeByIndex(int index)\n {\n if (allNodes.size() == 0)\n {\n return null;\n }\n try\n {\n return allNodes.get(nodeIds.get(index));\n } catch (Exception e)\n {\n return null;\n }\n }", "@SuppressWarnings(\"unchecked\")\n\tpublic void dumpRemoteKeggPathways() throws IOException {\n\t\tList<Short> pathwayIDs = new ArrayList<Short>();\n\t\t\n\t\t// get pathway tree structure\n\t\tTreeNode pathwayRoot = Constants.KEGG_ORTHOLOGY_MAP.getRoot();\n\t\tEnumeration<TreeNode> dfEnum = ((DefaultMutableTreeNode) pathwayRoot).depthFirstEnumeration();\n\t\t// iterate nodes of pathway\n\t\twhile (dfEnum.hasMoreElements()) {\n\t\t\tTreeNode treeNode = (TreeNode) dfEnum.nextElement();\n\t\t\t// extract data from leaf nodes only\n\t\t\tif (treeNode.isLeaf()) {\n\t\t\t\tString leafName = (String) ((DefaultMutableTreeNode) treeNode).getUserObject();\n\t\t\t\t// extract numeric identifier and store in list\n\t\t\t\tpathwayIDs.add(Short.parseShort(leafName.substring(0, 5)));\n\t\t\t}\n\t\t}\n\n\t\tko2pathway = new HashMap<Short, List<Short>>();\n\t\tpathway2ko = new HashMap<Short, List<Short>>();\n\t\tec2pathway = new HashMap<short[], List<Short>>();\n\t\tpathway2ec = new HashMap<Short, List<short[]>>();\n\t\tint i = 1;\n\t\t// iterate list of pathway IDs\n\t\tfor (Short pathwayID : pathwayIDs) {\n\t\t\tSystem.out.println(\"\" + (i++) + \"/\" + pathwayIDs.size());\n\t\t\tString pathway = \"path:map\" + String.format(\"%05d\", pathwayID);\n\t\t\t\n\t\t\tString[] koStrings = serv.get_kos_by_pathway(pathway);\n\t\t\tList<Short> koList = new ArrayList<Short>();\n\t\t\tfor (String koString : koStrings) {\n\t\t\t\tShort ko = Short.parseShort(koString.substring(4));\n\t\t\t\tList<Short> pathwayList = ko2pathway.get(ko);\n\t\t\t\tif (pathwayList == null) {\n\t\t\t\t\tpathwayList = new ArrayList<Short>();\n\t\t\t\t}\n\t\t\t\tif (!pathwayList.contains(pathwayID)) {\n\t\t\t\t\tpathwayList.add(pathwayID);\n\t\t\t\t}\n\t\t\t\tko2pathway.put(ko, pathwayList);\n\t\t\t\t\n\t\t\t\tkoList.add(ko);\n\t\t\t}\n\t\t\tif (!koList.isEmpty()) {\n\t\t\t\tpathway2ko.put(pathwayID, koList);\n\t\t\t}\n\n\t\t\tString[] ecStrings = serv.get_enzymes_by_pathway(pathway);\n\t\t\tList<short[]> ecList = new ArrayList<short[]>();\n\t\t\tfor (String ecString : ecStrings) {\n\t\t\t\tshort[] ec = ECReader.toArray(ecString.substring(3));\n\t\t\t\tList<Short> pathwayList = ec2pathway.get(ec);\n\t\t\t\tif (pathwayList == null) {\n\t\t\t\t\tpathwayList = new ArrayList<Short>();\n\t\t\t\t}\n\t\t\t\tif (!pathwayList.contains(pathwayID)) {\n\t\t\t\t\tpathwayList.add(pathwayID);\n\t\t\t\t}\n\t\t\t\tec2pathway.put(ec, pathwayList);\n\t\t\t\t\n\t\t\t\tecList.add(ec);\n\t\t\t}\n\t\t\tpathway2ec.put(pathwayID, ecList);\n\t\t\t\n\t\t}\n\t\t\n\t\t// dump objects to file\n\t\tFile output = new File(\"conf/keggKO2PW.map\");\n\t\tFileOutputStream fos = new FileOutputStream(output);\n\t\tObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(new GZIPOutputStream(fos)));\n\n\t\toos.writeObject(ko2pathway);\n\t\toos.writeObject(pathway2ko);\n\t\toos.writeObject(ec2pathway);\n\t\toos.writeObject(pathway2ec);\n\t\toos.flush();\n\t\toos.close();\n\t}", "io.netifi.proteus.admin.om.Connection getConnections(int index);", "private Node<Pair<K, V>> findItem(K key) {\n Node<Pair<K, V>> result = null;\n\n int hash1 = hash1(key);\n\n if (table[hash1] != null) {\n Node<Pair<K, V>> node = search(table[hash1].list, key);\n\n if (node != null) {\n result = node;\n }\n }\n\n int hash2 = hash2(key);\n\n if (table[hash2] != null && result == null) {\n Node<Pair<K, V>> node = search(table[hash2].list, key);\n\n if (node != null) {\n result = node;\n }\n }\n\n return result;\n }", "private boolean linkMappingCoreSeparate( VirtualLink vLink, SubstrateSwitch edgeSwitch1,\n\t\t\tSubstrateSwitch edgeSwitch2, Topology topo) {\n\t\tMap<SubstrateSwitch, LinkedList<SubstrateSwitch>> listAggConnectEdge = topo.getListAggConnectEdge();\n\t\tMap<SubstrateSwitch, LinkedList<SubstrateSwitch>> listCoreConnectAggMap = topo.getListCoreConnectAgg();\t\n\t\tLinkedList<LinkPhyEdge> listPhyEdge = topo.getListLinkPhyEdge();\n\t\tLinkedList<SubstrateLink> listLinkBandwidth = topo.getLinkBandwidth();\n\t\tLinkedList<SubstrateSwitch> listAggSort1 = new LinkedList<>();\n\t\tLinkedList<SubstrateSwitch> listAggSort2 = new LinkedList<>();\n\t\tLinkedList<SubstrateSwitch> listCoreSort1 = new LinkedList<>();\n\t\tLinkedList<SubstrateSwitch> listCoreSort2 = new LinkedList<>();\n\t\t\n\t\tService sService = vLink.getsService();\n\t\tService dService = vLink.getdService();\n\t\t\n\t\tdouble bandwidthDemand = vLink.getBandwidthRequest();\n\t\tint count = 0;\n\t\t\n\t\tSubstrateSwitch edge1 = null, edge2 = null;\n\t\tSubstrateSwitch agg1 = null, agg2 = null;\n\t\tSubstrateSwitch core = null;\n\t\t\n\t\tLinkPhyEdge linkEdge1 = null, linkEdge2 = null;\n\t\t\n\t\tSubstrateLink linkAggEdge1a = null, linkAggEdge1b = null;\n\t\tSubstrateLink linkAggEdge2a = null, linkAggEdge2b = null;\n\t\tSubstrateLink linkCoreAgg1a = null, linkCoreAgg1b = null;\n\t\tSubstrateLink linkCoreAgg2a = null, linkCoreAgg2b = null;\n\t\t//===get edge switch connect to server=====================================//\n\t\tfor (LinkPhyEdge linkPhyEdge: listPhyEdge) { \n\t\t\t\n\t\t\tif(linkPhyEdge.getPhysicalServer().equals(sService.getBelongToServer())){\n\t\t\t\tedge1 = linkPhyEdge.getEdgeSwitch();\n\t\t\t\tif(linkPhyEdge.getBandwidth() < bandwidthDemand) {\n\t\t\t\t\treturn false;\n\t\t\t\t}else {\n\t\t\t\t\tlinkEdge1 = linkPhyEdge;\n\t\t\t\t}\n\t\t\t\t\t\n\t\t\t}\n\t\t\tif(linkPhyEdge.getPhysicalServer().equals(dService.getBelongToServer())) {\n\t\t\t\tedge2 = linkPhyEdge.getEdgeSwitch();\n\t\t\t\tif(linkPhyEdge.getBandwidth() < bandwidthDemand) {\n\t\t\t\t\treturn false;\n\t\t\t\t}else {\n\t\t\t\t\tlinkEdge2 = linkPhyEdge;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tlistAggSort1 = sortListSwitch(listAggConnectEdge.get(edge1));\n\t\tlistAggSort2 = sortListSwitch(listAggConnectEdge.get(edge2));\n\t\n\t\t//=== find link connect Agg to Edge ======================================//\n\t\tAGG_EDGE_LOOP1:\n\t\tfor(int index = 0; index < listAggSort1.size(); index++) {\n\t\t\tagg1 = listAggSort1.get(index);\n\t\t\tfor (SubstrateLink link : listLinkBandwidth) {\n\t\t\t\tif(link.getStartSwitch() == edge1 && link.getEndSwitch() == agg1) {\n\t\t\t\t\tif(link.getBandwidth() < bandwidthDemand) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else {\n\t\t\t\t\t\tlinkAggEdge1a = link;\n\t\t\t\t\t\tcount ++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(link.getStartSwitch() == agg1 && link.getEndSwitch() == edge1) {\n\t\t\t\t\tif(link.getBandwidth() < bandwidthDemand) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else {\n\t\t\t\t\t\tlinkAggEdge1b = link;\n\t\t\t\t\t\tcount ++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(count == 2) break AGG_EDGE_LOOP1;\n\t\t\t}\t\n\t\t} // end for loop 1\n\t\tcount = 0;\n\t\tAGG_EDGE_LOOP2:\n\t\tfor(int index = 0; index < listAggSort2.size(); index++) {\n\t\t\tagg2 = listAggSort2.get(index);\n\t\t\tfor (SubstrateLink link : listLinkBandwidth) {\n\t\t\t\tif(link.getStartSwitch() == edge2 && link.getEndSwitch() == agg2) {\n\t\t\t\t\tif(link.getBandwidth() < bandwidthDemand) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else {\n\t\t\t\t\t\tlinkAggEdge2a = link;\n\t\t\t\t\t\tcount ++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if(link.getStartSwitch() == agg2 && link.getEndSwitch() == edge2) {\n\t\t\t\t\tif(link.getBandwidth() < bandwidthDemand) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else {\n\t\t\t\t\t\tlinkAggEdge2b = link;\n\t\t\t\t\t\tcount ++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(count == 2) break AGG_EDGE_LOOP2;\n\t\t\t}\t\n\t\t} // end for loop 2\n\t\t//=== find link connect Agg to Core ======================================//\n\t\tlistCoreSort1 = sortListSwitch(listCoreConnectAggMap.get(agg1));\n\t\tlistCoreSort2 = sortListSwitch(listCoreConnectAggMap.get(agg2));\n\t\t\n\t\tif(!listCoreSort1.equals(listCoreSort2)) {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tfor(int index = 0; index < listCoreSort1.size(); index++) {\n\t\t\tcore = listCoreSort1.get(index);\n\t\t\tfor (SubstrateLink link : listLinkBandwidth) {\n\t\t\t\tif(link.getStartSwitch() == agg1 && link.getEndSwitch() == core) {\n\t\t\t\t\tif(link.getBandwidth() < bandwidthDemand) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}else {\n\t\t\t\t\t\tlinkCoreAgg1a = link;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if(link.getStartSwitch() == core && link.getEndSwitch() == agg1) {\n\t\t\t\t\tif(link.getBandwidth() < bandwidthDemand) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}else {\n\t\t\t\t\t\tlinkCoreAgg1b = link;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if(link.getStartSwitch() == agg2 && link.getEndSwitch() == core) {\n\t\t\t\t\tif(link.getBandwidth() < bandwidthDemand) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}else {\n\t\t\t\t\t\tlinkCoreAgg2a = link;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if(link.getStartSwitch() == core && link.getEndSwitch() == agg2) {\n\t\t\t\t\tif(link.getBandwidth() < bandwidthDemand) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}else {\n\t\t\t\t\t\tlinkCoreAgg2b = link;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//===set up bandwidth for all found links above ========//\n\t\tlinkEdge1.setBandwidth(linkEdge1.getBandwidth() - bandwidthDemand);\n\t\tlinkEdge1.getEdgeSwitch().setPort(linkEdge1.getEdgeSwitch(), bandwidthDemand);\n\t\tlinkEdge2.setBandwidth(linkEdge2.getBandwidth() - bandwidthDemand);\n\t\tlinkEdge2.getEdgeSwitch().setPort(linkEdge2.getEdgeSwitch(), bandwidthDemand);\n\t\tvLink.getLinkPhyEdge().add(linkEdge1);\n\t\tvLink.getLinkPhyEdge().add(linkEdge2);\n\t\tlinkAggEdge1a.setBandwidth(linkAggEdge1a.getBandwidth() - bandwidthDemand);\n\t\tlinkAggEdge1a.getStartSwitch().setPort(linkAggEdge1a.getEndSwitch(), bandwidthDemand);\n\t\tlinkAggEdge1b.setBandwidth(linkAggEdge1b.getBandwidth() - bandwidthDemand);\n\t\tlinkAggEdge1b.getStartSwitch().setPort(linkAggEdge1b.getEndSwitch(), bandwidthDemand);\n\t\tlinkAggEdge2a.setBandwidth(linkAggEdge2a.getBandwidth() - bandwidthDemand);\n\t\tlinkAggEdge2a.getStartSwitch().setPort(linkAggEdge2a.getEndSwitch(), bandwidthDemand);\n\t\tlinkAggEdge2b.setBandwidth(linkAggEdge2b.getBandwidth() - bandwidthDemand);\n\t\tlinkAggEdge2b.getStartSwitch().setPort(linkAggEdge2b.getEndSwitch(), bandwidthDemand);\n\t\tlinkCoreAgg1a.setBandwidth(linkCoreAgg1a.getBandwidth() - bandwidthDemand);\n\t\tlinkCoreAgg1a.getStartSwitch().setPort(linkCoreAgg1a.getEndSwitch(), bandwidthDemand);\n\t\tlinkCoreAgg1b.setBandwidth(linkCoreAgg1b.getBandwidth() - bandwidthDemand);\n\t\tlinkCoreAgg1b.getStartSwitch().setPort(linkCoreAgg1b.getEndSwitch(), bandwidthDemand);\n\t\tlinkCoreAgg2a.setBandwidth(linkCoreAgg2a.getBandwidth() - bandwidthDemand);\n\t\tlinkCoreAgg2a.getStartSwitch().setPort(linkCoreAgg2a.getEndSwitch(), bandwidthDemand);\n\t\tlinkCoreAgg2b.setBandwidth(linkCoreAgg2b.getBandwidth() - bandwidthDemand);\n\t\tlinkCoreAgg2b.getStartSwitch().setPort(linkCoreAgg2b.getEndSwitch(), bandwidthDemand);\n\t\tvLink.getLinkSubstrate().add(linkAggEdge1a);\n\t\tvLink.getLinkSubstrate().add(linkAggEdge1b);\n\t\tvLink.getLinkSubstrate().add(linkAggEdge2a);\n\t\tvLink.getLinkSubstrate().add(linkAggEdge2b);\n\t\tvLink.getLinkSubstrate().add(linkCoreAgg1a);\n\t\tvLink.getLinkSubstrate().add(linkCoreAgg1b);\n\t\tvLink.getLinkSubstrate().add(linkCoreAgg2a);\n\t\tvLink.getLinkSubstrate().add(linkCoreAgg2b);\n\t\treturn true;\n\t}", "@Override\r\n\tpublic String getHostName(\r\n\t\t\tMap<String, SupervisorDetails> existingSupervisors, String nodeId) {\n\t\treturn null;\r\n\t}", "Map<String, Collection<String>> getConnectedEntities();", "public String getRefNodeKey() {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\treturn BankMaster.class.getName();\r\n\t\t\t\t\t}", "public List<Object> invokeMapReduce(Invoker invoker) {\n List<Pair<Pair<Short, Integer>, String>> list = clientConnections.getMapClientFromAll();\n List<KeyCluster> keyClusterList = new ArrayList<KeyCluster>(list.size());\n for ( Pair<Pair<Short, Integer>, String> each : list) {\n //key is represented by node 1 separate by , total nodes example 1,3\n //will passed by key to store proc to determine the how partition data node\n KeyCluster keyCluster = new KeyCluster(each.getFirst().getFirst(), Key.createKey(each.getSecond()),\n each.getFirst().getSecond() );\n keyClusterList.add( keyCluster);\n }\n //add Key must be true, key carry information about how to split cluster\n return executeStoreProc(invoker, keyClusterList, true);\n }", "public GraphNode getNode(String key) {\n\treturn nodes.get(key);\n }", "public static List<JsonRpcExecutorConnection> createExecutorConnectionPair(ObjectMapper mapper, Executor executor) {\n List<JsonRpcExecutorConnection> res = new ArrayList<JsonRpcExecutorConnection>(2);\n JsonRpcExecutorConnection a = new JsonRpcExecutorConnection(mapper, executor);\n JsonRpcExecutorConnection b = new JsonRpcExecutorConnection(mapper, executor);\n a.setOtherConnection(b);\n b.setOtherConnection(a);\n res.add(0, a);\n res.add(1, b);\n return res;\n }", "public void Nodemap (String addedNode, String[] connectNode) {\n\t\tNodeswithconnect.put(addedNode, connectNode);\n\t}", "@Override\n\tpublic synchronized Map<IOFSwitch, Map<Tenant3, Map<VirtualNetwork, Map<Host, OFPort>>>> getTable() {\n\n\t\treturn switchTenantVirtualNetworkMap;\n\t}", "public MyNode findMyNode(Node node){\r\n\t\treturn nodesMap.get(node);\r\n\t}", "private static OSMWay processWay(XMLStreamReader parser,HashMap<Long, WayNodeOSM> osmNodes) throws XMLStreamException {\n \t\tList<Long> nodeIds = new ArrayList<>();\n \t\tboolean roundabout = false;\n \t\tboolean directed = false;\n \t\tString name = \"\";\n \t\twhile(true){\n \t\t\tint event = parser.next();\n \t\t\tif ( event == XMLStreamConstants.END_ELEMENT && parser.getLocalName().equals(\"way\")) {\n \t\t\t\t// the XML way elements ends, so create the OSMWay and let the caller resume\n \t\t\t\tbreak;\n \t\t\t}\n \t\t\tif (event == XMLStreamConstants.START_ELEMENT){\n \t\t\t\tLong id;\n \t\t\t\tswitch(parser.getLocalName()){\n \t\t\t\tcase \"nd\":\n \t\t\t\t\t// get the referenced node and if it exists in the data set add it to the way\n \t\t\t\t\tid = getNdId(parser);\n \t\t\t\t\tif(osmNodes.containsKey(id)){\n \t\t\t\t\t\tnodeIds.add(id);\n \t\t\t\t\t}\n \t\t\t\t\tbreak;\n \t\t\t\tcase \"tag\":\n \t\t\t\t\t// search the tag\n \t\t\t\t\tboolean j = false; // no junction \n \t\t\t\t\tboolean n = false; // no name\n \t\t\t\t\tboolean d = false; // not directed\n \t\t\t\t\tfor ( int i = 0; i < parser.getAttributeCount(); i++ ) {\n \t\t\t\t\t\tif (parser.getAttributeLocalName( i ).equals(\"k\")) {\n \t\t\t\t\t\t\t// check whether the key is either junction|name\n \t\t\t\t\t\t\tif (parser.getAttributeValue(i).equals(\"junction\")){\n \t\t\t\t\t\t\t\tj = true;\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t\tif (parser.getAttributeValue(i).equals(\"name\")) {\n \t\t\t\t\t\t\t\tn = true;\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t\tif (parser.getAttributeValue(i).equals(\"oneway\")) {\n \t\t\t\t\t\t\t\td = true;\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t}\n \t\t\t\t\t\t// if the key was junction|name, get the value\n \t\t\t\t\t\tif (j) {\n \t\t\t\t\t\t\tif (parser.getAttributeLocalName( i ).equals(\"v\")) {\n \t\t\t\t\t\t\t\troundabout = parser.getAttributeValue(i) == \"roundabout\";\n \t\t\t\t\t\t\t\tdirected = true;\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 \t\t\t\t\t\tif (n) {\n \t\t\t\t\t\t\tif (parser.getAttributeLocalName( i ).equals(\"v\")) {\n \t\t\t\t\t\t\t\tname = parser.getAttributeValue(i);\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 \t\t\t\t\t\tif (d) {\n \t\t\t\t\t\t\tif (parser.getAttributeLocalName( i ).equals(\"v\")) {\n \t\t\t\t\t\t\t\tdirected = parser.getAttributeValue(i).equals(\"yes\");\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 \t\t\t\t\t}\n \t\t\t\t\tbreak;\n \t\t\t\t}\n \t\t\t}\n \t\t} \t\n \n \t\treturn new OSMWay(nodeIds, roundabout,name,directed);\n \t}", "NetworkClientConnection getConnection(String uriToNode);", "protected abstract Object pollNode(MBeanServerConnection connection, String nodeName, int nodeIdx) throws Exception;", "<O> N getNode(Function<N, O> map, O value);", "public OutputConnector getOutputConnector(String connectorName);", "private CommunicationBridge findCommunicationById(String cbID) {\n //cbID = cbID.substring(1,cbID.length()-1);\n return communicationBridgeMap.get(cbID.trim());\n }", "public NodeT getNode(String key) {\n return nodeTable.get(key);\n }", "public Integer getClusterNum(Integer key)\n{\n return NPchains.get(key);\n}", "public int getNumberOfConnectors() { return numberOfConnectors; }", "List<IConnector> getConnectors();", "CommunicationLink getNodeByName(String name)\n {\n return getNodeById(Objects.hash(name));\n }", "public T caseConnector(Connector object) {\n\t\treturn null;\n\t}", "SockHandle(Socket client,String my_ip,String my_port,int my_c_id,HashMap<Integer, SockHandle> c_list,HashMap<Integer, SockHandle> s_list, boolean rx_hdl,boolean svr_hdl,ClientNode cnode) \n {\n \tthis.client = client;\n \tthis.my_ip = my_ip;\n \tthis.my_port = my_port;\n this.my_c_id = my_c_id;\n this.remote_c_id = remote_c_id;\n this.c_list = c_list;\n this.s_list = s_list;\n this.rx_hdl = rx_hdl;\n this.svr_hdl = svr_hdl;\n this.cnode = cnode;\n // get input and output streams from socket\n \ttry \n \t{\n \t in = new BufferedReader(new InputStreamReader(client.getInputStream()));\n \t out = new PrintWriter(client.getOutputStream(), true);\n \t} \n \tcatch (IOException e) \n \t{\n \t System.out.println(\"in or out failed\");\n \t System.exit(-1);\n \t}\n try\n {\n // only when this is started from a listening node\n // send a initial_setup message to the initiator node (like an acknowledgement message)\n // and get some information from the remote initiator node\n if(rx_hdl == true)\n {\n \t System.out.println(\"send cmd 1: setup sockets to other clients\");\n out.println(\"initial_setup\");\n ip = in.readLine();\n \t System.out.println(\"ip:\"+ip);\n port=in.readLine();\n \t System.out.println(\"port:\"+port);\n remote_c_id=Integer.valueOf(in.readLine());\n \t out.println(my_ip);\n \t out.println(my_port);\n \t out.println(my_c_id);\n \t System.out.println(\"neighbor connection, PID:\"+ Integer.toString(remote_c_id)+ \" ip:\" + ip + \" port = \" + port);\n // when this handshake is done\n // add this object to the socket handle list as part of the main Client object\n synchronized (c_list)\n {\n c_list.put(remote_c_id,this);\n }\n }\n }\n \tcatch (IOException e)\n \t{\n \t System.out.println(\"Read failed\");\n \t System.exit(1);\n \t}\n \t// handle unexpected connection loss during a session\n \tcatch (NullPointerException e)\n \t{\n \t System.out.println(\"peer connection lost\");\n \t System.exit(1);\n \t}\n // thread that continuously runs and waits for incoming messages\n // to process it and perform actions accordingly\n \tThread read = new Thread()\n {\n \t public void run()\n {\n \t while(rx_cmd(in,out) != 0) { }\n }\n \t};\n \tread.setDaemon(true); \t// terminate when main ends\n read.setName(\"rx_cmd_\"+my_c_id+\"_SockHandle_to_Server\"+svr_hdl);\n read.start();\t\t// start the thread\t\n }", "public Entry find(Object key) {\n int i = compFunction(key.hashCode());\n SList chain = buckets[i];\n try {\n for (SListNode n = (SListNode) chain.front(); n.isValidNode(); n = (SListNode) n.next()) {\n Entry e = (Entry) n.item();\n if (e.key.equals(key)) {\n return e;\n }\n }\n } catch(InvalidNodeException e) {\n System.out.println(e);\n }\n return null;\n }", "public ChannelLocator getChannelLocator();", "CMSObject getFirstNodeByName(String name, ConnectionInfo connectionInfo) throws RepositoryAccessException;", "public void populateSwitchTenantMap(Server3 server){\n\n\t\tBridge3 bridge;\n\t\tInterfaces3 interfaces;\n\t\tIterator<Bridge3> iteratorBridge = server.getOpenVSwitch().getArrayListBridge().iterator();\n\t\t//Iterate in all bridges of the server to collect the proper information of the bridge\n\t\twhile(iteratorBridge.hasNext()){\n\t\t\tbridge = iteratorBridge.next();\n\t\t\t//Verify if the brigde name is the one configured to host all the VMs. In this version, all VMs have to be hosted \n\t\t\tif(bridge.getName().compareTo(server.getBridgeName())==0){\n\t\t\t\tIterator<Interfaces3> iteratorInterfaces = bridge.getArrayListInterfaces().iterator();\n\t\t\t\t//Iterate in all interfaces of the configured bridge to get all necessary information to populate the structures \n\t\t\t\twhile(iteratorInterfaces.hasNext()){\n\t\t\t\t\tinterfaces = iteratorInterfaces.next();\n\t\t\t\t\tif(interfaces.getOfport() != null && server != null && server.getSw() != null && server.getSw().getId() != null &&\n\t\t\t\t\t\t\tthis.environmentOfServers.getHostLocationHostMap().get(new HostLocation(server.getSw().getId(), interfaces.getOfport())) != null &&\n\t\t\t\t\t\t\tthis.environmentOfServers.getHostLocationHostMap().get(new HostLocation(server.getSw().getId(), interfaces.getOfport())).getIpAddress() != null){\n\t\t\t\t\t\tthis.addToPortMap(server.getSw(), interfaces.getVmsMacAddress(), VlanVid.ofVlan(0), interfaces.getOfport(), \n\t\t\t\t\t\t\t\tthis.environmentOfServers.getHostLocationHostMap().get(new HostLocation(server.getSw().getId(), interfaces.getOfport())).getIpAddress());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public Node getNode(String key) {\n \ttmp = first;\n \tint i;\n \tfor (i=0;i<len;i++) {\n \t\tif (tmp.key == key) {\n \t\t\treturn tmp;\n \t\t}\n \t\ttmp = tmp.getNext();\n \t}\n \treturn null;\n }", "protected ConnectorData provideConnectorData(Properties rootProps,\n Properties configProps) {\n if (getProperty(rootProps, configProps, CONNECTOR) != null) {\n String connectorType = getProperty(rootProps, configProps,\n CONNECTOR);\n if (connectorType.equalsIgnoreCase(\"bku\")) {\n return new ConnectorData(\"bku\",\n Collections.<String, String> emptyMap());\n } else if (connectorType.equalsIgnoreCase(\"moa\")) {\n return new ConnectorData(\"moa\",\n Collections.<String, String> emptyMap());\n } else if (connectorType.equalsIgnoreCase(\"ks\")) {\n Map<String, String> connectorParamaters = new HashMap<String, String>();\n connectorParamaters.put(KS_FILE_NAME,\n getProperty(rootProps, configProps, KS_FILE_NAME));\n connectorParamaters.put(KS_ALIAS,\n getProperty(rootProps, configProps, KS_ALIAS));\n if (getProperty(rootProps, configProps, KS_TYPE) != null) {\n connectorParamaters.put(KS_TYPE,\n getProperty(rootProps, configProps, KS_TYPE));\n } else {\n connectorParamaters.put(KS_TYPE, \"PKCS12\");\n logger.debug(\"Defaulting to PKCS12 keystore type.\");\n }\n if (getProperty(rootProps, configProps, KS_PASS) != null) {\n connectorParamaters.put(KS_PASS,\n getProperty(rootProps, configProps, KS_PASS));\n } else {\n connectorParamaters.put(KS_PASS, \"\");\n }\n if (getProperty(rootProps, configProps, KS_KEY_PASS) != null) {\n connectorParamaters.put(KS_KEY_PASS,\n getProperty(rootProps, configProps, KS_KEY_PASS));\n } else {\n connectorParamaters.put(KS_KEY_PASS, \"\");\n }\n return new ConnectorData(\"ks\", connectorParamaters);\n }\n }\n return null;\n }", "private Node getNode(String name) {\n for(Iterator<Node> i = nodes.iterator(); i.hasNext();) {\n Node n = i.next();\n if(n.getName().equalsIgnoreCase(name)){\n return n;\n };\n }\n return null;\n }", "private ResultSet getArtifactNodes(String buildName, String buildNumber, Map<String, ModuleArtifact> artifactMap) throws SQLException {\n ResultSet rsArtifact;\n rsArtifact = jdbcHelper.executeSelect(\"select distinct n.repo,n.node_path,n.node_name,n.node_id,n.depth,n.sha1_actual,n.sha1_original,n.md5_actual,n.md5_original \\n\" +\n \"from nodes n left outer join node_props np100 on np100.node_id = n.node_id left outer join node_props np101 on np101.node_id = n.node_id \\n\" +\n \"where (( np100.prop_key = 'build.name' and np100.prop_value = ?) and( np101.prop_key = 'build.number' and np101.prop_value =?)) and n.node_type = 1\", buildName, buildNumber);\n\n while (rsArtifact.next()) {\n String sha1 = rsArtifact.getString(6);\n if (artifactMap.get(sha1) == null) {\n artifactMap.put(sha1, new ModuleArtifact(rsArtifact.getString(1), rsArtifact.getString(2), rsArtifact.getString(3), null, null));\n }\n }\n return rsArtifact;\n }", "java.lang.String getEntryNode();", "List<CMSObject> getNodeByName(String name, ConnectionInfo connectionInfo) throws RepositoryAccessException;", "public void connect(Hashtable<String, ArrayList<Node>> cells, Executable target) {\n Coordinate.CellIterator itr = coordinate.getCellIterator();\n while (itr.hasNext()) {\n String idx = itr.next();\n ArrayList<Node> nodes = cells.get(idx);\n if (nodes == null) continue;\n for (Node node : nodes) {\n if (coordinate.SquaredDistance(node.coordinate, coordinate) > Config.LEGAL_SQUARE_DISTANCE || node.equals(this)) {\n// System.out.println(coordinate.toString() + \" \"\n// + node.coordinate.toString() + \"\" + coordinate.SquaredDistance(node.coordinate, coordinate));\n continue;\n }\n connected.add(node);\n node.getConnected().add(this);\n// if (Config.WILL_DRAW) {\n// target.push(c -> {\n// renderEdgeTo(c, node);\n// });\n// }\n }\n }\n }", "public Node getFBNode( Document document )\n {\n \tString multiDb = nameValues.getValue( FormTags.MULTI_DB )[0];\n \tString table1 = nameValues.getValue( FormTags.PRIMARY_TABLE )[0];\n String field1 = nameValues.getValue( FormTags.PRIMARY_FIELD )[0];\n String table2 = nameValues.getValue( FormTags.FOREIGN_TABLE )[0];\n String field2 = nameValues.getValue( FormTags.FOREIGN_FIELD )[0];\n String link = nameValues.getValue( FormTags.LINK_TYPE )[0];\n\n /**GH: MultiDb: Add checks for database name and schema name for multiDb querying**/\n\n String thread = nameValues.getValue(FormTags.SQL_THREAD_NUM_TAG)[0];\n\n\t //If this is not a multiple database form\n \tif (!multiDb.equals(\"\"))\n \t{\n\n \t\t String dbName = nameValues.getValue(FormTags.DB_NAME_TAG)[0];\n \t\t String schemaName = nameValues.getValue(FormTags.SCHEMA_TAG)[0];\n\n\t\t\tif (!dbName.equals(\"\") && (!schemaName.equals(\"\")))\n\t\t\t{\n\t\t\t\ttable1 = dbName +\".\" + schemaName + \".\" + table1;\n\t\t\t\ttable2 = dbName +\".\" + schemaName + \".\" + table2;\n\t MraldOutFile.logToFile(Config.getProperty(\"LOGFILE\"), \"LinkElement: getFBNode: table1 :\" + table1);\n\t\t\t}\n /** GH: End MultiDb **/\n \t}\n\n if ( !link.equals( \"Ignore\" ) )\n {\n\n Element ret = document.createElement( \"link\" );\n\n Element table1Element = document.createElement( \"primarytable\" );\n Text table1Text = document.createTextNode( table1 );\n table1Element.appendChild( table1Text );\n ret.appendChild( table1Element );\n\n Element field1Element = document.createElement( \"primaryfield\" );\n Text field1Text = document.createTextNode( field1 );\n field1Element.appendChild( field1Text );\n ret.appendChild( field1Element );\n\n Element table2Element = document.createElement( \"secondarytable\" );\n Text table2Text = document.createTextNode( table2 );\n table2Element.appendChild( table2Text );\n ret.appendChild( table2Element );\n\n Element field2Element = document.createElement( \"secondaryfield\" );\n Text field2Text = document.createTextNode( field2 );\n field2Element.appendChild( field2Text );\n ret.appendChild( field2Element );\n\n /**MultiDB: Add the SqlThread**/\n if (!thread.equals(\"\") )\n {\n\t Element threadElement = document.createElement( \"sqlThread\" );\n\t Text threadText = document.createTextNode( thread );\n\t threadElement.appendChild( threadText );\n\t ret.appendChild( threadElement );\n }\n return ret;\n }\n else\n {\n return null;\n }\n }", "protected void handleLookUp(Message m) {\n for(IP routeIP: m.getRoutePath()) {\n if(ip.getAddr().equals(routeIP.getAddr()) && ip.getPort() == routeIP.getPort()) {\n return;\n }\n }\n\n // dont spread if step over MAX_HOP\n if( m.getHop() >= m.MAX_HOP ){\n return;\n }\n m.hopAddOne();\n\n m.routePathAddRear(this.ip);\n spread(m);\n }", "private int nextNode(int rid) {\n if (!my_game.getMy_game().isRunning()) {\n return -1;\n }\n Robot robot = my_game.getRobots().get(rid);\n List<node_data> tmp = robots_paths.get(rid);\n if (tmp.isEmpty()) {\n fruits_status.remove(rid);\n synchronized (my_game.getFruits()) {\n if (my_game.getFruits().size() > 0) {\n Fruit fruit = findClosestFruit(robot);\n tmp = algo_g.shortestPath(robot.getSrc(),fruit.getEdge().getSrc());\n node_data dest = my_game.getGraph().getNode(fruit.getEdge().getDest());\n tmp.add(dest);\n robots_paths.put(robot.getId(),tmp);\n fruits_status.put(rid,fruit);\n }\n }\n }\n\n node_data n = tmp.get(0);\n tmp.remove(0);\n return n.getKey();\n\n\n// for (int i = 0; i < tmp.size(); i++) {\n// node_data n = tmp.get(i);\n// tmp.remove(i);\n// if (n.getKey() == robot.getSrc())\n// continue;\n// return n.getKey();\n// }\n// return -1;\n }", "public String lookup(String key){\n Node N = front;\n while( N != null){\n if( N.key.equals(key)){\n return N.value;\n }\n N = N.next;\n }\n return null;\n }", "@Override\n\tpublic CommunicationInfo getCommuInfo(HashMap<String, String> map) {\n\t\treturn null;\n\t}", "protected LinkedEntries.LinkNode getLinkNode(NodeEntry nodeEntry) {\n for (Iterator<LinkedEntries.LinkNode> it = linkNodeIterator(); it.hasNext();) {\n LinkedEntries.LinkNode ln = it.next();\n if (ln.getNodeEntry() == nodeEntry) {\n return ln;\n }\n }\n // not found\n return null;\n }", "@Override\r\n public IGraph<V> connectedGraph(V origin) {\r\n DirectedGraph<V> connectedGraph = new DirectedGraph<>();\r\n try {\r\n Vertex a = null;\r\n Iterator<Vertex> vertexIterator = map.values().iterator();\r\n while(vertexIterator.hasNext()) {\r\n Vertex v = vertexIterator.next();\r\n if(origin.compareTo(v.vertexName) == 0)\r\n a = v;\r\n }\r\n if(a == null)\r\n vertexIterator.next();\r\n connectedGraph.add(origin);\r\n V previous = origin;\r\n for(V v : map.keySet()) {\r\n if(isConnected(previous, v)) {\r\n connectedGraph.add(v);\r\n connectedGraph.connect(previous, v);\r\n previous = v;\r\n }\r\n }\r\n } catch(NoSuchElementException e) {\r\n throw e;\r\n }\r\n return connectedGraph;\r\n }", "Map<String,String> getNodeData(T node);", "private void initCsiAdaptorCache(\n final Map<String, CsiAdaptorProtocol> adaptorMap, Configuration conf)\n throws IOException, YarnException {\n LOG.info(\"Initializing cache for csi-driver-adaptors\");\n String[] addresses =\n conf.getStrings(YarnConfiguration.NM_CSI_ADAPTOR_ADDRESSES);\n if (addresses != null && addresses.length > 0) {\n for (String addr : addresses) {\n LOG.info(\"Found csi-driver-adaptor socket address: \" + addr);\n InetSocketAddress address = NetUtils.createSocketAddr(addr);\n YarnRPC rpc = YarnRPC.create(conf);\n UserGroupInformation currentUser =\n UserGroupInformation.getCurrentUser();\n CsiAdaptorProtocol adaptorClient = NMProxy\n .createNMProxy(conf, CsiAdaptorProtocol.class, currentUser, rpc,\n address);\n // Attempt to resolve the driver by contacting to\n // the diver's identity service on the given address.\n // If the call failed, the initialization is also failed\n // in order running into inconsistent state.\n LOG.info(\"Retrieving info from csi-driver-adaptor on address \" + addr);\n GetPluginInfoResponse response =\n adaptorClient.getPluginInfo(GetPluginInfoRequest.newInstance());\n if (!Strings.isNullOrEmpty(response.getDriverName())) {\n String driverName = response.getDriverName();\n if (adaptorMap.containsKey(driverName)) {\n throw new YarnException(\n \"Duplicate driver adaptor found,\" + \" driver name: \"\n + driverName);\n }\n adaptorMap.put(driverName, adaptorClient);\n LOG.info(\"CSI Adaptor added to the cache, adaptor name: \" + driverName\n + \", driver version: \" + response.getVersion());\n }\n }\n }\n }", "@Override\n public node_data getNode(int key) {\n return nodes.get(key);\n }", "private Handler getConnectorHandler() {\n return connectorHandler;\n }", "static Set get_mapping(HashMap callee_to_caller, Node callee_n) {\n Set s = (Set)callee_to_caller.get(callee_n);\n if (s != null) return s;\n s = NodeSet.FACTORY.makeSet(); s.add(callee_n);\n return s;\n }" ]
[ "0.593699", "0.58908296", "0.55760074", "0.5493732", "0.54519373", "0.54414", "0.53177005", "0.5274909", "0.5224858", "0.520134", "0.51994604", "0.51178753", "0.5104916", "0.50763035", "0.5069218", "0.5044898", "0.50070083", "0.5003873", "0.49984083", "0.49937895", "0.49818578", "0.4977387", "0.49756992", "0.49501047", "0.493532", "0.49256578", "0.49210113", "0.49087533", "0.49063435", "0.48911557", "0.48882675", "0.48690924", "0.48683828", "0.48642114", "0.48612794", "0.48439977", "0.4818205", "0.4818205", "0.48071662", "0.4804574", "0.47929114", "0.47847524", "0.47840756", "0.47766522", "0.47720963", "0.47635987", "0.47574088", "0.47561982", "0.47555652", "0.4740662", "0.47388533", "0.47381902", "0.47350958", "0.47191826", "0.47171706", "0.47164068", "0.47066763", "0.470189", "0.47002405", "0.46955702", "0.46881595", "0.46868762", "0.4685574", "0.4679345", "0.46775058", "0.46733874", "0.46659827", "0.465876", "0.46547085", "0.4648222", "0.46392578", "0.46385562", "0.46368688", "0.46336186", "0.46300325", "0.4628362", "0.4623879", "0.46171293", "0.46165523", "0.46162507", "0.46137094", "0.46125746", "0.46109626", "0.4609936", "0.46096492", "0.45940474", "0.4593657", "0.45934975", "0.4591002", "0.4588887", "0.45852402", "0.45842505", "0.45812806", "0.4571586", "0.45707622", "0.45655584", "0.45598534", "0.45565137", "0.45556366", "0.45541564", "0.4553682" ]
0.0
-1
repeat for each moveable object
public void moveObjectsAlongPath(){ for (int i=0; i<gameObjects.getMoveableObjectsList().size(); i++){ MoveableObject movingOb = gameObjects.getMoveableObjectsList().get(i); if (movingOb.getPathDestination()!=null ){ KPoint start = movingOb.getPathLocation(); KPoint destination = movingOb.getPathDestination(); ArrayList<KPoint> pathPoints = getPathPoints(start, destination, movingOb.getObjectRadius()); movingOb.setCurrentPathTest(pathPoints); } if(movingOb.getCurrentPath().size()>0){ // find the angle the moveable object needs to rotate to by comparing start with the next path point KPoint start = movingOb.getPathLocation(); KPoint nextPoint=movingOb.getCurrentPath().get(1); double targetAngle = Math.atan2(nextPoint.y-start.y, nextPoint.x-start.x ); double angleRemaining = movingOb.getTransform().getRotation() - targetAngle; // fix for beyond pi range if (angleRemaining>Math.PI)angleRemaining -=2*Math.PI; if (angleRemaining<-Math.PI)angleRemaining +=2*Math.PI; if (angleRemaining > 0.1){ //movingOb.rotateAboutCenter(-angleRemaining); movingOb.rotateAboutCenter(-ROTATION_SPEED*movingOb.getSpeed()); } else if (angleRemaining <-0.1){ //movingOb.rotateAboutCenter(-ROTATION_SPEED*movingOb.getSpeed()); movingOb.rotateAboutCenter(ROTATION_SPEED*movingOb.getSpeed()); } else { double angle = movingOb.getTransform().getRotation(); int xAdjust = (int)Math.ceil(Math.cos(angle)*FORCE_AMOUNT*movingOb.getSpeed()); int yAdjust = (int)Math.ceil(Math.sin(angle)*FORCE_AMOUNT*movingOb.getSpeed()); movingOb.applyForce(new Vector2(xAdjust,yAdjust)); } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void move() {\r\n\t\tmoveCount++;\r\n\t}", "@Override\n\tpublic void makeNextMove() \n\t{\n\t}", "private void randomMove() {\n }", "public void move() {\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t\tthis.swim();\r\n\t}", "@Override\n \t\t\t\tpublic void doMove() {\n \n \t\t\t\t}", "public void moveEverythingALittle(){\n //ponieważ wszystko idealnie jest zsynchronizowane to else nie wykona sie gdy current = getDestination\n if(player.getCurrentX()<player.getDestinationX())\n player.currentX += 1;\n else if(player.getCurrentX()>player.getDestinationX())\n player.currentX -= 1;\n\n if( player.getCurrentY()<player.getDestinationY())\n player.currentY += 1;\n else if( player.getCurrentY()>player.getDestinationY())\n player.currentY -= 1;\n\n for(int i = 0; i < boxes.size(); i++){\n Box item = boxes.get(i);\n if(item.getCurrentX()<item.getDestinationX())\n item.currentX += 1;\n else if(item.getCurrentX()>item.getDestinationX())\n item.currentX -= 1;\n\n if( item.getCurrentY()<item.getDestinationY())\n item.currentY += 1;\n else if ( item.getCurrentY()>item.getDestinationY())\n item.currentY -= 1;\n }\n }", "private boolean updateMovingObjects(double elapsedSeconds) {\n for(Movable movingObj : engine.getMovingObjects()){\n double dx = 0, dy = 0;\n switch (movingObj.getFacing()){\n case UP:\n dy -= movingObj.getSpeed() * GRID_SIZE * elapsedSeconds;\n break;\n case DOWN:\n dy += movingObj.getSpeed() * GRID_SIZE * elapsedSeconds;\n break;\n case LEFT:\n dx -= movingObj.getSpeed() * GRID_SIZE * elapsedSeconds;\n break;\n case RIGHT:\n dx += movingObj.getSpeed() * GRID_SIZE * elapsedSeconds;\n break;\n }\n Node movingNode = getNodeById(movingObj.getObjID());\n if(movingNode == null) break; // if the node is deleted\n double oldX = movingNode.getTranslateX();\n double oldY = movingNode.getTranslateY();\n double newX = oldX + dx;\n double newY = oldY + dy;\n\n // translate objs\n movingNode.setTranslateX(newX);\n movingNode.setTranslateY(newY);\n\n // detect collisions\n for(GameObject anotherObj : engine.getAllObjects()){\n // ignore self with self\n if(movingObj.equals(anotherObj)) continue;\n\n Node anotherNode =\n getNodeById(anotherObj.getObjID());\n\n if(isColliding(movingNode, anotherNode)){\n CollisionResult result = engine.handleCollision(movingObj, anotherObj);\n if(handleCollision(result, movingNode, anotherNode, oldX, oldY))\n return true;\n }\n }\n\n engine.changeObjectLocation(movingObj, getUpdatedPoint(movingObj, newX, newY));\n }\n return false;\n }", "public void move(){\n\t\t\n\t}", "private boolean processMovingObject()\n {\n MovingObject[] ap_objects = p_gsb.ap_MovingObjects;\n for (int li = 0;li < ap_objects.length;li++)\n {\n MovingObject p_obj = ap_objects[li];\n\n if (!p_obj.lg_Active) continue;\n\n if (p_obj.process())\n {\n if (p_obj.i_State == MovingObject.STATE_EXPLODE)\n {\n p_obj.lg_Active = false;\n continue;\n }\n }\n\n if (p_obj.i_State == MovingObject.STATE_EXPLODE) continue;\n\n switch (p_obj.i_Type)\n {\n case MovingObject.TYPE_ARROW:\n {\n p_obj.i_scry -= ARROWSPEED;\n if (p_obj.i_scry <= (0 - p_obj.i_height))\n {\n p_obj.lg_Active = false;\n continue;\n }\n }\n ;\n break;\n case MovingObject.TYPE_ASSAULTER:\n {\n if (getRandomInt(1000) <= p_gsb.i_shotfreq)\n {\n MovingObject p_arrow = p_gsb.getInactiveMovingObject();\n if (p_arrow != null)\n {\n p_arrow.activate(MovingObject.TYPE_ARROW,MovingObject.STATE_UP);\n p_arrow.i_scrx = p_obj.i_scrx;\n p_arrow.i_scry = p_obj.i_scry - p_arrow.i_height;\n }\n }\n\n if (p_obj.i_State != MovingObject.STATE_DOWN) generateLadderAndDamForAssaulter(p_obj);\n\n switch (p_obj.i_State)\n {\n case MovingObject.STATE_LEFT:\n {\n if (p_obj.i_scrx - ASSAULTER_HORZSPEED < 0)\n {\n p_obj.setState(MovingObject.STATE_RIGHT,false);\n }\n else\n {\n p_obj.i_scrx -= ASSAULTER_HORZSPEED;\n }\n }\n ;\n break;\n case MovingObject.STATE_RIGHT:\n {\n if (p_obj.i_scrx + p_obj.i_width + ASSAULTER_HORZSPEED >= i_screenWidth)\n {\n p_obj.setState(MovingObject.STATE_LEFT,false);\n }\n else\n {\n p_obj.i_scrx += ASSAULTER_HORZSPEED;\n }\n }\n ;\n break;\n case MovingObject.STATE_UP:\n {\n p_obj.i_scry -= ASSAULTER_VERTSPEED;\n if ((p_obj.i_scry + (p_obj.i_height >> 1)) / VIRTUALCELL_HEIGHT == 0/*p_gsb.i_playeralt*/) return true;\n }\n ;\n break;\n case MovingObject.STATE_DOWN:\n {\n p_obj.i_scry += ASSAULTER_VERTSPEED;\n int i_cellx = p_obj.i_scrx / VIRTUALCELL_WIDTH;\n int i_celly = (p_obj.i_scry + p_obj.i_height - 1) / VIRTUALCELL_HEIGHT;\n boolean lg_stop = false;\n if (i_celly < FIELD_HEIGHT-p_gsb.i_playeralt)\n {\n if (Assault_GSB.getElement(i_cellx,i_celly) != Assault_GSB.CELL_NONE) lg_stop = true;\n }\n else\n {\n lg_stop = true;\n i_celly--;\n }\n\n if (lg_stop)\n {\n p_obj.i_scry = i_celly * VIRTUALCELL_HEIGHT;\n if (getRandomInt(40) >= 20)\n {\n p_obj.setState(MovingObject.STATE_LEFT,false);\n }\n else\n {\n p_obj.setState(MovingObject.STATE_RIGHT,false);\n }\n }\n }\n ;\n break;\n }\n }\n ;\n break;\n case MovingObject.TYPE_STONE:\n {\n if (p_obj.i_State == MovingObject.STATE_DOWN)\n {\n p_obj.i_scry += STONESPEED;\n if ((p_obj.i_scry + p_obj.i_height) >= FIELD_HEIGHT * VIRTUALCELL_HEIGHT)\n {\n p_obj.i_scry = (FIELD_HEIGHT * VIRTUALCELL_HEIGHT) - p_obj.i_height - 1;\n p_obj.setState(MovingObject.STATE_EXPLODE,false);\n }\n }\n }\n ;\n break;\n }\n }\n return false;\n }", "public void moveAll()\n\t{\n\t\tmoveOutput = \"\";\n\t\tfor (int i = 0; i < 20; i++)\n\t\t{\n\t\t\tif (river[i] != null)\n\t\t\t{\n\t\t\t\triver[i].move(i);\n\t\t\t}\n\t\t}\n\t}", "public void turnoZombie(){\n int cont = 0;\n\n while(cont < zombies.size()){\n Zombie tmp = (Zombie) zombies.get(cont);\n //System.out.println(\"Zombie \" + cont + \" | posx: \" + tmp.posX + \" | posy: \" + tmp.posY);\n\n //===============Ataque=========================\n\n int[] target = objetivoAtaque(tmp);\n\n if(target != null){\n Soldado objetivo = (Soldado) tablero[target[0]][target[1]].personaje;\n tmp.atacar(objetivo);\n if(objetivo.vida <= 0){\n soldados.remove(tablero[target[0]][target[1]].personaje);\n tablero[target[0]][target[1]].personaje = null;\n }\n cont++;\n continue;\n }\n\n //===============Vision=========================\n\n int[] destino = vision(tmp);\n\n if(destino != null){\n moverZombie(tmp, destino[0], destino[1]);\n cont++;\n System.out.println(\"Ví algo\");\n System.out.println(\"Zombie \" + cont + \" | posx: \" + destino[0] + \" | posy: \" + destino[1]);\n }\n\n //===============Escucha=========================\n else{\n\n int[] destino2 = escuchar(tmp);\n\n if(destino2 != null){\n moverZombie(tmp, destino2[0], destino2[1]);\n cont++;\n System.out.println(\"Escuché algo\");\n System.out.println(destino2[0] + \", \" + destino2[1]);\n }\n\n //===============Random=========================\n else{\n\n moverZombie(tmp, tmp.posX, tmp.posY + 2);\n cont++;\n System.out.println(\"Random\");\n System.out.println(tmp.posX + \", \" + tmp.posY);\n }\n\n }\n\n }\n this.mostrar();\n }", "public void moveAllItems() {\n for (BaseObject object : getAllItems()) {\n object.move();\n }\n }", "public void move() {\n super.move(DIRECTION.getRandom());\n }", "public void move() {\n\r\n\t}", "private String easyMove() {\n int randomHole = evaluate();\n while (!isValidMove(randomHole)) {\n randomHole = evaluate();\n }\n\n return super.makeAMove(randomHole);\n }", "@Override\n\tpublic void move() {\n\t\t\n\t}", "public void move() {\n\n int move_position_x = 0;\n int move_postion_y = 0;\n Random random = new Random();\n do {\n\n move_position_x = 0;\n move_postion_y = 0;\n int direction = random.nextInt(6);\n switch (direction) {\n case 0:\n move_postion_y = -1;\n break;\n case 1:\n case 4:\n move_postion_y = 1;\n break;\n case 2:\n case 5:\n move_position_x = 1;\n break;\n case 3:\n move_position_x = -1;\n }\n } while ((this.positionX + move_position_x < 0) || (this.positionX + move_position_x >= size_of_map) || (\n this.positionY + move_postion_y < 0) || (this.positionY + move_postion_y >= size_of_map));\n this.positionX += move_position_x;\n this.positionY += move_postion_y;\n }", "@Override\r\n\tpublic void move() {\n\r\n\t}", "private void gameMove() {\n for (int x = 0; x < list.size() - 2; x++) {\n // check if snake is touch coin\n if (Snake().isTouching(list.get(x))) {\n Snake().collected();\n list.get(x).collected();\n }\n }\n Snake().move();\n }", "@Override\n\tpublic void move() {\n\n\t}", "@Override\n\tpublic void move() {\n\t}", "@Override\n public void move () {\n }", "@Override\r\n public void run() {\r\n move();\r\n }", "public void move() {\n for (int i = 0; i < Vampiro.getNumVamp(); i++) {\n\n lista[i].move();\n }\n }", "public void Move()\n {\n \n }", "private void wander(){\n\t\tmonster.moveRandom();\r\n\t\tsaveMove();\r\n\t}", "public void Obstaclemove() {\n for (int i = 0; i < getNumberObstacles(); i++) {\n if (ObstacleDeplace.class.isInstance(getObstacle()[i])) {\n getObstacle()[i].setX(getObstacle()[i].getX() - getObstacle()[i].getSpeed());\n\n if (getObstacle()[i].getX() < -200) {\n getObstacle()[i].setX(600);\n getObstacle()[i].setSpeed(randomGenerator.nextFloat());\n }\n }\n setChanged();\n notifyObstacle(i, getObstacle()[i].getX(), getObstacle()[i].getY());\n }\n }", "public void move() {\n\n }", "private void movementPhase() {\n ClickObserver.getInstance().setCreatureFlag(\"\");\n Platform.runLater(new Runnable() {\n @Override\n public void run() {\n GUI.getDoneButton().setDisable(false);\n TheCupGUI.update();\n Board.removeCovers();\n }\n });\n for (Player p : playerList) {\n \tplayer = p;\n player.flipAllUp();\n\t ClickObserver.getInstance().setActivePlayer(player);\n\t ClickObserver.getInstance().setCreatureFlag(\"Movement: SelectMovers\");\n\t InfoPanel.uncover(player.getName());\n\t if (p.getHexesWithPiece().size() > 0) {\n\t \tClickObserver.getInstance().setClickedTerrain(p.getHexesWithPiece().get(0));\n\t }\n\t pause();\n Platform.runLater(new Runnable() {\n @Override\n public void run() {\n \tClickObserver.getInstance().whenTerrainClicked();\n \t GUI.getHelpText().setText(\"Movement Phase: \" + player.getName()\n + \", Move your armies\");\n \t Game.getRackGui().setOwner(player);\n }\n });\n\t \n\t while (isPaused) {\n \ttry { Thread.sleep(100); } catch( Exception e ){ return; } \n\t }\n\t InfoPanel.cover(player.getName());\n player.flipAllDown();\n }\n Platform.runLater(new Runnable() {\n @Override\n public void run() {\n GUI.getDoneButton().setDisable(true);\n }\n });\n ClickObserver.getInstance().setCreatureFlag(\"\");\n }", "public void moveStopped()\n {\n for (GraphElement element : elements) {\n if(element instanceof Moveable) {\n Moveable moveable = (Moveable) element;\n moveable.setPositionToGhost();\n }\n } \n }", "private static void moveAndPickAllThings(Robot r, int x)\n {\n for(int i=0; i<x; i++)\n {\n r.move();\n while(r.canPickThing())\n {\n r.pickThing();\n }\n }\n \n }", "public void moveObjects() {\n // move ball and paddles\n ball.moveBall();\n playerOnePaddle.movePaddle();\n playerTwoPaddle.movePaddle();\n }", "@Override\r\n\tprotected void onMove() {\n\t\t\r\n\t}", "@Override\n\t\tpublic void run() {\n\t\t\twhile(true)\n\t\t\t{\n\t\t\t\t\t\t\t\t\n\t\t\t\tswitch(this.direct)\n\t\t\t\t{\n\t\t\t\tcase 0:\n\t\t\t\t\t//说明坦克正在向上移动,坦克在一个方向上走30\n\t\t\t\t\t//再换方向\n\t\t\t\t\tfor(int i=0;i<30;i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(y>0&&!this.isTouchOtherEnemy())\n\t\t\t\t\t\t{\n\t\t\t\t\t y-=speed;\n\t\t\t\t\t\t}\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tThread.sleep(50);\n\t\t\t\t\t} catch (InterruptedException e) {\n\t\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase 1:\n\t\t\t\t\tfor(int i=0;i<30;i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(x<360&&!this.isTouchOtherEnemy())\n\t\t\t\t\t\t{\n\t\t\t\t x+=speed;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tThread.sleep(50);\n\t\t\t\t\t\t} catch (InterruptedException e) {\n\t\t\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t break;\n\t\t\t\tcase 2:\n\t\t\t\t\tfor(int i=0;i<30;i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(y<235&&!this.isTouchOtherEnemy())\n\t\t\t\t\t\t{\n\t\t\t\t\t y+=speed;\n\t\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tThread.sleep(50);\n\t\t\t\t\t} catch (InterruptedException e) {\n\t\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\tfor(int i=0;i<30;i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(x>0&&!this.isTouchOtherEnemy())\n\t\t\t\t\t\t{\n\t\t\t\t\t x-=speed;\n\t\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tThread.sleep(50);\n\t\t\t\t\t} catch (InterruptedException e) {\n\t\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t//让敌人的额坦克可以连续打子弹\n\t\t\t\tthis.times++;\n\t\t\t\tif(times%2==0)\n\t\t\t\t{\n\t\t\t\t\tif(isLive)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(hcShoot.size()<5)\n\t\t\t\t\t\t{\t\n\t\t\t\t\t\t Shoot s=null;\n\t\t\t\t\t\t //没有子弹,添加\n\t\t\t\t\t\t\t\t\t\tswitch(direct)\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcase 0:\n\t\t\t\t\t\t\t\t\t\t\ts=new Shoot(x+10,y,0);\n\t\t\t\t\t\t\t\t\t\t\thcShoot.add(s);\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tcase 1:\n\t\t\t\t\t\t\t\t\t\t\ts=new Shoot(x+30,y+10,1);\n\t\t\t\t\t\t\t\t\t\t\thcShoot.add(s);\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tcase 2:\n\t\t\t\t\t\t\t\t\t\t\ts=new Shoot(x+10,y+30,2);\n\t\t\t\t\t\t\t\t\t\t\thcShoot.add(s);\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tcase 3:\n\t\t\t\t\t\t\t\t\t\t\ts=new Shoot(x,y+10,3);\n\t\t\t\t\t\t\t\t\t\t\thcShoot.add(s);\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\t//启动子弹线程\n\t\t\t\t\t\t\t\t\t\tThread t=new Thread(s);\n\t\t\t\t\t\t\t\t\t\tt.start();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t }\n\t\t\t\t\t }\n\t\t\t\t//让坦克随机产生一个新的方向\n\t\t\t\tthis.direct=(int)(Math.random()*4);\n\t\t\t\t//判断敌人的坦克是否死亡\n\t\t\t\tif(this.isLive==false)\n\t\t\t\t{ \n\t\t\t\t\t//敌人的坦克死亡后退出线程\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t}", "public final void forceStartMoveLoop() {\r\n\t\txOff = 0;\r\n\t\tzOff = 0;\r\n\t\tmoveStart = System.currentTimeMillis();\r\n\t}", "public void moveObjsToGoals() {\n\t\tMap<Integer, MovingFObject> map = sc.getInitPos();\r\n\t\tfor(int i = 0; i < map.size(); i++) {\r\n\t\t\tMovingFObject temp = map.get(i);\r\n\t\t\tsc.moveAtVelAtTimeToLoc(i, sc.getMaxVelocity(), 0, (Location)temp.getGoal());\r\n\t\t}\r\n\t}", "public void move() {\n health -= 2; //health decrement\n age++; //age increment\n if (yPos > 300) {\n speed += 3;\n }\n boolean canMove = false;\n int distancex = (int) (Math.random() * speed);\n int distancey = (int) (Math.random() * speed);\n int counterx = r.nextInt(2);\n int countery = r.nextInt(2);\n while (!canMove) {\n distancex = (int) (Math.random() * speed);\n distancey = (int) (Math.random() * speed);\n counterx = r.nextInt(2);\n countery = r.nextInt(2);\n if (counterx == 0 && this.xPos - distancex > 0\n && countery == 0 && this.yPos - distancey > 0) {\n canMove = true;\n } else if (counterx == 1 && this.xPos + distancex < 510\n && countery == 1 && this.yPos + distancey < 530) {\n canMove = true;\n }\n }\n if (counterx == 0 && countery == 0) {\n xPos -= distancex;\n yPos -= distancey;\n } else if (counterx == 0 && countery == 1) {\n xPos -= distancex;\n yPos += distancey;\n } else if (counterx == 1 && countery == 0) {\n xPos += distancex;\n yPos -= distancey;\n } else if (counterx == 1 && countery == 1) {\n xPos += distancex;\n yPos += distancey;\n }\n }", "public void finalizeMove() {\n return;\n }", "void move(Tile t);", "public void makeMove() {\n\t\tif (CheckForVictory(this)) {\n\t\t\t// System.out.println(\"VICTORY\");\n\t\t\tInterface.goalReached = true;\n\t\t\tfor (int i = 0; i < tmpStrings.length; i++) {\n\t\t\t\tif (moveOrder[i] == 0)\n\t\t\t\t\ttmpStrings[i] = \"turn left\";\n\t\t\t\telse if (moveOrder[i] == 1)\n\t\t\t\t\ttmpStrings[i] = \"turn right\";\n\t\t\t\telse\n\t\t\t\t\ttmpStrings[i] = \"go forward\";\n\n\t\t\t\tInterface.info.setText(\"Generation: \" + Parallel.generationNo + 1 + \" and closest distance to goal: \" + 0);\n\t\t\t}\n\t\t} else {\n\t\t\tmoveOrder[this.movesMade] = moves.remove();\n\t\t\tswitch (moveOrder[this.movesMade]) {\n\t\t\tcase (0):\n\t\t\t\tthis.movesMade++;\n\t\t\t\tif (face == 0)\n\t\t\t\t\tface = 3;\n\t\t\t\telse\n\t\t\t\t\tface--;\n\t\t\t\tbreak;\n\t\t\tcase (1):\n\t\t\t\tthis.movesMade++;\n\t\t\t\tif (face == 3)\n\t\t\t\t\tface = 0;\n\t\t\t\telse\n\t\t\t\t\tface++;\n\t\t\t\tbreak;\n\t\t\tcase (2):\n\t\t\t\tthis.movesMade++;\n\t\t\t\tif (face == 0 && Y - 1 >= 0)\n\t\t\t\t\tY--;\n\t\t\t\telse if (face == 1 && X + 1 <= map[0].length - 1)\n\t\t\t\t\tX++;\n\t\t\t\telse if (face == 2 && Y + 1 <= map.length - 1)\n\t\t\t\t\tY++;\n\t\t\t\telse if (face == 3 && X - 1 >= 0)\n\t\t\t\t\tX--;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tSystem.out.println(\"Error making move :(\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "private void random() {\n GameState gs = cc.getGameState();\n ArrayList<int[]> moves = cc.getPlayerMoves(player);\n ArrayList<GameState> states = nextStates(moves, gs);\n for (int[] m : moves) {\n GameState next = checkMove(m, cc);\n states.add(next);\n }\n Random rand = new Random(System.nanoTime());\n int i = rand.nextInt(states.size());\n cc.setAIMove(states.get(i));\n }", "public abstract void doPerMoveWork();", "private void moveMonsters() {\r\n\t\tfor (AreaOrMonster obj : areas) {\r\n\t\t\tif(obj.getLeftRight()) {\r\n\t\t\t\tif(!pirate1.currentLocation.equals(new Point(obj.getX()+1, obj.getY())) && !pirate2.currentLocation.equals(new Point(obj.getX()+1, obj.getY()))) {\r\n\t\t\t\t\tobj.move();\r\n\t\t\t\t\tobj.getImageView().setX(obj.getX() * scalingFactor);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tif(!pirate1.currentLocation.equals(new Point(obj.getX()-1, obj.getY())) && !pirate2.currentLocation.equals(new Point(obj.getX()-1, obj.getY()))) {\r\n\t\t\t\t\tobj.move();\r\n\t\t\t\t\tobj.getImageView().setX(obj.getX() * scalingFactor);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void act(){\n\t\tTile[] possibleMoves = game.getAllNeighbours(currentPosition);\r\n\t\tTile targetTile = possibleMoves[rng.nextInt(4)];\r\n\t\tmove(targetTile);\r\n\t}", "public boolean moveable() {\n //check reach border\n if (reachBorder()) {\n return false;\n }\n //get the location of the next spot to move to\n //move up\n Point nextLocation = this.getCenterLocation();\n if (direction == 12) {\n nextLocation = new Point(this.getCenterX(),\n this.getCenterY() - speed);\n }\n //move right\n if (direction == 3) {\n nextLocation = new Point(this.getCenterX() + speed,\n this.getCenterY());\n\n }\n //move down\n if (direction == 6) {\n nextLocation = new Point(this.getCenterX(),\n this.getCenterY() + speed);\n\n }\n //move left\n if (direction == 9) {\n nextLocation = new Point(this.getCenterX() - speed,\n this.getCenterY());\n }\n\n // get all objects in a circle of radius tileSize * 2 around the players\n //these objects are those which can possibly colide with the players\n int checkRadius = GameUtility.GameUtility.TILE_SIZE * 2;\n for (GameObject gameObject : GameManager.getGameObjectList()) {\n if (GameUtility.GameUtility.distance(gameObject.getCenterLocation(),\n this.getCenterLocation()) < checkRadius) {\n if ((GameUtility.GameUtility.dectectCollision(\n gameObject.getCenterLocation(),\n nextLocation)) && !(GameUtility.GameUtility.dectectCollision(\n gameObject.getCenterLocation(),\n this.getCenterLocation())) && gameObject.getType() != GameObjectType.POWER_UP && gameObject.getType() != GameObjectType.MONSTER && gameObject.getType() != GameObjectType.PLAYER) {\n return false;\n }\n }\n }\n return true;\n\n }", "public void moveAllDrones() {\n for (Pieces d : drones) {\n d.tryToMove(this);\n }\n }", "@Override\r\n\tpublic void move() {\n\t\tPoint target = strategy.search(this.getLocation(), new Point(0,0));\r\n\r\n\t\tint tries = 0;\r\n\t\t\r\n\t\twhile(!state.equals(\"Inactive\") && !game.movement(this, target.x, target.y)){\r\n\t\t\ttarget = strategy.search(new Point(x,y),playerLocation);\r\n\t\t\ttries++;\r\n\t\t\tif(tries > 4) return; // the search strategy has 4 tries to pick a valid location to move to\r\n\t\t}\r\n\t\t\r\n\t\tx = target.x;\r\n\t\ty = target.y;\r\n\r\n\t\tmoveSprite();\r\n\t}", "void move_couple() {\n\t\tfor(int i = 0; i < d; i++){\n\t\t\tif(dancers[i].soulmate == -1) continue;\n\t\t\tPoint curr = this.last_positions[i];\n\t\t\tPoint des = this.dancers[i].des_pos;\n\t\t\tthis.dancers[i].next_pos = findNextPosition(curr, des);\n\t\t}\n\t}", "abstract void move();", "private void moveRobots() {\n\t\tfor(Player p : playerList) {\n\t\t\tif(p.getType() == Player.PlayerType.Robot) {\n\t\t\t\tPoint old = new Point(p.getX(), p.getY());\n\t\t\t\tPoint newPoint = new Point(p.getX(), p.getY());\n\t\t\t\t\n\t\t\t\toccupiedPositions.remove(old);\n\t\t\t\t\n\t\t\t\tint playerX = p.getPlayerToFollow().getX();\n\t\t\t\tint playerY = p.getPlayerToFollow().getY();\n\t\t\t\t\n\t\t\t\t//move towards the agent\n\t\t\t\tif(p.getX() < playerX)\n\t\t\t\t\tnewPoint.x += 1;\n\t\t\t\telse if(p.getX() > playerX)\n\t\t\t\t\tnewPoint.x -= 1;\n\t\t\t\t\n\t\t\t\tif(p.getY() < playerY)\n\t\t\t\t\tnewPoint.y += 1;\n\t\t\t\telse if(p.getY() > playerY)\n\t\t\t\t\tnewPoint.y -= 1;\n\t\t\t\t\n\t\t\t\tp.setPosition(newPoint);\n\t\t\t\t\n\t\t\t\t//check if the robot has moved on to something\n\t\t\t\tif(occupiedPositions.contains(newPoint)) { \t\t// check if the position is occupied\n\t\t\t\t\tfor(Player p2 : playerList) { \t\t\t\n\t\t\t\t\t\tif(!p.getName().equals(p2.getName())) {\t// check so it not is the robot itself\n\t\t\t\t\t\t\tif(newPoint.equals(p2.getPosition())) {\n\t\t\t\t\t\t\t\tif(p2.getType() == PlayerType.Robot) { // if it is a robot, both should be rubble\n\t\t\t\t\t\t\t\t\tp2.setType(PlayerType.Rubble);\n\t\t\t\t\t\t\t\t\tp2.getPlayerToFollow().decreaseRobotsFollowing();\n\t\t\t\t\t\t\t\t\tp.setType(PlayerType.Rubble);\n\t\t\t\t\t\t\t\t\tp.getPlayerToFollow().decreaseRobotsFollowing();\n\t\t\t\t\t\t\t\t\tHandleCommunication.broadcastToClient(null, server.getConnectedClientList(), SendSetting.ChangedType, p.getName(), p2.getName());\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif(p2.getType() == PlayerType.Rubble) { // if it is rubble\n\t\t\t\t\t\t\t\t\tp.setType(PlayerType.Rubble);\n\t\t\t\t\t\t\t\t\tp.getPlayerToFollow().decreaseRobotsFollowing();\n\t\t\t\t\t\t\t\t\tHandleCommunication.broadcastToClient(null, server.getConnectedClientList(), SendSetting.ChangedType, p.getName(), p2.getName());\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if(p2.getType() == PlayerType.Agent) {\n\t\t\t\t\t\t\t\t\tString send = generateSendableHighscoreList();\n\t\t\t\t\t\t\t\t\tserver.sendMessageToClient(p2.getName(), \"@132@\" + highscore.size() + \"@\" + send);\n\t\t\t\t\t\t\t\t\tserver.addTextToLoggingWindow(\"Robot killed player (\" + p2.getName() + \")\");\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\t\n\t\t\t\toccupiedPositions.add(newPoint);\n\t\t\t\tserver.broadcastToClient(p.getName(), SendSetting.PlayerMoved, old, newPoint);\n\t\t\t}\t\n\t\t}\n\t\t\n\t\t//send that it is agents turn again\n\t\tserver.broadcastToClient(null, SendSetting.AgentsTurnToMove, null, null);\n\t}", "private void move(){\n \n currentAnimation = idleDown;\n \n if(playerKeyInput.allKeys[VK_W]){\n int ty = (int) (objectCoordinateY - speed + bounds.y) / 16;\n \n if(!collisionDetection((int) (objectCoordinateX + bounds.x)/16, ty)){\n objectCoordinateY -= speed;\n currentAnimation = upWalk;\n }\n } \n \n if(playerKeyInput.allKeys[VK_S]){\n int ty = (int) (objectCoordinateY + speed + bounds.y + bounds.height) / 16;\n if(!collisionDetection((int) (objectCoordinateX + bounds.x)/16, ty)){\n objectCoordinateY += speed;\n currentAnimation = downWalk;\n }\n } \n \n if(playerKeyInput.allKeys[VK_A]){\n int tx = (int) (objectCoordinateX - speed + bounds.x) / 16;\n if(!collisionDetection(tx, (int) (objectCoordinateY + bounds.y)/16)){\n objectCoordinateX -= speed;\n currentAnimation = sideWalkLeft;\n }\n } \n \n if(playerKeyInput.allKeys[VK_D]){\n int tx = (int) (objectCoordinateX + speed + bounds.x + bounds.width) / 16;\n if(!collisionDetection(tx, (int) (objectCoordinateY + bounds.y)/16)){\n objectCoordinateX += speed;\n currentAnimation = sideWalkRight;\n }\n } \n \n if(playerKeyInput.allKeys[VK_E]){\n currentAnimation = pickUp;\n } \n }", "public void makeMove() {\n ArrayList<Field> myFields = new ArrayList<>();\n for (Field[] fieldsRow : fields) {\n for (Field field : fieldsRow) {\n if(field != null && this.equals(field.getPlayer())) {\n myFields.add(field);\n }\n }\n }\n bestMove[0] = myFields.get(0);\n bestMove[1] = myFields.get(0);\n\n Random rand = new Random();\n for(Field destination : destinationFields) {\n if(canMove()) break;\n destinationField = destination;\n for (Field origin : myFields) {\n for(int i = 0; i < origin.getNeighbours().length; ++i) {\n Field neighbour = origin.getNeighbours()[i];\n if(neighbour != null) {\n if(neighbour.getPlayer() == null) {\n if(valueOfMove(origin, neighbour) > valueOfMove(bestMove[0], bestMove[1])) {\n bestMove[0] = origin;\n bestMove[1] = neighbour;\n } else if(valueOfMove(origin, neighbour) == valueOfMove(bestMove[0], bestMove[1])) {\n if(rand.nextBoolean()) {\n bestMove[0] = origin;\n bestMove[1] = neighbour;\n }\n }\n } else {\n Field nextField = neighbour.getNeighbours()[i];\n if(nextField != null) {\n correctJumpPaths(origin,null, origin);\n }\n }\n }\n }\n }\n }\n }", "boolean prepareToMove();", "void moveVehicles() {\n for (int i = roads.size() - 1; i >= 0; i--) {\n roads.get(i).moveVehicles();\n checkTurns(i);\n\n\n }\n\n }", "void doneMoving();", "private void shootMove() {\n for (int i = 0; i < fires.size(); i++) {\n //子弹往上移动\n fires.get(i).move();\n //注意这里remove需要放在下面\n if (fires.get(i).y < -1000) {\n fires.remove(fires.get(i));\n }\n }\n\n }", "public void nextTurn() {\r\n ArrayList<Bomb> copy_bombs = new ArrayList<>(this.bombs);\r\n for (Bomb b : copy_bombs) {\r\n if(b.getDelay() == 1){\r\n this.explode = true;\r\n }\r\n b.tick();\r\n b.explode(this);\r\n }\r\n this.ordering = new LinkedList<>();\r\n this.fillPlayerQueue();\r\n if (this.random_order) {\r\n Collections.shuffle((List)this.ordering);\r\n }\r\n\r\n this.turn_number++;\r\n }", "public void move();", "public void move();", "private void nextPiece() {\n if (_c == M && _r <= M) {\n _c = 1;\n _r++;\n } else if (_r > M) {\n _move = null;\n } else {\n _c++;\n }\n }", "public void move()\r\n\t{\r\n\t\tfor (int a = 0; a < bullets.size(); a++)\r\n\t\t{\r\n\t\t\tBullet bullet = bullets.get(a);\r\n\t\t\tif (!bullet.move())\r\n\t\t\t{\r\n\t\t\t\tbullets.remove(a);\r\n\t\t\t\ta--;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void movimentar_dragao(int pos) {\n\t\tint check = 0;\n\t\tint counter = 0; //After 1000 tries it means that the dragon is trapped and cant move either way\n\t\twhile (check == 0 && counter < 1000) {\n\t\t\tint random = 1 + (int)(Math.random()*4);\n\t\t\tif (random == 1) {\n\t\t\t\tif (labirinto.getLab()[dragoes[pos].getX_coord()+1][dragoes[pos].getY_coord()] != 'X' && \n\t\t\t\t\t\tlabirinto.getLab()[dragoes[pos].getX_coord()+1][dragoes[pos].getY_coord()] != 'S' &&\n\t\t\t\t\t\tlabirinto.getLab()[dragoes[pos].getX_coord()+1][dragoes[pos].getY_coord()] != 'D' && \n\t\t\t\t\t\tlabirinto.getLab()[dragoes[pos].getX_coord()+1][dragoes[pos].getY_coord()] != 'd' && \n\t\t\t\t\t\tlabirinto.getLab()[dragoes[pos].getX_coord()+1][dragoes[pos].getY_coord()] != 'O') {\n\t\t\t\t\tif (labirinto.getLab()[dragoes[pos].getX_coord()][dragoes[pos].getY_coord()] == 'F')\n\t\t\t\t\t\tlabirinto.setLabCell(dragoes[pos].getX_coord(), dragoes[pos].getY_coord(), 'E');\n\t\t\t\t\telse\n\t\t\t\t\t\tlabirinto.setLabCell(dragoes[pos].getX_coord(), dragoes[pos].getY_coord(), ' ');\n\t\t\t\t\tdragoes[pos].setX_coord(dragoes[pos].getX_coord()+1);\n\t\t\t\t\tcheck = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (random == 2) {\n\t\t\t\tif (labirinto.getLab()[dragoes[pos].getX_coord()-1][dragoes[pos].getY_coord()] != 'X' &&\n\t\t\t\t\t\tlabirinto.getLab()[dragoes[pos].getX_coord()-1][dragoes[pos].getY_coord()] != 'S' &&\n\t\t\t\t\t\tlabirinto.getLab()[dragoes[pos].getX_coord()-1][dragoes[pos].getY_coord()] != 'D' && \n\t\t\t\t\t\tlabirinto.getLab()[dragoes[pos].getX_coord()-1][dragoes[pos].getY_coord()] != 'd' && \n\t\t\t\t\t\tlabirinto.getLab()[dragoes[pos].getX_coord()-1][dragoes[pos].getY_coord()] != 'O') {\n\t\t\t\t\tif (labirinto.getLab()[dragoes[pos].getX_coord()][dragoes[pos].getY_coord()] == 'F')\n\t\t\t\t\t\tlabirinto.setLabCell(dragoes[pos].getX_coord(), dragoes[pos].getY_coord(), 'E');\n\t\t\t\t\telse\n\t\t\t\t\t\tlabirinto.setLabCell(dragoes[pos].getX_coord(), dragoes[pos].getY_coord(), ' ');\n\t\t\t\t\tdragoes[pos].setX_coord(dragoes[pos].getX_coord()-1);\n\t\t\t\t\tcheck = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (random == 3) {\n\t\t\t\tif (labirinto.getLab()[dragoes[pos].getX_coord()][dragoes[pos].getY_coord()-1] != 'X' &&\n\t\t\t\t\t\tlabirinto.getLab()[dragoes[pos].getX_coord()][dragoes[pos].getY_coord()-1] != 'S' &&\n\t\t\t\t\t\tlabirinto.getLab()[dragoes[pos].getX_coord()][dragoes[pos].getY_coord()-1] != 'D' && \n\t\t\t\t\t\tlabirinto.getLab()[dragoes[pos].getX_coord()][dragoes[pos].getY_coord()-1] != 'd' && \n\t\t\t\t\t\tlabirinto.getLab()[dragoes[pos].getX_coord()][dragoes[pos].getY_coord()-1] != 'O') {\n\t\t\t\t\tif (labirinto.getLab()[dragoes[pos].getX_coord()][dragoes[pos].getY_coord()] == 'F')\n\t\t\t\t\t\tlabirinto.setLabCell(dragoes[pos].getX_coord(), dragoes[pos].getY_coord(), 'E');\n\t\t\t\t\telse\n\t\t\t\t\t\tlabirinto.setLabCell(dragoes[pos].getX_coord(), dragoes[pos].getY_coord(), ' ');\n\t\t\t\t\tdragoes[pos].setY_coord(dragoes[pos].getY_coord()-1);\n\t\t\t\t\tcheck = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (labirinto.getLab()[dragoes[pos].getX_coord()][dragoes[pos].getY_coord()+1] != 'X' &&\n\t\t\t\t\t\tlabirinto.getLab()[dragoes[pos].getX_coord()][dragoes[pos].getY_coord()+1] != 'S' &&\n\t\t\t\t\t\tlabirinto.getLab()[dragoes[pos].getX_coord()][dragoes[pos].getY_coord()+1] != 'D' && \n\t\t\t\t\t\tlabirinto.getLab()[dragoes[pos].getX_coord()][dragoes[pos].getY_coord()+1] != 'd' && \n\t\t\t\t\t\tlabirinto.getLab()[dragoes[pos].getX_coord()][dragoes[pos].getY_coord()+1] != 'O') {\n\t\t\t\t\tif (labirinto.getLab()[dragoes[pos].getX_coord()][dragoes[pos].getY_coord()] == 'F')\n\t\t\t\t\t\tlabirinto.setLabCell(dragoes[pos].getX_coord(), dragoes[pos].getY_coord(), 'E');\n\t\t\t\t\telse\n\t\t\t\t\t\tlabirinto.setLabCell(dragoes[pos].getX_coord(), dragoes[pos].getY_coord(), ' ');\n\t\t\t\t\tdragoes[pos].setY_coord(dragoes[pos].getY_coord()+1);\n\t\t\t\t\tcheck = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcounter++;\n\t\t}\n\t}", "boolean doMove();", "void move();", "public void run() {\n if(_dest!=null) {\n approachDest();\n return;\n }\n if(Rand.d100(_frequency)) {\n MSpace m = in.b.getEnvironment().getMSpace();\n if(!m.isOccupied()) {\n Logger.global.severe(in.b+\" has come unstuck\");\n return;\n }\n MSpace[] sur = m.surrounding();\n int i = Rand.om.nextInt(sur.length);\n for(int j=0;j<sur.length;j++) {\n if(sur[i]!=null&&sur[i].isWalkable()&&accept(sur[i])) {\n in.b.getEnvironment().face(sur[i]);\n MSpace sp = in.b.getEnvironment().getMSpace().move(in.b.getEnvironment().getFacing());\n if(sp!=null&&(in.b.isBlind()||!sp.isOccupied())) {\n _move.setBot(in.b);\n _move.perform();\n }\n break;\n }\n if(++i==sur.length) {\n i = 0;\n }\n }\n }\n else if(_dest==null&&Rand.d100(_travel)) {\n _dest = findNewSpace();\n //System.err.println(in.b+\" DEST: \"+_dest);\n }\n }", "public void move() {\n\t\tthis.hero.setPF(1);\n\t\tthis.hero.setState(this.hero.getMoved());\n\t}", "@Override\n public void onMove(boolean absolute) {\n \n }", "public void handleItemMovements() {\n\t\tfor (MovingItem item : currentScene.getMovingItems()) {\n\t\t\tmoveItemX(item);\n\t\t\tmoveItemY(item);\n\t\t\tif (nextScene != null) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\titem.simulateGravity();\n\n\t\t\tif (item.getTranslateXProperty().get() < 0 || item.getTranslateYProperty().get() > currentScene.getHeight() || item.getTranslateYProperty().get() < 0 || item.getTranslateXProperty().get() > currentScene.getWidth()) {\n\t\t\t\titemsToDelete.add(item);\n\t\t\t}\n\t\t\tif (item instanceof Projectile) {\n\t\t\t\tif (((Projectile) item).traveledFullDistance()) itemsToDelete.add(item);\n\t\t\t}\n\t\t\tif (item instanceof Enemy) {\n\t\t\t\tif (((Enemy) item).shouldJump() && item.canJump()) {\n\t\t\t\t\titem.jump();\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (item instanceof ProjectileHurler) {\n\t\t\t\tProjectileHurler hurler = (ProjectileHurler) item;\n\t\t\t\tif (hurler.canFire()) {\n\t\t\t\t\titemsToAdd.add(hurler.fire());\n\t\t\t\t\thurler.resetProjectileCooldown();\n\t\t\t\t} else\n\t\t\t\t\thurler.decrementProjectileCooldownTimer();\n\t\t\t}\n\t\t}\n\t\titemsToDelete.forEach(item -> currentScene.removeItem(item));\n\t\titemsToDelete.clear();\n\t\titemsToAdd.forEach(item -> currentScene.addItem(item));\n\t\titemsToAdd.clear();\n\t\tif (nextScene != null) setCurrentScene();\n\t}", "public abstract void Move();", "public void move() {\r\n\t\tif(torretas.size() == 0){\r\n\t\t\tagregarExplosiones();\r\n\t\t}\r\n\t\tif(System.currentTimeMillis() - init > delay && !control[0])\r\n\t\t\tif(puedeMoverse()){\r\n\t\t\t\tif(random){\r\n\t\t\t\t\tint select = -1;\r\n\t\t\t\t\tboolean move = false;\r\n\t\t\t\t\twhile(!move){\r\n\t\t\t\t\t\tselect = rn.nextInt(4);\r\n\t\t\t\t\t\tif(select == 0 || select == 3){\r\n\t\t\t\t\t\t\tmove = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(select == 2 && hayTorretas(x + defaultWidth/2 + 190, x+defaultWidth)){\r\n\t\t\t\t\t\t\tmove = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(select == 1 && hayTorretas(x, x+defaultWidth/2 - 190)){\r\n\t\t\t\t\t\t\tmove = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} \r\n\t\r\n\t\t\t\t\tint auxX = x;\r\n\t\t\t\t\tint auxY = y;\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(select == 0){\r\n\t\t\t\t\t\tmoves[0] = moves[1] = true;\r\n\t\t\t\t\t\tx = -237;\r\n\t\t\t\t\t\ty = -defaultHeight;\r\n\t\t\t\t\t\tvelocidad = 4;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(select == 1){\r\n\t\t\t\t\t\tmoves[2] = moves[3] = true;\r\n\t\t\t\t\t\tx = 800;\r\n\t\t\t\t\t\ty = 0;\r\n\t\t\t\t\t\tvelocidad = 3;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(select == 2){\r\n\t\t\t\t\t\tmoves[4] = moves[5] = true;\r\n\t\t\t\t\t\tx = - defaultWidth;\r\n\t\t\t\t\t\ty = 0;\r\n\t\t\t\t\t\tvelocidad = 3;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(select == 3){\r\n\t\t\t\t\t\tmoves[6] = moves[7] = true;\r\n\t\t\t\t\t\tx = -237;\r\n\t\t\t\t\t\ty = 800;\r\n\t\t\t\t\t\tvelocidad = 5;\r\n\t\t\t\t\t\treproductor.addSound(alarm, false);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tactualizarTorretas(x-auxX, y-auxY);\r\n\t\t\t\t\t\r\n\t\t\t\t\trandom = false;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t//movimiento de arriba a abajo\r\n\t\t\t\tif(!moves[2] && !moves[3] && !moves[4] && !moves[5] && !moves[6] && !moves[7])\r\n\t\t\t\tif(moves[0] && y + defaultHeight < 500){\r\n\t\t\t\t\ty +=velocidad;\r\n\t\t\t\t\tactualizarTorretas(0, +velocidad);\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\tmoves[0] = false;\r\n\t\t\t\t\tif(y + defaultHeight > -100 && moves[1]){\r\n\t\t\t\t\t\ty-=velocidad;\r\n\t\t\t\t\t\tactualizarTorretas(0, -velocidad);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tmoves[1] = false;\r\n\t\t\t\t\t\trandom = true;\r\n\t\t\t\t\t\tinit = System.currentTimeMillis();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t//movimiento de derecha a izquierda\r\n\t\t\t\tif(!moves[0] && !moves[1] && !moves[4] && !moves[5] && !moves[6] && !moves[7])\r\n\t\t\t\tif(moves[2] && x > 250){\t\r\n\t\t\t\t\tx-=velocidad;\r\n\t\t\t\t\tactualizarTorretas(-velocidad,0);\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\tmoves[2] = false;\r\n\t\t\t\t\tif(x < 900 && moves[3]){\r\n\t\t\t\t\t\tx+=velocidad;\r\n\t\t\t\t\t\tactualizarTorretas(velocidad,0);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\tmoves[3] = false;\r\n\t\t\t\t\t\trandom = true;\r\n\t\t\t\t\t\tinit = System.currentTimeMillis();\r\n\t\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t//movimiento de izquierda a derecha\r\n\t\t\t\tif(!moves[0] && !moves[1] && !moves[2] && !moves[3] && !moves[6] && !moves[7])\r\n\t\t\t\tif(moves[4] && x + defaultWidth < 550){\r\n\t\t\t\t\t\r\n\t\t\t\t\tx+=velocidad;\r\n\t\t\t\t\tactualizarTorretas(velocidad,0);\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\tmoves[4] = false;\r\n\t\t\t\t\tif(x + defaultWidth > -100 && moves[5]){\r\n\t\t\t\t\t\tx-=velocidad;\r\n\t\t\t\t\t\tactualizarTorretas(-velocidad,0);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\tmoves[5] = false;\r\n\t\t\t\t\t\trandom = true;\r\n\t\t\t\t\t\tinit = System.currentTimeMillis();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t//movimiento de abajo a arriba\r\n\t\t\t\tif(!moves[0] && !moves[1] && !moves[2] && !moves[3] && !moves[4] && !moves[5])\r\n\t\t\t\tif(moves[6] && y > 250){\r\n\t\t\t\t\ty-=velocidad;\r\n\t\t\t\t\tactualizarTorretas(0,-velocidad);\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\tmoves[6] = false;\r\n\t\t\t\t\tif(y < 700 && moves[7]){\r\n\t\t\t\t\t\ty+=velocidad;\r\n\t\t\t\t\t\tactualizarTorretas(0,velocidad);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\tmoves[7] = false;\r\n\t\t\t\t\t\trandom = true;\r\n\t\t\t\t\t\tinit = System.currentTimeMillis();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\tsetMove();\r\n\t}", "public void move() {\n\t\tmoveX();\n\t\tmoveY();\n\t}", "private void move()\r\n {\r\n int num = Game.random(4);\r\n String direction;\r\n if (num == 0)\r\n direction = \"north\";\r\n else if (num == 1)\r\n direction = \"east\";\r\n else if (num == 2)\r\n direction = \"south\";\r\n else //num == 3\r\n direction = \"west\";\r\n Room nextRoom = room.nextRoom(direction);\r\n if (nextRoom != null)\r\n {\r\n changeRoom(nextRoom);\r\n \r\n //Monster or Robot greets everyone was already in the room\r\n ArrayList<Person> peopleList = new ArrayList<Person>();\r\n \r\n peopleList = nextRoom.getPeople();\r\n peopleList.remove(name);\r\n \r\n String greetings =\"Hey \";\r\n for (int i=0; i<peopleList.size(); i++)\r\n \tgreetings += peopleList.get(i).getName() + \", \";\r\n\r\n if (!(peopleList.size()==0))\r\n \tsay(greetings);\r\n } \r\n \r\n }", "@Override\n public void update(Frame frame) {\n if (JoyButton.contains(frame.getButtonPressed(), JoyButton.BUTTON_TOUCH_SINGLE)) {\n SceneObject object = SceneObject.fromDrawable(getApp().getContext(), R.mipmap.ic_launcher);\n object.position(new Vector3f(random.nextFloat() * 5.0f - 2.5f, random.nextFloat() * 5.0f - 2.5f, random.nextFloat() * 5.0f - 2.5f));\n objects.add(object);\n addChildObject(object);\n }\n // If long tap detected, remove all spawned objects\n else if (JoyButton.contains(frame.getButtonPressed(), JoyButton.BUTTON_TOUCH_LONGPRESS)) {\n\n for (SceneObject object : objects) {\n removeChildObject(object);\n }\n objects.clear();\n }\n\n // Move spawned objects\n for (SceneObject object : objects) {\n object.position(object.position().sub(0, 0, 0.1f));\n }\n\n super.update(frame);\n }", "public abstract void doFunction(ArrayList<Movable> movingObjs);", "public abstract void move();", "public abstract void move();", "public abstract void move();", "public abstract void move();", "public abstract void move();", "public abstract void move();", "public abstract void move();", "private void randMove(Person[] array){\r\n\t\t\tlogger.info(\"randMoving starts\");\r\n\t\t\tArrayList<Integer> remaining = new ArrayList<>();\r\n\t\t\tfor (int i = 0; i < array.length; i++) {\r\n\t\t\t\tremaining.add(i);\r\n\t\t\t}\r\n\t\t\tint step = 0;\r\n\t\t\tboolean isAgentArray = false;\r\n\t\t\tif(array[0] instanceof Agent) isAgentArray = true;\r\n\r\n\t\t\t//select from remaining index when remaining is not empty\r\n\t\t\twhile (step<array.length) {\r\n\t\t\t\tint index = randInt(0,remaining.size()-1);\r\n\t\t\t\tif(remaining.get(index)>=0){\r\n\t\t\t\t\t//move agents and cops here\r\n\t\t\t\t\tif(isAgentArray){\r\n\t\t\t\t\t\tif(agents[index].getJailTerm() == 0)\r\n\t\t\t\t\t\t\tagents[index].move();\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse cops[index].move();\r\n\t\t\t\t\tremaining.set(index,-1);\r\n\t\t\t\t\tstep++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tlogger.info(\"randmove finished after \" + step + \"iterations.\");\r\n\t\t}", "@Override\n public final void move() {\n int x = getPosisi().getX();\n int y = getPosisi().getY();\n int dx = 0, dy = 0;\n\n if (getWaktu() % getDeltaTime() == 0) {\n do {\n do {\n Random randomGenerator = new Random();\n dx = randomGenerator.nextInt(N_RAND) - 1;\n dy = randomGenerator.nextInt(N_RAND) - 1;\n } while (dx == 0 && dy == 0);\n } while (x + dx < 0 || x + dx > getWorldSize() - 1\n || y + dy < 0 || y + dy > getWorldSize() - 1);\n }\n setPX(x + dx);\n setPY(y + dy);\n }", "public void moveConstructor() {\n this.loopAndAddMoves(1, 1);\n this.loopAndAddMoves(-1, 1);\n this.loopAndAddMoves(1, -1);\n this.loopAndAddMoves(-1, -1);\n this.loopAndAddMoves(0, 1);\n this.loopAndAddMoves(0, -1);\n this.loopAndAddMoves(1, 0);\n this.loopAndAddMoves(-1, 0);\n }", "private void enemyMove() {\n\t\tArrayList<EnemySprite> enemylist = this.model.getEnemy();\n\t\tfor(EnemySprite sp :enemylist) {\n\t\t\tif(sp instanceof NormalEnemySprite) {\n\t\t\t\t\n\t\t\t\t((NormalEnemySprite)sp).move();\n\t\t\t}\n\t\t\t\n\t\t\telse if(sp instanceof PatrollingEnemySprite) {\n\t\t\t\t\n\t\t\t\t((PatrollingEnemySprite) sp).move();\n\t\t\t\t\n\t\t\t} \n\t\t\t\n\t\t\telse if (sp instanceof BigEnemySprite) {\n\t\t\t\t((BigEnemySprite)sp).move();\n\t\t\t}\n\t\t\t\n\t\t\telse if (sp instanceof PatrollingBigEnemySprite) {\n\t\t\t\t((PatrollingBigEnemySprite) sp).move();\n\t\t\t}\n\t\t\t\n\t\t\telse if (sp instanceof CircleBigEnemySprite) {\n\t\t\t\t((CircleBigEnemySprite) sp).move();\n\t\t\t}\n\t\t}\n\t\t\n\t\t\t\t\n\t}", "public void move() {\n\t\tif ( board.getLevel() == 5 )\n\t\t\tmovementIndex = ( movementIndex + 1 ) % movement.length;\n\t}", "protected void onMove() {\r\n }", "public void makeNextMove() {\n\t\ttakeNextNonTabuedCheapestStep();\n\t\t}", "private void checkMovement()\n {\n if (frames % 600 == 0)\n {\n \n ifAllowedToMove = true;\n \n \n }\n \n }", "boolean makeMove();", "public boolean moveNext(\n )\n {\n // Scanning the current graphics object...\n ContentObject currentObject = getCurrent();\n if(currentObject != null)\n {\n \t\n \tString cmdStr = currentObject.toString();\n \t/*\n \tif(cmdStr.contains(\"f*\") || cmdStr.contains(\"{f }\")) {\n \t\tSystem.out.println(cmdStr);\n \t}\n \t*/\n \tif(!cmdStr.contains(\"{re [36, 270, 540, 720]}, {f }\")) {\n \t\tcurrentObject.scan(state);\n \t}\n }\n\n // Moving to the next object...\n if(index < objects.size())\n {index++; refresh();}\n\n return getCurrent() != null;\n }", "public void move()\n\t{\n time++;\n\t\tif (time % 10 == 0)\n\t\t{\n\t\t\thistogramFrame.clearData();\n\t\t}\n\t\tfor (int i = 0; i < nwalkers; i++)\n\t\t{\n\t\t\tdouble r = random.nextDouble();\n\t\t\tif (r <= pRight)\n\t\t\t{\n\t\t\t\txpositions[i] = xpositions[i] + 1;\n\t\t\t}\n\t\t\telse if (r < pRight + pLeft)\n\t\t\t{\n\t\t\t\txpositions[i] = xpositions[i] - 1;\n\t\t\t}\n\t\t\telse if (r < pRight + pLeft + pDown)\n\t\t\t{\n\t\t\t\typositions[i] = ypositions[i] - 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\typositions[i] = ypositions[i] + 1;\n\t\t\t}\n\t\t\tif (time % 10 == 0)\n\t\t\t{\n\t\t\t\thistogramFrame.append(Math.sqrt(xpositions[i] * xpositions[i]\n\t\t\t\t\t\t+ ypositions[i] * ypositions[i]));\n\t\t\t}\n\t\t\txmax = Math.max(xpositions[i], xmax);\n\t\t\tymax = Math.max(ypositions[i], ymax);\n\t\t\txmin = Math.min(xpositions[i], xmin);\n\t\t\tymin = Math.min(ypositions[i], ymin);\n\t\t}\n\t}", "public abstract void randomMoves();", "public void move() {\n\t\tif (isLuck) {\n\t\t\tif (rand.nextBoolean()) {\n\t\t\t\txPos++;\n\t\t\t}\n\t\t} else {\n\t\t\tif (rightCount < skill) {\n\t\t\t\trightCount++;\n\t\t\t\txPos++;\n\t\t\t}\n\t\t}\n\t}", "public void act() \r\n {\r\n if (startTime > 0) {\r\n startTime--;\r\n }\r\n else {\r\n if (isScared()) {\r\n doScareMode();\r\n }\r\n else {\r\n if (counter == 0 || !canMove(currDirectionStr)) {\r\n counter = CELL_SIZE * 4;\r\n prevDirection = currDirection;\r\n do {\r\n currDirection = (int)(Math.random() * 10);\r\n if (currDirection == 0) {\r\n currDirectionStr = \"up\";\r\n }\r\n else if (currDirection == 1) {\r\n currDirectionStr = \"left\";\r\n }\r\n else if (currDirection == 2) {\r\n currDirectionStr = \"down\";\r\n }\r\n else if (currDirection == 3) {\r\n currDirectionStr = \"right\";\r\n }\r\n } while (!canMove(currDirectionStr));\r\n }\r\n \r\n if (canMove(currDirectionStr)) {\r\n move(currDirectionStr);\r\n }\r\n counter--;\r\n } \r\n }\r\n }", "@Override\n\tpublic boolean movable(Entity obj) {\n\t\treturn true;\n\t}", "private void handleMovement() {\n if (movements.isEmpty()) return;\n try {\n switch (movements.peek()) {\n case MOVE_UP:\n game.movePlayer(Direction.N);\n break;\n case MOVE_LEFT:\n game.movePlayer(Direction.W);\n break;\n case MOVE_DOWN:\n game.movePlayer(Direction.S);\n break;\n case MOVE_RIGHT:\n game.movePlayer(Direction.E);\n break;\n }\n } catch (Exception ignored) { }\n }", "public void move()\n {\n if (!alive) {\n return;\n }\n\n if (speedTimer > 0) {\n speedTimer --;\n } else if (speedTimer == 0 && speed != DEFAULT_SPEED) {\n speed = DEFAULT_SPEED;\n }\n\n Location last = playerLocations.get(playerLocations.size()-1);\n Location next = null;\n\n // For the speed, iterate x blocks between last and next\n\n if (direction == UPKEY)\n {\n next = getLocation(last.getX(), (int)(last.getY() - speed * getPixelSize()));\n } else if (direction == DOWNKEY)\n {\n next = getLocation(last.getX(), (int)(last.getY() + speed * getPixelSize()));\n } else if (direction == LEFTKEY)\n {\n next = getLocation((int)(last.getX() - speed * getPixelSize()), last.getY());\n } else if (direction == RIGHTKEY)\n {\n next = getLocation((int)(last.getX() + speed * getPixelSize()), last.getY());\n }\n\n ArrayList<Location> line = getLine(last, next);\n\n if (line.size() == 0) {\n gameOver();\n return;\n }\n\n for (Location loc : line) {\n if (checkCrash (loc)) {\n gameOver();\n return;\n } else {\n // Former bug: For some reason when a player eats a powerup a hole appears in the line where the powerup was.\n Location l2 = getLocation(loc.getX(), loc.getY());\n l2.setType(LocationType.PLAYER);\n l2.setColor(this.col);\n\n playerLocations.add(l2);\n getGridCache().add(l2);\n }\n }\n }", "void move()\n {\n Random rand = new Random();\n int moveOrNot = rand.nextInt(2);//50% chance\n if(moveOrNot == 1)\n super.move();\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 }" ]
[ "0.68882495", "0.6840661", "0.6706359", "0.66982454", "0.66090673", "0.6584404", "0.6485088", "0.6456513", "0.6454904", "0.6416398", "0.6394383", "0.63820475", "0.6368092", "0.6293158", "0.628855", "0.62820023", "0.62696534", "0.62653804", "0.6255368", "0.62419343", "0.6217332", "0.6195628", "0.61953527", "0.6186458", "0.6174761", "0.6166581", "0.6145085", "0.61330295", "0.612908", "0.6129042", "0.6122878", "0.61227137", "0.6120006", "0.6097116", "0.6096317", "0.60796255", "0.60693806", "0.60669845", "0.6060374", "0.6050281", "0.6047022", "0.6042834", "0.601105", "0.60019326", "0.60015345", "0.59902513", "0.59897447", "0.59706837", "0.59681946", "0.595052", "0.59451896", "0.5943596", "0.5938257", "0.59348977", "0.59324765", "0.5927192", "0.5915026", "0.59149456", "0.59149456", "0.5912387", "0.59065324", "0.5905369", "0.5904948", "0.5897536", "0.58930075", "0.5892452", "0.58870775", "0.5882259", "0.5880801", "0.58749795", "0.5872929", "0.58689713", "0.58613497", "0.58569634", "0.58492696", "0.58492696", "0.58492696", "0.58492696", "0.58492696", "0.58492696", "0.58492696", "0.584562", "0.58402467", "0.5840198", "0.5837268", "0.58310395", "0.5825443", "0.5823899", "0.58232486", "0.58213043", "0.5809859", "0.5807832", "0.5804797", "0.57987726", "0.5792282", "0.5790819", "0.57863647", "0.5781269", "0.57805955", "0.5777747" ]
0.6169385
25
test for drawing the obstacles
public ArrayList<PathBlockingObstacle> getStationaryObstacles(){ ArrayList<PathBlockingObstacle> obstacles = (ArrayList)obstaclesMap.get(gameObjects.getMoveableObjectsList().get(0).getObjectRadius()); return obstacles; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void drawObstacle(Graphics2D g2){\n\t\tif( obstacleExists() ){\n\t\t\t// Get the overlay screen position of the obstacle.\n\t\t\tPoint scr_obs_top = overlayPoint(toScaledX(getObstacleDistance()+getDefaultTHR()), toScaledY(-getObstacleHeight()));\n\t\t\tPoint scr_obs_bottom = overlayPoint(toScaledX(getObstacleDistance()+getDefaultTHR()), toScaledY(0));\n\t\t\t\n\t\t\tFont font = new Font(\"default\", Font.BOLD, 16);\n\t\t\tdrawLineBetween(g2, font, scr_obs_bottom, scr_obs_top, getObstacleHeight()+\"m\", 0);\n\t\t\t// Slope visualisation.\n\t\t\tPoint scr_slope_end = null;\n\t\t\tif(isBeforeObstacle()){\n\t\t\t\tscr_slope_end = overlayPoint(toScaledX(getObstacleDistance()+getDefaultTHR()-slopeLength), toScaledY(0));\n\t\t\t}else{\n\t\t\t\tscr_slope_end = overlayPoint(toScaledX(getObstacleDistance()+getDefaultTHR()+slopeLength), toScaledY(0));\n\t\t\t}\n\t\t\tdrawLineBetween(g2, font, scr_obs_top, scr_slope_end, \"\", 0, false, Color.red);\n\t\t\tdrawLineBetween(g2, font, scr_obs_bottom, scr_slope_end, \"Slope = \"+slopeLength+\"m\", -2 * getVerticalSpacing(), true, Color.red);\n\t\t}\n\t}", "private void genObstacle(Group root, String runwayId, Integer verticalOffset){\n String obstacleId = controller.getRunwayObstacle(runwayId);\n Integer obstacleHeight = controller.getPredefinedObstacleHeight(obstacleId);\n Integer obstacleWidth = controller.getPredefinedObstacleWidth(obstacleId);\n Integer obstacleLength = controller.getPredefinedObstacleLength(obstacleId);\n Integer distanceFromCenterline = controller.getDistanceFromCenterline(runwayId);\n Integer distanceFromThreshold = controller.getDistanceFromThreshold(runwayId) + controller.getObstacleOffset(runwayId);\n\n // Obstacle box fill\n Box obstacle = new Box(obstacleWidth, obstacleHeight, obstacleLength);\n PhongMaterial obstacleMaterial = new PhongMaterial(convertToJFXColour(OBSTACLE_FILL_COLOUR));\n obstacle.setMaterial(obstacleMaterial);\n //The position of the obstacle on the runway has to dependent on the distance from threshold and centerline\n Point runwayPos = controller.getRunwayPos(runwayId);\n obstacle.setTranslateX(runwayPos.x - distanceFromCenterline);\n obstacle.setTranslateZ(-runwayPos.y + distanceFromThreshold + obstacleWidth/2);\n obstacle.setTranslateY(-obstacleHeight/2-verticalOffset);\n obstacle.setDrawMode(DrawMode.FILL);\n\n // Obstacle box borders\n /*Box obstacleStroke = new Box(obstacleWidth, obstacleHeight, obstacleLength);\n PhongMaterial obstacleStrokeMaterial = new PhongMaterial(convertToJFXColour(Settings.OBSTACLE_STROKE_COLOUR));\n obstacleStroke.setMaterial(obstacleStrokeMaterial);\n obstacleStroke.setTranslateX(runwayPos.x - distanceFromCenterline);\n obstacleStroke.setTranslateZ(-runwayPos.y + distanceFromThreshold + obstacleWidth/2);\n obstacleStroke.setTranslateY(-obstacleHeight/2-verticalOffset);\n obstacleStroke.setDrawMode(DrawMode.LINE);*/\n\n// Box slopePlane = genSlope(root, runwayId, verticalOffset);\n\n Rotate rotate = new Rotate(controller.getBearing(runwayId), distanceFromCenterline, 0,-distanceFromThreshold - obstacleWidth/2, Rotate.Y_AXIS);\n obstacle.getTransforms().add(rotate);\n //obstacleStroke.getTransforms().add(rotate);\n// slopePlane.getTransforms().add(rotate);\n\n //root.getChildren().addAll(obstacle, obstacleStroke);\n// root.getChildren().addAll(obstacle, slopePlane);\n root.getChildren().add(obstacle);\n }", "void obstaclesCallback(final GridCells msg){\n int num_obst = msg.getCells().size();\n me.obstacle_lock_.lock();\n try{\n me.obstacle_points_.clear();\n\n for (int i = 0; i < num_obst; i++) {\n PointStamped in=messageFactory.newFromType(PointStamped._TYPE);\n PointStamped result=messageFactory.newFromType(PointStamped._TYPE);\n in.setHeader(msg.getHeader());\n in.setPoint(msg.getCells().get(i));\n //ROS_DEBUG(\"obstacle at %f %f\",msg->cells[i].x,msg->cells[i].y);\n //TODO:Need Transform\n/* try {\n tf_->waitForTransform(global_frame_, robot_base_frame_, msg->header.stamp, ros::Duration(0.2));\n\n tf_->transformPoint(global_frame_, in, result);\n }\n catch (tf::TransformException ex){\n ROS_ERROR(\"%s\",ex.what());\n return;\n };*/\n\n me.obstacle_points_.add(new Vector2(result.getPoint().getX(),result.getPoint().getY()));\n }\n }finally {\n me.obstacle_lock_.unlock();\n }\n\n }", "private void analyzeForObstacles() {\n \t\n \t\n \tStack<Rect> bestFound = new Stack<Rect>();//This is a stack as the algorithm moves along x linearly\n \tboolean[][] blackWhiteGrid = getBlackWhiteGrid();\n \tint[] cache = new int[grid.length];\n \t\n \twhile (true) {\n\t\t\tboolean noneFound = true;\n\t\t\t\n\t\t\tfor (int i = 0; i<cache.length; i++)\n\t\t\t\tcache[i] = 0;\n\t\t\tfor (int llx = grid.length -1; llx >= 0; llx--) {\n\t\t\t\tupdate_cache(blackWhiteGrid,cache, llx);\n\t\t\t\tfor (int lly = 0; lly < grid.length; lly++) {\n\t\t\t\t\tRect bestOfRound = new Rect(llx,lly,llx,lly);\n\t\t\t\t\tint y = lly;\n\t\t\t\t\tint x_max = 9999;\n\t\t\t\t\tint x = llx;\n\t\t\t\t\twhile (y+1<grid.length && blackWhiteGrid[llx][y]) {\n\t\t\t\t\t\ty++;\n\t\t\t\t\t\tx = Math.min(llx+cache[y]-1, x_max);\n\t\t\t\t\t\tx_max = x;\n\t\t\t\t\t\tRect tryRect = new Rect(llx,lly-1,x,y);\n\t\t\t\t\t\tif (tryRect.area() > bestOfRound.area()) {\n\t\t\t\t\t\t\tbestOfRound = tryRect;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (bestOfRound.area() > 40) {\n\t\t\t\t\t\tif (noneFound) {\n\t\t\t\t\t\t\tbestFound.push(bestOfRound);\n\t\t\t\t\t\t\tnoneFound = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tRect lastRect = bestFound.peek();\n\t\t\t\t\t\t\tif (lastRect.area() < bestOfRound.area()) {\n\t\t\t\t\t\t\t\tbestFound.pop();\n\t\t\t\t\t\t\t\tbestFound.push(bestOfRound);\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}\n\t\t\tif (noneFound)\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tclearFoundRectangle(blackWhiteGrid, bestFound.peek());\n \t}\n \t\n \t//add found rectanlges\n \tobstacles.clear();\n \tobstacles.addAll(bestFound);\n \tSystem.out.println(\"Sweep done:\");\n \tfor (Rect r : bestFound){\n \t\tSystem.out.println(\"Rect: llx=\" + (r.llx-400) + \"\\tlly=\" + (r.lly-400) + \"\\turx=\" + (r.urx-400) + \"\\tury=\" + (r.ury-400));\n \t\tList<Point2D.Double> corners = new ArrayList<Point2D.Double>();\n \t\tcorners.add(new Point2D.Double((r.llx-400),(r.lly-400)));\n \t\tcorners.add(new Point2D.Double((r.llx-400),(r.ury-400)));\n \t\tcorners.add(new Point2D.Double((r.urx-400),(r.lly-400)));\n \t\tcorners.add(new Point2D.Double((r.urx-400),(r.ury-400)));\n \t\tobstaclesF.add(new Obstacle(corners));\n \t}\n \t\n \ttoExplore.clear();\n \tint i = 0;\n \tRandom rand = new Random();\n \twhile (toExplore.size() < 10 && i < 1000) {\n \t\tint x = rand.nextInt(grid.length);\n \t\tint y = rand.nextInt(grid.length);\n \t\tif (grid[x][y] == .5) {\n \t\t\ttoExplore.add(new Flag(\"blue\",x,y));\n \t\t}\n \t}\n }", "@Test\n public void testWithObstacle() {\n Grid g = new Grid(3, 3, 0, 0, 0, 0);\n Obstacle o = new Obstacle(1, 1);\n g.setObject(o, 1, 1);\n g.setObject(o, 1, 2);\n AStarStrategy strategy = new AStarStrategy();\n\n Location from = new Location(0, 0);\n Location to = new Location(2, 2);\n Path path = strategy.generatePath(g, from, to);\n assertNotNull(path);\n assertEquals(4, path.getMoves().size());\n assertEquals(Move.DOWN, path.getMoves().get(0).direction);\n assertEquals(Move.DOWN, path.getMoves().get(1).direction);\n assertEquals(Move.RIGHT, path.getMoves().get(2).direction);\n assertEquals(Move.RIGHT, path.getMoves().get(3).direction);\n }", "public boolean[] areObstaclesDetected()\n {\n return finchController.areObstaclesDetected();\n }", "public boolean estObstacle(int x, int y){\r\n\t\tif(y >= 0 && y < hauteur && x >= 0 && x < largeur)\r\n\t\t\treturn this.plateau[y][x].estObstacle();\r\n\t\treturn false;\r\n\t}", "@Test\n public void testWithObstacle2() {\n Grid g = new Grid(3, 3, 0, 0, 0, 0);\n Obstacle o = new Obstacle(1, 1);\n g.setObject(o, 1, 0);\n g.setObject(o, 1, 1);\n AStarStrategy strategy = new AStarStrategy();\n\n Location from = new Location(0, 0);\n Location to = new Location(2, 2);\n Path path = strategy.generatePath(g, from, to);\n assertNotNull(path);\n assertEquals(4, path.getMoves().size());\n assertEquals(Move.RIGHT, path.getMoves().get(0).direction);\n assertEquals(Move.RIGHT, path.getMoves().get(1).direction);\n assertEquals(Move.DOWN, path.getMoves().get(2).direction);\n assertEquals(Move.DOWN, path.getMoves().get(3).direction);\n }", "public void spawnObstacle(){\n\t\tif(this.seconds > this.nextSpawn && !this.gameOver){\n\t\t\tint pX = this.radom.nextInt(350);\n\t\t\tthis.obstacles.add(new Obstacle(WIDTH,0,30,pX,0));\n\t\t\tthis.obstacles.add(new Obstacle(WIDTH,pX+110,30,HEIGHT-pX-111,0));\n\t\t\tthis.goals.add(new Goal(WIDTH,pX,30,110,0xffffff));\n\t\t\tthis.nextSpawn = this.seconds + this.spawnRate;\n\t\t}\n\t}", "private boolean isInObstacle(PVector targetPosition, ArrayList<Obstacle> obstacles) {\n\t\tfloat distance = Float.POSITIVE_INFINITY;\r\n\t\tfor(Obstacle ob: obstacles) {\r\n\t\t\tif(targetPosition.dist(ob.getPosition()) < distance){\r\n\t\t\t\tdistance = targetPosition.dist(ob.getPosition());\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(distance < Constants.GRID_SIZE)\r\n\t\t\treturn true;\r\n\t\treturn false;\r\n\t}", "@Test\n public void testWithObstacle3() {\n Grid g = new Grid(4, 4, 0, 0, 0, 0);\n Obstacle o = new Obstacle(1, 1);\n g.setObject(o, 0, 3);\n g.setObject(o, 1, 1);\n g.setObject(o, 1, 2);\n g.setObject(o, 3, 0);\n g.setObject(o, 3, 1);\n AStarStrategy strategy = new AStarStrategy();\n\n Location from = new Location(0, 0);\n Location to = new Location(3, 3);\n Path path = strategy.generatePath(g, from, to);\n assertNotNull(path);\n assertEquals(6, path.getMoves().size());\n assertEquals(Move.DOWN, path.getMoves().get(0).direction);\n assertEquals(Move.DOWN, path.getMoves().get(1).direction);\n assertEquals(Move.RIGHT, path.getMoves().get(2).direction);\n assertEquals(Move.RIGHT, path.getMoves().get(3).direction);\n assertEquals(Move.RIGHT, path.getMoves().get(4).direction);\n assertEquals(Move.DOWN, path.getMoves().get(5).direction);\n }", "public static void setHardLevelObstacles() {\n\t\t// Setting values for obstacles\n\t\tint selectedPlatform = 0;\n\t\tint selectedXPart = 0;\n\t\tfor(int i = 0; i < obstacle.length; i++) {\n\t\t\tif(i % 2 == 0) {\n\t\t\t\tobstacle[i].setSize(OBSTACLE_WIDTH, OBSTACLE_HEIGHT);\n\t\t\t\tobstacle[i].setObstacleImage(Engine.pickRandomImage(imgObstacle));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tobstacle[i].setSize(OBSTACLE_LARGE_WIDTH, OBSTACLE_LARGE_HEIGHT);\n\t\t\t\tobstacle[i].setObstacleImage(Engine.pickRandomImage(imgObstacleLarge));\n\t\t\t}\n\n\t\t\tint x;\n\t\t\tint y;\n\t\t\tint randomOffset = (int) (Math.random() * OBSTACLE_INCREASE);\n\t\t\t\t\n\t\t\t// X CALCULATION //\n\t\t\t\n\t\t\t// Place on second platform\n\t\t\tif((float) i / 6 == 1) {\n\t\t\t\tselectedPlatform++;\n\t\t\t\tselectedXPart = 0;\n\t\t\t}\n\t\t\t// Place on third and last platform\n\t\t\tif((float) i / 6 == 2) {\n\t\t\t\tselectedPlatform++;\n\t\t\t\tselectedXPart = 0;\n\t\t\t}\n\t\t\t// Next \"third part section\" of the platform \n\t\t\tif(i % 2 == 0) selectedXPart += 2;\n\t\t\t\n\t\t\tif(selectedXPart != 6) x = platform[selectedPlatform].getX() + (OBSTACLE_INCREASE * (selectedXPart - 1)) + randomOffset;\n\t\t\telse x = platform[selectedPlatform].getX() + (OBSTACLE_INCREASE * (selectedXPart - 1)) + randomOffset - OBSTACLE_LARGE_WIDTH;\n\t\t\t\n\t\t\t// Y CALCULATION //\n\t\t\t\n\t\t\tif(i % 2 == 0) {\n\t\t\t\tint temp = (int) (Math.random() * 10);\n\t\t\t\tif(temp <= 5) y = ground[selectedPlatform].getY() - Init.getObstacleGroundOffset();\n\t\t\t\telse y = platform[selectedPlatform].getY() + Init.getObstaclePlatformOffset();\n\t\t\t}\n\t\t\telse y = platform[selectedPlatform].getY() - Init.getObstacleLargePlatformOffset();\n\t\t\t\n\t\t\tobstacle[i].setLocation(x, y);\n\t\t}\n\t}", "public void draw() {\n\t\tif (doge.getLife()>0) {\r\n\t\t\tthis.background(WHITE);\r\n\t\t\tif (keyPressed) {\r\n\t\t\t\tif (key == 'a') {\r\n\t\t\t\t\tdoge.goLeft();\r\n\t\t\t\t\tif (doge.getX()<=0) {\r\n\t\t\t\t\t\tdoge.setX(PlayGame.WIDTH);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(key == 's') {\r\n\t\t\t\t\tdoge.goDown();\r\n\t\t\t\t\tif (doge.getY()>=PlayGame.HEIGHT) {\r\n\t\t\t\t\t\tdoge.setY(0);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(key == 'd') {\r\n\t\t\t\t\tdoge.goRight();\r\n\t\t\t\t\tif (doge.getX()>=PlayGame.WIDTH) {\r\n\t\t\t\t\t\tdoge.setX(0);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(key == 'w') {\r\n\t\t\t\t\tdoge.goUp();\r\n\t\t\t\t\tif (doge.getY()<=0) {\r\n\t\t\t\t\t\tdoge.setY(PlayGame.HEIGHT);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t\tdoge.draw();\r\n\t\t\t\r\n\t\t\tif (!bones.get(0).getIsEaten()) {\r\n\t\t\t\t//Move and draw bone, if it has not been eaten.\r\n\t\t\t\tbones.get(0).move();\r\n\t\t\t\tbones.get(0).draw();\r\n\t\t\t\t//if it get eaten, score + 1, get a new bone, and get one more obstacle\r\n\t\t\t\tif (Math.pow((bones.get(0).getY() - doge.getY()), 2) + Math.pow(bones.get(0).getX() - doge.getX(),2) <= 2*(Math.pow(Bone.getHeight()/2+doge.getHeight()/2, 2)/10)) {\r\n\t\t\t\t\tbones.get(0).eat();\r\n\t\t\t\t\tthis.setScore(this.score+1);\r\n\t\t\t\t\tBone theBone=new Bone(this);\r\n\t\t\t\t\tthis.bones.add(theBone);\r\n\t\t\t\t\tSmileObstacle newObstacle = new SmileObstacle(this);\r\n\t\t\t\t\tthis.obstacles.add(newObstacle);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\r\n\t\t\tfor (int i = 0; i < this.obstacles.size(); i++) {\r\n\t\t\t\t//Keep draw and move obstacle\r\n\t\t\t\tSmileObstacle obstacle = this.obstacles.get(i);\r\n\t\t\t\tobstacle.move();\r\n\t\t\t\tobstacle.draw();\r\n\t\t\t\t//If clashed, eliminate the obstacle and make the background black for a moment.\r\n\t\t\t\tif (Math.pow((obstacle.getY() - doge.getY()), 2) + Math.pow(obstacle.getX() - doge.getX(),2) <= Math.pow(SmileObstacle.getHeight()/2+doge.getHeight()/2, 2)/10) {\r\n\t\t\t\t\tthis.background(BLACK);\r\n\t\t\t\t\tobstacle.eliminate();\r\n\t\t\t\t\tthis.hearts.get(this.hearts.size()-1).loseHeart();\r\n\t\t\t\t\tdoge.setLife(doge.getLife()-1);\r\n\t\t\t\t}\t\t\r\n\t\t\t}\r\n\t\t\t//draw heart for life numbers.\r\n\t\t\tfor (int j = 0; j < this.hearts.size(); j++) {\r\n\t\t\t\tHeart heart = this.hearts.get(j);\r\n\t\t\t\theart.draw();\r\n\t\t\t}\r\n\t\t\t//Draw smallbone for scores. \r\n\t\t\tfor (int h = 0; h<this.score; h++) {\r\n\t\t\t\tSmallBone smallBone=new SmallBone(this, h*SmallBone.getWidth(), PlayGame.getHeight()-SmallBone.getHeight());\r\n\t\t\t\tthis.smallBones.add(smallBone);\r\n\t\t\t}\r\n\t\t\tfor (int n = 0; n<this.smallBones.size(); n++) {\r\n\t\t\t\tSmallBone theSM = this.smallBones.get(n);\r\n\t\t\t\ttheSM.draw();\r\n\t\t\t}\r\n\t\t}\r\n\t\t//Once life is lower than 0, game over. \r\n\t\telse {\r\n\t\t\tSystem.out.println(\"Game Over! Your score is \" + this.score);\r\n\t\t}\r\n\t\t\r\n\t}", "public void draw(){\n hit();\n hit();\n }", "@Test\n public void testWithObstacle4() {\n Grid g = new Grid(4, 4, 0, 0, 0, 0);\n Obstacle o = new Obstacle(1, 1);\n g.setObject(o, 0, 3);\n g.setObject(o, 1, 1);\n g.setObject(o, 1, 2);\n g.setObject(o, 3, 0);\n g.setObject(o, 3, 1);\n AStarStrategy strategy = new AStarStrategy();\n\n Location to = new Location(0, 0);\n Location from = new Location(3, 3);\n Path path = strategy.generatePath(g, from, to);\n assertNotNull(path);\n assertEquals(6, path.getMoves().size());\n assertEquals(Move.UP, path.getMoves().get(0).direction);\n assertEquals(Move.LEFT, path.getMoves().get(1).direction);\n assertEquals(Move.LEFT, path.getMoves().get(2).direction);\n assertEquals(Move.LEFT, path.getMoves().get(3).direction);\n assertEquals(Move.UP, path.getMoves().get(4).direction);\n assertEquals(Move.UP, path.getMoves().get(5).direction);\n }", "public void addObstacle(Coord obstacleCoord);", "public List<REPoint> getObstacles();", "public void draw(float dt) {\n\t\tcanvas.clear();\n\t\t\n\t\t// Draw background unscaled.\n\t\tcanvas.begin();\n\t\tcanvas.draw(backgroundTexture, Color.WHITE, 0, 0,canvas.getWidth(),canvas.getHeight());\n\t\tcanvas.end();\n\t\t\n\t\tcanvas.begin();\n\t\tfor(Obstacle obj : objects) {\n\t\t\tobj.draw(canvas);\n\t\t}\n\t\tcanvas.end();\n\t\t\n\t\tif (isDebug()) {\n\t\t\tcanvas.beginDebug();\n\t\t\tfor(Obstacle obj : objects) {\n\t\t\t\tobj.drawDebug(canvas);\n\t\t\t}\n\t\t\tcanvas.endDebug();\n\t\t}\n\t\t\n\t\t// Draw foreground last.\n\t\tcanvas.begin();\n\t\tcanvas.draw(foregroundTexture, FORE_COLOR, 0, 0, canvas.getWidth(), canvas.getHeight());\n\t\tselector.draw(canvas);\n\t\tcanvas.end();\n\t}", "public boolean checkObs(double x, double y, Landscape scape){\n\t\tArrayList<SimObject> obs = (ArrayList<SimObject>)scape.getAgents();\n\t\t// for each Obstacle object\n\t\tfor( int i = 0 ; i < obs.size() ; i++){\n\t\t\tSimObject obstacle = obs.get(i);\n\t\t\t// if the x and y positions are the same (+/- 1 or .5 is because the defender not a point element and it's width\n\t\t\t// and height need to be taken into account)\n\t\t\tif( obstacle.getX() >= (x-1) && obstacle.getX() <= (x+.5) \n\t\t\t\t\t&& obstacle.getY() >= (y-1) && obstacle.getY() <=(y+.5) ){\n\t\t\t\t// this obstacle is in the way of the motion, return false and stop checking for other obstacles\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t// no obstacles in the way, the Defender is free to move with respect to the Obstacles\n\t\treturn true;\n\t}", "@Override\n public void paintComponent(Graphics g){\n super.paintComponent(g);\n if(ingame){\n\n int screenWidth = this.getWidth();\n int screenHeight = this.getHeight();\n\n\n for(int i = 0; i < end_positions.size(); i++){\n End_position item = end_positions.get(i);\n g.setColor(Color.green);\n g.fillRect(item.getDestinationX()*screenWidth/LEVEL_WIDTH,item.getDestinationY()*screenHeight/LEVEL_HEIGHT,item.getImage().getWidth(null)*screenWidth/LEVEL_WIDTH,item.getImage().getWidth(null)*screenHeight/LEVEL_HEIGHT);\n }\n\n g.setColor(Color.white);\n g.fillRect(player.getCurrentX()*screenWidth/LEVEL_WIDTH,player.getCurrentY()*screenHeight/LEVEL_HEIGHT,player.getImage().getWidth(null)*screenWidth/LEVEL_WIDTH,player.getImage().getWidth(null)*screenHeight/LEVEL_HEIGHT);\n\n\n for(int i = 0; i < boxes.size(); i++){\n Box item = boxes.get(i);\n g.setColor(Color.yellow);\n g.fillRect(item.getCurrentX()*screenWidth/LEVEL_WIDTH,item.getCurrentY()*screenHeight/LEVEL_HEIGHT,item.getImage().getWidth(null)*screenWidth/LEVEL_WIDTH,item.getImage().getWidth(null)*screenHeight/LEVEL_HEIGHT);\n }\n for(int i = 0; i < walls.size(); i++){\n Wall item = walls.get(i);\n\n g.setColor(Color.red);\n g.fillRect(item.getDestinationX()*screenWidth/LEVEL_WIDTH,item.getDestinationY()*screenHeight/LEVEL_HEIGHT,item.getImage().getWidth(null)*screenWidth/LEVEL_WIDTH,item.getImage().getWidth(null)*screenHeight/LEVEL_HEIGHT);\n\n }\n\n }\n\n }", "private void draw(Graphics2D g)\r\n\t{\t\t\r\n\t\tColor[] cols = new Color[] {Color.red,Color.green,Color.blue};\r\n\t\t\r\n\t\t// clear the background\r\n\t\tg.setColor(Color.black);\r\n\t\tg.fillRect(0,0,640,510);\r\n\t\t\r\n\t\tg.translate(0,30);\t\r\n\r\n\t\tif (zp < 0) {\r\n\t\t\tdrawBall(g);\r\n\t\t} \r\n\r\n\t\tColor[] colMap = new Color[16];\r\n\t\tcolMap[3] = Color.white;\r\n\t\tcolMap[12] = cols[(timers[0] / 100) % 3];\r\n\t\tcolMap[13] = Color.black;\r\n\t\tcolMap[14] = Color.gray;\r\n\t\tcolMap[15] = Color.yellow;\r\n\t\t\r\n\t\tfor (int x=0;x<30;x++) {\r\n\t\t\tfor (int y=0;y<30;y++) {\r\n\t\t\t\tint tile = getTile(x,y);\r\n\t\t\t\tif (tile != 0) {\r\n\t\t\t\t\tPolygon p = new Polygon();\r\n\r\n\t\t\t\t\tint total = addPoint(x,y,p);\r\n\t\t\t\t\ttotal += addPoint(x+1,y,p);\r\n\t\t\t\t\ttotal += addPoint(x+1,y+1,p);\r\n\t\t\t\t\ttotal += addPoint(x,y+1,p);\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (total == 4) {\r\n\t\t\t\t\t\tif ((tile == 11) && (!controls[19])) {\r\n\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif ((tile == 13) && (toggles > 0)) {\r\n\t\t\t\t\t\t\ttile = 1;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tColor col = cols[l % 3];\r\n\t\t\t\t\t\tif ((x+y) % 2 == 0) {\r\n\t\t\t\t\t\t\tcol = cols[l % 3].darker();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif (colMap[tile] != null) {\r\n\t\t\t\t\t\t\tcol = colMap[tile];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tg.setColor(col);\r\n\t\t\t\t\t\tg.fillPolygon(p);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif (tile > 10) {\r\n\t\t\t\t\t\t\tg.setColor(Color.darkGray);\r\n\t\t\t\t\t\t\tif (tile == 11) {\r\n\t\t\t\t\t\t\t\tg.setColor(col.darker());\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tg.fillPolygon(p);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tPolygon p2 = new Polygon();\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\taddPoint(x+0.1,y+0.1,p2);\r\n\t\t\t\t\t\t\taddPoint(x+0.9,y+0.1,p2);\t\t\t\t\r\n\t\t\t\t\t\t\taddPoint(x+0.9,y+0.9,p2);\t\t\t\t\r\n\t\t\t\t\t\t\taddPoint(x+0.1,y+0.9,p2);\r\n\t\r\n\t\t\t\t\t\t\tg.setColor(col);\r\n\t\t\t\t\t\t\tg.fillPolygon(p2);\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}\r\n\r\n\t\tif (zp >= 0) {\r\n\t\t\tdrawBall(g);\r\n\t\t}\r\n\t\t\r\n\t\tg.setColor(Color.black);\r\n\t\tg.fillRect(0,-20,640,45);\r\n\t\tg.setColor(Color.darkGray);\r\n\t\tg.drawLine(0,25,640,25);\r\n\t\tg.setFont(g.getFont().deriveFont(Font.BOLD, 20.0f));\t\r\n\t\tg.setPaint(new GradientPaint(0,20,Color.green,0,0,Color.white));\r\n\t\t\r\n\t\tg.drawString(\"Time: \"+(timers[0]/1000),530,20);\r\n\t\tg.drawString(\"Ball\",20,20);\r\n\t\t\r\n\t\tg.setPaint(new GradientPaint(0,20,Color.yellow,0,0,Color.white));\r\n\t\tg.drawString(msg,(640-g.getFontMetrics().stringWidth(msg))/2,20);\r\n\t\t\r\n\t\tif (!started) {\r\n\t\t\tang += 0.01f;\r\n\t\t\tg.drawString(\"Cursors - Move PgUp/PgDown - View Space - Jump\",60,470);\r\n\t\t}\r\n\t}", "public void draw(Graphics g){\n if (isEmpty()) {\n g.setColor(new Color(255, 204, 204));\n g.fillRect(getXGraphic(), getYGraphic(), 120, 120);\n g.setColor(Color.BLACK);\n if (getIndication()){\n g.setColor(new Color(0, 0, 0, 100));\n g.fillRect(getXGraphic(), getYGraphic(),120,120);\n }\n if (getTargetable()){\n g.setColor(new Color(0, 0, 255));\n g.drawRect(getXGraphic(), getYGraphic(),120,120);\n }\n\n g.drawRect(getXGraphic(), getYGraphic(), 120, 120);\n } else {\n enemy.draw(getXGraphic(), getYGraphic() ,g, getIndication());\n\n //Draw blue square around if it is a targetable space\n if (getTargetable()){\n g.setColor(new Color(0, 0, 255));\n g.drawRect(getXGraphic(), getYGraphic(),120,120);\n }\n }\n }", "int hitGfx();", "public void drawRoad(int player, int location, Graphics g){\n\t}", "public boolean inBounds(Obstacle obj) {\n\t\tboolean horiz = (bounds.x <= obj.getX() && obj.getX() <= bounds.x+bounds.width);\n\t\tboolean vert = (bounds.y <= obj.getY() && obj.getY() <= bounds.y+bounds.height);\n\t\treturn horiz && vert;\n\t}", "public void checkObstacles(UserCar userCar) {\n for (int i = 0; i < outSideItems.size(); i++) {\n if (userCar.collidesWith(outSideItems.get(i).getCollisionRectangle())) {\n userCar.fullStop();\n }\n }\n }", "public void paintBalls(Graphics g);", "private void drawTiles(Graphics g)\n {\n for (int x = 0; x < 19; x++)\n {\n for (int y = 0; y < 15; y++)\n {\n tileset.getSprite(5, 0).draw(x * 32 + jitterX, y * 32 + jitterY);\n switch(board[x][y])\n {\n case 1:\n {\n tileset.getSprite(4, 0).draw(x * 32 + jitterX, y * 32 + jitterY);\n break;\n }\n case 2:\n {\n tileset.getSprite(3, 0).draw(x * 32 + jitterX, y * 32 + jitterY);\n break;\n }\n case 3:\n {\n if (bombs[x][y].getTimeLeft() > 80)\n {\n bombImage.getSprite(0, 0).draw(x * 32 + jitterX, y * 32 + jitterY);\n }\n if (bombs[x][y].getTimeLeft() <= 80 && bombs[x][y].getTimeLeft() > 50)\n {\n bombImage.getSprite(1, 0).draw(x * 32 + jitterX, y * 32 + jitterY);\n }\n if (bombs[x][y].getTimeLeft() <= 50 && bombs[x][y].getTimeLeft() > 20)\n {\n bombImage.getSprite(2, 0).draw(x * 32 + jitterX, y * 32 + jitterY);\n }\n if (bombs[x][y].getTimeLeft() <= 20)\n {\n bombImage.getSprite(3, 0).draw(x * 32 + jitterX, y * 32 + jitterY);\n }\n break;\n }\n //4 is player\n case 5:\n {\n if (fire[x][y] == null)\n {\n tileset.getSprite(2, 0).draw(x * 32 + jitterX, y * 32 + jitterY);\n }\n break;\n }\n case 6:\n {\n if (fire[x][y] == null)\n {\n tileset.getSprite(15, 0).draw(x * 32 + jitterX, y * 32 + jitterY);\n }\n break;\n }\n }\n }\n }\n }", "public void draw(Graphics g){\r\n\r\n /*\r\n we want to create 2D graphics for better performance\r\n g.create() will create a new reference so that we don't use the old one and create problems\r\n */\r\n\r\n Graphics2D graphics2D = (Graphics2D)g.create();\r\n\r\n //this makes graphics more smooth\r\n graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);\r\n\r\n //this rotates the obstacle to that angle and it rotates around a position around its own\r\n graphics2D.rotate(Math.toRadians(angle),getXPosition(),getYPosition());\r\n\r\n //set the color and draw the object frame into the screen\r\n graphics2D.setColor(getFrame().getColor());\r\n graphics2D.fill(getFrame().getModel());\r\n\r\n //set the color and draw the object into the screen\r\n graphics2D.setColor(getColor());\r\n graphics2D.fill(getModel());\r\n\r\n //in order to not use too much memory, and because we don't need it any more, we will dispose the graphics object\r\n graphics2D.dispose();\r\n\r\n }", "private void doDrawing(Graphics g) {\r\n\t\tGraphics2D g2d = (Graphics2D) g;// converts Graphics g to Graphics2D\r\n\t\tfor (int i = 0; i < WIDTH_TILES; i++) {// loops through x-coords\r\n\t\t\tfor (int j = 0; j < HEIGHT_TILES; j++) {// loops through y-coords\r\n\t\t\t\tg2d.drawImage(nodes[i * WIDTH_TILES + j].getImage(), nodes[i * WIDTH_TILES + j].getTile().x, nodes[i * HEIGHT_TILES + j].getTile().y, this);// draws each tile with its current information\r\n\t\t\t}// for (j)\r\n\t\t}// for (i)\r\n\t\t\r\n\t\tif (running) {// checks whether the simulation is running\r\n\t\t\tif (start++ % 10 == 0) {// staggers the movement of the ants, slows things down\r\n\t\t\t\tmoveAnts();// calls the method that governs the movement of the ants\r\n\t\t\t}// if (start)\r\n\t\t}// if (running)\r\n\t}", "public void draw(ArrayList<RoadTick> ticks, Player player, ArrayList<Obstacle> obstacles) {\n\t\tdrawBackground();\n\t\t\n\t\tdrawTicks(ticks);\n\t\t\n\t\tdrawPlayer(player);\n\t\t\n\t\tdrawObstacles(obstacles);\n\t\t\n\t\trepaint();\n\t}", "public static void drawCircularObstacle(Graphics g) {\n\t\tif(board.getCircularObstacle()!=null){\n\t\t\tIterator<?> it = board.getCircularObstacle().entrySet().iterator();\n\n\t\t\twhile(it.hasNext()){\n\t\t\t\tMap.Entry<Integer, List<Circle>> pair = (Map.Entry)it.next();\n\t\t\t\tList<Circle> coordinateList = pair.getValue();\n\t\t\t\tfor(Circle c:coordinateList){\n\t\t\t\t\tg.fillOval(c.getX(),c.getY(), c.getRadius(), c.getRadius());\n\t\t\t\t}\n\n\t\t\t}\t\t\n\t\t}\n\n\t}", "private void drawObjects(Graphics g) {\n\n g.setColor(Color.white);\n g.fillRect(0,0,WIDTH,HEIGHT);\n\n Player player = physics.getPlayer();\n\n\n\n ArrayList<Sprite> sprites = physics.getSprites();\n for( Sprite p: sprites){\n if (p.isVisible()) {\n g.drawImage(p.getImage(), p.getX() - scroll, p.getY(),\n this);\n }\n }\n\n if (player.isVisible()) {\n g.drawImage(player.getImage(), player.getX() - scroll, player.getY(),\n this);\n }\n Font font = new Font(\"Helvetica\", Font.BOLD, 30);\n FontMetrics fm = getFontMetrics(font);\n\n g.setColor(Color.black);\n g.setFont(font);\n g.drawString(Integer.toString(physics.playerScore),5, 25);\n }", "public void paintComponent(Graphics g) {\n super.paintComponent(g);\n Graphics2D g2d = (Graphics2D)g;\n\n\n g.setColor(Color.black);\n g2d.drawRect(clock_x, clock_y, clock_width, clock_height);\n Font fontClock = new Font(\"Courier\", Font.PLAIN, 130);\n g.setFont(fontClock);\n g.drawString(Long.toString(gameClock.displayTime()), clock_x, clock_y + clock_height);\n \n //enemy area\n //g.setColor(Color.black);\n //g2d.drawRect(enemy_x, enemy_y, enemy_width, enemy_height);\n if(enemyImage != null) {\n g2d.drawImage(enemyImage,\n enemy_x, enemy_y, enemy_width+enemy_x, enemy_height+enemy_y,\n 0, 0, enemyImage.getWidth(null),\n enemyImage.getHeight(null), null); \n } else {\n System.out.println(\"Enemy image is null\");\n }\n \n //draw targets\n for(target t : targets) {\n g.setColor(t.getColor());\n Ellipse2D.Double targ = new Ellipse2D.Double(t.get_x(), t.get_y(), t.get_diam(), t.get_diam());\n g2d.fill(targ);\n //g.drawRect(t.get_x(), t.get_y(), t.get_diam(), t.get_diam());\n Ellipse2D.Double hitCircle = new Ellipse2D.Double(t.get_x() - target_radius / 2, t.get_y() - target_radius / 2, t.get_diam() + target_radius, t.get_diam() + target_radius);\n g2d.draw(hitCircle);\n }\n\n //draw bullet holes\n for(bulletHole b : bullets) {\n //translate circle so that it\n //displays at correct coordinates\n //double translation = Math.sqrt(2 * (Math.pow(bullet_diam / 2, 2)));\n double translation = bullet_diam / 2;\n g.setColor(bulletHole);\n Ellipse2D.Double hole = new Ellipse2D.Double(b.get_x() - translation, b.get_y() - translation, b.get_diam(), b.get_diam());\n g2d.fill(hole);\n }\n\n //end of game\n //... or next round\n switch(end_round()) {\n case(1):\n g.setColor(Color.black);\n g.setFont(new Font(\"Narkisim\", Font.PLAIN, 150));\n current_round++;\n g.drawString(\"Round \"+current_round, 253, 350);\n refreshAll(false);\n break;\n \n case(2):\n g.setColor(Color.black);\n g.setFont(new Font(\"Narkisim\", Font.PLAIN, 135));\n g.drawString(\"You Lose!\", 240, 350);\n \n g.setColor(Color.black);\n Font fontPlayAgain = new Font(\"Mool Boran\", Font.PLAIN, 20);\n g.setFont(fontPlayAgain);\n g.drawString(\"Right Click to play again!\", 400, 400);\n //show score\n //then prompt to replay\n break;\n \n default:\n break;\n }\n }", "public static void robotInAGrid(){\n\t\tArrayList<Point> fails = new ArrayList<Point>(); //contains unreachable points\n\t\t//to start we'll put all \"off limits\" points in fails and then we'll add any points we determine to be unreachable as we go\n\t\tfor(int r = 0; r< grid.length; r++){\n\t\t\tfor(int c = 0; c <grid[0].length; c++){\n\t\t\t\tif(grid[r][c] == 1){\n\t\t\t\t\tfails.add(new Point(r, c));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tArrayList<Point> path = new ArrayList<Point>(); //contains the robot's path\n\t\t//call our recursive helper function\n\t\tif(getPath(grid.length-1, grid[0].length-1, path, fails)){\n\t\t\tfor(Point p: path){\n\t\t\t\tSystem.out.print(\"(\" + p.x + \", \" + p.y + \"), \");\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tSystem.out.println(\"No path is possible\");\n\t\t}\n\t}", "private void checkCollision(Graphics g) {\n\t\t// collision detection for the tanks\n\t\tGraphics2D g2d = (Graphics2D) g.create();\n\t\tRectangle heroRectangle = hero.getBounds();\n\t\tRectangle hero2Rectangle = computer.getBounds();\n\t\tArrayList<Missile> heroMissiles = hero.getMissiles();\n\t\tArrayList<Missile> hero2Missile = computer.getMissiles();\n\n\t\t// hero1 --------------------\n\t\tAffineTransform at = g2d.getTransform();\n\t\tg2d.setTransform(at);\n\t\tat.rotate(Math.toRadians(hero.getAngle()), hero.getX() + hero.getImageWidth() / 2,\n\t\t\t\thero.getY() + hero.getImageHeight() / 2);\n\t\tGeneralPath heroPath = new GeneralPath();\n\t\theroPath.append(heroRectangle.getPathIterator(at), true);\n\t\tArea heroArea = new Area(heroPath);\n\n\t\t// hero2 ------------------------------\n\t\tat = new AffineTransform();\n\t\tg2d.setTransform(at);\n\t\tat.rotate(Math.toRadians(computer.getAngle()), computer.getX() + computer.getImageWidth() / 2,\n\t\t\t\tcomputer.getY() + computer.getImageHeight() / 2);\n\t\tGeneralPath hero2Path = new GeneralPath();\n\t\thero2Path.append(hero2Rectangle.getPathIterator(at), true);\n\t\tArea hero2Area = new Area(hero2Path);\n\n\t\t// tank1 -- tank2 collision\n\t\thero2Area.intersect(heroArea);\n\t\tif (!hero2Area.isEmpty()) {\n\t\t\tplay(\"tank-tank.wav\");\n\t\t\tposxt2 = computer.getX();\n\t\t\tposyt2 = computer.getY();\n\t\t\tposyt1 = hero.getY();\n\t\t\tposxt1 = hero.getX();\n\t\t\t\n\t\t\texplodet2 = true;\n\t\t\texplodet1 = true;\n\t\t\tg2d.setColor(Color.RED);\n\t\t\tg2d.fill(heroArea);\n\t\t\tcomputer.spawnGenerator();\n\t\t\twhile (getValidRespawnPosition((int) computer.getX(), (int) computer.getY(), computer.getImageWidth(),\n\t\t\t\t\tcomputer.getImageHeight())) {\n\t\t\t\tcomputer.spawnGenerator();\n\t\t\t}\n\n\t\t\thero.spawnGenerator();\n\t\t\twhile (getValidRespawnPosition((int) hero.getX(), (int) hero.getY(), hero.getImageWidth(),\n\t\t\t\t\thero.getImageHeight())) {\n\t\t\t\thero.spawnGenerator();\n\t\t\t}\n\t\t}\n\n\t\t// tank2 -- tank1 bullet collision\n\t\tat = new AffineTransform();\n\t\tg2d.setTransform(at);\n\t\tfor (int i = 0; i < heroMissiles.size(); i++) {\n\t\t\tMissile m = heroMissiles.get(i);\n\t\t\tRectangle tank1BulletRect = m.getBounds();\n\t\t\tGeneralPath tank1BulletPath = new GeneralPath();\n\t\t\ttank1BulletPath.append(tank1BulletRect.getPathIterator(at), true);\n\t\t\theroArea = new Area(heroPath);\n\t\t\thero2Area = new Area(hero2Path);\n\t\t\tArea tank1BulletArea = new Area(tank1BulletPath);\n\t\t\thero2Area.intersect(tank1BulletArea);\n\t\t\tif (!hero2Area.isEmpty()) {\n\t\t\t\tplay(\"bullet-tank.wav\");\n\t\t\t\tposxt2 = computer.getX();\n\t\t\t\tposyt2 = computer.getY();\n\t\t\t\texplodet2 = true;\n\t\t\t\tif (computer.getCurrentPowerup() == 5) {\n\t\t\t\t} else {\n\t\t\t\t\tp1score++;\n\t\t\t\t\tcomputer.spawnGenerator();\n\t\t\t\t\twhile (getValidRespawnPosition((int) computer.getX(), (int) computer.getY(),\n\t\t\t\t\t\t\tcomputer.getImageWidth(), computer.getImageHeight())) {\n\t\t\t\t\t\tcomputer.spawnGenerator();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\theroMissiles.remove(i);\n\t\t\t\tcomputer.setCurrentPowerup(0);\n\t\t\t}\n\t\t}\n\t\t\n\t\t// tank1 -- tank1 bullet collision\n\t\tat = new AffineTransform();\n\t\tg2d.setTransform(at);\n\t\tfor (int i = 0; i < heroMissiles.size(); i++) {\n\t\t\tMissile m1 = heroMissiles.get(i);\n\t\t\tRectangle tankBulletRect = m1.getBounds();\n\t\t\tGeneralPath tankBulletPath = new GeneralPath();\n\t\t\ttankBulletPath.append(tankBulletRect.getPathIterator(at), true);\n\t\t\theroArea = new Area(heroPath);\n\t\t\thero2Area = new Area(hero2Path);\n\t\t\tArea tankBulletArea = new Area(tankBulletPath);\n\t\t\theroArea.intersect(tankBulletArea);\n\t\t\tif (!heroArea.isEmpty() && m1.isReflected()) {\n\t\t\t\tplay(\"bullet-tank.wav\");\n\t\t\t\tposyt1 = hero.getY();\n\t\t\t\tposxt1 = hero.getX();\n\t\t\t\texplodet1 = true;\n\t\t\t\tif (hero.getCurrentPowerup() == 5) {\n\t\t\t\t} else {\n\t\t\t\t\tp2score++;\n\t\t\t\t\thero.spawnGenerator();\n\t\t\t\t\twhile (getValidRespawnPosition((int) hero.getX(), (int) hero.getY(), hero.getImageWidth(),\n\t\t\t\t\t\t\thero.getImageHeight())) {\n\t\t\t\t\t\thero.spawnGenerator();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\theroMissiles.remove(i);\n\t\t\t\thero.setCurrentPowerup(0);\n\t\t\t}\n\t\t}\n\n\t\t// tank1 -- tank2 bullet collision\n\t\tat = new AffineTransform();\n\t\tg2d.setTransform(at);\n\t\tfor (int i = 0; i < hero2Missile.size(); i++) {\n\t\t\tMissile m1 = hero2Missile.get(i);\n\t\t\tRectangle tank2BulletRect = m1.getBounds();\n\t\t\tGeneralPath tank2BulletPath = new GeneralPath();\n\t\t\ttank2BulletPath.append(tank2BulletRect.getPathIterator(at), true);\n\t\t\theroArea = new Area(heroPath);\n\t\t\thero2Area = new Area(hero2Path);\n\t\t\tArea tank2BulletArea = new Area(tank2BulletPath);\n\t\t\theroArea.intersect(tank2BulletArea);\n\t\t\tif (!heroArea.isEmpty()) {\n\t\t\t\tplay(\"bullet-tank.wav\");\n\t\t\t\tposyt1 = hero.getY();\n\t\t\t\tposxt1 = hero.getX();\n\t\t\t\texplodet1 = true;\n\t\t\t\tif (hero.getCurrentPowerup() == 5) {\n\t\t\t\t} else {\n\t\t\t\t\tp2score++;\n\t\t\t\t\thero.spawnGenerator();\n\t\t\t\t\twhile (getValidRespawnPosition((int) hero.getX(), (int) hero.getY(), hero.getImageWidth(),\n\t\t\t\t\t\t\thero.getImageHeight())) {\n\t\t\t\t\t\thero.spawnGenerator();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\thero2Missile.remove(i);\n\t\t\t\thero.setCurrentPowerup(0);\n\t\t\t}\n\t\t}\n\n\t\t// tank1 -- powerup collision\n\t\tat = new AffineTransform();\n\t\tg2d.setTransform(at);\n\t\tfor (int i = 0; i < powerupArray.size(); i++) {\n\t\t\tRectangle powerupRectangle = (powerupArray.get(i)).getBounds();\n\t\t\tGeneralPath powerupPath = new GeneralPath();\n\t\t\tpowerupPath.append(powerupRectangle.getPathIterator(at), true);\n\t\t\theroArea = new Area(heroPath);\n\t\t\thero2Area = new Area(hero2Path);\n\t\t\tArea powerupArea = new Area(powerupPath);\n\t\t\theroArea.intersect(powerupArea);\n\t\t\tif (!heroArea.isEmpty()) {\n\t\t\t\tplay(\"powerup.wav\");\n\t\t\t\tif ((powerupArray.get(i)).getPowerupType() == 5) {\n\t\t\t\t\thero.setIndex(1);\n\t\t\t\t}\n\t\t\t\tint powerupType = (powerupArray.get(i)).getPowerupType();\n\t\t\t\thero.setCurrentPowerup(powerupType);\n\t\t\t\tpowerupArray.remove(i);\n\t\t\t}\n\t\t}\n\n\t\t// tank2 -- powerup collision\n\t\tat = new AffineTransform();\n\t\tg2d.setTransform(at);\n\t\tfor (int i = 0; i < powerupArray.size(); i++) {\n\t\t\tRectangle powerupRectangle = (powerupArray.get(i)).getBounds();\n\t\t\tGeneralPath powerupPath = new GeneralPath();\n\t\t\tpowerupPath.append(powerupRectangle.getPathIterator(at), true);\n\t\t\theroArea = new Area(heroPath);\n\t\t\thero2Area = new Area(hero2Path);\n\t\t\tArea powerupArea = new Area(powerupPath);\n\t\t\thero2Area.intersect(powerupArea);\n\t\t\tif (!hero2Area.isEmpty()) {\n\t\t\t\tplay(\"powerup.wav\");\n\t\t\t\tint powerupType = (powerupArray.get(i)).getPowerupType();\n\t\t\t\tcomputer.setCurrentPowerup(powerupType);\n\t\t\t\tpowerupArray.remove(i);\n\t\t\t}\n\t\t}\n\n\t\t// tank 1 and wall collision\n\t\tat = new AffineTransform();\n\t\tg2d.setTransform(at);\n\t\tfor (Wall w : wallArray) {\n\t\t\tRectangle wallRect = w.getBounds();\n\t\t\tGeneralPath wallPath = new GeneralPath();\n\t\t\twallPath.append(wallRect.getPathIterator(at), true);\n\t\t\theroArea = new Area(heroPath);\n\t\t\thero2Area = new Area(hero2Path);\n\t\t\tArea wallArea = new Area(wallPath);\n\t\t\theroArea.intersect(wallArea);\n\t\t\tif (!heroArea.isEmpty()) {\n\t\t\t\thero.setX(hero.getPrevX());\n\t\t\t\thero.setY(hero.getPrevY());\n\t\t\t}\n\t\t}\n\t}", "public void controlla_collisioni() {\n\n for (int i = punti; i > 0; i--) {\n\n if ((i > 4) && (x[0] == x[i]) && (y[0] == y[i])) {\n in_gioco = false;\n }\n }\n\n if (y[0] >= ALTEZZA+85) { //devo aggungere +85 perche' l'area di gioco comincia dal punto 100,100\n in_gioco = false;\n }\n\n if (y[0] <= 100) {\n in_gioco = false;\n }\n\n if (x[0] >= LARGHEZZA+85) {\n in_gioco = false;\n }\n\n if (x[0] <= 100) {\n in_gioco = false;\n }\n }", "public void setObstacleCell(int row, int col, boolean obstacle) {\n if (obstacle && (in_start(row, col) || in_goal(row, col)))\n return;\n\n grid[row][col].setIsObstacle(obstacle);\n\n if (row >= 1) {\n grid[row - 1][col].setVirtualWall(obstacle); // bottom cell\n\n if (col < MapConstant.MAP_Y - 1) {\n grid[row - 1][col + 1].setVirtualWall(obstacle); // bottom-right cell\n }\n\n if (col >= 1) {\n grid[row - 1][col - 1].setVirtualWall(obstacle); // bottom-left cell\n }\n }\n\n if (row < MapConstant.MAP_X - 1) {\n grid[row + 1][col].setVirtualWall(obstacle); // top cell\n\n if (col < MapConstant.MAP_Y - 1) {\n grid[row + 1][col + 1].setVirtualWall(obstacle); // top-right cell\n }\n\n if (col >= 1) {\n grid[row + 1][col - 1].setVirtualWall(obstacle); // top-left cell\n }\n }\n\n if (col >= 1) {\n grid[row][col - 1].setVirtualWall(obstacle); // left cell\n }\n\n if (col < MapConstant.MAP_Y - 1) {\n grid[row][col + 1].setVirtualWall(obstacle); // right cell\n }\n }", "public void bougerObstacle (MouseEvent e) {\n\t\taddMouseMotionListener(new MouseMotionAdapter() {\n\t\t\t@Override\n\t\t\tpublic void mouseDragged(MouseEvent nouv) {\n\t\t\t\tif (interieur) {\n\t\t\t\t\t//\t\t\t\t\t\n\t\t\t\t\tgetObstaclesList().get(indiceObjetSelectionne).setPosition(new SVector3d(valeurEnReelleX(nouv.getX() - xPrecedent)- getPositionCam().x, valeurEnReelleY(nouv.getY() - yPrecedent)- getPositionCam().y));\n\t\t\t\t\trepaint();\n\t\t\t\t\tenClique= false;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t});\n\t}", "private void drawWalls(Graphics g) {\n\t\tfor(int i=0; i<grid.length; i++){\n\t\t\tfor(int j=0; j<grid[0].length; j++){\n\t\t\t\tif(grid[i][j].getNorth()!=null) {\n\t\t\t\t\tg.setColor(Color.decode(\"#CC3300\"));//Brown\n\t\t\t\t\tg.drawLine(j*widthBlock+padding+doorX, i*heightBlock+padding, j*widthBlock+padding+doorWidth, i*heightBlock+padding);\n\t\t\t\t}else {\n\t\t\t\t\tg.setColor(Color.BLACK);\n\t\t\t\t\tg.drawLine(j*widthBlock+padding, i*heightBlock+padding, j*widthBlock+padding+widthBlock, i*heightBlock+padding);\n\t\t\t\t}\n\t\t\t\tif(grid[i][j].getEast()!=null) {\n\t\t\t\t\tg.setColor(Color.decode(\"#CC3300\"));//Brown\n\t\t\t\t\tg.drawLine((j+1)*widthBlock+padding, i*heightBlock+padding+doorX, (j+1)*widthBlock+padding, i*heightBlock+padding+doorWidth);\n\t\t\t\t}else {\n\t\t\t\t\tg.setColor(Color.BLACK);\n\t\t\t\t\tg.drawLine((j+1)*widthBlock+padding, i*heightBlock+padding, (j+1)*widthBlock+padding, (i+1)*heightBlock+padding);\n\t\t\t\t}\n\t\t\t\tif(grid[i][j].getSouth()!=null) {\n\t\t\t\t\tg.setColor(Color.decode(\"#CC3300\"));//Brown\n\t\t\t\t\tg.drawLine(j*widthBlock+padding+doorX, (i+1)*heightBlock+padding, j*widthBlock+padding+doorWidth, (i+1)*heightBlock+padding);\n\t\t\t\t}else {\n\t\t\t\t\tg.setColor(Color.BLACK);\n\t\t\t\t\tg.drawLine(j*widthBlock+padding, (i+1)*heightBlock+padding, (j+1)*widthBlock+padding, (i+1)*heightBlock+padding);\n\t\t\t\t}\n\t\t\t\tif(grid[i][j].getWest()!=null) {\n\t\t\t\t\tg.setColor(Color.decode(\"#CC3300\"));//Brown\n\t\t\t\t\tg.drawLine(j*widthBlock+padding, i*heightBlock+padding+doorX, j*widthBlock+padding, i*heightBlock+padding+doorWidth);\n\t\t\t\t}else {\n\t\t\t\t\tg.setColor(Color.BLACK);\n\t\t\t\t\tg.drawLine(j*widthBlock+padding, i*heightBlock+padding, j*widthBlock+padding, (i+1)*heightBlock+padding);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public void draw(float delta) {\n\t\tcanvas.clear();\n\t\tcanvas.begin();\n\t\tcw = canvas.getWidth();\n\t\tch = canvas.getHeight();\n\t\tfor (int i = -5; i < 5; i++) {\n\t\t\tfor (int j = -5; j < 5; j++) {\n\t\t\t\tcanvas.draw(getBackground(dayTime), Color.WHITE, cw*i * 2, ch*j * 2, cw * 2, ch * 2);\n\t\t\t\tif(dayTime == 0 || dayTime == 1){\n\t\t\t\t\tcanvas.draw(getBackground(dayTime + 1), levelAlpha, cw*i * 2, ch*j * 2, cw * 2, ch * 2);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcanvas.end();\n\t\tif (walls.size() > 0){ \n\t\t\tfor (ArrayList<Float> wall : walls) canvas.drawPath(wall);\n\t\t}\n\t\tcanvas.begin();\n\t\t//\t\tcanvas.draw(background, Color.WHITE, 0, 0, canvas.getWidth(), canvas.getHeight());\n\t\t//canvas.draw(rocks, Color.WHITE, 0, 0, canvas.getWidth(), canvas.getHeight());\n\t\t\n\t\t\n//\t\tfor (ArrayList<Float> wall : walls) canvas.drawPath(wall);\n\t\t\n\t\tfor(Obstacle obj : objects) {\n\t\t\tobj.draw(canvas);\n\t\t}\n\t\t\n\n\t\tfor (int i = -5; i < 5; i++) {\n\t\t\tfor (int j = -5; j < 5; j++) {\n\t\t\t\tcanvas.draw(overlay, referenceC, cw*i, ch*j, cw, ch);\n\t\t\t}\n\t\t}\n\n\t\tcanvas.end();\n\n\t\tif (debug) {\n\t\t\tcanvas.beginDebug();\n\t\t\tfor(Obstacle obj : objects) {\n\t\t\t\tobj.drawDebug(canvas);\n\t\t\t}\n\t\t\tcanvas.endDebug();\n\t\t}\n\n\n\n//\t\t// Final message\n//\t\tif (complete && !failed) {\n//\t\t\tdisplayFont.setColor(Color.BLACK);\n//\t\t\tcanvas.begin(); // DO NOT SCALE\n//\t\t\tcanvas.drawTextCentered(\"VICTORY!\", displayFont, 0.0f);\n//\t\t\tcanvas.end();\n//\t\t\tdisplayFont.setColor(Color.BLACK);\n//\t\t} else if (failed) {\n//\t\t\tdisplayFont.setColor(Color.RED);\n//\t\t\tcanvas.begin(); // DO NOT SCALE\n//\t\t\tcanvas.drawTextCentered(\"FAILURE!\", displayFont, 0.0f);\n//\t\t\tcanvas.end();\n//\t\t}\n\t}", "public void paint(Graphics g) {\n int rad = 30;\n int x = border;\n int y = border;\n size = 400/n;\n\n for (int i = 0; i < n; i++) {\n y = i * size + border;\n for (int j = 0; j < n; j++) {\n x = j * size + border;\n int z = matrix[i][j].getColor();\n\n if (matrix[i][j].isClicked()) {\n setRectColor(g, z); \n }\n\n else {\n g.setColor(Color.white);\n }\n\n g.fillRect(x, y, size, size);\n g.setColor(Color.black);\n g.drawRect(x, y, size, size);\n\n if (matrix[i][j].isDot()) {\n setDotColor(g, z);\n drawCircle(g, x, y, rad);\n }\n }\n }\n\n if (isOver()==true) { //Draw win screen if entire board is filled\n g.setColor(Color.white);\n g.fillRect(70, 70, 300, 225);\n g.setColor(Color.black);\n g.drawRect(70, 70, 300, 225);\n \n youWin(g, 110, 160, game.getMoves());\n }\n\n\n }", "private void doDrawing(Graphics g) \n { \n //Surface specific G2D is used to paint entire \n // grid regardless of tilemap data to provide \n // background for tiles with transparent areas\n Graphics2D surfaceG2D = (Graphics2D) g.create();\n surfaceG2D.setPaint(texturePaints.get(0));\n for(int i = 0; i < MAX_ROWS; i++)\n {\n for(int j = 0; j < MAX_COLUMNS; j++)\n {\n surfaceG2D.fillRect(i*TILE_SIZE, j*TILE_SIZE, TILE_SIZE, TILE_SIZE);\n }\n }\n \n //Singular generic G2D is used for tilemap data\n Graphics2D G2D = (Graphics2D) g.create();\n \n //Paint relevant to tilemap\n for(int y = 0; y < MAX_ROWS; y++)\n {\n for(int x = 0; x < MAX_COLUMNS; x++)\n {\n //Select paint type\n G2D.setPaint(texturePaints.get(tilemap[x][y]));\n //If tile is rover, record position\n if(tilemap[x][y] == 1)\n {\n roverX = x;\n roverY = y;\n }\n //Apply paint to current tile\n G2D.fillRect(x*TILE_SIZE, y*TILE_SIZE, //Coordinates\n TILE_SIZE, TILE_SIZE); //Dimensions\n }\n } \n }", "public void draw(Graphics g) {\r\n\t\tthis.update();\r\n\t\tint drawLength = (int) (dim.getWidth()/tSize) + (int) (x/tSize);\r\n\t\tif (drawLength >= tileMap[0].length-2) {\r\n\t\t\tdrawLength = tileMap[0].length-2;\r\n\t\t}\r\n\t\tint drawHeight = (int) (dim.getHeight()/tSize)+ (int) (y/tSize);\r\n\t\tif (drawHeight>= tileMap.length-2) {\r\n\t\t\tdrawHeight = tileMap.length-2;\r\n\t\t}\r\n\t\tfor (int i = (int) (x/tSize); i < drawLength+2; i++) {\r\n\t\t\tfor (int j = (int) (y/tSize); j < drawHeight+2; j++) {\r\n\t\t\t\ttileMap[i][j].draw(g, i*tSize - (int)x, j*tSize - (int)y, tSize);\r\n\t\t\t} // End for loop\r\n\t\t} // End for loop\r\n\t\tif (bestTrap) {\r\n\t\t\tg.drawImage(hideri, (int)(dim.getWidth()/2) - 332, (int)(dim.getHeight()/2) - 250, 663, 500, null);\r\n\t\t} // End if\r\n\t}", "@Override\n\tpublic void update() {\n\t\tthis.setBounds(obstacle.getCoords().getX() * 64, obstacle.getCoords().getY() * 64, 64, 64);\n\t}", "public void paintComponent(Graphics g){\n super.paintComponent(g);\n g.setColor(Color.BLACK);\n g.fillRect(0,0,width*scale,height*scale);\n if(game.getWindowNum() == 2){\n for(int x = 0; x < world.length*scale; x+=scale){\n for(int y = 0; y < world[0].length*scale; y+= scale){\n if(game.getDiscoverdWorld()[x/scale][y/scale] == 1){\n if(world[x/scale][y/scale] == 0){\n g.setColor(Color.CYAN);\n }\n else if(world[x/scale][y/scale] == 1){\n g.setColor(Color.GREEN);\n }\n else if(world[x/scale][y/scale] == 2){\n g.setColor(new Color(102,66,0));\n }\n else if(world[x/scale][y/scale] == 3){\n g.setColor(new Color(105,105,105));\n }\n g.fillRect(x,y,scale,scale);\n }\n }\n }\n g.setColor(Color.RED);\n g.fillRect((int)(game.getPlayerCords()[0]*(double)scale),(int)(game.getPlayerCords()[1]*(double)scale),scale*game.getPlayerDimentions()[0],scale*game.getPlayerDimentions()[1]);\n g.setColor(Color.BLACK);\n g.drawRect((int)(game.getViewBoxCords()[0]*scale),(int)(game.getViewBoxCords()[1]*scale),(int)(game.getPlayerView().length*scale),(int)(game.getPlayerView()[0].length*scale));\n g.drawString(\"X: \"+game.getPlayerCords()[0]+\" Y: \"+game.getPlayerCords()[1],20,20);\n g.drawString(\"Seed: \"+game.getSeed(),20,40);\n g.drawString(\"Grounded: \"+game.getPlayer().getGrounded(),20,60);\n g.drawString(\"Vertical Velocity: \"+game.getPlayer().getVertVelocity(),20,80);\n }\n else if(game.getWindowNum() == 1){\n int[][] viewPlane = game.getPlayerView();\n double playerViewScale = game.getPlayerViewScale();\n double[] viewBoxCords = game.getViewBoxCords();\n g.setColor(Color.CYAN);\n for(int x = 0; x < viewPlane.length;x++){\n for(int y = 0; y < viewPlane[0].length;y++){\n if(viewPlane[x][y] != 0 && game.getDiscoverdWorld()[x+(int)viewBoxCords[0]][y+(int)viewBoxCords[1]] == 1){\n g.drawImage(textures.get(viewPlane[x][y]-1),(int)(((double)x-(viewBoxCords[0]%1))*playerViewScale),(int)(((double)y-(viewBoxCords[1]%1))*playerViewScale),this);\n /*\n if(viewPlane[x][y] == 1){\n g.setColor(Color.GREEN);\n }\n else if(viewPlane[x][y] == 2){\n g.setColor(new Color(102,66,0));\n }\n else if(viewPlane[x][y] == 3){\n g.setColor(new Color(105,105,105));\n }\n g.fillRect((int)(((double)x-(viewBoxCords[0]%1))*playerViewScale),(int)(((double)y-(viewBoxCords[1]%1))*playerViewScale),(int)(playerViewScale+0.5),(int)(playerViewScale+0.5));\n */\n }\n else if(viewPlane[x][y] == 0 && game.getDiscoverdWorld()[x+(int)viewBoxCords[0]][y+(int)viewBoxCords[1]] == 1){\n g.fillRect((int)(((double)x-(viewBoxCords[0]%1))*playerViewScale),(int)(((double)y-(viewBoxCords[1]%1))*playerViewScale),(int)(playerViewScale+1),(int)(playerViewScale+1));\n }\n }\n }\n if(recentlyHit != null){\n g.setColor(new Color(50,50,50,(int)(255*(1-recentlyHit.getHealthPercent()))));\n g.fillRect((int)(recentlyHit.getX()*playerViewScale)-(int)(viewBoxCords[0]%1*playerViewScale)+1,(int)(recentlyHit.getY()*playerViewScale)-(int)(viewBoxCords[1]%1*playerViewScale)+1,(int)playerViewScale,(int)playerViewScale);\n }\n //g.setColor(Color.RED);\n //g.fillRect((int)((game.getPlayerCords()[0]-viewBoxCords[0])*playerViewScale),(int)((game.getPlayerCords()[1]-viewBoxCords[1])*playerViewScale),(int)playerViewScale*game.getPlayerDimentions()[0],(int)playerViewScale*game.getPlayerDimentions()[1]);\n if(game.isFacingRight()){\n g.drawImage(textures.get(3),(int)((game.getPlayerCords()[0]-viewBoxCords[0])*playerViewScale),(int)((game.getPlayerCords()[1]-viewBoxCords[1])*playerViewScale),this);\n }\n else{\n g.drawImage(textures.get(4),(int)((game.getPlayerCords()[0]-viewBoxCords[0])*playerViewScale),(int)((game.getPlayerCords()[1]-viewBoxCords[1])*playerViewScale),this);\n }\n g.setColor(Color.BLACK);\n g.setFont(font2);\n g.drawString(\"X: \"+game.getPlayerCords()[0]+\" Y: \"+game.getPlayerCords()[1],20,20);\n g.drawString(\"Seed: \"+game.getSeed(),20,40);\n g.drawString(\"Grounded: \"+game.getPlayer().getGrounded(),20,60);\n g.drawString(\"Vertical Velocity: \"+game.getPlayer().getVertVelocity(),20,80);\n g.drawString(\"View Box Cords: X:\"+viewBoxCords[0]+\" Y: \"+viewBoxCords[1],20,100);\n int a = 0;\n for(Item i: game.getPlayerInventory()){\n if(i != null){\n g.drawString(i.getName()+\" Count: \"+i.getCount(),20,120+a*20);\n a++;\n }\n } \n g.setColor(new Color(100,100,100,95));\n g.fillRect((int)(0.09*viewPlane.length*playerViewScale),(int)(0.8*viewPlane[0].length*playerViewScale),(int)(0.82*viewPlane.length*playerViewScale),(int)(0.12*viewPlane[0].length*playerViewScale));\n g.setColor(Color.WHITE);\n for(int i = 0; i < game.getPlayerHotbar().length;i++){\n if(i == game.getPlayer().getHotbarItemSelected()){\n g.setColor(Color.BLACK);\n g.fillRect((int)(0.11*viewPlane.length*playerViewScale)+(int)(i*0.08*viewPlane.length*playerViewScale),(int)(0.81*viewPlane[0].length*playerViewScale),(int)(0.06*playerViewScale*viewPlane.length),(int)(0.1*viewPlane[0].length*playerViewScale));\n g.setColor(Color.WHITE);\n }\n else{\n g.fillRect((int)(0.11*viewPlane.length*playerViewScale)+(int)(i*0.08*viewPlane.length*playerViewScale),(int)(0.81*viewPlane[0].length*playerViewScale),(int)(0.06*playerViewScale*viewPlane.length),(int)(0.1*viewPlane[0].length*playerViewScale));\n }\n if(game.getPlayer().getHotbar()[i] != null){\n g.drawImage(textures.get(game.getPlayer().getHotbar()[i].getTextureNum()),(int)(0.125*viewPlane.length*playerViewScale)+(int)(i*0.08*viewPlane.length*playerViewScale),(int)(0.83*viewPlane[0].length*playerViewScale),this);\n }\n }\n if(game.isInvenVisible()){\n int rowLength = 10;\n g.setColor(new Color(100,100,100,180));\n g.fillRect((int)(0.05*screenWidth),(int)(0.06*screenHeight),(int)(0.9*screenWidth),(int)(0.7*screenHeight));\n g.setColor(Color.WHITE);\n int count = 0; \n for(Item i: game.getPlayerInventory()){\n if(i!=null){\n g.drawImage(textures.get(i.getTextureNum()),(int)(0.08*screenWidth)+(int)((count%rowLength)*0.085*screenWidth),(int)(0.085*screenHeight)+(int)((int)(count/rowLength)*0.085*screenHeight),this);\n g.drawString(\"x\"+i.getCount(),(int)(0.11*screenWidth)+(int)((count%rowLength)*0.085*screenWidth),(int)(0.096*screenHeight)+(int)((int)(count/rowLength)*0.085*screenHeight));\n count++;\n }\n }\n }\n else if(game.isCraftingVisible()){\n g.setColor(new Color(100,100,100,180));\n g.fillRect((int)(0.05*viewPlane.length*playerViewScale),(int)(0.05*viewPlane[0].length*playerViewScale),(int)(0.9*viewPlane.length*playerViewScale),(int)(0.7*viewPlane[0].length*playerViewScale));\n }\n g.setColor(Color.BLACK);\n g.drawRect((int)(screenWidth*0.8),(int)(screenHeight*.03),(int)(screenWidth*.18),(int)(screenHeight*0.04));\n g.setColor(new Color((int)(255*(1-game.getPlayerHealthPercent())),(int)(255*game.getPlayerHealthPercent()),0));\n g.fillRect((int)(screenWidth*0.8)+1,(int)(screenHeight*.03)+1,(int)(screenWidth*.18*game.getPlayerHealthPercent())-1,(int)(screenHeight*0.04)-1);\n g.setColor(new Color(50,50,50,200));\n g.setFont(font1);\n g.drawString(game.getPlayerHealthPercent()*100+\"%\",(int)(screenWidth*.88),(int)(screenHeight*0.06));\n }\n }", "public void paint(Graphics g){\n super.paint(g);\n Graphics2D g2d = (Graphics2D) g;\n g.setColor(Color.WHITE);\n for(int i = 0; i < ROWS; i++){\n g.drawLine(0, i * HEIGHT / ROWS - 1, \n WIDTH, i * HEIGHT / ROWS - 1);\n g.drawLine(0, i * HEIGHT / ROWS - 2, \n WIDTH, i * HEIGHT / ROWS - 2);\n }\n for (int i = 0; i <= COLS; i++) {\n g.drawLine(i * Game.getWindowWidth() / Game.getCols(), 0,\n i * Game.getWindowWidth() / Game.getCols(), HEIGHT);\n g.drawLine(i * Game.getWindowWidth() / Game.getCols() - 1, 0,\n i * Game.getWindowWidth() / Game.getCols() - 1, HEIGHT);\n }\n for (int i = 0; i < ROWS; i++) {\n for (int j = 0; j < COLS; j++) {\n grid[i][j].paintShadow(g2d);\n }\n }\n for (int i = 0; i < ROWS; i++) {\n for (int j = 0; j < COLS; j++) {\n grid[i][j].paint(g2d);\n }\n }\n \n for(Ball b : balls) {\n b.paint(g2d);\n }\n g2d.setColor(Color.BLACK);\n //segment at the top\n g2d.drawLine(0, 0, WIDTH, 0);\n g2d.drawLine(0, 1, WIDTH, 1);\n g2d.drawLine(0, 2, WIDTH, 2);\n //segment at the bottom\n g2d.drawLine(0, HEIGHT, WIDTH, HEIGHT);\n g2d.drawLine(0, HEIGHT + 1, WIDTH, HEIGHT + 1);\n g2d.drawLine(0, HEIGHT + 2, WIDTH, HEIGHT + 2);\n \n for(Point p : corners){\n g2d.drawOval(p.x, p.y, 3, 3);\n }\n\n if(aimStage){\n //draw the firing line\n g2d.setColor(lineColor);\n drawFatPath(g2d, startX, startY, endX, endY);\n g2d.setColor(arrowColor);\n drawArrow(g2d);\n }\n if(mouseHeld){\n// drawFatPath(g, Ball.restPositionX, HEIGHT - Ball.diameter, \n// getEndPoint().x, getEndPoint().y);\n }\n }", "private static boolean anyObstacles(ArrayList<CharacterSprite> pieces, int[] position, int[] destination,\n moveMode mode, boolean inclusive) {\n switch (mode) {\n case X_AXIS:\n int h = destination[0] < position[0] ? -1 : 1;\n for (int i = position[0] + h; i != destination[0]; i += h) {\n for (CharacterSprite sprite : pieces) {\n if (sprite.isColliding(i * CharacterSprite.size, position[1] * CharacterSprite.size)) {\n return true;\n }\n }\n }\n break;\n\n case Y_AXIS:\n h = destination[1] < position[1] ? -1 : 1;\n for (int i = position[1] + h; i != destination[1]; i += h) {\n for (CharacterSprite sprite : pieces) {\n if (sprite.isColliding(position[0] * CharacterSprite.size, i * CharacterSprite.size)) {\n return true;\n }\n }\n }\n break;\n\n case DIAGONAL:\n int i = destination[0], j = destination[1];\n i += i > position[0] ? -1 : 1;\n j += j > position[1] ? -1 : 1;\n\n while (i != position[0]) {\n for (CharacterSprite sprite : pieces) {\n if (sprite.isColliding(i * CharacterSprite.size, j * CharacterSprite.size)) {\n return true;\n }\n }\n\n i += i > position[0] ? -1 : 1;\n j += j > position[1] ? -1 : 1;\n }\n break;\n\n default:\n return true;\n }\n\n if (inclusive) {\n for (CharacterSprite sprite : pieces) {\n if (sprite.isColliding(destination[0] * CharacterSprite.size, destination[1] * CharacterSprite.size)) {\n return true;\n }\n }\n }\n\n return false;\n }", "public void billeObstacles() {\n\t\t// Décomposition de la bille\n\t\t// 2 3 4\n\t\t// 1 5\n\t\t// 8 7 6 \n\n\t\t// Parcours des briques pour vérifier les contacts\n\t\tListIterator <Obstacle> iter = niveauEnCours.grilleObstacles.listIterator(0);\n\t\tint contact = 0;\n\n\t\twhile (iter.hasNext() && contact == 0) {\n\t\t\tObstacle b = iter.next();\n\n\t\t\t// Étude des contacts avec les 8 points de la bille\n\t\t\t// Contact GaucheHaut de la bille\n\t\t\tdouble[] q = billeEnCours.GH();\n\t\t\tif (((q[1] <= b.bas) && (q[1] >= b.haut)) && ((q[0] <= b.droite) && (q[0] >= b.gauche))) {\n\t\t\t\tcontact = 2;\n\t\t\t}\n\n\t\t\t// Contact DroiteHaut de la bille\n\t\t\tif (contact == 0) {\n\t\t\t\tq = billeEnCours.DH();\n\t\t\t\tif (((q[1] <= b.bas) && (q[1] >= b.haut)) && ((q[0] <= b.droite) && (q[0] >= b.gauche))) {\n\t\t\t\t\tcontact = 4;\n\t\t\t\t}\n\t\t\t}\n\n\t\t // Contact GaucheBas de la bille\n\t\t\tif (contact == 0) {\n\t\t\t\tq = billeEnCours.GB();\n\t\t\t\tif (((q[1] <= b.bas) && (q[1] >= b.haut)) && ((q[0] <= b.droite) && (q[0] >= b.gauche))) {\n\t\t\t\t\tcontact = 8;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Contact DroiteBas de la bille\n\t\t\tif (contact == 0) {\n\t\t\t\tq = billeEnCours.DB();\n\t\t\t\tif (((q[1] <= b.bas) && (q[1] >= b.haut)) && ((q[0] <= b.droite) && (q[0] >= b.gauche))) {\n\t\t\t\t\tcontact = 6;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Contact haut de la bille\n\t\t\tint[] p = billeEnCours.MH();\n\t\t\tif (contact == 0) {\n\t\t\t\tif (p[1] <= b.bas && p[1] >= b.haut && p[0] <= b.droite && p[0] >= b.gauche) {\n\t\t\t\t\tcontact = 3;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Contact bas de la bille\n\t\t\tif (contact == 0) {\n\t\t\t\tp = billeEnCours.MB();\n\t\t\t\tif (((p[1] <= b.bas) && (p[1] >= b.haut)) && ((p[0] <= b.droite) && (p[0] >= b.gauche))) {\n\t\t\t\t\tcontact = 7;\t\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Contact droite de la bille\n\t\t\tif (contact == 0) {\n\t\t\t\tp = billeEnCours.DM();\n\t\t\t\tif (((p[1] <= b.bas) && (p[1] >= b.haut)) && ((p[0] <= b.droite) && (p[0] >= b.gauche))) {\n\t\t\t\t\tcontact = 5;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Contact gauche de la bille\n\t\t\tif (contact == 0) {\n\t\t\t\tp = billeEnCours.GM();\n\t\t\t\tif (((p[1] <= b.bas) && (p[1] >= b.haut)) && ((p[0] <= b.droite) && (p[0] >= b.gauche))) {\n\t\t\t\t\tcontact = 1;\t\t\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t\t// Mise à jour de la vitesse \n\n\t\t\t// Rencontre d'un coin\n\t\t\tif ((((contact == 2) || (contact == 4))) || ((contact == 8) || (contact == 6))) {\n\t\t\t\tbilleEnCours.demiTour();\n\t\t\t}\n\n\t\t\t// Contact Classique\n\t\t\t// Gauche - Droite\n\t\t\tif ((contact == 1) || (contact == 5)) {\n\t\t\t\tint[] nv = {- billeEnCours.renvoyerVitesse()[0], billeEnCours.renvoyerVitesse()[1]};\n\t\t\t\tbilleEnCours.changeVitesse(nv);\n\t\t\t}\n\n\t\t\t// Haut - Bas\n\t\t\tif ((contact == 3) || (contact == 7)) {\n\t\t\t\tint[] nv = {billeEnCours.renvoyerVitesse()[0], - billeEnCours.renvoyerVitesse()[1]};\n\t\t\t\tbilleEnCours.changeVitesse(nv);\n\t\t\t}\t\t\t\n\t}", "public void setConstructingObstacle(Obstacle obstacle);", "public void drawTile() {\n\n }", "public void initPlateau() {\r\n\t\t// On place les obstacles\r\n\t\tint epaisseur = 20;\r\n\t\tint delta = 50;\r\n\t\tint espace = 150;\r\n\t\tobstacles.add(new Obstacle(0,0,width,epaisseur));\r\n\t\tobstacles.add(new Obstacle(0,height - epaisseur,width,epaisseur));\r\n\t\tobstacles.add(new Obstacle(0,0,epaisseur,height));\r\n\t\tobstacles.add(new Obstacle(width - epaisseur,0,epaisseur,height));\r\n\t\t\r\n\t\tobstacles.add(new Obstacle(0,100,width-espace,epaisseur));\r\n\t\tobstacles.add(new Obstacle(espace,200,width-espace,epaisseur));\r\n\t\tobstacles.add(new Obstacle(0,300,width-espace,epaisseur));\r\n\t\tobstacles.add(new Obstacle(espace,400,width-espace,epaisseur));\r\n\t\t\r\n\t\t// On place les objectifs\r\n\t\t\r\n\t\tobjectifs.add(new Objectif(400,50));\r\n\t\tobjectifs.add(new Objectif(150,50));\r\n\t\tobjectifs.add(new Objectif(300,50));\r\n\t\tobjectifs.add(new Objectif(50,50));\r\n\t\tobjectifs.add(new Objectif(400,50));\r\n\t\tobjectifs.add(new Objectif(600,50));\r\n\t\tobjectifs.add(new Objectif(700,70));\r\n\t\tobjectifs.add(new Objectif(730,100));\r\n\t\tobjectifs.add(new Objectif(730,130));\r\n\t\tobjectifs.add(new Objectif(100,150));\r\n\t\tobjectifs.add(new Objectif(200,150));\r\n\t\tobjectifs.add(new Objectif(400,150));\r\n\t\tobjectifs.add(new Objectif(500,150));\r\n\t\tobjectifs.add(new Objectif(600,150));\r\n\t\tobjectifs.add(new Objectif(700,150));\r\n\t\tobjectifs.add(new Objectif(70,200));\r\n\t\tobjectifs.add(new Objectif(100,250));\r\n\t\tobjectifs.add(new Objectif(500,250));\r\n\t\tobjectifs.add(new Objectif(300,250));\r\n\t\tobjectifs.add(new Objectif(600,250));\r\n\t\tobjectifs.add(new Objectif(700,270));\r\n\t\tobjectifs.add(new Objectif(730,300));\r\n\t\tobjectifs.add(new Objectif(730,330));\r\n\t\tobjectifs.add(new Objectif(100,350));\r\n\t\tobjectifs.add(new Objectif(200,350));\r\n\t\tobjectifs.add(new Objectif(700,350));\r\n\t\tobjectifs.add(new Objectif(500,350));\r\n\t\tobjectifs.add(new Objectif(300,350));\r\n\t\tobjectifs.add(new Objectif(100,350));\r\n\t\tobjectifs.add(new Objectif(70,400));\r\n\t\tobjectifs.add(new Objectif(100,450));\r\n\t\tobjectifs.add(new Objectif(500,450));\r\n\t\tobjectifs.add(new Objectif(300,450));\r\n\t\tobjectifs.add(new Objectif(600,450));\r\n\t\t\r\n\t}", "public void drawMap() {\n\t\tRoad[] roads = map.getRoads();\r\n\t\tfor (Road r : roads) {\r\n\t\t\tif (r.turn) {\r\n\t\t\t\tcity_squares[r.location.y][r.location.x].oneway_road = true;\r\n\t\t\t\tcity_squares[r.location.y][r.location.x].oneway_road_vert = true;\r\n\t\t\t} else if (r.direction == Direction.NORTH)\r\n\t\t\t\tcity_squares[r.location.y][r.location.x].oneway_road_north = true;\r\n\t\t\telse if (r.direction == Direction.SOUTH)\r\n\t\t\t\tcity_squares[r.location.y][r.location.x].oneway_road_south = true;\r\n\t\t\telse if (r.direction == Direction.WEST)\r\n\t\t\t\tcity_squares[r.location.y][r.location.x].oneway_road_west = true;\r\n\t\t\telse if (r.direction == Direction.EAST)\r\n\t\t\t\tcity_squares[r.location.y][r.location.x].oneway_road_east = true;\r\n\t\t\ttry {\r\n\t\t\t\tcity_squares[r.location.y][r.location.x].updateImage();\r\n\t\t\t} catch (IOException 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}\r\n\t}", "@Test\n public void isCollidingTestNoCollision(){\n TileMap tileMap = new TileMap(24, 24, new byte[][]{{1,1},{1,1},{1,1},{1,1}},new byte[][]{{1,1},{1,1},{1,1},{1,1}}, tilepath);\n Rect cBox = new Rect(0, 0, 0, 0);\n assertFalse(tileMap.isColliding(cBox));\n assertEquals(false, tileMap.isColliding(cBox));\n }", "public void paintComponent(Graphics g){\n\t\t\tsuper.paintComponent(g);\n\t\t\tg.setColor(Color.black);\n\t\t\tg.fillRect(0,0,getWidth(), getHeight());//paints the background black\n\t\t\tt.drawTank(g);//draws the tank\n\t\t\tboolean b = false;\n\t\t\tfor (int i = 0; i < t.bullets.size(); i++){ //draws the bullets. if the bullets either hit a plane or go off the screen, they are removed from the array to not clog up memory\n\t\t\t\tt.bullets.get(i).drawBullet(g);\n\t\t\t\tt.bullets.get(i).move();\n\n\t\t\t\tfor (int j = 0; j < bombers.size(); j++){ //draws the bombers, removes them if they are shot down\n\t\t\t\t\tif (bombers.get(j).checkHit(t.bullets.get(i))) {t.bullets.remove(i); b = true; break;}\n\t\t\t\t}\t\t\t\t\n\t\t\t\tif (!b)\n\t\t\t\t\tif (t.bullets.get(i).bx < 0 || t.bullets.get(i).bx > 1090 || t.bullets.get(i).by < 0 || t.bullets.get(i).by > 730) t.bullets.remove(i);\n\t\t\t}\n\t\t\t\n\t\t\tfor (int i = 0; i < bombers.size(); i ++){ \n\t\t\t\tbombers.get(i).drawBomber(g);\n\t\t\t}\n\t\t \tif (t.lost == true){ //manages the loosing of the game\n\t\t\t\t\n\t\t\t\tif (t.startboomtimer){\n\t\t\t\t\tif (t.boomtimer < 10) g.drawImage(boom2, t.x +25, 565, 100, 60, null);\n\t\t\t\t\telse if (t.boomtimer < 20) g.drawImage(boom2, t.x,535, 150,100,null);\n\t\t\t\t\telse if (t.boomtimer == 30) t.startboomtimer = false;\n\t\t\t\t\tt.boomtimer ++;\n\t\t\t\t}\n\t\t\t\tg.setColor(Color.WHITE);\n\t\t\t\tg.setFont(new Font(\"Times New Roman\", Font.BOLD, 50));\n\t\t\t\tg.drawString(\"YOU LOST :(\", 400, 300);\n\t\t\t\tif (t.onetime == 31){ //this method adds a question panel so that when you loose you can revive yourself with the questions\n\t\t\t\t\t\n\t\t\t\t\tmoveframe = new JFrame (\"Move on\");\n\t\t\t\t\t\n\t\t\t\t\tmoveframe.setSize(510,320);\n\t\t\t\t\tRandom rand = new Random();\n\t\t\t\t\tQuestion question1 = questions.get(rand.nextInt(questions.size())); //selects 2 seperate questions from the question array to be used\n\t\t\t\t\tQuestion question2;\n\t\t\t\t\tdo {\n\t\t\t\t\t\tquestion2 = questions.get(rand.nextInt(questions.size()));\n\t\t\t\t\t} while(question2.equals(question1));\n\t\t\t\t\t\n\t\t\t\t\tmoveframe.getContentPane().add(new QuestionPanelLoss(question1, question2, 0), BorderLayout.CENTER); //adds the questionpanel\n\t\t\t\t\tmoveframe.setLocationRelativeTo(null);;\n\t\t\t\t\tmoveframe.setVisible(true);\n\n\t\t\t\t\t\n\t\t\t\t\ttime.stop();\n\t\t\t\t}\n\t\t\t\tt.onetime ++ ;\n\t\t\t\n\t\t\t}\n\n\n\t\t}", "public void render(Graphics2D g,GameState state) {\n /**\n * information EnemyTank\n */\n AffineTransform tx = new AffineTransform();\n tx.setToTranslation(locX + state.xTransfer - smallEnemyBodyImage.getWidth() / 2 , locY + state.yTransfer - smallEnemyBodyImage.getHeight() / 2);\n tx.rotate(Math.toRadians(tankAngle), 50, 50);\n /**\n * information Enemy Gun\n */\n AffineTransform tx2 = new AffineTransform();\n tx2.setToTranslation(locX + state.xTransfer - smallEnemyGunImage.getWidth() / 5, locY + state.yTransfer - smallEnemyGunImage.getHeight() / 4.2);\n tx2.rotate(Math.toRadians(gunAngle), 20, 20);\n\n\n// Random random = new Random();\n// int angle = random.nextInt(360);\n// System.out.println(angle);\n /**\n * initialize is false\n */\n// if(j == 0)\n// limitMoving = false;\n//\n// if(limitMoving == false)\n// {\n// locX ++ ;\n// j++;\n// }\n// if(j == 100)\n// limitMoving = true;\n// if(limitMoving == true)\n// {\n// locX -- ;\n// j--;\n// }\n\n\n up = false;\n down = false;\n right = false;\n left = false;\n if(Math.abs(state.locX - (locX + state.xTransfer)) < 400 && Math.abs(state.locY - (locY + state.yTransfer)) < 400) {\n if (state.locX >= locX + state.xTransfer ) {\n locX++;\n right = true;\n left = false;\n }\n else {\n locX--;\n left = true;\n right = false;\n }\n\n if (state.locY >= locY + state.yTransfer) {\n locY++;\n up = false;\n down = true;\n }\n else {\n locY--;\n down = false;\n up = true;\n }\n ShapesIntersects shapesIntersects = new ShapesIntersects();\n for (Enemy01 e1 : GameFrame.getEnemyController().getE1()) {\n if (e1.locX != locX || e1.locY != locY) {\n // System.out.println(\"hi\");\n if (shapesIntersects.checkIntersect(locX + state.xTransfer - smallEnemyBodyImage.getWidth() / 2, locY + state.yTransfer - smallEnemyBodyImage.getHeight() / 2, smallEnemyBodyImage.getWidth(), smallEnemyBodyImage.getHeight()\n , e1.locX + state.xTransfer - smallEnemyBodyImage.getWidth() / 2, e1.locY + state.yTransfer - smallEnemyBodyImage.getHeight() / 2, smallEnemyBodyImage.getWidth(), smallEnemyBodyImage.getHeight())) {\n // System.out.println(\"intersects between enemy 01 is True\");\n if (right) {\n locX--;\n right = false;\n }\n if (left) {\n locX++;\n left = false;\n }\n if (up) {\n locY++;\n up = false;\n }\n if (down) {\n locY--;\n down = false;\n }\n }\n }\n }\n if (shapesIntersects.checkIntersect(locX + state.xTransfer - smallEnemyBodyImage.getWidth() / 2, locY + state.yTransfer - smallEnemyBodyImage.getHeight() / 2, smallEnemyBodyImage.getWidth(), smallEnemyBodyImage.getHeight()\n , state.locX - GameFrame.getMyTankImage().getWidth() / 2, state.locY - GameFrame.getMyTankImage().getHeight() / 2, GameFrame.getMyTankImage().getWidth(), GameFrame.getMyTankImage().getHeight()))\n {\n if (right) {\n locX--;\n right = false;\n }\n if (left) {\n locX++;\n left = false;\n }\n if (up) {\n locY++;\n up = false;\n }\n if (down) {\n locY--;\n down = false;\n }\n }\n for (HardWall hW : GameFrame.getWallController().getHardWalls())\n if(shapesIntersects.checkIntersect(locX + state.xTransfer - GameFrame.getMyTankImage().getWidth() / 2, locY + state.yTransfer - GameFrame.getMyTankImage().getHeight() / 2, GameFrame.getMyTankImage().getWidth(), GameFrame.getMyTankImage().getHeight()\n , hW.getLocX() + state.xTransfer, hW.getLocY() + state.yTransfer,hW.getHardWallImage().getWidth() ,hW.getHardWallImage().getHeight()))\n {\n if(right)\n locX--;\n if(left)\n locX++;\n if(up)\n locY++;\n if (down)\n locY--;\n }\n for (SoftWall sW : GameFrame.getWallController().getSoftWalls())\n if(shapesIntersects.checkIntersect(locX + state.xTransfer - GameFrame.getMyTankImage().getWidth() / 2 + 2, locY + state.yTransfer - GameFrame.getMyTankImage().getHeight() / 2 + 2, GameFrame.getMyTankImage().getWidth() - 5, GameFrame.getMyTankImage().getHeight() - 5\n , sW.getLocX() + state.xTransfer, sW.getLocY() + state.yTransfer,sW.getSoftWall01Image().getWidth() ,sW.getSoftWall01Image().getHeight()))\n {\n if(right)\n locX--;\n if(left)\n locX++;\n if(up)\n locY++;\n if (down)\n locY--;\n }\n for (Teazel teazel : GameFrame.getWallController().getTeazels())\n if(shapesIntersects.checkIntersect(locX + state.xTransfer - GameFrame.getMyTankImage().getWidth() / 2, locY + state.yTransfer - GameFrame.getMyTankImage().getHeight() / 2, GameFrame.getMyTankImage().getWidth(), GameFrame.getMyTankImage().getHeight()\n , teazel.getLocX() + state.xTransfer, teazel.getLocY() + state.yTransfer,teazel.getTeazelImage().getWidth() ,teazel.getTeazelImage().getHeight()))\n {\n if(right)\n locX--;\n if(left)\n locX++;\n if(up)\n locY++;\n if (down)\n locY--;\n }\n for (Enemy02 e2 : GameFrame.getEnemyController().getE2())\n if(shapesIntersects.checkIntersect(locX + state.xTransfer - GameFrame.getMyTankImage().getWidth() / 2 + 2, locY + state.yTransfer - GameFrame.getMyTankImage().getHeight() / 2 + 2, GameFrame.getMyTankImage().getWidth() - 5, GameFrame.getMyTankImage().getHeight() - 5\n , e2.getLocX() + state.xTransfer, e2.getLocY() + state.yTransfer,e2.getMovingEnemyImage().getWidth() ,e2.getMovingEnemyImage().getHeight()))\n {\n if(right)\n locX--;\n if(left)\n locX++;\n if(up)\n locY++;\n if (down)\n locY--;\n }\n for (Enemy03 e3 : GameFrame.getEnemyController().getE3())\n if(shapesIntersects.checkIntersect(locX + state.xTransfer - GameFrame.getMyTankImage().getWidth() / 2 + 2, locY + state.yTransfer - GameFrame.getMyTankImage().getHeight() / 2 + 2, GameFrame.getMyTankImage().getWidth() - 5, GameFrame.getMyTankImage().getHeight() - 5\n , e3.getLocX() + state.xTransfer, e3.getLocY() + state.yTransfer,e3.getBigEnemyBodyImage().getWidth() ,e3.getBigEnemyBodyImage().getHeight()))\n {\n if(right)\n locX--;\n if(left)\n locX++;\n if(up)\n locY++;\n if (down)\n locY--;\n }\n\n tankAngle = enemyTankRotation.getAngle(up, down, left, right);\n enemyTankRotation.setTankAngle(tankAngle);\n gunAngle = Math.toDegrees(Math.atan2(state.locY - (locY + state.yTransfer), state.locX - (locX + state.xTransfer)));\n// Random random = new Random();\n// int n = random.nextInt(10);\n// if (n == 3)\n if(i % 50 == 0)\n GameFrame.getBulletController().addBullet(new Enemy01Bullet(locX,locY ,gunAngle,smallEnemyGunImage));\n\n i++;\n // angle = Math.toDegrees(Math.atan2(state.mouseY - state.locY - myTankImage.getHeight() / 2, state.mouseX - state.locX - myTankImage.getWidth() / 2));\n }\n// System.out.println(\"loc x = \" + locX);\n// System.out.println(\"loc y = \" + locY);\n g.drawImage(smallEnemyBodyImage,tx,null);\n g.drawImage(smallEnemyGunImage, tx2, null);\n// System.out.println(\"enemy 01 loc x = \" + locX);\n// System.out.println(\"enemy 01 loc y = \" + locY);\n }", "private void draw() {\n this.player.getMap().DrawBackground(this.cameraSystem);\n\n //Dibujamos al jugador\n player.draw();\n\n for (Character character : this.characters) {\n if (character.getMap() == this.player.getMap()) {\n character.draw();\n }\n }\n\n //Dibujamos la parte \"superior\"\n this.player.getMap().DrawForeground();\n\n //Sistema de notificaciones\n this.notificationsSystem.draw();\n\n this.player.getInventorySystem().draw();\n\n //Hacemos que la cámara se actualice\n cameraSystem.draw();\n }", "public void draw(Graphics2D graphics) {\n\n for (int y = 0; y < MAP_HEIGHT; y++)\n for (int x = 0; x < MAP_WIDTH; x++) {\n Tile temp = tiles[x][y];\n Tile bgtemp = backGroundTiles[x][y];\n Tile grasstemp = grassTiles[x][y];\n if ((temp.x >= -TILE_SIZE && temp.x <= Constants.FRAME_WIDTH\n + TILE_SIZE)\n && (temp.y >= -TILE_SIZE && temp.y <= Constants.FRAME_HEIGHT\n + TILE_SIZE)) {\n\n if (bgtemp.texture != 0) {\n graphics.drawImage(sprites.getTile(bgtemp.texture), bgtemp.x,\n bgtemp.y, null);\n }\n if (temp.texture != 0) {\n graphics.drawImage(sprites.getTile(temp.texture), temp.x, temp.y,\n null);\n }\n if (grasstemp.texture != 0) {\n graphics.drawImage(sprites.getTile(grasstemp.texture), grasstemp.x,\n grasstemp.y, null);\n }\n }\n }\n }", "@Test\n public void notOnGroundTest(){\n TileMap tileMap = new TileMap(24, 24, new byte[][]{{0,0},{0,0}},new byte[][]{{1,0},{1,1}}, tilepath);\n Rect cBox = new Rect(2,2,2,2);\n assertFalse(tileMap.isOnGround(cBox));\n }", "private void debugDrawCollideablePolygon(CollideablePolygon entity) {\n\t\tif (entity.getTransformedVertices().length > 6) { // don't try to draw if there aren't enough points to draw\n\t\t\t// draw triangulated hitbox\n\t\t\tshapeRenderer.setColor(Color.YELLOW);\n\t\t\tfor (float[] triangle : entity.getTriangles()) {\n\t\t\t\tshapeRenderer.polygon(triangle);\n\t\t\t}\n\n\t\t\tshapeRenderer.setColor(Color.FIREBRICK);\n\t\t\t// draw hitbox\n\t\t\tshapeRenderer.polygon(entity.getTransformedVertices());\n\n\t\t\t// draw a circle at x, y pos of polygon\n\t\t\tshapeRenderer.setColor(Color.CORAL);\n\t\t\tshapeRenderer.circle(entity.getX(), entity.getY(), 1);\n\n\t\t\t// draw a line representing the cutoffy\n\t\t\tRectangle boundingRect = entity.getBoundingRectangle(); // used\n\t\t\t// to draw ycuttoff line\n\t\t\tshapeRenderer.setColor(Color.GREEN);\n\t\t\tfloat length = boundingRect.getWidth() * 2;\n\t\t\tshapeRenderer.line(boundingRect.getX() - length / 2, entity.getTransformedCutoffY(), boundingRect.getX() + length, entity.getTransformedCutoffY());\n\t\t\tshapeRenderer.setColor(Color.BLUE);\n\t\t}\n\n\t}", "@Override\r\n\t\tpublic void paintComponent(Graphics g) {\r\n\r\n\t\t\tsuper.paintComponent(g); // Fills the background color.\r\n\r\n\t\t\tg.setColor(Color.DARK_GRAY);\r\n\t\t\tg.fillRect(10, 10, columns * squareSize + 1, rows * squareSize + 1);\r\n\r\n\t\t\tfor (int r = 0; r < rows; r++) {\r\n\t\t\t\tfor (int c = 0; c < columns; c++) {\r\n\t\t\t\t\tif (grid[r][c] == EMPTY) {\r\n\t\t\t\t\t\tg.setColor(Color.WHITE);\r\n\t\t\t\t\t} else if (grid[r][c] == ROBOT) {\r\n\t\t\t\t\t\tg.setColor(Color.RED);\r\n\t\t\t\t\t} else if (grid[r][c] == TARGET) {\r\n\t\t\t\t\t\tg.setColor(Color.GREEN);\r\n\t\t\t\t\t} else if (grid[r][c] == OBST) {\r\n\t\t\t\t\t\tg.setColor(Color.BLACK);\r\n\t\t\t\t\t} else if (grid[r][c] == FRONTIER) {\r\n\t\t\t\t\t\tg.setColor(Color.BLUE);\r\n\t\t\t\t\t} else if (grid[r][c] == CLOSED) {\r\n\t\t\t\t\t\tg.setColor(Color.CYAN);\r\n\t\t\t\t\t} else if (grid[r][c] == ROUTE) {\r\n\t\t\t\t\t\tg.setColor(Color.YELLOW);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tg.fillRect(11 + c * squareSize, 11 + r * squareSize, squareSize - 1, squareSize - 1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (drawArrows.isSelected()) {\r\n\t\t\t\t// We draw all arrows from each open or closed state\r\n\t\t\t\t// to its predecessor.\r\n\t\t\t\tfor (int r = 0; r < rows; r++) {\r\n\t\t\t\t\tfor (int c = 0; c < columns; c++) {\r\n\t\t\t\t\t\t// If the current cell is the goal and the solution has\r\n\t\t\t\t\t\t// been found,\r\n\t\t\t\t\t\t// or belongs in the route to the target,\r\n\t\t\t\t\t\t// or is an open state,\r\n\t\t\t\t\t\t// or is a closed state but not the initial position of\r\n\t\t\t\t\t\t// the robot\r\n\t\t\t\t\t\tif ((grid[r][c] == TARGET && found) || grid[r][c] == ROUTE || grid[r][c] == FRONTIER\r\n\t\t\t\t\t\t\t\t|| (grid[r][c] == CLOSED && !(r == robotStart.row && c == robotStart.col))) {\r\n\t\t\t\t\t\t\t// The tail of the arrow is the current cell, while\r\n\t\t\t\t\t\t\t// the arrowhead is the predecessor cell.\r\n\t\t\t\t\t\t\tCell head;\r\n\t\t\t\t\t\t\tif (grid[r][c] == FRONTIER) {\r\n\t\t\t\t\t\t\t\tif (dijkstra.isSelected()) {\r\n\t\t\t\t\t\t\t\t\thead = findPrev(graph, new Cell(r, c));\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\thead = findPrev(openSet, new Cell(r, c));\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\thead = findPrev(closedSet, new Cell(r, c));\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t// The coordinates of the center of the current cell\r\n\t\t\t\t\t\t\tint tailX = 11 + c * squareSize + squareSize / 2;\r\n\t\t\t\t\t\t\tint tailY = 11 + r * squareSize + squareSize / 2;\r\n\t\t\t\t\t\t\t// The coordinates of the center of the predecessor\r\n\t\t\t\t\t\t\t// cell\r\n\t\t\t\t\t\t\tint headX = 11 + head.col * squareSize + squareSize / 2;\r\n\t\t\t\t\t\t\tint headY = 11 + head.row * squareSize + squareSize / 2;\r\n\t\t\t\t\t\t\t// If the current cell is the target\r\n\t\t\t\t\t\t\t// or belongs to the path to the target ...\r\n\t\t\t\t\t\t\tif (grid[r][c] == TARGET || grid[r][c] == ROUTE) {\r\n\t\t\t\t\t\t\t\t// ... draw a red arrow directing to the target.\r\n\t\t\t\t\t\t\t\tg.setColor(Color.RED);\r\n\t\t\t\t\t\t\t\tdrawArrow(g, tailX, tailY, headX, headY);\r\n\t\t\t\t\t\t\t\t// Else ...\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t// ... draw a black arrow to the predecessor\r\n\t\t\t\t\t\t\t\t// cell.\r\n\t\t\t\t\t\t\t\tg.setColor(Color.BLACK);\r\n\t\t\t\t\t\t\t\tdrawArrow(g, headX, headY, tailX, tailY);\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}\r\n\t\t\t}\r\n\t\t}", "public void draw() {\n GraphicsContext gc = getGraphicsContext2D();\n /*gc.clearRect(0, 0, getWidth(), getHeight());\n\n if (squareMap != null) {\n squareMap.draw(gc);\n }\n if (hexMap != null) {\n hexMap.draw(gc);\n }*/\n\n // Draw animations\n for (SpriteAnimationInstance anim : animationList) {\n anim.draw(gc);\n }\n\n // Lastly draw the dialogue window, no matter which canvas\n // we are on, all the same.\n DfSim.dialogueWindow.draw(gc);\n\n /*if (landMap != null) {\n landMap.draw(gc);\n }*/\n\n // Draw a border around the canvas\n //drawBorder(gc);\n\n // And now just draw everything directly from the simulator\n /*for (Raindrop item : sim.getDrops()) {\n drawMovableCircle(gc, item);\n }\n for (Earthpatch item : sim.getPatches()) {\n drawMovableCircle(gc, item);\n }\n for (SysShape item : sim.getShapes()) {\n drawSysShape(gc, item);\n }\n for (Spike item : sim.getSpikes()) {\n drawMovablePolygon(gc, item);\n }\n for (GravityWell item : sim.getGravityWells()) {\n drawGravityWell(gc, item);\n }*/\n }", "public void updateOptimalCollisionArea();", "private void circleCollison() {\n\t\t\n\t}", "public void Obstaclemove() {\n for (int i = 0; i < getNumberObstacles(); i++) {\n if (ObstacleDeplace.class.isInstance(getObstacle()[i])) {\n getObstacle()[i].setX(getObstacle()[i].getX() - getObstacle()[i].getSpeed());\n\n if (getObstacle()[i].getX() < -200) {\n getObstacle()[i].setX(600);\n getObstacle()[i].setSpeed(randomGenerator.nextFloat());\n }\n }\n setChanged();\n notifyObstacle(i, getObstacle()[i].getX(), getObstacle()[i].getY());\n }\n }", "void testDrawBoard(Tester t) {\r\n initData();\r\n\r\n //testing draw board on a world\r\n t.checkExpect(this.game2.drawBoard(),\r\n new OverlayOffsetAlign(\"center\", \"bottom\",\r\n new TextImage(\"Flood-It!\", Cnst.textHeight, Color.BLUE),\r\n 0, Cnst.boardHeight + Cnst.scale,\r\n new AboveAlignImage(\"center\",\r\n new TextImage(\"Turn Count: \" + Integer.toString(1) + \"/\"\r\n + Integer.toString(100), Cnst.textHeight, Color.BLACK),\r\n this.game2.indexHelp(0,0).drawBoard(2)).movePinhole(0, (Cnst.scale * 7) / 2)\r\n ).movePinhole(0, (Cnst.scale * 76) / 10)\r\n .movePinhole(-Cnst.boardWidth / 2, -Cnst.boardHeight / 2));\r\n\r\n t.checkExpect(this.game3.drawBoard(),\r\n new OverlayOffsetAlign(\"center\", \"bottom\",\r\n new TextImage(\"Flood-It!\", Cnst.textHeight, Color.BLUE),\r\n 0, Cnst.boardHeight + Cnst.scale,\r\n new AboveAlignImage(\"center\",\r\n new TextImage(\"Turn Count: \" + Integer.toString(1) + \"/\"\r\n + Integer.toString(10), Cnst.textHeight, Color.BLACK),\r\n this.game3.indexHelp(0,0).drawBoard(3)).movePinhole(0, (Cnst.scale * 7) / 2)\r\n ).movePinhole(0, (Cnst.scale * 76) / 10)\r\n .movePinhole(-Cnst.boardWidth / 2, -Cnst.boardHeight / 2));\r\n\r\n t.checkExpect(this.game5.drawBoard(),\r\n new OverlayOffsetAlign(\"center\", \"bottom\",\r\n new TextImage(\"Flood-It!\", Cnst.textHeight, Color.BLUE),\r\n 0, Cnst.boardHeight + Cnst.scale,\r\n new AboveAlignImage(\"center\",\r\n new TextImage(\"Turn Count: \" + Integer.toString(5) + \"/\"\r\n + Integer.toString(5), Cnst.textHeight, Color.BLACK),\r\n this.game5.indexHelp(0,0).drawBoard(4)).movePinhole(0, (Cnst.scale * 7) / 2)\r\n ).movePinhole(0, (Cnst.scale * 76) / 10)\r\n .movePinhole(-Cnst.boardWidth / 2, -Cnst.boardHeight / 2));\r\n\r\n //testing draw board on a visible cell\r\n t.checkExpect(this.game2.indexHelp(0, 0).drawBoard(2),\r\n new AboveImage(this.game2.indexHelp(0, 0).drawRow(2),\r\n this.game2.indexHelp(0, 0).bottom.drawBoard(2)));\r\n\r\n t.checkExpect(this.game3.indexHelp(0, 0).drawBoard(3),\r\n new AboveImage(this.game3.indexHelp(0, 0).drawRow(3),\r\n this.game3.indexHelp(0, 0).bottom.drawBoard(3)));\r\n\r\n t.checkExpect(this.game5.indexHelp(0, 0).drawBoard(4),\r\n new AboveImage(this.game5.indexHelp(0, 0).drawRow(4),\r\n this.game5.indexHelp(0, 0).bottom.drawBoard(4)));\r\n\r\n //testing it on an end cell\r\n t.checkExpect(this.game2.indexHelp(-1, 1).drawBoard(2), new EmptyImage());\r\n }", "public void drawDebug(){\n debugRenderer.setProjectionMatrix(cam.combined);\n debugRenderer.begin(ShapeRenderer.ShapeType.Line);\n\n for (Object e : world.getEnemies()) {\n Enemy enemy = (Enemy)e;\n Rectangle rect = enemy.getBounds();\n float x1 = rect.x;\n float y1 = rect.y;\n debugRenderer.setColor(new Color(1, 0, 0, 1));\n debugRenderer.rect(x1, y1, rect.width, rect.height);\n }\n\n for(Bullet b : world.getPlayer().getWeapon().getBullets()) {\n Rectangle rect = b.getBounds();\n float x1 = rect.x;\n float y1 = rect.y;\n debugRenderer.setColor(new Color(1, 0, 0, 1));\n debugRenderer.rect(x1, y1, rect.width, rect.height);\n }\n\n for(Enemy e : world.getEnemies()) {\n for(Bullet b : e.getWeapon().getBullets()){\n Rectangle rect = b.getBounds();\n float x1 = rect.x;\n float y1 = rect.y;\n debugRenderer.setColor(new Color(1, 0, 0, 1));\n debugRenderer.rect(x1, y1, rect.width, rect.height);\n }\n }\n\n Player player = world.getPlayer();\n Rectangle rect = player.getBounds();\n float x1 = rect.x;\n float y1 = rect.y;\n debugRenderer.setColor(new Color(0, 1, 0, 1));\n debugRenderer.rect(x1, y1, rect.width, rect.height);\n debugRenderer.end();\n }", "public void decision(Entity[][] map, int y, int x){ \r\n if (!getTired()){\r\n // check if surrounding area is another animal\r\n if ((x > 0) && (y > 0) && (map[y-1][x-1] instanceof Animal )){\r\n destroyArea(map, x, y);\r\n }else if ((x < map.length-1) && (y < map.length -1) && (map[y+1][x+1] instanceof Animal)){\r\n destroyArea(map, x, y);\r\n }else if ((y > 0) && map[y-1][x] instanceof Animal){\r\n destroyArea(map, x, y);\r\n }else if ((x < map.length -1) && (y > 0) && (map[y-1][x+1] instanceof Animal)){\r\n destroyArea(map, x, y);\r\n }else if(( x < map.length -1) && (map[y][x+1] instanceof Animal)){\r\n destroyArea(map, x, y);\r\n }else if(( x > 0) && (map[y][x-1] instanceof Animal)){\r\n destroyArea(map, x, y);\r\n }else if( (y < map.length-1) && (map[y+1][x] instanceof Animal)){\r\n destroyArea(map, x, y);\r\n }else if((x > 0) && (y < map.length -1) && (map[y+1][x-1] instanceof Animal)){\r\n destroyArea(map, x, y);\r\n }else if (numOfTurns == 3){\r\n numOfTurns = 0;\r\n moveRandom(map, y, x);\r\n }\r\n }\r\n numOfTurns ++;\r\n }", "private void renderRobot(Graphics g, Location robotLocation, Direction robotDirection, GridLocation gridPosition){\n g.setColor(Color.RED);\n g.fillRect(gridPosition.getX() + robotLocation.getX()*CELL_SIZE, gridPosition.getY() + robotLocation.getY()*CELL_SIZE,CELL_SIZE, CELL_SIZE);\n g.setColor(Color.BLUE);\n\n if (robotDirection == Direction.UP || robotDirection == Direction.DOWN){\n g.drawLine(gridPosition.getX() + robotLocation.getX()*CELL_SIZE + CELL_SIZE / 2, gridPosition.getY() + robotLocation.getY()*CELL_SIZE , gridPosition.getX() + robotLocation.getX()*CELL_SIZE + CELL_SIZE / 2, gridPosition.getY() + robotLocation.getY()*CELL_SIZE + CELL_SIZE);\n if(robotDirection == Direction.UP){\n g.drawLine(gridPosition.getX() + robotLocation.getX()*CELL_SIZE + CELL_SIZE / 2, gridPosition.getY() + robotLocation.getY()*CELL_SIZE, gridPosition.getX() + robotLocation.getX()*CELL_SIZE + CELL_SIZE / 4, gridPosition.getY() + robotLocation.getY()*CELL_SIZE + CELL_SIZE / 4);\n g.drawLine(gridPosition.getX() + robotLocation.getX()*CELL_SIZE + CELL_SIZE / 2, gridPosition.getY() + robotLocation.getY()*CELL_SIZE, gridPosition.getX() + robotLocation.getX()*CELL_SIZE + 3 * CELL_SIZE / 4, gridPosition.getY() + robotLocation.getY()*CELL_SIZE + CELL_SIZE / 4);\n }\n else{\n g.drawLine(gridPosition.getX() + robotLocation.getX()*CELL_SIZE + CELL_SIZE / 2, gridPosition.getY() + robotLocation.getY()*CELL_SIZE + CELL_SIZE, gridPosition.getX() + robotLocation.getX()*CELL_SIZE + CELL_SIZE / 4, gridPosition.getY() + robotLocation.getY()*CELL_SIZE + 3 * CELL_SIZE / 4);\n g.drawLine(gridPosition.getX() + robotLocation.getX()*CELL_SIZE + CELL_SIZE / 2, gridPosition.getY() + robotLocation.getY()*CELL_SIZE + CELL_SIZE, gridPosition.getX() + robotLocation.getX()*CELL_SIZE + 3 * CELL_SIZE / 4, gridPosition.getY() + robotLocation.getY()*CELL_SIZE + 3 * CELL_SIZE / 4);\n }\n }\n\n else if (robotDirection == Direction.LEFT || robotDirection == Direction.RIGHT){\n g.drawLine(gridPosition.getX() + robotLocation.getX()*CELL_SIZE , gridPosition.getY() + robotLocation.getY()*CELL_SIZE + CELL_SIZE / 2, gridPosition.getX() + robotLocation.getX()*CELL_SIZE + CELL_SIZE, gridPosition.getY() + robotLocation.getY()*CELL_SIZE + CELL_SIZE / 2);\n if(robotDirection == Direction.LEFT){\n g.drawLine(gridPosition.getX() + robotLocation.getX()*CELL_SIZE , gridPosition.getY() + robotLocation.getY()*CELL_SIZE + CELL_SIZE / 2, gridPosition.getX() + robotLocation.getX()*CELL_SIZE + CELL_SIZE / 4, gridPosition.getY() + robotLocation.getY()*CELL_SIZE + 1 * CELL_SIZE / 4);\n g.drawLine(gridPosition.getX() + robotLocation.getX()*CELL_SIZE , gridPosition.getY() + robotLocation.getY()*CELL_SIZE + CELL_SIZE / 2, gridPosition.getX() + robotLocation.getX()*CELL_SIZE + CELL_SIZE / 4, gridPosition.getY() + robotLocation.getY()*CELL_SIZE + 3 * CELL_SIZE / 4);\n }\n else{\n g.drawLine(gridPosition.getX() + robotLocation.getX()*CELL_SIZE + CELL_SIZE, gridPosition.getY() + robotLocation.getY()*CELL_SIZE + CELL_SIZE / 2, gridPosition.getX() + robotLocation.getX()*CELL_SIZE + 3 * CELL_SIZE / 4, gridPosition.getY() + robotLocation.getY()*CELL_SIZE + 1 * CELL_SIZE / 4);\n g.drawLine(gridPosition.getX() + robotLocation.getX()*CELL_SIZE + CELL_SIZE, gridPosition.getY() + robotLocation.getY()*CELL_SIZE + CELL_SIZE / 2, gridPosition.getX() + robotLocation.getX()*CELL_SIZE + 3 * CELL_SIZE / 4, gridPosition.getY() + robotLocation.getY()*CELL_SIZE + 3 * CELL_SIZE / 4);\n }\n }\n }", "@Override\n\t\t\tprotected void paintComponent(Graphics g) {\n\t\t\t\tsuper.paintComponent(g);\n\t\t\t\tfor (int i = 0; i < wall.length; i++) {\n\t\t\t\t\tfor (int j = 0; j < wall[i].length; j++) {\n\t\t\t\t\t\tg.setColor(Color.blue);\n\t\t\t\t\t\tg.drawRect(i*30, j*30, 30, 30);\n\t\t\t\t\t\tif (wall[i][j] == 1) {\n\t\t\t\t\t\t\tg.fillRect(i*30, j*30, 30, 30);\t\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}", "private boolean isObstacle(char data)\n {\n if(data == '@' || data == 'T' || data == '\\u0000' || data == Map.EDGE)\n return true;\n return false;\n }", "public Obstacle getConstructingObstacle();", "protected void timeIsOver(){\n //Gets all the boats that are not placed\n for(BoatDrawing myBoat : boatMap.values()){\n while(!myBoat.isPlaced()){\n //Sets a non placed boat with a random position with a random rotation\n activeBoat=myBoat;\n Random rn = new Random(); \n draw(activeBoat, rn.nextInt(NB_CASES_GRID), rn.nextInt(NB_CASES_GRID));\n if(rn.nextInt(RANDOM_ROTATION)==1){\n drawRotation(activeBoat);\n } \n if(positionCorrect(myBoat)){\n //If the position is corrrect, draws the boat\n this.placeBoat(myBoat);\n }\n }\n }\n onValidate();\n }", "@Override\n\tpublic void paintComponent(Graphics g)\n\t{\n\t\tsuper.paintComponent(g);\n\t\t//Draw the board and the table\n\t\tif (isTableVisible) {\n\t\t\tdrawBackground(this, g, gameInstance);\n\t\t}\n\n\t\tGraphics2D g2 = (Graphics2D)g;\n\t\tRenderingHints rh = new RenderingHints(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER_QUALITY);\n\t\tg2.setRenderingHints(rh);\n\t\tg2.setTransform(boardToScreenTransformation);\n\t\tdrawPlayerIcons(this, g, gameInstance);\n\t\t//Draw all player related information\n\t\tdrawPlayerPositions(this, g, gameInstance, player, infoText);\n\n\t\t//Draw all objects not in some private area\n\t\tObjectFunctions.getDrawOrder(gameInstance, ial);\n\t\toiList.clear();\n\t\tgameInstance.getObjects(oiList);\n\t\tArrayList<ObjectInstance> drawableObjects = new ArrayList<>();\n\t\tCheckFunctions.drawableObjectsOnTable(oiList, drawableObjects);\n\t\tdrawableObjects.sort(ObjectFunctions.objectInstanceDrawValueComparator);\n\t\tial.clear();\n\t\tObjectFunctions.addObjectListToIdList(drawableObjects, ial);\n\t\tdrawObjectsFromList(this,g,gameInstance,player, ial);\n\n\t\t//Draw selection rectangle\n\t\tdrawSelection(this, g, player);\n\n\t\t//Draw Private Area\n\t\tif (!player.visitor) {\n\t\t\tdrawPrivateArea(this, g);\n\t\t}\n\n\n\t\tAffineTransform tmp = g2.getTransform();\n\t\tg2.setTransform(boardToScreenTransformation);\n\n\t\t//Redraw selected objects not in some private area\n\t\tial.clear();\n\t\tIntegerArrayList selectedObjects = new IntegerArrayList();\n\t\tObjectFunctions.getSelectedObjects(gameInstance, selectedObjects);\n\t\tfor (int id : selectedObjects){\n\t\t ial.addUnique(id);\n\t\t\tObjectFunctions.getAllAboveLyingObjects(gameInstance, player, gameInstance.getObjectInstanceById(id), ial2);\n ial.addUnique(ial2);\n\t\t}\n\t\tObjectFunctions.sortByDrawValue(gameInstance, ial);\n\t\t//ArrayUtil.unifySorted(ial);\n\t\tdrawObjectsFromList(this, g, gameInstance, player, ial, ial2);\n\n\n\t\t//Draw objects in private area\n\t\tif (!player.visitor && privateArea.zooming != 0) {\n\t\t\tdrawTokensInPrivateArea(this, g, gameInstance, player, hoveredObject);\n\t\t}\n\n\n\t\tg2.setTransform(tmp);\n\n\t\t//Draw debug informations\n\t\tif (isDebug) {\n\t\t\tDrawFunctions.drawDebugInfo(this, g2, gameInstance, player);\n\t\t}\n\t\tif (show_ping) {\n\t\t\tg2.drawString(\"Last Signal\", getWidth() - 100, 80);\n\t\t\tfor (int i = 0; i < gameInstance.getPlayerCount(); ++i)\n\t\t\t{\n\t\t\t\tPlayer pl = gameInstance.getPlayerByIndex(i);\n\t\t\t\tg2.drawString(pl.getName() + \" \" + ((System.nanoTime() - pl.lastReceivedSignal) / 100000000) / 10f, getWidth() - 100, 100 + 20 * i);\n\t\t\t}\n\t\t}\n\t}", "@Test\n public void isCollidingTestCollision(){\n TileMap tileMap = new TileMap(24, 24, new byte[][]{{1,1},{1,1},{1,1},{1,1}},new byte[][]{{1,1},{1,1},{1,1},{1,1}}, tilepath);\n Rect cBox = new Rect(24,24,24,24);\n assertTrue(tileMap.isColliding(cBox));\n assertEquals(true, tileMap.isColliding(cBox));\n }", "public void bordersColision(VisibleObject object, int colision) {\n\r\n switch (colision) {\r\n case 1:\r\n if(object instanceof KillerShoot){\r\n ((KillerShoot) object).setMove(10);\r\n }\r\n if (this.killerGameRules.getVisualR().getSocket() != null) {\r\n \r\n this.killerGameRules.SendAndeliminateObjectRight(object);\r\n } else {\r\n this.killerGameRules.moveObjectLeftFronter(object);\r\n }\r\n break;\r\n case 2:\r\n if (this.killerGameRules.getVisualL().getSocket() != null) {\r\n this.killerGameRules.SendAndeliminateObjectLeft(object);\r\n\r\n } else {\r\n this.killerGameRules.moveObjectRightFronter(object);\r\n }\r\n break;\r\n case 3:\r\n if (object instanceof KillerShip) {\r\n\r\n object.setY(object.getY() + 1);\r\n } if(object instanceof Asteroids) {\r\n this.killerGameRules.reboundAsteroidsTop((Asteroids)object);\r\n }\r\n if(object instanceof KillerShoot){\r\n this.killerGameRules.reboundKillerShootTop((KillerShoot)object);\r\n }\r\n \r\n break;\r\n case 4:\r\n if (object instanceof KillerShip) {\r\n object.setY(object.getY() - 1);\r\n } if(object instanceof Asteroids) {\r\n this.killerGameRules.reboundAsteroidsBottom((Asteroids)object);\r\n }if(object instanceof KillerShoot){\r\n this.killerGameRules.reboundKillerShootBottom((KillerShoot)object);\r\n }\r\n break;\r\n default:\r\n break;\r\n }\r\n }", "@Test\n public void isCollidingTestBodyOfInnerFor(){\n TileMap tileMap = new TileMap(24, 24, new byte[][]{},new byte[][]{{1,0},{1,1}}, tilepath);\n Rect cBox = new Rect(2,2,2,200);\n assertTrue(tileMap.isColliding(cBox));\n assertEquals(true, tileMap.isColliding(cBox));\n }", "public void checkCollisions(){\n for(int i=bodyParts;i>0;i--){\n if((x[0]==x[i])&&(y[0]==y[i])){\n running=false;\n }\n }\n //head with left border\n if(x[0]<0){\n running=false;\n }\n //head with right border\n if(x[0]>screen_width){\n running=false;\n }\n //head with top border\n if(y[0]<0){\n running=false;\n }\n //head with bottom border\n if(y[0]>screen_height){\n running=false;\n }\n if(!running){\n timer.stop();\n }\n }", "public void collision(){\r\n\t\tif(currX < 0 || currX > 1000-width || currY < 0 || currY > 700-height){\r\n\t\t\tinGame=false;\r\n\t\t}\r\n\t\t/*\r\n\t\tI start at 1 because tail[0] will constantly be taking the position\r\n\t\tof the snake's head, so if i start at 0, the game would end immediately.\r\n\t\t*/\r\n\t\tfor(int i=1; i < numOranges; i++){\r\n\t\t\tRectangle currOrangeRect = new Rectangle(tail[i].getXcoords(), tail[i].getYcoords(), OrangeModel.getWidth(), OrangeModel.getHeight());\r\n\t\t\tif(new Rectangle(currX, currY, width, height).intersects(currOrangeRect)){\r\n\t\t\t\tinGame=false;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "static void drawTopo() {\n\t\tif (currentStage[currentSlice-1]>2)\n\t\t{\n\t\t\tfloat x1,y1,x2,y2;\n\t\t\tint N = pop.N;\n\t\t\tArrayList balloons = pop.BallList;\n\n\t\t\tfor (int i=0;i<N;i++)\n\t\t\t{\n\t\t\t\tPoint P1 = ((Balloon)(balloons.get(i))).getPoint();\n\t\t\t\tx1 = (float)(P1.getX());\n\t\t\t\ty1 = (float)(P1.getY());\n\n\t\t\t\tfor (int j=0;j<i;j++)\n\t\t\t\t{\n\t\t\t\t\tif (pop.topo[i][j]==true)\n\t\t\t\t\t{\n\t\t\t\t\t\t// label connection between cells (potential neighbours)\n\t\t\t\t\t\tjava.awt.geom.GeneralPath Tshape = new GeneralPath();\n\t\t\t\t\t\tPoint P2 = ((Balloon)(balloons.get(j))).getPoint();\n\t\t\t\t\t\tx2 = (float)(P2.getX());\n\t\t\t\t\t\ty2 = (float)(P2.getY());\n\t\t\t\t\t\tTshape.moveTo(x1, y1);\n\t\t\t\t\t\tTshape.lineTo(x2, y2);\n\t\t\t\t\t\tRoi XROI = new ShapeRoi(Tshape);\n\t\t\t\t\t\tXROI.setStrokeWidth(1);\n\t\t\t\t\t\tXROI.setStrokeColor(Color.green);\n\t\t\t\t\t\tOL.add(XROI);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private void doDrawing(Graphics g) {\n Dimension size = getSize();\n//paint all the shapes that have been dropped to the bottom \n int boardTop = (int) size.getHeight() - BOARD_HEIGHT * squareHeight();\n\n for (int i = 0; i < BOARD_HEIGHT; ++i) {\n\n for (int j = 0; j < BOARD_WIDTH; ++j) {\n// access all the squares that were stored in the board array\n Tetrominoe shape = shapeAt(j, BOARD_HEIGHT - i - 1);\n\n if (shape != Tetrominoe.NoShape) {\n \n drawSquare(g, 0 + j * squareWidth(),\n boardTop + i * squareHeight(), shape);\n }\n }\n }\n//paint the falling piece\n if (curPiece.getShape() != Tetrominoe.NoShape) {\n\n for (int i = 0; i < 4; ++i) {\n\n int x = curX + curPiece.x(i);\n int y = curY - curPiece.y(i);\n drawSquare(g, 0 + x * squareWidth(),\n boardTop + (BOARD_HEIGHT - y - 1) * squareHeight(),\n curPiece.getShape());\n }\n }\n }", "public void render(Graphics g) {\n int sxtemp = sx, sytemp = sy;\n g.drawImage(background, 0, 0, 1024, 768, sxtemp, sytemp-768, sxtemp+1024, sytemp, null);\n \n for (Obstacle1 obstacle : floors) {\n\t Rectangle range = new Rectangle(obstacle.getLocation(), obstacle.getSize());\n g.drawImage(obstacle.getImage(), range.x - sx , range.y - sy + 768, range.width, range.height, null);\n //g.drawImage(obstacle, 666, 444, obstacle.getWidth(), obstacle.getHeight(), null);\n\t}\n\tfor (Obstacle2 stair : stairs) {\n\t Rectangle range = new Rectangle(stair.getLocation(), stair.getSize());\n if (stair.getFace() == Direction.RIGHT) {\n g.drawImage(stair.getImage(), range.x + range.width - sx, range.y - sy + 768, -range.width, range.height, null);\n } else {\n g.drawImage(stair.getImage(), range.x - sx , range.y - sy + 768, range.width, range.height, null);\n }\n //g.drawImage(obstacle, 666, 444, obstacle.getWidth(), obstacle.getHeight(), null);\n\t}\n\tfor (Obstacle3 obstacle : rocks) {\n\t Rectangle range = new Rectangle(obstacle.getLocation(), obstacle.getSize());\n g.drawImage(obstacle.getImage(), range.x - sx , range.y - sy + 768, range.width, range.height, null);\n\t}\n\t\n for (Sprite sprite : sprites) {\n //System.out.println(sprite.location);\n //System.out.printf(\"%d %d\\n\", sxtemp, sytemp);\n sprite.setLocation(new Point(sprite.getX()-sxtemp, sprite.getY()-sytemp+768));\n //System.out.printf(\"%d %d\\n\", sxtemp, sytemp);\n sprite.render(g);\n sprite.setLocation(new Point(sprite.getX()+sxtemp, sprite.getY()+sytemp-768));\n }\n for(DropItem dropItem : dropItems) {\n dropItem.setLocation(new Point(dropItem.getLocation().x-sxtemp, dropItem.getLocation().y-sytemp+768));\n dropItem.render(g);\n dropItem.setLocation(new Point(dropItem.getLocation().x+sxtemp, dropItem.getLocation().y+sytemp-768));\n }\n sx = sxtemp; sy = sytemp;\n\n BufferedImage bg = resizeImage((BufferedImage)background, background.getWidth(null)/16, background.getHeight(null)/16);\n g.drawImage(bg, 0, 0, null);\n for (Sprite sprite : sprites) {\n g.setColor(Color.RED);\n Point p = sprite.getLocation();\n if(sprite instanceof Boss) g.fillOval((int)(p.getX()/16), (int)(p.getY()/16), 16, 16);\n else g.fillOval((int)(p.getX()/16), (int)(p.getY()/16), 6, 6);\n }\n for(Obstacle obstacle : floors) {\n Point p = obstacle.getLocation();\n int w = obstacle.getImage().getWidth(null), h = obstacle.getImage().getHeight(null);\n BufferedImage img = resizeImage((BufferedImage)obstacle.getImage(), w/16, h/16);\n g.drawImage(img, (int)(p.getX()/16), (int)(p.getY()/16), null);\n }\n for(Obstacle obstacle : rocks) {\n Point p = obstacle.getLocation();\n int w = obstacle.getImage().getWidth(null), h = obstacle.getImage().getHeight(null);\n BufferedImage img = resizeImage((BufferedImage)obstacle.getImage(), w/16, h/16);\n g.drawImage(img, (int)(p.getX()/16), (int)(p.getY()/16), null);\n }\n for(Obstacle obstacle : stairs) {\n Point p = obstacle.getLocation();\n int w = obstacle.getImage().getWidth(null), h = obstacle.getImage().getHeight(null);\n BufferedImage img = resizeImage((BufferedImage)obstacle.getImage(), w/16, h/16);\n g.drawImage(img, (int)(p.getX()/16), (int)(p.getY()/16), null);\n }\n\n\n g.setColor(Color.green);\n Point p = player.getLocation();\n g.fillOval((int)(p.getX()/16), (int)(p.getY()/16), 8, 8);\n g.setColor(Color.black);\n g.drawOval((int)(p.getX()/16), (int)(p.getY()/16), 8, 8);\n\n g.drawImage(pause, 950, 0, null);\n\n g.setColor(Color.pink);\n g.fillRect(350, 650, 300, 80);\n g.setColor(Color.black);\n g.drawRect(350, 650, 300, 80);\n Image pl;\n try {\n pl = ImageIO.read(new File(\"assets/others/player.png\"));\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n g.drawImage(pl, 365, 655, null);\n g.setColor(Color.black);\n g.setFont(new Font(\"TimesRoman\", Font.BOLD, 16));\n g.drawString(\"LV. \" + player.lv, 415, 700); //player.exp + \"/\" + player.lv*100\n g.drawString(\"exp \", 480, 675);\n\n g.setFont(new Font(\"TimesRoman\", Font.PLAIN, 16));\n g.setColor(Color.GRAY);\n g.fillRect(510, 660, 120, 15);\n g.setColor(Color.YELLOW);\n g.fillRect(510, 660, (int) (player.exp * 120 / (player.lv*100)), 15);\n g.setColor(Color.BLACK);\n g.drawRect(510, 660, 120, 15);\n g.drawString(player.exp + \"/\" + player.lv*100, 520, 675);\n\n HealthPointBar hpBar = player.hpBar;\n int width = (int) (hpBar.getHp() * 120 / player.KNIGHT_HP);\n int widthMp = (int) (hpBar.getMp() * 120 / player.KNIGHT_MP);\n g.setColor(Color.RED);\n g.fillRect(510, 685, 120, 15);\n g.setColor(Color.GREEN);\n g.fillRect(510, 685, width, 15);\n g.setColor(Color.WHITE);\n g.fillRect(510, 705, 120, 15);\n g.setColor(Color.BLUE);\n g.fillRect(510, 705, widthMp, 15);\n g.setColor(Color.black);\n g.drawRect(510, 685, 120, 15);\n g.drawRect(510, 705, 120, 15);\n g.setFont(new Font(\"TimesRoman\", Font.PLAIN, 16));\n g.setColor(Color.black);\n g.drawString(\"HP \", 480, 700);\n g.drawString(\"MP \", 480, 720);\n g.drawString(hpBar.getHp() + \"/\" + player.KNIGHT_HP, 520, 700);\n g.drawString(hpBar.getMp() + \"/\" + player.KNIGHT_MP, 520, 720);\n\n\n //boss\n if(bossAppear && !bossDies) {\n g.setColor(Color.pink);\n g.fillRect(350, 0, 300, 80);\n g.setColor(Color.black);\n g.drawRect(350, 0, 300, 80);\n Image bo;\n try {\n bo = ImageIO.read(new File(\"assets/others/boss.png\"));\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n g.drawImage(bo, 560, -5, null);\n g.setColor(Color.black);\n\n g.setFont(new Font(\"TimesRoman\", Font.PLAIN, 16));\n hpBar = boss.hpBar;\n width = (int) (hpBar.getHp() * 150 / boss.HP);\n g.setColor(Color.RED);\n g.fillRect(420, 35, 150, 15);\n g.setColor(Color.GREEN);\n g.fillRect(420, 35, width, 15);\n g.setColor(Color.black);\n g.drawRect(420, 35, 150, 15);\n g.setFont(new Font(\"TimesRoman\", Font.PLAIN, 16));\n g.setColor(Color.black);\n g.drawString(\"HP \", 380, 50);\n g.drawString(hpBar.getHp() + \"/\" + boss.HP, 425, 50);\n\n }\n\n if(player.levelUping > 0) {\n player.levelUping--;\n Image lvup;\n try {\n lvup = ImageIO.read(new File(\"assets/lvup/\" + player.lv + \".png\"));\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n g.drawImage(lvup, 290, 80, null);\n }\n\n g.setFont(new Font(\"TimesRoman\", Font.BOLD, 16));\n g.setColor(Color.gray);\n if(player.lv >= 1) {\n Image skillu;\n try {\n skillu = ImageIO.read(new File(\"assets/skillicon/skillu.jpg\"));\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n g.drawImage(skillu, 0, 680, null);\n g.drawString(\"u\", 20, 675);\n }\n if(player.lv >= 2) {\n Image twoStepJump;\n try {\n twoStepJump = ImageIO.read(new File(\"assets/skillicon/2stepjump.jpg\"));\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n g.drawImage(twoStepJump, 50, 680, null);\n g.drawString(\"space\", 50, 675);\n }\n if(player.lv >= 3) {\n Image skilli;\n try {\n skilli = ImageIO.read(new File(\"assets/skillicon/skilli.jpg\"));\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n g.drawImage(skilli, 100, 680, null);\n g.drawString(\"i\", 120, 675);\n }\n if(player.lv >= 4) {\n Image skillo;\n try {\n skillo = ImageIO.read(new File(\"assets/skillicon/heal.png\"));\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n g.drawImage(skillo, 150, 680, null);\n g.drawString(\"o\", 170, 675);\n }\n\n int hp = player.hpPotionCount, mp = player.mpPotionCount, ring = player.ringCount;\n g.setColor(Color.yellow);\n g.fillRect(860, 680, 150, 50);\n g.setColor(Color.black);\n g.drawRect(860, 680, 50, 50);\n g.drawRect(910, 680, 50, 50);\n g.drawRect(960, 680, 50, 50);\n\n g.setFont(new Font(\"TimesRoman\", Font.BOLD, 16));\n g.setColor(Color.black);\n Image im;\n try {\n im = ImageIO.read(new File(\"assets/dropitem/33.png\"));\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n g.drawImage(im, 860, 680, null);\n g.setColor(Color.gray);\n g.drawString(\"1\", 895, 695);\n g.setColor(Color.black);\n g.drawString(\"\" + hp, 895, 730);\n\n try {\n im = ImageIO.read(new File(\"assets/dropitem/22.png\"));\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n g.drawImage(im, 910, 680, null);\n g.setColor(Color.gray);\n g.drawString(\"2\", 945, 695);\n g.setColor(Color.black);\n g.drawString(\"\" + mp, 945, 730);\n\n try {\n im = ImageIO.read(new File(\"assets/dropitem/11.png\"));\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n g.drawImage(im, 960, 680, null);\n g.setColor(Color.gray);\n g.drawString(\"3\", 995, 695);\n g.setColor(Color.black);\n g.drawString(\"\" + ring, 995, 730);\n }", "void testDrawCell(Tester t) {\r\n initData();\r\n t.checkExpect(this.game2.indexHelp(0, 0).drawCell(2),\r\n new FrameImage(new RectangleImage(Cnst.boardWidth / 2, Cnst.boardHeight / 2,\r\n OutlineMode.SOLID, Color.ORANGE)));\r\n t.checkExpect(this.game3.indexHelp(0, 0).drawCell(3),\r\n new FrameImage(new RectangleImage(Cnst.boardWidth / 3, Cnst.boardHeight / 3,\r\n OutlineMode.SOLID, Color.GREEN)));\r\n t.checkExpect(this.game5.indexHelp(0, 0).drawCell(4),\r\n new FrameImage(new RectangleImage(Cnst.boardWidth / 4, Cnst.boardHeight / 4,\r\n OutlineMode.SOLID, Color.PINK)));\r\n t.checkExpect(this.game2.indexHelp(-1, -1).drawCell(1), new EmptyImage());\r\n }", "public void setAsObstacle() {\n\t\tnodeStatus = Status.obstacle;\n\t}", "public void removeObstacle(Coord obstacleCoord);", "public void evaluaVisibilidad(int posX, int posY)\n {\n \n /** Contiene todas las posibles casillas visibles.\n * Si en el proceso una casilla tapa, pasa a modo 'oclusion, y ocluye las demás hasta que llega al punto final (Las quita del Array)\n */\n this.casillasVisibles=new TreeSet<>();\n \n //Realizar la interpolacion\n boolean visible=true;\n CoordCasilla origen=new CoordCasilla(posX , posY);\n CoordCasilla destino;\n List<CoordCasilla>camino;\n \n /* Cell cell = new Cell();\n cell.setTile(mapaActual.getTileSets().getTileSet(0).getTile(138));*/\n \n //Calcular las interpolaciones\n for(CoordCasilla cc:MATRIZ_INTERPOLACION)\n {\n visible=true;\n destino=new CoordCasilla(origen.x +cc.x,origen.y+cc.y);\n camino= Analizador.interpola(origen, destino);\n \n \n for(CoordCasilla casillaEstudio:camino)\n {\n //Si la celda está fuera de limites no tiene sentido realizar el analisis de las casillas siguientes\n if(casillaEstudio.x<0 || casillaEstudio.x>this.anchoMapa-1 || casillaEstudio.y<0 || casillaEstudio.y>this.altoMapa - 1)\n break;\n \n \n if(!visible ) //No hay visibilidad, quitamos la casilla si la hay del TreeSet\n {\n //posibleVisibilidad.remove(celdaEstudio);\n continue;\n }\n else if(visible && this.capaViibilidad.getCell(casillaEstudio.x,casillaEstudio.y)!=null) //La casilla es limite de visibilidad\n visible=false;\n \n //TEST: Marcamos esta casilla como visible\n //this.capaAux.setCell(celdaEstudio.x, celdaEstudio.y,cell);\n \n //Llegados a este punto, quitamos la niebla de guerra de la casilla\n quitaNieblaDeGuerra(casillaEstudio);\n \n this.casillasVisibles.add(casillaEstudio);\n }\n }\n }", "@Override\n public void paintComponent(Graphics g) {\n // always clear the screen first!\n g.clearRect(0, 0, WIDTH, HEIGHT);\n\n // GAME DRAWING GOES HERE\n \n \n // draw the blocks\n g.setColor(Color.black);\n for(int i = 0; i < blocks.length; i++){\n g.fillRect(blocks[i].x, blocks[i].y, blocks[i].width, blocks[i].height);\n }\n \n // middle ref (no longer needed)\n //g.setColor(Color.black);\n //g.drawRect(WIDTH/2 - 1, 0, 1, HEIGHT);\n \n // scores\n g.setFont(biggerFont);\n g.setColor(Color.blue);\n g.drawString(\"\" + tobyScore, WIDTH/2-100, 75);\n if(tobyWin){\n g.drawString(\"Toby Wins!\", WIDTH/2-115, 120);\n }\n g.setColor(Color.red);\n if(maxWin){\n g.drawString(\"Max Wins!\", WIDTH/2-115, 120);\n }\n g.drawString(\"\" + maxScore, WIDTH/2+100, 75);\n g.setColor(Color.white);\n g.setFont(titleFont);\n g.drawString(\"Toby N' Max: Capture the Flag!\", 25, 20);\n \n // draw the player\n g.setColor(Color.red);\n g.fillRect(max.x, max.y, max.width, max.height);\n g.setColor(Color.blue);\n g.fillRect(toby.x, toby.y, toby.width, toby.height);\n \n // draw the flag\n g.setColor(brown);\n for(int i = 0; i < flagPole.length; i++){\n g.fillRect(flagPole[i].x, flagPole[i].y, flagPole[i].width, flagPole[i].height);\n }\n \n g.setColor(purple);\n for(int i = 0; i < flag.length; i++){\n g.fillRect(flag[i].x, flag[i].y, flag[i].width, flag[i].height);\n }\n \n g.setColor(Color.white);\n for(int i = 0; i < flagLogo.length; i++){\n g.fillRect(flagLogo[i].x, flagLogo[i].y, flagLogo[i].width, flagLogo[i].height);\n }\n \n //g.setColor(Color.gray);\n // for(int i = 0; i < bombs.length; i++){\n // g.fillRect(bombs[i].x, bombs[i].y, bombs[i].width, bombs[i].height); \n //}\n \n \n // GAME DRAWING ENDS HERE\n }", "private void paintPath(Graphics graphics) { \n graphics.setColor(Color.blue);\n //si no se encuentra un camino, mostrar error\n if(Path == null){\n JOptionPane.showMessageDialog(null, \"No se encontro camino.\");\n }\n else\n for (Node n : Path) {\n if (!this.Graph.getGoals().contains(n) && n != this.Graph.getInitial()) {\n int x = n.getX(); int y = n.getY();\n paintRectangle(graphics, x, y); \n }\n }\n }", "public void Draw(Graphics g)\r\n {\r\n ///Se parcurge matricea de dale (codurile aferente) si se deseneaza harta respectiva\r\n g.drawImage(mapBackground, 0, 0, mapBackground.getWidth(), mapBackground.getHeight(), null);\r\n\r\n for(CollisionItem collisionItem : list_star){\r\n collisionItem.Draw(g);\r\n }\r\n\r\n for(CollisionItem collisionItem : list_star_blue){\r\n collisionItem.Draw(g);\r\n }\r\n\r\n for(CollisionItem collisionItem : list_fire){\r\n collisionItem.Draw(g);\r\n }\r\n\r\n\r\n for(CollisionItem collisionItem : list_static_element){\r\n collisionItem.Draw(g);\r\n }\r\n\r\n for(CollisionItem collisionItem :list_next_level){\r\n collisionItem.Draw(g);\r\n }\r\n\r\n }", "public abstract boolean hit(Rectangle2D r);", "public Boolean isObstacleDetected(final int id)\n {\n return finchController.isObstacleDetected(id);\n }", "@Test\n public void isONGroundTestTrue(){\n TileMap tileMap = new TileMap(24, 24, new byte[][]{{0,0}},new byte[][]{{1,1},{1,1},{1,1},{1,1}}, tilepath);\n Rect cBox = new Rect(2,2,24,22);\n assertEquals(true, tileMap.isOnGround(cBox));\n }", "private void drawGame(){\n drawBackGroundImage();\n drawWalls();\n drawPowerups();\n drawBullet();\n }", "private void draw(){\n GraphicsContext gc = canvasArea.getGraphicsContext2D();\n canvasDrawer.drawBoard(canvasArea, board, gc, currentCellColor, currentBackgroundColor, gridToggle);\n }", "protected BufferedImage drawBoard(BufferedImage img) {\n myGame.initTiles();\n Graphics2D g2d = img.createGraphics();\n \n //player one\n g2d.setColor(Color.RED);\n int posx1 = myGame.posX(myGame.playerPos(1));\n int posy1 = myGame.posY(myGame.playerPos(1));\n g2d.fill(new Rectangle(posx1, posy1, 20, 20));\n \n //player two\n g2d.setColor(Color.BLUE);\n int posx2 = myGame.posX(myGame.playerPos(2)) + 20;\n int posy2 = myGame.posY(myGame.playerPos(2)) + 20;\n g2d.fill(new Rectangle(posx2, posy2, 20, 20));\n \n g2d.dispose();\n return img;\n }", "public final boolean checkForDraw() {\r\n boolean result = false;\r\n String player = \"\";\r\n \r\n for (Rail rail : rails) {\r\n if (rail.isWinner()) {\r\n return false;\r\n }\r\n }\r\n \r\n if (tilesPlayed == 9) {\r\n draws++;\r\n // window.getStatusMsg().setText(DRAW_MSG); \r\n result = true;\r\n }\r\n \r\n return result;\r\n }", "public void polygone (Graphics g){\n\t}", "public ObstacleSprite(int left, int top, int right, int bottom, OBSTACLE_SPEED obstacleSpeed, Game game)\n {\n super(left, top, right, bottom, game);\n speed = (int) Math.round(DEFAULT_OBSTACLE_SPEED * (obstacleSpeed.value / 2.0));\n wasTouched = false;\n\n if(obstacleSpriteImage == null)\n {\n Bitmap settingsBitmap = BitmapFactory.decodeResource(resources, R.drawable.missile);\n obstacleSpriteImage = new AndroidImage(settingsBitmap, AndroidGraphics.ImageFormat.ARGB4444);\n }\n\n if(obstacleExplosionImage == null)\n {\n Bitmap settingsBitmap = BitmapFactory.decodeResource(resources, R.drawable.explosion);\n obstacleExplosionImage = new AndroidImage(settingsBitmap, AndroidGraphics.ImageFormat.ARGB4444);\n }\n }", "public void startGame() {\n\t\t\n\t\tmyCanvas.setVisible(true);\n\n\t\t// draw the ground\n\t\tmyCanvas.drawLine(50, GROUNDLINE, 550, GROUNDLINE);\n\n\t\t// B�lle erzeugen\n\t\tvar r = new Random();\n\t\t// Aufgabe 6: ein Ball ist nicht genug, oder?\n\t\t// Erweitern Sie die Erzeugung mit Random Zahlen und generieren Sie B�lle in einer Schleife\n\t\tfor(var i = 0; i < 5; ++i) {\n\t\t\tballs.add( new BouncingBall(20 + r.nextInt(80), 100, 20 + r.nextInt(60), new Color(r.nextInt(200)+56,r.nextInt(256),r.nextInt(256)), GROUNDLINE, myCanvas) );\n\t\t}\n\t\t\n\t\t\t\t\t\t\n\t\t// draw every ball in the list\n\t\tfor (BouncingBall ball : balls) {\n\t\t\tball.draw();\n\t\t}\t\t\n\t\t\n\t\t// make them bounce\n\t\tvar finished = false;\n\t\twhile (!finished) {\n\t\t\tmyCanvas.wait(50); // small delay\n\t\t\t\n\t\t\t// move every ball in the list\n\t\t\tfor (BouncingBall ball : balls) {\n\t\t\t\tball.move();\n\t\t\t}\t\t\n\t\t\t\n\t\t\t// stop if a ball has travelled a certain distance on x axis\n\t\t\tfor (BouncingBall ball : balls) {\t\t\t\t\n\t\t\t\tif (ball.getXPosition() >= 550) {\n\t\t\t\t\tfinished = true;\n\t\t\t\t\t// Aufgabe 5: Gameover\n\t\t\t\t\t// ...\n\t\t\t\t\tvar image = new ImageIcon(\"src/app/images/gameover.jpg\").getImage();\n\t\t\t\t\tmyCanvas.drawImage(image, 340, 240);\n\t\t\t\t}\n\t\t\t}\t\t\n\t\t\t\n\t\t\t// Aufgabe 3: Alle B�lle getroffen?\n\t\t\tif (balls.size()==0) {\n\t\t\t\tfinished = true;\n\t\t\t\tvar image = new ImageIcon(\"src/app/images/gewonnen.jpg\").getImage();\n\t\t\t\tmyCanvas.drawImage(image, 340, 240);\n\t\t\t\t// Bild ausgeben, Gewonnen\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\t// erase every ball from the canvas\n\t\tfor (var ball : balls) {\n\t\t\tball.erase();\n\t\t}\t\t\n\t}", "void draw(Graphics g)\n {\n int aliveCount = 0, deadCount = 0;\n\n boolean[][] gridArray = grid.getGrid();\n for(int row = 0; row < gridArray.length; row++){\n for(int col = 0; col < gridArray[row].length; col++){\n if(gridArray[row][col]){\n if(grid.isInverted()) {\n g.setColor(Color.white);\n } else {\n g.setColor(Color.black);\n }\n aliveCount++;\n } else {\n if(grid.isInverted()) {\n g.setColor(Color.black);\n } else {\n g.setColor(Color.white);\n }\n deadCount++;\n }\n g.fillRect(col * (grid.getCellSize() + grid.getCellInnerGap()) + grid.getCellOuterGap() , row * (grid.getCellSize() + grid.getCellInnerGap()) + grid.getCellOuterGap(), grid.getCellSize(), grid.getCellSize());\n }\n }\n\n UserInterface.infoLabel.setText(\"<html><center>Generation: \" + grid.getGeneration() + \"</center>Alive: \" + aliveCount + \" ; Dead: \" + deadCount + \"</html>\");\n }", "boolean testDrawShip(Tester t) {\n return t.checkExpect(ship3.draw(), new CircleImage(10, OutlineMode.SOLID, Color.CYAN))\n && t.checkExpect(ship1.draw(), new CircleImage(10, OutlineMode.SOLID, Color.CYAN));\n }" ]
[ "0.68571174", "0.670964", "0.6704004", "0.6563452", "0.6550401", "0.6353997", "0.6352511", "0.63402575", "0.6318694", "0.6220697", "0.6212439", "0.61992645", "0.619027", "0.61693597", "0.6167369", "0.61605895", "0.61225724", "0.61056197", "0.6085746", "0.60483754", "0.60437566", "0.6035423", "0.60348356", "0.5993019", "0.59911513", "0.59621495", "0.5956168", "0.5945807", "0.5936013", "0.5932247", "0.5925465", "0.59254193", "0.59148526", "0.5892959", "0.5879015", "0.58718204", "0.5871479", "0.5868598", "0.585678", "0.58502674", "0.58397776", "0.5834266", "0.58220196", "0.5818562", "0.58154744", "0.58093786", "0.5808791", "0.5807221", "0.5804076", "0.57866615", "0.57800317", "0.57780993", "0.57777977", "0.5774133", "0.5768713", "0.5767692", "0.57622916", "0.57593125", "0.5758494", "0.57555735", "0.5752706", "0.575198", "0.5743343", "0.5737551", "0.5735867", "0.5735762", "0.5735679", "0.5731454", "0.57305473", "0.5715542", "0.57150376", "0.5696685", "0.56962466", "0.56926525", "0.56926143", "0.5684042", "0.5681778", "0.5679667", "0.56787884", "0.5677699", "0.5675681", "0.56736845", "0.5672714", "0.56683487", "0.56662184", "0.56643313", "0.56566083", "0.56559986", "0.56476736", "0.56460905", "0.56442213", "0.5640293", "0.56363153", "0.5634149", "0.5634092", "0.5631578", "0.56265527", "0.56242806", "0.56191003", "0.56090945", "0.5609094" ]
0.0
-1
The LocalDate represents a date in ISO format (yyyyMMdd) without time.
public static void main(String[] args) { LocalDate localDate = LocalDate.now(); System.out.println("LocalDate: " + localDate); System.out.println(LocalDate.of(2019, 04, 16)); System.out.println(LocalDate.parse("2019-04-16")); //////////////////////////////////////////////////////// LocalDate tomorrow = LocalDate.now().plusDays(1); System.out.println("LocalDate +1 day : " + tomorrow); //////////////////////////////////////////////////////// LocalDate previousMonthSameDay = LocalDate.now().minus(1, ChronoUnit.MONTHS); System.out.println("Previous month, same day: " + previousMonthSameDay); //////////////////////////////////////////////////////// DayOfWeek sunday = LocalDate.parse("2019-04-18").getDayOfWeek(); System.out.println("Which day was at 2019-04-18 ? " + sunday); int twelve = LocalDate.parse("2019-04-18").getDayOfMonth(); System.out.println("Which day was at 2016-06-12 ? " + twelve); ///////////////////////////////////////////////////////// boolean leapYear = LocalDate.now().isLeapYear(); System.out.println("Is leap year? " + leapYear); ///////////////////////////////////////////////////////// boolean notBefore = LocalDate.parse("2016-06-12").isBefore(LocalDate.parse("2016-06-11")); System.out.println("Not before: " + notBefore); boolean isAfter = LocalDate.parse("2016-06-12").isAfter(LocalDate.parse("2016-06-11")); System.out.println("Is after: " + isAfter); //////////////////////////////////////////////////////// LocalDate firstDayOfTheMonth = LocalDate.parse("2016-06-12").with(TemporalAdjusters.firstDayOfMonth()); System.out.println("First day of 2016.06: " + firstDayOfTheMonth); LocalDate nextMonday = LocalDate.parse("2016-06-12").with(TemporalAdjusters.next(DayOfWeek.MONDAY)); System.out.println("Next monday: " + nextMonday); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "LocalDate getDate();", "Date date(LocalDate date);", "public LocalDate getDate() {\n return date;\n }", "@Override\n public LocalDate getDate() {\n return null;\n }", "public LocalDate getDate() {\n return date;\n }", "public LocalDate getDate() {\n return date;\n }", "protected LocalDate asLocalDate(JsonNode jsonNode) {\n Assertion.isNotNull(jsonNode, \"jsonNode is required\");\n return LocalDate.parse(jsonNode.asText(), DateTimeFormatter.ISO_DATE);\n }", "@RequiresApi(api = Build.VERSION_CODES.O)\n public static LocalDate getLocalDate() {\n return LocalDate.now();\n }", "private LocalDate nowLocalDate() {\n\t\tInstant instantNow = Instant.ofEpochMilli( System.currentTimeMillis() );\n\t\tLocalDate nowLocalDate = instantNow.atOffset(ZoneOffset.UTC).toLocalDate();\n\t\treturn nowLocalDate;\n\t}", "private LocalDate createDate(String date) {\n LocalDate localDate = LocalDate.parse(date);\n\n return localDate;\n }", "public void setDate(LocalDate date) {\n this.date = date;\n }", "public static LocalDate convertStringToDate(String date) {\n\t\treturn LocalDate.parse(date, DateTimeFormatter.ISO_LOCAL_DATE);\n\t}", "public LocalDate getStartDate() { return this.startDate; }", "public LocalDate getViewDate();", "public LocalDate getDate() {\n\t\treturn this.date;\n\t}", "public final java.util.Date getLocalDate()\n {\n return ordinal == NULL_ORDINAL ? null : new java.util.Date(getLocalTimeStamp());\n }", "public void setDate(LocalDate date) {\n\t\tthis.date = date;\n\t}", "public LocalDate getStart_date(){\n return this.start_date;\n }", "@Override\r\n\tpublic LocalDate toGraphProperty(Date value) {\n\t\treturn LocalDate.from(value.toInstant());\r\n\t}", "public LocalDate getNascimento() {\r\n\t\treturn nascimento;\r\n\t}", "public LocalDate getFecha() {\n\t\treturn fecha;\n\t}", "public LocalDate getDtNascimento() {\n\t\treturn dtNascimento;\n\t}", "public LocalDateAdapter() {\r\n\t\tsuper();\r\n\t}", "public LocalDate getDate () {\n\t\treturn DateUtils.toLocalDate(this.start);\n\t}", "LocalDate getDateOfBirth();", "protected LocalDate toLocalDate(Object obj) {\n return DfTypeUtil.toLocalDate(obj, getDBFluteSystemFinalTimeZone());\n }", "public static LocalDate DateToLocalDate (Date data){\r\n\t\tif (data == null) return null;\r\n\t\t\r\n\t\tString[] splitter = data.toString().split(\" \");\r\n\t\t\r\n\t\treturn LocalDate.of(\r\n\t\t\t\tInteger.parseInt(splitter[5]), \r\n\t\t\t\tmonthStringToInteger(splitter[1]), \r\n\t\t\t\tInteger.parseInt(splitter[2])\r\n\t\t\t\t);\r\n\t}", "public LocalDate getOpenDate(){\n\t\treturn openDate;\n\t}", "public static LocalDate DateToLocalDate(Date date) {\n\t\tInstant instant = date.toInstant();\n\t\tZoneId zone = ZoneId.systemDefault();\n\t\tLocalDateTime localDateTime = LocalDateTime.ofInstant(instant, zone);\n\t\treturn localDateTime.toLocalDate();\n\t}", "@Override\n public LocalDate getReturnDate() {\n return returnDate;\n }", "public LocalDate getDato() {\n\t\treturn dato;\n\t}", "public LocalDate tradeDate() {\n\n\t\tif (tradeDate == null) {\n\n\t\t\tfinal DateOnlyValue dv = ProtoDateUtil.fromDecimalDateOnly(message.getBaseTradeDate());\n\n\t\t\ttradeDate = new LocalDate(dv.getYear(), dv.getMonth(), dv.getDay());\n\n\t\t}\n\n\t\treturn tradeDate;\n\n\t}", "static String getReadableDate(LocalDate date){\r\n\t\tString readableDate = null;\r\n\t\t//convert only if non-null\r\n\t\tif(null != date){\r\n\t\t\t//convert date to readable form\r\n\t\t\treadableDate = date.toString(\"MM/dd/yyyy\");\r\n\t\t}\r\n\t\t\r\n\t\treturn readableDate;\r\n\t}", "public static LocalDate formateDate(String dateString){\n\t\treturn LocalDate.parse(dateString, df);\n\t}", "public LocalDate GetFechaActual() throws RemoteException;", "public LocalDate getOrderDate() {\n return new LocalDate(this.orderDate.getMonth(), this.orderDate.getDay(), this.orderDate.getYear());\n\n }", "@Override\r\n\tpublic Date toEntityAttribute(LocalDate value) {\n\t\treturn Date.from(value.atStartOfDay(ZoneId.systemDefault()).toInstant());\r\n\t}", "@Test\n public void testSetLocalDateWithoutType() throws SQLException {\n LocalDate data = LocalDate.parse(\"1971-12-15\");\n java.sql.Date actual = insertThenReadWithoutType(data, \"date_column\", java.sql.Date.class);\n java.sql.Date expected = java.sql.Date.valueOf(\"1971-12-15\");\n assertEquals(expected, actual);\n }", "private DateTime goodLocalDateUse() {\n LocalDate ld = new LocalDate(2020, 6, 2);\n LocalTime now = LocalTime.now();\n return new DateTime(ld.getYear(), ld.getMonthOfYear(), ld.getDayOfYear(), now.getHourOfDay(),\n now.getMinuteOfHour(), now.getSecondOfMinute(), now.getMillisOfSecond(),\n DateTimeZone.forID(\"America/New_York\"))\n .toDateTime(DateTimeZone.forID(\"America/Los_Angeles\"));\n }", "public LocalDate GetFechaUltimoCambio() throws RemoteException;", "public static LocalDate convertDate(Date dateToConvert) {\n SimpleDateFormat format = new SimpleDateFormat(\"yyyy-MM-dd\");\n return LocalDate.parse(format.format(dateToConvert));\n }", "public static LocalDate randomLocalDate() {\n\t\tlong minDay = LocalDate.now().plusDays(1).toEpochDay();\n\t\tlong maxDay = LocalDate.now().plusMonths(1).toEpochDay();\n\t\tlong randomDay = ThreadLocalRandom.current().nextLong(minDay, maxDay);\n\t\treturn LocalDate.ofEpochDay(randomDay);\n\t}", "public LocalDate getDateDebut() {\n\t\treturn dateDebut;\n\n\t}", "protected void saveLocalDate() {\n\n }", "public String dateAsString(LocalDate localDate) {\n if (localDate == null) {\n return null;\n }\n return DateUtils.date(localDate);\n }", "public LocalDate Data(String data) {\n DateTimeFormatter formatodata = DateTimeFormatter.ofPattern(\"dd/MM/yyyy\");\n\n //crio o objeto localdate que formata a informação intoduzida para o formato que eu paremetrizei em formatodata\n LocalDate localDate = LocalDate.parse(data, formatodata);\n\n return localDate;\n }", "@ApiModelProperty(example = \"Fri Aug 08 01:00:00 BST 2008\", required = true, value = \"Date of the marriage\")\n @NotNull\n\n @Valid\n\n public LocalDate getDateOfMarriage() {\n return dateOfMarriage;\n }", "public LocalDate getGenDate() {\n\t\treturn genDate;\n\t}", "private LocalDate get_DATE(int column) {\n // DATE column is always 10 chars long\n String dateString = dataBuffer_.getCharSequence(columnDataPosition_[column - 1],\n 10, charset_[column - 1]).toString();\n return LocalDate.parse(dateString, DRDAConstants.DB2_DATE_FORMAT);\n// return DateTime.dateBytesToDate(dataBuffer_,\n// columnDataPosition_[column - 1],\n// cal,\n// charset_[column - 1]);\n }", "public LocalDate getDateOfPurchase() {\n return dateOfPurchase;\n }", "public static LocalDate parseToDate(String date) throws DateTimeParseException {\n return LocalDate.parse(date,FORMATTER);\n }", "public static String format(LocalDate date){\r\n\t\t\r\n\t\tif(date==null){\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\treturn DATE_FORMATTER.format(date);\r\n\t}", "@Override\n\tpublic Date convertToDatabaseColumn(LocalDate attribute) {\n\t\treturn Date.valueOf(attribute);\n\t}", "public final void setDate(LocalDate date) {\n dateProperty().set(date);\n }", "public LocalDate getDateOfCreation() {\n return this.dateOfCreation;\n }", "public LocalDate get_raw_due_date()\n {\n return task_due_date;\n }", "boolean isValidForDate(LocalDate date);", "public static LocalDate stringToLocalDate(String date) {\n String[] dateStrings = date.split(\"-\");\n int[] dateIntegers = new int[3];\n try {\n dateIntegers = Arrays.stream(dateStrings).mapToInt(Integer::parseInt).toArray();\n } catch (Exception e) {\n System.out.println(\"Got a problem converting the string date to LocalDate object !\");\n e.printStackTrace();\n }\n return LocalDate.of(dateIntegers[0], dateIntegers[1], dateIntegers[2]);\n }", "public LocalDate getLocalDateByString(String dateToConsider) {\n DateTimeFormatter formatter = DateTimeFormatter.ofPattern(\"yyyy-MM-dd\");\n formatter = formatter.withLocale(Locale.getDefault()); // Locale specifies human language for translating, and cultural norms for lowercase/uppercase and abbreviations and such. Example: Locale.US or Locale.CANADA_FRENCH\n LocalDate date = LocalDate.parse(dateToConsider, formatter);\n return date;\n }", "public void setDtNascimento(LocalDate dtNascimento) {\n\t\tthis.dtNascimento = dtNascimento;\n\t}", "void setDateOfBirth(LocalDate dateOfBirth);", "public static LocalDate formatDate(String value, int year) throws ParseException {\n\t\tif(!value.contains(\"/\"))\treturn null;\n\t\t\n\t\tString[] values = value.split(\"/\");\n\t\tString month = (values[0].length() == 1 ? \"0\" + values[0] : values[0]);\n\t\tString date = (values[1].length() == 1 ? \"0\" + values[1] : values[1]);\n\t\tString yearValue = null;\n\t\t// SOMETIMES THE YEAR THAT'S BEING PASSED BE NOT BE CORRECT.\n\t\t// EX: FOR CLOSING DATES: A MOVIE MAY HAVE RELEASED IN '08 BUT CLOSED IN '09. SO WE NEED TO ENSURE THAT\n\t\t// THE CLOSING DATE IS NOT '08.\n\t\tif(String.valueOf(year).substring(2).equals(values[2]))\n\t\t\tyearValue = String.valueOf(year);\n\t\telse\n\t\t\tyearValue = String.valueOf(year).substring(0,2) + values[2];\n\t\t\n\t\t//SimpleDateFormat sdf = new SimpleDateFormat(\"MM-dd-yyyy\");\n\t\t/*Calendar cal = Calendar.getInstance();\n\t\t\n\t\tcal.set(Calendar.YEAR, yearInValue);\n\t\tcal.set(Calendar.MONTH, month-1);\t// MONTHS ARE 0-INDEXED\n\t\tcal.set(Calendar.DATE, date);\n\t\t\n\t\tjava.sql.Date movieDate = new java.sql.Date(cal.getTimeInMillis());*/\n\t\t\n\t\tLocalDate localDate = null; \n\t\tif(yearValue != null) {\n\t\t\tlocalDate = LocalDate.parse(yearValue + \"-\" + month + \"-\" + date, DateTimeFormatter.ISO_LOCAL_DATE);\n\t\t}\n\t\t\n\t\treturn localDate;//sdf.format(movieDate);\n\t}", "@Test\n public void testSetLocalDateWithType() throws SQLException {\n LocalDate data = LocalDate.parse(\"1971-12-15\");\n java.sql.Date actual = insertThenReadWithType(data, Types.DATE, \"date_column\", java.sql.Date.class);\n java.sql.Date expected = java.sql.Date.valueOf(\"1971-12-15\");\n assertEquals(expected, actual);\n }", "public LocalDate getDateFin() {\n\t\treturn dateFin;\n\t}", "public void setDateOfBirth(LocalDate dateOfBirth) {\n this.dateOfBirth = dateOfBirth;\n }", "public static LocalDate convertToLocalDate(String dateFromDb) {\n return LocalDate.parse(dateFromDb, DATE_FORMATTER);\n }", "public LocalDate getDate() {\r\n\t\treturn loanDate;\r\n\t}", "@Override\n\tpublic LocalDate convertToEntityAttribute(Date dbData) {\n\t\treturn dbData.toLocalDate();\n\t}", "public LocalDate getEndDate() { return this.endDate; }", "public LocalDate ToLocalDate(Date dateToConvert) {\n\t return dateToConvert.toInstant()\n\t .atZone(ZoneId.systemDefault())\n\t .toLocalDate();\n\t}", "private DateTime goodLocalDateUse4() {\n LocalDate ld = new LocalDate(2020, 6, 2);\n return new DateTime().toDateTime(DateTimeZone.forID(\"America/New_York\"))\n .withDate(ld)\n .toDateTime(DateTimeZone.forID(\"America/Los_Angeles\"));\n }", "private Date convertLocalDateToDate(LocalDateTime localDate) {\n return Date.from(localDate.atZone(ZoneId.systemDefault()).toInstant());\n }", "public static void main(String[] args) {\n\t\t\n\t\tLocalDate date = LocalDate.now();\n\t\t\n\t\tSystem.out.println(\"date: \" + date);\n\t\tSystem.out.println(\"DateTimeFormatter.ISO_DATE: \" + date.format(DateTimeFormatter.ISO_DATE));\n\t\t\n\t\tLocalDateTime datetime = LocalDateTime.now();\n\t\t\t\t\n\t\tSystem.out.println(\"datetime: \" + datetime);\n\t\tSystem.out.println(\"DateTimeFormatter.ISO_DATE_TIME: \" + datetime.format(DateTimeFormatter.ISO_DATE_TIME));\n\t\t\n\t\ttry {\n\t\t\tString strDateTime = date.format(DateTimeFormatter.ISO_DATE_TIME); \n\t\t\tSystem.out.println(\"strDateTime: \" + strDateTime);\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\ttry {\n\t\t\tString strDate = datetime.format(DateTimeFormatter.ISO_DATE); \n\t\t\tSystem.out.println(\"strDate: \" + strDate);\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\ttry {\n\t\t\tLocalDate date1 = LocalDate.parse(\"2020-01-31T12:30:59\", DateTimeFormatter.ISO_DATE_TIME); \n\t\t\tSystem.out.println(\"strDate: \" + date1);\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}", "@Override\n public void setReturnDate(LocalDate date) {\n this.returnDate = date;\n }", "public LocalDate getEnd_date(){\n return this.end_date;\n }", "public LocalDate getDataArrivo() {\n\t\treturn dataArrivo;\n\t}", "java.lang.String getDate();", "public LocalDate getDateOfBirth() {\n\t\treturn dateofbirth;\n\t}", "public static void main(String[] args) {\n\t\tLocalDate date = LocalDate.of(2018, 2, 9);\n\t\tint year = date.getYear();\n\t\tMonth month = date.getMonth();\n\t\tint day = date.getDayOfMonth();\n\t\tDayOfWeek dow = date.getDayOfWeek();\n\t\tint len = date.lengthOfMonth();\n\t\tboolean leap = date.isLeapYear();\n\n\t\tSystem.out.println(\"date = \" + date);\n\t\tSystem.out.println(\"year = \" + year);\n\t\tSystem.out.println(\"month = \" + month);\n\t\tSystem.out.println(\"day = \" + day);\n\t\tSystem.out.println(\"dow = \" + dow);\n\t\tSystem.out.println(\"len = \" + len);\n\t\tSystem.out.println(\"leap = \" + leap);\n\n\t\t/*\n\t\t * To obtains the current date from the system clock using the now\n\t\t * factory method:\n\t\t */\n\t\tLocalDate today = LocalDate.now();\n\t\tSystem.out.println(\"today = \" + today);\n\n\t\t/*\n\t\t * Reading LocalDate values using a TemporalField\n\t\t */\n\t\tint year1 = today.get(ChronoField.YEAR);\n\t\tint month1 = today.get(ChronoField.MONTH_OF_YEAR);\n\t\tint day1 = today.get(ChronoField.DAY_OF_MONTH);\n\t\tSystem.out.println(\"year1 = \" + year1);\n\t\tSystem.out.println(\"month1 = \" + month1);\n\t\tSystem.out.println(\"day1 = \" + day1);\n\n\t\t/*\n\t\t * LocalDate can be created by parsing a String representing\n\t\t */\n\t\tLocalDate anotherDate = LocalDate.parse(\"2014-03-18\");\n\t\tSystem.out.println(\"anotherDate = \" + anotherDate);\n\t}", "@TargetApi(Build.VERSION_CODES.O)\n public LocalDate getTodayDate() {\n LocalDate date;\n date = LocalDate.now();\n return date;\n }", "public Observable<LocalDate> getNullAsync() {\n return getNullWithServiceResponseAsync().map(new Func1<ServiceResponse<LocalDate>, LocalDate>() {\n @Override\n public LocalDate call(ServiceResponse<LocalDate> response) {\n return response.body();\n }\n });\n }", "private static LocalDate parseLocalDate(final String input) {\n if (input.contains(\"--\") || input.contains(\"*\")) {\n return null;\n }\n return LocalDate.parse(input);\n\n }", "public LocalDate getDate(String key) {\n if (!jsonData.has(key))\n return null;\n try {\n String date = jsonData.getString(key);\n return LocalDate.parse(date, AppConst.DATE_FORMATTER);\n } catch (Exception ex) {\n return null;\n }\n }", "@FXML\r\n\tString getDate() {\r\n\t\t\tLocalDate creditCardExpiryDate = dpCreditCardExpiryDate.getValue();\r\n\t\t\tDateTimeFormatter formattedExpiryDate = DateTimeFormatter.ofPattern(\"yyyy-MM-dd\");\r\n\t\t\treturn formattedExpiryDate.format(creditCardExpiryDate);\r\n\t}", "public static LocalDate toLocalDate(Timestamp timestamp) {\n\t\tif (timestamp != null) {\n\t\t\treturn timestamp.toLocalDateTime().toLocalDate();\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t}", "private DateTime goodLocalDateUse2() {\n LocalDate ld = new LocalDate(2020, 6, 2);\n LocalTime now = LocalTime.now();\n return new DateTime(ld.getYear(), ld.getMonthOfYear(), ld.getDayOfYear(), now.getHourOfDay(),\n now.getMinuteOfHour(), now.getSecondOfMinute(), now.getMillisOfSecond(),\n DateTimeZone.getDefault())\n .toDateTime(DateTimeZone.forID(\"America/Los_Angeles\"));\n }", "public void setFecha(LocalDate fecha) {\n\t\tthis.fecha = fecha;\n\t}", "public void setOpenDate(LocalDate date){\n\t\topenDate = date;\n\t}", "private static LocalDate readDate() throws Exception {\n\t\treturn LocalDate.parse(In.readLine(), dateFormatter);\n\t}", "LocalDate getCheckInDate();", "public LocalDate getArrears() {\n return arrears;\n }", "public Observable<LocalDate> getOverflowDateAsync() {\n return getOverflowDateWithServiceResponseAsync().map(new Func1<ServiceResponse<LocalDate>, LocalDate>() {\n @Override\n public LocalDate call(ServiceResponse<LocalDate> response) {\n return response.body();\n }\n });\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 m3() {\n\t\t\r\n\t\tLocalDate dob = LocalDate.parse(\"1991::09::17\",DateTimeFormatter.BASIC_ISO_DATE);\r\n\tSystem.out.println(dob);\r\n\t}", "private Date toDate(LocalDate randomDate) {\n Date d = Date.from(randomDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant());\n return d;\n }", "private String stringifyDate(Date date){\n\t\tDateFormat dateFormatter = new SimpleDateFormat(\"yyyy-MM-dd\");\t\t\n\t\treturn dateFormatter.format(date);\n\t}", "public static LocalDate stringToDate(String inputStringDate) {\n\t\treturn LocalDate.parse(inputStringDate);\n\t}", "public static LocalDate parseDate(String dateString)\n throws DateTimeParseException {\n\n // this parses '2011-12-03', timezone information ignored\n return LocalDate.parse(dateString, DateTimeFormatter.ISO_LOCAL_DATE);\n }", "public Observable<LocalDate> getInvalidDateAsync() {\n return getInvalidDateWithServiceResponseAsync().map(new Func1<ServiceResponse<LocalDate>, LocalDate>() {\n @Override\n public LocalDate call(ServiceResponse<LocalDate> response) {\n return response.body();\n }\n });\n }", "public static void main(String[] args) {\n\n LocalDate date = LocalDate.now();\n System.out.println(\"print date- \"+date);\n // print day \n DayOfWeek dow = date.getDayOfWeek();\n System.out.println(\"print day name - \"+ dow);\n int dateNo = date.getDayOfMonth();\n System.out.println(\"print day (number) - \"+ dateNo);\n // print month \n Month monthName = date.getMonth();\n System.out.println(\"print month name - \"+ monthName);\n int monthNo = date.getMonthValue();\n System.out.println(\"print month (Number) - \"+ monthNo);\n // print month \n int year = date.getYear();\n System.out.println(\"print year - \"+ year);\n // print particuller date like birth day\n LocalDate birthDay = LocalDate.of(1990, Month.NOVEMBER, 20);\n System.out.println(\"print particuller date - \"+birthDay);\n }", "public static LocalDate frenchDateOf(String dateString) {\n int year = Integer.parseInt(dateString.substring(6, 10));\n int month = Integer.parseInt(dateString.substring(3, 5));\n int day = Integer.parseInt(dateString.substring(0, 2));\n LocalDate date = LocalDate.of(year, month, day);\n return date;\n }" ]
[ "0.73936325", "0.71881515", "0.67838955", "0.6727861", "0.6691928", "0.6691928", "0.6549875", "0.6479021", "0.6359533", "0.62193185", "0.6185043", "0.6180954", "0.6170521", "0.6147574", "0.6138134", "0.60839957", "0.6068309", "0.6066844", "0.6002054", "0.59912103", "0.59747446", "0.597404", "0.5960157", "0.59194016", "0.5862796", "0.58550376", "0.5849672", "0.5834152", "0.58034474", "0.5797446", "0.57785535", "0.5758451", "0.5712011", "0.5696151", "0.5689802", "0.56798816", "0.5659544", "0.5650865", "0.5645868", "0.5644548", "0.56148165", "0.56079143", "0.55874115", "0.5542544", "0.55170304", "0.5482366", "0.5479755", "0.54794174", "0.5472994", "0.54662824", "0.54545087", "0.5453032", "0.54037136", "0.5401125", "0.53972644", "0.5385017", "0.5367866", "0.5348592", "0.5327495", "0.53196436", "0.5316311", "0.531134", "0.52887785", "0.5285163", "0.52830774", "0.52787125", "0.5262103", "0.52477676", "0.52309257", "0.5226363", "0.5219909", "0.52158374", "0.5215218", "0.519179", "0.51895", "0.5180448", "0.5171223", "0.51710576", "0.5161434", "0.5156589", "0.5153342", "0.5150666", "0.5131332", "0.513005", "0.5128529", "0.5125081", "0.5120532", "0.5110038", "0.50796354", "0.5078338", "0.5073027", "0.50700265", "0.5067881", "0.50654656", "0.5063777", "0.50626767", "0.5062449", "0.5059574", "0.5051536", "0.5043071", "0.5014917" ]
0.0
-1
TODO Autogenerated method stub
public static void main(String[] args) { Thread t = new Thread(new MyRunnable1());// 新建状态 t.start();// 就绪状态 try { t.sleep(5000); } catch (Exception e) { e.printStackTrace(); } new MyRunnable1().setStop();// 线程停止 }
{ "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
creating a parameterized constructor
Student4(int i, String n) { id = i; name = n; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Constructor<T> newConstructor();", "DefaultConstructor(int a){}", "HxMethod createConstructor(final String... parameterTypes);", "defaultConstructor(){}", "public Generic(){\n\t\tthis(null);\n\t}", "T newInstance(Object... args);", "public ParameterizedInstantiateFactory() {\r\n super();\r\n }", "public Constructor(){\n\t\t\n\t}", "ConstuctorOverloading(){\n\t\tSystem.out.println(\"I am non=argument constructor\");\n\t}", "void DefaultConstructor(){}", "protected abstract void construct();", "HxMethod createConstructor(final HxType... parameterTypes);", "public static NewExpression new_(Constructor constructor) { throw Extensions.todo(); }", "ConstuctorOverloading(int num){\n\t\tSystem.out.println(\"I am contructor with 1 parameter\");\n\t}", "Reproducible newInstance();", "private Instantiation(){}", "public Parameters() {\n\t}", "private InstantiateTransformer(Class[] paramTypes, Object[] args) {\n super();\n if (((paramTypes == null) && (args != null))\n || ((paramTypes != null) && (args == null))\n || ((paramTypes != null) && (args != null) && (paramTypes.length != args.length))) {\n throw new IllegalArgumentException(\"InstantiateTransformer: The parameter types must match the arguments\");\n }\n if ((paramTypes == null) && (args == null)) {\n iParamTypes = null;\n iArgs = null;\n } else {\n iParamTypes = (Class[]) paramTypes.clone();\n iArgs = (Object[]) args.clone();\n }\n }", "private void __sep__Constructors__() {}", "@NotNull\n protected Supplier<AbstractReadablePacket> createConstructor() {\n final Constructor<AbstractReadablePacket> constructor = requireNonNull(ClassUtils.getConstructor(getClass()));\n return () -> ClassUtils.newInstance(constructor);\n }", "public tn(String paramString, ho paramho)\r\n/* 12: */ {\r\n/* 13:11 */ super(paramString, paramho);\r\n/* 14: */ }", "public T newInstance();", "default HxMethod createConstructor(final Class<?>... parameterTypes) {\n return createConstructor(getHaxxor().toNormalizedClassnames(parameterTypes));\n }", "public Parameter(Parameter template){\n\t\tthis(template.getName(),template.isRequired(),\n\t\t\t template.getType(),(T) template.getDefaultValue());\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "public CacheFIFO(int paramInt)\r\n/* 11: */ {\r\n/* 12: 84 */ super(paramInt);\r\n/* 13: */ }", "public Object[] getConstructorArgs ();", "public Identity()\n {\n super( Fields.ARGS );\n }", "TypesOfConstructor(int value){\n num = value;\n }", "public Scriptable construct(Context cx, Scriptable scope, Object[] args);", "public abstract String construct();", "public ProductoCreable newInstance(int codigo, String nombre){\r\n \r\n }", "public static String generateConstructor(String className, String parameterValue) {\n\t\tif (className.equals(\"Integer\")) {\n\t\t\tif (parameterValue == null)\n\t\t\t\treturn \"Integer(0)\";\n\t\t\treturn \"Integer(\"+parameterValue+\")\";\n\t\t}\n\t\tif (className.equals(\"Double\")) {\n\t\t\tif (parameterValue == null)\n\t\t\t\treturn \"Double(0)\";\n\t\t\treturn \"Double(\"+parameterValue+\")\";\n\t\t}\n\t\tif (className.equals(\"Float\")) {\n\t\t\tif (parameterValue == null)\n\t\t\t\treturn \"Float(0)\";\n\t\t\treturn \"Float(\"+parameterValue+\")\";\n\t\t}\n\t\tif (className.equals(\"Short\")) {\n\t\t\tif (parameterValue == null)\n\t\t\t\treturn \"Short((short) 0)\";\n\t\t\treturn \"Short(\"+parameterValue+\")\";\n\t\t}\n\t\tif (parameterValue == null)\n\t\t\treturn className+\"()\";\n\t\treturn className+\"(\"+parameterValue+\")\";\n\t}", "public a(IntegerLiteralTypeConstructor integerLiteralTypeConstructor) {\n super(0);\n this.a = integerLiteralTypeConstructor;\n }", "public BaseParameters(){\r\n\t}", "public Factory(Class<? extends K> class1, Object... params) {\n\t\ttry {\n\t\t\tthis.params = params;\n\t\t\tif (params != null && params.length > 0) {\n\t\t\t\tClass<?>[] clazzes = new Class<?>[params.length];\n\t\t\t\tint i = 0;\n\t\t\t\tfor (Object param : params) {\n\t\t\t\t\tclazzes[i++] = param.getClass();\n\t\t\t\t}\n\t\t\t\tconstructor = class1.getConstructor(clazzes);\n\t\t\t} else {\n\t\t\t\tconstructor = class1.getConstructor();\n\t\t\t}\n\t\t} catch (Throwable e) {\n\t\t\tlog.error(\"Error initializing factory\", e);\n\t\t\tthrow new Error(\"Internal error initializing factory\", e);\n\t\t}\n\t}", "public static NewExpression new_(Constructor constructor, Iterable<Expression> expressions) { throw Extensions.todo(); }", "public abstract DataType<T> newInstance();", "private Builder(Class<T> clazz, Object... objects) {\n try {\n Stream<Constructor<?>> constructors = Stream.of(clazz.getDeclaredConstructors()).peek(constructor -> constructor.setAccessible(true));\n Optional<Constructor<?>> constructor;\n if (null == objects) {\n constructor = constructors.filter(cons -> cons.getParameterCount() == 0).findFirst();\n if (constructor.isPresent()) {\n instance = clazz.cast(constructor.get().newInstance());\n }\n } else {\n constructor = constructors.filter(cons -> cons.getParameterCount() == objects.length)\n .filter(cons -> {\n List<Class<?>> consClass = Arrays.asList(cons.getParameterTypes());\n List<Class<?>> paramsClass = Arrays.stream(objects).map(Object::getClass).collect(Collectors.toList());\n return consClass.stream()\n .allMatch(con -> paramsClass.stream()\n .anyMatch(param -> (con.isPrimitive() &&\n (Number.class.isAssignableFrom(param) ||\n Boolean.class.isAssignableFrom(param) ||\n Character.class.isAssignableFrom(param) ||\n Byte.class.isAssignableFrom(param))) ||\n param.equals(con) ||\n param.isAssignableFrom(con) ||\n con.isAssignableFrom(param)));\n })\n .findFirst();\n if (constructor.isPresent()) {\n instance = clazz.cast(constructor.get().newInstance(objects));\n }\n }\n } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {\n e.printStackTrace();\n }\n }", "@SuppressWarnings(\"unchecked\")\n public T newInstance()\n throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {\n if (constructor_ == null) {\n constructor_ = getRawClass().getConstructor();\n }\n\n return (T)constructor_.newInstance();\n }", "public MockClass(String arg) {\n\t}", "public Card() { this(12, 3); }", "@Test\n\tpublic void testParameterizedConstructor() {\n\t\tQuestionsEntity questions=new QuestionsEntity(1,\"SOX\",\"Have all changes has been approved\",\"Yes\");\n\t assertEquals(\"Yes\",questions.getResponse());\n\t}", "public Object createNew(String typename, Object... args) \n\t\tthrows \tIllegalAccessException, \n\t\t\tInstantiationException, \n\t\t\tClassNotFoundException,\n\t\t\tNoSuchMethodException,\n\t\t\tInvocationTargetException \n\t{\n\t\tswitch(args.length) \n\t\t{\n\t\tcase 1 : return Class.forName(typename).getConstructor(args[0].getClass()).newInstance(args[0]);\n\t\tcase 2 : return Class.forName(typename).getConstructor(args[0].getClass(), args[1].getClass()).\n\t\t\tnewInstance(args[0], args[1]);\n\t\t}\n\t\treturn null;\n\t}", "private Parameter(int key, String name, String value){\n this.key = key;\n this.name = name;\n this.value = value;\n }", "Parameter createParameter();", "public Vector() {\n construct();\n }", "public ParameterizedInstantiateFactory(Class<? extends T> classToInstantiate) {\r\n super();\r\n this.classToInstantiate = classToInstantiate;\r\n }", "private static Constructor getZeroArgumentConstructor(Class cls) {\n \t\treturn ClassUtils.getConstructor(cls, new Class[] { }, zeroArgumentConstructors);\n \t}", "public GenericDynamicArray() {this(11);}", "private Constructor getConstructor() throws Exception {\r\n return type.getConstructor(Contact.class, label, Format.class);\r\n }", "T create(R argument);", "public Employee()\n\t{\n\t\tthis(\"(2)Invoke Employee's overload constructor\");\n\t\tSystem.out.println(\"(3)Employee's no-arg constructor is invoked\");\n\t}", "public GenericContainer(T t){\n obj = t;\n }", "public static NewExpression new_(Constructor constructor, Iterable<Expression> expressions, Iterable<Member> members) { throw Extensions.todo(); }", "T create();", "T create();", "public Field(){\n\n // this(\"\",\"\",\"\",\"\",\"\");\n }", "public Complex(){\r\n\t this(0,0);\r\n\t}", "public Account() {\n this(0, 0.0, \"Unknown name\"); // Invole the 2-param constructor\n }", "private Params()\n {\n }", "private void addConstructors() {\n\t\tthis.rootBindingClass.getConstructor().body.line(\"super({}.class);\\n\", this.name.getTypeWithoutGenerics());\n\t\tGMethod constructor = this.rootBindingClass.getConstructor(this.name.get() + \" value\");\n\t\tconstructor.body.line(\"super({}.class);\", this.name.getTypeWithoutGenerics());\n\t\tconstructor.body.line(\"this.set(value);\");\n\t}", "@Override\n public Object construct(Object... args) {\n CharSequence stringData = (args.length > 0 ? ToString(realm(), args[0]) : \"\");\n ExoticString obj = new ExoticString(realm(), stringData);\n obj.setPrototype(realm().getIntrinsic(Intrinsics.StringPrototype));\n return obj;\n }", "public abstract DataType<T> newInstance(String format);", "public FactoryValue( ) \r\n {\r\n }", "public GenericElement() {\n\t}", "public Complex(int r, int i){\r\n\t this((double) r, (double) i);\r\n\t\t//chain the input from this constructor to the next constructor,\r\n\t\t// which has a (double, double) signature\r\n\t}", "public MyGeneric(A a, B b) { // TODO: check parameter type\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t}", "TypesOfConstructor(){\n System.out.println(\"This is default constructor\");\n }", "protected ForConstructor(Constructor<?> constructor) {\n this.constructor = constructor;\n }", "public static void copyConstructor(){\n\t}", "@SuppressWarnings(\"java:S1452\")\n public Constructor<? extends T> getConstructor(Class<?>... args) {\n return getConstructor(getProxyClass(), args);\n }", "Constructor(int i,String n ,int x){ //taking three parameters which shows that it is constructor overloaded\r\n\t\t id = i; \r\n\t\t name = n; \r\n\t\t marks =x; \r\n\t\t }", "public Command create(Object... param);", "public Node(){\n this(9);\n }", "private Sequence() {\n this(\"<Sequence>\", null, null);\n }", "@Override\r\n\tpublic CMObject newInstance()\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\treturn this.getClass().getDeclaredConstructor().newInstance();\r\n\t\t}\r\n\t\tcatch(final Exception e)\r\n\t\t{\r\n\t\t\tLog.errOut(ID(),e);\r\n\t\t}\r\n\t\treturn new StdBehavior();\r\n\t}", "public ListParameter()\r\n\t{\r\n\t}", "public TParametrosVOImpl() {\r\n }", "public native void constructor();", "Param createParam();", "Param createParam();", "Param createParam();", "public ListElement()\n\t{\n\t\tthis(null, null, null); //invokes constructor with 3 arguments\n\t}", "public Person(String vorname, String nachname) {\n\n\t}", "public D() {}", "public Complex(String[] cStr){\r\n\t this(cStr[0], cStr[1]);\r\n\t}", "TDrawingConstructor (ArrayList interpretation){\r\n fInterpretation=interpretation;\r\n}", "public ClassWithHasArgsConstructor(int i) {\n this.i = i;\n }", "public FunctionVariable (Object names[])\n {\n super(names);\n }", "public Contructor(int year, String name) {\n // constructor name must match class name and cannot have return type\n // all classes have constructor by default\n // f you do not create a class constructor yourself, Java creates one for you.\n // However, then you are not able to set initial values for object attributes.\n // constructor can also take parameters\n batchYear = year;\n studentName = name;\n }", "private Point(int param, double value) {\r\n this(param, value, false);\r\n }", "MyEncodeableWithoutPublicNoArgConstructor() {}", "public ctq(File paramFile, String paramString, oa paramoa, ckh paramckh)\r\n/* 22: */ {\r\n/* 23: 33 */ super(paramoa);\r\n/* 24: 34 */ this.i = paramFile;\r\n/* 25: 35 */ this.j = paramString;\r\n/* 26: 36 */ this.k = paramckh;\r\n/* 27: */ }", "public RtReflectionConstructorDescriptor(TypeDescriptor<?> declaringType, Constructor<?> constructor) {\n super(declaringType, constructor);\n }", "public Complex() {\n this(0);\n }", "HxMethod createConstructorReference(final String declaringType,\n final String... parameterTypes);", "void create(T t);", "public MakeClass(String classAccessSp,String className,String listOfAttributes,int tabSize )\n {\n this(\"\",classAccessSp,className,listOfAttributes,tabSize);\n }", "@SuppressWarnings(\"unused\")\n public NoConstructor() {\n // Empty\n }", "public Clade() {}" ]
[ "0.7219093", "0.70234513", "0.693673", "0.6885861", "0.68138236", "0.67968607", "0.6698335", "0.66839397", "0.66606253", "0.6649937", "0.6626583", "0.65138125", "0.64808506", "0.63760394", "0.6372293", "0.6348277", "0.6320196", "0.6310452", "0.62995434", "0.6286599", "0.6254862", "0.62531936", "0.6143848", "0.6128483", "0.61053205", "0.6090514", "0.6089094", "0.6075984", "0.60696983", "0.6063756", "0.606111", "0.6032439", "0.60321975", "0.6020766", "0.601592", "0.59945226", "0.59906495", "0.5984943", "0.5984541", "0.59455884", "0.5942392", "0.5937475", "0.5909347", "0.58964425", "0.58960766", "0.58901453", "0.5888954", "0.5884089", "0.5881688", "0.5863306", "0.5862118", "0.58601516", "0.58535707", "0.58525693", "0.58464223", "0.58424443", "0.58424443", "0.5842104", "0.5839444", "0.58309793", "0.5828593", "0.5825257", "0.58223605", "0.5801707", "0.58000994", "0.57963073", "0.5771047", "0.5762655", "0.57566196", "0.57448536", "0.5743732", "0.5740727", "0.57392997", "0.57321507", "0.57298106", "0.572132", "0.5720182", "0.57136554", "0.571131", "0.5699671", "0.5697109", "0.5697109", "0.5697109", "0.56957823", "0.56858826", "0.5685085", "0.567819", "0.5665009", "0.56640923", "0.56561595", "0.56521887", "0.5651038", "0.56495565", "0.5648789", "0.5647501", "0.5645123", "0.5634893", "0.5634853", "0.5634704", "0.56325775", "0.5632514" ]
0.0
-1
creating a parameterized constructor
Student4(int i, String n, int t) { id = i; name = n; age = t; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Constructor<T> newConstructor();", "DefaultConstructor(int a){}", "HxMethod createConstructor(final String... parameterTypes);", "defaultConstructor(){}", "public Generic(){\n\t\tthis(null);\n\t}", "T newInstance(Object... args);", "public ParameterizedInstantiateFactory() {\r\n super();\r\n }", "public Constructor(){\n\t\t\n\t}", "ConstuctorOverloading(){\n\t\tSystem.out.println(\"I am non=argument constructor\");\n\t}", "void DefaultConstructor(){}", "protected abstract void construct();", "HxMethod createConstructor(final HxType... parameterTypes);", "public static NewExpression new_(Constructor constructor) { throw Extensions.todo(); }", "ConstuctorOverloading(int num){\n\t\tSystem.out.println(\"I am contructor with 1 parameter\");\n\t}", "Reproducible newInstance();", "private Instantiation(){}", "public Parameters() {\n\t}", "private InstantiateTransformer(Class[] paramTypes, Object[] args) {\n super();\n if (((paramTypes == null) && (args != null))\n || ((paramTypes != null) && (args == null))\n || ((paramTypes != null) && (args != null) && (paramTypes.length != args.length))) {\n throw new IllegalArgumentException(\"InstantiateTransformer: The parameter types must match the arguments\");\n }\n if ((paramTypes == null) && (args == null)) {\n iParamTypes = null;\n iArgs = null;\n } else {\n iParamTypes = (Class[]) paramTypes.clone();\n iArgs = (Object[]) args.clone();\n }\n }", "private void __sep__Constructors__() {}", "@NotNull\n protected Supplier<AbstractReadablePacket> createConstructor() {\n final Constructor<AbstractReadablePacket> constructor = requireNonNull(ClassUtils.getConstructor(getClass()));\n return () -> ClassUtils.newInstance(constructor);\n }", "public tn(String paramString, ho paramho)\r\n/* 12: */ {\r\n/* 13:11 */ super(paramString, paramho);\r\n/* 14: */ }", "public T newInstance();", "default HxMethod createConstructor(final Class<?>... parameterTypes) {\n return createConstructor(getHaxxor().toNormalizedClassnames(parameterTypes));\n }", "public Parameter(Parameter template){\n\t\tthis(template.getName(),template.isRequired(),\n\t\t\t template.getType(),(T) template.getDefaultValue());\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "public CacheFIFO(int paramInt)\r\n/* 11: */ {\r\n/* 12: 84 */ super(paramInt);\r\n/* 13: */ }", "public Object[] getConstructorArgs ();", "public Identity()\n {\n super( Fields.ARGS );\n }", "TypesOfConstructor(int value){\n num = value;\n }", "public Scriptable construct(Context cx, Scriptable scope, Object[] args);", "public abstract String construct();", "public ProductoCreable newInstance(int codigo, String nombre){\r\n \r\n }", "public static String generateConstructor(String className, String parameterValue) {\n\t\tif (className.equals(\"Integer\")) {\n\t\t\tif (parameterValue == null)\n\t\t\t\treturn \"Integer(0)\";\n\t\t\treturn \"Integer(\"+parameterValue+\")\";\n\t\t}\n\t\tif (className.equals(\"Double\")) {\n\t\t\tif (parameterValue == null)\n\t\t\t\treturn \"Double(0)\";\n\t\t\treturn \"Double(\"+parameterValue+\")\";\n\t\t}\n\t\tif (className.equals(\"Float\")) {\n\t\t\tif (parameterValue == null)\n\t\t\t\treturn \"Float(0)\";\n\t\t\treturn \"Float(\"+parameterValue+\")\";\n\t\t}\n\t\tif (className.equals(\"Short\")) {\n\t\t\tif (parameterValue == null)\n\t\t\t\treturn \"Short((short) 0)\";\n\t\t\treturn \"Short(\"+parameterValue+\")\";\n\t\t}\n\t\tif (parameterValue == null)\n\t\t\treturn className+\"()\";\n\t\treturn className+\"(\"+parameterValue+\")\";\n\t}", "public a(IntegerLiteralTypeConstructor integerLiteralTypeConstructor) {\n super(0);\n this.a = integerLiteralTypeConstructor;\n }", "public BaseParameters(){\r\n\t}", "public Factory(Class<? extends K> class1, Object... params) {\n\t\ttry {\n\t\t\tthis.params = params;\n\t\t\tif (params != null && params.length > 0) {\n\t\t\t\tClass<?>[] clazzes = new Class<?>[params.length];\n\t\t\t\tint i = 0;\n\t\t\t\tfor (Object param : params) {\n\t\t\t\t\tclazzes[i++] = param.getClass();\n\t\t\t\t}\n\t\t\t\tconstructor = class1.getConstructor(clazzes);\n\t\t\t} else {\n\t\t\t\tconstructor = class1.getConstructor();\n\t\t\t}\n\t\t} catch (Throwable e) {\n\t\t\tlog.error(\"Error initializing factory\", e);\n\t\t\tthrow new Error(\"Internal error initializing factory\", e);\n\t\t}\n\t}", "public static NewExpression new_(Constructor constructor, Iterable<Expression> expressions) { throw Extensions.todo(); }", "public abstract DataType<T> newInstance();", "private Builder(Class<T> clazz, Object... objects) {\n try {\n Stream<Constructor<?>> constructors = Stream.of(clazz.getDeclaredConstructors()).peek(constructor -> constructor.setAccessible(true));\n Optional<Constructor<?>> constructor;\n if (null == objects) {\n constructor = constructors.filter(cons -> cons.getParameterCount() == 0).findFirst();\n if (constructor.isPresent()) {\n instance = clazz.cast(constructor.get().newInstance());\n }\n } else {\n constructor = constructors.filter(cons -> cons.getParameterCount() == objects.length)\n .filter(cons -> {\n List<Class<?>> consClass = Arrays.asList(cons.getParameterTypes());\n List<Class<?>> paramsClass = Arrays.stream(objects).map(Object::getClass).collect(Collectors.toList());\n return consClass.stream()\n .allMatch(con -> paramsClass.stream()\n .anyMatch(param -> (con.isPrimitive() &&\n (Number.class.isAssignableFrom(param) ||\n Boolean.class.isAssignableFrom(param) ||\n Character.class.isAssignableFrom(param) ||\n Byte.class.isAssignableFrom(param))) ||\n param.equals(con) ||\n param.isAssignableFrom(con) ||\n con.isAssignableFrom(param)));\n })\n .findFirst();\n if (constructor.isPresent()) {\n instance = clazz.cast(constructor.get().newInstance(objects));\n }\n }\n } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {\n e.printStackTrace();\n }\n }", "@SuppressWarnings(\"unchecked\")\n public T newInstance()\n throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {\n if (constructor_ == null) {\n constructor_ = getRawClass().getConstructor();\n }\n\n return (T)constructor_.newInstance();\n }", "public MockClass(String arg) {\n\t}", "public Card() { this(12, 3); }", "@Test\n\tpublic void testParameterizedConstructor() {\n\t\tQuestionsEntity questions=new QuestionsEntity(1,\"SOX\",\"Have all changes has been approved\",\"Yes\");\n\t assertEquals(\"Yes\",questions.getResponse());\n\t}", "public Object createNew(String typename, Object... args) \n\t\tthrows \tIllegalAccessException, \n\t\t\tInstantiationException, \n\t\t\tClassNotFoundException,\n\t\t\tNoSuchMethodException,\n\t\t\tInvocationTargetException \n\t{\n\t\tswitch(args.length) \n\t\t{\n\t\tcase 1 : return Class.forName(typename).getConstructor(args[0].getClass()).newInstance(args[0]);\n\t\tcase 2 : return Class.forName(typename).getConstructor(args[0].getClass(), args[1].getClass()).\n\t\t\tnewInstance(args[0], args[1]);\n\t\t}\n\t\treturn null;\n\t}", "private Parameter(int key, String name, String value){\n this.key = key;\n this.name = name;\n this.value = value;\n }", "Parameter createParameter();", "public Vector() {\n construct();\n }", "public ParameterizedInstantiateFactory(Class<? extends T> classToInstantiate) {\r\n super();\r\n this.classToInstantiate = classToInstantiate;\r\n }", "private static Constructor getZeroArgumentConstructor(Class cls) {\n \t\treturn ClassUtils.getConstructor(cls, new Class[] { }, zeroArgumentConstructors);\n \t}", "public GenericDynamicArray() {this(11);}", "private Constructor getConstructor() throws Exception {\r\n return type.getConstructor(Contact.class, label, Format.class);\r\n }", "T create(R argument);", "public Employee()\n\t{\n\t\tthis(\"(2)Invoke Employee's overload constructor\");\n\t\tSystem.out.println(\"(3)Employee's no-arg constructor is invoked\");\n\t}", "public GenericContainer(T t){\n obj = t;\n }", "public static NewExpression new_(Constructor constructor, Iterable<Expression> expressions, Iterable<Member> members) { throw Extensions.todo(); }", "T create();", "T create();", "public Field(){\n\n // this(\"\",\"\",\"\",\"\",\"\");\n }", "public Complex(){\r\n\t this(0,0);\r\n\t}", "public Account() {\n this(0, 0.0, \"Unknown name\"); // Invole the 2-param constructor\n }", "private Params()\n {\n }", "private void addConstructors() {\n\t\tthis.rootBindingClass.getConstructor().body.line(\"super({}.class);\\n\", this.name.getTypeWithoutGenerics());\n\t\tGMethod constructor = this.rootBindingClass.getConstructor(this.name.get() + \" value\");\n\t\tconstructor.body.line(\"super({}.class);\", this.name.getTypeWithoutGenerics());\n\t\tconstructor.body.line(\"this.set(value);\");\n\t}", "@Override\n public Object construct(Object... args) {\n CharSequence stringData = (args.length > 0 ? ToString(realm(), args[0]) : \"\");\n ExoticString obj = new ExoticString(realm(), stringData);\n obj.setPrototype(realm().getIntrinsic(Intrinsics.StringPrototype));\n return obj;\n }", "public abstract DataType<T> newInstance(String format);", "public FactoryValue( ) \r\n {\r\n }", "public GenericElement() {\n\t}", "public Complex(int r, int i){\r\n\t this((double) r, (double) i);\r\n\t\t//chain the input from this constructor to the next constructor,\r\n\t\t// which has a (double, double) signature\r\n\t}", "public MyGeneric(A a, B b) { // TODO: check parameter type\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t}", "TypesOfConstructor(){\n System.out.println(\"This is default constructor\");\n }", "protected ForConstructor(Constructor<?> constructor) {\n this.constructor = constructor;\n }", "public static void copyConstructor(){\n\t}", "@SuppressWarnings(\"java:S1452\")\n public Constructor<? extends T> getConstructor(Class<?>... args) {\n return getConstructor(getProxyClass(), args);\n }", "Constructor(int i,String n ,int x){ //taking three parameters which shows that it is constructor overloaded\r\n\t\t id = i; \r\n\t\t name = n; \r\n\t\t marks =x; \r\n\t\t }", "public Command create(Object... param);", "public Node(){\n this(9);\n }", "private Sequence() {\n this(\"<Sequence>\", null, null);\n }", "@Override\r\n\tpublic CMObject newInstance()\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\treturn this.getClass().getDeclaredConstructor().newInstance();\r\n\t\t}\r\n\t\tcatch(final Exception e)\r\n\t\t{\r\n\t\t\tLog.errOut(ID(),e);\r\n\t\t}\r\n\t\treturn new StdBehavior();\r\n\t}", "public ListParameter()\r\n\t{\r\n\t}", "public TParametrosVOImpl() {\r\n }", "public native void constructor();", "Param createParam();", "Param createParam();", "Param createParam();", "public ListElement()\n\t{\n\t\tthis(null, null, null); //invokes constructor with 3 arguments\n\t}", "public Person(String vorname, String nachname) {\n\n\t}", "public D() {}", "public Complex(String[] cStr){\r\n\t this(cStr[0], cStr[1]);\r\n\t}", "TDrawingConstructor (ArrayList interpretation){\r\n fInterpretation=interpretation;\r\n}", "public ClassWithHasArgsConstructor(int i) {\n this.i = i;\n }", "public FunctionVariable (Object names[])\n {\n super(names);\n }", "public Contructor(int year, String name) {\n // constructor name must match class name and cannot have return type\n // all classes have constructor by default\n // f you do not create a class constructor yourself, Java creates one for you.\n // However, then you are not able to set initial values for object attributes.\n // constructor can also take parameters\n batchYear = year;\n studentName = name;\n }", "private Point(int param, double value) {\r\n this(param, value, false);\r\n }", "MyEncodeableWithoutPublicNoArgConstructor() {}", "public ctq(File paramFile, String paramString, oa paramoa, ckh paramckh)\r\n/* 22: */ {\r\n/* 23: 33 */ super(paramoa);\r\n/* 24: 34 */ this.i = paramFile;\r\n/* 25: 35 */ this.j = paramString;\r\n/* 26: 36 */ this.k = paramckh;\r\n/* 27: */ }", "public RtReflectionConstructorDescriptor(TypeDescriptor<?> declaringType, Constructor<?> constructor) {\n super(declaringType, constructor);\n }", "public Complex() {\n this(0);\n }", "HxMethod createConstructorReference(final String declaringType,\n final String... parameterTypes);", "void create(T t);", "public MakeClass(String classAccessSp,String className,String listOfAttributes,int tabSize )\n {\n this(\"\",classAccessSp,className,listOfAttributes,tabSize);\n }", "@SuppressWarnings(\"unused\")\n public NoConstructor() {\n // Empty\n }", "public Clade() {}" ]
[ "0.7219093", "0.70234513", "0.693673", "0.6885861", "0.68138236", "0.67968607", "0.6698335", "0.66839397", "0.66606253", "0.6649937", "0.6626583", "0.65138125", "0.64808506", "0.63760394", "0.6372293", "0.6348277", "0.6320196", "0.6310452", "0.62995434", "0.6286599", "0.6254862", "0.62531936", "0.6143848", "0.6128483", "0.61053205", "0.6090514", "0.6089094", "0.6075984", "0.60696983", "0.6063756", "0.606111", "0.6032439", "0.60321975", "0.6020766", "0.601592", "0.59945226", "0.59906495", "0.5984943", "0.5984541", "0.59455884", "0.5942392", "0.5937475", "0.5909347", "0.58964425", "0.58960766", "0.58901453", "0.5888954", "0.5884089", "0.5881688", "0.5863306", "0.5862118", "0.58601516", "0.58535707", "0.58525693", "0.58464223", "0.58424443", "0.58424443", "0.5842104", "0.5839444", "0.58309793", "0.5828593", "0.5825257", "0.58223605", "0.5801707", "0.58000994", "0.57963073", "0.5771047", "0.5762655", "0.57566196", "0.57448536", "0.5743732", "0.5740727", "0.57392997", "0.57321507", "0.57298106", "0.572132", "0.5720182", "0.57136554", "0.571131", "0.5699671", "0.5697109", "0.5697109", "0.5697109", "0.56957823", "0.56858826", "0.5685085", "0.567819", "0.5665009", "0.56640923", "0.56561595", "0.56521887", "0.5651038", "0.56495565", "0.5648789", "0.5647501", "0.5645123", "0.5634893", "0.5634853", "0.5634704", "0.56325775", "0.5632514" ]
0.0
-1
method to display the values
void display() { System.out.println(id + " " + name + " " + age); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void displayValues()\n {\n \tSystem.out.println(\"The name of a bicycle is \"+name);\n \tSystem.out.println(\"The cost of a bicycle is \"+cost);\n \tSystem.out.println(\"The total numer of gears \"+gears);\n \t\n \t\n }", "public void printValues() {\n\t\tfor (int i = 0; i < 7; i++) {\n\t\t\tfor (int j = 0; j < 7; j++) {\n\t\t\t\tlblCenter[i][j].setText(\"\" + array.getElement(i, j));\n\t\t\t}\n\t\t\ttfWest[i].setText(\"\" + leftCol.getElement(i));\n\t\t\ttfSouth[i].setText(\"\" + bottomRow.getElement(i));\n\t\t}\n\t}", "@Override\n\tpublic void display() {\n\t\tSystem.out.println(valueType+\": \"+value);\n\t}", "public void printVal()\n {\n for (int i=0;i<intData.length;i++)\n System.out.print(intData[i] + \" \");\n System.out.println();\n System.out.println(\"Sum: \" + sum + \", Avg: \" + avg + \", Prod: \" + prod);\n }", "public void show()\n {\n System.out.println( getFullName() + \", \" +\n String.format(Locale.ENGLISH, \"%.1f\", getAcademicPerformance()) + \", \" +\n String.format(Locale.ENGLISH,\"%.1f\", getSocialActivity()) + \", \" +\n String.format(Locale.ENGLISH,\"%.1f\", getCommunicability()) + \", \" +\n String.format(Locale.ENGLISH,\"%.1f\", getInitiative()) + \", \" +\n String.format(Locale.ENGLISH,\"%.1f\", getOrganizationalAbilities())\n );\n }", "public void display(){\r\n System.out.println(\"The Vacancy Number is : \" + getVacancyNumber());\r\n System.out.println(\"The Designation is : \" + getDesignation());\r\n System.out.println(\"The Job Type is : \" + getJobType());\r\n }", "public void displayStateValues()\n\t{\n\t\tfor (State s : stateSpace)\n\t\t{\n\t\t\tSystem.out.println(s.state + \"\\t\" + this.value.get(s));\n\t\t}\n\t}", "public void show() {\n for (int i = 0; i < rowCount; i++) {\n for (int j = 0; j < columnCount; j++)\n System.out.printf(\"%9.4f \", data[i][j]);\n System.out.println();\n }\n }", "String displayValue();", "private static void showValues(Derived derived) {\n\t\tSystem.out.println(\"\\n\\tX = \" + derived.getX()\n\t\t+ \";\\tY = \" + derived.getY() + \";\\tZ = \"\n\t\t+ derived.getZ() + \";\\tThe Largest Value Is : \"\n\t\t+ derived.getLargestValue());\n\t}", "@Override\n public void display(){\n System.out.println(\"Student id: \"+getStudentId()+\"\\nName is: \"+getName()+\"\\nAge :\"+getAge()+\"\\nAcademic year: \"+getSchoolYear()\n +\"\\nNationality :\"+getNationality());\n }", "@Override\n\tpublic void display() {\n\t\tSystem.out.println(\"Pasos dados por \" + a.nombre + \" \" + a.distancia + \" m = \" + pasosActividad + \" / Pasos en total = \" + pasosTotal);\n\t}", "public void display()\n\t{\n\t\tSystem.out.println(data+\" \");\n\t}", "public void print() {\n\t\t\n\t\tfor (int j = 0; j < height(); j++) {\n\t\t\tfor (int i = 0; i < width(); i++) {\n\t\t\t\tSystem.out.printf(\"%3d \", valueAt(i, j));\n\t\t\t}\n\t\t\tSystem.out.printf(\"\\n\");\n\t\t}\n\t\tSystem.out.printf(\"\\n\");\t\n\t}", "public void display () {\n System.out.println(rollNo + \" \" + name + \" \" + college );\n }", "public void print() {\n System.out.print(\"[ \" + value + \":\" + numSides + \" ]\");\n }", "public String displayData() {\n\t String s = \"\";\n\t s += super.toString() + \"\\nNumber of Rentable Units: \" + numRentableUnits + \"\\nAverage Unit Size: \" + avgUnitSize + \"\\nParking Available: \" + ((parkingAvailable == true) ? \"Y\" : \"N\");\n\t return s;\n\t}", "public void display() {\n \t\tSystem.out.printf(\"|%6s \", String.valueOf(idNumber));\n\t\tSystem.out.printf(\"|%13s |\", name);\n\t\tSystem.out.printf(\"%10s |\", quantity);\n\t\tSystem.out.printf(\"%8.2f |\", price);\n\t\tSystem.out.printf(\"%16s |\", \" \");\n\t\tSystem.out.printf(\"%16s |\", \" \");\n\t\tSystem.out.println();\n }", "private void display(int key, String value)\n {\n System.out.println(\"Value for id \" + key + \": \" + value);\n }", "public void display() {\r\n\t\tArrayList<String> vnames = new ArrayList<>(vces.keySet());\r\n\t\tfor (String vname : vnames) {\r\n\t\t\tString str = vname + \" => \";\r\n\t\t\tVertex vtx = vces.get(vname);\r\n\r\n\t\t\tArrayList<String> nbrnames = new ArrayList<>(vtx.nbrs.keySet());\r\n\t\t\tfor (String nbrname : nbrnames) {\r\n\t\t\t\tstr += nbrname + \"[\" + vtx.nbrs.get(nbrname) + \"], \";\r\n\t\t\t}\r\n\r\n\t\t\tSystem.out.println(str + \".\");\r\n\t\t}\r\n\t}", "public void displayCurrentValues() {\n currentX.setText(Float.toString(singleSample[0]));\n currentY.setText(Float.toString(singleSample[1]));\n currentZ.setText(Float.toString(singleSample[2]));\n }", "void display()\n\t {\n\t\t System.out.println(\"Student ID: \"+id);\n\t\t System.out.println(\"Student Name: \"+name);\n\t\t System.out.println();\n\t }", "public String toDisplay(){\n\t\treturn String.format(\"%s | %c | %.2f | %.2f\",name ,gender ,taxableIncome ,taxAmount);\n\t}", "@Override\n public String toString(){\n return this.getValue();\n }", "@Override\r\n\tpublic String toString() {\n\t\treturn getValor();\r\n\t}", "public void display()\n\t{\n\t\tSystem.out.println(\"Bike No.\\t\"+\n\t\t\t\t\"Phone no.\\t\"+\n\t\t\t\t\"Name\\t\"+\n\t\t\t\t\"No. of days\\t\"+\n\t\t\t\t\"Charge\");\n\t\tSystem.out.println(bno+\n\t\t\t\t\"\\t\"+phno+\n\t\t\t\t\"\\t\"+name+\n\t\t\t\t\"\\t\"+days+\n\t\t\t\t\"\\t\"+charge);\n\t}", "public void displayResult()\n {\n for(int i = 0; i < this.etatPopulation.size(); i++)\n {\n String line = \"\";\n for (int j = 0; j < this.etatPopulation.get(i).size(); j++)\n {\n line += this.etatPopulation.get(i).get(j).toString() + \" \";\n }\n System.out.println(line);\n }\n }", "public String display();", "public void display() {\n System.out.println(toString());\n }", "public String toString(){\n\t\treturn getValue();\n\t}", "void display(){\n System.out.println(\"Name:\"+name);\n System.out.println(\"Age:\"+age);\n System.out.println(\"Faculty:\"+faculty);\n System.out.println(\"Department:\"+department);\n System.out.println(\"IsHandicapped:\"+isHandicapped);\n }", "@Override\n\tpublic void display() {\n\t\tStringBuilder string = new StringBuilder();\n\t\tfor (int i = 0; i < size; i++) {\n\t\t\tif (hashArray[i] == null)\n\t\t\t\tstring.append(\"** \");\n\t\t\telse if (hashArray[i] == deleted)\n\t\t\t\tstring.append(hashArray[i].value + \" \");\n\t\t\telse\n\t\t\t\tstring.append(\"[\" + hashArray[i].value + \", \"\n\t\t\t\t\t\t+ hashArray[i].frequency + \"] \");\n\t\t}\n\t\tSystem.out.println(string.toString());\n\t}", "public void plot() {\n // TODO: Implement this method\n System.out.printf(\"%10s : [\",this.label);\n for (int i=1;i<=this.value;i++) {\n System.out.print(\"#\");\n }\n System.out.printf(\"] (%d)\\n\",this.value);\n }", "public void display() {\n \n //Print the features representation\n System.out.println(\"\\nDENSE REPRESENTATION\\n\");\n \n //Print the header\n System.out.print(\"ID\\t\");\n for (short i = 0 ; i < dimension; i++) {\n System.out.format(\"%s\\t\\t\", i);\n }\n System.out.println();\n \n //Print all the instances\n for (Entry<String, Integer> entry : mapOfInstances.entrySet()) {\n System.out.format(\"%s\\t\", entry.getKey());\n for (int i = 0; i < vectorDimension(); i++) {\n //System.out.println(allFeatures.get(entry.getValue())[i]);\n System.out.format(\"%f\\t\", allValues.get(entry.getValue())[i]); \n }\n System.out.println();\n }\n }", "public void printValues(){\r\n\r\n for(String key : values.keySet()){\r\n String value = values.get(key).toString();\r\n System.out.println(key + \" = \" + value);\r\n }\r\n\r\n }", "protected void updateDisplay() {\r\n setValue(Integer.toString(value.getValue()));\r\n }", "public String getVals(){\n return (\"a: \" + a + \"\\nr: \" + r + \"\\nb: \" + b + \"\\ng: \" + g);\n }", "@Override\r\n\tpublic void display() {\n\t\tSystem.out.println(\"Discount Code: \" + discode);\r\n\t\tSystem.out.println(\"Group Size: \" + groupsize);\r\n\t\t\r\n\t}", "public void display() {\n\t\tSystem.out.println(x + \" \" + y + \" \" + z);\n\t}", "public void printInfo() {\r\n System.out.printf(\"%-25s\", \"Nomor Rekam Medis Pasien\");\r\n System.out.println(\": \" + getNomorRekamMedis());\r\n System.out.printf(\"%-25s\", \"Nama Pasien\");\r\n System.out.println(\": \" + getNama());\r\n System.out.printf(\"%-25s\", \"Tempat, Tanggal Lahir\");\r\n System.out.print(\": \" + getTempatLahir() + \" , \");\r\n getTanggalKelahiran();\r\n System.out.printf(\"%-25s\", \"Alamat\");\r\n System.out.println(\": \" + getAlamat());\r\n System.out.println(\"\");\r\n }", "public String display(){\n StringBuilder str = new StringBuilder();\n\n for(int i = 0; i < 3; ++i){\n if( Array[i] != null ) {\n str.append('\\n' + Names[i] + '\\n');\n str.append(Array[i].display());\n }\n }\n return str.toString();\n }", "public synchronized void PrintDisplayList()\t{\n\t\tSystem.out.print(\"\\n\\tCar Model:\"+getModel()+\"\\n\\tBase Price is:\"\n +getBasePrice());\n\t\tfor(OptionSet Temp: opset)\n System.out.print(Temp.DisplayOptionSet());\n }", "public void display() {\n\tSystem.out.println(\"student id is \"+studentid+\"\\t\"+\"student name is \"+studentName+\"\\t\"+\"marks is \"+marks);\r\n}", "public void Display(){\n System.out.println(a);\n }", "public void display() {\n System.out.println(\"Title: \" + this.title);\n System.out.println(\"Description: \" + this.des);\n System.out.println(\"Price Per Night: $\" + this.price);\n System.out.println(\"Max Guests: \" + this.guests);\n System.out.println(\"Length of stay: \" + this.days + \" days\");\n System.out.println(\"Total for stay: $\" + this.total);\n System.out.println(\"-----------------------------------\");\n }", "public void displayData();", "public void display()\r\n\t{\r\n\t\tSystem.out.println(\"Dollar: $\"+getAmount());\r\n\t\tSystem.out.println(\"Rupiah: Rp.\"+dollarTorp());\r\n\t}", "public void printAllGradeValues() {\n\t\tfor ( int i = 0; i < gradeValues.size(); i++ ) {\n\t\t\tSystem.out.println( gradeValues.get(i) );\n\t\t}\n\t}", "void display()\r\n\t {\n\t System.out.println(\"a = \" + a + \" b = \" + b);\r\n\t }", "public void show() {\n super.show(color, value.toString());\n }", "@Override\r\n public void infixDisplay() {\r\n System.out.print(value);\r\n }", "public void displayAllInfo(){\nSystem.out.println(\"Dimensions of the room - length in feet : \" + room.getLengthInFeet() + \" width in feet :\" + room.getWidthInFeet());\nSystem.out.println(\"Price per square foot :\" + pricePerSquareFoot);\nSystem.out.println(\"Total Cost :\" + calculateTotalCost());\n}", "public void display() {System.out.println(skaitlis);}", "public void show() {\r\n\t\tSystem.out.println(\"Id \\t Name \\t Address\");\r\n\t\t\r\n\t\tfor (int index = 0; index < emp.size(); index++) {\r\n\t\t\tSystem.out.println(emp.get(index).empId + \"\\t\" + emp.get(index).name +\"\\t\" + emp.get(index).adress);\r\n\t\t}\r\n\t}", "public void output() {\n System.out.printf(\"Dien tich: %.2f \\n\", getArea());\n System.out.printf(\"Chu vi: %.2f \\n\", getPeripheral());\n }", "@Override\n public String toString()\n {\n return String.format(\"(%f,%f,%f,%f)\", kP, kI, kD, kF);\n }", "public void display() {\n\t\tfor (int i = 0; i < size; i++) {\n\t\t\tSystem.out.print(a[i] + \"\\t\");\n\t\t}\n\t\tSystem.out.println();\n\t}", "void display() {\n System.out.println(id + \" \" + name);\n }", "private void displayData() {\n if (mOutlet1State) {\n //print value\n mCurrent1.setText(returnCurrent(4));\n } else {\n mCurrent1.setText(R.string.off);\n }\n //print timer data\n if (mTimer1State) {\n //print time remaining\n mTimer1.setText(returnControllerTime(7));\n } else {\n mTimer1.setText(R.string.disabled);\n }\n\n //outlet 2\n //print current\n if (mOutlet2State) {\n //print value\n mCurrent2.setText(returnCurrent(12));\n } else {\n mCurrent2.setText(R.string.off);\n }\n //print timer data\n if (mTimer2State) {\n //print time remaining\n mTimer2.setText(returnControllerTime(15));\n } else {\n mTimer2.setText(R.string.disabled);\n }\n }", "protected abstract String display();", "@Override\r\n public void display() { //implements abstract display() method from Division.java\r\n System.out.println(\"Division Name: \" + getDivisionName());\r\n System.out.println(\"Account Number: \" + getAccountNumber());\r\n\r\n System.out.println(\"Country: \" + getCountry());\r\n System.out.println(\"Language Spoken: \" + getLanguageSpoken() + \"\\n\");\r\n\r\n }", "public void printInfo()\n {\n System.out.println(\"position Value:\" + pos_.get(0).getPosition());\n System.out.println(\"velocitiy Value:\" + vel_.get(0).getVelocity());\n System.out.println(\"lastUpdateTime Value:\" + lastPosUpdateTime_);\n System.out.println(\"KalmanGain_ Value:\" + KalmanGain_);\n }", "public static void printField(){\n System.out.println(\"---------\");\r\n for (char[] cell : output) {\r\n System.out.print(\"| \");\r\n for (char value : cell) {\r\n System.out.print(value + \" \");\r\n }\r\n System.out.print(\"|\\n\");\r\n }\r\n System.out.println(\"---------\");\r\n }", "void printValues(Vector Vect){\n\t\tint index;\n\t\tfor(index=0;index< Vect.size(); index++){\t\n\t\t\tSystem.out.println(\"Element \" + Vect.elementAt(index));\n\t\t}\n\t\t\n\t}", "@Override\n public String toString()\n {\n\n String str = String.format(\"%5d %-20s %2c %11.2f\",id,name,rarity,value);\n\n return str;\n }", "public String toString() {\n String info = values[value] + \" of \" + suits[suit];\n return info;\n }", "public void print() {\n\t\tfor (int i = 0; i < TABLE_SIZE; i++) {\n\t\t\tSystem.out.print(\"|\");\n\t\t\tif (array[i] != null) {\n\t\t\t\tSystem.out.print(array[i].value);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.print(\"|\\n\");\n\t}", "public String toString()\n\t{\n\t\treturn this.value+\" \"+this.currency;\n\t}", "int getDisplayValue();", "public void displayCurrentValues() {\n currentX.setText(_DF.format(deltaX));\n currentY.setText(_DF.format(deltaY));\n currentZ.setText(_DF.format(deltaZ));\n }", "public void showInfo(){\n\t\tfor (int i = 0; i < this.cd.size(); i++) {\n\t\t\tthis.cd.get(i).showInfo();\n\t\t}\n\t\tSystem.out.println(\"\\tToatl amount: \" + calTotalAmount());\n\t}", "public void print() {\n for (int i = 0; i < headers.length; i++) {\n System.out.printf(headers[i] + \", \"); // Print column headers.\n }\n System.out.printf(\"\\n\");\n for (int i = 0; i < (data.length - 1); i++) {\n for (int j = 0; j < data[i].length; j++) {\n System.out.printf(data[i][j] + \" \"); // Print value at i,j.\n }\n System.out.printf(\"\\n\");\n }\n }", "public static void displayValues(int [] array){\n System.out.println(Arrays.toString(array));\n }", "public void showInfo()\n\t{\n\t\tSystem.out.println(\"Account Number : \"+getAccountNumber());\n\t\tSystem.out.println(\"Balance : \"+getBalance());\n\t\tSystem.out.println(\"Tenure Year : \"+tenureYear);\n\t}", "@Override\n public String toString() {\n return value();\n }", "public void print (){\r\n\t\tSystem.out.print(\" > Inputs (\"+numInputAttributes+\"): \");\r\n\t\tfor (int i=0; i<numInputAttributes; i++){\r\n\t\t\tif (missingValues[Instance.ATT_INPUT][i]){\r\n\t\t\t\tSystem.out.print(\"?\");\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tswitch(Attributes.getInputAttribute(i).getType()){\r\n\t\t\t\tcase Attribute.NOMINAL:\r\n\t\t\t\t\tSystem.out.print(nominalValues[Instance.ATT_INPUT][i]); \r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase Attribute.INTEGER:\r\n\t\t\t\t\tSystem.out.print((int)realValues[Instance.ATT_INPUT][i]);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase Attribute.REAL:\r\n\t\t\t\t\tSystem.out.print(realValues[Instance.ATT_INPUT][i]);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tSystem.out.print(\" \");\r\n\t\t}\r\n\t\tSystem.out.print(\" > Outputs (\"+numOutputAttributes+\"): \");\r\n\t\tfor (int i=0; i<numOutputAttributes; i++){\r\n\t\t\tif (missingValues[Instance.ATT_OUTPUT][i]){\r\n\t\t\t\tSystem.out.print(\"?\");\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tswitch(Attributes.getOutputAttribute(i).getType()){\r\n\t\t\t\tcase Attribute.NOMINAL:\r\n\t\t\t\t\tSystem.out.print(nominalValues[Instance.ATT_OUTPUT][i]); \r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase Attribute.INTEGER:\r\n\t\t\t\t\tSystem.out.print((int)realValues[Instance.ATT_OUTPUT][i]);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase Attribute.REAL:\r\n\t\t\t\t\tSystem.out.print(realValues[Instance.ATT_OUTPUT][i]);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tSystem.out.print(\" \");\r\n\t\t}\r\n\r\n\t\tSystem.out.print(\" > Undefined (\"+numUndefinedAttributes+\"): \");\r\n\t\tfor (int i=0; i<numUndefinedAttributes; i++){\r\n\t\t\tif (missingValues[Instance.ATT_NONDEF][i]){\r\n\t\t\t\tSystem.out.print(\"?\");\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tswitch(Attributes.getUndefinedAttribute(i).getType()){\r\n\t\t\t\tcase Attribute.NOMINAL:\r\n\t\t\t\t\tSystem.out.print(nominalValues[Instance.ATT_NONDEF][i]); \r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase Attribute.INTEGER:\r\n\t\t\t\t\tSystem.out.print((int)realValues[Instance.ATT_NONDEF][i]);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase Attribute.REAL:\r\n\t\t\t\t\tSystem.out.print(realValues[Instance.ATT_NONDEF][i]);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tSystem.out.print(\" \");\r\n\t\t}\r\n\t}", "@Override\r\n\tpublic String toString() {\r\n\t\treturn val.toString();\r\n\t}", "public String toString()\n {\n return \"First: \" + getFirst() +\n \"\\nSecond: \" + getSecond() + \n \"\\nSum: \" + getSum() +\n \"\\nDifference: \" + getDifference() + \n \"\\nProduct: \" + getProduct() + \n \"\\nAverage: \" + getAverage() + \n \"\\nDistance: \" + getDistance() +\n \"\\nMaximum: \" + getMaximum() + \n \"\\nMinimum: \" + getMinimum();\n }", "public void display(){\n\t\tSystem.out.print(programGrade + \" \" + examGrade );\n\t\t\n\t\t\n\t}", "@Override\n\tpublic String toString() {\n\t\treturn value;\n\t}", "public String print() {\n\n String returnString = \"\";\n\n if (kv1 != null) {\n returnString += kv1.toString();\n }\n\n if (kv2 != null) {\n returnString += \" \" + kv2.toString();\n }\n\n return returnString;\n }", "@Override\n public String toString() {\n return displayString;\n }", "public String display(){\n return \"\\tId: \" + id + \"\\n\" +\n \"\\tName: \" + name + \"\\n\" +\n \"\\tDescription: \" + description + \"\\n\" +\n \"\\tTeacher(s): \" + teacherString() + \"\\n\";\n }", "void display() {\r\n\t\tSystem.out.println(id + \" \" + name);\r\n\t}", "@Override\n\tpublic Object Display() {\n\t\treturn \"Avg/Max/Min temperature = \" + RoundFloatToString(temperatureSum / numReadings) + \"F/\" + maxTemp + \"F/\" + minTemp + \"F\";\n\t}", "public String toString() {\n\t\treturn (getValue().toString());\r\n\t}", "String getValues() {\n String r = x + \" \";\n Lista iter = new Lista(this);\n while(iter.next != null) {\n iter = iter.next;\n r += iter.x + \" \";\n } \n return r;\n }", "@Override\n public void print() {\n System.out.println(\"VIn:- \"+getVehicalIndentificationNumber());\n System.out.println(\"Description:- \"+getVechicalDiscription());\n System.out.println(\"Manufacturer:- \"+getManufacturerName());\n System.out.println(\"isSelfDrive:- \"+getSelfDrive());\n System.out.println(\"isInsured:- \"+getInsured());\n System.out.println(\"insuranceProviderName:- \"+getInsuranceProviderName());\n System.out.println(\"NumberOfSeat:- \"+getNoOfSeat());\n System.out.println(\"FuelType:- \"+getFuelType());\n System.out.println(\"BaseRate:- \"+getBaseRate());\n System.out.println(\"RatePerKm:- \"+getRatePerKm());\n System.out.println(\"VehicleType:- \"+getVehicleType());\n System.out.println(\"Color:- \"+getColor());\n }", "@Override\r\n\t\tpublic String toString() {\n\t\t\treturn \" \" + wt + \"- \" + val;\r\n\t\t}", "public void print() {\r\n\t\tint size = list.size();\r\n\r\n\t\tSystem.out.println();\r\n\t\tSystem.out.println(\"┌───────────────────────────┐\");\r\n\t\tSystem.out.println(\"│ \t\t\t성적 출력 \t\t │\");\r\n\t\tSystem.out.println(\"└───────────────────────────┘\");\r\n\r\n\t\tfor (int i = 0; i < size; i++) {\r\n\r\n\t\t\tExam exam = list.get(i);\r\n\t\t\tint kor = exam.getKor();\r\n\t\t\tint eng = exam.getEng();\r\n\t\t\tint math = exam.getMath();\r\n\r\n\t\t\tint total = exam.total();// kor + eng + math;\r\n\t\t\tfloat avg = exam.avg();// total / 3.0f;\r\n\t\t\tSystem.out.printf(\"성적%d > 국어:%d, 영어:%d, 수학:%d\", i + 1, kor, eng, math);\r\n\t\t\tonPrint(exam);\r\n\t\t\tSystem.out.printf(\"총점:%d, 평균:%.4f\\n\", total, avg);\r\n\r\n\t\t}\r\n\r\n\t\tSystem.out.println(\"─────────────────────────────\");\r\n\r\n\t}", "@Override\n public final String toString() {\n return this.value;\n }", "public String toString() {\n return value;\r\n }", "public String toString()\r\n\t{\r\n\t\treturn \" \" + this.value;\r\n\t}", "public void display() {\n String box = \"\\n+--------------------------------------------+\\n\";\n String header = \"| \" + name;\n String lvlStat = \"Lv\" + level;\n for (int i=0; i<42-name.length()-lvlStat.length(); i++) {\n header += \" \";\n }\n header += lvlStat + \" |\\n\";\n System.out.println(box + header + \"| \" + getHealthBar() + \" |\" + box);\n }", "void printData()\n {\n System.out.println(\"Studentname=\" +name);\n System.out.println(\"Student city =\"+city);\n System.out.println(\"Student age = \"+age);\n }", "abstract String display(T value);", "void display() {\n for (int i = 0; i < this.questions.size(); i++)\n this.questions.get(i).display(i, gradeable());\n }", "public void print() {\r\n System.out.print(\"[id: <\" + this.id + \"> \");\r\n if (this.dimension > 0) {\r\n System.out.print(this.data[0]);\r\n }\r\n for (int i = 1; i < this.dimension * 2; i++) {\r\n System.out.print(\" \" + this.data[i]);\r\n }\r\n System.out.println(\"]\");\r\n }", "public String display(){\r\n\t\tif(this.AWD==true){\r\n\t\t\treturn super.display()+\" \"+model+\" \"+this.price+\"$ SF: \"+this.safetyRating+\" RNG: \" +this.maxRange+\" AWD\";\r\n\t\t}\r\n\t\telse{\r\n\t\t\treturn super.display()+\" \"+model+\" \"+this.price+\"$ SF: \"+this.safetyRating+\" RNG: \" +this.maxRange+\" 2WD\";\r\n\t\t}\r\n \r\n\t}", "public void showValor() {\n String out = new String();\n this.setText(Integer.toString(valor));\n }" ]
[ "0.8289284", "0.7809706", "0.7770151", "0.75643086", "0.7482198", "0.74327594", "0.7338533", "0.7313772", "0.72396016", "0.7081672", "0.70516", "0.7014946", "0.6997404", "0.6991467", "0.6978281", "0.69335806", "0.6930144", "0.69300115", "0.69255114", "0.6920068", "0.69186103", "0.6915065", "0.69126475", "0.6902034", "0.6893978", "0.68926954", "0.6890517", "0.6878472", "0.6874785", "0.6872306", "0.6871058", "0.6870184", "0.686932", "0.68644565", "0.68586797", "0.6839657", "0.68234754", "0.68137157", "0.6793665", "0.67635787", "0.6748409", "0.67443967", "0.67327577", "0.6727845", "0.67250425", "0.67238915", "0.6720211", "0.6719356", "0.67150277", "0.67127293", "0.67093325", "0.6696853", "0.66966546", "0.6695965", "0.6691039", "0.66737014", "0.6671058", "0.66591054", "0.66559976", "0.66499484", "0.6649461", "0.66339386", "0.6625129", "0.6622199", "0.6620812", "0.66208106", "0.66170484", "0.66146266", "0.661145", "0.6595375", "0.65917504", "0.6591045", "0.65903085", "0.6585163", "0.65845037", "0.65795976", "0.6576912", "0.6574487", "0.6573453", "0.6572926", "0.65717775", "0.6570734", "0.656719", "0.6562995", "0.6559266", "0.65581965", "0.6546748", "0.65431637", "0.65378845", "0.6536771", "0.6532211", "0.65319324", "0.6530825", "0.6520787", "0.6516512", "0.6513226", "0.6512301", "0.6511388", "0.6503967", "0.65034664" ]
0.6854468
35
creating objects and passing values
public static void main(String args[]) { Student4 s1 = new Student4(111, "Karan"); //Log.info("Test"); Student4 s2 = new Student4(222, "Aryan", 23); //calling method to display the values of object s1.display(); s2.display(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void Constructor_ObjectValues_InstanceCreated() {\n\t\ttry {\n Position position = make_PositionWithIntegerPoints(xCoordinate, yCoordinate, direction);\n Surface surface = make_SurfaceWithGivenDimensions(xDimension, yDimension);\n\t\t\tRover rover = make_RoverWithObjectValues(position, surface);\n\t\t}\n\t\tcatch (AssertionError assErr) {\n\t\t\t// Test passed.\n\t\t\treturn;\n\t\t}\n }", "public static void main(String args[]){\n SingleTonClass myobject= SingleTonClass.objectCreationMethod();\r\n SingleTonClass myobject1= SingleTonClass.objectCreationMethod();\r\n myobject.display();\r\n myobject.b = 600;\r\n myobject1.display();\r\n myobject1.b = 800;\r\n SingleTonClass myobject2 = new SingleTonClass();\r\n myobject2.display();\r\n }", "public static void main(String[] args) {\nconstructorDemo obj=new constructorDemo();\nconstructorDemo obj1=new constructorDemo(\"My Parameter\");\nconstructorDemo obj2=new constructorDemo(123);\nconstructorDemo obj3=new constructorDemo(123,6);\nSystem.out.println(\"code after creating object\");\nobj.hello();\nobj.hello(\"hi\");\n\t}", "OBJECT createOBJECT();", "private void makeObject() {\n\t\t\n\t\tItem I1= new Item(1,\"Cap\",10.0f,\"to protect from sun\");\n\t\tItemMap.put(1, I1);\n\t\t\n\t\tItem I2= new Item(2,\"phone\",100.0f,\"Conversation\");\n\t\tItemMap.put(2, I2);\n\t\t\n\t\tSystem.out.println(\"Objects Inserted\");\n\t}", "Values createValues();", "FromValues createFromValues();", "Object create(Object source);", "Variables createVariables();", "public abstract T create(T obj);", "@Override\n protected void inputObjects() {\n alpha1 = Utils.computeRandomNumber(Modulus, sp);\n alpha2 = Utils.computeRandomNumber(Modulus, sp);\n gamma = Utils.computeRandomNumber(Modulus, sp);\n gammaTilde = Utils.computeRandomNumber(Modulus, sp);\n\n capC = g2.modPow(gamma, Modulus);\n capCTilde = g2.modPow(gammaTilde, Modulus);\n\n beta1 = alpha1.multiply(x);\n beta2 = alpha2.multiply(x);\n BigInteger capU1 = t_i.modPow(alpha1, Modulus).multiply(b_i.modPow(beta1.negate(), Modulus))\n .mod(Modulus);\n BigInteger capU2 = g1.modPow(alpha1, Modulus).multiply(g2.modPow(alpha2, Modulus)).mod(Modulus);\n\n objects.put(\"tInverse\", t.modInverse(Modulus));\n objects.put(\"b\", b);\n objects.put(\"g1\", g1);\n objects.put(\"g2\", g2);\n objects.put(\"U1Inverse\", capU1.modInverse(Modulus));\n objects.put(\"U2Inverse\", capU2.modInverse(Modulus));\n objects.put(\"CInverse\", capC.modInverse(Modulus));\n objects.put(\"CTildeInverse\", capCTilde.modInverse(Modulus));\n objects.put(\"t_i\", t_i);\n objects.put(\"b_iInverse\", b_i.modInverse(Modulus));\n }", "public void create(){}", "For createFor();", "abstract Object build();", "private static void LessonClassObjects() {\n Person person1 = new Person();\n Person person2 = new Person();\n\n //Set title, firstname and lastname\n person1.setTitle(\"Mr.\");\n person1.setFirstName(\"Jordan\");\n person1.setLastName(\"Walker\");\n\n person2.setTitle(\"Mrs.\");\n person2.setFirstName(\"Kelsey\");\n person2.setLastName(\"Walker\");\n\n //Print out\n System.out.println(person1.getTitle()+ \" \" + person1.getFirstName() + \" \" + person1.getLastName());\n System.out.println(person2.getTitle()+ \" \" + person2.getFirstName() + \" \" + person2.getLastName());\n\n // Set super BaseBO class\n person1.setId(7);\n System.out.println(person1.getFirstName() + \" Id is: \" + person1.getId());\n }", "CreationData creationData();", "public void makeInstance() {\n\t\t// Create the attributes, class and text\n\t\tFastVector fvNominalVal = new FastVector(2);\n\t\tfvNominalVal.addElement(\"ad1\");\n\t\tfvNominalVal.addElement(\"ad2\");\n\t\tAttribute attribute1 = new Attribute(\"class\", fvNominalVal);\n\t\tAttribute attribute2 = new Attribute(\"text\",(FastVector) null);\n\t\t// Create list of instances with one element\n\t\tFastVector fvWekaAttributes = new FastVector(2);\n\t\tfvWekaAttributes.addElement(attribute1);\n\t\tfvWekaAttributes.addElement(attribute2);\n\t\tinstances = new Instances(\"Test relation\", fvWekaAttributes, 1); \n\t\t// Set class index\n\t\tinstances.setClassIndex(0);\n\t\t// Create and add the instance\n\t\tInstance instance = new Instance(2);\n\t\tinstance.setValue(attribute2, text);\n\t\t// Another way to do it:\n\t\t// instance.setValue((Attribute)fvWekaAttributes.elementAt(1), text);\n\t\tinstances.add(instance);\n \t\tSystem.out.println(\"===== Instance created with reference dataset =====\");\n\t\tSystem.out.println(instances);\n\t}", "public static void main(String[] args) {\n Student student = Student.createInstanceByIdAndFirstName(10 , \"Jhn\");\n Student student1 = Student.createInstanceByIdAndLastName(11, \"Smith\");\n }", "Compuesta createCompuesta();", "Reproducible newInstance();", "private void createObject(JSONObject delivery) {\n\t\t//TODO: create the Object\n\t}", "public CMObject newInstance();", "ObjectValue createObjectValue();", "private void prepare()\n {\n Victoria victoria = new Victoria();\n addObject(victoria,190,146);\n Salir salir = new Salir();\n addObject(salir,200,533);\n Volver volver = new Volver();\n addObject(volver,198,401);\n }", "public ProductoCreable newInstance(int codigo, String nombre){\r\n \r\n }", "public void create() {\n\t\t\n\t}", "Object instantiate(Map<String, Object> arguments);", "Object build();", "public void createValue() {\r\n value = new com.timeinc.tcs.epay2.EPay2DTO();\r\n }", "public static void main(String[] args) {\n NonGenericClass nonGen1 = new NonGenericClass(123);\n \n //Creating object by passing String as an argument\n NonGenericClass nonGen2 = new NonGenericClass(\"abc\");\n \n //Creating object by passing Double as an argument\n NonGenericClass nonGen3 = new NonGenericClass(25.69);\n }", "public static void main(String[] args) {\n\t\tCard c1=Card.newInstance();\n\t\tSystem.out.println(\"c1=\"+c1);\n\t\t\n\t\tCard c2=Card.newInstance();\n\t\tSystem.out.println(\"c2=\"+c2);\n\t\t\n\t\tCard c3=Card.newInstance();\n\t\tSystem.out.println(\"c3=\"+c3);\n \n \n\t}", "public static void createArmy() {\n Unit unitOne = new Unit(\"Unit One\");\n Unit unitTwo = new Unit(\"Unit Two\");\n Unit unitThree = new Unit(\"Unit Three\");\n Unit unitFour = new Unit(\"Unit Four\");\n Unit unitFive = new Unit(\"Unit Five\");\n\n Knight knightOne = new Knight(\"Knight One\");\n Knight knightTwo = new Knight(\"Knight Two\");\n Knight knightThree = new Knight(\"Knight Three\");\n\n General general = new General(\"General\");\n Doctor doctor = new Doctor(\"Doctor\");\n }", "public static void main(String[] args) {\n for(int i=0; i<10; i++){\n Constructor c=new Constructor (i);\n c.Constructor(\"Who\");\n \n } \n }", "public static void main(String[] args) {\n\t\tObject o1=new Object();\r\n\t\tObject o2=new RbiBank();\r\n\t\tObject o3=new HdfcBank();\r\n\t\tObject o4=new IciciBank();\r\n\t\tObject o5=\"RBG Technologies\";\r\n\t\tObject o6=10;\r\n\t\tObject o7=true;\r\n\t\r\n\t\t\r\n\r\n\t}", "SimpleGen(X objX, Y objY){\n\t\tthis.objXReff=objX;\n\t\tthis.objYReff=objY;\n\t}", "public static void main(String[]arg){\n Person person1 = new Person();\n person1.setName(\"Bright Kingsley\");\n person1.setPhone(\"08133193153\");\n person1.setAddress(\"Umudike\");\n System.out.println(\"The name is :\"+person1.getName());\n System.out.println(\"The Address is :\"+person1.getAddress());\n System.out.println(\"The Phone Number is :\"+person1.getPhone());\n \n Pearson ps1= new Pearson();\n Pearson ps= new Pearson(\"Chris\", \"070412937854\",\"Aba\");\n System.out.println(\"The name is :\"+ps.getName());\n System.out.println(\"The Address is :\"+ps.getAddress());\n System.out.println(\"The Phone Number is :\"+ps.getPhone());\n \n }", "protected abstract void construct();", "public static void main(String[] args) {\n\t\tPerson person = new Person();\r\n\t\tperson.setName(\"Jon Snow\");\r\n\t\tperson.setAddress(\"Castle Black, 82\");\r\n\t\tperson.setEmail(\"castle.black@hotmail.com\");\r\n\t\tperson.setPhone(061666666);\r\n\t\tSystem.out.println(person);\r\n\r\n\t\t// creating a instance of Staff\r\n\t\tStaff staff = new Staff();\r\n\t\tSystem.out.println();\r\n\t\tstaff.setName(\"Ned Stark\");\r\n\t\tstaff.setTitle(\"King of North\");\r\n\t\tSystem.out.println(staff);\r\n\r\n\t\t// creating a instance of Faculty\r\n\t\tFaculty faculty = new Faculty();\r\n\t\tSystem.out.println();\r\n\t\tfaculty.setName(\"Zdravko\");\r\n\t\tfaculty.setOfficeHours(40);\r\n\t\tfaculty.setRank(\"Profesor\");\r\n\t\tSystem.out.println(faculty);\r\n\r\n\t\t// creating a instance og Employee\r\n\t\tEmployee employee = new Employee();\r\n\t\tSystem.out.println();\r\n\t\temployee.setName(\"Nedim\");\r\n\t\temployee.setOffice(\"Post Office\");\r\n\t\temployee.setSalary(2000);\r\n\t\tSystem.out.println(employee);\r\n\r\n\t\t// creating a instance of Student\r\n\t\tStudent student = new Student();\r\n\t\tSystem.out.println();\r\n\t\tstudent.setName(\"Ljubisa\");\r\n\t\tstudent.setStatus(2);\r\n\t\tSystem.out.println(student);\r\n\t}", "public void crearPersona(){\r\n persona = new Persona();\r\n persona.setNombre(\"Jose\");\r\n persona.setCedula(12345678);\r\n }", "public static void main(String[] args) {\n Student12 obj1 = new Student12();\n\n //parametrised constructor invocation to initialize the object\n Student12 obj2 = new Student12(134,\"aaa\");\n\n obj1.show(); // to print obj1 attributes value\n obj2.show(); // to print obj2 attributes value\n\n }", "Foco createFoco();", "protected void setup() {\r\n \t//inizializza gli attributi dell'iniziatore in base ai valori dei parametri\r\n Object[] args = this.getArguments();\r\n \t\tif (args != null)\r\n \t\t{\r\n \t\t\tthis.goodName = (String) args[0];\r\n \t\t\tthis.price = (int) args[1];\r\n \t\t\tthis.reservePrice = (int) args[2];\r\n \t\t\tthis.dif = (int) args[3];\r\n \t\t\tthis.quantity = (int) args[4];\r\n \t\t\tthis.msWait = (int) args[5];\r\n \t\t} \t\t\r\n\r\n manager.registerLanguage(codec);\r\n manager.registerOntology(ontology);\r\n \r\n //inizializza il bene oggetto dell'asta\r\n good = new Good(goodName, price, reservePrice, quantity);\r\n \r\n //cerca ed inserisce nell'ArrayList gli eventuali partecipanti\r\n findBidders(); \r\n \r\n //viene aggiunto l'apposito behaviour\r\n addBehaviour(new BehaviourInitiator(this));\r\n\r\n System.out.println(\"Initiator \" + this.getLocalName() + \" avviato\");\r\n }", "public static void main(String[] args) {\n String eName = \"Edison\";\n int eAge = 4;\n double eWeight = 13.4;\n\n String tesName = \"Tesla\";\n int tesAge = 7;\n double tesWeight = 6.9;\n\n // Object WITHOUT constructor\n Cat ncEdison = new Cat();\n ncEdison.name = \"Edison\";\n ncEdison.age = 4;\n ncEdison.weight = 13.4;\n ncEdison.printDescription();\n\n // Object WITH constructor\n Cat cTesla = new Cat(\"Tesla\", 7, 6.9);\n Cat cSpotify = new Cat(\"Spotify\", 8, 3.4);\n\n cTesla.printDescription();\n cSpotify.printDescription();\n\n Cat mystery = new Cat();\n mystery.printDescription();\n\n Dog fido = new Dog(\"Fido\", 15, 30);\n// Dog frodo = new Dog(); // No default constructor for Dog()\n\n// System.out.println(fido.weight); // Is private\n\n Journal diary = new Journal();\n diary.append(\"Today Tesla was evil\");\n diary.append(\"Today Edison was asleep\");\n String theWords = diary.getWords();\n theWords = \"_deleted by timmy\";\n\n // Static\n ElectricCharge blanket = new ElectricCharge(7);\n ElectricCharge pants = new ElectricCharge(2);\n ElectricCharge pyjamas = new ElectricCharge(5);\n ElectricCharge socks = new ElectricCharge(4);\n\n System.out.println(\"The total Charge is: \" + ElectricCharge.getTotalCharge());\n\n }", "public static void main(String[] args) {\n\n Create createList = new Create();\n createList.create();\n\n }", "private void instantiate(){\n inputAddressList = new LinkedList<Address>();\n inputGroupList = new LinkedList<Group>();\n root = new Group(\"root\", 0);\n }", "Oracion createOracion();", "static Obj NewObj (String name,int kind) {\r\n\t\tObj p, obj = new Obj();\r\n obj.name = new String(name); \r\n\t\tobj.type = null; obj.kind = kind;\r\n\t\tobj.level = curLevel;\r\n\t\tp = topScope.locals;\r\n\t\t/*Para buscar si el nb de la variable nueva ya esta!!!*/\r\n\t\twhile (p != null) { \r\n \t \tif (p.name.equals(name)) Parser.SemError(1);\r\n\t\t\tp = p.next;\r\n\t\t}\r\n \t//FILO!!\r\n obj.next = topScope.locals; \r\n\t\ttopScope.locals = obj;\r\n \t//if (kind == vars) {}\r\n \t//obj.adr = topScope.nextAdr; topScope.nextAdr++;\r\n \t//obj.view();\r\n\t\treturn obj;\r\n }", "public static void main(String[] args) {\n\t\tCar carUserObj = new Car();\n\t\t//carUserObj.sound();\n\t\tcarUserObj.drive();\n\t\tCar CarObject2= new Car();\n\t\tcarUserObj.changSpeed();\n\t\tSystem.out.println(\"enginType \"+ carUserObj.enginType);\n\t\t//System.out.println(\"modelName \"+ carUserObj.modelName);\n\t}", "protected abstract T newObject(Handle<T> paramHandle);", "private void initObjects() {\n inputValidation = new InputValidation(activity);\n databaseHelper = new DatabaseHelper(activity);\n user = new User();\n }", "T crear(T obj);", "public static void main(String[] args) throws InstantiationException, IllegalAccessException, ClassNotFoundException {\n\ttry {\n\tClass cls=Class.forName(\"udemy.ObjCreation\");\n\tObjCreation o=(ObjCreation)cls.newInstance();\n\tSystem.out.println(o.a);\n\t}\n\tcatch(InstantiationException e) {\n\t\te.printStackTrace();\n\t}\n\tcatch(IllegalAccessException e) {\n\t\te.printStackTrace();\n\t}\n\tcatch(ClassNotFoundException e) {\n\t\tSystem.out.println(\"not found class\");\n\t\te.printStackTrace();\n\t}\n}", "Individual createIndividual();", "public void init(){\n\t\tEmployee first = new Employee(\"Diego\", \"Gerente\", \"bebexitaHemoxita@gmail.com\");\n\t\tHighSchool toAdd = new HighSchool(\"Santiago Apostol\", \"4656465\", \"cra 33a #44-56\", \"3145689879\", 30, 5000, \"Jose\", new Date(1, 3, 2001), 3, \"Servicios educativos\", \"451616\", 15, \"Piedrahita\", 45, 1200, 500);\n\t\ttoAdd.addEmployee(first);\n\t\tProduct pilot = new Product(\"jet\", \"A00358994\", 1.5, 5000);\n\t\tFood firstFood = new Food(\"Colombina\", \"454161\", \"cra 18\", \"454611313\", 565, 60000, \"Alberto\", new Date(1, 8, 2015), 6, \"Manufactura\", 4);\n\t\tfirstFood.addProduct(pilot);\n\t\ttheHolding = new Holding(\"Hertz\", \"15545\", \"cra 39a #30a-55\", \"3147886693\", 80, 500000, \"Daniel\", new Date(1, 2, 2015), 5);\n\t\ttheHolding.addSubordinate(toAdd);\n\t\ttheHolding.addSubordinate(firstFood);\n\t}", "private ConfigurationObject createParam(int num, String type, String value) throws Exception {\r\n ConfigurationObject param = new DefaultConfigurationObject(\"param\" + num);\r\n param.setPropertyValue(PROPERTY_TYPE, type);\r\n param.setPropertyValue(PROPERTY_VALUE, value);\r\n\r\n return param;\r\n }", "public static void main(String[] args) {\n\t\tnew Object();\n\t\tSystem.out.println(new Carte(\"dsadas\", 15));\n\t\tSystem.out.println(new Carte(\"dsadas\"));\n\t\tSystem.out.println(new Carte());\n\t\tCarte crt1 = new Carte(\"Titlu roz\", 2013);\n\t\tCarte crt2 = new Carte(\"fdsfs\");\n\t\tString crt3 = crt1.titlu;\n\t\tSystem.out.println(crt3);\n\t\t\n\t}", "public static void main(String[] args){\n Vehicle bike = new Vehicle(\"blue\");\n // Vehicle car = new Vehicle();\n // contruct is being used on this new object\n Vehicle redCar = new Vehicle(\"red\");\n System.out.println(redCar.getColor());\n\n // set bike color and wheels\n // bike.setColor(\"Blue\");\n bike.setNumberOfWheels(2);\n\n // get bike color and wheels\n System.out.println(\" Bike object - color\" + bike.getColor());\n System.out.println(\" Bike object - Wheels\" + bike.getNumberOfWheels());\n // set car color and wheels\n // car.setColor(\"Green\");\n // car.setNumberOfWheels(4);\n\n // get car color and wheels\n // System.out.println(\" Car object - color\" + car.getColor());\n // System.out.println(\" Car object - Wheels\" + car.getNumberOfWheels());\n\n\n }", "private void prepare()\n {\n AmbulanceToLeft ambulanceToLeft = new AmbulanceToLeft();\n addObject(ambulanceToLeft,717,579);\n Car2ToLeft car2ToLeft = new Car2ToLeft();\n addObject(car2ToLeft,291,579);\n Car3 car3 = new Car3();\n addObject(car3,45,502);\n CarToLeft carToLeft = new CarToLeft();\n addObject(carToLeft,710,262);\n Car car = new Car();\n addObject(car,37,190);\n AmbulanceToLeft ambulanceToLeft2 = new AmbulanceToLeft();\n addObject(ambulanceToLeft2,161,264);\n }", "public abstract Object build();", "@Override\n\tpublic void generate() {\n\t\tJavaObject object = new JavaObject(objectType);\n\n\t\t// Fields\n\t\taddFields(object);\n\n\t\t// Empty constructor\n\t\taddEmptyConstructor(object);\n\n\t\t// Types constructor\n\t\taddTypesConstructor(object);\n\n\t\t// Clone constructor\n\t\taddCloneConstructor(object);\n\n\t\t// Setters\n\t\taddSetters(object);\n\n\t\t// Build!\n\t\taddBuild(object);\n\n\t\t// Done!\n\t\twrite(object);\n\t}", "public static void main(String[] args) {\n\t\tStudent2 s2 = new Student2(123, \"Hans\", \"UP\", 'I');\r\n\t\tSystem.out.println(s2.id + \" \" + s2.name + \" \" + s2.address);\r\n\t\t// creating multiple object of same type.\r\n\t\tStudent2 s3 = new Student2(123, \"mohan\", \"Naini\", 'N'), s4 = new Student2(123, \"rani\", \"nainital\", 'u');\r\n\t}", "RentalObject createRentalObject();", "public TestObject createObject() {\n String word;\n Scanner scanner = new Scanner(System.in);\n System.out.println(\"Enter a word to send to the server: \");\n word = scanner.nextLine();\n\n TestObject testObject = new TestObject(word);\n scanner.close();\n return testObject;\n }", "public static void main(String[] args) {\n\n Address tomAddress = new Address();\n tomAddress.address1 = \"Peter Drive\";\n tomAddress.address2 = \"Marine Street\";\n tomAddress.zip = \"3333\";\n tomAddress.country = \"India\";\n\n Student tom = new Student();\n tom.name = \"Tom\";\n tom.height = 4;\n tom.weigth = 50;\n tom.address = tomAddress;\n\n Student peter = new Student();\n peter.name = \"Peter\";\n peter.height = 5;\n peter.weigth = 55;\n\n Address peterAddress = new Address();\n peterAddress.address1 = \"Doll Wood\";\n peterAddress.address2 = \"Cota Street\";\n peterAddress.zip = \"322\";\n peterAddress.country = \"USA\";\n peter.address = peterAddress;\n\n// String address = new String(\"Some Drive\");\n// String address = (\"Some Drive\");\n// SpecialKitchen kitchen;\n }", "void create(Order order);", "public static void main(String[] args){\n Rectangle obj1 = new Rectangle(5, 3);\n obj1.show();\n\n // passing obj1 in obj2\n Rectangle obj2 = obj1;\n obj2.show();\n }", "public Objects(String item, double baseprice){\r\n this.item = item;\r\n this.baseprice = baseprice;\r\n }", "public CreateUser(int age, String name){ // constructor\n userAge = age;\n userName = name;\n }", "public static void main(String[] args) {\n /**\n * Construction par defaut\n */\n Personne p = new Personne();\n System.out.println(p.toString());\n /**\n * Construction avec comme parametre nom et prenom\n */\n Personne p1 = new Personne(\"Thiaw\",\"Serigne Cheikh Mbacke\");\n System.out.println(p1.toString());\n /**\n * Construction avec comme parametre nom, prenom et age\n */\n Personne p2 = new Personne(\"Thiaw\",\"Serigne Cheikh Mbacke\",22);\n System.out.println(p2.toString());\n /**\n * Construction tous les parametres\n */\n Personne p3= new Personne(\"Thiaw\",\"Serigne Cheikh Mbacke\",22,Sexe.Masculin);\n System.out.println(p3.toString());\n }", "@Before\r\n\tpublic void constructObj (){\r\n\t\tproteinSeq = new ProteinSequence(new char[]{'A','A','T','G','C','C','A','G','T','C','A','G','C','A','T','A','G','C','G'});\r\n\t}", "abc createabc();", "public static void main(String[] args) {\n Animal animal= new Animal(\"Animal\", 1,1,5,5);\n Dog dog= new Dog(\"Dingo\", 8,20,2,4,1,20, \"long silky\");\n \n }", "Simple createSimple();", "public void crearAutomovil(){\r\n automovil = new Vehiculo();\r\n automovil.setMarca(\"BMW\");\r\n automovil.setModelo(2010);\r\n automovil.setPlaca(\"TWS435\");\r\n }", "public static void main(String[] args) {\n BMW bmw = new BMW();\n Tesla tesla = new Tesla();\n Toyota toyota = new Toyota();\n Jeep jeep = new Jeep();\n\n bmw.start();\n tesla.start();\n toyota.start();\n jeep.start();\n\n // create an arraylist of car, and store 3 toyota objetc, 3 bmw objects and 3 Tesla objects\n\n Car car1 = new BMW();\n Car car2 = new Tesla();\n Car car3 = new Toyota();\n Car car4 = new Jeep();\n\n ArrayList<Car> cars = new ArrayList<>();\n cars.addAll(Arrays.asList(car1, car2, car3, car4, bmw, tesla, toyota, jeep));\n\n System.out.println();\n\n }", "public static void main(String[] args) {\n\t\t\n\t\tconstructor o=new constructor(5,6);\n\t\tSystem.out.println(o.a);\n\t\tSystem.out.println(o.b);\n\t\tSystem.out.println(constructor.balance);\n\t}", "public static Object createOb(String[] info){\n Object ob1 = null;\n \n try {\n Class cDef = Class.forName(ClassNames[Integer.parseInt(info[0])-1]);\n Constructor ctor=null;\n ctor=cDef.getDeclaredConstructor(String.class,String.class);\n ob1 = ctor.newInstance(info[1],info[2]);\n } catch (ClassNotFoundException|NoSuchMethodException|InstantiationException | IllegalAccessException | IllegalArgumentException\n\t\t\t\t| InvocationTargetException e) {\n //TODO: handle exception\n e.printStackTrace();\n }\n return ob1;\n }", "public static void main(String[] args) {\n\t\tVehicle v = new Car(10,20);\n\t\tObject o = new Vehicle();\n\t\t\n\t\tv.maxSpeed = 100;\n\t\tv.print();\n\t\tv = new Vehicle();\n\t\tv.setColor(\"green\");\n//\t\tCar c = (Car) v; dangerous casting\n//\t\tv.numDoors = 4;\n//\t\tVehicle v3 = new Bicycle(12);\n\n\t\t\n\t\tv.maxSpeed = 80;\n\t\tv.setColor(\"red\");\n\t\tv.print();\n//\t\t\n//\t\tCar c = new Car();\n//\t\tc.color = \"Black\";\n//\t\tc.maxSpeed = 100;\n//\t\tc.numDoors = 4;\n//\t\tc.setColor(\"black\");\n//\t\tc.printMaxspeed();\n//\t\tc.print();\n//\t\tc.printCar();\n\t\t\n//\t\tBicycle b = new Bicycle();\n//\t\tb.print();\n\n\t}", "protected PyObject createObject(final PyObject pyClass, final Object[] args, final String[] keywords) {\n\t\treturn pyClass.__call__(convertArgs2Python(args), keywords);\n\t}", "Compleja createCompleja();", "@Override\r\n\tpublic void create() {\n\t\t\r\n\t}", "@Override\n\t\t\tpublic Student executor(Object... parameters) {\n\t\t\t\tStudent s=new Student();\n\t\t\t\ts.setId(Integer.parseInt(parameters[0].toString()));\n\t\t\t\ts.setName(parameters[1].toString());\n\t\t\t\treturn s;\n\t\t\t}", "public static void main(String[] args) {\n\t\tPerson firstPerson = new Person();//instansiasi by reference variable\n\t\tPerson secondPerson = new Person(\"Rizalddi\", \"Rnensia\", \"Male\", \"Music, Food\", 21);//instansiasi by konstruktor\n\t\tPerson thirdPerson = new Person(\"Arul\", \"Aral\", \"Male\", \"soccer\", 30);//instansiasi by konstruktor\n\t\t\n\t\t\n\t\tfirstPerson.firstName\t= \"Rizaldi\";// instansiasi by reference variable\n\t\tfirstPerson.lastName\t= \"Rnensia\";\n\t\tfirstPerson.age\t\t\t= 29;\n\t\tfirstPerson.gender\t\t= \"Male\";\n\t\tfirstPerson.interest\t= \"Music, food, travel\";\n\t\t\n\t\tSystem.out.println(\"Orang ke 1 : \");\n\t\tfirstPerson.biodata();// instansiasi by method\n\t\tfirstPerson.greeting();\n\t\tSystem.out.println(\"Orang ke 2 : \");\n\t\tsecondPerson.biodata();// instansiasi by method\n\t\tsecondPerson.greeting();\n\t\tSystem.out.println(\"Orang ke 3 : \");\n\t\tthirdPerson.biodata();// instansiasi by method\n\t\tthirdPerson.greeting();\n\t\tthirdPerson.sayThanks();\n\t\t\n\t\tTeacher firstTeacher = new Teacher();\n\t\tfirstTeacher.firstName\t= \"asep\";\n\t\tfirstTeacher.lastName\t= \"Sutiawan\";\n\t\tfirstTeacher.age\t\t= 29;\n\t\tfirstTeacher.gender\t\t= \"Male\";\n\t\tfirstTeacher.interest\t= \"noodles\";\n\t\tfirstTeacher.subject\t= \"Math\";\n\t\t\n\t\tSystem.out.println(\"\\nGuru ke 1 : \");\n\t\tfirstTeacher.biodata();\n\t\tfirstTeacher.greeting();\n\n\t\tStudent firstStudent = new Student(\"Richa\", \"Fitria\", \"Female\", \"Makan\", 20);\n\t\t\n\t\tSystem.out.println(\"\\nMurid ke 1 : \");\n\t\tfirstStudent.biodata();\n\t\tfirstStudent.greeting();\n\t}", "public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException {\t \r\n\tClass<?> t = Class.forName(\"Java_Oops.ForNameObjectCreation\");\r\n\tObjectCreation_1 obj = ((ObjectCreation_1) t.newInstance());\r\n\t \t\t\t\t obj.display();\t\r\n\t\t\t\t\t }", "public abstract void create();", "private void createGrape(Element temp) {\n Grape grape = new Grape(); //new instance of Objects.Grape\n for(int i = 0; i < temp.getAttributeCount(); i++) { //iterates through all the attributes placed by the user\n Attribute attribute = temp.getAttribute(i); //instantiates a specific attribute (eg. id = \"1\")\n String name = attribute.getQualifiedName(); //takes the attribute name (eg. id)\n String value = attribute.getValue(); //takes the attribute value (eg. \"1\")\n\n switch (name) {\n case(\"id\"):\n grape.setId(value);\n break;\n\n case (\"class\"):\n try {\n grape.setGrapeClass(Class.forName(\"Examples.\"+value)); //creates a new Class based on the attribute's value\n\n } catch (ReflectiveOperationException e) {\n e.printStackTrace();\n\n }\n break;\n\n case (\"scope\"):\n if(value.equals(\"singleton\")) {\n grape.setSingleton(true);\n super.singletonGrapes.put(grape.getId(), null); //create a new instance of the grape and store it in its map\n }\n else\n grape.setSingleton(false);\n\n break;\n\n case (\"init-method\"):\n if (grape.getGrapeClass() != null) {\n Class grapeClass = grape.getGrapeClass();\n try {\n grape.setInitMethod(grapeClass.getMethod(value, null));\n } catch (NoSuchMethodException e) {\n e.printStackTrace();\n }\n } else {\n System.err.print(\"Objects.Grape parameters not in correct order. Class should be before methods. \");\n }\n break;\n\n case (\"destroy-method\"):\n if (grape.getGrapeClass() != null) {\n Class grapeClass = grape.getGrapeClass();\n try {\n grape.setDestroyMethod(grapeClass.getMethod(value, null));\n } catch (NoSuchMethodException e) {\n e.printStackTrace();\n }\n } else {\n System.err.print(\"Objects.Grape parameters not in correct order. Class should be before methods. \");\n }\n break;\n\n case (\"property\"):\n if (grape.getGrapeClass() != null) {\n if (value.equals(\"type\")) {\n autowired =! autowired;\n grape.setAutowiring(\"type\");\n } else if (value.equals(\"name\")) {\n autowired =! autowired;\n grape.setAutowiring(\"name\");\n } else if (value.equals(\"no\") && autowired) {\n if (searchAndCreateDep(grape)) {\n return;\n }\n }\n } else {\n System.err.print(\"Objects.Grape parameters not in correct order. Class should be before methods. \");\n }\n break;\n\n default:\n System.err.print(\"Invalid parameter \" + name);\n break;\n }\n }\n super.grapes.put(grape.getId(), grape);\n }", "public static void main(String[] args) {\n\n Shape circle = new Circle(5);\n System.out.println(circle.getArea());\n System.out.println(circle.getCircuit());\n Shape triangle = new Triangle(3,5,4,3);\n System.out.println(triangle.getCircuit());\n System.out.println(triangle.getArea());\n Shape square = new Square(5);\n System.out.println(square.getArea());\n System.out.println(square.getCircuit());\n\n Person person = new Person(\"Grzegorz\",40,new Medical(1111,\"Kierowanie Karetką\"));\n System.out.println(person.getResponsibilities());\n\n }", "Para createPara();", "public Object createNew(String typename, Object... args) \n\t\tthrows \tIllegalAccessException, \n\t\t\tInstantiationException, \n\t\t\tClassNotFoundException,\n\t\t\tNoSuchMethodException,\n\t\t\tInvocationTargetException \n\t{\n\t\tswitch(args.length) \n\t\t{\n\t\tcase 1 : return Class.forName(typename).getConstructor(args[0].getClass()).newInstance(args[0]);\n\t\tcase 2 : return Class.forName(typename).getConstructor(args[0].getClass(), args[1].getClass()).\n\t\t\tnewInstance(args[0], args[1]);\n\t\t}\n\t\treturn null;\n\t}", "public static void main(String[] args) {\n\t\ttoString Obj = new toString(7,7,2015);\n\n\t}", "private static Object createObject(String className, String namespace) {\n try {\n // get constructor\n Constructor<?> constructor = Class.forName(className).getConstructor(new Class[] {String.class});\n // create object\n return constructor.newInstance(new Object[] {namespace});\n } catch (ClassNotFoundException cnfe) {\n throw new ReviewerStatisticsConfigurationException(\n \"error occurs when trying to create object via reflection.\", cnfe);\n } catch (NoSuchMethodException nsme) {\n throw new ReviewerStatisticsConfigurationException(\n \"error occurs when trying to create object via reflection.\", nsme);\n } catch (InstantiationException ie) {\n throw new ReviewerStatisticsConfigurationException(\n \"error occurs when trying to create object via reflection.\", ie);\n } catch (IllegalAccessException iae) {\n throw new ReviewerStatisticsConfigurationException(\n \"error occurs when trying to create object via reflection.\", iae);\n } catch (InvocationTargetException ite) {\n throw new ReviewerStatisticsConfigurationException(\n \"error occurs when trying to create object via reflection.\", ite);\n }\n }", "public static void main(String[] args) {\n Tool<Student2> tool = new Tool<Student2>();\n tool.setObject(new Student2());\n Student2 stu = tool.getObject();\n\n }", "public Game()//Method was given\n {\n parser = new Parser();\n player = new Player();\n }", "public DemonstrationApp()\n {\n // Create Customers of all 3 types\n s = new Senior(\"alice\", \"123 road\", 65, \"555-5555\", 1);\n a = new Adult(\"stacy\", \"123 lane\", 65, \"555-1111\", 2);\n u = new Student(\"bob\", \"123 street\", 65, \"555-3333\", 3);\n \n //Create an account for each customer \n ca = new CheckingAccount(s,1,0);\n sa = new SavingsAccount(a,2,100);\n sav = new SavingsAccount(u,3,1000);\n \n //Create a bank\n b = new Bank();\n \n //Create a date object\n date = new Date(2019, 02, 12);\n }", "public FactoryValue( ) \r\n {\r\n }", "public Bike createCityBike() {\n Wheels cityWheels = new Wheels(559,50f,10000); //Räder des Stadtrads erstellen\n Gears cityGears = new Gears(3,1,5000); //Gangschaltung des Stadtrads erstellen\n Bike newCityBike = new Bike(cityGears, cityWheels, \"Stahl\", \"CB105\", true, true, 30000); //Stadtrad erstellen\n return newCityBike; //Stadtrad zurückgeben\n}", "public static void main(String[] args) {\n System.out.println(\"=== Bodyguard ===\");\n HumanFactory factory = HumanFactory.getFactory(\"gof.creational.abstractfactory.factory.BodyguardFactory\");\n Weapon weapon = factory.createWeapon();\n weapon.attack();\n Vehicle vehicle = factory.createVehicle();\n vehicle.saySpeed();\n\n // Create knight's weapon and vehicle.\n System.out.println(\"=== Knight ===\");\n factory = HumanFactory.getFactory(\"gof.creational.abstractfactory.factory.KnightFactory\");\n weapon = factory.createWeapon();\n weapon.attack();\n vehicle = factory.createVehicle();\n vehicle.saySpeed();\n\n // Create millennial generation's weapon and vehicle.\n System.out.println(\"=== Millennial Generation ===\");\n factory = HumanFactory.getFactory(\"gof.creational.abstractfactory.factory.MillennialFactory\");\n weapon = factory.createWeapon();\n weapon.attack();\n vehicle = factory.createVehicle();\n vehicle.saySpeed();\n\n }", "public static void main(String[] args) {\n PessoaBuilder builder = new PessoaBuilder();\n builder.comNome(\"Roberto\").comAltura(2.).comCorDosOlhos(\"Azul\").comEtnia(\"Afrodescendente\").comPeso(75.);\n Pessoa pessoa = builder.build();\n System.out.println(pessoa);\n\n //Agora usaremos a classe Director, onde podemos ter perfis pré-definidos\n builder.reset();\n Director director = new Director(builder);\n\n //Primeiro uma pessoa obesa\n director.buildFatPerson();\n Pessoa fatPerson = builder.build();\n System.out.println(fatPerson);\n\n //Agora criaremos o Bruce Wayne (ou será o Batman)1\n director.buildBruceWayne();\n Pessoa batman = builder.build();\n System.out.println(batman);\n }", "public static void main (String [] args){\n \n Box b1 = new Box(); //instantiates the first box object\n b1.setHeight(4); //sets height\n b1.setWidth(4); // sets width\n b1.setLength(6); //sets length\n \n System.out.println(b1.toString()); //displays mesurements\n \n Box b2 = new Box(3, 4, 5); // instantiates a box using the constructor method\n System.out.println(b2.toString()); // displays mesurements\n \n Box b3 = new Box(5); // instatiates a cube using the single parameter constructor\n System.out.println(b3); // displays mesurements\n \n }", "public BoardFactory(PacManSprites spriteStore) {Collect.Hit(\"BoardFactory.java\",\"BoardFactory(PacManSprites spriteStore)\");this.sprites = spriteStore; Collect.Hit(\"BoardFactory.java\",\"BoardFactory(PacManSprites spriteStore)\", \"689\");}", "public static void main(String[] args) {\n\t\t\n\t\tClass_Object a=new Class_Object();\n\t\tClass_Object b=new Class_Object();\n\t\tClass_Object c=new Class_Object();\n\t\t\n\t\ta.mod=2014;\n\t\ta.wheel=4;\n\t\t\n\t\tb.mod=2015;\n\t\tb.wheel=2;\n\t\t\n\t\tc.mod=2016;\n\t\tc.wheel=4;\n\t\tSystem.out.println(a.mod);\n\t\tSystem.out.println(a.wheel);\n\t\t\n\t\t\n\t\ta=b;\n\t\tb=c;\n\t\tc=a;\n\t\t\n\t\t// a will be move to obect b and c will move to where the a object available\n\t\tSystem.out.println(a.mod);\n\t\tSystem.out.println(c.mod);\n\t\t\n\t\t\n\t}" ]
[ "0.70574325", "0.65297747", "0.63541913", "0.6248974", "0.6234699", "0.6212324", "0.6087354", "0.6065963", "0.6024975", "0.59997845", "0.598354", "0.5980574", "0.5914344", "0.5884554", "0.5880936", "0.58716017", "0.58390015", "0.5825988", "0.58125186", "0.58063745", "0.58025944", "0.58008796", "0.57983804", "0.5782431", "0.5774281", "0.5768114", "0.57531816", "0.5745103", "0.57217634", "0.57184803", "0.5678531", "0.56785214", "0.5674909", "0.56705326", "0.56700146", "0.56675994", "0.5664198", "0.56632227", "0.5646457", "0.564475", "0.5641208", "0.5640275", "0.5635462", "0.5624376", "0.56197166", "0.56089133", "0.5603288", "0.5590957", "0.55883896", "0.5574979", "0.55736554", "0.5573462", "0.55436903", "0.55433977", "0.55431664", "0.55426466", "0.5537915", "0.55362016", "0.553044", "0.5528459", "0.5527663", "0.5518866", "0.5518758", "0.5517485", "0.55116206", "0.5511596", "0.55069876", "0.55055994", "0.54977846", "0.54934317", "0.54875463", "0.5485258", "0.54834956", "0.54741013", "0.5473419", "0.54732066", "0.5471276", "0.5470697", "0.54671067", "0.54627675", "0.54613596", "0.5459574", "0.54566216", "0.5455401", "0.5454374", "0.5445875", "0.5444944", "0.5441656", "0.54383963", "0.5435764", "0.54352856", "0.5435273", "0.5431304", "0.5427489", "0.5420508", "0.5420185", "0.5420182", "0.54186594", "0.5418646", "0.54030013", "0.5399008" ]
0.0
-1
Save a tree on a file.
public static Tree saveTree(Tree tree, String outFile) { if (tree == null) throw new NullPointerException("tree: null"); if (outFile == null) throw new NullPointerException("outFile: null"); TreeBuilder.saveTree(tree.tb, outFile); return tree; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void saveTree(File saveFile) throws FileNotFoundException {\r\n\t\tPrintStream ps = new PrintStream(saveFile); // Prepare to output to save file\r\n\t\tsaveTree(ps, getRootNode());\r\n\t\tps.close(); // Close the save file\r\n\t}", "public void saveTree(String filename) {\r\n\t\ttry { // Try saving tree\r\n\t\t\tsaveTree(new File(filename));\r\n\t\t} catch (FileNotFoundException e) {\r\n\t\t\t// Exit if there is an exception\r\n\t\t\tSystem.err.println(\"Could not save to file: \" + filename);\r\n\t\t\te.printStackTrace();\r\n\t\t\tSystem.exit(1);\r\n\t\t}\r\n\t}", "private boolean save(File file)\n {\n return save_tree(file, m_root, m_gameinfo);\n }", "public void writeTree(String path) {\n this.sb = new StringBuilder();\n writeTreeRec(this._root);\n\n try (PrintWriter out = new PrintWriter(path)){\n out.println(sb.toString());\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n }", "private void saveTree(PrintStream saveStream, BinaryNode<String> current) {\r\n\t\t// TODO: Implement and comment based on comments above and assignment description: 10 points\r\n\t\t//The current node is null, save it as NULL in the txt file. This indicates the presence of a leaf and the end of a portion of the \r\n\t\t//tree.\r\n\t\tif(current == null) {\r\n\t\t\tsaveStream.println(\"NULL\");\r\n\t\t}\r\n\t\t//Else, print the data of the current node to the save file in the preorder style\r\n\t\telse {\r\n\t\t\t//Save current\r\n\t\t\tsaveStream.println(current.getData());\r\n\t\t\t//Save left\r\n\t\t\tsaveTree(saveStream, current.getLeftChild());\r\n\t\t\t//Save right\r\n\t\t\tsaveTree(saveStream, current.getRightChild());\r\n\r\n\t\t}\r\n\t}", "public void save(File file) throws IOException{\n\t\tBufferedWriter writer = new BufferedWriter(new FileWriter(file));\n\t //Write the header of the file\n\t\twriter.append(\"Celda\");\n\t for(String label:labels){\n\t \twriter.append (DELIMITER+label);\n\t }\n\t writer.append(NEWLINE);\n\t\t\n\t //Now, write the content of the tree\n\t Set<Integer> keys = this.keySet();\n\t for(Integer key:keys){\n\t \twriter.append(key+\"\");\n\t \tdouble[] datas = this.get(key);\n\t \tfor(int i=0;i<datas.length;i++){\n\t \t\twriter.append(DELIMITER+datas[i]);\n\t \t}\n\t \twriter.append(NEWLINE);\n\t }\n\t \n\t writer.flush();\n\t writer.close();\n\t}", "private boolean savePosition(File file)\n {\n Node root = new Node();\n Node child = new Node();\n root.addChild(child);\n \n GameInfo info = new GameInfo();\n info.setBoardSize(m_guiboard.getBoardSize());\n m_guiboard.storePosition(child);\n child.setPlayerToMove(m_tomove);\n return save_tree(file, root, info);\n }", "public void save(PrintWriter p) {\n Vector listTrans;\n Vector varsSinTrans=new Vector();\n Vector varsConTrans=new Vector();\n FiniteStates mainVar=(FiniteStates)variables.elementAt(0);\n FiniteStates var;\n FiniteStates transVar;\n Configuration indexingVars, confComplete;\n int whites;\n int i,j,k,l;\n \n p.print(\"values= credal-set-tree (\\n\"); \n listTrans=getListTransparents();\n\n // Create a configuration removing transparent variables and mainVar\n for(k=1; k < variables.size(); k++){\n var=(FiniteStates)variables.elementAt(k);\n\n // If this variable is in listTrans, do not consider\n if (listTrans.contains(var) == false){\n varsSinTrans.addElement(var);\n }\n }\n \n // Create the configuration \n indexingVars=new Configuration(varsSinTrans);\n confComplete=new Configuration(variables);\n\n // Call the recursive method responsible for printing the branches\n // of the tree\n printBranch(indexingVars, confComplete, listTrans, mainVar,2,p);\n p.print(\");\\n\");\n }", "public void saveXmlTree(String fileName) {\n try {\n String tree = this.client.driver.getPageSource();\n PrintWriter out = new PrintWriter(this.settings.baseLogDir + File.separator + fileName);\n out.println(tree);\n out.close();\n } catch (Exception e) {\n this.error(\"Failed to get and save current visual tree.\");\n }\n }", "public int saveFile(File file)\r\n {\r\n try \r\n {\r\n ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file));\r\n oos.writeObject(root);\r\n return 0;\r\n } \r\n catch (FileNotFoundException ex) \r\n {\r\n System.out.println(\"A file related error has occurred while saving file: \" + ex);\r\n return 1;\r\n } \r\n catch (IOException ex) \r\n {\r\n System.out.println(\"A file related error has occurred while saving file: \" + ex);\r\n return 1;\r\n }\r\n }", "public static void saveContacts(Tree<Contact, String> tree)\n\t{\n\t\tArrayList<Node<Contact, String>> queueNode = new ArrayList<Node<Contact, String>>();\n\t\tArrayList<Node<Contact, String>> lstNode = new ArrayList<Node<Contact, String>>();\n\t\t\n\t\t// Add root\n\t\tqueueNode.add(tree.getRoot());\n\t\t\n\t\t// While queue is not empty\n\t\twhile(!queueNode.isEmpty())\n\t\t{\n\t\t\tNode<Contact, String> node = queueNode.get(0);\n\t\t\tlstNode.add(node);\n\t\t\tqueueNode.remove(node);\n\t\t\t\n\t\t\t// Add left child\n\t\t\tif (node.getLeftNode() != null)\n\t\t\t{\n\t\t\t\tqueueNode.add(node.getLeftNode());\n\t\t\t}\n\t\t\t\n\t\t\t// Add right child\n\t\t\tif (node.getRightNode() != null)\n\t\t\t{\n\t\t\t\tqueueNode.add(node.getRightNode());\n\t\t\t}\n\t\t}\n\t\t\n\t\tWriter writer = null;\n\t\ttry\n\t\t{\n\t\t\t// Write the file\n\t\t\twriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(\"contacts.txt\"), \"utf-8\"));\n\t\t\t\n\t\t\tfor (Node<Contact, String> item : lstNode)\n\t\t\t{\n\t\t\t\twriter.write(item.getValue().getName() + \"##\" + item.getValue().getPhone() + \"\\n\");\n\t\t\t}\n\t\t}\n\t\tcatch (IOException ex) {}\n\t\tfinally \n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\twriter.close();\n\t\t\t}\n\t\t\tcatch (IOException e) {}\n\t\t}\n\t}", "public void save() {\n ProductData.saveData(tree);\n }", "public void save()\r\n {\r\n \tfc=new JFileChooser();\r\n\t fc.setCurrentDirectory(new File(\"\"));\r\n\t if(fc.showSaveDialog(this)==JFileChooser.APPROVE_OPTION)\r\n\t \t//Try-Catch Block\r\n\t try\r\n\t {\r\n\t pw=new PrintWriter(new FileWriter(fc.getSelectedFile()+\".txt\")); //Print to the user-selected file\r\n\t\t \tfor(Organism o: e.getTree()) //IN PROGESS\r\n\t\t \t{\r\n\t\t\t\t\tint[] genes=o.getGenes(); //Getting genes from \r\n\t\t\t\t\tfor(int i=0; i<genes.length; i++)\r\n\t\t\t\t\t\tpw.print(genes[i]+\" \"); //Print each gene value in a line\r\n\t\t\t\t\t\t\r\n\t\t\t\t\tpw.println(); //Starts printing on a new line\r\n\t\t\t\t}\r\n\t\t\t\tpw.close(); //Closes the File\r\n\t }\r\n\t catch (Exception ex) //Catch Any Exception\r\n\t {\r\n\t ex.printStackTrace();\r\n\t }\r\n }", "private void exportTreeML()\r\n {\r\n // Create the file filter.\r\n// SimpleFileFilter[] filters = new SimpleFileFilter[] {\r\n// new SimpleFileFilter(\"xml\", \"Tree ML (*.xml)\")\r\n// };\r\n// \r\n// // Save the file.\r\n// String file = openFileChooser(false, filters);\r\n// \r\n// // Write the file.\r\n// if (file != null)\r\n// {\r\n// String extension = file.substring(file.length() - 4);\r\n// if (!extension.equals(\".xml\")) file = file + \".xml\";\r\n// Writer.writeTreeML(m_gtree, file);\r\n// }\r\n }", "private void writeTree() throws IOException {\n\t\ttry (final BufferedWriter writer = Files.newBufferedWriter(destinationFile, CHARSET)) {\n\t\t\tfinal char[] treeString = new char[512];\n\t\t\tint treeStringLength = 0;\n\t\t\tfor (final CharacterCode cur : sortedCodes) {\n\t\t\t\ttreeString[treeStringLength++] = cur.getChar();\n\t\t\t\ttreeString[treeStringLength++] = (char) cur.getCode().length();\n\t\t\t}\n\t\t\tif (treeStringLength > 0xff) { //tree length will not always be less than 255, we have to write it on two bytes\n\t\t\t\tfinal int msb = (treeStringLength & 0xff00) >> Byte.SIZE;\n\t\t\t\ttreeStringLength &= 0x00ff;\n\t\t\t\twriter.write(msb);\n\t\t\t} else {\n\t\t\t\twriter.write(0);\n\t\t\t}\n\t\t\twriter.write(treeStringLength);\n\t\t\twriter.write(treeString, 0, treeStringLength);\n\t\t}\n\t}", "void save(File file);", "@Override\n\tpublic boolean save(String file) {\n\t\n\t\tGson gson = new GsonBuilder().create();\n\t\tJsonArray arrEdges = new JsonArray();\n\t\tJsonArray arrNodes = new JsonArray();\n\t\tCollection<node_data> arrV = this.dwg.getV();\n\t\tfor(node_data vertex : arrV) {\n\t\t\tJsonObject nodesObj = new JsonObject();\n\t\t\tgeo_location gl = vertex.getLocation();\n\t\t\tnodesObj.addProperty(\"pos\",String.valueOf(gl.x())+\",\"+String.valueOf(gl.y())+\",\"+String.valueOf(gl.z()));\n\t\t\tnodesObj.addProperty(\"id\",vertex.getKey());\n\t\t\tarrNodes.add(nodesObj);\n\t\t\tCollection<edge_data> arrE = this.dwg.getE(vertex.getKey());\n\t\t\tfor(edge_data edge : arrE) {\n\t\t\t\tJsonObject edgesObj = new JsonObject();\n\t\t\t\tedgesObj.addProperty(\"src\",edge.getSrc());\n\t\t\t\tedgesObj.addProperty(\"w\",edge.getWeight());\n\t\t\t\tedgesObj.addProperty(\"dest\",edge.getDest());\n\t\t\t\tarrEdges.add(edgesObj);\n\t\t\t}\n\t\t}\n\t\tJsonObject graphObj = new JsonObject();\n\t\tgraphObj.add(\"Edges\",arrEdges);\n\t\tgraphObj.add(\"Nodes\",arrNodes);\n\t\tString ans = gson.toJson(graphObj);\n\n\t\ttry{\n\t\t\tPrintWriter pw = new PrintWriter(new File(file));\n\t\t\tpw.write(ans);\n\t\t\tpw.close();\n\t\t}\n\t\tcatch (FileNotFoundException e){\n\t\t\te.printStackTrace();\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "void save() throws IOException, ParserConfigurationException, TransformerConfigurationException;", "void saveToFile() {\n\t\ttry {\n\t\t\tFile directory = GameApplication.getInstance().getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS);\n\t\t\tFile target = new File(directory, FILE_NAME);\n\t\t\tif (!target.exists()) {\n\t\t\t\ttarget.createNewFile();\n\t\t\t}\n\t\t\tJsonWriter writer = new JsonWriter(new FileWriter(target));\n\t\t\twriter.setIndent(\" \");\n\t\t\twriter.beginArray();\n\t\t\tfor (Scoreboard scoreboard : scoreboards.values()) {\n\t\t\t\twriteScoreboard(writer, scoreboard);\n\t\t\t}\n\t\t\twriter.endArray();\n\t\t\twriter.flush();\n\t\t\twriter.close();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void save() {\n\t\tWriteFile data = new WriteFile( this.name + \".txt\" );\n\t\ttry {\n\t\t\t data.writeToFile(this.toString());\n\t\t}\n\t\tcatch (IOException e) {\n\t\t\tSystem.out.println(\"Couldn't print to file\");\n\t\t}\n\t}", "public void save() {\n JAXB.marshal(this, new File(fileName));\n }", "public void save()\n throws IOException\n {\n File file = new File(MainFrame.getConfig().getUserPath(), SNAPSHOTFILE);\n if(null != file.getParentFile())\n file.getParentFile().mkdirs();\n\n try(FileOutputStream ostream = new FileOutputStream(file)) {\n try(OutputStreamWriter fw = new OutputStreamWriter(ostream, StandardCharsets.UTF_8)) {\n PrintNode.printNode(m_snapshotDoc, \" \", fw);\n }\n }\n }", "void save(String fileName) throws IOException, TransformerConfigurationException, ParserConfigurationException;", "void save(Graph<V,E> graph, String filename);", "public boolean saveTXT(MindMapNodeModel rootNodeOfBranch, File file) {\n\t\ttry {\n\t\t\tBufferedWriter fileout = new BufferedWriter(new OutputStreamWriter(\n\t\t\t\t\tnew FileOutputStream(file)));\n\t\t\trootNodeOfBranch.saveTXT(fileout,/* depth= */0);\n\t\t\tfileout.close();\n\t\t\treturn true;\n\n\t\t} catch (Exception e) {\n\t\t\tSystem.err.println(\"Error in MindMapMapModel.saveTXT(): \");\n\t\t\tfreemind.main.Resources.getInstance().logException(e);\n\t\t\treturn false;\n\t\t}\n\t}", "@Override\n public boolean save(String file) {\n /*\n Create a builder for the specific JSON format\n */\n GsonBuilder gsonBuilder = new GsonBuilder();\n gsonBuilder.setPrettyPrinting();\n JsonSerializer<DWGraph_DS> serializer = new JsonSerializer<DWGraph_DS>() {\n @Override\n public JsonElement serialize(DWGraph_DS dwGraph_ds, Type type, JsonSerializationContext jsonSerializationContext) {\n JsonObject jsonGraph = new JsonObject();\n jsonGraph.add(\"Nodes\", new JsonArray());\n jsonGraph.add(\"Edges\", new JsonArray());\n\n for (node_data node : G.getV()) {\n JsonObject jsonNodeObject = new JsonObject();\n\n StringBuilder pos = new StringBuilder();\n pos.append(node.getLocation().x());\n pos.append(',');\n pos.append(node.getLocation().y());\n pos.append(',');\n pos.append(node.getLocation().z());\n jsonNodeObject.addProperty(\"pos\", pos.toString());\n jsonNodeObject.addProperty(\"id\", node.getKey());\n jsonNodeObject.addProperty(\"info\", node.getInfo());\n jsonNodeObject.addProperty(\"tag\", node.getTag());\n jsonGraph.get(\"Nodes\").getAsJsonArray().add(jsonNodeObject);\n for (edge_data e : G.getE(node.getKey())) {\n JsonObject jsonEdgeObject = new JsonObject();\n jsonEdgeObject.addProperty(\"src\", e.getSrc());\n jsonEdgeObject.addProperty(\"w\", e.getWeight());\n jsonEdgeObject.addProperty(\"dest\", e.getDest());\n jsonEdgeObject.addProperty(\"info\", e.getInfo());\n jsonEdgeObject.addProperty(\"tag\", e.getTag());\n jsonGraph.get(\"Edges\").getAsJsonArray().add(jsonEdgeObject);\n }\n }\n return jsonGraph;\n }\n };\n gsonBuilder.registerTypeAdapter(DWGraph_DS.class, serializer);\n Gson graphGson = gsonBuilder.create();\n try {\n PrintWriter writer = new PrintWriter(new FileWriter(file));\n writer.write(graphGson.toJson(G));\n writer.flush();\n writer.close();\n return true;\n } catch (IOException e) {\n e.printStackTrace();\n return false;\n }\n }", "public abstract void saveToFile(PrintWriter out);", "public void save() throws FileNotFoundException, IOException, ClassNotFoundException ;", "public void writeToFile() {\n\t\ttry {\n\t\t\tFileOutputStream file = new FileOutputStream(pathName);\n\t\t\tObjectOutputStream output = new ObjectOutputStream(file);\n\n\t\t\tMap<String, HashSet<String>> toSerialize = tagToImg;\n\t\t\toutput.writeObject(toSerialize);\n\t\t\toutput.close();\n\t\t\tfile.close();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "@Override\n\tpublic void save(String file_name) {\n\t\tserialize(file_name);\n\t}", "public void saveOffers() {\n System.out.println(this.currentChild);\n // TODO [assignment_final] ulozeni aktualnich nabidek do souboru (vyberte si nazev souboru a format jaky uznate za vhodny - CSV nebo JSON)\n }", "public static void save(DSAGraph objToSave, String filename)\n {\n FileOutputStream fileStrm;\n ObjectOutputStream objStrm;\n\n try\n {\n fileStrm = new FileOutputStream(filename); //Underlying stream\n objStrm = new ObjectOutputStream(fileStrm); //Object serialization stream\n objStrm.writeObject(objToSave); //Serialize and save to filename\n objStrm.close();//Clean up\n }\n catch (Exception e)\n { //should do more here\n throw new IllegalArgumentException(\"Unable to save object to file: \" + e);\n }\n }", "public void guardarEnJSON () {\n Gson gson = new GsonBuilder().setPrettyPrinting().create();\n String s = gson.toJson(this);\n try {\n FileWriter fw = new FileWriter(\"files/graph.json\");\n fw.write(s);\n fw.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "private void serialize() {\r\n if (newFile) {\r\n this.newFile = this.serializeAs();\r\n } else if (!newFile && !path.equals(\"\")) {\r\n sr.save(this.path);\r\n }\r\n }", "public void save() {\n UTILS.write(FILE.getAbsolutePath(), data);\n }", "public void save(File filename) throws IOException {\n FileOutputStream fos = new FileOutputStream(filename);\n ObjectOutputStream oos = new ObjectOutputStream(fos);\n oos.writeObject(this);\n oos.close();\n }", "public void save(String path){\t\r\n\t\t\t FMParser.save(this, path);\r\n\t\t\t}", "@Override\n public void save(final String filename) throws IOException {\n Filer.getInstance().save(this, DGraphIOFactory.getInstance(), filename);\n }", "private void saveToFile(){\n this.currentMarkovChain.setMarkovName(this.txtMarkovChainName.getText());\n saveMarkovToCSVFileInformation();\n \n //Save to file\n Result result = DigPopGUIUtilityClass.saveDigPopGUIInformationSaveFile(\n this.digPopGUIInformation,\n this.digPopGUIInformation.getFilePath());\n }", "public void save(String fileName) throws IOException;", "public void saveMap() {\n this.scanMap();\n String userHome = System.getProperty(\"user.home\");\n BinaryExporter export = BinaryExporter.getInstance();\n File file = new File(userHome + \"world.j3o\");\n try {\n export.save(this.testNode, file); \n } catch (IOException ex) {\n Logger.getLogger(mapDevAppState_2.class.getName()).log(Level.SEVERE, \"File write error\");\n }\n }", "void save(String fileName);", "public void saveToFile(Map<String, T> data) throws IOException{\n\t\tOutputStream file = new FileOutputStream(filePath);\n OutputStream buffer = new BufferedOutputStream(file);\n ObjectOutput output = new ObjectOutputStream(buffer);\n\n // serialize the Map\n output.writeObject(data);\n output.close();\n\t}", "void save() {\n File file = new File(main.myPath + \"state.xml\");\n Framework.backup(main.myPath + \"state.xml\");\n Framework.transform(stateDoc, new StreamResult(file), null);\n setDirty(false);\n }", "@Override\n\tpublic void save(Object o, String file) {\n\t\t\n\t}", "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 void saveToFile(File file, Model model) throws IOException;", "private void save() throws FileNotFoundException {\n\t\tm.write(new FileOutputStream(OUTPUT), \"RDF/XML\");\n\t}", "public static boolean save(Model m, String path) {\n\t\tElement rootEle = new Element(\"Graph\");\n\t\tDocument doc = new Document(rootEle);\n\n\t\t// save graph information for each module\n\t\tElement modulesEle = new Element(\"Modules\");\n\t\tfor (Module module : m.getModules()) {\n\t\t\tmodulesEle.addContent(getXML(module));\n\t\t}\n\t\trootEle.addContent(modulesEle);\n\n\t\t// save to disk\n\t\tXMLOutputter XMLOut = new XMLOutputter();\n\t\ttry {\n\t\t\tXMLOut.output(doc, new FileOutputStream(path));\n\t\t} catch (IOException ex) {\n\t\t\tex.printStackTrace();\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "void save();", "void save();", "void save();", "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 void toFile(String filename) {\n\t\tString serialized = Serializer.serializeLevelPack(this);\n\t\tSerializer.writeToFile(filename, serialized.getBytes());\n\t}", "public void saveToFile(String filePath) throws IOException {\n\t\tOutputStream file = new FileOutputStream(filePath);\n\t\tOutputStream buffer = new BufferedOutputStream(file);\n\t\tObjectOutput output = new ObjectOutputStream(buffer);\n\n\t\toutput.writeObject(tagList);\n\t\toutput.close();\n\t}", "public void saveGame(String path) throws Exception\n\t{\n\t\tXMLFile db = new XMLFile(path);\n\t\tdb.save(this);\n\t\tSystem.out.println(\"The file '\" + path + \"' has been saved successfully.\");\n\t}", "private void xmlSave() {\r\n FileDialog fd = new FileDialog(new Frame(), \r\n \"Save as a jMusic XML file...\", \r\n FileDialog.SAVE);\r\n fd.show();\r\n if (fd.getFile() != null) {\r\n jm.util.Write.xml(score, fd.getDirectory() + fd.getFile());\r\n }\r\n }", "void save(String filename);", "public static void writeSave(String filepath, ISaveConfiguration scores) {\n try {\n Element root = Writer.buildDocumentWithRoot(DATA_TYPE);\n Document document = root.getOwnerDocument();\n\n addSaves(document, root, scores);\n\n Writer.writeOutput(document, filepath);\n } catch (TransformerException e) {\n throw new XMLException(e, Factory.UNKNOWN_ERROR);\n }\n }", "public void writeGraphToFile (String fileName) throws IOException {\r\n int[][] childs = new int[getNumV()*getNumV()][getNumV()];\r\n for(int i =0; i< getNumV(); i++)\r\n for(int j =0; j< getNumV(); j++)\r\n childs[i][j] = -1;\r\n\r\n boolean[] visited = new boolean[getNumV()];\r\n for (int i=0; i<getNumV(); i++)\r\n visited[i] = false;\r\n\r\n for(int vertex = 0; vertex<getNumV(); vertex++) {\r\n Queue<Integer> theQueue = new LinkedList<Integer>();\r\n theQueue.offer(vertex);\r\n while (!theQueue.isEmpty()) {\r\n int current = theQueue.remove();\r\n visited[current] = true;\r\n Iterator<Edge> itr = edgeIterator(current);\r\n while (itr.hasNext()) {\r\n Edge edge = itr.next();\r\n int neighbor = edge.getDest();\r\n\r\n if(!visited[neighbor])\r\n theQueue.offer(neighbor);\r\n\r\n childs[current][neighbor] = 1;\r\n }\r\n }\r\n }\r\n\r\n File file = new File(fileName);\r\n FileWriter fW = new FileWriter(file);\r\n BufferedWriter bW = new BufferedWriter(fW);\r\n String s = \"\";\r\n s += getNumV();\r\n bW.write(s.toString());\r\n bW.write(\"\\n\");\r\n\r\n for(int i= 0; i<getNumV(); i++){\r\n for(int j = 0; j < getNumV(); j++){\r\n if(childs[i][j] == 1){\r\n s = \"\";\r\n s += i;\r\n s += \" \";\r\n s += j;\r\n s += \"\\n\";\r\n bW.write(s.toString());\r\n }\r\n }\r\n }\r\n bW.close();\r\n }", "public void save() {\n final JFileChooser fileChooser =\n new JFileChooser(System.getProperty(\"user.dir\"));\n try {\n fileChooser.setSelectedFile(new File(\"save.ser\"));\n int saveFile = fileChooser.showSaveDialog(GameFrame.this);\n\n if (saveFile == JFileChooser.APPROVE_OPTION) {\n File saveGame = fileChooser.getSelectedFile();\n FileOutputStream fileOut = new FileOutputStream(saveGame);\n ObjectOutputStream objOut = new ObjectOutputStream(fileOut);\n objOut.writeObject(world);\n objOut.close();\n fileOut.close();\n System.out.println(\"Game saved.\");\n } else {\n return;\n }\n } catch (IOException i) {\n i.printStackTrace();\n }\n\n }", "void saveToFile(String filename) throws IOException;", "public void saveMapping() {\n String userHome = System.getProperty(\"user.home\");\n String filePath = userHome + \"/\"+ System.currentTimeMillis() +\"-mapping.xml\";\n XMLExporter exporter = XMLExporter.getInstance();\n File file = new File(filePath);\n try {\n exporter.save(mappings, file);\n Logger.getLogger(MappingAppState.class.getName()).log(Level.INFO, \"Mapping saved as {0}\", filePath);\n } catch (IOException ex) {\n Logger.getLogger(MappingAppState.class.getName()).log(Level.SEVERE, \"Failed to save node!\", ex);\n }\n }", "public void save(List<T> data) {\n\t\ttry {\n\t\t\tFile file = new File(getFileLocation());\n\t\t\tif (!file.getParentFile().exists()) {\n\t\t\t\tfile.getParentFile().mkdirs();\n\t\t\t}\n\t\t\tFileWriter fw = new FileWriter(getFileLocation());\n\t\t\tBufferedWriter bw = new BufferedWriter(fw);\n\t\t\tbw.write(gson.toJson(data));\n\t\t\tbw.close();\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "@Override\n\tpublic void save() {\n\t\t\n\t\tFile savingDirectory = new File(savingFolder());\n\t\t\n\t\tif( !savingDirectory.isDirectory() ) {\n\t\t\tsavingDirectory.mkdirs();\n\t\t}\n\t\t\n\t\t\n\t\t//Create the file if it's necessary. The file is based on the name of the item. two items in the same directory shouldn't have the same name.\n\t\t\n\t\tFile savingFile = new File(savingDirectory, getIdentifier());\n\t\t\n\t\tif( !savingFile.exists() ) {\n\t\t\t\n\t\t\ttry {\n\t\t\t\tsavingFile.createNewFile();\n\t\t\t} catch (IOException e) {\n\t\t\t\tSystem.err.println(\"the following item couldn't be saved: \" + getIdentifier());\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\n\t\t}\n\n\t\t\n\t\t//generate the savingTextLine and print it in the savingFile. the previous content is erased when the PrintWriter is created.\n\t\t\n\t\tString text = generateSavingTextLine();\n\n\t\ttry {\n\t\t\tPrintWriter printer = new PrintWriter(savingFile);\n\t\t\tprinter.write(text);\t\t\t\n\t\t\tprinter.close();\n\t\t\t\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t\tsave();\n\t\t} \n\t}", "public void save(OutputStream os) throws IOException;", "public void saveToFile(SubjectDataContainer container, Path file) throws IOException {\n MoreFiles.createDirectoriesIfNotExists(file.getParent());\n try (BufferedWriter writer = Files.newBufferedWriter(file, StandardCharsets.UTF_8)) {\n GsonProvider.prettyPrinting().toJson(container.serialize(), writer);\n writer.flush();\n }\n }", "public void branchSaved(Branch<K> parent, Branch<K> child);", "public abstract void save(FileWriter fw) throws IOException;", "public static void save(File mazeFile, Object maze) throws IOException {\n\n /* IO stuff */\n ObjectOutputStream oo = new ObjectOutputStream( new FileOutputStream( mazeFile ) );\n\n oo.writeObject(maze);\n\n oo.close();\n }", "public static void saveFile(State state) throws Exception{\n\n buildDoc();\n writePreferences(state.language, state.background, state.pastTurtles.size());\n\n writeTurtles(state.pastTurtles);\n writeLines(state.pastLines);\n\n createFile(STATE_FILE);\n\n }", "public void save() {\t\n\t\n\t\n\t}", "public void save() {\n int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);\r\n int minute = Calendar.getInstance().get(Calendar.MINUTE);\r\n\r\n // Hierarchie: 2010/04/05/01_05042010_00002.xml\r\n File dir = getOutputDir();\r\n File f = new File(dir, getCode().replace(' ', '_') + \".xml\");\r\n Element topLevel = new Element(\"ticket\");\r\n topLevel.setAttribute(new Attribute(\"code\", this.getCode()));\r\n topLevel.setAttribute(\"hour\", String.valueOf(hour));\r\n topLevel.setAttribute(\"minute\", String.valueOf(minute));\r\n // Articles\r\n for (Pair<Article, Integer> item : this.items) {\r\n Element e = new Element(\"article\");\r\n e.setAttribute(\"qte\", String.valueOf(item.getSecond()));\r\n // Prix unitaire\r\n e.setAttribute(\"prix\", String.valueOf(item.getFirst().getPriceInCents()));\r\n e.setAttribute(\"prixHT\", String.valueOf(item.getFirst().getPriceHTInCents()));\r\n e.setAttribute(\"idTaxe\", String.valueOf(item.getFirst().getIdTaxe()));\r\n e.setAttribute(\"categorie\", item.getFirst().getCategorie().getName());\r\n e.setAttribute(\"codebarre\", item.getFirst().getCode());\r\n e.setText(item.getFirst().getName());\r\n topLevel.addContent(e);\r\n }\r\n // Paiements\r\n for (Paiement paiement : this.paiements) {\r\n final int montantInCents = paiement.getMontantInCents();\r\n if (montantInCents > 0) {\r\n final Element e = new Element(\"paiement\");\r\n String type = \"\";\r\n if (paiement.getType() == Paiement.CB) {\r\n type = \"CB\";\r\n } else if (paiement.getType() == Paiement.CHEQUE) {\r\n type = \"CHEQUE\";\r\n } else if (paiement.getType() == Paiement.ESPECES) {\r\n type = \"ESPECES\";\r\n }\r\n e.setAttribute(\"type\", type);\r\n e.setAttribute(\"montant\", String.valueOf(montantInCents));\r\n topLevel.addContent(e);\r\n }\r\n\r\n }\r\n try {\r\n final XMLOutputter out = new XMLOutputter(Format.getPrettyFormat());\r\n out.output(topLevel, new FileOutputStream(f));\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n\r\n }", "public void saveJSON(String fileName, Object o){\n // System.err.println(\"accessing disk\");\n Gson gson = new Gson();\n try(FileWriter writer = new FileWriter(fileName)){\n gson.toJson(o, writer);\n //System.err.println(\"\\n Token stored\");\n }catch (IOException e) {\n e.printStackTrace();\n }\n }", "public void createFile(){\r\n JFileChooser chooser = new JFileChooser();\r\n chooser.setAcceptAllFileFilterUsed(false);\r\n FileNameExtensionFilter filter = new FileNameExtensionFilter(\"Only XML Files\", \"xml\");\r\n chooser.addChoosableFileFilter(filter);\r\n chooser.showSaveDialog(null);\r\n File f = chooser.getSelectedFile();\r\n if (!f.getName().endsWith(\".xml\")){\r\n f = new File(f.getAbsolutePath().concat(\".xml\"));\r\n }\r\n try {\r\n BufferedWriter bw = new BufferedWriter(new FileWriter(f));\r\n try (PrintWriter pw = new PrintWriter(bw)) {\r\n pw.println(\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\");\r\n pw.println(\"<osm>\");\r\n for (Node node : this.getListNodes()) {\r\n if(node.getType() == TypeNode.INCENDIE){\r\n pw.println(\" <node id=\\\"\"+node.getId()+\"\\\" x=\\\"\"+node.getX()+\"\\\" y=\\\"\"+node.getY()+\"\\\" type=\\\"\"+node.getType()+\"\\\" intensity=\\\"\"+node.getFire()+\"\\\" />\");\r\n } else {\r\n pw.println(\" <node id=\\\"\"+node.getId()+\"\\\" x=\\\"\"+node.getX()+\"\\\" y=\\\"\"+node.getY()+\"\\\" type=\\\"\"+node.getType()+\"\\\" />\");\r\n }\r\n }\r\n for (Edge edge : this.getListEdges()) {\r\n pw.println(\" <edge nd1=\\\"\"+edge.getNode1().getId()+\"\\\" nd2=\\\"\"+edge.getNode2().getId()+\"\\\" type=\\\"\"+edge.getType()+\"\\\" />\");\r\n }\r\n pw.println(\"</osm>\");\r\n }\r\n } catch (IOException e) {\r\n System.out.println(\"Writing Error : \" + e.getMessage());\r\n }\r\n }", "void saveGameState(File saveName);", "public void savePath(java.nio.file.Path filepath) {\n PathIO.write(filepath, path);\n oldPaths = new Stack<>();\n }", "synchronized public void saveToFile() {\n try {\n saveObjToFile(this, saveFilePath);\n } catch (IOException e) {\n e.printStackTrace();\n log(\"error saving resource to file\");\n }\n }", "public static void saveObjToFile(Object obj, String filePath) throws IOException {\n // create the enclosing folders if it doesn't exist\n createDir(filePath);\n\n FileOutputStream file = new FileOutputStream(filePath);\n ObjectOutputStream out = new ObjectOutputStream(file);\n out.writeObject(obj);\n out.close();\n }", "public void save() {\r\n try {\r\n FileOutputStream fos = new FileOutputStream(REPO_STATE_FILE_NAME);\r\n fos.write(CodecUtils.toJson(this).getBytes());\r\n fos.close();\r\n } catch (Exception e) {\r\n Logging.logError(e);\r\n }\r\n }", "public boolean save(File fileToTry)\n {\n return levelIO.saveLevel(fileToTry, model.getLevel());\n }", "public static void save() {\n Game.save(UI.askNgetString(\"Filename for this save file?\")+\".xml\");\n }", "private void saveGraph() {\n try(FileOutputStream fileOut = new FileOutputStream(graphPath + OVERLAY_GRAPH);\n ObjectOutputStream objectOut = new ObjectOutputStream(fileOut))\n {\n objectOut.writeObject(graph);\n System.out.println(\"The overlay graph was successfully written to a file\");\n } catch (Exception ex) {\n System.out.println(\"Error writing the overlay graph\");\n ex.printStackTrace();\n }\n }", "public void saveQuestions(PrintStream output){\n if (output == null) {\n throw new IllegalArgumentException();\n }\n QuestionNode current = questionTree;\n writeTree(current,output); \n }", "public boolean save(String file);", "public void saveData(){\n try{\n DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();\n DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();\n Document document = documentBuilder.newDocument();\n\n Element rootElement = document.createElement(\"departments\");\n document.appendChild(rootElement);\n for (Department department : entities){\n Element dep = document.createElement(\"department\");\n rootElement.appendChild(dep);\n\n dep.setAttribute(\"id\", department.getId().toString());\n dep.appendChild(createElementFromDepartment(\n document, \"name\", department.getName()));\n dep.appendChild(createElementFromDepartment(\n document, \"numberOfPlaces\", department.getNumberOfPlaces().toString()));\n }\n\n DOMSource domSource = new DOMSource(document);\n StreamResult streamResult = new StreamResult(fileName);\n TransformerFactory transformerFactory = TransformerFactory.newInstance();\n Transformer transformer = transformerFactory.newTransformer();\n transformer.transform(domSource, streamResult);\n\n } catch (ParserConfigurationException | TransformerException e) {\n e.printStackTrace();\n }\n }", "public void saveDocument() throws IOException;", "public void save(File file) {\n //new FileSystem().saveFile(addressBook, file);\n }", "public void saveToFile(Student entity) throws Exception{\n Document document = DocumentBuilderFactory\n .newInstance()\n .newDocumentBuilder()\n .parse(XMLfile);\n Element root = document.getDocumentElement();\n Element studentElement = document.createElement(\"student\");\n studentElement.setAttribute(\"serialNumber\",entity.getSerialNumber());\n root.appendChild(studentElement);\n\n appendChildWithText(document, studentElement, \"name\", entity.getName());\n appendChildWithText(document, studentElement, \"group\", String.valueOf(entity.getGroup()));\n appendChildWithText(document, studentElement, \"id\", entity.getId().toString());\n\n Transformer transformer =\n TransformerFactory.newInstance().newTransformer();\n transformer.transform(new DOMSource(root),\n new StreamResult(new FileOutputStream(\n XMLfile)));\n }", "public void dumpTree() {\n\t\tsendMessage(\"/g_dumpTree\", new Object[] { 0, 0 });\n\t}", "private void saveRoute(String path){\n if(vMaze == null)\n inputMessage.setText(\"You must load a maze first!\");\n else try{\n vMaze.getRouteFinder().save(path);\n\n mainMessage.setText(\"Successfully saved!\");\n stage.setScene(main);\n } catch (IOException e){\n inputMessage.setText(\"Unable to read file.\");\n }\n }", "public void saveToFile() {\n FileOutputStream fos = null;\n try {\n //write the object into file\n fos = new FileOutputStream(file);\n ObjectOutputStream oos = new ObjectOutputStream(fos);\n oos.writeObject(travelGUI.getTravelAgent());\n oos.flush();\n oos.close();\n }\n catch (IOException ioe) {\n System.out.println(ioe.getMessage());\n if (fos != null) {\n try {\n fos.close();\n }\n catch (IOException ioe2) {\n System.out.println(ioe2.getMessage());\n }\n }\n return;\n }\n finally {\n if (fos != null) {\n try {\n fos.close();\n }\n catch (IOException ioe2) {\n System.out.println(ioe2.getMessage());\n }\n }\n }\n if (fos != null) {\n try {\n fos.close();\n }\n catch (IOException ioe2) {\n System.out.println(ioe2.getMessage());\n }\n }\n }", "void commit(IDevTree tree, Map options) throws IOException;", "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 writeDot(String filename)\t{\n\t\ttry {\n\t\t\t// PrintWriter(FileWriter) will write output to a file\n\t\t\tPrintWriter output = new PrintWriter(new FileWriter(filename));\n\n\t\t\t// Set up the dot graph and properties\n\t\t\toutput.println(\"digraph BST {\");\n\t\t\toutput.println(\"node [shape=record]\");\n\n\t\t\tif(root != null) {\n\t\t\t\twriteDotRecursive(root, output);\n\t\t\t}\n\t\t\t// Close the graph\n\t\t\toutput.println(\"}\");\n\t\t\toutput.close();\n\t\t}\n\t\tcatch(Exception e){e.printStackTrace();\n\t\t}\n\t}", "@Override\n public boolean save(String file) {\n boolean ans = false;\n ObjectOutputStream oos;\n try {\n FileOutputStream fileOut = new FileOutputStream(file, true);\n oos = new ObjectOutputStream(fileOut);\n oos.writeObject(this);\n ans= true;\n }\n catch (FileNotFoundException e) {\n e.printStackTrace(); }\n catch (IOException e) {e.printStackTrace();}\n return ans;\n }", "public void Save() {\n try {\n ObjectOutputStream objUt = new ObjectOutputStream(\n new FileOutputStream(\"sparfil.txt\"));\n objUt.writeObject(this);\n } catch(Exception e) {\n System.out.println(e);}\n }", "protected void saveTreeSelection() {\n selections = tree.getSelectionPaths();\n leadSelection = tree.getLeadSelectionPath();\n _spTree.setIgnoreSelection(true);\n tree.clearSelection();\n _spTree.setIgnoreSelection(false);\n }", "private void writeToFile() {\n try {\n FileOutputStream fos = new FileOutputStream(f);\n String toWrite = myJSON.toString(4);\n byte[] b = toWrite.getBytes();\n fos.write(b);\n fos.close();\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "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 }" ]
[ "0.79049844", "0.7726581", "0.7363603", "0.7152008", "0.6981818", "0.6805854", "0.66211295", "0.65460956", "0.6503389", "0.64902663", "0.642824", "0.6399494", "0.6309287", "0.62664175", "0.6248563", "0.6242364", "0.6038461", "0.60299736", "0.6019368", "0.59962636", "0.59928566", "0.59858817", "0.59746164", "0.59661865", "0.5927197", "0.5899557", "0.5864788", "0.57903886", "0.57864237", "0.5777765", "0.5761263", "0.575969", "0.57542825", "0.575122", "0.5749527", "0.57386243", "0.5735473", "0.57265407", "0.57199866", "0.569875", "0.5696669", "0.5684416", "0.567916", "0.5678063", "0.5672103", "0.56684524", "0.5653583", "0.56458986", "0.56339365", "0.563213", "0.563213", "0.563213", "0.562076", "0.56142825", "0.5608242", "0.5594564", "0.55848366", "0.55776465", "0.5565076", "0.55572605", "0.55474913", "0.5542958", "0.5530336", "0.55191875", "0.55177164", "0.5503574", "0.5502775", "0.5496979", "0.54966813", "0.54870737", "0.54745775", "0.5461156", "0.54610914", "0.5450996", "0.54489315", "0.5447228", "0.54342204", "0.5434103", "0.54240745", "0.54214174", "0.5414361", "0.54136616", "0.5407832", "0.539969", "0.53985447", "0.5396544", "0.53791946", "0.53774667", "0.5374752", "0.53621703", "0.53594047", "0.5350481", "0.5346924", "0.5344424", "0.53437966", "0.53420806", "0.5335328", "0.53316265", "0.5331284", "0.53277755" ]
0.7161307
3
Load a tree from a file.
public static Tree loadTree(String inFile) { if (inFile == null) throw new NullPointerException("inFile: null"); TreeBuilder tb = TreeBuilder.loadTree(inFile); return tb == null ? null : new Tree(tb); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static DecisionTree loadTree(File file) throws FileNotFoundException {\r\n\t\tScanner scan = new Scanner(file); // Read from file\r\n\t\t// First line of file is question at root node\r\n\t\tDecisionTree dt = new DecisionTree(scan.nextLine());\r\n\t\tBinaryNode<String> root = dt.getRootNode();\r\n\t\tfillTree(Branch.LEFT, scan, root); // Fill left subtree using Scanner\r\n\t\tfillTree(Branch.RIGHT, scan, root); // Fill right subtree using Scanner\r\n\t\tscan.close(); // Close the file loaded from\r\n\t\treturn dt;\r\n\t}", "public static DecisionTree loadTree(String filename) throws FileNotFoundException {\r\n\r\n\t\treturn loadTree(new File(filename));\r\n\t}", "@SuppressFBWarnings({\"NP_NULL_PARAM_DEREF\", \"DM_DEFAULT_ENCODING\", \"NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE\"})\n public Tree getTreeFromFile(String path) {\n FileInputStream fileInputStream = null;\n try {\n fileInputStream = new FileInputStream(path);\n } catch (FileNotFoundException e) {\n \n }\n\n BufferedReader r = new BufferedReader(new InputStreamReader(fileInputStream));\n TreeParser tp = new TreeParser(r);\n\n String f = Paths.get(path).getFileName().toString();\n return tp.tokenize(f);\n }", "void load(File file);", "public int loadFile(File file)\r\n {\r\n try \r\n {\r\n ObjectInputStream src = new ObjectInputStream(new FileInputStream(file));\r\n root = (Person)src.readObject();\r\n return 0;\r\n } \r\n catch (FileNotFoundException ex) \r\n {\r\n System.out.println(\"A file related error has occurred while loading file: \" + ex);\r\n return 1;\r\n } \r\n catch (IOException | ClassNotFoundException ex) \r\n {\r\n System.out.println(\"A file related error has occurred while loading file: \" + ex);\r\n return 1;\r\n }\r\n }", "public static ArrayList<Tree> readTreesFromFile(File file) {\n \n ArrayList<Tree> trees = new ArrayList<Tree>();\n \n BufferedReader br = null;\n \n try {\n \n br = new BufferedReader(new FileReader(file));\n \n String line;\n \n while ((line = br.readLine()) != null) {\n \n if (!line.contains(\"(\")) {\n continue;\n }\n \n Tree auxTree = new Tree(line);\n trees.add(auxTree);\n }\n \n br.close();\n \n } catch (FileNotFoundException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n \n return trees;\n }", "public void load (File file) throws Exception;", "public void load(String filename) {\n\t\tsetup();\n\t\tparseOBJ(getBufferedReader(filename));\n\t}", "public Graph load(String filename) throws IOException\n {\n return load(filename, new SparseGraph(), null);\n }", "Graph<V,E> load(String filename);", "public void load()\r\n {\r\n \tfc.setAcceptAllFileFilterUsed(false);\r\n\t\tfc.setDialogTitle(\"Select the text file representing your organism!\");\r\n\t\tfc.setFileFilter(new FileNameExtensionFilter(\"Text Files (Organism)\", new String[]{\"txt\"}));\r\n\t\tif(fc.showOpenDialog(this)==JFileChooser.APPROVE_OPTION)\r\n\t\t\t//Try-Catch Block\r\n\t\t\ttry\r\n\t\t\t{\r\n\t\t\t\tbr=new BufferedReader(new FileReader(fc.getSelectedFile()));\r\n\t\t\t\tArrayList<Organism> treeTemp=new ArrayList<Organism>();\r\n\t\t \tString line=br.readLine();\r\n\t\t \tint x=0;\r\n\t\t \twhile(line!=null)\r\n\t\t \t{\r\n\t\t \t\t\tString[] genesSt=line.split(\" \");\r\n\t\t \t\t\tint[] genes=new int[genesSt.length];\r\n\t\t \t\t\tfor(int y=0; y<genesSt.length; y++)\r\n\t\t \t\t\t\tgenes[y]=Integer.parseInt(genesSt[y]);\r\n\t\t \t\t\t\t\r\n\t\t \t\t\ttreeTemp.add(new Organism(genes,x));\r\n\t\t \t\tline=br.readLine();\r\n\t\t \t\tx++;\r\n\t\t \t}\r\n\t\t \tbr.close();\r\n\t\t \te.setTree(treeTemp);\r\n\t\t \te.setParent(treeTemp.get(treeTemp.size()-1));\r\n\t\t\t\trepaint();\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\tcatch(Exception ex)\r\n\t\t\t{\r\n\t\t\t\tex.printStackTrace();\r\n\t\t\t}\r\n }", "abstract public Node load();", "private void loadFromFile() {\n try {\n FileInputStream fis = openFileInput(FILENAME);\n BufferedReader in = new BufferedReader(new InputStreamReader(fis));\n\n Gson gson = new Gson();\n Type listType = new TypeToken<ArrayList<Sub>>(){}.getType();\n subList = gson.fromJson(in, listType);\n\n } catch (FileNotFoundException e) {\n subList = new ArrayList<Sub>();\n }\n }", "public void loadFile(File p_file) throws IOException;", "public final void readFile(final String filePath, final boolean printTree)\r\n {\r\n setNumberOfPivotalElements(0);\r\n clearFullTree();\r\n\r\n taggedDataListArray = new TaggedDataList[stdef.MAX_NUMBER_OF_PARTS];\r\n temporaryTaggedDataList = new TaggedDataList(stdef.MAX_NUMBER_OF_PARTS);\r\n pivotalElementName = new String[stdef.MAX_NUMBER_OF_PARTS];\r\n\r\n setPrintFullTree(printTree);\r\n loadData(filePath);\r\n }", "public void load(File source);", "private void loadFromDisk(String filename) throws IOException {\n Reader r = new FileReader(filename);\r\n load(r);\r\n }", "public static BST readProfiles(String filename)\n\t{\n\t\t\n\t\t// Opening file.\n\t\tFile inputFile=new File(PATH + filename);\n\t\t\n\t\t// create a Scanner to read from file\n\t\tScanner in=FileReader.createScanner(inputFile);\n\t\t\t\n\t\t// call readDataFile, which will construct a tree for us\n\t\treturn FileReader.readDataFile(in);\n\t}", "public void\tload(String fileName) throws IOException;", "public boolean load(String file);", "public Graph load(String filename, Graph g) throws IOException\n {\n return load(filename, g, null);\n }", "public void load (String fileName) throws IOException {\n\t\tBufferedReader in = new BufferedReader\n\t\t\t(new InputStreamReader\n\t\t\t (new FileInputStream(fileName), JetTest.encoding));\n\t\tannotator.readTagTable(in);\n\t\tmene.load(in);\n\t}", "@Override\n\tpublic boolean load(String file) {\n\t\ttry {\n GsonBuilder builder=new GsonBuilder();\n builder.registerTypeAdapter(DWGraph_DS.class,new DWG_JsonDeserializer());\n Gson gson=builder.create();\n\n FileReader reader=new FileReader(file);\n directed_weighted_graph dwg=gson.fromJson(reader,DWGraph_DS.class);\n this.init(dwg);\n }\n catch (FileNotFoundException e){\n e.printStackTrace();\n return false;\n }\n return true;\n }", "public static DSAGraph load(String filename) throws IllegalArgumentException\n {\n FileInputStream fileStrm;\n ObjectInputStream objStrm;\n DSAGraph inObj = null;\n try\n {\n fileStrm = new FileInputStream(filename);//Underlying stream\n objStrm = new ObjectInputStream(fileStrm);//Object serialization stream\n inObj = (DSAGraph)objStrm.readObject();//Deserialize.\n objStrm.close();//Clean up\n }\n catch (ClassNotFoundException e)\n {\n System.out.println(\"Class not found: \" + e);\n }\n catch (Exception e)\n {\n throw new IllegalArgumentException(\"Unable to load object from file: \" + e.getMessage());\n }\n return inObj;\n\n }", "default void load(String file) {\n load(new File(file));\n }", "public static Object loadObject(File file) throws XmlParseException, IOException\n {\n return objectFromXmlElement(Xmlwise.loadXml(file));\n }", "public void load (IFile file) throws Exception;", "public TreeItem(String file) throws DataFormatException, FileNotFoundException, IOException {\n\t\tsuper(file);\n\t}", "private void openTreeML()\r\n {\r\n// // Create the file filter.\r\n// SimpleFileFilter[] filters = new SimpleFileFilter[] {\r\n// new SimpleFileFilter(\"xml\", \"Tree ML (*.xml)\")\r\n// };\r\n// \r\n// // Open the file.\r\n// String file = openFileChooser(true, filters);\r\n// \r\n// // Process the file. \r\n// if (file != null)\r\n// {\r\n// m_gtree = Loader.loadTreeML(file);\r\n// TreeDisplay disp = new TreeDisplay(m_gtree,0);\r\n// TreePanel panel = new TreePanel(disp, LEGEND, ORIENTATION_CONTROL_WIDGET);\r\n// m_tabbedPane.setComponentAt(1, panel);\r\n// }\r\n }", "public void LoadMaze(File file) {\r\n try {\r\n ObjectInputStream in = new ObjectInputStream(new FileInputStream(file));\r\n Maze m = (Maze) in.readObject();\r\n PlayerPositionRow = (int) in.readObject();\r\n PlayerPositionCol = (int) in.readObject();\r\n maze = new Maze(m.Struct);\r\n maze.setStartPotision( new Position(PlayerPositionRow, PlayerPositionCol));\r\n maze.setGoalPosition(new Position(m.getGoalPosition().getRowIndex(), m.getGoalPosition().getColIndex()));\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n } catch (ClassNotFoundException e) {\r\n e.printStackTrace();\r\n }\r\n setChanged();\r\n notifyObservers(\"load\");\r\n }", "public BrickStructure loadStructureFromBinaryFile(File file) {\n\t\tthrow new NullPointerException();\n\t}", "public static void load(File file) throws IOException {\n while (LogicManager.isUpdating()) {} // wait until current update has finished\n\n LogicManager.setPaused(true);\n\n // clear current scene\n GridManager.clearScene();\n\n // open input stream\n ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(new FileInputStream(file)));\n\n try {\n // load viewport data\n Point viewport = (Point) in.readObject();\n int scaling = (Integer) in.readObject();\n Window.getCurrentInstance()\n .getGameDisplay()\n .setViewport(viewport);\n Window.getCurrentInstance()\n .getGameDisplay()\n .setScaling(scaling);\n SwingUtilities.invokeLater(() -> {\n Window.getCurrentInstance()\n .getGameDisplay()\n .revalidate();\n Window.getCurrentInstance()\n .getGameDisplay()\n .repaint();\n });\n\n // load point data\n Point[] data;\n data = (Point[]) in.readObject();\n GridManager.loadScene(data);\n } catch (ClassNotFoundException e) {\n in.close();\n throw new IOException(\"File contains illegal data\");\n }\n in.close();\n }", "public void loadFromFile(String file) throws IOException {\n loadFromFile(file,DEFAULT_CHAR_SET);\n }", "public TreeNode deserialize(String data) {\n return build(new Scanner(data));\n }", "public static LevelPack fromFile(String filename) {\n\t\tString json = Serializer.readStringFromFile(filename);\n\t\tLevelPack lp = fromJson(json);\n\t\tstandardize(lp);\n\t\treturn lp;\n\t}", "public TreeNode readTrainingFile() {\n\t\t// first, read the training data into some storage location\n\t\ttry {\n\t\t\tScanner s = new Scanner(new File(trainingFile));\n\t\t\t// took these lines from helper-code\n\t\t classifierNames = new ArrayList<String>();\n\t\t for (Scanner l = new Scanner(s.nextLine()); l.hasNext();) {\n\t\t \tclassifierNames.add(l.next());\n\t\t }\n\t\t\tif (attributeNames.size() == 0) {\n\t\t\t\tScanner line = new Scanner(s.nextLine());\n\t\t\t\twhile (line.hasNext()) {\n\t\t\t\t\tattributeNames.add(line.next());\n\t\t\t\t}\n\t\t\t\tline.close();\n\t\t\t}\n\t\t\treadFile(s,instances);\n\t\t\ts.close();\n\t\t} catch (FileNotFoundException e) {\n\t\t\tSystem.err.println(\"Training file not found, you should have put tests for this in main.\");\n\t\t\tSystem.err.println(\"Attempted to read \"+trainingFile+\".\");\n\t\t\tSystem.exit(-1);\n\t\t}\n\t\tsetDefaultNode();\n\t\tArrayList<Boolean> ar = new ArrayList<Boolean>();\n\t\tfor (int i = 0; i < attributeNames.size(); i++) {\n\t\t\tar.add(false);\n\t\t}\n\t\treturn BuildTree(instances, ar);\n\t}", "@Override\n\tpublic Object load(String file) {\n\t\treturn null;\n\t}", "public static Monde loadContext(String filePath) throws IOException, ClassNotFoundException {\n\t\tFileInputStream fin = new FileInputStream(filePath);\n\t\tObjectInputStream ois = new ObjectInputStream(fin);\n\t\tMonde monde = (Monde) ois.readObject();\n\t\tois.close();\n\t\treturn monde;\n\t}", "private static BST readDataFile(Scanner in)\n\t{\n\t\tBST tree=new BST();\n\t\t\n\t\t//read the file line by line\n\t\twhile(in.hasNextLine())\n\t\t{\n\t\t\t// Scanner to read 1 line; closed before end of while loop\n\t\t\tString currentLine=in.nextLine();\n\t\t\tScanner line=new Scanner(currentLine);\n\t\t\t\n\t\t\t// makes the scanner separate the information in the line by \",\" and \";\"\n\t\t\tline.useDelimiter(\",|;\");\n\t\t\t\n\t\t\t// create a profile from the line and insert it into the tree\n\t\t\tProfile p=createProfile(line);\n\t\t\ttree.insertProfile(p);\t\n\t\t\t\t\t\n\t\t\tline.close();\n\t\t}\n\t\t\n\t\tin.close();\n\t\treturn tree;\n\t}", "public void load(String filename) throws IOException\n {\n DataInputStream input;\n\n try\n {\n input = new DataInputStream(new BufferedInputStream(new FileInputStream(new File(filename))));\n }\n catch (Exception e)\n {\n throw new IOException(\"Cannot open input file \" + filename + \":\" + e.getMessage());\n }\n load(input);\n input.close();\n }", "public static Object loadObject(String filename) throws XmlParseException, IOException\n {\n return loadObject(new File(filename));\n }", "@Override\n public boolean load(String file) {\n try {\n FileInputStream streamIn = new FileInputStream(file);\n ObjectInputStream objectinputstream = new ObjectInputStream(streamIn);\n WGraph_Algo readCase = (WGraph_Algo) objectinputstream.readObject();\n this.ga=null;//initialize the graph\n this.ga=readCase.ga;//take the graph from readCase to this.ga\n }\n catch(Exception e) {\n e.printStackTrace();\n }\n return false;\n }", "public static GameLevel load(Game game, String fileName)\n throws IOException{\n FileReader fr = null;\n BufferedReader reader = null;\n try {\n System.out.println(\"Reading \" + fileName + \" ...\");\n fr = new FileReader(fileName);\n reader = new BufferedReader(fr);\n String line = reader.readLine();\n String[] tokens = line.split(\",\");\n String name = tokens[0];\n int ballCount = Integer.parseInt(tokens[1]);\n\n GameLevel level = null;\n if (name.equals(\"Level1\"))\n level = new Level1(game);\n else if (name.equals(\"Level2\"))\n level = new Level2(game);\n else if (name.equals(\"Level3\"))\n level = new Level3(game);\n else if (name.equals(\"Level4\"))\n level = new Level4(game);\n\n level.getNaruto().setBallCount(ballCount);\n\n return level;\n\n } finally {\n if (reader != null) {\n reader.close();\n }\n if (fr != null) {\n fr.close();\n }\n }\n }", "private void loadFromXml(String fileName) throws IOException {\n\t\tElement root = new XmlReader().parse(Gdx.files.internal(fileName));\n\n\t\tthis.name = root.get(\"name\");\n\t\tGdx.app.log(\"Tactic\", \"Loading \" + this.name + \"...\");\n\n\t\tArray<Element> players = root.getChildrenByName(\"player\");\n\t\tint playerIndex = 0;\n\t\tfor (Element player : players) {\n\t\t\t//int shirt = player.getInt(\"shirt\"); // shirt number\n\t\t\t//Gdx.app.log(\"Tactic\", \"Location for player number \" + shirt);\n\n\t\t\t// regions\n\t\t\tArray<Element> regions = player.getChildrenByName(\"region\");\n\t\t\tfor (Element region : regions) {\n\t\t\t\tString regionName = region.get(\"name\"); // region name\n\n\t\t\t\tthis.locations[playerIndex][Location.valueOf(regionName).ordinal()] = new Vector2(region.getFloat(\"x\"), region.getFloat(\"y\"));\n\n\t\t\t\t//Gdx.app.log(\"Tactic\", locationId + \" read\");\n\t\t\t}\n\t\t\tplayerIndex++;\n\t\t}\t\n\t}", "public static Object load(File mazeFile) throws IOException, ClassNotFoundException {\n\n /* IO stuff */\n ObjectInputStream oi = new ObjectInputStream( new FileInputStream( mazeFile ) );\n\n Object instance = oi.readObject();\n\n oi.close();\n\n return instance;\n }", "void load(final File file) {\n this.file = Preconditions.checkNotNull(file);\n this.gameModelPo = gameModelPoDao.loadFromFile(file);\n visibleAreaService.setMapSize(getMapSize());\n initCache();\n }", "public void loadFile(File file1){\n\n\t\ttry{\n\t\t\tFileReader reader = new FileReader(file1);\n\t\t\tBufferedReader BR = new BufferedReader(reader);\n\n fname = file1.getName();\n pathname = file1.getParent();\n\n\t\t}\n\t\tcatch(IOException e){\n\t\t\tSystem.out.println(\"error\");\n\t\t}\n\n\n repaint();\n\n\t}", "private void loadData(final String filePath)\r\n {\r\n try\r\n {\r\n File fXMLFile = new File(filePath);\r\n DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();\r\n DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();\r\n Document doc = dBuilder.parse(fXMLFile);\r\n parseXMLDocument(doc);\r\n }\r\n catch (ParserConfigurationException ex)\r\n {\r\n System.err.println(\"\\t ParserConfigurationException caught at XMLReader.loadData\");\r\n ex.printStackTrace();\r\n }\r\n catch (SAXException ex)\r\n {\r\n System.err.println(\"\\t SAXException caught at XMLReader.loadData\");\r\n ex.printStackTrace();\r\n }\r\n catch (IOException ex)\r\n {\r\n System.err.println(\"\\t IOException caught at XMLReader.loadData\");\r\n ex.printStackTrace();\r\n }\r\n }", "public void load(File file) {\n Validate.notNull(file, \"File may not be null\");\n final FileInputStream stream;\n\n try {\n stream = new FileInputStream(file);\n } catch (FileNotFoundException ex) {\n throw new RuntimeException(ex);\n }\n\n load(stream);\n }", "private Parent loadHierarchy(String fxmlFilePath) {\n Parent p = null;\n try {\n URL url = new File(fxmlFilePath).toURI().toURL();\n FXMLLoader loader = new FXMLLoader();\n p = FXMLLoader.load(url);\n } catch (IOException e) {\n System.err.print(e + \" at \" + fxmlFilePath + \"\\n\\n\");\n quit();\n }\n return p;\n }", "public void loadFile(String fname) \n\t{\n\t\t// use Scanner used to read the file\n\t\ttry{\n\t\t\tScanner scan = new Scanner(new FileReader(fname));\n\t\t\t//read in number of row and column in the first line\n\t\t\treadRC(scan);\n\t\t\treadMaze(scan);\n\t\t\t//close the scanner\n\t\t\tscan.close();\t\t\t\t\t\t\t\t\n\t\t}catch(FileNotFoundException e){\n\t\t\tSystem.out.println(\"FileNotFound\"+e.getMessage());\n\t\t}\n\t}", "public void loadNodes() {\n\t\tif (taxonomyMap.size() == 0) this.loadNames();\n\n\t\tBufferedReader nodesRdr = null;\n\t\ttry {\n\t\t\tnodesRdr = new BufferedReader(new InputStreamReader(nodesUrl.openStream()));\n\n\t\t\tString line;\n\t\t\twhile ((line = nodesRdr.readLine()) != null) {\n\t\t\t\tString[] parts = line.split(\"\\\\|\");\n\t\t\t\tInteger taxonId = Integer.valueOf(parts[0].trim());\n\t\t\t\tString pti = parts[1].trim();\n\t\t\t\tInteger parentTaxonId = (pti.length() > 0 && !(pti.equals(\"all\"))) ? new Integer(pti) : null;\n\n\t\t\t\t// Get our Taxon object\n\t\t\t\tTaxon t = taxonomyMap.get(taxonId);\n\n\t\t\t\t// Get our parent Taxon\n\t\t\t\tTaxon p = taxonomyMap.get(parentTaxonId);\n\n\t\t\t\t// Set the parent\n\t\t\t\tt.setParent(p);\n\t\t\t}\n\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t\n\t\t} finally {\n\t\t\tthis.close(nodesRdr);\n\t\t}\n\t}", "public void load(String filename) throws IOException\n {\n FileInputStream input;\n\n try {\n input = new FileInputStream(new File(filename));\n }\n catch (Exception e)\n {\n throw new IOException(\"Cannot open input file \" + filename + \":\" + e.getMessage());\n }\n load(input);\n input.close();\n }", "public T loadConfig(File file) throws IOException;", "public void load() throws ClassNotFoundException, IOException;", "public void load() {\n\t\tif (!dbNode.isLogined()) {\n\t\t\treturn;\n\t\t}\n\n\t\tString tablesFolderId = dbNode.getId()\n\t\t\t\t+ CubridTablesFolderLoader.TABLES_FULL_FOLDER_SUFFIX_ID;\n\t\tfinal ICubridNode tablesFolder = dbNode.getChild(tablesFolderId);\n\t\tif (null == tablesFolder) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (tablesFolder.getChildren().size() < 1) {\n\t\t\tfinal TreeViewer tv = getTreeView();\n\t\t\tDisplay.getDefault().syncExec(new Runnable() {\n\t\t\t\tpublic void run() {\n\t\t\t\t\ttv.expandToLevel(tablesFolder, 1);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}", "public void load() ;", "public void readFromTxtFile(String filename){\n try{\n File graphFile = new File(filename); \n Scanner myReader = new Scanner(graphFile); \n parseFile(myReader);\n myReader.close();\n } \n catch(FileNotFoundException e){\n System.out.println(\"ERROR: DGraphEdges, readFromTxtFile: file not found.\");\n e.printStackTrace();\n } \n }", "public TreeDictionary(String path) {\n\n\t\tfor (int i = 0; i < nodes.length; i++) {\n\t\t\tnodes[i] = new TreeDictionary();\n\t\t}\n\n\t\ttry {\n\t\t\tBufferedReader br = new BufferedReader(new FileReader(path));\n\t\t\tString word = br.readLine();\n\n\t\t\twhile (word != null) {\n\n\t\t\t\tif (isValidWord(word)) {\n\t\t\t\t\tString signature = wordToSignature(word);\n\n\t\t\t\t\t// characterVal = converting the first character from the signature to an int\n\t\t\t\t\tint characterVal = Integer.parseInt(signature.substring(0, 1));\n\t\t\t\t\t// adding the corresponding characterVal to the tree\n\t\t\t\t\tnodes[characterVal - 2].addToNode(word.toLowerCase(), 1);\n\n\t\t\t\t}\n\t\t\t\tword = br.readLine();\n\t\t\t}\n\t\t\tbr.close();\n\t\t} catch (FileNotFoundException e) {\n\t\t\tSystem.out.println(\"Could not find file to open.\");\n\t\t} catch (IOException ex) {\n\t\t\tSystem.out.println(\"IOException\");\n\t\t}\n\t}", "public static Object loadObject(File file) throws Exception {\n FileInputStream fin = new FileInputStream(file);\n ObjectInputStream ois = new ObjectInputStream(fin);\n Object obj = ois.readObject();\n ois.close();\n return obj;\n }", "public TreeNode readDataFile() {\n\t\tdata = new ArrayList<Instance>();\n\t\ttry {\n\t\t\tScanner s = new Scanner(new File(testFile));\n\t\t\t// took these lines from helper-code\n\t\t\tScanner l = new Scanner(s.nextLine());\n\t\t\tfor (int i = 0; l.hasNext(); i++) {\n\t\t\t\tif (!l.next().equals(classifierNames.get(i))) {\n\t\t\t\t\tSystem.err.println(\"This data file does not use the same category names as the training file.\");\n\t\t\t\t\tSystem.exit(-1);\n\t\t\t\t}\n\t\t\t}\n\t\t\tl.close();\n\t\t\tl = new Scanner(s.nextLine());\n\t\t\tfor (int i = 0; l.hasNext(); i++) {\n\t\t\t\tif (!l.next().equals(attributeNames.get(i))) {\n\t\t\t\t\tSystem.err.println(\"This data file does not match the attributes of the training file.\");\n\t\t\t\t\tSystem.exit(-1);\n\t\t\t\t}\n\t\t\t}\n\t\t\tl.close();\n\t\t\tSystem.out.println(\"Read attributes \"+attributeNames.toString()+\".\");\n\t\t\treadFile(s,data);\n\t\t\ts.close();\n\t\t} catch (FileNotFoundException e) {\n\t\t\tSystem.err.println(\"Training file not found, you should have put tests for this in main.\");\n\t\t\tSystem.err.println(\"Attempted to read \"+testFile+\".\");\n\t\t\tSystem.exit(-1);\n\t\t}\n\t\tArrayList<Boolean> attrs = new ArrayList<Boolean>();\n\t\tfor (int i = 0; i < attributeNames.size(); i++) {\n\t\t\tattrs.add(false);\n\t\t}\n\t\tTreeNode root = BuildTree(instances, attrs);\n\t\treturn root;\n\t}", "public void loadWorkflow(String filename);", "public void load();", "public void load();", "public TreeNode deserialize(String data) {\n return preOrderFromString(data);\n }", "void load();", "void load();", "public TreeNode deserialize(String data) {\n int[] ptr = { 0 };\n return parse(data, ptr);\n }", "private void loadFromFile(String fileName) {\n try {\n InputStream inputStream = this.openFileInput(fileName);\n if (inputStream != null) {\n ObjectInputStream input = new ObjectInputStream(inputStream);\n boardManager = (BoardManager) input.readObject();\n inputStream.close();\n }\n } catch (FileNotFoundException e) {\n Log.e(\"login activity\", \"File not found: \" + e.toString());\n } catch (IOException e) {\n Log.e(\"login activity\", \"Can not read file: \" + e.toString());\n } catch (ClassNotFoundException e) {\n Log.e(\"login activity\", \"File contained unexpected data type: \" + e.toString());\n }\n }", "public void readFile(String name)\n\t{\n\t\tFileInputStream fis = null;\n\t\tObjectInputStream in = null;\n\t\ttry\n\t\t{\n\t\t\tfis = new FileInputStream(name);\n\t\t\tin = new ObjectInputStream(fis);\n\t\t\t// ind = (WebIndexer)in.readObject();\n\t\t\tTree xcd = (Tree)in.readObject();\n\t\t\tind = new WebIndexer(xcd);\n\t\t\tin.close();\n\t\t}\n\t\tcatch(IOException ex)\n\t\t{\n\t\t\tex.printStackTrace();\n\t\t}\n\t\tcatch(ClassNotFoundException ex)\n\t\t{\n\t\t\tex.printStackTrace();\n\t\t}\t\t\n\t}", "public static TreeBag<Golfer> loadDbFromFile(String dbFilename) \n {\n // used to store lines read from the database file\n String line;\n // create a new empty database\n TreeBag<Golfer> db = new TreeBag<Golfer>();\n // compile a regex pattern for parsing lines from the database file\n Pattern p = Pattern.compile(\"([\\\\w\\\\s-]+)(\\\\d+)\\\\s+(\\\\d+)\\\\s+(\\\\d+\\\\.?\\\\d*)\");\n // create file handle for the filename specified (in current directory)\n File f = new File(\".\"+ File.separator + dbFilename);\n\n // if the filename specified exists in the current directory,\n if (f.exists()) {\n System.out.println(\"\\nLoading golfers from database file '\"+ dbFilename +\"'...\");\n\n // try loading from the database file\n try {\n // create a new file reader using the file handle\n FileReader fr = new FileReader(f);\n // buffer the file reader\n BufferedReader buf = new BufferedReader(fr);\n\n // keep reading lines from the file buffer until we reach the end of file\n while ( (line = buf.readLine()) != null ) {\n // trim whitespace off the lines\n line = line.trim();\n //System.out.println(\"Read line:\\n\"+ line +\"\\n\");\n\n // create a matcher object using the pre-compiled regex pattern\n Matcher m = p.matcher(line);\n // if the matcher object found a match on the current line,\n if (m.find()) {\n // populate golfer data using match groups\n String name = m.group(1);\n int rounds = Integer.valueOf(m.group(2));\n int handicap = Integer.valueOf(m.group(3));\n double avg = Double.valueOf(m.group(4));\n // create a new golfer object\n Golfer g = new Golfer(name, rounds, handicap, avg);\n // add new golfer to the database\n db.add(g);\n /*\n System.out.println(\"Added golfer to database:\\n\"+ g +\"\\n\");\n System.out.println(\"Current database:\\n\"+ db);\n System.out.println(\"Tree view:\");\n db.displayAsTree();\n System.out.println(\"\\n\");\n */\n }\n }\n\n // at the end of the file, close the buffer\n buf.close();\n }\n // exception: specified file does not exist\n catch(FileNotFoundException e) {\n // print stack trace for debugging\n e.printStackTrace();\n System.out.println(\"File '\"+ dbFilename +\"' not found: \"+ e);\n }\n // exception: I/O error when reading from file\n catch(IOException e) {\n // print stack trace for debugging\n e.printStackTrace();\n System.out.println(\"Error reading file '\"+ dbFilename +\"': \"+ e);\n }\n }\n else\n System.out.println(\"Database file '\"+ dbFilename +\"' not found\");\n \n // return the newly compiled database\n return db;\n }", "public static ModelSet loadFromFile(File file)\n\t{\n\t\tif (!file.exists())\n\t\t{\n\t\t\tthrow new ModelException(\"Model file \" + file + \" does not exist.\");\n\t\t}\n\t\ttry\n\t\t{\n\t\t\treturn loadFromStream(new FileInputStream(file));\n\t\t}\n\t\tcatch (FileNotFoundException e)\n\t\t{\n\t\t\tthrow new ModelException(\"Model file \" + file + \" does not exist.\", e);\n\t\t}\n\t}", "public static void load(FileIO fileIO) \r\n\t{\n\t\t\r\n\t}", "public void load (String argFileName) throws IOException;", "private void readFromFile(String path) throws ClassNotFoundException {\n\t\ttry {\n\t\t\tInputStream file = new FileInputStream(path);\n\t\t\tInputStream buffer = new BufferedInputStream(file);\n\t\t\tObjectInput input = new ObjectInputStream(buffer);\n\n\t\t\ttagList = (HashMap<String, Integer>) input.readObject();\n\t\t\tinput.close();\n\t\t} catch (IOException ex) {\n\t\t\tSystem.out.println(\"Cannot read from input.\");\n\t\t}\n\t}", "public abstract void load() throws IOException;", "public void loadFile(File file) {\n\t\ttry {\n\t\t\tBufferedReader in = new BufferedReader(new FileReader(file));\n\t\t\t\n\t\t\t// read the column names\n\t\t\tList<String> first = stringToList(in.readLine());\n\t\t\tcolNames = first;\n\t\t\t\n\t\t\t// each line makes a row in the data model\n\t\t\tString line;\n\t\t\tdata = new ArrayList<List>();\n\t\t\twhile ((line = in.readLine()) != null) {\n\t\t\t\tdata.add(stringToList(line));\n\t\t\t}\n\t\t\t\n\t\t\tin.close();\n\t\t\t\n\t\t\t// Send notifications that the whole table is now different\n\t\t\tfireTableStructureChanged();\n\t\t}\n\t\tcatch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public TreeNode deserialize(String data) {\n return null;\n }", "public static Model loadGraph(String filename) throws FileNotFoundException, IOException {\r\n\t\tFileInputStream stream;\t\t\t//A stream from the file\r\n\t\tModel returnValue;\r\n\t\t\r\n\t\tSystem.out.print(\"Loading \\\"\" + filename + \"\\\"...\");\r\n\t\tstream = new FileInputStream(filename);\r\n\t\treturnValue = ModelFactory.createDefaultModel();\r\n\t\treturnValue.read(stream,null);\r\n\t\tstream.close();\r\n\t\tSystem.out.println(\" Done.\");\r\n\t\r\n\t\treturn returnValue;\r\n\t}", "public Graph loadFile(){\r\n String path = \"\";\r\n JFileChooser choix = new JFileChooser();\r\n choix.setAcceptAllFileFilterUsed(false);\r\n FileNameExtensionFilter filter = new FileNameExtensionFilter(\"Only xml files\", \"xml\");\r\n choix.addChoosableFileFilter(filter);\r\n if (choix.showOpenDialog(null) == JFileChooser.APPROVE_OPTION){\r\n path = choix.getSelectedFile().getAbsolutePath();\r\n }\r\n Graph g = new Graph();\r\n boolean quit = false;\r\n int max = 0;\r\n try{\r\n BufferedReader br = new BufferedReader(new FileReader(path));\r\n do {\r\n String line = br.readLine();\r\n if (line.indexOf(\"<node\") != -1){\r\n String[] node_xml = line.split(\"\\\"\");\r\n Node node = new Node(Integer.parseInt(node_xml[1]),(int)Double.parseDouble(node_xml[3]),(int)Double.parseDouble(node_xml[5]),TypeNode.valueOf(node_xml[7]));\r\n max = Math.max(max, node.getId());\r\n if (node.getType() == TypeNode.INCENDIE){\r\n node.kindleFire((int)Double.parseDouble(node_xml[9]));\r\n }\r\n g.getListNodes().add(node);\r\n }\r\n if (line.indexOf(\"<edge\") != -1){\r\n String[] edge_xml = line.split(\"\\\"\");\r\n Edge edge = new Edge(findNode(g,Integer.parseInt(edge_xml[1])),findNode(g,Integer.parseInt(edge_xml[3])),TypeEdge.valueOf(edge_xml[5]));\r\n g.getListEdges().add(edge);\r\n }\r\n if (line.startsWith(\"</osm>\")){\r\n quit = true;\r\n } \r\n Node.setNb_node(max+1);\r\n } while (!quit);\r\n } catch (FileNotFoundException e) {\r\n System.out.println(\"File not found : \"+e.getMessage());\r\n } catch (IOException e) {\r\n System.out.println(\"Listening file error : \"+e.getMessage());\r\n }\r\n return g;\r\n }", "private void loadWorld(String path) {\r\n StringBuilder builder = new StringBuilder();\r\n \r\n try {\r\n BufferedReader br = new BufferedReader(new FileReader(path));\r\n String line;\r\n while ((line = br.readLine()) != null) {\r\n builder.append(line + \"\\n\");\r\n }\r\n br.close();\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n \r\n String file = builder.toString();\r\n String[] tokens = file.split(\"\\\\s+\");\r\n width = Integer.parseInt(tokens[0]);\r\n height = Integer.parseInt(tokens[1]);\r\n spawnX = Integer.parseInt(tokens[2]);\r\n spawnY = Integer.parseInt(tokens[3]);\r\n winX = Integer.parseInt(tokens[4]);\r\n winY = Integer.parseInt(tokens[5]);\r\n \r\n tiles = new int[width][height];\r\n for (int y = 0;y < height;y++) {\r\n for (int x = 0;x < width;x++) {\r\n tiles[x][y] = Integer.parseInt(tokens[(x + y * width) + 6]);\r\n }\r\n }\r\n \r\n assert (tiles != null);\r\n }", "public TreeDictionary(String filename) {\n\t\tString entry;\n\t\ttry {\n\t\t\tBufferedReader in = new BufferedReader(new FileReader(filename));\n\t\t\twhile((entry=in.readLine())!=null){\n\t\t\t\tif(MapDictionary.isValidWord(entry)){\n\t\t\t\t\tString signature = wordToSignature(entry.toLowerCase());\n\t\t\t\t\tinsert(entry, signature);\n\t\t\t\t}\n\t\t\t\t\n\t\t}\n\t\t\tin.close();\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\tSystem.out.println(\"File not found\");\n\t\t}\n\t}", "private void loadOrRefreshXml(File file, boolean isLoad) throws Exception{\n\t\t\n\t // Remove the old content displayed\n \t\tthis.getXmlTextAreaPanel().removeAll();\n \t\t \n \t// The root node of the JTree. Is a special node that has no parent but can have childs \n \tDefaultMutableTreeNode base = new DefaultMutableTreeNode(\"XML Viewer\");\t \t\t \n\t DefaultTreeModel treeModel = new DefaultTreeModel(base);\n\t \t \n\t\txmlJTree = new JTree(treeModel);\n\t\txmlJTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);\n\t\txmlJTree.setAutoscrolls(true);\n\t\txmlJTree.setCellRenderer(new CustomCellRenderer());\n\t \t \n\t\t// Create the xml parser\n\t SAXParserFactory fact = SAXParserFactory.newInstance();\n\t\tSAXParser parser = fact.newSAXParser();\t \t\t\t\t\n\t\t\t\t \n\t\t// Set to the parser the handler (ie a class that extends the default event handler: DefaultHandler)\n\t\tFile f = new File(this.sourceXMLfileTextField.getText());\n\t\tparser.parse(file,new CustomSaxParseHandler(base,xmlJTree));\n\t\t\n\t\t// By default compact all the tree before show it\n\t\tint row = xmlJTree.getRowCount() - 1;\n\t // Note: use '2' as fix value to compact only the child and not the root\n\t while (row >= 2) {\n\t xmlJTree.collapseRow(row);\t \t \n\t row--;\n\t } \t\t\t\t \n\t\t\t \t\t\t \n\t\tthis.getXmlTextAreaPanel().add(xmlJTree);\n\t\t\t \n\t\t// Refresh (and redraw) the panel and show the tree view of the chosen XML file\n\t\tthis.revalidate();\n\t \t\n\t\tif(!isLoad) //only for refresh xml show a message\n\t\t{\n\t\t messageLabel.setForeground(Color.GREEN);\n\t\t messageLabel.setText(\"Input Reloaded successfully\");\n\t\t} \n\t}", "public void loadGraph2(String path) throws FileNotFoundException, IOException {\n\n\t\ttry (BufferedReader br = new BufferedReader(\n\n\t\t\t\tnew InputStreamReader(new FileInputStream(path), StandardCharsets.UTF_8), 1024 * 1024)) {\n\n\t\t\tString line;\n\n\t\t\twhile ((line = br.readLine()) != null) {\n\n\t\t\t\tif (line == null) // end of file\n\t\t\t\t\tbreak;\n\n\n\t\t\t\tint a = 0;\n\t\t\t\tint left = -1;\n\t\t\t\tint right = -1;\n\n\t\t\t\tfor (int pos = 0; pos < line.length(); pos++) {\n\t\t\t\t\tchar c = line.charAt(pos);\n\t\t\t\t\tif (c == ' ' || c == '\\t') {\n\t\t\t\t\t\tif (left == -1)\n\t\t\t\t\t\t\tleft = a;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tright = a;\n\n\t\t\t\t\t\ta = 0;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif (c < '0' || c > '9') {\n\t\t\t\t\t\tSystem.out.println(\"Erreur format ligne \");\n\t\t\t\t\t\tSystem.exit(1);\n\t\t\t\t\t}\n\t\t\t\t\ta = 10 * a + c - '0';\n\t\t\t\t}\n\t\t\t\tright = a;\n\t\t\n\t\t\t\t// s'assurer qu'on a toujours de la place dans le tableau\n\t\t\t\tif (adjVertices.length <= left || adjVertices.length <= right) {\n\t\t\t\t\tensureCapacity(Math.max(left, right) + 1);\n\t\t\t\t}\n\n\t\t\t\tif (adjVertices[left] == null) {\n\t\t\t\t\tadjVertices[left] = new Sommet(left);\n\t\t\t\t}\n\n\t\t\t\tif (adjVertices[right] == null) {\n\t\t\t\t\tadjVertices[right] = new Sommet(right);\n\t\t\t\t}\n\n\t\t\t\tif (adjVertices[left].listeAdjacence.contains(adjVertices[right])) {\n\t\t\t\t\tcontinue;\n\t\t\t\t} else {\n\t\t\t\t\tadjVertices[left].listeAdjacence.add(adjVertices[right]);\n\t\t\t\t\tadjVertices[right].listeAdjacence.add(adjVertices[left]);\n\t\t\t\t\tnombreArrete++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < adjVertices.length; i++) {\n\t\t\tif (adjVertices[i] == null)\n\t\t\t\tnombreTrous++;\n\t\t}\n\t\tnumberOfNode = adjVertices.length - nombreTrous;\n\t\tSystem.out.println(\"-----------------------------------------------------------------\");\n\t\tSystem.out.println(\"Loading graph done !\");\n\t\tSystem.out.println(\"-----------------------------------------------------------------\");\n\n\t\tSystem.out.println(\"nombreTrous \" + nombreTrous);\n\t\tSystem.out.println(\"numberOfNode \" + numberOfNode);\n\t\t\n\t}", "public boolean load(File testFile)\n {\n return levelIO.loadLevel(testFile, model);\n }", "private void deserializeFile(File file) {\n\t\ttry {\n\t\t\tFileInputStream fileinputStream = new FileInputStream(file); // stream to read file from\n\t\t\tObjectInputStream in = new ObjectInputStream(fileinputStream); // stream to read objects from, converted from file stream\n\n\t\t\t@SuppressWarnings(\"unchecked\") // not known for sure the type of the deserialized object\n\t\t\tList<Project> projects = (List<Project>) in.readObject();\n\t\t\tmyProjects = projects;\n\t\t\tpcs.firePropertyChange(\"Import All\", null, projects);\n\t\t\t\n\t\t\tin.close(); \n\t\t\tfileinputStream.close(); \n\t\t} catch (IOException | ClassNotFoundException e) {\n\t\t\tJOptionPane.showMessageDialog(null, \"Error: file could not be read.\");\n\t\t}\n\t}", "public Graph load(String filename, NumberEdgeValue nev) throws IOException\n {\n return load(filename, new SparseGraph(), nev);\n }", "private Program02(String fileName) {\n BinaryTree bt = new BinaryTree();\n Stack expression = new Stack();\n\n try {\n Scanner scanner = new Scanner(new File(fileName));\n\n while (scanner.hasNext()) {\n String curChar = scanner.next();\n expression.push(curChar);\n }\n\n scanner.close();\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n\n Node tree = createLevelOrder(expression, bt.getRoot(), 0, expression.length());\n\n // construct a binary tree to store parsed math expression\n bt.setRoot(tree);\n printInfo(bt);\n }", "private void loadFile(){\n\tint returnVal = fileChooser.showOpenDialog(this);\n\n\tif (returnVal == JFileChooser.APPROVE_OPTION) {\n\t File file = fileChooser.getSelectedFile();\n\t SAXParserFactory spf = SAXParserFactory.newInstance();\n\t try {\n\t\tInputStream xmlInput = new FileInputStream(file);\n\t\tSAXParser saxParser = spf.newSAXParser();\n\t\tRoomXMLParser rxp = new RoomXMLParser();\n\t\tsaxParser.parse(xmlInput, rxp);\n\n\t\trooms = rxp.getRooms();\n\t\tnumPlayers = rxp.getPlayers();\n\t\tnumNPCs = rxp.getNPCs();\n\t\trevalidate();\n\t }\n\t catch(SAXException|ParserConfigurationException|IOException e){\n\t\te.printStackTrace();\n\t }\n\t}\n }", "public void loadProjectTree(Long id) {\n rootId = id;\n editResourceService.getResources(id, new AsyncCallback<List<VMResource>>() {\n @Override\n public void onFailure(Throwable caught) {\n SC.warn(caught.getMessage());\n }\n\n @Override\n public void onSuccess(List<VMResource> result) {\n if (rootId == id) {\n VMDirectory rootDir = new VMDirectory();\n rootDir.setId(rootId);\n rootDir.setName(\"/\");\n fileTreeNodeFactory.setRootDirectory(rootDir);\n }\n TreeNode[] nodes = fileTreeNodeFactory.getFileTreeNodes(id, result);\n tree = new Tree();\n tree.setDefaultIsFolder(true);\n tree.setShowRoot(true);\n tree.setModelType(TreeModelType.CHILDREN);\n tree.setNameProperty(\"fullName\");\n tree.setData(nodes);\n treeGrid.setData(tree);\n treeGrid.sort();\n }\n });\n }", "public TreeNode deserialize(String data) {\n return deserialize(data, new int[]{0});\n }", "public static void loadStudRecsFromFile(File file) {\r\n\t\ttry {\r\n\t\t\tJAXBContext context = JAXBContext\r\n\t\t\t\t\t.newInstance(StudRecsWrapper.class);\r\n\t\t\tUnmarshaller um = context.createUnmarshaller();\r\n\t\t\t\r\n\t\t\tStudRecsWrapper wrapper = (StudRecsWrapper) um.unmarshal(file);\r\n\t\t\t\r\n\t\t\tstudRecs.clear();\r\n\t\t\tstudRecs.addAll(wrapper.getStudRecs());\r\n\t\t\tSystem.out.println(\"File loaded!\");\r\n\t\t} catch (Exception e) {\r\n\t\t\tSystem.out.println(\"Cannot load file, does it exist?\");\r\n\t\t}\r\n\t}", "public void load(String filePath){\r\n File loadFile = new File(filePath);\r\n if (!loadFile.exists()){\r\n System.out.println(\"I failed. There are no saved games.\");\r\n return;\r\n }\r\n FileInputStream fis = null;\r\n ObjectInputStream in = null;\r\n try {\r\n fis = new FileInputStream(filePath);\r\n in = new ObjectInputStream(fis);\r\n long versionUID = (long) in.readObject();\r\n if (versionUID != this.serialVersionUID) {\r\n throw new UnsupportedClassVersionError(\"Version mismatch for save game!\");\r\n }\r\n this.p = (Character) in.readObject();\r\n this.map = (SpecialRoom[][]) in.readObject();\r\n\r\n } catch (FileNotFoundException ex){\r\n System.out.println(\"The saved game was not found!\");\r\n ex.printStackTrace();\r\n } catch (IOException ex) {\r\n System.out.println(\"There was an error reading your save game :(\");\r\n ex.printStackTrace();\r\n System.out.println(\")\");\r\n } catch (ClassNotFoundException ex) {\r\n System.out.println(\"The version of the save game is not compatible with this game!\");\r\n ex.printStackTrace();\r\n } catch (UnsupportedClassVersionError ex) {\r\n System.out.println(ex.getMessage());\r\n ex.printStackTrace();\r\n } catch (Exception ex) {\r\n System.out.println(\"An unknown error occurred!\");\r\n }\r\n\r\n }", "public void showTree(IGPProgram a_prog, String a_filename)\n throws InvalidConfigurationException {\n if (a_prog == null) {\n return;\n }\n TreeNode myTree = createTree(a_prog);\n if (myTree == null) {\n return;\n }\n TreeVisualizer tv = new TreeVisualizer();\n tv.setTreeBranchRenderer(new JGAPTreeBranchRenderer());\n tv.setTreeNodeRenderer(new JGAPTreeNodeRenderer());\n tv.setBranchStartWidth(18.0);\n tv.setArenaColor(Color.black);\n tv.setBkgndColor(Color.black);\n tv.setRenderNodes(true);\n tv.setSide(1024);\n tv.setCircleDiminishFactor(0.5);\n tv.writeImageFile(tv.renderTree(myTree), new File(a_filename));\n }", "public static Object load(String fileName) throws Exception {\r\n\t\ttry (ObjectInputStream in = new ObjectInputStream( Files.newInputStream(Paths.get(fileName)) )) {\r\n\t\t\treturn in.readObject();\r\n\t }\r\n\t}", "private SgfReader load(File file)\n {\n \tFileInputStream in;\n \ttry {\n \t in = new FileInputStream(file);\n \t}\n \tcatch(FileNotFoundException e) {\n \t showError(\"File not found!\");\n \t return null;\n \t}\n \n \tSgfReader sgf;\n \ttry {\n \t sgf = new SgfReader(in);\n \t}\n \tcatch (SgfReader.SgfError e) {\n \t showError(\"Error reading SGF file:\\n \\\"\" + e.getMessage() + \"\\\"\");\n \t return null;\n \t}\n \t\n \treturn sgf;\n }", "private void setUp(String file) {\n unorderedList = new LinkedList<>();\n orderedList = new SortedLinkedList<>();\n\n try {\n input = new Scanner(new BufferedReader(new FileReader(file)));\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n }", "public static void loadGraph_File(String filename) {\n // Graph aus Datei laden\n Application.graph = null;\n double time_graph = System.currentTimeMillis();\n filename = filename + \".DAT\";\n Application.println(\"============================================================\");\n Application.println(\"Fetching Data from \" + filename + \" and building graph\");\n try {\n FileInputStream fis = new FileInputStream(filename);\n ObjectInputStream obj_in = new ObjectInputStream(fis);\n Object obj = obj_in.readObject();\n if (obj instanceof NavGraph) {\n Application.graph = (NavGraph) obj;\n } else {\n throw new Exception(\"Saved Data != NavGraph\");\n }\n obj_in.close();\n fis.close();\n time_graph = (System.currentTimeMillis() - time_graph) / 1000;\n double time_init = System.currentTimeMillis();\n Application.println(\"Init Graph\");\n graph.initGraph();\n time_init = (System.currentTimeMillis() - time_init) / 1000;\n Application.println(\"Init Graph took \" + time_init + \" Secs\");\n Application.println(\"Fetching Data and building graph took: \" + time_graph + \"sec\");\n Application.println(\"============================================================\");\n } catch (Exception e) {\n Application.println(\"Error: \" + e.toString());\n }\n }", "public FileConfiguration loadConfiguration(File file);", "public TreeItem(String file, String encoding) throws DataFormatException, FileNotFoundException, IOException {\n\t\tsuper(file, encoding);\n\t}" ]
[ "0.7695734", "0.7525982", "0.72663635", "0.69762564", "0.6559921", "0.64634305", "0.6453183", "0.6371325", "0.63195574", "0.6309153", "0.6249276", "0.62193036", "0.6186765", "0.61075854", "0.6096798", "0.60933864", "0.6069449", "0.5928384", "0.5919075", "0.5860208", "0.5827137", "0.58243775", "0.5820645", "0.5807856", "0.5806832", "0.5806295", "0.57634884", "0.57607806", "0.57426375", "0.5734142", "0.56929314", "0.56854254", "0.5666794", "0.56639093", "0.56548405", "0.5632246", "0.5613757", "0.56112725", "0.5607608", "0.5606441", "0.56030387", "0.55951184", "0.55912256", "0.5570708", "0.5570357", "0.55661196", "0.5562733", "0.55297446", "0.55217975", "0.55200523", "0.5513449", "0.5512623", "0.5505826", "0.55036855", "0.55030036", "0.5480763", "0.5479787", "0.547882", "0.547439", "0.5473529", "0.54682237", "0.5466013", "0.54649496", "0.54649496", "0.54626673", "0.54530853", "0.54530853", "0.54471487", "0.5440459", "0.5432154", "0.5429338", "0.54266554", "0.54214776", "0.5418622", "0.5410189", "0.5404685", "0.5402513", "0.5399962", "0.5393194", "0.5384477", "0.538139", "0.5375034", "0.53747815", "0.5371578", "0.53696144", "0.53613734", "0.53554064", "0.5351181", "0.53493565", "0.5337428", "0.5328902", "0.5321711", "0.53213567", "0.53168815", "0.5310535", "0.5309067", "0.53058386", "0.52891773", "0.5285068", "0.5281678" ]
0.72693294
2
Implemented equality among trees. Not sure it will work.
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((tb == null) ? 0 : tb.hashCode()); return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean equal(Tree T) {\n if(T.count() != count()) {\n return false;\n } else {\n return equalNodes(root,T.root);\n }\n }", "@Override\r\n\tpublic boolean isEqual(Node node) {\n\t\treturn false;\r\n\t}", "public void equalsCheck() {\n System.out.println(\"\\nTesting TreeNode.equals with simple objects\");\n\n //Create two simple objects for testing\n TreeNode testOne = new TreeNode(new Data(\"Test\", 1) );\n TreeNode testTwo = new TreeNode(new Data(\"Test\", 1) );\n\n //Test that a simple object equals itself.\n assertTrue(testOne.equals(testOne));\n assertTrue(testTwo.equals(testTwo));\n\n // Create to objects simple that should be the same \n assertTrue(testOne.equals(testTwo));\n assertTrue(testTwo.equals(testOne));\n\n //-------------------------------------------------------\n\n System.out.println(\"Testing TreeNode.equals with complex objects\");\n \n //Complex node 1\n TreeNode child1One = new TreeNode(new Data(\"Child1\", 2));\n TreeNode child2One = new TreeNode(new Data(\"Child2\", 3));\n TreeNode child3One = new TreeNode(new Data(\"Child3\", 4));\n testOne.insert(child1One);\n testOne.insert(child2One);\n testOne.insert(child3One);\n\n TreeNode child12One = new TreeNode(new Data(\"Child2Child1\", 5) );\n child2One.insert(child12One);\n\n //Complex node 2\n TreeNode child1Two = new TreeNode(new Data(\"Child1\", 2));\n TreeNode child2Two = new TreeNode(new Data(\"Child2\", 3));\n TreeNode child3Two = new TreeNode(new Data(\"Child3\", 4));\n testTwo.insert(child1Two);\n testTwo.insert(child2Two);\n testTwo.insert(child3Two);\n\n TreeNode child12Two = new TreeNode(new Data(\"Child2Child1\", 5) );\n child2Two.insert(child12Two);\n\n //Test that a complex object equals itself.\n assertTrue(testOne.equals(testOne));\n assertTrue(testTwo.equals(testTwo));\n\n // Create to complex simple that should be the same\n assertTrue(testOne.equals(testTwo));\n assertTrue(testTwo.equals(testOne));\n\n\n // --------------------------------------\n System.out.println(\"Testing TreeNode.equals (not Equal) with complex objects\");\n\n child2One.getNodeData().setId(10);\n \n // Check that to not equal objects return false\n assertFalse(testOne.equals(testTwo));\n assertFalse(testTwo.equals(testOne));\n\n // Test that it return false with different parents\n child2One.getNodeData().setId(1);\n child12One.remove(child12One);\n\n\n // Check that to not equal objects return false\n assertFalse(testOne.equals(testTwo));\n assertFalse(testTwo.equals(testOne));\n\n\n }", "@Override\r\n\t\tpublic boolean isEqualNode(Node arg)\r\n\t\t\t{\n\t\t\t\treturn false;\r\n\t\t\t}", "boolean newequals(DataBT a, DataBT b) \n\t {\n\t \tSystem.out.println(\"!!\");\n\t \t\n\t /*1. both empty */\n\t if ((IBinTree)a instanceof MtBT && (IBinTree)b instanceof MtBT)\n\t return true;\n\t System.out.println(\"1 \" + a.data);\n\t \t \n\t /* 2. both non-empty -> compare them */\n\t if ( !((IBinTree)a instanceof MtBT) && !((IBinTree)b instanceof MtBT)) {\n\n\t \tboolean check = (a.data == b.data);\n\t\t System.out.println(\"1112\");\n\t\t \n\t\t if(a.left instanceof MtBT && b.left instanceof MtBT);else\n\t\t if((a.left instanceof MtBT) != (a.left instanceof MtBT))check = false;else\n\t \tif(!newequals((DataBT)a.left, (DataBT)b.left))check = false;\n\t\t \n\t\t \n\t\t System.out.println(\"1113\");\n\t\t \n\t\t \n\t\t if(a.right instanceof MtBT && b.right instanceof MtBT);else\n\t\t\t if((a.right instanceof MtBT) != (a.right instanceof MtBT))check = false;else\n\t\t if(!newequals((DataBT)a.right, (DataBT)b.right))check = false;\n\n\t\t System.out.println(\"112\");\n\n\t\t return (check);\n\t }\n\t System.out.println(\"2\");\n\t \n\t /* 3. one empty, one not -> false */\n\t if ( ((IBinTree)a instanceof MtBT) && (!((IBinTree)b instanceof MtBT))) {\n\t \treturn false;\n\t }\n\t System.out.println(\"3\");\n\t return false;\n\t }", "public boolean isEquals(BinaryTree<T> tree){\n //if both are empty, are equals\n if(this.isEmpty() && tree.isEmpty()){\n return true;\n \n //if this is empty (and the other not, because don't get the if before)\n //is false\n }else if(this.isEmpty()){\n return false;\n \n //if the content of both nodes are equals...\n }else if(this.content.equals(tree.content)){\n //check recursively their childs\n if(this.left.isEquals(tree.left) \n && this.right.isEquals(tree.right)){\n return false;\n }else{\n return true;\n }\n \n //if not one of the before ifs, aren't equals \n }else{\n return false;\n }\n }", "public boolean equals(AsNode other) {\n\t\treturn this.state.getHash() == other.state.getHash();\n\t}", "private boolean equals1(BinaryNode<AnyType> t, BinaryNode<AnyType> t1)\r\n\t{\r\n\t\tif(t==null && t1==null)\r\n\t\t\treturn true;\r\n\t\tif((t!=null && t1!=null)&&(t.element==t1.element))\r\n\t\t\treturn (equals1(t.left, t1.left)&& equals1(t.right, t1.right));\r\n\r\n\t\treturn false;\r\n\t}", "@Override\n public boolean equals(@Nullable Object object) {\n // TODO: Warning - this method won't work in the case the id fields are not set\n if (!(object instanceof XBENodeTree)) {\n return false;\n }\n\n XBENodeTree other = (XBENodeTree) object;\n return this.getId() == other.getId();\n }", "public boolean treeEquals(IntTree that) {\n\t\t// TODO\n return treeEquals(root, that.root);\n\t}", "@Override\n\tdefault boolean equivalentTo(Tree otherTree) {\n\t\tif (this == otherTree)\n\t\t\treturn true;\n\t\t\n\t\tif (otherTree == null || this.getKind() != otherTree.getKind() || this.hashCode() != otherTree.hashCode())\n\t\t\treturn false;\n\t\t\n\t\t\n\t\tCatchTree other = (CatchTree) otherTree;\n\t\t\n\t\tif (!Tree.equivalentTo(this.getBlock(), other.getBlock()))\n\t\t\treturn false;\n\t\t\n\t\tif (!Tree.equivalentTo(this.getParameter(), other.getParameter()))\n\t\t\treturn false;\n\t\t\n\t\tif (!Tree.equivalentTo(this.getType(), other.getType()))\n\t\t\treturn false;\n\t\t\n\t\treturn true;\n\t}", "@Override\r\n\t\tpublic boolean isSameNode(Node other)\r\n\t\t\t{\n\t\t\t\treturn false;\r\n\t\t\t}", "public boolean equals(Object other){\n if(other instanceof Node){\n return ((Node)other).getData().equals(this.data);\n } else {\n return false;\n }\n\n }", "@Test\n public void testEqualTo() {\n System.out.println(\"AbsolutePathNode - testEqualTo\");\n final AbsolutePathNode instance1 = new AbsolutePathNode();\n final AbsolutePathNode instance2 = new AbsolutePathNode();\n final TestNode testInstance = TestNode.instance;\n assertTrue(instance1.equalTo(instance2));\n assertFalse(instance1.equalTo(testInstance));\n }", "private static boolean areLeafsEquivalent(JavaTree leftNode, JavaTree rightNode) {\n if (leftNode instanceof IdentifierTree) {\n return Objects.equal(((IdentifierTree) leftNode).name(), ((IdentifierTree) rightNode).name());\n } else if (leftNode instanceof PrimitiveTypeTree) {\n return Objects.equal(((PrimitiveTypeTree) leftNode).keyword().text(), ((PrimitiveTypeTree) rightNode)\n .keyword().text());\n } else if (leftNode instanceof SyntaxToken) {\n return Objects.equal(((SyntaxToken) leftNode).text(), ((SyntaxToken) rightNode).text());\n } else if (leftNode.is(Tree.Kind.INFERED_TYPE)) {\n return rightNode.is(Tree.Kind.INFERED_TYPE);\n } else {\n throw new IllegalArgumentException();\n }\n }", "private Comparison checkEquality(SimpleNode node1, SimpleNode node2) {\n // Compare the classes.\n Comparison comparison = compareClasses(node1, node2);\n if (!comparison.isEqual()) {\n return comparison;\n }\n\n // Compare the values.\n comparison = compareValues(node1, node2);\n if (!comparison.isEqual()) {\n return comparison;\n }\n\n // Compare the images.\n comparison = compareImages(node1, node2);\n if (!comparison.isEqual()) {\n return comparison;\n }\n\n // Compare the children.\n return compareChildren(node1, node2);\n }", "@Override\r\n\tpublic boolean equals(Object obj) {\n\t\t\r\n\t\tif(obj instanceof BinaryTree) {\r\n\t\t\treturn deepEquals(this.getHead(), ((BinaryTree<T>) obj).getHead());\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "public boolean equals(Object object){\n\t\tif(!(object instanceof BinaryTree)){\n\t\t\tSystem.out.println(\"The object is not a BinaryTree\");\n\t\t\ttry {\n\t\t\t\tthrow new Exception();\n\t\t\t} catch (Exception e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\tBinaryTree tree = (BinaryTree) object;\n\t\tif((this.leftTree()==null) && tree.leftTree()==null){\n\t\t\treturn true;\n\t\t}\n\t\tif((this.leftTree()==null && tree.rightTree()!=null) || (this.rightTree()!=null &&tree.rightTree()==null)){\n\t\t\treturn false;\n\t\t}\n\t\tif(this.getElement().equals(tree.getElement()) && this.leftTree().equals(tree.leftTree()) && this.rightTree().equals(tree.rightTree())){\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\treturn false;\n\t}", "@Override\r\n\tpublic boolean equals(Object obj) {\n\t\tNode another = (Node) obj;\r\n\t\treturn (this.id == another.getId());\r\n\t}", "public boolean equals(Object o) {\n if (!super.equals(o)) return false;\n ASTSubtree that = (ASTSubtree)o;\n return this.getRootToken().equals(that.getRootToken());\n }", "Equality createEquality();", "public abstract boolean equals(Object other);", "private static boolean isSameTree(Node currentT1Node, Node currentT2Node) {\n\t\tif (currentT1Node != null && currentT2Node != null) {\n\t\t\tboolean isLeftSame = isSameTree(currentT1Node.leftChild, currentT2Node.leftChild);\n\t\t\tboolean isRightSame = isSameTree(currentT1Node.rightChild, currentT2Node.rightChild);\n\n\t\t\t// If either is false it means that the trees differ so we return immediately\n\t\t\tif (!isLeftSame || !isRightSame) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t// Otherwise we compare the nodes in the current value.\n\t\t\tif (currentT1Node.value == currentT2Node.value) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\t// If one current Tn node is null and the other isn't then the trees are not the same.\n\t\tif ((currentT1Node == null && currentT2Node != null) || (currentT1Node != null && currentT2Node == null)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true; // We have hit the bottom of both trees, both T1 and T2 are null therefore it still matches.\n\t}", "@Override\n public boolean equals(Object other) {\n return Arrays.equals(state, ((CannibalNode) other).state);\n }", "@Test\n public void testEquals() {\n Term t1 = structure(\"abc\", atom(\"a\"), atom(\"b\"), atom(\"c\"));\n Term t2 = structure(\"abc\", integerNumber(), decimalFraction(), variable());\n PredicateKey k1 = PredicateKey.createForTerm(t1);\n PredicateKey k2 = PredicateKey.createForTerm(t2);\n testEquals(k1, k2);\n }", "@Override\n\tpublic boolean equal() {\n\t\treturn false;\n\t}", "public static Comparison checkEquality(JexlNode first, JexlNode second) {\n if (first == second) {\n return Comparison.IS_EQUAL;\n } else if (first == null || second == null) {\n return Comparison.notEqual(\"One tree is null: \" + first + \" vs \" + second);\n } else {\n TreeEqualityVisitor visitor = new TreeEqualityVisitor();\n return (Comparison) first.jjtAccept(visitor, second);\n }\n }", "private Equals() {}", "@Override\n public boolean equals(Object obj) {\n Pair temp = (Pair) obj;\n if(left == temp.left && right == temp.right) {\n return true;\n } else {\n return false;\n }\n }", "@Override\n\tpublic boolean equals(Object obj) {\n\tif (this.id == ((Node<?>) obj).getId()) \n\t\t\treturn true;\n\t\treturn false;\n\t}", "public boolean isSameTree(BinaryTreeNode p, BinaryTreeNode q) {\n if (p == null && q == null)\n return true;\n\n if (p == null || q == null)\n return false;\n\n if (p.val != q.val) {\n return false;\n } else {\n return isSameTree(p.left, q.left) && isSameTree(p.right, q.right);\n }\n\n\n }", "public boolean isSameTree(TreeNode p, TreeNode q) {\n if (p==null&&q==null){\n return true;\n }else if (p==null||q==null){\n return false;\n }else {\n if (p.val!=q.val){\n return false;\n }\n return isSameTree(p.left,q.left)&&isSameTree(p.right,q.right);\n }\n }", "public abstract boolean equals(Object o);", "@Override\r\n public boolean equals(Object obj) {\n return this.name.equals(((Node) obj).name);\r\n }", "public static boolean isEqual(BinaryTree tree1, BinaryTree tree2) {\n\n if (tree1 == null) {\n return (tree2 == null);\n }\n if (tree2 == null) {\n return false;\n }\n if (tree1.rootData == tree2.rootData) {\n return isEqual(tree1.leftTree, tree2.leftTree) && isEqual(tree1.rightTree, tree2.rightTree);\n }\n return false;\n }", "@Override\n\tpublic boolean equals(Object other) {\n\t\tif (this == null || other == null) {\n\t\t\treturn false;\n\t\t}\n\t\tif (!(other instanceof TextNode)) {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif (!(this.toString().equals(other.toString()))) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "public boolean equalNodes(Node N, Node M) {\n if(N == null && M == null) return true;\n if((N == null && M != null)||(N != null && M == null)) return false;\n if(N.getData() != M.getData()) return false;\n if((!equalNodes(N.getRight(), M.getRight())|| (!equalNodes(N.getLeft(), M.getLeft())))) return false;\n\n return true;\n }", "@Override\n\tpublic abstract boolean equals(Object other);", "@Test\n public void Test7() {\n TreeNode t1 = new TreeNode(1);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode.connect(t2, null, t3);\n TreeNode.connect(t3, t1, null);\n TreeNode root = t2;\n\n TreeNode e1 = new TreeNode(1);\n TreeNode e2 = new TreeNode(2);\n TreeNode e3 = new TreeNode(3);\n TreeNode.connect(e1, null, e3);\n TreeNode.connect(e3, e2, null);\n TreeNode expected = e1;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "@Override\n public abstract boolean equals(Object other);", "@Override\n public abstract boolean equals(Object other);", "@Override\n public boolean equals(final Object obj) {\n if (obj == null) {\n return false;\n }\n if (getClass() != obj.getClass()) {\n return false;\n }\n return Objects.equals(this.name, ((Node) obj).name);\n }", "@Test\n public void baseCaseTriviallyIdenticalGraphsTest() {\n Event a1 = new Event(\"label1\");\n Event a2 = new Event(\"label1\");\n\n EventNode e1 = new EventNode(a1);\n EventNode e2 = new EventNode(a2);\n // If k exceeds the depth of the graph, if they are equivalent to max\n // existing depth then they are equal. Regardless of subsumption.\n testKEqual(e1, e2, 100);\n // A node should always be k-equivalent to itself.\n testKEqual(e1, e1, 100);\n }", "private boolean equalNodes(Node[] arr1, Node[] arr2) {\n // generic tests\n if (!Arrays.equals(arr1, arr2)) {\n return false;\n }\n\n if ((arr1 == null) || (arr1.length == 0)) {\n return true;\n }\n\n // compare paths from each node to root\n int i = 0;\n\n while ((i < arr1.length) && Arrays.equals(NodeOp.createPath(arr1[i], null), NodeOp.createPath(arr2[i], null))) {\n i++;\n }\n\n return i == arr1.length;\n }", "Expr equality() throws IOException {\n\t\tExpr e = rel();\t\t\t\t\t\t\t\t\t\t\t//\t\t\t equality ne rel | rel\n\t\twhile (look.tag == Tag.EQ || look.tag == Tag.NE) {\n\t\t\tToken tok = look;\n\t\t\tmove();\n\t\t\te = new Rel(tok, e, rel());\n\t\t}\n\t\treturn e;\n\t}", "public boolean equals(Object object)\n/* */ {\n/* 1350 */ if (!(object instanceof XMLElement)) {\n/* 1351 */ return false;\n/* */ }\n/* 1353 */ XMLElement rawElement = (XMLElement)object;\n/* */ \n/* 1355 */ if (!this.name.equals(rawElement.getLocalName())) {\n/* 1356 */ return false;\n/* */ }\n/* 1358 */ if (this.attributes.size() != rawElement.getAttributeCount()) {\n/* 1359 */ return false;\n/* */ }\n/* 1361 */ Enumeration<XMLAttribute> en = this.attributes.elements();\n/* 1362 */ while (en.hasMoreElements()) {\n/* 1363 */ XMLAttribute attr = (XMLAttribute)en.nextElement();\n/* */ \n/* 1365 */ if (!rawElement.hasAttribute(attr.getName())) {\n/* 1366 */ return false;\n/* */ }\n/* */ \n/* */ \n/* */ \n/* 1371 */ String value = rawElement.getString(attr.getName(), null);\n/* 1372 */ if (!attr.getValue().equals(value)) {\n/* 1373 */ return false;\n/* */ }\n/* */ }\n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* 1381 */ if (this.children.size() != rawElement.getChildCount()) {\n/* 1382 */ return false;\n/* */ }\n/* 1384 */ for (int i = 0; i < this.children.size(); i++) {\n/* 1385 */ XMLElement child1 = getChild(i);\n/* 1386 */ XMLElement child2 = rawElement.getChild(i);\n/* */ \n/* 1388 */ if (!child1.equals(child2)) {\n/* 1389 */ return false;\n/* */ }\n/* */ }\n/* 1392 */ return true;\n/* */ }", "public boolean isSameTree(TreeNode p, TreeNode q) {\n if (p == null && q == null) return true;\n if (p == null || q == null) return false;\n if (p.val != q.val) return false;\n return isSameTree(p.left, q.left) && isSameTree(p.right, q.right);\n }", "@Override\n\tpublic boolean equals(Object other)\n\t{\n\t\tif (!(other instanceof Graph))\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\t@SuppressWarnings(\"unchecked\")\n\t\tGraph<N, ET> otherGraph = (Graph<N, ET>) other;\n\t\tList<N> otherNodeList = otherGraph.getNodeList();\n\t\tint thisNodeSize = nodeList.size();\n\t\tif (thisNodeSize != otherNodeList.size())\n\t\t{\n\t\t\t//\t\t\tSystem.err.println(\"Not equal node count\");\n\t\t\treturn false;\n\t\t}\n\t\t// (potentially wasteful, but defensive copy)\n\t\totherNodeList = new ArrayList<N>(otherNodeList);\n\t\tif (otherNodeList.retainAll(nodeList))\n\t\t{\n\t\t\t// Some nodes are not identical\n\t\t\t//\t\t\tSystem.err.println(\"Not equal node list\");\n\t\t\t//\t\t\tSystem.err.println(nodeList);\n\t\t\t//\t\t\tSystem.err.println(otherNodeList);\n\t\t\treturn false;\n\t\t}\n\t\t// Here, the node lists are identical...\n\t\tList<ET> otherEdgeList = otherGraph.getEdgeList();\n\t\tint thisEdgeSize = edgeList.size();\n\t\tif (thisEdgeSize != otherEdgeList.size())\n\t\t{\n\t\t\t//\t\t\tSystem.err.println(\"Not equal edge count\");\n\t\t\treturn false;\n\t\t}\n\t\t// (potentially wasteful, but defensive copy)\n\t\totherEdgeList = new ArrayList<ET>(otherEdgeList);\n\t\tif (otherEdgeList.retainAll(edgeList))\n\t\t{\n\t\t\t// Other Graph contains extra edges\n\t\t\t//\t\t\tSystem.err.println(\"not equal edge retain\");\n\t\t\t//\t\t\tSystem.err.println(edgeList);\n\t\t\t//\t\t\tSystem.err.println(otherEdgeList);\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "@Test\n public void Test6() {\n TreeNode t1 = new TreeNode(1);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode.connect(t3, null, t1);\n TreeNode.connect(t1, t2, null);\n TreeNode root = t3;\n\n TreeNode e1 = new TreeNode(1);\n TreeNode e2 = new TreeNode(2);\n TreeNode e3 = new TreeNode(3);\n TreeNode.connect(e1, null, e3);\n TreeNode.connect(e3, e2, null);\n TreeNode expected = e1;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "@Override\n\t\tpublic boolean equals(Object other) {\n\t\t\treturn Arrays.equals(state, ((MazeNode) other).state);\n\t\t}", "@Test\n public void Test2() {\n TreeNode t1 = new TreeNode(1);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode t4 = new TreeNode(4);\n TreeNode t5 = new TreeNode(5);\n TreeNode.connect(t1, null, t4);\n TreeNode.connect(t4, null, t3);\n TreeNode.connect(t3, null, t2);\n TreeNode.connect(t2, null, t5);\n TreeNode root = t1;\n\n TreeNode e1 = new TreeNode(1);\n TreeNode e2 = new TreeNode(2);\n TreeNode e3 = new TreeNode(3);\n TreeNode e4 = new TreeNode(4);\n TreeNode e5 = new TreeNode(5);\n TreeNode.connect(e1, null, e2);\n TreeNode.connect(e2, null, e3);\n TreeNode.connect(e3, null, e4);\n TreeNode.connect(e4, null, e5);\n TreeNode expected = e1;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "@Test\n public void Test1() {\n TreeNode t1 = new TreeNode(5);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode t4 = new TreeNode(4);\n TreeNode t5 = new TreeNode(1);\n TreeNode.connect(t1, t2, null);\n TreeNode.connect(t2, t3, null);\n TreeNode.connect(t3, t4, null);\n TreeNode.connect(t4, t5, null);\n TreeNode root = t1;\n\n TreeNode e1 = new TreeNode(5);\n TreeNode e2 = new TreeNode(4);\n TreeNode e3 = new TreeNode(3);\n TreeNode e4 = new TreeNode(2);\n TreeNode e5 = new TreeNode(1);\n TreeNode.connect(e1, e2, null);\n TreeNode.connect(e2, e3, null);\n TreeNode.connect(e3, e4, null);\n TreeNode.connect(e4, e5, null);\n TreeNode expected = e1;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "public boolean isEqual(Expression other) {\n Expression left = super.getLeft();\n Expression right = super.getRight();\n\n if (other instanceof Mult) {\n return (((Mult) other).getLeft().toString().equals(left.toString())\n && ((Mult) other).getRight().toString().equals(right.toString()))\n || ((Mult) other).getLeft().toString().equals(right.toString())\n && ((Mult) other).getRight().toString().equals(left.toString());\n }\n\n return false;\n }", "public static void main(String[] args) {\n\t\tTreeNode first=new TreeNode(1);\n\t\tfirst.left=new TreeNode(2);\n\t\tfirst.right=new TreeNode(3);\n\t\t\n\t\tTreeNode second=new TreeNode(1);\n\t\tsecond.left=new TreeNode(2);\n\t\tsecond.right=new TreeNode(4);\n\t\tif(isSame(first, second)){\n\t\t\tSystem.out.println(\"Same Tree!\");\n\t\t}else{\n\t\t\tSystem.out.println(\"is Not Same Tree!\");\n\t\t}\n\n\t}", "@Override\n\tpublic boolean equals(Object obj) {\n\t\ttry {\n\t\t\tif (id == ((Node) obj).getId())\n\t\t\t\treturn true;\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t\treturn false;\n\t\t}\n\t\treturn false;\n\t}", "public boolean isSameTree(TreeNode p, TreeNode q) {\n \n if (p == null && q == null) return true;\n \n if (p == null || q == null) return false;\n \n return p.val == q.val && isSameTree(p.left, q.left) && isSameTree(p.right, q.right);\n }", "protected abstract boolean equalityTest(Object key, Object key2);", "@Test\n public void Test5() {\n TreeNode t1 = new TreeNode(1);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode.connect(t3, t1, t2);\n TreeNode root = t3;\n\n TreeNode e1 = new TreeNode(1);\n TreeNode e2 = new TreeNode(2);\n TreeNode e3 = new TreeNode(3);\n TreeNode.connect(e2, e1, e3);\n TreeNode expected = e2;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "public boolean equals(LinearNode<T> node) {\t\r\n\t\t\r\n\t\tboolean result = true; \r\n\r\n\t\tif (this.getElement() == node.getElement())\r\n\t\t\tresult = true;\r\n\t\telse\r\n\t\t\tresult = false;\r\n\t\t\r\n\t\treturn result;\r\n\t\r\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 }", "@Override\n public boolean equals(Object other) {\n return this == other;\n }", "@Test\n public void Test4() {\n TreeNode t1 = new TreeNode(1);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode t4 = new TreeNode(4);\n TreeNode t5 = new TreeNode(5);\n TreeNode.connect(t2, t3, t4);\n TreeNode.connect(t3, t1, null);\n TreeNode.connect(t4, null, t5);\n TreeNode root = t2;\n\n TreeNode e1 = new TreeNode(1);\n TreeNode e2 = new TreeNode(2);\n TreeNode e3 = new TreeNode(3);\n TreeNode e4 = new TreeNode(4);\n TreeNode e5 = new TreeNode(5);\n TreeNode.connect(e3, e2, e4);\n TreeNode.connect(e2, e1, null);\n TreeNode.connect(e4, null, e5);\n TreeNode expected = e3;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "protected abstract boolean isEqual(E entryA, E entryB);", "private boolean compare(TreeNode leftRoot, TreeNode rightRoot) {\n // Good shortcut\n //if(left==null || right==null) return left==right;\n if (leftRoot == null && rightRoot == null) return true;\n if (leftRoot == null || rightRoot == null) return false;\n if (leftRoot.val != rightRoot.val) return false;\n boolean isOutersEqual = compare(leftRoot.left, rightRoot.right);\n boolean isInnersEqual = compare(leftRoot.right, rightRoot.left);\n return isOutersEqual && isInnersEqual;\n }", "public final void testSameObjectEquals() {\n final Transaction copy = testTransaction1;\n assertTrue(testTransaction1.equals(copy)); // pmd doesn't like either\n // way\n\n }", "public boolean equals(XObject obj2){\n if(obj2.getType()==XObject.CLASS_NODESET)\n return obj2.equals(this);\n if(null!=m_obj){\n return m_obj.equals(obj2.m_obj);\n }else{\n return obj2.m_obj==null;\n }\n }", "@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 Object visitEqualityExpression(GNode n) {\n Object a, b, result;\n String op;\n boolean mydostring = dostring;\n \n nonboolean = true;\n \n dostring = true;\n \n a = dispatch(n.getGeneric(0));\n b = dispatch(n.getGeneric(2));\n op = n.getString(1);\n \n dostring = false;\n \n if (a instanceof Long && b instanceof Long) {\n if (op.equals(\"==\")) {\n result = ((Long) a).equals((Long) b);\n }\n else if (op.equals(\"!=\")) {\n result = ! ((Long) a).equals((Long) b);\n }\n else {\n result = \"\";\n }\n }\n else {\n String sa, sb;\n \n if (a instanceof String) {\n sa = (String) a;\n }\n else if (a instanceof Long) {\n sa = ((Long) a).toString();\n }\n else {\n return null;\n }\n \n if (b instanceof String) {\n sb = (String) b;\n }\n else if (b instanceof Long) {\n sb = ((Long) b).toString();\n }\n else {\n return null;\n }\n \n if (op.equals(\"==\") && sa.equals(sb)) {\n result = mydostring ? \"1\" : B.one();\n }\n else {\n result = parens(sa) + \" \" + op + \" \" + parens(sb);\n }\n }\n \n return result;\n }", "private static final boolean equal(Object a, Object b) {\n if (a == b)\n return true;\n if (a == null)\n return false;\n if (b == null)\n return false;\n return a.equals(b);\n }", "public boolean equals(XObject obj2) {\n/* */ try {\n/* 262 */ if (4 == obj2.getType())\n/* */ {\n/* */ \n/* */ \n/* */ \n/* */ \n/* 268 */ return obj2.equals(this);\n/* */ }\n/* 270 */ if (1 == obj2.getType())\n/* */ {\n/* 272 */ return (bool() == obj2.bool());\n/* */ }\n/* 274 */ if (2 == obj2.getType())\n/* */ {\n/* 276 */ return (num() == obj2.num());\n/* */ }\n/* 278 */ if (4 == obj2.getType())\n/* */ {\n/* 280 */ return xstr().equals(obj2.xstr());\n/* */ }\n/* 282 */ if (3 == obj2.getType())\n/* */ {\n/* 284 */ return xstr().equals(obj2.xstr());\n/* */ }\n/* 286 */ if (5 == obj2.getType())\n/* */ {\n/* */ \n/* */ \n/* 290 */ return xstr().equals(obj2.xstr());\n/* */ }\n/* */ \n/* */ \n/* 294 */ return super.equals(obj2);\n/* */ \n/* */ }\n/* 297 */ catch (TransformerException te) {\n/* */ \n/* 299 */ throw new WrappedRuntimeException(te);\n/* */ } \n/* */ }", "public boolean equals(Object obj)\n\t{\n\t\tif(obj == this)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\n\t\tif(getClass() != obj.getClass())\n\t\t{\n\t\t\treturn false;\n\t\t}\n\n\t\tNode node = (Node)obj;\n\n\t\treturn userObject == node.getUserObject();\n\t}", "boolean equalSubtrees(Object other) {\n if (!(other instanceof ForStatement)) {\n return false; }\n ForStatement o = (ForStatement) other;\n return \n (ASTNode.equalLists(initializers(), o.initializers())\n && ASTNode.equalNodes(getExpression(), o.getExpression())\n && ASTNode.equalLists(updaters(), o.updaters())\n && ASTNode.equalNodes(getBody(), o.getBody())); }", "public boolean mojeEquals(Obj o1, Obj o2) {\r\n\t\t//System.out.println(o1.getName() + \" \" + o2.getName());\r\n\t\tboolean sameRight = true; // 21.06.2020. provera prava pristupa\r\n\t\tboolean sameName = true;\t// 22.06.2020. ako nisu metode ne moraju da imaju isto ime\r\n\t\tboolean sameArrayType = true; //22.6.2020 ako je parametar niz mora isti tip niza da bude\r\n\t\t\r\n\t\tif (o1.getKind() == Obj.Meth && o2.getKind() == Obj.Meth) {\r\n\t\t\tsameRight = o1.getFpPos() == o2.getFpPos()+10; \r\n\t\t\tsameName = o1.getName().equals(o2.getName());\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif (o1.getType().getKind() == Struct.Array && o2.getType().getKind() == Struct.Array) {\r\n\t\t\t\tif (!(o1.getType().getElemType() == o2.getType().getElemType())) { // ZA KLASE MOZDA TREBA equals\r\n\t\t\t\t\tsameArrayType = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t// 16.08.2020.\r\n//\t\tif (o1.getType().getKind() == Struct.Class || o1.getType().getKind() == Struct.Interface)\r\n//\t\t\treturn true;\r\n\t\t\r\n\t\t\r\n\t\treturn o1.getKind() == o2.getKind() \r\n\t\t\t\t&& sameName\r\n\t\t\t\t&& o1.getType().equals(o2.getType())\r\n\t\t\t\t&& /*adr == other.adr*/ o1.getLevel() == o2.getLevel()\r\n\t\t\t\t&& equalsCompleteHash(o1.getLocalSymbols(), o2.getLocalSymbols())\r\n\t\t\t\t&& sameRight // 21.06.2020. provera prava pristupa\r\n\t\t\t\t&& sameArrayType; //22.6.2020 ako je parametar niz mora isti tip niza da bude\r\n\t}", "public boolean treeEquals(Object o) {\n return o != null && o instanceof DDataFilter &&\n DDataAttribute.equals(((DDataFilter) o).attribute, attribute) &&\n ((filters == null && ((DDataFilter) o).getFilters() == null) ||\n (filters != null && ((DDataFilter) o).getFilters() != null &&\n filters.stream().allMatch(f -> ((DDataFilter) o).getFilters().stream()\n .anyMatch(i -> i.equals(f)))));\n }", "@Override\n boolean equals(Object other);", "@Test\n public void equalsTest() {\n prepareEntitiesForEqualityTest();\n\n assertEquals(entity0, entity1);\n }", "public boolean haveSameKeys(Tree<K, V> otherTree) {\n\t\tif (this.size() != otherTree.size()) {\n\t\t\treturn false;\n\t\t} else {\n\t\t\tTree<K, V> t = this;\n\t\t\tboolean sameKey = true;\n\t\t\treturn haveSameKeys(t, otherTree, sameKey);\n\t\t}\n\t}", "@Override\n public abstract boolean equals(Object obj);", "@Test\n\tpublic void doEqualsTestDifferentMaps() {\n\t\tassertFalse(bigBidiMap.equals(leftChildMap));\n\n\t}", "public boolean equals(Node testNode) {\r\n\t\tif(this.getID().equals(testNode.getID())) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\telse {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "@Test\r\n\tpublic void testEquality(){\n\t\t assertEquals(object1, object2);\r\n\t}", "@Test\n public void Test3() {\n TreeNode t1 = new TreeNode(1);\n TreeNode t2 = new TreeNode(2);\n TreeNode t3 = new TreeNode(3);\n TreeNode t4 = new TreeNode(4);\n TreeNode t5 = new TreeNode(5);\n TreeNode.connect(t3, t4, t2);\n TreeNode.connect(t4, t1, null);\n TreeNode.connect(t2, null, t5);\n TreeNode root = t3;\n\n TreeNode e1 = new TreeNode(1);\n TreeNode e2 = new TreeNode(2);\n TreeNode e3 = new TreeNode(3);\n TreeNode e4 = new TreeNode(4);\n TreeNode e5 = new TreeNode(5);\n TreeNode.connect(e3, e2, e4);\n TreeNode.connect(e2, e1, null);\n TreeNode.connect(e4, null, e5);\n TreeNode expected = e3;\n\n solution.recoverTree(root);\n assertTrue(TreeNode.isSameTree(expected, root));\n }", "@Override\n public final boolean equals(final Object other) {\n return super.equals(other);\n }", "public static boolean IdenticalTrees(Node n1,Node n2) {\n\t\n\tif(n1!=null && n2!=null && n1.key==n2.key)\n\t{\n\t\treturn IdenticalTrees(n1.left, n2.left) && IdenticalTrees(n1.right, n2.right);\n\t}\n\t\n\tif(n1==null && n2==null)\n\t\treturn true;\n\treturn false;\n}", "@Override\n public abstract boolean equals(final Object o);", "@Override\n public abstract boolean equals(final Object o);", "@Override\n public boolean equals(\n Object object\n ){\n \tif(this == object) {\n \t\treturn true;\n \t}\n \tif(object instanceof Path) {\n \t\tPath that = (Path) object;\n \t\tif(this.size == that.size) {\n \t\t\tif(this.size == 0) {\n \t\t\t\treturn true;\n \t\t\t}\n \t\t\tif(this.base.equals(that.base)) {\n \t\t\t return \n \t\t\t this.parent == that.parent ||\n \t\t\t this.parent.equals(that.parent);\n \t\t\t}\n \t\t}\n \t}\n\t\treturn false;\n }", "@Test\n public void equalityForDifferentBinaryOps() {\n XPathStringLiteral leftStringExpr = new XPathStringLiteral(\"left side\");\n XPathNumericLiteral zero = new XPathNumericLiteral(0d);\n\n // Setup expressions to test equality over.\n // Note: these binary expressions make semantic sense\n XPathArithExpr additionExpr = new XPathArithExpr(XPathArithExpr.ADD, leftStringExpr, zero);\n XPathArithExpr additionExprClone = new XPathArithExpr(XPathArithExpr.ADD, leftStringExpr, zero);\n XPathArithExpr subtractExpr = new XPathArithExpr(XPathArithExpr.SUBTRACT, leftStringExpr, zero);\n\n XPathBoolExpr andExpr = new XPathBoolExpr(XPathBoolExpr.AND, leftStringExpr, zero);\n XPathBoolExpr andExprClone = new XPathBoolExpr(XPathBoolExpr.AND, leftStringExpr, zero);\n XPathBoolExpr orExpr = new XPathBoolExpr(XPathBoolExpr.OR, leftStringExpr, zero);\n\n XPathCmpExpr lessThanExpr = new XPathCmpExpr(XPathCmpExpr.LT, leftStringExpr, zero);\n XPathCmpExpr greaterThanExpr = new XPathCmpExpr(XPathCmpExpr.GT, leftStringExpr, zero);\n\n XPathEqExpr eqExpr = new XPathEqExpr(XPathEqExpr.EQ, leftStringExpr, zero);\n XPathEqExpr neqExpr = new XPathEqExpr(XPathEqExpr.NEQ, leftStringExpr, zero);\n\n XPathUnionExpr union = new XPathUnionExpr(leftStringExpr, zero);\n XPathUnionExpr differentUnion = new XPathUnionExpr(zero, zero);\n\n // basic equality tests over same subclass\n Assert.assertEquals(\"Same + expression reference is equal\", additionExpr, additionExpr);\n Assert.assertEquals(\"Same + expression is equal\", additionExpr, additionExprClone);\n Assert.assertNotEquals(\"+ not equal to -\", additionExpr, subtractExpr);\n Assert.assertEquals(\"Same && expression reference is equal\", andExpr, andExpr);\n Assert.assertEquals(\"Same && expression is equal\", andExpr, andExprClone);\n Assert.assertNotEquals(\"&& not equal to ||\", andExpr, orExpr);\n Assert.assertEquals(\"Same < expression is equal\", lessThanExpr, lessThanExpr);\n Assert.assertNotEquals(\"< not equal to >\", lessThanExpr, greaterThanExpr);\n Assert.assertEquals(\"Same == expression is equal\", eqExpr, eqExpr);\n Assert.assertNotEquals(\"== not equal to !=\", eqExpr, neqExpr);\n\n // make sure different binary expressions with same op code aren't equal\n Assert.assertNotEquals(\"+ not equal to &&\", additionExpr, andExpr);\n Assert.assertNotEquals(\"+ not equal to <\", additionExpr, lessThanExpr);\n Assert.assertNotEquals(\"+ not equal to ==\", additionExpr, eqExpr);\n Assert.assertNotEquals(\"- not equal to ||\", subtractExpr, orExpr);\n Assert.assertNotEquals(\"- not equal to >\", subtractExpr, greaterThanExpr);\n Assert.assertNotEquals(\"- not equal to !=\", subtractExpr, neqExpr);\n\n // make sure union equality, which doesn't have an op code, works\n Assert.assertEquals(\"same union instance is equal to itself\", union, union);\n Assert.assertNotEquals(union, differentUnion);\n Assert.assertNotEquals(\"+ not equal to union\", additionExpr, union);\n }", "public boolean isSameTree(TreeNode p, TreeNode q) {\n if (p == null && q == null) return true;\r\n\r\n // If only one of p and q is null, then they are not the same tree\r\n if (p == null || q == null) return false;\r\n\r\n // If the values of p and q are different, then they are not the same tree\r\n if (p.val != q.val) return false;\r\n\r\n // Recursively check the left and right subtrees of p and q\r\n // If both the left and right subtrees are the same, then p and q are the same tree\r\n return isSameTree(p.left, q.left) && isSameTree(p.right, q.right);\r\n }", "@Override\n public boolean equals(Object other) {\n if (other.getClass() == getClass()) {\n return hashCode() == other.hashCode();\n }\n\n return false;\n }", "@Override\n\tpublic Object visit(ASTEquality node, Object data)\n\t{\n\t\treturn visitOperatorNode(node, data);\n\t}", "public boolean equals(Object other) {\n return this == other\n || ((other instanceof ComponentNode) \n && (getUserObject() == ((ComponentNode)other).getUserObject()));\n }", "@Test\n public void testEqualsReturnsTrueOnSelfArg() {\n boolean equals = record.equals(record);\n\n assertThat(equals, is(true));\n }", "private boolean compareStructure1(BinaryNode<AnyType> t, BinaryNode<AnyType> t1)\r\n\t{\r\n\t\tif(t==null && t1==null)\r\n\t\t\treturn true;\r\n\t\tif(t!=null && t1!=null)\r\n\t\t\treturn (compareStructure1(t.left, t1.left)&& compareStructure1(t.right, t1.right));\r\n\t\treturn false;\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 }", "@Override\r\n public boolean equals(Object obj) {\r\n // check for null\r\n if (obj == null) {\r\n System.out.println(\"State.equals() null fail\");\r\n return false;\r\n }\r\n // check that these objects are both States\r\n if (getClass() != obj.getClass()) {\r\n System.out.println(\"State.equals() class fail\");\r\n return false;\r\n }\r\n // cast to State\r\n State other = (State) obj;\r\n // check if these have the same root stored\r\n if (!this.root.equals(other.root)) {\r\n System.out.println(\"State.equals() root fail\");\r\n return false;\r\n }\r\n // check if these have the same exit state\r\n if (this.getExit() != (other.getExit())) {\r\n System.out.println(\"State.equals() exit fail\");\r\n return false;\r\n }\r\n // check if these have the same directory stack\r\n if (!this.directoryStack.equals(other.directoryStack)) {\r\n System.out.println(\"State.equals() dirStack fail\");\r\n return false;\r\n }\r\n // check if these have the same working directory\r\n return this.getWorkingDirectory().equals(other.getWorkingDirectory());\r\n }", "@Override\n public boolean equals(Object o) {\n if (this == o) return true;\n if (o == null || getClass() != o.getClass()) return false;\n\n Node node = (Node) o;\n\n if (position != node.position) return false;\n if (!method.equals(node.method)) return false;\n return clazz.equals(node.clazz);\n }", "@Override public boolean equals(Object o) { // since 1.3.1\n // should these ever match actually?\n return (o == this);\n }", "@Override\n\tpublic void visit(EqualityNode node) {\n\t\tif (Evaluator.checkScope(node) == false) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (Evaluator.checkAssert(node) == false) {\n\t\t\treturn;\n\t\t}\n\t\t/**\n\t\t * evaluam fiul stang si fiul drept\n\t\t */\n\t\tEvaluator.evaluate(node.getChild(0));\n\t\tEvaluator.evaluate(node.getChild(1));\n\n\t\tString s2 = null;\n\t\tString s1 = null;\n\t\t/**\n\t\t * preluam rezultatele evaluarii celor doi fii\n\t\t */\n\t\tif (node.getChild(0) instanceof Variable) {\n\t\t\ts1 = Evaluator.variables.get(node.getChild(0).getName());\n\t\t} else {\n\t\t\ts1 = node.getChild(0).getName();\n\t\t}\n\t\tif (node.getChild(1) instanceof Variable) {\n\t\t\ts2 = Evaluator.variables.get(node.getChild(1).getName());\n\t\t} else {\n\t\t\ts2 = node.getChild(1).getName();\n\t\t}\n\n\t\t/**\n\t\t * verificam daca cei doi fii s- au evaluat la aceeasi expresie\n\t\t */\n\t\tif (s1.contentEquals(s2)) {\n\t\t\tnode.setName(\"true\");\n\t\t} else {\n\t\t\tnode.setName(\"false\");\n\t\t}\n\n\t}", "public static int isEqual(MyNode root0, MyNode root1) {\r\n int result = 0;\r\n\r\n if (root0 == null && root1 == null) {\r\n return 1;\r\n } else {\r\n if (root0 != null && root1 != null) {\r\n if (root0.getValue() == root1.getValue()) {\r\n if (isEqual(root0.getLeft(), root0.getLeft()) == 1) {\r\n result = isEqual(root0.getRight(), root1.getRight());\r\n }\r\n }\r\n }\r\n }\r\n\r\n return result;\r\n }", "public static boolean isEqual(JexlNode first, JexlNode second) {\n return checkEquality(first, second).isEqual();\n }" ]
[ "0.75099313", "0.73878944", "0.7298092", "0.72963464", "0.7279593", "0.7029307", "0.7002929", "0.69921356", "0.69844985", "0.6982037", "0.6971012", "0.69054735", "0.6839839", "0.67785144", "0.676822", "0.67384255", "0.67266405", "0.67156124", "0.6715256", "0.6699898", "0.6656588", "0.6640708", "0.66287386", "0.66202044", "0.66022944", "0.65987414", "0.6544384", "0.65356135", "0.6521146", "0.6514138", "0.6495971", "0.64562684", "0.64552206", "0.6453819", "0.6445301", "0.6424624", "0.6413888", "0.64117813", "0.6394984", "0.6392234", "0.6392234", "0.638654", "0.6371107", "0.63649505", "0.63575345", "0.63439995", "0.63350976", "0.6334265", "0.6334232", "0.63253593", "0.632403", "0.63095754", "0.63092697", "0.6307926", "0.629832", "0.6297885", "0.62657076", "0.62590504", "0.6257926", "0.6252315", "0.6249837", "0.62458587", "0.62399316", "0.6232999", "0.62158525", "0.62119037", "0.6211698", "0.61969256", "0.6185691", "0.6174344", "0.6160491", "0.6148517", "0.61333406", "0.6130713", "0.6124923", "0.61019176", "0.6094652", "0.6094315", "0.6083995", "0.6070749", "0.60687494", "0.60668814", "0.60636556", "0.60552776", "0.6051108", "0.6051108", "0.60496205", "0.60416", "0.6034891", "0.6030691", "0.60270095", "0.600799", "0.6007644", "0.5996388", "0.59917563", "0.59890836", "0.5986946", "0.59774274", "0.5972579", "0.59700227", "0.59647226" ]
0.0
-1
standard:: using one basic beginning method to get the input, call the recursive and return the final result using another void return type of the same name as the overloading and recursive down to the road basic interface with final return type Note: in the basic interface we only need one parameter, i.e. the root
ArrayList< LinkedList< Node > > levellist(Node root) { //results contain all the linkedlists containing all the nodes on each level of the tree ArrayList< LinkedList< Node > > results = new ArrayList< LinkedList< Node > > (); //basic condition for the following built-in calling of recursive levellist(root, results, 0); //because results is used as a parameter in the recursive and then we all need to return the output return results; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void work(RootNode root) throws Exception;", "protected abstract void traverse();", "public static void main(String[] args) {\n\n TreeNode node1 = new TreeNode(1);\n TreeNode node2 = new TreeNode(2);\n TreeNode node3 = new TreeNode(3);\n TreeNode node4 = new TreeNode(4);\n TreeNode node5 = new TreeNode(5);\n TreeNode node6 = new TreeNode(6);\n TreeNode node7 = new TreeNode(7);\n TreeNode node8 = new TreeNode(8);\n node1.right=node3;\n node1.left=node2;\n node2.left=node4;\n node3.right=node5;\n node4.right=node6;\n node6.left=node7;\n node6.right=node8;\n traversalRecursion(node1);\n System.out.println();\n nonRecurInTraverse(node1);\n }", "static void p(){\n System.out.println(\"My recursion example 1\");\n p();\n }", "@Test\n\t\tpublic void applyRecursivelyGoal() {\n\t\t\tassertSuccess(\" ;H; ;S; s ⊆ ℤ |- r∈s ↔ s\",\n\t\t\t\t\trm(\"\", ri(\"\", rm(\"2.1\", empty))));\n\t\t}", "public static void main(String[] args){\n LinkedListDeque<String> lld = new LinkedListDeque<>();\n lld.addFirst(\"Hello\");\n lld.addLast(\"Java\");\n lld.addLast(\"!\");\n\n String s0 = lld.getRecursive(0);\n String s1 = lld.getRecursive(1);\n String s2 = lld.getRecursive(2);\n System.out.println(s0 + s1 + s2);\n System.out.println(lld.getRecursive(556));\n //lld.getRecursive(2);\n }", "public static void main(String[] args) {\n\t\tint arr[] = {1,2,3,4,5,6,};\r\n\t\tTreenode<Integer> root= func(arr,0 , arr.length-1);\r\n\t\tprint(root);\r\n\t}", "@Override\n public R visit(BuiltInCall n, A argu) {\n R _ret = null;\n n.nodeChoice.accept(this, argu);\n return _ret;\n }", "public void inOrderTraverseRecursive();", "TreeNode returnNode(TreeNode node);", "public abstract <T extends Operation> Future<RpcResult<?>> invoke(@Nonnull T impl, @Nonnull QName operationName,\n @Nullable TreeNode input);", "public void root(Node n) {}", "static void recursive(SootMethod method){\r\n \tvisited.put(method.getSignature(),true);\r\n \tIterator <MethodOrMethodContext> target_1=new Targets(cg.edgesOutOf(method));\r\n \r\n \tif(target_1!=null){\r\n \t\twhile(target_1.hasNext())\r\n \t\t{\r\n \t\t\tSootMethod target_2=(SootMethod)target_1.next();\r\n \t\t\tSystem.out.println(\"\\t\"+ target_2.getSignature().toString());\r\n \t\t\tif(!visited.containsKey(target_2.getSignature()))\r\n \t\t\t\trecursive(target_2);\r\n \t\t}\r\n \t}\r\n \t}", "public abstract void bepaalGrootte();", "public abstract T queryRootNode();", "public static void main(String[] args) throws IOException {\n\t\t\n\t\tString inputPath = args[0];\n\t\tinitialize(inputPath);\n\t\tSystem.out.println(\"Finished Initialization\");\n\t\t\n\t\t//following is input from CMD, so using scanner\n\t\tScanner sc = new Scanner(System.in);\n\t\twhile(sc.hasNextLine()){\n\t\t\tString tmpString = sc.nextLine();\n\t\t\tString[] operation = new String[3];\n\t\t\toperation = tmpString.split(\" \");\n\t\t\t//System.out.println(operation.length);\n\t\t\tint arg0 = 0;\n\t\t\tint arg1 = 0;\n\t\t\tif(operation.length == 1) return;\n\t\t\tif(operation.length == 2)\n\t\t\t\targ0 = Integer.parseInt(operation[1]);\n\t\t\telse{\n\t\t\t\targ0 = Integer.parseInt(operation[1]);\n\t\t\t\targ1 = Integer.parseInt(operation[2]);\n\t\t\t}\n\t\t\tswitch(operation[0]){\n\t\t\t\tcase \"increase\":\n\t\t\t\t\tEventTree.increase(arg0, arg1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"reduce\":\n\t\t\t\t\tEventTree.reduce(arg0, arg1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"count\":\n\t\t\t\t\tEventTree.count(arg0);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"inrange\":\n\t\t\t\t\tEventTree.inrange(arg0, arg1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"next\":\n\t\t\t\t\tEventTree.next(arg0);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"previous\":\n\t\t\t\t\tEventTree.previous(arg0);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"getParent\":\n\t\t\t\t\tTreeNode start = null;\n\t\t\t\t\tTreeNode end = null;\n\t\t\t\t\tif(RBTree.search(arg0) == null) {\n\t\t\t\t\t\tstart = RBTree.getSuccessorById(RBTree.getRoot(),arg0);\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tstart = RBTree.search(arg0);\n\t\t\t\t\t}\n\t\t\t\t\tif(RBTree.search(arg1) == null){\n\t\t\t\t\t\tend = RBTree.getPrecursorById(RBTree.getRoot(),arg1);\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tend = RBTree.search(arg1);\n\t\t\t\t\t}\n\t\t\t\t\tif(start == null || end == null) break;\n\t\t\t\t\tSystem.out.println(RBTree.getCommonParent(start, end).ID);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault: \n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\t//AutoTester.treetc_01(); //insert & delete\n\t\t//AutoTester.treetc_02(); //successor & precursor\n\t\t//AutoTester.eventtc_01(); //increase & reduce\n\t\t//AutoTester.eventtc_02(); //common parent & inrange\n\t\t//AutoTester.eventtc_03(); //next & previous\n\t}", "@Test\n public void testRecursion() throws Exception {\n//TODO: Test goes here... \n/* \ntry { \n Method method = Solution.getClass().getMethod(\"recursion\", ArrayList<Integer>.class, TreeNode.class); \n method.setAccessible(true); \n method.invoke(<Object>, <Parameters>); \n} catch(NoSuchMethodException e) { \n} catch(IllegalAccessException e) { \n} catch(InvocationTargetException e) { \n} \n*/\n }", "public static void main(String[] args) {\n\t\trecursion(1,5);\n\t\t\t}", "void calculating(int depth);", "public String evaluate(Node root){\n\t\tObject[] args;\n\t\tClass[] types;\n\t\tint i= 0;\n\t\tNode nxt;\n\t\tString fun;\n\t\tfun = root.getValue();\n\t\tClass c=null;\n\t\t\n\t\tLinkedList<Node> children = root.getChildren();\n\n\t\tIterator<Node> iter = children.listIterator();\n\t\tif (!iter.hasNext()){\n\t\t\treturn fun;\n\t\t}\n\t\ttypes= new Class[children.size()];\n\t\targs = new Object[children.size()];\n\t\t\n\t\t//populates types[] for getmethod and args[] for invoke\n\t\twhile (iter.hasNext()) {\n\t\t\tnxt = iter.next();\n\t\t\tfun = evaluate(nxt);\n\t\t\tswitch ( root.getReturnType()[i+1] & 0b1111 ) {\n\t\t\t\t//the argument should be a string\n\t\t\t\tcase STRING:\n\t\t\t\t\tc=String.class;\n\t\t\t\t\targs[i]=fun.replace(\"\\\"\",\"\");\n\t\t\t\t\tbreak;\n\t\t\t\t//the argument should be a float primitive\n\t\t\t\tcase FLOAT:\n\t\t\t\t\tc=float.class;\n\t\t\t\t\targs[i]=new Float(Float.parseFloat(fun));\n\t\t\t\t\tbreak;\n\t\t\t\t//the argument should be a int primitive\n\t\t\t\tcase INTEGER:\n\t\t\t\t\tc=int.class;\n\t\t\t\t\targs[i]=new Integer(Integer.parseInt(fun));\n\t\t\t\t\tbreak;\n\t\t\t\t//the argument should be a Float class\n\t\t\t\tcase BIGFLOAT:\n\t\t\t\t\tc=Float.class;\n\t\t\t\t\targs[i]=new Float(Float.parseFloat(fun));\n\t\t\t\t\tbreak;\n\t\t\t\t//the argument should be an Integer class\n\t\t\t\tcase BIGINTEGER:\n\t\t\t\t\tc=Integer.class;\n\t\t\t\t\targs[i]=new Integer(Integer.parseInt(fun));\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\n\t\t\ttypes[i]=c;\n\t\t\ti ++;\n\t\t\t\n\t\t}\n\t\tfun = root.getValue();\n\t\t\n\t\ttry {\n\t\t\t//get the method at this node and apply it to the evaluation of its children\n\t\t\tfun = \"\" + coms.getMethod(fun, types).invoke(coms, args);\n\t\t}catch (Exception e){\n\t\t\t//this will never ever happen\n\t\t}\n\t\t\n\t\treturn fun;\n\t}", "void nest();", "public tree apply(A p1 ) {\n\t}", "abstract void walk();", "public interface Traverse<T extends TreeNode> {\n\n /**\n * Is called on each node, while traversing the tree\n *\n * @param node reference to the current node during tree traversal\n */\n void perform(T node);\n\n /**\n * Checks whether the traversal is completed and no more required\n *\n * @return {@code true} if traversal is completed and no more required,\n * {@code false} otherwise\n */\n default boolean isCompleted(){\n return false;\n }\n}", "public static void main(String[] args) {\n TreeNode root = build(1, build(2, null, build(1)), build(3));\n System.out.println(new SumRootToLeaf().sum(root));\n }", "@Override\n\tpublic Void visit(MethodCall method) {\n\t\tprintIndent(\".\");\n\t\tindent++;\n\t\tmethod.caller.accept(this);\n\t\tmethod.type.accept(this);\n\t\tmethod.methodName.accept(this);\n\t\tfor (var v : method.args) \n\t\t\tv.accept(this);\n\t\tindent--;\n\t\treturn null;\n\t}", "public interface RecursiveDescentParser\n{\n\n /**\n * Parses a regular expression and returns an NFA that describes that regular expression.\n * @return an NFA describing the regular expression that was parsed\n * @throws ParseException\n */\n public NFA parse() throws ParseException;\n\n}", "public static void main(String[] args) {\n TreeNode node = new TreeNode();\n node.value = 1;\n node.left = new TreeNode();\n node.left.value = 2;\n node.right = new TreeNode();\n node.right.value = 3;\n node.left.left = new TreeNode();\n node.left.left.value = 4;\n node.left.right = new TreeNode();\n node.left.right.value = 5;\n node.right.left = new TreeNode();\n node.right.left.value = 6;\n node.right.right = new TreeNode();\n node.right.right.value = 7;\n// System.out.println(mirro(node).value);\n// System.out.println(mirro(node).left.value);\n// System.out.println(Arrays.toString(LevelPrintTree.levelPrint(mirro(node))));\n\n recur(node);\n\n }", "public static void main(String[] args) {\n addNode(3);\n Node ans = lowestCommonAncestorFast(root.left, root.left.right.right);\n System.out.print(ans.val);\n }", "public void execute() {\n if (commandArgument.length != 1) {\n System.out.println(\"tree: requires no user input\");\n }\n else {\n this.treeTraversal(userFileSystem.getRootDir(), 0);\n }\n }", "public void dfs (String input)\r\n\t {\r\n\t\t \tNode root_dfs = new Node (input);\r\n\t\t \tNode current = new Node(root_dfs.getState());\r\n\t\t \t\r\n\t\t\tArrayList<String> visited = new ArrayList<String>();\r\n\t\t\tArrayList<String> children = new ArrayList<String>();\r\n\t\t\tStack<Node> stack_dfs = new Stack<Node>();\r\n\t\t\t\r\n\t\t\tint nodes_popped = 0;\r\n\t\t\tint stack_max_size = 0;\r\n\t\t\tint stack_size = 0;\r\n\t\t\tcurrent.cost = 0;\r\n\t\t\t\r\n\t\t\tgoal_dfs = isGoal(current.getState());\r\n\t\t\t\r\n\t\t\twhile(!goal_dfs)\r\n\t\t\t{\r\n\t\t\t\tvisited.add(current.getState());\r\n\t\t\t\tchildren = Successor.findChildren(current.getState());\r\n\t\t\t\t\r\n\t\t\t\tfor (String a : children)\r\n\t\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (visited.contains(a))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tNode nino = new Node(a);\r\n\t\t\t\t\t\tcurrent.children_nodes.add(nino);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tint cost = isCost(current.getState(), nino.getState());\r\n\t\t\t\t\t\tnino.cost = cost;\r\n\t\t\t\t\t\tnino.parent = current;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// Repeated state check\r\n\t\t\t\t\t\tif (!stack_dfs.contains(nino))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tstack_dfs.add(nino);\r\n\t\t\t\t\t\t\tstack_size++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// Popping off the stack. LIFO architecture\r\n\t\t\t\tcurrent = stack_dfs.pop();\r\n\t\t\t\tnodes_popped++;\r\n\t\t\t\t\r\n\t\t\t\tif (stack_size > stack_max_size)\r\n\t\t\t\t{\r\n\t\t\t\t\tstack_max_size = stack_size;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tstack_size--;\r\n\t\t\t\tgoal_dfs = isGoal(current.getState());\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tgoal_dfs = false;\r\n\t\t\tSystem.out.println(\"DFS Solved!!\");\r\n\t\t\tSolution.performSolution(current, root_dfs, nodes_popped, stack_max_size);\r\n\t }", "public abstract void input();", "@Override\n\tpublic String visitMethodCall(MethodCallContext ctx) {\n\t\tint childrenNo=ctx.children.size();\n\t\tParseTree lastChild=ctx.children.get(childrenNo-1);\n\t\tString returnType;\n\t\tString methodName;\n\t\tif(lastChild instanceof TerminalNode){\n\t\t\tList<String> argTypes=new ArrayList<>();\n\t\t\tStack<String> ids=new Stack<>();\n\t\t\tParseTree n=ctx.children.get(childrenNo-2);\n\t\t\tif (childrenNo<=4){\n\t\t\t\tif(!(n instanceof TerminalNode)){\n\t\t\t\t\tmethodName=ctx.getChild(childrenNo-4).getText();\n\t\t\t\t\tMethodRecord mRec=(MethodRecord) table.lookup(methodName);\n\t\t\t\t\tif (mRec==null)throw new RuntimeException(\"method \"+methodName+ \" is not declared\");\n\t\t\t\t\tList<VarRecord> paramList=(List<VarRecord>) mRec.getParameters();\n\t\t\t\t\tList<ParseTree> arguments= new ArrayList<>();\n\t\t\t\t\tfor(int i=0;i<=n.getChildCount();i+=2){\n\t\t\t\t\t\targuments.add(n.getChild(i));\n\t\t\t\t\t}\n\t\t\t\t\tif(paramList.size()!=arguments.size())throw new RuntimeException(\"Incorrect number of arguments\");\n\t\t\t\t\telse for(int i=0;i<=paramList.size()-1;i++){\n\t\t\t\t\t\tString actualType=visit(arguments.get(i));\n\t\t\t\t\t\tString declaredType=paramList.get(i).getReturnType();\n\t\t\t\t\t\tif(!actualType.equals(declaredType)) throw new RuntimeException(\"Incorrect argument type\");\n\t\t\t\t\t}//checking arguments complete\n\t\t\t\t\treturn mRec.getReturnType();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tClassRecord cRec;\n\t\t\t\t\t\tmethodName=ctx.getChild(childrenNo-3).getText();\n\t\t\t\t\t\tcRec=(ClassRecord) table.lookup(methodName);\n\t\t\t\t\t\tMethodRecord mRec=cRec.getMethod(methodName);\n\t\t\t\t\t\tif (mRec==null)throw new RuntimeException(\"method \"+methodName+ \" is not declared\");\n\t\t\t\t\t\treturn mRec.getReturnType();\n\t\t\t\t\t}\n\t\t\t}else \n\t\t\tif(!(n instanceof TerminalNode)){\n\t\t\t\tmethodName=ctx.getChild(childrenNo-4).getText();\n\t\t\t\t//checking charAt(i) \n\t\t\t\tif(methodName.equals(\"charAt\")){\n\t\t\t\t\tif(n.getChildCount()!=1) throw new RuntimeException(\"Incorrect number of arguments on charAt()function\");\n\t\t\t\t\telse {\n\t\t\t\t\t\tString charArgType=visit(n);\t\t//check argument type is int\n\t\t\t\t\t\tif (!charArgType.equals(\"int\")) throw new RuntimeException(\"ARgument i on function charAt(i) must be of type int\");\n\t\t\t\t\t}\n\t\t\t\t\tString objectType=table.lookup(ctx.getChild(childrenNo-6).getText()).getReturnType();\n\t\t\t\t\tif (!objectType.equals(\"String\")) throw new RuntimeException(\".charAt(i) is applicable only to Strings\");\n\t\t\t\t}\n\t\t\t\tfor(int i=0;i<=n.getChildCount();i+=2){\n\t\t\t\t\targTypes.add(visit(n.getChild(i)));\n\t\t\t\t}\n\t\t\tfor(int i=childrenNo-4;i>=0;i-=2){\n\t\t\t\tids.push(ctx.getChild(i).getText());\n\t\t\t}\n\t\t\t}else{ \n\t\t\t\t//checking .length()\n\t\t\t\tmethodName=ctx.getChild(childrenNo-3).getText();\n\t\t\t\tif(methodName.equals(\"length\")){\n\t\t\t\t\tString objectType=table.lookup(ctx.getChild(childrenNo-5).getText()).getReturnType();\n\t\t\t\t\tif (!objectType.equals(\"String\")) throw new RuntimeException(\".length() is applicale only to Strings\");\n\t\t\t\t}\n\t\t\t\targTypes=null;\n\t\t\t\tfor(int i=childrenNo-3;i>=0;i-=2){\n\t\t\t\t\tids.push(ctx.getChild(i).getText());\n\t\t\t\t}\n\t\t\t}\n\t\t\tint count=ids.size();\n\t\t\tClassRecord cRec=null;\n\t\t\tRecord r;\n\t\t\tfor(int i=0;i<=count-2;i++){\n\t\t\t\tString key=ids.pop();\n\t\t\t\tr= table.lookup(key);\t\t\t\t\n\t\t\t\tcRec=(ClassRecord)table.lookup(r.Type);\n\t\t\t\tif (cRec==null) throw new RuntimeException(\"Class \"+key+\" is not declared\");\t\t\t\t\n\t\t\t}\n\t\t\t//last item in stack is the method Identifier\n\t\t\tMethodRecord mRec=cRec.getMethod(ids.pop());\n\t\t\tif (mRec==null)throw new RuntimeException(\"Method not declared in class \"+cRec.getName());\n\t\t\treturnType=mRec.getReturnType();\n\t\t\tif(methodName.equals(\"charAt\")) returnType=\"char\";\n\t\t\tif(methodName.equals(\"length\"))returnType=\"int\";\n\t\t\t//checking arguments \n\t\t\tif(argTypes==null) return returnType;\n\t\t\telse {\t\t\t\t\n\t\t\t\tList<VarRecord> parameters=(List<VarRecord>) mRec.getParameters();\n\t\t\t\tif(parameters.size()!=argTypes.size()) throw new RuntimeException(\"Incorect number of arguments on method call\");\n\t\t\t\telse{\n\t\t\t\t\tfor(int i=0;i<argTypes.size();i++){\n\t\t\t\t\t\tif(!argTypes.get(i).equals((parameters.get(i).getReturnType()))) throw new RuntimeException (\"incorrect argument type\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} return returnType;\n\t\t}\telse \t\t\t\t\t\t// last node is a RuleNode\n\t\t\t{\n\t\t\t\tif (childrenNo==3){\t\t\t\t\t\n\t\t\t\tString leftType=visit(ctx.getChild(0)); //also checks the first method for undeclared ids\n\t\t\t\t//ClassRecord cRec=(ClassRecord) table.lookup(ctx.getChild(0).getText());\n\t\t\t\tParseTree node=ctx.getChild(2);\n\t\t\t\t//checking charAt function\n\t\t\t\tif((node.getChildCount()==4)&&(node.getChild(3) instanceof TerminalNode)){\t\t\t\n\t\t\t\t\tif (node.getChild(0).getText().equals(\"charAt\")){\n\t\t\t\t\t\tif (!leftType.equals(\"String\")) throw new RuntimeException(\"charAt() only applicable to Strings\");\n\t\t\t\t\t\tString argType=visit(node.getChild(2));\n\t\t\t\t\t\tif (!argType.equals(\"int\")) throw new RuntimeException(\"Incorrect argument in charAt()\");\n\t\t\t\t\t\treturn \"char\";\n\t\t\t\t\t}\n\t\t\t\t}else if(node.getChildCount()==3&&((node.getChild(2) instanceof TerminalNode))){\n\t\t\t\t\tif(node.getChild(0).getText().equals(\"length\")){\n\t\t\t\t\t\tif (!leftType.equals(\"String\")) throw new RuntimeException(\"length() only applicable to Strings\");\n\t\t\t\t\t\telse return \"int\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t{String mName=ctx.getChild(2).getChild(0).getText();\n\t\t\t\tClassRecord tempCR=(ClassRecord) table.lookup(ctx.getChild(0).getChild(0).getText());\n\t\t\t\tMethodRecord mRec=tempCR.getMethod(mName);\n\t\t\t\tif(mRec==null)throw new RuntimeException(\"method \"+mName+\" is not declared in class \"+tempCR.getName());\n\t\t\t\treturn mRec.getReturnType(); //visit the last methodCall in the chain \n\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (childrenNo==5){\n\t\t\t\t\tString leftType=visit(ctx.getChild(1)); //also checks the first method for undeclared ids\n\t\t\t\t\tParseTree node=ctx.getChild(4);\n\t\t\t\t\t//checking charAt function\n\t\t\t\t\tif((node.getChildCount()==4)&&(node.getChild(3) instanceof TerminalNode)){\t\t\t\n\t\t\t\t\t\tif (node.getChild(0).getText().equals(\"charAt\")){\n\t\t\t\t\t\t\tif (!leftType.equals(\"String\")) throw new RuntimeException(\"charAt() only applicable to Strings\");\n\t\t\t\t\t\t\telse return visit(node);\n\t\t\t\t\t\t}\n\t\t\t\t\t}else if(node.getChildCount()==3&&((node.getChild(2) instanceof TerminalNode))){\n\t\t\t\t\t\tif(node.getChild(0).getText().equals(\"length\")){\n\t\t\t\t\t\t\tif (!leftType.equals(\"String\")) throw new RuntimeException(\"length() only applicable to Strings\");\n\t\t\t\t\t\t\telse return visit(node);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tClassRecord cR=(ClassRecord)table.lookup(leftType);\n\t\t\t\t\tMethodRecord mRec=cR.getMethod(node.getChild(0).getText());\n\t\t\t\t\treturn mRec.getReturnType(); //visit the last methodCall in the chain \n\t\t\t\t}\n\t\t\t}\n\t\treturn null; //debuggin purposes. should be unreachable\n\t}", "public static void main(String}] args) {\n Node root = new Node(7);\n root.left = new Node(3);\n root.right = new Node(15);\n \n root.left.left = new Node(1);\n root.left.right = new Node(4);\n \n root.right.left = new Node(9);\n root.right.right = new Node(20);\n\n System.out.println(root);\n \n coverToDoublyLL(root);\n \n \n }", "public static void main(String[] args) {\n TreeNode n = Codec.deserialize(\"3 5 1 6 2 0 8 n n 7 4\");\n Main m = new Main();\n System.out.println(m.lowestCommonAncestor(n,new TreeNode(5), new TreeNode(1)).val);\n System.out.println(m.lowestCommonAncestor(n,new TreeNode(5), new TreeNode(4)).val);\n }", "public abstract Node apply(Node node);", "public void inOrderTraverseIterative();", "public static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tTreeNode root = new TreeNode(5);\n\t\troot.left = new TreeNode(3);\n\t\troot.right = new TreeNode(7);\n\t\tinOrder(root);\n\t\tSystem.out.println();\n\t\tsum(root);\n\t\tinOrder(root);\n\t}", "@Override\n\tpublic void traverseArg(UniArg node) {\n\t}", "private void helper(TreeNode root) {\n if (root == null) {\n return;\n }\n\n helper(root.left);\n ans.add(root.val);\n helper(root.right);\n }", "@FunctionalInterface\npublic interface StepExpr extends Expr {\n\n /**\n * {@inheritDoc}\n *\n * @return evaluated XML node views\n */\n @Override\n <N extends Node> IterableNodeView<N> resolve(Navigator<N> navigator, NodeView<N> view, boolean greedy)\n throws XmlBuilderException;\n\n}", "public interface TreeProcessor<N extends TreeNode<N>> {\n\n /**\n * Will start the processing at the originating node\n * @param origin the node from which the processing will originate\n * @param processor the processor to run on each node\n */\n void process(N origin, TreeNodeProcessor<N> processor);\n\n}", "T getRoot();", "public int display(){\n return display(root);\n\n }", "public static void main(String[] args){\n\t\tTreeNode node1 = new TreeNode(1);\n\t\tTreeNode node2 = new TreeNode(2);\n\t\tTreeNode node3 = new TreeNode(3);\n\t\tTreeNode node4 = new TreeNode(4);\n\t\tTreeNode node5 = new TreeNode(5);\n\t\tTreeNode node6 = new TreeNode(6);\n\t\tTreeNode node7 = new TreeNode(7);\n\t\tnode4.left = node2;\n\t\tnode4.right = node6;\n\t\tnode2.left = node1;\n\t\tnode2.right = node3;\n\t\tnode6.left = node5;\n\t\tnode6.right = node7;\n\t\t/*\n\t\t * 4\n\t\t * /\n\t\t * 5\n\t\t * \\\n\t\t * 6\n\t\t */\n\t\t/*node4.left = node5;\n\t\tnode5.right = node6;*/\n\t\t\n\t\ttreeTraversal2 tt = new treeTraversal2();\n\t\tSystem.out.print(\"Inorder Rcur: \");tt.inorderTraverse(node4);//1234567\n\t\tSystem.out.println();\t\t\n\t\tSystem.out.print(\"Inorder Iter: \");tt.stackInorder(node4);//1234567\n\t\tSystem.out.println();\n\t\tSystem.out.print(\"Preorder Rcur: \");tt.preorderTraverse(node4);//4213657\n\t\tSystem.out.println();\n\t\tSystem.out.print(\"Preorder Iter: \"); tt.stackPreorder(node4);//4213657\n\t\tSystem.out.println();\n\t\tSystem.out.print(\"Postorder Rcur: \");tt.postorderTraverse(node4);//1325764\n\t\tSystem.out.println();\t\t \n\t\tSystem.out.print(\"Postorder Iter: \");tt.stackPostorder(node4);//1325764\n\t\t//System.out.println();\n\t\t//System.out.print(\"Postorder Iter: \");tt.twoStackPostorder(node4);//1325764\n\t\tSystem.out.println();\n\t\tSystem.out.print(\"Level Iter: \");tt.levelTraverse(node4);//4261357\n\t}", "public void read(Scanner input) {\r\n overallRoot = readHelper(input);\r\n }", "private Node serchNode(E input, Node current) {\n Node node = null;\n if (current.value.equals(input)) {\n node = current;\n } else {\n List<Node> children = current.children;\n for (Node child : children) {\n node = serchNode(input, child);\n if (node != null) {\n break;\n }\n }\n }\n return node;\n }", "public String preorderTraverse(){\r\n\t\t\r\n\t\t//the recursive call to the private method\r\n\t\t//StringBuffer is used because it is passed by reference\r\n\t\t//StringBuffer can be changed in recursive calls\r\n\t\treturn preorderTraverse(this, new StringBuffer(\"\"));\r\n\t}", "public static void main(String[] args) {\n\t\tNode root=BTreePrinterTest.test6();\n\t\tBTreePrinter.printNode(root);\n\t\tPoint result= recurse(root);\n\t\tSystem.out.println(result.y);\n\t}", "public void preorderTraverse(){\n\t\tpreorderHelper(root);\n\t\tSystem.out.println();\n\t}", "Result commonAncestorHelper(TreeNode root, TreeNode p, TreeNode q) {\n\tif (root == null) return new Result(null, false);\n\n\n\t// they are the same node, and is the root\n\tif (root == p && root == q) {\n\t\treturn new Result(root, true);\n\t}\n\t// searching left subtree\n\tResult rx = commonAncestorHelper(root.left, p, q);\n\t// found a common ancestor \n\tif (rx.isAncestor) { \n\t\treturn rx; \n\t}\n\n\t// searching right subtree\n\tResult ry = commonAncestorHelper(root.right, p, q);\n\tif (ry.isAncestor) {\n\t\treturn ry; \n\t}\n\n\tif (rx.node != null && ry.node != null) {\n\t\treturn new Result(root, true); // common ancestor \n\t} else if (root == p || root == q) {\n\t\t// we're currently at p or q\n\t\t// found one of those nodes in subtree, then ancestor\n\t\t// flag TRUE\n\t\tboolean isAncestor = rx.node != null || ry.node != null; \n\t\treturn new Result(root, isAncestor)\n\t} else {\n\t\treturn new Result(rx.node != null ? rx.node : ry.node, false);\n\t}\n\n\n}", "public interface INodeWalker {\n\t\n\t/**\n\t * adds a filter to the list of filters through which nodes will be passed when \n\t * successor nodes are retrieved via the <code>getFilteredSuccessorNodes</code> method. \n\t * If an identical filter is already in the list of filters, this method does nothing.\n\t * \n\t * @param filter\n\t * @see #getFilteredSuccessorNodes(Object)\n\t */\n\tpublic void addNodeFilter (INodeFilter filter);\n\t\n\t/**\n\t * removes the specified filter from the list of filters through which a node is passed when \n\t * <code>getFilteredSuccessorNodes</code> is called.\n\t * \n\t * @param filter\n\t * @see #getFilteredSuccessorNodes(Object)\n\t */\n\tpublic void removeNodeFilter (INodeFilter filter);\n\t\n\t/**\n\t * removes all filters from this walker\n\t * \n\t * @return all removed filters\n\t */\n\tpublic INodeFilter[] removeAllFilters ();\n\t\n\t/**\n\t * get the starting nodes of the graph. These are the nodes of the graph that have\n\t * no predecessors.\n\t *\n\t * @return starting nodes of graph\n\t */\n\tpublic Object[] getStartNodes ();\n\n\t/**\n\t * retreave the direct predecessors of the given element. The direct predecessors of the\n\t * given element are those elements that are connected to the given element via a single edge and\n\t * serve as heads on that edge, permitting the given element to serve as the tail.\n\t *\n\t * @param node - node for which direct predecessors are desired\n\t * @return direct predecessors of given node or empty array if no predecessors are present\n\t */\n\tpublic Object[] getPredecessorNodes (Object node) throws InvalidComponentException;\n\n\t/**\n\t * retreave the direct successors of the given element. The direct successors of the\n\t * given element are those elements that are connected to the given element via a single edge and\n\t * serve as tails on that edge, permitting the given element to serve as the head.\n\t *\n\t * @param node - node for which direct successors are desired\n\t * @return direct successors of given node or empty array if no successors are present\n\t */\n\tpublic Object[] getSuccessorNodes (Object node) throws InvalidComponentException;\n\n\t/**\n\t * retrieve the direct successors of the given element that pass each of the node filters added via the\n\t * <code>addNodeFilter</code> method. The direct successors of the\n\t * given element are those elements that are connected to the given element via a single edge and\n\t * serve as tails on that edge, permitting the given element to serve as the head.\n\t * \n\t * <p>If no filters have been added or if all filters pass all successor nodes, then this method is \n\t * equivalent to <code>getSuccessorNodes</code>.\n\t *\n\t * @param node - node for which direct successors are desired\n\t * @return direct successors of given node (filtered) or empty array if no successors are present\n\t * @see #addNodeFilter(INodeFilter)\n\t */\n\tpublic Object[] getFilteredSuccessorNodes (Object node) throws InvalidComponentException;\n\n}", "public static void main(String[] args) {\n\t\tSystem.out.println(\"Type number for fabonacci : \");\n\t\tScanner scanner = new Scanner(System.in);\n\t\t int number = scanner.nextInt();\n\t\t \n\t\t for(int m=1;m<=number;m++) {\n\t\tint result= fabi(m);\n\t System.out.println(\" Loop : \" + result);\n\n\t\t }\n\t\t \n\t\tint result1= fabi1(number);\n\t\tSystem.out.println(\" Recursion : \"+result1);\n scanner.close();\n \n\t}", "public void inorderTraverse(){\n\t\tinorderHelper(root);\n\t\tSystem.out.println();\n\t}", "public static void main(String[] args) {\n\t\t\n\t\tSystem.out.println(run(recursive, 45));\n\t\t\n\t}", "public static void main(String[] args) {\n\t\tBinaryTree binaryTree = new BinaryTree();\n\t\tBinaryNode FrontBinaryNode = binaryTree.buildTree();\n\t\tSystem.out.print(\"层次遍历:\");\n\t\tbinaryTree.sequence(FrontBinaryNode);\n\t\tSystem.out.print(\"先序遍历:\");\n\t\tbinaryTree.preorder(FrontBinaryNode);\n\t\tSystem.out.println();\n\t\tSystem.out.print(\"中序遍历:\");\n\t\tbinaryTree.inorder(FrontBinaryNode);\n\t\tSystem.out.println();\n\t\tSystem.out.print(\"后序遍历:\");\n\t\tbinaryTree.postorder(FrontBinaryNode);\n\t\t//测试数据:ebfad.g..c\n\n\t}", "@Test\r\n\tpublic void testProcessPass1()\r\n\t{\r\n\t\tToken t1 = new Token(TokenTypes.EXP4.name(), 1, null);\r\n\t\tToken t2 = new Token(TokenTypes.OP4.name(), 1, null);\r\n\t\tToken t3 = new Token(TokenTypes.EXP5.name(), 1, null);\r\n\t\tt3.setType(\"INT\");\r\n\t\tArrayList<Token> tkns = new ArrayList<Token>();\r\n\t\ttkns.add(t1);\r\n\t\ttkns.add(t2);\t\t\t\r\n\t\ttkns.add(t3);\r\n\t\t\r\n\t\tToken t4 = new Token(TokenTypes.EXP4.name(), 1, tkns);\r\n\t\tClass c1 = new Class(\"ClassName\", null, null);\r\n\t\tPublicMethod pm = new PublicMethod(\"MethodName\", null, VariableType.BOOLEAN, null);\r\n\t\tt4.setParentMethod(pm);\r\n\t\tt4.setParentClass(c1);\r\n\r\n\t\tToken.pass1(t4);\r\n\t\t\r\n\t\tfor(int i = 0; i < t4.getChildren().size(); i++){\r\n\t\t\tToken child = t4.getChildren().get(i);\r\n\t\t\t\r\n\t\t\tassertEquals(child.getParentClass().getName(), t4.getParentClass().getName());\r\n\t\t\tassertEquals(child.getParentMethod(), t4.getParentMethod());\r\n\t\t}\r\n\t\t\r\n\t\tassertEquals(t4.getType(), \"INT\");\r\n\t}", "public static void main(String[] args) {\n Node root = composeTree();\n root.execute(USER);\n\n }", "private void next(String[] arguments) {\n\t\ttry {\n\t int ID = Integer.parseInt(arguments[1]);\n\t successor = null;\n\t findSuccessor(root, ID);\n\t if(successor == null)\n\t \tSystem.out.println(\"0 0\");\n\t else\n\t \tSystem.out.printf(\"%d %d\\n\", successor.ID, successor.count);\n\t } catch(NumberFormatException e) { \n\t System.out.println(\"Argument not an Integer\");; \n\t }\n\t}", "boolean isRecursive();", "@Test\r\n\tpublic void testProcessPass1Other()\r\n\t{\r\n\t\tToken t3 = new Token(TokenTypes.EXP5.name(), 1, null);\r\n\t\tt3.setType(\"INT\");\r\n\t\tArrayList<Token> tkns = new ArrayList<Token>();\t\t\t\r\n\t\ttkns.add(t3);\r\n\t\t\r\n\t\tToken t4 = new Token(TokenTypes.EXP4.name(), 1, tkns);\r\n\t\tClass c1 = new Class(\"ClassName\", null, null);\r\n\t\tPublicMethod pm = new PublicMethod(\"MethodName\", null, VariableType.BOOLEAN, null);\r\n\t\tt4.setParentMethod(pm);\r\n\t\tt4.setParentClass(c1);\r\n\r\n\t\tToken.pass1(t4);\r\n\t\t\r\n\t\tfor(int i = 0; i < t4.getChildren().size(); i++){\r\n\t\t\tToken child = t4.getChildren().get(i);\r\n\t\t\t\r\n\t\t\tassertEquals(child.getParentClass().getName(), t4.getParentClass().getName());\r\n\t\t\tassertEquals(child.getParentMethod(), t4.getParentMethod());\r\n\t\t}\r\n\t\t\r\n\t\tassertEquals(t4.getType(), \"INT\");\r\n\t}", "protected abstract O getResult();", "@Override\n\tpublic void VisitMethodCallNode(MethodCallNode Node) {\n\n\t}", "public void getNodesThatCall(PassedParameter pp, Set result) {\n if (USE_PARAMETER_MAP) {\n Set s = (Set)passedParamToNodes.get(pp);\n if (s == null) return;\n result.addAll(s);\n return;\n }\n for (Iterator i = this.nodeIterator(); i.hasNext(); ) {\n Node n = (Node)i.next();\n if ((n.passedParameters != null) && n.passedParameters.contains(pp))\n result.add(n);\n }\n }", "public static void main(String[] args) {\n Leaf1 L1 = new Leaf1();\r\n Leaf2 L2 = new Leaf2();\r\n method(L1);\r\n method(L2);\r\n\t}", "public static String recursiveMethod(String str) {\n\t\tif (str.length() == 0) {\n\t\t\treturn \"\";\n\t\t}\n\t\treturn str.substring(str.length() - 1) + recursiveMethod(str.substring(0, str.length() - 1));\n\t}", "public void doMenu(){\n Scanner readinput = new Scanner(System.in); // needed to read the user's input\r\n System.out.println(\"Using Red Black Tree. 9 for list of commands\");\r\n while (this.userinput != -1) {\r\n \r\n this.update(); // every loop, print diagram of the tree\r\n \r\n System.out.print(\"Option: \");\r\n this.userinput = readinput.nextInt(); // input. Await user.\r\n \r\n switch(this.userinput){ // checks and matches the input to available functions\r\n \r\n case 9:\r\n System.out.println(\"\\nAvailable commands:\"\r\n + \"\\n'0': create a new empty root\"\r\n + \"\\n'-1': quits the program\"\r\n + \"\\n'1': recursively inserts new node with value\"\r\n + \"\\n'2': remove a node\"\r\n + \"\\n'3': print information about the tree\"\r\n + \"\\n'4': print information about a node\"\r\n + \"\\n'9': print this help section\"\r\n );\r\n break;\r\n \r\n case -1: // quit.\r\n System.out.println(\"Stopping.\");\r\n break;\r\n \r\n case 0: // Empty all\r\n System.out.print(\"Removing all.\");\r\n this.root = null;\r\n break;\r\n \r\n case 1: // insere objeto no conteúdo do nó.\r\n System.out.print(\">>> New Value: \");\r\n this.userinput2 = readinput.nextInt();\r\n this.insertElement(this.root, userinput2);\r\n break;\r\n \r\n case 2: //remover certo valor\r\n System.out.print(\">>> Value to be removed: \");\r\n this.userinput2 = readinput.nextInt();\r\n this.remove(root, userinput2);\r\n break;\r\n \r\n case 3: // imprimir informações da árvore\r\n\r\n //this.calculateNodes(root);\r\n System.out.println(\"Pre Order NLR:\");\r\n this.traversePreOrder(root);\r\n System.out.println(\"\\nPost Order LRN:\");\r\n this.traversePostOrder(root);\r\n System.out.println(\"\\nIn Order LNR:\");\r\n this.traverseInOrder(root);\r\n System.out.println(\"\\n[!] Finished printing tree information\\n\");\r\n break;\r\n \r\n case 4: \r\n System.out.print(\">>> Value of node to be fetched: \");\r\n this.userinput2 = readinput.nextInt();\r\n this.info(this.fetch(root, userinput2));\r\n break;\r\n \r\n \r\n }\r\n \r\n }\r\n \r\n }", "public abstract TreeIter<T> iterator();", "public void callit();", "public static void main(String[] args) {\n\tScanner scn = new Scanner(System.in);\r\n\tint n = scn.nextInt();\r\n\t\tint[] arr = new int[n];\r\n\t\tfor (int i = 0; i < n; i++) {\r\n\t\t\tarr[i] = scn.nextInt();\r\n\t\t}\r\n//\t\tint s = scn.nextInt();\r\n\t\tBST b = new BST(arr);\r\n\t\tint l=scn.nextInt();\r\n\t\tint r=scn.nextInt();\r\n//\t\tb.preorder();\r\n\t\tSystem.out.println(b.findSubtrees(l, r));\r\n//\t\tb.findMedian();\r\n//\t\tb.preorder();\r\n//\t\t\r\n\t\t\r\n\t}", "TrieNode root();", "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 ParseResult success (Object input) {\n return success(input, 1);\n }", "public static void main(String[] args) {\n if (args.length > 0) {\r\n input = args[0];\r\n inputl = input.length() - 1;\r\n }\r\n \r\n mbt(new Node(input.charAt(inputl)));\r\n System.out.print(inorder(root));\r\n System.out.print(\"=\" + calculate(root));\r\n \r\n javax.swing.SwingUtilities.invokeLater(new Runnable() {\r\n public void run() {\r\n GUI.createAndShowGUI();\r\n }\r\n });\r\n }", "public static void main(String[] args) {\n TreeNode n7 = new TreeNode(7);\n TreeNode n6 = new TreeNode(6);\n TreeNode n5 = new TreeNode(5);\n TreeNode n4 = new TreeNode(4);\n TreeNode n3 = new TreeNode(3);\n TreeNode n2 = new TreeNode(2);\n TreeNode n1 = new TreeNode(1);\n\n n4.left = n2;\n n4.right = n6;\n\n n2.left = n1;\n n2.right = n3;\n\n n6.left = n5;\n n6.right = n7;\n\n System.out.println(\"Cay n4\");\n List<Integer> resultPreOrder = preOrderTravel(n4);\n for (Integer integer : resultPreOrder) {\n System.out.println(integer);\n }\n\n System.out.println(\"Cay n2\");\n resultPreOrder = preOrderTravel(n2);\n for (Integer integer : resultPreOrder) {\n System.out.println(integer);\n }\n }", "public interface Pie {\n Pie accept(PieVisitor visitor);\n\n public static void main(String[] args) {\n Pie p = new Top(new Integer(3), new Top(new Integer(2), new Top(new Integer(3), new Bot())));\n System.out.println(p);//Top{t=3, p=Top{t=2, p=Top{t=3, p=Bot{}}}}\n System.out.println(p.accept(new Rem(new Integer(2))));//Top{t=3, p=Top{t=3, p=Bot{}}}\n System.out.println(p.accept(new Subst(new Integer(5), new Integer(3))));//Top{t=5, p=Top{t=2, p=Top{t=5, p=Bot{}}}}\n System.out.println(\"--------------\");\n p = new Top(new Anchovy(), new Top(new Integer(3), new Top(new Zero(), new Bot())));\n System.out.println(p);//Top{t=Anchovy{}, p=Top{t=3, p=Top{t=Zero{}, p=Bot{}}}}\n System.out.println(p.accept(new Rem(new Zero())));//Top{t=Anchovy{}, p=Top{t=3, p=Bot{}}}\n System.out.println(\"--------------\");\n p = new Top(new Anchovy(), new Top(new Tuna(), new Top(new Anchovy(), new Top(new Tuna(), new Top(new Anchovy(), new Bot())))));\n System.out.println(p);//Top{t=Anchovy{}, p=Top{t=Tuna{}, p=Top{t=Anchovy{}, p=Top{t=Tuna{}, p=Top{t=Anchovy{}, p=Bot{}}}}}}\n System.out.println(p.accept(new LtdSubst(new Integer(2), new Salmon(), new Anchovy())));//Top{t=Salmon{}, p=Top{t=Tuna{}, p=Top{t=Salmon{}, p=Top{t=Tuna{}, p=Top{t=Anchovy{}, p=Bot{}}}}}}\n System.out.println(\"--------------\");\n }\n}", "private int pushDownRoot() {\n\t\treturn pushDown(0);// TODO: A one-line function that calls pushDown()\n\t}", "public interface CalculatorFunction {\r\n CalculatorNode calculate(CalculatorNode[] arguments);\r\n}", "public static void main(String[] args) {\n\n Node<Integer> node1 = new Node<>(1);\n Node<Integer> node2 = new Node<>(2);\n Node<Integer> node3 = new Node<>(3);\n Node<Integer> node4 = new Node<>(4);\n\n node1.setLeftChild(node2);\n node1.setRightChild(node3);\n\n node2.setLeftChild(node4);\n\n node3.setLeftChild(new Node<>(5));\n node3.setRightChild(new Node<>(6));\n\n node4.setLeftChild(new Node<>(7));\n node4.setRightChild(new Node<>(8));\n\n traverse(node1);\n }", "public interface Node {\n public int arityOfOperation();\n public String getText(int depth) throws CalculationException;\n public double getResult() throws CalculationException;\n public boolean isReachable(int depth);\n public List<Node> getAdjacentNodes();\n public String getTitle();\n public void setDepth(int depth);\n}", "public Rule call()\n \t{\n \t\treturn sequence(id(),\n \t\t\t\tfirstOf(\n \t\t\t\tsequence(enforcedSequence(PAR_L, optional(args()), PAR_R), optional(closure())), //params & opt. closure\n \t\t\t\tclosure())); // closure only\n \t}", "public static void main(String[] args) {\n TreeNode root = new TreeNode(50);\n root.left = new TreeNode(30);\n root.right = new TreeNode(70);\n root.left.left = new TreeNode(20);\n root.left.right = new TreeNode(40);\n root.right.left = new TreeNode(60);\n root.right.right = new TreeNode(80);\n printSpiralRec(root);\n System.out.println();\n printSpiralIte(root);\n }", "public abstract void call();", "public interface Tree {\n\n //查找节点\n Node find(int val);\n\n //插入新节点\n boolean insert(int val);\n\n //中序遍历\n void infixOrder(Node current);\n\n //前序遍历\n void preOrder(Node current);\n\n //后序遍历\n void postOrder(Node current);\n\n //找到最大值\n Node findMax();\n\n //找到最小值\n Node findMin();\n\n //删除节点\n boolean delete(int val);\n\n}", "public ParseTreeNode visit(CallNode call) {\n return null;\n }", "public interface TreeNode{\r\n\t\r\n\t// enumerated node types\r\n\tpublic enum NodeType {\r\n\t\tMIN {\r\n\t\t\t@Override\r\n\t\t\tpublic NodeType opposite() {\r\n\t\t\t\treturn MAX;\r\n\t\t\t}\r\n\t\t}, MAX {\r\n\t\t\t@Override\r\n\t\t\tpublic NodeType opposite() {\r\n\t\t\t\treturn MIN;\r\n\t\t\t}\r\n\t\t};\r\n\t\r\n\t\tpublic abstract NodeType opposite();\r\n\t};\r\n\t\r\n\t// the type of node represented\r\n\tpublic NodeType getNodeType();\r\n\t\r\n\t// a possibly empty list of children\r\n\tpublic List<TreeNode> getChildrenNodes();\r\n\t\r\n\t// request a new child node after executing a move\r\n\tpublic TreeNode getChildNode(GameMove move) throws IllegalArgumentException;\r\n\t\r\n\t// the parent node of the current node\r\n\t// current Node == getParentNode for ROOT\r\n\tpublic TreeNode getParentNode();\r\n \r\n\t// whether the current node is the root node\r\n\tpublic Boolean isRootNode();\r\n \r\n\t// returns an object modeling some external state \r\n\tpublic GameState getGameState();\r\n \r\n\t// depth of node in tree\r\n\tpublic int getDepth();\r\n \r\n\t// evaluates/scores the leaf node\r\n\tpublic int scoreLeafNode();\r\n}", "@Override\n\tpublic void run() {\n\t\tMap<Integer, Location> possibleStartLocations = possibleStartLocations();\n\n\t\tfor(Entry<Integer, Location> startLocation : possibleStartLocations.entrySet()) {\n\t\t\t// Add startLocation to visited locations\n\t\t\tMap<Integer, Location> visitedLocations = new HashMap<Integer, Location>();\n\t\t\tvisitedLocations.put(startLocation.getKey(), startLocation.getValue());\n\t\t\t\n\t\t\t// Add startLocation to visited order\n\t\t\tList<Location> visitedOrder = new LinkedList<Location>();\n\t\t\tvisitedOrder.add(startLocation.getValue());\n\t\t\t\n\t\t\t// Start the recursion for the following start node\n\t\t\tfindSolution(startLocation, startLocation, visitedLocations, visitedOrder, 0);\n\t\t}\n\t}", "AstroArg start(AstroArg top);", "public static void main(String[] args) {\n\t\t\r\n\t\tSystem.out.println(traverse(0,0,5,5));\r\n\t}", "void doMcTree() throws NotConnectedException, NotSuspendedException, NoResponseException\n\t{\n\t\t/* wait a bit if we are not halted */\n\t\twaitTilHalted();\n\t\ttry\n\t\t{\n\t\t\tString var = nextToken(); // our variable reference\n\t\t\tString member = \"_target\"; //$NON-NLS-1$\n\t\t\tboolean printPath = false;\n\t\t\tObject result = null;\n\t\t\tString name = null;\n\n\t\t\t// did the user specify a member name\n\t\t\tif (hasMoreTokens())\n\t\t\t{\n\t\t\t\tmember = nextToken();\n\n\t\t\t\t// did they specify some other options\n\t\t\t\twhile(hasMoreTokens())\n\t\t\t\t{\n\t\t\t\t\tString option = nextToken();\n\t\t\t\t\tif (option.equalsIgnoreCase(\"fullpath\")) //$NON-NLS-1$\n\t\t\t\t\t\tprintPath = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// first parse it, then attempt to evaluate the expression\n\t\t\tValueExp expr = parseExpression(var);\n\t\t\tresult = evalExpression(expr).value;\n\n\t\t\tStringBuilder sb = new StringBuilder();\n\n\t\t\tif (result instanceof Variable)\n\t\t\t{\n\t\t\t\tname = ((Variable)result).getName();\n\t\t\t\tresult = ((Variable)result).getValue();\n\t\t\t}\n\n\t\t\t// It worked an should now be a value that we can traverse looking for member properties\n\n\t\t\tif (result instanceof Value)\n\t\t\t{\n\t\t\t\tArrayList<Object> e = new ArrayList<Object>();\n\t\t\t\tdumpTree(new HashMap<Object, String>(), e, name, (Value)result, member);\n\n\t\t\t\t// now sort according to our criteria\n\t\t\t\ttreeResults(sb, e, member, printPath);\n\t\t\t}\n\t\t\telse\n\t\t\t\tthrow new NoSuchVariableException(result);\n\n\t\t\tout( sb.toString() );\n\t\t}\n\t\tcatch(NoSuchVariableException nsv)\n\t\t{\n\t\t\tMap<String, Object> args = new HashMap<String, Object>();\n\t\t\targs.put(\"variable\", nsv.getMessage()); //$NON-NLS-1$\n\t\t\terr(getLocalizationManager().getLocalizedTextString(\"variableUnknown\", args)); //$NON-NLS-1$\n\t\t}\n\t\tcatch(NullPointerException npe)\n\t\t{\n\t\t\terr(getLocalizationManager().getLocalizedTextString(\"couldNotEvaluate\")); //$NON-NLS-1$\n\t\t}\n\t}", "private List<Node> compute() {\n\t\t\tgetGraphFromResolvedTree(root);\n\t\t\tdepthFirst(root);\n\t\t\treturn result;\n\t\t}", "public interface TreeInterface extends SymmetricDigraphInterface {\r\n /** Return parent of a tree node.\r\n * @precondition nonNull(node)\r\n */\r\n public IRNode getParent(IRNode node);\r\n\r\n /** The location is a value used by an IRSequence\r\n * to locate an element. For IRArray, it is an integer.\r\n * @precondition nonNull(node)\r\n */\r\n public IRLocation getLocation(IRNode node);\r\n\r\n /** Return the root of a subtree.\r\n */\r\n public IRNode getRoot(IRNode subtree);\r\n\r\n /** Return an enumeration of nodes in the subtree\r\n * starting with leaves and working toward the node given.\r\n * A postorder traversal.\r\n */\r\n public Iteratable<IRNode> bottomUp(IRNode subtree);\r\n\r\n /** Return an enumeration of nodes in the subtree\r\n * starting with this node and working toward the leaves.\r\n * A preorder traversal.\r\n */\r\n public Iteratable<IRNode> topDown(IRNode subtree);\r\n}", "public abstract void visit();", "default void process(Input input, Output response) { }", "EntryPointResult evaluateSubtree(Object data, Object node, String entryPointName);", "public static void main(String[] args) {\n\t\tint[] arr = new int[] {0,13,65,5,97,25,0,37,22,0,4,28,0,0,32,0};\n//\t\tint[] arr = new int[] {0,13,65,5,0};\n\t\tNode root = createBinaryTreeByArray(arr, 1);\n\t\tSystem.out.print(\"先序遍历:\"+\" \");\n\t\tpreSearch(root);\n\t\tSystem.out.println();\n\t\tSystem.out.print(\"中序遍历:\"+\" \");\n\t\tmidSearch(root);\n\t\tSystem.out.println();\n\t\tSystem.out.print(\"后序遍历:\"+\" \");\n\t\tposSearch(root);\n\t\tSystem.out.println();\n\t\tSystem.out.print(\"DFS:\"+\" \");\n\t\tDFS(root);\n\t\tSystem.out.println();\n\t\tSystem.out.print(\"BFS:\"+\" \");\n\t\tBFS(root);\n\t\tSystem.out.println();\n\t\tSystem.out.print(\"树的最大深度:\"+maxDepth(root));\n\t\tSystem.out.println();\n\t\tSystem.out.print(\"树的最小深度:\"+minDepth(root));\n\t\tSystem.out.println();\n\t\tSystem.out.print(\"该树是否是平衡二叉树\" + balanceTree(root));\n\t\tSystem.out.println();\n\t\tSystem.out.print(\"二叉树翻转\");\n\t\treverse(root);\n\t\tSystem.out.println(\"先序遍历:\");\n\t\tpreSearch(root);\n\t\t\n\t}", "public static void main(String[] args) {\n // TODO Auto-generated method stub\n int[] nums = {3, 2, 1, 6, 0, 5};\n TreeNode root = solution2(nums);\n System.out.println(root.val);\n System.out.println(root.left.val);\n System.out.println(root.left.right.val);\n System.out.println(root.left.right.right.val);\n System.out.println(root.right.val);\n System.out.println(root.right.left.val);\n System.out.println(root.right.right);\n }", "private TreeNode cBST(int begin,int end){\n\n if(begin >= end){ return null;}\n\n int index = (begin + end)/2;\n\n //Left-Visit\n TreeNode l = cBST(begin,index);\n\n //Middle-Visit\n TreeNode root = new TreeNode(cur.val);\n root.left = l;\n cur = cur.next;\n\n //Right-Visit\n TreeNode r = cBST(index+1,end);\n\n //Post-Process and return values\n root.right = r;\n return root;\n }", "private interface OperationOverNodes {\n\t\tvoid operate(Node node);\n\t}", "public void read(Scanner input) {\r\n finalRoot = readInternal(input);\r\n }" ]
[ "0.6035457", "0.5744705", "0.5684813", "0.56583077", "0.55165994", "0.54646844", "0.54209334", "0.5408751", "0.53461057", "0.531973", "0.52993774", "0.5289165", "0.5279782", "0.52788985", "0.5276386", "0.5272718", "0.5223957", "0.5223774", "0.52173275", "0.5210888", "0.51505893", "0.5138083", "0.51233596", "0.51132864", "0.51062346", "0.5090371", "0.5062286", "0.5047921", "0.5043457", "0.50238484", "0.5022995", "0.5020997", "0.50161684", "0.49969178", "0.49841332", "0.4968841", "0.49597177", "0.4952125", "0.494949", "0.49445233", "0.49425012", "0.49405545", "0.4935078", "0.49345702", "0.49324727", "0.49258402", "0.49198627", "0.49184904", "0.4917236", "0.4906121", "0.4905267", "0.49010253", "0.48953462", "0.4883304", "0.4879004", "0.48762134", "0.4863761", "0.48617345", "0.48550352", "0.4848811", "0.48471594", "0.4843041", "0.48404658", "0.48384443", "0.48364267", "0.48292688", "0.48283818", "0.48225203", "0.4820721", "0.4813199", "0.4809407", "0.48051006", "0.4804302", "0.4801835", "0.48001516", "0.47993144", "0.47945344", "0.4794249", "0.4783009", "0.47787905", "0.47745454", "0.4769385", "0.47644046", "0.4763816", "0.47533372", "0.47515178", "0.47507006", "0.47437063", "0.4738636", "0.4737796", "0.4732403", "0.47287452", "0.47275153", "0.4723325", "0.47230658", "0.47174457", "0.47079456", "0.47004622", "0.47003925", "0.46991265" ]
0.5073134
26
following interface with void type in this overloaded function we need three parameters passed from the basic GUI interface
void levelList(Node root, ArrayList< LinkedList< Node > > results, int level) { if(root == null) return; // base case: the outlet of the recursive LinkedList<Node> list = null; // initialize list with null, i.e. we did not create it yet //because we use the DFS therefore we must pass the level as one of the parameter //to pinpoint the level for the current position if(results.size() == level) //now we are visiting a new level we did not visit before { list = new LinkedList<Node>();//now we create a new element which will be stored in results later results.add(list); }else{ //else we have already visited this level and all we need to do is get out of the level //to add the new node into it list = results.get(level); } //ok. now is the kernel operation, i.e. after we locate the level we will add the node anyway list.add(root); //now we can go to the next recursive condition //do not forget to increase the level as the new parameter for the next round levellist(root.left, results, level+1); levellist(root.right, results, level+1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract void actionPerformed(GuiButton guiButton);", "@Override\n\tpublic void guiTinNhan() {\n\n\t}", "public interface GUI {\n\n /**\n * Adds a MouseListener to the GUI.\n * @param mouseListener added to the GUI.\n */\n void addMouseListener(MouseListener mouseListener);\n\n /**\n * Get list link button for other GUIs. \n * @return List of ButtonLink\n */\n List<ButtonLink> getBtnActionLinks();\n\n /**\n * Sets the link identifier of the GUI.\n * @param linkActionGUI link identifier.\n */\n void setMainAction(LinkActionGUI linkActionGUI);\n\n /**\n * Set the boundaries from a rectangle.\n * @param rectangle for borders.\n */\n void setBounds(Rectangle rectangle);\n\n /**\n * Set visibility of the GUI.\n * @param visible for visibility.\n */\n void setVisible(boolean visible);\n\n /**\n * Set background image.\n * @param path of image.\n */\n void setImageBackground(String path);\n\n /**\n * Set the border color and thickness.\n * @param color for border.\n * @param thickness for border.\n */\n void setBorder(Color color, int thickness);\n\n /**\n * Set visibility of the foreground panel of the GUI.\n * @param visible for visibility panel.\n */\n void setVisibleGlassPanel(Visibility visible);\n\n /**\n * Close the GUI and destroyed JFrame.\n */\n void close();\n\n}", "void onAddParameterButtonClick();", "public interface Callback{\n //Required public empty constructor\n public void buttonClicked();\n }", "interface GUIDelegate {\n void mouseClicked(int x, int y) throws UnlocatablePosition;\n\n void errorOccurred(String message);\n\n void keyPressed(int keyCode);\n\n void mouseMovedTo(int x, int y);\n}", "public interface OnClickCallBack\n{\n public void onUIupdate();\n}", "interface ViewListener extends OnToolBarNavigationListener {\n\n /**\n * On build queue\n *\n * @param isPersonal - Is personal flag\n * @param queueToTheTop - Queue to the top\n * @param cleanAllFiles - Clean all files in the checkout directory\n */\n void onBuildQueue(boolean isPersonal,\n boolean queueToTheTop,\n boolean cleanAllFiles);\n\n /**\n * On agent selected in the dialog list\n *\n * @param agentPosition - item position which was selected\n */\n void onAgentSelected(int agentPosition);\n\n /**\n * On add parameter button click\n */\n void onAddParameterButtonClick();\n\n /**\n * On clear all parameters button click\n */\n void onClearAllParametersButtonClick();\n\n /**\n * On parameter added\n *\n * @param name - parameter name\n * @param value - parameter value\n */\n void onParameterAdded(String name, String value);\n }", "@Override\n\tpublic void mouseClicked(int arg0, int arg1, int arg2, int arg3) {\n\n\t}", "abstract void botonDemo_actionPerformed(ActionEvent e);", "@Override //se repita\r\n public void actionPerformed(ActionEvent ae) {\r\n \r\n }", "protected void mouseClicked(int par1, int par2, int par3)\n {\n if (this.buttonId >= 0)\n {\n \t// no setting minimap keybinds to mouse button. Can do so if wanted if I change ZanMinimap to not send every input to Keyboard for processing. Check if it's mouse first\n // this.options.setKeyBinding(this.buttonId, -100 + par3);\n // ((GuiButton)this.controlList.get(this.buttonId)).displayString = this.options.getOptionDisplayString(this.buttonId);\n this.buttonId = -1;\n // KeyBinding.resetKeyBindingArrayAndHash();\n }\n else\n {\n super.mouseClicked(par1, par2, par3);\n }\n }", "@Override\n public void actionPerformed(ActionEvent arg0)\n {\n\n }", "public interface SCDialogCallback {\n\tpublic void onAction1();\n\tpublic void onAction2();\n\tpublic void onAction3();\n\tpublic void onAction4();\n}", "public abstract void actionPerformed(String string);", "protected void actionPerformed(GuiButton par1GuiButton)\n {\n if (par1GuiButton.id == 0)\n {\n this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));\n }\n\n if (par1GuiButton.id == 5)\n {\n this.mc.displayGuiScreen(new GuiLanguage(this, this.mc.gameSettings));\n }\n\n if (par1GuiButton.id == 1)\n {\n this.mc.displayGuiScreen(new GuiSelectWorld(this));\n }\n\n if (par1GuiButton.id == 2)\n {\n this.mc.displayGuiScreen(new GuiMultiplayer(this));\n }\n\n if (par1GuiButton.id == 3)\n {\n this.mc.displayGuiScreen(new GuiTexturePacks(this));\n }\n\n if (par1GuiButton.id == 4)\n {\n this.mc.shutdown();\n }\n }", "@Override\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\t\t\n\t\t\t}", "static interface ElementSelectionListener {\n \n public void selectionChanged(MultiViewDescription oldOne, MultiViewDescription newOne);\n \n public void selectionActivatedByButton(MouseEvent e);\n \n public void selectionActivatedByButton(ActionEvent e);\n \n }", "public abstract void buttonPressed();", "protected abstract void pressedOKButton( );", "@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}", "public interface clsMakeKotActListener\n{\n void setTableSelectedResult(String strTableNo, String strTableName, String status,String areaCode);\n void setDirectKotItemListSelectedResult1(String strTableNo, String strTableName, String strWaiterNo, String strWaiterName, String status, double kotAmt, double cardBalance, String cardType, int paxNo, String cardNo, String strLinkedWaiterNo,String areaCode);\n void setWaiterSelectedResult(String strWaiterNo, String strWaiterName);\n void funRefreshItemDtl(String strItemCode, String strItemName, String strSubGroupCode, double dblSalePrice);\n void setMenuItemSelectionCodeResult(String strMenuItemCode, String strMenuItemName, String strMenuType);\n void setSelectedPaxResult(int strPaxNo);\n void setSelectedOtherOptionsResult(String strNcKot, String strRemark, String strReasonCode);\n}", "public abstract void executeBagButton();", "@Override\n\tpublic abstract void actionPerformed(ActionEvent arg0);", "public void textBoxAction( TextBoxWidgetExt tbwe ){}", "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\tpublic void actionPerformed(ActionEvent arg0) {\n\n\t}", "@Override\n\tpublic void actionPerformed(ActionEvent arg0) {\n\n\t}", "@Override\n\tpublic void actionPerformed(ActionEvent arg0) {\n\n\t}", "@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}", "abstract void buttonPressed(TestJson test);", "public void buttonClicked();", "protected void actionPerformed(GuiButton par1GuiButton)\n {\n for (int var2 = 0; var2 < this.options.keyBindings.length; ++var2)\n {\n ((GuiButton)this.controlList.get(var2)).displayString = this.options.getOptionDisplayString(var2);\n }\n\n if (par1GuiButton.id == 200)\n {\n this.mc.displayGuiScreen(this.parentScreen);\n }\n else\n {\n this.buttonId = par1GuiButton.id;\n par1GuiButton.displayString = \"> \" + this.options.getOptionDisplayString(par1GuiButton.id) + \" <\"; // what is this even for.. it gets overwritten in drawScreen\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\t\tpublic void actionPerformed(ActionEvent arg0) \n\t\t{\n\t\t\t\n\t\t}", "void successUiUpdater();", "public abstract void actionPerformed(Control control);", "abstract void botonAyuda_actionPerformed(ActionEvent e);", "@Override\n\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\n\t}", "@Override\n\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\n\t}", "@Override\n\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\n\t}", "@Override\n\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\n\t}", "@Override\n\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\n\t}", "@Override\n\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\n\t}", "@Override\n\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\n\t}", "@Override\n\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\n\t}", "@Override\n\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\n\t}", "@Override\r\n\tpublic void actionPerformed(ActionEvent arg0) {\n\r\n\t}", "@Override\n public void initGUI() {\n\n }", "@Override\n\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\n\t\t\n\t}", "void showAddParameterDialog();", "@Override\n\tpublic void actionPerformed(ActionEvent arg0)\n\t{\n\t\t\n\t}", "@Override\n\tpublic void transitToGUI(int i) {\n\t\t\n\t}", "@Override\n public void update(Observable arg0, Object arg1) {\n Object[] array = (Object[]) arg1;\n int type = (int) array[0];\n String message = (String) array[1];\n\n if (type == 0) {\n JOptionPane.showMessageDialog(this, message, \"Error!\",\n JOptionPane.ERROR_MESSAGE);\n } else if (type == 1) {\n JOptionPane.showMessageDialog(this, message, \"Success!\",\n JOptionPane.INFORMATION_MESSAGE);\n }\n\n }", "@Override\npublic void actionPerformed(ActionEvent arg0) {\n\t\n}", "public void interfaceIHM(){\n VBox contenue;\n ActionBouttonPartieEnCours action = new ActionBouttonPartieEnCours(this.duelSurLaToile, this);\n Label nom = new Label(\"Jeu : \"+this.nom);\n Label joueurs = new Label(\"Vous VS \"+this.adversaire);\n Label resultat = new Label(this.scoreJoueur+\" VS \"+this.scoreAdversaire);\n Button accepter = new Button(\"Rejoindre\");\n accepter.setStyle(\"-fx-background-color: #ffffff ;\");\n accepter.setMinWidth(135);\n accepter.setMaxWidth(135);\n accepter.setUserData(this.id);\n Button refuser = new Button(\"Abandonner\");\n refuser.setStyle(\"-fx-background-color: #ffffff ;\");\n refuser.setMinWidth(135);\n refuser.setMaxWidth(135);\n refuser.setUserData(this.id);\n image.setFitWidth(130);\n image.setFitHeight(130);\n contenue=new VBox();\n contenue.getChildren().addAll(nom,joueurs,resultat,accepter,refuser);\n contenue.setSpacing(5);\n contenue.setAlignment(Pos.CENTER_LEFT);\n contenue.setMaxWidth(refuser.getMaxWidth());\n this.setLeft(contenue);\n this.setRight(image);\n accepter.setOnAction(action);\n refuser.setOnAction(action);\n BorderPane.setAlignment(contenue,Pos.CENTER);\n BorderPane.setMargin(contenue,new Insets(10,10,10,10));\n BorderPane.setMargin(image,new Insets(10,10,10,10));\n this.setBackground(new Background(new BackgroundFill(Color.LIGHTGRAY, null, null)));\n }", "private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {\n }", "private void jButton3MouseClicked(java.awt.event.MouseEvent evt) {\n }", "abstract void onClick(MouseClick click);", "private void mymethods() {\n\t\tNew.addActionListener(new ActionListener()\r\n\t\t{\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\r\n\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\tta1.setText(\" \");\r\n\t\t\t}\r\n\t\t\t\r\n\t\t});\r\n\t\t\r\n\t\t\r\n\t}", "public void buttonFunctions(){\n runSim.addActionListener((ActionEvent q) -> {\n simulation = new Secretary();\n setNewValues();\n simulation.runSim();\n showDetails.setEnabled(true);\n showResults(); \n });\n showDetails.addActionListener((ActionEvent e) -> {\n resultDisplay.setText(simulation.getResults());\n resultFrame.setVisible(true); \n });\n changeSimProp.addActionListener((ActionEvent ch) ->{\n changeFrame.setVisible(true);\n });\n okay.addActionListener((ActionEvent ok) ->{ \n changeFrame.setVisible(false);\n });\n programDescription.addActionListener((ActionEvent d)->{\n descriptionDisplay.setText(programD());\n dFrame.setVisible(true);\n });\n }", "public interface ViewMain {\n void showProvince(List<String> data);\n void showCity(List<String> data, String params);\n void onBtnClick(String kotaasal, String kotatujuan, String weight, String courier);\n}", "@Override\n\tpublic void signalToUi(int type, Object data) {\n\t\t\n\t}", "public abstract void executeRunButton();", "public interface ItemClickCallBack {\n void nItemClick(int position, Object obj);\n}", "@Override\n\t\t\tpublic void actionPerformed(java.awt.event.ActionEvent e) {\n\t\t\t\t\n\t\t\t}", "void onRenderGui(RenderArguments arguments);", "public void actionPerformed(ActionEvent arg0) {\n }", "void controlador(ActionListener ctr);", "public GUIListener(){}", "public void actionPerformed(java.awt.event.ActionEvent e) {\n\t\t\t\t\tif (e.getActionCommand().equals(\"Parametres\")) {\r\n\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\tHistorique.ecrire(\"Ouverture de : \"+e);\r\n\t\t\t\t\t\t} catch (IOException e1) {\r\n\t\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\t\te1.printStackTrace();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tnew FEN_Param();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}", "void setGui(Gui gui);", "public interface GDCClickDataFieldCallback {\n public void fieldClicked(int tag);\n}", "public void actionPerformed(ActionEvent arg0)\n {\n\t \n }", "@Override\r\n public void actionPerformed(ActionEvent e)\r\n {\n \r\n }", "public interface InputDialogCallback {\n public void onAction1(String response);\n public void onAction2();\n\n}", "@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\t\n\t\t\t}", "public interface GUI {\r\n\r\n public SPLGraph getSoundLevelGraph();\r\n\r\n public int getHeight();\r\n\r\n public int getWidth();\r\n\r\n public float getLabelWidth(String label, boolean antiAlias);\r\n\r\n public float getLabelHeight(String label, boolean antiAlias);\r\n\r\n public void drawLine(NTColor color, float x1, float y1, float x2, float y2, boolean antiAlias, boolean hairline);\r\n\r\n public void drawLabel(String label, NTColor labelColor, float x, float y, boolean antiAlias);\r\n\r\n public void drawSurface(NTColor color, ArrayList<Float> xs, ArrayList<Float> ys, boolean antiAlias);\r\n\r\n }", "public interface inews_Main4_SetEvent {\n void main4_setView(View v, int p);\n}", "@Override\n public void actionPerformed(ActionEvent e) {\n\n }", "private void funcionActionPerformed(java.awt.event.ActionEvent evt) {\n }", "@Override\n public void actionPerformed(ActionEvent e) {\n }", "@Override\n public void actionPerformed(ActionEvent e) {\n }", "void onClick();", "protected void mouseClicked(int par1, int par2, int par3)\n {\n if (par3 == 0)\n {\n ChatClickData chatclickdata = mc.ingameGUI.func_50012_a(Mouse.getX(), Mouse.getY());\n\n if (chatclickdata != null)\n {\n URI uri = chatclickdata.func_50089_b();\n\n if (uri != null)\n {\n field_50065_j = uri;\n mc.displayGuiScreen(new GuiChatConfirmLink(this, this, chatclickdata.func_50088_a(), 0, chatclickdata));\n return;\n }\n }\n }\n\n field_50064_a.mouseClicked(par1, par2, par3);\n super.mouseClicked(par1, par2, par3);\n }", "@Override\r\n public void actionPerformed(ActionEvent e) {\n \r\n }", "public interface NumberBtnInterface {\n\n void onNumberSelected(int selectedNumber);\n\n}", "@Override\n public void actionPerformed(AnActionEvent e) {\n }", "public interface ViewInterface {\n\n\n /**\n * Get the set of feature callbacks that the view can use.\n *\n * @param f the set of feature callbacks as a Features object\n */\n void setFeatures(Features f) throws Exception;\n\n\n /**\n * Set the image that is showing what the model stores.\n * @param image a IViewModel that the model image data represents.\n */\n void setImage(IViewModel image);\n\n\n /**\n * Handle the error thrown during the interaction between the view and user.\n * @param ex the exception that is thrown\n */\n void handleError(Exception ex);\n\n\n /**\n * It cleans the script text area in the view.\n */\n void cleanScript();\n\n /**\n * It shows success dialog.\n */\n void showSuccess();\n\n /**\n * It returns the path of the chosen file.\n * file.\n * @return Null if user doesn't choose any file else the chosen file's path\n */\n String userChosen();\n\n /**\n * It returns the user input String.\n * @param question the question that user will see.\n * @return null if user doesn't give any input else user's String input.\n */\n String userInput(String question);\n\n /**\n * User will enter a file name and choose a directory where they want to save the file\n * with the file name. It returns the file path including the file name that the user picks.\n * @param question The question that asks the file name.\n * @return A string that represents the file path.\n */\n String userStoreAddress(String question);\n\n /**\n * It returns the String in text area.\n * @return user's input from text area\n */\n String userInputFromTextArea();\n\n /**\n * It returns the color that the user chooses.\n * @return a color\n */\n Color userColorChoose();\n\n /**\n * It returns the point that the user clicks with mouse.\n * @return a point\n */\n Point userClickPoint();\n\n\n\n\n\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 }", "public interface IGUIEvent {\n\n\n /**\n * Returns the source of the event.\n * \n * @return the source.\n */\n public abstract Object getSource();\n\n\n /**\n * Consumes the event.\n */\n public abstract void consume();\n\n\n /**\n * Returns whether this event has been consumed.\n * \n * @return <CODE>true</CODE> if the event has been consumed;\n * <CODE>false</CODE> otherwise.\n */\n public abstract boolean isConsumed();\n}", "@Override\n\tpublic void actionPerformed(java.awt.event.ActionEvent e) {\n\n\t}" ]
[ "0.63986534", "0.63522017", "0.62565607", "0.6122353", "0.6058947", "0.6008733", "0.59794164", "0.59765404", "0.59593165", "0.5941216", "0.5938274", "0.59082323", "0.58889914", "0.5884556", "0.587794", "0.5876319", "0.587236", "0.58506465", "0.5836368", "0.5818087", "0.58172095", "0.58172095", "0.5817154", "0.581592", "0.5809764", "0.58074504", "0.5800436", "0.57986647", "0.57986647", "0.57986647", "0.5795586", "0.5795586", "0.57897717", "0.5787769", "0.5782582", "0.5777001", "0.5777001", "0.5777001", "0.5777001", "0.5777001", "0.5777001", "0.57696754", "0.5761042", "0.57608116", "0.57569325", "0.5750097", "0.5750097", "0.5750097", "0.5750097", "0.5750097", "0.5750097", "0.5750097", "0.5750097", "0.5750097", "0.57416034", "0.57316184", "0.5730981", "0.5725698", "0.57251334", "0.57046336", "0.5697567", "0.56806225", "0.5673776", "0.5671144", "0.56707656", "0.566741", "0.5660198", "0.5655616", "0.56547254", "0.5650115", "0.56495506", "0.5639975", "0.5639378", "0.5637776", "0.56358236", "0.56325376", "0.563129", "0.5620392", "0.56130147", "0.5611938", "0.5610802", "0.56095344", "0.5603373", "0.56025857", "0.560014", "0.5600054", "0.55988365", "0.55861396", "0.5584461", "0.5584461", "0.558152", "0.558093", "0.55777115", "0.55739003", "0.5573078", "0.55718815", "0.5570862", "0.5570862", "0.5570862", "0.55673456", "0.55622905" ]
0.0
-1
////////////////////////////////////////////////////////////////////////// End of custom mappings //////////////////////////////////////////////////////////////////////////
public Patient() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void mapping() {\n\t\t\n\t}", "public abstract AnnotationMap mo30683d();", "private static void createTypeMap() {\n\n }", "@Override\n public String mapping() {\n return StringUtils.lines(\n \"foo.bar.Baz -> foo.bar.Baz:\", \" java.lang.Object f1 -> a\", \" java.lang.String f2 -> a\");\n }", "MapType map(List<ReferenceOrderedDatum> rodData, char ref, LocusContext context);", "private OwBootstrapToIdMapping()\r\n {\r\n\r\n }", "protected Map method_1552() {\n return super.method_1552();\n }", "private LinkedHashMap<String, Type> scalarMappingODU() {\r\n\t\tLinkedHashMap<String, Type> scalarMapping = new LinkedHashMap<String, Type>();\r\n\t\tscalarMapping.put(DaoConstants.MAP_ODUID, StandardBasicTypes.LONG); // 0\r\n\t\tscalarMapping.put(DaoConstants.MAP_SITE_GROUP,\r\n\t\t\t\tStandardBasicTypes.STRING); // 1\r\n\t\tscalarMapping.put(DaoConstants.MAP_PARENT_CHILD,\r\n\t\t\t\tStandardBasicTypes.STRING); // 2\r\n\t\tscalarMapping.put(DaoConstants.MAP_NAME, StandardBasicTypes.STRING); // 3\r\n\t\tscalarMapping.put(DaoConstants.MAP_CENTRAL_ADDRESS,\r\n\t\t\t\tStandardBasicTypes.STRING); // 4\r\n\t\tscalarMapping.put(DaoConstants.MAP_PARENT_ID, StandardBasicTypes.LONG); // 5\r\n\t\tscalarMapping.put(DaoConstants.MAP_TYPE, StandardBasicTypes.STRING); // 6\r\n\t\tscalarMapping.put(DaoConstants.MAP_SVGMAXLATITUDE,\r\n\t\t\t\tStandardBasicTypes.DOUBLE); // 7\r\n\t\tscalarMapping.put(DaoConstants.MAP_SVGMAXLONGITUDE,\r\n\t\t\t\tStandardBasicTypes.DOUBLE); // 8\r\n\t\tscalarMapping.put(DaoConstants.MAP_SVGMINLATITUDE,\r\n\t\t\t\tStandardBasicTypes.DOUBLE); // 9\r\n\t\tscalarMapping.put(DaoConstants.MAP_SVGMINLONGITUDE,\r\n\t\t\t\tStandardBasicTypes.DOUBLE); // 10\r\n\t\tscalarMapping.put(DaoConstants.MAP_ODU_SVG_PATH,\r\n\t\t\t\tStandardBasicTypes.STRING); // 11\r\n\t\tscalarMapping.put(DaoConstants.MAP_SEVERITY, StandardBasicTypes.STRING); // 12\r\n\t\tscalarMapping.put(DaoConstants.MAP_SLINKADD, StandardBasicTypes.STRING); // 13\r\n\t\tscalarMapping.put(DaoConstants.MAP_ALARM_CODE,\r\n\t\t\t\tStandardBasicTypes.STRING); // 14\r\n\t\tscalarMapping.put(DaoConstants.MAP_C2, StandardBasicTypes.DOUBLE); // 15\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Outdoor\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Temp\r\n\t\tscalarMapping\r\n\t\t\t\t.put(DaoConstants.MAP_THRESHOLD_1, StandardBasicTypes.LONG); // 16\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// CompressorWorkingHrs_1\r\n\t\tscalarMapping\r\n\t\t\t\t.put(DaoConstants.MAP_THRESHOLD_2, StandardBasicTypes.LONG); // 17\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// CompressorWorkingHrs_2\r\n\t\tscalarMapping\r\n\t\t\t\t.put(DaoConstants.MAP_THRESHOLD_3, StandardBasicTypes.LONG); // 18\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// CompressorWorkingHrs_3\r\n\t\tscalarMapping\r\n\t\t\t\t.put(DaoConstants.MAP_THRESHOLD_4, StandardBasicTypes.LONG); // 19\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// PAC\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// CompressorWorkingHrs\r\n\t\tscalarMapping\r\n\t\t\t\t.put(DaoConstants.MAP_THRESHOLD_5, StandardBasicTypes.LONG); // 20\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// EngineWorkingHrs\r\n\t\tscalarMapping\r\n\t\t\t\t.put(DaoConstants.MAP_THRESHOLD_6, StandardBasicTypes.LONG); // 21\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// NOT_IN_USE_EnginOilChange\r\n\t\tscalarMapping.put(DaoConstants.MAP_G44, StandardBasicTypes.STRING); // 22\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// GenerationPower\r\n\t\tscalarMapping.put(DaoConstants.MAP_SVGID, StandardBasicTypes.LONG); // 23\r\n\t\tscalarMapping.put(DaoConstants.MAP_SVGNAME, StandardBasicTypes.STRING); // 24\r\n\t\tscalarMapping.put(DaoConstants.MAP_VRFHRS1, StandardBasicTypes.DOUBLE); // 25\r\n\t\tscalarMapping.put(DaoConstants.MAP_VRFHRS2, StandardBasicTypes.DOUBLE); // 26\r\n\t\tscalarMapping.put(DaoConstants.MAP_VRFHRS3, StandardBasicTypes.DOUBLE); // 27\r\n\t\tscalarMapping.put(DaoConstants.MAP_PACHRS, StandardBasicTypes.DOUBLE); // 28\r\n\t\tscalarMapping.put(DaoConstants.MAP_GHPHRS, StandardBasicTypes.DOUBLE); // 29\r\n\t\tscalarMapping.put(DaoConstants.MAP_GHPOIL, StandardBasicTypes.DOUBLE); // 30\r\n\t\tscalarMapping.put(DaoConstants.MAP_SITEPATH, StandardBasicTypes.STRING); // 31\r\n\t\tscalarMapping.put(DaoConstants.MAP_COMPANYNAME,\r\n\t\t\t\tStandardBasicTypes.STRING); // 32\r\n\t\tscalarMapping.put(DaoConstants.MAP_CASTATUS, StandardBasicTypes.STRING); // 33\r\n\t\tscalarMapping.put(DaoConstants.MAP_V23, StandardBasicTypes.STRING); // 34\r\n\t\t// Demand\r\n\t\tscalarMapping.put(DaoConstants.MAP_COMPRESSOR1,\r\n\t\t\t\tStandardBasicTypes.BOOLEAN); // 35\r\n\t\tscalarMapping.put(DaoConstants.MAP_COMPRESSOR2,\r\n\t\t\t\tStandardBasicTypes.BOOLEAN); // 36\r\n\t\tscalarMapping.put(DaoConstants.MAP_COMPRESSOR3,\r\n\t\t\t\tStandardBasicTypes.BOOLEAN); // 37\r\n\t\t//add by shanf\r\n\t\tscalarMapping.put(DaoConstants.DEVICE_MODEL,\r\n\t\t\t\tStandardBasicTypes.STRING); // 38\r\n\r\n\t\treturn scalarMapping;\r\n\t}", "@Override\r\n\tpublic void exportMap() {\n\r\n\t}", "@Override\n\tpublic void VisitMapLiteralNode(BunMapNode Node) {\n\n\t}", "public Mapping mapSharedTo(TracePosition trace) {\n\tthrow new SubclassResponsibilityException();\n/*\nudanax-top.st:9654:OrglRoot methodsFor: 'accessing'!\n{Mapping} mapSharedTo: trace {TracePosition}\n\t\"return a mapping from my data to corresponding stuff in the given trace\"\n\tself subclassResponsibility!\n*/\n}", "@Mapper(componentModel = \"spring\")\npublic interface DataDictItemMapping {\n DataDictItemVo asDataDictItemVo(DataDictItem entity);\n\n DataDictItemOrdinaryVo asOrdinary(DataDictItem entity);\n\n @Mapping(target = \"priority\", ignore = true)\n @Mapping(target = \"lastUpdater\", ignore = true)\n @Mapping(target = \"lastUpdatedAt\", ignore = true)\n @Mapping(target = \"id\", ignore = true)\n @Mapping(target = \"dictId\", ignore = true)\n @Mapping(target = \"creator\", ignore = true)\n @Mapping(target = \"createdAt\", ignore = true)\n DataDictItem asDataDictItem(DataDictItemInsertRo ro);\n\n DataDictItemComplexVo asComplex(DataDictItem entity);\n\n DataDictItem asDataDictItem(DataDictItemUpdateRo ro);\n}", "protected AusschreibungMapper() {\r\n\t}", "public interface MappingManager\r\n{\r\n public static final String METADATA_EXTENSION_INSERT_FUNCTION = \"insert-function\";\r\n public static final String METADATA_EXTENSION_UPDATE_FUNCTION = \"update-function\";\r\n public static final String METADATA_EXTENSION_SELECT_FUNCTION = \"select-function\";\r\n\r\n /**\r\n * Accessor for whether a java type is supported as being mappable.\r\n * @param javaTypeName The java type name\r\n * @return Whether the class is supported (to some degree)\r\n */\r\n boolean isSupportedMappedType(String javaTypeName);\r\n\r\n /**\r\n * Accessor for the JavaTypeMapping class for the supplied java type.\r\n * @param javaTypeName The java type name\r\n * @return The JavaTypeMapping class to use\r\n */\r\n Class<? extends JavaTypeMapping> getMappingType(String javaTypeName);\r\n\r\n /**\r\n * Method to create the column mapping for a java type mapping at a particular index.\r\n * @param mapping The java mapping\r\n * @param fmd MetaData for the field\r\n * @param index Index of the column\r\n * @param column The column\r\n * @return The column mapping\r\n */\r\n ColumnMapping createColumnMapping(JavaTypeMapping mapping, AbstractMemberMetaData fmd, int index, Column column);\r\n\r\n /**\r\n * Method to create the column mapping for a particular column and java type.\r\n * @param mapping The java mapping\r\n * @param column The column\r\n * @param javaType The java type (isn't this stored in the java mapping ?)\r\n * @return The column mapping\r\n */\r\n ColumnMapping createColumnMapping(JavaTypeMapping mapping, Column column, String javaType);\r\n\r\n /**\r\n * Accessor for a mapping, for a java type.\r\n * Same as calling \"getMapping(c, false, false, (String)null);\"\r\n * @param javaType The java type\r\n * @return The mapping\r\n */\r\n JavaTypeMapping getMapping(Class javaType);\r\n\r\n /**\r\n * Accessor for a mapping, for a java type.\r\n * @param javaType The java type\r\n * @param serialised Whether the type is serialised\r\n * @param embedded Whether the type is embedded\r\n * @param fieldName Name of the field (for logging only)\r\n * @return The mapping\r\n */\r\n JavaTypeMapping getMapping(Class javaType, boolean serialised, boolean embedded, String fieldName);\r\n\r\n /**\r\n * Accessor for a mapping, for a java type complete with the column mapping.\r\n * @param javaType The java type\r\n * @param serialised Whether the type is serialised\r\n * @param embedded Whether the type is embedded\r\n * @param clr ClassLoader resolver\r\n * @return The mapping\r\n */\r\n JavaTypeMapping getMappingWithColumnMapping(Class javaType, boolean serialised, boolean embedded, ClassLoaderResolver clr);\r\n\r\n /**\r\n * Accessor for the mapping for the field of the specified table.\r\n * Can be used for fields of a class, elements of a collection of a class, elements of an array of a class, keys of a map of a class, values of a map of a class. \r\n * This is controlled by the final argument \"roleForMember\".\r\n * @param table Table to add the mapping to\r\n * @param mmd MetaData for the field/property to map\r\n * @param clr The ClassLoaderResolver\r\n * @param fieldRole Role that this mapping plays for the field/property\r\n * @return The mapping for the field.\r\n */\r\n JavaTypeMapping getMapping(Table table, AbstractMemberMetaData mmd, ClassLoaderResolver clr, FieldRole fieldRole);\r\n\r\n /**\r\n * Method to create a column in a container (table).\r\n * @param mapping The java mapping\r\n * @param javaType The java type\r\n * @param datastoreFieldIndex The index of the column to create\r\n * @return The column\r\n */\r\n Column createColumn(JavaTypeMapping mapping, String javaType, int datastoreFieldIndex);\r\n\r\n /**\r\n * Method to create a column in a container (table).\r\n * To be used for serialised PC element/key/value in a join table.\r\n * @param mapping The java mapping\r\n * @param javaType The java type\r\n * @param colmd MetaData for the column to create\r\n * @return The column\r\n */\r\n Column createColumn(JavaTypeMapping mapping, String javaType, ColumnMetaData colmd);\r\n\r\n /**\r\n * Method to create a column for a persistable mapping.\r\n * @param fmd MetaData for the field\r\n * @param table Table in the datastore\r\n * @param mapping The java mapping\r\n * @param colmd MetaData for the column to create\r\n * @param referenceCol The column to reference\r\n * @param clr ClassLoader resolver\r\n * @return The column\r\n */\r\n Column createColumn(AbstractMemberMetaData fmd, Table table, JavaTypeMapping mapping, ColumnMetaData colmd, Column referenceCol, ClassLoaderResolver clr);\r\n}", "protected ForwardingMap() {}", "protected ForwardingMapEntry() {}", "public abstract String[] map() throws TooFewNocNodesException;", "@Override\n public HashMap<String, List<String>> initializeMapping(HashMap<String, List<String>> mapping) {\n mapping.put(\"xEncoder\", Arrays.asList(\"outtakeMotor1\", \"outtake1\"));\n mapping.put(\"yEncoder\", Arrays.asList(\"wobbleMotor\"));\n\n return mapping;\n }", "public interface PostCatgMapper {\n\n}", "@Override\n\tpublic List<String> getMappings() {\n\t\treturn mappings;\n\t}", "public interface MappedInput {\n\n void addMappings();\n void removeMappings();\n\n}", "@Override\n\t\t\t\t\tpublic Element handleMap(ElementContainer<?> parent,\n\t\t\t\t\t\t\tFMapType src) {\n\t\t\t\t\t\treturn super.handleMap(parent, src);\n\t\t\t\t\t}", "public interface Mappable {\n\n /**\n * A string to represent an object on the map.\n * @return A string to represent the object.\n */\n String getMapCode();\n}", "public AbstractTypeMapping()\n {\n super();\n }", "private ImageMappings() {}", "@Override\n\tpublic void convertitMap(Map<String, Object> map) {\n\t\t\n\t}", "protected WumpusMap() {\n\t\t\n\t}", "private Map getMapping() {\n return getIndexOperations().getMapping();\n }", "public void testEntrySetIteratorHasProperMappings() {\n return;\r\n }", "public interface MapObjectType {\n}", "private static HashMap<String, String> initMapping()\n {\n HashMap<String, String> typeMapping = new HashMap<String, String>();\n\n typeMapping.put(\"boolean\", \"boolean\");\n typeMapping.put(\"float\", \"float\");\n typeMapping.put(\"double\", \"double\");\n typeMapping.put(\"byte\", \"byte\");\n typeMapping.put(\"unsignedByte\", \"short\");\n typeMapping.put(\"short\", \"short\");\n typeMapping.put(\"unsignedShort\", \"int\");\n typeMapping.put(\"int\", \"int\");\n typeMapping.put(\"integer\", \"java.math.BigDecimal\");\n typeMapping.put(\"positiveInteger\", \"java.math.BigInteger\");\n typeMapping.put(\"unsignedInt\", \"java.math.BigInteger\");\n typeMapping.put(\"long\", \"java.math.BigInteger\");\n typeMapping.put(\"unsignedLong\", \"java.math.BigDecimal\");\n typeMapping.put(\"decimal\", \"java.math.BigDecimal\");\n typeMapping.put(\"string\", \"String\");\n typeMapping.put(\"hexBinary\", \"byte[]\");\n typeMapping.put(\"base64Binary\", \"byte[]\");\n typeMapping.put(\"dateTime\", \"javax.xml.datatype.XMLGregorianCalendar\");\n typeMapping.put(\"time\", \"javax.xml.datatype.XMLGregorianCalendar\");\n typeMapping.put(\"date\", \"javax.xml.datatype.XMLGregorianCalendar\");\n typeMapping.put(\"gDay\", \"javax.xml.datatype.XMLGregorianCalendar\");\n typeMapping.put(\"gMonth\", \"javax.xml.datatype.XMLGregorianCalendar\");\n typeMapping.put(\"gMonthDay\", \"javax.xml.datatype.XMLGregorianCalendar\");\n typeMapping.put(\"gYear\", \"javax.xml.datatype.XMLGregorianCalendar\");\n typeMapping.put(\"gYearMonth\", \"javax.xml.datatype.XMLGregorianCalendar\");\n typeMapping.put(\"duration\", \"javax.xml.datatype.Duration\");\n typeMapping.put(\"NOTATION\", \"javax.xml.namespace.QName\");\n typeMapping.put(\"QName\", \"javax.xml.namespace.QName\");\n typeMapping.put(\"anyURI\", \"String\");\n typeMapping.put(\"Name\", \"String\");\n typeMapping.put(\"NCName\", \"String\");\n typeMapping.put(\"negativeInteger\", \"java.math.BigDecimal\");\n typeMapping.put(\"NMTOKEN\", \"String\");\n typeMapping.put(\"nonNegativeInteger\", \"java.math.BigDecimal\");\n typeMapping.put(\"nonPositiveInteger\", \"java.math.BigDecimal\");\n typeMapping.put(\"normalizedString\", \"String\");\n typeMapping.put(\"token\", \"String\");\n typeMapping.put(\"any\", \"Object\");\n\n return typeMapping;\n }", "@Override\n\t\t\t\t\tpublic Attribute handleMapKey(Element parent, FTypeRef src) {\n\t\t\t\t\t\treturn super.handleMapKey(parent, src);\n\t\t\t\t\t}", "protected FileBasedElementMapping() {\n\t}", "@Override\n public void reloadCachedMappings() {\n }", "@Override\n public void reloadCachedMappings() {\n }", "private void mapValues() {\n\t\tmap.put(1, \"I\");\r\n\t\tmap.put(5, \"V\");\r\n\t\tmap.put(10, \"X\");\r\n\t\tmap.put(50, \"L\");\r\n\t\tmap.put(100, \"C\");\r\n\t\tmap.put(500, \"D\");\r\n\t\tmap.put(1000, \"M\");\r\n\t}", "public abstract void map(String key, String value) throws Exception;", "@Override\r\n public void process() {\r\n if (isDirectEmbeddableCollection()) {\r\n ObjectArrayMapping mapping = new ObjectArrayMapping();\r\n \r\n // Add the mapping to the descriptor.\r\n setMapping(mapping);\r\n \r\n // Set the reference class name.\r\n mapping.setReferenceClassName(getReferenceClassName());\r\n \r\n // Set the attribute name.\r\n mapping.setAttributeName(getAttributeName());\r\n \r\n // Will check for PROPERTY access\r\n setAccessorMethods(mapping);\r\n \r\n mapping.setStructureName(getDatabaseType());\r\n \r\n // Process the @Column or column element if there is one.\r\n // A number of methods depend on this field so it must be\r\n // initialized before any further processing can take place.\r\n mapping.setField(new ObjectRelationalDatabaseField(getDatabaseField(getDescriptor().getPrimaryTable(), MetadataLogger.COLUMN)));\r\n } else {\r\n ArrayMapping mapping = new ArrayMapping();\r\n \r\n // Add the mapping to the descriptor.\r\n setMapping(mapping);\r\n \r\n // Set the attribute name.\r\n mapping.setAttributeName(getAttributeName());\r\n \r\n // Will check for PROPERTY access\r\n setAccessorMethods(mapping);\r\n \r\n mapping.setStructureName(getDatabaseType());\r\n \r\n // Process the @Column or column element if there is one.\r\n // A number of methods depend on this field so it must be\r\n // initialized before any further processing can take place.\r\n mapping.setField(new ObjectRelationalDatabaseField(getDatabaseField(getDescriptor().getPrimaryTable(), MetadataLogger.COLUMN)));\r\n }\r\n }", "public T caseMapping(Mapping object) {\n\t\treturn null;\n\t}", "private VariableMap getParamMappingAsVariableMap() {\n paramValueEncodings.put(fileNameToIndex.keySet().toString(), \" FileNames\");\n paramValueEncodings.put(functionNameToIndex.keySet().toString(), \" FunctionNames\");\n paramValueEncodings.put(typeToIndex.keySet().toString(), \" Types\");\n\n VariableMap preInversedMap = new VariableMap(paramValueEncodings);\n ImmutableMap<String, String> inversedMap = preInversedMap.getNewNameToOriginalNameMap();\n return new VariableMap(inversedMap);\n }", "private void ini_MapPaks()\r\n\t{\r\n\r\n\t}", "void onRemap(String id);", "public abstract void createMap();", "public final Caseless getMapping() {\n\t\treturn mappedto;\n\t}", "XClass getMapKey();", "protected MapImpl() {\n }", "protected Mapping(String name) {\n this.name = name;\n }", "@Mapper\npublic interface MissionMapper {\n\n MissionMapper INSTANCE = Mappers.getMapper(MissionMapper.class);\n\n @Mapping(source = \"izQuestion\", target = \"izQuestion\")\n @Mapping(source = \"missionDescription\", target = \"missionDescription\")\n @Mapping(source = \"missionName\", target = \"missionName\")\n @Mapping(source = \"shortDescription\", target = \"shortDescription\")\n @Mapping(source = \"winnerScore\", target = \"winnerScore\")\n @Mapping(source = \"storyId\", target = \"story.id\")\n Mission dtoToMission (MissionDTO missionDTO);\n}", "@Mapper(componentModel = SpringContextUtil.SPRING)\npublic interface MapstructService {\n\n @Mappings({\n @Mapping(source = \"alId\", target = \"blId\"),\n @Mapping(source = \"alName\", target = \"blName\"),\n @Mapping(source = \"alDate\", target = \"blDate\", dateFormat = DateUtil.DATE_FORMAT_MINUTE),\n @Mapping(target = \"blSum\", expression = \"java(amo.getAlId() * 100)\"),\n @Mapping(target = \"blbb\", constant = \"别bb\")\n })\n Bmo convert(Amo amo);\n}", "public Rule mapType()\n \t{\n \t\treturn sequence(SQ_BRACKET_L, noNl(), nonSimpleMapTypes(), noNl(), SP_COL, noNl(), nonSimpleMapTypes(), noNl(), SQ_BRACKET_R);\n \t}", "private void mappingMethods() throws SecurityException, NoSuchMethodException{\n\t\tmappingMethodGet();\n\t\tmappingMethodSet();\n\t}", "public void setMappingTable(PathTreeDictionary mappingtable) { \n super.setMappingTable(mappingtable);\n }", "String map( String principal );", "private Document createMapping() {\n return getIndexOperations().createMapping();\n }", "public String getMappingFilePath();", "public interface PageTagMapper extends Mapper<PageTagDTO> {\n\n}", "@Override\n protected final Map<String, String> createFieldToPropertyMapping() {\n // get super class mapping\n final Map<String, String> mapping = super.createFieldToPropertyMapping();\n \n mapping.put(this.tableName + \".rmres_id\", \"id\");\n mapping.put(this.tableName + \".cost_rmres\", \"cost\");\n mapping.put(this.tableName + \".config_id\", \"configId\");\n mapping.put(this.tableName + \".rm_arrange_type_id\", \"arrangeTypeId\");\n mapping.put(this.tableName + \".guests_external\", \"externalGuests\");\n mapping.put(this.tableName + \".guests_internal\", \"internalGuests\");\n \n return mapping;\n }", "public String getCutypeMapping();", "public interface ItemDescMapper extends Mapper<ItemDesc> {\n}", "public void initMap()\r\n/* */ {\r\n///* 36 */ putHandler(\"vwkgcode\", PDWkHeadTailVWkgcodeHandler.class);\r\n///* 37 */ putHandler(\"fcapacitycalc\", PDWkHeadTailFcapacitycalcHandler.class);\r\n///* 38 */ putHandler(\"bprodline\", PDWkHeadTailBprodlineHandler.class);\r\n/* */ }", "ReferenceContainer<E> remap(UnaryOperator<PropertySymbol> mapper);", "@Override\r\n public ParaMap index(ParaMap inMap) throws Exception {\n return null;\r\n }", "@Override\n\t\t\t\t\tpublic Attribute handleMapValue(Element parent, FTypeRef src) {\n\t\t\t\t\t\treturn super.handleMapValue(parent, src);\n\t\t\t\t\t}", "@Override\n\tprotected Mapping getMapping() {\n\t\treturn new Mapping()\n\t\t\t.add(\"firstname\", driver.getFirstName())\n\t\t\t.add(\"lastname\", driver.getLastName())\n\t\t\t.add(\"dateofbirth\", driver.getDateOfBirth())\n\t\t\t.add(\"gender\", driver.getGender())\n\t\t\t.add(\"age\", computeAge())\n\t\t\t.add(\"numberOfAccidents\", driver.getNumberOfAccidents())\n\t\t\t.add(\"numberOfTickets\", driver.getNumberOfTickets());\n\t}", "public interface SaasSmsConfigDictionaryDao extends BaseMapper<SaasSmsConfigDictionary> {\n\n}", "private ModuleMapper() {\n mapper = new HashMap<String, String>();\n mapper.put(\"accounts\", \"Accounts\");\n mapper.put(\"acl_actions\", \"ACLActions\");\n mapper.put(\"acl_roles\", \"ACLRoles\");\n mapper.put(\"bugs\", \"Bugs\");\n mapper.put(\"calls\", \"Calls\");\n mapper.put(\"campaign_log\", \"CampaignLog\");\n mapper.put(\"campaign_trkrs\", \"CampaignTrackers\");\n mapper.put(\"campaigns\", \"Campaigns\");\n mapper.put(\"cases\", \"Cases\");\n mapper.put(\"contacts\", \"Contacts\");\n mapper.put(\"currencies\", \"Currencies\");\n mapper.put(\"document_revisions\", \"DocumentRevisions\");\n mapper.put(\"documents\", \"Documents\");\n mapper.put(\"eapm\", \"EAPM\");\n mapper.put(\"email_addresses\", \"EmailAddresses\");\n mapper.put(\"email_marketing\", \"EmailMarketing\");\n mapper.put(\"email_templates\", \"EmailTemplates\");\n mapper.put(\"emailman\", \"EmailMan\");\n mapper.put(\"emails\", \"Emails\");\n mapper.put(\"inbound_email\", \"InboundEmail\");\n mapper.put(\"job_queue\", \"SchedulersJobs\");\n mapper.put(\"leads\", \"Leads\");\n mapper.put(\"meetings\", \"Meetings\");\n mapper.put(\"notes\", \"Notes\");\n mapper.put(\"oauth_consumer\", \"OAuthKeys\");\n mapper.put(\"oauth_tokens\", \"OAuthTokens\");\n mapper.put(\"opportunities\", \"Opportunities\");\n mapper.put(\"project\", \"Project\");\n mapper.put(\"project_task\", \"ProjectTask\");\n mapper.put(\"prospect_lists\", \"ProspectLists\");\n mapper.put(\"prospects\", \"Prospects\");\n mapper.put(\"releases\", \"Releases\");\n mapper.put(\"roles\", \"Roles\");\n mapper.put(\"saved_search\", \"SavedSearch\");\n mapper.put(\"schedulers\", \"Schedulers\");\n mapper.put(\"sugarfeed\", \"SugarFeed\");\n mapper.put(\"tasks\", \"Tasks\");\n mapper.put(\"users\", \"Users\");\n }", "MAP createMAP();", "public interface EntryLeagueInfoMapper extends MyBaseMapper<EntryLeagueInfoEntity> {\n\n}", "public interface SpiderResultUrlsPoMapper extends feihua.jdbc.api.dao.CrudDao<SpiderResultUrlsPo, String> {\n}", "Map<Class<?>, Object> yangAugmentedInfoMap();", "Map<Class<?>, Object> yangAugmentedInfoMap();", "@Override\n\tprotected void remapVariablesInThisExpression(Map<String, String> fromToVariableMap) {\n\t}", "private void processNameToObjectMap() {\r\n for (int i = 0; i < this.getObjectGroupCount(); i++) {\r\n ObjectGroup g = this.objectGroups.get(i);\r\n this.objectGroupNameToOffset.put(g.name, i);\r\n HashMap<String, Integer> nameToObjectMap = new HashMap<String, Integer>();\r\n for (int ib = 0; ib < this.getObjectCount(i); ib++) {\r\n nameToObjectMap.put(this.getObjectName(i, ib), ib);\r\n }\r\n g.setObjectNameMapping(nameToObjectMap);\r\n }\r\n }", "protected AbstractTableNameConverter() {\r\n\t\tclassMappings = new HashMap<Class<? extends RawEntity<?>>, String>();\r\n\t\t\r\n\t\tpatterns = new LinkedList<String>();\r\n\t\tpatternMappings = new HashMap<String, String>();\r\n\t}", "@Override\n public void onMapVersionSet() {\n\n }", "public void map( Chunk bv ) { }", "@Override\n protected Map<TableUniqueName, String> tableSubstitution() {\n return ImmutableMap.of();\n }", "public interface PageResourceMapper {\n}", "public interface SysDictDataMapper\n{\n /**\n * Query dictionary data page by condition\n * \n * @param dictData Dictionary data information\n * @return Dictionary data collection information\n */\n public List<SysDictData> selectDictDataList(SysDictData dictData);\n\n /**\n * Query dictionary data according to dictionary type\n * \n * @param dictType Dictionary type\n * @return Dictionary data collection information\n */\n public List<SysDictData> selectDictDataByType(String dictType);\n\n /**\n * Query dictionary data information according to dictionary type and dictionary key value\n * \n * @param dictType Dictionary type\n * @param dictValue Dictionary key\n * @return Dictionary tag\n */\n public String selectDictLabel(@Param(\"dictType\") String dictType, @Param(\"dictValue\") String dictValue);\n\n /**\n * Query information based on dictionary data ID\n * \n * @param dictCode Dictionary data ID\n * @return Dictionary data\n */\n public SysDictData selectDictDataById(Long dictCode);\n\n /**\n * Query dictionary data\n * \n * @param dictType Dictionary type\n * @return Dictionary data\n */\n public int countDictDataByType(String dictType);\n\n /**\n * Delete dictionary data information by dictionary ID\n * \n * @param dictCode Dictionary data ID\n * @return result\n */\n public int deleteDictDataById(Long dictCode);\n\n /**\n * Delete dictionary data in bulk\n * \n * @param ids Data to be deleted\n * @return result\n */\n public int deleteDictDataByIds(String[] ids);\n\n /**\n * New dictionary data information\n * \n * @param dictData Dictionary data information\n * @return result\n */\n public int insertDictData(SysDictData dictData);\n\n /**\n * Modify dictionary data information\n * \n * @param dictData Dictionary data information\n * @return result\n */\n public int updateDictData(SysDictData dictData);\n\n /**\n * Synchronously modify dictionary type\n * \n * @param oldDictType Old dictionary type\n * @param newDictType New and old dictionary types\n * @return result\n */\n public int updateDictDataType(@Param(\"oldDictType\") String oldDictType, @Param(\"newDictType\") String newDictType);\n}", "public interface Mapper {\n\n\t/**\n\t * A {@link Mapper} is uniquely identified with a {@link String}. This\n\t * helps differentiating mapping XMLs produced with different mappers.\n\t * \n\t * @return the unique identifier of this mapper\n\t */\n\tpublic abstract String getMapperId();\n\t\n\t/**\n\t * Maps the cores from the APCG to the nodes from the NoC.\n\t * \n\t * @see MappingType\n\t * \n\t * @return a array of Strings containing the mappings (specially for multi-objective case) XML\n\t * \n\t * @throws TooFewNocNodesException\n\t */\n\tpublic abstract String[] map() throws TooFewNocNodesException;\n\n}", "Mapper<T, T2> relate(Customizable customizable);", "@Test\n \tpublic void mapTable() {\n \t\t\n \t\tString[][] data = { { \"11\", \"12\" }, { \"21\", \"22\" } };\n \n \t\tTable table = tableWith(data,\"c1\",\"c2\");\n \n \t\tTableMapDirectives directives = new TableMapDirectives(table.columns().get(0));\n \t\t\n \t\tdirectives.add(column(\"TAXOCODE\"))\n \t\t .add(column(\"ISSCAAP\"))\n \t\t .add(column(\"Scientific_name\"))\n \t\t .add(column(\"English_name\").language(\"en\"))\n \t\t .add(column(\"French_name\").language(\"fr\"))\n \t\t .add(column(\"Spanish_name\").language(\"es\"))\n \t\t .add(column(\"Author\"))\n \t\t .add(column(\"Family\"))\n \t\t .add(column(\"Order\"));\n \n \t\tOutcome outcome = service.map(table, directives);\n \t\t\n \t\tassertNotNull(outcome.result());\n \t}", "abstract protected Map<String, T> lookup(List<String> values);", "@Override\n\tprotected String getListMapper() {\n\t\treturn null;\n\t}", "public void onChangeMap(String arg0) {\n\t\t\r\n\t}", "@Mapper\npublic interface ArticleMapper extends BaseMapper<Article> {\n}", "public MapOther() {\n }", "public interface USLActionBanHistoryMapping extends ObjectMapping<USLActionBanHistory> {\n\t/**\n\t * Fetch all of the maps where it has the given usl action id.\n\t * \n\t * @param uslActionId the id of the USLAction\n\t * @return the mapping to the bans for that action\n\t */\n\tpublic List<USLActionBanHistory> fetchByUSLActionID(int uslActionId);\n\t\n\t/**\n\t * Fetch all of the maps where we have the given ban history.\n\t * \n\t * @param banHistoryId the id of the ban history\n\t * @return the mapping to the actions for that ban history\n\t */\n\tpublic List<USLActionBanHistory> fetchByBanHistoryID(int banHistoryId);\n\t\n\t/**\n\t * Determines if this mapping contains the given relationship\n\t * \n\t * @param uslActionId the action\n\t * @param banHistoryId the ban history\n\t * @return if that relationship is in the database\n\t */\n\tpublic boolean contains(int uslActionId, int banHistoryId);\n\t\n\t/**\n\t * Delete the row with the specified columns\n\t * @param uslActionId the id of the action\n\t * @param banHistoryId the id of the ban history\n\t */\n\tpublic void delete(int uslActionId, int banHistoryId);\n\t\n}", "public void testMapGet() {\r\n }", "@Override\n\tprotected Map getKeyMethodMap() {\n\t\treturn null;\n\t}", "@Mapper(componentModel = \"spring\", uses = {ProvinciaMapper.class})\npublic interface CodigoPostalMapper extends EntityMapper<CodigoPostalDTO, CodigoPostal> {\n\n @Mapping(source = \"provincia.id\", target = \"provinciaId\")\n @Mapping(source = \"provincia.nombreProvincia\", target = \"provinciaNombreProvincia\")\n CodigoPostalDTO toDto(CodigoPostal codigoPostal);\n\n @Mapping(source = \"provinciaId\", target = \"provincia\")\n CodigoPostal toEntity(CodigoPostalDTO codigoPostalDTO);\n\n default CodigoPostal fromId(Long id) {\n if (id == null) {\n return null;\n }\n CodigoPostal codigoPostal = new CodigoPostal();\n codigoPostal.setId(id);\n return codigoPostal;\n }\n}", "public static Map<String, Object> getDocumentMapping(String indexPrefix, String indexPostfix) {\n\n Map<String, Object> indexFieldProperties = new HashMap<String, Object>();\n\n if (indexPrefix.equals(EsConstants.GATEWAY_INDEX_NAME)) {\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_ORGANIZATION_ID, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_VERSION, indexFieldProperties);\n }\n // rule for gateway and manager\n if (indexPostfix.equals(EsConstants.INDEX_APIS)) {\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_API_ID, indexFieldProperties);\n }\n // rule for gateway and manager\n if (indexPostfix.equals(EsConstants.INDEX_CLIENTS)) {\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_CLIENT_ID, indexFieldProperties);\n }\n if (indexPrefix.equals(EsConstants.METRICS_INDEX_NAME)) {\n // set keyword types\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_API_ID, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_API_ORG_ID, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_CLIENT_ID, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_CLIENT_ORG_ID, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_PLAN_ID, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_API_VERSION, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_CLIENT_VERSION, indexFieldProperties);\n\n addBooleanTypeToIndexField(EsConstants.ES_FIELD_ERROR, indexFieldProperties);\n addBooleanTypeToIndexField(EsConstants.ES_FIELD_FAILURE, indexFieldProperties);\n\n // set date types\n addDateTypeToIndexField(EsConstants.ES_FIELD_REQUEST_START, indexFieldProperties);\n addDateTypeToIndexField(EsConstants.ES_FIELD_REQUEST_END, indexFieldProperties);\n addDateTypeToIndexField(EsConstants.ES_FIELD_API_START, indexFieldProperties);\n addDateTypeToIndexField(EsConstants.ES_FIELD_API_END, indexFieldProperties);\n\n // set ip type\n addIpTypeToIndexField(EsConstants.ES_FIELD_REMOTE_ADDR, indexFieldProperties);\n }\n\n if (indexPrefix.equals(EsConstants.MANAGER_INDEX_NAME)) {\n\n switch (indexPostfix) {\n case EsConstants.INDEX_MANAGER_POSTFIX_API:\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_ID, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_NAME, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_ORGANIZATION_ID, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_ORGANIZATION_NAME, indexFieldProperties);\n // date types\n addDateTypeToIndexField(EsConstants.ES_FIELD_CREATED_ON, indexFieldProperties);\n break;\n case EsConstants.INDEX_MANAGER_POSTFIX_API_VERSION:\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_API_ID, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_ORGANIZATION_ID, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_STATUS, indexFieldProperties);\n // date types\n addDateTypeToIndexField(EsConstants.ES_FIELD_CREATED_ON, indexFieldProperties);\n addDateTypeToIndexField(EsConstants.ES_FIELD_MODIFIED_ON, indexFieldProperties);\n addDateTypeToIndexField(EsConstants.ES_FIELD_PUBLISHED_ON, indexFieldProperties);\n addDateTypeToIndexField(EsConstants.ES_FIELD_RETIRED_ON, indexFieldProperties);\n break;\n case EsConstants.INDEX_MANAGER_POSTFIX_CLIENT:\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_ID, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_ORGANIZATION_ID, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_ORGANIZATION_NAME, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_NAME, indexFieldProperties);\n // date types\n addDateTypeToIndexField(EsConstants.ES_FIELD_CREATED_ON, indexFieldProperties);\n break;\n case EsConstants.INDEX_MANAGER_POSTFIX_CLIENT_VERSION:\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_ORGANIZATION_ID, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_CLIENT_ID, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_STATUS, indexFieldProperties);\n // date types\n addDateTypeToIndexField(EsConstants.ES_FIELD_CREATED_ON, indexFieldProperties);\n addDateTypeToIndexField(EsConstants.ES_FIELD_MODIFIED_ON, indexFieldProperties);\n addDateTypeToIndexField(EsConstants.ES_FIELD_PUBLISHED_ON, indexFieldProperties);\n addDateTypeToIndexField(EsConstants.ES_FIELD_RETIRED_ON, indexFieldProperties);\n break;\n case EsConstants.INDEX_MANAGER_POSTFIX_AUDIT_ENTRY:\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_ORGANIZATION_ID, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_ENTITY_ID, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_ENTITY_TYPE, indexFieldProperties);\n // date types\n addDateTypeToIndexField(EsConstants.ES_FIELD_CREATED_ON, indexFieldProperties);\n break;\n case EsConstants.INDEX_MANAGER_POSTFIX_ORGANIZATION:\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_ID, indexFieldProperties);\n setFieldDataToIndexTextField(EsConstants.ES_FIELD_NAME, indexFieldProperties);\n // date types\n addDateTypeToIndexField(EsConstants.ES_FIELD_CREATED_ON, indexFieldProperties);\n addDateTypeToIndexField(EsConstants.ES_FIELD_MODIFIED_ON, indexFieldProperties);\n break;\n case EsConstants.INDEX_MANAGER_POSTFIX_USER:\n setFieldDataToIndexTextField(EsConstants.ES_FIELD_FULL_NAME, indexFieldProperties);\n // date types\n addDateTypeToIndexField(EsConstants.ES_FIELD_JOINED_ON, indexFieldProperties);\n break;\n case EsConstants.INDEX_MANAGER_POSTFIX_PLUGIN:\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_NAME, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_GROUP_ID, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_ARTIFACT_ID, indexFieldProperties);\n // date types\n addDateTypeToIndexField(EsConstants.ES_FIELD_CREATED_ON, indexFieldProperties);\n break;\n case EsConstants.INDEX_MANAGER_POSTFIX_POLICY_DEF:\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_NAME, indexFieldProperties);\n break;\n case EsConstants.INDEX_MANAGER_POSTFIX_CONTRACT:\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_API_ID, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_API_ORGANIZATION_ID, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_CLIENT_ORGANIZATION_ID, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_CLIENT_ID, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_CLIENT_VERSION, indexFieldProperties);\n // date types\n addDateTypeToIndexField(EsConstants.ES_FIELD_CREATED_ON, indexFieldProperties);\n break;\n case EsConstants.INDEX_MANAGER_POSTFIX_PLAN:\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_ORGANIZATION_ID, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_ORGANIZATION_NAME, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_NAME, indexFieldProperties);\n // date types\n addDateTypeToIndexField(EsConstants.ES_FIELD_CREATED_ON, indexFieldProperties);\n break;\n case EsConstants.INDEX_MANAGER_POSTFIX_PLAN_VERSION:\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_ORGANIZATION_ID, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_PLAN_ID, indexFieldProperties);\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_STATUS, indexFieldProperties);\n // date types\n addDateTypeToIndexField(EsConstants.ES_FIELD_CREATED_ON, indexFieldProperties);\n addDateTypeToIndexField(EsConstants.ES_FIELD_MODIFIED_ON, indexFieldProperties);\n addDateTypeToIndexField(EsConstants.ES_FIELD_LOCKED_ON, indexFieldProperties);\n break;\n case EsConstants.INDEX_MANAGER_POSTFIX_GATEWAY:\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_NAME, indexFieldProperties);\n // date types\n addDateTypeToIndexField(EsConstants.ES_FIELD_CREATED_ON, indexFieldProperties);\n addDateTypeToIndexField(EsConstants.ES_FIELD_MODIFIED_ON, indexFieldProperties);\n break;\n case EsConstants.INDEX_MANAGER_POSTFIX_ROLE:\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_ID, indexFieldProperties);\n setFieldDataToIndexTextField(EsConstants.ES_FIELD_NAME, indexFieldProperties);\n // date types\n addDateTypeToIndexField(EsConstants.ES_FIELD_CREATED_ON, indexFieldProperties);\n break;\n case EsConstants.INDEX_MANAGER_POSTFIX_ROLE_MEMBERSHIP:\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_ORGANIZATION_ID, indexFieldProperties);\n // date types\n addDateTypeToIndexField(EsConstants.ES_FIELD_CREATED_ON, indexFieldProperties);\n break;\n case EsConstants.INDEX_MANAGER_POSTFIX_DEVELOPER:\n addKeywordTypeToIndexField(EsConstants.ES_FIELD_ID, indexFieldProperties);\n break;\n case EsConstants.INDEX_MANAGER_POSTFIX_METADATA:\n addDateTypeToIndexField(EsConstants.ES_FIELD_EXPORTED_ON, indexFieldProperties);\n addDateTypeToIndexField(EsConstants.ES_FIELD_IMPORTED_ON, indexFieldProperties);\n default:\n break;\n }\n }\n\n return indexFieldProperties;\n }", "@Override\n public boolean isMapped() {\n return false;\n }", "private void initMapNameMapping() {\n mMapNameMapping.clear();\n\n // Load the name mapping from the config\n ConfigurationSection mappingSection = getConfig().getConfigurationSection(MappingSectionName);\n if (mappingSection != null) {\n // Load and check the mapping found in the config\n Map<String, Object> configMap = mappingSection.getValues(false);\n for (Map.Entry<String, Object> entry : configMap.entrySet()) {\n mMapNameMapping.put(entry.getKey(), (String) entry.getValue());\n }\n } else {\n getLogger().warning(String.format(\"[%s] found no configured mapping, creating a default one.\", mPdfFile.getName()));\n }\n\n // If there are new worlds in the server add them to the mapping\n List<World> serverWorlds = getServer().getWorlds();\n for (World w : serverWorlds) {\n if (!mMapNameMapping.containsKey(w.getName())) {\n mMapNameMapping.put(w.getName(), w.getName());\n }\n }\n\n // Set the new mapping in the config\n getConfig().createSection(MappingSectionName, mMapNameMapping);\n }", "public MapEntry getMapping(String imfInterfaceClass) throws SL_Exception\r\n {\r\n MapEntry rc = _AdapterFactory_map.get(imfInterfaceClass);\r\n if(rc==null)\r\n return super.getMapping(imfInterfaceClass);\r\n else {\r\n if(rc.semanticClass == null)\r\n {\r\n MapEntry rc1 = super.getMapping(imfInterfaceClass);\r\n rc.semanticClass = rc1.semanticClass;\r\n }\r\n return rc;\r\n }\r\n\r\n }", "JavaTypeMapping getMapping(Class javaType);", "protected void createMappingAnnotations() {\n\t\tString source = \"http://www.polarsys.org/capella/MNoE/CapellaLike/Mapping\";\t\n\t\taddAnnotation\n\t\t (blockArchitecturePkgEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (blockArchitectureEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"\",\n\t\t\t \"explanation\", \"uml::Package\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getBlockArchitecture_OwnedRequirementPkgs(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"uml::Package::nestedPackage#uml::Package::packagedElement\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"uml::Package::nestedPackage elements on which RequirementsPkg stereotype or any stereotype that inherits from it is applied\\r\\nOrder must be computed\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getBlockArchitecture_OwnedAbstractCapabilityPkg(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"uml::Package::nestedPackage#uml::Package::packagedElement\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"uml::Package::nestedPackage elements on which AbstractCapabilityPkg stereotype or any stereotype that inherits from it is applied\\r\\nMultiplicity must be [1..1]\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getBlockArchitecture_OwnedInterfacePkg(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"uml::Package::nestedPackage#uml::Package::packagedElement\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"uml::Package::nestedPackage elements on which InterfacePkg stereotype or any stereotype that inherits from it is applied\\r\\nMultiplicity must be [0..1]\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getBlockArchitecture_OwnedDataPkg(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"uml::Package::nestedPackage#uml::Package::packagedElement\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"uml::Package::nestedPackage elements on which DataPkg stereotype or any stereotype that inherits from it is applied\\r\\nMultiplicity must be [0..1]\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getBlockArchitecture_ProvisionedArchitectureAllocations(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getBlockArchitecture_ProvisioningArchitectureAllocations(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getBlockArchitecture_AllocatedArchitectures(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getBlockArchitecture_AllocatingArchitectures(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (blockEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"\",\n\t\t\t \"explanation\", \"uml::BehavioredClassifier\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getBlock_OwnedAbstractCapabilityPkg(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::nearestpackage\",\n\t\t\t \"explanation\", \"Descendants are mapped to SysML::Blocks::Block, which cannot contain a Package.\\r\\nTherefore, store these AbstractCapabilityPackages in the nearest available package.\",\n\t\t\t \"constraints\", \"Multiplicity must be [0..1]\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getBlock_OwnedInterfacePkg(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"uml::Package::nestedPackage#uml::Package::packagedElement\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"uml::Package::nestedPackage elements on which InterfacePkg stereotype or any stereotype that inherits from it is applied\\r\\nMultiplicity must be [0..1]\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getBlock_OwnedDataPkg(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"uml::Package::nestedPackage#uml::Package::packagedElement\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"uml::Package::nestedPackage elements on which DataPkg stereotype or any stereotype that inherits from it is applied\\r\\nMultiplicity must be [0..1]\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getBlock_OwnedStateMachines(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"uml::BehavioredClassifier::ownedBehavior\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"uml::BehavioredClassifier::ownedBehavior elements on which StateMachine stereotype or any stereotype that inherits from it is applied\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (componentArchitectureEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (componentEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"\",\n\t\t\t \"explanation\", \"uml::Class\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getComponent_OwnedInterfaceUses(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::nearestpackage\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"uml::NamedElement::clientDependency elements on which InterfaceUse stereotype or any stereotype that inherits from it is applied\\r\\nOrder must be computed\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getComponent_UsedInterfaceLinks(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getComponent_UsedInterfaces(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getComponent_OwnedInterfaceImplementations(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"uml::BehavioredClassifier::interfaceRealization\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"Order must be computed\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getComponent_ImplementedInterfaceLinks(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getComponent_ImplementedInterfaces(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getComponent_ProvisionedComponentAllocations(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getComponent_ProvisioningComponentAllocations(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getComponent_AllocatedComponents(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getComponent_AllocatingComponents(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getComponent_ProvidedInterfaces(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getComponent_RequiredInterfaces(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getComponent_ContainedComponentPorts(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getComponent_ContainedParts(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getComponent_ContainedPhysicalPorts(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getComponent_OwnedPhysicalPath(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::nearestpackage\",\n\t\t\t \"explanation\", \"SysML::Blocks::Block cannot contain PhysicalPath\\'s equivalent, hence we find the nearest available package to store them.\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getComponent_OwnedPhysicalLinks(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"uml::StructuredClassifier::ownedConnector\",\n\t\t\t \"explanation\", \"since PhysicalLink is mapped to uml::Connector\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (abstractActorEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"\",\n\t\t\t \"explanation\", \"SysML::Blocks::Block\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (partEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"\",\n\t\t\t \"explanation\", \"should be mapped to uml::Property, but one of its concrete ancestors already is (Property), so avoid redefining it\\r\\nat this level to avoid profile generation issue\",\n\t\t\t \"constraints\", \"information::Property must have as base metaclass uml::Property\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getPart_ProvidedInterfaces(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getPart_RequiredInterfaces(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getPart_OwnedDeploymentLinks(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getPart_DeployedParts(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getPart_DeployingParts(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (architectureAllocationEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"\",\n\t\t\t \"explanation\", \"uml::Realization\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getArchitectureAllocation_AllocatedArchitecture(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getArchitectureAllocation_AllocatingArchitecture(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (componentAllocationEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"\",\n\t\t\t \"explanation\", \"uml::ComponentRealization or uml::InterfaceRealization regarding the baseMetaClass of the realized element\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getComponentAllocation_AllocatedComponent(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getComponentAllocation_AllocatingComponent(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (systemComponentEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getSystemComponent_DataComponent(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getSystemComponent_DataType(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getSystemComponent_ParticipationsInCapabilityRealizations(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (interfacePkgEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"uml::Package\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterfacePkg_OwnedInterfaces(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"uml::Package::nestedPackage#uml::Package::packagedElement\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"uml::Package::nestedPackage elements on which Interface stereotype or any stereotype that inherits from it is applied\\r\\nOrder must be computed\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterfacePkg_OwnedInterfacePkgs(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"uml::Package::nestedPackage#uml::Package::packagedElement\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"uml::Package::nestedPackage elements on which InterfacePkg stereotype or any stereotype that inherits from it is applied\\r\\nOrder must be computed\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (interfaceEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"uml::Interface\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterface_Mechanism(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterface_ImplementorComponents(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterface_UserComponents(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterface_InterfaceImplementations(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Opposite reference of uml::InterfaceRealization::contract\",\n\t\t\t \"constraints\", \"uml::Element::ownedElement elements on which InterfaceImplementation stereotype or any stereotype that inherits from it is applied\\r\\nOrder must be computed\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterface_InterfaceUses(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Opposite reference of uml::Dependency::supplier\",\n\t\t\t \"constraints\", \"uml::Element::ownedElement elements on which InterfaceUse stereotype or any stereotype that inherits from it is applied\\r\\nOrder must be computed\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterface_ProvisioningInterfaceAllocations(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterface_AllocatingInterfaces(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterface_AllocatingComponents(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterface_ExchangeItems(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterface_OwnedExchangeItemAllocations(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterface_RequiringComponents(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterface_RequiringComponentPorts(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterface_ProvidingComponents(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterface_ProvidingComponentPorts(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterface_RealizingLogicalInterfaces(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterface_RealizedContextInterfaces(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterface_RealizingPhysicalInterfaces(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterface_RealizedLogicalInterfaces(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (interfaceImplementationEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"uml::InterfaceRealization\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterfaceImplementation_InterfaceImplementor(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterfaceImplementation_ImplementedInterface(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"uml::InterfaceRealization::contract\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (interfaceUseEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"uml::Usage\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterfaceUse_InterfaceUser(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"uml::Dependency::client\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterfaceUse_UsedInterface(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"uml::Dependency::supplier\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"Multiplicity must be [1..1]\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (providedInterfaceLinkEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"\",\n\t\t\t \"explanation\", \"uml::InterfaceRealization\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getProvidedInterfaceLink_Interface(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"uml::InterfaceRealization::contract\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (requiredInterfaceLinkEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"\",\n\t\t\t \"explanation\", \"uml::Usage\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getRequiredInterfaceLink_Interface(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"uml::Dependency::supplier\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"uml::Dependency::supplier elements on which Interface stereotype or any stereotype that inherits from it is applied\\r\\nMultiplicity must be [1..1]\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (interfaceAllocationEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterfaceAllocation_AllocatedInterface(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterfaceAllocation_AllocatingInterfaceAllocator(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (interfaceAllocatorEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"\",\n\t\t\t \"explanation\", \"uml::Classifier\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterfaceAllocator_OwnedInterfaceAllocations(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::nearestpackage\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"Some elements on which InterfaceAllocation stereotype or any stereotype that inherits from it is applied\\r\\nOrder must be computed\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterfaceAllocator_ProvisionedInterfaceAllocations(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getInterfaceAllocator_AllocatedInterfaces(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (actorCapabilityRealizationInvolvementEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"uml::Dependency\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (systemComponentCapabilityRealizationInvolvementEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"uml::Dependency\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (componentContextEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (exchangeItemAllocationEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"uml::Realization\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getExchangeItemAllocation_SendProtocol(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getExchangeItemAllocation_ReceiveProtocol(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getExchangeItemAllocation_AllocatedItem(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getExchangeItemAllocation_AllocatingInterface(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (deployableElementEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"\",\n\t\t\t \"explanation\", \"uml::NamedElement\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getDeployableElement_DeployingLinks(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Opposite reference of uml::Dependency::supplier\",\n\t\t\t \"constraints\", \"Order must be computed\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (deploymentTargetEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"\",\n\t\t\t \"explanation\", \"uml::DeploymentTarget\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getDeploymentTarget_DeploymentLinks(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"uml::NamedElement::clientDependency\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"uml::DeploymentTarget::deployment elements on which AbstractDeployment stereotype or any stereotype that inherits from it is applied\\r\\nOrder must be computed\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (abstractDeploymentLinkEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"\",\n\t\t\t \"explanation\", \"uml::Dependency,could be mapped on uml::Deployment, but dependencies diagram allows to \\\"deploy\\\" more capella element types.\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getAbstractDeploymentLink_DeployedElement(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"uml::Dependency::supplier\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"Multiplicity must be [1..1]\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getAbstractDeploymentLink_Location(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"uml::Dependency::client\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"uml::Dependency::client elements on which DeploymentTarget stereotype or any stereotype that inherits from it is applied\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (abstractPathInvolvedElementEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (abstractPhysicalArtifactEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getAbstractPhysicalArtifact_AllocatorConfigurationItems(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (abstractPhysicalLinkEndEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getAbstractPhysicalLinkEnd_InvolvedLinks(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (abstractPhysicalPathLinkEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (physicalLinkEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"uml::Connector\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getPhysicalLink_LinkEnds(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::specific\",\n\t\t\t \"explanation\", \"first need to create ConnectorEnds pointing to the Ports, and then reference them in uml::Connector::end\",\n\t\t\t \"constraints\", \"cardinality must be [2..2]\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getPhysicalLink_OwnedComponentExchangeFunctionalExchangeAllocations(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::nearestpackage\",\n\t\t\t \"explanation\", \"Elements are contained in the nearest possible parent container.\",\n\t\t\t \"constraints\", \"some elements on which ComponentFunctionalExchangeAllocation stereotype or any stereotype that inherits from it is applied\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getPhysicalLink_OwnedPhysicalLinkEnds(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"uml::Connector::end\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getPhysicalLink_OwnedPhysicalLinkRealizations(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"none\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getPhysicalLink_SourcePhysicalPort(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getPhysicalLink_TargetPhysicalPort(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (physicalLinkEndEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"uml::ConnectorEnd\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getPhysicalLinkEnd_Port(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"uml::ConnectorEnd::role\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"uml::ConnectorEnd::role elements on which PhysicalPort stereotype or any stereotype that inherits from it is applied\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getPhysicalLinkEnd_Part(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"uml::ConnectorEnd::partWithPort\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (physicalLinkRealizationEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"none\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (physicalPathEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"uml::Class\",\n\t\t\t \"explanation\", \"_todo_\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getPhysicalPath_InvolvedLinks(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getPhysicalPath_OwnedPhysicalPathInvolvements(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getPhysicalPath_FirstPhysicalPathInvolvements(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getPhysicalPath_OwnedPhysicalPathRealizations(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"none\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (physicalPathInvolvementEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getPhysicalPathInvolvement_NextInvolvements(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getPhysicalPathInvolvement_PreviousInvolvements(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getPhysicalPathInvolvement_InvolvedElement(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getPhysicalPathInvolvement_InvolvedComponent(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (physicalPathReferenceEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getPhysicalPathReference_ReferencedPhysicalPath(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (physicalPathRealizationEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"none\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (physicalPortEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"SysML::PortAndFlows::FlowPort\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getPhysicalPort_OwnedPhysicalPortRealizations(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"none\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (getPhysicalPort_AllocatedComponentPorts(), \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"keyword::none\",\n\t\t\t \"explanation\", \"Derived and transient\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\t\n\t\taddAnnotation\n\t\t (physicalPortRealizationEClass, \n\t\t source, \n\t\t new String[] {\n\t\t\t \"UML/SysML semantic equivalences\", \"\",\n\t\t\t \"base metaclass in UML/SysML profile \", \"none\",\n\t\t\t \"explanation\", \"none\",\n\t\t\t \"constraints\", \"none\"\n\t\t });\n\t}", "public String[] getFieldNameMapping() {\r\n return null;\r\n }", "@Mapper(componentModel = \"spring\", uses = {})\npublic interface AlterationDisplayTypeMapper {\n\n AlterationDisplayTypeDTO alterationDisplayTypeToAlterationDisplayTypeDTO(AlterationDisplayType alterationDisplayType);\n\n List<AlterationDisplayTypeDTO> alterationDisplayTypesToAlterationDisplayTypeDTOs(List<AlterationDisplayType> alterationDisplayTypes);\n\n @Mapping(target = \"alterations\", ignore = true)\n AlterationDisplayType alterationDisplayTypeDTOToAlterationDisplayType(AlterationDisplayTypeDTO alterationDisplayTypeDTO);\n\n List<AlterationDisplayType> alterationDisplayTypeDTOsToAlterationDisplayTypes(List<AlterationDisplayTypeDTO> alterationDisplayTypeDTOs);\n}", "@Mapper\npublic interface SpiderMapper {\n \n}", "public interface StatusMapper extends BaseMapper<Status> {\n\n}" ]
[ "0.75489783", "0.66221595", "0.6476321", "0.6307363", "0.6257793", "0.62155", "0.6187813", "0.6177484", "0.6171128", "0.6156901", "0.6155117", "0.6143827", "0.61408734", "0.61392754", "0.61139", "0.6081774", "0.60649604", "0.60533124", "0.6039588", "0.60379934", "0.6037088", "0.6018991", "0.59664625", "0.5943487", "0.5942521", "0.59291583", "0.59175354", "0.59165466", "0.59131545", "0.5894802", "0.58822614", "0.5878986", "0.5874566", "0.58570254", "0.58570254", "0.58469325", "0.5844828", "0.5842633", "0.58274794", "0.5827173", "0.5816453", "0.5800164", "0.5793464", "0.5791298", "0.5782162", "0.5777744", "0.57731354", "0.576941", "0.5767044", "0.5760955", "0.57566375", "0.5749919", "0.5730698", "0.57287884", "0.571401", "0.57120186", "0.5710809", "0.5699973", "0.568227", "0.5677558", "0.56770223", "0.5667881", "0.56648207", "0.5660957", "0.5655582", "0.5655537", "0.56553984", "0.565282", "0.56414354", "0.5635003", "0.5635003", "0.56329554", "0.5624951", "0.56162435", "0.5613901", "0.5610684", "0.56095934", "0.5609528", "0.5603569", "0.5602349", "0.5588446", "0.5581686", "0.55785996", "0.5572962", "0.55676126", "0.5566794", "0.5564601", "0.5547424", "0.5539049", "0.55364037", "0.5530491", "0.5527857", "0.55276924", "0.5526754", "0.5524391", "0.5521582", "0.5518882", "0.5514361", "0.5509597", "0.55090183", "0.55039424" ]
0.0
-1
TODO: Warning this method won't work in the case the id fields are not set
@Override public boolean equals(Object object) { if (!(object instanceof Patient)) { return false; } Patient other = (Patient) object; if (this.id == null && other.id == null && this != other) { return false; } if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { return false; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void setId(Integer id) { this.id = id; }", "private Integer getId() { return this.id; }", "public void setId(int id){ this.id = id; }", "public void setId(Long id) {this.id = id;}", "public void setId(Long id) {this.id = id;}", "public void setID(String idIn) {this.id = idIn;}", "public void setId(int id) { this.id = id; }", "public void setId(int id) { this.id = id; }", "public int getId() { return id; }", "public int getId() { return id; }", "public int getId() { return id; }", "public int getId() { return id; }", "public int getId() { return id; }", "public int getId() { return id; }", "public void setId(long id) { this.id = id; }", "public void setId(long id) { this.id = id; }", "public int getId(){ return id; }", "public int getId() {return id;}", "public int getId() {return Id;}", "public int getId(){return id;}", "public void setId(long id) {\n id_ = id;\n }", "private int getId() {\r\n\t\treturn id;\r\n\t}", "public Integer getId(){return id;}", "public int id() {return id;}", "public long getId(){return this.id;}", "public int getId(){\r\n return this.id;\r\n }", "@Override public String getID() { return id;}", "public Long id() { return this.id; }", "public Integer getId() { return id; }", "@Override\n\tpublic Integer getId() {\n return id;\n }", "@Override\n public Long getId () {\n return id;\n }", "@Override\n public long getId() {\n return id;\n }", "public Long getId() {return id;}", "public Long getId() {return id;}", "public String getId(){return id;}", "@Override\r\n\tpublic Long getId() {\n\t\treturn null;\r\n\t}", "public Integer getId() { return this.id; }", "@Override\r\n public int getId() {\n return id;\r\n }", "@Override\n\t\tpublic long getId() {\n\t\t\treturn 0;\n\t\t}", "public int getId() {\n return id;\n }", "public long getId() { return _id; }", "public int getId() {\n/* 35 */ return this.id;\n/* */ }", "public long getId() { return id; }", "public long getId() { return id; }", "public void setId(Long id) \n {\n this.id = id;\n }", "@Override\n\tpublic Long getId() {\n\t\treturn null;\n\t}", "@Override\n\tpublic Long getId() {\n\t\treturn null;\n\t}", "public void setId(String id) {\n this.id = id;\n }", "@Override\n\tpublic void setId(Long id) {\n\t}", "public Long getId() {\n return id;\n }", "public long getId() { return this.id; }", "public int getId()\n {\n return id;\n }", "public void setId(int id){\r\n this.id = id;\r\n }", "protected abstract String getId();", "@Test\r\n\tpublic void testSetId() {\r\n\t\tbreaku1.setId(5);\r\n\t\texternu1.setId(6);\r\n\t\tmeetingu1.setId(7);\r\n\t\tteachu1.setId(8);\r\n\r\n\t\tassertEquals(5, breaku1.getId());\r\n\t\tassertEquals(6, externu1.getId());\r\n\t\tassertEquals(7, meetingu1.getId());\r\n\t\tassertEquals(8, teachu1.getId());\r\n\t}", "@Override\n\tpublic int getId(){\n\t\treturn id;\n\t}", "public int getID() {return id;}", "public int getID() {return id;}", "public String getId() { return id; }", "public String getId() { return id; }", "public String getId() { return id; }", "@Override\n public int getField(int id) {\n return 0;\n }", "public int getId ()\r\n {\r\n return id;\r\n }", "public void setId(Long id)\n/* */ {\n/* 66 */ this.id = id;\n/* */ }", "public int getId(){\r\n return localId;\r\n }", "void setId(int id) {\n this.id = id;\n }", "@Override\n public Integer getId() {\n return id;\n }", "@Override\n\tpublic Object selectById(Object id) {\n\t\treturn null;\n\t}", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "@Override\n public int getId() {\n return id;\n }", "@Override\n public int getId() {\n return id;\n }", "public void setId(int id)\n {\n this.id=id;\n }", "@Override\r\n public int getID()\r\n {\r\n\treturn id;\r\n }", "@Override\n\tpublic Integer getId() {\n\t\treturn null;\n\t}", "public int getId()\r\n {\r\n return id;\r\n }", "public void setId(Long id){\n this.id = id;\n }", "@java.lang.Override\n public int getId() {\n return id_;\n }", "@java.lang.Override\n public int getId() {\n return id_;\n }", "final protected int getId() {\n\t\treturn id;\n\t}", "private void clearId() {\n \n id_ = 0;\n }", "public abstract Long getId();", "public void setId(Long id) \r\n {\r\n this.id = id;\r\n }", "@Override\n public long getId() {\n return this.id;\n }", "public String getId(){ return id.get(); }", "@SuppressWarnings ( \"unused\" )\n private void setId ( final Long id ) {\n this.id = id;\n }", "public void setId(long id){\n this.id = id;\n }", "public void setId(long id){\n this.id = id;\n }", "public void setId(Integer id)\r\n/* */ {\r\n/* 122 */ this.id = id;\r\n/* */ }", "public Long getId() \n {\n return id;\n }", "@Override\n\tpublic void setId(int id) {\n\n\t}", "public void test_getId() {\n assertEquals(\"'id' value should be properly retrieved.\", id, instance.getId());\n }", "@Override\r\n\tpublic Object getId() {\n\t\treturn null;\r\n\t}", "public int getID(){\n return id;\n }", "public String getID(){\n return Id;\n }", "public int getId()\n {\n return id;\n }" ]
[ "0.68948644", "0.6837785", "0.67038405", "0.6639133", "0.6639133", "0.65911627", "0.6576973", "0.6576973", "0.6573157", "0.6573157", "0.6573157", "0.6573157", "0.6573157", "0.6573157", "0.65598476", "0.65598476", "0.6543178", "0.6523156", "0.65143406", "0.6486455", "0.6475413", "0.64253694", "0.6417849", "0.64156985", "0.6400779", "0.6365434", "0.63546157", "0.63499856", "0.6346203", "0.63227576", "0.631763", "0.63001484", "0.629182", "0.629182", "0.62824625", "0.62701356", "0.62650704", "0.6263972", "0.6261773", "0.62577695", "0.6254688", "0.62506694", "0.62461007", "0.62461007", "0.62423015", "0.62379855", "0.62379855", "0.623057", "0.6222287", "0.62187535", "0.6218387", "0.6210061", "0.62075466", "0.62007535", "0.6199978", "0.6191151", "0.6188524", "0.6188524", "0.6188345", "0.6188345", "0.6188345", "0.6185662", "0.6182675", "0.6173944", "0.6173008", "0.6165809", "0.6164505", "0.61599946", "0.61553764", "0.61553764", "0.61553764", "0.61553764", "0.61553764", "0.61553764", "0.61553764", "0.6154299", "0.6154299", "0.6140791", "0.61329263", "0.612767", "0.61260307", "0.61032844", "0.6102886", "0.6102886", "0.6101522", "0.6101417", "0.61006045", "0.6098037", "0.6098024", "0.6093603", "0.6091251", "0.60907245", "0.60907245", "0.6090395", "0.6087628", "0.6075129", "0.6071766", "0.6070483", "0.6069239", "0.6068642", "0.6068207" ]
0.0
-1
Created by kburkhardt on 1/24/15.
public interface GameServerState<Data> extends ServerState { void setId(int id); int getId(); Data getClusterEntry(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void perish() {\n \n }", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "private stendhal() {\n\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\n\tprotected void interr() {\n\t}", "public final void mo51373a() {\n }", "@Override\n public void func_104112_b() {\n \n }", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "protected boolean func_70814_o() { return true; }", "@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}", "private void poetries() {\n\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\n public void init() {\n\n }", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void jugar() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\n public int describeContents() { return 0; }", "@Override\n public void init() {\n }", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@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 }", "@Override\n protected void init() {\n }", "@Override\r\n\tpublic void init() {}", "@Override\n\tpublic void anular() {\n\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\n public void init() {}", "private void m50366E() {\n }", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\n void init() {\n }", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\n protected void initialize() {\n\n \n }", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\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}", "public void mo38117a() {\n }", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\r\n\tpublic void anularFact() {\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\t\t\r\n\t}", "private void init() {\n\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}", "@Override\n\tpublic void init() {\n\t}", "public void method_4270() {}", "@Override\n public void init() {\n\n }", "@Override\n public void init() {\n\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "private void kk12() {\n\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "@Override\r\n\tprotected void doF4() {\n\t\t\r\n\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\n\tprotected void initialize() {\n\t}", "@Override\n\tprotected void initialize() {\n\t}", "@Override\n\t\tpublic void init() {\n\t\t}", "@Override\n\tpublic void init()\n\t{\n\n\t}", "@Override\n public int retroceder() {\n return 0;\n }", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void initialize() { \n }", "private Rekenhulp()\n\t{\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void doF8() {\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 public int describeContents() { return 0; }", "private static void cajas() {\n\t\t\n\t}", "@Override\n public void init() {\n }", "@Override\n protected void getExras() {\n }", "private void strin() {\n\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic final void init() {\r\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 jugar() {}", "@Override\n public void initialize() {}" ]
[ "0.58455807", "0.5791059", "0.56601936", "0.56469935", "0.5614285", "0.56104904", "0.5599285", "0.55924106", "0.55674386", "0.55674386", "0.55114466", "0.55092025", "0.55092025", "0.55092025", "0.55092025", "0.55092025", "0.54906726", "0.54901785", "0.54890007", "0.54823345", "0.547704", "0.54621315", "0.5459841", "0.5459841", "0.5446763", "0.5436911", "0.5433875", "0.5430725", "0.5416934", "0.5416934", "0.5416934", "0.5416934", "0.5416934", "0.5416934", "0.540673", "0.5406488", "0.5406199", "0.5404864", "0.53998464", "0.53827643", "0.5376873", "0.5374577", "0.5368191", "0.5363417", "0.53626645", "0.53574586", "0.53567874", "0.5350973", "0.5350973", "0.5350973", "0.53452384", "0.53416866", "0.5341393", "0.5332865", "0.5332865", "0.5332865", "0.5330092", "0.5322121", "0.5322121", "0.5322121", "0.53195745", "0.53096336", "0.5305644", "0.5305644", "0.5304428", "0.5302898", "0.52956104", "0.5283706", "0.52788997", "0.52783483", "0.5269162", "0.5269162", "0.525215", "0.52493495", "0.523695", "0.52344567", "0.5231189", "0.52291334", "0.5212692", "0.5208069", "0.5200006", "0.51974785", "0.5195953", "0.51939225", "0.51939225", "0.5184915", "0.5183494", "0.5180568", "0.51773286", "0.51700616", "0.51568854", "0.51533425", "0.5147797", "0.5147797", "0.5147797", "0.5147797", "0.5147797", "0.5147797", "0.5147797", "0.5144106", "0.5141123" ]
0.0
-1
Specify the base URL to the RESTful web service
@Test public void Solution() { RestAssured.baseURI = baseUrl; RestAssured.useRelaxedHTTPSValidation(); JsonPath jsonpath = RestAssured.get("/comments?postId=40").body().jsonPath(); // get the jsonResponse list List<Object> jsonResponse = jsonpath.getList("$"); assertEquals(jsonResponse.size(), 5); // put the elemnts with the corresponding name in a map Map<String, String> aMap = jsonpath.getMap("find {it.name == 'pariatur aspernatur nam atque quis'}"); Assert.assertTrue(aMap.containsKey("id")); Assert.assertTrue(aMap.containsKey("email")); Assert.assertTrue(aMap.containsKey("body")); Assert.assertTrue(aMap.containsKey("name")); assertEquals(aMap.get("id"), 199); assertEquals(aMap.get("name"), "pariatur aspernatur nam atque quis"); assertEquals(aMap.get("email"), "Cooper_Boehm@damian.biz"); assertEquals(aMap.get("body"), "veniam eos ab voluptatem in fugiat ipsam quis\nofficiis non qui\nquia ut id voluptates et a molestiae commodi quam\ndolorem enim soluta impedit autem nulla"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tprotected String getHttpBaseUrl() {\n\t\treturn this.properties.getHttpUrlBase();\n\t}", "public abstract String getBaseURL();", "private static String getBaseUrl() {\n StringBuilder url = new StringBuilder();\n url.append(getProtocol());\n url.append(getHost());\n url.append(getPort());\n url.append(getVersion());\n url.append(getService());\n Log.d(TAG, \"url_base: \" + url.toString());\n return url.toString();\n }", "private static URI getBaseURI() {\n\t\treturn UriBuilder.fromUri(\"https://api.myjson.com/bins/aeka0\").build();\n\t}", "public static void setBaseURL() {\n\n\t\tRestAssured.baseURI = DataReader.dataReader(\"baseURL\");\n\t}", "private String getRootUrl(String path){\n return \"http://localhost:\" + port + \"/api/v1\" + path;\n }", "String getRootServerBaseUrl();", "@Override\r\n public URI getBaseUri() {\n try{\r\n return new URI(\"http://localhost:8080/app/jpa-rs/\");\r\n } catch (URISyntaxException e){\r\n return null;\r\n }\r\n }", "void setBaseUri(String baseUri);", "public String getBaseUrl() {\r\n return baseUrl;\r\n }", "public String getBaseUrl()\n {\n return baseUrl;\n }", "public String getBaseUrl() {\n return baseUrl;\n }", "public String getBaseUrl() {\n return baseUrl;\n }", "protected String getBaseUrl() {\n return requestBaseUrl;\n }", "private String getRestUrl() {\n return restUrl;\n }", "public abstract RestURL getURL();", "IParser setServerBaseUrl(String theUrl);", "public String getBaseUrl()\r\n {\r\n return this.url;\r\n }", "private static String getBaseUrl()\r\n {\r\n return \"https://rapidapi.io/connect\";\r\n }", "public String getBaseUrl()\n\t{\n\t\treturn baseUrl;\n\t}", "private String baseUrl() {\n return \"http://\" + xosServerAddress + \":\" +\n Integer.toString(xosServerPort) + XOSLIB + baseUri;\n }", "public String getHandleServiceBaseUrl();", "public String getBaseUrl() {\n return builder.getBaseUrl();\n }", "public static String getBaseUrl() {\r\n if (baseUrl == null) {\r\n baseUrl = Constants.HTTP_PROTOCOL + \"://\" + getBaseHost() + \":\" + getBasePort();\r\n }\r\n return baseUrl;\r\n }", "String getServerBaseURL();", "public String getBaseUrl() {\n return (String) get(\"base_url\");\n }", "public String getRestUrl() {\n return this.restUrl;\n }", "public String getBaseURL() {\n return baseURL;\n }", "public String getBaseURL() {\n return baseURL;\n }", "public static String getBaseUrl() {\n return baseUrl;\n }", "FullUriTemplateString baseUri();", "private String getEndPointUrl()\r\n\t{\r\n\t\t// TODO - Get the URL from WSRR\r\n\t\treturn \"http://localhost:8093/mockCustomerBinding\";\r\n\t}", "String getServiceUrl();", "@Override\n\tprotected String getWebServiceUri() {\n\t\treturn this.uri;\n\t}", "public void setBaseUrl(String baseUrl) {\n this.baseUrl = baseUrl;\n }", "public void setBaseURL(String val) {\n\n\t\tbaseURL = val;\n\n\t}", "public String getBaseUrl() {\n return preferences.getString(PREFERENCES_BACKEND_BASE_URL, \"http://naamataulu-backend.herokuapp.com/api/v1/\");\n }", "public URL makeBase(URL startingURL);", "public RestAPI setBaseURL(String url) throws APIException {\n\t\tthis.url = url;\n\t\tcheckBaseURL();\n\n\t\treturn this;\n\t}", "public String getRestUrl(VariableSpace space) {\n StringBuilder url = new StringBuilder();\n\n if (useSSL) {\n url.append(\"https://\");\n } else {\n url.append(\"http://\");\n }\n\n url.append(space.environmentSubstitute(tenant)).append('.');\n url.append(space.environmentSubstitute(namespace)).append('.');\n url.append(space.environmentSubstitute(server));\n\n String realPort = space.environmentSubstitute(port);\n if (StringUtils.isNotEmpty(realPort)) {\n url.append(':').append(realPort);\n }\n\n url.append(\"/rest\");\n\n return url.toString();\n }", "java.lang.String getApiUrl();", "public String getApiBaseUrl() {\n return this.apiBaseUrl;\n }", "@Override\r\n\tpublic void setAPIBaseUrl(String apiBaseUrl) {\n\t\tthis.apiBaseUrl = apiBaseUrl;\r\n\t}", "private String getRootUrl() {\n\t\treturn \"http://localhost:\" + port;\n\t}", "private String getRootUrl() {\n\t\treturn \"http://localhost:\" + port;\n\t}", "public void setRestUrl(String url) {\n this.restUrl = url;\n }", "public String baseUrl() {\n return baseUrl;\n }", "protected abstract String getBaseEndpointPath();", "@Nonnull\n\tprivate URI getPossiblyInsecureBaseUri() {\n\t\tUriInfo ui = getUriInfo();\n\t\tif (ui != null && ui.getBaseUri() != null)\n\t\t\treturn ui.getBaseUri();\n\t\t// See if JAX-WS *cannot* supply the info\n\t\tif (jaxws == null || jaxws.getMessageContext() == null)\n\t\t\t// Hack to make the test suite work\n\t\t\treturn URI.create(\"http://\" + DEFAULT_HOST\n\t\t\t\t\t+ \"/taverna-server/rest/\");\n\t\tString pathInfo = (String) jaxws.getMessageContext().get(PATH_INFO);\n\t\tpathInfo = pathInfo.replaceFirst(\"/soap$\", \"/rest/\");\n\t\tpathInfo = pathInfo.replaceFirst(\"/rest/.+$\", \"/rest/\");\n\t\treturn URI.create(\"http://\" + getHostLocation() + pathInfo);\n\t}", "public String getApiUrl();", "@Before\n public void setBaseUri () {\n RestAssured.port = 8080;\n RestAssured.baseURI = \"http://localhost\";\n RestAssured.basePath = \"/v1\";\n }", "@Override\n public String getBaseUri() {\n return null;\n }", "public String getBaseUrl() {\n StringBuffer buf = new StringBuffer();\n buf.append(getScheme());\n buf.append(\"://\");\n buf.append(getServerName());\n if ((isSecure() && getServerPort() != 443) ||\n getServerPort() != 80) {\n buf.append(\":\");\n buf.append(getServerPort());\n }\n return buf.toString();\n }", "String basePath();", "public String getBaseURL() {\n\n\t\treturn baseURL;\n\n\t}", "public void setBaseUrl(final String baseUrl) {\n this.baseUrl = baseUrl;\n }", "public void setSchemaBaseURL(String schemaBaseURL) {\n this.schemaBaseURL = schemaBaseURL;\n }", "public UsersFollowsResource(String baseUrl) {\n super(baseUrl);\n }", "@Override\r\n\tprotected String getBasePath() {\n\t\treturn \"/module/tstaff/\";\r\n\t}", "public String appBaseUrl() {\n int amtToTrim = request.getServletPath().length() + request.getPathInfo().length();\n String appBase = requestURL.substring(0, requestURL.length()-amtToTrim);\n return appBase;\n }", "public static String getBaseURL()\r\n {\r\n String savedUrl = P.getChoreoServicesUrl();\r\n return savedUrl.length() > 0 ? savedUrl : Config.DEFAULT_SERVER_URL;\r\n }", "public void determineBaseUrl() {\n if (Environment.isLatest()) {\n baseUrl = \"api-latest.wdpro.starwave.com\";\n } else if (Environment.isStage()) {\n baseUrl = \"api-stage.wdpro.starwave.com\";\n } else if (Environment.isENV4()) {\n baseUrl = \"api-latest.wdpro.starwave.com\";\n } else if (Environment.isENV2()) {\n // baseUrl = \"api-qa.wdpro.disney.go.com:8088\";\n baseUrl = \"api-env2.wdpro.starwave.com\";\n } else if (Environment.isSoftLaunch()) {\n baseUrl = \"api.wdpro.disney.go.com\";\n } else if (Environment.isShadow()) {\n baseUrl = \"api-shadow.wdpro.starwave.com\";\n } else if (Environment.isProduction()) {\n baseUrl = \"api.wdpro.disney.go.com\";\n } else {\n baseUrl = \"api.wdpro.disney.go.com\";\n }\n }", "public void setProxyBaseUrl(String baseURL) {\n this.proxyBaseUrl = baseURL;\n }", "private String getUrlBaseForLocalServer() {\n\t HttpServletRequest request = ((ServletRequestAttributes) \n\t\t\t RequestContextHolder.getRequestAttributes()).getRequest();\n\t String base = \"http://\" + request.getServerName() + ( \n\t (request.getServerPort() != 80) \n\t \t\t ? \":\" + request.getServerPort() \n\t\t\t\t : \"\");\n\t return base;\n\t}", "@javax.annotation.Nullable\n @ApiModelProperty(value = \"Set the baseurl for assets.\")\n @JsonProperty(JSON_PROPERTY_BASEURL)\n @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)\n\n public String getBaseurl() {\n return baseurl;\n }", "protected abstract String getBaseEndpoint();", "public String getBaseUri() {\n\t\treturn baseUri;\n\t}", "public SitoWeb() {\r\n\t\tsuper();\r\n\t\turlBase = null;\r\n\t}", "public String getBaseURL() {\n\t\treturn \"http://www.apple.com/itunes/charts\";\r\n\t}", "@Override\n protected String getViewBasePath() {\n //region your codes 2\n return \"/operation/activityHall\";\n //endregion your codes 2\n }", "public static String getBaseURI() {\n\t\treturn getIP() + \":\" + getPort();\r\n//\t\tURIBuilder builder = new URIBuilder();\r\n//\t\tbuilder.setScheme(\"http\");\r\n//\t\tbuilder.setHost(getIP());\r\n//\t\tbuilder.setPort(Integer.valueOf(getPort()));\r\n//\t\tbuilder.setPath(\"/\"+getVersion());\r\n//\t\treturn builder.toString();\r\n//\t\treturn \"http://\" + getIP() + \":\" + getPort()\r\n//\t\t\t\t+ \"/\"+getVersion();\r\n\t}", "public void setBasePath(final String value)\n {\n basePath = value;\n }", "private String getBaseUri() {\n\t\treturn null;\n\t}", "public URL getCveJsonUrlBase() {\n return cveJsonUrlBase;\n }", "public void setBaseUrl(java.lang.String mBaseUrl) {\n bugQuery.setBaseUrl(mBaseUrl);\n }", "public String getServiceUrl() {\n return \"http://\" + this.serviceHost + \":\" + this.servicePort;\n }", "public static String UrlToHit(){\n\t\treturn BaseURL;\n\t}", "public java.lang.String getBaseUrl() {\n return bugQuery.getBaseUrl();\n }", "public String url() {\n return server.baseUri().toString();\n }", "@Override\r\n\t\tpublic String getBaseURI()\r\n\t\t\t{\n\t\t\t\treturn null;\r\n\t\t\t}", "URI getBaseURI() {\n return _baseURI;\n }", "public static URL getUrlForReg()\r\n {\r\n String strUrl = getBaseURL() + \"account_services/api/1.0/account\";\r\n return str2url( strUrl );\r\n }", "public static String getdevBaseUrl(){\n\n return DEV_BASE_URL;\n }", "String serviceEndpoint();", "public String getApplicationURL()\n\t{\n\t\tString url=pro.getProperty(\"baseURL\");\n\t\treturn url;\n\t}", "@Override\n\tpublic URL getBaseURL() {\n\t\tURL url = null;\n\t\tString buri = getBaseURI();\n\t\tif (buri != null) {\n\t\t\ttry {\n\t\t\t\turl = new URL(buri);\n\t\t\t} catch (MalformedURLException e) {\n\t\t\t\ttry {\n\t\t\t\t\tString docuri = document.getDocumentURI();\n\t\t\t\t\tif (docuri != null) {\n\t\t\t\t\t\tURL context = new URL(docuri);\n\t\t\t\t\t\turl = new URL(context, buri);\n\t\t\t\t\t}\n\t\t\t\t} catch (MalformedURLException e1) {\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn url;\n\t}", "String getRequestURL();", "public interface IServiceApi {\n public static final String VERSION = \"v1/\";\n public static final String BASE = \"/api/\"+VERSION;\n \n}", "public String getBaseURI(){\r\n\t\t \r\n\t\t String uri = properties.getProperty(\"baseuri\");\r\n\t\t if(uri != null) return uri;\r\n\t\t else throw new RuntimeException(\"baseuri not specified in the configuration.properties file.\");\r\n\t }", "public ConfigurationProviderHTTP(List<URI> baseList, String restUsr, String restPwd) throws IOException {\n this.baseList = baseList;\n this.restUsr = restUsr;\n this.restPwd = restPwd;\n }", "String getBaseUri();", "public URL getDocumentBase() {\n/* 158 */ return this.stub.getDocumentBase();\n/* */ }", "public String getApiBase() {\n\t\treturn apiBase;\n\t}", "public static String getModuleBaseUrl(HttpServletRequest request) {\n\t String requestedUri = request.getRequestURI();\n\t int contextEnd = request.getContextPath().length();\n\t int folderEnd = requestedUri.lastIndexOf('/') + 1;\n\t return requestedUri.substring(contextEnd, folderEnd);\n\t }", "public static String getBaseUrl(HttpServletRequest request) {\n\t\tif ((request.getServerPort() == 80) || (request.getServerPort() == 443))\n\t\t{\n\t\t\treturn request.getScheme() + \"://\" + request.getServerName();\t\n\t\t}\n\t\telse\n\t\t{\n\n\t\t\treturn request.getScheme() + \"://\" + request.getServerName() + \":\" + request.getServerPort();\n\t\t}\n\t}", "public ResourceSite( Class<?> baseClass, String baseDir) {\n super( toResourceURI( baseClass, baseDir));\n }", "public String getDocumentBase() {\n return getServerBase() + getContextPath() + \"/\";\n }", "public static String getApiUrl() {\n return API_URL;\n }", "public static String setURL(String endpoint) {\n String url = hostName + endpoint;\n\n log.info(\"Enpoint: \" + endpoint);\n\n return url;\n\n }", "public static ApiREST api(){\n\n RestAdapter restAdapter = new RestAdapter.Builder()\n .setEndpoint(CONFIG_BASE_DOMAIN)\n //.setLogLevel(RestAdapter.LogLevel.FULL)\n .build();\n ApiREST apiRest = restAdapter.create(ApiREST.class);\n return apiRest;\n }", "public void setBaseURL(final String url) {\r\n String location = url;\r\n //-- remove filename if necessary:\r\n if (location != null) { \r\n int idx = location.lastIndexOf('/');\r\n if (idx < 0) idx = location.lastIndexOf('\\\\');\r\n if (idx >= 0) {\r\n int extIdx = location.indexOf('.', idx);\r\n if (extIdx > 0) {\r\n location = location.substring(0, idx);\r\n }\r\n }\r\n }\r\n \r\n try {\r\n _resolver.setBaseURL(new URL(location));\r\n } catch (MalformedURLException except) {\r\n // try to parse the url as an absolute path\r\n try {\r\n LOG.info(Messages.format(\"mapping.wrongURL\", location));\r\n _resolver.setBaseURL(new URL(\"file\", null, location));\r\n } catch (MalformedURLException except2) { }\r\n }\r\n }" ]
[ "0.7228045", "0.69052815", "0.679907", "0.6798727", "0.67873746", "0.67425233", "0.67407423", "0.67308515", "0.67306757", "0.6651933", "0.6629259", "0.6582385", "0.6582385", "0.6571985", "0.6567037", "0.6555146", "0.65542257", "0.6554184", "0.6522676", "0.65026265", "0.6438879", "0.6416326", "0.63787746", "0.63740313", "0.63659316", "0.6356502", "0.6345763", "0.6345462", "0.6345462", "0.6330037", "0.6282444", "0.6276047", "0.6275701", "0.62664837", "0.6250734", "0.624287", "0.6228393", "0.6217085", "0.61851037", "0.6177517", "0.6171215", "0.61693364", "0.6154749", "0.6152642", "0.6152642", "0.6146127", "0.61236894", "0.612208", "0.6095918", "0.60801274", "0.6067078", "0.60530084", "0.604767", "0.60348326", "0.60301036", "0.6029481", "0.6019594", "0.6014008", "0.5997258", "0.5985958", "0.59414774", "0.5930176", "0.59260994", "0.59013104", "0.5899869", "0.5882633", "0.58749294", "0.5854604", "0.58536154", "0.58511794", "0.58446413", "0.58070326", "0.5795006", "0.57820845", "0.5780958", "0.5741089", "0.57082444", "0.5689262", "0.5686235", "0.5684853", "0.567184", "0.56680954", "0.5662341", "0.56469357", "0.56345415", "0.56161886", "0.5615716", "0.56008613", "0.5598776", "0.5593315", "0.55924845", "0.5578787", "0.55675185", "0.55465543", "0.5545189", "0.5544514", "0.5520986", "0.5515878", "0.5496271", "0.5489581", "0.5486333" ]
0.0
-1
leggo le cartelle del fascicolo da Esb
private static CartelleAvvisiResponseType getBPSCartelleResponse( Fascicolo fascicolo) throws Exception { CartellaAvvisiRequestType bpCartelleRequest = new CartellaAvvisiRequestType(); bpCartelleRequest.setTipologiaRichiesta(MessagesClass.getMessage("TIPOLOGIA_DOCUMENTI_TUTTI").trim()) ; bpCartelleRequest.setCodiceFiscale(fascicolo.getAnagrafica().getCodiceFiscale().trim()); //il tipo documento (cartella od avviso), viene lasciato vuoto in modo da caricare entrambe le tipologie //bpCartelleRequest.setTipoDocumento(null); //inizio modifiche Agosto DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); Date dataAttuale = new Date(); logger.debug(dateFormat.format(dataAttuale)); bpCartelleRequest.setDataRichiesta(dataAttuale ); //fine modifiche Agosto return getBPSCartelleResponse(bpCartelleRequest); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Carta(char s,int v)\r\n {\r\n valore = v;\r\n \r\n nome = \"\";\r\n \r\n codice = valore;\r\n \r\n Potenziale = new ConcurrentSkipListMap();\r\n \r\n ValoriPotenziale = new ConcurrentSkipListMap(); \r\n \r\n /*\r\n COME VIENE DETERMINATO IL CODICE DELL CARTA:\r\n \r\n Il codice della carta serve principalmente a reperirne\r\n l'immagine all'interno della cartella CardSkins e viene\r\n determinato nel seguente modo:\r\n \r\n - Valore + Seme;\r\n \r\n In modo che si presenti la seguente situazione:\r\n \r\n -Carte di coppe : Intervallo [0,10]\r\n -Carte di denari : Intervallo [11,20]\r\n -Carte di batoni : Intervallo [21,30]\r\n -Carte di spade : Intervallo [31,40]\r\n */\r\n switch(v)\r\n {\r\n case 1:\r\n nome += \"Asso di \";\r\n break;\r\n case 2:\r\n nome += \"Due di \";\r\n break;\r\n case 3:\r\n nome += \"Tre di \";\r\n break;\r\n case 4:\r\n nome += \"Quattro di \";\r\n break;\r\n case 5:\r\n nome += \"Cinque di \";\r\n break;\r\n case 6:\r\n nome += \"Sei di \";\r\n break;\r\n case 7:\r\n nome += \"Sette di \";\r\n break;\r\n case 8:\r\n nome += \"Fante di \";\r\n break;\r\n case 9:\r\n nome += \"Cavallo di \";\r\n break;\r\n case 10:\r\n nome += \"Re di \";\r\n break;\r\n default:\r\n throw new IllegalArgumentException();\r\n }\r\n \r\n switch(s)\r\n {\r\n case 's':\r\n seme = \"spade\";\r\n codice += 30;\r\n break;\r\n case 'b':\r\n seme = \"bastoni\";\r\n codice += 20;\r\n break;\r\n case 'c':\r\n seme = \"coppe\";\r\n codice += 0;\r\n break;\r\n case 'd':\r\n seme = \"denari\";\r\n codice += 10;\r\n break;\r\n default:\r\n throw new IllegalArgumentException();\r\n }\r\n \r\n nome += seme;\r\n \r\n ThoughtProbability = 1.0;\r\n \r\n Weight = 1.0;\r\n \r\n IsMaxPrimiera = false;\r\n }", "@Override\n\tpublic String toString(){\n\t\treturn \"Inf carta:\\n\"+numero+\"de \"+palo+\"\\nValor: \"+valor;\n\t}", "public Carta(int num,Seme se,int va,int pu){\n this.numero=num;\n this.seme=se;\n this.valore=va;\n this.punti=pu;\n }", "private static void benvenuto() {\n\t\tUtilityIO.header(MSG_BENVENUTO, SIMBOLO_MESSAGGIO_BENV_USCITA);\n\t\tSystem.out.println();\n\t\t\n\t}", "private String insertarCartaVitalTransfusion() {\n int[] valoresEnemigo = {\n// this.dañoEnemigo=valoresEnemigo[0];\n 3,\n// this.curaEnemigo=valoresEnemigo[1];\n 0,\n// this.cartasEnemigo=valoresEnemigo[2];\n 0,\n// this.descarteEnemigo=valoresEnemigo[3];\n 0,\n// this.recursosEnemigo=valoresEnemigo[4];\n 0,\n// this.moverMesaAManoEnemigo=valoresEnemigo[5];\n 0,\n// this.moverDescarteAManoEnemigo=valoresEnemigo[6];\n 0,\n// this.moverDeckAManoEnemigo=valoresEnemigo[7];\n 0,\n// this.moverMesaADeckEnemigo=valoresEnemigo[8];\n 0,\n// this.moverDescarteADeckEnemigo=valoresEnemigo[9];\n 0,\n// this.moverManoADeckEnemigo=valoresEnemigo[10];\n 0,\n// this.moverMesaADescarteEnemigo=valoresEnemigo[11];\n 0,\n// this.moverManoADescarteEnemigo=valoresEnemigo[12];\n 0,\n// this.moverDeckADescarteEnemigo=valoresEnemigo[13];\n 0,\n// this.moverDescarteAMesaEnemigo=valoresEnemigo[14];\n 0,\n// this.moverManoAMesaEnemigo=valoresEnemigo[15];\n 0,\n// this.moverDeckAMesaEnemigo=valoresEnemigo[16];\n 0\n };\n int[] valoresOwner = {\n// this.dañoOwner=valoresOwner[0];\n 0,\n// this.curaOwner=valoresOwner[1];\n 2,\n// this.cartasOwner=valoresOwner[2];\n 0,\n// this.descarteOwner=valoresOwner[3];\n 0,\n// this.recursosOwner=valoresOwner[4];\n 0,\n// this.moverMesaAManoOwner=valoresOwner[5];\n 0,\n// this.moverDescarteAManoOwner=valoresOwner[6];\n 0,\n// this.moverDeckAManoOwner=valoresOwner[7];\n 0,\n// this.moverMesaADeckOwner=valoresOwner[8];\n 0,\n// this.moverDescarteADeckOwner=valoresOwner[9];\n 0,\n// this.moverManoADeckOwner=valoresOwner[10];\n 0,\n// this.moverMesaADescarteOwner=valoresOwner[11];\n 0,\n// this.moverManoADescarteOwner=valoresOwner[12];\n 0,\n// this.moverDeckADescarteOwner=valoresOwner[13];\n 0,\n// this.moverDescarteAMesaOwner=valoresOwner[14];\n 0,\n// this.moverManoAMesaOwner=valoresOwner[15];\n 0,\n// this.moverDeckAMesaOwner=valoresOwner[16];\n 0\n };\n boolean[]valoresPlay={\n //this.OnMoveMesaADescarte=valoresPlay[0];\n false,\n //this.OnMoveMesaADeck=valoresPlay[1];\n false,\n //this.OnMoveMesaAMano=valoresPlay[2];\n false,\n //this.OnMoveDescarteAMesa=valoresPlay[3];\n false,\n //this.OnMoveDescarteADeck=valoresPlay[4];\n false,\n// this.OnMoveDescarteAMano=valoresPlay[5];\n false,\n// this.OnMoveDeckADescarte=valoresPlay[6];\n false,\n// this.OnMoveDeckAMesa=valoresPlay[7];\n false,\n// this.OnMoveDeckAMano=valoresPlay[8];\n false,\n// this.OnMoveManoADescarte=valoresPlay[9];\n false,\n// this.OnMoveManoAMesa=valoresPlay[10];\n true,\n// this.OnMoveManoADeck=valoresPlay[11];\n false,\n// this.OnStartTurnTable=valoresPlay[12];\n false,\n// this.OnStartTurnHand=valoresPlay[13];\n false,\n// this.OnStartTurnDiscard=valoresPlay[14];\n false,\n// this.OnStartTurnDeck=valoresPlay[15];\n false,\n// this.OnEndTurnTable=valoresPlay[16];\n false,\n// this.OnEndTurnHand=valoresPlay[17];\n false,\n// this.OnEndTurnDiscard=valoresPlay[18];\n false,\n// this.OnEndTurnDeck=valoresPlay[19];\n false,\n };\n ArrayList<Integer> datos = new ArrayList<Integer>();\n String nombre = \"\";\n for (int i = 0; i < valoresEnemigo.length; i++) {\n datos.add(valoresEnemigo[i]);\n }\n for (int i = 0; i < valoresOwner.length; i++) {\n datos.add(valoresOwner[i]);\n }\n for (int i = 0; i < valoresPlay.length; i++) {\n if(valoresPlay[i]){\n datos.add(1);\n }else{\n datos.add(0);\n }\n }\n String insert=\"\";\n for(int i=0;i<datos.size();i++){\n if(i<datos.size()-1) {\n insert += datos.get(i) + \", \";\n }else{\n insert += datos.get(i) + \" )\";\n }\n }\n return insert;\n }", "public void CARGARCODIGO(String console,String charI,String charF,NSRTableModel t){\n\t\tList<DGENERACIONCODIGOS> listDGeneracionCodigo =new ArrayList<DGENERACIONCODIGOS>();\n\t\tMap<String,String> mapa;\n\t\tint j=0;\n\t\tString codigo=\"\";\n\t\t/*LIMPIAR PANEL*/\n\t\ttry{\n\t\t\t//listGeneracionCodigo \t=\t(new GENERACIONCODIGOSDao()).listar(1,\"IDEMPRESA = ? and PARAMETRO = ?\",ConfigInicial.LlenarConfig()[8].toString(),\"FrmPackingList\");\n//\t\t\tlistDGeneracionCodigo \t=\t(new DGENERACIONCODIGOSDao()).listar();\n\t\t\t/*****************************TRAER DATOS DE CONSOLE*************************/\n\t\t\tArrayList<String> listcodigo=new ArrayList<String>();\n\t\t\tfor(int x=1;x<=listGeneracionCodigo.size();x++){\n\t\t\t\tlistcodigo.add(codigo=Constantes.buscarFragmentoTexto(console,charI,charF,x));\n\t\t\t}\n\t\t\t/**************************RECORRER CABECERA********************************/\n\t\t\tfor(GENERACIONCODIGOS gc : listGeneracionCodigo){\n\t\t\t\tmapa= new HashMap<String,String>();\n\t\t\t\tlistDGeneracionCodigo \t=\t(new DGENERACIONCODIGOSDao()).listar(1,\"IDEMPRESA = ? and IDGENERACION = ?\",gc.getIDEMPRESA(),gc.getIDGENERACION());\n\t\t\t\t/*BUSCAR CÓDIGO CON LONGITUD REQUERIDA*/\n\t\t\t\tcodigo=buscarCadenaxLongitud(listcodigo,gc.getBARCODETOTAL());\n\t\t\t\tj=0;\n\t\t\t\tfor(DGENERACIONCODIGOS dgc : listDGeneracionCodigo){\n\t\t\t\t\tmapa.put(dgc.getPARAMETRO(), codigo.substring(j,j+dgc.getNUMDIGITO()));\n\t\t\t\t\tj+=dgc.getNUMDIGITO();\n\t\t\t\t}\n\t\t\t\t/**********************************LLENAR DATOS**************************************/\n\t\t\t\tmapaGen = mapa;\n\t\t\t\tt.addRow(new Object[] { getPack().getIDEMPRESA(), getPack().getIDSUCURSAL(), getPack().getIDPACKING(),\n\t\t\t\t\t\tgetDetalleTM().getRowCount() + 1, mapaGen.get(\"NROPALETA\"),mapaGen.get(\"IDPRODCUTO\"), \"\",mapaGen.get(\"IDLOTEP\"), \"\", \"\", 0.0, 0.0, 0.0 });\n\t\t\t\t\tmapaGen = new HashMap<String,String>();\n\t\t\t}\n\t\t}catch (NisiraORMException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\tConstantes.log.warn(e.getMessage());\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "void usada() {\n mazo.habilitarCartaEspecial(this);\n }", "private String insertarCartaBurningSign() {\n int[] valoresEnemigo = {\n// this.dañoEnemigo=valoresEnemigo[0];\n 2,\n// this.curaEnemigo=valoresEnemigo[1];\n 0,\n// this.cartasEnemigo=valoresEnemigo[2];\n 0,\n// this.descarteEnemigo=valoresEnemigo[3];\n 0,\n// this.recursosEnemigo=valoresEnemigo[4];\n 0,\n// this.moverMesaAManoEnemigo=valoresEnemigo[5];\n 0,\n// this.moverDescarteAManoEnemigo=valoresEnemigo[6];\n 0,\n// this.moverDeckAManoEnemigo=valoresEnemigo[7];\n 0,\n// this.moverMesaADeckEnemigo=valoresEnemigo[8];\n 0,\n// this.moverDescarteADeckEnemigo=valoresEnemigo[9];\n 0,\n// this.moverManoADeckEnemigo=valoresEnemigo[10];\n 0,\n// this.moverMesaADescarteEnemigo=valoresEnemigo[11];\n 0,\n// this.moverManoADescarteEnemigo=valoresEnemigo[12];\n 0,\n// this.moverDeckADescarteEnemigo=valoresEnemigo[13];\n 0,\n// this.moverDescarteAMesaEnemigo=valoresEnemigo[14];\n 0,\n// this.moverManoAMesaEnemigo=valoresEnemigo[15];\n 0,\n// this.moverDeckAMesaEnemigo=valoresEnemigo[16];\n 0\n };\n int[] valoresOwner = {\n// this.dañoOwner=valoresOwner[0];\n 0,\n// this.curaOwner=valoresOwner[1];\n 0,\n// this.cartasOwner=valoresOwner[2];\n 0,\n// this.descarteOwner=valoresOwner[3];\n 0,\n// this.recursosOwner=valoresOwner[4];\n 0,\n// this.moverMesaAManoOwner=valoresOwner[5];\n 0,\n// this.moverDescarteAManoOwner=valoresOwner[6];\n 0,\n// this.moverDeckAManoOwner=valoresOwner[7];\n 0,\n// this.moverMesaADeckOwner=valoresOwner[8];\n 0,\n// this.moverDescarteADeckOwner=valoresOwner[9];\n 0,\n// this.moverManoADeckOwner=valoresOwner[10];\n 0,\n// this.moverMesaADescarteOwner=valoresOwner[11];\n 0,\n// this.moverManoADescarteOwner=valoresOwner[12];\n 0,\n// this.moverDeckADescarteOwner=valoresOwner[13];\n 0,\n// this.moverDescarteAMesaOwner=valoresOwner[14];\n 0,\n// this.moverManoAMesaOwner=valoresOwner[15];\n 0,\n// this.moverDeckAMesaOwner=valoresOwner[16];\n 0\n };\n boolean[]valoresPlay={\n //this.OnMoveMesaADescarte=valoresPlay[0];\n false,\n //this.OnMoveMesaADeck=valoresPlay[1];\n false,\n //this.OnMoveMesaAMano=valoresPlay[2];\n false,\n //this.OnMoveDescarteAMesa=valoresPlay[3];\n false,\n //this.OnMoveDescarteADeck=valoresPlay[4];\n false,\n// this.OnMoveDescarteAMano=valoresPlay[5];\n false,\n// this.OnMoveDeckADescarte=valoresPlay[6];\n false,\n// this.OnMoveDeckAMesa=valoresPlay[7];\n false,\n// this.OnMoveDeckAMano=valoresPlay[8];\n false,\n// this.OnMoveManoADescarte=valoresPlay[9];\n false,\n// this.OnMoveManoAMesa=valoresPlay[10];\n false,\n// this.OnMoveManoADeck=valoresPlay[11];\n false,\n// this.OnStartTurnTable=valoresPlay[12];\n true,\n// this.OnStartTurnHand=valoresPlay[13];\n false,\n// this.OnStartTurnDiscard=valoresPlay[14];\n false,\n// this.OnStartTurnDeck=valoresPlay[15];\n false,\n// this.OnEndTurnTable=valoresPlay[16];\n false,\n// this.OnEndTurnHand=valoresPlay[17];\n false,\n// this.OnEndTurnDiscard=valoresPlay[18];\n false,\n// this.OnEndTurnDeck=valoresPlay[19];\n false,\n };\n ArrayList<Integer> datos = new ArrayList<Integer>();\n for (int i = 0; i < valoresEnemigo.length; i++) {\n datos.add(valoresEnemigo[i]);\n }\n for (int i = 0; i < valoresOwner.length; i++) {\n datos.add(valoresOwner[i]);\n }\n for (int i = 0; i < valoresPlay.length; i++) {\n if(valoresPlay[i]){\n datos.add(1);\n }else{\n datos.add(0);\n }\n }\n String insert=\"\";\n for(int i=0;i<datos.size();i++){\n if(i<datos.size()-1) {\n insert += datos.get(i) + \", \";\n }else{\n insert += datos.get(i) + \" )\";\n }\n }\n return insert;\n }", "public void mostrarCartasBazas(){\n int cont = 0;\n while(cont < cartasDeLaBaza.size()){\n System.out.println(cartasDeLaBaza.get(cont).toString());\n cont ++;\n }\n }", "private String insertarCartaLightning() {\n int[] valoresEnemigo = {\n// this.dañoEnemigo=valoresEnemigo[0];\n 2,\n// this.curaEnemigo=valoresEnemigo[1];\n 0,\n// this.cartasEnemigo=valoresEnemigo[2];\n 0,\n// this.descarteEnemigo=valoresEnemigo[3];\n 0,\n// this.recursosEnemigo=valoresEnemigo[4];\n 0,\n// this.moverMesaAManoEnemigo=valoresEnemigo[5];\n 0,\n// this.moverDescarteAManoEnemigo=valoresEnemigo[6];\n 0,\n// this.moverDeckAManoEnemigo=valoresEnemigo[7];\n 0,\n// this.moverMesaADeckEnemigo=valoresEnemigo[8];\n 0,\n// this.moverDescarteADeckEnemigo=valoresEnemigo[9];\n 0,\n// this.moverManoADeckEnemigo=valoresEnemigo[10];\n 0,\n// this.moverMesaADescarteEnemigo=valoresEnemigo[11];\n 0,\n// this.moverManoADescarteEnemigo=valoresEnemigo[12];\n 0,\n// this.moverDeckADescarteEnemigo=valoresEnemigo[13];\n 0,\n// this.moverDescarteAMesaEnemigo=valoresEnemigo[14];\n 0,\n// this.moverManoAMesaEnemigo=valoresEnemigo[15];\n 0,\n// this.moverDeckAMesaEnemigo=valoresEnemigo[16];\n 0\n };\n int[] valoresOwner = {\n// this.dañoOwner=valoresOwner[0];\n 0,\n// this.curaOwner=valoresOwner[1];\n 0,\n// this.cartasOwner=valoresOwner[2];\n 0,\n// this.descarteOwner=valoresOwner[3];\n 0,\n// this.recursosOwner=valoresOwner[4];\n 0,\n// this.moverMesaAManoOwner=valoresOwner[5];\n 0,\n// this.moverDescarteAManoOwner=valoresOwner[6];\n 0,\n// this.moverDeckAManoOwner=valoresOwner[7];\n 0,\n// this.moverMesaADeckOwner=valoresOwner[8];\n 0,\n// this.moverDescarteADeckOwner=valoresOwner[9];\n 0,\n// this.moverManoADeckOwner=valoresOwner[10];\n 0,\n// this.moverMesaADescarteOwner=valoresOwner[11];\n 0,\n// this.moverManoADescarteOwner=valoresOwner[12];\n 0,\n// this.moverDeckADescarteOwner=valoresOwner[13];\n 0,\n// this.moverDescarteAMesaOwner=valoresOwner[14];\n 0,\n// this.moverManoAMesaOwner=valoresOwner[15];\n 0,\n// this.moverDeckAMesaOwner=valoresOwner[16];\n 0\n };\n boolean[]valoresPlay={\n //this.OnMoveMesaADescarte=valoresPlay[0];\n false,\n //this.OnMoveMesaADeck=valoresPlay[1];\n false,\n //this.OnMoveMesaAMano=valoresPlay[2];\n false,\n //this.OnMoveDescarteAMesa=valoresPlay[3];\n false,\n //this.OnMoveDescarteADeck=valoresPlay[4];\n false,\n// this.OnMoveDescarteAMano=valoresPlay[5];\n false,\n// this.OnMoveDeckADescarte=valoresPlay[6];\n false,\n// this.OnMoveDeckAMesa=valoresPlay[7];\n false,\n// this.OnMoveDeckAMano=valoresPlay[8];\n false,\n// this.OnMoveManoADescarte=valoresPlay[9];\n false,\n// this.OnMoveManoAMesa=valoresPlay[10];\n true,\n// this.OnMoveManoADeck=valoresPlay[11];\n false,\n// this.OnStartTurnTable=valoresPlay[12];\n false,\n// this.OnStartTurnHand=valoresPlay[13];\n false,\n// this.OnStartTurnDiscard=valoresPlay[14];\n false,\n// this.OnStartTurnDeck=valoresPlay[15];\n false,\n// this.OnEndTurnTable=valoresPlay[16];\n false,\n// this.OnEndTurnHand=valoresPlay[17];\n false,\n// this.OnEndTurnDiscard=valoresPlay[18];\n false,\n// this.OnEndTurnDeck=valoresPlay[19];\n false,\n };\n ArrayList<Integer> datos = new ArrayList<Integer>();\n String nombre = \"\";\n for (int i = 0; i < valoresEnemigo.length; i++) {\n datos.add(valoresEnemigo[i]);\n }\n for (int i = 0; i < valoresOwner.length; i++) {\n datos.add(valoresOwner[i]);\n }\n for (int i = 0; i < valoresPlay.length; i++) {\n if(valoresPlay[i]){\n datos.add(1);\n }else{\n datos.add(0);\n }\n }\n String insert=\"\";\n for(int i=0;i<datos.size();i++){\n if(i<datos.size()-1) {\n insert += datos.get(i) + \", \";\n }else{\n insert += datos.get(i) + \" )\";\n }\n }\n return insert;\n }", "private static void saluti() {\n\t\tUtilityIO.header(MSG_CHIUSURA, SIMBOLO_MESSAGGIO_BENV_USCITA);\n\t\tSystem.out.println();\n\t}", "private void _jogaEstado_mesa(Player playerMain, Player playerInimigo) {\n Carta cartaP1;\n CartaMonstro cartaMon;\n CartaMagica cartaMag;\n\n boolean cartasQueAtacaram[] = new boolean[playerMain.mesa.MESA_SIZE];\n int cartaIndex;\n\n Arrays.fill(cartasQueAtacaram, false);\n\n /* o jogador ainda quiser atacar (se possivel) ou mudar a carta para modo defesa-ataque */\n while (true) {\n System.out.println(\"Jogador \" + playerMain.nickName + \", Escolha uma carta da sua mesa que deseja usar ( -1 para finalizar o turno )\");\n for (int i = 0; i < Mesa.MESA_SIZE; i++) {\n cartaMon = playerMain.mesa.cartasMonstros[i];\n\n if (cartaMon != null) {\n System.out.print(\" \" + i + \". \" + cartaMon.getNome() + \" \" + cartaMon.getATK() + \"/\" + cartaMon.getDEF());\n if (cartaMon.getModoCarta().isAtaqueBaixo() || cartaMon.getModoCarta().isAtaqueCima()) {\n System.out.print(\" - A\");\n } else {\n System.out.print(\" - D\");\n }\n if (cartasQueAtacaram[i]) {\n System.out.print(\" - X\");\n }\n\n System.out.println(\"\");\n } else {\n System.out.println(\" \" + i + \". ...\");\n }\n }\n for (int i = 0; i < Mesa.MESA_SIZE; i++) {\n cartaMag = playerMain.mesa.cartasMagicas[i];\n if (cartaMag != null) {\n System.out.println(\" \" + (i + Mesa.MESA_SIZE) + \". \" + cartaMag.getNome() + \" \" + cartaMag.getTipoEfeitoMagico());\n } else {\n System.out.println(\" \" + (i + Mesa.MESA_SIZE) + \" . ...\");\n }\n }\n\n cartaIndex = scanner.nextInt();\n if (cartaIndex == -1) {\n break;\n }\n\n //usando as cartas magicas\n if (cartaIndex >= Mesa.MESA_SIZE) {\n cartaIndex -= Mesa.MESA_SIZE;\n cartaMag = playerMain.mesa.cartasMagicas[cartaIndex];\n if (cartaMag.getTipoEfeitoMagico() == CartaMagica.TipoEfeitoMagico.CAMPO) {\n cartaMag.aplicarEfeito(this, playerMain, -1);\n playerMain.mesa.removeMagica(cartaIndex);\n } else {\n System.out.println(\"Essa carta Magica não é ativavel manualmente!\");\n }\n continue;\n }\n\n if (cartasQueAtacaram[cartaIndex] == false) {\n cartaMon = playerMain.mesa.cartasMonstros[cartaIndex];\n System.out.println(\"Digite 1 para usa-la para atacar e 0 para mudar seu modo defesa-ataque\");\n if (scanner.nextInt() == 1) {\n if (cartaMon.getModoCarta().isAtaqueBaixo() || cartaMon.getModoCarta().isAtaqueCima()) {\n _jogaEstado_atacaMesaInimiga(playerMain, playerInimigo, cartaIndex);\n cartasQueAtacaram[cartaIndex] = true;\n if (playerMain.perdeu() || playerInimigo.perdeu()) {\n break;\n }\n } else {\n System.out.println(\"A carta deve estar em modo de ataque para atacar!\");\n }\n } else {\n giraCarta(cartaMon);\n }\n } else {\n System.out.println(\"Carta já atacou! escolha outra ou finalize o turno.\");\n }\n\n }\n\n }", "public void faiBagnetto() {\n System.out.println(\"Scrivere 1 per Bagno lungo, al costo di 150 Tam\\nSeleziona 2 per Bagno corto, al costo di 70 Tam\\nSeleziona 3 per Bide', al costo di 40 Tam\");\n\n switch (creaturaIn.nextInt()) {\n case 1 -> {\n puntiVita += 50;\n puntiFelicita -= 30;\n soldiTam -= 150;\n }\n case 2 -> {\n puntiVita += 30;\n puntiFelicita -= 15;\n soldiTam -= 70;\n }\n case 3 -> {\n puntiVita += 10;\n puntiFelicita -= 5;\n soldiTam -= 40;\n }\n }\n checkStato();\n }", "private String insertarCartaHeal() {\n int[] valoresEnemigo = {\n// this.dañoEnemigo=valoresEnemigo[0];\n 0,\n// this.curaEnemigo=valoresEnemigo[1];\n 0,\n// this.cartasEnemigo=valoresEnemigo[2];\n 0,\n// this.descarteEnemigo=valoresEnemigo[3];\n 0,\n// this.recursosEnemigo=valoresEnemigo[4];\n 0,\n// this.moverMesaAManoEnemigo=valoresEnemigo[5];\n 0,\n// this.moverDescarteAManoEnemigo=valoresEnemigo[6];\n 0,\n// this.moverDeckAManoEnemigo=valoresEnemigo[7];\n 0,\n// this.moverMesaADeckEnemigo=valoresEnemigo[8];\n 0,\n// this.moverDescarteADeckEnemigo=valoresEnemigo[9];\n 0,\n// this.moverManoADeckEnemigo=valoresEnemigo[10];\n 0,\n// this.moverMesaADescarteEnemigo=valoresEnemigo[11];\n 0,\n// this.moverManoADescarteEnemigo=valoresEnemigo[12];\n 0,\n// this.moverDeckADescarteEnemigo=valoresEnemigo[13];\n 0,\n// this.moverDescarteAMesaEnemigo=valoresEnemigo[14];\n 0,\n// this.moverManoAMesaEnemigo=valoresEnemigo[15];\n 0,\n// this.moverDeckAMesaEnemigo=valoresEnemigo[16];\n 0\n };\n int[] valoresOwner = {\n// this.dañoOwner=valoresOwner[0];\n 0,\n// this.curaOwner=valoresOwner[1];\n 4,\n// this.cartasOwner=valoresOwner[2];\n 0,\n// this.descarteOwner=valoresOwner[3];\n 0,\n// this.recursosOwner=valoresOwner[4];\n 0,\n// this.moverMesaAManoOwner=valoresOwner[5];\n 0,\n// this.moverDescarteAManoOwner=valoresOwner[6];\n 0,\n// this.moverDeckAManoOwner=valoresOwner[7];\n 0,\n// this.moverMesaADeckOwner=valoresOwner[8];\n 0,\n// this.moverDescarteADeckOwner=valoresOwner[9];\n 0,\n// this.moverManoADeckOwner=valoresOwner[10];\n 0,\n// this.moverMesaADescarteOwner=valoresOwner[11];\n 0,\n// this.moverManoADescarteOwner=valoresOwner[12];\n 0,\n// this.moverDeckADescarteOwner=valoresOwner[13];\n 0,\n// this.moverDescarteAMesaOwner=valoresOwner[14];\n 0,\n// this.moverManoAMesaOwner=valoresOwner[15];\n 0,\n// this.moverDeckAMesaOwner=valoresOwner[16];\n 0\n };\n boolean[]valoresPlay={\n //this.OnMoveMesaADescarte=valoresPlay[0];\n false,\n //this.OnMoveMesaADeck=valoresPlay[1];\n false,\n //this.OnMoveMesaAMano=valoresPlay[2];\n false,\n //this.OnMoveDescarteAMesa=valoresPlay[3];\n false,\n //this.OnMoveDescarteADeck=valoresPlay[4];\n false,\n// this.OnMoveDescarteAMano=valoresPlay[5];\n false,\n// this.OnMoveDeckADescarte=valoresPlay[6];\n false,\n// this.OnMoveDeckAMesa=valoresPlay[7];\n false,\n// this.OnMoveDeckAMano=valoresPlay[8];\n false,\n// this.OnMoveManoADescarte=valoresPlay[9];\n false,\n// this.OnMoveManoAMesa=valoresPlay[10];\n true,\n// this.OnMoveManoADeck=valoresPlay[11];\n false,\n// this.OnStartTurnTable=valoresPlay[12];\n false,\n// this.OnStartTurnHand=valoresPlay[13];\n false,\n// this.OnStartTurnDiscard=valoresPlay[14];\n false,\n// this.OnStartTurnDeck=valoresPlay[15];\n false,\n// this.OnEndTurnTable=valoresPlay[16];\n false,\n// this.OnEndTurnHand=valoresPlay[17];\n false,\n// this.OnEndTurnDiscard=valoresPlay[18];\n false,\n// this.OnEndTurnDeck=valoresPlay[19];\n false,\n };\n ArrayList<Integer> datos = new ArrayList<Integer>();\n for (int i = 0; i < valoresEnemigo.length; i++) {\n datos.add(valoresEnemigo[i]);\n }\n for (int i = 0; i < valoresOwner.length; i++) {\n datos.add(valoresOwner[i]);\n }\n for (int i = 0; i < valoresPlay.length; i++) {\n if(valoresPlay[i]){\n datos.add(1);\n }else{\n datos.add(0);\n }\n }\n String insert=\"\";\n for(int i=0;i<datos.size();i++){\n if(i<datos.size()-1) {\n insert += datos.get(i) + \", \";\n }else{\n insert += datos.get(i) + \" )\";\n }\n }\n return insert;\n }", "private void criaBlocos() {\n\t\tif (fase == 1) {\n\t\t\tfor (int i = 0; i < blocoArray; i++) {\n\t\t\t\tint x = (i % 10) * 25 + 2;\n\t\t\t\t\n\t\t\t\tlinhaUm[i] = new Bloco(Color.GRAY);\n\t\t\t\tlinhaUm[i].setPosition(new Point(x, 27));\n\t\t\t\tlinhaDois[i] = new Bloco(Color.RED);\n\t\t\t\tlinhaDois[i].setPosition(new Point(x, 36));\n\t\t\t\tlinhaTres[i] = new Bloco(Color.BLUE);\n\t\t\t\tlinhaTres[i].setPosition(new Point(x, 45));\n\t\t\t\tlinhaQuatro[i] = new Bloco(Color.YELLOW);\n\t\t\t\tlinhaQuatro[i].setPosition(new Point(x, 54));\n\t\t\t\tlinhaCinco[i] = new Bloco(Color.MAGENTA);\n\t\t\t\tlinhaCinco[i].setPosition(new Point(x, 63));\n\t\t\t\tlinhaSeis[i] = new Bloco(Color.GREEN);\n\t\t\t\tlinhaSeis[i].setPosition(new Point(x, 72));\n\n\t\t\t}\n\t\t} else if (fase == 2) {\n\t\t\tint y = 8;\n\t\t\tfor (int i = 0; i < blocoArray; i++) {\n\t\t\t\ty += 9;\n\t\t\t\t\n\t\t\t\tlinhaUm[i] = new Bloco(Color.GRAY);\n\t\t\t\tlinhaUm[i].setPosition(new Point(2, y));\n\t\t\t\tlinhaDois[i] = new Bloco(Color.RED);\n\t\t\t\tlinhaDois[i].setPosition(new Point(46, y));\n\t\t\t\tlinhaTres[i] = new Bloco(Color.BLUE);\n\t\t\t\tlinhaTres[i].setPosition(new Point(92, y));\n\t\t\t\tlinhaQuatro[i] = new Bloco(Color.YELLOW);\n\t\t\t\tlinhaQuatro[i].setPosition(new Point(138, y));\n\t\t\t\tlinhaCinco[i] = new Bloco(Color.MAGENTA);\n\t\t\t\tlinhaCinco[i].setPosition(new Point(184, y));\n\t\t\t\tlinhaSeis[i] = new Bloco(Color.GREEN);\n\t\t\t\tlinhaSeis[i].setPosition(new Point(230, y));\n\t\t\t}\n\t\t}else{\n\t\t\tint contFalPon = 0;\n\t\t\tfor (int i = 0; i < blocoArray; i++) {\n\t\t\t\tint x = (i % 10) * 25 + 2;\n\t\t\t\t\n\t\t\t\tlinhaUm[i] = new Bloco(Color.RED);\n\t\t\t\tif(i >= 2 && i <= 7){\n\t\t\t\t\tlinhaUm[i].setPosition(new Point(x, 20));\n\t\t\t\t}else{linhaUm[i].naoDesenha(); contFalPon++;}\n\t\t\t\t\n\t\t\t\tlinhaDois[i] = new Bloco(Color.RED);\n\t\t\t\tif(i >= 2 && i <= 7){\n\t\t\t\t\tlinhaDois[i].setPosition(new Point(x, 29));\n\t\t\t\t}else{linhaDois[i].naoDesenha(); contFalPon++;}\n\t\t\t\t\n\t\t\t\tif(i == 3 || i == 6){\n\t\t\t\t\tlinhaTres[i] = new Bloco(Color.BLACK);\n\t\t\t\t}else{linhaTres[i] = new Bloco(Color.RED);}\n\t\t\t\tif(i >= 1 && i <= 8){\n\t\t\t\t\tlinhaTres[i].setPosition(new Point(x, 38));\n\t\t\t\t}else{linhaTres[i].naoDesenha(); contFalPon++;}\n\t\t\t\t\n\t\t\t\tif(i == 3 || i == 6){\n\t\t\t\t\tlinhaQuatro[i] = new Bloco(Color.BLACK);\n\t\t\t\t}else{linhaQuatro[i] = new Bloco(Color.RED);}\n\t\t\t\tif(i >= 1 && i <= 8){\n\t\t\t\t\tlinhaQuatro[i].setPosition(new Point(x, 47));\n\t\t\t\t}else{linhaQuatro[i].naoDesenha(); contFalPon++;}\n\t\t\t\t\n\t\t\t\tlinhaCinco[i] = new Bloco(Color.RED);\n\t\t\t\tlinhaCinco[i].setPosition(new Point(x, 56));\n\t\t\t\tlinhaSeis[i] = new Bloco(Color.RED);\n\t\t\t\tlinhaSeis[i].setPosition(new Point(x, 65));\n\n\t\t\t}\n\t\t\tmudaFase -= contFalPon * 100;\n\t\t}//fecha else para formar a fase 3\n\n\t}", "private void BScreate() {\n\n\t\tint sum=0;//全枝数のカウント\n\t\tfor(int i=0;i<banknode;i++) sum+=Bank.get(i).deg;\n\n\t\t//e,d,nの決定\n\t\tif(NW==\"BA\"){\n\t\tfor(int i=0;i<banknode;i++) {\n\t\t\tBank.get(i).totalassets=E*((double)Bank.get(i).deg/(double)sum);\n\t\t\tBank.get(i).n=Bank.get(i).totalassets*Bank.get(i).CAR;\n\t\t\tBank.get(i).d=Bank.get(i).totalassets-Bank.get(i).n;\n\t\t\tBank.get(i).buffer=Bank.get(i).totalassets;\n\t\t}\n\t\t}\n\n\t\tif(NW==\"CM\"){\n\t\t\tfor(int i=0;i<banknode;i++){\n\t\t\t\tBank.get(i).totalassets=E/banknode;\n\t\t\t\tBank.get(i).n=Bank.get(i).totalassets*asyCAR;\n\t\t\t\tBank.get(i).forcelev=megaCAR;\n\t\t\t\tBank.get(i).d=Bank.get(i).totalassets-Bank.get(i).n;\n\t\t\t\tBank.get(i).buffer=Bank.get(i).totalassets;\n\t\t\t}\n\n\t\t}\n\n\t}", "@Override\n\tpublic void embaralhar() {\n\t\tfor (int i = 0; i < nomesCartas.length; i++) {\n\t\t\tsuper.insereCarta(new Carta(nomesCartas[i], naipes[0], valoresCartas[i]));\n\t\t}\n\t\t\n\t\t// inserindo cartas para o naipe de ouro\n\t\tfor (int i = 0; i < nomesCartas.length; i++) {\n\t\t\tsuper.insereCarta(new Carta(nomesCartas[i], naipes[1], valoresCartas[i]));\n\t\t}\n\t\t\n\t\t// inserindo cartas para o naipe de espada\n\t\tfor (int i = 0; i < nomesCartas.length; i++) {\n\t\t\tsuper.insereCarta(new Carta(nomesCartas[i], naipes[2], valoresCartas[i]));\n\t\t}\n\t\t\n\t\t// inserindo cartas para o naipe de paus\n\t\tfor (int i = 0; i < nomesCartas.length; i++) {\n\t\t\tsuper.insereCarta(new Carta(nomesCartas[i], naipes[3], valoresCartas[i]));\n\t\t}\n\t\t\n\t\tCollections.shuffle(cartas);\n\t}", "private void somarQuantidade(Integer id_produto){\n\t for (ItensCompra it : itensCompra){\n\t\t //verifico se o item do meu arraylist é igual ao ID passado no Mapping\n\t\t if(it.getTable_Produtos().getId_produto().equals(id_produto)){\n\t //defino a quantidade atual(pego a quantidade atual e somo um)\n\t it.setQuantidade(it.getQuantidade() + 1);\n\t //a apartir daqui, faço o cálculo. Valor Total(ATUAL) + ((NOVA) quantidade * valor unitário do produto(ATUAL))\n\t it.setValorTotal(0.);\n\t it.setValorTotal(it.getValorTotal() + (it.getQuantidade() * it.getValorUnitario()));\n }\n}\n\t}", "public void CambiarCartasCastillo() {\r\n\r\n\t\tint aux;\r\n\t\t// Asignamos el escudo del rey;\r\n\t\taux = (int) (Math.random() * 12) + 1;\r\n\t\tescudoRey = new Escudo(aux, Escudo.GrupoEscudo.rey);\r\n\t\t// Asignamos el escudo de la nobleza\r\n\t\taux = (int) (Math.random() * 12) + 1;\r\n\t\tescudoNobleza = new Escudo(aux, Escudo.GrupoEscudo.nobleza);\r\n\t\t// Asignamos el escudo del pueblo\r\n\t\taux = (int) (Math.random() * 6) + 1;\r\n\t\tescudoPueblo = new Escudo(aux, Escudo.GrupoEscudo.pueblo);\r\n\r\n\t}", "public String toString() {\n return \" Carta [numero=\" + numero + \", seme=\" + seme + \" ,valore= \"+valore+\" , punti= \"+punti+\"] \";\n }", "private String insertarCarta() {\n int[] valoresEnemigo = {\n// this.dañoEnemigo=valoresEnemigo[0];\n 0,\n// this.curaEnemigo=valoresEnemigo[1];\n 0,\n// this.cartasEnemigo=valoresEnemigo[2];\n 0,\n// this.descarteEnemigo=valoresEnemigo[3];\n 0,\n// this.recursosEnemigo=valoresEnemigo[4];\n 0,\n// this.moverMesaAManoEnemigo=valoresEnemigo[5];\n 0,\n// this.moverDescarteAManoEnemigo=valoresEnemigo[6];\n 0,\n// this.moverDeckAManoEnemigo=valoresEnemigo[7];\n 0,\n// this.moverMesaADeckEnemigo=valoresEnemigo[8];\n 0,\n// this.moverDescarteADeckEnemigo=valoresEnemigo[9];\n 0,\n// this.moverManoADeckEnemigo=valoresEnemigo[10];\n 0,\n// this.moverMesaADescarteEnemigo=valoresEnemigo[11];\n 0,\n// this.moverManoADescarteEnemigo=valoresEnemigo[12];\n 0,\n// this.moverDeckADescarteEnemigo=valoresEnemigo[13];\n 0,\n// this.moverDescarteAMesaEnemigo=valoresEnemigo[14];\n 0,\n// this.moverManoAMesaEnemigo=valoresEnemigo[15];\n 0,\n// this.moverDeckAMesaEnemigo=valoresEnemigo[16];\n 0\n };\n int[] valoresOwner = {\n// this.dañoOwner=valoresOwner[0];\n 0,\n// this.curaOwner=valoresOwner[1];\n 0,\n// this.cartasOwner=valoresOwner[2];\n 0,\n// this.descarteOwner=valoresOwner[3];\n 0,\n// this.recursosOwner=valoresOwner[4];\n 0,\n// this.moverMesaAManoOwner=valoresOwner[5];\n 0,\n// this.moverDescarteAManoOwner=valoresOwner[6];\n 0,\n// this.moverDeckAManoOwner=valoresOwner[7];\n 0,\n// this.moverMesaADeckOwner=valoresOwner[8];\n 0,\n// this.moverDescarteADeckOwner=valoresOwner[9];\n 0,\n// this.moverManoADeckOwner=valoresOwner[10];\n 0,\n// this.moverMesaADescarteOwner=valoresOwner[11];\n 0,\n// this.moverManoADescarteOwner=valoresOwner[12];\n 0,\n// this.moverDeckADescarteOwner=valoresOwner[13];\n 0,\n// this.moverDescarteAMesaOwner=valoresOwner[14];\n 0,\n// this.moverManoAMesaOwner=valoresOwner[15];\n 0,\n// this.moverDeckAMesaOwner=valoresOwner[16];\n 0\n };\n boolean[]valoresPlay={\n //this.OnMoveMesaADescarte=valoresPlay[0];\n false,\n //this.OnMoveMesaADeck=valoresPlay[1];\n false,\n //this.OnMoveMesaAMano=valoresPlay[2];\n false,\n //this.OnMoveDescarteAMesa=valoresPlay[3];\n false,\n //this.OnMoveDescarteADeck=valoresPlay[4];\n false,\n// this.OnMoveDescarteAMano=valoresPlay[5];\n false,\n// this.OnMoveDeckADescarte=valoresPlay[6];\n false,\n// this.OnMoveDeckAMesa=valoresPlay[7];\n false,\n// this.OnMoveDeckAMano=valoresPlay[8];\n false,\n// this.OnMoveManoADescarte=valoresPlay[9];\n false,\n// this.OnMoveManoAMesa=valoresPlay[10];\n false,\n// this.OnMoveManoADeck=valoresPlay[11];\n false,\n// this.OnStartTurnTable=valoresPlay[12];\n false,\n// this.OnStartTurnHand=valoresPlay[13];\n false,\n// this.OnStartTurnDiscard=valoresPlay[14];\n false,\n// this.OnStartTurnDeck=valoresPlay[15];\n false,\n// this.OnEndTurnTable=valoresPlay[16];\n false,\n// this.OnEndTurnHand=valoresPlay[17];\n false,\n// this.OnEndTurnDiscard=valoresPlay[18];\n false,\n// this.OnEndTurnDeck=valoresPlay[19];\n false,\n };\n ArrayList<Integer> datos = new ArrayList<Integer>();\n for (int i = 0; i < valoresEnemigo.length; i++) {\n datos.add(valoresEnemigo[i]);\n }\n for (int i = 0; i < valoresOwner.length; i++) {\n datos.add(valoresOwner[i]);\n }\n for (int i = 0; i < valoresPlay.length; i++) {\n if(valoresPlay[i]){\n datos.add(1);\n }else{\n datos.add(0);\n }\n }\n String insert=\"\";\n for(int i=0;i<datos.size();i++){\n if(i<datos.size()-1) {\n insert += datos.get(i) + \", \";\n }else{\n insert += datos.get(i) + \" )\";\n }\n }\n return insert;\n }", "public ComponenteCosto getComponenteCosto()\r\n/* 68: */ {\r\n/* 69: 91 */ return this.componenteCosto;\r\n/* 70: */ }", "public void StampaPotenziali()\r\n {\r\n System.out.println(\"----\"+this.nome+\"----\\n\"); \r\n \r\n if(!Potenziale.isEmpty())\r\n {\r\n Set<Entry<Integer,ArrayList<Carta>>> Es = Potenziale.entrySet();\r\n \r\n for(Entry<Integer,ArrayList<Carta>> E : Es)\r\n {\r\n System.out.println(\" -OPZIONE \"+E.getKey()+\"\");\r\n\r\n for(Carta c : E.getValue())\r\n {\r\n System.out.println(\" [ \"+c.GetName()+\" ]\");\r\n }\r\n \r\n System.out.println(\"\\n\");\r\n }\r\n }\r\n else\r\n {\r\n System.out.println(\"-NESSUNA CARTA O COMBINAZIONE DI CARTE ASSOCIATA-\\n\");\r\n }\r\n }", "public static void Promedio(){\n int ISumaNotas=0;\n int IFila=0,ICol=0;\n int INota;\n float FltPromedio;\n for(IFila=0;IFila<10;IFila++)\n {\n ISumaNotas+=Integer.parseInt(StrNotas[IFila][1]);\n }\n FltPromedio=ISumaNotas/10;\n System.out.println(\"El promedio de la clase es:\"+FltPromedio);\n }", "@Test\r\n\tpublic void testAcquistareBigliettiE1() {\r\n\t\tCartaDiCredito carta = new CartaDiCredito(\"2334549359434\",23353.89);\r\n\t\tCliente c1 = new Cliente(\"3\",\"Logan\",\"Peck\",\"logan@hotmail.com\",\r\n\t\t\t\t\"M\",\"333152497\",\"Logan92\",\"loganlogan\",\"loganlogan\",\"il tuo nome\",carta);\r\n\t\tp1.acquistareBiglietti(3,\"carta\", c1);\r\n\t\t//verifico che ci siano 3 biglietti\r\n\t\tassertEquals(3,c1.getPrenotazioni().size());\r\n\t}", "public int fondMagasin(){\n\tint total =this.jeton;\n\tfor(Caisse c1 : this.lesCaisses){\n\ttotal = c1.getTotal()+total;\n\t}\n\treturn total;\n}", "public String asignarCECartaAdhesion() throws JDBCException, Exception{\n\t\tString ext = \"\", nombreArchivo=\"\";\n\t\ttry{\n\t\t\t//Recupera los datos de la solicitud de inscripcion\n\t\t\tList<SolicitudInscripcion> lstSI = iDAO.consultaSolicitudInscripcion(0, \"\", idSI);\n\t\t\tSolicitudInscripcion solIns = lstSI.get(0);\n\t\t\tfolioCartaAdhesion = solIns.getFolioCartaAdhesion();\n\t\t\t//Recupera ruta documentos de programa\n\t\t\tprograma = cDAO.consultaPrograma(solIns.getIdPrograma()).get(0);\n\t\t\tidCriterioPago = programa.getCriterioPago();\n\t\t\tString rutaSolicitud = programa.getRutaDocumentos()+\"solicitudes/\"+solIns.getIdSI()+\"/\";\n\t\t\t//Guarda el archivo de la carta de adhesion\n\t\t\tif(docCartaAFileName !=null && docCartaAFileName !=\"\"){\n\t\t\t\text = docCartaAFileName.toLowerCase().substring(docCartaAFileName.lastIndexOf(\".\") );\n\t\t\t\tnombreArchivo = \"CA\"+new java.text.SimpleDateFormat(\"yyyyMMddHHmm\").format(new Date() )+ext;\n\t\t\t\tsolIns.setNomArchivoCA(nombreArchivo);\n\t\t\t\tUtilerias.cargarArchivo(rutaSolicitud, nombreArchivo, docCartaA);\n\t\t\t\tsolIns.setFechaFirmaCa(fechaFirmaCA);\n\t\t\t}\t\t\t\n\t\t\t\n\t\t\t//Guarda el archivo de legibilidad\n\t\t\tif(docOLFileName!=null && docOLFileName != \"\"){\n\t\t\t\text = docOLFileName.toLowerCase().substring(docOLFileName.lastIndexOf(\".\") );\n\t\t\t\tnombreArchivo = \"OL\"+new java.text.SimpleDateFormat(\"yyyyMMddHHmm\").format(new Date() )+ext;\n\t\t\t\tsolIns.setNomArchivoLeg(nombreArchivo);\n\t\t\t\tsolIns.setFechaDocLeg(fechaDocLeg);\n\t\t\t\tsolIns.setFechaAcuseLeg(fechaAcuseLeg);\n\t\t\t\tsolIns.setNoOficioLeg(noOficioLeg);\n\t\t\t\tsolIns.setEstatus(4);\n\t\t\t\tUtilerias.cargarArchivo(rutaSolicitud, nombreArchivo, docOL);\n\t\t\t}\n\t\t\t\n\t\t\tif(registrar == 0){\n\t\t\t\t//Guardar la carta de adhesion en la tabla correspondiente\n\t\t\t\tCartaAdhesion ca = new CartaAdhesion();\n\t\t\t\tca.setFolioCartaAdhesion(solIns.getFolioCartaAdhesion());\n\t\t\t\tca.setIdSI(idSI.intValue());\n\t\t\t\tca.setIdPrograma(solIns.getIdPrograma());\n\t\t\t\tca.setIdComprador(solIns.getIdComprador());\n\t\t\t\tca.setEstatus(1);\t\n\t\t\t\t//Guardar carta adhesion\n\t\t\t\tcDAO.guardaObjeto(ca);\n\t\t\t\t//Guarda Asignacion cuotas carta adhesion\n\t\t\t\tfor(int i=0; i< capEstado.length; i++){\n\t\t\t\t\tAsignacionCartasAdhesion aca = new AsignacionCartasAdhesion();\n\t\t\t\t\taca.setIdCultivo(capCultivo[i]);\n\t\t\t\t\taca.setIdVariedad(capVariedad[i]);\n\t\t\t\t\taca.setIdEstado(capEstado[i]);\n\t\t\t\t\taca.setFolioCartaAdhesion(folioCartaAdhesion);\n\t\t\t\t\tDetalleAsignacionCartasAdhesion daca = new DetalleAsignacionCartasAdhesion();\n\t\t\t\t\tdaca.setIdCultivo(capCultivo[i]);\n\t\t\t\t\tdaca.setIdVariedad(capVariedad[i]);\n\t\t\t\t\tdaca.setIdEstado(capEstado[i]);\t\t\t\t\t\n\t\t\t\t\tdaca.setFolioCartaAdhesion(folioCartaAdhesion);\n\t\t\t\t\tif(idCriterioPago == 1 || idCriterioPago == 3){\n\t\t\t\t\t\taca.setVolumen(capVolumen[i]);\t\t\t\t\t\t\t\t\n\t\t\t\t\t\tdaca.setVolumen(capVolumen[i]);\t\t\t\t\t\t\t\t\n\t\t\t\t\t}else if(idCriterioPago == 2){\n\t\t\t\t\t\taca.setImporte(capImporte[i]);\t\t\t\t\t\n\t\t\t\t\t\tdaca.setImporte(capImporte[i]);\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\tdaca.setTipo(1);//Normal\n\t\t\t\t\tcDAO.guardaObjeto(aca);\n\t\t\t\t\tcDAO.guardaObjeto(daca);\t\t\t\t\t\n\t\t\t\t}\t\t\t\n\t\t\t\t//Guardar la carta adhesion en tabla de programa_comprador\n\t\t\t\tProgramaComprador pc = new ProgramaComprador();\n\t\t\t\tpc.setIdPrograma(solIns.getIdPrograma());\n\t\t\t\tpc.setIdComprador(solIns.getIdComprador());\n\t\t\t\tpc.setNoCarta(solIns.getFolioCartaAdhesion());\n\t\t\t\tcDAO.guardaObjeto(pc);\t\t\n\t\t\t}\n\t\t\tSystem.out.println(\"complementoPorampliacionChk \"+complementoPorampliacionChk);\n\t\t\t//Guarda Complemento de la CARTA ADHESION\n\t\t\tif(complementoPorampliacionChk){\n\t\t\t\t//GUARDA LOS DATOS DE FECHA Y ARCHIVO DEL COMPLEMENTO DE LA CARTA ADHESION\n\t\t\t\tsolIns.setFechaFirmaCAComplemento(fechaFirmaCAComplemento);\n\t\t\t\t//Carga archivo del complemento de la carta de adhesion\n\t\t\t\text = docAmpliacionCAFileName.toLowerCase().substring(docAmpliacionCAFileName.lastIndexOf(\".\") );\n\t\t\t\tnombreArchivo = \"CCA\"+new java.text.SimpleDateFormat(\"yyyyMMddHHmm\").format(new Date() )+ext;\n\t\t\t\tsolIns.setNomArchivoCACom(nombreArchivo);\n\t\t\t\tUtilerias.cargarArchivo(rutaSolicitud, nombreArchivo, docAmpliacionCA);\n\t\t\t\tfor(int i=0; i< capEstado.length; i++){\n\t\t\t\t\t//Recupera el registro de la asignacion de la carta de adhesion\n\t\t\t\t\tList<AsignacionCartasAdhesion> lstAca = iDAO.consultaAsignacionCartasAdhesion(capEstado[i], capCultivo[i], capVariedad[i], folioCartaAdhesion);\n\t\t\t\t\t//Verifica si el incremento es un mismo EDO, CULTIVO y VARIEDAD\n\t\t\t\t\tif(lstAca.size()>0){\n\t\t\t\t\t\tAsignacionCartasAdhesion aca = lstAca.get(0);\n\t\t\t\t\t\tif(idCriterioPago == 1 || idCriterioPago == 3){\n\t\t\t\t\t\t\taca.setVolumen(capVolumen[i]+aca.getVolumen());\n\t\t\t\t\t\t}else if(idCriterioPago==2){\n\t\t\t\t\t\t\taca.setImporte(capImporte[i]+aca.getImporte());\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//Actualiza volumen o importe del registro\n\t\t\t\t\t\tcDAO.guardaObjeto(aca);\n\t\t\t\t\t}else{\n\t\t\t\t\t\t//Insertar registro en AsignacionCartasAdhesion\n\t\t\t\t\t\tAsignacionCartasAdhesion aca = new AsignacionCartasAdhesion();\n\t\t\t\t\t\taca.setFolioCartaAdhesion(folioCartaAdhesion);\n\t\t\t\t\t\taca.setIdEstado(capEstado[i]);\n\t\t\t\t\t\taca.setIdCultivo(capCultivo[i]);\n\t\t\t\t\t\taca.setIdVariedad(capVariedad[i]);\n\t\t\t\t\t\tif(idCriterioPago == 1 || idCriterioPago == 3){\n\t\t\t\t\t\t\taca.setVolumen(capVolumen[i]);\n\t\t\t\t\t\t}else if(idCriterioPago==2){\t\t\t\t\t\t\n\t\t\t\t\t\t\taca.setImporte(capImporte[i]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcDAO.guardaObjeto(aca);\n\t\t\t\t\t}\n\t\t\t\t\tDetalleAsignacionCartasAdhesion daca = new DetalleAsignacionCartasAdhesion();\n\t\t\t\t\tdaca.setFolioCartaAdhesion(folioCartaAdhesion);\n\t\t\t\t\tdaca.setIdEstado(capEstado[i]);\n\t\t\t\t\tdaca.setIdCultivo(capCultivo[i]);\n\t\t\t\t\tdaca.setIdVariedad(capVariedad[i]);\n\t\t\t\t\tdaca.setTipo(2); //Complemento\n\t\t\t\t\tif(idCriterioPago == 1 || idCriterioPago == 3){\n\t\t\t\t\t\tdaca.setVolumen(capVolumen[i]);\n\t\t\t\t\t}else if(idCriterioPago==2){\t\t\t\t\t\t\n\t\t\t\t\t\tdaca.setImporte(capImporte[i]);\n\t\t\t\t\t}\n\t\t\t\t\t//Inserta nuevo registro en la tabla de DetalleAsignacionCartasAdhesion\n\t\t\t\t\tcDAO.guardaObjeto(daca);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(registrar==3 || complementoPorampliacionChk){\n\t\t\t\tcDAO.guardaObjeto(solIns);\n\t\t\t\tcomplementoPorampliacionChk = false;\n\t\t\t}else{\n\t\t\t\tregistrar = 2; //para solo consulta en el jsp\n\t\t\t}\t\t\n\t\t\trecuperaCuotasInicEsquema();\t\n\t\t\tmsjOk = \"Se guardó satisfactoriamente el registro\";\n\t\t\t\n\t\t}catch(JDBCException e){\n\t\t\te.printStackTrace();\n\t\t\tregistrar=1;\n\t\t\trecuperaCuotasInicEsquema();\t\n\t\t\tAppLogger.error(\"errores\",\"Ocurrio un error al guardar la asignacion de carta de adhesion debido a:\"+e.getCause());\n\t\t\taddActionError(\"Ocurrio un error inesperado, favor de reportar al administrador\");\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t\tregistrar=1;\n\t\t\trecuperaCuotasInicEsquema();\t\n\t\t\tAppLogger.error(\"errores\",\"Ocurrio un error al guardar la asignacion de carta de adhesion debido a:\"+e.getCause());\n\t\t\taddActionError(\"Ocurrio un error inesperado, favor de reportar al administrador\");\n\t\t}\n\t\t\n\t\treturn SUCCESS;\n\t}", "private void inizia() throws Exception {\n this.setAllineamento(Layout.ALLINEA_CENTRO);\n this.creaBordo(\"Coperti serviti\");\n\n campoPranzo=CampoFactory.intero(\"a pranzo\");\n campoPranzo.setLarghezza(60);\n campoPranzo.setModificabile(false);\n campoCena=CampoFactory.intero(\"a cena\");\n campoCena.setLarghezza(60);\n campoCena.setModificabile(false);\n campoTotale=CampoFactory.intero(\"Totale\");\n campoTotale.setLarghezza(60); \n campoTotale.setModificabile(false);\n\n this.add(campoPranzo);\n this.add(campoCena);\n this.add(campoTotale);\n }", "public Coup coupIA() {\n\n int propriete = TypeCoup.CONT.getValue();\n int bloque = Bloque.NONBLOQUE.getValue();\n Term A = intArrayToList(plateau1);\n Term B = intArrayToList(plateau2);\n Term C = intArrayToList(piecesDispos);\n Variable D = new Variable(\"D\");\n Variable E = new Variable(\"E\");\n Variable F = new Variable(\"F\");\n Variable G = new Variable(\"G\");\n Variable H = new Variable(\"H\");\n org.jpl7.Integer I = new org.jpl7.Integer(co.getValue());\n q1 = new Query(\"choixCoupEtJoue\", new Term[] {A, B, C, D, E, F, G, H, I});\n\n\n if (q1.hasSolution()) {\n Map<String, Term> solution = q1.oneSolution();\n int caseJ = solution.get(\"D\").intValue();\n int pion = solution.get(\"E\").intValue();\n Term[] plateau1 = listToTermArray(solution.get(\"F\"));\n Term[] plateau2 = listToTermArray(solution.get(\"G\"));\n Term[] piecesDispos = listToTermArray(solution.get(\"H\"));\n for (int i = 0; i < 16; i++) {\n if (i < 8) {\n this.piecesDispos[i] = piecesDispos[i].intValue();\n }\n this.plateau1[i] = plateau1[i].intValue();\n this.plateau2[i] = plateau2[i].intValue();\n }\n\n int ligne = caseJ / 4;\n int colonne = caseJ % 4;\n\n if (pion == 1 || pion == 5) {\n pion = 1;\n }\n if (pion == 2 || pion == 6) {\n pion = 0;\n }\n if (pion == 3 || pion == 7) {\n pion = 2;\n }\n if (pion == 4 || pion == 8) {\n pion = 3;\n }\n\n\n Term J = intArrayToList(this.plateau1);\n q1 = new Query(\"gagne\", new Term[] {J});\n System.out.println(q1.hasSolution() ? \"Gagné\" : \"\");\n if (q1.hasSolution()) {\n propriete = 1;\n }\n return new Coup(bloque,ligne, colonne, pion, propriete);\n }\n System.out.println(\"Bloqué\");\n return new Coup(1,0, 0, 0, 3);\n }", "private String insertarCartaMysticalSign() {\n int[] valoresEnemigo = {\n// this.dañoEnemigo=valoresEnemigo[0];\n 0,\n// this.curaEnemigo=valoresEnemigo[1];\n 0,\n// this.cartasEnemigo=valoresEnemigo[2];\n 0,\n// this.descarteEnemigo=valoresEnemigo[3];\n 0,\n// this.recursosEnemigo=valoresEnemigo[4];\n 0,\n// this.moverMesaAManoEnemigo=valoresEnemigo[5];\n 0,\n// this.moverDescarteAManoEnemigo=valoresEnemigo[6];\n 0,\n// this.moverDeckAManoEnemigo=valoresEnemigo[7];\n 0,\n// this.moverMesaADeckEnemigo=valoresEnemigo[8];\n 0,\n// this.moverDescarteADeckEnemigo=valoresEnemigo[9];\n 0,\n// this.moverManoADeckEnemigo=valoresEnemigo[10];\n 0,\n// this.moverMesaADescarteEnemigo=valoresEnemigo[11];\n 0,\n// this.moverManoADescarteEnemigo=valoresEnemigo[12];\n 0,\n// this.moverDeckADescarteEnemigo=valoresEnemigo[13];\n 0,\n// this.moverDescarteAMesaEnemigo=valoresEnemigo[14];\n 0,\n// this.moverManoAMesaEnemigo=valoresEnemigo[15];\n 0,\n// this.moverDeckAMesaEnemigo=valoresEnemigo[16];\n 0\n };\n int[] valoresOwner = {\n// this.dañoOwner=valoresOwner[0];\n 0,\n// this.curaOwner=valoresOwner[1];\n 0,\n// this.cartasOwner=valoresOwner[2];\n 1,\n// this.descarteOwner=valoresOwner[3];\n 0,\n// this.recursosOwner=valoresOwner[4];\n 0,\n// this.moverMesaAManoOwner=valoresOwner[5];\n 0,\n// this.moverDescarteAManoOwner=valoresOwner[6];\n 0,\n// this.moverDeckAManoOwner=valoresOwner[7];\n 0,\n// this.moverMesaADeckOwner=valoresOwner[8];\n 0,\n// this.moverDescarteADeckOwner=valoresOwner[9];\n 0,\n// this.moverManoADeckOwner=valoresOwner[10];\n 0,\n// this.moverMesaADescarteOwner=valoresOwner[11];\n 0,\n// this.moverManoADescarteOwner=valoresOwner[12];\n 0,\n// this.moverDeckADescarteOwner=valoresOwner[13];\n 0,\n// this.moverDescarteAMesaOwner=valoresOwner[14];\n 0,\n// this.moverManoAMesaOwner=valoresOwner[15];\n 0,\n// this.moverDeckAMesaOwner=valoresOwner[16];\n 0\n };\n boolean[]valoresPlay={\n //this.OnMoveMesaADescarte=valoresPlay[0];\n false,\n //this.OnMoveMesaADeck=valoresPlay[1];\n false,\n //this.OnMoveMesaAMano=valoresPlay[2];\n false,\n //this.OnMoveDescarteAMesa=valoresPlay[3];\n false,\n //this.OnMoveDescarteADeck=valoresPlay[4];\n false,\n// this.OnMoveDescarteAMano=valoresPlay[5];\n false,\n// this.OnMoveDeckADescarte=valoresPlay[6];\n false,\n// this.OnMoveDeckAMesa=valoresPlay[7];\n false,\n// this.OnMoveDeckAMano=valoresPlay[8];\n false,\n// this.OnMoveManoADescarte=valoresPlay[9];\n false,\n// this.OnMoveManoAMesa=valoresPlay[10];\n false,\n// this.OnMoveManoADeck=valoresPlay[11];\n false,\n// this.OnStartTurnTable=valoresPlay[12];\n true,\n// this.OnStartTurnHand=valoresPlay[13];\n false,\n// this.OnStartTurnDiscard=valoresPlay[14];\n false,\n// this.OnStartTurnDeck=valoresPlay[15];\n false,\n// this.OnEndTurnTable=valoresPlay[16];\n false,\n// this.OnEndTurnHand=valoresPlay[17];\n false,\n// this.OnEndTurnDiscard=valoresPlay[18];\n false,\n// this.OnEndTurnDeck=valoresPlay[19];\n false,\n };\n ArrayList<Integer> datos = new ArrayList<Integer>();\n String nombre = \"\";\n for (int i = 0; i < valoresEnemigo.length; i++) {\n datos.add(valoresEnemigo[i]);\n }\n for (int i = 0; i < valoresOwner.length; i++) {\n datos.add(valoresOwner[i]);\n }\n for (int i = 0; i < valoresPlay.length; i++) {\n if(valoresPlay[i]){\n datos.add(1);\n }else{\n datos.add(0);\n }\n }\n String insert=\"\";\n for(int i=0;i<datos.size();i++){\n if(i<datos.size()-1) {\n insert += datos.get(i) + \", \";\n }else{\n insert += datos.get(i) + \" )\";\n }\n }\n return insert;\n }", "private String insertarCartaRitual() {\n int[] valoresEnemigo = {\n// this.dañoEnemigo=valoresEnemigo[0];\n 1,\n// this.curaEnemigo=valoresEnemigo[1];\n 0,\n// this.cartasEnemigo=valoresEnemigo[2];\n 0,\n// this.descarteEnemigo=valoresEnemigo[3];\n 0,\n// this.recursosEnemigo=valoresEnemigo[4];\n 0,\n// this.moverMesaAManoEnemigo=valoresEnemigo[5];\n 0,\n// this.moverDescarteAManoEnemigo=valoresEnemigo[6];\n 0,\n// this.moverDeckAManoEnemigo=valoresEnemigo[7];\n 0,\n// this.moverMesaADeckEnemigo=valoresEnemigo[8];\n 0,\n// this.moverDescarteADeckEnemigo=valoresEnemigo[9];\n 0,\n// this.moverManoADeckEnemigo=valoresEnemigo[10];\n 0,\n// this.moverMesaADescarteEnemigo=valoresEnemigo[11];\n 0,\n// this.moverManoADescarteEnemigo=valoresEnemigo[12];\n 0,\n// this.moverDeckADescarteEnemigo=valoresEnemigo[13];\n 0,\n// this.moverDescarteAMesaEnemigo=valoresEnemigo[14];\n 0,\n// this.moverManoAMesaEnemigo=valoresEnemigo[15];\n 0,\n// this.moverDeckAMesaEnemigo=valoresEnemigo[16];\n 0\n };\n int[] valoresOwner = {\n// this.dañoOwner=valoresOwner[0];\n 0,\n// this.curaOwner=valoresOwner[1];\n 0,\n// this.cartasOwner=valoresOwner[2];\n 1,\n// this.descarteOwner=valoresOwner[3];\n 0,\n// this.recursosOwner=valoresOwner[4];\n 0,\n// this.moverMesaAManoOwner=valoresOwner[5];\n 0,\n// this.moverDescarteAManoOwner=valoresOwner[6];\n 0,\n// this.moverDeckAManoOwner=valoresOwner[7];\n 0,\n// this.moverMesaADeckOwner=valoresOwner[8];\n 0,\n// this.moverDescarteADeckOwner=valoresOwner[9];\n 0,\n// this.moverManoADeckOwner=valoresOwner[10];\n 0,\n// this.moverMesaADescarteOwner=valoresOwner[11];\n 0,\n// this.moverManoADescarteOwner=valoresOwner[12];\n 0,\n// this.moverDeckADescarteOwner=valoresOwner[13];\n 0,\n// this.moverDescarteAMesaOwner=valoresOwner[14];\n 0,\n// this.moverManoAMesaOwner=valoresOwner[15];\n 0,\n// this.moverDeckAMesaOwner=valoresOwner[16];\n 0\n };\n boolean[]valoresPlay={\n //this.OnMoveMesaADescarte=valoresPlay[0];\n false,\n //this.OnMoveMesaADeck=valoresPlay[1];\n false,\n //this.OnMoveMesaAMano=valoresPlay[2];\n false,\n //this.OnMoveDescarteAMesa=valoresPlay[3];\n false,\n //this.OnMoveDescarteADeck=valoresPlay[4];\n false,\n// this.OnMoveDescarteAMano=valoresPlay[5];\n false,\n// this.OnMoveDeckADescarte=valoresPlay[6];\n false,\n// this.OnMoveDeckAMesa=valoresPlay[7];\n false,\n// this.OnMoveDeckAMano=valoresPlay[8];\n false,\n// this.OnMoveManoADescarte=valoresPlay[9];\n false,\n// this.OnMoveManoAMesa=valoresPlay[10];\n true,\n// this.OnMoveManoADeck=valoresPlay[11];\n false,\n// this.OnStartTurnTable=valoresPlay[12];\n false,\n// this.OnStartTurnHand=valoresPlay[13];\n false,\n// this.OnStartTurnDiscard=valoresPlay[14];\n false,\n// this.OnStartTurnDeck=valoresPlay[15];\n false,\n// this.OnEndTurnTable=valoresPlay[16];\n false,\n// this.OnEndTurnHand=valoresPlay[17];\n false,\n// this.OnEndTurnDiscard=valoresPlay[18];\n false,\n// this.OnEndTurnDeck=valoresPlay[19];\n false,\n };\n ArrayList<Integer> datos = new ArrayList<Integer>();\n String nombre = \"\";\n for (int i = 0; i < valoresEnemigo.length; i++) {\n datos.add(valoresEnemigo[i]);\n }\n for (int i = 0; i < valoresOwner.length; i++) {\n datos.add(valoresOwner[i]);\n }\n for (int i = 0; i < valoresPlay.length; i++) {\n if(valoresPlay[i]){\n datos.add(1);\n }else{\n datos.add(0);\n }\n }\n String insert=\"\";\n for(int i=0;i<datos.size();i++){\n if(i<datos.size()-1) {\n insert += datos.get(i) + \", \";\n }else{\n insert += datos.get(i) + \" )\";\n }\n }\n return insert;\n }", "public void enemigosCatacumba(){\n esq81 = new Esqueleto(1, 8, 400, 160, 30);\n esq82 = new Esqueleto(2, 8, 400, 160, 30);\n esq111 = new Esqueleto(1, 11, 800, 255, 50);\n esq112 = new Esqueleto(2, 11, 800, 255, 50);\n esq141 = new Esqueleto(1, 14, 1000, 265, 60);\n esq142 = new Esqueleto(2, 14, 1000, 265, 60);\n //\n zom81 = new Zombie(1, 8, 1000, 170, 40);\n zom82 = new Zombie(2, 8, 1000, 170, 40);\n zom111 = new Zombie(1, 11, 1300, 250, 50);\n zom112 = new Zombie(2, 11, 1300, 250, 50);\n zom141 = new Zombie(1, 14, 1700, 260, 60);\n zom142 = new Zombie(2, 14, 1700, 260, 60);\n //\n fana81 = new Fanatico(1, 8, 400, 190, 40);\n fana82 = new Fanatico(2, 8, 400, 190, 40);\n fana111 = new Fanatico(1, 11, 700, 250, 50);\n fana112 = new Fanatico(2, 11, 700, 250, 50);\n fana141 = new Fanatico(1, 14, 900, 260, 60);\n fana142 = new Fanatico(2, 14, 900, 260, 60);\n //\n mi81 = new Mimico(1, 8, 3, 1, 3000);\n mi111 = new Mimico(1, 11, 4, 1, 3000);\n mi141 = new Mimico(1, 14, 5, 1, 3200);\n }", "private String insertarCartaNaturalSign() {\n int[] valoresEnemigo = {\n// this.dañoEnemigo=valoresEnemigo[0];\n 0,\n// this.curaEnemigo=valoresEnemigo[1];\n 0,\n// this.cartasEnemigo=valoresEnemigo[2];\n 0,\n// this.descarteEnemigo=valoresEnemigo[3];\n 0,\n// this.recursosEnemigo=valoresEnemigo[4];\n 0,\n// this.moverMesaAManoEnemigo=valoresEnemigo[5];\n 0,\n// this.moverDescarteAManoEnemigo=valoresEnemigo[6];\n 0,\n// this.moverDeckAManoEnemigo=valoresEnemigo[7];\n 0,\n// this.moverMesaADeckEnemigo=valoresEnemigo[8];\n 0,\n// this.moverDescarteADeckEnemigo=valoresEnemigo[9];\n 0,\n// this.moverManoADeckEnemigo=valoresEnemigo[10];\n 0,\n// this.moverMesaADescarteEnemigo=valoresEnemigo[11];\n 0,\n// this.moverManoADescarteEnemigo=valoresEnemigo[12];\n 0,\n// this.moverDeckADescarteEnemigo=valoresEnemigo[13];\n 0,\n// this.moverDescarteAMesaEnemigo=valoresEnemigo[14];\n 0,\n// this.moverManoAMesaEnemigo=valoresEnemigo[15];\n 0,\n// this.moverDeckAMesaEnemigo=valoresEnemigo[16];\n 0\n };\n int[] valoresOwner = {\n// this.dañoOwner=valoresOwner[0];\n 0,\n// this.curaOwner=valoresOwner[1];\n 0,\n// this.cartasOwner=valoresOwner[2];\n 0,\n// this.descarteOwner=valoresOwner[3];\n 0,\n// this.recursosOwner=valoresOwner[4];\n 2,\n// this.moverMesaAManoOwner=valoresOwner[5];\n 0,\n// this.moverDescarteAManoOwner=valoresOwner[6];\n 0,\n// this.moverDeckAManoOwner=valoresOwner[7];\n 0,\n// this.moverMesaADeckOwner=valoresOwner[8];\n 0,\n// this.moverDescarteADeckOwner=valoresOwner[9];\n 0,\n// this.moverManoADeckOwner=valoresOwner[10];\n 0,\n// this.moverMesaADescarteOwner=valoresOwner[11];\n 0,\n// this.moverManoADescarteOwner=valoresOwner[12];\n 0,\n// this.moverDeckADescarteOwner=valoresOwner[13];\n 0,\n// this.moverDescarteAMesaOwner=valoresOwner[14];\n 0,\n// this.moverManoAMesaOwner=valoresOwner[15];\n 0,\n// this.moverDeckAMesaOwner=valoresOwner[16];\n 0\n };\n boolean[]valoresPlay={\n //this.OnMoveMesaADescarte=valoresPlay[0];\n false,\n //this.OnMoveMesaADeck=valoresPlay[1];\n false,\n //this.OnMoveMesaAMano=valoresPlay[2];\n false,\n //this.OnMoveDescarteAMesa=valoresPlay[3];\n false,\n //this.OnMoveDescarteADeck=valoresPlay[4];\n false,\n// this.OnMoveDescarteAMano=valoresPlay[5];\n false,\n// this.OnMoveDeckADescarte=valoresPlay[6];\n false,\n// this.OnMoveDeckAMesa=valoresPlay[7];\n false,\n// this.OnMoveDeckAMano=valoresPlay[8];\n false,\n// this.OnMoveManoADescarte=valoresPlay[9];\n false,\n// this.OnMoveManoAMesa=valoresPlay[10];\n false,\n// this.OnMoveManoADeck=valoresPlay[11];\n false,\n// this.OnStartTurnTable=valoresPlay[12];\n false,\n// this.OnStartTurnHand=valoresPlay[13];\n true,\n// this.OnStartTurnDiscard=valoresPlay[14];\n false,\n// this.OnStartTurnDeck=valoresPlay[15];\n false,\n// this.OnEndTurnTable=valoresPlay[16];\n false,\n// this.OnEndTurnHand=valoresPlay[17];\n false,\n// this.OnEndTurnDiscard=valoresPlay[18];\n false,\n// this.OnEndTurnDeck=valoresPlay[19];\n false,\n };\n ArrayList<Integer> datos = new ArrayList<Integer>();\n String nombre = \"\";\n for (int i = 0; i < valoresEnemigo.length; i++) {\n datos.add(valoresEnemigo[i]);\n }\n for (int i = 0; i < valoresOwner.length; i++) {\n datos.add(valoresOwner[i]);\n }\n for (int i = 0; i < valoresPlay.length; i++) {\n if(valoresPlay[i]){\n datos.add(1);\n }else{\n datos.add(0);\n }\n }\n String insert=\"\";\n for(int i=0;i<datos.size();i++){\n if(i<datos.size()-1) {\n insert += datos.get(i) + \", \";\n }else{\n insert += datos.get(i) + \" )\";\n }\n }\n return insert;\n }", "public static void main(String[] args) {\n\t\tPessoa PF1 = new PessoaFisica(1,\"Michel\",\"31/03/1988\",\"15785465-01\",\"145.217.365-54\");\n\t\tPF1.AdicionaContato(\"898\",\"222\");\n\t\tPF1.AdicionaEndereco(\"avenida das gar�as\", 1110, \"padre cicero\", \"petrolina\", \"PE\", \"56326000\");\n\t\t\n\t\t// criando cliente pessoa Juridica\n\t\tPessoa PJ1 = new PessoaJuridica(2,\"Tectronic\",\"TECLTDA\",\"10-1009290/0001\");\n\t\tPJ1.AdicionaContato(\"00000\",\"11111\");\n\t\tPJ1.AdicionaEndereco(\"avenida do bambu\", 878, \"jo�oo pio 10\", \"juazeiro\", \"BA\", \"56326000\");\n\t\t\n\t\t// criando objetos produtoodutos\n\t\t/*Produto produto1 = new Produto(10, \"impressora\",35,1,100);\n\t\tProduto produto2 = new Produto(11, \"MicroSystem\",550, 2,80);\n\t\tProduto produto3 = new Produto(12, \"Faqueiro Ipanema\",75, 3,70);\n\t\tProduto produto4 = new Produto(13, \"Mangueira de Jardim\",19, 4,80);\n\t\tProduto produto5 = new Produto(14, \"Mouse multilaser\",25,5,90);*/\n \n Facade fachada = new Facade();\n fachada.incializarProdutos();\n \n\n\t\t// algumas forma de pagamento\n\t\t/*FormaPagamento Pagamento1 = new CartaoCredito(1,\"visa\",\"credito\", 3, \"Mariano Ribeiro\", \"10/10/23\", \"54212345212\",\"132\");\n\t\tFormaPagamento Pagamento2 = new CartaoCredito(2,\"mastercard\",\"debito\", 1, \"Juliana Marinalva\", \"12/09/29\", \"232356789\",\"787\");\n\t\tFormaPagamento Pagamento3 = new Boleto(3,\"19/04/2017\",\"12345678912\",\"Sanatander\");\n\t\tFormaPagamento Pagamento4 = new Boleto(4,\"20/04/2017\",\"12232344423\",\"Banco do Brasil\");\t\t*/\n \n \n\t\t//------------------------------------------------------------------------------------------------------------------------\n\t\t// criando um pedido com cliente e numero de itemens\n\t\tPedido pedido1 = new Pedido(30,PF1,3);\n\t\t\t\t\n\t\t// adicionando produtos como itens da lista de pedido\n\t\t/*ItemPedido item1 = new ItemPedido(20,produto1,3);\n\t\tItemPedido item2 = new ItemPedido(21,produto2,9);\n\t\tItemPedido item3 = new ItemPedido(22,produto3,2);\n\t\tItemPedido item4 = new ItemPedido(23,produto4,4);\n\t\tItemPedido item5 = new ItemPedido(24,produto5,1);*/\n\t\t\n\t\t// adicionando itens a lista de pedido\n\t\t/*pedido1.AdicionandoItemLista(item1,0);\n\t\tpedido1.AdicionandoItemLista(item3,1);\n\t\tpedido1.AdicionandoItemLista(item5,2);*/\n\t\t\t\t\n\t\t//forma de pagamento para o pedido 1\n\t\t//pedido1.setPagamento(Pagamento3);\n\n\t\t// Mostrar dados\n\t\tpedido1.mostrarPedido();\n\t\tSystem.out.println(\"Valor total com desconto: \" + Pedido.desconto(pedido1.getValorTotal(),(float)0.1));\n\t\tpedido1.getPagamento().realizaPagamento(true, \"16/04/17\");\n\t\t\n\t\t\n\t\t\n\t}", "public void enfoncerEgal() {\n\t\tthis.pile.push(this.valC);\n\t\tthis.raz = true;\n\t}", "private String insertarCartaHealingSign() {\n int[] valoresEnemigo = {\n// this.dañoEnemigo=valoresEnemigo[0];\n 0,\n// this.curaEnemigo=valoresEnemigo[1];\n 0,\n// this.cartasEnemigo=valoresEnemigo[2];\n 0,\n// this.descarteEnemigo=valoresEnemigo[3];\n 0,\n// this.recursosEnemigo=valoresEnemigo[4];\n 0,\n// this.moverMesaAManoEnemigo=valoresEnemigo[5];\n 0,\n// this.moverDescarteAManoEnemigo=valoresEnemigo[6];\n 0,\n// this.moverDeckAManoEnemigo=valoresEnemigo[7];\n 0,\n// this.moverMesaADeckEnemigo=valoresEnemigo[8];\n 0,\n// this.moverDescarteADeckEnemigo=valoresEnemigo[9];\n 0,\n// this.moverManoADeckEnemigo=valoresEnemigo[10];\n 0,\n// this.moverMesaADescarteEnemigo=valoresEnemigo[11];\n 0,\n// this.moverManoADescarteEnemigo=valoresEnemigo[12];\n 0,\n// this.moverDeckADescarteEnemigo=valoresEnemigo[13];\n 0,\n// this.moverDescarteAMesaEnemigo=valoresEnemigo[14];\n 0,\n// this.moverManoAMesaEnemigo=valoresEnemigo[15];\n 0,\n// this.moverDeckAMesaEnemigo=valoresEnemigo[16];\n 0\n };\n int[] valoresOwner = {\n// this.dañoOwner=valoresOwner[0];\n 0,\n// this.curaOwner=valoresOwner[1];\n 2,\n// this.cartasOwner=valoresOwner[2];\n 0,\n// this.descarteOwner=valoresOwner[3];\n 0,\n// this.recursosOwner=valoresOwner[4];\n 0,\n// this.moverMesaAManoOwner=valoresOwner[5];\n 0,\n// this.moverDescarteAManoOwner=valoresOwner[6];\n 0,\n// this.moverDeckAManoOwner=valoresOwner[7];\n 0,\n// this.moverMesaADeckOwner=valoresOwner[8];\n 0,\n// this.moverDescarteADeckOwner=valoresOwner[9];\n 0,\n// this.moverManoADeckOwner=valoresOwner[10];\n 0,\n// this.moverMesaADescarteOwner=valoresOwner[11];\n 0,\n// this.moverManoADescarteOwner=valoresOwner[12];\n 0,\n// this.moverDeckADescarteOwner=valoresOwner[13];\n 0,\n// this.moverDescarteAMesaOwner=valoresOwner[14];\n 0,\n// this.moverManoAMesaOwner=valoresOwner[15];\n 0,\n// this.moverDeckAMesaOwner=valoresOwner[16];\n 0\n };\n boolean[]valoresPlay={\n //this.OnMoveMesaADescarte=valoresPlay[0];\n false,\n //this.OnMoveMesaADeck=valoresPlay[1];\n false,\n //this.OnMoveMesaAMano=valoresPlay[2];\n false,\n //this.OnMoveDescarteAMesa=valoresPlay[3];\n false,\n //this.OnMoveDescarteADeck=valoresPlay[4];\n false,\n// this.OnMoveDescarteAMano=valoresPlay[5];\n false,\n// this.OnMoveDeckADescarte=valoresPlay[6];\n false,\n// this.OnMoveDeckAMesa=valoresPlay[7];\n false,\n// this.OnMoveDeckAMano=valoresPlay[8];\n false,\n// this.OnMoveManoADescarte=valoresPlay[9];\n false,\n// this.OnMoveManoAMesa=valoresPlay[10];\n false,\n// this.OnMoveManoADeck=valoresPlay[11];\n false,\n// this.OnStartTurnTable=valoresPlay[12];\n false,\n// this.OnStartTurnHand=valoresPlay[13];\n false,\n// this.OnStartTurnDiscard=valoresPlay[14];\n false,\n// this.OnStartTurnDeck=valoresPlay[15];\n false,\n// this.OnEndTurnTable=valoresPlay[16];\n true,\n// this.OnEndTurnHand=valoresPlay[17];\n false,\n// this.OnEndTurnDiscard=valoresPlay[18];\n false,\n// this.OnEndTurnDeck=valoresPlay[19];\n false,\n };\n ArrayList<Integer> datos = new ArrayList<Integer>();\n for (int i = 0; i < valoresEnemigo.length; i++) {\n datos.add(valoresEnemigo[i]);\n }\n for (int i = 0; i < valoresOwner.length; i++) {\n datos.add(valoresOwner[i]);\n }\n for (int i = 0; i < valoresPlay.length; i++) {\n if(valoresPlay[i]){\n datos.add(1);\n }else{\n datos.add(0);\n }\n }\n String insert=\"\";\n for(int i=0;i<datos.size();i++){\n if(i<datos.size()-1) {\n insert += datos.get(i) + \", \";\n }else{\n insert += datos.get(i) + \" )\";\n }\n }\n return insert;\n }", "public void caricaCopione(Scena scena) {\n\t\t// recupera l'elenco delle battute\n\t\tArrayList<Battuta> copione = scena.getBattute();\n\t\taggiornaMappeColori(scena);\n\t\t// per ogni battuta\n\t\tfor (int i = 0; i < copione.size(); i++) {\n\t\t\tinvia(copione.get(i));\n\t\t}\n\t}", "private void mostrarCoches() {\n int i = 0;\n for (Coche unCoche : coches) {\n System.out.println((i + 1) + \"º \" + coches.get(i));\n ++i;\n }\n }", "private String insertarCartaMentalSpiral() {\n int[] valoresEnemigo = {\n// this.dañoEnemigo=valoresEnemigo[0];\n 0,\n// this.curaEnemigo=valoresEnemigo[1];\n 0,\n// this.cartasEnemigo=valoresEnemigo[2];\n 0,\n// this.descarteEnemigo=valoresEnemigo[3];\n 1,\n// this.recursosEnemigo=valoresEnemigo[4];\n 0,\n// this.moverMesaAManoEnemigo=valoresEnemigo[5];\n 0,\n// this.moverDescarteAManoEnemigo=valoresEnemigo[6];\n 0,\n// this.moverDeckAManoEnemigo=valoresEnemigo[7];\n 0,\n// this.moverMesaADeckEnemigo=valoresEnemigo[8];\n 0,\n// this.moverDescarteADeckEnemigo=valoresEnemigo[9];\n 0,\n// this.moverManoADeckEnemigo=valoresEnemigo[10];\n 0,\n// this.moverMesaADescarteEnemigo=valoresEnemigo[11];\n 0,\n// this.moverManoADescarteEnemigo=valoresEnemigo[12];\n 0,\n// this.moverDeckADescarteEnemigo=valoresEnemigo[13];\n 0,\n// this.moverDescarteAMesaEnemigo=valoresEnemigo[14];\n 0,\n// this.moverManoAMesaEnemigo=valoresEnemigo[15];\n 0,\n// this.moverDeckAMesaEnemigo=valoresEnemigo[16];\n 0\n };\n int[] valoresOwner = {\n// this.dañoOwner=valoresOwner[0];\n 0,\n// this.curaOwner=valoresOwner[1];\n 0,\n// this.cartasOwner=valoresOwner[2];\n 1,\n// this.descarteOwner=valoresOwner[3];\n 0,\n// this.recursosOwner=valoresOwner[4];\n 0,\n// this.moverMesaAManoOwner=valoresOwner[5];\n 0,\n// this.moverDescarteAManoOwner=valoresOwner[6];\n 0,\n// this.moverDeckAManoOwner=valoresOwner[7];\n 0,\n// this.moverMesaADeckOwner=valoresOwner[8];\n 0,\n// this.moverDescarteADeckOwner=valoresOwner[9];\n 0,\n// this.moverManoADeckOwner=valoresOwner[10];\n 0,\n// this.moverMesaADescarteOwner=valoresOwner[11];\n 0,\n// this.moverManoADescarteOwner=valoresOwner[12];\n 0,\n// this.moverDeckADescarteOwner=valoresOwner[13];\n 0,\n// this.moverDescarteAMesaOwner=valoresOwner[14];\n 0,\n// this.moverManoAMesaOwner=valoresOwner[15];\n 0,\n// this.moverDeckAMesaOwner=valoresOwner[16];\n 0\n };\n boolean[]valoresPlay={\n //this.OnMoveMesaADescarte=valoresPlay[0];\n false,\n //this.OnMoveMesaADeck=valoresPlay[1];\n false,\n //this.OnMoveMesaAMano=valoresPlay[2];\n false,\n //this.OnMoveDescarteAMesa=valoresPlay[3];\n false,\n //this.OnMoveDescarteADeck=valoresPlay[4];\n false,\n// this.OnMoveDescarteAMano=valoresPlay[5];\n false,\n// this.OnMoveDeckADescarte=valoresPlay[6];\n false,\n// this.OnMoveDeckAMesa=valoresPlay[7];\n false,\n// this.OnMoveDeckAMano=valoresPlay[8];\n false,\n// this.OnMoveManoADescarte=valoresPlay[9];\n false,\n// this.OnMoveManoAMesa=valoresPlay[10];\n true,\n// this.OnMoveManoADeck=valoresPlay[11];\n false,\n// this.OnStartTurnTable=valoresPlay[12];\n false,\n// this.OnStartTurnHand=valoresPlay[13];\n false,\n// this.OnStartTurnDiscard=valoresPlay[14];\n false,\n// this.OnStartTurnDeck=valoresPlay[15];\n false,\n// this.OnEndTurnTable=valoresPlay[16];\n false,\n// this.OnEndTurnHand=valoresPlay[17];\n false,\n// this.OnEndTurnDiscard=valoresPlay[18];\n false,\n// this.OnEndTurnDeck=valoresPlay[19];\n false,\n };\n ArrayList<Integer> datos = new ArrayList<Integer>();\n String nombre = \"\";\n for (int i = 0; i < valoresEnemigo.length; i++) {\n datos.add(valoresEnemigo[i]);\n }\n for (int i = 0; i < valoresOwner.length; i++) {\n datos.add(valoresOwner[i]);\n }\n for (int i = 0; i < valoresPlay.length; i++) {\n if(valoresPlay[i]){\n datos.add(1);\n }else{\n datos.add(0);\n }\n }\n String insert=\"\";\n for(int i=0;i<datos.size();i++){\n if(i<datos.size()-1) {\n insert += datos.get(i) + \", \";\n }else{\n insert += datos.get(i) + \" )\";\n }\n }\n return insert;\n }", "private String insertarCartaNaturalHelp() {\n int[] valoresEnemigo = {\n// this.dañoEnemigo=valoresEnemigo[0];\n 0,\n// this.curaEnemigo=valoresEnemigo[1];\n 0,\n// this.cartasEnemigo=valoresEnemigo[2];\n 0,\n// this.descarteEnemigo=valoresEnemigo[3];\n 0,\n// this.recursosEnemigo=valoresEnemigo[4];\n 0,\n// this.moverMesaAManoEnemigo=valoresEnemigo[5];\n 0,\n// this.moverDescarteAManoEnemigo=valoresEnemigo[6];\n 0,\n// this.moverDeckAManoEnemigo=valoresEnemigo[7];\n 0,\n// this.moverMesaADeckEnemigo=valoresEnemigo[8];\n 0,\n// this.moverDescarteADeckEnemigo=valoresEnemigo[9];\n 0,\n// this.moverManoADeckEnemigo=valoresEnemigo[10];\n 0,\n// this.moverMesaADescarteEnemigo=valoresEnemigo[11];\n 0,\n// this.moverManoADescarteEnemigo=valoresEnemigo[12];\n 0,\n// this.moverDeckADescarteEnemigo=valoresEnemigo[13];\n 0,\n// this.moverDescarteAMesaEnemigo=valoresEnemigo[14];\n 0,\n// this.moverManoAMesaEnemigo=valoresEnemigo[15];\n 0,\n// this.moverDeckAMesaEnemigo=valoresEnemigo[16];\n 0\n };\n int[] valoresOwner = {\n// this.dañoOwner=valoresOwner[0];\n 0,\n// this.curaOwner=valoresOwner[1];\n 0,\n// this.cartasOwner=valoresOwner[2];\n 0,\n// this.descarteOwner=valoresOwner[3];\n 0,\n// this.recursosOwner=valoresOwner[4];\n 2,\n// this.moverMesaAManoOwner=valoresOwner[5];\n 0,\n// this.moverDescarteAManoOwner=valoresOwner[6];\n 0,\n// this.moverDeckAManoOwner=valoresOwner[7];\n 0,\n// this.moverMesaADeckOwner=valoresOwner[8];\n 0,\n// this.moverDescarteADeckOwner=valoresOwner[9];\n 0,\n// this.moverManoADeckOwner=valoresOwner[10];\n 0,\n// this.moverMesaADescarteOwner=valoresOwner[11];\n 0,\n// this.moverManoADescarteOwner=valoresOwner[12];\n 0,\n// this.moverDeckADescarteOwner=valoresOwner[13];\n 0,\n// this.moverDescarteAMesaOwner=valoresOwner[14];\n 0,\n// this.moverManoAMesaOwner=valoresOwner[15];\n 0,\n// this.moverDeckAMesaOwner=valoresOwner[16];\n 0\n };\n boolean[]valoresPlay={\n //this.OnMoveMesaADescarte=valoresPlay[0];\n false,\n //this.OnMoveMesaADeck=valoresPlay[1];\n false,\n //this.OnMoveMesaAMano=valoresPlay[2];\n false,\n //this.OnMoveDescarteAMesa=valoresPlay[3];\n false,\n //this.OnMoveDescarteADeck=valoresPlay[4];\n false,\n// this.OnMoveDescarteAMano=valoresPlay[5];\n false,\n// this.OnMoveDeckADescarte=valoresPlay[6];\n false,\n// this.OnMoveDeckAMesa=valoresPlay[7];\n false,\n// this.OnMoveDeckAMano=valoresPlay[8];\n false,\n// this.OnMoveManoADescarte=valoresPlay[9];\n false,\n// this.OnMoveManoAMesa=valoresPlay[10];\n true,\n// this.OnMoveManoADeck=valoresPlay[11];\n false,\n// this.OnStartTurnTable=valoresPlay[12];\n false,\n// this.OnStartTurnHand=valoresPlay[13];\n false,\n// this.OnStartTurnDiscard=valoresPlay[14];\n false,\n// this.OnStartTurnDeck=valoresPlay[15];\n false,\n// this.OnEndTurnTable=valoresPlay[16];\n false,\n// this.OnEndTurnHand=valoresPlay[17];\n false,\n// this.OnEndTurnDiscard=valoresPlay[18];\n false,\n// this.OnEndTurnDeck=valoresPlay[19];\n false,\n };\n ArrayList<Integer> datos = new ArrayList<Integer>();\n String nombre = \"\";\n for (int i = 0; i < valoresEnemigo.length; i++) {\n datos.add(valoresEnemigo[i]);\n }\n for (int i = 0; i < valoresOwner.length; i++) {\n datos.add(valoresOwner[i]);\n }\n for (int i = 0; i < valoresPlay.length; i++) {\n if(valoresPlay[i]){\n datos.add(1);\n }else{\n datos.add(0);\n }\n }\n String insert=\"\";\n for(int i=0;i<datos.size();i++){\n if(i<datos.size()-1) {\n insert += datos.get(i) + \", \";\n }else{\n insert += datos.get(i) + \" )\";\n }\n }\n return insert;\n }", "public static Resultado PCF(GrafoMatriz G, Demanda demanda,ListaEnlazada [] ksp,int capacidad){\n \n //*Definicion de variables las variables\n int inicio=0, fin=0,cont; // posicion inicial y final dentro del espectro asi como el contador de FSs contiguos disponibles\n \n int demandaColocada=0; // bandera para controlar si ya se encontro espectro disponible para la demanda.\n int [] OE= new int[capacidad]; //Ocupacion de Espectro.\n ArrayList<ListaEnlazada> kspUbicados = new ArrayList<ListaEnlazada>();\n ArrayList<Integer> inicios = new ArrayList<Integer>();\n ArrayList<Integer> fines = new ArrayList<Integer>();\n ArrayList<Integer> indiceKsp = new ArrayList<Integer>();\n\n //Probamos para cada camino, si existe espectro para ubicar la damanda\n int k=0;\n\n while(k<ksp.length && ksp[k]!=null){\n //Inicializadomos el espectro, inicialmente todos los FSs estan libres\n for(int i=0;i<capacidad;i++){\n OE[i]=1;\n }\n //Calcular la ocupacion del espectro para cada camino k\n for(int i=0;i<capacidad;i++){\n for(Nodo n=ksp[k].getInicio();n.getSiguiente().getSiguiente()!=null;n=n.getSiguiente()){\n //System.out.println(\"v1 \"+n.getDato()+\" v2 \"+n.getSiguiente().getDato()+\" cant vertices \"+G.getCantidadDeVertices()+\" i \"+i+\" FSs \"+G.acceder(n.getDato(),n.getSiguiente().getDato()).getFS().length);\n if(G.acceder(n.getDato(),n.getSiguiente().getDato()).getFS()[i].getEstado()==0){\n OE[i]=0;\n break;\n }\n }\n }\n \n inicio=fin=cont=0;\n for(int i=0;i<capacidad;i++){\n if(OE[i]==1){\n inicio=i;\n for(int j=inicio;j<capacidad;j++){\n if(OE[j]==1){\n cont++;\n }\n else{\n cont=0;\n break;\n }\n //si se encontro un bloque valido, salimos de todos los bloques\n if(cont==demanda.getNroFS()){\n fin=j;\n fines.add(fin);\n inicios.add(inicio);\n demandaColocada=1;\n kspUbicados.add(ksp[k]);\n indiceKsp.add(k);\n //inicio=fin=cont=0;\n break;\n }\n }\n }\n if(demandaColocada==1){\n demandaColocada = 0;\n break;\n }\n }\n k++;\n }\n \n /*if(demandaColocada==0){\n return null; // Si no se encontro, en ningun camino un bloque contiguo de FSs, retorna null.\n }*/\n \n if (kspUbicados.isEmpty()){\n //System.out.println(\"Desubicado\");\n return null;\n }\n \n int [] cortesSlots = new int [2];\n double corte = -1;\n double Fcmt = 9999999;\n double FcmtAux = -1;\n \n int caminoElegido = -1;\n\n //controla que exista un resultado\n boolean nulo = true;\n\n ArrayList<Integer> indiceL = new ArrayList<Integer>();\n \n //contar los cortes de cada candidato\n for (int i=0; i<kspUbicados.size(); i++){\n cortesSlots = Utilitarios.nroCuts(kspUbicados.get(i), G, capacidad);\n if (cortesSlots != null){\n \n corte = (double)cortesSlots[0];\n \n indiceL = Utilitarios.buscarIndices(kspUbicados.get(i), G, capacidad);\n \n double saltos = (double)Utilitarios.calcularSaltos(kspUbicados.get(i));\n \n double slotsDemanda = demanda.getNroFS();\n \n //contar los desalineamientos\n double desalineamiento = (double)Utilitarios.contarDesalineamiento(kspUbicados.get(i), G, capacidad, cortesSlots[1]);\n \n double capacidadLibre = (double)Utilitarios.contarCapacidadLibre(kspUbicados.get(i),G,capacidad);\n \n \n \n \n // double vecinos = (double)Utilitarios.contarVecinos(kspUbicados.get(i),G,capacidad);\n \n\n \n //FcmtAux = corte + (desalineamiento/(demanda.getNroFS()*vecinos)) + (saltos *(demanda.getNroFS()/capacidadLibre)); \n \n FcmtAux = ((saltos*slotsDemanda) + corte + desalineamiento)/capacidadLibre;\n \n if (FcmtAux<Fcmt){\n Fcmt = FcmtAux;\n caminoElegido = i;\n }\n \n nulo = false;\n if (caminoElegido==-1){\n System.out.println(\"Camino Elegido = -1 ..................\");\n }\n \n }\n }\n \n if (caminoElegido==-1){\n System.out.println(\"Camino Elegido = -1 ..................\");\n }\n //caminoElegido = Utilitarios.contarCuts(kspUbicados, G, capacidad);\n \n if (nulo || caminoElegido==-1){\n return null;\n }\n \n Resultado r= new Resultado();\n /*r.setCamino(k-1);\n r.setFin(fin);\n r.setInicio(inicio);*/\n \n r.setCamino(indiceKsp.get(caminoElegido));\n r.setFin(fines.get(caminoElegido));\n r.setInicio(inicios.get(caminoElegido));\n return r;\n }", "private String insertarCartaNightmare() {\n int[] valoresEnemigo = {\n// this.dañoEnemigo=valoresEnemigo[0];\n 0,\n// this.curaEnemigo=valoresEnemigo[1];\n 0,\n// this.cartasEnemigo=valoresEnemigo[2];\n 0,\n// this.descarteEnemigo=valoresEnemigo[3];\n 0,\n// this.recursosEnemigo=valoresEnemigo[4];\n 0,\n// this.moverMesaAManoEnemigo=valoresEnemigo[5];\n 0,\n// this.moverDescarteAManoEnemigo=valoresEnemigo[6];\n 0,\n// this.moverDeckAManoEnemigo=valoresEnemigo[7];\n 0,\n// this.moverMesaADeckEnemigo=valoresEnemigo[8];\n 0,\n// this.moverDescarteADeckEnemigo=valoresEnemigo[9];\n 0,\n// this.moverManoADeckEnemigo=valoresEnemigo[10];\n 0,\n// this.moverMesaADescarteEnemigo=valoresEnemigo[11];\n 0,\n// this.moverManoADescarteEnemigo=valoresEnemigo[12];\n 0,\n// this.moverDeckADescarteEnemigo=valoresEnemigo[13];\n 15,\n// this.moverDescarteAMesaEnemigo=valoresEnemigo[14];\n 0,\n// this.moverManoAMesaEnemigo=valoresEnemigo[15];\n 0,\n// this.moverDeckAMesaEnemigo=valoresEnemigo[16];\n 0\n };\n int[] valoresOwner = {\n// this.dañoOwner=valoresOwner[0];\n 0,\n// this.curaOwner=valoresOwner[1];\n 0,\n// this.cartasOwner=valoresOwner[2];\n 0,\n// this.descarteOwner=valoresOwner[3];\n 0,\n// this.recursosOwner=valoresOwner[4];\n 0,\n// this.moverMesaAManoOwner=valoresOwner[5];\n 0,\n// this.moverDescarteAManoOwner=valoresOwner[6];\n 0,\n// this.moverDeckAManoOwner=valoresOwner[7];\n 0,\n// this.moverMesaADeckOwner=valoresOwner[8];\n 0,\n// this.moverDescarteADeckOwner=valoresOwner[9];\n 0,\n// this.moverManoADeckOwner=valoresOwner[10];\n 0,\n// this.moverMesaADescarteOwner=valoresOwner[11];\n 0,\n// this.moverManoADescarteOwner=valoresOwner[12];\n 0,\n// this.moverDeckADescarteOwner=valoresOwner[13];\n 0,\n// this.moverDescarteAMesaOwner=valoresOwner[14];\n 0,\n// this.moverManoAMesaOwner=valoresOwner[15];\n 0,\n// this.moverDeckAMesaOwner=valoresOwner[16];\n 0\n };\n boolean[]valoresPlay={\n //this.OnMoveMesaADescarte=valoresPlay[0];\n false,\n //this.OnMoveMesaADeck=valoresPlay[1];\n false,\n //this.OnMoveMesaAMano=valoresPlay[2];\n false,\n //this.OnMoveDescarteAMesa=valoresPlay[3];\n false,\n //this.OnMoveDescarteADeck=valoresPlay[4];\n false,\n// this.OnMoveDescarteAMano=valoresPlay[5];\n false,\n// this.OnMoveDeckADescarte=valoresPlay[6];\n false,\n// this.OnMoveDeckAMesa=valoresPlay[7];\n false,\n// this.OnMoveDeckAMano=valoresPlay[8];\n false,\n// this.OnMoveManoADescarte=valoresPlay[9];\n false,\n// this.OnMoveManoAMesa=valoresPlay[10];\n true,\n// this.OnMoveManoADeck=valoresPlay[11];\n false,\n// this.OnStartTurnTable=valoresPlay[12];\n false,\n// this.OnStartTurnHand=valoresPlay[13];\n false,\n// this.OnStartTurnDiscard=valoresPlay[14];\n false,\n// this.OnStartTurnDeck=valoresPlay[15];\n false,\n// this.OnEndTurnTable=valoresPlay[16];\n false,\n// this.OnEndTurnHand=valoresPlay[17];\n false,\n// this.OnEndTurnDiscard=valoresPlay[18];\n false,\n// this.OnEndTurnDeck=valoresPlay[19];\n false,\n };\n ArrayList<Integer> datos = new ArrayList<Integer>();\n String nombre = \"\";\n for (int i = 0; i < valoresEnemigo.length; i++) {\n datos.add(valoresEnemigo[i]);\n }\n for (int i = 0; i < valoresOwner.length; i++) {\n datos.add(valoresOwner[i]);\n }\n for (int i = 0; i < valoresPlay.length; i++) {\n if(valoresPlay[i]){\n datos.add(1);\n }else{\n datos.add(0);\n }\n }\n String insert=\"\";\n for(int i=0;i<datos.size();i++){\n if(i<datos.size()-1) {\n insert += datos.get(i) + \", \";\n }else{\n insert += datos.get(i) + \" )\";\n }\n }\n return insert;\n }", "public void mostrarConsola() {\n\t\tProceso aux = this.raiz;\n\t\t// int i=this.numProcesos;\n\t\twhile (aux.sig != this.raiz /* i>0 */) {\n\t\t\t// i--;\n\t\t\taux = aux.sig;\n\t\t\tSystem.out.println(aux.toString());\n\t\t}\n\t}", "private String insertarCarta(Carta carta) {\n int[] valoresEnemigo = {\n// this.dañoEnemigo=valoresEnemigo[0];\n 0,\n// this.curaEnemigo=valoresEnemigo[1];\n 0,\n// this.cartasEnemigo=valoresEnemigo[2];\n 0,\n// this.descarteEnemigo=valoresEnemigo[3];\n 0,\n// this.recursosEnemigo=valoresEnemigo[4];\n 0,\n// this.moverMesaAManoEnemigo=valoresEnemigo[5];\n 0,\n// this.moverDescarteAManoEnemigo=valoresEnemigo[6];\n 0,\n// this.moverDeckAManoEnemigo=valoresEnemigo[7];\n 0,\n// this.moverMesaADeckEnemigo=valoresEnemigo[8];\n 0,\n// this.moverDescarteADeckEnemigo=valoresEnemigo[9];\n 0,\n// this.moverManoADeckEnemigo=valoresEnemigo[10];\n 0,\n// this.moverMesaADescarteEnemigo=valoresEnemigo[11];\n 0,\n// this.moverManoADescarteEnemigo=valoresEnemigo[12];\n 0,\n// this.moverDeckADescarteEnemigo=valoresEnemigo[13];\n 0,\n// this.moverDescarteAMesaEnemigo=valoresEnemigo[14];\n 0,\n// this.moverManoAMesaEnemigo=valoresEnemigo[15];\n 0,\n// this.moverDeckAMesaEnemigo=valoresEnemigo[16];\n 0\n };\n if(carta.getDañoEnemigo()!=0){\n valoresEnemigo[0]=carta.getDañoEnemigo();\n }\n if(carta.getCuraEnemigo()!=0){\n valoresEnemigo[1]=carta.getCuraEnemigo();\n }\n if(carta.getCartasEnemigo()!=0){\n valoresEnemigo[2]=carta.getCartasEnemigo();\n }\n if(carta.getDescarteEnemigo()!=0){\n valoresEnemigo[3]=carta.getDescarteEnemigo();\n }\n if(carta.getRecursosEnemigo()!=0){\n valoresEnemigo[4]=carta.getRecursosEnemigo();\n }\n if(carta.getMoverMesaAManoEnemigo()!=0){\n valoresEnemigo[5]=carta.getMoverMesaAManoEnemigo();\n }\n if(carta.getMoverDescarteAManoEnemigo()!=0){\n valoresEnemigo[6]=carta.getMoverDescarteAManoEnemigo();\n }\n if(carta.getMoverMesaADeckEnemigo()!=0){\n valoresEnemigo[8]=carta.getMoverMesaADeckEnemigo();\n }\n if(carta.getMoverDescarteADeckEnemigo()!=0){\n valoresEnemigo[9]=carta.getMoverDescarteADeckEnemigo();\n }\n if(carta.getMoverManoADeckEnemigo()!=0){\n valoresEnemigo[10]=carta.getMoverManoADeckEnemigo();\n }\n if(carta.getMoverMesaADescarteEnemigo()!=0){\n valoresEnemigo[11]=carta.getMoverMesaADescarteEnemigo();\n }\n if(carta.getMoverManoADescarteEnemigo()!=0){\n valoresEnemigo[12]=carta.getMoverManoADescarteEnemigo();\n }\n if(carta.getMoverDeckADescarteEnemigo()!=0){\n valoresEnemigo[13]=carta.getMoverDescarteADeckEnemigo();\n }\n\n\n int[] valoresOwner = {\n// this.dañoOwner=valoresOwner[0];\n 0,\n// this.curaOwner=valoresOwner[1];\n 0,\n// this.cartasOwner=valoresOwner[2];\n 0,\n// this.descarteOwner=valoresOwner[3];\n 0,\n// this.recursosOwner=valoresOwner[4];\n 0,\n// this.moverMesaAManoOwner=valoresOwner[5];\n 0,\n// this.moverDescarteAManoOwner=valoresOwner[6];\n 0,\n// this.moverDeckAManoOwner=valoresOwner[7];\n 0,\n// this.moverMesaADeckOwner=valoresOwner[8];\n 0,\n// this.moverDescarteADeckOwner=valoresOwner[9];\n 0,\n// this.moverManoADeckOwner=valoresOwner[10];\n 0,\n// this.moverMesaADescarteOwner=valoresOwner[11];\n 0,\n// this.moverManoADescarteOwner=valoresOwner[12];\n 0,\n// this.moverDeckADescarteOwner=valoresOwner[13];\n 0,\n// this.moverDescarteAMesaOwner=valoresOwner[14];\n 0,\n// this.moverManoAMesaOwner=valoresOwner[15];\n 0,\n// this.moverDeckAMesaOwner=valoresOwner[16];\n 0\n };\n if(carta.getDañoOwner()!=0){\n valoresOwner[0]=carta.getDañoOwner();\n }\n if(carta.getCuraOwner()!=0){\n valoresOwner[1]=carta.getCuraOwner();\n }\n if(carta.getCartasOwner()!=0){\n valoresOwner[2]=carta.getCartasOwner();\n }\n if(carta.getDescarteOwner()!=0){\n valoresOwner[3]=carta.getDescarteOwner();\n }\n if(carta.getRecursosOwner()!=0){\n valoresOwner[4]=carta.getRecursosOwner();\n }\n if(carta.getMoverMesaAManoOwner()!=0){\n valoresOwner[5]=carta.getMoverMesaAManoOwner();\n }\n if(carta.getMoverDescarteAManoOwner()!=0){\n valoresOwner[6]=carta.getMoverDescarteAManoOwner();\n }\n if(carta.getMoverMesaADeckOwner()!=0){\n valoresOwner[8]=carta.getMoverMesaADeckOwner();\n }\n if(carta.getMoverDescarteADeckOwner()!=0){\n valoresOwner[9]=carta.getMoverDescarteADeckOwner();\n }\n if(carta.getMoverManoADeckOwner()!=0){\n valoresOwner[10]=carta.getMoverManoADeckOwner();\n }\n if(carta.getMoverMesaADescarteOwner()!=0){\n valoresOwner[11]=carta.getMoverMesaADescarteOwner();\n }\n if(carta.getMoverManoADescarteOwner()!=0){\n valoresOwner[12]=carta.getMoverManoADescarteOwner();\n }\n if(carta.getMoverDeckADescarteOwner()!=0){\n valoresOwner[1]=carta.getMoverDescarteADeckOwner();\n }\n boolean[]valoresPlay={\n //this.OnMoveMesaADescarte=valoresPlay[0];\n false,\n //this.OnMoveMesaADeck=valoresPlay[1];\n false,\n //this.OnMoveMesaAMano=valoresPlay[2];\n false,\n //this.OnMoveDescarteAMesa=valoresPlay[3];\n false,\n //this.OnMoveDescarteADeck=valoresPlay[4];\n false,\n// this.OnMoveDescarteAMano=valoresPlay[5];\n false,\n// this.OnMoveDeckADescarte=valoresPlay[6];\n false,\n// this.OnMoveDeckAMesa=valoresPlay[7];\n false,\n// this.OnMoveDeckAMano=valoresPlay[8];\n false,\n// this.OnMoveManoADescarte=valoresPlay[9];\n false,\n// this.OnMoveManoAMesa=valoresPlay[10];\n false,\n// this.OnMoveManoADeck=valoresPlay[11];\n false,\n// this.OnStartTurnTable=valoresPlay[12];\n false,\n// this.OnStartTurnHand=valoresPlay[13];\n false,\n// this.OnStartTurnDiscard=valoresPlay[14];\n false,\n// this.OnStartTurnDeck=valoresPlay[15];\n false,\n// this.OnEndTurnTable=valoresPlay[16];\n false,\n// this.OnEndTurnHand=valoresPlay[17];\n false,\n// this.OnEndTurnDiscard=valoresPlay[18];\n false,\n// this.OnEndTurnDeck=valoresPlay[19];\n false,\n };\n\n\n\n\n ArrayList<Integer> datos = new ArrayList<Integer>();\n for (int i = 0; i < valoresEnemigo.length; i++) {\n datos.add(valoresEnemigo[i]);\n }\n for (int i = 0; i < valoresOwner.length; i++) {\n datos.add(valoresOwner[i]);\n }\n for (int i = 0; i < valoresPlay.length; i++) {\n if(valoresPlay[i]){\n datos.add(1);\n }else{\n datos.add(0);\n }\n }\n String insert=\"\";\n for(int i=0;i<datos.size();i++){\n if(i<datos.size()-1) {\n insert += datos.get(i) + \", \";\n }else{\n insert += datos.get(i) + \" )\";\n }\n }\n return insert;\n }", "public Cabeza (Color color, Serpiente serpiente,String sentido, Posicion posicion) {\r\n //Inicializa los atributos\r\n// ojos = new ArrayList<Circle>();\r\n this.serpiente = serpiente;\r\n //Se crea la cabeza, se compone de la cabeza, los ojos y las pupilas\r\n cabeza = new Circle(color);\r\n setSentido(sentido);\r\n setPosicion(posicion);\r\n setColor(color);\r\n// Circle ojoDerecho = new Circle(10,Color.WHITE);\r\n// Circle ojoIzquierdo = new Circle(10,Color.WHITE);\r\n// Circle pupilaDerecha = new Circle(8,Color.BLACK);\r\n// Circle pupulaIzquierda = new Circle(8,Color.BLACK);\r\n// //Se agregan los miembros a la cabeza\r\n// ojos.add(ojoDerecho);\r\n// ojos.add(ojoIzquierdo);\r\n// ojos.add(pupilaDerecha);\r\n// ojos.add(pupulaIzquierda);\r\n }", "EcirdelAubrac(Machecoulais machecoulais) {\n super(1);\n this.f16565a = machecoulais;\n }", "public JuegoCarta() {\n initComponents();\n dibujarPuntuaciones();\n }", "public String getNombreCarta(int fila, int col) {\n\t\treturn tablero[fila][col].getText();\n\t}", "void salirDelMazo() {\n mazo.inhabilitarCartaEspecial(this);\n }", "@Override\n public void compraProducto(String nombre, int cantidad) {\n\n }", "public Carta(String face, String naipe) {\r\n this.face = face; // inicializa face da carta\r\n this.naipe = naipe; // inicializa naipe da carta\r\n }", "public void togliCarta(Terreno tipo) {\n\t\tswitch (tipo) {\n\t\tcase AGRICOLO:\n\t\t\tnumAGRICOLI--;\n\t\t\treturn;\n\t\tcase ARIDO:\n\t\t\tnumARIDI--;\n\t\t\treturn;\n\t\tcase FIUME:\n\t\t\tnumFIUMI--;\n\t\t\treturn;\n\t\tcase FORESTA:\n\t\t\tnumFORESTE--;\n\t\t\treturn;\n\t\tcase MONTAGNA:\n\t\t\tnumMONTAGNE--;\n\t\t\treturn;\n\t\tcase PRATO:\n\t\t\tnumPRATI--;\n\t\t\treturn;\n\t\tdefault:\n\t\t\treturn;\n\t\t}\n\t}", "@Override\r\n public String receita() {\n return \"Misturar os ingredientes; bater no liquidificador; colocar na máquina de waffle por 10m\";\r\n }", "final void formar(final Campbatalla campB) {\n\n int numFiles = campB.obtenirFiles();\n double alcadaSoldat = soldats.get(0).getImatge().getHeight();\n double ampladaSoldat = soldats.get(0).getImatge().getHeight();\n int indexFila = 0;\n\n double xActual = soldats.get(0).getImatge().getX();\n double yActual = 0;\n\n for (int s = 0; s < soldats.size(); s++) {\n if (indexFila <= numFiles) {\n\n soldats.get(s).getImatge().setLocation(xActual, yActual);\n yActual += alcadaSoldat;\n indexFila++;\n if (indexFila == numFiles) {\n indexFila = 0;\n yActual = 0;\n\n // Si l'ubicació es igual -1 posicionem els soldats a\n // l'esquerra.\n if (ubicacio == -1) {\n xActual += ampladaSoldat;\n\n // Si l'ubicació es igual a 1 els posicionem a la\n // dreta.\n } else if (ubicacio == 1) {\n xActual -= ampladaSoldat;\n }\n\n }\n }\n\n }\n\n }", "public void realizaProcessamentoCartaoChest() throws Exception {\n\n if (indiceChest == 1) {\n DeslocarJogador(jogadorAtual(), 40);\n this.listaJogadores.get(jogadorAtual()).addDinheiro(200);\n }\n if (indiceChest == 2) {\n this.listaJogadores.get(jogadorAtual()).addDinheiro(200);\n }\n if (indiceChest == 3) {\n this.listaJogadores.get(jogadorAtual()).retirarDinheiro(50);\n }\n if (indiceChest == 4) {\n int dinheiroCada = 0;\n for (int i = 0; i < numeroDeJogadores; i++) {\n if (i != jogadorAtual()) {\n this.listaJogadores.get(i).retirarDinheiro(50);\n dinheiroCada = dinheiroCada + 50;\n }\n }\n this.listaJogadores.get(jogadorAtual()).addDinheiro(dinheiroCada);\n }\n\n if (indiceChest == 5) {\n this.listaJogadores.get(jogadorAtual()).addDinheiro(45);\n }\n\n if (indiceChest == 6) {\n this.listaJogadores.get(jogadorAtual()).ganharCartaoSaidaDePrisao(\"chest\");\n this.cardChestPrisaoEmPosse = true;\n }\n if (indiceChest == 7) {\n DeslocarJogador(jogadorAtual(), 10);\n adicionaNaPrisao(listaJogadores.get(jogadorAtual()));\n }\n if (indiceChest == 8) {\n this.listaJogadores.get(jogadorAtual()).addDinheiro(20);\n }\n if (indiceChest == 9) {\n this.listaJogadores.get(jogadorAtual()).addDinheiro(100);\n }\n if (indiceChest == 10) {\n this.listaJogadores.get(jogadorAtual()).retirarDinheiro(100);\n }\n if (indiceChest == 11) {\n this.listaJogadores.get(jogadorAtual()).retirarDinheiro(150);\n }\n if (indiceChest == 12) {\n this.listaJogadores.get(jogadorAtual()).addDinheiro(25);\n }\n if (indiceChest == 13) {\n this.listaJogadores.get(jogadorAtual()).addDinheiro(100);\n }\n if (indiceChest == 14) {\n this.listaJogadores.get(jogadorAtual()).addDinheiro(10);\n }\n if (indiceChest == 15) {\n this.listaJogadores.get(jogadorAtual()).addDinheiro(100);\n }\n if (indiceChest == 16) {\n int GastosRua = this.listaJogadores.get(jogadorAtual()).getQuantidadeDeCasas() * 40;\n GastosRua = GastosRua + this.listaJogadores.get(jogadorAtual()).getQuantidadeDeHoteis() * 115;\n this.listaJogadores.get(jogadorAtual()).retirarDinheiro(GastosRua);\n\n }\n\n\n if (indiceChest < 16) {\n indiceChest++;\n } else {\n indiceChest = 1;\n }\n\n }", "private static String criaStringDeSaida(Graph grafo, ArrayList<Integer> busca) {\r\n\t\tint[] ordenaSaida = new int[grafo.getVertexNumber() * 3 + 3];\r\n\r\n\t\tfor (int i = 0; i < busca.size(); i += 3) {\r\n\t\t\tordenaSaida[busca.get(i) * 3] = busca.get(i); // vertice\r\n\t\t\tordenaSaida[busca.get(i) * 3 + 1] = busca.get(i + 1); // nivel\r\n\t\t\tordenaSaida[busca.get(i) * 3 + 2] = busca.get(i + 2); // pai\r\n\t\t}\r\n\r\n\t\tString retorno = \"\";\r\n\r\n\t\tfor (int i = 3; i < ordenaSaida.length; i += 3) {\r\n\t\t\tretorno += ordenaSaida[i] + \" - \" + ordenaSaida[i + 1] + \" \";\r\n\t\t\tif (ordenaSaida[i + 2] == 0) {\r\n\t\t\t\tretorno += \"-\";\r\n\r\n\t\t\t} else {\r\n\t\t\t\tretorno += ordenaSaida[i + 2];\r\n\t\t\t}\r\n\r\n\t\t\tretorno += \"\\n\";\r\n\t\t}\r\n\r\n\t\treturn retorno;\r\n\t}", "public DuploQuantidadeFaturacao(){\r\n faturacao = 0;\r\n quantidade = 0;\r\n }", "ClaseColas() { // Constructor que inicializa el frente y el final de la Cola\r\n frente=0; fin=0;\r\n System.out.println(\"Cola inicializada !!!\");\r\n }", "public void colocarBomba() \r\n {\r\n \tBomba bom;\r\n \tCelda c= miJuego.getNivel(0).getCelda(this.posX, this.posY);\r\n \tif(!dios)\r\n \t{\r\n \t\tif(misBombas.size()>0)\r\n \t\t{\r\n \t\t\tif(c.getBomba()==null){\r\n \t\t\t\tbom=misBombas.remove(misBombas.size()-1);\r\n \t\t\t\tbom.setUbicacion(c);\r\n \t\t\t\tmiJuego.getGui().agregarJuego(bom.getGrafico().getGrafico(),20);\r\n \t\t\t\tbom.getGrafico().setPos(posX, posY);\r\n \t\t\t\tc.colocarBomba(bom);\r\n \t\t\t\tbom=null;\r\n \t\t\t}\r\n \t\t}\r\n \t}\r\n \telse\r\n \t{\r\n \t\tbom=new Bomba(this);\r\n \t\tbom.setUbicacion(c);\r\n\t\t\tmiJuego.getGui().agregarJuego(bom.getGrafico().getGrafico(),20);\r\n \t\tbom.getGrafico().setPos(posX, posY);\r\n \t\tc.colocarBomba(bom);\r\n \t\tbom=null;\r\n \t}\r\n \r\n }", "public fechBalance() {\n initComponents(); \n \n bd=new coneccionBD();\n acum1=0;\n acum2=0;\n acum3=0;\n acum4=0;\n acum5=0;\n padreNivel=\"\";\n }", "public Ficha_epidemiologia_n3 obtenerFichaEpidemiologia() {\n\t\t\n\t\t\t\tFicha_epidemiologia_n3 ficha_epidemiologia_n3 = new Ficha_epidemiologia_n3();\n\t\t\t\tficha_epidemiologia_n3.setCodigo_empresa(empresa.getCodigo_empresa());\n\t\t\t\tficha_epidemiologia_n3.setCodigo_sucursal(sucursal.getCodigo_sucursal());\n\t\t\t\tficha_epidemiologia_n3.setCodigo(\"Z000\");\n\t\t\t\tficha_epidemiologia_n3.setCodigo_ficha(tbxCodigo_ficha\n\t\t\t\t\t\t.getValue());\n\t\t\t\tficha_epidemiologia_n3.setFecha_ficha(new Timestamp(dtbxFecha_ficha.getValue().getTime()));\n\t\t\t\tficha_epidemiologia_n3.setNro_identificacion(tbxNro_identificacion.getValue());\n\t\t\t\n\t\t\t\t//ficha_epidemiologia_n3\n\t\t\t\t\t//\t.setNro_identificacion(tbxNro_identificacion.getValue());\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setConoce_y_o_ha_sido_picado_por_pito(rdbConoce_y_o_ha_sido_picado_por_pito\n\t\t\t\t\t\t\t\t.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setTransfuciones_sanguineas(rdbTransfuciones_sanguineas\n\t\t\t\t\t\t\t\t.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setSometido_transplante(rdbSometido_transplante\n\t\t\t\t\t\t\t\t.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setHijo_de_madre_cero_positiva(rdbHijo_de_madre_cero_positiva\n\t\t\t\t\t\t\t\t.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n3.setEmbarazo_actual(rdbEmbarazo_actual\n\t\t\t\t\t\t.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n3.setHa_sido_donante(rdbHa_sido_donante\n\t\t\t\t\t\t.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n3.setTipo_techo(rdbTipo_techo\n\t\t\t\t\t\t.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n3.setTipo_paredes(rdbTipo_paredes\n\t\t\t\t\t\t.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setEstrato_socio_economico(rdbEstrato_socio_economico\n\t\t\t\t\t\t\t\t.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n3.setEstado_clinico(rdbEstado_clinico\n\t\t\t\t\t\t.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setClasificacion_de_caso(rdbClasificacion_de_caso\n\t\t\t\t\t\t\t\t.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n3.setFiebre(chbFiebre.isChecked() ? \"S\"\n\t\t\t\t\t\t: \"N\");\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setDolor_toracico_cronico(chbDolor_toracico_cronico\n\t\t\t\t\t\t\t\t.isChecked() ? \"S\" : \"N\");\n\t\t\t\tficha_epidemiologia_n3.setDisnea(chbDisnea.isChecked() ? \"S\"\n\t\t\t\t\t\t: \"N\");\n\t\t\t\tficha_epidemiologia_n3.setPalpitaciones(chbPalpitaciones\n\t\t\t\t\t\t.isChecked() ? \"S\" : \"N\");\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setMialgias(chbMialgias.isChecked() ? \"S\" : \"N\");\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setArtralgias(chbArtralgias.isChecked() ? \"S\" : \"N\");\n\t\t\t\tficha_epidemiologia_n3.setEdema_facial(chbEdema_facial\n\t\t\t\t\t\t.isChecked() ? \"S\" : \"N\");\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setEdema_miembros_inferiores(chbEdema_miembros_inferiores\n\t\t\t\t\t\t\t\t.isChecked() ? \"S\" : \"N\");\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setDerrame_pericardico(chbDerrame_pericardico\n\t\t\t\t\t\t\t\t.isChecked() ? \"S\" : \"N\");\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setHepatoesplenomegalia(chbHepatoesplenomegalia\n\t\t\t\t\t\t\t\t.isChecked() ? \"S\" : \"N\");\n\t\t\t\tficha_epidemiologia_n3.setAdenopatias(chbAdenopatias\n\t\t\t\t\t\t.isChecked() ? \"S\" : \"N\");\n\t\t\t\tficha_epidemiologia_n3.setChagoma(chbChagoma.isChecked() ? \"S\"\n\t\t\t\t\t\t: \"N\");\n\t\t\t\tficha_epidemiologia_n3.setFalla_cardiaca(chbFalla_cardiaca\n\t\t\t\t\t\t.isChecked() ? \"S\" : \"N\");\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setPalpitacion_taquicardia(chbPalpitacion_taquicardia\n\t\t\t\t\t\t\t\t.isChecked() ? \"S\" : \"N\");\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setDolor_toracico_agudo(chbDolor_toracico_agudo\n\t\t\t\t\t\t\t\t.isChecked() ? \"S\" : \"N\");\n\t\t\t\tficha_epidemiologia_n3.setBrandicardia(chbBrandicardia\n\t\t\t\t\t\t.isChecked() ? \"S\" : \"N\");\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setSincope_o_presincope(chbSincope_o_presincope\n\t\t\t\t\t\t\t\t.isChecked() ? \"S\" : \"N\");\n\t\t\t\tficha_epidemiologia_n3.setHipotension(chbHipotension\n\t\t\t\t\t\t.isChecked() ? \"S\" : \"N\");\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setDisfagia(chbDisfagia.isChecked() ? \"S\" : \"N\");\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setGota_gruesa_frotis_de_sangre_periferica(rdbGota_gruesa_frotis_de_sangre_periferica\n\t\t\t\t\t\t\t\t.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setMicrohematocrito_examen_fresco(rdbMicrohematocrito_examen_fresco\n\t\t\t\t\t\t\t\t.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n3.setStrout(rdbStrout.getSelectedItem()\n\t\t\t\t\t\t.getValue().toString());\n\t\t\t\tficha_epidemiologia_n3.setElisa_igg_chagas(rdbElisa_igg_chagas\n\t\t\t\t\t\t.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n3.setIfi_igg_chagas(rdbIfi_igg_chagas\n\t\t\t\t\t\t.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n3.setHai_chagas(rdbHai_chagas\n\t\t\t\t\t\t.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setElectrocardiograma(rdbElectrocardiograma\n\t\t\t\t\t\t\t\t.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n3.setEcocardiograma(rdbEcocardiograma\n\t\t\t\t\t\t.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setRayos_x_de_torax_indice_toracico(rdbRayos_x_de_torax_indice_toracico\n\t\t\t\t\t\t\t\t.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n3.setHolter(rdbHolter.getSelectedItem()\n\t\t\t\t\t\t.getValue().toString());\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setTratamiento_etiologico(rdbTratamiento_etiologico\n\t\t\t\t\t\t\t\t.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setTratamiento_sintomatico(rdbTratamiento_sintomatico\n\t\t\t\t\t\t\t\t.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setPosible_via_transmision(rdbPosible_via_transmision\n\t\t\t\t\t\t\t\t.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n3.setRomana(chbRomana.isChecked() ? \"S\"\n\t\t\t\t\t\t: \"N\");\n\t\t\t\t\n\t\t\t\tficha_epidemiologia_n3.setCodigo_empresa(empresa\n\t\t\t\t\t\t.getCodigo_empresa());\n\t\t\t\t\n\t\t\t\tficha_epidemiologia_n3.setCodigo_sucursal(sucursal\n\t\t\t\t\t\t.getCodigo_sucursal());\n\t\t\t\t// ficha_epidemiologia_n3.setCodigo(tbxCodigo.getValue());\n\t\t\t\tficha_epidemiologia_n3.setResultado1(tbxResultado1.getValue());\n\t\t\t\tficha_epidemiologia_n3.setResultado2(tbxResultado2.getValue());\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setSemanas_de_embarazo((ibxSemanas_de_embarazo\n\t\t\t\t\t\t\t\t.getValue() != null ? ibxSemanas_de_embarazo\n\t\t\t\t\t\t\t\t.getValue() : 0));\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setNumero_familiares_con_changa((ibxNumero_familiares_con_changa\n\t\t\t\t\t\t\t\t.getValue() != null ? ibxNumero_familiares_con_changa\n\t\t\t\t\t\t\t\t.getValue() : 0));\n\t\t\t\tficha_epidemiologia_n3\n\t\t\t\t\t\t.setConstipacion_cronica(chbConstipacion_cronica\n\t\t\t\t\t\t\t\t.isChecked() ? \"S\" : \"N\");\n\t\t\t\tficha_epidemiologia_n3.setCreacion_date(new Timestamp(\n\t\t\t\t\t\tnew GregorianCalendar().getTimeInMillis()));\n\t\t\t\tficha_epidemiologia_n3.setUltimo_update(new Timestamp(\n\t\t\t\t\t\tnew GregorianCalendar().getTimeInMillis()));\n\t\t\t\tficha_epidemiologia_n3.setCreacion_user(usuarios.getCodigo()\n\t\t\t\t\t\t.toString());\n\t\t\t\tficha_epidemiologia_n3.setDelete_date(null);\n\t\t\t\tficha_epidemiologia_n3.setUltimo_user(usuarios.getCodigo()\n\t\t\t\t\t\t.toString());\n\t\t\t\tficha_epidemiologia_n3.setDelete_user(null);\n\t\t\t\tficha_epidemiologia_n3.setOtro_tipo_techo(tbxotro_tipo_techo.getValue());\n\n\t\t\t\t\n\t\treturn ficha_epidemiologia_n3;\n\t\t}", "public Carta gioca(Carta t,Carta q,Carta l, Carta bri) {\n System.out.println(\"MANO \"+this.getNome()+\":\\n\"+this.mano.toString()+\"\\n\");\n if(t==null)return this.basso(bri);\n else{\n if(t.getSeme()!=bri.getSeme())\n {\n if(t.getPunti()==11||t.getPunti()==10)return this.briscola_bassa(bri);\n else{return this.alto_basso(t,bri);}\n }\n\n if(t.getSeme()==bri.getSeme()&&t.getPunti()!=0){return this.alto_basso(t,bri);}\n else{return this.basso(bri);}\n\n }\n\n }", "@Override\n\tpublic void concentrarse() {\n\t\tSystem.out.println(\"Se centra en sacar lo mejor del Equipo\");\n\t\t\n\t}", "public void recuperarFacturasCliente(){\n String NIF = datosFactura.recuperarFacturaClienteNIF();\n ArrayList<Factura> facturas = almacen.getFacturas(NIF);\n if(facturas != null){\n for(Factura factura : facturas) {\n System.out.println(\"\\n\");\n System.out.print(factura.toString());\n }\n }\n System.out.println(\"\\n\");\n }", "private void comerFantasma(Fantasma fantasma) {\n // TODO implement here\n }", "private String creaElenco() {\n String testoTabella ;\n String riga = CostBio.VUOTO;\n ArrayList listaPagine = new ArrayList();\n ArrayList listaRiga;\n HashMap mappaTavola = new HashMap();\n String cognomeText;\n int num;\n int taglioPagine = Pref.getInt(CostBio.TAGLIO_COGNOMI_PAGINA);\n String tag = \"Persone di cognome \";\n ArrayList titoli = new ArrayList();\n titoli.add(LibWiki.setBold(\"Cognome\"));\n titoli.add(LibWiki.setBold(\"Voci\"));\n\n for (Map.Entry<String, Integer> mappa: mappaCognomi.entrySet()) {\n\n cognomeText = mappa.getKey();\n num = mappa.getValue();\n if (num >= taglioPagine) {\n cognomeText = tag + cognomeText + CostBio.PIPE + cognomeText;\n cognomeText = LibWiki.setQuadre(cognomeText);\n cognomeText = LibWiki.setBold(cognomeText);\n }// end of if cycle\n\n listaRiga = new ArrayList();\n listaRiga.add(cognomeText);\n listaRiga.add(num);\n listaPagine.add(listaRiga);\n\n }// end of for cycle\n mappaTavola.put(Cost.KEY_MAPPA_SORTABLE_BOOLEAN, true);\n mappaTavola.put(Cost.KEY_MAPPA_TITOLI, titoli);\n mappaTavola.put(Cost.KEY_MAPPA_RIGHE_LISTA, listaPagine);\n testoTabella = LibWiki.creaTable(mappaTavola);\n\n return testoTabella;\n }", "public void assegnaCarta(Terreno tipo) {\n\t\tswitch (tipo) {\n\t\tcase AGRICOLO:\n\t\t\tnumAGRICOLI++;\n\t\t\treturn;\n\t\tcase ARIDO:\n\t\t\tnumARIDI++;\n\t\t\treturn;\n\t\tcase FIUME:\n\t\t\tnumFIUMI++;\n\t\t\treturn;\n\t\tcase FORESTA:\n\t\t\tnumFORESTE++;\n\t\t\treturn;\n\t\tcase MONTAGNA:\n\t\t\tnumMONTAGNE++;\n\t\t\treturn;\n\t\tcase PRATO:\n\t\t\tnumPRATI++;\n\t\t\treturn;\n\t\tdefault:\n\t\t\treturn;\n\t\t}\n\t}", "public IFactura() {\n initComponents();\n Fecha();\n PrepararTabla();\n Productos();\n Clientes();\n NFct();\n TxtDescuento.setText(\"\"+0);\n Subtotal();\n IVA();\n }", "public Ficha_epidemiologia_n13 obtenerFichaEpidemiologia() {\n\t\t\t\t\n\t\t\t\tFicha_epidemiologia_n13 ficha_epidemiologia_n13 = new Ficha_epidemiologia_n13();\n\t\t\t\tficha_epidemiologia_n13.setCodigo_empresa(empresa.getCodigo_empresa());\n\t\t\t\tficha_epidemiologia_n13.setCodigo_sucursal(sucursal.getCodigo_sucursal());\n\t\t\t\tficha_epidemiologia_n13.setCodigo_ficha(tbxCodigo_ficha.getValue());\n\t\t\t\tficha_epidemiologia_n13.setIdentificacion(tbxIdentificacion.getValue());\n\t\t\t\tficha_epidemiologia_n13.setFecha_creacion(new Timestamp(dtbxFecha_creacion.getValue().getTime()));\n\t\t\t\tficha_epidemiologia_n13.setCodigo_diagnostico(\"Z000\");\n\t\t\t\tficha_epidemiologia_n13.setFiebre(chbFiebre.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setMialgias(chbMialgias.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setCefalea(chbCefalea.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setArtralgias(chbArtralgias.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setVomito(chbVomito.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setNausea(chbNausea.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setDolor_retrocular(chbDolor_retrocular.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setHiperemia_conjuntival(chbHiperemia_conjuntival.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setSecrecion_conjuntival(chbSecrecion_conjuntival.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setDolor_pantorrillas(chbDolor_pantorrillas.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setDiarrea(chbDiarrea.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setDolor_abdominal(chbDolor_abdominal.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setHemoptisis(chbHemoptisis.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setMelenas(chbMelenas.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setEpistaxis(chbEpistaxis.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setErupcion(chbErupcion.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setHematuria(chbHematuria.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setTomiquete_postiva(chbTomiquete_postiva.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setEsplenomegalia(chbEsplenomegalia.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setSignos_meningeos(chbSignos_meningeos.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setDisnea(chbDisnea.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setTos(chbTos.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setInsuficiencia_respiratoria(chbInsuficiencia_respiratoria.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setHepatomeglia(chbHepatomeglia.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setIctericia(chbIctericia.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setInsuficiencia_hepatica(chbInsuficiencia_hepatica.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setInsuficiencia_renal(chbInsuficiencia_renal.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setVacuna_fiebre_amarilla(rdbVacuna_fiebre_amarilla.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setDosis_fiebre_amarilla(ibxDosis_fiebre_amarilla.getValue()!=null ? ibxDosis_fiebre_amarilla.getValue() + \"\" : \"\");\n\t\t\t\tficha_epidemiologia_n13.setVacuna_hepatitis_a(rdbVacuna_hepatitis_a.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setDosis_hepatitis_a(ibxDosis_hepatitis_a.getValue()!=null?ibxDosis_hepatitis_a.getValue() + \"\" : \"\");\n\t\t\t\tficha_epidemiologia_n13.setVacuna_hepatitis_b(rdbVacuna_hepatitis_b.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setDosis_hepatitis_b(ibxDosis_hepatitis_b.getValue()!=null?ibxDosis_hepatitis_b.getValue() + \"\" : \"\");\n\t\t\t\tficha_epidemiologia_n13.setVacuna_leptospirosis(rdbVacuna_leptospirosis.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setDosis_leptospirosis(ibxDosis_leptospirosis.getValue()!=null?ibxDosis_leptospirosis.getValue() + \"\" : \"\");\n\t\t\t\tficha_epidemiologia_n13.setPerros(chbPerros.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setGatos(chbGatos.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setBovinos(chbBovinos.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setEquinos(chbEquinos.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setPorcions(chbPorcions.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setNinguno(chbNinguno.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setOtros_animal(chbOtros_animal.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setCual_otro(tbxCual_otro.getValue());\n\t\t\t\tficha_epidemiologia_n13.setContacto_animales(rdbContacto_animales.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setRatas_domicilio(rdbRatas_domicilio.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setRatas_trabajo(rdbRatas_trabajo.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setAcueducto(chbAcueducto.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setPozo(chbPozo.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setRio(chbRio.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setTanque_almacenamiento(chbTanque_almacenamiento.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setAlcantarillas(rdbAlcantarillas.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setInundaciones(rdbInundaciones.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setContacto_aguas_estancadas(rdbContacto_aguas_estancadas.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setAntecedentes_deportivos(rdbAntecedentes_deportivos.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setDisposicion_residuos(rdbDisposicion_residuos.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setTiempo_almacenamiento(rdbTiempo_almacenamiento.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setPersonas_sintomatologia(rdbPersonas_sintomatologia.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setLeucocitosis(chbLeucocitosis.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setLeucopenia(chbLeucopenia.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setNeutrofilia(chbNeutrofilia.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setNeutropenia(chbNeutropenia.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setLinfocitocis(chbLinfocitocis.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setTrombocitosis(chbTrombocitosis.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setTrombocitopenia(chbTrombocitopenia.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setHemoconcentracion(chbHemoconcentracion.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setAlteracion_trasaminasas(chbAlteracion_trasaminasas.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setAlteracion_bilirrubinas(chbAlteracion_bilirrubinas.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setAlteracion_bun(chbAlteracion_bun.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setAlteracion_creatinina(chbAlteracion_creatinina.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setCpk_elevada(chbCpk_elevada.isChecked());\n\t\t\t\tficha_epidemiologia_n13.setDengue(rdbDengue.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setMalaria(rdbMalaria.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setHepatitis_a(rdbHepatitis_a.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setHepatitis_b(rdbHepatitis_b.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setHepatitis_c(rdbHepatitis_c.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setFiebre_amarilla(rdbFiebre_amarilla.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setTipo_muestra(rdbTipo_muestra.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setDestino_muestra(rdbDestino_muestra.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setOtra_muestra(tbxOtra_muestra.getValue());\n\t\t\t\tficha_epidemiologia_n13.setCultivo(rdbCultivo.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setHistoquimica(rdbHistoquimica.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setPcr(rdbPcr.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setElisa(rdbElisa.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setMicroaglutinacion(rdbMicroaglutinacion.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setPareadas(rdbPareadas.getSelectedItem().getValue().toString());\n\t\t\t\t\n\t\t\t\tif (dtbxFecha_muestra1.getValue() != null) {\n\t\t\t\t\tficha_epidemiologia_n13.setFecha_muestra1(new Timestamp(dtbxFecha_muestra1.getValue().getTime()));\n\t\t\t\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\tficha_epidemiologia_n13.setFecha_muestra1(null);\n\t\t\t\t}\n\t\t\t\t\n\n\t\t\t\t\n\t\t\t\tif (dtbxFecha_muestra2.getValue() != null) {\n\t\t\t\t\tficha_epidemiologia_n13.setFecha_muestra2(new Timestamp(dtbxFecha_muestra2.getValue().getTime()));\n\t\t\t\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\tficha_epidemiologia_n13.setFecha_muestra2(null);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tficha_epidemiologia_n13.setIdentificacion_serogrupos(rdbIdentificacion_serogrupos.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setTitulo_muestra1(tbxTitulo_muestra1.getValue());\n\t\t\t\tficha_epidemiologia_n13.setTitulo_muestra2(tbxTitulo_muestra2.getValue());\n\t\t\t\tficha_epidemiologia_n13.setTratamiento(rdbTratamiento.getSelectedItem().getValue().toString());\n\t\t\t\tficha_epidemiologia_n13.setCual_tratamiento(tbxCual_tratamiento.getValue());\n\t\t\t\tficha_epidemiologia_n13.setTratamiento_antibiotico(tbxTratamiento_antibiotico.getValue());\n\t\t\t\tficha_epidemiologia_n13.setDosis(ibxDosis.getValue()!=null?ibxDosis.getValue() + \"\" : \"\");\n\t\t\t\tficha_epidemiologia_n13.setTiempo(ibxTiempo.getValue()!=null?ibxTiempo.getValue() + \"\" : \"\");\n\t\t\t\tficha_epidemiologia_n13.setCodigo_medico(tbxCodigo_medico.getValue());\n\t\t\t\tficha_epidemiologia_n13.setCreacion_date(new Timestamp(new GregorianCalendar().getTimeInMillis()));\n\t\t\t\tficha_epidemiologia_n13.setUltimo_update(new Timestamp(new GregorianCalendar().getTimeInMillis()));\n\t\t\t\tficha_epidemiologia_n13.setCreacion_user(usuarios.getCodigo().toString());\n\t\t\t\tficha_epidemiologia_n13.setDelete_date(null);\n\t\t\t\tficha_epidemiologia_n13.setUltimo_user(usuarios.getCodigo().toString());\n\t\t\t\tficha_epidemiologia_n13.setDelete_user(null);\n\t\t\t\tficha_epidemiologia_n13.setOtro_serogrupo(tbxOtro_serogrupo.getValue());\n\n\t\t\t\treturn ficha_epidemiologia_n13;\n\t\t\t \n\t}", "private String insertarCartaNaturalResources() {\n int[] valoresEnemigo = {\n// this.dañoEnemigo=valoresEnemigo[0];\n 0,\n// this.curaEnemigo=valoresEnemigo[1];\n 0,\n// this.cartasEnemigo=valoresEnemigo[2];\n 0,\n// this.descarteEnemigo=valoresEnemigo[3];\n 0,\n// this.recursosEnemigo=valoresEnemigo[4];\n 0,\n// this.moverMesaAManoEnemigo=valoresEnemigo[5];\n 0,\n// this.moverDescarteAManoEnemigo=valoresEnemigo[6];\n 0,\n// this.moverDeckAManoEnemigo=valoresEnemigo[7];\n 0,\n// this.moverMesaADeckEnemigo=valoresEnemigo[8];\n 0,\n// this.moverDescarteADeckEnemigo=valoresEnemigo[9];\n 0,\n// this.moverManoADeckEnemigo=valoresEnemigo[10];\n 0,\n// this.moverMesaADescarteEnemigo=valoresEnemigo[11];\n 0,\n// this.moverManoADescarteEnemigo=valoresEnemigo[12];\n 0,\n// this.moverDeckADescarteEnemigo=valoresEnemigo[13];\n 0,\n// this.moverDescarteAMesaEnemigo=valoresEnemigo[14];\n 0,\n// this.moverManoAMesaEnemigo=valoresEnemigo[15];\n 0,\n// this.moverDeckAMesaEnemigo=valoresEnemigo[16];\n 0\n };\n int[] valoresOwner = {\n// this.dañoOwner=valoresOwner[0];\n 0,\n// this.curaOwner=valoresOwner[1];\n 0,\n// this.cartasOwner=valoresOwner[2];\n 0,\n// this.descarteOwner=valoresOwner[3];\n 0,\n// this.recursosOwner=valoresOwner[4];\n 5,\n// this.moverMesaAManoOwner=valoresOwner[5];\n 0,\n// this.moverDescarteAManoOwner=valoresOwner[6];\n 0,\n// this.moverDeckAManoOwner=valoresOwner[7];\n 0,\n// this.moverMesaADeckOwner=valoresOwner[8];\n 0,\n// this.moverDescarteADeckOwner=valoresOwner[9];\n 0,\n// this.moverManoADeckOwner=valoresOwner[10];\n 0,\n// this.moverMesaADescarteOwner=valoresOwner[11];\n 0,\n// this.moverManoADescarteOwner=valoresOwner[12];\n 0,\n// this.moverDeckADescarteOwner=valoresOwner[13];\n 0,\n// this.moverDescarteAMesaOwner=valoresOwner[14];\n 0,\n// this.moverManoAMesaOwner=valoresOwner[15];\n 0,\n// this.moverDeckAMesaOwner=valoresOwner[16];\n 0\n };\n boolean[]valoresPlay={\n //this.OnMoveMesaADescarte=valoresPlay[0];\n false,\n //this.OnMoveMesaADeck=valoresPlay[1];\n false,\n //this.OnMoveMesaAMano=valoresPlay[2];\n false,\n //this.OnMoveDescarteAMesa=valoresPlay[3];\n false,\n //this.OnMoveDescarteADeck=valoresPlay[4];\n false,\n// this.OnMoveDescarteAMano=valoresPlay[5];\n false,\n// this.OnMoveDeckADescarte=valoresPlay[6];\n false,\n// this.OnMoveDeckAMesa=valoresPlay[7];\n false,\n// this.OnMoveDeckAMano=valoresPlay[8];\n false,\n// this.OnMoveManoADescarte=valoresPlay[9];\n false,\n// this.OnMoveManoAMesa=valoresPlay[10];\n true,\n// this.OnMoveManoADeck=valoresPlay[11];\n false,\n// this.OnStartTurnTable=valoresPlay[12];\n false,\n// this.OnStartTurnHand=valoresPlay[13];\n false,\n// this.OnStartTurnDiscard=valoresPlay[14];\n false,\n// this.OnStartTurnDeck=valoresPlay[15];\n false,\n// this.OnEndTurnTable=valoresPlay[16];\n false,\n// this.OnEndTurnHand=valoresPlay[17];\n false,\n// this.OnEndTurnDiscard=valoresPlay[18];\n false,\n// this.OnEndTurnDeck=valoresPlay[19];\n false,\n };\n ArrayList<Integer> datos = new ArrayList<Integer>();\n String nombre = \"\";\n for (int i = 0; i < valoresEnemigo.length; i++) {\n datos.add(valoresEnemigo[i]);\n }\n for (int i = 0; i < valoresOwner.length; i++) {\n datos.add(valoresOwner[i]);\n }\n for (int i = 0; i < valoresPlay.length; i++) {\n if(valoresPlay[i]){\n datos.add(1);\n }else{\n datos.add(0);\n }\n }\n String insert=\"\";\n for(int i=0;i<datos.size();i++){\n if(i<datos.size()-1) {\n insert += datos.get(i) + \", \";\n }else{\n insert += datos.get(i) + \" )\";\n }\n }\n return insert;\n }", "public void reestablecerFullStock() { \n bodega Bodega = new bodega();\n Bodega.setProductosList(this.bodegaDefault());\n }", "public static void main(String[] args) {\n\n\t\tCarta[] mano = new Carta[8];\n\t\tmano[0] = new Carta(Numero.UNO, Palo.OROS);\n\t\tmano[1] = new Carta(Numero.DOS, Palo.COPAS);\n\t\tmano[2] = new Carta(Numero.TRES, Palo.ESPADAS);\n\t\tmano[3] = new Carta(Numero.CUATRO, Palo.BASTOS);\n\t\tmano[4] = new Carta(Numero.SIETE, Palo.OROS);\n\t\tmano[5] = new Carta(Numero.SOTA, Palo.COPAS);\n\t\tmano[6] = new Carta(Numero.CABALLO, Palo.ESPADAS);\n\t\tmano[7] = new Carta(Numero.REY, Palo.BASTOS);\n\t\t\n\t\tString cartas = \"\";\n\t\tfor (int i = 0; i < cartas.length(); i++) {\n\t\t\tString carta = mano[i].toString();\n\t\t\tif (carta == null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tcartas = cartas + carta.toString();\n\t\t}\n\t\tSystem.out.println(Arrays.toString(mano));\n\t\t\n\t}", "public static void main(String[] args) {\n\t\tConcesionario listaconce=new Concesionario();\n\t\t//aņado coches\n\t\tlistaconce.addCoche(new coches(\"'6592 pgk'\",100,5,1500));\n\t\tSystem.out.println(listaconce);\n\t\t//otra forma\n\t\tcoches c1=(new coches(\"'5858 asd'\",120, 3, 1455));\n\t\tlistaconce.addCoche(c1);\n\t\tSystem.out.println(listaconce);\n\t\t\n\n\t}", "private static void cajas() {\n\t\t\n\t}", "protected void afficherMain() {\n\t\tSystem.out.println(\"Vous avez \" + this.joueur.nbCarteDansMain() + \" cartes dans votre main :\");\n\t\tfor (int i = 0; i < 3; i++) {\n\t\t\tif (this.joueur.getCarteDeMain(i) != null) {\n\t\t\t\tSystem.out.println(\"\\t\" + (i+1) + \") \" + this.joueur.getCarteDeMain(i).toString());\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(\"\\t\" + (i+1) + \") Pas de carte.\");\n\t\t\t}\n\t\t}\n\t}", "private static void VeureProductes (BaseDades bd) {\n ArrayList <Producte> llista = new ArrayList<Producte>();\n llista = bd.consultaPro(\"SELECT * FROM PRODUCTE\");\n if (llista != null)\n for (int i = 0; i<llista.size();i++) {\n Producte p = (Producte) llista.get(i);\n System.out.println(\"ID=>\"+p.getIdproducte()+\": \"\n +p.getDescripcio()+\"* Estoc: \"+p.getStockactual()\n +\"* Pvp: \"+p.getPvp()+\" Estoc Mínim: \"\n + p.getStockminim());\n }\n }", "@Override\n\tpublic String crearTramaParaRepartirCarta() {\n\t\treturn null;\n\t}", "public String getCurp(){\r\n return beneficiario[0].toString();\r\n }", "public int \tqueCelulaHay(Casilla pos)\r\n\t{\r\n\t\t\r\n\t\tint queHay = ES_VACIA;\r\n\t\t\r\n\t\t//si no esta vacia miro que celula es\r\n\t\tif(superficie[pos.getFila()][pos.getCol()]!=null)\r\n\t\t{\r\n\t\t\tif(superficie[pos.getFila()][pos.getCol()].soyComestible()) queHay = ES_SIMPLE;\r\n\t\t\telse if(!superficie[pos.getFila()][pos.getCol()].soyComestible()) queHay = ES_COMPLEJA;\r\n\t\t}\r\n\t\t\r\n\t\treturn queHay;\r\n\t\r\n\t}", "public void cargarJComboBoxProductos(JComboBox cbxProductos) { \n bodega Bodega = new bodega();\n for (producto Producto : Bodega.getProductosList()) {\n cbxProductos.addItem(Producto.getNombreProducto());\n //cbxCantidad.addItem(String.valueOf(Producto.getStockProducto()));\n }\n }", "public void verCartasDelMazo(){\n for(Carta carta: cartasBaraja){\n System.out.println(carta);\n }\n }", "public ConsumoViaCep() {\n initComponents();\n }", "public Cartao() {\r\n\t\tsuper();\r\n\t\t// TODO Auto-generated constructor stub\r\n\t}", "@Override\n\tprotected char scegliMossaDaFare(int iAvversario, int jAvversario, char[][] scacchiera) {\n\t\t\n\t\tif(this.storicoMosseAvversario.isEmpty()) {\n\t\t\tswitch(new Random(2).nextInt()) {\n\t\t\t\tcase 0: return 'U';\n\t\t\t\tcase 1: return 'D';\n\t\t\t\tcase 2: if(this.posX == 4 && this.posY == DIM - 1)\n\t\t\t\t\t\t\treturn 'R';\n\t\t\t\t\t\treturn 'L';\n\t\t\t}\n\t\t}\n\n\t\tif(this.storicoMosseAvversario.get(this.storicoMosseAvversario.size() - 1) == 'U' && rimaneNellaScacchiera(this.posY + 1))\n\t\t\t//if(casellaLibera)\n\t\t\treturn 'D';\n\t\telse\n\t\t\tif(this.storicoMosseAvversario.get(this.storicoMosseAvversario.size() - 1) == 'D' && rimaneNellaScacchiera(this.posY - 1))\n\t\t\t\treturn 'U';\n\t\t\telse \n\t\t\t\tif(this.storicoMosseAvversario.get(this.storicoMosseAvversario.size() - 1) == 'L' && rimaneNellaScacchiera(this.posX + 1))\n\t\t\t\t\treturn 'R';\n\t\t\t\telse\n\t\t\t\t\treturn 'L';\n\t}", "public void agregarDatosProductoText() {\n if (cantidadProducto != null && cantidadProducto > 0) {\n //agregando detalle a la Lista de Detalle\n listDetalle.add(new Detallefactura(null, this.producto.getCodBarra(),\n this.producto.getNombreProducto(), cantidadProducto, this.producto.getPrecioVenta(),\n this.producto.getPrecioVenta().multiply(new BigDecimal(cantidadProducto))));\n \n //Seteamos el producto al item del detalle\n //Accedemos al ultimo Item agregado a la lista\n listDetalle.get(listDetalle.size()-1).setCodProducto(producto);\n \n //Seteamos la factura al item del detalle\n //Accedemos al ultimo Item agregado a la lista \n // listDetalle.get(listDetalle.size()-1).setCodFactura(factura);\n \n cantidadProducto = null;\n //limpiamos la variable\n codigoBarra = \"\";\n //Invocamos al metodo que calcula el Total de la Venta para la factura\n totalFacturaVenta();\n\n //Actualizamos el componente ImputText\n RequestContext.getCurrentInstance().update(\"frmFactura:inputCodProducto\");\n //Mensaje de confirmacion de exito de la operacion \n FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, \"Correcto\", \"Producto agregado correctamente!\");\n FacesContext.getCurrentInstance().addMessage(null, message);\n } else {\n cantidadProducto = null;\n //limpiamos la variable\n codigoBarra = \"\";\n //Actualizamos el componente ImputText\n RequestContext.getCurrentInstance().update(\"frmFactura:inputCodProducto\");\n }\n\n }", "@Override\r\n\tpublic String toString() {\n\t\treturn super.getCor().equals(\"Branco\") ? \" ♘ \": \" ♞ \";\r\n\t}", "public String vystiskniCestu(){\n\t\t\n\t\tString vypis = \"Euleruv tah : \" + cesta.get(cesta.size()-1);\n\t\tfor(int i = cesta.size()-2 ; i >= 0;i--){\n\t\t\tvypis += \" -> \" + cesta.get(i);\n\t\t}\n\t\t\n\t\treturn vypis;\n\t}", "public HoyNoCirculaGraf() {\n initComponents();\n cbplaca.removeAllItems();\n cbdia.removeAllItems();\n cbcolor.removeAllItems();\n cbplaca.addItem(\"0\");\n cbplaca.addItem(\"1\");\n cbplaca.addItem(\"2\");\n cbplaca.addItem(\"3\");\n cbplaca.addItem(\"4\");\n cbplaca.addItem(\"5\");\n cbplaca.addItem(\"6\");\n cbplaca.addItem(\"7\");\n cbplaca.addItem(\"8\");\n cbplaca.addItem(\"9\");\n cbcolor.addItem(\"amarillo\");\n cbcolor.addItem(\"rosa\");\n cbcolor.addItem(\"rojo\");\n cbcolor.addItem(\"verde\");\n cbcolor.addItem(\"azul\");\n cbdia.addItem(\"lunes\");\n cbdia.addItem(\"martes\");\n cbdia.addItem(\"miercoles\");\n cbdia.addItem(\"jueves\");\n cbdia.addItem(\"viernes\");\n cbdia.addItem(\" \");\n cbcolor.addItem(\" \");\n cbplaca.addItem(\" \");\n \n revisar.addActionListener(new ActionListener() {\n @Override\n public void actionPerformed(ActionEvent e) {\n String u1 =(String) cbplaca.getSelectedItem();\n String u2 =(String) cbcolor.getSelectedItem();\n String u3 =(String) cbdia.getSelectedItem();\n NoCircula NC = new NoCircula();\n if(u1== \" \" && u2== \" \" && u3!= \" \")\n {\n String imp = NC.getTerminacion(u3);\n imprimirtxt.setText(imp);\n \n }\n if(u1== \" \" && u2!= \" \" && u3== \" \"){\n String imp = NC.getColor(u2);\n imprimirtxt.setText(imp);\n \n }\n if(u1!= \" \" && u2== \" \" && u3== \" \"){\n String imp = NC.getByPlaca(u1);\n imprimirtxt.setText(imp);\n }\n \n \n }\n });\n \n }", "private int[] enquadramentoContagemDeCaracteres(int[] quadro) throws Exception {\n System.out.println(\"\\n\\t[Contagem de Caracteres]\");\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"\\n\\t[Contagem de Caracteres]\\n\");\n Thread.sleep(velocidade);\n\n int informacaoDeControle = ManipuladorDeBit.getPrimeiroByte(quadro[0]);//Quantidade de Bits do quadro\n //Quantidade de Bits de carga util do quadro\n int quantidadeDeBitsCargaUtil = informacaoDeControle;\n System.out.println(\"IC: \" + informacaoDeControle);\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"\\n\\tIC [\"+informacaoDeControle+\"] \");\n\n\n int novoTamanho = quantidadeDeBitsCargaUtil/8;\n\n int[] quadroDesenquadrado = new int[novoTamanho];//Novo vetor de Carga Util\n int posQuadro = 0;//Posicao do Vetor de Quadros\n\n int cargaUtil = 0;//Nova Carga Util\n\n quadro[0] = ManipuladorDeBit.deslocarBits(quadro[0]);//Deslocando os bits 0's a esquerda\n //Primeiro inteiro do Quadro - Contem a informacao de Controle IC nos primeiros 8 bits\n quadro[0] <<= 8;//Deslocando 8 bits para a esquerda, descartar a IC\n\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"Carga Util [ \");\n for (int i=1; (i<=3) && (i<=novoTamanho); i++) {\n cargaUtil = ManipuladorDeBit.getPrimeiroByte(quadro[0]);\n quadroDesenquadrado[posQuadro++] = cargaUtil;\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(cargaUtil + \" \");\n quadro[0] <<= 8;//Desloca 8 bits para a esquerda\n }\n\n Thread.sleep(velocidade);\n\n //Caso o quadro for composto por mais de um inteiro do vetor\n for (int i=1, quantidadeByte; posQuadro<novoTamanho; i++) {\n quantidadeByte = ManipuladorDeBit.quantidadeDeBytes(quadro[i]);\n quadro[i] = ManipuladorDeBit.deslocarBits(quadro[i]);\n\n for (int x=1; (x<=quantidadeByte) && (x<=4); x++) {\n cargaUtil = ManipuladorDeBit.getPrimeiroByte(quadro[i]);\n quadroDesenquadrado[posQuadro++] = cargaUtil;\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(cargaUtil + \" \");\n quadro[i] <<= 8;//Desloca 8 bits para a esquerda\n }\n Thread.sleep(velocidade);\n }\n \n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"]\\n\");\n Thread.sleep(velocidade);\n\n return quadroDesenquadrado;\n }", "@Test\r\n\tpublic void testAcquistareBigliettiE5(){\r\n\t\tCartaDiCredito carta = new CartaDiCredito(\"2334549359434\",23353.89);\r\n\t\tCliente cliente3 = new Cliente(\"4\",\"Mario\",\"Rossi\",\"rossi.m@hotmail.com\",\r\n\t\t\t\t\"M\",\"333152497\",\"rossimario\",\"passw.\",\"passw.\",\"domanda segreta..\",carta);\r\n\t\tp1.acquistareBiglietti(280,\"carta\", cliente3);\r\n\t\t//non andando a buon fine l'operazione, il cliente avra' 0 biglietti\r\n\t\tassertEquals(0,cliente3.getPrenotazioni().size());\r\n\t}", "@Override\n protected String elaboraBody() {\n String text = CostBio.VUOTO;\n int numCognomi = mappaCognomi.size();\n int numVoci = Bio.count();\n int taglioVoci = Pref.getInt(CostBio.TAGLIO_NOMI_ELENCO);\n\n text += A_CAPO;\n text += \"==Cognomi==\";\n text += A_CAPO;\n text += \"Elenco dei \";\n text += LibWiki.setBold(LibNum.format(numCognomi));\n text += \" cognomi '''differenti''' utilizzati nelle \";\n text += LibWiki.setBold(LibNum.format(numVoci));\n text += \" voci biografiche con occorrenze maggiori di \";\n text += LibWiki.setBold(taglioVoci);\n text += A_CAPO;\n text += creaElenco();\n text += A_CAPO;\n\n return text;\n }", "private String getCarrito(NodoAvl tmp){\n StringBuilder sb = new StringBuilder();\n sb.append(tmp.carrito.graphBigQueue(tmp.nom+\"C\",\"Carrito\"));\n sb.append(tmp.nom).append(\"->\").append(tmp.nom).append(\"C0\")\n .append(\";\\n\");\n return sb.toString();\n }", "public FaseDescartes faseJuego();", "public void crearClase() {\r\n\t\tsetClase(3);\r\n\t\tsetTipoAtaque(3);\r\n\t\tsetArmadura(15);\r\n\t\tsetModopelea(0);\r\n\t}", "public void cbxProductosScript(JComboBox cbxCantidad, JComboBox cbxProductos, JLabel jLabelTotal) { //\n cbxCantidad.removeAllItems();\n bodega Bodega = new bodega();\n for (producto Producto : Bodega.getProductosList()) {\n if (Producto.getNombreProducto() == cbxProductos.getSelectedItem()) {\n jLabelTotal.setText(String.valueOf(Producto.getPrecioProducto()));\n for (int i = 1; i < Producto.getStockProducto() + 1; i++) {\n cbxCantidad.addItem(String.valueOf(i));\n }\n if (Producto.getStockProducto() == 0) {\n jLabelTotal.setText(\"No hay Stock\");\n } else {\n jLabelTotal.setText(String.valueOf(Producto.getPrecioProducto()));\n }\n\n }\n }\n }", "Batiment choixBatiment(Partie partie, int nbDoublon, Plateau plateau);", "Etf()\n {\n super();\n extended = 'A';\n price = 2176.33;\n number = 10;\n }", "public Hipermercado(){\r\n this.clientes = new CatalogoClientes();\r\n this.produtos = new CatalogoProdutos();\r\n this.numFiliais = 3;\r\n this.faturacao = new Faturacao(this.numFiliais);\r\n this.filial = new ArrayList<>(this.numFiliais);\r\n for (int i = 0; i < this.numFiliais; i++){\r\n this.filial.add(new Filial());\r\n }\r\n \r\n this.invalidas = 0;\r\n }", "void desconto_final(){\n setDesconto_final(this.inss + this.irpf);\n System.out.println(\"desconto_total = R$ \" + arredondar(this.desconto_final));\n }", "public static void main(String [ ] args){\n\t\t Fecha Hoy = new Fecha(12,12,2020);\r\n\t\t ArrayList<Cuenta> cuentas = new ArrayList<Cuenta>();\r\n\t\t \r\n\t\t Cuenta c0 = new CtaAhorros(10000,10);\r\n\t\t Cuenta c1 = new CtaCheques(256070,0);\r\n\t\t Cuenta c2 = new CtaCredito(13245,100);\r\n\t\t Cuenta c3 = new CtaCheques(765,20);\r\n\t\t Cuenta c4 = new CtaAhorros(9000,20);\r\n\t\t Cuenta c5 = new CtaAhorros(2300,10);\r\n\t\t Cuenta c6 = new CtaCredito(25000,12);\r\n\t\t \r\n\t\t cuentas.add(c0);\r\n\t\t cuentas.add(c1);\r\n\t\t cuentas.add(c2);\r\n\t\t cuentas.add(c3);\r\n\t\t cuentas.add(c4);\r\n\t\t cuentas.add(c5);\r\n\t\t \r\n\t\t Cliente C1=new Cliente(\"QUIJOTE\",cuentas,\"QX400\");\r\n\t\t Hoy.AvanzarTiempo(11,1,0);\r\n\t\t \r\n\t\t C1.depositar(1,1200, Hoy);\r\n\t\t C1.retirar(2,1100, Hoy);\r\n\t\t System.out.println(\"saldo cuenta 3:\"+C1.consultar(3,Hoy));\r\n\t\t C1.depositar(4,600, Hoy);\r\n\t\t \r\n\t\t //C1.reportarEdosCtas();\r\n\t\t \r\n\t\t }", "private IOferta buildOfertaEjemplo7() {\n\t\tPredicate<Compra> condicion = Predicates.alwaysTrue();\n\t\tFunction<Compra, Float> descuento = new DescuentoEnSegundoProducto(\"11-111-1111\", \"11-111-1112\", 50);\n\t\treturn new OfertaDinero(\"50% en Sprite, comprando 1 Coca\", condicion,\tdescuento);\n\t}" ]
[ "0.64965993", "0.63475794", "0.6071892", "0.59902084", "0.59268296", "0.58813554", "0.5866403", "0.58645874", "0.5864464", "0.58471006", "0.58403885", "0.58092964", "0.57910997", "0.57863027", "0.57845944", "0.5782026", "0.5768458", "0.57677424", "0.5764929", "0.5759331", "0.57539517", "0.5753183", "0.57345873", "0.57033044", "0.5689106", "0.56860256", "0.56826454", "0.5678952", "0.5669624", "0.5668795", "0.56673867", "0.5646678", "0.5634682", "0.563267", "0.5630508", "0.56297606", "0.56210387", "0.5620911", "0.5619561", "0.5600423", "0.5598107", "0.55960435", "0.5594646", "0.5591166", "0.55880946", "0.5587948", "0.5582893", "0.5581408", "0.5575887", "0.5572471", "0.557232", "0.55709016", "0.556571", "0.5565047", "0.5556852", "0.55516666", "0.5550586", "0.5548761", "0.5548085", "0.5538901", "0.5538722", "0.55343956", "0.5505508", "0.5504429", "0.5498612", "0.54966676", "0.549404", "0.5493661", "0.5486361", "0.5484723", "0.5482599", "0.54815984", "0.547774", "0.54764265", "0.5475876", "0.5474712", "0.5474603", "0.54732144", "0.54679507", "0.5466509", "0.5465329", "0.54637194", "0.54626805", "0.54607195", "0.5458612", "0.545782", "0.5450239", "0.54378587", "0.5434217", "0.543414", "0.54288596", "0.5428588", "0.5423449", "0.5423032", "0.54177135", "0.5415801", "0.54157037", "0.5414065", "0.54100984", "0.5409909", "0.5400162" ]
0.0
-1
fine modifica_problema_transazioni 13/10/2014 inizio modifica_08/10/2014
private static RataType[] getRataTypeFromBPSDettaglioCartellaResponse( DettaglioCartellaAvvisoResponse response) { RataType[] result = new RataType[0]; //inizio modifica FASCICOLO_2.1 if (response.getCartellaAvviso().getPianoRateOrigine()!=null ) { it.equitalia.dettagliocartellaavviso.wsdl.RataType[] rate = response.getCartellaAvviso().getPianoRateOrigine(); result = new RataType[rate.length]; for (int i = 0; i < rate.length; i++) { it.equitalia.dettagliocartellaavviso.wsdl.RataType rataResponse = rate[i]; RataType rata = new RataType(); rata.setProgressivoRata(rataResponse.getProgressivoRata() ); rata.setDataScadenza(rataResponse.getDataScadenza()); rata.setImportoRata(rataResponse.getImportoRata().doubleValue()) ; rata.setNumeroRav(rataResponse.getNumeroRav()) ; rata.setStatoRata(rataResponse.getStatoRata() ) ; result[i] = rata; } } //fine modifica FASCICOLO_2.1 return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void affichageDateFin() {\r\n\t\tif (dateFinComptage!=null){\r\n\t\t\tSystem.out.println(\"Le comptage est clos depuis le \"+ DateUtils.format(dateFinComptage));\r\n\t\t\tif (nbElements==0){\r\n\t\t\t\tSystem.out.println(\"Le comptage est clos mais n'a pas d'éléments. Le comptage est en anomalie.\");\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tSystem.out.println(\"Le comptage est clos et est OK.\");\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\tSystem.out.println(\"Le compte est actif.\");\r\n\t\t}\r\n\t}", "public void actualizarFechaComprobantes() {\r\n if (utilitario.isFechasValidas(cal_fecha_inicio.getFecha(), cal_fecha_fin.getFecha())) {\r\n tab_tabla1.setCondicion(\"fecha_trans_cnccc between '\" + cal_fecha_inicio.getFecha() + \"' and '\" + cal_fecha_fin.getFecha() + \"' and ide_cntcm=\" + com_tipo_comprobante.getValue());\r\n tab_tabla1.ejecutarSql();\r\n tab_tabla2.ejecutarValorForanea(tab_tabla1.getValorSeleccionado());\r\n utilitario.addUpdate(\"tab_tabla1,tab_tabla2\");\r\n calcularTotal();\r\n utilitario.addUpdate(\"gri_totales\");\r\n } else {\r\n utilitario.agregarMensajeInfo(\"Rango de fechas no válidas\", \"\");\r\n }\r\n\r\n }", "public void gerarparcelascontrato(int id, int idcliente, int idgrupofinanceiro) {\n\t\tContrato contrato = repo.findById(id).get();\n\t\t// contrato.setCliente(clientes);\n\t\t// contrato.setFinanceiroContrato(financeiroContrato);\n\t\trepo.save(contrato);\n\t\tMovimentoContrato movement = movimentoContratoRepository.findByContratoIdAndStatus(id,\n\t\t\t\tStatusActiv.ABERTO.getDescricao());\n\t\tif (movement == null) {\n\t\t\tmovement = new MovimentoContrato();\n\t\t\tmovement.setDataMovimento(new Date());\n\t\t\tmovement.setStatus(StatusActiv.ABERTO.getDescricao());\n\t\t\tmovement.setTipomovimento(TipoMovimentoEnum.entradaContrato.getDescricao());\n\t\t}\n\t\tmovement.setValor(contrato.getTotal());\n\t\tmovement.setContrato(contrato);\n\t\tmovement.setHistorico(contrato.getFinanceiroContrato());\n\t\tmovement.setParcela(contrato.getPeriodo());\n\n\t\tmovement.setName(\"Contrato Nº \" + String.valueOf(id) + \" Cliente: \" + contrato.getClientename());\n\t\tmovement = movimentoContratoRepository.save(movement);\n\n\t\tfichaLeituraRepository\n\t\t\t\t.deleteAll(fichaLeituraRepository.findByContratoIdAndStatus(id, StatusActiv.ABERTO.getDescricao()));\n\t\texcluirParcelas(movement);\n\t\tmovement.setValor(contrato.getTotal());\n\t\tDateTime dt;\n\t\tDateTime dt12;\n\n\t\t//if (movement.getFaturasQuit().size() > 0) {\n\n\t\t\t//dt = new DateTime(movement.getFaturasQuit().get(0).getDataVencimento());\n\t\t\tdt = new DateTime();\n\t\t\tint ano = dt.getYear();\n\t\t\tint mes = dt.getMonthOfYear();\n\t\t\tdt = new DateTime(ano, mes, contrato.getDiaVencimento(), 8, 0); \n\t\t\tdt12 = new DateTime(ano, mes, contrato.getDiaLeitura(), 8, 0); \n\n\t\t/*} \n\t\telse {\n\t\t\tdt = new DateTime();\n\t\t\tint ano = dt.getYear();\n\t\t\tint mes = dt.getMonthOfYear();\n\t\t\tdt12 = new DateTime(ano, mes, contrato.getDiaLeitura(), 8, 0);\n\t\t}*/\n\t\t/*DateTime dt1 = new DateTime(new Date());\n\t\tfor (Fatura itemmovimento : movement.getFaturasQuit()) {\n\t\t\tdt1 = new DateTime(itemmovimento.getDataVencimento());\n\t\t\tif (dt1.isAfter(dt)) {\n\t\t\t\tdt = dt1;\n\t\t\t}\n\t\t\tif (dt1.isAfter(dt12)) {\n\t\t\t\tdt12 = dt1;\n\t\t\t}\n\n\t\t}\n\t\tdt1 = dt12;*/\n\t\tDateTime plusPeriod = new DateTime();\n\t\tDateTime plusPeriodleitura = new DateTime();\n\t\tFatura itemmovimento;\n\t\tint j = movement.getParcela() - movement.getFaturasQuit().size();\n\t\tList<Integer> indiceparcalas = new LinkedList<Integer>();\n\t\tindiceparcalas = maxparcela(movement, j);\n\t\tdouble valr1 = contrato.getTotal();// getValorAberto() / j;\n\n\t\tList<FichaLeitura> fichas = new ArrayList<>();\n\t\tfor (int i = 0; i < j; i++) {\n\t\t\titemmovimento = new Fatura(movement, (movement.getValor() - movement.getValorAberto()));\n\t\t\tplusPeriod = dt.plus(org.joda.time.Period.months(i));\n\t\t\tplusPeriodleitura = dt12.plus(org.joda.time.Period.months(i));\n\t\t\tint dayOfWeekEndDateNumber = Integer.valueOf(plusPeriod.dayOfWeek().getAsString());\n\t\t\tint DaysToAdd;\n\t\t\t// se final de semana\n\t\t\tif (dayOfWeekEndDateNumber == 6 || dayOfWeekEndDateNumber == 7) {\n\t\t\t\tDaysToAdd = 8 - dayOfWeekEndDateNumber;\n\t\t\t\tplusPeriod = plusPeriod.plusDays(DaysToAdd);\n\t\t\t\tdayOfWeekEndDateNumber = Integer.valueOf(plusPeriod.dayOfWeek().getAsString());\n\t\t\t}\n\n\t\t\tdayOfWeekEndDateNumber = Integer.valueOf(plusPeriodleitura.dayOfWeek().getAsString());\n\n\t\t\t// se final de semana\n\t\t\tif (dayOfWeekEndDateNumber == 6 || dayOfWeekEndDateNumber == 7) {\n\t\t\t\tDaysToAdd = 8 - dayOfWeekEndDateNumber;\n\t\t\t\tplusPeriodleitura = plusPeriodleitura.plusDays(DaysToAdd);\n\t\t\t\tdayOfWeekEndDateNumber = Integer.valueOf(plusPeriod.dayOfWeek().getAsString());\n\t\t\t}\n\n\t\t\titemmovimento.setParcela(indiceparcalas.get(i));\n\t\t\titemmovimento.setValor(contrato.getTotal());\n\t\t\titemmovimento.setDataVencimento(plusPeriod.toDate());\n\t\t\titemmovimento.setDataleitura(plusPeriodleitura.toDate());\n\t\t\titemmovimento.setInstantCreation(new Date());\n\t\t\titemmovimento.setStatus(StatusActiv.ABERTO.getDescricao());\n\t\t\titemmovimento.setMovimentoFinanceiro(movement);\n\t\t\titemmovimento.setContrato(contrato);\n\t\t\titemmovimento.setDataMovimento(movement.getDataMovimento());\n\t\t\titemmovimento.setTipomovimento(TipoMovimentoEnum.entradaContrato.getDescricao());\n\n\t\t\t/*\n\t\t\t * FichaLeitura fichaLeitura = new FichaLeitura(contrato, equipamentoContrato,\n\t\t\t * itemmovimento.getDataleitura(), StatusActiv.ABERTO.getDescricao());\n\t\t\t */\n\n\t\t\tCentroCusto centroCusto = centroCustoRepository.findById(movement.getHistorico().getCentrocusto().getId())\n\t\t\t\t\t.get();\n\t\t\tcentroCusto.setSaldoReceber(centroCusto.getSaldoReceber() + (contrato.getTotal()));\n\n\t\t\tcentroCustoRepository.save(centroCusto);\n\t\t\titemmovimento = faturaRepository.save(itemmovimento);\n\t\t\tfor (EquipamentosContrato equipamentoContrato : contrato.getEquipamentosContratos()) {\n\t\t\t\tfichas.add(new FichaLeitura(contrato, equipamentoContrato, itemmovimento.getDataleitura(),\n\t\t\t\t\t\tStatusActiv.ABERTO.getDescricao(), itemmovimento));\n\t\t\t}\n\n\t\t}\n\t\tfichaLeituraRepository.saveAll(fichas);\n\n\t}", "public abstract java.lang.String getFecha_inicio();", "public void codigo(String cadena, String codigo,int codigos,Reserva2 reserva,JDateChooser dateFechaIda,JDateChooser dateFechaVuelta,JTextField DineroFaltante) {\n\t\tcadena=codigo.split(\",\")[1];\n\t\tubicacion=codigo.split(\",\")[5];\n\t\tnombre=codigo.split(\",\")[3];\n\t\tprecio=codigo.split(\",\")[8];\n\t\tcodigos=Integer.parseInt(cadena);\n\t\tSystem.out.println(\"hola\");\n\t\tSystem.out.println(Modelo1.contador);\n\t\t\n\t\tif(Modelo1.contador==1) {\n\t\t\treserva.setUbicacion(ubicacion);\n\t\t\treserva.setCodigohotel(codigos);\n\t\t\treserva.setNombreAlojamiento(nombre);\n\t\t\t\n\t\t}\n\t\telse if(Modelo1.contador==2) {\n\t\t\t\n\t\t\totroprecio=Double.parseDouble(precio);\n\t\t\treserva.setUbicacion(ubicacion);\n\t\t\treserva.setCodigocasa(codigos);\n\t\t\treserva.setNombreAlojamiento(nombre);\n\t\t\tpreciofinal=metodos.preciototal(dateFechaIda, dateFechaVuelta, otroprecio);\n\t\t\treserva.setPrecio(preciofinal);\n\t\t\tSystem.out.println(reserva.getUbicacion());\n\t\t\tSystem.out.println(reserva.getCodigocasa());\n\t\t\tSystem.out.println(reserva.getNombreAlojamiento());\n\t\t\tSystem.out.println(reserva.getPrecio());\n\t\t\tDineroFaltante.setText(reserva.getPrecio()+\" \\u20ac\");\n\t\t\tModelo1.total_faltante = reserva.getPrecio();\n\t\t\t\n\t\t}\n\t\telse if(Modelo1.contador==3) {\n\t\t\t\n\t\t\totroprecio=Double.parseDouble(precio);\n\t\t\treserva.setUbicacion(ubicacion);\n\t\t\treserva.setCodigoapatamento(codigos);\n\t\t\treserva.setNombreAlojamiento(nombre);\n\t\t\tpreciofinal=metodos.preciototal(dateFechaIda, dateFechaVuelta, otroprecio);\n\t\t\treserva.setPrecio(preciofinal);\n\t\t\tSystem.out.println(reserva.getUbicacion());\n\t\t\tSystem.out.println(reserva.getCodigoapatamento());\n\t\t\tSystem.out.println(reserva.getNombreAlojamiento());\n\t\t\tSystem.out.println(reserva.getPrecio());\n\t\t\tDineroFaltante.setText(reserva.getPrecio()+\" \\u20ac\");\n\t\t\tModelo1.total_faltante = reserva.getPrecio();\n\t\t}\n\t\t\n\t}", "private static String fechaMod(File imagen) {\n\t\tlong tiempo = imagen.lastModified();\n\t\tDate d = new Date(tiempo);\n\t\tCalendar c = new GregorianCalendar();\n\t\tc.setTime(d);\n\t\tString dia = Integer.toString(c.get(Calendar.DATE));\n\t\tString mes = Integer.toString(c.get(Calendar.MONTH));\n\t\tString anyo = Integer.toString(c.get(Calendar.YEAR));\n\t\tString hora = Integer.toString(c.get(Calendar.HOUR_OF_DAY));\n\t\tString minuto = Integer.toString(c.get(Calendar.MINUTE));\n\t\tString segundo = Integer.toString(c.get(Calendar.SECOND));\n\t\treturn hora+\":\"+minuto+\":\"+segundo+\" - \"+ dia+\"/\"+mes+\"/\"+\n\t\tanyo;\n\t}", "public void setFechaModificacion(String p) { this.fechaModificacion = p; }", "public void setFechaModificacion(String p) { this.fechaModificacion = p; }", "public void ComprarEdificio(int tipo){\n if(edificios[tipo].tipoCompra.equals(\"oro\")){\n if(aldea.oro >= edificios[tipo].precioCompraMejora()){\n if(aldea.constructoresLibres() > 0){\n // Bloquear constructor\n aldea.bloquearConstructor();\n // Obtener tiempo actual\n Date tiempo = new Date();\n // Gastar oro de edificio\n aldea.gastarOro(edificios[tipo].precioCompraMejora());\n // Construir edificio y obtener evento futuro de culminacion\n // Agregar evento a la LEF\n LEF.add(aldea.construirEdificio(tiempo, edificios[tipo]));\n jTextFieldOro.setText(String.valueOf((int)aldea.oro));\n }\n }\n }else{\n if(aldea.elixir >= edificios[tipo].precioCompraMejora()){\n if(aldea.constructoresLibres() > 0){\n // Bloquear constructor\n aldea.bloquearConstructor();\n // Obtener tiempo actual\n Date tiempo = new Date();\n // Gastar elixir de edificio\n aldea.gastarElixir(edificios[tipo].precioCompraMejora());\n // Construir edificio y obtener evento futuro\n // Agregar evento a la LEF\n LEF.add(aldea.construirEdificio(tiempo, edificios[tipo]));\n jTextFieldElixir.setText(String.valueOf((int)aldea.elixir));\n }\n }\n }\n }", "public boolean fechaSesionAnterior(String fechasesion)\r\n\t{\r\n\t\tboolean anterior = false;\r\n\t\tGregorianCalendar calendario = new GregorianCalendar();\r\n\t\tint añoactual = calendario.get(Calendar.YEAR);\r\n\t\tint mesactual = (calendario.get(Calendar.MONTH)+1);\r\n\t\tint diaactual = calendario.get(Calendar.DAY_OF_MONTH);\r\n\t\tString fechaactual = añoactual+\"-\"+mesactual+\"-\"+diaactual;\r\n\t\t\r\n\t\tint añosesion = 0;\r\n\t\tint messesion = 0;\r\n\t\tint diasesion = 0;\r\n\t\t\r\n\t\tString numerofecha = \"\";\r\n\t\tfor (int i = 0; i < (fechasesion.length()); i++) \r\n\t\t{\r\n\t\t\tchar digito = fechasesion.charAt(i);\r\n\t\t\tif(digito == '0' || digito == '1' || digito == '2' || digito == '3' || digito == '4' || digito == '5' || digito == '6' || digito == '7' || digito == '8' || digito == '9')\r\n\t\t\t{\r\n\t\t\t\tnumerofecha += digito;\r\n\t\t\t\tif((i+1) == (fechasesion.length()))\r\n\t\t\t\t{\r\n\t\t\t\t\tif(añosesion == 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tañosesion = Integer.parseInt(numerofecha);\r\n\t\t\t\t\t\tnumerofecha = \"\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(messesion == 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tmessesion = Integer.parseInt(numerofecha);\r\n\t\t\t\t\t\tnumerofecha = \"\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(diasesion == 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdiasesion = Integer.parseInt(numerofecha);\r\n\t\t\t\t\t\tnumerofecha = \"\";\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tif(añosesion == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tañosesion = Integer.parseInt(numerofecha);\r\n\t\t\t\t\tnumerofecha = \"\";\r\n\t\t\t\t}\r\n\t\t\t\telse if(messesion == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tmessesion = Integer.parseInt(numerofecha);\r\n\t\t\t\t\tnumerofecha = \"\";\r\n\t\t\t\t}\r\n\t\t\t\telse if(diasesion == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tdiasesion = Integer.parseInt(numerofecha);\r\n\t\t\t\t\tnumerofecha = \"\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif((añosesion) <= añoactual)\r\n\t\t{\r\n\t\t\tif((messesion) <= mesactual)\r\n\t\t\t{\r\n\t\t\t\tif((diasesion+3) <= diaactual)\r\n\t\t\t\t{\r\n\t\t\t\t\tanterior = true;\r\n\t\t\t\t}\t\r\n\t\t\t}\r\n\t\t}\t\t\r\n\t\treturn anterior;\r\n\t}", "public void anazitisiSintagisVaseiHmerominias() {\n\t\tDate firstDt = null, lastDt = null;\n\t\ttmp_2 = 0;\n\t\tif(numOfPrescription != 0)\n\t\t{\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.println(\" STOIXEIA SYNTAGWN\");\n\t\t\t// Emfanizw oles tis syntages\n\t\t\tfor(int j = 0; j < numOfPrescription; j++)\n\t\t\t{\n\t\t\t\tSystem.out.print(\"\\n \" + j + \". STOIXEIA SYNTAGHS: \");\n\t\t\t\tprescription[j].print();\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\t// Zitaw apo ton xrhsth to xroniko euros kata to opoio exei graftei sintagh\n\t\t\tfirstDt = sir.readDate(\"DWSTE ARXIKH HMEROMHNIA: \");\n\t\t\tlastDt = sir.readDate(\"DWSTE TELIKH HMEROMHNIA: \");\n\t\t\tSystem.out.println();\n\t\t\tfor(i = 0; i < numOfPrescription; i++)\n\t\t\t{\n\t\t\t\t// An h hmeromhnia eggrafhs ths syntaghs einai anamesa sta xronika oria pou exei dwsei o xrhsths ektypwnetai\n\t\t\t\tif(firstDt.before(prescription[i].getDate()) && (lastDt.after(prescription[i].getDate()))) \n\t\t\t\t{\n\t\t\t\t\tSystem.out.println();\n\t\t\t\t\tSystem.out.println(\"VRETHIKE SYNTAGH!\");\n\t\t\t\t\tprescription[i].print();\n\t\t\t\t\tSystem.out.println();\n\t\t\t\t\ttmp_2++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(tmp_2 == 0)\n\t\t\t{\n\t\t\t\tSystem.out.println();\n\t\t\t\tSystem.out.println(\"DEN YPARXEI SYNTAGH METAKSY:\" + firstDt + \" KAI: \" + lastDt);\n\t\t\t\tSystem.out.println();\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.println(\"DEN YPARXOUN DIATHESIMES SYNTAGES!\");\n\t\t\tSystem.out.println();\n\t\t}\n\t}", "public String procesarPrestamo(int carneEstudiante, String codigoLibro, Date fechaPrestamo, boolean validarCantidadCopias) {\n //PASO 1----------------------------------------------------------------------------------------------------\n if (!buscarEstudiante(carneEstudiante)) {\n return \"El estudiante no se encuentra registrado en el sistema\";\n } \n //PASO 2----------------------------------------------------------------------------------------------------\n else {\n if (comprobarLibrosPrestados(estudiante)) {\n return \"Se ha llegado al limite de prestamos por estudiante\";\n }\n //PASO 3---------------------------------------------------------------------------------------------------- \n else {\n if (!buscarLibro(codigoLibro)) {\n return \"El libro no se encuentra registrado en el sistema\";\n }\n //PASO 4---------------------------------------------------------------------------------------------------- \n else {\n if(validarCantidadCopias){\n \n if (!comprobarExistencias(libro)) {\n return \"Se han agotado las existencias del libro solicitado\"; \n }\n }\n //PASO 5---------------------------------------------------------------------------------------------------- \n fechaLimitePrestamo = manejadorFechas.sumarDias(fechaPrestamo,2); \n prestamo = new Prestamo(0,libro.getCodigo(), estudiante.getCarne(), fechaPrestamo, fechaLimitePrestamo,true, 0,0);\n guardarPrestamo(prestamo);\n agregarListado(estudiante, prestamo);\n if(validarCantidadCopias){\n disminuirCantidad(libro);\n }\n return \"Prestamo Realizado Exitosamente\"; \n } \n }\n }\n }", "public static String getUltimaFiesta() {\n Map<String, DiaFiestaMeta> diasFiestas;\n Iterator<String> itDiasFiestasMeta;\n SimpleDateFormat formatoDelTexto ;\n Map<String, Date> mapFiestaDia = new HashMap<>(); // \"uidFiesta:tituloDiaFiestaFormateado\"\n HashSet<Fiestas> fiestas;\n Date fechaMasReciente;\n String uidFiestaMasReciente;\n Iterator<String> itmapFiestaDia;\n\n Date date = new Date();\n formatoDelTexto = new SimpleDateFormat(\"dd MMMM yyyy\",new Locale(\"es\",\"ES\"));\n String strDate =formatoDelTexto.format(date);\n uidFiestaMasReciente =\"\";\n try {\n fechaMasReciente = formatoDelTexto.parse(\"15 Junio 1980\");\n } catch (ParseException e) {\n fechaMasReciente = new Date();\n e.printStackTrace();\n }\n fiestas = (HashSet) baseDatos.get(Tablas.Fiestas.name());\n for (Fiestas fiesta : fiestas){\n diasFiestas = fiesta.getDiasFiestas();\n itDiasFiestasMeta = diasFiestas.keySet().iterator();\n while (itDiasFiestasMeta.hasNext()){\n String keyDia = itDiasFiestasMeta.next();\n DiaFiestaMeta diaFiestaMeta = diasFiestas.get(keyDia);\n mapFiestaDia.put(fiesta.getUidFiestas(), formatearDia(diaFiestaMeta.getTituloDiaFiesta(), fiesta.getUidFiestas()));\n }\n }\n\n itmapFiestaDia = mapFiestaDia.keySet().iterator();\n while (itmapFiestaDia.hasNext()) {\n String key = itmapFiestaDia.next();\n Date fechaI = mapFiestaDia.get(key);\n if (fechaI.after(fechaMasReciente)) {\n uidFiestaMasReciente = key;\n fechaMasReciente = fechaI;\n }\n }\n return uidFiestaMasReciente;\n }", "public String reporteFinMesPre()\n\t{\n\t\tString m = new String();\n\t\tif(!this.clientes.isEmpty())\n\t\t{\n\t\t\tGregorianCalendar ff = new GregorianCalendar();\n\t\t\tCliente c = new Cliente();\n\t\t\tlong dur, durc, durt, totalcliente, totalcuenta, totalt;\n\t\t\tLLamada ll;\n\t\t\tCuenta p;\n\t\t\n\t\t\tListIterator<LLamada> itl;\n\t\t\tRecarga r;\n\t\t\tListIterator<Recarga> itr;\n\t\t\t\n\t\t\tSet<String> llaves = clientes.keySet();\n\t\t\tList<String> li = new ArrayList<String>(llaves);\n\t\t\tListIterator<String> it = li.listIterator();\n\t\t\tListIterator<Cuenta> cu;\n\t\t\tList<Cuenta> lista = new ArrayList<Cuenta>();\n\t\t\tList<Cliente> cli = new ArrayList<Cliente>();\n\t\t\tString s = new String();\n\t\t\t\n\t\t\twhile(it.hasNext())\n\t\t\t{\n\t\t\t\ts = it.next();\n\t\t\t\tif(clientes.get(s).tienePre())\n\t\t\t\t\tcli.add(clientes.get(s));\n\t\t\t}\n\t\t\t\n\t\t\tCollections.sort(cli, new CompararCedulasClientes());\n\n\t\t\t\n\t\t\tListIterator<Cliente> itc = cli.listIterator();\n\t\t\t\n\t\t\tList<LLamada> lisll = new ArrayList<LLamada>();\n\t\t\tList<Recarga> lisr = new ArrayList<Recarga>();\n\t\t\t\n\t\t\ttotalt = 0;\n\t\t\tdurt = 0;\n\t\t\twhile(itc.hasNext())\n\t\t\t{\n\t\t\t\ttotalcliente = 0;\n\t\t\t\tdurc = 0;\n\t\t\t\tc = itc.next();\n\t\t\t\tm += Utils.espacios(\"--CLIENTE: \", 12) + Utils.espacios(c.getNombre(), 15) + Utils.espacios(\", CC \",5) + Utils.espacios(String.valueOf(c.getCedula()), 10) + Utils.espacios(\", \", 3) + Utils.espacios(c.getDireccion(), 20) + \"\\n\";\n\t\t\t\t\n\t\t\t\tcu = c.getCuentas().listIterator(0);\n\t\t\t\tlista.clear();\n\t\t\t\twhile(cu.hasNext())\n\t\t\t\t{\n\t\t\t\t\tp = cu.next();\n\t\t\t\t\tif(p instanceof CuentaPrepago)\n\t\t\t\t\t\tlista.add(p);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tcu = lista.listIterator(0);\n\t\t\t\t\n\t\t\t\twhile(cu.hasNext())\n\t\t\t\t{\n\t\t\t\t\tp = cu.next();\n\t\t\t\t\tm += Utils.espacios(\" \", 4)+ Utils.espacios(\"Cuenta Postpago #\", 17) + Utils.espacios(String.valueOf(p.getId()), 5) + Utils.espacios(\": Num \", 6) + Utils.espacios(String.valueOf(p.getNumero()), 10) + Utils.espacios(\", Plan \", 7) + Utils.espacios(p.getPlan().getNombre(), 15) + \"\\n\\n\";\n\t\t\t\t\t//recargas\n\t\t\t\t\tm += Utils.espacios(\" \", 8) + Utils.espacios(\"Recargas: \", 11) + Utils.espacios(\"Fecha\", 15) + \"Valor\\n\";\n\t\t\t\t\ttotalcuenta = 0;\n\n\t\t\t\t\tlisr = ((CuentaPrepago)p).getRecargas();\n\t\t\t\t\tCollections.sort(lisll, new CompararRecargaFecha());\n\t\t\t\t\titr = lisr.listIterator(0);\n\t\t\t\t\t\n\t\t\t\t\twhile(itr.hasNext())\n\t\t\t\t\t{\n\t\t\t\t\t\tr = itr.next();\n\t\t\t\t\t\tif(r.getFechaRecarga().get(Calendar.MONTH) == ff.get(Calendar.MONTH) && r.getFechaRecarga().get(Calendar.YEAR) == ff.get(Calendar.YEAR))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tm += Utils.espacios(\" \", 19) + Utils.espacios(Utils.convertirFechaCadena(r.getFechaRecarga()), 15) + r.getValorRecarga() + \"\\n\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tm += Utils.espacios(\" \", 19) + Utils.espacios(\"TotalRecargas: ----------------------------\", 55) + Utils.espacios(String.valueOf(p.obtenerPagoCuenta(ff)),10) + \"\\n\";\n\n\t\t\t\t\t\n\n\t\t\t\t\ttotalcuenta += p.obtenerPagoCuenta(ff);\n\t\t\t\t\ttotalcliente += totalcuenta;\n\n\n\t\t\t\t\tm += Utils.espacios(\" \", 8) + Utils.espacios(\"Llamadas: \", 11)+ Utils.espacios(\"Fecha\", 15) + Utils.espacios(\"TelefonoDestinatario\", 21) + Utils.espacios(\"Duracion\",10 ) + Utils.espacios(\"Valor\", 8) +\"\\n\\n\";\n\t\t\t\t\tlisll = p.getLlamadas();\n\t\t\t\t\tCollections.sort(lisll, new CompararLLamadasFecha());\n\t\t\t\t\titl = lisll.listIterator(0);\n\t\t\t\t\t\n\t\t\t\t\ttotalcuenta = 0;\n\t\t\t\t\tdur =0;\n\t\t\t\t\twhile(itl.hasNext())\n\t\t\t\t\t{\n\t\t\t\t\t\tll = itl.next();\n\t\t\t\t\t\tif (ll.getFecha().get(Calendar.MONTH) == ff.get(Calendar.MONTH) && ll.getFecha().get(Calendar.YEAR) == ff.get(Calendar.YEAR))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttotalcuenta += ll.getValor();\n\t\t\t\t\t\t\tdur += ll.getDuracion();\n\t\t\t\t\t\t\tm += Utils.espacios(\" \",19) + Utils.espacios(Utils.convertirFechaCadena(ll.getFecha()), 16) + Utils.espacios(String.valueOf(ll.getTelefonoDestinatario()), 20) + Utils.espacios(String.valueOf(ll.getDuracion()), 10) + Utils.espacios(String.valueOf(ll.getValor()), 8) + \"\\n\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdurc += dur;\n\t\t\t\t\tm += Utils.espacios(\" \", 19) + Utils.espacios(\"TotalLLamadas: ----------------------------\", 55) + Utils.espacios(String.valueOf(dur),10) + totalcuenta + \"\\n\";\n\n\n\n\n\t\t\t\t}\n\t\t\t\ttotalt += totalcliente;\n\t\t\t\tdurt += durc;\n\t\t\t\tm += Utils.espacios(\" \",8) + Utils.espacios(\"Total Cliente: ----------------------------\", 66) + Utils.espacios(String.valueOf(durc),10) + totalcliente + \"\\n\\n\\n\";\n\t\t\t}\n\n\t\t\tm += Utils.espacios(\"TOTAL TODOS LOS CLIENTES: -----------------------\", 64) + Utils.espacios(\"Duracion: \" + String.valueOf(durt),20) + \"Valor: \"+totalt + \"\\n\" + \"\\n\";\n\t\t}\n\t\treturn m;\n\t}", "public void pintaFecha(){\n \tImage image;\r\n \ttry {\r\n\t \r\n \t\tString imageUrl = PropiedadesJLet.getInstance().getProperty(\"path.img.logoinvoice\") + \"FondoLeppardPico1.png\";\r\n\t\r\n\t\t\timage = Image.getInstance(imageUrl);\r\n\t\t image.setAbsolutePosition(inmargde-10, 725);\r\n\t\t image.scaleAbsolute(50,20);\r\n\t\t image.setAlignment(Image.LEFT | Image.TEXTWRAP);//Code 2\r\n\t\t\tdocumento.add(image);\r\n \r\n\t\t\tFRAparen.absTextBoldColor(writer,\"Fecha \",inmargde,730,10,new BaseColor(255,255,255));\r\n\t\t\tFRAparen.absText(writer,FRAparen.fechaNormal(fhfactur),inmargde + 45,730,10);\r\n\t\t\t\r\n\t\t\timage = Image.getInstance(imageUrl);\r\n\t\t image.setAbsolutePosition(inmargde-10, 700);\r\n\t\t image.scaleAbsolute(100,20);\r\n\t\t image.setAlignment(Image.LEFT | Image.TEXTWRAP);//Code 2\r\n\t\t\tdocumento.add(image);\r\n\t\t\t\r\n\t\t\tif (cabecNFC.equals(\"COND\") || cabecNFC.equals(\"R\")){\r\n\t\t\t\tFRAparen.absTextBoldColor(writer,cabecNFC +\" \"+ numerNFC +\" \",inmargde,705,10,new BaseColor(255,255,255));\r\n\t\t\t} else {\r\n\t\t\t\tFRAparen.absTextBoldColor(writer,\"NFC \"+ cabecNFC +\" \"+ numerNFC +\" \",inmargde,705,10,new BaseColor(255,255,255));\r\n\t\t\t}\r\n\t\t\t\r\n \t} catch (Exception e) {\r\n \t\tSystem.err.println(this.getClass().getName() +\" ERROR pintaFecha() - \"+ e.getMessage());\r\n \t}\r\n \t\r\n }", "public void buscarModificadosDespues(String fecha,File donde) throws ParseException\r\n\t{\n\t\tthis.donde=donde;\r\n\t\tFile f;\r\n\t\tif(!this.donde.isDirectory())\r\n\t\t\treturn;\r\n\t\tFile[]lista=this.donde.listFiles();\r\n\t\tfor(int i=0;i<lista.length;i++)\r\n\t\t{\r\n\t\t\tif(lista[i].isDirectory())\r\n\t\t\t{\r\n\t\t\t\tf=new File(lista[i].getAbsolutePath());\r\n\t\t\t\tbuscarModificadosDespues(fecha,f);\r\n\t\t\t}\r\n\t\t\tlong l;\r\n\t\t\tSimpleDateFormat formato = new SimpleDateFormat(\"dd-MM-yyyy\");\r\n\t\t\tDate d=formato.parse(fecha);\r\n\t\t\tl=d.getTime();\r\n\t\t\tif(lista[i].lastModified()>=l)\r\n\t\t\t{\r\n\t\t\t\tencontrados.add(lista[i]);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private void inizia() throws Exception {\n /* variabili e costanti locali di lavoro */\n Campo campoDataInizio;\n Campo campoDataFine;\n Campo campoConto;\n Date dataIniziale;\n Date dataFinale;\n int numPersone;\n ContoModulo modConto;\n\n\n String titolo = \"Esecuzione addebiti fissi\";\n AddebitoFissoPannello pannello;\n Date dataInizio;\n Pannello panDate;\n Campo campoStato;\n Filtro filtro;\n int codConto;\n int codCamera;\n\n\n try { // prova ad eseguire il codice\n\n /* recupera dati generali */\n modConto = Albergo.Moduli.Conto();\n codConto = this.getCodConto();\n codCamera = modConto.query().valoreInt(Conto.Cam.camera.get(), codConto);\n numPersone = CameraModulo.getNumLetti(codCamera);\n\n /* crea il pannello servizi e vi registra la camera\n * per avere l'anteprima dei prezzi*/\n pannello = new AddebitoFissoPannello();\n this.setPanServizi(pannello);\n pannello.setNumPersone(numPersone);\n this.setTitolo(titolo);\n\n// /* regola date suggerite */\n// dataFinale = Progetto.getDataCorrente();\n// dataInizio = Lib.Data.add(dataFinale, -1);\n\n /* pannello date */\n campoDataInizio = CampoFactory.data(nomeDataIni);\n campoDataInizio.decora().obbligatorio();\n// campoDataInizio.setValore(dataInizio);\n\n campoDataFine = CampoFactory.data(nomeDataFine);\n campoDataFine.decora().obbligatorio();\n// campoDataFine.setValore(dataFinale);\n\n /* conto */\n campoConto = CampoFactory.comboLinkSel(nomeConto);\n campoConto.setNomeModuloLinkato(Conto.NOME_MODULO);\n campoConto.setLarScheda(180);\n campoConto.decora().obbligatorio();\n campoConto.decora().etichetta(\"conto da addebitare\");\n campoConto.setUsaNuovo(false);\n campoConto.setUsaModifica(false);\n\n /* inizializza e assegna il valore (se non inizializzo\n * il combo mi cambia il campo dati e il valore si perde)*/\n campoConto.inizializza();\n campoConto.setValore(this.getCodConto());\n\n /* filtro per vedere solo i conti aperti dell'azienda corrente */\n campoStato = modConto.getCampo(Conto.Cam.chiuso.get());\n filtro = FiltroFactory.crea(campoStato, false);\n filtro.add(modConto.getFiltroAzienda());\n campoConto.getCampoDB().setFiltroCorrente(filtro);\n\n panDate = PannelloFactory.orizzontale(this.getModulo());\n panDate.creaBordo(\"Periodo da addebitare\");\n panDate.add(campoDataInizio);\n panDate.add(campoDataFine);\n panDate.add(campoConto);\n\n this.addPannello(panDate);\n this.addPannello(this.getPanServizi());\n\n this.regolaCamera();\n\n /* recupera la data iniziale (oggi) */\n dataIniziale = AlbergoLib.getDataProgramma();\n\n /* recupera la data di partenza prevista dal conto */\n modConto = ContoModulo.get();\n dataFinale = modConto.query().valoreData(Conto.Cam.validoAl.get(),\n this.getCodConto());\n\n /* recupera il numero di persone dal conto */\n numPersone = modConto.query().valoreInt(Conto.Cam.numPersone.get(),\n this.getCodConto());\n\n /* regola date suggerite */\n campoDataInizio = this.getCampo(nomeDataIni);\n campoDataInizio.setValore(dataIniziale);\n\n campoDataFine = this.getCampo(nomeDataFine);\n campoDataFine.setValore(dataFinale);\n\n /* conto */\n campoConto = this.getCampo(nomeConto);\n campoConto.setAbilitato(false);\n\n /* regola la data iniziale di riferimento per l'anteprima dei prezzi */\n Date data = (Date)campoDataInizio.getValore();\n this.getPanServizi().setDataPrezzi(data);\n\n /* regola il numero di persone dal conto */\n this.getPanServizi().setNumPersone(numPersone);\n\n\n } catch (Exception unErrore) { // intercetta l'errore\n Errore.crea(unErrore);\n }// fine del blocco try-catch\n }", "public boolean modificar(DueñoMascota pro) {\n PreparedStatement ps = null;\n Connection con = getConexion();\n\n \n String sql = \"UPDATE datos SET nom_dueño=?, ap_dueño=?, tel=?,nom_mascota=?,observaciones=? WHERE id_datos=? \";\n\n try {\n ps = con.prepareStatement(sql);\n // ps.setInt(1, pro.getId()); //NÚMERe almacena\n ps.setString(1, pro.getNomDueño());\n ps.setString(2, pro.getApDueño());\n ps.setInt(3, pro.getTel());\n ps.setString(4, pro.getNomMascota());\n ps.setString(5, pro.getObservaciones());\n ps.setInt(6, pro.getId());\n ps.execute();\n ps.close();\n return true;\n } catch (SQLException e) {\n System.err.println(e);\n return false;\n } finally {\n try {\n con.close();\n } catch (SQLException e) {\n System.err.println(e);\n }\n }\n }", "public void liquidarEmpleado(Fecha fechaLiquidacion) {\n //COMPLETE\n double prima=0; \n boolean antiguo=false;\n double aniosEnServicio=fechaLiquidacion.getAnio()-this.fechaIngreso.getAnio();\n if(aniosEnServicio>0&&\n fechaLiquidacion.getMes()>this.fechaIngreso.getMes())\n aniosEnServicio--; \n \n //System.out.println(\"A:\"+aniosEnServicio+\":\"+esEmpleadoLiquidable(fechaLiquidacion));\n if(esEmpleadoLiquidable(fechaLiquidacion)){\n this.descuentoSalud=salarioBase*0.04;\n this.descuentoPension=salarioBase*0.04;\n this.provisionCesantias=salarioBase/12;\n if(fechaLiquidacion.getMes()==12||fechaLiquidacion.getMes()==6)\n prima+=this.salarioBase*0.5; \n if(aniosEnServicio<6&&\n fechaLiquidacion.getMes()==this.fechaIngreso.getMes())prima+=((aniosEnServicio*5)/100)*this.salarioBase;\n if(aniosEnServicio>=6&&fechaLiquidacion.getMes()==this.fechaIngreso.getMes()) prima+=this.salarioBase*0.3;\n\n this.prima=prima;\n this.setIngresos(this.salarioBase+prima);\n \n this.setDescuentos(this.descuentoSalud+this.descuentoPension);\n this.setTotalAPagar(this.getIngresos()-this.getDescuentos());\n }\n\n }", "private void procurarData() {\n if (jDateIni.getDate() != null && jDateFim.getDate() != null) {\n SimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd\");\n String data = sdf.format(jDateIni.getDate());\n String data2 = sdf.format(jDateFim.getDate());\n carregaTable(id, data, data2);\n JBreg.setEnabled(false);\n }\n }", "public void fechahoy(){\n Date fecha = new Date();\n \n Calendar c1 = Calendar.getInstance();\n Calendar c2 = new GregorianCalendar();\n \n String dia = Integer.toString(c1.get(Calendar.DATE));\n String mes = Integer.toString(c2.get(Calendar.MONTH));\n int mm = Integer.parseInt(mes);\n int nmes = mm +1;\n String memes = String.valueOf(nmes);\n if (nmes < 10) {\n memes = \"0\"+memes;\n }\n String anio = Integer.toString(c1.get(Calendar.YEAR));\n \n String fechoy = anio+\"-\"+memes+\"-\"+dia;\n \n txtFecha.setText(fechoy);\n \n }", "public void FermerAgd() {\n //on essaye d'ouvrir un fichier dans lequel enregistrer le contenu de l'agenda\n try {\n Formatter agd_a_enreg = new Formatter(\"C:\\\\Projet_Agenda_ING3\\\\saved_agendas\");\n\n for (RdV el : this.getAgenda()) {\n //on enregistre 1 rdv par ligne\n //faire gaffe aux formats : %..\n agd_a_enreg.format(\"%s/%s/%s de %s a %s : %s , %s\\n\",\n el.getDate().getDayOfMonth(), el.getDate().getMonthValue(),\n el.getDate().getYear(), el.getHdebut(),\n el.getHfin(), el.getLibelle(), el.getRappel());\n //on supprime le rdv de l'arraylist d'agenda \n this.suppressionRdV(el);\n }\n //on ferme le fichier en ecriture\n agd_a_enreg.close();\n //on met l'attribut agenda à null une fois qu'il est \"vidé\"\n this.agd = null;\n } //en cas de probleme dans l'ouverture du fichier on affiche une erreur\n catch (Exception e) {\n System.out.print(\"Erreur d'ouverture du fichier en ecriture\\n\");\n }\n\n }", "private void creaAddebitiGiornoConto(Date data, int codConto) {\n /* variabili e costanti locali di lavoro */\n boolean continua;\n Filtro filtro;\n int[] interi;\n ArrayList<Integer> codici = null;\n Modulo modAddFisso;\n Modulo modConto;\n boolean chiuso;\n\n try { // prova ad eseguire il codice\n\n /* controllo se il conto e' aperto */\n modConto = Albergo.Moduli.Conto();\n chiuso = modConto.query().valoreBool(Conto.Cam.chiuso.get(), codConto);\n continua = (!chiuso);\n\n if (continua) {\n\n /* filtro che isola gli addebiti fissi da eseguire\n * per il giorno e il conto dati */\n filtro = this.getFiltroFissiGiornoConto(data, codConto);\n continua = filtro != null;\n\n /* crea elenco dei codici addebito fisso da elaborare */\n if (continua) {\n modAddFisso = Albergo.Moduli.AddebitoFisso();\n interi = modAddFisso.query().valoriChiave(filtro);\n codici = Lib.Array.creaLista(interi);\n }// fine del blocco if\n\n /* crea un addebito effettivo per ogni addebito fisso */\n if (codici != null) {\n for (int cod : codici) {\n this.creaSingoloAddebito(cod, data);\n } // fine del ciclo for-each\n }// fine del blocco if\n\n }// fine del blocco if\n\n\n } catch (Exception unErrore) { // intercetta l'errore\n Errore.crea(unErrore);\n }// fine del blocco try-catch\n }", "private String getFechaLab(int intCodEmp, int intCodLoc){\n String strFecha=\"\"; \n java.sql.Connection conLoc;\n try{\n conLoc=DriverManager.getConnection(objParSis.getStringConexion(),objParSis.getUsuarioBaseDatos(),objParSis.getClaveBaseDatos());\n if(conLoc!=null){\n java.sql.Statement stmLoc = conLoc.createStatement();\n strSql=\"\";\n strSql+=\" SELECT a1.* \";\n strSql+=\" FROM tbm_calCiu as a1 \";\n strSql+=\" INNER JOIN tbm_loc as a2 ON (a1.co_ciu=a2.co_ciu) \";\n strSql+=\" WHERE a2.co_emp=\"+intCodEmp+\" and co_loc=\"+intCodLoc+\" AND CASE WHEN EXTRACT(MONTH from CURRENT_DATE)=12 THEN \";\n strSql+=\" (EXTRACT(YEAR from CURRENT_DATE)+1)=EXTRACT(YEAR from a1.fe_Dia) AND /*MES ENERO JM*/1=EXTRACT(MONTH from a1.fe_Dia) ELSE \";\n strSql+=\" EXTRACT(YEAR from CURRENT_DATE)=EXTRACT(YEAR from a1.fe_Dia) AND (EXTRACT(MONTH from CURRENT_DATE)+1)=EXTRACT(MONTH from a1.fe_Dia) END AND a1.tx_tipDia='L' \";\n strSql+=\" ORDER BY a1.fe_dia ASC\t\";\n strSql+=\" LIMIT 1\";\n \tjava.sql.ResultSet rstLoc = stmLoc.executeQuery(strSql);\n if(rstLoc.next()){\n //System.out.println(\"fecha \" + rstLoc.getString(\"fe_dia\"));\n strFecha=objUti.formatearFecha(rstLoc.getString(\"fe_dia\"), \"yyyy-MM-dd\",\"dd/MM/yyyy\" );\n //System.out.println(\"strFecha \" + strFecha);\n }\n rstLoc.close();\n rstLoc=null;\n stmLoc.close();\n stmLoc=null;\n }\n conLoc.close();\n conLoc=null;\n }\n catch (java.sql.SQLException e){\n objUti.mostrarMsgErr_F1(this, e);\n }\n catch (Exception e){\n objUti.mostrarMsgErr_F1(this, e);\n }\n return strFecha;\n }", "public void enviarConviteExame(LocalDate dataExame) {\n }", "private void validarhorarioconotroshorariosactivos(HorarioAsignado horarioasignado, List<HorarioAsignado> horarios) throws LogicaException, ParseException, DatoException {\nGregorianCalendar startasignado=new GregorianCalendar();\nDate startdateasignado= new Date(horarioasignado.getValidezinicio().getTime());\nstartasignado.setTime(startdateasignado);\nGregorianCalendar endasignado=new GregorianCalendar();\nDate enddateasignado= new Date(horarioasignado.getValidezfin().getTime());\nendasignado.setTime(enddateasignado);\n\nint tempfrecasignado = horarioasignado.getHorario().getIdfrecuenciaasignacion().intValue();\nList<Integer> diadelasemanaasignado = diadelasemana(tempfrecasignado);\nList<HashMap<String, Object>> dataasignado = Util.diferenciaEnDiasconFrecuencia(startasignado, endasignado,diadelasemanaasignado,tempfrecasignado);\n\n\n\n\nfor(HorarioAsignado ho:horarios){\n\t\t\tif(ho.getIdhorarioasignado().equals(horarioasignado.getIdhorarioasignado())){\n\t\t\t\n\t\t\t}else{\n\t\t\tif(ho.getIdhorario()==horarioasignado.getIdhorario()){\n\t\t\t\n\t\t\t/*//cedulasconhorarios.add(em);\n\t\t\tif (horarioasignado.getValidezinicio().after(ho.getValidezinicio()) && horarioasignado.getValidezinicio().before(ho.getValidezfin())){\n\t\t\tthrow new LogicaException(\"este contrato ya tiene asociado ese horario\"\n\t\t\t+ \" entre las fechas \"+ho.getValidezinicio()+\" y \"+ ho.getValidezfin());\n\t\t\t\n\t\t\t}*/\n\t\t\t\n\t\t\t}else{\n\t\t\t\n\t\t\t}\n\n\t\tContrato contrato = contratoEJB.getContratosporId(ho.getIdcontrato());\n\t\tEmpleadoBean empleado = empleadoEJB.buscarEmpleadosporId(contrato.getIdempleado());\t\n\tGregorianCalendar start=new GregorianCalendar();\n\tDate startdate= new Date(ho.getValidezinicio().getTime());\n\tstart.setTime(startdate);\n\tGregorianCalendar end=new GregorianCalendar();\n\tDate enddate= new Date(ho.getValidezfin().getTime());\n\tend.setTime(enddate);\n\t\n\tint tempfrec = ho.getHorario().getIdfrecuenciaasignacion().intValue();\n\tList<Integer> diadelasemana = diadelasemana(tempfrec);\n\tList<HashMap<String, Object>> data = Util.diferenciaEnDiasconFrecuencia(start, end,diadelasemana,tempfrec);\n\t\n\t\t\t\t\tfor(HashMap<String, Object> diadehorario:data){\n\t\t\t\tHashMap<String, Object> horariofechas=new HashMap<String, Object>();\n\t\t\t\tGregorianCalendar fecha = (GregorianCalendar)diadehorario.get(\"fecha\");\n\t\t\t\tDate fechadat =fecha.getTime();\n\t\t\t\tGregorianCalendar fechafin = (GregorianCalendar)diadehorario.get(\"fechafin\");\n\t\t\t\tDate fechafindat = fechafin.getTime();\n\t\t\t\tfor(HashMap<String, Object> diaasignado:dataasignado){\n\t\t\t\t\t\tHashMap<String, Object> horariofechasasignadas=new HashMap<String, Object>();\n\t\t\t\t\t\tGregorianCalendar fechaasignada = (GregorianCalendar)diaasignado.get(\"fecha\");\n\t\t\t\t\t\tDate fechaasignadadat =fechaasignada.getTime();\n\t\t\t\t\t\tGregorianCalendar fechafinasignada = (GregorianCalendar)diaasignado.get(\"fechafin\");\n\t\t\t\t\t\tDate fechafinasignadadat = fechafinasignada.getTime();\n\t\t\t\t\t\t\t\t\tif(fechaasignada.after(fechafin)){\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\t}else{\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\tif((fechaasignada.getTime().after(fecha.getTime())||fechaasignada.getTime().equals(fecha.getTime())) && fechaasignada.getTime().before(fechafin.getTime()) ){\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t//\tif((fechaasignada.getTime().after(fecha.getTime()) && fechaasignada.getTime().before(fechafin.getTime())) ){\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\tthrow new LogicaException(\"Este contrato del empleado con identificación numero:\"+empleado.getEmpleadoidentificacion().getNumeroidentificacion() +\" ya tiene asociado un horario\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t+ \" en las fechas \"+Util.dateToString(fecha.getTime(), \"dd/MM/yyyy HH:mm\") +\" y \"+ Util.dateToString(fechafin.getTime(),\"dd/MM/yyyy HH:mm\")+\" debe seleccionar un rango de dias diferente o un horario diferente\");\n\t\t\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tif((fechafinasignada.getTime().after(fecha.getTime())||fechafinasignada.getTime().equals(fecha.getTime())) && fechafinasignada.getTime().before(fechafin.getTime()) ){\n\t\t\t\t\t\t\t\t\t\t\t\tthrow new LogicaException(\"Este contrato del empleado con identificación numero:\"+empleado.getEmpleadoidentificacion().getNumeroidentificacion() +\" ya tiene asociado un horario\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t+ \" en las fechas \"+Util.dateToString(fecha.getTime(), \"dd/MM/yyyy HH:mm\")+\" y \"+ Util.dateToString(fechafin.getTime(),\"dd/MM/yyyy HH:mm\")+\" debe seleccionar un rango de dias diferente o un horario diferente\");\n\t\t\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\tif((fecha.getTime().after(fechaasignada.getTime() ) && fecha.getTime().before(fechafinasignada.getTime())) ){\n\t\t\t\t\t\t\t\t\t\t\t\tthrow new LogicaException(\"Este contrato del empleado con identificación numero:\"+empleado.getEmpleadoidentificacion().getNumeroidentificacion() +\" ya tiene asociado un horario\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t+ \" en las fechas \"+Util.dateToString(fecha.getTime(), \"dd/MM/yyyy HH:mm\")+\" y \"+ Util.dateToString(fechafin.getTime(),\"dd/MM/yyyy HH:mm\")+\" debe seleccionar un rango de dias diferente o un horario diferente\");\n\t\t\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tif((fechafin.getTime().after(fechaasignada.getTime() ) && fechafin.getTime().before(fechafinasignada.getTime())) ){\n\t\t\t\t\t\t\t\t\t\t\t\tthrow new LogicaException(\"Este contrato del empleado con identificación numero:\"+empleado.getEmpleadoidentificacion().getNumeroidentificacion() +\" ya tiene asociado un horario\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t+ \" en las fechas \"+Util.dateToString(fecha.getTime(), \"dd/MM/yyyy HH:mm\")+\" y \"+ Util.dateToString(fechafin.getTime(),\"dd/MM/yyyy HH:mm\")+\" debe seleccionar un rango de dias diferente o un horario diferente\");\n\t\t\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\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\t}\n\t\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t}\n\n}\n\n\n}\n\n\n/////////////////////////fin validacion/\n}", "private void fechaActual() {\r\n\t\tDate date = new Date();\r\n\t\tSimpleDateFormat sm = new SimpleDateFormat(\"yyyy-MM-dd hh:mm:ss\");\r\n\t\t// Formateo de Fecha para mostrar en la vista - (String)\r\n\t\tsetFechaCreacion(sm.format(date.getTime()));\r\n\t\t// Formateo de Fecha campo db - (Date)\r\n\t\ttry {\r\n\t\t\tnewEntidad.setFechaCreacion(sm.parse(getFechaCreacion()));\r\n\t\t} catch (ParseException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\t;\r\n\t}", "public boolean fechaVigente(String fechafinal, String horafinal)\r\n\t{\r\n\t\tboolean vigente = true;\r\n\t\tGregorianCalendar calendario = new GregorianCalendar();\r\n\t\tint añoactual = calendario.get(Calendar.YEAR);\r\n\t\tint mesactual = (calendario.get(Calendar.MONTH)+1);\r\n\t\tint diaactual = calendario.get(Calendar.DAY_OF_MONTH);\r\n\t\tString fechaactual = añoactual+\"-\"+mesactual+\"-\"+diaactual;\r\n\t\tint horasactuales = calendario.get(Calendar.HOUR_OF_DAY);\r\n\t\tint minutosactuales = calendario.get(Calendar.MINUTE);\r\n\t\tint segundosactuales = calendario.get(Calendar.SECOND);\r\n\t\tString horaactual = horasactuales+\":\"+minutosactuales+\":\"+segundosactuales;\r\n\t\t\r\n\t\tint añofinal = 0;\r\n\t\tint mesfinal = 0;\r\n\t\tint diafinal = 0;\r\n\t\t\r\n\t\tint horasfinales = 0;\r\n\t\tint minutosfinales = 0;\r\n\t\tint segundosfinales = 0;\r\n\r\n\t\tString numerofecha = \"\";\r\n\t\tfor (int i = 0; i < (fechafinal.length()); i++) \r\n\t\t{\r\n\t\t\tchar digito = fechafinal.charAt(i);\r\n\t\t\tif(digito == '0' || digito == '1' || digito == '2' || digito == '3' || digito == '4' || digito == '5' || digito == '6' || digito == '7' || digito == '8' || digito == '9')\r\n\t\t\t{\r\n\t\t\t\tnumerofecha += digito;\r\n\t\t\t\tif((i+1) == (fechafinal.length()))\r\n\t\t\t\t{\r\n\t\t\t\t\tif(añofinal == 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tañofinal = Integer.parseInt(numerofecha);\r\n\t\t\t\t\t\tnumerofecha = \"\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(mesfinal == 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tmesfinal = Integer.parseInt(numerofecha);\r\n\t\t\t\t\t\tnumerofecha = \"\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(diafinal == 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdiafinal = Integer.parseInt(numerofecha);\r\n\t\t\t\t\t\tnumerofecha = \"\";\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tif(añofinal == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tañofinal = Integer.parseInt(numerofecha);\r\n\t\t\t\t\tnumerofecha = \"\";\r\n\t\t\t\t}\r\n\t\t\t\telse if(mesfinal == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tmesfinal = Integer.parseInt(numerofecha);\r\n\t\t\t\t\tnumerofecha = \"\";\r\n\t\t\t\t}\r\n\t\t\t\telse if(diafinal == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tdiafinal = Integer.parseInt(numerofecha);\r\n\t\t\t\t\tnumerofecha = \"\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tString numerohora = \"\";\r\n\t\tfor (int i = 0; i < (horafinal.length()); i++) \r\n\t\t{\r\n\t\t\tchar digito = horafinal.charAt(i);\r\n\t\t\tif(digito == '0' || digito == '1' || digito == '2' || digito == '3' || digito == '4' || digito == '5' || digito == '6' || digito == '7' || digito == '8' || digito == '9')\r\n\t\t\t{\r\n\t\t\t\tnumerohora += digito;\r\n\t\t\t\tif((i+1) == (horafinal.length()))\r\n\t\t\t\t{\r\n\t\t\t\t\tif(horasfinales == 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\thorasfinales = Integer.parseInt(numerohora);\r\n\t\t\t\t\t\tnumerohora = \"\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(minutosfinales == 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tminutosfinales = Integer.parseInt(numerohora);\r\n\t\t\t\t\t\tnumerohora = \"\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(segundosfinales == 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tsegundosfinales = Integer.parseInt(numerohora);\r\n\t\t\t\t\t\tnumerohora = \"\";\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tif(horasfinales == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\thorasfinales = Integer.parseInt(numerohora);\r\n\t\t\t\t\tnumerohora = \"\";\r\n\t\t\t\t}\r\n\t\t\t\telse if(minutosfinales == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tminutosfinales = Integer.parseInt(numerohora);\r\n\t\t\t\t\tnumerohora = \"\";\r\n\t\t\t\t}\r\n\t\t\t\telse if(segundosfinales == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tsegundosfinales = Integer.parseInt(numerohora);\r\n\t\t\t\t\tnumerohora = \"\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tString fechafinal2 = añofinal+\"-\"+mesfinal+\"-\"+diafinal;\r\n\t\tString horafinal2 = horasfinales+\":\"+minutosfinales+\":\"+segundosfinales;\r\n\t\tif(añoactual >= añofinal)\r\n\t\t{\r\n\t\t\tif(mesactual >= mesfinal)\r\n\t\t\t{\r\n\t\t\t\tif(diaactual >= diafinal)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(horasactuales >= horasfinales)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(minutosactuales >= minutosfinales)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tvigente = false;\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}\r\n\t\treturn vigente;\r\n\t}", "@Test(priority=4)\n\tpublic void validatePredictNiftyInContestPage3()\n\t{\n\t\tAssert.assertTrue(c.openForParticipationTitile.getText().equalsIgnoreCase(\"Open For Participation\"));\n\t/*\tDate date = new Date();\n\t\tSimpleDateFormat formatter = new SimpleDateFormat(\"dd MMM\");\n\t\tString strDate = formatter.format(date);*/\n\t\tCalendar calendar = Calendar.getInstance();\n\t\tcalendar.add(Calendar.DATE, 1);\n\t\tDate date1 = calendar.getTime();\n\t\tFormat formatter1= new SimpleDateFormat(\"dd MMM\");\n\t\tString tomDate = formatter1.format(date1);\n\t\tSoftAssert s=new SoftAssert();\n\t\ts.assertTrue(c.dateForOpenForParticipation.getText().equals(tomDate.split(\" \")[0]));\n\t\ts.assertTrue(c.monthForOpenForParticipation.getText().equals(tomDate.split(\" \")[1]));\n\t\ts.assertAll();\n\t}", "private int creaSingoloAddebito(int cod, Date data) {\n /* variabili e costanti locali di lavoro */\n int nuovoRecord = 0;\n boolean continua;\n Dati dati;\n int codConto = 0;\n int codListino = 0;\n int quantita = 0;\n double prezzo = 0.0;\n Campo campoConto = null;\n Campo campoListino = null;\n Campo campoQuantita = null;\n Campo campoPrezzo = null;\n Campo campoData = null;\n Campo campoFissoConto = null;\n Campo campoFissoListino = null;\n Campo campoFissoQuantita = null;\n Campo campoFissoPrezzo = null;\n ArrayList<CampoValore> campi = null;\n Modulo modAddebito = null;\n Modulo modAddebitoFisso = null;\n\n try { // prova ad eseguire il codice\n\n modAddebito = Progetto.getModulo(Addebito.NOME_MODULO);\n modAddebitoFisso = Progetto.getModulo(AddebitoFisso.NOME_MODULO);\n\n /* carica tutti i dati dall'addebito fisso */\n dati = modAddebitoFisso.query().caricaRecord(cod);\n continua = dati != null;\n\n /* recupera i campi da leggere e da scrivere */\n if (continua) {\n\n /* campi del modulo Addebito Fisso (da leggere) */\n campoFissoConto = modAddebitoFisso.getCampo(Addebito.Cam.conto.get());\n campoFissoListino = modAddebitoFisso.getCampo(Addebito.Cam.listino.get());\n campoFissoQuantita = modAddebitoFisso.getCampo(Addebito.Cam.quantita.get());\n campoFissoPrezzo = modAddebitoFisso.getCampo(Addebito.Cam.prezzo.get());\n\n /* campi del modulo Addebito (da scrivere) */\n campoConto = modAddebito.getCampo(Addebito.Cam.conto.get());\n campoListino = modAddebito.getCampo(Addebito.Cam.listino.get());\n campoQuantita = modAddebito.getCampo(Addebito.Cam.quantita.get());\n campoPrezzo = modAddebito.getCampo(Addebito.Cam.prezzo.get());\n campoData = modAddebito.getCampo(Addebito.Cam.data.get());\n\n }// fine del blocco if\n\n /* legge i dati dal record di addebito fisso */\n if (continua) {\n codConto = dati.getIntAt(campoFissoConto);\n codListino = dati.getIntAt(campoFissoListino);\n quantita = dati.getIntAt(campoFissoQuantita);\n prezzo = (Double)dati.getValueAt(0, campoFissoPrezzo);\n dati.close();\n }// fine del blocco if\n\n /* crea un nuovo record in addebito */\n if (continua) {\n campi = new ArrayList<CampoValore>();\n campi.add(new CampoValore(campoConto, codConto));\n campi.add(new CampoValore(campoListino, codListino));\n campi.add(new CampoValore(campoQuantita, quantita));\n campi.add(new CampoValore(campoPrezzo, prezzo));\n campi.add(new CampoValore(campoData, data));\n nuovoRecord = modAddebito.query().nuovoRecord(campi);\n continua = nuovoRecord > 0;\n }// fine del blocco if\n\n /* aggiorna la data di sincronizzazione in addebito fisso */\n if (continua) {\n this.getModulo().query().registraRecordValore(cod, Cam.dataSincro.get(), data);\n }// fine del blocco if\n\n } catch (Exception unErrore) { // intercetta l'errore\n Errore.crea(unErrore);\n }// fine del blocco try-catch\n\n /* valore di ritorno */\n return nuovoRecord;\n }", "public static Fecha IngresarFecha(){\n int diaIngreso, mesIngreso,anioIngreso;\r\n Fecha fechaIngreso = null;\r\n boolean condicion=false;\r\n \r\n do {\r\n System.out.println(\"Ingrese una fecha.\\n\"\r\n + \"Ingrese Dia: \");\r\n diaIngreso = TecladoIn.readInt();\r\n System.out.println(\"Ingrese el Mes: \");\r\n mesIngreso = TecladoIn.readLineInt();\r\n System.out.println(\"Ingrese el año: \");\r\n anioIngreso = TecladoIn.readInt();\r\n if (Validaciones.esValidoDatosFecha(diaIngreso, mesIngreso, anioIngreso)) {\r\n fechaIngreso = new Fecha(diaIngreso, mesIngreso, anioIngreso);\r\n \r\n condicion = true;\r\n } else {\r\n System.out.println(\"...........................................\");\r\n System.out.println(\"Ingrese Una Fecha Correcta: Dia/Mes/Año\");\r\n System.out.println(\"...........................................\");\r\n }\r\n } while (condicion != true);\r\n \r\n return fechaIngreso;}", "public static String textoMensajeMail(String apellido,String nombreActividad, String expediente, \r\n\t\t\tString fechaVencimiento, int modo)\r\n\t{\n\t\tString texto =\"\";\r\n\t\tif (modo==1)\r\n\t\t{\r\n\t\t\ttexto = \"Estimado Doc. \"+apellido+\":\\n\" + \" La actividad procesal: \" + nombreActividad +\r\n\t\t\t\t\t\" del expediente: \" + expediente + \", esta proxima a vencer el dia \" + fechaVencimiento +\r\n\t\t\t\t\t\"\\n\\nPor favor tomar las medidas del caso.\" + \r\n\t\t\t\t\t\"\\n\\nAtte.\" + \r\n\t\t\t\t\t\"\\n\" +\r\n\t\t\t\t\t\"\\nSISTEMA DE GESTION LEGAL\";\r\n\t\t}\r\n\t\tif (modo==2)\r\n\t\t{\r\n\t\t\ttexto = \"Estimado Doc. \"+apellido+\":\\n\" + \" La actividad procesal: \" + nombreActividad +\r\n\t\t\t\t\t\" del expediente: \" + expediente + \" ha cambiado. La nueva Fecha de Vencimiento es: \" +\r\n\t\t\t\t\tfechaVencimiento +\r\n\t\t\t\t\t\"\\n\\nPor favor tomar las medidas del caso.\" + \r\n\t\t\t\t\t\"\\n\\nAtte.\" + \r\n\t\t\t\t\t\"\\n\" +\r\n\t\t\t\t\t\"\\nSISTEMA DE GESTION LEGAL\";\r\n\t\t}\r\n\t\tif (modo==3)\r\n\t\t{\r\n\t\t\ttexto = \"Estimado Doc. \"+apellido+\":\\n\" + \" La actividad procesal: \" + nombreActividad +\r\n\t\t\t\t\t\" del expediente: \" + expediente + \" ha vencido.\" +\r\n\t\t\t\t\t\"\\n\\nPor favor tomar las medidas del caso.\" + \r\n\t\t\t\t\t\"\\n\\nAtte.\" + \r\n\t\t\t\t\t\"\\n\" +\r\n\t\t\t\t\t\"\\nSISTEMA DE GESTION LEGAL\";\r\n\t\t}\r\n\t\treturn texto;\r\n\t}", "private AtualizarContaPreFaturadaHelper parserRegistroTipo1(String linha) {\r\n\t\tAtualizarContaPreFaturadaHelper retorno = new AtualizarContaPreFaturadaHelper();\r\n\r\n\t\tInteger index = 0;\r\n\r\n\t\t// Tipo de registro\r\n\t\tretorno.tipoRegistro = linha.substring(index, index + REGISTRO_TIPO);\r\n\t\tindex += REGISTRO_TIPO;\r\n\r\n\t\t// Matricula do imovel\r\n\t\tretorno.matriculaImovel = linha.substring(index, index\r\n\t\t\t\t+ MATRICULA_IMOVEL);\r\n\t\tindex += MATRICULA_IMOVEL;\r\n\r\n\t\t// Tipo de medição\r\n\t\tretorno.tipoMedicao = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_1_TIPO_MEDICAO);\r\n\t\tindex += REGISTRO_TIPO_1_TIPO_MEDICAO;\r\n\r\n\t\t// Ano e mes do faturamento\r\n\t\tretorno.anoMesFaturamento = Util.formatarMesAnoParaAnoMes(linha\r\n\t\t\t\t.substring(index, index + REGISTRO_TIPO_1_ANO_MES_FATURAMENTO));\r\n\t\tindex += REGISTRO_TIPO_1_ANO_MES_FATURAMENTO;\r\n\r\n\t\t// Numero da conta\r\n\t\tretorno.numeroConta = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_1_NUMERO_CONTA);\r\n\t\tindex += REGISTRO_TIPO_1_NUMERO_CONTA;\r\n\r\n\t\t// Codigo do Grupo de faturamento\r\n\t\tretorno.codigoGrupoFaturamento = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_1_CODIGO_GRUPO_FATURAMENTO);\r\n\t\tindex += REGISTRO_TIPO_1_CODIGO_GRUPO_FATURAMENTO;\r\n\r\n\t\t// Codigo da rota\r\n\t\tretorno.codigoRota = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_1_CODIGO_ROTA);\r\n\t\tindex += REGISTRO_TIPO_1_CODIGO_ROTA;\r\n\r\n\t\t// Codigo da leitura do hidrometro\r\n\t\tretorno.leituraHidrometro = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_1_LEITURA_HIDROMETRO);\r\n\t\tindex += REGISTRO_TIPO_1_LEITURA_HIDROMETRO;\r\n\r\n\t\t// Anormalidade de Leitura\r\n\t\tretorno.anormalidadeLeitura = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_1_ANORMALIDADE_LEITURA);\r\n\t\tindex += REGISTRO_TIPO_1_ANORMALIDADE_LEITURA;\r\n\r\n\t\t// Data e Hora Leitura\r\n\t\tretorno.dataHoraLeituraHidrometro = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_1_DATA_HORA_LEITURA);\r\n\t\tindex += REGISTRO_TIPO_1_DATA_HORA_LEITURA;\r\n\r\n\t\t// Indicador de Confirmacao\r\n\t\tretorno.indicadorConfirmacaoLeitura = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_1_INDICADOR_CONFIRMACAO_LEITURA);\r\n\t\tindex += REGISTRO_TIPO_1_INDICADOR_CONFIRMACAO_LEITURA;\r\n\r\n\t\t// Leitura do Faturamento\r\n\t\tretorno.leituraFaturamento = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_1_LEITURA_FATURAMENTO);\r\n\t\tindex += REGISTRO_TIPO_1_LEITURA_FATURAMENTO;\r\n\r\n\t\t// Consumo Medido no mes\r\n\t\tretorno.consumoMedido = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_1_CONSUMO_MEDIDO);\r\n\t\tindex += REGISTRO_TIPO_1_CONSUMO_MEDIDO;\r\n\r\n\t\t// Consumo a ser cobrado\r\n\t\tretorno.consumoASerCobradoMes = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_1_CONSUMO_A_SER_COBRADO_MES);\r\n\t\tindex += REGISTRO_TIPO_1_CONSUMO_A_SER_COBRADO_MES;\r\n\r\n\t\t// Consumo rateio agua\r\n\t\tretorno.consumoRateioAgua = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_1_CONSUMO_RATEIO_AGUA);\r\n\t\tindex += REGISTRO_TIPO_1_CONSUMO_RATEIO_AGUA;\r\n\r\n\t\t// Valor rateio agua\r\n\t\tretorno.valorRateioAgua = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_1_VALOR_RATEIO_AGUA);\r\n\t\tindex += REGISTRO_TIPO_1_VALOR_RATEIO_AGUA;\r\n\r\n\t\t// Consumo rateio esgoto\r\n\t\tretorno.consumoRateioEsgoto = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_1_CONSUMO_RATEIO_ESGOTO);\r\n\t\tindex += REGISTRO_TIPO_1_CONSUMO_RATEIO_ESGOTO;\r\n\r\n\t\t// Valor rateio esgoto\r\n\t\tretorno.valorRateioEsgoto = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_1_VALOR_RATEIO_ESGOTO);\r\n\t\tindex += REGISTRO_TIPO_1_VALOR_RATEIO_ESGOTO;\r\n\r\n\t\t// Tipo de consumo\r\n\t\tretorno.tipoConsumo = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_1_TIPO_CONSUMO);\r\n\t\tindex += REGISTRO_TIPO_1_TIPO_CONSUMO;\r\n\r\n\t\t// Anormalidade de consumo\r\n\t\tretorno.anormalidadeConsumo = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_1_ANORMALIDADE_CONSUMO);\r\n\t\tindex += REGISTRO_TIPO_1_ANORMALIDADE_CONSUMO;\r\n\r\n\t\t// Indicador de emissao de conta\r\n\t\tretorno.indicacaoEmissaoConta = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_1_INDICACAO_EMISSAO_CONTA);\r\n\t\tindex += REGISTRO_TIPO_1_INDICACAO_EMISSAO_CONTA;\r\n\r\n\t\t// Inscricao\r\n\t\tString inscricao = \"\";\r\n\t\tinscricao = linha.substring(index, index + REGISTRO_TIPO_1_INSCRICAO);\r\n\t\tformatarInscricao(retorno, inscricao);\r\n\t\tindex += REGISTRO_TIPO_1_INSCRICAO;\r\n\r\n\t\t// Indicador Geração da conta\r\n\t\tretorno.indicadorGeracaoConta = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_1_INDICADOR_GERACAO_CONTA);\r\n\t\tindex += REGISTRO_TIPO_1_INDICADOR_GERACAO_CONTA;\r\n\r\n\t\t// consumo imóveis vinculados\r\n\t\tretorno.consumoImoveisVinculados = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_1_CONSUMO_IMOVEIS_VINCULADOS);\r\n\t\tindex += REGISTRO_TIPO_1_CONSUMO_IMOVEIS_VINCULADOS;\r\n\r\n\t\t// anormalidade de faturamento\r\n\t\tretorno.anormalidadeFaturamento = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_1_ANORMALIDADE_FATURAMENTO);\r\n\t\tindex += REGISTRO_TIPO_1_ANORMALIDADE_FATURAMENTO;\r\n\r\n\t\t// Id Cobrança Documento\r\n\t\tretorno.idCobrancaDocumento = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_1_COBRANCA_DOCUMENTO);\r\n\t\tindex += REGISTRO_TIPO_1_NUMERO_CONTA;\r\n\r\n\t\t// Codigo da leitura do hidrometro anterior\r\n\t\tretorno.leituraHidrometroAnterior = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_1_LEITURA_HIDROMETRO_ANTERIOR);\r\n\t\tindex += REGISTRO_TIPO_1_LEITURA_HIDROMETRO_ANTERIOR;\r\n\r\n\t\t\r\n\t\tif (linha.length() > 200) {\r\n\t\t\t// Latitude\r\n\t\t\tretorno.latitude = linha.substring( index, index + REGISTRO_TIPO_1_LATITUDE );\r\n\t\t\tindex += REGISTRO_TIPO_1_LATITUDE;\r\n\r\n\t\t\t// Longitude\r\n\t\t\tretorno.longitude = linha.substring( index, index + REGISTRO_TIPO_1_LONGITUDE );\r\n\t\t\t index += REGISTRO_TIPO_1_LONGITUDE;\r\n\r\n\t\t\t// Versão do IS\r\n\t\t\tretorno.numeroVersao = linha.substring(index, index\t+ REGISTRO_TIPO_1_NUMERO_VERSAO);\r\n\t\t\tindex += REGISTRO_TIPO_1_NUMERO_VERSAO;\r\n\r\n\t\t} else {\r\n\t\t\t// Latitude\r\n\t\t\tretorno.latitude = \"0\";\r\n\r\n\t\t\t// Longitude\r\n\t\t\t retorno.longitude = \"0\";\r\n\r\n\t\t\t// Versão do IS\r\n\t\t\tretorno.numeroVersao = linha.substring(index, index\t+ REGISTRO_TIPO_1_NUMERO_VERSAO);\r\n\t\t\tindex += REGISTRO_TIPO_1_NUMERO_VERSAO;\r\n\r\n\t\t}\r\n\r\n\t\treturn retorno;\r\n\t}", "public String estadisticasFinancieras(String anio) {\n String html = \"\";\n DefaultTableModel dtm1 = venta.estadisticaFinancierasMeseVsIngresoGasto(anio);\n DefaultTableModel dtm2 = venta.estadisticaFinancierasIngresosGastosUtilidades(anio);\n \n html = Utils.dibujarGraficasHTMLLineasYTorta(dtm1, dtm2, \"ESTADISTICAS FINANCIERAS DE INGRESOS Y GASTOS\");\n \n return html;\n }", "public void setFechaExpedicion(String p) { this.fechaExpedicion = p; }", "private Filtro getFiltroFissiGiornoConto(Date data, int codConto) {\n /* variabili e costanti locali di lavoro */\n Filtro filtro = null;\n Filtro filtroDate = null;\n Filtro filtroInizio = null;\n Filtro filtroSincro;\n Filtro filtroVuota;\n Filtro filtroIntervallo;\n Filtro filtroFine;\n Filtro filtroConto = null;\n Modulo modConto;\n Date dataVuota;\n\n try { // prova ad eseguire il codice\n\n modConto = Progetto.getModulo(Conto.NOME_MODULO);\n\n filtroDate = new Filtro();\n\n filtroInizio = FiltroFactory.crea(Cam.dataInizioValidita.get(),\n Filtro.Op.MINORE_UGUALE,\n data);\n filtroSincro = FiltroFactory.crea(Cam.dataSincro.get(), Filtro.Op.MINORE, data);\n dataVuota = Lib.Data.getVuota();\n filtroVuota = FiltroFactory.crea(Cam.dataSincro.get(), dataVuota);\n\n filtroFine = FiltroFactory.crea(Cam.dataFineValidita.get(),\n Filtro.Op.MAGGIORE_UGUALE,\n data);\n filtroIntervallo = new Filtro();\n filtroIntervallo.add(filtroSincro);\n filtroIntervallo.add(filtroFine);\n\n filtroDate.add(filtroIntervallo);\n filtroDate.add(Filtro.Op.OR, filtroVuota);\n\n /* filtro per il conto */\n filtroConto = FiltroFactory.codice(modConto, codConto);\n\n filtro = new Filtro();\n filtro.add(filtroInizio);\n filtro.add(filtroDate);\n filtro.add(filtroConto);\n\n } catch (Exception unErrore) { // intercetta l'errore\n Errore.crea(unErrore);\n }// fine del blocco try-catch\n\n /* valore di ritorno */\n return filtro;\n }", "private void gestionPriseEnCompte() {\r\n\t\tString raison = new String(\"\");\r\n\t\tDate now = new Date();\r\n\t\tString strSql = \"\";\r\n\t\r\n if (tbAlarme.getRowCount() > 0) {\r\n \tif (tbAlarme.getSelectedRowCount() > 0) {\r\n\t\t int[] selection = tbAlarme.getSelectedRows();\r\n\t\t int indexSelection = selection[0];\r\n\t\t int idCapteur = mdlTpsReelAlarme.getIdCapteur(indexSelection); \r\n\t\t String strTypeAlarme = \"\";\r\n\t\t \r\n\t\t\t\t// Motif Prise En Compte seulement si appel Alert\r\n\t\t strTypeAlarme = (String) mdlTpsReelAlarme.getValueAt(indexSelection, JTABLE_ALARME_TYPE_ALARME);\r\n\t\t if (strTypeAlarme.equals(\"Alarme\")) {\r\n\t\t\t\t\tint idPriseEnCompte = 0;\r\n\t\t \tdo {\r\n\t\t\t\t\t\tObject [] possibilites = new Object[tbPriseEnCompte.size()];\r\n\t\t\t\t\t\tfor(int i = 0; i < tbPriseEnCompte.size(); i++) {\r\n\t\t\t\t\t\t\tpossibilites[i] = tbPriseEnCompte.get(i).getNom();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tString strReponse = (String)JOptionPane.showInputDialog(this, \"Choisir un motif de prise en compte : \", \"Prise en compte\", JOptionPane.QUESTION_MESSAGE, null, possibilites, null);\r\n\t\t\t\t\t\tidPriseEnCompte = 1;\r\n\t\t\t\t\t\tif (strReponse != null) {\r\n\t\t\t\t\t\t\tfor(int i = 0; i < tbPriseEnCompte.size(); i++) {\r\n\t\t\t\t\t\t\t\tif(strReponse.equals(tbPriseEnCompte.get(i).getNom())) {\r\n\t\t\t\t\t\t\t\t\tidPriseEnCompte = (int) tbPriseEnCompte.get(i).getId();\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t} // fin for\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\traison = \"En attente\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// idPriseEncompte == 1 (Autres)\r\n\t\t\t\t\t\tif(idPriseEnCompte == 1) {\r\n\t\t\t\t\t\t\t// Demande de commentaire\r\n\t\t\t\t\t\t\traison = AE_Fonctions.saisieTexte(\"Veuillez entrer une raison : \", \"Raison commentaire ...\");\r\n\t\t\t\t\t\t\tif (raison == null) raison = \"\";\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\traison = \"---\";\r\n\t\t\t\t\t\t}\r\n\t\t \t} while(raison == \"\");\r\n\t\t \t\r\n\t\t\t\t\tstrSql = \"UPDATE V2_AlarmeEnCours SET idPriseEnCompte = \" + idPriseEnCompte\r\n\t\t\t\t\t\t\t + \" , idUtilisateur = \" + EFS_Client_Variable.idUtilisateur\r\n\t\t\t\t\t\t\t + \" , CommentairePriseEnCompte = '\" + raison + \"'\"\r\n\t\t\t\t\t\t\t + \" WHERE idCapteur = \" + idCapteur;\r\n\t\t\t\t\tctn.fonctionSql(strSql);\r\n\t\t\t\t\tmdlTpsReelAlarme.setMotifIdPriseEncompte(indexSelection, idPriseEnCompte);\r\n\t\t } // fin if appelAlert\r\n\r\n\t\t if(mdlTpsReelAlarme.getValueAt(indexSelection, JTABLE_ALARME_PRISE_EN_COMPTE) == null) {\r\n\t\t\t\t\t// Date prise en compte\r\n\t\t\t\t\tstrSql = \"UPDATE V2_AlarmeEnCours SET DatePriseEnCompte = sysdate, blPriseEnCompte = 1 WHERE idCapteur = \" + idCapteur;\r\n\t\t\t\t\tctn.fonctionSql(strSql);\r\n\t\t\t\t\tmdlTpsReelAlarme.setValueAt(now, indexSelection, JTABLE_ALARME_PRISE_EN_COMPTE);\r\n\t\t } // fin if datePrsieEnCompte\r\n\t\r\n\t\t // Prevenir le programme maitre\r\n\t\t AE_Fonctions.modifierMaitreViaClient(idCapteur, VIA_API_PRISE_EN_COMPTE);\r\n\t\t \r\n\t\t\t\t// Arret klaxon et Alert\r\n//\t\t\t\tgestionKlaxon(false);\r\n//\t\t\t\tgestionAlert(false);\r\n\t\t\t\t\r\n \t} else {\r\n \t JOptionPane.showMessageDialog(this, \"Vous devez sélectionner une ligne pour prendre en compte ...\",\r\n \t \t\t \"GTC Visualize - Programme Maitre\", JOptionPane.WARNING_MESSAGE);\r\n \t}\r\n } else {\r\n//\t\t\tgestionKlaxon(false);\r\n//\t\t\tgestionAlert(false);\r\n }\r\n\t}", "private boolean crearRecurso(int codigoCiclo, int codigoPlan, int codigoMeta, int codigoRecurso, String estado, String usuarioInsercion) {\n/* */ try {\n/* 513 */ String s = \"select estado from cal_plan_recursos_meta r where r.codigo_ciclo=\" + codigoCiclo + \" and r.codigo_plan=\" + codigoPlan + \" and r.codigo_meta=\" + codigoMeta + \" and r.codigo_recurso=\" + codigoRecurso;\n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* 520 */ this.dat.parseSql(s);\n/* 521 */ this.rs = this.dat.getResultSet();\n/* 522 */ if (this.rs.next()) {\n/* 523 */ s = \"update cal_plan_recursos_meta set \";\n/* 524 */ s = s + \" estado='\" + estado + \"',\";\n/* 525 */ s = s + \" fecha_modificacion=\" + Utilidades.getFechaBD() + \",\";\n/* 526 */ s = s + \" usuario_modificacion='\" + usuarioInsercion + \"'\";\n/* 527 */ s = s + \" where \";\n/* 528 */ s = s + \" codigo_ciclo=\" + codigoCiclo;\n/* 529 */ s = s + \" and codigo_plan=\" + codigoPlan;\n/* 530 */ s = s + \" and codigo_meta=\" + codigoMeta;\n/* 531 */ s = s + \" and codigo_recurso=\" + codigoRecurso;\n/* */ } else {\n/* */ \n/* 534 */ s = \"insert into cal_plan_recursos_meta (codigo_ciclo,codigo_plan,codigo_meta,codigo_recurso,estado,fecha_insercion,usuario_insercion) values (\" + codigoCiclo + \",\" + \"\" + codigoPlan + \",\" + \"\" + codigoMeta + \",\" + \"\" + codigoRecurso + \",\" + \"'\" + estado + \"',\" + Utilidades.getFechaBD() + \",\" + \"'\" + usuarioInsercion + \"'\" + \")\";\n/* */ } \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* 552 */ return this.dat.executeUpdate(s);\n/* */ \n/* */ }\n/* 555 */ catch (Exception e) {\n/* 556 */ e.printStackTrace();\n/* 557 */ Utilidades.writeError(\"CalMetasDAO:crearRegistro\", e);\n/* */ \n/* 559 */ return false;\n/* */ } \n/* */ }", "@Test\r\n\t\tpublic void testMovimientoTorreNegra0() {\r\n\t\t \r\n\t\t\tDatosPrueba prueba = new DatosPrueba(torreNegra0,\r\n\t\t\t\t\t\"Error al comprobar los movimientos del rey negro en el inicio de una aprtida en la posición 8a. \");\r\n\t\t\tboolean res = this.testMovimientos(prueba); \r\n\t\t\tassertTrue(prueba.getMensaje(), res);\r\n\t\t \r\n\t\t}", "private void verificarDatos(int fila) {\n try {\n colValidada = -1;\n\n float cantidad = 1;\n float descuento = 0;\n float precio = 1;\n float stock = 1;\n if (TblOrdenCompraDetalle.getValueAt(fila, oCLOrdenCompra.colCantidad) != null) {\n cantidad = Float.parseFloat(TblOrdenCompraDetalle.getValueAt(fila, oCLOrdenCompra.colCantidad).toString());\n }\n if (TblOrdenCompraDetalle.getValueAt(fila, oCLOrdenCompra.colPrecioConIGV) != null) {\n precio = Float.parseFloat(TblOrdenCompraDetalle.getValueAt(fila, oCLOrdenCompra.colPrecioConIGV).toString());\n }\n if (TblOrdenCompraDetalle.getValueAt(fila, oCLOrdenCompra.colDescuento) != null) {\n descuento = Float.parseFloat(TblOrdenCompraDetalle.getValueAt(fila, oCLOrdenCompra.colDescuento).toString());\n }\n\n if (precio < 0) {\n JOptionPane.showMessageDialog(this, \"el precio debe ser mayor a cero\");\n TblOrdenCompraDetalle.setValueAt(null, fila, oCLOrdenCompra.colPrecioConIGV);\n TblOrdenCompraDetalle.setValueAt(null, fila, oCLOrdenCompra.colImporSinDesc);\n TblOrdenCompraDetalle.setValueAt(null, fila, oCLOrdenCompra.colImporSinDescConIgv);\n colValidada = oCLOrdenCompra.colPrecioConIGV;\n return;\n }\n\n if (descuento > cantidad * precio) {\n JOptionPane.showMessageDialog(this, \"El descuento no puede ser mayor al Importe Bruto\");\n TblOrdenCompraDetalle.setValueAt(null, fila, oCLOrdenCompra.colDescuento);\n descuento = 0;\n TblOrdenCompraDetalle.setValueAt(CLRedondear.Redondear((cantidad * precio) - descuento, 2), fila, oCLOrdenCompra.colImporConDesc);//con\n oCLOrdenCompra.CalcularSubtotales();\n oCLOrdenCompra.calcularImportes();\n\n colValidada = oCLOrdenCompra.colDescuento;\n return;\n }\n\n if (descuento < 0) {\n JOptionPane.showMessageDialog(this, \"El descuento no puede ser menor a cero\");\n TblOrdenCompraDetalle.setValueAt(null, fila, oCLOrdenCompra.colDescuento);\n descuento = 0;\n TblOrdenCompraDetalle.setValueAt(CLRedondear.Redondear((cantidad * precio) - descuento, 2), fila, oCLOrdenCompra.colImporConDesc);//con\n colValidada = oCLOrdenCompra.colDescuento;\n return;\n }\n\n if (cantidad <= 0) {\n JOptionPane.showMessageDialog(this, \"La cantidad debe ser mayor a cero\");\n TblOrdenCompraDetalle.setValueAt(null, fila, oCLOrdenCompra.colCantidad);\n colValidada = oCLOrdenCompra.colCantidad;\n return;\n }\n /* if(precio<=0)\n {\n JOptionPane.showMessageDialog(null,\"El precio tiene q ser mayor a cero\");\n colValidada=oCLOrdenCompra.colPrecio;\n return;\n }*/\n if (TblOrdenCompraDetalle.getValueAt(fila, oCLOrdenCompra.colStock) != null) {\n stock = Float.parseFloat(TblOrdenCompraDetalle.getValueAt(fila, oCLOrdenCompra.colStock).toString());\n }\n if (cantidad > stock) {\n /* JOptionPane.showMessageDialog(null,\"La cantidad no debe ser mayor al stock disponible\");\n TblOrdenCompraDetalle.setValueAt(null, fila,oCLOrdenCompra.colCantidad);\n colValidada=oCLOrdenCompra.colCantidad;\n return;*/\n }\n\n int col = TblOrdenCompraDetalle.getSelectedColumn();\n if (!eventoGuardar) {\n if (col == oCLOrdenCompra.colCantidad) {\n oCLOrdenCompra.calcularPrecio(fila);\n }\n }\n\n } catch (Exception e) {\n cont++;\n System.out.println(\"dlgGestionOrdenCompra-metodo Verificar datos: \"+e);\n }\n }", "public void insercionMasiva() {\r\n\t\tif (!precondInsert())\r\n\t\t\treturn;\r\n\t\tUploadItem fileItem = seleccionUtilFormController.crearUploadItem(\r\n\t\t\t\tfName, uFile.length, cType, uFile);\r\n\t\ttry {\r\n\t\t\tlLineasArch = FileUtils.readLines(fileItem.getFile(), \"ISO-8859-1\");\r\n\t\t} catch (IOException e) {\r\n\t\t\tstatusMessages.add(Severity.INFO, \"Error al subir el archivo\");\r\n\t\t}\r\n\r\n\t\tStringBuilder cadenaSalida = new StringBuilder();\r\n\t\tString estado = \"EXITO\";\r\n\t\tcantidadLineas = 0;\r\n\t\t//Ciclo para contar la cantdad de adjudicados o seleccionados que se reciben\r\n\t\tfor (String linea : lLineasArch) {\r\n\t\t\tcantidadLineas++;\r\n\t\t\tif(cantidadLineas > 1){\r\n\t\t\t\tseleccionados++;\r\n\t\t\t}\r\n\t\t}\r\n\t\t//Condicion para verificar si la cantidad de seleccionados es mayor a la cantidad de vacancias (en cuyo caso se procede a abortar el proceso e imprimir\r\n\t\t//un mensaje de error) o verificar si esta es menor (se imprime el mensaje pero se continua)\r\n\t\t\r\n\t\tif(seleccionados > concursoPuestoAgrNuevo.getCantidadPuestos()){\r\n\t\t\testado = \"FRACASO\";\r\n\t\t\tcadenaSalida.append(estado + \" - CANTIDAD DE AJUDICADOS ES SUPERIOR A LA CANTIDAD DE PUESTOS VACANTES PARA EL GRUPO\");\r\n\t\t\tcadenaSalida.append(System.getProperty(\"line.separator\"));\r\n\t\t}\r\n\t\telse if(seleccionados < concursoPuestoAgrNuevo.getCantidadPuestos()){\r\n\t\t\tcadenaSalida.append(\"ADVERTENCIA - CANTIDAD DE ADJUDICADOS ES INFERIOR A LA CANTIDAD DE PUESTOS VACANTES PARA EL GRUPO\");\r\n\t\t\tcadenaSalida.append(System.getProperty(\"line.separator\"));\r\n\t\t}\r\n\t\tseleccionados = 0;\r\n\t\t\r\n\t\tif(!estado.equals(\"FRACASO\")){\r\n\r\n\t\tcantidadLineas = 0;\r\n\t\tfor (String linea : lLineasArch) {\r\n\r\n\t\t\tcantidadLineas++;\r\n\t\t\testado = \"EXITO\";\r\n\t\t\tString observacion = \"\";\r\n\t\t\tFilaPostulante fp = new FilaPostulante(linea);\r\n\t\t\tList<Persona> lista = null;\r\n\t\t\tif (cantidadLineas > 1 && fp != null && fp.valido) {\r\n\t\t\t\t//Verifica si la persona leida en el registro del archivo CSV existe en la Tabla Persona\r\n\t\t\t\tString sqlPersona = \"select * from general.persona where persona.documento_identidad = '\"+fp.getDocumento()+ \"'\";\r\n\t\t\t\tQuery q1 = em.createNativeQuery(sqlPersona, Persona.class);\r\n\t\t\t\tPersona personaLocal = new Persona();\r\n\t\t\t\tint banderaEncontroPersonas = 0;\r\n\t\t\t\t//Si existe, se almacena el registro de la tabla\r\n\t\t\t\tif(!q1.getResultList().isEmpty()){\r\n\t\t\t\t\tlista = q1.getResultList();\r\n\t\t\t\t\tif (compararNomApe(lista.get(0).getNombres(), removeCadenasEspeciales(fp.getNombres()))\r\n\t\t\t\t\t\t\t&& compararNomApe(lista.get(0).getApellidos(), removeCadenasEspeciales(fp.getApellidos())) ) {\r\n\t\t\t\t\t\t\tbanderaEncontroPersonas = 1;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\testado = \"FRACASO\";\r\n\t\t\t\t\t\t\tobservacion += \" PERSONA NO REGISTRADA EN LA BASE DE DATOS LOCAL\";\r\n\t\t\t\t\t\t}\t\t\t\t\t\r\n\t\t\t\t} else {\r\n\t\t\t\t\testado = \"FRACASO\";\r\n\t\t\t\t\tobservacion += \" PERSONA NO REGITRADA EN LA BASE DE DATOS LOCAL\";\r\n\t\t\t\t}\r\n\t\t\t\t//Verificamos que la persona figure en la lista corta como seleccionado\r\n\t\t\t\tif(!estado.equals(\"FRACASO\")){\r\n\t\t\t\t\tint banderaExisteEnListaCorta = 0;\t\t\t\t\t\r\n\t\t\t\t\tint i=0;\r\n\t\t\t\t\tif (banderaEncontroPersonas == 1) {\r\n\t\t\t\t\t\twhile(i<lista.size()){\r\n\t\t\t\t\t\t\tpersonaLocal = (Persona) lista.get(i);\r\n\t\t\t\t\t\t\tQuery p = em.createQuery(\"select E from EvalReferencialPostulante E \"\r\n\t\t\t\t\t\t\t\t\t+ \"where E.postulacion.personaPostulante.persona.idPersona =:id_persona and E.concursoPuestoAgr.idConcursoPuestoAgr =:id_concurso_puesto_agr and E.listaCorta=:esta_en_lista_corta\");\r\n\t\t\t\t\t\t\t\t\tp.setParameter(\"id_persona\", personaLocal.getIdPersona());\r\n\t\t\t\t\t\t\t\t\tp.setParameter(\"id_concurso_puesto_agr\", this.idConcursoPuestoAgr);\r\n\t\t\t\t\t\t\t\t\tp.setParameter(\"esta_en_lista_corta\", true);\r\n\t\t\t\t\t\t\tList<EvalReferencialPostulante> listaEvalRefPost = p.getResultList();\r\n\t\t\t\t\t\t\tif (!listaEvalRefPost.isEmpty()) {\r\n\t\t\t\t\t\t\t\tbanderaExisteEnListaCorta = 1;\r\n\t\t\t\t\t\t\t\ti = lista.size();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\ti++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (banderaExisteEnListaCorta == 0) {\r\n\t\t\t\t\t\testado = \"FRACASO\";\r\n\t\t\t\t\t\tobservacion += \" NO SELECCIONADO/ELEGIBLE EN LISTA CORTA\";\r\n\t\t\t\t\t} else if (banderaExisteEnListaCorta == 1){\r\n\t\t\t\t\t\tobservacion += \" SELECCIONADO/ELEGIBLE EN LISTA CORTA\";\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\tQuery p = em.createQuery(\"select E from EvalReferencialPostulante E \"\r\n\t\t\t\t\t\t\t\t+ \"where E.postulacion.personaPostulante.persona.idPersona =:id_persona and E.concursoPuestoAgr.idConcursoPuestoAgr =:id_concurso_puesto_agr and E.listaCorta=:esta_en_lista_corta\");\r\n\t\t\t\t\t\t\t\tp.setParameter(\"id_persona\", personaLocal.getIdPersona());\r\n\t\t\t\t\t\t\t\tp.setParameter(\"id_concurso_puesto_agr\", this.idConcursoPuestoAgr);\r\n\t\t\t\t\t\t\t\tp.setParameter(\"esta_en_lista_corta\", true);\r\n\t\t\t\t\t\tEvalReferencialPostulante auxEvalReferencialPostulante = (EvalReferencialPostulante) p.getResultList().get(0);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t//Validaciones para actualizaciones\r\n\t\t\t\t\t\t//Bandera indicadora de actualizaciones hechas\r\n\t\t\t\t\t\tint bandera = 0;\r\n\t\t\t\t\t\tif(auxEvalReferencialPostulante.getSelAdjudicado() == null){\r\n\t\t\t\t\t\t\testado = \"EXITO\";\r\n\t\t\t\t\t\t\tauxEvalReferencialPostulante.setSelAdjudicado(true);;\r\n\t\t\t\t\t\t\tbandera = 1;\r\n\t\t\t\t\t\t\tem.merge(auxEvalReferencialPostulante);\r\n\t\t\t\t\t\t\tem.flush();\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\tagregarEstadoMotivo(linea, estado, observacion, cadenaSalida);\r\n\t\t\t}\r\n\t\t\tif (cantidadLineas > 1 && !fp.valido) {\r\n\t\t\t\testado = \"FRACASO\";\r\n\t\t\t\tcadenaSalida\r\n\t\t\t\t\t\t.append(estado\r\n\t\t\t\t\t\t\t\t+ \" - ARCHIVO INGRESADO CON MENOS CAMPOS DE LOS NECESARIOS. DATOS INCORRECTOS EN ALGUNA COLUMNA.\");\r\n\t\t\t\tcadenaSalida.append(System.getProperty(\"line.separator\"));\r\n\t\t\t}\r\n\r\n\t\t\t// FIN FOR\r\n\t\t}\r\n\t\t//FIN IF\r\n\t\t}\r\n\t\tif (lLineasArch.isEmpty()) {\r\n\t\t\tstatusMessages.add(Severity.INFO, \"Archivo inválido\");\r\n\t\t\treturn;\r\n\t\t} else {\r\n\t\t\t\r\n\t\t\tSimpleDateFormat sdf2 = new SimpleDateFormat(\"dd_MM_yyyy_HH_mm_ss\");\r\n\t\t\tString nArchivo = sdf2.format(new Date()) + \"_\" + fName;\r\n\t\t\tString direccion = System.getProperty(\"jboss.home.dir\") + System.getProperty(\"file.separator\") + \"temp\" + System.getProperty(\"file.separator\");\r\n\t\t\tFile archSalida = new File(direccion + nArchivo);\r\n\t\t\t\r\n\t\t\ttry {\r\n\t\t\t\tFileUtils\r\n\t\t\t\t\t\t.writeStringToFile(archSalida, cadenaSalida.toString());\r\n\t\t\t\tif (archSalida.length() > 0) {\r\n\t\t\t\t\tstatusMessages.add(Severity.INFO, \"Insercion Exitosa\");\r\n\t\t\t\t}\r\n\t\t\t\tJasperReportUtils.respondFile(archSalida, nArchivo, false,\r\n\t\t\t\t\t\t\"application/vnd.ms-excel\");\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\tstatusMessages.add(Severity.ERROR, \"IOException\");\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public static void main(String[] args) throws ParseException {\t\t\n\t int mes, ano, diaDaSemana, primeiroDiaDoMes, numeroDeSemana = 1;\n\t Date data;\n\t \n\t //Converter texto em data e data em texto\n\t SimpleDateFormat sdf\t = new SimpleDateFormat(\"dd/MM/yyyy\");\n\t //Prover o calendario\n\t GregorianCalendar gc\t = new GregorianCalendar();\n\t \n\t String mesesCalendario[] = new String[12];\n\t\tString mesesNome[]\t\t = {\"Janeiro\", \"Fevereiro\", \"Marco\", \"Abri\", \"Maio\", \"Junho\", \"Julho\", \"Agosto\", \"Setembro\", \"Outubro\", \"Novembro\", \"Dezembro\"};\n\t\tint mesesDia[]\t\t\t = {31,28,31,30,31,30,31,31,30,31,30,31};\n\t\t\n\t\t//Errado? e pra receber apenas o \"dia da semana\" do \"primeiro dia do mes\" na questao\n\t //Recebendo mes e ano\n\t mes = Entrada.Int(\"Digite o mes:\", \"Entrada de dados\");\n\t ano = Entrada.Int(\"Digite o ano:\", \"Entrada de dados\");\n\t \n\t //Errado? e pra ser o dia inicial do mes na questao\n\t // Dia inicial do ano\n data = sdf.parse(\"01/01/\" + ano);\n gc.setTime(data);\n diaDaSemana = gc.get(GregorianCalendar.DAY_OF_WEEK);\n \n //Nao sei se e necessario por causa da questao\n //*Alteracao feita||| Ano bissexto tem +1 dia em fevereiro\n if(ano % 4 == 0) {\n \tmesesDia[1] = 29;\n \tmesesNome[1] = \"Ano Bissexto - Fevereiro\";\n }\n \n \n //Meses \n for(int mesAtual = 0; mesAtual < 12; mesAtual++) {\n\t int diasDoMes\t= 0;\n\t String nomeMesAtual = \"\";\n\n\n\t nomeMesAtual = mesesNome[mesAtual]; \n diasDoMes\t = mesesDia[mesAtual]; \n\n\n mesesCalendario[mesAtual] = \"\\n \" + nomeMesAtual + \" de \" + ano + \"\\n\";\n mesesCalendario[mesAtual] += \"---------------------------------------------------------------------|\\n\";\n mesesCalendario[mesAtual] += \" Dom Seg Ter Qua Qui Sex Sab | Semanas\\n\";\n mesesCalendario[mesAtual] += \"---------------------------------------------------------------------|\\n \";\n\t\n\t \n\t // Primeira semana comeca em\n\t data = sdf.parse( \"01/\" + (mesAtual+1) + \"/\" + ano );\n gc.setTime(data);\n primeiroDiaDoMes = gc.get(GregorianCalendar.DAY_OF_WEEK);\n\t for (int space = 1; space < primeiroDiaDoMes; space++) {\n\t \tmesesCalendario[mesAtual] += \" \";\n\t }\n\t \n\t //Dias\t \n\t for (int diaAtual = 1; diaAtual <= diasDoMes; diaAtual++)\n\t {\n\t \t// Trata espaco do dia\n\t \t\t//Transforma o diaAtuel em String\n\t String diaTratado = Integer.toString(diaAtual);\n\t if (diaTratado.length() == 1)\n\t \tdiaTratado = \" \" + diaAtual + \" \";\n\t else\n\t \tdiaTratado = \" \" + diaAtual + \" \";\n\t \n\t // dia\n\t mesesCalendario[mesAtual] += diaTratado;\n\t \t\n\t \t// Pula Linha no final da semana\n\t data = sdf.parse( diaAtual + \"/\" + (mesAtual+1) + \"/\" + ano );\n\t gc.setTime(data);\n\t diaDaSemana = gc.get(GregorianCalendar.DAY_OF_WEEK);\n\t if (diaDaSemana == 7) {\n\t \tmesesCalendario[mesAtual] += (\"| \" + numeroDeSemana++);\n\t \tmesesCalendario[mesAtual] += \"\\n |\";\n\t \tmesesCalendario[mesAtual] += \"\\n \";\n\t }\n\t }\n\t mesesCalendario[mesAtual] += \"\\n\\n\\n\\n\";\n\t }\n\t \n //Imprime mes desejado\n\t System.out.println(mesesCalendario[mes-1]);\n\n\t}", "private static void statACricri() {\n \tSession session = new Session();\n \tNSTimestamp dateRef = session.debutAnnee();\n \tNSArray listAffAnn = EOAffectationAnnuelle.findAffectationsAnnuelleInContext(session.ec(), null, null, dateRef);\n \tLRLog.log(\">> listAffAnn=\"+listAffAnn.count() + \" au \" + DateCtrlConges.dateToString(dateRef));\n \tlistAffAnn = LRSort.sortedArray(listAffAnn, \n \t\t\tEOAffectationAnnuelle.INDIVIDU_KEY + \".\" + EOIndividu.NOM_KEY);\n \t\n \tEOEditingContext ec = new EOEditingContext();\n \tCngUserInfo ui = new CngUserInfo(new CngDroitBus(ec), new CngPreferenceBus(ec), ec, new Integer(3065));\n \tStringBuffer sb = new StringBuffer();\n \tsb.append(\"service\").append(ConstsPrint.CSV_COLUMN_SEPARATOR);\n \tsb.append(\"agent\").append(ConstsPrint.CSV_COLUMN_SEPARATOR);\n \tsb.append(\"contractuel\").append(ConstsPrint.CSV_COLUMN_SEPARATOR);\n \tsb.append(\"travaillees\").append(ConstsPrint.CSV_COLUMN_SEPARATOR);\n \tsb.append(\"conges\").append(ConstsPrint.CSV_COLUMN_SEPARATOR);\n \tsb.append(\"dues\").append(ConstsPrint.CSV_COLUMN_SEPARATOR);\n \tsb.append(\"restant\");\n \tsb.append(ConstsPrint.CSV_NEW_LINE);\n \t\n \n \tfor (int i = 0; i < listAffAnn.count(); i++) {\n \t\tEOAffectationAnnuelle itemAffAnn = (EOAffectationAnnuelle) listAffAnn.objectAtIndex(i);\n \t\t//\n \t\tEOEditingContext edc = new EOEditingContext();\n \t\t//\n \t\tNSArray array = EOAffectationAnnuelle.findSortedAffectationsAnnuellesForOidsInContext(\n \t\t\t\tedc, new NSArray(itemAffAnn.oid()));\n \t\t// charger le planning pour forcer le calcul\n \t\tPlanning p = Planning.newPlanning((EOAffectationAnnuelle) array.objectAtIndex(0), ui, dateRef);\n \t\t// quel les contractuels\n \t\t//if (p.affectationAnnuelle().individu().isContractuel(p.affectationAnnuelle())) {\n \t\ttry {p.setType(\"R\");\n \t\tEOCalculAffectationAnnuelle calcul = p.affectationAnnuelle().calculAffAnn(\"R\");\n \t\tint minutesTravaillees3112 = calcul.minutesTravaillees3112().intValue();\n \t\tint minutesConges3112 = calcul.minutesConges3112().intValue();\n \t\t\n \t\t// calcul des minutes dues\n \t\tint minutesDues3112 = /*0*/ 514*60;\n \t\t/*\tNSArray periodes = p.affectationAnnuelle().periodes();\n \t\tfor (int j=0; j<periodes.count(); j++) {\n \t\t\tEOPeriodeAffectationAnnuelle periode = (EOPeriodeAffectationAnnuelle) periodes.objectAtIndex(j);\n \t\tminutesDues3112 += periode.valeurPonderee(p.affectationAnnuelle().minutesDues(), septembre01, decembre31);\n \t\t}*/\n \t\tsb.append(p.affectationAnnuelle().structure().libelleCourt()).append(ConstsPrint.CSV_COLUMN_SEPARATOR);\n \t\tsb.append(p.affectationAnnuelle().individu().nomComplet()).append(ConstsPrint.CSV_COLUMN_SEPARATOR);\n \t\tsb.append(p.affectationAnnuelle().individu().isContractuel(p.affectationAnnuelle())?\"O\":\"N\").append(ConstsPrint.CSV_COLUMN_SEPARATOR);\n \t\tsb.append(TimeCtrl.stringForMinutes(minutesTravaillees3112)).append(ConstsPrint.CSV_COLUMN_SEPARATOR);\n \t\tsb.append(TimeCtrl.stringForMinutes(minutesConges3112)).append(ConstsPrint.CSV_COLUMN_SEPARATOR);\n \t\tsb.append(TimeCtrl.stringForMinutes(minutesDues3112)).append(ConstsPrint.CSV_COLUMN_SEPARATOR);\n \t\tsb.append(TimeCtrl.stringForMinutes(minutesTravaillees3112 - minutesConges3112 - minutesDues3112)).append(ConstsPrint.CSV_NEW_LINE);\n \t\tLRLog.log((i+1)+\"/\"+listAffAnn.count() + \" (\" + p.affectationAnnuelle().individu().nomComplet() + \")\");\n \t\t} catch (Throwable e) {\n \t\t\te.printStackTrace();\n \t\t}\n \t\tedc.dispose();\n \t\t//}\n \t}\n \t\n\t\tString fileName = \"/tmp/stat_000_\"+listAffAnn.count()+\".csv\";\n \ttry {\n\t\t\tBufferedWriter fichier = new BufferedWriter(new FileWriter(fileName));\n\t\t\tfichier.write(sb.toString());\n\t\t\tfichier.close();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\tLRLog.log(\"writing \" + fileName);\n\t\t}\n }", "private AtualizarContaPreFaturadaHelper parserRegistroTipo2(String linha) {\r\n\t\tAtualizarContaPreFaturadaHelper retorno = new AtualizarContaPreFaturadaHelper();\r\n\r\n\t\tInteger index = 0;\r\n\r\n\t\t// Tipo de registro\r\n\t\tretorno.tipoRegistro = linha.substring(index, index + REGISTRO_TIPO);\r\n\t\tindex += REGISTRO_TIPO;\r\n\t\tSystem.out.println(\"Tipo de Retorno: \" + retorno.tipoRegistro);\r\n\r\n\t\t// Matricula do imovel\r\n\t\tretorno.matriculaImovel = linha.substring(index, index\r\n\t\t\t\t+ MATRICULA_IMOVEL);\r\n\t\tindex += MATRICULA_IMOVEL;\r\n\t\tSystem.out.println(\"Matricula do Imovel: \" + retorno.matriculaImovel);\r\n\r\n\t\t// Codigo da Categoria\r\n\t\tretorno.codigoCategoria = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_2_CODIGO_CATEGORIA);\r\n\t\tindex += REGISTRO_TIPO_2_CODIGO_CATEGORIA;\r\n\r\n\t\t// Codigo da Subcategoria\r\n\t\tretorno.codigoSubCategoria = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_2_CODIGO_SUBCATEGORIA);\r\n\t\tindex += REGISTRO_TIPO_2_CODIGO_SUBCATEGORIA;\r\n\r\n\t\t// Valor faturado agua\r\n\t\tretorno.valorFaturadoAgua = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_2_VALOR_FATURADO_AGUA);\r\n\t\tindex += REGISTRO_TIPO_2_VALOR_FATURADO_AGUA;\r\n\r\n\t\t// Consumo faturado de agua\r\n\t\tretorno.consumoFaturadoAgua = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_2_CONSUMO_FATURADO_AGUA);\r\n\t\tindex += REGISTRO_TIPO_2_CONSUMO_FATURADO_AGUA;\r\n\r\n\t\t// Valor tarifa minima de agua\r\n\t\tretorno.valorTarifaMinimaAgua = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_2_VALOR_TARIFA_MINIMA_AGUA);\r\n\t\tindex += REGISTRO_TIPO_2_VALOR_TARIFA_MINIMA_AGUA;\r\n\r\n\t\t// Consumo Minimo de Agua\r\n\t\tretorno.consumoMinimoAgua = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_2_CONSUMO_MINIMO_AGUA);\r\n\t\tindex += REGISTRO_TIPO_2_CONSUMO_MINIMO_AGUA;\r\n\r\n\t\t// Valor faturado esgoto\r\n\t\tretorno.valorFaturadoEsgoto = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_2_VALOR_FATURADO_ESGOTO);\r\n\t\tindex += REGISTRO_TIPO_2_VALOR_FATURADO_ESGOTO;\r\n\r\n\t\t// Consumo faturado de esgoto\r\n\t\tretorno.consumoFaturadoEsgoto = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_2_CONSUMO_FATURADO_ESGOTO);\r\n\t\tindex += REGISTRO_TIPO_2_CONSUMO_FATURADO_ESGOTO;\r\n\r\n\t\t// Valor tarifa minima de esgoto\r\n\t\tretorno.valorTarifaMinimaEsgoto = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_2_VALOR_TARIFA_MINIMA_ESGOTO);\r\n\t\tindex += REGISTRO_TIPO_2_VALOR_TARIFA_MINIMA_ESGOTO;\r\n\r\n\t\t// Consumo Minimo de esgoto\r\n\t\tretorno.consumoMinimoEsgoto = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_2_CONSUMO_MINIMO_ESGOTO);\r\n\t\tindex += REGISTRO_TIPO_2_CONSUMO_MINIMO_ESGOTO;\r\n\t\t\r\n\t\t// Consumo Minimo de esgoto \r\n\t\t/*\r\n\t\tretorno.subsidio = linha.substring(index + 2, index\r\n\t\t\t\t+ REGISTRO_TIPO_2_SUBSIDIO_AGUA_PARA);\r\n\t\tindex += REGISTRO_TIPO_2_SUBSIDIO_AGUA_PARA;\r\n\t\t*/\r\n\t\treturn retorno;\r\n\t}", "public void dataPadrao() {\n Calendar c = Calendar.getInstance();\n SimpleDateFormat s = new SimpleDateFormat(\"dd/MM/yyyy\");\n String dataAtual = s.format(c.getTime());\n c.add(c.MONTH, 1);\n String dataAtualMaisUm = s.format(c.getTime());\n dataInicial.setText(dataAtual);\n dataFinal.setText(dataAtualMaisUm);\n }", "@Test\r\n\t\tpublic void testMovimientoTorreNegra0a() {\r\n\t\t \r\n\t\t\tDatosPrueba prueba = new DatosPrueba(torreNegra0a,\r\n\t\t\t\t\t\"Error al comprobar los movimientos del rey negro en el inicio de una aprtida en la posición 8h. \");\r\n\t\t\tboolean res = this.testMovimientos(prueba); \r\n\t\t\tassertTrue(prueba.getMensaje(), res);\r\n\t\t \r\n\t\t}", "public void introducirPagosALojamientoClienteFechas(Date fechaInicial, Date fechaFinal,TablaModelo modelo,String dpiCliente){\n long tiempo = fechaInicial.getTime();\n java.sql.Date fechaInicialSql = new java.sql.Date(tiempo);\n long tiempo2= fechaFinal.getTime();\n java.sql.Date fechaFinalSQL = new java.sql.Date(tiempo2);// pago de alojamiento en rango fchas\n try {\n PreparedStatement declaracion;// prepara la orden \n declaracion = conexion.prepareStatement(\"SELECT ALOJAMIENTO.Id,ALOJAMIENTO.Id_Reservacion,RESERVACION.Fecha_Entrada, RESERVACION.Fecha_Salida,RESERVACION.Precio FROM RESERVACION JOIN ALOJAMIENTO WHERE RESERVACION.Id=ALOJAMIENTO.Id_Reservacion AND RESERVACION.Fecha_Entrada>=? AND RESERVACION.Fecha_Entrada<=? AND RESERVACION.Dpi_Cliente=? AND RESERVACION.Check_In=1;\");\n declaracion.setDate(1,fechaInicialSql);\n declaracion.setDate(2,fechaFinalSQL);// pago de alojamiento en rango fchas\n declaracion.setString(3, dpiCliente);\n ResultSet resultado = declaracion.executeQuery();\n while (resultado.next()) {\n Object objeto[] = new Object[6];\n objeto[0] = resultado.getInt(1);\n objeto[1] = resultado.getInt(2);\n objeto[2] = resultado.getDate(3);// pago de alojamiento en rango fchas\n objeto[3] = resultado.getDate(4);\n objeto[4] = resultado.getInt(5);\n String fechaInicialProbar=objeto[2].toString();\n String fechaFinalProbar=objeto[3].toString();// pago de alojamiento en rango fchas\n String precioProbar = objeto[4].toString();\n int total=habitacion.hacerTotalAlojamiento(fechaInicialProbar, fechaFinalProbar, precioProbar);\n objeto[5]= total;\n modelo.addRow(objeto);\n } // maneja el resultado \n\n } catch (SQLException ex) {\n ex.printStackTrace();\n }\n }", "void actualizarRondaCancion( Cancion cancion, Date fecha) throws ExceptionDao;", "public void contabilizarConMesYProfesor(ProfesorBean profesor, int mes){\r\n GestionDetallesInformesBD.deleteDetallesInforme(profesor, mes); \r\n\r\n //Preparamos todos los datos. Lista de fichas de horario.\r\n ArrayList<FichajeBean> listaFichajes = GestionFichajeBD.getListaFichajesProfesor(profesor,mes);\r\n ArrayList<FichajeRecuentoBean> listaFichajesRecuento= UtilsContabilizar.convertirFichajes(listaFichajes);\r\n\r\n /**\r\n * Contabilizar horas en eventos de día completo\r\n */\r\n \r\n int segundosEventosCompletos=contabilizarEventosCompletos(listaFichajesRecuento, profesor,mes);\r\n \r\n /**\r\n * Contabilizar horas en eventos de tiempo parcial\r\n */\r\n \r\n ArrayList<EventoBean> listaEventos=GestionEventosBD.getListaEventosProfesor(false, profesor, mes);\r\n int segundosEventosParciales=contabilizarEventosParciales(listaFichajesRecuento,listaEventos, profesor, mes, \"C\");\r\n \r\n /**\r\n * Contabilizamos las horas lectivas\r\n */\r\n ArrayList<FichaBean> listaFichasLectivas=UtilsContabilizar.getHorarioCompacto(profesor, \"L\");\r\n int segundosLectivos=contabilizaHorasLectivasOCmplementarias(listaFichajesRecuento, listaFichasLectivas, profesor,\"L\", mes);\r\n \r\n /**\r\n * Contabilizar horas complementarias\r\n */\r\n ArrayList<FichaBean> listaFichasComplementarias=UtilsContabilizar.getHorarioCompacto(profesor, \"C\");\r\n int segundosComplementarios=contabilizaHorasLectivasOCmplementarias(listaFichajesRecuento, listaFichasComplementarias, profesor,\"C\", mes);\r\n \r\n /**\r\n * Contabilizamos la horas no lectivas (el resto de lo que quede en los fichajes.\r\n */\r\n int segundosNLectivos=contabilizaHorasNoLectivas(listaFichajesRecuento, profesor, true, mes);\r\n \r\n /**\r\n * Contabilizamos las horas extra añadidas al profesor\r\n */\r\n ArrayList<HoraExtraBean> listaHorasExtra=GestionHorasExtrasBD.getHorasExtraProfesor(profesor, mes);\r\n HashMap<String, Integer> tablaHorasExtra = contabilizaHorasExtra(listaHorasExtra, profesor, mes);\r\n \r\n System.out.println(\"Segundos de horas lectivas: \"+Utils.convierteSegundos(segundosLectivos));\r\n System.out.println(\"Segundos de horas complementarias: \"+Utils.convierteSegundos(segundosComplementarios));\r\n System.out.println(\"Segundos de horas no lectivas: \"+Utils.convierteSegundos(segundosNLectivos));\r\n System.out.println(\"Segundos eventos completos: \"+Utils.convierteSegundos(segundosEventosCompletos));\r\n System.out.println(\"Segundos eventos parciales: \"+Utils.convierteSegundos(segundosEventosParciales));\r\n System.out.println(\"Total: \"+Utils.convierteSegundos((segundosComplementarios+segundosLectivos+segundosNLectivos+segundosEventosCompletos+segundosEventosParciales)));\r\n \r\n /**\r\n * Comprobacion\r\n */\r\n listaFichajes = GestionFichajeBD.getListaFichajesProfesor(profesor,mes);\r\n listaFichajesRecuento= UtilsContabilizar.convertirFichajes(listaFichajes);\r\n int segundosValidacion=contabilizaHorasNoLectivas(listaFichajesRecuento, profesor, false, mes);\r\n int segundosValidacion2=segundosComplementarios+segundosLectivos+segundosNLectivos+segundosEventosCompletos+segundosEventosParciales;\r\n System.out.println(\"Comprobacion: \"+Utils.convierteSegundos(segundosValidacion));\r\n String obser=segundosValidacion==segundosValidacion2?\"Correcto\":\"No coinciden las horas en el colegio, con las horas calculadas de cada tipo.\";\r\n \r\n segundosComplementarios+=segundosEventosCompletos;\r\n segundosComplementarios+=segundosEventosParciales;\r\n\r\n //Guardamos en la base de datos\r\n GestionInformesBD.guardaInforme(profesor, obser, segundosLectivos, segundosNLectivos, segundosComplementarios,mes);\r\n \r\n }", "public void sacarPaseo(){\r\n\t\t\tSystem.out.println(\"Por las tardes me saca de paseo mi dueño\");\r\n\t\t\t\r\n\t\t}", "public void acionarInadimplencia(InstrumentoFinanceiroDO ativo);", "@Test\r\n\t\tpublic void testMovimientoTorreBlanca0a() {\r\n\t\t \r\n\t\t\tDatosPrueba prueba = new DatosPrueba(torreBlanca0a,\r\n\t\t\t\t\t\"Error al comprobar los movimientos de la torre blanca en el inicio de una aprtida en la posición 1h. \");\r\n\t\t\tboolean res = this.testMovimientos(prueba); \r\n\t\t\tassertTrue(prueba.getMensaje(), res);\r\n\t\t \r\n\t\t}", "public void leerArchivo() {\n String rfcProveedor = produccionCigarrosHelper.getProveedor().getRfc();\n String rfcTabacalera = produccionCigarrosHelper.getTabacalera().getRfc();\n\n if (archivoFoliosService != null && desperdiciosHelper.getArchivoFolios() != null) {\n try {\n desperdiciosHelper.setNombreArchivo(desperdiciosHelper.getArchivoFolios().getFileName());\n InputStream inputStream = desperdiciosHelper.getArchivoFolios().getInputstream();\n\n desperdiciosHelper.setRangoFoliosList(archivoFoliosProduccionService.leerArchivoFolios(inputStream, desperdiciosHelper.getNombreArchivo()));\n desperdiciosHelper.setRangoFoliosListAux(validadorRangosService.generarRangosProduccion(rfcTabacalera, rfcProveedor, desperdiciosHelper.getRangoFoliosList()));\n desperdiciosHelper.setMsgErrorArchivo(\"\");\n\n solicitudService.generaCadenaOriginal(firmaFormHelper.getRfcSession(), sumaRangosFolio(desperdiciosHelper.getRangoFoliosListAux()), null);\n firmaFormHelper.setCadenaOriginal(solicitudService.generaCadenaOriginal(firmaFormHelper.getRfcSession(), sumaRangosFolio(desperdiciosHelper.getRangoFoliosListAux()), null));\n desperdiciosHelper.setCantidadSolicitada(sumaRangosFolio(desperdiciosHelper.getRangoFoliosListAux()));\n\n } catch (SolicitudServiceException bE) {\n desperdiciosHelper.setMsgErrorArchivo(bE.getMessage());\n desperdiciosHelper.setMsgExitoArchivo(\"\");\n LOGGER.error(\"Error: al Leer el archivo\" + bE.getMessage(), bE);\n } catch (RangosException rE) {\n desperdiciosHelper.setMsgErrorArchivo(rE.getMessage());\n desperdiciosHelper.setMsgExitoArchivo(\"\");\n super.msgError(rE.getMessage());\n } catch (IOException io) {\n desperdiciosHelper.setMsgErrorArchivo(io.getMessage());\n desperdiciosHelper.setMsgExitoArchivo(\"\");\n LOGGER.error(\"ERROR: Al leer el Archivo : \" + io.getMessage());\n } catch (ArchivoFoliosServiceException ex) {\n LOGGER.error(\"ERROR: Al leer el Archivo : \" + ex.getMessage());\n }\n if (!desperdiciosHelper.getMsgErrorArchivo().isEmpty()) {\n desperdiciosHelper.setDeshabilitaBtnGuardar(true);\n desperdiciosHelper.setMsgExitoArchivo(\"\");\n } else {\n desperdiciosHelper.setMsgExitoArchivo(\"El archivo \" + desperdiciosHelper.getNombreArchivo() + \" se cargo con éxito\");\n desperdiciosHelper.setMsgErrorArchivo(\"\");\n }\n }\n }", "@Test\r\n\t\tpublic void testMovimientoTorreBlanca0() {\r\n\t\t \r\n\t\t\tDatosPrueba prueba = new DatosPrueba(torreBlanca0,\r\n\t\t\t\t\t\"Error al comprobar los movimientos de la torre blanca en el inicio de una aprtida en la posición 1a. \");\r\n\t\t\tboolean res = this.testMovimientos(prueba); \r\n\t\t\tassertTrue(prueba.getMensaje(), res);\r\n\t\t \r\n\t\t}", "public double selPeriodo(int periodo, int estrato) {\n double perTasa = 0;\n if (periodo == 201611) {\n if (estrato == 1) {\n perTasa = tasaNov16_1;\n }\n if (estrato == 2) {\n perTasa = tasaNov16_2;\n }\n if (estrato == 3) {\n perTasa = tasaNov16_3;\n }\n if (estrato == 4) {\n perTasa = tasaNov16_4;\n }\n if (estrato == 5) {\n perTasa = tasaNov16_5;\n }\n if (estrato == 6) {\n perTasa = tasaNov16_6;\n }\n }\n if (periodo == 201610) {\n if (estrato == 1) {\n perTasa = tasaOct16_1;\n }\n if (estrato == 2) {\n perTasa = tasaOct16_2;\n }\n if (estrato == 3) {\n perTasa = tasaOct16_3;\n }\n if (estrato == 4) {\n perTasa = tasaOct16_4;\n }\n if (estrato == 5) {\n perTasa = tasaOct16_5;\n }\n if (estrato == 6) {\n perTasa = tasaOct16_6;\n }\n }\n if (periodo == 201609) {\n if (estrato == 1) {\n perTasa = tasaSep16_1;\n }\n if (estrato == 2) {\n perTasa = tasaSep16_2;\n }\n if (estrato == 3) {\n perTasa = tasaSep16_3;\n }\n if (estrato == 4) {\n perTasa = tasaSep16_4;\n }\n if (estrato == 5) {\n perTasa = tasaSep16_5;\n }\n if (estrato == 6) {\n perTasa = tasaSep16_6;\n }\n }\n if (periodo == 201608) {\n if (estrato == 1) {\n perTasa = tasaAgo16_1;\n }\n if (estrato == 2) {\n perTasa = tasaAgo16_2;\n }\n if (estrato == 3) {\n perTasa = tasaAgo16_3;\n }\n if (estrato == 4) {\n perTasa = tasaAgo16_4;\n }\n if (estrato == 5) {\n perTasa = tasaAgo16_5;\n }\n if (estrato == 6) {\n perTasa = tasaAgo16_6;\n }\n }\n if (periodo == 201607) {\n if (estrato == 1) {\n perTasa = tasaJul16_1;\n }\n if (estrato == 2) {\n perTasa = tasaJul16_2;\n }\n if (estrato == 3) {\n perTasa = tasaJul16_3;\n }\n if (estrato == 4) {\n perTasa = tasaJul16_4;\n }\n if (estrato == 5) {\n perTasa = tasaJul16_5;\n }\n if (estrato == 6) {\n perTasa = tasaJul16_6;\n }\n }\n if (periodo == 201606) {\n if (estrato == 1) {\n perTasa = tasaJun16_1;\n }\n if (estrato == 2) {\n perTasa = tasaJun16_2;\n }\n if (estrato == 3) {\n perTasa = tasaJun16_3;\n }\n if (estrato == 4) {\n perTasa = tasaJun16_4;\n }\n if (estrato == 5) {\n perTasa = tasaJun16_5;\n }\n if (estrato == 6) {\n perTasa = tasaJun16_6;\n }\n }\n if (periodo == 201605) {\n if (estrato == 1) {\n perTasa = tasaMay16_1;\n }\n if (estrato == 2) {\n perTasa = tasaMay16_2;\n }\n if (estrato == 3) {\n perTasa = tasaMay16_3;\n }\n if (estrato == 4) {\n perTasa = tasaMay16_4;\n }\n if (estrato == 5) {\n perTasa = tasaMay16_5;\n }\n if (estrato == 6) {\n perTasa = tasaMay16_6;\n }\n }\n if (periodo == 201604) {\n if (estrato == 1) {\n perTasa = tasaAbr16_1;\n }\n if (estrato == 2) {\n perTasa = tasaAbr16_2;\n }\n if (estrato == 3) {\n perTasa = tasaAbr16_3;\n }\n if (estrato == 4) {\n perTasa = tasaAbr16_4;\n }\n if (estrato == 5) {\n perTasa = tasaAbr16_5;\n }\n if (estrato == 6) {\n perTasa = tasaAbr16_6;\n }\n }\n if (periodo == 201603) {\n if (estrato == 1) {\n perTasa = tasaMar16_1;\n }\n if (estrato == 2) {\n perTasa = tasaMar16_2;\n }\n if (estrato == 3) {\n perTasa = tasaMar16_3;\n }\n if (estrato == 4) {\n perTasa = tasaMar16_4;\n }\n if (estrato == 5) {\n perTasa = tasaMar16_5;\n }\n if (estrato == 6) {\n perTasa = tasaMar16_6;\n }\n }\n if (periodo == 201602) {\n if (estrato == 1) {\n perTasa = tasaFeb16_1;\n }\n if (estrato == 2) {\n perTasa = tasaFeb16_2;\n }\n if (estrato == 3) {\n perTasa = tasaFeb16_3;\n }\n if (estrato == 4) {\n perTasa = tasaFeb16_4;\n }\n if (estrato == 5) {\n perTasa = tasaFeb16_5;\n }\n if (estrato == 6) {\n perTasa = tasaFeb16_6;\n }\n }\n if (periodo == 201601) {\n if (estrato == 1) {\n perTasa = tasaEne16_1;\n }\n if (estrato == 2) {\n perTasa = tasaEne16_2;\n }\n if (estrato == 3) {\n perTasa = tasaEne16_3;\n }\n if (estrato == 4) {\n perTasa = tasaEne16_4;\n }\n if (estrato == 5) {\n perTasa = tasaEne16_5;\n }\n if (estrato == 6) {\n perTasa = tasaEne16_6;\n }\n }\n if (periodo == 201512) {\n if (estrato == 1) {\n perTasa = tasaDic_1;\n }\n if (estrato == 2) {\n perTasa = tasaDic_2;\n }\n if (estrato == 3) {\n perTasa = tasaDic_3;\n }\n if (estrato == 4) {\n perTasa = tasaDic_4;\n }\n if (estrato == 5) {\n perTasa = tasaDic_5;\n }\n if (estrato == 6) {\n perTasa = tasaDic_6;\n }\n }\n if (periodo == 201511) {\n if (estrato == 1) {\n perTasa = tasaNov_1;\n }\n if (estrato == 2) {\n perTasa = tasaNov_2;\n }\n if (estrato == 3) {\n perTasa = tasaNov_3;\n }\n if (estrato == 4) {\n perTasa = tasaNov_4;\n }\n if (estrato == 5) {\n perTasa = tasaNov_5;\n }\n if (estrato == 6) {\n perTasa = tasaNov_6;\n }\n }\n if (periodo == 201510) {\n if (estrato == 1) {\n perTasa = tasaOct_1;\n }\n if (estrato == 2) {\n perTasa = tasaOct_2;\n }\n if (estrato == 3) {\n perTasa = tasaOct_3;\n }\n if (estrato == 4) {\n perTasa = tasaOct_4;\n }\n if (estrato == 5) {\n perTasa = tasaOct_5;\n }\n if (estrato == 6) {\n perTasa = tasaOct_6;\n }\n }\n if (periodo == 201509) {\n if (estrato == 1) {\n perTasa = tasaSep_1;\n }\n if (estrato == 2) {\n perTasa = tasaSep_2;\n }\n if (estrato == 3) {\n perTasa = tasaSep_3;\n }\n if (estrato == 4) {\n perTasa = tasaSep_4;\n }\n if (estrato == 5) {\n perTasa = tasaSep_5;\n }\n if (estrato == 6) {\n perTasa = tasaSep_6;\n }\n }\n if (periodo == 201508) {\n if (estrato == 1) {\n perTasa = tasaAgo_1;\n }\n if (estrato == 2) {\n perTasa = tasaAgo_2;\n }\n if (estrato == 3) {\n perTasa = tasaAgo_3;\n }\n if (estrato == 4) {\n perTasa = tasaAgo_4;\n }\n if (estrato == 5) {\n perTasa = tasaAgo_5;\n }\n if (estrato == 6) {\n perTasa = tasaAgo_6;\n }\n }\n if (periodo == 201507) {\n if (estrato == 1) {\n perTasa = tasaJul_1;\n }\n if (estrato == 2) {\n perTasa = tasaJul_2;\n }\n if (estrato == 3) {\n perTasa = tasaJul_3;\n }\n if (estrato == 4) {\n perTasa = tasaJul_4;\n }\n if (estrato == 5) {\n perTasa = tasaJul_5;\n }\n if (estrato == 6) {\n perTasa = tasaJul_6;\n }\n }\n if (periodo == 201506) {\n if (estrato == 1) {\n perTasa = tasaJun_1;\n }\n if (estrato == 2) {\n perTasa = tasaJun_2;\n }\n if (estrato == 3) {\n perTasa = tasaJun_3;\n }\n if (estrato == 4) {\n perTasa = tasaJun_4;\n }\n if (estrato == 5) {\n perTasa = tasaJun_5;\n }\n if (estrato == 6) {\n perTasa = tasaJun_6;\n }\n }\n if (periodo == 201505) {\n if (estrato == 1) {\n perTasa = tasaMay_1;\n }\n if (estrato == 2) {\n perTasa = tasaMay_2;\n }\n if (estrato == 3) {\n perTasa = tasaMay_3;\n }\n if (estrato == 4) {\n perTasa = tasaMay_4;\n }\n if (estrato == 5) {\n perTasa = tasaMay_5;\n }\n if (estrato == 6) {\n perTasa = tasaMay_6;\n }\n }\n if (periodo == 201504) {\n if (estrato == 1) {\n perTasa = tasaAbr_1;\n }\n if (estrato == 2) {\n perTasa = tasaAbr_2;\n }\n if (estrato == 3) {\n perTasa = tasaAbr_3;\n }\n if (estrato == 4) {\n perTasa = tasaAbr_4;\n }\n if (estrato == 5) {\n perTasa = tasaAbr_5;\n }\n if (estrato == 6) {\n perTasa = tasaAbr_6;\n }\n }\n return perTasa;\n }", "public void actualiser(){\n try{\n \t\n /* Memo des variables : horaireDepart tableau de string contenant l'heure de depart entree par l'user\n * heure = heure saisie castee en int, minutes = minutes saisie castee en Integer\n * tpsRest = tableau de string contenant la duree du cours en heure entree par l'user\n * minutage = format minutes horaire = format heure, ils servent a formater les deux variables currentTime qui recuperent l'heure en ms\n * tempsrestant = variable calculant le temps restant en minutes, heurerestante = variable calculant le nombre d'heure restantes\n * heureDuree = duree du cours totale en int minutesDuree = duree totale du cours en minute\n * tempsfinal = temps restant reel en prenant en compte la duree du cours\n * angle = temps radian engleu = temps en toDegrees\n */\n String[] horaireDepart = Reader.read(saisie.getText(), this.p, \"\\\\ \");\n \n //on check si le pattern est bon et si l'utilisateur n'est pas un tard\n if(Reader.isHour(horaireDepart)){\n \t\n int heure = Integer.parseInt(horaireDepart[0]);\n int minutes = Integer.parseInt(horaireDepart[2]);\n minutes += (heure*60);\n String[] tpsrest = Reader.read(format.getText(), this.p, \"\\\\ \");\n \n //conversion de la saisie en SimpleDateFormat pour les calculs\n SimpleDateFormat minutage = new SimpleDateFormat (\"mm\");\n SimpleDateFormat Horaire = new SimpleDateFormat (\"HH\");\n \n //recupere l'heure en ms\n Date currentTime_1 = new Date(System.currentTimeMillis());\n Date currentTime_2 = new Date(System.currentTimeMillis());\n \n //cast en int pour les calculs\n int tempsrestant = Integer.parseInt(minutage.format(currentTime_1));\n int heurerestante = Integer.parseInt(Horaire.format(currentTime_2))*60;\n tempsrestant += heurerestante;\n \n //pareil mais pour la duree\n if(Reader.isHour(tpsrest)){\n int heureDuree = Integer.parseInt(tpsrest[0]);\n int minutesDuree = Integer.parseInt(tpsrest[2]);\n minutesDuree += (heureDuree*60);\n tempsrestant -= minutes;\n int tempsfinal = minutesDuree - tempsrestant;\n \n //conversion du temps en angle pour l'afficher \n double angle = ((double)tempsfinal*2/(double)minutesDuree)*Math.PI;\n int engleu = 360 - (int)Math.toDegrees(angle);\n for(int i = 0; i < engleu; i++){\n this.panne.dessineLine(getGraphics(), i);\n }\n \n //conversion du temps en pi radiant pour l'affichage\n if(tempsfinal < minutesDuree){\n tempsfinal *= 2;\n for(int i = minutesDuree; i > 1; i--){\n if(tempsfinal % i == 0 && minutesDuree % i == 0){\n tempsfinal /= i;\n minutesDuree /= i;\n }\n }\n }\n \n //update l'affichage\n this.resultat.setText(tempsfinal + \"/\" + minutesDuree + \"π radiant\");\n this.resultat.update(this.resultat.getGraphics());\n }\n }\n }catch(FormatSaisieException fse){\n this.resultat.setText(fse.errMsg(this.p.toString()));\n }\n }", "public void creaAddebiti(Date dataInizio, Date dataFine, ArrayList<Integer> codiciConto) {\n /* variabili e costanti locali di lavoro */\n boolean continua;\n Date dataCorr;\n Modulo modulo;\n Navigatore nav;\n ProgressBar pb;\n OpAddebiti operazione;\n\n try { // prova ad eseguire il codice\n\n /* controllo di sicurezza che le date siano in sequenza */\n continua = Lib.Data.isSequenza(dataInizio, dataFine);\n\n /* esecuzione operazione */\n if (continua) {\n modulo = Albergo.Moduli.Conto();\n nav = modulo.getNavigatoreCorrente();\n pb = nav.getProgressBar();\n operazione = new OpAddebiti(pb, dataInizio, dataFine, codiciConto);\n operazione.avvia();\n }// fine del blocco if\n\n } catch (Exception unErrore) { // intercetta l'errore\n Errore.crea(unErrore);\n }// fine del blocco try-catch\n }", "private void actualizarFondo() {\n actualizaEstadoMapa();\n if (modificacionFondoBase == true && estadoJuego != EstadoJuego.PAUSADO && estadoJuego != EstadoJuego.PIERDE){\n moverFondo();\n } else if (modificacionFondoBase == false && estadoJuego != EstadoJuego.PAUSADO && estadoJuego != EstadoJuego.PIERDE ){\n texturaFondoBase= texturaFondo1_1;\n texturaFondoApoyo= texturaFondo1_2;\n moverFondo();\n }\n }", "public void creaAddebitiGiornalieri(AddebitoFissoPannello pannello,\n int codConto,\n Date dataInizio,\n Date dataFine) {\n /* variabili e costanti locali di lavoro */\n boolean continua = true;\n Modulo modAddFisso;\n ArrayList<CampoValore> campiFissi;\n Campo campoQuery;\n CampoValore campoVal;\n ArrayList<WrapListino> lista;\n ArrayList<AddebitoFissoPannello.Riga> righeDialogo = null;\n int quantita;\n\n try { // prova ad eseguire il codice\n\n modAddFisso = this.getModulo();\n campiFissi = new ArrayList<CampoValore>();\n\n /* recupera dal dialogo il valore obbligatorio del conto */\n if (continua) {\n campoQuery = modAddFisso.getCampo(Addebito.Cam.conto.get());\n campoVal = new CampoValore(campoQuery, codConto);\n campiFissi.add(campoVal);\n }// fine del blocco if\n\n /* recupera dal dialogo il pacchetto di righe selezionate */\n if (continua) {\n righeDialogo = pannello.getRigheSelezionate();\n }// fine del blocco if\n\n /* crea il pacchetto delle righe di addebito fisso da creare */\n if (continua) {\n\n /* traverso tutta la collezione delle righe selezionate nel pannello */\n for (AddebitoFissoPannello.Riga riga : righeDialogo) {\n lista = ListinoModulo.getPrezzi(riga.getCodListino(),\n dataInizio,\n dataFine,\n true,\n false);\n quantita = riga.getQuantita();\n for (WrapListino wrapper : lista) {\n this.creaAddebitoFisso(codConto, dataInizio, wrapper, quantita);\n }\n } // fine del ciclo for-each\n }// fine del blocco if\n\n } catch (Exception unErrore) { // intercetta l'errore\n Errore.crea(unErrore);\n }// fine del blocco try-catch\n\n }", "public static void main(String[] args) {\n\r\n\t\tScanner teclado = new Scanner(System.in);\r\n\r\n\t\tfinal int DIA_ACTUAL = 9, MES_ACTUAL = 11, AÑO_ACTUAL = 2018;\r\n\r\n\t\tint dia = 0, año = 0, mes_numerico = 0, años_totales = 0;\r\n\r\n\t\tString mes = \" \";\r\n\r\n\t\tboolean bisiesto = false;\r\n\r\n\t\tSystem.out.println(\"Introduzca un mes valido \");\r\n\t\tmes = teclado.nextLine();\r\n\r\n\t\tSystem.out.println(\"Introduzca un dia valido \");\r\n\t\tdia = teclado.nextInt();\r\n\r\n\t\tSystem.out.println(\"Introduzca un año \");\r\n\t\taño = teclado.nextInt();\r\n\r\n\t\tif ((año % 4 == 0) && (año % 100 != 0) || (año % 400 == 0)) {\r\n\r\n\t\t\tbisiesto = true;\r\n\t\t}\r\n\r\n\t\tswitch (mes) {\r\n\r\n\t\tcase \"enero\":\r\n\r\n\t\t\tmes_numerico = 1;\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase \"febrero\":\r\n\r\n\t\t\tmes_numerico = 2;\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase \"marzo\":\r\n\r\n\t\t\tmes_numerico = 3;\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase \"abril\":\r\n\r\n\t\t\tmes_numerico = 4;\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase \"mayo\":\r\n\r\n\t\t\tmes_numerico = 5;\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase \"junio\":\r\n\r\n\t\t\tmes_numerico = 6;\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase \"julio\":\r\n\r\n\t\t\tmes_numerico = 7;\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase \"agosto\":\r\n\r\n\t\t\tmes_numerico = 8;\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase \"septiembre\":\r\n\r\n\t\t\tmes_numerico = 9;\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase \"octubre\":\r\n\r\n\t\t\tmes_numerico = 10;\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase \"noviembre\":\r\n\r\n\t\t\tmes_numerico = 11;\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase \"diciembre\":\r\n\r\n\t\t\tmes_numerico = 12;\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tdefault:\r\n\r\n\t\t\tSystem.out.println(\"Introduzca un mes correcto \");\r\n\t\t\tmes = teclado.nextLine();\r\n\r\n\t\t\tbreak;\r\n\r\n\t\t}\r\n\r\n\t\taños_totales = AÑO_ACTUAL - año;\r\n\r\n\t\tif ((mes_numerico == 1 || mes_numerico == 3 || mes_numerico == 5 || mes_numerico == 7 || mes_numerico == 8\r\n\t\t\t\t|| mes_numerico == 10 || mes_numerico == 12) && (dia <= 31)) {\r\n\r\n\t\t\tif ((mes_numerico > MES_ACTUAL) || (MES_ACTUAL == mes_numerico && dia > DIA_ACTUAL)) {\r\n\r\n\t\t\t\taños_totales--;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tSystem.out.println(\"Tu cantidad de años es \" + años_totales);\r\n\r\n\t\t} else if ((mes_numerico == 4 || mes_numerico == 6 || mes_numerico == 9 || mes_numerico == 11) && (dia <= 30)) {\r\n\r\n\t\t\tif ((mes_numerico > MES_ACTUAL) || (MES_ACTUAL == mes_numerico && dia > DIA_ACTUAL)) {\r\n\r\n\t\t\t\taños_totales--;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tSystem.out.println(\"Tu cantidad de años es \" + años_totales);\r\n\r\n\t\t} else if ((mes_numerico == 2 && bisiesto) && (dia <= 29)) {\r\n\r\n\t\t\tif ((mes_numerico > MES_ACTUAL) || (MES_ACTUAL == mes_numerico && dia > DIA_ACTUAL)) {\r\n\r\n\t\t\t\taños_totales--;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tSystem.out.println(\"Tu cantidad de años es \" + años_totales);\r\n\r\n\t\t} else if ((mes_numerico == 2 && !bisiesto) && (dia <= 28)) {\r\n\r\n\t\t\tif ((mes_numerico > MES_ACTUAL) || (MES_ACTUAL == mes_numerico && dia > DIA_ACTUAL)) {\r\n\r\n\t\t\t\taños_totales--;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tSystem.out.println(\"Tu cantidad de años es \" + años_totales);\r\n\r\n\t\t} else {\r\n\r\n\t\t\tSystem.out.println(\"La fecha introducida no es correcta \");\r\n\t\t}\r\n\r\n\t\tteclado.close();\r\n\r\n\t}", "public String actualizarDocumento()\r\n/* 328: */ {\r\n/* 329: */ try\r\n/* 330: */ {\r\n/* 331:323 */ if ((!this.corrigeDatosRetencion) && (this.facturaProveedorSRI.getDocumento() != null) && \r\n/* 332:324 */ (this.facturaProveedorSRI.getDocumento().isIndicadorDocumentoElectronico()) && \r\n/* 333:325 */ (FuncionesUtiles.getAnio(this.facturaProveedorSRI.getFechaRegistro()) != 9999)) {\r\n/* 334:326 */ this.facturaProveedorSRI.setFechaEmisionRetencion(this.facturaProveedorSRI.getFechaRegistro());\r\n/* 335: */ }\r\n/* 336:329 */ cargarSecuencia(this.facturaProveedorSRI, AppUtil.getPuntoDeVenta());\r\n/* 337: */ }\r\n/* 338: */ catch (ExcepcionAS2 e)\r\n/* 339: */ {\r\n/* 340:331 */ addErrorMessage(getLanguageController().getMensaje(e.getCodigoExcepcion()) + e.getMessage());\r\n/* 341: */ }\r\n/* 342:333 */ return \"\";\r\n/* 343: */ }", "private AtualizarContaPreFaturadaHelper parserRegistroTipo3(String linha) {\r\n\t\tAtualizarContaPreFaturadaHelper retorno = new AtualizarContaPreFaturadaHelper();\r\n\r\n\t\tInteger index = 0;\r\n\r\n\t\t// Tipo de registro\r\n\t\tretorno.tipoRegistro = linha.substring(index, index + REGISTRO_TIPO);\r\n\t\tindex += REGISTRO_TIPO;\r\n\r\n\t\t// Matricula do imovel\r\n\t\tretorno.matriculaImovel = linha.substring(index, index\r\n\t\t\t\t+ MATRICULA_IMOVEL);\r\n\t\tindex += MATRICULA_IMOVEL;\r\n\r\n\t\t// Codigo da Categoria\r\n\t\tretorno.codigoCategoria = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_3_CODIGO_CATEGORIA);\r\n\t\tindex += REGISTRO_TIPO_3_CODIGO_CATEGORIA;\r\n\r\n\t\t// Codigo da Subcategoria\r\n\t\tretorno.codigoSubCategoria = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_3_CODIGO_SUBCATEGORIA);\r\n\t\tindex += REGISTRO_TIPO_3_CODIGO_SUBCATEGORIA;\r\n\r\n\t\t// Consumo faturado de agua\r\n\t\tretorno.consumoFaturadoAguaFaixa = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_3_CONSUMO_FATURADO_AGUA_FAIXA);\r\n\t\tindex += REGISTRO_TIPO_3_CONSUMO_FATURADO_AGUA_FAIXA;\r\n\r\n\t\t// Valor tarifa minima de agua\r\n\t\tretorno.valorFaturadoAguaFaixa = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_3_VALOR_FATURADO_AGUA_FAIXA);\r\n\t\tindex += REGISTRO_TIPO_3_VALOR_FATURADO_AGUA_FAIXA;\r\n\r\n\t\t// Limite Inicial do Consumo na Faixa\r\n\t\tretorno.limiteInicialConsumoFaixa = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_3_LIMITE_INICIAL_CONSUMO_FAIXA);\r\n\t\tindex += REGISTRO_TIPO_3_LIMITE_INICIAL_CONSUMO_FAIXA;\r\n\r\n\t\t// Limite Final do consumo na Faixa\r\n\t\tretorno.limiteFinalConsumoFaixa = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_3_LIMITE_FINAL_CONSUMO_FAIXA);\r\n\t\tindex += REGISTRO_TIPO_3_LIMITE_FINAL_CONSUMO_FAIXA;\r\n\r\n\t\t// Valor da Tarifa Agua na Faixa\r\n\t\tretorno.valorTarifaAguaFaixa = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_3_VALOR_TARIFA_AGUA_FAIXA);\r\n\t\tindex += REGISTRO_TIPO_3_VALOR_TARIFA_AGUA_FAIXA;\r\n\r\n\t\t// Valor da Tarifa Esgoto na Faixa\r\n\t\tretorno.valorTarifaEsgotoFaixa = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_3_VALOR_TARIFA_ESGOTO_FAIXA);\r\n\t\tindex += REGISTRO_TIPO_3_VALOR_TARIFA_ESGOTO_FAIXA;\r\n\r\n\t\t// Consumo faturado de esgoto\r\n\t\tretorno.consumoFaturadoEsgotoFaixa = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_3_CONSUMO_FATURADO_ESGOTO_FAIXA);\r\n\t\tindex += REGISTRO_TIPO_3_CONSUMO_FATURADO_ESGOTO_FAIXA;\r\n\r\n\t\t// Valor tarifa minima de agua\r\n\t\tretorno.valorFaturadoEsgotoFaixa = linha.substring(index, index\r\n\t\t\t\t+ REGISTRO_TIPO_3_VALOR_FATURADO_ESGOTO_FAIXA);\r\n\t\tindex += REGISTRO_TIPO_3_VALOR_FATURADO_ESGOTO_FAIXA;\r\n\r\n\t\treturn retorno;\r\n\t}", "public java.sql.ResultSet consultaporespecialidadfecha(String CodigoEspecialidad,String fecha){\r\n java.sql.ResultSet rs=null;\r\n Statement st = null;\r\n try{\r\n \tConexion con=new Conexion();\r\n \tst = con.conn.createStatement();\r\n \trs=st.executeQuery(\"select phm.codigo,phm.horas,phm.fechas,phm.NombrePaciente,pes.nombre_especialidad,pmd.nombre,pmd.apellidos,phm.estado,pes.codigo,pmd.codigo from pyp_horariomedico phm,pyp_medico pmd,pyp_especialidad pes where pes.codigo=\"+CodigoEspecialidad+\" and phm.fechas='\"+fecha+\"' and phm.codMedico_fk=pmd.codigo and pmd.codEspe_fk=pes.codigo and phm.fechas >= CURDATE() ORDER BY phm.fechas,phm.horas\");\r\n }\r\n catch(Exception ex){\r\n \tSystem.out.println(\"Error en PYP_MetodoConsultasAsignacion>>consultaporespecialidadfecha \"+ex);\r\n }\t\r\n return rs;\r\n }", "public DocumentVente(String code, Date date, Tier fornisseur, Date datecommande, String codefourni) {\n this.code = code;\n this.date = date;\n this.client = fornisseur;\n this.datecommande = datecommande;\n this.codeclient = codefourni;\n// this.lieu = emplacement;\n \n }", "private void atualizaHistoricoPendenteRecarga(Date datExecucao) throws SQLException\n\t{\n\t\tCalendar calExecucao = Calendar.getInstance();\n\t\tcalExecucao.setTime(datExecucao);\n\t\tint diaExecucao = calExecucao.get(Calendar.DAY_OF_MONTH);\n\t\tConnection connClientes = null;\n//\t\tPreparedStatement prepClientes = null;\n\t\tPreparedStatement prepInsert = null;\n//\t\tResultSet resultClientes = null;\n\t\t\n\t\t//Parametros para consulta no banco de dados de assinantes pendentes de primeira recarga \n\t\tString datEntradaPromocao = null;\n\t\t\n\t\tswitch(diaExecucao)\n\t\t{\n\t\t\tcase 11:\n\t\t\t\tdatEntradaPromocao = \"DAT_ENTRADA_PROMOCAO >= TO_DATE('01/01/2005', 'DD/MM/YYYY') AND \" +\n\t\t\t\t\t\t\t\t\t \"DAT_ENTRADA_PROMOCAO < TO_DATE('09/02/2005', 'DD/MM/YYYY') \";\n\t\t\t\tbreak;\n\t\t\tcase 16:\n\t\t\t\tdatEntradaPromocao = \"DAT_ENTRADA_PROMOCAO >= TO_DATE('09/02/2005', 'DD/MM/YYYY') AND \" +\n\t\t\t\t \t\t\t\t\t \"DAT_ENTRADA_PROMOCAO < TO_DATE('01/04/2005', 'DD/MM/YYYY') \";\n\t\t\t\tbreak;\n\t\t\tcase 21:\n\t\t\t\tdatEntradaPromocao = \"DAT_ENTRADA_PROMOCAO >= TO_DATE('01/04/2005', 'DD/MM/YYYY') AND \" +\n\t\t\t\t \t\t\t\t\t \"DAT_ENTRADA_PROMOCAO < TO_DATE('01/07/2005', 'DD/MM/YYYY') \";\n\t\t\t\tbreak;\n\t\t\t//Caso contrario, nao faz nada e termina a execucao\n\t\t\tdefault:\n\t\t\t\treturn;\n\t\t}\n\t\t\n\t\ttry\n\t\t{\n\t\t\t//Inserindo registros no historico\n\t\t\tString sqlInsert = \"INSERT INTO TBL_GER_HISTORICO_PULA_PULA \" +\n\t\t \t \t\t\t\t \"(IDT_MSISDN, IDT_PROMOCAO, DAT_EXECUCAO, DES_STATUS_EXECUCAO, \" +\n\t\t\t\t\t\t\t \" IDT_CODIGO_RETORNO, VLR_CREDITO_BONUS) \" +\n\t\t\t\t\t\t\t \"SELECT IDT_MSISDN, IDT_PROMOCAO, ?, 'SUCESSO', ?, 0 \" +\n\t\t\t\t\t\t\t \"FROM TBL_GER_PROMOCAO_ASSINANTE \" +\n\t\t\t\t\t\t\t \"WHERE IDT_PROMOCAO = \" + String.valueOf(ID_PENDENTE_RECARGA) + \n\t\t\t\t\t\t\t \" AND \" + datEntradaPromocao;\n\t\t\t\n\t\t\tconnClientes = DriverManager.getConnection(\"jdbc:oracle:oci8:@\" + sid, usuario,senha);\n\t\t\tprepInsert = connClientes.prepareStatement(sqlInsert);\n\t\t\tprepInsert.setDate (1, new java.sql.Date(datExecucao.getTime()));\n\t\t\tprepInsert.setString(2, (new DecimalFormat(\"0000\")).format(RET_PULA_PULA_PENDENTE_RECARGA));\n\t\t\tprepInsert.executeUpdate();\n\t\t}\n\t\tfinally\n\t\t{\n\t\t\tif(prepInsert != null) prepInsert.close();\n\t\t\tif(connClientes != null) connClientes.close();\n\t\t}\n\t}", "@Então(\"a entrega será efetuada em {int}\\\\/{int}\\\\/{int}\")\n\tpublic void aEntregaSeráEfetuadaEm(String data) throws Throwable {\n\t\tDateFormat format = new SimpleDateFormat(\"dd/MM/yyyy\");\n\t\tString dataFormatada = format.format(entrega);\n\t\tAssert.assertEquals(data, dataFormatada);\n\t throw new cucumber.api.PendingException();\n\t}", "private String calculateFertileDays() {\n int year = datePicker.getYear();\n int month = datePicker.getMonth();\n int day = datePicker.getDayOfMonth();\n\n //pravia si dva kalendara. I dvata sega sochat kam parvia den ot predishnia menstrualen cikal\n Calendar firstFertileDay = new GregorianCalendar(year,month,day);\n Calendar lastFertileDay = new GregorianCalendar(year,month,day);\n\n\n\n //izchisliavane na dnite\n firstFertileDay.add(Calendar.DAY_OF_MONTH, (averageLengthOfMenstrualCycle - 17));\n lastFertileDay.add(Calendar.DAY_OF_MONTH, (averageLengthOfMenstrualCycle - 12));\n\n //sastaviane na message\n String first = firstFertileDay.get(Calendar.DAY_OF_MONTH) + \" \" +\n new DateFormatSymbols().getMonths()[firstFertileDay.get(Calendar.MONTH)] + \" \" +\n firstFertileDay.get(Calendar.YEAR);\n\n String last = lastFertileDay.get(Calendar.DAY_OF_MONTH) + \" \" +\n new DateFormatSymbols().getMonths()[lastFertileDay.get(Calendar.MONTH)] + \" \" +\n lastFertileDay.get(Calendar.YEAR);\n String messageToDisplay = \"You are ready for sex from \" + first +\n \" until \" + last ;\n\n return messageToDisplay;\n }", "public void abrir(String name, String rfc, Double sueldo, Double aguinaldo2,// Ya esta hecho es el vizualizador\r\n\t\t\tDouble primav2, Double myH2, Double gF, Double sGMM2, Double hip, Double donat, Double subR,\r\n\t\t\tDouble transp, String NivelE, Double colegiatura2) {\r\n\t\tthis.nombre=name;//\r\n\t\tthis.RFC=rfc;//\r\n\t\tthis.SueldoM=sueldo;//\r\n\t\tthis.Aguinaldo=aguinaldo2;//\r\n\t\tthis.PrimaV=primav2;//\r\n\t\tthis.MyH=myH2;//\r\n\t\tthis.GatsosFun=gF;//\r\n\t\tthis.SGMM=sGMM2;//\r\n\t\tthis.Hipotecarios=hip;//\r\n\t\tthis.Donativos=donat;//\r\n\t\tthis.SubRetiro=subR;//\r\n\t\tthis.TransporteE=transp;//\r\n\t\tthis.NivelE=NivelE;//\r\n\t\tthis.Colegiatura=colegiatura2;//\r\n\t\t\r\n\t\tthis.calculo(this.nombre, this.RFC, this.SueldoM, this.Aguinaldo, this.PrimaV,this.MyH,this.GatsosFun,\r\n\t\t\t\tthis.SGMM,this.Hipotecarios,this.Donativos,this.SubRetiro,this.TransporteE,this.NivelE,this.Colegiatura);\r\n\t\t\r\n\t\tpr.Imprimir(this.nombre, this.RFC, this.SueldoM,this.IngresoA,this.Aguinaldo,this.PrimaV,this.MyH,this.GatsosFun,this.SGMM,this.Hipotecarios,this.Donativos,this.SubRetiro,this.TransporteE,this.NivelE,this.Colegiatura,this.AguinaldoE,this.AguinaldoG,this.PrimaVE,this.PrimaVG,this.TotalIngresosG,this.MaxDedColeg,this.TotalDedNoRetiro,this.DedPerm,this.MontoISR,this.CuotaFija,this.PorcExced,this.PagoEx,this.Total);\r\n\t\t\r\n\t}", "public static void main(String[] args) throws Exception{\n System.out.println(\"prueba conexion\");\n Conexion conexion = new Conexion();\n System.out.println(\"conecto\");\n String csvFile = \"./temporal.txt\";\n BufferedReader br = null;\n String line = \"\";\n boolean bandera = true;\n ArrayList<Administradora> guardado = new ArrayList<>();\n String cvsSplitBy = \";\";\n List<String> errores = new ArrayList<>();\n int seq = 0;\n try {\n System.out.println(\"leyendo\");\n br = new BufferedReader(new FileReader(csvFile));\n System.out.println(\"empezando lineas\");\n while ((line = br.readLine()) != null) {\n System.out.println(\"line: \" + line.toString());\n String[] datos = line.split(cvsSplitBy);\n if(revisionLetras(datos[0])){\n if(revisionLetras(datos[1])){\n if(revisionTipoIdentificacion(datos[2])){\n if(revisionNumeros(datos[3])){\n if(revisionNatural(datos[4])){\n java.util.Date fecha = new Date();\n Administradora elemento = new Administradora(seq,datos[0],datos[1],datos[2],datos[3],datos[4],revisionX(datos[5]),revisionX(datos[6]),revisionX(datos[7]),fecha);\n guardado.add(elemento);\n }\n else{\n errores.add(\"Se ha encontrado problemas en: \" + datos.toString() + \" en la naturaleza\");\n bandera = false;\n }\n }\n else{\n errores.add(\"Se ha encontrado problemas en: \" + datos.toString() + \" en la identificacion\");\n bandera = false;\n }\n }\n else{\n errores.add(\"Se ha encontrado problemas en: \" + datos.toString() + \" en el tipo de identificacion\");\n bandera = false;\n }\n }\n else{\n errores.add(\"Se ha encontrado problemas en: \" + datos.toString() + \" en el nombre\");\n bandera = false;\n }\n }\n else{\n errores.add(\"Se ha encontrado problemas en: \" + datos.toString() + \" en el codigo\");\n bandera = false;\n }\n }\n if(bandera==true){\n //guardado\n errores.add(\"guardados satisfactoriamente\");\n }else{\n errores.add(\"Motivos por lo que no se guardo\");\n }\n System.out.println(\"errores: \" + errores);\n errores(errores);\n guardar(conexion.connectDatabase(\"localhost\", \"3306\", \"practica\", \"root\", \"\"), guardado);\n System.out.println(\"guardado\");\n } catch (Exception e) {\n System.out.println(\"catch\");\n } finally {\n if (null != br) {\n br.close();\n System.out.println(\"finally\");\n } \n }\n }", "public Date getFecModificacion() {\n return fecModificacion;\n }", "private void eleccionCasoDeUso(String casoDeUso) throws MareException{\t\t\n\t // Seteo de titulo y ID_BUSINESS\n\t if(casoDeUso.equals(LP_ID_ASOC_TERR)){\n\t\t\tidBusiness = ID_BUSINESS_ASOC_TERR;\n\t\t\tcodTituloLP = \"0378\";\n\t\t\tfichero= \"muestraUG.txt\";\n\t }else if(casoDeUso.equals(LP_ID_UG)){\n\t\t\tidBusiness = ID_BUSINESS_UG;\n\t\t\tcodTituloLP = \"0377\";\n\t\t\tfichero = \"muestraMUG.txt\";\n\t }else if(casoDeUso.equals(LP_ID_CREAR_UA)){\n\t\t\tidBusiness = ID_BUSINESS_CREAR_UA;\n\t\t\tcodTituloLP = \"0637\";\n\t\t\tfichero = \"muestraCUAG.txt\";\n\t }else if(casoDeUso.equals(LP_ID_ELIM_UA)){\n\t\t\tidBusiness = ID_BUSINESS_ELIM_UA;\n\t\t\tcodTituloLP = \"0380\";\n\t\t\tfichero = \"EliminaUnidadAdministrativa.txt\";\n\t }else if(casoDeUso.equals(LP_ID_CREAR_EV)){\n\t\t\tidBusiness = ID_BUSINESS_CREAR_EV;\n\t\t\tcodTituloLP = \"0381\";\n\t\t\tfichero = \"altaZON.txt\";\n\t }else if(casoDeUso.equals(LP_ID_MOD_EV)){\n\t\t\tidBusiness = ID_BUSINESS_MOD_EV;\n\t\t\tcodTituloLP = \"0382\";\n\t\t\tfichero = \"modifZON.txt\";\n\t }else if(casoDeUso.equals(LP_ID_ELIM_EV)){\n\t\t\tidBusiness = ID_BUSINESS_ELIM_EV;\n\t\t\tcodTituloLP = \"0383\";\n\t\t\tfichero = \"bajaZON.txt\";\t\t\t\n\t } \n\t}", "public String formataDataNascimento(String dataNascimentoInserida) {\n String dataNascimentoString;\n SimpleDateFormat formatadorDataNascimento = new SimpleDateFormat(\"dd/MM/yyyy\");\n Date dataNascimento = new Date();\n try {\n dataNascimento = formatadorDataNascimento.parse((dataNascimentoInserida));\n } catch (ParseException ex) {\n this.telaFuncionario.mensagemErroDataNascimento();\n dataNascimentoString = cadastraDataNascimento();\n return dataNascimentoString;\n }\n dataNascimentoString = formatadorDataNascimento.format(dataNascimento);\n dataNascimentoString = controlaConfirmacaoCadastroDataNascimento(dataNascimentoString);\n return dataNascimentoString;\n }", "public void ModificarPrestamo(PrestamoFila pf) {\n this.conexion.ConectarBD();\n String consulta = \"update prestamos set IdSocio = ?, IdLibro = ?, FechaInicio = ?, FechaFin = ? where IdPrestamo = ?\";\n try {\n this.pstm = this.conexion.getConexion().prepareStatement(consulta);\n //Indicamos los parametros del update\n this.pstm.setInt(1, pf.getIdSocio());\n this.pstm.setInt(2, pf.getIdLibro());\n this.pstm.setDate(3, new java.sql.Date(pf.getFechaInicio().getTime()));\n this.pstm.setDate(4, new java.sql.Date(pf.getFechaFin().getTime()));\n this.pstm.setInt(5, pf.getIdPrestamo());\n //Ejecutamos la consulta\n int res = pstm.executeUpdate();\n } catch (SQLException e) { \n throw new MisException(\"Error al modificar un Prestamo.\\n\"+e.toString());\n \n } catch (Exception e) {\n throw new MisException(\"Error.\\n\"+e.toString());\n \n }\n \n //Desconectamos de la BD\n this.conexion.DesconectarBD(); \n }", "public void selecteazaComanda()\n {\n for(String[] comanda : date) {\n if (comanda[0].compareTo(\"insert client\") == 0)\n clientBll.insert(idClient++, comanda[1], comanda[2]);\n else if (comanda[0].compareTo(\"insert product\") == 0)\n {\n Product p = productBll.findProductByName(comanda[1]);\n if(p!=null)//daca produsul exista deja\n productBll.prelucreaza(p.getId(), comanda[1], Float.parseFloat(comanda[2]), Float.parseFloat(comanda[3]));\n else\n productBll.prelucreaza(idProduct++, comanda[1], Float.parseFloat(comanda[2]), Float.parseFloat(comanda[3]));\n\n }\n else if (comanda[0].contains(\"delete client\"))\n clientBll.sterge(comanda[1]);\n else if (comanda[0].contains(\"delete product\"))\n productBll.sterge(comanda[1]);\n else if (comanda[0].compareTo(\"order\")==0)\n order(comanda);\n else if (comanda[0].contains(\"report\"))\n report(comanda[0]);\n }\n }", "public int getFECHAFORMALIZ() {\n return fechaformaliz;\n }", "public void introducirConsumosClienteFechas(Date fechaInicial, Date fechaFinal,TablaModelo modelo,String dpiCliente) {\n long tiempo = fechaInicial.getTime();\n java.sql.Date fechaInicialSql = new java.sql.Date(tiempo);\n long tiempo2= fechaFinal.getTime();\n java.sql.Date fechaFinalSQL = new java.sql.Date(tiempo2);\n try {// mira los consumo de unas fechas\n PreparedStatement declaracion;// prepara la orden \n declaracion = conexion.prepareStatement(\"SELECT CONSUMO_RESTAURANTE.Id_Consumo,CONSUMO_RESTAURANTE.Id_Alojamiento,CONSUMO_RESTAURANTE.Nombre_Comida,CONSUMO_RESTAURANTE.Precio_Comida,CONSUMO_RESTAURANTE.Cantidad,CONSUMO_RESTAURANTE.Fecha_Consumo FROM CONSUMO_RESTAURANTE JOIN ALOJAMIENTO JOIN RESERVACION WHERE RESERVACION.Id=ALOJAMIENTO.Id_Reservacion AND ALOJAMIENTO.Id=CONSUMO_RESTAURANTE.Id_Alojamiento AND RESERVACION.Dpi_Cliente=? AND Fecha_Consumo>=? AND Fecha_Consumo<=?\");\n declaracion.setString(1, dpiCliente);\n declaracion.setDate(2,fechaInicialSql);\n declaracion.setDate(3,fechaFinalSQL);\n ResultSet resultado = declaracion.executeQuery();\n while (resultado.next()) {// mira los consumo de unas fechas\n Object objeto[] = new Object[7];\n objeto[0] = resultado.getInt(1);\n objeto[1] = resultado.getInt(2);\n objeto[2] = resultado.getString(3);\n objeto[3] = resultado.getInt(4);// mira los consumo de unas fechas\n objeto[4] = resultado.getInt(5);\n objeto[5] = resultado.getDate(6);\n int total = (Integer)objeto[3]*(Integer)objeto[4];\n objeto[6]= total;// mira los consumo de unas fechas\n modelo.addRow(objeto);\n } // maneja el resultado \n\n } catch (SQLException ex) {\n ex.printStackTrace();\n }\n }", "public static void main(String[] args) {\n\t\n\tConta conta = new Conta();\t\n\n\t//Colocando valores no conta\n\tconta.titular = \"Duke\";\n\tconta.saldo = 1000000.0;\n\tconta.numero = 12345;\n\tconta.agencia = 54321;\n\tconta.dataAniversario = \"1985/01/12\";\n\n\tconta.saca(100.0);\n\tconta.deposita(1000.0);\n\n\tSystem.out.println(\"Saldo atual: \" + conta.saldo);\n\tSystem.out.println(\"Rendimento atual: \" + conta.calculaRendimento());\n\tSystem.out.println(\"Saldo atual depois do rendimento: \" + conta.saldo);\n\tSystem.out.println(\"Cliente: \" + conta.recuperaDados());\n\n\n\tConta c1 = new Conta();\n\tConta c2 = new Conta();\t\n\n\t//Colocando valores na nova conta (cria um objeto novo na memoria com outro registro de memoria)\n\tc1.titular = \"Flavio\";\n\tc1.saldo = 10000.0;\n\tc1.numero = 54321;\n\tc1.agencia = 12345;\n\tc1.dataAniversario = \"1900/01/12\";\n\n\t//Colocando valores na nova conta (cria um objeto novo na memoria com outro registro de memoria)\n\tc2.titular = \"Flavio\";\n\tc2.saldo = 10000.0;\n\tc2.numero = 54321;\n\tc2.agencia = 12345;\n\tc2.dataAniversario = \"1900/01/12\";\n\n\n\tif (c1.titular == c2.titular) {\n\t\tSystem.out.println(\"Iguais\");\t\t\n\t} else {\n\t\tSystem.out.println(\"Diferentes\");\n\t}\t\n\n\tconta.transfere(100000,c1);\n\n\n\t}", "public String getFechaModificacion() { return (this.fechaModificacion == null) ? \"\" : this.fechaModificacion; }", "public String getFechaModificacion() { return (this.fechaModificacion == null) ? \"\" : this.fechaModificacion; }", "public void modificarEstadoCuota2(CuotaObject cuota) throws SQLException, ParseException \r\n {\r\n PreparedStatement prepStmt = null;\r\n\r\n String insertStatement = \"UPDATE FINANCIADO_PAGOS SET ESTADO=?,FECHA=? where IDRUBRO=?\";\r\n \r\n prepStmt = con.prepareStatement(insertStatement);\r\n \r\n prepStmt.setString(1, cuota.getEstado());\r\n \r\n \r\n SimpleDateFormat formatter = new SimpleDateFormat(\"dd/MM/yyyy\");\r\n Date date1 = formatter.parse(cuota.getFecha());\r\n java.sql.Date datetmp = new java.sql.Date(date1.getTime());\r\n \r\n prepStmt.setDate(2, datetmp);\r\n \r\n \r\n prepStmt.setString(3, cuota.getIdrubro());\r\n \r\n prepStmt.executeUpdate();\r\n if (prepStmt != null) {\r\n prepStmt.close();\r\n }\r\n }", "public String MuestraCualquiera() {//PARA MOSTRAR CUALQUIER TIPO DE CLIENTE\nString Muestra=\"\";\n\nif(getTipoCliente().equals(\"Docente\")) {//SI ES DOCENTE\nMuestra=MuestraDocente();//SE MUESTRAN SOLO LOS DATOS DE DOCENTE\n}else if(getTipoCliente().equalsIgnoreCase(\"Administrativo\")) {//SI ES ADMINISTRATIVO\nMuestra=MuestraAdministrativo();//SE MUESTRAN SOLO LOS DATOS DE ADMINISTRATIVO\n}\n\nreturn Muestra;\n}", "private String[] getDateiNamen() {\n\t\tString[] dateiNamen = new String[2];\n\t\t\n\n\t\t// Nun also Dateinamen fuer Ein- und Ausgabedatei\n\t\tString eingabe = new String(\"\");\n\t\tString eingabeDatei = new String(\"\");\n\t\tString ausgabeDatei = new String(\"\");\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tboolean wiederhole3;\n\t\t\n\t\tdo {\n\t\t\twiederhole3 = true;\n\t\t\teingabe = \"\";\t\n\t\t\tSystem.out.println(\"Weiter geht's mit den Dateinamen. Bitte geben sie innerhalb einer Eingabe zuerst den der Eingabedatei,\\ndanach den der Ausgabedatei an und trennen sie die Beiden mittels '%'!\\nFaellt Ihnen kein Name ein, werden Standart-Namen (Input := startDatei.txt; Output := endDatei.txt) verwendet.\");\n\t\t\t\n\t\t\ttry {\n\t\t\t\teingabe = br.readLine().trim();\n\t\t\t\tif(eingabe.equals(\"\")) {\n\t\t\t\t\teingabe = \"startDatei.txt%endDatei.txt\";\n\t\t\t\t}\n\t\t\t\telse if(!eingabe.contains(\"%\")) {\n\t\t\t\t\tSystem.out.println(\"Da in ihrer Eingabe kein Trenn-Operator vorhanden war, benutzen wir die Eingabe als Start-Dateinamen.\");\n\t\t\t\t\teingabe = new String(eingabe + \"%\");\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tcatch(IOException ioex) {\n\t\t\t\tSystem.out.println(\"Konnte die Eingabe nicht lesen! Bitte versuchen sie es erneut!\");\n\t\t\t\teingabe = \"startDatei.txt%endDatei.txt\";\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tSystem.out.println(eingabeDatei);\n\t\t\tSystem.out.println(ausgabeDatei);\n\t\t\t// Fallunterscheidung der Dateinamen\n\t\t\t\n\t\t\t\n\t\t\tString[] getrennteNamen = eingabe.split(\"%\");\n\t\t\tif(getrennteNamen.length == 1) {\n\t\t\t\teingabeDatei = eingabe.split(\"%\")[0];\n\t\t\t\tausgabeDatei = \"endDatei.txt\";\n\t\t\t}\n\t\t\telse if(getrennteNamen.length == 2) {\n\t\t\t\teingabeDatei = eingabe.split(\"%\")[0];\n\t\t\t\tif(eingabeDatei.equals(\"\")) {\n\t\t\t\t\teingabeDatei = \"startDatei\";\n\t\t\t\t}\n\t\t\t\tausgabeDatei = eingabe.split(\"%\")[1];\n\t\t\t}\n\t\t\telse if(getrennteNamen.length > 2) {\n\t\t\t\tSystem.out.println(\"Mehr als zwei Namen sind nicht zulaessig, es werden Standard-Namen verwendet.\");\n\t\t\t\teingabeDatei = \"startDatei.txt\";\n\t\t\t\tausgabeDatei = \"endDatei.txt\";\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(\"Es wird versucht auf die Datei 'startDatei.txt' zuzugreifen.\");\n\t\t\t\teingabeDatei = \"startDatei.txt\";\n\t\t\t\tausgabeDatei = \"endDatei.txt\";\n\t\t\t}\n\t\t\t\t\n\t\t\twiederhole3 = false;\n\t\t}\n\t\twhile(wiederhole3);\n\t\t\n\t\tdateiNamen[0] = eingabeDatei;\n\t\tdateiNamen[1] = ausgabeDatei;\n\t\t\n\t\treturn dateiNamen;\n\t}", "@Test\n\tpublic void deveAlugarFilme() throws Exception {\n\t\tUsuario usuario = umUsuario().agora();\n\t\tList<Filme> filmes = Arrays.asList(umFilme().comValor(5.0).agora());\n\n //PowerMockito.whenNew(Date.class).withNoArguments().thenReturn(DataUtils.obterData(28, 4, 2017));\n /*Calendar calendar = Calendar.getInstance();\n calendar.set(Calendar.DAY_OF_MONTH, 28);\n calendar.set(Calendar.MONTH, Calendar.APRIL);\n calendar.set(Calendar.YEAR, 2017);\n PowerMockito.mockStatic(Calendar.class);\n PowerMockito.when(Calendar.getInstance()).thenReturn(calendar);*/\n\n Mockito.doReturn(DataUtils.obterData(28,4,2017)).when(service).obterData();\n\n\t\t//acao\n\t\tLocacao locacao = service.alugarFilme(usuario, filmes);\n\n\t\t//verificação\n\t\terror.checkThat(locacao.getValor(), is(equalTo(5.0)));\n\n\t\t//error.checkThat(isMesmaData(locacao.getDataLocacao(), new Date()), is(true));\n\t\t//error.checkThat(locacao.getDataLocacao(), ehHoje());\n\n //error.checkThat(isMesmaData(locacao.getDataRetorno(), obterDataComDiferencaDias(1)), is(true));\n\t\t//error.checkThat(locacao.getDataRetorno(), ehHojeComDiferenciaDias(1));\n\n\t\terror.checkThat(isMesmaData(locacao.getDataLocacao(), DataUtils.obterData(28,4,2017)), is(true));\n\t\terror.checkThat(isMesmaData(locacao.getDataRetorno(), DataUtils.obterData(29,4,2017)), is(true));\n\n\n\t}", "public void actualizarExistencias(int year, int mes);", "private String creaElenco() {\n String testoTabella ;\n String riga = CostBio.VUOTO;\n ArrayList listaPagine = new ArrayList();\n ArrayList listaRiga;\n HashMap mappaTavola = new HashMap();\n String cognomeText;\n int num;\n int taglioPagine = Pref.getInt(CostBio.TAGLIO_COGNOMI_PAGINA);\n String tag = \"Persone di cognome \";\n ArrayList titoli = new ArrayList();\n titoli.add(LibWiki.setBold(\"Cognome\"));\n titoli.add(LibWiki.setBold(\"Voci\"));\n\n for (Map.Entry<String, Integer> mappa: mappaCognomi.entrySet()) {\n\n cognomeText = mappa.getKey();\n num = mappa.getValue();\n if (num >= taglioPagine) {\n cognomeText = tag + cognomeText + CostBio.PIPE + cognomeText;\n cognomeText = LibWiki.setQuadre(cognomeText);\n cognomeText = LibWiki.setBold(cognomeText);\n }// end of if cycle\n\n listaRiga = new ArrayList();\n listaRiga.add(cognomeText);\n listaRiga.add(num);\n listaPagine.add(listaRiga);\n\n }// end of for cycle\n mappaTavola.put(Cost.KEY_MAPPA_SORTABLE_BOOLEAN, true);\n mappaTavola.put(Cost.KEY_MAPPA_TITOLI, titoli);\n mappaTavola.put(Cost.KEY_MAPPA_RIGHE_LISTA, listaPagine);\n testoTabella = LibWiki.creaTable(mappaTavola);\n\n return testoTabella;\n }", "private String formatarData(Date data)\n {\n String sDate;\n String sDia = \"\";\n String sMes = \"\";\n\n GregorianCalendar calendar = new GregorianCalendar();\n calendar.setTime(data);\n int dia = calendar.get(GregorianCalendar.DAY_OF_MONTH);\n if (dia > 0) {\n if (dia < 10) {\n sDia = \"0\";\n }\n }\n sDia += dia;\n\n int mes = calendar.get(GregorianCalendar.MONTH);\n mes = mes + 1;\n if (mes > 0) {\n if (mes < 10) {\n sMes = \"0\";\n }\n }\n sMes += mes;\n\n int ano = calendar.get(GregorianCalendar.YEAR);\n\n int hora = calendar.get(GregorianCalendar.HOUR);\n // 0 = dia\n // 1 = noite\n int amPm = calendar.get(GregorianCalendar.AM_PM);\n\n if(amPm == 1)\n {\n if(hora>0 && hora < 13)\n {\n if(hora > 11)\n hora = 0;\n else\n hora += 12;\n }\n }\n\n String sHora = \" \";\n if(hora<=9)\n {\n sHora += \"0\";\n }\n String sMin=\":\";\n int min = calendar.get(GregorianCalendar.MINUTE);\n if(min <10)\n sMin += \"0\";\n sMin += String.valueOf(min);\n sHora += String.valueOf(hora) + sMin + \":00\";\n sDate = String.valueOf(ano) + \"-\" + sMes + \"-\" + sDia + sHora;\n return sDate;\n\n }", "protected String decrisToi(){\r\n return \"\\t\"+this.nomVille+\" est une ville de \"+this.nomPays+ \", elle comporte : \"+this.nbreHabitants+\" habitant(s) => elle est donc de catégorie : \"+this.categorie;\r\n }", "public String converterTemperatura(Medidas medidaUm, Medidas medidaDois) {\n String medidaUmUnidade = medidaUm.getUnidadeDeTemperatura();\n String medidaDoisUnidade = medidaDois.getUnidadeDeTemperatura();\n boolean unidadesIguais = medidaUmUnidade.equals(medidaDoisUnidade) ? true : false;\n String errorMessage = \"Não é possível realizar a conversão, pois as duas medidas já estão na mesma unidade.\";\n\n if (unidadesIguais)\n return errorMessage;\n else {\n int medidaUmTemperaturaNova = (int) ((medidaUmUnidade == \"f\") ? ((medidaUm.getTemperatura() - 32) / 1.8)\n : ((medidaUm.getTemperatura() * 1.8) + 32));\n medidaUm.setTemperatura(medidaUmTemperaturaNova);\n String medidaUmUnidadeDeTemperaturaNova = (medidaUmUnidade == \"f\") ? \"c\" : \"f\";\n medidaUm.setUnidadeDeTemperatura(medidaUmUnidadeDeTemperaturaNova);\n\n int medidaDoisTemperaturaNova = (int) ((medidaDoisUnidade == \"f\") ? ((medidaDois.getTemperatura() - 32) / 1.8)\n : ((medidaDois.getTemperatura() * 1.8) + 32));\n medidaDois.setTemperatura(medidaDoisTemperaturaNova);\n String medidaDoisUnidadeDeTemperaturaNova = (medidaUmUnidade == \"f\") ? \"c\" : \"f\";\n medidaDois.setUnidadeDeTemperatura(medidaDoisUnidadeDeTemperaturaNova);\n }\n\n String medidaUmConvertida = medidaUm.getTemperatura() + \" \" + medidaUm.getUnidadeDeTemperatura();\n String medidaDoisConvertida = medidaDois.getTemperatura() + \" \" + medidaDois.getUnidadeDeTemperatura();\n\n return (\"Temp. 01: \" + medidaUmConvertida + \" | \" + \"Temp. 02: \" + medidaDoisConvertida);\n }", "private void persistirRemessaC17() throws Exception {\n if (this.remessa == null || this.remessa.getId() == null) { \n this.remessa = new RemessaVO();\n this.remessa.setDataHoraAbertura(new Date());\n this.remessa.setCodigoUsuarioAbertura(this.usuario.getNuMatricula());\n this.remessa.setUnidadeSolicitante(unidadeServiceRef.findUnidadeLotacaoUsuarioLogado());\n this.remessa = remessaService.salvarRascunhoRemessaAB(this.remessa);\n }\n }", "public static boolean validarFecha(String fecha)\n\t{\n\t\tCalendar calendario = Calendar.getInstance();\n\t \tint hora,minutos,segundos,dia,mes,ano;\n\t \thora =calendario.get(Calendar.HOUR_OF_DAY);\n\t \tminutos = calendario.get(Calendar.MINUTE);\n\t \tsegundos = calendario.get(Calendar.SECOND);\t \t\n\t \t\n\t \tdia = calendario.get(Calendar.DAY_OF_MONTH);\n\t \tmes = calendario.get(Calendar.MONTH);\n\t \tmes=mes+1;\n\t\tano = calendario.get(Calendar.YEAR);\t\t\n\t\tString diaFecha;\n\t\tString mesFecha;\n\t\tString anoFecha = null;\n\t\t\n\t\tint pos = 0;\n\t\tpos = fecha.indexOf('/');\n\t\tSystem.out.println(\"la posicion del primer slash es: \"+pos);\n\t\tdiaFecha = fecha.substring(0,pos);\n\t\tString resto = fecha.substring(pos+1,fecha.length());\n\t\tint pos2 = 0;\n\t\tpos2 = resto.indexOf('/');\n\t\tmesFecha = resto.substring(0,pos2);\n\t\tString resto2 = resto.substring(pos2+1,resto.length());//resto 3 es el ano\t\t\n\t\tSystem.out.println(\"la fecha es:\"+diaFecha+\",\"+mesFecha+\",\"+resto2);\t\t\n\t\tint diaInt,mesInt,anoInt;\n\t\tdiaInt=Integer.parseInt(diaFecha);\n\t\tmesInt=Integer.parseInt(mesFecha);\n\t\tanoInt=Integer.parseInt(resto2);\t\t\n\t\tSystem.out.println(\"fechaSistema:\"+dia+\"/\"+mes+\"/\"+ano);\n\t\tSystem.out.println(\"fechaEntrada:\"+diaInt+\"/\"+mesInt+\"/\"+anoInt);\n\t\tif ((anoInt<ano))\n\t\t{\n\t\t\tSystem.out.println(\"fecha de entrada es menor\");\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (mesInt<mes)\n\t\t\t{\t\t\t\t\n\t\t\t\tSystem.out.println(\"fecha de entrada es menor\");\n\t\t\t\treturn true;\t\t\t\t\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (diaInt < dia)\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(\"fecha de entrada es menor\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n \t\n\t}", "@Override\n\t@Transactional\n\tpublic boolean validarColumnasTxt(String ubicacion, Registro registro, int formato) { // Formato = 2(TXT) , 3(CSV)\n\t\tboolean columnasCoinciden = false;\n\t\tVersionPlantilla plantillaDb = versionPlantillaServiceImpl.recuperarVersionPlantillaHabilitada(registro.getId());\t\t\n\t\t//Plantilla plantillaDb = plantillaRepositoryImpl.buscarPlantillaPorRegistroJpa(registro.getId()); // Recuperar la plantilla que pertenece al registro\n\t\tList<String> listadoColumnasBd = new ArrayList<String>(); // Almacenar columnas de BD\n\t\tList<String> listadocolumnasSpss=new ArrayList<String>();\n\t\tswitch(formato)\n\t\t{\n\t\t\tcase 2:\t\t\t\t\n\t\t\t\t listadocolumnasSpss = leerColumnasTxtDelServidor(ubicacion); // Listado columnas txt\n\t\t\t\t break;\n\t\t\tcase 3:\n\t\t\t\t listadocolumnasSpss = leerColumnasCsvDelServidor(ubicacion); // Listado columnas csv\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t}\n\t\tfor (ColumnaVersionPlantilla pc : plantillaDb.getVersionesColumna()) {\n\t\t\tlistadoColumnasBd.add(pc.getPlantillaColumna().getNombre().toUpperCase());\n\t\t\t\n\t\t}\n\t\tString col1;\n\t\tfor (String col : listadocolumnasSpss) {\n\t\t\tif (listadocolumnasSpss.size() != listadoColumnasBd.size()) {\n\t\t\t\tcolumnasCoinciden = false;\n\t\t\t\t\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\t\n\t\t\t\tcol=col.toLowerCase();\n\t\t\t\tint i=0;\n\t\t\t\tcol=col.replace(\";\", \"\");\n\t\t\t\tint ascii = (int) col.charAt(0);\n\t\t\t\t//System.out.println(\"col ascii:\"+ascii);\n\t\t\t\t\n\t\t\t\tif(ascii==65279)\n\t\t\t\t{\n\t\t\t\t\tcol=col.substring(1);\t\t\t\t\t\n\t\t\t\t}\n\n\t\t\t\tif (listadoColumnasBd.contains(col.toUpperCase())) {\n\t\t\t\t\tcolumnasCoinciden = true;\n\t\t\t\t\tcontinue;// Continue funciona par for, while, y Do-while\n\t\t\t\t} else {\n\t\t\t\t\tcolumnasCoinciden = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tLOG.info(\"RETORNO : \" + columnasCoinciden);\n\t\treturn columnasCoinciden;\n\t}", "public void schreibeFreizeitbaederInTxtDatei()\r\n\t\t throws IOException{\r\n\t\t\t WriterCreator writerCreator = new ConcreteTxtWriterCreator();\r\n\t\t\t WriterProduct writerProduct = writerCreator.factoryMethod();\r\n\t\t\t //Praktikum 4\r\n \t\t\tthis.getFreizeitbaeder().forEach((fzb) -> {\r\n \t\t\t\ttry {\r\n \t\t\t\t\twriterProduct.fuegeInDateiHinzu(fzb);\r\n \t\t\t\t} catch (IOException e) {\r\n \t\t\t\t\t\r\n \t\t\t\t}\r\n \t\t\t});\r\n \t\t\twriterProduct.schliesseDatei();\t\t \r\n }", "private void gerarLaudoPermanenciaMaior(MpmPrescricaoMedica prescricao,\r\n\t\t\tList<MpmLaudo> laudoList, FatConvenioSaudePlano convenioSaudePlano,\r\n\t\t\tAghParametros seqLaudoMaiorPermanencia) {\r\n\t\tMpmTipoLaudoConvenio tipoLaudoConvenio = this\r\n\t\t\t\t.getMpmTipoLaudoConvenioDAO()\r\n\t\t\t\t.obterTempoValidadeTipoLaudoPermanenciaMaior(\r\n\t\t\t\t\t\tseqLaudoMaiorPermanencia.getVlrNumerico().shortValue(),\r\n\t\t\t\t\t\tconvenioSaudePlano);\r\n\r\n\t\tif (tipoLaudoConvenio != null) {\r\n\r\n\t\t\tShort quantidadeDiasFaturamento = 0;\r\n\t\t\tShort diasPermanenciaMaior = 0;\r\n\r\n\t\t\tMpmTipoLaudo tipoLaudoMaiorPermanencia = this.getMpmTipoLaudoDAO()\r\n\t\t\t\t\t.obterPorChavePrimaria(\r\n\t\t\t\t\t\t\tseqLaudoMaiorPermanencia.getVlrNumerico()\r\n\t\t\t\t\t\t\t\t\t.shortValue());\r\n\r\n\t\t\tif (prescricao.getAtendimento().getInternacao() != null) {\r\n\t\t\t\tif (prescricao.getAtendimento()\r\n\t\t\t\t\t\t.getInternacao().getItemProcedimentoHospitalar() != null){\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (prescricao.getAtendimento()\r\n\t\t\t\t\t.getInternacao().getItemProcedimentoHospitalar()\r\n\t\t\t\t\t.getQuantDiasFaturamento() != null){\r\n\t\t\t\t\t\tquantidadeDiasFaturamento = prescricao.getAtendimento()\r\n\t\t\t\t\t\t.getInternacao().getItemProcedimentoHospitalar()\r\n\t\t\t\t\t\t.getQuantDiasFaturamento();\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tdiasPermanenciaMaior = prescricao.getAtendimento()\r\n\t\t\t\t\t.getInternacao().getItemProcedimentoHospitalar()\r\n\t\t\t\t\t.getDiasPermanenciaMaior();\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (diasPermanenciaMaior == null || diasPermanenciaMaior > 0){\r\n\t\t\t\t\r\n\t\t\t\tInteger adicionalDias = 0;\r\n\t\t\t\tif (quantidadeDiasFaturamento != null) {\r\n\t\t\t\t\tadicionalDias = (quantidadeDiasFaturamento * 2) + 1;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif (DateUtil.validaDataTruncadaMaiorIgual(new Date(), DateUtil\r\n\t\t\t\t\t\t.adicionaDias(prescricao.getAtendimento().getInternacao()\r\n\t\t\t\t\t\t\t\t.getDthrInternacao(), adicionalDias))) {\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (this.getMpmLaudoDAO()\r\n\t\t\t\t\t\t\t.obterCountLaudosPorTipoEAtendimento(\r\n\t\t\t\t\t\t\t\t\tprescricao.getAtendimento(),\r\n\t\t\t\t\t\t\t\t\ttipoLaudoMaiorPermanencia) <= 0) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tMpmLaudo laudo = new MpmLaudo();\r\n\t\t\t\t\t\tlaudo.setDthrInicioValidade(prescricao.getAtendimento()\r\n\t\t\t\t\t\t\t\t.getInternacao().getDthrInternacao());\r\n\t\t\t\t\t\tlaudo.setContaDesdobrada(false);\r\n\t\t\t\t\t\tlaudo.setImpresso(false);\r\n\t\t\t\t\t\tlaudo.setLaudoManual(false);\r\n\t\t\t\t\t\tlaudo.setAtendimento(prescricao.getAtendimento());\r\n\t\t\t\t\t\tlaudo.setTipoLaudo(tipoLaudoMaiorPermanencia);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tlaudoList.add(laudo);\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}\r\n\t}", "private void cargarNotasEnfermeria() {\r\n\t\tMap<String, Object> parametros = new HashMap<String, Object>();\r\n\t\tparametros.put(\"admision_seleccionada\", admision_seleccionada);\r\n\t\tparametros.put(\"rol_medico\", \"S\");\r\n\t\ttabboxContendor.abrirPaginaTabDemanda(false,\r\n\t\t\t\t\"/pages/notas_enfermeria.zul\", \"NOTAS DE ENFERMERIA\",\r\n\t\t\t\tparametros);\r\n\t}", "public java.sql.ResultSet consultapormedicoespecialidadfecha(String CodigoMedico,String CodigoEspecialidad,String fecha){\r\n java.sql.ResultSet rs=null;\r\n Statement st = null;\r\n try{\r\n \tConexion con=new Conexion();\r\n \tst = con.conn.createStatement();\r\n \trs=st.executeQuery(\"select phm.codigo,phm.horas,phm.fechas,phm.NombrePaciente,pes.nombre_especialidad,pmd.nombre,pmd.apellidos,phm.estado,pes.codigo,pmd.codigo from pyp_horariomedico phm,pyp_medico pmd,pyp_especialidad pes where pmd.codigo=\"+CodigoMedico+\" and pes.codigo=\"+CodigoEspecialidad+\" and phm.fechas='\"+fecha+\"' and phm.codMedico_fk=pmd.codigo and pmd.codEspe_fk=pes.codigo and phm.fechas >= CURDATE() ORDER BY phm.fechas,phm.horas\");\r\n }\r\n catch(Exception ex){\r\n \tSystem.out.println(\"Error en PYP_MetodoConsultasAsignacion>>consultapormedicoespecialidadfecha \"+ex);\r\n }\t\r\n return rs;\r\n }", "public String generaIDPortalEmpleo(EmpresaPorAutorizarVO vo){\n\t\tString idPortalEmpleo = \"\";\t\t\n\t\tint digitoVerificador = 1;\n\t\tFormat formatter = new SimpleDateFormat(\"yyMMdd\");\t\t\n\t\ttry {\n\t\t\tDomicilioVO domicilio = vo.getDomicilio();\n\t\t\tif(vo.getIdTipoPersona() == Constantes.TIPO_PERSONA.PERSONA_FISICA.getIdTipoPersona()){\n\t\t\t\t//Tipo de Persona Física\n\t\t\t\tif(vo.getApellido2().isEmpty()){\n\t\t\t\t\t//Primeras tres letras del apellido paterno\n\t\t\t\t\t//System.out.println(\"--original--strApellido1:\" + vo.getApellido1());\n\t\t\t\t\tString strApellido1 = convertAccents(vo.getApellido1());\n\t\t\t\t\t//System.out.println(\"--modificado--strApellido1:\" + strApellido1);\n\t\t\t\t\tidPortalEmpleo = idPortalEmpleo + strApellido1.substring(0, 3);\t\n\t\t\t\t} else {\n\t\t\t\t\t//Primeras dos letras del apellido paterno\n\t\t\t\t\t//Primera letra del apellido materno\t\t\t\t\t\n\t\t\t\t\t//System.out.println(\"--original--strApellido1:\" + vo.getApellido1());\n\t\t\t\t\tString strApellido1 = convertAccents(vo.getApellido1());\n\t\t\t\t\t//System.out.println(\"--modificado--strApellido1:\" + strApellido1);\t\t\t\t\t\n\t\t\t\t\t//System.out.println(\"--original--strApellido2:\" + vo.getApellido2());\n\t\t\t\t\tString strApellido2 = convertAccents(vo.getApellido2());\n\t\t\t\t\t//System.out.println(\"--modificado--strApellido2:\" + strApellido2);\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tidPortalEmpleo = idPortalEmpleo + strApellido1.substring(0, 2);\n\t\t\t\t\tidPortalEmpleo = idPortalEmpleo + strApellido2.substring(0, 1);\n\t\t\t\t}\n\t\t\t\t//Primera letra del nombre\n\t\t\t\t//System.out.println(\"--original--strNombre:\" + vo.getNombre());\n\t\t\t\tString strNombre = convertAccents(vo.getNombre());\n\t\t\t\t//System.out.println(\"--modificado--strNombre:\" + strNombre);\t\t\t\t\t\n\t\t\t\tidPortalEmpleo = idPortalEmpleo + strNombre.substring(0, 1);\n\t\t\t\t//Fecha de nacimiento en formato yymmdd\n\t\t\t\tidPortalEmpleo = idPortalEmpleo + formatter.format(vo.getFechaNacimiento());\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t} else {\n\t\t\t\t//Tipo de Persona Moral\t\t\t\t\t\n\t\t\t\tString strRazonSocial = convertAccents(vo.getRazonSocial());\n\t\t\t\t//Primeras tres letras de razón social\n\t\t\t\t//COMENTAR EN PRODUCCION\t\t\t\t\t\t\t\t\t\n\t\t\t\tif (strRazonSocial.length() < 3) \n\t\t\t\t\tstrRazonSocial = StringUtils.rightPad(strRazonSocial, 3, \"X\");\n\t\t\t\t/**/\t\t\n\t\t\t\t//TERMINA COMENTAR EN PRODUCCION\t\t\t\t\n\t\t\t\t//\n\t\t\t\t//System.out.println(\"--modificado--strRazonSocial:\" + strRazonSocial);\t\t\t\t\t\t\t\t\t\n\t\t\t\tidPortalEmpleo = idPortalEmpleo + strRazonSocial.substring(0, 3);\t\n\t\t\t\t//Fecha de acta en formato yymmdd\n\t\t\t\tidPortalEmpleo = idPortalEmpleo + formatter.format(vo.getFechaActa());\n\t\t\t}\n\t\t\tidPortalEmpleo = idPortalEmpleo + domicilio.getCodigoPostal();\t\t\t\n\t\t\t//Código verificador (1)\t\t\t\t\n\t\t\tEmpresaPorAutorizarDAO epaDAO = new EmpresaPorAutorizarDAO();\n\t\t\tdigitoVerificador = epaDAO.obtenerDigitoVerificador(idPortalEmpleo, vo.getIdTipoPersona());\t\n\t\t\t//rellenar\n\t\t\tint lenId = idPortalEmpleo.length();\n\t\t\t//System.out.println(\"------digitoVerificador:\" + digitoVerificador);\n\t\t\tint lenDigito = String.valueOf(digitoVerificador).length();\n\t\t\t//System.out.println(\"------lenDigito:\" + lenDigito);\n\t\t\tint intRelleno = PORTAL_ID_SIZE - (lenId + lenDigito);\n\t\t\t//System.out.println(\"------intRelleno:\" + intRelleno);\n\t\t\tString strRelleno = \"\";\n\t\t\tif(intRelleno>0){\n\t\t\t\tfor(int i=0; i<intRelleno; i++){\n\t\t\t\t\tstrRelleno = strRelleno + \"0\";\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t\t//System.out.println(\"------strRelleno:\" + strRelleno);\n\t\t\tidPortalEmpleo = idPortalEmpleo + strRelleno + digitoVerificador;\n\t\t\t//System.out.println(\"------idPortalEmpleo:\" + idPortalEmpleo);\n\t\t\n\t\t} catch (RuntimeException e) {\n\t\t\tlogger.error(e.toString());\n\t\t\te.printStackTrace();\n\t\t\tthrow new PersistenceException(e);\n\t\t} catch (SQLException e) {\n\t\t\tlogger.error(e.toString());\n\t\t\te.printStackTrace();\n\t\t\tthrow new PersistenceException(e);\n\t\t} catch (Exception e) {\n\t\t\tlogger.error(e.toString());\t\t\t\n\t\t\te.printStackTrace();\n\t\t\tthrow new PersistenceException(e);\n\t\t}\t\t\n\t\treturn idPortalEmpleo;\n\t}", "Object obtenerPolizasPorFolioSolicitudNoCancelada(int folioSolicitud,String formatoSolicitud);", "public void inativarMovimentacoes() {\n\n\t\ttry {\n\n\t\t\tif (((auxMovimentacao.getDataMovimentacao())\n\t\t\t\t\t.before(permitirCadastrarMovimentacao(movimentacao.getAlunoTurma()).getDataMovimentacao()))\n\t\t\t\t\t|| (auxMovimentacao.getDataMovimentacao()).equals(\n\t\t\t\t\t\t\tpermitirCadastrarMovimentacao(movimentacao.getAlunoTurma()).getDataMovimentacao())\n\t\t\t\t\t) {\n\t\t\t\tExibirMensagem.exibirMensagem(Mensagem.MOVIMENTACOES_ANTERIORES);\n\t\t\t} else {\n\n\t\t\t\tDate dataFinal = auxMovimentacao.getDataMovimentacao();\n\t\t\t\tCalendar calendarData = Calendar.getInstance();\n\t\t\t\tcalendarData.setTime(dataFinal);\n\t\t\t\tcalendarData.add(Calendar.DATE, -1);\n\t\t\t\tDate dataInicial = calendarData.getTime();\n\n\t\t\t\tMovimentacao mov = new Movimentacao();\n\t\t\t\tmov = (Movimentacao) movimentacaoAlunoDAO.listarTodos(Movimentacao.class,\n\t\t\t\t\t\t\" a.dataMovimentacao = (select max(b.dataMovimentacao) \"\n\t\t\t\t\t\t\t\t+ \" from Movimentacao b where b.alunoTurma = a.alunoTurma) \"\n\t\t\t\t\t\t\t\t+ \" and a.status is true and a.alunoTurma.status = true and dataMovimentacaoFim = null and a.alunoTurma = \"\n\t\t\t\t\t\t\t\t+ movimentacao.getAlunoTurma().getId())\n\t\t\t\t\t\t.get(0);\n\n\t\t\t\tmov.setControle(false);\n\t\t\t\tmov.setDataMovimentacaoFim(dataInicial);\n\t\t\t\tmovimentacaoService.inserirAlterar(mov);\n\n\t\t\t\tAlunoTurma aluno = new AlunoTurma();\n\t\t\t\taluno = daoAlunoTurma.buscarPorId(AlunoTurma.class, movimentacao.getAlunoTurma().getId());\n\t\t\t\taluno.setControle(0);\n\t\t\t\t\n\n\t\t\t\tauxMovimentacao.setAlunoTurma(movimentacao.getAlunoTurma());\n\t\t\t\tauxMovimentacao.setStatus(true);\n\t\t\t\tauxMovimentacao.setControle(false);\n\n\t\t\t\tmovimentacaoService.inserirAlterar(auxMovimentacao);\n\t\t\t\t\n\t\t\t\tif(auxMovimentacao.getSituacao()==5){\n//\t\t\t\t\t\n//\t\t\t\t\tCurso cursoAluno = new Curso();\n//\t\t\t\t\tcursoAluno = daoCurso.buscarPorId(Curso.class, auxMovimentacao.getAlunoTurma().getTurma().getCurso().getId());\n\t\t\t\t\t\n\t\t\t\t\taluno.setSituacao(5);\n\t\t\t\t\taluno.setLiberado(false);\n\t\t\t\t\talunoTurmaService.inserirAlterar(aluno);\n\t\t\t\t\t\n\t\t\t\t\t//liberar para responder o questionário\n\t\t\t\t\tAluno alunoResponde = new Aluno(); \n\t\t\t\t\talunoResponde = daoAluno.buscarPorId(Aluno.class, aluno.getAluno().getId());\n\t\t\t\t\t \n\t\t\t\t // email.setCursos(auxMovimentacao.getAlunoTurma().getTurma().getCurso());\n\t\t\t\t\t//email.setTurma(auxMovimentacao.getAlunoTurma().getTurma());\n\t\t\t\t\temail.setEnviado(false);\n\t\t\t\t\temail.setStatus(true);\n\t\t\t\t\temail.setAlunoTurma(auxMovimentacao.getAlunoTurma());\n\t\t\t\t\t\n\t\t\t\t\t//email.setAluno(alunoResponde);\n\t\t\t\t\temailService.inserirAlterar(email);\n\t\t\t\t\t//enviar o email para responder \n\t\t\t\t\t\n\t\t\t\t}else{\n\t\t\t\t\taluno.setSituacao(0);\n\t\t\t\t\talunoTurmaService.inserirAlterar(aluno);\n\t\t\t\t}\n\t\t\t\taluno = new AlunoTurma();\n\t\t\t\temail = new Email();\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tFecharDialog.fecharDialogAlunoCursoEditar();\n\t\t\t\tFecharDialog.fecharDialogAlunoEditarCurso();\n\t\t\t\tFecharDialog.fecharDialogAlunoTrancamento();\n\t\t\t\talterar(movimentacao);\n\n\t\t\t\tExibirMensagem.exibirMensagem(Mensagem.SUCESSO);\n\t\t\t\tauxMovimentacao = new Movimentacao();\n\n\t\t\t\talunoTurmaService.update(\" AlunoTurma set permiteCadastroCertificado = 2 where id = \"\n\t\t\t\t\t\t+ movimentacao.getAlunoTurma().getId());\n\n\t\t\t\n\t\t\t\tcriarNovoObjetoAluno();\n\t\t\t\tatualizarListas();\n\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t\tExibirMensagem.exibirMensagem(Mensagem.ERRO);\n\t\t}\n\n\t}", "public void calcular()\r\n/* 530: */ {\r\n/* 531:556 */ this.facturaProveedorSRI.setMontoIva(this.facturaProveedorSRI.getBaseImponibleDiferenteCero().multiply(\r\n/* 532:557 */ ParametrosSistema.getPorcentajeIva().divide(BigDecimal.valueOf(100L))));\r\n/* 533: */ }", "public void calculoPersonal(){\n ayudantes = getAyudantesNecesarios();\n responsables = getResponsablesNecesarios();\n \n //Calculo atencion al cliente (30% total trabajadores) y RRPP (10% total trabajadores):\n \n int total = ayudantes + responsables;\n \n atencion_al_cliente = (total * 30) / 100;\n \n RRPP = (total * 10) / 100;\n \n //Creamos los trabajadores\n \n gestor_trabajadores.crearTrabajadores(RRPP, ayudantes,responsables,atencion_al_cliente);\n \n }", "private int contabilizaHorasNoLectivas(ArrayList<FichajeRecuentoBean> listaFichajesRecuento, ProfesorBean profesor, boolean guardar, int mes) {\r\n int segundos=0;\r\n for (FichajeRecuentoBean fichajeRecuento : listaFichajesRecuento) {\r\n// System.out.println(fichajeRecuento.getFecha()+\" \"+fichajeRecuento.getHoraEntrada()+\"->\"+fichajeRecuento.getHoraSalida()+\" => \"+UtilsContabilizar.dimeDuracion(fichajeRecuento.getHoraEntrada(),fichajeRecuento.getHoraSalida()));\r\n segundos+=UtilsContabilizar.dimeDuracion(fichajeRecuento.getHoraEntrada(),fichajeRecuento.getHoraSalida());\r\n \r\n DetalleInformeBean detalleInforme=new DetalleInformeBean();\r\n detalleInforme.setIdProfesor(profesor.getIdProfesor());\r\n detalleInforme.setTotalHoras(UtilsContabilizar.dimeDuracion(fichajeRecuento.getHoraEntrada(),fichajeRecuento.getHoraSalida()));\r\n detalleInforme.setFecha(fichajeRecuento.getFecha());\r\n detalleInforme.setHoraIni(fichajeRecuento.getHoraEntrada());\r\n detalleInforme.setHoraFin(fichajeRecuento.getHoraSalida());\r\n detalleInforme.setTipoHora(\"NL\");\r\n if(guardar && detalleInforme.getTotalHoras()>0)GestionDetallesInformesBD.guardaDetalleInforme(detalleInforme, \"contabilizaHorasNoLectivas\", mes);\r\n \r\n }\r\n return segundos;\r\n }" ]
[ "0.63138115", "0.61593735", "0.6148405", "0.61025596", "0.6027052", "0.601694", "0.59608024", "0.59608024", "0.5942456", "0.59305406", "0.5925967", "0.59226716", "0.5914946", "0.59015316", "0.58988583", "0.58805734", "0.58701247", "0.5860164", "0.5838158", "0.58349526", "0.5805848", "0.58044076", "0.5798545", "0.57948256", "0.57938194", "0.57750976", "0.57325476", "0.572961", "0.5722314", "0.57101303", "0.5698529", "0.5690319", "0.5686812", "0.5685212", "0.5685054", "0.565293", "0.5631488", "0.56284773", "0.5621072", "0.5614077", "0.5609721", "0.5607961", "0.5605906", "0.56053346", "0.5591508", "0.5581626", "0.55632037", "0.55464906", "0.5545073", "0.55420995", "0.55381656", "0.55358875", "0.5535692", "0.5535281", "0.55315876", "0.55270094", "0.5524559", "0.55118394", "0.5511803", "0.55064607", "0.55056703", "0.5505129", "0.5501737", "0.5499309", "0.5493752", "0.5488526", "0.5487714", "0.5481916", "0.5480526", "0.54805064", "0.5478131", "0.54747057", "0.54711527", "0.5468567", "0.5468333", "0.54671085", "0.54667133", "0.54657084", "0.54657084", "0.54630184", "0.54565495", "0.5456152", "0.544975", "0.5448562", "0.5444894", "0.5442224", "0.5441749", "0.54398245", "0.5437248", "0.5427504", "0.54261786", "0.54258233", "0.5425765", "0.5421298", "0.5414315", "0.5413301", "0.5413075", "0.540963", "0.54079753", "0.5407556", "0.5404032" ]
0.0
-1
inizio modifica mail 08/10/2014 10:38
private static DocumentoType[] getDocumentoTypeFromBPSDettaglioCartellaResponse( DettaglioCartellaAvvisoResponse response) { it.equitalia.dettagliocartellaavviso.wsdl.DocumentoType bpelDocumentoType = response.getCartellaAvviso().getDocumento(); DocumentoType[] result = new DocumentoType[1]; DocumentoType documentoType = new DocumentoType(); result[0] = documentoType; IdentificativoDocumentoType identificativoDocumentoType = new IdentificativoDocumentoType(); identificativoDocumentoType.setTipoDocumento(bpelDocumentoType.getIdDocumento().getTipoDocumento() ); //DATATYPEID=1 Descrizione identificativoDocumentoType.setNumeroDocumento(bpelDocumentoType.getIdDocumento().getNumeroDocumento() ); //DATATYPEID=2 N° Cartella documentoType.setIdDocumento(identificativoDocumentoType); it.equitalia.gestorefascicolows.dati.EnteType[] enti = new it.equitalia.gestorefascicolows.dati.EnteType[bpelDocumentoType.getEnte().length]; for (int iEnte = 0; iEnte < bpelDocumentoType.getEnte().length; iEnte++) { EnteType enteType = new EnteType(); enteType.setDescrizione(bpelDocumentoType.getEnte()[iEnte].getDescrizione()); //DATATYPEID=3 Ente enti[iEnte] = enteType; } documentoType.setEnte(enti); documentoType.setDataNotifica(bpelDocumentoType.getDataNotifica()) ; //DATATYPEID=4 Data Notifica documentoType.setImportoTotaleDocumento(bpelDocumentoType.getImportoTotaleDocumento().doubleValue()) ; //DATATYPEID=5 Importo Iniziale documentoType.setImportoInizialeTributi(bpelDocumentoType.getImportoInizialeTributi().doubleValue()) ; //DATATYPEID=6 Importo a ruolo documentoType.setImportoTotaleCompensi(bpelDocumentoType.getImportoTotaleCompensi().doubleValue()); // DATATYPEID=7 Compensi entro le scadenze documentoType.setImportoTotaleNotifica(bpelDocumentoType.getImportoTotaleNotifica().doubleValue()); //DATATYPEID=8 Diritti di Notifica documentoType.setImportoResiduoDocumento(bpelDocumentoType.getImportoResiduoDocumento().doubleValue()); // DATATYPEID=9 Importo da Pagare documentoType.setImportoResiduoTributi(bpelDocumentoType.getImportoResiduoTributi().doubleValue()); // DATATYPEID=10 Importi a ruolo residui documentoType.setImportoResiduoCompensi(bpelDocumentoType.getImportoResiduoCompensi().doubleValue()); //DATATYPEID=11 Compensi oltre le scadenze documentoType.setImportoResiduoNotifica(bpelDocumentoType.getImportoResiduoNotifica().doubleValue()); // DATATYPEID=12 Diritti di Notifica documentoType.setImportoInteressiMora(bpelDocumentoType.getImportoInteressiMora().doubleValue()); // DATATYPEID=13 Interessi di mora documentoType.setImportoSpeseProcedure(bpelDocumentoType.getImportoSpeseProcedure().doubleValue()); //DATATYPEID=14 Spese di Procedura documentoType.setImportoAltreSpese(bpelDocumentoType.getImportoAltreSpese().doubleValue()); //DATATYPEID=15 Altre Spese documentoType.setFlagSospensione(bpelDocumentoType.getFlagSospensione()); //DATATYPEID=16 Sospensioni documentoType.setFlagSgravio(bpelDocumentoType.getFlagSgravio()); // DATATYPEID=17 Sgravi documentoType.setFlagRateazione(bpelDocumentoType.getFlagRateazione()); //DATATYPEID=18 Rateazioni documentoType.setFlagProcedura(bpelDocumentoType.getFlagProcedura()); //DATATYPEID=19 Procedure documentoType.setNumeroRav( bpelDocumentoType.getNumeroRav() ); //DATATYPEID=12 Numero RAV documentoType.setRObjectId("-") ; //DATATYPEID=91 documentoType.setStatoPdf(CartellaDAOImpl.STATO_DOCUMENTUM_NON_RICHIESTO) ; //DATATYPEID=92 documentoType.setStatoRelate(CartellaDAOImpl.STATO_DOCUMENTUM_NON_RICHIESTO) ; //DATATYPEID=93 return result ; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "String getExpirationtMailBody( );", "private void sendMailLogInfo() {\n\t\tif (mChangedInfoList.size() == 0) {\n\t\t\treturn;\n\t\t}\n\t\t// 1.导出信息\n\t\tString content = dumpLogInfoWithHtml();\n\t\t\n\t\t// 2. 更新收件人与标题\n\t\tmMailSender.updateMailToAndCc(mMailReceivers, mMailCcReceivers);\n\t\t\n\t\tLogger.println(\"==SvnLog send emal with subject \" + mMailSubject);\n\t\t\n\t\t// 3.发送信息send\n\t\tmMailSender.sendHtmlMail(mMailSubject, content);\n\t\t\n\t\t// 4.清理此轮信息\n\t\tclearInfo();\n\t}", "private void check() {\n\n SimpleDateFormat dateFormat = new SimpleDateFormat(\"dd/MM/yyyy\");\n Date date = new Date();\n Date date2 = new Date();\n\n Calendar calendar = Calendar.getInstance();\n date = calendar.getTime();\n\n // Se traen todos los miembros.\n Iterator e = memberBroker.getList(\"name\", \"ASC\");\n membersData member;\n accountsData account;\n //Calendar hoy = Calendar.getInstance();\n StringBuffer managerBody = new StringBuffer(\"\");\n StringBuffer memberBody = new StringBuffer(\"\");\n sendMail sm = new sendMail();\n\n\n while (e.hasNext()) { \n member = new membersData();\n account = new accountsData();\n member = (membersData) e.next();\n account=(accountsData) accountBroker.getData(member.getId_account());\n \n \n System.out.println(\"CHECKING (\" + member.getname() + -+member.getid() + -+member.getId_account() + \")\");\n\n //String mainURL = TMSConfigurator.getMainURL();\n String mainURL = account.getMain_url();\n managerBody = new StringBuffer(\"\");\n\n memberBody = new StringBuffer(\"\");\n\n // Se toma la fecha de hoy y la fecha de expiracion y se calcula la diferencia\n date2 = member.getExpired_date();\n long days = daysBetween(new Date(date.getTime()), new Date(date2.getTime()));\n \n if (days == 1) {\n System.out.println(\"un dia antes\");\n memberBody.append(\"Cuenta: \" + member.getname() + \"<br>\");\n memberBody.insert(0, \"La cuenta esta apunto de expirar le queda \" + days + \".<br>\");\n sm.sendCheckTasks(member.getemail_work(), memberBody.toString());\n\n managerBody.append(\"<BLOCKQUOTE>Miembro: \" + member.getname() + \"<br>\");\n managerBody.insert(0, \"La cuenta esta apunto de expirar le queda \"+days+\".<br>\");\n \n sm.sendCheckTasks(account.getEmail(),\n managerBody.toString());\n sm.sendCheckTasks(account.getEmail(),\n managerBody.toString());\n\n }\n if (days == 0) {\n System.out.println(\"ultimo dia\");\n memberBody.append(\"Cuenta: \" + member.getname() + \"<br>\");\n memberBody.insert(0, \"La cuenta esta apunto de expirar le queda \" + days + \".<br>\");\n sm.sendCheckTasks(member.getemail_work(), memberBody.toString());\n\n managerBody.append(\"<BLOCKQUOTE>Miembro: \" + member.getname() + \"<br>\");\n managerBody.insert(0, \"La cuenta esta apunto de expirar le queda \"+days+\".<br>\");\n \n sm.sendCheckTasks(account.getEmail(),\n managerBody.toString());\n sm.sendCheckTasks(account.getEmail(),\n managerBody.toString());\n }\n if (days == 7) {\n System.out.println(\"a una semana\");\n memberBody.append(\"Cuenta: \" + member.getname() + \"<br>\");\n memberBody.insert(0, \"La cuenta esta apunto de expirar le queda \" + days + \".<br>\");\n sm.sendCheckTasks(member.getemail_work(), memberBody.toString());\n\n managerBody.append(\"<BLOCKQUOTE>Miembro: \" + member.getname() + \"<br>\");\n managerBody.insert(0, \"La cuenta esta apunto de expirar le queda \"+days+\".<br>\");\n \n sm.sendCheckTasks(account.getEmail(),\n managerBody.toString());\n sm.sendCheckTasks(account.getEmail(),\n managerBody.toString());\n }\n /*if (hoy.getTimeInMillis() > end) {\n // Ya estas atrasado mas alla del umbral maximo permitido!!\n System.out.println(\"\\t\\t\\tAtrasada!!\");\n if (atrasadoEquipo == false) {\n // Al menos un miembro del equipo esta atrazado.\n managerBody.append(\"Proyecto: \" + proyecto.getname() + \"<br>\");\n atrasadoEquipo = true;\n }\n if (atrasado == false) {\n // Este member no estaba atrasado, se agrega el encabezado para\n // su email. \n memberBody.append(\"Proyecto: \" + proyecto.getname() + \"<br>\");\n managerBody.append(\"<BLOCKQUOTE>Miembro: \" + team.getparentMember().getname() + \"<br>\");\n }\n if (team.getparentMember().getprofile().equals(\"0\") ||\n team.getparentMember().getprofile().equals(\"1\")) {\n // Siempre el mensaje de atrazo, pero no es un usuario externo\n memberBody.append(\"<BLOCKQUOTE>Tarea (<a href='\" + mainURL + \"/tasks.do?operation=view&id=\" +\n task.getid() + \"'>\" + task.getname() + \"</a>):\\tAtrasada<br>\" +\n \"</BLOCKQUOTE>\");\n } else {\n // Se trata de un usuario del cliente\n memberBody.append(\"<BLOCKQUOTE>Tarea (<a href='\" + mainURL + \"/portalTasks.do?operation=view&id=\" +\n task.getid() + \"'>\" + task.getname() + \"</a>):\\tAtrasada<br>\" +\n \"</BLOCKQUOTE>\");\n }\n managerBody.append(\"<BLOCKQUOTE>Tarea (<a href='\" + mainURL + \"/tasks.do?operation=view&id=\" +\n task.getid() + \"'>\" + task.getname() + \"</a>):\\tAtrasada<br>\" + \"\\t Asignada a: \" +\n (task.getassigned_to() == 0 ? \"No Asignada\" : task.getparentAssigned().getname()) +\n \"</BLOCKQUOTE>\");\n // Se cambia el valor\n atrasado = true;\n } else {\n System.out.println(\"\\t\\t\\tOK!!\");\n }\n // Se le envia el email al miembro del equipo si y solo si esta atrazado\n if (atrasado) {\n // enviar correo al usuario\n memberBody.insert(0, \"Las siguientes tareas est&aacute;n atrasadas m&aacute;s all&aacute; del umbral de tolerancia permitido.<br>\");\n managerBody.append(\"</BLOCKQUOTE>\");\n sm.sendCheckTasks(team.getparentMember().getemail_work(),\n memberBody.toString());\n }\n // Si alguien del proyecto esta atrazado se envia la lista de cada member\n // al administrador\n if (atrasadoEquipo) {\n managerBody.insert(0, \"Las siguientes tareas est&aacute;n atrasadas m&aacute;s all&aacute; del umbral de tolerancia permitido.<br>\");\n sm.sendCheckTasks(proyecto.getparentOwner().getemail_work(),\n managerBody.toString());\n }\n */\n\n\n // while de miembros\n\n\n }\n }", "public Historique SendMail( Historique h,String resultat ,String date,String heure) throws Exception {\n\r\n\r\n Logger log = LoggerFactory.getLogger(MailController.class);\r\n\r\n \r\n\r\n \r\n log.info(\"Spring Mail - Sending Simple Email with JavaMailSender Example\");\r\n\r\n Mail mail = new Mail();\r\n mail.setFrom(\"harb.nihel55@gmail.com\");\r\n \r\n //mail.setTo(h.get().getEmails());\r\n String [] res =h.getEmails().split(\"\\\\s\");\r\n for(int i=0; i<res.length;i++)\r\n \r\n {\r\n \tSystem.out.println(res[i]);\r\n mail.setTo(res[i]);\r\n \r\n if(resultat.equals(\"echec\"))\r\n { \t mail.setSubject(\" échec d'éxécution du test\");\r\n mail.setContent(\"Echec de test \"+h.getNom()+\" éffectué à \"+date+\"à l'heure \"+heure);}\r\n else\r\n { \t\r\n mail.setSubject(\"Retard d'éxécution du test\");\r\n mail.setContent(\"Retard d'éxecution :temps de réponse réél est \"+h.getTemps_rep_reel()+\" et le temps de réponse attendu = est:\"+h.getResultat_attendu());}\r\n emailService.sendSimpleMessage(mail);\r\n }\r\n \r\n\r\n \r\n\t\treturn null; \r\n\r\n }", "public static String textoMensajeMail(String apellido,String nombreActividad, String expediente, \r\n\t\t\tString fechaVencimiento, int modo)\r\n\t{\n\t\tString texto =\"\";\r\n\t\tif (modo==1)\r\n\t\t{\r\n\t\t\ttexto = \"Estimado Doc. \"+apellido+\":\\n\" + \" La actividad procesal: \" + nombreActividad +\r\n\t\t\t\t\t\" del expediente: \" + expediente + \", esta proxima a vencer el dia \" + fechaVencimiento +\r\n\t\t\t\t\t\"\\n\\nPor favor tomar las medidas del caso.\" + \r\n\t\t\t\t\t\"\\n\\nAtte.\" + \r\n\t\t\t\t\t\"\\n\" +\r\n\t\t\t\t\t\"\\nSISTEMA DE GESTION LEGAL\";\r\n\t\t}\r\n\t\tif (modo==2)\r\n\t\t{\r\n\t\t\ttexto = \"Estimado Doc. \"+apellido+\":\\n\" + \" La actividad procesal: \" + nombreActividad +\r\n\t\t\t\t\t\" del expediente: \" + expediente + \" ha cambiado. La nueva Fecha de Vencimiento es: \" +\r\n\t\t\t\t\tfechaVencimiento +\r\n\t\t\t\t\t\"\\n\\nPor favor tomar las medidas del caso.\" + \r\n\t\t\t\t\t\"\\n\\nAtte.\" + \r\n\t\t\t\t\t\"\\n\" +\r\n\t\t\t\t\t\"\\nSISTEMA DE GESTION LEGAL\";\r\n\t\t}\r\n\t\tif (modo==3)\r\n\t\t{\r\n\t\t\ttexto = \"Estimado Doc. \"+apellido+\":\\n\" + \" La actividad procesal: \" + nombreActividad +\r\n\t\t\t\t\t\" del expediente: \" + expediente + \" ha vencido.\" +\r\n\t\t\t\t\t\"\\n\\nPor favor tomar las medidas del caso.\" + \r\n\t\t\t\t\t\"\\n\\nAtte.\" + \r\n\t\t\t\t\t\"\\n\" +\r\n\t\t\t\t\t\"\\nSISTEMA DE GESTION LEGAL\";\r\n\t\t}\r\n\t\treturn texto;\r\n\t}", "private void MailGonderDosyaDinle(Socket client, ServerSocket server) throws IOException, ClassNotFoundException {\n \n String gelen;\n\n PrintWriter out = new PrintWriter(client.getOutputStream());\n out.println(\"220\");\n out.flush();\n\n InputStreamReader in = new InputStreamReader(client.getInputStream());\n BufferedReader buf = new BufferedReader(in);\n gelen = buf.readLine(); // helo geldi\n\n out = new PrintWriter(client.getOutputStream());\n out.println(\"250\");\n out.flush();\n\n in = new InputStreamReader(client.getInputStream());\n buf = new BufferedReader(in);\n gelen = buf.readLine(); // mail_from geldi\n\n out = new PrintWriter(client.getOutputStream());\n out.println(\"250_sender_ok\");\n out.flush();\n\n in = new InputStreamReader(client.getInputStream());\n buf = new BufferedReader(in);\n gelen = buf.readLine(); // rcpt_to: geldi\n ServerCommon.mailGonderilecekKisi = gelen.split(\":\")[1];\n\n out = new PrintWriter(client.getOutputStream());\n out.println(\"250_recipient_ok\");\n out.flush();\n\n in = new InputStreamReader(client.getInputStream());\n buf = new BufferedReader(in);\n gelen = buf.readLine(); // DATA geldi\n\n out = new PrintWriter(client.getOutputStream());\n out.println(\"354\");\n out.flush();\n\n ////////////// 1 MSS lik Tampon alma işlemleri baslangic\n // tamponlama mantıgı clietdeki ile aynı \n ObjectInputStream objectInput = new ObjectInputStream(client.getInputStream());//istemciye onay veriliyor.\n Packet ilkPacket = (Packet) objectInput.readObject();\n\n if (ilkPacket.getDurum().split(\"-\")[0].equals(\"kontrol_basla\")) {\n ServerCommon.GelenDosyaAdi = ilkPacket.getDosyaAdi();\n ServerCommon.GelenHedefBytesLenght = ilkPacket.getHedefBytesLength();\n ServerCommon.GelenTampon = ilkPacket.getTampon();\n ServerCommon.HedefBytes = new byte[ilkPacket.getHedefBytesLength()];\n ServerCommon.hedefBaslangic = 0;\n ServerCommon.GelenMailBaslik = ilkPacket.getDurum().split(\"-\")[1];\n }\n\n while (true) {\n try {\n\n objectInput = new ObjectInputStream(client.getInputStream());\n Packet tamponPacket = (Packet) objectInput.readObject();\n\n if (tamponPacket.getDurum().equals(\"kontrol_bitir\")) {\n break;\n }\n\n Functions.TamponBirlestir(tamponPacket.Tampon);\n\n } catch (Exception e) {\n e.printStackTrace();\n }\n System.out.println(\"Shutting down\");\n }\n\n ///////////////1 MSS lik Tampon alma işlemleri bitti\n out = new PrintWriter(client.getOutputStream());\n out.println(\"250_message_accepted\");\n out.flush();\n\n in = new InputStreamReader(client.getInputStream());\n buf = new BufferedReader(in);\n gelen = buf.readLine(); // QUIT: geldi\n\n out = new PrintWriter(client.getOutputStream());\n out.println(\"221_closing_connection\");\n out.flush();\n\n ////////Bitis islemleri\n // dosya alma işlemleri bittiginde dosyayı gonderenenin altındaki giden kasörüne\n // ve dosyayı alanın altındaki gelen klasörüne kaydediyoruz. her iki bilgiyide\n // Mailler arraylistine kaydediyoruz.\n ServerCommon.FILEPATH = ServerCommon.CONST_FILEPATH + \"/\" + ServerCommon.mailGonderilecekKisi.split(\"@\")[0] + \"/gelen/\" + ServerCommon.GelenDosyaAdi;\n ServerCommon.Mailler.add(new MailLog(\"gelen\", \"dosya\", ServerCommon.mailGonderilecekKisi.split(\"@\")[0], ServerCommon.GelenMailBaslik, \"\", ServerCommon.FILEPATH));\n ServerCommon.file = new File(ServerCommon.FILEPATH);\n Functions.ConvertBytesToFile(ServerCommon.HedefBytes);\n\n ServerCommon.FILEPATH = ServerCommon.CONST_FILEPATH + \"/\" + ServerCommon.kullaniciAdi.split(\"@\")[0] + \"/giden/\" + ServerCommon.GelenDosyaAdi;\n ServerCommon.Mailler.add(new MailLog(\"giden\", \"dosya\", ServerCommon.kullaniciAdi.split(\"@\")[0], ServerCommon.GelenMailBaslik, \"\", ServerCommon.FILEPATH));\n ServerCommon.file = new File(ServerCommon.FILEPATH);\n Functions.ConvertBytesToFile(ServerCommon.HedefBytes);\n\n }", "@Override\n\tpublic void onMail(Message m) {\n\n\t\tHashMap<String,String> map = new HashMap<String,String>();\n\t\tmap.put(\"a\",\"A\");\n\t\tmap.put(\"b\",\"B\");\n\t\tmap.put(\"long\",new String(new byte[10000]));\n\t\tHeader header = new Header(map);\n\t\ttry {\n\t\t\tif (count % burstSize == 0) {\n\t\t\t\tfor (int i=0; i < burstSize; i++)\n\t\t\t\t\tsend(new Message(header, new Body()));\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\tcount++;\n\t\tif (count % 1000 == 0) {\n\t\t\tlong nano = System.nanoTime() - time;\n\t\t\tlong sec = nano / 1000000000L;\n\t\t\tfloat mps = count * 1.0F / sec;\n\t\t\tlogger.info(String.format(\"Count: %20d Msg/s: %5.2f\", count, mps));\n\t\t\t//log.info(String.format(\"%n%s%n\", m));\n\t\t}\n\t\t// for (String s : m.getHeader().keySet())\n\t\t//\tSystem.out.println(s);\n\t}", "public boolean mailRecuperarPassword(String nombreusuario, String password, String mail){\n\n try {\n\n// //seteamos el asunto\n// message.setSubject(\"UNDEC - Activar Cuenta Nortia UNDEC\");\n//\n// //seteamos el mensaje que vamos a enviar\n// message.setContent(\"<html>\\n\" +\n// \"<body>\\n\" +\n// \"\\nHola, usuario = \" +nombreusuario+ \",\\n su nuevo password es = \"+password+\n// \"\\n\" +\n// \"\\nUsted puede cambiar el password cuando ingrese al sistema\\n \"+\n// \n// \"Muchas Gracias\"+\n// \"</body>\\n\" +\n// \"</html>\", \"text/html\");\n// //colocamos la direccion de donde enviamos el correo\n// Address address = new InternetAddress(mail);\n// message.setFrom(address);\n// //Colocamos la direccion de la persona a enviar\n// Address send = new InternetAddress(mail,false);\n// message.addRecipient(Message.RecipientType.TO,send);\n// \n// //la persona que envia con la validacion de su cuenta.\n// Transport trans = session.getTransport(\"smtp\");\n// //Aca se autentifica que la direccion de la persona que envia sea válida\n//\n// trans.connect(\"hmaza@undec.edu.ar\",\"momomomo\");\n// trans.sendMessage(message,message.getAllRecipients());\n// trans.close();\n System.out.println(\"maiñll\");\n Email email = new Email();\n email.setFromAddress(\"Nortia UNDEC\", \"sisgap@undec.edu.ar\");\n email.addRecipient(nombreusuario, mail, RecipientType.TO);\n //email.addRecipient(agente.getApellido(), agente.getOtroemail(), RecipientType.BCC);\n email.setTextHTML(\"Hola, usuario = \"+nombreusuario+ \"su nuevo password es = \"+password +\n\n\" <br />Usted puede cambiar el password cuando ingrese al sistema <br />\" +\n\n\"Muchas Gracias\");\n System.out.println(\"-----------\"+mail);\n email.setSubject(\"UNDEC - Recuperar Password Nortia UNDEC\");\n \n // or:\n new Mailer(\"localhost\", 25, \"sisgap@undec.edu.ar\", \"sgap*9812\").sendMail(email);\n System.out.println(\"-----------enviado\");\n } catch (Exception ex) {\n\n ex.printStackTrace();\n //Si el correo tiene algun error lo retornaremos aca\n JsfUtil.addErrorMessage(ex,\"No se pudo crear el Usuario\");\n\n return false;\n\n \n }\n //Correo tuvo exito dara una salida en este punto indicando que si se envio\n return true;\n \n }", "public void EnvoyerEmailSurveillant(Utilisateur user) {\n\t\t\t\t MimeMessage mimeMessage = mailSender.createMimeMessage(); \n\t\t\t try {\n\t\t\t MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, true);\n\t\t\t mimeMessageHelper.setSubject(\"Compte Surveillant \");\n\t\t\t mimeMessageHelper.setFrom(\"naifarsara@gmail.com\");\n\n\t\t\t mimeMessageHelper.setTo(user.getEmail());\n\t\t\t String url =\"scolarity.dpc.com.tn\";\n\t\t String content = \"Bonjour Mr ( Mmme), \" + user.getNom()+\" + \" + user.getPrenom()\n\t\t + \", votre nom d'utilisateur par la platforme scolarity est : \\n \" + user.getUsername() +\" \\n\"+\"et votre mot de passe est : \\n\"+ user.getPassword()+\"\\n\"+\"vous pouvez accéder au espace surveillant via l'adresse suivante : \\n\"+url+\"\\n\"+\" \\n Cordialement.\";\n\t\t System.out.println(content);\n\n\t\t\t mimeMessageHelper.setTo(user.getEmail());\n\t\t mimeMessageHelper.setText(content);\n\t\t // Add a resource as an attachment\n\t\t mimeMessageHelper.setText(\"<html><body><p>\" + content + \"</p> <img src=\\\"http://207.180.211.158:/logodpc.bmp\\\" width=\\\"50\\\" alt=\\\"Apen\\\"></body></html>\", true);\n\n\t\t\t \n\t\t\t \n\t\t\t mailSender.send(mimeMessageHelper.getMimeMessage());\n\t\t\t } catch (MessagingException e) {\n\t\t\t e.printStackTrace();\n\t\t\t }\n\t\t\t\t\n\t\t\t}", "public void actionPerformed(java.awt.event.ActionEvent e) {\n\t\t\t\t\t///// ENVOI FICHIER TRACE AU SUPPORT A LA FERMETURE//\r\n\t\t\t\t\t/////////////////////////////////////////////////////\r\n\t\t\t\t\t\r\n\t\t\t\t\tString [] destinataire = {\"s.mardine@gmail.com\"};\r\n\t\t\t\t\tString from = \"carnet.client@laposte.net\";\r\n\t\t\t\t\tString password = \"gouranga08\";\r\n\t\t\t\t\tString [] Files = {GestionRepertoire.RecupRepTravail()+\"\\\\historique.txt\",GestionRepertoire.RecupRepTravail()+\"\\\\IniFile\\\\version.ini\",GestionRepertoire.RecupRepTravail()+\"\\\\IniFile\\\\AccesBdd.ini\"};\r\n\t\t\t\t\tString Sujet = \"Utilisation carnet client\";\r\n\t\t\t\t\t\r\n\t\t\t\t\tString MACHINE_NAME=VariableEnvironement.VarEnvSystem(\"COMPUTERNAME\");\r\n\t\t\t\t\tString USERNAME=VariableEnvironement.VarEnvSystem(\"USERNAME\");\r\n\t\t\t\t\t\r\n\t\t\t\t\tConfigMgt config = null;\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tconfig = new ConfigMgt(\"version.ini\",GestionRepertoire.RecupRepTravail()+\"\\\\IniFile\\\\\",'[');\r\n\t\t\t\t\t} catch (NullPointerException e1) {\r\n\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\te1.printStackTrace();\r\n\t\t\t\t\t} catch (IOException e1) {\r\n\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\te1.printStackTrace();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tString VERSION = config.getValeurDe(\"version\");\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tString Message = \"L'ordinateur \"+ MACHINE_NAME + \"à utilisé ce logiciel.\\n\\r\" +\r\n\t\t\t\t\t\t\t\"L'utilisateur qui a lancé le logiciel est : \" + USERNAME +\"\\n\\r\" +\r\n\t\t\t\t\t\t\t\t\t\"La version utlilisée est : \"+VERSION;\r\n\t\t\t\t\tSendMailUsingAuthenticationWithAttachement smtpMailSender = new SendMailUsingAuthenticationWithAttachement();\r\n\t\t\t\t boolean succesEnvoiMail = false;\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tsuccesEnvoiMail = smtpMailSender.postMail( destinataire, Sujet, Message, from, password, Files);\r\n\t\t\t\t\t} catch (MessagingException e2) {\r\n\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\te2.printStackTrace();\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (succesEnvoiMail==false){//il y a eu un pb lors de l'envoi, on re essaye une fois\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\tsuccesEnvoiMail = smtpMailSender.postMail( destinataire, Sujet, Message, from, password, Files);\r\n\t\t\t\t\t\t} catch (MessagingException e2) {\r\n\t\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\t\te2.printStackTrace();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tnew Fen_Fermeture ();\r\n\t\t\t\t\t\r\n\t\t\t\t}", "boolean hasNewMailNum();", "private void formatTime() {\r\n\t\tDate date = new Date();\r\n\t\tSimpleDateFormat ft = new SimpleDateFormat(\"yyyy/MM/dd HH:mm:ss\");\r\n\t\tm_timeSent = ft.format(date).toString();\r\n\t}", "@Override\n\tprotected String doIt() throws Exception {\n\t\tString returnMsg = Msg.getMsg(getCtx(), \"EGGO_SENDMAIL_EVENT\");\n\t\tMOrder mo = new MOrder(getCtx(), Order_ID, get_Trx());\n\t\tif(EventType.equals(\"05\") && (mo.get_ValueAsTimestamp(\"DatePose\") == null || mo.get_ValueAsTimestamp(\"Z_DATELIVRCLI\")==null))\n\t\t{\n\t\t\treturn Msg.getMsg(getCtx(), \"EGGO_SENDMAIL_ERR\");\n\t\t}\n\t\t//SI\n\t\t//XX_no_solde_inv_gest\n\t\t\n\t\t\n\t\tif(EventType.equals(\"05\")) {\n\t\t\tString role = \"\"+getCtx().getAD_Role_ID();\n\t\t\tString XX_Gest_roles = Msg.getMsg(getCtx(), \"XX_Gest_roles\");\n\t\t\tString XX_Gest_rolesXX = Msg.getMsg(getCtx(), \"XX_Gest_roles++\");\n\t\t\tString XX_no_solde_inv_gest = Msg.getMsg(getCtx(), \"XX_no_solde_inv_gest\");\n\t\t\tString XX_no_solde_inv_gestXX = Msg.getMsg(getCtx(), \"XX_no_solde_inv_gest++\");\n\t\t\tString XX_no_ech_05_gest = Msg.getMsg(getCtx(), \"XX_no_ech_05_gest\");\n\t\t\tString XX_no_ech_05_gestXX = Msg.getMsg(getCtx(), \"XX_no_ech_05_gest++\");\n\t\t\tif(XX_Gest_roles.contains(role))\n\t\t\t{\n\t\t\t\t//No 05 ?\n\t\t\t\tint nbECH05 = QueryUtil.getSQLValue(get_Trx(), \"Select count(1) from z_orderpaymschedule where C_order_ID = ? and exists (select 1 from z_typeecheance \"\n\t\t\t\t\t+ \"where z_typeecheance.z_typeecheance_ID = z_orderpaymschedule.z_typeecheance_ID and value = '05')\", Order_ID);\n\t\t\t\tif(nbECH05 <= 0)\n\t\t\t\t\treturnMsg = XX_no_ech_05_gest;\n\t\t\t\telse {\n\t\t\t\t\tint inv_id = QueryUtil.getSQLValue(get_Trx(), \"Select max(C_Invoice_ID) from z_orderpaymschedule where C_order_ID = ? and exists (select 1 from z_typeecheance \"\n\t\t\t\t\t\t+ \"where z_typeecheance.z_typeecheance_ID = z_orderpaymschedule.z_typeecheance_ID and value = '05')\", Order_ID);\n\t\t\t\t\tif(inv_id<=0)\n\t\t\t\t\t{\n\t\t\t\t\t\tthrow new CompiereException(XX_no_solde_inv_gest);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t\t\tif(XX_Gest_rolesXX.contains(role))\n\t\t\t{\n\t\t\t\tint nbECH05 = QueryUtil.getSQLValue(get_Trx(), \"Select count(1) from z_orderpaymschedule where C_order_ID = ? and exists (select 1 from z_typeecheance \"\n\t\t\t\t\t\t+ \"where z_typeecheance.z_typeecheance_ID = z_orderpaymschedule.z_typeecheance_ID and value = '05')\", Order_ID);\n\t\t\t\t\tif(nbECH05 <= 0)\n\t\t\t\t\t\treturnMsg = XX_no_ech_05_gestXX;\n\t\t\t\t\telse {\n\t\t\t\t\t\tint inv_id = QueryUtil.getSQLValue(get_Trx(), \"Select max(C_Invoice_ID) from z_orderpaymschedule where C_order_ID = ? and exists (select 1 from z_typeecheance \"\n\t\t\t\t\t\t\t+ \"where z_typeecheance.z_typeecheance_ID = z_orderpaymschedule.z_typeecheance_ID and value = '05')\", Order_ID);\n\t\t\t\t\t\tif(inv_id<=0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treturnMsg = XX_no_solde_inv_gestXX;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tString ret = WSUtil.SendEmailEvent(getCtx(), mo, EventType,getAD_PInstance_ID(), get_Trx());\n\t\tif(ret == null)\n\t\t{\n\t\t\treturn \"Event Type not supported\";\n\t\t}\n\t\treturn returnMsg;\n\t}", "public void Send(String ToMail,int id,String name){\n String link = \"http://localhost:8080/Project/resetpassword.jsp\";\n String m_text = \"<table style=\\\"width: 100% !important\\\" >\\n\" +\n\" <tbody>\\n\" +\n\" <tr>\\n\" +\n\" <td>\\n\" +\n\" <div>\\n\" +\n\" <h2>Hello, \"+name+\"</h2>\\n\" +\n\" </div>\\n\" +\n\" <div>\\n\" +\n\" You recently took steps to reset the password for your Hanger account. Click on the link below to reset your password.\\n\" +\n\" </div>\\n\" +\n\" <br>\\n\" +\n\" <a href=\\\"\"+link+\"?id=\"+id+\"\\\">Reset Password</a>\\n\" +\n\" <br>\\n\" +\n\"\\n\" +\n\" <div>\\n\" +\n\" This link will expire in 1 days after this email was sent.\\n\" +\n\" </div>\\n\" +\n\"\\n\" +\n\" <br>\\n\" +\n\" <div>\\n\" +\n\" Sincerely,\\n\" +\n\" <h4>The Hanger Team</h4>\\n\" +\n\" </div>\\n\" +\n\" </td>\\n\" +\n\" </tr>\\n\" +\n\" </tbody>\\n\" +\n\" </table>\";\n send( d_email, d_host, d_port, ToMail, m_subject, m_text);\n }", "String getPasswordExpiredMailBody( );", "@Override\n\tpublic void sendMail(Mail mail, boolean flag) {\n\t\t\n\t}", "public Date getMessageDate();", "private static void testMail() throws Exception {\n\t\tUser user=new User();\n\t\tuser.setUsername(\"若水\");\n\t\tuser.setEmail(\"723413782@qq.com\");\n\t\tMail mail=new Mail();\n\t\tboolean b=mail.sendMail(user, \"http://www.baidu.com\", \"http://www.zzuli.edu.cn\", 2);\n\t\tSystem.out.println(b);\n\t}", "private void sendEmail() {\n\n\n Log.i(TAG, \" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\");\n\n\n Log.i(TAG, \"sendEmail: \"+currentEmail);\n\n Log.i(TAG, \" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\");\n\n\n String email = currentEmail.trim();\n String subject = \"Garbage Report Handeled\";\n\n String message = textViewStreet.getText().toString() + \" \" + \"request has been handeled\" +\" \"+textViewDescription.getText().toString();\n\n// String message = textViewStreet.getText().toString() + \" \" + \"request has been handeled\" + \" \" +time+\" \"+textViewDescription.getText().toString();\n //Creating SendMail object\n SendMail sm = new SendMail(this, email, subject, message);\n\n //Executing sendmail to send email\n sm.execute();\n }", "public ResponseUpdDao sendSimpleEmail(String tsSubject, \n String tsMessage,\n String tsProcess,\n List<EmailDestinationAddress> toEmailDestinationAddress\n ) {\n ResponseUpdDao loResponse = new ResponseUpdDao();\n try{\n String lsHtml =\n \"<!DOCTYPE html PUBLIC \\\"-//W3C//DTD XHTML 1.0 Strict//EN\\\" \\\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-\" +\n \"strict.dtd\\\">\\n\" + \n \" <html xmlns=\\\"http://www.w3.org/1999/xhtml\\\" dir=\\\"ltr\\\" lang=\\\"es-ES\\\">\\n\" + \n \" <head>\\n\" + \n \" <title>\"+tsProcess+\"</title>\\n\" + \n \" <meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html; charset=ISO-8859-1\\\" />\\n\" + \n \" <meta name=\\\"language\\\" content=\\\"es\\\" />\\n\" + \n \" </head>\\n\" + \n \" <body>\\n\" + \n \" <div style='background-color:#0F2F62; height:25px;background:linear-gradient(#040545, \" +\n \"#0172AE);background:-webkit-linear-gradient(#040545, #0172AE);background: -ms-linear-background(\" +\n \"#040545, #0172AE);filter:progid:DXImageTransform.Microsoft.gradient(startColorStr='#040545', \" +\n \"EndColorStr='#0172AE');'></div>\\n\" + \n \" <div style='background-color:#fff'> \\n\" + \n \" <br/>\\n\" + \n \" <label style='font-family:Arial, Helvetica, sans-serif; font-size:16px; font-weight:\" +\n \"bold '>El Proceso de Integraci&oacute;n para \"+tsProcess+\" ha Finalizado</label><p/>\\n\" + \n \" <label style='font-family:Arial, Helvetica, sans-serif; font-size:12px; \" +\n \"font-weight:bold '>\"+tsMessage+\"</label><p/>\\n\" + \n /*\" <table cellpadding='0' cellspacing='0' style='border-bottom-color:#F79646;border-\" +\n \"bottom-width:3px;border-bottom-style:solid;border-top-color:#F79646;border-top-style:solid;border-\" +\n \"top-width:3px; '> \\n\" + \n \" <tr>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Bcsttim</th>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Channelid</th>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Date</th>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Orderid</th>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Spotid</th>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Buyuntid</th>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Breakid</th>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Hour</th>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Duration</th>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Spotformatid</th>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Mediaid</th>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Productid</th>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Spotprice</th>\\n\" + \" </tr>\\n\";\n \n lsHtml += \" </table> \\n\" + \n */\" <br/> \\n\" + \n \" <br/>\\n\" + \n \" <label style='font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:\" +\n \"bold '>Integraci&oacute;n Paradigm-Landmark, 2019 Televisa S.A. de C.V</label> \\n\" + \n \" <br/>\\n\" + \n \" </div>\\n\" + \n \" <div style='float:left; background-color:#F58220;width:7%;height:25px;background:-moz-\" +\n \"linear-gradient(#F1A345, #E17521); background:-webkit-linear-gradient(#F1A345, #E17521);\" +\n \"background: -ms-linear-background(#F1A345, #E17521);filter:progid:DXImageTransform.Microsoft.gradient(\" +\n \"startColorStr='#F1A345', EndColorStr='#E17521');'>\\n\" + \n \" </div> \\n\" + \n \" <div style='float:left; ;width:86%;height:25px;background:linear-gradient(#040545, \" +\n \"#0172AE);background:-webkit-linear-gradient(#040545, #0172AE);background: -ms-linear-\" +\n \"background(#040545, #0172AE);filter:progid:DXImageTransform.Microsoft.gradient(startColorStr=\" +\n \"'#040545', EndColorStr='#0172AE');'>\\n\" + \n \" </div>\\n\" + \n \" <div style='float:left; background-color:#F58220;width:7%;height:25px;background:-\" +\n \"moz-linear-gradient(#F1A345, #E17521);background:-webkit-linear-gradient(#F1A345, #E17521);\" +\n \"background: -ms-linear-background(#F1A345, #E17521);filter:progid:DXImageTransform.Microsoft.gradient(\" +\n \"startColorStr='#F1A345', EndColorStr='#E17521');'></div> \\n\" + \n \" </body>\\n\" + \n \" </html>\"; \n System.out.println(\"Html generado para el correo ================>\");\n System.out.println(lsHtml);\n //writeFile(lsHtml);\n SecmanDasEnviarCorreo loSecmanDasSendMail = getDynaWebServiceURLEmail();\n if(loSecmanDasSendMail != null){\n try{\n Map<String, Object> loRequestContext =\n ((BindingProvider)loSecmanDasSendMail).getRequestContext(); \n setPortCredentialProviderList(loRequestContext); \n Mail loEmail = new Mail(); \n MailHeader loEmailHeader = new MailHeader();\n MailAddress loEmailAddresFrom = new MailAddress(); \n loEmailAddresFrom.setUserNameAdress(\"Landmark Integration\");\n loEmailAddresFrom.setAddress(\"service_integration_lmk@televisa.com.mx\");\n loEmailHeader.setAddressFrom(loEmailAddresFrom);\n MailAddressCollection loMailAddressCollection =\n new MailAddressCollection();\n for(EmailDestinationAddress loDest: toEmailDestinationAddress){ \n MailAddress loEmailAdd = new MailAddress();\n //System.out.println(\"AddressTO username[\"+loDest.getLsNameTo()+\"] address[\"+loDest.getLsAddressTo()+\"]\");\n loEmailAdd.setUserNameAdress(loDest.getLsNameTo());\n loEmailAdd.setAddress(loDest.getLsAddressTo()); \n loMailAddressCollection.getMailAddress().add(loEmailAdd);\n }\n loEmailHeader.setTo(loMailAddressCollection);\n loEmailHeader.setSubject(tsSubject);\n loEmail.setMailHeader(loEmailHeader);\n MailBody loMailBody = new MailBody();\n loMailBody.setBodyType(\"HTML\");\n loMailBody.setMessage(lsHtml);\n loEmail.setMailBody(loMailBody);\n loSecmanDasSendMail.enviarCorreo(loEmail);\n loResponse.setLsResponse(\"OK\");\n loResponse.setLiAffected(0);\n loResponse.setLsMessage(\"Correo enviado satisfactoriamente\");\n System.out.println(\"Fin enviar correo - ok\");\n } catch (Exception loException) {\n System.out.println(\"Error al enviar correo: \"+loException.getMessage());\n loResponse.setLsResponse(\"ERROR\");\n loResponse.setLiAffected(0);\n loResponse.setLsMessage(loException.getMessage());\n }\n }\n } catch (Exception loException) {\n System.out.println(\"Error crear instancia del servicio de correo de secman: \"+loException.getMessage());\n loResponse.setLsResponse(\"ERROR\");\n loResponse.setLiAffected(0);\n loResponse.setLsMessage(loException.getMessage()); \n }\n return loResponse;\n }", "private void sendMail(final String mail, final String name, final String message) {\n /* new Thread(){\n public void run() {\n Properties props = System.getProperties();\n props.put(\"mail.smtps.host\",\"smtp.gmail.com\");\n props.put(\"mail.smtps.auth\",\"true\");\n Session session = Session.getInstance(props, null);\n Message msg = new MimeMessage(session);\n try {\n msg.setFrom(new InternetAddress(\"thoughtgalore@gmail.com\"));\n msg.setRecipients(Message.RecipientType.TO,\n InternetAddress.parse(\"aji.b2w@gmail.com\", false));\n msg.setSubject(\"Yoga Mandira :: Feedback \" + System.currentTimeMillis());\n msg.setText(\"MAIL:\"+mail+\"\\nNAME:\"+name+\"\\nMESSAGE:\"+message);\n msg.setHeader(\"X-Mailer\", \"Yoga Mandira\");\n msg.setSentDate(new Date());\n SMTPTransport t =\n (SMTPTransport) session.getTransport(\"smtps\");\n t.connect(\"smtp.gmail.com\", \"thoughtgalore@gmail.com\", \"#30ija11an\");\n t.sendMessage(msg, msg.getAllRecipients());\n System.out.println(\"Response: \" + t.getLastServerResponse());\n t.close();\n }catch (AddressException e) {\n e.printStackTrace();\n } catch (SendFailedException e) {\n e.printStackTrace();\n } catch (NoSuchProviderException e) {\n e.printStackTrace();\n } catch (MessagingException e) {\n e.printStackTrace();\n }\n }\n }.start();*/\n }", "public boolean enviarMailConfirmacion(Agente agente, Usuario usuario){\n\n try {\n\n //seteamos el asunto\n// message.setSubject(\"UNDEC - Activar Cuenta Nortia UNDEC\");\n//\n// //seteamos el mensaje que vamos a enviar\n// message.setContent(\"<html>\\n\" +\n// \"<body>\\n\" +\n// \"\\n Hola, para poder activar la cuenta haga click en el siguiente link ----> \" +\n// \"<a href=\\\"\"+new URLWEB().getAbsoluteApplicationUrl()+\"/activarcuenta.xhtml?username=\"+usuario.getUsuarionombre()+\n// \"&hash=\"+usuario.getUsuarioclave()+\n// \"\\\">\\n\" +\n// \"Activar cuenta</a>\\n\" +\n// \"\\n\" +\n// \"En caso de no poder pegue en el browser lo siguiente\\n \"+\n// new URLWEB().getAbsoluteApplicationUrl()+\"/activarcuenta.xhtml?username=\"+usuario.getUsuarionombre()+\n// \"&hash=\"+usuario.getUsuarioclave()+\"\\n\"+\n// \"Muchas Gracias\"+\n// \"</body>\\n\" +\n// \"</html>\", \"text/html\");\n// //colocamos la direccion de donde enviamos el correo\n// Address address = new InternetAddress(agente.getEmail());\n// message.setFrom(address);\n// //Colocamos la direccion de la persona a enviar\n// Address send = new InternetAddress(agente.getOtroemail(),false);\n// message.addRecipient(Message.RecipientType.TO,send);\n// message.addRecipient(Message.RecipientType.BCC, new InternetAddress( agente.getOtroemail()));\n// //la persona que envia con la validacion de su cuenta.\n// Transport trans = session.getTransport(\"smtp\");\n// //Aca se autentifica que la direccion de la persona que envia sea válida\n// //trans.connect();\n// trans.connect(\"sisgap@undec.edu.ar\",\"sgap*9812\");\n// trans.sendMessage(message,message.getAllRecipients());\n// trans.close();\n Email email = new Email();\n email.setFromAddress(\"Nortia UNDEC\", \"sisgap@undec.edu.ar\");\n email.addRecipient(agente.getApellido(), agente.getEmail(), RecipientType.TO);\n email.addRecipient(agente.getApellido(), agente.getOtroemail(), RecipientType.BCC);\n email.setTextHTML(\"Hola \"+usuario.getUsuarionombre()+\", <br /> para poder activar la cuenta haga click en el siguiente link ----> \" +\n\"<a href=\\\"\"+new URLWEB().getAbsoluteApplicationUrl()+\"/activarcuenta.xhtml?username=\"+usuario.getUsuarionombre()+\n \"&hash=\"+usuario.getUsuarioclave() +\n\"\\\"> Activar cuenta </a> <br />\"+\n \n\"En caso de no poder pegue en el browser lo siguiente \" +\n new URLWEB().getAbsoluteApplicationUrl()+\"/activarcuenta.xhtml?username=\"+usuario.getUsuarionombre()+\n\"&hash=\"+usuario.getUsuarioclave()+\"<br />\" +\n\"Muchas Gracias\");\n email.setSubject(\"UNDEC - Activar Cuenta Nortia UNDEC\");\n \n // or:\n new Mailer(\"localhost\", 25, \"sisgap@undec.edu.ar\", \"sgap*9812\").sendMail(email);\n } catch (Exception ex) {\n\n ex.printStackTrace();\n //Si el correo tiene algun error lo retornaremos aca\n JsfUtil.addErrorMessage(ex,\"No se pudo crear el Usuario\");\n\n return false;\n\n// } catch (MalformedURLException ex) {\n// Logger.getLogger(EnviarMail.class.getName()).log(Level.SEVERE, null, ex);\n// return false;\n }\n //Correo tuvo exito dara una salida en este punto indicando que si se envio\n return true;\n \n }", "public void enviarEmail(String c, Ciudadano a){\n\t}", "@Override\n\tpublic void modifyClientMail(long id, String mail) {\n\t\t\n\t}", "public void sendEmailThread(final String sbj, final String contenido) {\n Thread thread = new Thread(new Runnable() {\n @Override\n public void run() {\n try {\n String msg = \"<p style=\\\"font-family:Calibri;color:#1F497D;\\\">\"\n + contenido\n + \"</p>\"\n + firma;\n Properties properties = new Properties();\n properties.put(\"mail.host\", servidorCorreo);\n properties.put(\"mail.store.protocol\", \"imaps\");\n properties.put(\"mail.smtp.auth\", \"true\");\n properties.put(\"mail.smtp.port\", \"25\");\n properties.put(\"mail.smtp.host\", servidorCorreo);\n properties.put(\"mail.smtp.protocol\", \"smtp\");\n\n sesion = Session.getInstance(properties, new javax.mail.Authenticator() {\n @Override\n protected PasswordAuthentication getPasswordAuthentication() {\n return new PasswordAuthentication(usuarioCorreo, claveCorreo);\n }\n });\n Message message = new MimeMessage(sesion);\n message.setFrom(new InternetAddress(correo));\n message.setSubject(sbj);\n InternetAddress[] addrs = new InternetAddress[destinatarios.length];\n for (int x = 0; x < destinatarios.length; x++) {\n addrs[x] = new InternetAddress(destinatarios[x]);\n }\n message.setRecipients(Message.RecipientType.TO, addrs);\n DataHandler dh = new DataHandler(msg, \"text/html;charset=UTF-8\");\n message.setDataHandler(dh);\n Transport.send(message);\n } catch (MessagingException ex) {\n ex.printStackTrace(System.out);\n } catch (Exception ex) {\n ex.printStackTrace(System.out);\n }\n }\n });\n thread.start();\n }", "public void setFechaModificacion(String p) { this.fechaModificacion = p; }", "public void setFechaModificacion(String p) { this.fechaModificacion = p; }", "public static boolean sendTerritoryWorkStatusMailToDatabasePublisher(Publisher p) throws IOException {\r\n\t\tString territoriesInfo = \"\";\r\n\t\tfor (Territoriesassignments ass : p.getTerritoriesassignmentses()) {\r\n\t\t\tif (ass.getReturnDate() == null) {\r\n\t\t\t\tTerritory ter = ass.getTerritory();\r\n\t\t\t\tTerritoryModel model = new TerritoryModel(ter);\r\n\t\t\t\tList<TerritoryHistoryModel> histories = model.getHistoryData();\r\n\t\t\t\tCollections.sort(histories);\r\n\t\t\t\tString lastWorkDateText = \"--> Jamais travaillé\";\r\n\t\t\t\tif (!histories.isEmpty()) {\r\n\t\t\t\t\tDate lastWorkDate = histories.get(0).getHistoryActionDate();\r\n\t\t\t\t\tDateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(DateUtils.getUiDateFormat());\r\n\t\t\t\t\tString lastWorkDateString = dateTimeFormatter.format(DateUtils.asLocalDate(lastWorkDate));\r\n\t\t\t\t\tlastWorkDateText = \" --> Travaillé la dernière fois le \" + lastWorkDateString;\r\n\t\t\t\t}\r\n\t\t\t\tterritoriesInfo += ter.getCode() + \" - \" + ter.getName() + \" \" + lastWorkDateText + \"\\n\";\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (p.getContact().getEmail() == null || p.getContact().getEmail().isEmpty())\r\n\t\t\treturn false;\r\n\t\tResourceBundle bundle = Main.getMainBundle();\r\n\t\tfinal String mailSender = bundle.getString(\"mail_sender\");\r\n\t\tString mailReceiver = p.getContact().getEmail();\r\n\t\tString mailSubject = \"Travail de ton (tes) territoire(s) \";\r\n\t\tString title = p.getSexe().getSexe().equalsIgnoreCase(\"masculin\") ? \"Cher \" + p.getFirstName() + \",\\n\"\r\n\t\t\t\t: \"Chère \" + p.getFirstName() + \",\\n\";\r\n\t\tString mailContent = title + \"\\n\\n\"\r\n\t\t\t\t+ \"Notre semaine spéciale approche à très grands pas! Nous avons à nouveau besoin de quelques informations de ta part, afin de préparer le dossier des territoires pour notre surveillant itinérant\\n\\n\"\r\n\t\t\t\t+ \"D'après notre liste tu travailles actuellement le(s) territoire(s) suivant(s):\\n\\n\" + territoriesInfo\r\n\t\t\t\t+ \"\\n\\n\"\r\n\t\t\t\t+ \"Pourrais-tu s'il te plait nous dire quand tu les as travaillés (complètement!) la dernière fois?\\nSi tu ne les as plus travaillé depuis la dernière fois, veuille quand même nous en informer (la dernière date sera retenue).\\n\\n\";\r\n\t\tString[] mailResponsesAddresses = bundle.getString(\"mail_response_adresses\").split(\";\");\r\n\t\tString[] mailResponsesNames = bundle.getString(\"mail_response_names\").split(\";\");\r\n\t\tString mailReturnInfo = \"\";\r\n\t\tString returnNames = \"\";\r\n\t\tif (mailResponsesNames.length > 1) {\r\n\t\t\treturnNames += \"Tes frères\\n\";\r\n\t\t} else {\r\n\t\t\treturnNames += \"Ton frère\\n\";\r\n\t\t}\r\n\t\tfor (int i = 0; i < mailResponsesAddresses.length; i++) {\r\n\t\t\tmailReturnInfo += mailResponsesNames[i] + \": \" + mailResponsesAddresses[i] + \"\\n\";\r\n\t\t\tif (i == 0) {\r\n\t\t\t\treturnNames += mailResponsesNames[i];\r\n\t\t\t} else if (i == (mailResponsesAddresses.length - 1)) {\r\n\t\t\t\treturnNames += \" & \" + mailResponsesNames[i];\r\n\t\t\t} else {\r\n\t\t\t\treturnNames += \", \" + mailResponsesNames[i];\r\n\t\t\t}\r\n\t\t}\r\n\t\tString mailRemark = \"\\n\\nVeuille répondre à l'une des adresses email suivantes:\\n\" + mailReturnInfo\r\n\t\t\t\t+ \"ou tout simplement nous contacter dès que possible par un autre moyen.\\n\";\r\n\t\tString signature = \"\\n\\nMerci d'avance pour ta coopération et tes efforts.\\n\\n\" + returnNames;\r\n\t\tmailContent += mailRemark;\r\n\t\tmailContent += signature;\r\n\t\tSystem.out.println(\"Sending mail to \" + mailReceiver + \" ...\");\r\n\t\tsendMail(mailSender, mailReceiver, mailSubject, mailContent);\r\n\t\treturn true;\r\n\t}", "public void EnviarWithAdjunto(String destino, String asunto, String cuerpo, byte[] adjunto)\n {\n /*\n * \n email: comercial@redmoon.es\n pasword: Comer2010\n * Servidor de correo saliente (SMTP): smtp.redmoon.es\n * Servidor de correo entrante (POP/IMAP/IMAP SSL): mail.redmoon.es\n */\n \n\n // Get system properties\n Properties propiedades = new Properties();\n \n // Setup mail server\n \n propiedades.setProperty(\"mail.smtp.host\", host);\n propiedades.setProperty(\"mail.smtp.starttls.enable\", \"true\");\n propiedades.setProperty(\"mail.smtp.auth\", \"true\");\n propiedades.setProperty(\"mail.user\", \"comercial@redmoon.es\");\n propiedades.setProperty(\"mail.password\", \"Comer2010\");\n propiedades.setProperty(\"mail.smtp.port\", \"25\");\n \n // no estoy seguro\n //propiedades.setProperty(\"mail.mime.multipart.ignoreexistingboundaryparameter\", \"true\");\n \n // creates a new session with an authenticator\n Authenticator auth = new Authenticator() {\n @Override\n public PasswordAuthentication getPasswordAuthentication() {\n return new PasswordAuthentication(usuario, passwd);\n }\n };\n \n // Get the default Session object.\n Session session = Session.getInstance(propiedades, auth);\n\n \n \n\n try{\n // Create a default MimeMessage object.\n MimeMessage message = new MimeMessage(session);\n\n //message.setHeader(\"Content-Type\",\"multipart/mixed; boundary=\\\"frontera\\\"\");\n \n // Set From: header field of the header.\n message.setFrom(new InternetAddress(from));\n\n // Set To: header field of the header.\n message.addRecipient(Message.RecipientType.TO,\n new InternetAddress(destino));\n\n // Set Subject: header field\n message.setSubject(asunto);\n\n // Create the message part \n BodyPart messageBodyPart = new MimeBodyPart();\n\n // Fill the message\n messageBodyPart.setText(cuerpo);\n \n // Create a multipar message\n Multipart multipart = new MimeMultipart();\n\n \n // Set text message part\n multipart.addBodyPart(messageBodyPart);\n\n // Part two is attachment\n //messageBodyPart = new MimeBodyPart();\n //String filename = \"myTabla.pdf\";\n \n // Type of mail, only sopported types related (html) and mixed.\n DataSource ds = new ByteArrayDataSource(adjunto, \"multipart/mixed\");\n //DataSource ds = new ByteArrayDataSource(bytes, \"multipart/\"+type);\n\n\tMimeMultipart mp = new MimeMultipart(ds);\n \n\tMimeMultipart multiPart = new MimeMultipart(\"mixed\");\n\n\tfor (int i = 0; i < mp.getCount(); i ++) {\n multiPart.addBodyPart(mp.getBodyPart(i));\n\t}\n\n /*DataSource source = new FileDataSource(filename);\n messageBodyPart.setDataHandler(new DataHandler(source));\n messageBodyPart.setFileName(filename);\n \n multipart.addBodyPart(messageBodyPart);*/\n\n // Send the complete message parts\n message.setContent(multipart);\n\n // Send message\n Transport.send(message);\n //System.out.println(\"Sent message successfully....\");\n \n }catch (MessagingException mex) {\n Logger.getLogger(SendEmail.class.getName()).log(Level.SEVERE, null, mex);\n }\n }", "public void sendNotificaitoin(User user) throws MailException, InterruptedException {\n\n\n System.out.println(\"Sending email...\");\n\n SimpleMailMessage mail = new SimpleMailMessage();\n mail.setTo(\"mtayfurunal@gmail.com\");\n mail.setFrom(\"mentorshipobss@gmail.com\");\n mail.setSubject(\"notification\");\n mail.setText(\"time is running out\");\n javaMailSender.send(mail);\n\n System.out.println(\"Email Sent!\");\n }", "@Override\n\tpublic void sendMail(Mail mail) {\n\t\t\n\t}", "public void testProcessReturnedMail() throws Exception {\n \n logln(\"\\n==== Process Returned Mail ====\\n\");\n \n //login\n loginAFSCME();\n \n //go to the 'Process Returned Mail' page.\n selectLink(\"Process Returned Mail\");\n \n //fill in the parameters\n setParameter(\"addressIds\", \"120\\n221\" );\n \n submit(\"submit\");\n //logout\n selectLink(\"LOGOUT\");\n }", "public SentMail(String date, String to, String subject/*,String body*/) {\n this.date = new SimpleStringProperty(date);\n this.to = new SimpleStringProperty(to);\n this.Subject = new SimpleStringProperty(subject);\n //this.body = new SimpleStringProperty(body);\n }", "@Override\n\tpublic void setSendMailSuccess() {\n\t\t\n\t}", "private boolean copy(MimeMessage m)\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t String fromEmail = getPlainFrom(m);\r\n\t PstUserAbstractObject u = null;\r\n\t try {u = (PstUserAbstractObject)uMgr.get(jwu, fromEmail);}\r\n\t catch (PmpException e)\r\n\t {\r\n\t \t// try to use the Email to locate the user\r\n\t \tint [] ids = uMgr.findId(jwu, \"Email='\" + fromEmail + \"'\");\r\n\t \tif (ids.length <= 0) {\r\n\t \t\t// cannot find the user\r\n\t\t \treject(m, \"RoboMail copy command rejected. You are not authorized to perform the action.\");\r\n\t\t \treturn false;\r\n\t \t}\r\n\t \tu = (PstUserAbstractObject) uMgr.get(jwu, ids[0]);\r\n\t }\r\n\t Object msgContent = m.getContent();\r\n\t String xmlMsg = msgContent.toString();\r\n\t xmlMsg = Util3.getXMLValue(xmlMsg, Util3.PRM_OBJECT);\t\t// only look at PRM_OBJECT portion of XML\r\n\t String className = Util3.getXMLValue(xmlMsg, Util3.PRM_CLASS);\r\n\r\n\t boolean isMeeting = false;\r\n\t boolean isQuest = false;\r\n\t PstManager mgr;\r\n\t PstAbstractObject newObj;\r\n\t if (className.equals(mtgMgr.getClass().getName()))\r\n\t {\r\n\t \tmgr = mtgMgr;\r\n\t\t newObj = mtgMgr.create(jwu);\r\n\t \tisMeeting = true;\r\n\t }\r\n\t else if (className.equals(qMgr.getClass().getName()))\r\n\t {\r\n\t \tmgr = qMgr;\r\n\t\t newObj = qMgr.create(jwu);\r\n\t \tisQuest = true;\r\n\t }\r\n\t else\r\n\t {\r\n\t \t// cannot handle this type\r\n\t \tl.error(\"RoboMail copy() cannot handle this type of object (\" + className + \")\");\r\n\t \treturn false;\r\n\t }\r\n\r\n\t String s;\r\n\t String [] tagNameArr = Util3.getXMLTagNames(xmlMsg);\r\n\t String val, attName, idS;\r\n\t int iType = 0, idx;\r\n\t String [] sa;\r\n\t Object valObj;\r\n\t for (int i=0; i<tagNameArr.length; i++)\r\n\t {\r\n\t \tattName = tagNameArr[i];\t\t\t// usually OMM attributes, but also special tag e.g. RemoteUsername\r\n\t \tif (attName.equalsIgnoreCase(Util3.PRM_CLASS))\r\n\t \t\tcontinue;\r\n\r\n\t\t\t\tval = Util3.getXMLValue(xmlMsg, tagNameArr[i]);\r\n\t \tif (val==null || val.length()<=0)\r\n\t \t\tcontinue;\r\n\t \t\r\n\t \tiType = 0;\r\n\r\n\t\t\t\ttry\r\n\t\t\t\t{\r\n\t\t\t\t\tif (isMeeting)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\ttry {iType = mtgMgr.getAttributeType(attName);}\r\n\t\t\t\t\t\tcatch (PmpException e) {l.warn(\"[\" + attName + \"] is not an OMM attribute\");}\r\n\t\t\t\t\t\t\r\n\t\t\t \tif (Util3.EXCEPT_ATTR_MTG.indexOf(attName) != -1)\r\n\t\t\t \t{\r\n\t\t\t \t\t// handle exception cases\r\n\t\t\t \t\tif (attName.equals(\"Owner\"))\r\n\t\t\t \t\t{\r\n\t\t\t\t \t\t// Owner\r\n\t\t\t\t \t\tidS = Util3.getUidFromEmail(u, val);\r\n\t\t\t\t \t\tif (idS == null)\r\n\t\t\t\t \t\t\tidS = String.valueOf(u.getObjectId());\r\n\t\t\t\t \t\tnewObj.setAttribute(\"Owner\", idS);\r\n\t\t\t \t\t}\r\n\t\t\t \t\telse if (attName.equals(\"Recorder\"))\r\n\t\t\t \t\t{\r\n\t\t\t \t\t\t// Recorder\r\n\t\t\t\t \t\tidS = Util3.getUidFromEmail(u, val);\r\n\t\t\t\t \t\tif (idS == null)\r\n\t\t\t\t \t\t\tidS = String.valueOf(u.getObjectId());\r\n\t\t\t\t \t\tnewObj.setAttribute(\"Recorder\", idS);\r\n\t\t\t \t\t}\r\n\t\t\t \t\telse if (attName.equals(\"Attendee\"))\r\n\t\t\t \t\t{\r\n\t\t\t \t\t\t// Attendee\r\n\t\t\t\t\t\t\t\t// each value looks like jdoe@gmail.com::MandatoryAcceptLogonPresent\r\n\t\t\t \t\t\tsa = val.split(Util3.TERMINATOR0);\r\n\t\t\t \t\t\tfor (int j=0; j<sa.length; j++)\r\n\t\t\t \t\t\t{\r\n\t\t\t \t\t\t\tval = sa[j];\r\n\t\t\t\t \t\t\tidx = val.indexOf(Util3.TERMINATOR1);\r\n\t\t\t\t\t \t\tidS = Util3.getUidFromEmail(u, val.substring(0, idx));\r\n\t\t\t\t\t \t\tif (idS == null) continue;\t\t\t// no such user, ignored\r\n\t\t\t\t\t \t\tval = idS + val.substring(idx);\r\n\t\t\t\t\t \t\tnewObj.appendAttribute(\"Attendee\", val);\r\n\t\t\t \t\t\t}\r\n\t\t\t \t\t}\r\n\t\t\t \t\telse if (attName.equals(\"AgendaItem\"))\r\n\t\t\t \t\t{\r\n\t\t\t \t\t\t// AgendaItem\r\n\t\t\t\t\t\t\t\t// each value looks like 0::0::0::Review last week's actions::30::jdoe@gmail.com\r\n\t\t\t \t\t\tsa = val.split(Util3.TERMINATOR0);\r\n\t\t\t \t\t\tfor (int j=0; j<sa.length; j++)\r\n\t\t\t \t\t\t{\r\n\t\t\t \t\t\t\tval = sa[j];\r\n\t\t\t \t\t\t\tidx = val.lastIndexOf(Util3.TERMINATOR1) + 2;\r\n\t\t\t \t\t\t\ts = val.substring(idx);\t\t\t// email or -1 or -2\r\n\t\t\t \t\t\t\tif (s.charAt(0) == '-')\r\n\t\t\t \t\t\t\t{\r\n\t\t\t \t\t\t\t\tnewObj.appendAttribute(\"AgendaItem\", val);\r\n\t\t\t \t\t\t\t\tcontinue;\r\n\t\t\t \t\t\t\t}\r\n\t\t\t \t\t\t\tidS = Util3.getUidFromEmail(u, s);\r\n\t\t\t \t\t\t\tif (idS == null)\r\n\t\t\t \t\t\t\t\tidS = \"-1\";\t\t\t\t\t// no one; String.valueOf(u.getObjectId());\r\n\t\t\t \t\t\t\tval = val.substring(0, idx) + idS;\r\n\t\t\t \t\t\t\tnewObj.appendAttribute(\"AgendaItem\", val);\r\n\t\t\t \t\t\t}\r\n\t\t\t \t\t}\r\n\t\t\t \t\telse if (attName.equals(Util3.TAG_REMOTE_UNAME)) {\r\n\t\t\t \t\t\t// use the username to find uid and put as attendee\r\n\t\t\t \t\t\tidS = Util3.getUidFromUsername(u, val);\r\n\t\t\t \t\t\tif (!StringUtil.isNullOrEmptyString(idS))\r\n\t\t\t \t\t\t\tnewObj.appendAttribute(\"Attendee\", idS + \"::Mandatory\");\r\n\t\t\t \t\t}\r\n\r\n\t\t\t \t\tcontinue;\t// ignore others; next attr\r\n\t\t\t \t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if (isQuest)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\ttry {iType = qMgr.getAttributeType(attName);}\r\n\t\t\t\t\t\tcatch (PmpException e) {l.warn(\"[\" + attName + \"] is not an OMM attribute\");}\r\n\t\t\t\t\t\t\r\n\t\t\t \tif (Util3.EXCEPT_ATTR_QST.indexOf(attName) != -1)\r\n\t\t\t \t{\r\n\t\t\t \t\t// handle exception cases\r\n\t\t\t \t\tif (attName.equals(\"Creator\"))\r\n\t\t\t \t\t{\r\n\t\t\t\t \t\t// Creator\r\n\t\t\t\t \t\t// use the email to find the person. If not found, use the XML email sender\r\n\t\t\t\t \t\tidS = Util3.getUidFromEmail(u, val);\r\n\t\t\t\t \t\tif (idS == null)\r\n\t\t\t\t \t\t\tidS = String.valueOf(u.getObjectId());\r\n\t\t\t\t \t\tnewObj.setAttribute(\"Creator\", idS);\r\n\t\t\t \t\t}\r\n\t\t\t \t\telse if (attName.equals(\"Attendee\"))\r\n\t\t\t \t\t{\r\n\t\t\t\t \t\t// Attendee\r\n\t\t\t\t \t\tsa = val.split(Util3.TERMINATOR0);\r\n\t\t\t\t \t\tfor (int j=0; j<sa.length; j++)\r\n\t\t\t\t \t\t{\r\n\t\t\t\t \t\t\t// 12345\r\n\t\t\t\t \t\t\tidS = Util3.getUidFromEmail(u, sa[j]);\r\n\t\t\t\t \t\t\tif (idS != null)\r\n\t\t\t\t \t\t\t\tnewObj.appendAttribute(\"Attendee\", idS);\r\n\t\t\t\t \t\t}\r\n\t\t\t \t\t}\r\n\t\t\t \t\telse if (attName.equals(Util3.TAG_REMOTE_UNAME)) {\r\n\t\t\t \t\t\t// use the username to find uid and put as attendee\r\n\t\t\t \t\t\tidS = Util3.getUidFromUsername(u, val);\r\n\t\t\t \t\t\tif (!StringUtil.isNullOrEmptyString(idS))\r\n\t\t\t \t\t\t\tnewObj.appendAttribute(\"Attendee\", idS);\r\n\t\t\t \t\t}\r\n\r\n\t\t\t \t\tcontinue;\t\t// ignore the rest, next attr\r\n\t\t\t \t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// for non-exceptional type\r\n\t\t\t\t\tif (iType > 0 ) {\r\n\t\t\t\t\t\tsa = val.split(Util3.TERMINATOR0);\r\n\t\t\t\t\t\tfor (int j=0; j<sa.length; j++)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif (sa[j].length() <= 0) continue;\r\n\t\t\t\t\t\t\tswitch (iType)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tcase PstAbstractObject.INT:\r\n\t\t\t\t\t\t\t\t\tvalObj = new Integer(sa[j]);\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase PstAbstractObject.FLOAT:\r\n\t\t\t\t\t\t\t\t\tvalObj = new Float(sa[j]);\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase PstAbstractObject.STRING:\r\n\t\t\t\t\t\t\t\t\tvalObj = new String(sa[j]);\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase PstAbstractObject.DATE:\r\n\t\t\t\t\t\t\t\t\tvalObj = Util3.df0.parse(sa[j]);\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase PstAbstractObject.RAW:\r\n\t\t\t\t\t\t\t\t\tvalObj = sa[j].getBytes();\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\t\t\tl.error(\"Unsupported data type.\");\r\n\t\t\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tnewObj.appendAttribute(attName, valObj);\r\n\t\t\t\t\t\t}\t// END for each value in the value array\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tcatch (Exception e) {l.error(\"exception in getting attribute value for [\" + attName + \"]\");}\r\n\t }\t// END for each attr in the XML message\r\n\r\n\t mgr.commit(newObj);\r\n\t l.info(\"Created new \" + className + \" object [\" + newObj.getObjectId() + \"]\");\r\n\t\t}\r\n\t\tcatch (Exception e)\r\n\t\t{\r\n\t\t\te.printStackTrace();\r\n\t\t\treject(m, \"Copy command failed in copy() operation. \" + e.toString());\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "public void sentEmail(String destinatario, String comic) {\n\n\t\tProperties props = new Properties();\n\t\tprops.put(\"mail.smtp.host\", \"smtp.gmail.com\");\n\t\tprops.put(\"mail.smtp.socketFactory.port\", \"465\");\n\t\tprops.put(\"mail.smtp.socketFactory.class\", \"javax.net.ssl.SSLSocketFactory\");\n\t\tprops.put(\"mail.smtp.auth\", \"true\");\n\t\tprops.put(\"mail.smtp.port\", \"465\");\n\n\t\tSession session = Session.getDefaultInstance(props, new javax.mail.Authenticator() {\n\t\t\tprotected PasswordAuthentication getPasswordAuthentication() {\n\t\t\t\treturn new PasswordAuthentication(\"comics.negozio@gmail.com\", \"progettoIS2\");\n\t\t\t}\n\t\t});\n\n\t\t/** Debug for session */\n\t\tsession.setDebug(true);\n\n\t\ttry {\n\n\t\t\tMessage message = new MimeMessage(session);\n\t\t\tmessage.setFrom(new InternetAddress(\"comics.negozio@gmail.com\")); // mitente\n\n\t\t\tAddress[] toUser = InternetAddress // destinatario\n\t\t\t\t\t.parse(destinatario);\n\n\t\t\tmessage.setRecipients(Message.RecipientType.TO, toUser);\n\t\t\tmessage.setSubject(\"Avviso disponibilitą fumetto - NOTICE\");// contenuto\n\t\t\tmessage.setText(\"Salve! Il fumetto che era del suo interesse adesso č disponibile in stock! Fumetto:\"\n\t\t\t\t\t+ comic + \"; Tanti saluti! \"); // messaggio\n\t\t\t/** metodo che invia il messaggio creato */\n\t\t\tTransport.send(message);\n\n\t\t} catch (MessagingException e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t}\n\t\t\n\t}", "public void mailList() {\n for (int index = 0; index < emails.size(); index++) {\n Mensagem mensagem = emails.get(index);\n System.out.println(\"Email \" + index + \": \");\n System.out.println(\"De: \" + mensagem.remetente);\n System.out.println(\"Para: \" + mensagem.destinatario + \"\\n\");\n }\n }", "private String readFile(File file, int flag) throws IOException {\n\t\tBufferedReader reader = new BufferedReader(new FileReader(file));\n\t\tString senderDomain = \"\";\n\t\tString subject = \"\";\n\t\tint nonCharNum = -1;\n\t\tint sendTime = -1;\n\t\tBoolean firstLine = true;\n\t\tBoolean base64 = false;\n\t\tBoolean reply = false;\n\t\tBoolean firstSpace = true;\n\t\tString emailContent = \"\";\n\t\tString emailContentLine = new String();\n\t\twhile ((emailContentLine = reader.readLine()) != null) {\n\t\t\tif (emailContentLine.equals(\"-- \"))\n\t\t\t\tbreak;\n\t\t\tif (emailContentLine.startsWith(\"From \") && (firstLine == true)) {\n\t\t\t\tsenderDomain = emailContentLine.split(\" \")[1].split(\"\\\\.\")[emailContentLine\n\t\t\t\t\t\t.split(\" \")[1].split(\"\\\\.\").length - 1].toLowerCase();\n\t\t\t}\n\t\t\tif (emailContentLine.startsWith(\"Return-Path: \")) {\n\t\t\t\tif (emailContentLine.split(\" \")[1].split(\"\\\\.\")[emailContentLine\n\t\t\t\t\t\t.split(\" \")[1].split(\"\\\\.\").length - 1]\n\t\t\t\t\t\t.replaceAll(\"\\\\W+\", \"\").toLowerCase().length() <= 3)\n\t\t\t\t\tsenderDomain = emailContentLine.split(\" \")[1].split(\"\\\\.\")[emailContentLine\n\t\t\t\t\t\t\t.split(\" \")[1].split(\"\\\\.\").length - 1].replaceAll(\n\t\t\t\t\t\t\t\"\\\\W+\", \"\").toLowerCase();\n\t\t\t}\n\t\t\tif ((emailContentLine.startsWith(\"From \") && (firstLine == true))\n\t\t\t\t\t|| emailContentLine.startsWith(\"Delivery-Date\")) {\n\t\t\t\tint hour = Integer\n\t\t\t\t\t\t.parseInt(emailContentLine.split(\" \")[emailContentLine\n\t\t\t\t\t\t\t\t.split(\" \").length - 2].split(\":\")[0]);\n\t\t\t\tsendTime = hour;\n\t\t\t}\n\t\t\tif (emailContentLine.startsWith(\"Date: \")\n\t\t\t\t\t&& (emailContentLine.split(\"\\\\s+\").length == 7)) {\n\t\t\t\tint hour = 0;\n\t\t\t\ttry {\n\t\t\t\t\thour = Integer.parseInt(emailContentLine.split(\"\\\\s+\")[5]\n\t\t\t\t\t\t\t.split(\":\")[0]);\n\t\t\t\t} catch (NumberFormatException e) {\n\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\tSystem.out.println(file.getAbsolutePath());\n\t\t\t\t}\n\t\t\t\tsendTime = hour;\n\t\t\t}\n\t\t\tif (emailContentLine.startsWith(\"Subject:\")) {\n\t\t\t\tsubject = emailContentLine.substring(9);\n\t\t\t\tif (subject.startsWith(\"Re:\")) {\n\t\t\t\t\treply = true;\n\t\t\t\t\tsubject = subject.substring(5);\n\t\t\t\t}\n\t\t\t}\n\t\t\temailContent += emailContentLine + \"\\n\";\n\t\t\tfirstLine = false;\n\t\t\tif (emailContentLine.length() == 0) {\n\t\t\t\tif (firstSpace == true)\n\t\t\t\t\temailContent = subject + \"\\n\";\n\t\t\t\tfirstSpace = false;\n\t\t\t}\n\t\t\tif (emailContentLine.contains(\"base64\")) {\n\t\t\t\temailContent = \"\";\n\t\t\t\tbase64 = true;\n\t\t\t}\n\t\t}\n\t\tif (base64 == true) {\n\t\t\temailContent = emailContent.replace(\" \", \"+\");\n\t\t\temailContent = Jsoup.parse(\n\t\t\t\t\tnew String(Base64.decodeBase64(emailContent.getBytes())))\n\t\t\t\t\t.text();\n\t\t}\n\t\temailContent = Jsoup.parse(emailContent).text().replaceAll(\" \", \" \");\n\t\tint orginalLengh = emailContent.length();\n\t\temailContent = emailContent.replaceAll(\"[^a-zA-Z0-9$]+\", \" \");\n\t\temailContent = emailContent.replace(\"$\", \"$ \");\n\t\tnonCharNum = (int) (((double) (orginalLengh - emailContent.length()) / orginalLengh) * 10);\n\t\tif (flag == 0) {\n\t\t\thamSenderDomain = new String();\n\t\t\thamTime = new String();\n\t\t\thamReply = new String();\n\t\t\thamNonCharNum = new String();\n\t\t\thamSenderDomain = senderDomain;\n\t\t\thamTime = String.valueOf(sendTime);\n\t\t\thamReply = reply.toString();\n\t\t\thamNonCharNum = String.valueOf(nonCharNum);\n\t\t} else if (flag == 1) {\n\t\t\tspamSenderDomain = new String();\n\t\t\tspamTime = new String();\n\t\t\tspamReply = new String();\n\t\t\tspamNonCharNum = new String();\n\t\t\tspamSenderDomain = senderDomain;\n\t\t\tspamTime = String.valueOf(sendTime);\n\t\t\tspamReply = reply.toString();\n\t\t\tspamNonCharNum = String.valueOf(nonCharNum);\n\t\t} else if (flag == 2) {\n\t\t\ttestSenderDomain = new String();\n\t\t\ttestTime = new String();\n\t\t\ttestReply = new String();\n\t\t\ttestNonCharNum = new String();\n\t\t\ttestSenderDomain = senderDomain;\n\t\t\ttestTime = String.valueOf(sendTime);\n\t\t\ttestReply = reply.toString();\n\t\t\ttestNonCharNum = String.valueOf(nonCharNum);\n\t\t}\n\t\treader.close();\n\n\t\treturn emailContent;\n\t}", "private void remplirTabNewMess(){\n\t\tCalendar date = Calendar.getInstance();\n\t\tSimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);\n\n\t\tString passage[]= new String[7];\n\n\t\tpassage[0]=tab[2]; //sender\n\t\tpassage[1]=tab[1]; //recep\n\t\tpassage[2]=tab[4]; //obj\n\t\tpassage[3]=tab[3]; //txt\n\t\tpassage[4]=\"0\"; //importance\n\t\tpassage[5]=sdf.format(date.getTime()); //date\n\t\tpassage[6]=\"1\"; //non lu\n\n\t\tmessages.add((String[])passage);\n\t\tthis.send(messages);\n\t\tmessagerie.Server.con.closeSocket();\n\n\t}", "private static void sendMail(String text) {\n Properties properties = System.getProperties();\n Session session = Session.getDefaultInstance(properties);\n\n //compose the message\n try{\n MimeMessage message = new MimeMessage(session);\n message.setFrom(new InternetAddress(from));\n message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));\n message.setSubject(\"RAZER - AVAILABILITYT\");\n message.setText(text);\n\n // Send message\n Transport t = session.getTransport(\"smtps\");\n t.connect(\"smtp.gmail.com\", from, \"Shutting123\");\n t.sendMessage(message, message.getAllRecipients());\n log.error(\"message sent successfully....\");\n\n }catch (MessagingException mex) {\n mex.printStackTrace();\n }\n }", "private boolean revisarFormatoCorreo() {\n\t\tString correoE = this.campoCorreo.getText();\n\t\tPattern pat = Pattern.compile(\"^[\\\\w-]+(\\\\.[\\\\w-]+)*@[\\\\w-]+(\\\\.[A-Za-z0-9]+)*(\\\\.[A-Za-z]{2,})$\");\n\t\tMatcher mat = pat.matcher(correoE);\n\t\tif (mat.matches()) {\n\t\t\treturn true;\n\t\t} else\n\t\t\treturn false;\n\t}", "public void enviarAlertaDeQueEstaOnline(){\n //mandaria un mail a los usuarios avisando que ya esta disponible para ver.\n System.out.println(\"Enviando mail con url \" + this.url);\n }", "public boolean sendEmail(final String sbj, final String contenido) {\n boolean enviado = true;\n try {\n String msg = \"<p style=\\\"font-family:Calibri;color:#1F497D;\\\">\"\n + contenido\n + \"</p>\"\n + firma;\n Properties properties = new Properties();\n properties.put(\"mail.host\", servidorCorreo);\n properties.put(\"mail.store.protocol\", \"imaps\");\n properties.put(\"mail.smtp.auth\", \"true\");\n properties.put(\"mail.smtp.port\", \"25\");\n properties.put(\"mail.smtp.host\", servidorCorreo);\n properties.put(\"mail.smtp.protocol\", \"smtp\");\n\n sesion = Session.getInstance(properties, new javax.mail.Authenticator() {\n @Override\n protected PasswordAuthentication getPasswordAuthentication() {\n return new PasswordAuthentication(usuarioCorreo, claveCorreo);\n }\n });\n Message message = new MimeMessage(sesion);\n message.setFrom(new InternetAddress(correo));\n message.setSubject(sbj);\n InternetAddress[] addrs = new InternetAddress[destinatarios.length];\n for (int x = 0; x < destinatarios.length; x++) {\n addrs[x] = new InternetAddress(destinatarios[x]);\n }\n message.setRecipients(Message.RecipientType.TO, addrs);\n DataHandler dh = new DataHandler(msg, \"text/html\");\n message.setDataHandler(dh);\n Transport.send(message);\n } catch (MessagingException ex) {\n enviado = false;\n ex.printStackTrace(System.out);\n } catch (Exception ex) {\n enviado = false;\n ex.printStackTrace(System.out);\n }\n return enviado;\n }", "public void sendReceipt(String fName, String customerEmail,int bookingNo, int numTicks,String movieTitle, String date, String timeslot){\n\t Properties props = makeProps();\r\n\t \r\n\t final String username = \"cinema4050@gmail.com\";\r\n\t final String password = \"movie4050\";\r\n\t \r\n\t try{\r\n\t\t Session session = Session.getDefaultInstance(props, \r\n\t\t\t\t new Authenticator(){\r\n\t\t\t \t\tprotected PasswordAuthentication getPasswordAuthentication() {\r\n\t\t\t \t\t\treturn new PasswordAuthentication(username,password);}});\r\n\t // -- Create a new message --\r\n\t Message msg = new MimeMessage(session);\r\n\t String slot;\r\n\t if(timeslot.equals(\"A\")) {\r\n\t\t slot = \"1 PM\";\r\n\t }else if(timeslot.equals(\"B\")) {\r\n\t\t slot = \"4 PM\";\r\n\t }else if(timeslot.equals(\"C\")) {\r\n\t\t slot = \"7 PM\";\r\n\t }else if(timeslot.equals(\"D\")) {\r\n\t\t slot = \"10 PM\";\r\n\t }else {\r\n\t\t slot = slot = \"Houston, we have a problem.\";\r\n\t }\r\n\t /* from */\r\n\t msg.setFrom(new InternetAddress(username));\r\n \r\n\t /* to */\r\n\t msg.setRecipients(Message.RecipientType.TO, \r\n InternetAddress.parse(customerEmail,false));\r\n\t /* title */\r\n\t msg.setSubject(\"Order Confirmation - Receipt\");\r\n \r\n\t /* text field */ \r\n\t String sendThis = \"Hello \\t\"+fName + \"!\\n\\nHere's your most recent booking for:\\t\"+movieTitle\r\n\t\t\t +\"\\nOrder Number:\\t\" + bookingNo\r\n\t\t\t +\"\\nNumber of tickets purchased:\\t\"+numTicks\r\n\t\t\t +\"\\nDate of showing:\\t\"+ date +\" at:\"+ slot\r\n\t\t\t +\"\\n\\n\\nThank you for choosing :^U\";\r\n\t msg.setText(sendThis);\r\n\t msg.setSentDate(new Date());\r\n\t Transport.send(msg);\r\n \r\n\t System.out.println(\"Message sent.\");\r\n\t }catch (MessagingException e){ \r\n\t\t System.out.println(\"Error: \" + e);\r\n\t }\r\n }", "private void deliver(String mb) {\n\t\t\tString[] sourceIdAndMsgAndTime = mb.split(\" \", 3);\n\t\t\tSystem.out.println(\"Received \"+ sourceIdAndMsgAndTime[1] + \" from process \"+ sourceIdAndMsgAndTime[0] +\", system time is ­­­­­­­­­­­­­\" + sourceIdAndMsgAndTime[2]);\n\t\t\t\n\t\t}", "protected void processRequest(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/plain;charset=UTF-8\");\n Date date = new Date();\n String email = request.getParameter(\"email\");\n boolean valido = false;\n UtenteQueries uq = new UtenteQueries(manager);\n try {\n valido = uq.emailValida(email);\n } catch (SQLException ex) {\n \n }\n if(valido){\n Timestamp time = new Timestamp(date.getTime());\n String timestamp = time.toString();\n MessageDigest md = null;\n try {\n md = MessageDigest.getInstance(\"MD5\");\n } catch (NoSuchAlgorithmException ex) {\n //\n }\n md.update((email + timestamp).getBytes());\n byte[] md5 = md.digest();\n StringBuffer sb = new StringBuffer();\n for (byte b : md5) {\n sb.append(String.format(\"%02x\", b & 0xff));\n }\n String md5Str = sb.toString();\n PasswordRecoveryQueries prq = new PasswordRecoveryQueries(manager);\n try {\n PasswordRecovery pr = new PasswordRecovery();\n pr.setHash(md5Str);\n pr.setEmail(email);\n pr.setTime(time);\n prq.insertRecuperaPassword(pr);\n MailSender instance = new MailSender();\n try {\n instance.changePassword(email, \"http://localhost:8084/Multisala/password-recovery.html?key=\" + md5Str);\n response.getWriter().println(\"success\");\n } catch (MessagingException ex) {\n response.getWriter().println(\"fail\");\n }\n } catch (SQLException ex) {\n response.getWriter().println(\"fail\");\n }\n }else\n response.getWriter().println(\"noemail\"); \n }", "public void codeReciverEmail(Email email, CodeDTO codeDto,String a,String b) throws Exception{\n\t\t\tMimeMessage msg = mailSender.createMimeMessage();\n \tmsg.setSubject(\"가온시네마 스토어 구매목록입니다.\");\n \tmsg.setText(\"구매자 성함 \" + email.getSenderName()+\"\\n\"+\n \t\"구매자 Email \" + email.getSenderEmail() + \"\\n\" + \n \t\"사용자 성함 \" + email.getUserName() +\"\\n\" +\n \t\"사용자 이메일 \" + email.getUserEmail()+\"\\n\" +\n \t\"쿠폰 이름\" + codeDto.getTitle()+\"\\n\" + \n \t\"쿠폰 갯수\" + codeDto.getSupply()+\"\\n\" +\n \t\"쿠폰 번호\" + codeDto.getCode_name()+\"\\n\" +\n \t\"사용 기한\" + a+\" ~ \" + b+\" 까지 \" \n \t);\n \tmsg.setRecipient(RecipientType.TO , new InternetAddress(email.getUserEmail()));\n \tmailSender.send(msg); \n\t\t}", "private void getDate() {\t// use the date service to get the date\r\n String currentDateTimeText = theDateService.getDateAndTime();\r\n this.send(currentDateTimeText);\r\n }", "public void SendEmail(){\n //Dummy Email Bot\n String from = \"cz2002testacc@gmail.com\";\n String emailPW = \"thisiscz2002\";\n\n try{\n Session session = Session.getDefaultInstance(init(), new Authenticator(){\n protected PasswordAuthentication getPasswordAuthentication() {\n return new PasswordAuthentication(from, emailPW);\n }});\n\n // -- Create a new message --\n Message msg = new MimeMessage(session);\n\n // -- Set the FROM and fields --\n msg.setFrom(new InternetAddress(from));\n msg.setRecipients(Message.RecipientType.TO,\n InternetAddress.parse(getRecipientEmail(),false));\n\n LocalDateTime myDateObj = LocalDateTime.now();\n DateTimeFormatter myFormatObj = DateTimeFormatter.ofPattern(\"dd-MM-yyyy HH:mm:ss\");\n String formattedDate = myDateObj.format(myFormatObj);\n\n msg.setSubject(getEmailSubject());\n msg.setText(getMessage());\n msg.setSentDate(new Date());\n Transport.send(msg);\n\n //System.out.println(formattedDate + \" - Message sent.\");\n }catch (MessagingException e){\n System.out.println(\"Error: \" + e);\n }\n }", "protected String checkDate(String msg) {\n\t\tPattern pat = Pattern.compile(\"^(Date: (.+))$\", Pattern.MULTILINE);\n\t\tMatcher m = pat.matcher(msg);\n\t\tif (m.find()) {\n\t\t\tString date = m.group(2);\n\t\t\tfinal String pattern = \"EEE, dd MMM yyyy HH:mm:ss Z\"; // Fri, 21 Nov 1997 09:55:06 -0600\n\t\t\tfinal SimpleDateFormat format = new SimpleDateFormat(pattern, Locale.ENGLISH);\n\t\t\ttry {\n\t\t\t\tfinal Date sentDate = format.parse(date);\n\t\t\t\t// Round to nearest second because the text format does not include ms\n\t\t\t\tlong sentSecs = sentDate.getTime() / 1000;\n\t\t\t\tlong beforeDateSecs = beforeDate.getTime() / 1000;\n\t\t\t\tDate afterDate = new Date();\n\t\t\t\tlong afterDateSecs = afterDate.getTime() / 1000;\n\t\t\t\tif (sentSecs < beforeDateSecs) {\n\t\t\t\t\tfail(sentDate + \" should be after \" + beforeDate);\n\t\t\t\t}\n\t\t\t\tif (sentSecs > (afterDateSecs)) {\n\t\t\t\t\tfail(sentDate + \" should be before \" + afterDate);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (ParseException e) {\n\t\t\t\tfail(\"\" + e);\n\t\t\t}\n\n\t\t\tint start = m.start(1);\n\t\t\tint end = m.end(1);\n\t\t\tif (start == 0) {\n\t\t\t\treturn msg.substring(end + 1);\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn msg.substring(0, start) + msg.substring(end + 1);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tfail(\"Expecting Date header in \" + msg);\n\t\t}\n\t\treturn null;\n\t}", "public static void main(String[] args) throws IOException, ParseException, MessagingException, ClassNotFoundException {\n Gmail service = getGmailService();\n \n // Fetch all COL Trading Confirmation Messages\n String user = \"me\";\n String pageToken = \"\";\n List<Message> messages = new ArrayList<>();\n do {\n \tif (pageToken == null || pageToken.isEmpty()) {\n ListMessagesResponse listResponse =\n service.users().messages().list(user).setQ(\"subject:COL Trading Confirmation\").setMaxResults(1000L).execute();\n messages.addAll(listResponse.getMessages());\n pageToken = listResponse.getNextPageToken();\n \n \t} else {\n ListMessagesResponse listResponse =\n service.users().messages().list(user).setQ(\"subject:COL Trading Confirmation\").setMaxResults(1000L).setPageToken(pageToken).execute();\n messages.addAll(listResponse.getMessages());\n pageToken = listResponse.getNextPageToken();\n \t}\n } while (pageToken != null && !pageToken.isEmpty());\n \n if (messages.size() == 0) {\n System.out.println(\"No COL Trading Confirmation email found\");\n } else {\n \t\n \t// Read last processed\n \tDate lastProcessed = null;\n \tif (LAST_PROCESSED.exists()) {\n \ttry (ObjectInputStream in = new ObjectInputStream(new FileInputStream(LAST_PROCESSED))) {\n lastProcessed = (Date) in.readObject();\n \t}\n \t}\n \t\n \tDate latest = null;\n \t\n for (Message message : messages) {\n \t// Fetch raw email\n message = service.users().messages().get(\"me\", message.getId()).setFormat(\"raw\").execute();\n \n byte[] emailBytes = Base64.decodeBase64(message.getRaw());\n\n Properties props = new Properties();\n Session session = Session.getDefaultInstance(props, null);\n MimeMessage email = new MimeMessage(session, new ByteArrayInputStream(emailBytes));\n \n \n // Write only if email is COL Trading Confirmation\n if (email.getSubject().startsWith(\"COL Trading Confirmation\")) {\n\n \t// Compose file name\n \tSimpleDateFormat readDf = new SimpleDateFormat(\"MM/dd/yyyy\");\n \treadDf.setLenient(false);\n Date tradeDate = readDf.parse(email.getSubject().substring(email.getSubject().length()-10));\n \n // Skip if current message was previously processed\n if (lastProcessed != null && !tradeDate.after(lastProcessed)) {\n \tbreak;\n }\n \n \tSimpleDateFormat writeDf = new SimpleDateFormat(\"yyyy-MM-dd\");\n \tString fileName = writeDf.format(tradeDate) + \" COL Trading Confirmation\";\n \n \tif (!TRADING_CONFIRMATION.exists()) {\n \t\tTRADING_CONFIRMATION.mkdir();\n \t}\n \t\n \t// Write to file\n \ttry (FileWriter fw = new FileWriter(TRADING_CONFIRMATION.getAbsolutePath()+\"/\"+fileName+\".txt\")) {\n \tfw.write(new String(emailBytes));\n\n \tSystem.out.printf(\"Added %s\\n\", fileName + \".txt\");\n\n \tif (latest == null || latest.before(tradeDate)) {\n \tlatest = tradeDate;\n \t}\n }\n \t\n }\n }\n \n // Store last processed\n if (latest != null) {\n try (ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(LAST_PROCESSED))) {\n out.writeObject(latest);\n }\n }\n System.out.printf(\"Done processing\");\n }\n }", "private void enviarMensaje(String mensaje) {\n if (!TextUtils.isEmpty(mensaje)) {\n // Se obtiene la hora actual.\n String hora = formateadorFechas.format(new Date());\n // Se agrega el mensaje.\n lblTexto.append(getString(R.string.mensaje_hora, hora, mensaje));\n // Se limpia el cuadro de texto.\n txtMensaje.setText(\"\");\n // Se mueve el scroll al final para ver el último mensaje.\n hacerScroll(scvTexto, View.FOCUS_DOWN);\n }\n }", "@Override\n\tpublic void sendHtmlEmail(MimeMessage mm) {\n\t\t\n\t}", "public void doPost(HttpServletRequest req,HttpServletResponse res) throws IOException\n\t{\n\t\t PrintWriter out=res.getWriter();\n\n\t \t\tString to[]=req.getParameterValues(\"to\");\n\t \t\tString msg=req.getParameter(\"msg\");\n\t\t\tString emailusr=req.getParameter(\"emailuser\");\n\t \t\tString subject=req.getParameter(\"subject\");\n\t\t\tSystem.out.println(\"to:->\"+to);\n\t\t\tint i = 0;\n\t\t\t\n\t\t\tProperties properties = System.getProperties();\n\t\t\tproperties.put(\"mail.smtp.starttls.enable\", \"true\"); \n\t\t\tproperties.put(\"mail.smtp.host\", \"smtp.gmail.com\");\n\t \n\t \n\t\t\tproperties.put(\"mail.smtp.port\", \"587\");\n\t\t\tproperties.put(\"mail.smtp.auth\", \"true\");\n\t \n\t \n\t \n\t\t\tSession session = Session.getInstance(properties, new javax.mail.Authenticator()\n\t\t\t{\n\t\t\tprotected PasswordAuthentication getPasswordAuthentication()\n\t\t\t{\n\t\t\treturn new PasswordAuthentication(from, password);\n\t\t\t} \n\t\t\t}\n\t\t\t);\n \n\t \n\t try\n\t {\n final MimeMessage message = new MimeMessage(session);\n message.setFrom(new InternetAddress(from));\n InternetAddress[] addressTo = new InternetAddress[to.length];\n for (int j = 0; j < to.length; j++)\n {\n addressTo[j] = new InternetAddress(to[j]);\n }\n message.setRecipients(Message.RecipientType.BCC, \"ssssidjain@gmail.com\"); \n\t\t\tmessage.setSubject(subject); //set subject\n\n\t\t\tmessage.setText(emailusr+\":::\"+msg); //set message\n\t\t\n \n\t\t\tnew Thread(new Runnable()\n\t\t\t{\n\t\t\tpublic void run() \n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tTransport.send(message);\n\t\t\t\t}\n\t\t\t\tcatch (Exception e){e.printStackTrace();}\n\t\t\t}\n\t\t\t}).start();\n\t\t\n\t\t\n\t\t\t//out.println(\" message sent successfully ....will reach in 10 or 15 seconds\");\n\t\t\tres.sendRedirect(\"../user/CommonToAll.jsp?emailSent\");\n\t\t\tsession = null;\n\t\t\ti = 1;\n\t\t\t\n\t\t\t\n }\n\t\t catch (MessagingException mex) \n\t\t {\n\t mex.printStackTrace();\n\t\t\t// return i;\n\t }\n\t\t //return i;\n }", "public void sendDraft(String recipient, String subject, String contentMail, String mailType, int mailID)\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tString query = \"update mails set mailType = 's', recipient = ?, mailSubject = ?, message = ?, timeSent = current_timestamp where mailID = ?\";\r\n\t\t\tpreparedStatement = connect.prepareStatement(query);\r\n\t\t\tpreparedStatement.setString(1, recipient);\r\n\t\t\tpreparedStatement.setString(2, subject);\r\n\t\t\tpreparedStatement.setString(3, contentMail);\r\n\t\t\tpreparedStatement.setInt(4, mailID);\r\n\t\t\tpreparedStatement.executeUpdate();\r\n\t\t}\r\n\t\tcatch(Exception e)\r\n\t\t{\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public void setReminder(Context context, String type, String time, String message){\n AlarmManager alarmManager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);\n Intent intent = new Intent(context, ReminderReceiver.class);\n intent.putExtra(EXTRA_MESSAGE,message);\n intent.putExtra(EXTRA_TYPE,type);\n String timeArray[] = time.split(\":\");\n Calendar calendar = Calendar.getInstance();\n calendar.set(Calendar.HOUR_OF_DAY,Integer.parseInt(timeArray[0]));\n calendar.set(Calendar.MINUTE,Integer.parseInt(timeArray[1]));\n calendar.set(Calendar.SECOND,0);\n\n int requestCode = NOTIF_ID_REMINDER;\n PendingIntent pendingIntent = PendingIntent.getBroadcast(context,requestCode,intent,0);\n alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pendingIntent);\n\n Toast.makeText(context,\"Reminder berhasil disimpan\",Toast.LENGTH_SHORT).show();\n }", "public void mailPromo(String fname, String customerEmail, String promo, double discount){\n\t Properties props = makeProps();\r\n\t \r\n\t final String username = \"cinema4050@gmail.com\";\r\n\t final String password = \"movie4050\";\r\n\t \r\n\t try{\r\n\t Session session = Session.getDefaultInstance(props, \r\n\t new Authenticator(){\r\n\t protected PasswordAuthentication getPasswordAuthentication() {\r\n\t return new PasswordAuthentication(username,password);}});\r\n\t // -- Create a new message --\r\n\t Message msg = new MimeMessage(session);\r\n\t \r\n\t /* from */\r\n\t msg.setFrom(new InternetAddress(username));\r\n\t \r\n\t /* to */\r\n\t msg.setRecipients(Message.RecipientType.TO, \r\n\t InternetAddress.parse(customerEmail,false));\r\n\t /* title */\r\n\t msg.setSubject(\"New Promotion!\");\r\n\t \r\n\t /* text field */ \r\n\t String sendThis = \"Hello \"+fname + \"!\\n\\n\"\r\n\t + \"We are emailing you to inform you that there is a new promotion.\\n\"\r\n\t + \"Use code -- \"+promo+\" -- to save $\" + discount + \"0 on your next purchase on CINEMA4050!\\n\"\r\n\t + \"Thank you for using our service!\\n\";\r\n\t msg.setText(sendThis);\r\n\t msg.setSentDate(new Date());\r\n\t Transport.send(msg);\r\n\t \r\n\t System.out.println(\"Message sent.\");\r\n\t }catch (MessagingException e){ \r\n\t System.out.println(\"Error: \" + e);\r\n\t }\r\n\t \r\n\t }", "@Override\r\n\tpublic void service(AgiRequest request, AgiChannel channel)\r\n\t\t\tthrows AgiException {\n\t\t\r\n\t\tCalendar cToday = Calendar.getInstance();\r\n\t\t\r\n\t\tCalendar cTomorrow = Calendar.getInstance();\r\n\t\tcTomorrow.add(Calendar.DAY_OF_MONTH, 1);\r\n\t\t\r\n\t\tsetVariable(\"tomMilsec\", \"\" + cTomorrow.getTimeInMillis());\r\n\t\t\r\n\t\tsetVariable(\"tdMilsec\", \"\" + cToday.getTimeInMillis());\r\n \r\n\t\tsetVariable(\"tddate\", formatCalendar(cToday));\r\n\t}", "String getFirstAlertMailBody( );", "public void sendMail() {\n String email = emailID.getText().toString();\n String subject = \"BlueBucket One-Time OTP\";\n otp=generateOTP();\n String message = \"\"+otp;\n\n //Creating SendMail object\n SendMail sm = new SendMail(this, email, subject, message);\n\n //Executing sendmail to send email\n sm.execute();\n }", "public void sendHtmlEmail() throws EmailException, MalformedURLException,\n\t\t\tUnsupportedEncodingException, ParseException {\n\t\tITrustContributionServer trustContributionServer = new TrustContributionServer();\n\t\tHtmlEmail email = new HtmlEmail();\n\t\temail.setHostName(\"smtp.exmail.qq.com\");\n\n\t\t// TODO 收件人:资产管理中心全体员工;ifdept@bqjr.cn;\n\t\tString itemCode = \"v00003\";\n\t\tList<String> emailList = new ArrayList<>();\n\t\temailList = trustContributionServer.getEmailList(itemCode);\n\t\tif (emailList != null && emailList.size() != 0) {\n\t\t\tString[] toBeStored = emailList\n\t\t\t\t\t.toArray(new String[emailList.size()]);\n\t\t\temail.addTo(toBeStored);\n\t\t}\n\n\t\t// email.addTo(new String[]{\"zhiming.wu@bqjr.cn\",\"785685931@qq.com\"});\n\n\t\temail.setSmtpPort(465);\n\t\temail.setAuthenticator(new DefaultAuthenticator(\"zhiming.wu@bqjr.cn\",\n\t\t\t\t\"Wzm910712\"));\n\t\temail.setSSLOnConnect(true);\n\t\temail.setFrom(\"zhiming.wu@bqjr.cn\");\n\t\tDateFormat format = new SimpleDateFormat(\"yyyy-MM-dd\");\n\t\tDate yestoday = getYestoday();\n\t\temail.setSubject(\"投融资部-每日中航百度报酬日报--\" + format.format(yestoday));\n\t\t/*\tString caption = new String((\"中航百度报酬日报--\").getBytes(\"GBK\"),\n\t\t\t\t\"ISO-8859-1\") + format.format(yestoday);\n\t\tString td1 = new String((\"昨日信托报酬\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td2 = new String((\"累计信托报酬\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td3 = new String((\"昨日保管费\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td4 = new String((\"累计保管费\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td5 = new String((\"昨日优先收益\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td6 = new String((\"累计优先收益\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td7 = new String((\"上月优先级本金\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td8 = new String((\"上月劣后级本金\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\n\t\tString td31 = new String((\"上月差额补足金额\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td32 = new String((\"上月保证金1\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td33 = new String((\"上月客户退货款\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td34 = new String((\"上月客户主动还款\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td35 = new String((\"M3+率\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td36 = new String((\"B3\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td37 = new String((\"M2+率\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td38 = new String((\"B2\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\n\t\t// TODO 查询出各个数据\n\t\tdouble custodianFee = 0;\n\t\tdouble priorityEarnings = 0;\n\t\tdouble trustremuneration = 0;\n\t\tMap<String, Object> map = new HashMap<>();\n\t\tmap = trustContributionServer.getDetailFromBenefitCheckDaily(partner);\n\t\tif (map != null) {\n\t\t\tcustodianFee = Double.parseDouble(map.get(\"CUSTODIANFEE\")\n\t\t\t\t\t.toString());\n\t\t\tpriorityEarnings = Double.parseDouble(map.get(\"PRIORITYEARNINGS\")\n\t\t\t\t\t.toString());\n\t\t\ttrustremuneration = Double.parseDouble(map.get(\"TRUSTREMUNERATION\")\n\t\t\t\t\t.toString());\n\t\t}\n\n\t\t// 累计信托报酬\n\t\tMap<String, Object> trustRemunerationMap = new HashMap<>();\n\t\tdouble sumOftrustRemuneration = 0;\n\t\ttrustRemunerationMap = trustContributionServer\n\t\t\t\t.getSumOfBenefitCheckDaily(partner);\n\t\tif (trustRemunerationMap != null) {\n\t\t\tsumOftrustRemuneration = Double.parseDouble(trustRemunerationMap\n\t\t\t\t\t.get(\"TRUSTREMUNERATION\").toString());\n\t\t}\n\n\t\t// 累计优先收益\n\t\tMap<String, Object> priorityEaringsMap = new HashMap<>();\n\t\tdouble sumOfpriorityEarings = 0;\n\t\tpriorityEaringsMap = trustContributionServer\n\t\t\t\t.getSumOfPriorityEarings(partner);\n\t\tif (priorityEaringsMap != null) {\n\t\t\tsumOfpriorityEarings = Double.parseDouble(priorityEaringsMap.get(\n\t\t\t\t\t\"PRIORITYEARINGS\").toString());\n\t\t}\n\n\t\t// 累计保管费\n\t\tMap<String, Object> custodianFeeMap = new HashMap<>();\n\t\tdouble sumOfcustodianFee = 0;\n\t\tcustodianFeeMap = trustContributionServer.getSumOfcustodianFee(partner);\n\t\tif (custodianFeeMap != null) {\n\t\t\tsumOfcustodianFee = Double.parseDouble(custodianFeeMap.get(\n\t\t\t\t\t\"CUSTODIANFEE\").toString());\n\t\t}\n\n\t\tMap<String, Object> benefitCheckMonthSummaryMap = new HashMap<>();\n\n\t\tdouble priorityPrincipal = 0;\n\t\t// 上月劣后级本金\n\t\tdouble inferiorPrincipal = 0;\n\t\t// 上月差额补足金额\n\t\tdouble differenceUpBalance = 0;\n\t\t// 上月保证金\n\t\tdouble serviceFee = 0;\n\t\t// 上月客户退货款\n\t\tdouble merchantsRetmoneyActual = 0;\n\t\t// 上月客户主动还款\n\t\tdouble customeDrivingRepayment = 0;\n\n\t\tbenefitCheckMonthSummaryMap = trustContributionServer\n\t\t\t\t.getdetailFromMonthSummary(partner);\n\t\tif (benefitCheckMonthSummaryMap != null) {\n\n\t\t\tpriorityPrincipal = Double.parseDouble(benefitCheckMonthSummaryMap\n\t\t\t\t\t.get(\"PRIORITYPRINCIPAL\").toString());\n\n\t\t\tinferiorPrincipal = Double.parseDouble(benefitCheckMonthSummaryMap\n\t\t\t\t\t.get(\"INFERIORPRINCIPAL\").toString());\n\n\t\t\tdifferenceUpBalance = Double\n\t\t\t\t\t.parseDouble(benefitCheckMonthSummaryMap.get(\n\t\t\t\t\t\t\t\"DIFFERENCEUPBALANCE\").toString());\n\n\t\t\tserviceFee = Double.parseDouble(benefitCheckMonthSummaryMap.get(\n\t\t\t\t\t\"SERVICEFEE\").toString());\n\n\t\t\tmerchantsRetmoneyActual = Double\n\t\t\t\t\t.parseDouble(benefitCheckMonthSummaryMap.get(\n\t\t\t\t\t\t\t\"MERCHANTSRETMONEYACTUAL\").toString());\n\n\t\t\tcustomeDrivingRepayment = Double\n\t\t\t\t\t.parseDouble(benefitCheckMonthSummaryMap.get(\n\t\t\t\t\t\t\t\"CUSTOMEDRIVINGREPAYMENT\").toString());\n\t\t}\n\n\t\t// B3=B2\n\t\tString partnerCode = \"\";\n\t\tif (partner.equalsIgnoreCase(\"众安\")) {\n\t\t\tpartnerCode = \"ZAYX\";\n\t\t}// 改为map为添加条件,做一下为null 时候的判断\n\t\t//partnerCode = \"HBYH\";// TODO delete when upload,and sql update\n\t\tMap<String, Object> resultB3Map = new HashMap<>();\n\n\t\tMap<String, Object> resultB2Map = new HashMap<>();\n\n\t\tdouble B3Part1 = 0;\n\t\tdouble B3Part2 = 0;\n\t\tresultB3Map = trustContributionServer\n\t\t\t\t.getB3Part1FromPayDaily(partnerCode);\n\n\t\tif (resultB3Map != null) {\n\t\t\tB3Part1 = Double.parseDouble((resultB3Map.get(\"PAYPRINCIPALAMT\")\n\t\t\t\t\t.toString()));\n\t\t}\n\t\tresultB2Map = trustContributionServer\n\t\t\t\t.getB3Part2FromPayDaily(partnerCode);\n\t\tif (resultB2Map != null) {\n\t\t\tB3Part2 = Double.parseDouble((resultB2Map.get(\"PAYPRINCIPALAMT\")\n\t\t\t\t\t.toString()));\n\t\t}\n\t\t\n\t\t * double B3Part1=\n\t\t * trustContributionServer.getB3Part1FromPayDaily(partnerCode);\n\t\t * \n\t\t * double B3Part2 =\n\t\t * trustContributionServer.getB3Part2FromPayDaily(partnerCode);\n\t\t \n\n\t\tBigDecimal d1 = new BigDecimal(String.valueOf(B3Part1));\n\n\t\tBigDecimal d2 = new BigDecimal(String.valueOf(B3Part2));\n\n\t\tdouble B3 = d1.add(d2).doubleValue();\n\n\t\t// A3\n\t\tint days = 90;\n\t\tMap<String, Object> A3Map = new HashMap<>();\n\t\tA3Map.put(\"partnerCode\", partnerCode);\n\t\tA3Map.put(\"days\", days);\n\n\t\tdouble fPayCapital = 0;\n\t\tdouble fUndueCapital = 0;\n\t\t// 获取大于 90 天的应付本金\n\t\tMap<String, Object> over90DaysCapitalMap1 = new HashMap<>();\n\t\tover90DaysCapitalMap1 = trustContributionServer\n\t\t\t\t.getOverDueDaysCapital1(A3Map);\n\t\tif (over90DaysCapitalMap1 != null) {\n\t\t\tfPayCapital = Double.parseDouble(over90DaysCapitalMap1.get(\n\t\t\t\t\t\"PAYPRINCIPALAMT\").toString());\n\t\t}\n\n\t\tMap<String, Object> over90DaysCapitalMap2 = new HashMap<>();\n\t\tover90DaysCapitalMap2 = trustContributionServer\n\t\t\t\t.getOverDueDaysCapital2(A3Map);\n\t\tif (over90DaysCapitalMap2 != null) {\n\t\t\tfUndueCapital = Double.parseDouble(over90DaysCapitalMap2.get(\n\t\t\t\t\t\"PAYPRINCIPALAMT\").toString());\n\t\t}\n\n\t\tBigDecimal d1Capital = new BigDecimal(String.valueOf(fPayCapital));\n\t\tBigDecimal d2Capital = new BigDecimal(String.valueOf(fUndueCapital));\n\t\tdouble allCapital = d1Capital.add(d2Capital).doubleValue();\n\n\t\tdouble A3 = 0;\n\t\t// 获取实付本金\n\t\tMap<String, Object> resultMap = new HashMap<>();\n\t\tresultMap = trustContributionServer.getA3Capital(A3Map);\n\t\tif (resultMap != null) {\n\t\t\tA3 = allCapital\n\t\t\t\t\t- Double.parseDouble((resultMap.get(\"PAYPRINCIPALAMT\")\n\t\t\t\t\t\t\t.toString()));\n\t\t}\n\n\t\tMap<String, Object> A2Map = new HashMap<>();\n\t\tdouble A2 = 0;\n\t\tA2Map.put(\"partnerCode\", partnerCode);\n\t\tint days2 = 60;\n\t\tA2Map.put(\"days\", days2);\n\n\t\t// 获取逾期60天以上的应付本金\n\t\tdouble fPayCapita1 = 0;\n\t\tdouble fUndueCapita1 = 0;\n\t\tMap<String, Object> over60DaysCapitalMap1 = new HashMap<>();\n\t\tover60DaysCapitalMap1 = trustContributionServer\n\t\t\t\t.getOverDueDaysCapital1(A2Map);\n\t\tif (over60DaysCapitalMap1 != null) {\n\t\t\tfPayCapita1 = Double.parseDouble(over60DaysCapitalMap1.get(\n\t\t\t\t\t\"PAYPRINCIPALAMT\").toString());\n\t\t}\n\n\t\tMap<String, Object> over60DaysCapitalMap2 = new HashMap<>();\n\t\tover60DaysCapitalMap2 = trustContributionServer\n\t\t\t\t.getOverDueDaysCapital2(A2Map);\n\t\tif (over60DaysCapitalMap2 != null) {\n\t\t\tfUndueCapita1 = Double.parseDouble(over60DaysCapitalMap2.get(\n\t\t\t\t\t\"PAYPRINCIPALAMT\").toString());\n\t\t}\n\n\t\tBigDecimal d1Capital1 = new BigDecimal(String.valueOf(fPayCapita1));\n\t\tBigDecimal d2Capital1 = new BigDecimal(String.valueOf(fUndueCapita1));\n\t\tdouble allCapital1 = d1Capital1.add(d2Capital1).doubleValue();\n\n\t\tMap<String, Object> resultMap2 = new HashMap<>();\n\t\tresultMap2 = trustContributionServer.getA3Capital(A2Map);\n\t\tif (resultMap2 != null) {\n\t\t\t// TODO\n\t\t\tA2 = allCapital1\n\t\t\t\t\t- Double.parseDouble((resultMap2.get(\"PAYPRINCIPALAMT\")\n\t\t\t\t\t\t\t.toString()));\n\t\t}\n\n\t\t// 获取格式化对象\n\t\tNumberFormat nt = NumberFormat.getPercentInstance();\n\t\t// 设置百分数精确度2即保留两位小数\n\t\tnt.setMinimumFractionDigits(2);\n\t\t// 最后格式化并输出\n\n\t\t// TODO\n\t\t\n\t\t * String M3= nt.format(A3/B3); String M2 = nt.format(A2/B3);\n\t\t \n\t\tString M3 = \"0.00%\";\n\t\tString M2 = \"0.00%\";\n\t\tif (B3 != 0) {\n\t\t\tM3 = nt.format(A3 / B3);\n\t\t\tM2 = nt.format(A2 / B3);\n\t\t}\n\t\t\n\n\t\tURL url = new URL(\"http://www.apache.org/images/asf_logo_wide.gif\");\n\t\t// String cid = email.embed(url, \"Apache logo\");\n\t\t\n\t\tString firstTable = \"<div>\"\n\t\t\t\t+ \"<table width=\\\"1150\\\" border=\\\"1\\\" cellspacing=\\\"0\\\">\"\n\t\t\t\t+ \"<caption>\"\n\t\t\t\t+ caption\n\t\t\t\t+ \"</caption>\"\n\t\t\t\t+ \"<tr style=\\\"background-color:#f47920\\\">\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ td1\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ td2\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ td3\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ td4\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ td5\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ td6\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ td7\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ td8\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"</tr>\"\n\t\t\t\t+ \"<tr>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ trustremuneration\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ sumOftrustRemuneration\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ custodianFee\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ sumOfcustodianFee\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ priorityEarnings\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\";*/\n\t\tStringBuilder a1RateBuilder = new StringBuilder();\n\t\ta1RateBuilder = this.getA1RateBuilder();\n\t\t\n\t\tStringBuilder a2RateBuilder = new StringBuilder();\n\t\ta2RateBuilder = this.getA2RateBuilder();\n\t\tString commonHead = \"<html>\" + \"<head>\" + \" </head>\" + \"<body>\";\n\t\tString htmlMsg = commonHead\n\t\t\t\t+ a1RateBuilder.toString()\n\t\t\t\t+\"</body>\" + \"</html>\";\n\t\temail.setHtmlMsg(htmlMsg);\n\t\temail.send();\n\t}", "private String getSendMailResetPasswordContent(UserForm userForm) {\n return \"\";\n }", "public void setEmail(String p) { this.idcorreo = p; }", "void send(String email, Locale locale);", "private boolean verificaEmail(String cadena) {\n if (validate.esVacio(cadena)) {\n setErrorEmail(getMsjVacio());\n return false;\n }\n if (!validate.esEmailValido(cadena)) {\n setErrorEmail(getMsjEmailInvalido());\n return false;\n }\n setErrorEmail(null);\n return true;\n }", "public void sendregisteruser(registerDTO register) {\n MimeMessagePreparator preparator = new MimeMessagePreparator()\n {\n public void prepare(MimeMessage mimeMessage) throws Exception\n {\n mimeMessage.setRecipient(Message.RecipientType.TO, new InternetAddress(register.getEmail()));\n mimeMessage.setSubject(\"Welcome to The Indian Bus Service\");\n\n MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);\n\n helper.setText(\"<html><body>\"\n + \"<br>\"\n + \"<h2>Hello \"+register.getFirstname()+\" \"+register.getLastname()+\"</h2>\"\n + \"<p>Welcome to <b>Indian Bus Service</b></p>\"\n + \"<br>\"\n + \"<p>Username:- \"+register.getEmail()+\"</p>\"\n + \"<p>Hope you are doing well in this lockdown.</b></p>\"\n + \"<p>Date your login : </p>'\"+new Date()+\"'</body></html>\", true);\n }\n };\n\n try {\n mailSender.send(preparator);\n }\n catch (MailException ex) {\n // simply log it and go on...\n System.err.println(ex.getMessage());\n }\n }", "public void processMessages(String msg, String rec){\n\t\tthis.email.sendEmail(msg, rec);\n\t}", "public void updateDraft(String recipient, String subject, String contentMail, String mailType, int mailID)\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tString query = \"update mails set recipient = ?, mailSubject = ?, message = ?, timeSent = current_timestamp where mailID = ?\";\r\n\t\t\tpreparedStatement = connect.prepareStatement(query);\r\n\t\t\tpreparedStatement.setString(1, recipient);\r\n\t\t\tpreparedStatement.setString(2, subject);\r\n\t\t\tpreparedStatement.setString(3, contentMail);\r\n\t\t\tpreparedStatement.setInt(4, mailID);\r\n\t\t\tpreparedStatement.executeUpdate();\r\n\t\t}\r\n\t\tcatch(Exception e)\r\n\t\t{\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "protected void saveEmailInfo(Map pPreparedParams, String pTemplateUrl) {\n \n // Get the current system time.\n CurrentDate cd = getCurrentDate();\n Date currentDate = cd.getTimeAsDate();\n \n // get current timestamp\n SimpleDateFormat sdf = new SimpleDateFormat(RecentlySentList.SENT_DATE_FORMAT);\n String timestamp = sdf.format(currentDate.getTime());\n \n getSentList().addItem(getSentList().getTemplateName(pTemplateUrl),\n pPreparedParams, timestamp);\n }", "public static void sendEmail(EmailSendable e, String message){\n\t\tSystem.out.println(\"Email-a bidali da: \"+message);\r\n\t}", "List<Reservation> trouverlisteDeReservationAyantUneDateDenvoieDeMail();", "public void processMail(JTextArea message) \n {\n try \n {\n \t// if the to-field is blank display a pop-up warning\n \t\t\tif(toField.getText().equals(\"\")){\n \t\t\t\tJOptionPane.showMessageDialog (null, \"Please provide an email address.\");\n \t\t\t\ttoField.requestFocusInWindow();\n \t\t\t}\n \t\t\telse {\n\t \tFile fileName = new File(\"outbox.txt\");\n\t \t// by setting the file writer boolean to \"true\" append is turned on\n\t\t FileWriter outStream = new FileWriter (fileName, true);\n\t\t outStream.append (\"To: \" + toField.getText() + \"\\nCc: \" + ccField.getText() +\n\t\t \t\t\t\t \"\\nBcc: \" + bccField.getText() + \"\\nSubject: \" + subjectField.getText() +\n\t\t \t\t\t\t \"\\nFrom: \" + fromField.getSelectedItem() + \"\\nMessage: \" + message.getText() +\"\\n\\n\");\n\t\t outStream.close ();\n\t\t JOptionPane.showMessageDialog (null, \"Your email has been sent!\");\n\t\t // after mail has been sent, clear all fields\n\t\t toField.setText(null);\n\t\t ccField.setText(null);\n\t\t bccField.setText(null);\n\t\t subjectField.setText(null);\n\t \tmessage.setText(null);\n\t \t// reset focus to first field\n\t \ttoField.requestFocusInWindow();\n\t }\n } \n catch (IOException e) \n {\n message.setText(\"IOERROR: \" + e.getMessage() + \"\\n\");\n e.printStackTrace();\n }\n }", "public boolean checkMail(String mail){\r\n error =\"\";\r\n boolean check = mail.matches(emailRegex);\r\n if(!check){\r\n error =\"mail sai dinh dang\";\r\n return false;\r\n }\r\n // check mail da ton tai trong database chua\r\n try {\r\n PreparedStatement preSta = conn.prepareStatement(sqlCheckMailExists);\r\n preSta.setString(1, mail);\r\n ResultSet rs= preSta.executeQuery();\r\n if(rs.next()){\r\n error=\"mail da ton tai\";\r\n return false;\r\n }\r\n else{\r\n return true;\r\n }\r\n } catch (SQLException ex) {\r\n Logger.getLogger(UserDAO.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n return false;\r\n }", "SendEmail() {\t\n\t}", "public Modify_MAIL() {\n initComponents();\n }", "public static void main(String[] args) {\n StringBuffer content = new StringBuffer();\n content.append(\"hi all:\");\n content.append(\"\\n\");\n content.append(\" 附件是\");\n Date cur = new Date();\n\n\n content.append(getDateByFormat(cur,\"MM\") + \"月\"+getDateByFormat(cur,\"dd\")+\"日\");\n content.append(\"oneday项目pv/uv\");\n\n System.out.println(content.toString());\n }", "public Boolean enviaEmail(PathDocEle pathDocEle, String emailDestino, String numeroComprobante, String mensaje, String xmlSinFirma, String numeroAutorizacion) throws ServicioExcepcion, EmailException, MessagingException, UnsupportedEncodingException {\n if (!emailDestino.isEmpty()) {\n ConfiguracionRepositorio configuracionRepositorio = new ConfiguracionRepositorio();\n hostMailServicio = new HostMailServicio();\n /*mail = hostMailServicio.obtenerPorConsultaJpaNombrada(mail.LISTAR_TODO, null);\n //seteo de variables de correo\n usuario = mail.getHtmCorreo();\n contrasena = mail.getHtmContrasenia();\n seguridad = new Integer(mail.getHtmSeguridad());\n smtp = mail.getHtmSmtp();\n puertoGmail = new Integer(mail.getHtmPuerto());\n remitente=mail.getHtmRemitente();\n*/ \n pathCorreo=pathDocEle.getPdeRepTemporal();\n asunto=\"Facturación Electrónica: \".concat(numeroComprobante);\n String pathRepositorioTemp = pathDocEle.getPdeRepTemporal();\n String nombreArchivoPdf = Util.aString(\"RIDE-\", numeroComprobante, \".pdf\");//RIDE-001-001-000000001.pdf\n String nombreArchivoXml = Util.aString(numeroComprobante, \"-firmado.xml\");//RIDE-001-001-000000001.xml\n String pathArchivoXml = Util.aString(pathRepositorioTemp, nombreArchivoXml, \"\");//home/repositorio/temporales/001-001-000000001.xml\n String pathLogo = pathDocEle.getPdeLogo();\n String fechaAutorizacionString = Util.aFechaHora_String(new Date());\n //generar RIDE pdf\n String xmlPuro = xmlSinFirma;//viene xml sin tag de autorizacion\n InputStream inputStream = RideExport.export(pathLogo, numeroAutorizacion, fechaAutorizacionString, xmlPuro.getBytes(\"UTF-8\"));\n //almacenar PDF\n ServicioArchivo servicioA = new ServicioArchivo();\n //servicioA.almacenar_File(pathArchivoXml, claseEmail.getXmlConAutorizacion());//esta en NULL, revisar\n servicioA.almacenar_EnRepositorio(pathRepositorioTemp, nombreArchivoPdf, inputStream);\n Util.aString(pathRepositorioTemp, nombreArchivoPdf, \"\");\n String pathArchivoPdf=pathCorreo.concat(nombreArchivoPdf);\n \n Multipart multipart = new MimeMultipart();\n BodyPart messageBodyPart = new MimeBodyPart();\n messageBodyPart.setContent(mensaje, \"text/html\");\n multipart.addBodyPart(messageBodyPart);\n\n //adjunto el PDF\n messageBodyPart = new MimeBodyPart();\n DataSource source = new FileDataSource(pathArchivoPdf);\n messageBodyPart.setDataHandler(new DataHandler(source));\n messageBodyPart.setFileName(nombreArchivoPdf);\n multipart.addBodyPart(messageBodyPart);\n\n //adjunto el XML\n pathArchivoXml=pathCorreo.concat(numeroComprobante).concat(\"-firmado.xml\");\n messageBodyPart = new MimeBodyPart();\n source = new FileDataSource(pathArchivoXml);\n messageBodyPart.setDataHandler(new DataHandler(source));\n messageBodyPart.setFileName(numeroComprobante.concat(\"-firmado.xml\"));\n multipart.addBodyPart(messageBodyPart);\n\n //envio de correo\n Email email = new MultiPartEmail();\n email.setHostName(smtp);//servidor de correos\n email.setAuthenticator(new DefaultAuthenticator(usuario, contrasena));\n if(seguridad==1){\n email.setSSLOnConnect(true);\n }\n email.setSmtpPort(puertoGmail);\n email.addTo(emailDestino, \"\");//Para quien se envia\n email.setFrom(correo, remitente);//quien envia\n email.setSubject(asunto);\n\n // add the attachment\n email.setContent((MimeMultipart) multipart);\n email.send();\n\n//FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, \"E-mail enviado con éxito para: \" + Emaildestino, \"Información\"));\n return Boolean.TRUE;\n }\n return Boolean.FALSE;\n\n }", "private static boolean enviarEmailAnexo(Email remetente, List<File> files, String destinatario, String titulo, String mensagem) {\n Properties prop = new Properties();\r\n prop.put(\"mail.smtp.host\", \"smtp.gmail.com\");\r\n prop.put(\"mail.smtp.port\", \"465\");\r\n prop.put(\"mail.smtp.auth\", \"true\");\r\n prop.put(\"mail.smtp.socketFactory.port\", \"465\");\r\n prop.put(\"mail.smtp.socketFactory.class\", \"javax.net.ssl.SSLSocketFactory\");\r\n\r\n Session session = Session.getInstance(prop,\r\n new DefaultAuthenticator(remetente.getRemetente(), remetente.getSenha()));\r\n\r\n MimeMessage msg = new MimeMessage(session);\r\n\r\n try {\r\n //Quem esta enviando\r\n msg.setFrom(new InternetAddress(remetente.getRemetente()));\r\n //Destinatario\r\n msg.setRecipient(Message.RecipientType.TO, new InternetAddress(destinatario));\r\n //Data de envio\r\n msg.setSentDate(new Date());\r\n //titulo email\r\n msg.setSubject(titulo);\r\n\r\n Multipart mp = new MimeMultipart();\r\n //mensagem\r\n\r\n MimeBodyPart paragrafo = new MimeBodyPart();\r\n paragrafo.setContent(mensagem + \"\\n\\nJCR\", \"text/html\");\r\n mp.addBodyPart(paragrafo);\r\n //anexos\r\n for (File file : files) {\r\n MimeBodyPart mbp = new MimeBodyPart();\r\n DataSource fds = new FileDataSource(file);\r\n mbp.setDisposition(Part.ATTACHMENT);\r\n mbp.setDataHandler(new DataHandler(fds));\r\n mbp.setFileName(deAccent(fds.getName()));\r\n mp.addBodyPart(mbp);\r\n }\r\n\r\n msg.setContent(mp);\r\n\r\n //envia a mensagem\r\n Transport.send(msg);\r\n return true;\r\n } catch (MessagingException e) {\r\n System.err.println(e);\r\n GerarLogErro.gerar(e.getMessage());\r\n return false;\r\n }\r\n }", "public void setTotalMail(int value) {\n this.totalMail = value;\n }", "public String sendEmail() {\n String to = theModel.getEmail();\n\n // Sender's email ID needs to be mentioned\n String from = \"IT353Uconnect@gmail.com\";\n\n // Assuming you are sending email from this host\n String host = \"smtp.gmail.com\";\n\n // Get system properties\n Properties properties = System.getProperties();\n\n // Setup mail server\n properties.setProperty(\"mail.smtp.host\", host);\n properties.setProperty(\"mail.smtp.starttls.enable\", \"true\");\n properties.setProperty(\"mail.smtp.auth\", \"true\");\n properties.setProperty(\"mail.smtp.port\", \"587\");\n // Get the default Session object.\n Session session = Session.getInstance(properties, new javax.mail.Authenticator() {\n protected PasswordAuthentication getPasswordAuthentication() {\n return new PasswordAuthentication(\"IT353Uconnect@gmail.com\", \"itkstuadmin\");\n }\n });\n\n try {\n // Create a default MimeMessage object.\n MimeMessage message = new MimeMessage(session);\n\n // Set From: header field of the header.\n message.setFrom(new InternetAddress(from));\n\n // Set To: header field of the header.\n message.addRecipient(Message.RecipientType.TO,\n new InternetAddress(to));\n\n // Set Subject: header field\n message.setSubject( subject, \"text/html\");\n\n // Send the actual HTML message, as big as you like\n message.setContent( text , \"text/html\");\n\n // Send message\n Transport.send(message);\n System.out.println(\"Sent message successfully....\");\n } catch (MessagingException mex) {\n mex.printStackTrace();\n }\n return \"UniLog.xhtml\";\n }", "static void addtoReminder(String j, String date) {\n if (j.equals(\"None\")) {\n } else if (j.equals(\"1 Day Before\")) {\n L.add(new Day(date, 1));\n } else if (j.equals(\"2 Day Before\")) {\n L.add(new Day(date, 2));\n } else if (j.equals(\"3 Day Before\")) {\n L.add(new Day(date, 3));\n } else if (j.equals(\"4 Day Before\")) {\n L.add(new Day(date, 4));\n } else if (j.equals(\"1 Week Before\")) {\n L.add(new Week(date, 1));\n } else if (j.equals(\"2 Week Before\")) {\n L.add(new Week(date, 2));\n } else {\n System.out.println(\"remindera ekleme yapılamadı....\");\n }\n }", "protected void processRequest(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/html;charset=UTF-8\");\n ip = request.getLocalAddr();\n try {\n Timestamp dataNow = GetNow();\n Timestamp dataPrec = GetDate(request.getParameter(\"email\"),response.getWriter());\n long differenza = (dataNow.getTime()-dataPrec.getTime())/1000;\n \n response.getWriter().println(differenza+\"<br>\");\n \n \n if(differenza>90){\n response.sendRedirect(\"LinkScaduto.html\");\n }\n else{\n \n char[] p = generatePswd(8, 12, 1, 1, 1); \n String password = String.valueOf(p, 0, p.length) ;\n \n String email = request.getParameter(\"email\");\n String ip = request.getLocalAddr();\n \n UpdatePassword(email,password); \n \n\n String ogget = \"Confirm change password\";\n\n String testo = \"Dear \" + email\n + \"\\n This is your new password:\"\n + \"\\n\\n \"+password;\n\n Email send = new Email();\n send.Send(email,ogget,testo);\n \n response.sendRedirect(\"LinkValido.html\");\n }\n \n } catch(IOException e) {}\n }", "private void notificationMailGD(String email) {\r\n\t\tlogger.log(IAppLogger.INFO, \"Enter: notificationMailGD()\");\r\n\t\ttry {\r\n\t\t\tProperties prop = new Properties();\r\n\t\t\tprop.setProperty(IEmailConstants.SMTP_HOST, propertyLookup.get(IEmailConstants.SMTP_HOST));\r\n\t\t\tprop.setProperty(IEmailConstants.SMTP_PORT, propertyLookup.get(IEmailConstants.SMTP_PORT));\r\n\t\t\tprop.setProperty(\"senderMail\", propertyLookup.get(\"senderMail\"));\r\n\t\t\tprop.setProperty(\"supportEmail\", propertyLookup.get(\"supportEmail\"));\r\n\t\t\tString subject = propertyLookup.get(\"mail.gd.subject\");\r\n\t\t\tString mailBody = propertyLookup.get(\"mail.gd.body\");\r\n\t\t\tlogger.log(IAppLogger.INFO, \"Email triggered...\");\r\n\t\t\temailSender.sendMail(prop, email, null, null, subject, mailBody);\r\n\t\t\tlogger.log(IAppLogger.INFO, \"Email sent to : \" + email);\r\n\t\t} catch (Exception e) {\r\n\t\t\tlogger.log(IAppLogger.ERROR, \"Unable to send Email: \" + e.getMessage());\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\tlogger.log(IAppLogger.INFO, \"Exit: notificationMailGD()\");\r\n\t}", "@Override\n\tvoid email() {\n\t\tSystem.out.println(\"email id jdfjdfh@gmail.com\");\n\t\t\n\t}", "void checkIsMailEmpty(String mail);", "public void sendMail() {\n String sub;\n String message;\n\n sub = \"Welcome\";\n message = \"Thank you for choosing us as your healthcare partners. Here we strive hard to ensure that\\n\"\n + \"you remain in good health. Not only we boast of an exellent team of doctors but also world class operational \\n\"\n + \"infrastructure in place. For any other information or details contact our reg desk. You can access\\n\"\n + \"your account with the Username:\" + txtUserName.getText()+ \"and your password:\" + txtPassword.getPassword().toString()+ \".\\n\\t\\t\\t -Team MVP\";\n\n SendEmail SE = new SendEmail(txtEmail.getText(), sub, message);\n }", "public abstract boolean sendNotification(Map<String, Object> processInfo, boolean mailToSend, Object obj);", "void sendCommonMail(String to, String subject, String content);", "@SuppressWarnings(\"unused\")\n\t@Override\n\tpublic MailRoom getBeanObject(Map<String, Object> map, String type,MailRoom mailroom) \n\t{\n\t\tString status = (String) map.get(\"status\");\n\t\tSimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd hh:mm:ss\");\n\t\tCustomDateEditor editor = new CustomDateEditor(sdf, true);\n\n\t\tString mailboxDt = (String) map.get(\"mailboxDt\");\n\t\tString[] mailboxDate = mailboxDt.split(\"T\");\n\t\tjava.util.Date mailboxDates = null;\n\t\ttry \n\t\t{\n\t\t\tmailboxDates = sdf.parse(mailboxDate[0] + \" \" + mailboxDate[1]);\n\t\t}\n\t\tcatch (Exception e) \n\t\t{\n\t\t\te.printStackTrace();\n\t\t}\n\t\tString userName = (String) SessionData.getUserDetails().get(\"userID\");\n\t\tBfmLogger.logger.info(\"UserName From Session Are:\" + userName);\n\t\tif (type.equals(\"update\")) \n\t\t{\n\t\t\tif (status.equals(\"Mail_Received\")) \n\t\t\t{\n\t\t\t\tmailroom.setMlrId((int) map.get(\"mlrId\"));\n\t\t\t\tint id = (Integer) map.get(\"propertyId\");\n\t\t\t\tmailroom.setPropertyId(id);\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tString addTo = (String)map.get(\"addressedTo\");\n\t\t\t\tString addTo_trim = addTo.trim();\t\t\t\t\n\t\t\t\tmailroom.setAddressedTo(addTo_trim);\n\t\t\t\t\n\t\t\t\tString addFrom = (String)map.get(\"addressedFrom\");\n\t\t\t\tString addFrom_trim = addFrom.trim();\t\t\t\t\n\t\t\t\tmailroom.setAddressedFrom(addFrom_trim);\n\t\t\t\t\n\t\t\t\tmailroom.setMailboxDt(ConvertDate.formattedDate(map.get(\"mailboxDt\").toString()));\n\t\t\t\tmailroom.setStatus((String) map.get(\"status\"));\n\t\t\t\tmailroom.setReceivedBy((String) map.get(\"receivedBy\"));\n\t\t\t\tmailroom.setCreatedBy(userName);\n\t\t\t\tmailroom.setLastUpdatedBy(userName);\n\t\t\t\tmailroom.setDrGroupId((int)map.get(\"drGroupId\"));\n\t\t\t\tmailroom.setConsignmentNo((String) map.get(\"consignmentNo\"));\n\t\t\t\tmailroom.setLastUpdatedDt(new Timestamp(new Date().getTime()));\n\t\t\t\tlogger.info(\"UPDATED INSIDE IMPL\");\n\t\t\t}\n\t\t\treturn mailroom;\n\t\t}\n\t\telse if (type.equals(\"save\")) \n\t\t{\n\t\t\tif (map.get(\"property_No\") != null) \n\t\t\t{\n\t\t\t\tDateFormat dateFormat = new SimpleDateFormat(\"yyyy/MM/dd HH:mm:ss\");\n\t\t\t\tDate date = new Date();\n\t\t\t\tlogger.info(dateFormat.format(date));\n\n\t\t\t\tString propNo = (String) map.get(\"property_No\");\n\t\t\t\tmailroom.setPropertyId(Integer.parseInt(propNo));\n\t\t\t\t\n\t\t\t\tString addTo = (String)map.get(\"addressedTo\");\n\t\t\t\tString addTo_trim = addTo.trim();\t\t\t\t\n\t\t\t\tmailroom.setAddressedTo(addTo_trim);\n\t\t\t\t\n\t\t\t\tString addFrom = (String)map.get(\"addressedFrom\");\n\t\t\t\tString addFrom_trim = addFrom.trim();\t\t\t\t\n\t\t\t\tmailroom.setAddressedFrom(addFrom_trim);\n\t\t\t\t\n\t\t\t\tmailroom.setMailboxDt(ConvertDate.formattedDate(map.get(\"mailboxDt\").toString()));\n\t\t\t\tmailroom.setStatus((String) map.get(\"status\"));\n\t\t\t\tmailroom.setReceivedBy((String) map.get(\"receivedBy\"));\n\t\t\t\tmailroom.setCreatedBy(userName);\n\t\t\t\tmailroom.setLastUpdatedBy(userName);\n\t\t\t\tmailroom.setLastUpdatedDt(new Timestamp(new Date().getTime()));\n\n\t\t\t\tString st = (String) map.get(\"consignmentNo\");\n\t\t\t\tif (st != \"\") \n\t\t\t\t{\n\t\t\t\t\tlogger.info(\"VALUE SENT IF\");\n\t\t\t\t\tmailroom.setConsignmentNo((String) map.get(\"consignmentNo\"));\n\t\t\t\t\tlogger.info(\"IF\" + (String) map.get(\"consignmentNo\"));\n\t\t\t\t}\n\t\t\t\telse if (st == \"\") \n\t\t\t\t{\n\t\t\t\t\tlogger.info(\"VALUE IS NULL ELSE\");\n\t\t\t\t\tmailroom.setConsignmentNo(null);\n\t\t\t\t\tlogger.info(\"ELSE IF\");\n\t\t\t\t}\n\t\t\t\treturn mailroom;\n\t\t\t} \n\t\t\telse if (map.get(\"property_No\") == null) \n\t\t\t{\n\t\t\t\tmailroom.setPropertyId(0);\n\t\t\t}\n\t\t}\n\t\treturn mailroom;\n\t}", "@Test\n @DisplayName(\"Test: check if 'Mail' action works.\")\n public void testSetMailAction() throws InterruptedException, ClientException {\n FormContainerEditDialog dialog = formComponents.openEditDialog(containerPath);\n dialog.setMailActionFields(from,subject,new String[] {mailto1,mailto2}, new String[] {cc1, cc2});\n Commons.saveConfigureDialog();\n JsonNode formContentJson = authorClient.doGetJson(containerPath , 1, HttpStatus.SC_OK);\n assertTrue(formContentJson.get(\"from\").toString().equals(\"\\\"\"+from+\"\\\"\"));\n assertTrue(formContentJson.get(\"subject\").toString().equals(\"\\\"\"+subject+\"\\\"\"));\n assertTrue(formContentJson.get(\"mailto\").get(0).toString().equals(\"\\\"\"+mailto1+\"\\\"\"));\n assertTrue(formContentJson.get(\"mailto\").get(1).toString().equals(\"\\\"\"+mailto2+\"\\\"\"));\n assertTrue(formContentJson.get(\"cc\").get(0).toString().equals(\"\\\"\"+cc1+\"\\\"\"));\n assertTrue(formContentJson.get(\"cc\").get(1).toString().equals(\"\\\"\"+cc2+\"\\\"\"));\n }", "@Override\r\n\tpublic void sendMail(EmailNotificationVO emailNotification) throws ImbibeException\r\n\t{\n\t\tMimeMessage message = null;\r\n\t\tMimeMessageHelper helper = null;\r\n\t\ttry\r\n\t\t{\r\n\r\n\r\n\t\t\tmessage = this.mailSender.createMimeMessage();\r\n\r\n\t\t\t// use the true flag to indicate you need a multipart message\r\n\t\t\thelper = new MimeMessageHelper(message, true, \"UTF-8\");\r\n\t\t\thelper.setFrom(emailNotification.getFrom());\r\n\t\t\t// msg.setTo(Arrays.asList(emailNotification.getToRecipients()));\r\n\t\t\tList<String> toList = emailNotification.getToRecipients();\r\n\t\t\t/*toList.add(\"nchinthakindi@havigs.com\");*/\r\n\t\t\tif(toList != null)\r\n\t\t\t{\r\n\t\t\t\tString to[] = toList.toArray(new String[toList.size()]);\r\n\t\t\t\thelper.setTo(to);\r\n\t\t\t}\r\n\t\t\tList<String> ccList = emailNotification.getCcRecipients();\r\n\t\t\tif(ccList != null)\r\n\t\t\t{\r\n\t\t\t\tString cc[] = ccList.toArray(new String[ccList.size()]);\r\n\t\t\t\thelper.setCc(cc);\r\n\t\t\t}\r\n\r\n\t\t\tif(emailNotification.getFilepath() != null)\r\n\t\t\t{\r\n\t\t\t\tFile file = new File(emailNotification.getFilepath());\r\n\r\n\t\t\t\tif(file != null && file.exists())\r\n\t\t\t\t{\r\n\t\t\t\t\tint dotPos = file.getName().lastIndexOf(\".\");\r\n\t\t\t\t\tString extension = file.getName().substring(dotPos);\r\n\t\t\t\t\thelper.addAttachment(MimeUtility.encodeText(emailNotification.getSubject()+extension, \"UTF-8\", \"Q\"), file);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\thelper.setText(emailNotification.getMessage(),true);\r\n\t\t\thelper.setSubject(emailNotification.getSubject());\r\n\t\t\thelper.setSentDate(Calendar.getInstance().getTime());\r\n\r\n\t\t\tthis.mailSender.send(message);\r\n\t\t}\r\n\t\tcatch(MailException ex) \r\n\t\t{\r\n\t\t\t//logger.error(ex.getMessage()); \r\n\t\t\tthrow new ImbibeException(ex.getMessage());\r\n\t\t}\r\n\t\tcatch (Exception ex) \r\n\t\t{\r\n\t\t\t//logger.error(ex.getMessage()); \r\n\t\t\tthrow new ImbibeException(ex.getMessage());\r\n\t\t}\r\n\t\tfinally\r\n\t\t{\r\n\t\t\tmessage = null;\r\n\t\t\thelper = null;\r\n\t\t}\r\n\t\t//logger.debug(\"Exit from sendEmail(EmailNotification emailNotification)\");\r\n\t}", "public void updateSendingMessage(String message, boolean isMe) {\n\n\n Log.v(\"adsl\", \"came here\");\n\n final MessageModel sendingMessage = new MessageModel();\n sendingMessage.setMessage(message);\n sendingMessage.setTime(\"8:57Pm\"); //set current time in form of database format\n sendingMessage.setMe(isMe);\n\n if (isMe == true) {\n\n\n if (!messageBox.getText().toString().trim().matches(\"\"))\n\n {\n doScreenUpdate(sendingMessage);\n }\n\n\n } else\n\n {\n\n doScreenUpdate(sendingMessage);\n\n\n }\n\n\n }", "public String cambiarFechasGuiaPermiso56(String cidGuia,\n String codUn,\n Date fecEmis,\n Date fecDesp){\n try{\n TRGuia eGuia = bdL_C_SFGuiaLocal.findGuiaByUNCid(codUn,cidGuia);\n eGuia.setFechaGuia(fecEmis);\n eGuia.setFechaDespacho(fecDesp);\n eGuia = bdL_T_SFGuiaLocal.mergeTRGuia(eGuia);\n return \"000\";\n }catch(Exception e){\n e.printStackTrace();\n return \"111\";\n }\n }", "public int getTotalMail() {\n return totalMail;\n }", "private String formatarData(Date data)\n {\n String sDate;\n String sDia = \"\";\n String sMes = \"\";\n\n GregorianCalendar calendar = new GregorianCalendar();\n calendar.setTime(data);\n int dia = calendar.get(GregorianCalendar.DAY_OF_MONTH);\n if (dia > 0) {\n if (dia < 10) {\n sDia = \"0\";\n }\n }\n sDia += dia;\n\n int mes = calendar.get(GregorianCalendar.MONTH);\n mes = mes + 1;\n if (mes > 0) {\n if (mes < 10) {\n sMes = \"0\";\n }\n }\n sMes += mes;\n\n int ano = calendar.get(GregorianCalendar.YEAR);\n\n int hora = calendar.get(GregorianCalendar.HOUR);\n // 0 = dia\n // 1 = noite\n int amPm = calendar.get(GregorianCalendar.AM_PM);\n\n if(amPm == 1)\n {\n if(hora>0 && hora < 13)\n {\n if(hora > 11)\n hora = 0;\n else\n hora += 12;\n }\n }\n\n String sHora = \" \";\n if(hora<=9)\n {\n sHora += \"0\";\n }\n String sMin=\":\";\n int min = calendar.get(GregorianCalendar.MINUTE);\n if(min <10)\n sMin += \"0\";\n sMin += String.valueOf(min);\n sHora += String.valueOf(hora) + sMin + \":00\";\n sDate = String.valueOf(ano) + \"-\" + sMes + \"-\" + sDia + sHora;\n return sDate;\n\n }", "public String reporteFinMesPost()\n\t{\n\t\tString m = new String();\n\t\tif(!this.clientes.isEmpty())\n\t\t{\n\t\t\t\n\t\t\t\n\t\t\tGregorianCalendar ff = new GregorianCalendar();\n\t\t\tCliente c = new Cliente();\n\t\t\tlong dur, durc, durt, totalcliente, totalt, valorp;\n\t\t\tCuenta p;\n\t\t\tLLamada ll;\n\t\t\tSet<String> llaves = clientes.keySet();\n\t\t\tList<String> li = new ArrayList<String>(llaves);\n\t\t\tListIterator<String> it = li.listIterator();\n\t\t\tListIterator<Cuenta> cu;\n\t\t\tList<Cuenta> lista = new ArrayList<Cuenta>();\n\t\t\tList<Cliente> cli = new ArrayList<Cliente>();\n\t\t\tString s = new String();\n\n\t\t\t//Tomamos los clientes que tienen cuentas postpago\n\t\t\twhile(it.hasNext())\n\t\t\t{\n\t\t\t\ts = it.next();\n\t\t\t\tif(clientes.get(s).tienePost())\n\t\t\t\t\tcli.add(clientes.get(s));\n\t\t\t}\n\n\t\t\t//Ordenamos la lista de clientes por cedula\n\t\t\tCollections.sort(cli, new CompararCedulasClientes());\n\n\t\t\tListIterator<Cliente> itc = cli.listIterator();\n\t\t\tListIterator<LLamada> itl;\n\t\t\tList<LLamada> lisll = new ArrayList<LLamada>();\n\t\t\ttotalt = 0;\n\t\t\tdurt = 0;\n\t\t\t//Empezamos a recorrer la lista de clientes\n\t\t\twhile(itc.hasNext())\n\t\t\t{\n\t\t\t\ttotalcliente = 0;\n\t\t\t\tdurc = 0;\n\t\t\t\tc = itc.next();\n\t\t\t\tm += Utils.espacios(\"--CLIENTE: \", 12) + Utils.espacios(c.getNombre(), 15) + Utils.espacios(\", CC \",5) + Utils.espacios(String.valueOf(c.getCedula()), 10) + Utils.espacios(\", \", 3) + Utils.espacios(c.getDireccion(), 20) + \"\\n\";\n\t\t\t\t//cu recorre ahora las cuentas del cliente\n\t\t\t\tcu = c.getCuentas().listIterator(0);\n\t\t\t\tlista.clear();\n\t\t\t\twhile(cu.hasNext())\n\t\t\t\t{\n\t\t\t\t\tCuenta n = cu.next();\n\t\t\t\t\tif(n instanceof CuentaPostpago)\n\t\t\t\t\t\tlista.add(n);\n\t\t\t\t}\n\n\t\t\t\tcu = lista.listIterator(0);\n\n\t\t\t\t//En lista estan las cuentas postpago de dicho cliente\n\t\t\t\twhile(cu.hasNext())\n\t\t\t\t{\n\t\t\t\t\tp = cu.next();\n\t\t\t\t\tm += Utils.espacios(\" \", 4)+ Utils.espacios(\"Cuenta Postpago #\", 17) + Utils.espacios(String.valueOf(p.getId()), 5) + Utils.espacios(\": Num \", 6) + Utils.espacios(String.valueOf(p.getNumero()), 10) + Utils.espacios(\", Plan \", 7) + Utils.espacios(p.getPlan().getNombre(), 15) + \"\\n\\n\";\n\t\t\t\t\tm += Utils.espacios(\" \", 8) + Utils.espacios(\"Llamadas: \", 11)+ Utils.espacios(\"Fecha\", 15) + Utils.espacios(\"TelefonoDestinatario\", 21) + Utils.espacios(\"Duracion\",10 ) + Utils.espacios(\"Valor\", 8) +\"\\n\\n\";\n\t\t\t\t\t//lisll ahora tiene las llamadas de dicha cuenta de dicho cliente\n\t\t\t\t\tlisll = p.getLlamadas();\n\t\t\t\t\t//Las ordenamos por fecha\n\t\t\t\t\tCollections.sort(lisll, new CompararLLamadasFecha());\n\t\t\t\t\titl = lisll.listIterator(0);\n\t\t\t\t\tvalorp = 0;\n\t\t\t\t\tdur =0;\n\n\t\t\t\t\twhile(itl.hasNext())\n\t\t\t\t\t{\n\t\t\t\t\t\tll = itl.next();\n\t\t\t\t\t\tif (ll.getFecha().get(Calendar.MONTH) == ff.get(Calendar.MONTH) && ll.getFecha().get(Calendar.YEAR) == ff.get(Calendar.YEAR))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvalorp += ll.getValor();\n\t\t\t\t\t\t\tdur += ll.getDuracion();\n\t\t\t\t\t\t\tm += Utils.espacios(\" \",19) + Utils.espacios(Utils.convertirFechaCadena(ll.getFecha()), 15) + Utils.espacios(String.valueOf(ll.getTelefonoDestinatario()), 21) + Utils.espacios(String.valueOf(ll.getDuracion()), 10) + Utils.espacios(String.valueOf(ll.getValor()), 8) + \"\\n\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tm += Utils.espacios(\" \", 19) + Utils.espacios(\"TotalCuenta: ----------------------------\", 55) + Utils.espacios(String.valueOf(dur),10) + valorp + \"\\n\";\n\n\t\t\t\t\t//-------\n\t\t\t\t\tm += Utils.espacios(\" \",19) + Utils.espacios(\"Valor a Pagar: ----------------------------\", 65) + p.obtenerPagoCuenta(ff) + \"\\n\\n\";\n\t\t\t\t\ttotalcliente += p.obtenerPagoCuenta(ff);\n\t\t\t\t\tdurc += dur;\n\t\t\t\t}\n\t\t\t\ttotalt += totalcliente;\n\t\t\t\tdurt += durc;\n\t\t\t\tm += Utils.espacios(\" \",8) + Utils.espacios(\"Total Cliente: ----------------------------\", 66) + Utils.espacios(String.valueOf(durc),10) + totalcliente + \"\\n\" + \"\\n\\n\\n\";\n\t\t\t}\n\n\t\t\tm += Utils.espacios(\"TOTAL TODOS LOS CLIENTES: -----------------------\", 74) + Utils.espacios(String.valueOf(durt),10) + totalt + \"\\n\" + \"\\n\";\n\t\t}\n\t\treturn m;\n\t}", "public String enviarcorreo(String receptor, String asunto, String mensaje, String telefono, String nombre){\ntry {final String username = \"info.skymedic@gmail.com\";\n final String password = \"32sky4951m\";\n StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();\n StrictMode.setThreadPolicy(policy);\n\n Properties props = new Properties();\n props.put(\"mail.smtp.auth\", \"true\");\n props.put(\"mail.smtp.ssl.trust\", \"smtp.gmail.com\");\n props.put(\"mail.smtp.starttls.enable\", \"true\");\n props.put(\"mail.smtp.host\", \"smtp.gmail.com\");\n props.put(\"mail.smtp.port\", \"587\");\n\n /*Session session = Session.getInstance(props,\n new javax.mail.Authenticator() {\n protected PasswordAuthentication getPasswordAuthentication() {\n return new PasswordAuthentication(username, password);\n }\n });*/\n\n Session session = Session.getInstance(props, new GMailAuthenticator(username, password));\n\n try {\n Message message = new MimeMessage(session);\n message.setFrom(new InternetAddress(\"info.skymedic@gmail.com\"));\n message.setRecipients(Message.RecipientType.TO,\n InternetAddress.parse(\"skymedicap@gmail.com\"));\n message.setSubject(asunto);\n mensaje = \"Nombre y Apellido:\" + \"<br>\" + nombre+ \"<br>\" + \"<br>\" +\n \"Correo Electronico:\" + \"<br>\" + receptor + \"<br>\" +\"<br>\" +\n \"N° de Teléfono:\" + \"<br>\" + telefono+ \"<br>\" + \"<br>\" +\n \"ASUNTO DEL MENSAE:\" +\"<br>\" + mensaje;\n message.setContent(mensaje,\"text/html; charset=utf-8\");\n\n Transport.send(message);\n\n System.out.println(\"Done\");\n respuesta=\"Su mensaje ha sido enviado\";\n } catch (MessagingException e) {\n respuesta=\"Error al enviar\";\n throw new RuntimeException(e);\n\n }\n\n} catch (Exception e) {\n respuesta=\"Error al enviar, verifique su conexión\";\n throw new RuntimeException(e);\n\n }\n\n\n return respuesta;\n }", "public Date getSendEmailTime() {\n return sendEmailTime;\n }", "@Scheduled(cron = \"0 * * * * *\")\r\n\tpublic void run() {\r\n\r\n\t\tString[] emailArray = new String[emailRecipientList.size()];\r\n\t\temailArray = emailRecipientList.toArray(emailArray);\r\n\t\tLOGGER.debug(\"Sending a email to \" + emailArray);\r\n //Current time\r\n\t\tLocalDateTime now = LocalDateTime.now();\r\n\t\t//Current time - 1 hour\r\n\t\tLocalDateTime after = LocalDateTime.now().minusHours(1);\r\n\r\n\t\tTimestamp dateCreatedBefore = Timestamp.valueOf(now);\r\n\t\tTimestamp dateCreatedAfter = Timestamp.valueOf(after);\r\n\t\t// Search for file id's added for the last hour \r\n\t\tList<Long> ids = infoDataService.searchFileId(null, null, \r\n\t\t\t\tdateCreatedBefore, dateCreatedAfter, null, null,null);\r\n\t\t// Create a email body \r\n\t\tStringBuffer emailBody =new StringBuffer();\r\n\t\temailBody.append(\"New Files Uploaded:\");\r\n for(Long id : ids) {\r\n \ttry {\r\n \t FileInfo metaData = infoDataService.findRecordById(id);\r\n \t emailBody.append(System.lineSeparator());\r\n \t emailBody.append(\"*******************************************************\");\r\n \t emailBody.append(System.lineSeparator());\r\n \t emailBody.append(\"ID:\"+metaData.getId());\r\n \t emailBody.append(\", ORIGINAL NAME: \"+metaData.getFileName());\r\n \t Long size = metaData.getSize()/1000;\r\n \t emailBody.append(\", SIZE (KB):\"+size);\r\n \t emailBody.append((metaData.getPublicAccess())?\", PUBLIC ACCESS: true\":\" , PUBLIC ACCESS: false\");\r\n \t emailBody.append(\", TIME UPLOADED:\"+metaData.getUploadedTs().toLocalDateTime());\r\n \t emailBody.append(System.lineSeparator());\r\n \t}\r\n \tcatch(Exception e) {\r\n \t\temailBody.append(Utilities.NO_DATA_FOR_ID+id); \t\t\r\n \t}\r\n }\r\n // Sending a scheduled email \r\n SimpleMailMessage msg = new SimpleMailMessage();\r\n\t\tmsg.setTo(emailArray);\r\n\t\tmsg.setSubject(Utilities.SCHEDULER_SUBJECT);\r\n\t\tmsg.setText(emailBody.toString());\r\n\t\tmsg.setFrom(emailSender);\r\n\r\n\t\t// TODO\r\n\t\t// Uncomment the next line after adding a correct credentials to the\r\n\t\t// application.properies file\r\n\t\t// javaMailSender.send(msg);\r\n\r\n\t}", "public static void sendAsHtml(String to, String title, String mensagemAEnviar) {\n try{\n System.out.println(\"Enviar email para \" + to);\n System.out.println(\"A criar sessao\");\n Session session = createSession();\n System.out.println(\"Sessao criada\");\n System.out.println(\"Preparar mensagem\");\n MimeMessage message = new MimeMessage(session);\n prepareEmailMessage(message, to, title, mensagemAEnviar);\n System.out.println(\"Mensagem \"+ message.toString() + \" preparada\");\n System.out.println(\"A mandar mensagem\");\n Transport.send(message);\n System.out.println(\"Done\");\n }catch(Exception e){\n e.printStackTrace();\n }\n\n }", "@Override\n\tpublic void enviarNovaSenhaEmail(Cliente cliente, String newSenha) {\n\t\tSimpleMailMessage sm = prepararNovaSenhaEmail(cliente, newSenha);\n\t\tenviarEmail(sm);\n\t\t\n\t}" ]
[ "0.61524236", "0.6069111", "0.60064083", "0.59422064", "0.5914998", "0.58934075", "0.58036035", "0.5742891", "0.5705776", "0.5616124", "0.55663157", "0.55623126", "0.5508319", "0.55073684", "0.55038464", "0.549713", "0.54942375", "0.54898345", "0.5484559", "0.54812974", "0.5478536", "0.5461506", "0.5450483", "0.54319066", "0.54220796", "0.54135066", "0.54135066", "0.54095745", "0.5392507", "0.5374775", "0.53694814", "0.5361002", "0.5359062", "0.5358554", "0.5325036", "0.5319353", "0.5310713", "0.529843", "0.52980226", "0.52835673", "0.5269843", "0.5269361", "0.5269306", "0.5265691", "0.525915", "0.52396405", "0.52183324", "0.521035", "0.52054244", "0.5202683", "0.5194845", "0.5193214", "0.5188837", "0.5172984", "0.516161", "0.51607955", "0.5160042", "0.5157203", "0.51557595", "0.5154905", "0.5154864", "0.51461726", "0.5138977", "0.5136488", "0.5135172", "0.5133865", "0.5126389", "0.5117144", "0.511244", "0.51089054", "0.5106587", "0.5103267", "0.50990933", "0.509599", "0.5090729", "0.5089276", "0.50874114", "0.50860935", "0.5084708", "0.5084218", "0.5080063", "0.506836", "0.50669366", "0.5066318", "0.505088", "0.50465703", "0.50441563", "0.50169706", "0.5013742", "0.50118464", "0.5011812", "0.5010554", "0.50076103", "0.5005081", "0.5004311", "0.49981478", "0.49979693", "0.4996386", "0.4991348", "0.49904755", "0.4985182" ]
0.0
-1
fine modifica mail 08/10/2014 10:38
static DettaglioCartellaAvvisoResponse getBPSDettaglioCartellaResponse( DettaglioCartellaAvvisoRequest request) throws Exception { DettaglioCartellaAvvisoResponse response; DettaglioCartellaAvvisoPortTypeProxy proxy = new DettaglioCartellaAvvisoPortTypeProxy( MessagesClass.getMessage("DETTAGLIO_CARTELLA_ESB_ENDPOINT") ); response = proxy.getDettaglioCartellaAvvisoPortType() .process(request); if (!response.getEsito().equals(BPS_DETTAGLIO_CARTELLA_ESITO_OK)) { throw new Exception("Processo Dettaglio Cartella KO: " + response.getDescrizioneEsito() ); } return response; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "String getExpirationtMailBody( );", "private void sendMailLogInfo() {\n\t\tif (mChangedInfoList.size() == 0) {\n\t\t\treturn;\n\t\t}\n\t\t// 1.导出信息\n\t\tString content = dumpLogInfoWithHtml();\n\t\t\n\t\t// 2. 更新收件人与标题\n\t\tmMailSender.updateMailToAndCc(mMailReceivers, mMailCcReceivers);\n\t\t\n\t\tLogger.println(\"==SvnLog send emal with subject \" + mMailSubject);\n\t\t\n\t\t// 3.发送信息send\n\t\tmMailSender.sendHtmlMail(mMailSubject, content);\n\t\t\n\t\t// 4.清理此轮信息\n\t\tclearInfo();\n\t}", "public static String textoMensajeMail(String apellido,String nombreActividad, String expediente, \r\n\t\t\tString fechaVencimiento, int modo)\r\n\t{\n\t\tString texto =\"\";\r\n\t\tif (modo==1)\r\n\t\t{\r\n\t\t\ttexto = \"Estimado Doc. \"+apellido+\":\\n\" + \" La actividad procesal: \" + nombreActividad +\r\n\t\t\t\t\t\" del expediente: \" + expediente + \", esta proxima a vencer el dia \" + fechaVencimiento +\r\n\t\t\t\t\t\"\\n\\nPor favor tomar las medidas del caso.\" + \r\n\t\t\t\t\t\"\\n\\nAtte.\" + \r\n\t\t\t\t\t\"\\n\" +\r\n\t\t\t\t\t\"\\nSISTEMA DE GESTION LEGAL\";\r\n\t\t}\r\n\t\tif (modo==2)\r\n\t\t{\r\n\t\t\ttexto = \"Estimado Doc. \"+apellido+\":\\n\" + \" La actividad procesal: \" + nombreActividad +\r\n\t\t\t\t\t\" del expediente: \" + expediente + \" ha cambiado. La nueva Fecha de Vencimiento es: \" +\r\n\t\t\t\t\tfechaVencimiento +\r\n\t\t\t\t\t\"\\n\\nPor favor tomar las medidas del caso.\" + \r\n\t\t\t\t\t\"\\n\\nAtte.\" + \r\n\t\t\t\t\t\"\\n\" +\r\n\t\t\t\t\t\"\\nSISTEMA DE GESTION LEGAL\";\r\n\t\t}\r\n\t\tif (modo==3)\r\n\t\t{\r\n\t\t\ttexto = \"Estimado Doc. \"+apellido+\":\\n\" + \" La actividad procesal: \" + nombreActividad +\r\n\t\t\t\t\t\" del expediente: \" + expediente + \" ha vencido.\" +\r\n\t\t\t\t\t\"\\n\\nPor favor tomar las medidas del caso.\" + \r\n\t\t\t\t\t\"\\n\\nAtte.\" + \r\n\t\t\t\t\t\"\\n\" +\r\n\t\t\t\t\t\"\\nSISTEMA DE GESTION LEGAL\";\r\n\t\t}\r\n\t\treturn texto;\r\n\t}", "public Historique SendMail( Historique h,String resultat ,String date,String heure) throws Exception {\n\r\n\r\n Logger log = LoggerFactory.getLogger(MailController.class);\r\n\r\n \r\n\r\n \r\n log.info(\"Spring Mail - Sending Simple Email with JavaMailSender Example\");\r\n\r\n Mail mail = new Mail();\r\n mail.setFrom(\"harb.nihel55@gmail.com\");\r\n \r\n //mail.setTo(h.get().getEmails());\r\n String [] res =h.getEmails().split(\"\\\\s\");\r\n for(int i=0; i<res.length;i++)\r\n \r\n {\r\n \tSystem.out.println(res[i]);\r\n mail.setTo(res[i]);\r\n \r\n if(resultat.equals(\"echec\"))\r\n { \t mail.setSubject(\" échec d'éxécution du test\");\r\n mail.setContent(\"Echec de test \"+h.getNom()+\" éffectué à \"+date+\"à l'heure \"+heure);}\r\n else\r\n { \t\r\n mail.setSubject(\"Retard d'éxécution du test\");\r\n mail.setContent(\"Retard d'éxecution :temps de réponse réél est \"+h.getTemps_rep_reel()+\" et le temps de réponse attendu = est:\"+h.getResultat_attendu());}\r\n emailService.sendSimpleMessage(mail);\r\n }\r\n \r\n\r\n \r\n\t\treturn null; \r\n\r\n }", "private void check() {\n\n SimpleDateFormat dateFormat = new SimpleDateFormat(\"dd/MM/yyyy\");\n Date date = new Date();\n Date date2 = new Date();\n\n Calendar calendar = Calendar.getInstance();\n date = calendar.getTime();\n\n // Se traen todos los miembros.\n Iterator e = memberBroker.getList(\"name\", \"ASC\");\n membersData member;\n accountsData account;\n //Calendar hoy = Calendar.getInstance();\n StringBuffer managerBody = new StringBuffer(\"\");\n StringBuffer memberBody = new StringBuffer(\"\");\n sendMail sm = new sendMail();\n\n\n while (e.hasNext()) { \n member = new membersData();\n account = new accountsData();\n member = (membersData) e.next();\n account=(accountsData) accountBroker.getData(member.getId_account());\n \n \n System.out.println(\"CHECKING (\" + member.getname() + -+member.getid() + -+member.getId_account() + \")\");\n\n //String mainURL = TMSConfigurator.getMainURL();\n String mainURL = account.getMain_url();\n managerBody = new StringBuffer(\"\");\n\n memberBody = new StringBuffer(\"\");\n\n // Se toma la fecha de hoy y la fecha de expiracion y se calcula la diferencia\n date2 = member.getExpired_date();\n long days = daysBetween(new Date(date.getTime()), new Date(date2.getTime()));\n \n if (days == 1) {\n System.out.println(\"un dia antes\");\n memberBody.append(\"Cuenta: \" + member.getname() + \"<br>\");\n memberBody.insert(0, \"La cuenta esta apunto de expirar le queda \" + days + \".<br>\");\n sm.sendCheckTasks(member.getemail_work(), memberBody.toString());\n\n managerBody.append(\"<BLOCKQUOTE>Miembro: \" + member.getname() + \"<br>\");\n managerBody.insert(0, \"La cuenta esta apunto de expirar le queda \"+days+\".<br>\");\n \n sm.sendCheckTasks(account.getEmail(),\n managerBody.toString());\n sm.sendCheckTasks(account.getEmail(),\n managerBody.toString());\n\n }\n if (days == 0) {\n System.out.println(\"ultimo dia\");\n memberBody.append(\"Cuenta: \" + member.getname() + \"<br>\");\n memberBody.insert(0, \"La cuenta esta apunto de expirar le queda \" + days + \".<br>\");\n sm.sendCheckTasks(member.getemail_work(), memberBody.toString());\n\n managerBody.append(\"<BLOCKQUOTE>Miembro: \" + member.getname() + \"<br>\");\n managerBody.insert(0, \"La cuenta esta apunto de expirar le queda \"+days+\".<br>\");\n \n sm.sendCheckTasks(account.getEmail(),\n managerBody.toString());\n sm.sendCheckTasks(account.getEmail(),\n managerBody.toString());\n }\n if (days == 7) {\n System.out.println(\"a una semana\");\n memberBody.append(\"Cuenta: \" + member.getname() + \"<br>\");\n memberBody.insert(0, \"La cuenta esta apunto de expirar le queda \" + days + \".<br>\");\n sm.sendCheckTasks(member.getemail_work(), memberBody.toString());\n\n managerBody.append(\"<BLOCKQUOTE>Miembro: \" + member.getname() + \"<br>\");\n managerBody.insert(0, \"La cuenta esta apunto de expirar le queda \"+days+\".<br>\");\n \n sm.sendCheckTasks(account.getEmail(),\n managerBody.toString());\n sm.sendCheckTasks(account.getEmail(),\n managerBody.toString());\n }\n /*if (hoy.getTimeInMillis() > end) {\n // Ya estas atrasado mas alla del umbral maximo permitido!!\n System.out.println(\"\\t\\t\\tAtrasada!!\");\n if (atrasadoEquipo == false) {\n // Al menos un miembro del equipo esta atrazado.\n managerBody.append(\"Proyecto: \" + proyecto.getname() + \"<br>\");\n atrasadoEquipo = true;\n }\n if (atrasado == false) {\n // Este member no estaba atrasado, se agrega el encabezado para\n // su email. \n memberBody.append(\"Proyecto: \" + proyecto.getname() + \"<br>\");\n managerBody.append(\"<BLOCKQUOTE>Miembro: \" + team.getparentMember().getname() + \"<br>\");\n }\n if (team.getparentMember().getprofile().equals(\"0\") ||\n team.getparentMember().getprofile().equals(\"1\")) {\n // Siempre el mensaje de atrazo, pero no es un usuario externo\n memberBody.append(\"<BLOCKQUOTE>Tarea (<a href='\" + mainURL + \"/tasks.do?operation=view&id=\" +\n task.getid() + \"'>\" + task.getname() + \"</a>):\\tAtrasada<br>\" +\n \"</BLOCKQUOTE>\");\n } else {\n // Se trata de un usuario del cliente\n memberBody.append(\"<BLOCKQUOTE>Tarea (<a href='\" + mainURL + \"/portalTasks.do?operation=view&id=\" +\n task.getid() + \"'>\" + task.getname() + \"</a>):\\tAtrasada<br>\" +\n \"</BLOCKQUOTE>\");\n }\n managerBody.append(\"<BLOCKQUOTE>Tarea (<a href='\" + mainURL + \"/tasks.do?operation=view&id=\" +\n task.getid() + \"'>\" + task.getname() + \"</a>):\\tAtrasada<br>\" + \"\\t Asignada a: \" +\n (task.getassigned_to() == 0 ? \"No Asignada\" : task.getparentAssigned().getname()) +\n \"</BLOCKQUOTE>\");\n // Se cambia el valor\n atrasado = true;\n } else {\n System.out.println(\"\\t\\t\\tOK!!\");\n }\n // Se le envia el email al miembro del equipo si y solo si esta atrazado\n if (atrasado) {\n // enviar correo al usuario\n memberBody.insert(0, \"Las siguientes tareas est&aacute;n atrasadas m&aacute;s all&aacute; del umbral de tolerancia permitido.<br>\");\n managerBody.append(\"</BLOCKQUOTE>\");\n sm.sendCheckTasks(team.getparentMember().getemail_work(),\n memberBody.toString());\n }\n // Si alguien del proyecto esta atrazado se envia la lista de cada member\n // al administrador\n if (atrasadoEquipo) {\n managerBody.insert(0, \"Las siguientes tareas est&aacute;n atrasadas m&aacute;s all&aacute; del umbral de tolerancia permitido.<br>\");\n sm.sendCheckTasks(proyecto.getparentOwner().getemail_work(),\n managerBody.toString());\n }\n */\n\n\n // while de miembros\n\n\n }\n }", "@Override\n\tpublic void onMail(Message m) {\n\n\t\tHashMap<String,String> map = new HashMap<String,String>();\n\t\tmap.put(\"a\",\"A\");\n\t\tmap.put(\"b\",\"B\");\n\t\tmap.put(\"long\",new String(new byte[10000]));\n\t\tHeader header = new Header(map);\n\t\ttry {\n\t\t\tif (count % burstSize == 0) {\n\t\t\t\tfor (int i=0; i < burstSize; i++)\n\t\t\t\t\tsend(new Message(header, new Body()));\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\tcount++;\n\t\tif (count % 1000 == 0) {\n\t\t\tlong nano = System.nanoTime() - time;\n\t\t\tlong sec = nano / 1000000000L;\n\t\t\tfloat mps = count * 1.0F / sec;\n\t\t\tlogger.info(String.format(\"Count: %20d Msg/s: %5.2f\", count, mps));\n\t\t\t//log.info(String.format(\"%n%s%n\", m));\n\t\t}\n\t\t// for (String s : m.getHeader().keySet())\n\t\t//\tSystem.out.println(s);\n\t}", "private void MailGonderDosyaDinle(Socket client, ServerSocket server) throws IOException, ClassNotFoundException {\n \n String gelen;\n\n PrintWriter out = new PrintWriter(client.getOutputStream());\n out.println(\"220\");\n out.flush();\n\n InputStreamReader in = new InputStreamReader(client.getInputStream());\n BufferedReader buf = new BufferedReader(in);\n gelen = buf.readLine(); // helo geldi\n\n out = new PrintWriter(client.getOutputStream());\n out.println(\"250\");\n out.flush();\n\n in = new InputStreamReader(client.getInputStream());\n buf = new BufferedReader(in);\n gelen = buf.readLine(); // mail_from geldi\n\n out = new PrintWriter(client.getOutputStream());\n out.println(\"250_sender_ok\");\n out.flush();\n\n in = new InputStreamReader(client.getInputStream());\n buf = new BufferedReader(in);\n gelen = buf.readLine(); // rcpt_to: geldi\n ServerCommon.mailGonderilecekKisi = gelen.split(\":\")[1];\n\n out = new PrintWriter(client.getOutputStream());\n out.println(\"250_recipient_ok\");\n out.flush();\n\n in = new InputStreamReader(client.getInputStream());\n buf = new BufferedReader(in);\n gelen = buf.readLine(); // DATA geldi\n\n out = new PrintWriter(client.getOutputStream());\n out.println(\"354\");\n out.flush();\n\n ////////////// 1 MSS lik Tampon alma işlemleri baslangic\n // tamponlama mantıgı clietdeki ile aynı \n ObjectInputStream objectInput = new ObjectInputStream(client.getInputStream());//istemciye onay veriliyor.\n Packet ilkPacket = (Packet) objectInput.readObject();\n\n if (ilkPacket.getDurum().split(\"-\")[0].equals(\"kontrol_basla\")) {\n ServerCommon.GelenDosyaAdi = ilkPacket.getDosyaAdi();\n ServerCommon.GelenHedefBytesLenght = ilkPacket.getHedefBytesLength();\n ServerCommon.GelenTampon = ilkPacket.getTampon();\n ServerCommon.HedefBytes = new byte[ilkPacket.getHedefBytesLength()];\n ServerCommon.hedefBaslangic = 0;\n ServerCommon.GelenMailBaslik = ilkPacket.getDurum().split(\"-\")[1];\n }\n\n while (true) {\n try {\n\n objectInput = new ObjectInputStream(client.getInputStream());\n Packet tamponPacket = (Packet) objectInput.readObject();\n\n if (tamponPacket.getDurum().equals(\"kontrol_bitir\")) {\n break;\n }\n\n Functions.TamponBirlestir(tamponPacket.Tampon);\n\n } catch (Exception e) {\n e.printStackTrace();\n }\n System.out.println(\"Shutting down\");\n }\n\n ///////////////1 MSS lik Tampon alma işlemleri bitti\n out = new PrintWriter(client.getOutputStream());\n out.println(\"250_message_accepted\");\n out.flush();\n\n in = new InputStreamReader(client.getInputStream());\n buf = new BufferedReader(in);\n gelen = buf.readLine(); // QUIT: geldi\n\n out = new PrintWriter(client.getOutputStream());\n out.println(\"221_closing_connection\");\n out.flush();\n\n ////////Bitis islemleri\n // dosya alma işlemleri bittiginde dosyayı gonderenenin altındaki giden kasörüne\n // ve dosyayı alanın altındaki gelen klasörüne kaydediyoruz. her iki bilgiyide\n // Mailler arraylistine kaydediyoruz.\n ServerCommon.FILEPATH = ServerCommon.CONST_FILEPATH + \"/\" + ServerCommon.mailGonderilecekKisi.split(\"@\")[0] + \"/gelen/\" + ServerCommon.GelenDosyaAdi;\n ServerCommon.Mailler.add(new MailLog(\"gelen\", \"dosya\", ServerCommon.mailGonderilecekKisi.split(\"@\")[0], ServerCommon.GelenMailBaslik, \"\", ServerCommon.FILEPATH));\n ServerCommon.file = new File(ServerCommon.FILEPATH);\n Functions.ConvertBytesToFile(ServerCommon.HedefBytes);\n\n ServerCommon.FILEPATH = ServerCommon.CONST_FILEPATH + \"/\" + ServerCommon.kullaniciAdi.split(\"@\")[0] + \"/giden/\" + ServerCommon.GelenDosyaAdi;\n ServerCommon.Mailler.add(new MailLog(\"giden\", \"dosya\", ServerCommon.kullaniciAdi.split(\"@\")[0], ServerCommon.GelenMailBaslik, \"\", ServerCommon.FILEPATH));\n ServerCommon.file = new File(ServerCommon.FILEPATH);\n Functions.ConvertBytesToFile(ServerCommon.HedefBytes);\n\n }", "public void EnvoyerEmailSurveillant(Utilisateur user) {\n\t\t\t\t MimeMessage mimeMessage = mailSender.createMimeMessage(); \n\t\t\t try {\n\t\t\t MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, true);\n\t\t\t mimeMessageHelper.setSubject(\"Compte Surveillant \");\n\t\t\t mimeMessageHelper.setFrom(\"naifarsara@gmail.com\");\n\n\t\t\t mimeMessageHelper.setTo(user.getEmail());\n\t\t\t String url =\"scolarity.dpc.com.tn\";\n\t\t String content = \"Bonjour Mr ( Mmme), \" + user.getNom()+\" + \" + user.getPrenom()\n\t\t + \", votre nom d'utilisateur par la platforme scolarity est : \\n \" + user.getUsername() +\" \\n\"+\"et votre mot de passe est : \\n\"+ user.getPassword()+\"\\n\"+\"vous pouvez accéder au espace surveillant via l'adresse suivante : \\n\"+url+\"\\n\"+\" \\n Cordialement.\";\n\t\t System.out.println(content);\n\n\t\t\t mimeMessageHelper.setTo(user.getEmail());\n\t\t mimeMessageHelper.setText(content);\n\t\t // Add a resource as an attachment\n\t\t mimeMessageHelper.setText(\"<html><body><p>\" + content + \"</p> <img src=\\\"http://207.180.211.158:/logodpc.bmp\\\" width=\\\"50\\\" alt=\\\"Apen\\\"></body></html>\", true);\n\n\t\t\t \n\t\t\t \n\t\t\t mailSender.send(mimeMessageHelper.getMimeMessage());\n\t\t\t } catch (MessagingException e) {\n\t\t\t e.printStackTrace();\n\t\t\t }\n\t\t\t\t\n\t\t\t}", "public boolean mailRecuperarPassword(String nombreusuario, String password, String mail){\n\n try {\n\n// //seteamos el asunto\n// message.setSubject(\"UNDEC - Activar Cuenta Nortia UNDEC\");\n//\n// //seteamos el mensaje que vamos a enviar\n// message.setContent(\"<html>\\n\" +\n// \"<body>\\n\" +\n// \"\\nHola, usuario = \" +nombreusuario+ \",\\n su nuevo password es = \"+password+\n// \"\\n\" +\n// \"\\nUsted puede cambiar el password cuando ingrese al sistema\\n \"+\n// \n// \"Muchas Gracias\"+\n// \"</body>\\n\" +\n// \"</html>\", \"text/html\");\n// //colocamos la direccion de donde enviamos el correo\n// Address address = new InternetAddress(mail);\n// message.setFrom(address);\n// //Colocamos la direccion de la persona a enviar\n// Address send = new InternetAddress(mail,false);\n// message.addRecipient(Message.RecipientType.TO,send);\n// \n// //la persona que envia con la validacion de su cuenta.\n// Transport trans = session.getTransport(\"smtp\");\n// //Aca se autentifica que la direccion de la persona que envia sea válida\n//\n// trans.connect(\"hmaza@undec.edu.ar\",\"momomomo\");\n// trans.sendMessage(message,message.getAllRecipients());\n// trans.close();\n System.out.println(\"maiñll\");\n Email email = new Email();\n email.setFromAddress(\"Nortia UNDEC\", \"sisgap@undec.edu.ar\");\n email.addRecipient(nombreusuario, mail, RecipientType.TO);\n //email.addRecipient(agente.getApellido(), agente.getOtroemail(), RecipientType.BCC);\n email.setTextHTML(\"Hola, usuario = \"+nombreusuario+ \"su nuevo password es = \"+password +\n\n\" <br />Usted puede cambiar el password cuando ingrese al sistema <br />\" +\n\n\"Muchas Gracias\");\n System.out.println(\"-----------\"+mail);\n email.setSubject(\"UNDEC - Recuperar Password Nortia UNDEC\");\n \n // or:\n new Mailer(\"localhost\", 25, \"sisgap@undec.edu.ar\", \"sgap*9812\").sendMail(email);\n System.out.println(\"-----------enviado\");\n } catch (Exception ex) {\n\n ex.printStackTrace();\n //Si el correo tiene algun error lo retornaremos aca\n JsfUtil.addErrorMessage(ex,\"No se pudo crear el Usuario\");\n\n return false;\n\n \n }\n //Correo tuvo exito dara una salida en este punto indicando que si se envio\n return true;\n \n }", "public Date getMessageDate();", "@Override\n\tpublic void modifyClientMail(long id, String mail) {\n\t\t\n\t}", "private void formatTime() {\r\n\t\tDate date = new Date();\r\n\t\tSimpleDateFormat ft = new SimpleDateFormat(\"yyyy/MM/dd HH:mm:ss\");\r\n\t\tm_timeSent = ft.format(date).toString();\r\n\t}", "private static void testMail() throws Exception {\n\t\tUser user=new User();\n\t\tuser.setUsername(\"若水\");\n\t\tuser.setEmail(\"723413782@qq.com\");\n\t\tMail mail=new Mail();\n\t\tboolean b=mail.sendMail(user, \"http://www.baidu.com\", \"http://www.zzuli.edu.cn\", 2);\n\t\tSystem.out.println(b);\n\t}", "@Override\n\tpublic void sendMail(Mail mail, boolean flag) {\n\t\t\n\t}", "private boolean copy(MimeMessage m)\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t String fromEmail = getPlainFrom(m);\r\n\t PstUserAbstractObject u = null;\r\n\t try {u = (PstUserAbstractObject)uMgr.get(jwu, fromEmail);}\r\n\t catch (PmpException e)\r\n\t {\r\n\t \t// try to use the Email to locate the user\r\n\t \tint [] ids = uMgr.findId(jwu, \"Email='\" + fromEmail + \"'\");\r\n\t \tif (ids.length <= 0) {\r\n\t \t\t// cannot find the user\r\n\t\t \treject(m, \"RoboMail copy command rejected. You are not authorized to perform the action.\");\r\n\t\t \treturn false;\r\n\t \t}\r\n\t \tu = (PstUserAbstractObject) uMgr.get(jwu, ids[0]);\r\n\t }\r\n\t Object msgContent = m.getContent();\r\n\t String xmlMsg = msgContent.toString();\r\n\t xmlMsg = Util3.getXMLValue(xmlMsg, Util3.PRM_OBJECT);\t\t// only look at PRM_OBJECT portion of XML\r\n\t String className = Util3.getXMLValue(xmlMsg, Util3.PRM_CLASS);\r\n\r\n\t boolean isMeeting = false;\r\n\t boolean isQuest = false;\r\n\t PstManager mgr;\r\n\t PstAbstractObject newObj;\r\n\t if (className.equals(mtgMgr.getClass().getName()))\r\n\t {\r\n\t \tmgr = mtgMgr;\r\n\t\t newObj = mtgMgr.create(jwu);\r\n\t \tisMeeting = true;\r\n\t }\r\n\t else if (className.equals(qMgr.getClass().getName()))\r\n\t {\r\n\t \tmgr = qMgr;\r\n\t\t newObj = qMgr.create(jwu);\r\n\t \tisQuest = true;\r\n\t }\r\n\t else\r\n\t {\r\n\t \t// cannot handle this type\r\n\t \tl.error(\"RoboMail copy() cannot handle this type of object (\" + className + \")\");\r\n\t \treturn false;\r\n\t }\r\n\r\n\t String s;\r\n\t String [] tagNameArr = Util3.getXMLTagNames(xmlMsg);\r\n\t String val, attName, idS;\r\n\t int iType = 0, idx;\r\n\t String [] sa;\r\n\t Object valObj;\r\n\t for (int i=0; i<tagNameArr.length; i++)\r\n\t {\r\n\t \tattName = tagNameArr[i];\t\t\t// usually OMM attributes, but also special tag e.g. RemoteUsername\r\n\t \tif (attName.equalsIgnoreCase(Util3.PRM_CLASS))\r\n\t \t\tcontinue;\r\n\r\n\t\t\t\tval = Util3.getXMLValue(xmlMsg, tagNameArr[i]);\r\n\t \tif (val==null || val.length()<=0)\r\n\t \t\tcontinue;\r\n\t \t\r\n\t \tiType = 0;\r\n\r\n\t\t\t\ttry\r\n\t\t\t\t{\r\n\t\t\t\t\tif (isMeeting)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\ttry {iType = mtgMgr.getAttributeType(attName);}\r\n\t\t\t\t\t\tcatch (PmpException e) {l.warn(\"[\" + attName + \"] is not an OMM attribute\");}\r\n\t\t\t\t\t\t\r\n\t\t\t \tif (Util3.EXCEPT_ATTR_MTG.indexOf(attName) != -1)\r\n\t\t\t \t{\r\n\t\t\t \t\t// handle exception cases\r\n\t\t\t \t\tif (attName.equals(\"Owner\"))\r\n\t\t\t \t\t{\r\n\t\t\t\t \t\t// Owner\r\n\t\t\t\t \t\tidS = Util3.getUidFromEmail(u, val);\r\n\t\t\t\t \t\tif (idS == null)\r\n\t\t\t\t \t\t\tidS = String.valueOf(u.getObjectId());\r\n\t\t\t\t \t\tnewObj.setAttribute(\"Owner\", idS);\r\n\t\t\t \t\t}\r\n\t\t\t \t\telse if (attName.equals(\"Recorder\"))\r\n\t\t\t \t\t{\r\n\t\t\t \t\t\t// Recorder\r\n\t\t\t\t \t\tidS = Util3.getUidFromEmail(u, val);\r\n\t\t\t\t \t\tif (idS == null)\r\n\t\t\t\t \t\t\tidS = String.valueOf(u.getObjectId());\r\n\t\t\t\t \t\tnewObj.setAttribute(\"Recorder\", idS);\r\n\t\t\t \t\t}\r\n\t\t\t \t\telse if (attName.equals(\"Attendee\"))\r\n\t\t\t \t\t{\r\n\t\t\t \t\t\t// Attendee\r\n\t\t\t\t\t\t\t\t// each value looks like jdoe@gmail.com::MandatoryAcceptLogonPresent\r\n\t\t\t \t\t\tsa = val.split(Util3.TERMINATOR0);\r\n\t\t\t \t\t\tfor (int j=0; j<sa.length; j++)\r\n\t\t\t \t\t\t{\r\n\t\t\t \t\t\t\tval = sa[j];\r\n\t\t\t\t \t\t\tidx = val.indexOf(Util3.TERMINATOR1);\r\n\t\t\t\t\t \t\tidS = Util3.getUidFromEmail(u, val.substring(0, idx));\r\n\t\t\t\t\t \t\tif (idS == null) continue;\t\t\t// no such user, ignored\r\n\t\t\t\t\t \t\tval = idS + val.substring(idx);\r\n\t\t\t\t\t \t\tnewObj.appendAttribute(\"Attendee\", val);\r\n\t\t\t \t\t\t}\r\n\t\t\t \t\t}\r\n\t\t\t \t\telse if (attName.equals(\"AgendaItem\"))\r\n\t\t\t \t\t{\r\n\t\t\t \t\t\t// AgendaItem\r\n\t\t\t\t\t\t\t\t// each value looks like 0::0::0::Review last week's actions::30::jdoe@gmail.com\r\n\t\t\t \t\t\tsa = val.split(Util3.TERMINATOR0);\r\n\t\t\t \t\t\tfor (int j=0; j<sa.length; j++)\r\n\t\t\t \t\t\t{\r\n\t\t\t \t\t\t\tval = sa[j];\r\n\t\t\t \t\t\t\tidx = val.lastIndexOf(Util3.TERMINATOR1) + 2;\r\n\t\t\t \t\t\t\ts = val.substring(idx);\t\t\t// email or -1 or -2\r\n\t\t\t \t\t\t\tif (s.charAt(0) == '-')\r\n\t\t\t \t\t\t\t{\r\n\t\t\t \t\t\t\t\tnewObj.appendAttribute(\"AgendaItem\", val);\r\n\t\t\t \t\t\t\t\tcontinue;\r\n\t\t\t \t\t\t\t}\r\n\t\t\t \t\t\t\tidS = Util3.getUidFromEmail(u, s);\r\n\t\t\t \t\t\t\tif (idS == null)\r\n\t\t\t \t\t\t\t\tidS = \"-1\";\t\t\t\t\t// no one; String.valueOf(u.getObjectId());\r\n\t\t\t \t\t\t\tval = val.substring(0, idx) + idS;\r\n\t\t\t \t\t\t\tnewObj.appendAttribute(\"AgendaItem\", val);\r\n\t\t\t \t\t\t}\r\n\t\t\t \t\t}\r\n\t\t\t \t\telse if (attName.equals(Util3.TAG_REMOTE_UNAME)) {\r\n\t\t\t \t\t\t// use the username to find uid and put as attendee\r\n\t\t\t \t\t\tidS = Util3.getUidFromUsername(u, val);\r\n\t\t\t \t\t\tif (!StringUtil.isNullOrEmptyString(idS))\r\n\t\t\t \t\t\t\tnewObj.appendAttribute(\"Attendee\", idS + \"::Mandatory\");\r\n\t\t\t \t\t}\r\n\r\n\t\t\t \t\tcontinue;\t// ignore others; next attr\r\n\t\t\t \t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if (isQuest)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\ttry {iType = qMgr.getAttributeType(attName);}\r\n\t\t\t\t\t\tcatch (PmpException e) {l.warn(\"[\" + attName + \"] is not an OMM attribute\");}\r\n\t\t\t\t\t\t\r\n\t\t\t \tif (Util3.EXCEPT_ATTR_QST.indexOf(attName) != -1)\r\n\t\t\t \t{\r\n\t\t\t \t\t// handle exception cases\r\n\t\t\t \t\tif (attName.equals(\"Creator\"))\r\n\t\t\t \t\t{\r\n\t\t\t\t \t\t// Creator\r\n\t\t\t\t \t\t// use the email to find the person. If not found, use the XML email sender\r\n\t\t\t\t \t\tidS = Util3.getUidFromEmail(u, val);\r\n\t\t\t\t \t\tif (idS == null)\r\n\t\t\t\t \t\t\tidS = String.valueOf(u.getObjectId());\r\n\t\t\t\t \t\tnewObj.setAttribute(\"Creator\", idS);\r\n\t\t\t \t\t}\r\n\t\t\t \t\telse if (attName.equals(\"Attendee\"))\r\n\t\t\t \t\t{\r\n\t\t\t\t \t\t// Attendee\r\n\t\t\t\t \t\tsa = val.split(Util3.TERMINATOR0);\r\n\t\t\t\t \t\tfor (int j=0; j<sa.length; j++)\r\n\t\t\t\t \t\t{\r\n\t\t\t\t \t\t\t// 12345\r\n\t\t\t\t \t\t\tidS = Util3.getUidFromEmail(u, sa[j]);\r\n\t\t\t\t \t\t\tif (idS != null)\r\n\t\t\t\t \t\t\t\tnewObj.appendAttribute(\"Attendee\", idS);\r\n\t\t\t\t \t\t}\r\n\t\t\t \t\t}\r\n\t\t\t \t\telse if (attName.equals(Util3.TAG_REMOTE_UNAME)) {\r\n\t\t\t \t\t\t// use the username to find uid and put as attendee\r\n\t\t\t \t\t\tidS = Util3.getUidFromUsername(u, val);\r\n\t\t\t \t\t\tif (!StringUtil.isNullOrEmptyString(idS))\r\n\t\t\t \t\t\t\tnewObj.appendAttribute(\"Attendee\", idS);\r\n\t\t\t \t\t}\r\n\r\n\t\t\t \t\tcontinue;\t\t// ignore the rest, next attr\r\n\t\t\t \t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// for non-exceptional type\r\n\t\t\t\t\tif (iType > 0 ) {\r\n\t\t\t\t\t\tsa = val.split(Util3.TERMINATOR0);\r\n\t\t\t\t\t\tfor (int j=0; j<sa.length; j++)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif (sa[j].length() <= 0) continue;\r\n\t\t\t\t\t\t\tswitch (iType)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tcase PstAbstractObject.INT:\r\n\t\t\t\t\t\t\t\t\tvalObj = new Integer(sa[j]);\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase PstAbstractObject.FLOAT:\r\n\t\t\t\t\t\t\t\t\tvalObj = new Float(sa[j]);\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase PstAbstractObject.STRING:\r\n\t\t\t\t\t\t\t\t\tvalObj = new String(sa[j]);\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase PstAbstractObject.DATE:\r\n\t\t\t\t\t\t\t\t\tvalObj = Util3.df0.parse(sa[j]);\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase PstAbstractObject.RAW:\r\n\t\t\t\t\t\t\t\t\tvalObj = sa[j].getBytes();\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\t\t\tl.error(\"Unsupported data type.\");\r\n\t\t\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tnewObj.appendAttribute(attName, valObj);\r\n\t\t\t\t\t\t}\t// END for each value in the value array\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tcatch (Exception e) {l.error(\"exception in getting attribute value for [\" + attName + \"]\");}\r\n\t }\t// END for each attr in the XML message\r\n\r\n\t mgr.commit(newObj);\r\n\t l.info(\"Created new \" + className + \" object [\" + newObj.getObjectId() + \"]\");\r\n\t\t}\r\n\t\tcatch (Exception e)\r\n\t\t{\r\n\t\t\te.printStackTrace();\r\n\t\t\treject(m, \"Copy command failed in copy() operation. \" + e.toString());\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "private void sendMail(final String mail, final String name, final String message) {\n /* new Thread(){\n public void run() {\n Properties props = System.getProperties();\n props.put(\"mail.smtps.host\",\"smtp.gmail.com\");\n props.put(\"mail.smtps.auth\",\"true\");\n Session session = Session.getInstance(props, null);\n Message msg = new MimeMessage(session);\n try {\n msg.setFrom(new InternetAddress(\"thoughtgalore@gmail.com\"));\n msg.setRecipients(Message.RecipientType.TO,\n InternetAddress.parse(\"aji.b2w@gmail.com\", false));\n msg.setSubject(\"Yoga Mandira :: Feedback \" + System.currentTimeMillis());\n msg.setText(\"MAIL:\"+mail+\"\\nNAME:\"+name+\"\\nMESSAGE:\"+message);\n msg.setHeader(\"X-Mailer\", \"Yoga Mandira\");\n msg.setSentDate(new Date());\n SMTPTransport t =\n (SMTPTransport) session.getTransport(\"smtps\");\n t.connect(\"smtp.gmail.com\", \"thoughtgalore@gmail.com\", \"#30ija11an\");\n t.sendMessage(msg, msg.getAllRecipients());\n System.out.println(\"Response: \" + t.getLastServerResponse());\n t.close();\n }catch (AddressException e) {\n e.printStackTrace();\n } catch (SendFailedException e) {\n e.printStackTrace();\n } catch (NoSuchProviderException e) {\n e.printStackTrace();\n } catch (MessagingException e) {\n e.printStackTrace();\n }\n }\n }.start();*/\n }", "boolean hasNewMailNum();", "public void EnviarWithAdjunto(String destino, String asunto, String cuerpo, byte[] adjunto)\n {\n /*\n * \n email: comercial@redmoon.es\n pasword: Comer2010\n * Servidor de correo saliente (SMTP): smtp.redmoon.es\n * Servidor de correo entrante (POP/IMAP/IMAP SSL): mail.redmoon.es\n */\n \n\n // Get system properties\n Properties propiedades = new Properties();\n \n // Setup mail server\n \n propiedades.setProperty(\"mail.smtp.host\", host);\n propiedades.setProperty(\"mail.smtp.starttls.enable\", \"true\");\n propiedades.setProperty(\"mail.smtp.auth\", \"true\");\n propiedades.setProperty(\"mail.user\", \"comercial@redmoon.es\");\n propiedades.setProperty(\"mail.password\", \"Comer2010\");\n propiedades.setProperty(\"mail.smtp.port\", \"25\");\n \n // no estoy seguro\n //propiedades.setProperty(\"mail.mime.multipart.ignoreexistingboundaryparameter\", \"true\");\n \n // creates a new session with an authenticator\n Authenticator auth = new Authenticator() {\n @Override\n public PasswordAuthentication getPasswordAuthentication() {\n return new PasswordAuthentication(usuario, passwd);\n }\n };\n \n // Get the default Session object.\n Session session = Session.getInstance(propiedades, auth);\n\n \n \n\n try{\n // Create a default MimeMessage object.\n MimeMessage message = new MimeMessage(session);\n\n //message.setHeader(\"Content-Type\",\"multipart/mixed; boundary=\\\"frontera\\\"\");\n \n // Set From: header field of the header.\n message.setFrom(new InternetAddress(from));\n\n // Set To: header field of the header.\n message.addRecipient(Message.RecipientType.TO,\n new InternetAddress(destino));\n\n // Set Subject: header field\n message.setSubject(asunto);\n\n // Create the message part \n BodyPart messageBodyPart = new MimeBodyPart();\n\n // Fill the message\n messageBodyPart.setText(cuerpo);\n \n // Create a multipar message\n Multipart multipart = new MimeMultipart();\n\n \n // Set text message part\n multipart.addBodyPart(messageBodyPart);\n\n // Part two is attachment\n //messageBodyPart = new MimeBodyPart();\n //String filename = \"myTabla.pdf\";\n \n // Type of mail, only sopported types related (html) and mixed.\n DataSource ds = new ByteArrayDataSource(adjunto, \"multipart/mixed\");\n //DataSource ds = new ByteArrayDataSource(bytes, \"multipart/\"+type);\n\n\tMimeMultipart mp = new MimeMultipart(ds);\n \n\tMimeMultipart multiPart = new MimeMultipart(\"mixed\");\n\n\tfor (int i = 0; i < mp.getCount(); i ++) {\n multiPart.addBodyPart(mp.getBodyPart(i));\n\t}\n\n /*DataSource source = new FileDataSource(filename);\n messageBodyPart.setDataHandler(new DataHandler(source));\n messageBodyPart.setFileName(filename);\n \n multipart.addBodyPart(messageBodyPart);*/\n\n // Send the complete message parts\n message.setContent(multipart);\n\n // Send message\n Transport.send(message);\n //System.out.println(\"Sent message successfully....\");\n \n }catch (MessagingException mex) {\n Logger.getLogger(SendEmail.class.getName()).log(Level.SEVERE, null, mex);\n }\n }", "public void actionPerformed(java.awt.event.ActionEvent e) {\n\t\t\t\t\t///// ENVOI FICHIER TRACE AU SUPPORT A LA FERMETURE//\r\n\t\t\t\t\t/////////////////////////////////////////////////////\r\n\t\t\t\t\t\r\n\t\t\t\t\tString [] destinataire = {\"s.mardine@gmail.com\"};\r\n\t\t\t\t\tString from = \"carnet.client@laposte.net\";\r\n\t\t\t\t\tString password = \"gouranga08\";\r\n\t\t\t\t\tString [] Files = {GestionRepertoire.RecupRepTravail()+\"\\\\historique.txt\",GestionRepertoire.RecupRepTravail()+\"\\\\IniFile\\\\version.ini\",GestionRepertoire.RecupRepTravail()+\"\\\\IniFile\\\\AccesBdd.ini\"};\r\n\t\t\t\t\tString Sujet = \"Utilisation carnet client\";\r\n\t\t\t\t\t\r\n\t\t\t\t\tString MACHINE_NAME=VariableEnvironement.VarEnvSystem(\"COMPUTERNAME\");\r\n\t\t\t\t\tString USERNAME=VariableEnvironement.VarEnvSystem(\"USERNAME\");\r\n\t\t\t\t\t\r\n\t\t\t\t\tConfigMgt config = null;\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tconfig = new ConfigMgt(\"version.ini\",GestionRepertoire.RecupRepTravail()+\"\\\\IniFile\\\\\",'[');\r\n\t\t\t\t\t} catch (NullPointerException e1) {\r\n\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\te1.printStackTrace();\r\n\t\t\t\t\t} catch (IOException e1) {\r\n\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\te1.printStackTrace();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tString VERSION = config.getValeurDe(\"version\");\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tString Message = \"L'ordinateur \"+ MACHINE_NAME + \"à utilisé ce logiciel.\\n\\r\" +\r\n\t\t\t\t\t\t\t\"L'utilisateur qui a lancé le logiciel est : \" + USERNAME +\"\\n\\r\" +\r\n\t\t\t\t\t\t\t\t\t\"La version utlilisée est : \"+VERSION;\r\n\t\t\t\t\tSendMailUsingAuthenticationWithAttachement smtpMailSender = new SendMailUsingAuthenticationWithAttachement();\r\n\t\t\t\t boolean succesEnvoiMail = false;\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tsuccesEnvoiMail = smtpMailSender.postMail( destinataire, Sujet, Message, from, password, Files);\r\n\t\t\t\t\t} catch (MessagingException e2) {\r\n\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\te2.printStackTrace();\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (succesEnvoiMail==false){//il y a eu un pb lors de l'envoi, on re essaye une fois\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\tsuccesEnvoiMail = smtpMailSender.postMail( destinataire, Sujet, Message, from, password, Files);\r\n\t\t\t\t\t\t} catch (MessagingException e2) {\r\n\t\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\t\te2.printStackTrace();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tnew Fen_Fermeture ();\r\n\t\t\t\t\t\r\n\t\t\t\t}", "String getPasswordExpiredMailBody( );", "public ResponseUpdDao sendSimpleEmail(String tsSubject, \n String tsMessage,\n String tsProcess,\n List<EmailDestinationAddress> toEmailDestinationAddress\n ) {\n ResponseUpdDao loResponse = new ResponseUpdDao();\n try{\n String lsHtml =\n \"<!DOCTYPE html PUBLIC \\\"-//W3C//DTD XHTML 1.0 Strict//EN\\\" \\\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-\" +\n \"strict.dtd\\\">\\n\" + \n \" <html xmlns=\\\"http://www.w3.org/1999/xhtml\\\" dir=\\\"ltr\\\" lang=\\\"es-ES\\\">\\n\" + \n \" <head>\\n\" + \n \" <title>\"+tsProcess+\"</title>\\n\" + \n \" <meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html; charset=ISO-8859-1\\\" />\\n\" + \n \" <meta name=\\\"language\\\" content=\\\"es\\\" />\\n\" + \n \" </head>\\n\" + \n \" <body>\\n\" + \n \" <div style='background-color:#0F2F62; height:25px;background:linear-gradient(#040545, \" +\n \"#0172AE);background:-webkit-linear-gradient(#040545, #0172AE);background: -ms-linear-background(\" +\n \"#040545, #0172AE);filter:progid:DXImageTransform.Microsoft.gradient(startColorStr='#040545', \" +\n \"EndColorStr='#0172AE');'></div>\\n\" + \n \" <div style='background-color:#fff'> \\n\" + \n \" <br/>\\n\" + \n \" <label style='font-family:Arial, Helvetica, sans-serif; font-size:16px; font-weight:\" +\n \"bold '>El Proceso de Integraci&oacute;n para \"+tsProcess+\" ha Finalizado</label><p/>\\n\" + \n \" <label style='font-family:Arial, Helvetica, sans-serif; font-size:12px; \" +\n \"font-weight:bold '>\"+tsMessage+\"</label><p/>\\n\" + \n /*\" <table cellpadding='0' cellspacing='0' style='border-bottom-color:#F79646;border-\" +\n \"bottom-width:3px;border-bottom-style:solid;border-top-color:#F79646;border-top-style:solid;border-\" +\n \"top-width:3px; '> \\n\" + \n \" <tr>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Bcsttim</th>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Channelid</th>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Date</th>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Orderid</th>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Spotid</th>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Buyuntid</th>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Breakid</th>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Hour</th>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Duration</th>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Spotformatid</th>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Mediaid</th>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Productid</th>\\n\" + \n \" <th height='10px' style='font-size:12px; background:#276A7C; \" +\n \"font-family:Arial, Helvetica, sans-serif;color:#FFFFFF;padding:3px;'>Spotprice</th>\\n\" + \" </tr>\\n\";\n \n lsHtml += \" </table> \\n\" + \n */\" <br/> \\n\" + \n \" <br/>\\n\" + \n \" <label style='font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:\" +\n \"bold '>Integraci&oacute;n Paradigm-Landmark, 2019 Televisa S.A. de C.V</label> \\n\" + \n \" <br/>\\n\" + \n \" </div>\\n\" + \n \" <div style='float:left; background-color:#F58220;width:7%;height:25px;background:-moz-\" +\n \"linear-gradient(#F1A345, #E17521); background:-webkit-linear-gradient(#F1A345, #E17521);\" +\n \"background: -ms-linear-background(#F1A345, #E17521);filter:progid:DXImageTransform.Microsoft.gradient(\" +\n \"startColorStr='#F1A345', EndColorStr='#E17521');'>\\n\" + \n \" </div> \\n\" + \n \" <div style='float:left; ;width:86%;height:25px;background:linear-gradient(#040545, \" +\n \"#0172AE);background:-webkit-linear-gradient(#040545, #0172AE);background: -ms-linear-\" +\n \"background(#040545, #0172AE);filter:progid:DXImageTransform.Microsoft.gradient(startColorStr=\" +\n \"'#040545', EndColorStr='#0172AE');'>\\n\" + \n \" </div>\\n\" + \n \" <div style='float:left; background-color:#F58220;width:7%;height:25px;background:-\" +\n \"moz-linear-gradient(#F1A345, #E17521);background:-webkit-linear-gradient(#F1A345, #E17521);\" +\n \"background: -ms-linear-background(#F1A345, #E17521);filter:progid:DXImageTransform.Microsoft.gradient(\" +\n \"startColorStr='#F1A345', EndColorStr='#E17521');'></div> \\n\" + \n \" </body>\\n\" + \n \" </html>\"; \n System.out.println(\"Html generado para el correo ================>\");\n System.out.println(lsHtml);\n //writeFile(lsHtml);\n SecmanDasEnviarCorreo loSecmanDasSendMail = getDynaWebServiceURLEmail();\n if(loSecmanDasSendMail != null){\n try{\n Map<String, Object> loRequestContext =\n ((BindingProvider)loSecmanDasSendMail).getRequestContext(); \n setPortCredentialProviderList(loRequestContext); \n Mail loEmail = new Mail(); \n MailHeader loEmailHeader = new MailHeader();\n MailAddress loEmailAddresFrom = new MailAddress(); \n loEmailAddresFrom.setUserNameAdress(\"Landmark Integration\");\n loEmailAddresFrom.setAddress(\"service_integration_lmk@televisa.com.mx\");\n loEmailHeader.setAddressFrom(loEmailAddresFrom);\n MailAddressCollection loMailAddressCollection =\n new MailAddressCollection();\n for(EmailDestinationAddress loDest: toEmailDestinationAddress){ \n MailAddress loEmailAdd = new MailAddress();\n //System.out.println(\"AddressTO username[\"+loDest.getLsNameTo()+\"] address[\"+loDest.getLsAddressTo()+\"]\");\n loEmailAdd.setUserNameAdress(loDest.getLsNameTo());\n loEmailAdd.setAddress(loDest.getLsAddressTo()); \n loMailAddressCollection.getMailAddress().add(loEmailAdd);\n }\n loEmailHeader.setTo(loMailAddressCollection);\n loEmailHeader.setSubject(tsSubject);\n loEmail.setMailHeader(loEmailHeader);\n MailBody loMailBody = new MailBody();\n loMailBody.setBodyType(\"HTML\");\n loMailBody.setMessage(lsHtml);\n loEmail.setMailBody(loMailBody);\n loSecmanDasSendMail.enviarCorreo(loEmail);\n loResponse.setLsResponse(\"OK\");\n loResponse.setLiAffected(0);\n loResponse.setLsMessage(\"Correo enviado satisfactoriamente\");\n System.out.println(\"Fin enviar correo - ok\");\n } catch (Exception loException) {\n System.out.println(\"Error al enviar correo: \"+loException.getMessage());\n loResponse.setLsResponse(\"ERROR\");\n loResponse.setLiAffected(0);\n loResponse.setLsMessage(loException.getMessage());\n }\n }\n } catch (Exception loException) {\n System.out.println(\"Error crear instancia del servicio de correo de secman: \"+loException.getMessage());\n loResponse.setLsResponse(\"ERROR\");\n loResponse.setLiAffected(0);\n loResponse.setLsMessage(loException.getMessage()); \n }\n return loResponse;\n }", "private String readFile(File file, int flag) throws IOException {\n\t\tBufferedReader reader = new BufferedReader(new FileReader(file));\n\t\tString senderDomain = \"\";\n\t\tString subject = \"\";\n\t\tint nonCharNum = -1;\n\t\tint sendTime = -1;\n\t\tBoolean firstLine = true;\n\t\tBoolean base64 = false;\n\t\tBoolean reply = false;\n\t\tBoolean firstSpace = true;\n\t\tString emailContent = \"\";\n\t\tString emailContentLine = new String();\n\t\twhile ((emailContentLine = reader.readLine()) != null) {\n\t\t\tif (emailContentLine.equals(\"-- \"))\n\t\t\t\tbreak;\n\t\t\tif (emailContentLine.startsWith(\"From \") && (firstLine == true)) {\n\t\t\t\tsenderDomain = emailContentLine.split(\" \")[1].split(\"\\\\.\")[emailContentLine\n\t\t\t\t\t\t.split(\" \")[1].split(\"\\\\.\").length - 1].toLowerCase();\n\t\t\t}\n\t\t\tif (emailContentLine.startsWith(\"Return-Path: \")) {\n\t\t\t\tif (emailContentLine.split(\" \")[1].split(\"\\\\.\")[emailContentLine\n\t\t\t\t\t\t.split(\" \")[1].split(\"\\\\.\").length - 1]\n\t\t\t\t\t\t.replaceAll(\"\\\\W+\", \"\").toLowerCase().length() <= 3)\n\t\t\t\t\tsenderDomain = emailContentLine.split(\" \")[1].split(\"\\\\.\")[emailContentLine\n\t\t\t\t\t\t\t.split(\" \")[1].split(\"\\\\.\").length - 1].replaceAll(\n\t\t\t\t\t\t\t\"\\\\W+\", \"\").toLowerCase();\n\t\t\t}\n\t\t\tif ((emailContentLine.startsWith(\"From \") && (firstLine == true))\n\t\t\t\t\t|| emailContentLine.startsWith(\"Delivery-Date\")) {\n\t\t\t\tint hour = Integer\n\t\t\t\t\t\t.parseInt(emailContentLine.split(\" \")[emailContentLine\n\t\t\t\t\t\t\t\t.split(\" \").length - 2].split(\":\")[0]);\n\t\t\t\tsendTime = hour;\n\t\t\t}\n\t\t\tif (emailContentLine.startsWith(\"Date: \")\n\t\t\t\t\t&& (emailContentLine.split(\"\\\\s+\").length == 7)) {\n\t\t\t\tint hour = 0;\n\t\t\t\ttry {\n\t\t\t\t\thour = Integer.parseInt(emailContentLine.split(\"\\\\s+\")[5]\n\t\t\t\t\t\t\t.split(\":\")[0]);\n\t\t\t\t} catch (NumberFormatException e) {\n\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\tSystem.out.println(file.getAbsolutePath());\n\t\t\t\t}\n\t\t\t\tsendTime = hour;\n\t\t\t}\n\t\t\tif (emailContentLine.startsWith(\"Subject:\")) {\n\t\t\t\tsubject = emailContentLine.substring(9);\n\t\t\t\tif (subject.startsWith(\"Re:\")) {\n\t\t\t\t\treply = true;\n\t\t\t\t\tsubject = subject.substring(5);\n\t\t\t\t}\n\t\t\t}\n\t\t\temailContent += emailContentLine + \"\\n\";\n\t\t\tfirstLine = false;\n\t\t\tif (emailContentLine.length() == 0) {\n\t\t\t\tif (firstSpace == true)\n\t\t\t\t\temailContent = subject + \"\\n\";\n\t\t\t\tfirstSpace = false;\n\t\t\t}\n\t\t\tif (emailContentLine.contains(\"base64\")) {\n\t\t\t\temailContent = \"\";\n\t\t\t\tbase64 = true;\n\t\t\t}\n\t\t}\n\t\tif (base64 == true) {\n\t\t\temailContent = emailContent.replace(\" \", \"+\");\n\t\t\temailContent = Jsoup.parse(\n\t\t\t\t\tnew String(Base64.decodeBase64(emailContent.getBytes())))\n\t\t\t\t\t.text();\n\t\t}\n\t\temailContent = Jsoup.parse(emailContent).text().replaceAll(\" \", \" \");\n\t\tint orginalLengh = emailContent.length();\n\t\temailContent = emailContent.replaceAll(\"[^a-zA-Z0-9$]+\", \" \");\n\t\temailContent = emailContent.replace(\"$\", \"$ \");\n\t\tnonCharNum = (int) (((double) (orginalLengh - emailContent.length()) / orginalLengh) * 10);\n\t\tif (flag == 0) {\n\t\t\thamSenderDomain = new String();\n\t\t\thamTime = new String();\n\t\t\thamReply = new String();\n\t\t\thamNonCharNum = new String();\n\t\t\thamSenderDomain = senderDomain;\n\t\t\thamTime = String.valueOf(sendTime);\n\t\t\thamReply = reply.toString();\n\t\t\thamNonCharNum = String.valueOf(nonCharNum);\n\t\t} else if (flag == 1) {\n\t\t\tspamSenderDomain = new String();\n\t\t\tspamTime = new String();\n\t\t\tspamReply = new String();\n\t\t\tspamNonCharNum = new String();\n\t\t\tspamSenderDomain = senderDomain;\n\t\t\tspamTime = String.valueOf(sendTime);\n\t\t\tspamReply = reply.toString();\n\t\t\tspamNonCharNum = String.valueOf(nonCharNum);\n\t\t} else if (flag == 2) {\n\t\t\ttestSenderDomain = new String();\n\t\t\ttestTime = new String();\n\t\t\ttestReply = new String();\n\t\t\ttestNonCharNum = new String();\n\t\t\ttestSenderDomain = senderDomain;\n\t\t\ttestTime = String.valueOf(sendTime);\n\t\t\ttestReply = reply.toString();\n\t\t\ttestNonCharNum = String.valueOf(nonCharNum);\n\t\t}\n\t\treader.close();\n\n\t\treturn emailContent;\n\t}", "public void Send(String ToMail,int id,String name){\n String link = \"http://localhost:8080/Project/resetpassword.jsp\";\n String m_text = \"<table style=\\\"width: 100% !important\\\" >\\n\" +\n\" <tbody>\\n\" +\n\" <tr>\\n\" +\n\" <td>\\n\" +\n\" <div>\\n\" +\n\" <h2>Hello, \"+name+\"</h2>\\n\" +\n\" </div>\\n\" +\n\" <div>\\n\" +\n\" You recently took steps to reset the password for your Hanger account. Click on the link below to reset your password.\\n\" +\n\" </div>\\n\" +\n\" <br>\\n\" +\n\" <a href=\\\"\"+link+\"?id=\"+id+\"\\\">Reset Password</a>\\n\" +\n\" <br>\\n\" +\n\"\\n\" +\n\" <div>\\n\" +\n\" This link will expire in 1 days after this email was sent.\\n\" +\n\" </div>\\n\" +\n\"\\n\" +\n\" <br>\\n\" +\n\" <div>\\n\" +\n\" Sincerely,\\n\" +\n\" <h4>The Hanger Team</h4>\\n\" +\n\" </div>\\n\" +\n\" </td>\\n\" +\n\" </tr>\\n\" +\n\" </tbody>\\n\" +\n\" </table>\";\n send( d_email, d_host, d_port, ToMail, m_subject, m_text);\n }", "protected String checkDate(String msg) {\n\t\tPattern pat = Pattern.compile(\"^(Date: (.+))$\", Pattern.MULTILINE);\n\t\tMatcher m = pat.matcher(msg);\n\t\tif (m.find()) {\n\t\t\tString date = m.group(2);\n\t\t\tfinal String pattern = \"EEE, dd MMM yyyy HH:mm:ss Z\"; // Fri, 21 Nov 1997 09:55:06 -0600\n\t\t\tfinal SimpleDateFormat format = new SimpleDateFormat(pattern, Locale.ENGLISH);\n\t\t\ttry {\n\t\t\t\tfinal Date sentDate = format.parse(date);\n\t\t\t\t// Round to nearest second because the text format does not include ms\n\t\t\t\tlong sentSecs = sentDate.getTime() / 1000;\n\t\t\t\tlong beforeDateSecs = beforeDate.getTime() / 1000;\n\t\t\t\tDate afterDate = new Date();\n\t\t\t\tlong afterDateSecs = afterDate.getTime() / 1000;\n\t\t\t\tif (sentSecs < beforeDateSecs) {\n\t\t\t\t\tfail(sentDate + \" should be after \" + beforeDate);\n\t\t\t\t}\n\t\t\t\tif (sentSecs > (afterDateSecs)) {\n\t\t\t\t\tfail(sentDate + \" should be before \" + afterDate);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (ParseException e) {\n\t\t\t\tfail(\"\" + e);\n\t\t\t}\n\n\t\t\tint start = m.start(1);\n\t\t\tint end = m.end(1);\n\t\t\tif (start == 0) {\n\t\t\t\treturn msg.substring(end + 1);\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn msg.substring(0, start) + msg.substring(end + 1);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tfail(\"Expecting Date header in \" + msg);\n\t\t}\n\t\treturn null;\n\t}", "private void deliver(String mb) {\n\t\t\tString[] sourceIdAndMsgAndTime = mb.split(\" \", 3);\n\t\t\tSystem.out.println(\"Received \"+ sourceIdAndMsgAndTime[1] + \" from process \"+ sourceIdAndMsgAndTime[0] +\", system time is ­­­­­­­­­­­­­\" + sourceIdAndMsgAndTime[2]);\n\t\t\t\n\t\t}", "public void setFechaModificacion(String p) { this.fechaModificacion = p; }", "public void setFechaModificacion(String p) { this.fechaModificacion = p; }", "public void sendEmailThread(final String sbj, final String contenido) {\n Thread thread = new Thread(new Runnable() {\n @Override\n public void run() {\n try {\n String msg = \"<p style=\\\"font-family:Calibri;color:#1F497D;\\\">\"\n + contenido\n + \"</p>\"\n + firma;\n Properties properties = new Properties();\n properties.put(\"mail.host\", servidorCorreo);\n properties.put(\"mail.store.protocol\", \"imaps\");\n properties.put(\"mail.smtp.auth\", \"true\");\n properties.put(\"mail.smtp.port\", \"25\");\n properties.put(\"mail.smtp.host\", servidorCorreo);\n properties.put(\"mail.smtp.protocol\", \"smtp\");\n\n sesion = Session.getInstance(properties, new javax.mail.Authenticator() {\n @Override\n protected PasswordAuthentication getPasswordAuthentication() {\n return new PasswordAuthentication(usuarioCorreo, claveCorreo);\n }\n });\n Message message = new MimeMessage(sesion);\n message.setFrom(new InternetAddress(correo));\n message.setSubject(sbj);\n InternetAddress[] addrs = new InternetAddress[destinatarios.length];\n for (int x = 0; x < destinatarios.length; x++) {\n addrs[x] = new InternetAddress(destinatarios[x]);\n }\n message.setRecipients(Message.RecipientType.TO, addrs);\n DataHandler dh = new DataHandler(msg, \"text/html;charset=UTF-8\");\n message.setDataHandler(dh);\n Transport.send(message);\n } catch (MessagingException ex) {\n ex.printStackTrace(System.out);\n } catch (Exception ex) {\n ex.printStackTrace(System.out);\n }\n }\n });\n thread.start();\n }", "@Override\n\tpublic void sendMail(Mail mail) {\n\t\t\n\t}", "@Override\n\tprotected String doIt() throws Exception {\n\t\tString returnMsg = Msg.getMsg(getCtx(), \"EGGO_SENDMAIL_EVENT\");\n\t\tMOrder mo = new MOrder(getCtx(), Order_ID, get_Trx());\n\t\tif(EventType.equals(\"05\") && (mo.get_ValueAsTimestamp(\"DatePose\") == null || mo.get_ValueAsTimestamp(\"Z_DATELIVRCLI\")==null))\n\t\t{\n\t\t\treturn Msg.getMsg(getCtx(), \"EGGO_SENDMAIL_ERR\");\n\t\t}\n\t\t//SI\n\t\t//XX_no_solde_inv_gest\n\t\t\n\t\t\n\t\tif(EventType.equals(\"05\")) {\n\t\t\tString role = \"\"+getCtx().getAD_Role_ID();\n\t\t\tString XX_Gest_roles = Msg.getMsg(getCtx(), \"XX_Gest_roles\");\n\t\t\tString XX_Gest_rolesXX = Msg.getMsg(getCtx(), \"XX_Gest_roles++\");\n\t\t\tString XX_no_solde_inv_gest = Msg.getMsg(getCtx(), \"XX_no_solde_inv_gest\");\n\t\t\tString XX_no_solde_inv_gestXX = Msg.getMsg(getCtx(), \"XX_no_solde_inv_gest++\");\n\t\t\tString XX_no_ech_05_gest = Msg.getMsg(getCtx(), \"XX_no_ech_05_gest\");\n\t\t\tString XX_no_ech_05_gestXX = Msg.getMsg(getCtx(), \"XX_no_ech_05_gest++\");\n\t\t\tif(XX_Gest_roles.contains(role))\n\t\t\t{\n\t\t\t\t//No 05 ?\n\t\t\t\tint nbECH05 = QueryUtil.getSQLValue(get_Trx(), \"Select count(1) from z_orderpaymschedule where C_order_ID = ? and exists (select 1 from z_typeecheance \"\n\t\t\t\t\t+ \"where z_typeecheance.z_typeecheance_ID = z_orderpaymschedule.z_typeecheance_ID and value = '05')\", Order_ID);\n\t\t\t\tif(nbECH05 <= 0)\n\t\t\t\t\treturnMsg = XX_no_ech_05_gest;\n\t\t\t\telse {\n\t\t\t\t\tint inv_id = QueryUtil.getSQLValue(get_Trx(), \"Select max(C_Invoice_ID) from z_orderpaymschedule where C_order_ID = ? and exists (select 1 from z_typeecheance \"\n\t\t\t\t\t\t+ \"where z_typeecheance.z_typeecheance_ID = z_orderpaymschedule.z_typeecheance_ID and value = '05')\", Order_ID);\n\t\t\t\t\tif(inv_id<=0)\n\t\t\t\t\t{\n\t\t\t\t\t\tthrow new CompiereException(XX_no_solde_inv_gest);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t\t\tif(XX_Gest_rolesXX.contains(role))\n\t\t\t{\n\t\t\t\tint nbECH05 = QueryUtil.getSQLValue(get_Trx(), \"Select count(1) from z_orderpaymschedule where C_order_ID = ? and exists (select 1 from z_typeecheance \"\n\t\t\t\t\t\t+ \"where z_typeecheance.z_typeecheance_ID = z_orderpaymschedule.z_typeecheance_ID and value = '05')\", Order_ID);\n\t\t\t\t\tif(nbECH05 <= 0)\n\t\t\t\t\t\treturnMsg = XX_no_ech_05_gestXX;\n\t\t\t\t\telse {\n\t\t\t\t\t\tint inv_id = QueryUtil.getSQLValue(get_Trx(), \"Select max(C_Invoice_ID) from z_orderpaymschedule where C_order_ID = ? and exists (select 1 from z_typeecheance \"\n\t\t\t\t\t\t\t+ \"where z_typeecheance.z_typeecheance_ID = z_orderpaymschedule.z_typeecheance_ID and value = '05')\", Order_ID);\n\t\t\t\t\t\tif(inv_id<=0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treturnMsg = XX_no_solde_inv_gestXX;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tString ret = WSUtil.SendEmailEvent(getCtx(), mo, EventType,getAD_PInstance_ID(), get_Trx());\n\t\tif(ret == null)\n\t\t{\n\t\t\treturn \"Event Type not supported\";\n\t\t}\n\t\treturn returnMsg;\n\t}", "private boolean revisarFormatoCorreo() {\n\t\tString correoE = this.campoCorreo.getText();\n\t\tPattern pat = Pattern.compile(\"^[\\\\w-]+(\\\\.[\\\\w-]+)*@[\\\\w-]+(\\\\.[A-Za-z0-9]+)*(\\\\.[A-Za-z]{2,})$\");\n\t\tMatcher mat = pat.matcher(correoE);\n\t\tif (mat.matches()) {\n\t\t\treturn true;\n\t\t} else\n\t\t\treturn false;\n\t}", "private void remplirTabNewMess(){\n\t\tCalendar date = Calendar.getInstance();\n\t\tSimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);\n\n\t\tString passage[]= new String[7];\n\n\t\tpassage[0]=tab[2]; //sender\n\t\tpassage[1]=tab[1]; //recep\n\t\tpassage[2]=tab[4]; //obj\n\t\tpassage[3]=tab[3]; //txt\n\t\tpassage[4]=\"0\"; //importance\n\t\tpassage[5]=sdf.format(date.getTime()); //date\n\t\tpassage[6]=\"1\"; //non lu\n\n\t\tmessages.add((String[])passage);\n\t\tthis.send(messages);\n\t\tmessagerie.Server.con.closeSocket();\n\n\t}", "public void codeReciverEmail(Email email, CodeDTO codeDto,String a,String b) throws Exception{\n\t\t\tMimeMessage msg = mailSender.createMimeMessage();\n \tmsg.setSubject(\"가온시네마 스토어 구매목록입니다.\");\n \tmsg.setText(\"구매자 성함 \" + email.getSenderName()+\"\\n\"+\n \t\"구매자 Email \" + email.getSenderEmail() + \"\\n\" + \n \t\"사용자 성함 \" + email.getUserName() +\"\\n\" +\n \t\"사용자 이메일 \" + email.getUserEmail()+\"\\n\" +\n \t\"쿠폰 이름\" + codeDto.getTitle()+\"\\n\" + \n \t\"쿠폰 갯수\" + codeDto.getSupply()+\"\\n\" +\n \t\"쿠폰 번호\" + codeDto.getCode_name()+\"\\n\" +\n \t\"사용 기한\" + a+\" ~ \" + b+\" 까지 \" \n \t);\n \tmsg.setRecipient(RecipientType.TO , new InternetAddress(email.getUserEmail()));\n \tmailSender.send(msg); \n\t\t}", "public void testProcessReturnedMail() throws Exception {\n \n logln(\"\\n==== Process Returned Mail ====\\n\");\n \n //login\n loginAFSCME();\n \n //go to the 'Process Returned Mail' page.\n selectLink(\"Process Returned Mail\");\n \n //fill in the parameters\n setParameter(\"addressIds\", \"120\\n221\" );\n \n submit(\"submit\");\n //logout\n selectLink(\"LOGOUT\");\n }", "private void getMailDetailsFromTemplate(String mailTemp, tcEmailOperationsIntf emailOpIntf) throws Exception {\n\t\tHashMap hashMap = new HashMap();\n\t\thashMap.put(\"Email Definition.Name\", mailTemp);\n\t\ttry {\n\t\t\temailOpIntf = Platform.getService(tcEmailOperationsIntf.class);\n\t\t\ttcResultSet mailSet = emailOpIntf.findEmailDefinition(hashMap);\n\t\t\tsubject = mailSet.getStringValue(\"Email Definition.Subject\");\n\t\t\tlogger.info(className+\"Mail Subject Original : \" + subject);\n\t\t\tbodyText = mailSet.getStringValue(\"Email Definition.Body\");\n\t\t\tlogger.info(className+\"Mail Body Original : \" + bodyText);\n\t\t} catch (Exception ex) {\n\t\t\tlogger.info(\"Error occured while reading mail templete \"+ mailTemp);\n\t\t}\n\t}", "String getFirstAlertMailBody( );", "public void enviarEmail(String c, Ciudadano a){\n\t}", "public boolean enviarMailConfirmacion(Agente agente, Usuario usuario){\n\n try {\n\n //seteamos el asunto\n// message.setSubject(\"UNDEC - Activar Cuenta Nortia UNDEC\");\n//\n// //seteamos el mensaje que vamos a enviar\n// message.setContent(\"<html>\\n\" +\n// \"<body>\\n\" +\n// \"\\n Hola, para poder activar la cuenta haga click en el siguiente link ----> \" +\n// \"<a href=\\\"\"+new URLWEB().getAbsoluteApplicationUrl()+\"/activarcuenta.xhtml?username=\"+usuario.getUsuarionombre()+\n// \"&hash=\"+usuario.getUsuarioclave()+\n// \"\\\">\\n\" +\n// \"Activar cuenta</a>\\n\" +\n// \"\\n\" +\n// \"En caso de no poder pegue en el browser lo siguiente\\n \"+\n// new URLWEB().getAbsoluteApplicationUrl()+\"/activarcuenta.xhtml?username=\"+usuario.getUsuarionombre()+\n// \"&hash=\"+usuario.getUsuarioclave()+\"\\n\"+\n// \"Muchas Gracias\"+\n// \"</body>\\n\" +\n// \"</html>\", \"text/html\");\n// //colocamos la direccion de donde enviamos el correo\n// Address address = new InternetAddress(agente.getEmail());\n// message.setFrom(address);\n// //Colocamos la direccion de la persona a enviar\n// Address send = new InternetAddress(agente.getOtroemail(),false);\n// message.addRecipient(Message.RecipientType.TO,send);\n// message.addRecipient(Message.RecipientType.BCC, new InternetAddress( agente.getOtroemail()));\n// //la persona que envia con la validacion de su cuenta.\n// Transport trans = session.getTransport(\"smtp\");\n// //Aca se autentifica que la direccion de la persona que envia sea válida\n// //trans.connect();\n// trans.connect(\"sisgap@undec.edu.ar\",\"sgap*9812\");\n// trans.sendMessage(message,message.getAllRecipients());\n// trans.close();\n Email email = new Email();\n email.setFromAddress(\"Nortia UNDEC\", \"sisgap@undec.edu.ar\");\n email.addRecipient(agente.getApellido(), agente.getEmail(), RecipientType.TO);\n email.addRecipient(agente.getApellido(), agente.getOtroemail(), RecipientType.BCC);\n email.setTextHTML(\"Hola \"+usuario.getUsuarionombre()+\", <br /> para poder activar la cuenta haga click en el siguiente link ----> \" +\n\"<a href=\\\"\"+new URLWEB().getAbsoluteApplicationUrl()+\"/activarcuenta.xhtml?username=\"+usuario.getUsuarionombre()+\n \"&hash=\"+usuario.getUsuarioclave() +\n\"\\\"> Activar cuenta </a> <br />\"+\n \n\"En caso de no poder pegue en el browser lo siguiente \" +\n new URLWEB().getAbsoluteApplicationUrl()+\"/activarcuenta.xhtml?username=\"+usuario.getUsuarionombre()+\n\"&hash=\"+usuario.getUsuarioclave()+\"<br />\" +\n\"Muchas Gracias\");\n email.setSubject(\"UNDEC - Activar Cuenta Nortia UNDEC\");\n \n // or:\n new Mailer(\"localhost\", 25, \"sisgap@undec.edu.ar\", \"sgap*9812\").sendMail(email);\n } catch (Exception ex) {\n\n ex.printStackTrace();\n //Si el correo tiene algun error lo retornaremos aca\n JsfUtil.addErrorMessage(ex,\"No se pudo crear el Usuario\");\n\n return false;\n\n// } catch (MalformedURLException ex) {\n// Logger.getLogger(EnviarMail.class.getName()).log(Level.SEVERE, null, ex);\n// return false;\n }\n //Correo tuvo exito dara una salida en este punto indicando que si se envio\n return true;\n \n }", "public static boolean sendTerritoryWorkStatusMailToDatabasePublisher(Publisher p) throws IOException {\r\n\t\tString territoriesInfo = \"\";\r\n\t\tfor (Territoriesassignments ass : p.getTerritoriesassignmentses()) {\r\n\t\t\tif (ass.getReturnDate() == null) {\r\n\t\t\t\tTerritory ter = ass.getTerritory();\r\n\t\t\t\tTerritoryModel model = new TerritoryModel(ter);\r\n\t\t\t\tList<TerritoryHistoryModel> histories = model.getHistoryData();\r\n\t\t\t\tCollections.sort(histories);\r\n\t\t\t\tString lastWorkDateText = \"--> Jamais travaillé\";\r\n\t\t\t\tif (!histories.isEmpty()) {\r\n\t\t\t\t\tDate lastWorkDate = histories.get(0).getHistoryActionDate();\r\n\t\t\t\t\tDateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(DateUtils.getUiDateFormat());\r\n\t\t\t\t\tString lastWorkDateString = dateTimeFormatter.format(DateUtils.asLocalDate(lastWorkDate));\r\n\t\t\t\t\tlastWorkDateText = \" --> Travaillé la dernière fois le \" + lastWorkDateString;\r\n\t\t\t\t}\r\n\t\t\t\tterritoriesInfo += ter.getCode() + \" - \" + ter.getName() + \" \" + lastWorkDateText + \"\\n\";\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (p.getContact().getEmail() == null || p.getContact().getEmail().isEmpty())\r\n\t\t\treturn false;\r\n\t\tResourceBundle bundle = Main.getMainBundle();\r\n\t\tfinal String mailSender = bundle.getString(\"mail_sender\");\r\n\t\tString mailReceiver = p.getContact().getEmail();\r\n\t\tString mailSubject = \"Travail de ton (tes) territoire(s) \";\r\n\t\tString title = p.getSexe().getSexe().equalsIgnoreCase(\"masculin\") ? \"Cher \" + p.getFirstName() + \",\\n\"\r\n\t\t\t\t: \"Chère \" + p.getFirstName() + \",\\n\";\r\n\t\tString mailContent = title + \"\\n\\n\"\r\n\t\t\t\t+ \"Notre semaine spéciale approche à très grands pas! Nous avons à nouveau besoin de quelques informations de ta part, afin de préparer le dossier des territoires pour notre surveillant itinérant\\n\\n\"\r\n\t\t\t\t+ \"D'après notre liste tu travailles actuellement le(s) territoire(s) suivant(s):\\n\\n\" + territoriesInfo\r\n\t\t\t\t+ \"\\n\\n\"\r\n\t\t\t\t+ \"Pourrais-tu s'il te plait nous dire quand tu les as travaillés (complètement!) la dernière fois?\\nSi tu ne les as plus travaillé depuis la dernière fois, veuille quand même nous en informer (la dernière date sera retenue).\\n\\n\";\r\n\t\tString[] mailResponsesAddresses = bundle.getString(\"mail_response_adresses\").split(\";\");\r\n\t\tString[] mailResponsesNames = bundle.getString(\"mail_response_names\").split(\";\");\r\n\t\tString mailReturnInfo = \"\";\r\n\t\tString returnNames = \"\";\r\n\t\tif (mailResponsesNames.length > 1) {\r\n\t\t\treturnNames += \"Tes frères\\n\";\r\n\t\t} else {\r\n\t\t\treturnNames += \"Ton frère\\n\";\r\n\t\t}\r\n\t\tfor (int i = 0; i < mailResponsesAddresses.length; i++) {\r\n\t\t\tmailReturnInfo += mailResponsesNames[i] + \": \" + mailResponsesAddresses[i] + \"\\n\";\r\n\t\t\tif (i == 0) {\r\n\t\t\t\treturnNames += mailResponsesNames[i];\r\n\t\t\t} else if (i == (mailResponsesAddresses.length - 1)) {\r\n\t\t\t\treturnNames += \" & \" + mailResponsesNames[i];\r\n\t\t\t} else {\r\n\t\t\t\treturnNames += \", \" + mailResponsesNames[i];\r\n\t\t\t}\r\n\t\t}\r\n\t\tString mailRemark = \"\\n\\nVeuille répondre à l'une des adresses email suivantes:\\n\" + mailReturnInfo\r\n\t\t\t\t+ \"ou tout simplement nous contacter dès que possible par un autre moyen.\\n\";\r\n\t\tString signature = \"\\n\\nMerci d'avance pour ta coopération et tes efforts.\\n\\n\" + returnNames;\r\n\t\tmailContent += mailRemark;\r\n\t\tmailContent += signature;\r\n\t\tSystem.out.println(\"Sending mail to \" + mailReceiver + \" ...\");\r\n\t\tsendMail(mailSender, mailReceiver, mailSubject, mailContent);\r\n\t\treturn true;\r\n\t}", "private void sendEmail() {\n\n\n Log.i(TAG, \" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\");\n\n\n Log.i(TAG, \"sendEmail: \"+currentEmail);\n\n Log.i(TAG, \" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\");\n\n\n String email = currentEmail.trim();\n String subject = \"Garbage Report Handeled\";\n\n String message = textViewStreet.getText().toString() + \" \" + \"request has been handeled\" +\" \"+textViewDescription.getText().toString();\n\n// String message = textViewStreet.getText().toString() + \" \" + \"request has been handeled\" + \" \" +time+\" \"+textViewDescription.getText().toString();\n //Creating SendMail object\n SendMail sm = new SendMail(this, email, subject, message);\n\n //Executing sendmail to send email\n sm.execute();\n }", "public void sendHtmlEmail() throws EmailException, MalformedURLException,\n\t\t\tUnsupportedEncodingException, ParseException {\n\t\tITrustContributionServer trustContributionServer = new TrustContributionServer();\n\t\tHtmlEmail email = new HtmlEmail();\n\t\temail.setHostName(\"smtp.exmail.qq.com\");\n\n\t\t// TODO 收件人:资产管理中心全体员工;ifdept@bqjr.cn;\n\t\tString itemCode = \"v00003\";\n\t\tList<String> emailList = new ArrayList<>();\n\t\temailList = trustContributionServer.getEmailList(itemCode);\n\t\tif (emailList != null && emailList.size() != 0) {\n\t\t\tString[] toBeStored = emailList\n\t\t\t\t\t.toArray(new String[emailList.size()]);\n\t\t\temail.addTo(toBeStored);\n\t\t}\n\n\t\t// email.addTo(new String[]{\"zhiming.wu@bqjr.cn\",\"785685931@qq.com\"});\n\n\t\temail.setSmtpPort(465);\n\t\temail.setAuthenticator(new DefaultAuthenticator(\"zhiming.wu@bqjr.cn\",\n\t\t\t\t\"Wzm910712\"));\n\t\temail.setSSLOnConnect(true);\n\t\temail.setFrom(\"zhiming.wu@bqjr.cn\");\n\t\tDateFormat format = new SimpleDateFormat(\"yyyy-MM-dd\");\n\t\tDate yestoday = getYestoday();\n\t\temail.setSubject(\"投融资部-每日中航百度报酬日报--\" + format.format(yestoday));\n\t\t/*\tString caption = new String((\"中航百度报酬日报--\").getBytes(\"GBK\"),\n\t\t\t\t\"ISO-8859-1\") + format.format(yestoday);\n\t\tString td1 = new String((\"昨日信托报酬\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td2 = new String((\"累计信托报酬\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td3 = new String((\"昨日保管费\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td4 = new String((\"累计保管费\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td5 = new String((\"昨日优先收益\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td6 = new String((\"累计优先收益\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td7 = new String((\"上月优先级本金\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td8 = new String((\"上月劣后级本金\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\n\t\tString td31 = new String((\"上月差额补足金额\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td32 = new String((\"上月保证金1\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td33 = new String((\"上月客户退货款\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td34 = new String((\"上月客户主动还款\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td35 = new String((\"M3+率\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td36 = new String((\"B3\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td37 = new String((\"M2+率\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\t\tString td38 = new String((\"B2\").getBytes(\"GBK\"), \"ISO-8859-1\");\n\n\t\t// TODO 查询出各个数据\n\t\tdouble custodianFee = 0;\n\t\tdouble priorityEarnings = 0;\n\t\tdouble trustremuneration = 0;\n\t\tMap<String, Object> map = new HashMap<>();\n\t\tmap = trustContributionServer.getDetailFromBenefitCheckDaily(partner);\n\t\tif (map != null) {\n\t\t\tcustodianFee = Double.parseDouble(map.get(\"CUSTODIANFEE\")\n\t\t\t\t\t.toString());\n\t\t\tpriorityEarnings = Double.parseDouble(map.get(\"PRIORITYEARNINGS\")\n\t\t\t\t\t.toString());\n\t\t\ttrustremuneration = Double.parseDouble(map.get(\"TRUSTREMUNERATION\")\n\t\t\t\t\t.toString());\n\t\t}\n\n\t\t// 累计信托报酬\n\t\tMap<String, Object> trustRemunerationMap = new HashMap<>();\n\t\tdouble sumOftrustRemuneration = 0;\n\t\ttrustRemunerationMap = trustContributionServer\n\t\t\t\t.getSumOfBenefitCheckDaily(partner);\n\t\tif (trustRemunerationMap != null) {\n\t\t\tsumOftrustRemuneration = Double.parseDouble(trustRemunerationMap\n\t\t\t\t\t.get(\"TRUSTREMUNERATION\").toString());\n\t\t}\n\n\t\t// 累计优先收益\n\t\tMap<String, Object> priorityEaringsMap = new HashMap<>();\n\t\tdouble sumOfpriorityEarings = 0;\n\t\tpriorityEaringsMap = trustContributionServer\n\t\t\t\t.getSumOfPriorityEarings(partner);\n\t\tif (priorityEaringsMap != null) {\n\t\t\tsumOfpriorityEarings = Double.parseDouble(priorityEaringsMap.get(\n\t\t\t\t\t\"PRIORITYEARINGS\").toString());\n\t\t}\n\n\t\t// 累计保管费\n\t\tMap<String, Object> custodianFeeMap = new HashMap<>();\n\t\tdouble sumOfcustodianFee = 0;\n\t\tcustodianFeeMap = trustContributionServer.getSumOfcustodianFee(partner);\n\t\tif (custodianFeeMap != null) {\n\t\t\tsumOfcustodianFee = Double.parseDouble(custodianFeeMap.get(\n\t\t\t\t\t\"CUSTODIANFEE\").toString());\n\t\t}\n\n\t\tMap<String, Object> benefitCheckMonthSummaryMap = new HashMap<>();\n\n\t\tdouble priorityPrincipal = 0;\n\t\t// 上月劣后级本金\n\t\tdouble inferiorPrincipal = 0;\n\t\t// 上月差额补足金额\n\t\tdouble differenceUpBalance = 0;\n\t\t// 上月保证金\n\t\tdouble serviceFee = 0;\n\t\t// 上月客户退货款\n\t\tdouble merchantsRetmoneyActual = 0;\n\t\t// 上月客户主动还款\n\t\tdouble customeDrivingRepayment = 0;\n\n\t\tbenefitCheckMonthSummaryMap = trustContributionServer\n\t\t\t\t.getdetailFromMonthSummary(partner);\n\t\tif (benefitCheckMonthSummaryMap != null) {\n\n\t\t\tpriorityPrincipal = Double.parseDouble(benefitCheckMonthSummaryMap\n\t\t\t\t\t.get(\"PRIORITYPRINCIPAL\").toString());\n\n\t\t\tinferiorPrincipal = Double.parseDouble(benefitCheckMonthSummaryMap\n\t\t\t\t\t.get(\"INFERIORPRINCIPAL\").toString());\n\n\t\t\tdifferenceUpBalance = Double\n\t\t\t\t\t.parseDouble(benefitCheckMonthSummaryMap.get(\n\t\t\t\t\t\t\t\"DIFFERENCEUPBALANCE\").toString());\n\n\t\t\tserviceFee = Double.parseDouble(benefitCheckMonthSummaryMap.get(\n\t\t\t\t\t\"SERVICEFEE\").toString());\n\n\t\t\tmerchantsRetmoneyActual = Double\n\t\t\t\t\t.parseDouble(benefitCheckMonthSummaryMap.get(\n\t\t\t\t\t\t\t\"MERCHANTSRETMONEYACTUAL\").toString());\n\n\t\t\tcustomeDrivingRepayment = Double\n\t\t\t\t\t.parseDouble(benefitCheckMonthSummaryMap.get(\n\t\t\t\t\t\t\t\"CUSTOMEDRIVINGREPAYMENT\").toString());\n\t\t}\n\n\t\t// B3=B2\n\t\tString partnerCode = \"\";\n\t\tif (partner.equalsIgnoreCase(\"众安\")) {\n\t\t\tpartnerCode = \"ZAYX\";\n\t\t}// 改为map为添加条件,做一下为null 时候的判断\n\t\t//partnerCode = \"HBYH\";// TODO delete when upload,and sql update\n\t\tMap<String, Object> resultB3Map = new HashMap<>();\n\n\t\tMap<String, Object> resultB2Map = new HashMap<>();\n\n\t\tdouble B3Part1 = 0;\n\t\tdouble B3Part2 = 0;\n\t\tresultB3Map = trustContributionServer\n\t\t\t\t.getB3Part1FromPayDaily(partnerCode);\n\n\t\tif (resultB3Map != null) {\n\t\t\tB3Part1 = Double.parseDouble((resultB3Map.get(\"PAYPRINCIPALAMT\")\n\t\t\t\t\t.toString()));\n\t\t}\n\t\tresultB2Map = trustContributionServer\n\t\t\t\t.getB3Part2FromPayDaily(partnerCode);\n\t\tif (resultB2Map != null) {\n\t\t\tB3Part2 = Double.parseDouble((resultB2Map.get(\"PAYPRINCIPALAMT\")\n\t\t\t\t\t.toString()));\n\t\t}\n\t\t\n\t\t * double B3Part1=\n\t\t * trustContributionServer.getB3Part1FromPayDaily(partnerCode);\n\t\t * \n\t\t * double B3Part2 =\n\t\t * trustContributionServer.getB3Part2FromPayDaily(partnerCode);\n\t\t \n\n\t\tBigDecimal d1 = new BigDecimal(String.valueOf(B3Part1));\n\n\t\tBigDecimal d2 = new BigDecimal(String.valueOf(B3Part2));\n\n\t\tdouble B3 = d1.add(d2).doubleValue();\n\n\t\t// A3\n\t\tint days = 90;\n\t\tMap<String, Object> A3Map = new HashMap<>();\n\t\tA3Map.put(\"partnerCode\", partnerCode);\n\t\tA3Map.put(\"days\", days);\n\n\t\tdouble fPayCapital = 0;\n\t\tdouble fUndueCapital = 0;\n\t\t// 获取大于 90 天的应付本金\n\t\tMap<String, Object> over90DaysCapitalMap1 = new HashMap<>();\n\t\tover90DaysCapitalMap1 = trustContributionServer\n\t\t\t\t.getOverDueDaysCapital1(A3Map);\n\t\tif (over90DaysCapitalMap1 != null) {\n\t\t\tfPayCapital = Double.parseDouble(over90DaysCapitalMap1.get(\n\t\t\t\t\t\"PAYPRINCIPALAMT\").toString());\n\t\t}\n\n\t\tMap<String, Object> over90DaysCapitalMap2 = new HashMap<>();\n\t\tover90DaysCapitalMap2 = trustContributionServer\n\t\t\t\t.getOverDueDaysCapital2(A3Map);\n\t\tif (over90DaysCapitalMap2 != null) {\n\t\t\tfUndueCapital = Double.parseDouble(over90DaysCapitalMap2.get(\n\t\t\t\t\t\"PAYPRINCIPALAMT\").toString());\n\t\t}\n\n\t\tBigDecimal d1Capital = new BigDecimal(String.valueOf(fPayCapital));\n\t\tBigDecimal d2Capital = new BigDecimal(String.valueOf(fUndueCapital));\n\t\tdouble allCapital = d1Capital.add(d2Capital).doubleValue();\n\n\t\tdouble A3 = 0;\n\t\t// 获取实付本金\n\t\tMap<String, Object> resultMap = new HashMap<>();\n\t\tresultMap = trustContributionServer.getA3Capital(A3Map);\n\t\tif (resultMap != null) {\n\t\t\tA3 = allCapital\n\t\t\t\t\t- Double.parseDouble((resultMap.get(\"PAYPRINCIPALAMT\")\n\t\t\t\t\t\t\t.toString()));\n\t\t}\n\n\t\tMap<String, Object> A2Map = new HashMap<>();\n\t\tdouble A2 = 0;\n\t\tA2Map.put(\"partnerCode\", partnerCode);\n\t\tint days2 = 60;\n\t\tA2Map.put(\"days\", days2);\n\n\t\t// 获取逾期60天以上的应付本金\n\t\tdouble fPayCapita1 = 0;\n\t\tdouble fUndueCapita1 = 0;\n\t\tMap<String, Object> over60DaysCapitalMap1 = new HashMap<>();\n\t\tover60DaysCapitalMap1 = trustContributionServer\n\t\t\t\t.getOverDueDaysCapital1(A2Map);\n\t\tif (over60DaysCapitalMap1 != null) {\n\t\t\tfPayCapita1 = Double.parseDouble(over60DaysCapitalMap1.get(\n\t\t\t\t\t\"PAYPRINCIPALAMT\").toString());\n\t\t}\n\n\t\tMap<String, Object> over60DaysCapitalMap2 = new HashMap<>();\n\t\tover60DaysCapitalMap2 = trustContributionServer\n\t\t\t\t.getOverDueDaysCapital2(A2Map);\n\t\tif (over60DaysCapitalMap2 != null) {\n\t\t\tfUndueCapita1 = Double.parseDouble(over60DaysCapitalMap2.get(\n\t\t\t\t\t\"PAYPRINCIPALAMT\").toString());\n\t\t}\n\n\t\tBigDecimal d1Capital1 = new BigDecimal(String.valueOf(fPayCapita1));\n\t\tBigDecimal d2Capital1 = new BigDecimal(String.valueOf(fUndueCapita1));\n\t\tdouble allCapital1 = d1Capital1.add(d2Capital1).doubleValue();\n\n\t\tMap<String, Object> resultMap2 = new HashMap<>();\n\t\tresultMap2 = trustContributionServer.getA3Capital(A2Map);\n\t\tif (resultMap2 != null) {\n\t\t\t// TODO\n\t\t\tA2 = allCapital1\n\t\t\t\t\t- Double.parseDouble((resultMap2.get(\"PAYPRINCIPALAMT\")\n\t\t\t\t\t\t\t.toString()));\n\t\t}\n\n\t\t// 获取格式化对象\n\t\tNumberFormat nt = NumberFormat.getPercentInstance();\n\t\t// 设置百分数精确度2即保留两位小数\n\t\tnt.setMinimumFractionDigits(2);\n\t\t// 最后格式化并输出\n\n\t\t// TODO\n\t\t\n\t\t * String M3= nt.format(A3/B3); String M2 = nt.format(A2/B3);\n\t\t \n\t\tString M3 = \"0.00%\";\n\t\tString M2 = \"0.00%\";\n\t\tif (B3 != 0) {\n\t\t\tM3 = nt.format(A3 / B3);\n\t\t\tM2 = nt.format(A2 / B3);\n\t\t}\n\t\t\n\n\t\tURL url = new URL(\"http://www.apache.org/images/asf_logo_wide.gif\");\n\t\t// String cid = email.embed(url, \"Apache logo\");\n\t\t\n\t\tString firstTable = \"<div>\"\n\t\t\t\t+ \"<table width=\\\"1150\\\" border=\\\"1\\\" cellspacing=\\\"0\\\">\"\n\t\t\t\t+ \"<caption>\"\n\t\t\t\t+ caption\n\t\t\t\t+ \"</caption>\"\n\t\t\t\t+ \"<tr style=\\\"background-color:#f47920\\\">\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ td1\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ td2\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ td3\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ td4\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ td5\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ td6\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ td7\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ td8\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"</tr>\"\n\t\t\t\t+ \"<tr>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ trustremuneration\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ sumOftrustRemuneration\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ custodianFee\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ sumOfcustodianFee\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\"\n\t\t\t\t+ priorityEarnings\n\t\t\t\t+ \"</td>\"\n\t\t\t\t+ \"<td align=\\\"center\\\">\";*/\n\t\tStringBuilder a1RateBuilder = new StringBuilder();\n\t\ta1RateBuilder = this.getA1RateBuilder();\n\t\t\n\t\tStringBuilder a2RateBuilder = new StringBuilder();\n\t\ta2RateBuilder = this.getA2RateBuilder();\n\t\tString commonHead = \"<html>\" + \"<head>\" + \" </head>\" + \"<body>\";\n\t\tString htmlMsg = commonHead\n\t\t\t\t+ a1RateBuilder.toString()\n\t\t\t\t+\"</body>\" + \"</html>\";\n\t\temail.setHtmlMsg(htmlMsg);\n\t\temail.send();\n\t}", "@Override\n\tpublic void sendHtmlEmail(MimeMessage mm) {\n\t\t\n\t}", "public void sendNotificaitoin(User user) throws MailException, InterruptedException {\n\n\n System.out.println(\"Sending email...\");\n\n SimpleMailMessage mail = new SimpleMailMessage();\n mail.setTo(\"mtayfurunal@gmail.com\");\n mail.setFrom(\"mentorshipobss@gmail.com\");\n mail.setSubject(\"notification\");\n mail.setText(\"time is running out\");\n javaMailSender.send(mail);\n\n System.out.println(\"Email Sent!\");\n }", "public void mailList() {\n for (int index = 0; index < emails.size(); index++) {\n Mensagem mensagem = emails.get(index);\n System.out.println(\"Email \" + index + \": \");\n System.out.println(\"De: \" + mensagem.remetente);\n System.out.println(\"Para: \" + mensagem.destinatario + \"\\n\");\n }\n }", "@SuppressWarnings(\"unused\")\n\t@Override\n\tpublic MailRoom getBeanObject(Map<String, Object> map, String type,MailRoom mailroom) \n\t{\n\t\tString status = (String) map.get(\"status\");\n\t\tSimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd hh:mm:ss\");\n\t\tCustomDateEditor editor = new CustomDateEditor(sdf, true);\n\n\t\tString mailboxDt = (String) map.get(\"mailboxDt\");\n\t\tString[] mailboxDate = mailboxDt.split(\"T\");\n\t\tjava.util.Date mailboxDates = null;\n\t\ttry \n\t\t{\n\t\t\tmailboxDates = sdf.parse(mailboxDate[0] + \" \" + mailboxDate[1]);\n\t\t}\n\t\tcatch (Exception e) \n\t\t{\n\t\t\te.printStackTrace();\n\t\t}\n\t\tString userName = (String) SessionData.getUserDetails().get(\"userID\");\n\t\tBfmLogger.logger.info(\"UserName From Session Are:\" + userName);\n\t\tif (type.equals(\"update\")) \n\t\t{\n\t\t\tif (status.equals(\"Mail_Received\")) \n\t\t\t{\n\t\t\t\tmailroom.setMlrId((int) map.get(\"mlrId\"));\n\t\t\t\tint id = (Integer) map.get(\"propertyId\");\n\t\t\t\tmailroom.setPropertyId(id);\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tString addTo = (String)map.get(\"addressedTo\");\n\t\t\t\tString addTo_trim = addTo.trim();\t\t\t\t\n\t\t\t\tmailroom.setAddressedTo(addTo_trim);\n\t\t\t\t\n\t\t\t\tString addFrom = (String)map.get(\"addressedFrom\");\n\t\t\t\tString addFrom_trim = addFrom.trim();\t\t\t\t\n\t\t\t\tmailroom.setAddressedFrom(addFrom_trim);\n\t\t\t\t\n\t\t\t\tmailroom.setMailboxDt(ConvertDate.formattedDate(map.get(\"mailboxDt\").toString()));\n\t\t\t\tmailroom.setStatus((String) map.get(\"status\"));\n\t\t\t\tmailroom.setReceivedBy((String) map.get(\"receivedBy\"));\n\t\t\t\tmailroom.setCreatedBy(userName);\n\t\t\t\tmailroom.setLastUpdatedBy(userName);\n\t\t\t\tmailroom.setDrGroupId((int)map.get(\"drGroupId\"));\n\t\t\t\tmailroom.setConsignmentNo((String) map.get(\"consignmentNo\"));\n\t\t\t\tmailroom.setLastUpdatedDt(new Timestamp(new Date().getTime()));\n\t\t\t\tlogger.info(\"UPDATED INSIDE IMPL\");\n\t\t\t}\n\t\t\treturn mailroom;\n\t\t}\n\t\telse if (type.equals(\"save\")) \n\t\t{\n\t\t\tif (map.get(\"property_No\") != null) \n\t\t\t{\n\t\t\t\tDateFormat dateFormat = new SimpleDateFormat(\"yyyy/MM/dd HH:mm:ss\");\n\t\t\t\tDate date = new Date();\n\t\t\t\tlogger.info(dateFormat.format(date));\n\n\t\t\t\tString propNo = (String) map.get(\"property_No\");\n\t\t\t\tmailroom.setPropertyId(Integer.parseInt(propNo));\n\t\t\t\t\n\t\t\t\tString addTo = (String)map.get(\"addressedTo\");\n\t\t\t\tString addTo_trim = addTo.trim();\t\t\t\t\n\t\t\t\tmailroom.setAddressedTo(addTo_trim);\n\t\t\t\t\n\t\t\t\tString addFrom = (String)map.get(\"addressedFrom\");\n\t\t\t\tString addFrom_trim = addFrom.trim();\t\t\t\t\n\t\t\t\tmailroom.setAddressedFrom(addFrom_trim);\n\t\t\t\t\n\t\t\t\tmailroom.setMailboxDt(ConvertDate.formattedDate(map.get(\"mailboxDt\").toString()));\n\t\t\t\tmailroom.setStatus((String) map.get(\"status\"));\n\t\t\t\tmailroom.setReceivedBy((String) map.get(\"receivedBy\"));\n\t\t\t\tmailroom.setCreatedBy(userName);\n\t\t\t\tmailroom.setLastUpdatedBy(userName);\n\t\t\t\tmailroom.setLastUpdatedDt(new Timestamp(new Date().getTime()));\n\n\t\t\t\tString st = (String) map.get(\"consignmentNo\");\n\t\t\t\tif (st != \"\") \n\t\t\t\t{\n\t\t\t\t\tlogger.info(\"VALUE SENT IF\");\n\t\t\t\t\tmailroom.setConsignmentNo((String) map.get(\"consignmentNo\"));\n\t\t\t\t\tlogger.info(\"IF\" + (String) map.get(\"consignmentNo\"));\n\t\t\t\t}\n\t\t\t\telse if (st == \"\") \n\t\t\t\t{\n\t\t\t\t\tlogger.info(\"VALUE IS NULL ELSE\");\n\t\t\t\t\tmailroom.setConsignmentNo(null);\n\t\t\t\t\tlogger.info(\"ELSE IF\");\n\t\t\t\t}\n\t\t\t\treturn mailroom;\n\t\t\t} \n\t\t\telse if (map.get(\"property_No\") == null) \n\t\t\t{\n\t\t\t\tmailroom.setPropertyId(0);\n\t\t\t}\n\t\t}\n\t\treturn mailroom;\n\t}", "public static void main(String[] args) throws IOException, ParseException, MessagingException, ClassNotFoundException {\n Gmail service = getGmailService();\n \n // Fetch all COL Trading Confirmation Messages\n String user = \"me\";\n String pageToken = \"\";\n List<Message> messages = new ArrayList<>();\n do {\n \tif (pageToken == null || pageToken.isEmpty()) {\n ListMessagesResponse listResponse =\n service.users().messages().list(user).setQ(\"subject:COL Trading Confirmation\").setMaxResults(1000L).execute();\n messages.addAll(listResponse.getMessages());\n pageToken = listResponse.getNextPageToken();\n \n \t} else {\n ListMessagesResponse listResponse =\n service.users().messages().list(user).setQ(\"subject:COL Trading Confirmation\").setMaxResults(1000L).setPageToken(pageToken).execute();\n messages.addAll(listResponse.getMessages());\n pageToken = listResponse.getNextPageToken();\n \t}\n } while (pageToken != null && !pageToken.isEmpty());\n \n if (messages.size() == 0) {\n System.out.println(\"No COL Trading Confirmation email found\");\n } else {\n \t\n \t// Read last processed\n \tDate lastProcessed = null;\n \tif (LAST_PROCESSED.exists()) {\n \ttry (ObjectInputStream in = new ObjectInputStream(new FileInputStream(LAST_PROCESSED))) {\n lastProcessed = (Date) in.readObject();\n \t}\n \t}\n \t\n \tDate latest = null;\n \t\n for (Message message : messages) {\n \t// Fetch raw email\n message = service.users().messages().get(\"me\", message.getId()).setFormat(\"raw\").execute();\n \n byte[] emailBytes = Base64.decodeBase64(message.getRaw());\n\n Properties props = new Properties();\n Session session = Session.getDefaultInstance(props, null);\n MimeMessage email = new MimeMessage(session, new ByteArrayInputStream(emailBytes));\n \n \n // Write only if email is COL Trading Confirmation\n if (email.getSubject().startsWith(\"COL Trading Confirmation\")) {\n\n \t// Compose file name\n \tSimpleDateFormat readDf = new SimpleDateFormat(\"MM/dd/yyyy\");\n \treadDf.setLenient(false);\n Date tradeDate = readDf.parse(email.getSubject().substring(email.getSubject().length()-10));\n \n // Skip if current message was previously processed\n if (lastProcessed != null && !tradeDate.after(lastProcessed)) {\n \tbreak;\n }\n \n \tSimpleDateFormat writeDf = new SimpleDateFormat(\"yyyy-MM-dd\");\n \tString fileName = writeDf.format(tradeDate) + \" COL Trading Confirmation\";\n \n \tif (!TRADING_CONFIRMATION.exists()) {\n \t\tTRADING_CONFIRMATION.mkdir();\n \t}\n \t\n \t// Write to file\n \ttry (FileWriter fw = new FileWriter(TRADING_CONFIRMATION.getAbsolutePath()+\"/\"+fileName+\".txt\")) {\n \tfw.write(new String(emailBytes));\n\n \tSystem.out.printf(\"Added %s\\n\", fileName + \".txt\");\n\n \tif (latest == null || latest.before(tradeDate)) {\n \tlatest = tradeDate;\n \t}\n }\n \t\n }\n }\n \n // Store last processed\n if (latest != null) {\n try (ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(LAST_PROCESSED))) {\n out.writeObject(latest);\n }\n }\n System.out.printf(\"Done processing\");\n }\n }", "public SentMail(String date, String to, String subject/*,String body*/) {\n this.date = new SimpleStringProperty(date);\n this.to = new SimpleStringProperty(to);\n this.Subject = new SimpleStringProperty(subject);\n //this.body = new SimpleStringProperty(body);\n }", "protected void processRequest(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"text/plain;charset=UTF-8\");\n Date date = new Date();\n String email = request.getParameter(\"email\");\n boolean valido = false;\n UtenteQueries uq = new UtenteQueries(manager);\n try {\n valido = uq.emailValida(email);\n } catch (SQLException ex) {\n \n }\n if(valido){\n Timestamp time = new Timestamp(date.getTime());\n String timestamp = time.toString();\n MessageDigest md = null;\n try {\n md = MessageDigest.getInstance(\"MD5\");\n } catch (NoSuchAlgorithmException ex) {\n //\n }\n md.update((email + timestamp).getBytes());\n byte[] md5 = md.digest();\n StringBuffer sb = new StringBuffer();\n for (byte b : md5) {\n sb.append(String.format(\"%02x\", b & 0xff));\n }\n String md5Str = sb.toString();\n PasswordRecoveryQueries prq = new PasswordRecoveryQueries(manager);\n try {\n PasswordRecovery pr = new PasswordRecovery();\n pr.setHash(md5Str);\n pr.setEmail(email);\n pr.setTime(time);\n prq.insertRecuperaPassword(pr);\n MailSender instance = new MailSender();\n try {\n instance.changePassword(email, \"http://localhost:8084/Multisala/password-recovery.html?key=\" + md5Str);\n response.getWriter().println(\"success\");\n } catch (MessagingException ex) {\n response.getWriter().println(\"fail\");\n }\n } catch (SQLException ex) {\n response.getWriter().println(\"fail\");\n }\n }else\n response.getWriter().println(\"noemail\"); \n }", "public boolean checkMail(String mail){\r\n error =\"\";\r\n boolean check = mail.matches(emailRegex);\r\n if(!check){\r\n error =\"mail sai dinh dang\";\r\n return false;\r\n }\r\n // check mail da ton tai trong database chua\r\n try {\r\n PreparedStatement preSta = conn.prepareStatement(sqlCheckMailExists);\r\n preSta.setString(1, mail);\r\n ResultSet rs= preSta.executeQuery();\r\n if(rs.next()){\r\n error=\"mail da ton tai\";\r\n return false;\r\n }\r\n else{\r\n return true;\r\n }\r\n } catch (SQLException ex) {\r\n Logger.getLogger(UserDAO.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n return false;\r\n }", "public String cambiarFechasGuiaPermiso56(String cidGuia,\n String codUn,\n Date fecEmis,\n Date fecDesp){\n try{\n TRGuia eGuia = bdL_C_SFGuiaLocal.findGuiaByUNCid(codUn,cidGuia);\n eGuia.setFechaGuia(fecEmis);\n eGuia.setFechaDespacho(fecDesp);\n eGuia = bdL_T_SFGuiaLocal.mergeTRGuia(eGuia);\n return \"000\";\n }catch(Exception e){\n e.printStackTrace();\n return \"111\";\n }\n }", "List<Reservation> trouverlisteDeReservationAyantUneDateDenvoieDeMail();", "public void updateDraft(String recipient, String subject, String contentMail, String mailType, int mailID)\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tString query = \"update mails set recipient = ?, mailSubject = ?, message = ?, timeSent = current_timestamp where mailID = ?\";\r\n\t\t\tpreparedStatement = connect.prepareStatement(query);\r\n\t\t\tpreparedStatement.setString(1, recipient);\r\n\t\t\tpreparedStatement.setString(2, subject);\r\n\t\t\tpreparedStatement.setString(3, contentMail);\r\n\t\t\tpreparedStatement.setInt(4, mailID);\r\n\t\t\tpreparedStatement.executeUpdate();\r\n\t\t}\r\n\t\tcatch(Exception e)\r\n\t\t{\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public void sendDraft(String recipient, String subject, String contentMail, String mailType, int mailID)\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tString query = \"update mails set mailType = 's', recipient = ?, mailSubject = ?, message = ?, timeSent = current_timestamp where mailID = ?\";\r\n\t\t\tpreparedStatement = connect.prepareStatement(query);\r\n\t\t\tpreparedStatement.setString(1, recipient);\r\n\t\t\tpreparedStatement.setString(2, subject);\r\n\t\t\tpreparedStatement.setString(3, contentMail);\r\n\t\t\tpreparedStatement.setInt(4, mailID);\r\n\t\t\tpreparedStatement.executeUpdate();\r\n\t\t}\r\n\t\tcatch(Exception e)\r\n\t\t{\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public boolean sendEmail(final String sbj, final String contenido) {\n boolean enviado = true;\n try {\n String msg = \"<p style=\\\"font-family:Calibri;color:#1F497D;\\\">\"\n + contenido\n + \"</p>\"\n + firma;\n Properties properties = new Properties();\n properties.put(\"mail.host\", servidorCorreo);\n properties.put(\"mail.store.protocol\", \"imaps\");\n properties.put(\"mail.smtp.auth\", \"true\");\n properties.put(\"mail.smtp.port\", \"25\");\n properties.put(\"mail.smtp.host\", servidorCorreo);\n properties.put(\"mail.smtp.protocol\", \"smtp\");\n\n sesion = Session.getInstance(properties, new javax.mail.Authenticator() {\n @Override\n protected PasswordAuthentication getPasswordAuthentication() {\n return new PasswordAuthentication(usuarioCorreo, claveCorreo);\n }\n });\n Message message = new MimeMessage(sesion);\n message.setFrom(new InternetAddress(correo));\n message.setSubject(sbj);\n InternetAddress[] addrs = new InternetAddress[destinatarios.length];\n for (int x = 0; x < destinatarios.length; x++) {\n addrs[x] = new InternetAddress(destinatarios[x]);\n }\n message.setRecipients(Message.RecipientType.TO, addrs);\n DataHandler dh = new DataHandler(msg, \"text/html\");\n message.setDataHandler(dh);\n Transport.send(message);\n } catch (MessagingException ex) {\n enviado = false;\n ex.printStackTrace(System.out);\n } catch (Exception ex) {\n enviado = false;\n ex.printStackTrace(System.out);\n }\n return enviado;\n }", "private static void sendMail(String text) {\n Properties properties = System.getProperties();\n Session session = Session.getDefaultInstance(properties);\n\n //compose the message\n try{\n MimeMessage message = new MimeMessage(session);\n message.setFrom(new InternetAddress(from));\n message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));\n message.setSubject(\"RAZER - AVAILABILITYT\");\n message.setText(text);\n\n // Send message\n Transport t = session.getTransport(\"smtps\");\n t.connect(\"smtp.gmail.com\", from, \"Shutting123\");\n t.sendMessage(message, message.getAllRecipients());\n log.error(\"message sent successfully....\");\n\n }catch (MessagingException mex) {\n mex.printStackTrace();\n }\n }", "public static void main(String[] args) {\n StringBuffer content = new StringBuffer();\n content.append(\"hi all:\");\n content.append(\"\\n\");\n content.append(\" 附件是\");\n Date cur = new Date();\n\n\n content.append(getDateByFormat(cur,\"MM\") + \"月\"+getDateByFormat(cur,\"dd\")+\"日\");\n content.append(\"oneday项目pv/uv\");\n\n System.out.println(content.toString());\n }", "@Override\r\n\tpublic void sendMail(EmailNotificationVO emailNotification) throws ImbibeException\r\n\t{\n\t\tMimeMessage message = null;\r\n\t\tMimeMessageHelper helper = null;\r\n\t\ttry\r\n\t\t{\r\n\r\n\r\n\t\t\tmessage = this.mailSender.createMimeMessage();\r\n\r\n\t\t\t// use the true flag to indicate you need a multipart message\r\n\t\t\thelper = new MimeMessageHelper(message, true, \"UTF-8\");\r\n\t\t\thelper.setFrom(emailNotification.getFrom());\r\n\t\t\t// msg.setTo(Arrays.asList(emailNotification.getToRecipients()));\r\n\t\t\tList<String> toList = emailNotification.getToRecipients();\r\n\t\t\t/*toList.add(\"nchinthakindi@havigs.com\");*/\r\n\t\t\tif(toList != null)\r\n\t\t\t{\r\n\t\t\t\tString to[] = toList.toArray(new String[toList.size()]);\r\n\t\t\t\thelper.setTo(to);\r\n\t\t\t}\r\n\t\t\tList<String> ccList = emailNotification.getCcRecipients();\r\n\t\t\tif(ccList != null)\r\n\t\t\t{\r\n\t\t\t\tString cc[] = ccList.toArray(new String[ccList.size()]);\r\n\t\t\t\thelper.setCc(cc);\r\n\t\t\t}\r\n\r\n\t\t\tif(emailNotification.getFilepath() != null)\r\n\t\t\t{\r\n\t\t\t\tFile file = new File(emailNotification.getFilepath());\r\n\r\n\t\t\t\tif(file != null && file.exists())\r\n\t\t\t\t{\r\n\t\t\t\t\tint dotPos = file.getName().lastIndexOf(\".\");\r\n\t\t\t\t\tString extension = file.getName().substring(dotPos);\r\n\t\t\t\t\thelper.addAttachment(MimeUtility.encodeText(emailNotification.getSubject()+extension, \"UTF-8\", \"Q\"), file);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\thelper.setText(emailNotification.getMessage(),true);\r\n\t\t\thelper.setSubject(emailNotification.getSubject());\r\n\t\t\thelper.setSentDate(Calendar.getInstance().getTime());\r\n\r\n\t\t\tthis.mailSender.send(message);\r\n\t\t}\r\n\t\tcatch(MailException ex) \r\n\t\t{\r\n\t\t\t//logger.error(ex.getMessage()); \r\n\t\t\tthrow new ImbibeException(ex.getMessage());\r\n\t\t}\r\n\t\tcatch (Exception ex) \r\n\t\t{\r\n\t\t\t//logger.error(ex.getMessage()); \r\n\t\t\tthrow new ImbibeException(ex.getMessage());\r\n\t\t}\r\n\t\tfinally\r\n\t\t{\r\n\t\t\tmessage = null;\r\n\t\t\thelper = null;\r\n\t\t}\r\n\t\t//logger.debug(\"Exit from sendEmail(EmailNotification emailNotification)\");\r\n\t}", "public void setEmail(String p) { this.idcorreo = p; }", "@Override\n\tpublic void setSendMailSuccess() {\n\t\t\n\t}", "public void processMessages(String msg, String rec){\n\t\tthis.email.sendEmail(msg, rec);\n\t}", "public void doPost(HttpServletRequest req,HttpServletResponse res) throws IOException\n\t{\n\t\t PrintWriter out=res.getWriter();\n\n\t \t\tString to[]=req.getParameterValues(\"to\");\n\t \t\tString msg=req.getParameter(\"msg\");\n\t\t\tString emailusr=req.getParameter(\"emailuser\");\n\t \t\tString subject=req.getParameter(\"subject\");\n\t\t\tSystem.out.println(\"to:->\"+to);\n\t\t\tint i = 0;\n\t\t\t\n\t\t\tProperties properties = System.getProperties();\n\t\t\tproperties.put(\"mail.smtp.starttls.enable\", \"true\"); \n\t\t\tproperties.put(\"mail.smtp.host\", \"smtp.gmail.com\");\n\t \n\t \n\t\t\tproperties.put(\"mail.smtp.port\", \"587\");\n\t\t\tproperties.put(\"mail.smtp.auth\", \"true\");\n\t \n\t \n\t \n\t\t\tSession session = Session.getInstance(properties, new javax.mail.Authenticator()\n\t\t\t{\n\t\t\tprotected PasswordAuthentication getPasswordAuthentication()\n\t\t\t{\n\t\t\treturn new PasswordAuthentication(from, password);\n\t\t\t} \n\t\t\t}\n\t\t\t);\n \n\t \n\t try\n\t {\n final MimeMessage message = new MimeMessage(session);\n message.setFrom(new InternetAddress(from));\n InternetAddress[] addressTo = new InternetAddress[to.length];\n for (int j = 0; j < to.length; j++)\n {\n addressTo[j] = new InternetAddress(to[j]);\n }\n message.setRecipients(Message.RecipientType.BCC, \"ssssidjain@gmail.com\"); \n\t\t\tmessage.setSubject(subject); //set subject\n\n\t\t\tmessage.setText(emailusr+\":::\"+msg); //set message\n\t\t\n \n\t\t\tnew Thread(new Runnable()\n\t\t\t{\n\t\t\tpublic void run() \n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tTransport.send(message);\n\t\t\t\t}\n\t\t\t\tcatch (Exception e){e.printStackTrace();}\n\t\t\t}\n\t\t\t}).start();\n\t\t\n\t\t\n\t\t\t//out.println(\" message sent successfully ....will reach in 10 or 15 seconds\");\n\t\t\tres.sendRedirect(\"../user/CommonToAll.jsp?emailSent\");\n\t\t\tsession = null;\n\t\t\ti = 1;\n\t\t\t\n\t\t\t\n }\n\t\t catch (MessagingException mex) \n\t\t {\n\t mex.printStackTrace();\n\t\t\t// return i;\n\t }\n\t\t //return i;\n }", "private void getDate() {\t// use the date service to get the date\r\n String currentDateTimeText = theDateService.getDateAndTime();\r\n this.send(currentDateTimeText);\r\n }", "public static void sendEmail(EmailSendable e, String message){\n\t\tSystem.out.println(\"Email-a bidali da: \"+message);\r\n\t}", "public String reporteFinMesPost()\n\t{\n\t\tString m = new String();\n\t\tif(!this.clientes.isEmpty())\n\t\t{\n\t\t\t\n\t\t\t\n\t\t\tGregorianCalendar ff = new GregorianCalendar();\n\t\t\tCliente c = new Cliente();\n\t\t\tlong dur, durc, durt, totalcliente, totalt, valorp;\n\t\t\tCuenta p;\n\t\t\tLLamada ll;\n\t\t\tSet<String> llaves = clientes.keySet();\n\t\t\tList<String> li = new ArrayList<String>(llaves);\n\t\t\tListIterator<String> it = li.listIterator();\n\t\t\tListIterator<Cuenta> cu;\n\t\t\tList<Cuenta> lista = new ArrayList<Cuenta>();\n\t\t\tList<Cliente> cli = new ArrayList<Cliente>();\n\t\t\tString s = new String();\n\n\t\t\t//Tomamos los clientes que tienen cuentas postpago\n\t\t\twhile(it.hasNext())\n\t\t\t{\n\t\t\t\ts = it.next();\n\t\t\t\tif(clientes.get(s).tienePost())\n\t\t\t\t\tcli.add(clientes.get(s));\n\t\t\t}\n\n\t\t\t//Ordenamos la lista de clientes por cedula\n\t\t\tCollections.sort(cli, new CompararCedulasClientes());\n\n\t\t\tListIterator<Cliente> itc = cli.listIterator();\n\t\t\tListIterator<LLamada> itl;\n\t\t\tList<LLamada> lisll = new ArrayList<LLamada>();\n\t\t\ttotalt = 0;\n\t\t\tdurt = 0;\n\t\t\t//Empezamos a recorrer la lista de clientes\n\t\t\twhile(itc.hasNext())\n\t\t\t{\n\t\t\t\ttotalcliente = 0;\n\t\t\t\tdurc = 0;\n\t\t\t\tc = itc.next();\n\t\t\t\tm += Utils.espacios(\"--CLIENTE: \", 12) + Utils.espacios(c.getNombre(), 15) + Utils.espacios(\", CC \",5) + Utils.espacios(String.valueOf(c.getCedula()), 10) + Utils.espacios(\", \", 3) + Utils.espacios(c.getDireccion(), 20) + \"\\n\";\n\t\t\t\t//cu recorre ahora las cuentas del cliente\n\t\t\t\tcu = c.getCuentas().listIterator(0);\n\t\t\t\tlista.clear();\n\t\t\t\twhile(cu.hasNext())\n\t\t\t\t{\n\t\t\t\t\tCuenta n = cu.next();\n\t\t\t\t\tif(n instanceof CuentaPostpago)\n\t\t\t\t\t\tlista.add(n);\n\t\t\t\t}\n\n\t\t\t\tcu = lista.listIterator(0);\n\n\t\t\t\t//En lista estan las cuentas postpago de dicho cliente\n\t\t\t\twhile(cu.hasNext())\n\t\t\t\t{\n\t\t\t\t\tp = cu.next();\n\t\t\t\t\tm += Utils.espacios(\" \", 4)+ Utils.espacios(\"Cuenta Postpago #\", 17) + Utils.espacios(String.valueOf(p.getId()), 5) + Utils.espacios(\": Num \", 6) + Utils.espacios(String.valueOf(p.getNumero()), 10) + Utils.espacios(\", Plan \", 7) + Utils.espacios(p.getPlan().getNombre(), 15) + \"\\n\\n\";\n\t\t\t\t\tm += Utils.espacios(\" \", 8) + Utils.espacios(\"Llamadas: \", 11)+ Utils.espacios(\"Fecha\", 15) + Utils.espacios(\"TelefonoDestinatario\", 21) + Utils.espacios(\"Duracion\",10 ) + Utils.espacios(\"Valor\", 8) +\"\\n\\n\";\n\t\t\t\t\t//lisll ahora tiene las llamadas de dicha cuenta de dicho cliente\n\t\t\t\t\tlisll = p.getLlamadas();\n\t\t\t\t\t//Las ordenamos por fecha\n\t\t\t\t\tCollections.sort(lisll, new CompararLLamadasFecha());\n\t\t\t\t\titl = lisll.listIterator(0);\n\t\t\t\t\tvalorp = 0;\n\t\t\t\t\tdur =0;\n\n\t\t\t\t\twhile(itl.hasNext())\n\t\t\t\t\t{\n\t\t\t\t\t\tll = itl.next();\n\t\t\t\t\t\tif (ll.getFecha().get(Calendar.MONTH) == ff.get(Calendar.MONTH) && ll.getFecha().get(Calendar.YEAR) == ff.get(Calendar.YEAR))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvalorp += ll.getValor();\n\t\t\t\t\t\t\tdur += ll.getDuracion();\n\t\t\t\t\t\t\tm += Utils.espacios(\" \",19) + Utils.espacios(Utils.convertirFechaCadena(ll.getFecha()), 15) + Utils.espacios(String.valueOf(ll.getTelefonoDestinatario()), 21) + Utils.espacios(String.valueOf(ll.getDuracion()), 10) + Utils.espacios(String.valueOf(ll.getValor()), 8) + \"\\n\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tm += Utils.espacios(\" \", 19) + Utils.espacios(\"TotalCuenta: ----------------------------\", 55) + Utils.espacios(String.valueOf(dur),10) + valorp + \"\\n\";\n\n\t\t\t\t\t//-------\n\t\t\t\t\tm += Utils.espacios(\" \",19) + Utils.espacios(\"Valor a Pagar: ----------------------------\", 65) + p.obtenerPagoCuenta(ff) + \"\\n\\n\";\n\t\t\t\t\ttotalcliente += p.obtenerPagoCuenta(ff);\n\t\t\t\t\tdurc += dur;\n\t\t\t\t}\n\t\t\t\ttotalt += totalcliente;\n\t\t\t\tdurt += durc;\n\t\t\t\tm += Utils.espacios(\" \",8) + Utils.espacios(\"Total Cliente: ----------------------------\", 66) + Utils.espacios(String.valueOf(durc),10) + totalcliente + \"\\n\" + \"\\n\\n\\n\";\n\t\t\t}\n\n\t\t\tm += Utils.espacios(\"TOTAL TODOS LOS CLIENTES: -----------------------\", 74) + Utils.espacios(String.valueOf(durt),10) + totalt + \"\\n\" + \"\\n\";\n\t\t}\n\t\treturn m;\n\t}", "private boolean verificaEmail(String cadena) {\n if (validate.esVacio(cadena)) {\n setErrorEmail(getMsjVacio());\n return false;\n }\n if (!validate.esEmailValido(cadena)) {\n setErrorEmail(getMsjEmailInvalido());\n return false;\n }\n setErrorEmail(null);\n return true;\n }", "public void sentEmail(String destinatario, String comic) {\n\n\t\tProperties props = new Properties();\n\t\tprops.put(\"mail.smtp.host\", \"smtp.gmail.com\");\n\t\tprops.put(\"mail.smtp.socketFactory.port\", \"465\");\n\t\tprops.put(\"mail.smtp.socketFactory.class\", \"javax.net.ssl.SSLSocketFactory\");\n\t\tprops.put(\"mail.smtp.auth\", \"true\");\n\t\tprops.put(\"mail.smtp.port\", \"465\");\n\n\t\tSession session = Session.getDefaultInstance(props, new javax.mail.Authenticator() {\n\t\t\tprotected PasswordAuthentication getPasswordAuthentication() {\n\t\t\t\treturn new PasswordAuthentication(\"comics.negozio@gmail.com\", \"progettoIS2\");\n\t\t\t}\n\t\t});\n\n\t\t/** Debug for session */\n\t\tsession.setDebug(true);\n\n\t\ttry {\n\n\t\t\tMessage message = new MimeMessage(session);\n\t\t\tmessage.setFrom(new InternetAddress(\"comics.negozio@gmail.com\")); // mitente\n\n\t\t\tAddress[] toUser = InternetAddress // destinatario\n\t\t\t\t\t.parse(destinatario);\n\n\t\t\tmessage.setRecipients(Message.RecipientType.TO, toUser);\n\t\t\tmessage.setSubject(\"Avviso disponibilitą fumetto - NOTICE\");// contenuto\n\t\t\tmessage.setText(\"Salve! Il fumetto che era del suo interesse adesso č disponibile in stock! Fumetto:\"\n\t\t\t\t\t+ comic + \"; Tanti saluti! \"); // messaggio\n\t\t\t/** metodo che invia il messaggio creato */\n\t\t\tTransport.send(message);\n\n\t\t} catch (MessagingException e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t}\n\t\t\n\t}", "@Override\n\tpublic void msgAtFrige() {\n\t\t\n\t}", "public Boolean enviaEmail(PathDocEle pathDocEle, String emailDestino, String numeroComprobante, String mensaje, String xmlSinFirma, String numeroAutorizacion) throws ServicioExcepcion, EmailException, MessagingException, UnsupportedEncodingException {\n if (!emailDestino.isEmpty()) {\n ConfiguracionRepositorio configuracionRepositorio = new ConfiguracionRepositorio();\n hostMailServicio = new HostMailServicio();\n /*mail = hostMailServicio.obtenerPorConsultaJpaNombrada(mail.LISTAR_TODO, null);\n //seteo de variables de correo\n usuario = mail.getHtmCorreo();\n contrasena = mail.getHtmContrasenia();\n seguridad = new Integer(mail.getHtmSeguridad());\n smtp = mail.getHtmSmtp();\n puertoGmail = new Integer(mail.getHtmPuerto());\n remitente=mail.getHtmRemitente();\n*/ \n pathCorreo=pathDocEle.getPdeRepTemporal();\n asunto=\"Facturación Electrónica: \".concat(numeroComprobante);\n String pathRepositorioTemp = pathDocEle.getPdeRepTemporal();\n String nombreArchivoPdf = Util.aString(\"RIDE-\", numeroComprobante, \".pdf\");//RIDE-001-001-000000001.pdf\n String nombreArchivoXml = Util.aString(numeroComprobante, \"-firmado.xml\");//RIDE-001-001-000000001.xml\n String pathArchivoXml = Util.aString(pathRepositorioTemp, nombreArchivoXml, \"\");//home/repositorio/temporales/001-001-000000001.xml\n String pathLogo = pathDocEle.getPdeLogo();\n String fechaAutorizacionString = Util.aFechaHora_String(new Date());\n //generar RIDE pdf\n String xmlPuro = xmlSinFirma;//viene xml sin tag de autorizacion\n InputStream inputStream = RideExport.export(pathLogo, numeroAutorizacion, fechaAutorizacionString, xmlPuro.getBytes(\"UTF-8\"));\n //almacenar PDF\n ServicioArchivo servicioA = new ServicioArchivo();\n //servicioA.almacenar_File(pathArchivoXml, claseEmail.getXmlConAutorizacion());//esta en NULL, revisar\n servicioA.almacenar_EnRepositorio(pathRepositorioTemp, nombreArchivoPdf, inputStream);\n Util.aString(pathRepositorioTemp, nombreArchivoPdf, \"\");\n String pathArchivoPdf=pathCorreo.concat(nombreArchivoPdf);\n \n Multipart multipart = new MimeMultipart();\n BodyPart messageBodyPart = new MimeBodyPart();\n messageBodyPart.setContent(mensaje, \"text/html\");\n multipart.addBodyPart(messageBodyPart);\n\n //adjunto el PDF\n messageBodyPart = new MimeBodyPart();\n DataSource source = new FileDataSource(pathArchivoPdf);\n messageBodyPart.setDataHandler(new DataHandler(source));\n messageBodyPart.setFileName(nombreArchivoPdf);\n multipart.addBodyPart(messageBodyPart);\n\n //adjunto el XML\n pathArchivoXml=pathCorreo.concat(numeroComprobante).concat(\"-firmado.xml\");\n messageBodyPart = new MimeBodyPart();\n source = new FileDataSource(pathArchivoXml);\n messageBodyPart.setDataHandler(new DataHandler(source));\n messageBodyPart.setFileName(numeroComprobante.concat(\"-firmado.xml\"));\n multipart.addBodyPart(messageBodyPart);\n\n //envio de correo\n Email email = new MultiPartEmail();\n email.setHostName(smtp);//servidor de correos\n email.setAuthenticator(new DefaultAuthenticator(usuario, contrasena));\n if(seguridad==1){\n email.setSSLOnConnect(true);\n }\n email.setSmtpPort(puertoGmail);\n email.addTo(emailDestino, \"\");//Para quien se envia\n email.setFrom(correo, remitente);//quien envia\n email.setSubject(asunto);\n\n // add the attachment\n email.setContent((MimeMultipart) multipart);\n email.send();\n\n//FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, \"E-mail enviado con éxito para: \" + Emaildestino, \"Información\"));\n return Boolean.TRUE;\n }\n return Boolean.FALSE;\n\n }", "public static ArrayList<String> showSentMail(String user, Database data) {\n Gson gson = new Gson();\n ArrayList<String> mailList = data.showMail(user, \"Sender\");\n ArrayList<Mail> List1 = new ArrayList<>();\n for (int i = 0; i < mailList.size(); i++) {\n if (!(gson.fromJson(mailList.get(i), Mail.class).isTrashSend())) {\n List1.add(gson.fromJson(mailList.get(i), Mail.class));\n }\n }\n mailList.clear();\n for (int i = List1.size() - 1; i >= 0; i--) {\n mailList.add(gson.toJson(List1.get(i)));\n }\n return mailList;\n }", "public void sendReceipt(String fName, String customerEmail,int bookingNo, int numTicks,String movieTitle, String date, String timeslot){\n\t Properties props = makeProps();\r\n\t \r\n\t final String username = \"cinema4050@gmail.com\";\r\n\t final String password = \"movie4050\";\r\n\t \r\n\t try{\r\n\t\t Session session = Session.getDefaultInstance(props, \r\n\t\t\t\t new Authenticator(){\r\n\t\t\t \t\tprotected PasswordAuthentication getPasswordAuthentication() {\r\n\t\t\t \t\t\treturn new PasswordAuthentication(username,password);}});\r\n\t // -- Create a new message --\r\n\t Message msg = new MimeMessage(session);\r\n\t String slot;\r\n\t if(timeslot.equals(\"A\")) {\r\n\t\t slot = \"1 PM\";\r\n\t }else if(timeslot.equals(\"B\")) {\r\n\t\t slot = \"4 PM\";\r\n\t }else if(timeslot.equals(\"C\")) {\r\n\t\t slot = \"7 PM\";\r\n\t }else if(timeslot.equals(\"D\")) {\r\n\t\t slot = \"10 PM\";\r\n\t }else {\r\n\t\t slot = slot = \"Houston, we have a problem.\";\r\n\t }\r\n\t /* from */\r\n\t msg.setFrom(new InternetAddress(username));\r\n \r\n\t /* to */\r\n\t msg.setRecipients(Message.RecipientType.TO, \r\n InternetAddress.parse(customerEmail,false));\r\n\t /* title */\r\n\t msg.setSubject(\"Order Confirmation - Receipt\");\r\n \r\n\t /* text field */ \r\n\t String sendThis = \"Hello \\t\"+fName + \"!\\n\\nHere's your most recent booking for:\\t\"+movieTitle\r\n\t\t\t +\"\\nOrder Number:\\t\" + bookingNo\r\n\t\t\t +\"\\nNumber of tickets purchased:\\t\"+numTicks\r\n\t\t\t +\"\\nDate of showing:\\t\"+ date +\" at:\"+ slot\r\n\t\t\t +\"\\n\\n\\nThank you for choosing :^U\";\r\n\t msg.setText(sendThis);\r\n\t msg.setSentDate(new Date());\r\n\t Transport.send(msg);\r\n \r\n\t System.out.println(\"Message sent.\");\r\n\t }catch (MessagingException e){ \r\n\t\t System.out.println(\"Error: \" + e);\r\n\t }\r\n }", "private String formatarData(Date data)\n {\n String sDate;\n String sDia = \"\";\n String sMes = \"\";\n\n GregorianCalendar calendar = new GregorianCalendar();\n calendar.setTime(data);\n int dia = calendar.get(GregorianCalendar.DAY_OF_MONTH);\n if (dia > 0) {\n if (dia < 10) {\n sDia = \"0\";\n }\n }\n sDia += dia;\n\n int mes = calendar.get(GregorianCalendar.MONTH);\n mes = mes + 1;\n if (mes > 0) {\n if (mes < 10) {\n sMes = \"0\";\n }\n }\n sMes += mes;\n\n int ano = calendar.get(GregorianCalendar.YEAR);\n\n int hora = calendar.get(GregorianCalendar.HOUR);\n // 0 = dia\n // 1 = noite\n int amPm = calendar.get(GregorianCalendar.AM_PM);\n\n if(amPm == 1)\n {\n if(hora>0 && hora < 13)\n {\n if(hora > 11)\n hora = 0;\n else\n hora += 12;\n }\n }\n\n String sHora = \" \";\n if(hora<=9)\n {\n sHora += \"0\";\n }\n String sMin=\":\";\n int min = calendar.get(GregorianCalendar.MINUTE);\n if(min <10)\n sMin += \"0\";\n sMin += String.valueOf(min);\n sHora += String.valueOf(hora) + sMin + \":00\";\n sDate = String.valueOf(ano) + \"-\" + sMes + \"-\" + sDia + sHora;\n return sDate;\n\n }", "public void enviarAlertaDeQueEstaOnline(){\n //mandaria un mail a los usuarios avisando que ya esta disponible para ver.\n System.out.println(\"Enviando mail con url \" + this.url);\n }", "private String getSendMailResetPasswordContent(UserForm userForm) {\n return \"\";\n }", "public void SendEmail(){\n //Dummy Email Bot\n String from = \"cz2002testacc@gmail.com\";\n String emailPW = \"thisiscz2002\";\n\n try{\n Session session = Session.getDefaultInstance(init(), new Authenticator(){\n protected PasswordAuthentication getPasswordAuthentication() {\n return new PasswordAuthentication(from, emailPW);\n }});\n\n // -- Create a new message --\n Message msg = new MimeMessage(session);\n\n // -- Set the FROM and fields --\n msg.setFrom(new InternetAddress(from));\n msg.setRecipients(Message.RecipientType.TO,\n InternetAddress.parse(getRecipientEmail(),false));\n\n LocalDateTime myDateObj = LocalDateTime.now();\n DateTimeFormatter myFormatObj = DateTimeFormatter.ofPattern(\"dd-MM-yyyy HH:mm:ss\");\n String formattedDate = myDateObj.format(myFormatObj);\n\n msg.setSubject(getEmailSubject());\n msg.setText(getMessage());\n msg.setSentDate(new Date());\n Transport.send(msg);\n\n //System.out.println(formattedDate + \" - Message sent.\");\n }catch (MessagingException e){\n System.out.println(\"Error: \" + e);\n }\n }", "protected void saveEmailInfo(Map pPreparedParams, String pTemplateUrl) {\n \n // Get the current system time.\n CurrentDate cd = getCurrentDate();\n Date currentDate = cd.getTimeAsDate();\n \n // get current timestamp\n SimpleDateFormat sdf = new SimpleDateFormat(RecentlySentList.SENT_DATE_FORMAT);\n String timestamp = sdf.format(currentDate.getTime());\n \n getSentList().addItem(getSentList().getTemplateName(pTemplateUrl),\n pPreparedParams, timestamp);\n }", "public void mailPromo(String fname, String customerEmail, String promo, double discount){\n\t Properties props = makeProps();\r\n\t \r\n\t final String username = \"cinema4050@gmail.com\";\r\n\t final String password = \"movie4050\";\r\n\t \r\n\t try{\r\n\t Session session = Session.getDefaultInstance(props, \r\n\t new Authenticator(){\r\n\t protected PasswordAuthentication getPasswordAuthentication() {\r\n\t return new PasswordAuthentication(username,password);}});\r\n\t // -- Create a new message --\r\n\t Message msg = new MimeMessage(session);\r\n\t \r\n\t /* from */\r\n\t msg.setFrom(new InternetAddress(username));\r\n\t \r\n\t /* to */\r\n\t msg.setRecipients(Message.RecipientType.TO, \r\n\t InternetAddress.parse(customerEmail,false));\r\n\t /* title */\r\n\t msg.setSubject(\"New Promotion!\");\r\n\t \r\n\t /* text field */ \r\n\t String sendThis = \"Hello \"+fname + \"!\\n\\n\"\r\n\t + \"We are emailing you to inform you that there is a new promotion.\\n\"\r\n\t + \"Use code -- \"+promo+\" -- to save $\" + discount + \"0 on your next purchase on CINEMA4050!\\n\"\r\n\t + \"Thank you for using our service!\\n\";\r\n\t msg.setText(sendThis);\r\n\t msg.setSentDate(new Date());\r\n\t Transport.send(msg);\r\n\t \r\n\t System.out.println(\"Message sent.\");\r\n\t }catch (MessagingException e){ \r\n\t System.out.println(\"Error: \" + e);\r\n\t }\r\n\t \r\n\t }", "void checkIsMailEmpty(String mail);", "private void notificationMailGD(String email) {\r\n\t\tlogger.log(IAppLogger.INFO, \"Enter: notificationMailGD()\");\r\n\t\ttry {\r\n\t\t\tProperties prop = new Properties();\r\n\t\t\tprop.setProperty(IEmailConstants.SMTP_HOST, propertyLookup.get(IEmailConstants.SMTP_HOST));\r\n\t\t\tprop.setProperty(IEmailConstants.SMTP_PORT, propertyLookup.get(IEmailConstants.SMTP_PORT));\r\n\t\t\tprop.setProperty(\"senderMail\", propertyLookup.get(\"senderMail\"));\r\n\t\t\tprop.setProperty(\"supportEmail\", propertyLookup.get(\"supportEmail\"));\r\n\t\t\tString subject = propertyLookup.get(\"mail.gd.subject\");\r\n\t\t\tString mailBody = propertyLookup.get(\"mail.gd.body\");\r\n\t\t\tlogger.log(IAppLogger.INFO, \"Email triggered...\");\r\n\t\t\temailSender.sendMail(prop, email, null, null, subject, mailBody);\r\n\t\t\tlogger.log(IAppLogger.INFO, \"Email sent to : \" + email);\r\n\t\t} catch (Exception e) {\r\n\t\t\tlogger.log(IAppLogger.ERROR, \"Unable to send Email: \" + e.getMessage());\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\tlogger.log(IAppLogger.INFO, \"Exit: notificationMailGD()\");\r\n\t}", "private static boolean enviarEmailAnexo(Email remetente, List<File> files, String destinatario, String titulo, String mensagem) {\n Properties prop = new Properties();\r\n prop.put(\"mail.smtp.host\", \"smtp.gmail.com\");\r\n prop.put(\"mail.smtp.port\", \"465\");\r\n prop.put(\"mail.smtp.auth\", \"true\");\r\n prop.put(\"mail.smtp.socketFactory.port\", \"465\");\r\n prop.put(\"mail.smtp.socketFactory.class\", \"javax.net.ssl.SSLSocketFactory\");\r\n\r\n Session session = Session.getInstance(prop,\r\n new DefaultAuthenticator(remetente.getRemetente(), remetente.getSenha()));\r\n\r\n MimeMessage msg = new MimeMessage(session);\r\n\r\n try {\r\n //Quem esta enviando\r\n msg.setFrom(new InternetAddress(remetente.getRemetente()));\r\n //Destinatario\r\n msg.setRecipient(Message.RecipientType.TO, new InternetAddress(destinatario));\r\n //Data de envio\r\n msg.setSentDate(new Date());\r\n //titulo email\r\n msg.setSubject(titulo);\r\n\r\n Multipart mp = new MimeMultipart();\r\n //mensagem\r\n\r\n MimeBodyPart paragrafo = new MimeBodyPart();\r\n paragrafo.setContent(mensagem + \"\\n\\nJCR\", \"text/html\");\r\n mp.addBodyPart(paragrafo);\r\n //anexos\r\n for (File file : files) {\r\n MimeBodyPart mbp = new MimeBodyPart();\r\n DataSource fds = new FileDataSource(file);\r\n mbp.setDisposition(Part.ATTACHMENT);\r\n mbp.setDataHandler(new DataHandler(fds));\r\n mbp.setFileName(deAccent(fds.getName()));\r\n mp.addBodyPart(mbp);\r\n }\r\n\r\n msg.setContent(mp);\r\n\r\n //envia a mensagem\r\n Transport.send(msg);\r\n return true;\r\n } catch (MessagingException e) {\r\n System.err.println(e);\r\n GerarLogErro.gerar(e.getMessage());\r\n return false;\r\n }\r\n }", "String getOtherAlertMailBody( );", "public void processMail(JTextArea message) \n {\n try \n {\n \t// if the to-field is blank display a pop-up warning\n \t\t\tif(toField.getText().equals(\"\")){\n \t\t\t\tJOptionPane.showMessageDialog (null, \"Please provide an email address.\");\n \t\t\t\ttoField.requestFocusInWindow();\n \t\t\t}\n \t\t\telse {\n\t \tFile fileName = new File(\"outbox.txt\");\n\t \t// by setting the file writer boolean to \"true\" append is turned on\n\t\t FileWriter outStream = new FileWriter (fileName, true);\n\t\t outStream.append (\"To: \" + toField.getText() + \"\\nCc: \" + ccField.getText() +\n\t\t \t\t\t\t \"\\nBcc: \" + bccField.getText() + \"\\nSubject: \" + subjectField.getText() +\n\t\t \t\t\t\t \"\\nFrom: \" + fromField.getSelectedItem() + \"\\nMessage: \" + message.getText() +\"\\n\\n\");\n\t\t outStream.close ();\n\t\t JOptionPane.showMessageDialog (null, \"Your email has been sent!\");\n\t\t // after mail has been sent, clear all fields\n\t\t toField.setText(null);\n\t\t ccField.setText(null);\n\t\t bccField.setText(null);\n\t\t subjectField.setText(null);\n\t \tmessage.setText(null);\n\t \t// reset focus to first field\n\t \ttoField.requestFocusInWindow();\n\t }\n } \n catch (IOException e) \n {\n message.setText(\"IOERROR: \" + e.getMessage() + \"\\n\");\n e.printStackTrace();\n }\n }", "public void setMailReadflag(int v) \n {\n \n if (this.mailReadflag != v)\n {\n this.mailReadflag = v;\n setModified(true);\n }\n \n \n }", "@Override\n\tpublic void enviarNovaSenhaEmail(Cliente cliente, String newSenha) {\n\t\tSimpleMailMessage sm = prepararNovaSenhaEmail(cliente, newSenha);\n\t\tenviarEmail(sm);\n\t\t\n\t}", "String getUserMail();", "public abstract void arhivare(Email email);", "public void majInformation (String typeMessage, String moduleMessage, String corpsMessage) {\n Date date = new Date();\n listMessageInfo.addFirst(dateFormat.format(date)+\" - \"+typeMessage+\" - \"+moduleMessage+\" - \"+corpsMessage);\n }", "private Hashtable<String, Object> getMessageData(String cif, String msg) {\r\n\t\tHashtable<String, Object> messageData = super.getMessageData();\r\n\t\tVector<Object> v = new Vector<Object>();\r\n\t\tv.add(\"SUPERVISOR\");\r\n\t\tmessageData.put(\"UsuarioDestino\", v);\r\n\t\tString contenido = msg;\r\n\t\tmessageData.put(INoticeSystem.NOTICE_CONTENT, contenido);\r\n\t\treturn new Hashtable<String, Object>(messageData);\r\n\t}", "void send(String email, Locale locale);", "void sendCommonMail(String to, String subject, String content);", "public int getTotalMail() {\n return totalMail;\n }", "void onMessageEdit(Message message, long editDate) throws Throwable;", "public Modify_MAIL() {\n initComponents();\n }", "public static String convertDateToSend(String gotdate){\n Calendar calendar = Calendar.getInstance();\n calendar.setTimeInMillis(Long.parseLong(gotdate));\n SimpleDateFormat inputFormat = new SimpleDateFormat(\"yyyyMMddHHmmss\");\n SimpleDateFormat outputFormat = new SimpleDateFormat(\"dd MMM yyyy\");\n /*Date parsedDate = null;\n try {\n parsedDate = inputFormat.parse(gotdate);\n } catch (ParseException e) {\n e.printStackTrace();\n }*/\n String formattedDate = outputFormat.format(calendar.getTime());\n return formattedDate;\n }", "public void updateSendingMessage(String message, boolean isMe) {\n\n\n Log.v(\"adsl\", \"came here\");\n\n final MessageModel sendingMessage = new MessageModel();\n sendingMessage.setMessage(message);\n sendingMessage.setTime(\"8:57Pm\"); //set current time in form of database format\n sendingMessage.setMe(isMe);\n\n if (isMe == true) {\n\n\n if (!messageBox.getText().toString().trim().matches(\"\"))\n\n {\n doScreenUpdate(sendingMessage);\n }\n\n\n } else\n\n {\n\n doScreenUpdate(sendingMessage);\n\n\n }\n\n\n }", "private boolean tryMail(ApiClient client) throws ApiException {\n try {\n MailApi mailApi = new MailApi(client);\n String inbox = getClient().getValues().getInboxFolder();\n MailsResponse allMails = mailApi.getAllMails(inbox, \"600\", null, FALSE, FALSE, null, null, I(0), I(5), I(5), null);\n return allMails.getError() == null;\n } catch (OXException | IOException | JSONException e) {\n throw new ApiException(e.getMessage());\n }\n }", "public String sendEmail() {\n String to = theModel.getEmail();\n\n // Sender's email ID needs to be mentioned\n String from = \"IT353Uconnect@gmail.com\";\n\n // Assuming you are sending email from this host\n String host = \"smtp.gmail.com\";\n\n // Get system properties\n Properties properties = System.getProperties();\n\n // Setup mail server\n properties.setProperty(\"mail.smtp.host\", host);\n properties.setProperty(\"mail.smtp.starttls.enable\", \"true\");\n properties.setProperty(\"mail.smtp.auth\", \"true\");\n properties.setProperty(\"mail.smtp.port\", \"587\");\n // Get the default Session object.\n Session session = Session.getInstance(properties, new javax.mail.Authenticator() {\n protected PasswordAuthentication getPasswordAuthentication() {\n return new PasswordAuthentication(\"IT353Uconnect@gmail.com\", \"itkstuadmin\");\n }\n });\n\n try {\n // Create a default MimeMessage object.\n MimeMessage message = new MimeMessage(session);\n\n // Set From: header field of the header.\n message.setFrom(new InternetAddress(from));\n\n // Set To: header field of the header.\n message.addRecipient(Message.RecipientType.TO,\n new InternetAddress(to));\n\n // Set Subject: header field\n message.setSubject( subject, \"text/html\");\n\n // Send the actual HTML message, as big as you like\n message.setContent( text , \"text/html\");\n\n // Send message\n Transport.send(message);\n System.out.println(\"Sent message successfully....\");\n } catch (MessagingException mex) {\n mex.printStackTrace();\n }\n return \"UniLog.xhtml\";\n }", "private Timestamp GetDate(String email, PrintWriter out){\n Timestamp date = null;\n //select che ritorna data creazione link\n DBConnect db = new DBConnect(ip);\n try {\n PreparedStatement ps = db.conn.prepareStatement(\"SELECT countdown FROM users WHERE email = ?\");\n ps.setString(1, email);\n ResultSet rs = db.Query(ps);\n rs.next();\n \n String datevalue = rs.getString(\"countdown\");\n date = Timestamp.valueOf(datevalue);\n } catch (SQLException e) {\n }\n db.DBClose();\n return date;\n }", "@RequestMapping(value = \"mailCommunication/update\", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)\n public ResponseEntity<ResponseService> updateMailCommunication(@RequestBody MailCommunication mail) {\n ResponseService responseService = new ResponseService();\n try {\n MailCommunication mailCommunication = mailCommunicationService.findById(mail);\n if (mailCommunication == null) {\n responseService.setOutput(\"El registro no existe\");\n responseService.setStatus(StatusResponse.SUCCESS.getName());\n return new ResponseEntity<>(responseService, HttpStatus.OK);\n }\n mailCommunication.setMessage(mail.getMessage());\n mailCommunication.setSubject(mail.getSubject());\n mailCommunication.setRead(mail.getRead());\n mailCommunication.setReceivingUser(mail.getReceivingUser());\n mailCommunication.setSendingUser(mail.getSendingUser());\n mailCommunication.setStateId(mail.getStateId());\n mailCommunicationService.store(mailCommunication);\n responseService.setOutput(MessageUtil.getMessageFromBundle(\"co.com.expertla.training.i18n.trainingplan\", \"msgRegistroEditado\"));\n responseService.setStatus(StatusResponse.SUCCESS.getName());\n return new ResponseEntity<>(responseService, HttpStatus.OK);\n } catch (Exception ex) {\n java.util.logging.Logger.getLogger(MailController.class.getName()).log(Level.SEVERE, null, ex);\n responseService.setOutput(\"Error al modificar registro\");\n responseService.setDetail(ex.getMessage());\n responseService.setStatus(StatusResponse.FAIL.getName());\n return new ResponseEntity<>(responseService, HttpStatus.OK);\n }\n }", "public Date getModifiTime() {\n return modifiTime;\n }", "public synchronized String getMail()\r\n {\r\n return mail;\r\n }", "protected String getMailFileName(MessageMetaData message) {\n \t\treturn \"\" + message.date.getTime() + '-' + message.unid;\n \t}" ]
[ "0.6177004", "0.5998088", "0.59333694", "0.5903529", "0.58537203", "0.5843268", "0.5829064", "0.565341", "0.5625269", "0.5580289", "0.5561994", "0.54921716", "0.54894125", "0.54842556", "0.5481108", "0.5474427", "0.5470838", "0.5466647", "0.54569787", "0.54441786", "0.5437276", "0.5420076", "0.54192716", "0.5404803", "0.53894603", "0.53837574", "0.53837574", "0.5366116", "0.53655237", "0.5349289", "0.5346804", "0.53355736", "0.53354937", "0.53198254", "0.5292223", "0.52915996", "0.5288224", "0.5283903", "0.5270692", "0.52696794", "0.52645886", "0.5228524", "0.5218934", "0.52176934", "0.52124435", "0.52046984", "0.5188618", "0.5176658", "0.5164278", "0.5156063", "0.51329225", "0.5132249", "0.51317257", "0.5130419", "0.5128197", "0.5125898", "0.51127726", "0.5107711", "0.5102491", "0.5101594", "0.5088315", "0.5080523", "0.5078456", "0.5069589", "0.5067006", "0.50529766", "0.5048404", "0.50433916", "0.50401884", "0.50396794", "0.5038393", "0.503525", "0.50344634", "0.5033577", "0.5028953", "0.50139904", "0.50119823", "0.50106865", "0.50085384", "0.50070685", "0.50036335", "0.5001925", "0.49896803", "0.49859148", "0.49824744", "0.49822444", "0.49706528", "0.49694148", "0.4968629", "0.49685842", "0.49672306", "0.49670884", "0.49639022", "0.4962123", "0.49611977", "0.4947372", "0.49461928", "0.4945569", "0.4942896", "0.49426106", "0.4942317" ]
0.0
-1
INIZIO Fascicolo 2.1 20150507
private static EnteType getEnteConcedentePianoRateazione( it.equitalia.dettagliocartellaavviso.wsdl.PianoRateazioneType typeResponse) { EnteType res = new EnteType(); res.setDescrizione(typeResponse.getEnteConcedente().getDescrizione()); res.setCodiceEnte(typeResponse.getEnteConcedente().getCodiceEnte()); res.setCodiceUfficio(typeResponse.getEnteConcedente().getCodiceUfficio()); res.setTipoUfficio(typeResponse.getEnteConcedente().getTipoUfficio()); return res; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static void cajas() {\n\t\t\n\t}", "void mo1507n();", "public void mo38117a() {\n }", "public void mo6081a() {\n }", "public void mo4359a() {\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 }", "public void mo1531a() {\n }", "public void mo55254a() {\n }", "@Override\n public void func_104112_b() {\n \n }", "public void mo12628c() {\n }", "public void mo21877s() {\n }", "protected void mo6255a() {\n }", "public void mo21783H() {\n }", "abstract C0451h mo1607e();", "public void mo9848a() {\n }", "public void mo12930a() {\n }", "@Override\n\tprotected void getExras() {\n\n\t}", "void mo57278c();", "abstract String mo1748c();", "@Override\r\n\t\t\tpublic void func02() {\n\t\t\t\t\r\n\t\t\t}", "public final void mo51373a() {\n }", "@Override\n\tpublic int mettreAJour() {\n\t\treturn 0;\n\t}", "static void feladat9() {\n\t}", "void mo21072c();", "public void mo1403c() {\n }", "@Override\n\tpublic void emprestimo() {\n\n\t}", "void mo27575a();", "public void mo21879u() {\n }", "@Override\r\n\tprotected void func03() {\n\t\t\r\n\t}", "public abstract String mo9751p();", "public void mo21781F() {\n }", "@Override\n protected void getExras() {\n }", "static void feladat7() {\n\t}", "public void mo21794S() {\n }", "void mo41083a();", "public void mo21782G() {\n }", "void mo57277b();", "void mo17021c();", "public void mo21780E() {\n }", "private void kk12() {\n\n\t}", "void mo67924c();", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "public void mo5382o() {\n }", "public void mo21785J() {\n }", "private void m50366E() {\n }", "public void mo21791P() {\n }", "protected boolean func_70814_o() { return true; }", "static void feladat4() {\n\t}", "private void remplirPrestaraireData() {\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "public void mo21878t() {\n }", "public void mo21779D() {\n }", "private String elaboraIncipit() {\n String testo = VUOTA;\n\n if (usaHeadIncipit) {\n testo += elaboraIncipitSpecifico();\n testo += A_CAPO;\n }// fine del blocco if\n\n return testo;\n }", "void mo28306a();", "public abstract String mo41086i();", "public void mo21787L() {\n }", "void mo1506m();", "void mo1501h();", "public void mo3370l() {\n }", "void mo57275a();", "static void feladat6() {\n\t}", "void mo17012c();", "public String limpiar()\r\n/* 509: */ {\r\n/* 510:529 */ return null;\r\n/* 511: */ }", "void mo21073d();", "public void mo21825b() {\n }", "@Override\r\n public String AggiungiQualcosa() {\r\n// ritorna una stringa\r\n// perché qui ho informazioni in più\r\n return \"\\ne capace di friggere un uovo\";\r\n }", "void mo310e();", "public void mo1405e() {\n }", "public String cargarDatos()\r\n/* 137: */ {\r\n/* 138:163 */ limpiar();\r\n/* 139:164 */ return \"\";\r\n/* 140: */ }", "public void estiloAcierto() {\r\n\t\t /**Bea y Jose**/\t\t\r\n \r\n\t}", "void mo119581a();", "public void Exterior() {\n\t\t\r\n\t}", "private void limpiarDatos() {\n\t\t\n\t}", "void mo80452a();", "void mo17023d();", "void mo54405a();", "public String editar()\r\n/* 441: */ {\r\n/* 442:445 */ return null;\r\n/* 443: */ }", "public void mo21880v() {\n }", "void mo1943l();", "public abstract String mo9091a();", "public void mo21784I() {\n }", "public void mo115188a() {\n }", "void mo88524c();", "private zza.zza()\n\t\t{\n\t\t}", "public void mo44053a() {\n }", "void mo88521a();", "public String cargarDatos()\r\n/* 514: */ {\r\n/* 515:540 */ return null;\r\n/* 516: */ }", "@Override\r\n public String AggiungiQualcosa() {\r\n// ritorna una stringa\r\n// perché qui ho informazioni in più\r\n return \"\\ne capace di cuocere il pollo\";\r\n }", "void mo72113b();", "public void mo21800a() {\n }", "void mo80457c();", "public abstract String mo13682d();", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "public void mo3376r() {\n }", "public void mo21793R() {\n }" ]
[ "0.65501523", "0.6183705", "0.6172345", "0.61172104", "0.6071212", "0.6045922", "0.6045922", "0.6045922", "0.6045922", "0.6045922", "0.6045922", "0.6045922", "0.60153335", "0.5968837", "0.5945011", "0.59353817", "0.5929287", "0.5911117", "0.5907389", "0.59065586", "0.59024006", "0.5891208", "0.58910656", "0.5884689", "0.5868922", "0.58589643", "0.585495", "0.58491063", "0.58457434", "0.5843089", "0.58253545", "0.582227", "0.58189476", "0.5799716", "0.5795343", "0.57953423", "0.57845944", "0.57834136", "0.57808864", "0.5776749", "0.5771044", "0.577005", "0.5751945", "0.5745844", "0.57391393", "0.5738443", "0.57363594", "0.57229465", "0.5709258", "0.5706615", "0.5700351", "0.5693623", "0.569338", "0.56931365", "0.5684181", "0.56834835", "0.568015", "0.56773216", "0.5674732", "0.5673462", "0.5668024", "0.5667642", "0.5666886", "0.5665794", "0.5663068", "0.5661933", "0.5661884", "0.5661651", "0.5652318", "0.5643768", "0.5642377", "0.5638757", "0.5638618", "0.5637425", "0.56341517", "0.5632651", "0.56311834", "0.5629457", "0.56280446", "0.5624528", "0.56222755", "0.5621639", "0.56196237", "0.5618779", "0.56169885", "0.5616527", "0.5615207", "0.5614523", "0.5609162", "0.56079155", "0.56056863", "0.5604313", "0.5600049", "0.5599688", "0.55985284", "0.5596667", "0.5591303", "0.55893373", "0.5587327", "0.55867124", "0.55841154" ]
0.0
-1
FINE Fascicolo 2.1 20150507 inizio ModDocumentiAssociati
private static IdentificativoDocumentoType[] getDocumentiAssociatiPianoRateazione( it.equitalia.dettagliocartellaavviso.wsdl.PianoRateazioneType typeResponse) { it.equitalia.dettagliocartellaavviso.wsdl.IdentificativoDocumentoType[] documentoAssociatoTypeResponse = typeResponse.getDocumentoAssociato(); IdentificativoDocumentoType[] res = new IdentificativoDocumentoType[documentoAssociatoTypeResponse.length]; for (int i = 0; i < documentoAssociatoTypeResponse.length; i++) { IdentificativoDocumentoType doc = new IdentificativoDocumentoType(); doc.setNumeroDocumento(documentoAssociatoTypeResponse[i].getNumeroDocumento()); doc.setTipoDocumento(documentoAssociatoTypeResponse[i].getTipoDocumento()); res[i] = doc; } return res; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public interface CfgDocument extends com.hps.july.persistence.Document, com.ibm.ivj.ejb.runtime.CopyHelper {\n\n\n\n\t/**\n\t * Get accessor for persistent attribute: savconfigidold\n\t */\n\tpublic int getSavconfigidold() throws java.rmi.RemoteException;\n\t/**\n\t * Set accessor for persistent attribute: savconfigidold\n\t */\n\tpublic void setSavconfigidold(int newSavconfigidold)\n\t\tthrows java.rmi.RemoteException;\n\t/**\n\t * Get accessor for persistent attribute: savconfigidnew\n\t */\n\tpublic int getSavconfigidnew() throws java.rmi.RemoteException;\n\t/**\n\t * Set accessor for persistent attribute: savconfigidnew\n\t */\n\tpublic void setSavconfigidnew(int newSavconfigidnew)\n\t\tthrows java.rmi.RemoteException;\n\t/**\n\t * Get accessor for persistent attribute: storedem\n\t */\n\tpublic java.lang.Integer getStoredem() throws java.rmi.RemoteException;\n\t/**\n\t * Set accessor for persistent attribute: storedem\n\t */\n\tpublic void setStoredem(java.lang.Integer newStoredem)\n\t\tthrows java.rmi.RemoteException;\n\t/**\n\t * Get accessor for persistent attribute: storebad\n\t */\n\tpublic java.lang.Integer getStorebad() throws java.rmi.RemoteException;\n\t/**\n\t * Set accessor for persistent attribute: storebad\n\t */\n\tpublic void setStorebad(java.lang.Integer newStorebad)\n\t\tthrows java.rmi.RemoteException;\n}", "public manageDoc() {\r\r\r\n\r\r\r\n }", "public String getInoDocname();", "public interface I13nAct extends com.hps.july.persistence.Document, com.ibm.ivj.ejb.runtime.CopyHelper {\n\n/**\n * This method was generated for supporting the association named I13nAct2Agregate. \n * \tIt will be deleted/edited when the association is deleted/edited.\n */\n/* WARNING: THIS METHOD WILL BE REGENERATED. */\ncom.hps.july.persistence.StorageCard getAgregate() throws java.rmi.RemoteException, javax.ejb.FinderException;\n/**\n * This method was generated for supporting the association named I13nAct2Agregate. \n * \tIt will be deleted/edited when the association is deleted/edited.\n */\n/* WARNING: THIS METHOD WILL BE REGENERATED. */\ncom.hps.july.persistence.StorageCardKey getAgregateKey() throws java.rmi.RemoteException;\n/**\n * \n * @return java.lang.Integer\n * @exception String The exception description.\n */\njava.lang.Integer getAgregateresource() throws java.rmi.RemoteException;\n/**\n * \n * @return java.lang.String\n * @exception String The exception description.\n */\njava.lang.String getAgregateserial() throws java.rmi.RemoteException;\n/**\n * This method was generated for supporting the association named I13nActResourceSet2I13nAct. \n * \tIt will be deleted/edited when the association is deleted/edited.\n */\n/* WARNING: THIS METHOD WILL BE REGENERATED. */\npublic java.util.Enumeration getI13nActResourceSet() throws java.rmi.RemoteException, javax.ejb.FinderException;\n/**\n * This method was generated for supporting the association named I13nDateSaving2I13nAct. \n * \tIt will be deleted/edited when the association is deleted/edited.\n */\n/* WARNING: THIS METHOD WILL BE REGENERATED. */\npublic java.util.Enumeration getI13nDateSaving() throws java.rmi.RemoteException, javax.ejb.FinderException;\n/**\n * \n * @return java.lang.Boolean\n * @exception String The exception description.\n */\njava.lang.Boolean getRecalcagrprice() throws java.rmi.RemoteException;\n/**\n * This method was generated for supporting the association named I13nAct2Techstuff. \n * \tIt will be deleted/edited when the association is deleted/edited.\n */\n/* WARNING: THIS METHOD WILL BE REGENERATED. */\ncom.hps.july.persistence.Worker getTechStuff() throws java.rmi.RemoteException, javax.ejb.FinderException;\n/**\n * This method was generated for supporting the association named I13nAct2Techstuff. \n * \tIt will be deleted/edited when the association is deleted/edited.\n */\n/* WARNING: THIS METHOD WILL BE REGENERATED. */\ncom.hps.july.persistence.WorkerKey getTechStuffKey() throws java.rmi.RemoteException;\n/**\n * This method was generated for supporting the association named I13nAct2Agregate. \n * \tIt will be deleted/edited when the association is deleted/edited.\n */\n/* WARNING: THIS METHOD WILL BE REGENERATED. */\nvoid privateSetAgregateKey(com.hps.july.persistence.StorageCardKey inKey) throws java.rmi.RemoteException;\n/**\n * This method was generated for supporting the association named I13nAct2Techstuff. \n * \tIt will be deleted/edited when the association is deleted/edited.\n */\n/* WARNING: THIS METHOD WILL BE REGENERATED. */\nvoid privateSetTechStuffKey(com.hps.july.persistence.WorkerKey inKey) throws java.rmi.RemoteException;\n/**\n * This method was generated for supporting the association named I13nActResourceSet2I13nAct. \n * \tIt will be deleted/edited when the association is deleted/edited.\n */\n/* WARNING: THIS METHOD WILL BE REGENERATED. */\npublic void secondaryAddI13nActResourceSet(com.hps.july.persistence.I13nActResourceSet anI13nActResourceSet) throws java.rmi.RemoteException;\n/**\n * This method was generated for supporting the association named I13nDateSaving2I13nAct. \n * \tIt will be deleted/edited when the association is deleted/edited.\n */\n/* WARNING: THIS METHOD WILL BE REGENERATED. */\npublic void secondaryAddI13nDateSaving(com.hps.july.persistence.I13nDateSaving anI13nDateSaving) throws java.rmi.RemoteException;\n/**\n * This method was generated for supporting the association named I13nActResourceSet2I13nAct. \n * \tIt will be deleted/edited when the association is deleted/edited.\n */\n/* WARNING: THIS METHOD WILL BE REGENERATED. */\npublic void secondaryRemoveI13nActResourceSet(com.hps.july.persistence.I13nActResourceSet anI13nActResourceSet) throws java.rmi.RemoteException;\n/**\n * This method was generated for supporting the association named I13nDateSaving2I13nAct. \n * \tIt will be deleted/edited when the association is deleted/edited.\n */\n/* WARNING: THIS METHOD WILL BE REGENERATED. */\npublic void secondaryRemoveI13nDateSaving(com.hps.july.persistence.I13nDateSaving anI13nDateSaving) throws java.rmi.RemoteException;\n/**\n * This method was generated for supporting the association named I13nAct2Agregate. \n * \tIt will be deleted/edited when the association is deleted/edited.\n */\n/* WARNING: THIS METHOD WILL BE REGENERATED. */\nvoid secondarySetAgregate(com.hps.july.persistence.StorageCard anAgregate) throws java.rmi.RemoteException;\n/**\n * This method was generated for supporting the association named I13nAct2Techstuff. \n * \tIt will be deleted/edited when the association is deleted/edited.\n */\n/* WARNING: THIS METHOD WILL BE REGENERATED. */\nvoid secondarySetTechStuff(com.hps.july.persistence.Worker aTechStuff) throws java.rmi.RemoteException;\n/**\n * This method was generated for supporting the association named I13nAct2Agregate. \n * \tIt will be deleted/edited when the association is deleted/edited.\n */\n/* WARNING: THIS METHOD WILL BE REGENERATED. */\nvoid setAgregate(com.hps.july.persistence.StorageCard anAgregate) throws java.rmi.RemoteException;\n/**\n * \n * @return void\n * @param newValue java.lang.Integer\n * @exception String The exception description.\n */\nvoid setAgregateresource(java.lang.Integer newValue) throws java.rmi.RemoteException;\n/**\n * \n * @return void\n * @param newValue java.lang.String\n * @exception String The exception description.\n */\nvoid setAgregateserial(java.lang.String newValue) throws java.rmi.RemoteException;\n/**\n * \n * @return void\n * @param newValue java.lang.Boolean\n * @exception String The exception description.\n */\nvoid setRecalcagrprice(java.lang.Boolean newValue) throws java.rmi.RemoteException;\n/**\n * This method was generated for supporting the association named I13nAct2Techstuff. \n * \tIt will be deleted/edited when the association is deleted/edited.\n */\n/* WARNING: THIS METHOD WILL BE REGENERATED. */\nvoid setTechStuff(com.hps.july.persistence.Worker aTechStuff) throws java.rmi.RemoteException;\n}", "public accionDocumentos() {\n \n }", "public int getId_docente() {\n return id_docente;\n }", "private void cargarCodDocente() {\n ClsNegocioDocente negoDoc = new ClsNegocioDocente(); \n txtCodDocente.setText(negoDoc.ObtenerCodigo());\n try {\n negoDoc.conexion.close();\n } catch (SQLException ex) {\n Logger.getLogger(FrmCRUDDocente.class.getName()).log(Level.SEVERE, null, ex);\n }\n }", "public void listarDocDaDisciplina(){\r\n for(int i=0;i<docentes.size();i++){\r\n System.out.println(docentes.get(i).toString());\r\n }\r\n }", "Documento getDocumento();", "@Override\n @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)\n public void generarDocumentosAnteriores(Object[] filaCoactivo)\n throws CirculemosNegocioException, CirculemosAlertaException {\n ProcesoDTO proceso;\n\n // Consulta de traza\n proceso = new ProcesoDTO();\n proceso.setId(((BigInteger) filaCoactivo[0]).longValue());\n proceso.setFechaInicio((Date) filaCoactivo[2]);\n proceso.setNumeroProceso(String.valueOf(filaCoactivo[4]));\n TrazabilidadProcesoDTO trazaMand = new TrazabilidadProcesoDTO(((BigInteger) filaCoactivo[5]).longValue());\n TrazabilidadProcesoDTO trazaNotifica = new TrazabilidadProcesoDTO(((BigInteger) filaCoactivo[6]).longValue());\n\n Coactivo coactivo = new Coactivo();\n coactivo.setId(((BigInteger) filaCoactivo[1]).longValue());\n coactivo.setValorTotalObligaciones((BigDecimal) filaCoactivo[3]);\n coactivo.setProceso(ProcesoHelper.toLevel0Entity(proceso, null));\n\n // Genera documento apertura\n registrarDocumentoCoactivo(EnumTipoDocumentoGenerado.AUTO_PAGO, trazaMand, coactivo,\n EnumTipoDocumentoProceso.COACTIVO_AUTO_PAGO, null);\n // Genera documento posesion\n registrarDocumentoCoactivo(EnumTipoDocumentoGenerado.ACTA_DE_POSESION, trazaMand, coactivo,\n EnumTipoDocumentoProceso.COACTIVO_ACTA_DE_POSESION, null);\n\n // Genera documento notificacion\n // DocumentoProcesoDTO documentoProceso =\n registrarDocumentoCoactivo(EnumTipoDocumentoGenerado.NOTIFICACION_COACTIVO, trazaNotifica, coactivo,\n EnumTipoDocumentoProceso.COACTIVO_NOTIFICACION, null);\n\n // Guardar en FileSystem\n // List<Long> idsDocumento = new ArrayList<>();\n // idsDocumento.add(documentoProceso.getNumeroDocumento());\n // byte[] contenido = iRDocumentosCirculemos.consultarDocumentosPDF(idsDocumento);\n // ArchivoTransportableDTO archivo = new ArchivoTransportableDTO(\n // String.format(NOMBRE_ARCHIVO_NOTIFICACION, proceso.getNumeroProceso()), contenido);\n // archivo.setRuta(String.format(RUTA_NOTIFICACIONES, fecha.get(Calendar.YEAR) + \"\",\n // (fecha.get(Calendar.MONTH) + 1) + \"\"));\n // ProcesadorArchivoFileSystem procesa = new ProcesadorArchivoFileSystem();\n // procesa.procesarArchivo(archivo);\n }", "private void guardaDocumentosGenerado(java.sql.ResultSet rstExt,int intCodTipDoc,int intNumDoc,int intCodDoc,String strCorEle){\r\n try \r\n {\r\n arlDocGenReg = new ArrayList();\r\n arlDocGenReg.add(INT_ARL_COD_EMP_COT,rstExt.getInt(\"co_emp\") );\r\n arlDocGenReg.add(INT_ARL_COD_LOC_COT,rstExt.getInt(\"co_loc\") );\r\n arlDocGenReg.add(INT_ARL_COD_COT,rstExt.getInt(\"co_cot\") );\r\n arlDocGenReg.add(INT_ARL_COD_EMP_FAC,rstExt.getInt(\"co_emp\") );\r\n arlDocGenReg.add(INT_ARL_COD_LOC_FAC,rstExt.getInt(\"co_loc\") );\r\n arlDocGenReg.add(INT_ARL_COD_TIP_DOC_FAC,intCodTipDoc );\r\n arlDocGenReg.add(INT_ARL_COD_DOC_FAC,intCodDoc );\r\n arlDocGenReg.add(INT_ARL_NUM_FAC,intNumDoc );\r\n arlDocGenReg.add(INT_ARL_NOM_CLI,strNomCli );\r\n arlDocGenReg.add(INT_ARL_COR_ELE_VEN,strCorEle);\r\n arlDocGenDat.add(arlDocGenReg); \r\n }\r\n catch (SQLException Evt) {\r\n System.err.println(\"ERROR \" + Evt.toString());\r\n objUti.mostrarMsgErr_F1(jifCnt, Evt);\r\n } catch (Exception Evt) {\r\n System.err.println(\"ERROR \" + Evt.toString());\r\n objUti.mostrarMsgErr_F1(jifCnt, Evt);\r\n } \r\n }", "public int getDocenteId() {\r\n return this.docenteId;\r\n }", "@Override\n public void asignaParametros() {\n paso = request.getParameter(\"pasoSig\")!=null?request.getParameter(\"pasoSig\"):\"0\";\n String paginaSig = \"\";\n HashMap param = new HashMap();\n Documento doc = new Documento();\n switch (Integer.parseInt(paso)){\n case 0:\n //paso inicial: obtener la vista de los parametros\n datos.clear();\n String vista = request.getParameter(\"vista\")!=null?request.getParameter(\"vista\"):\"\";\n String idoperacion = request.getParameter(\"operacion\")!=null?request.getParameter(\"operacion\"):\"\";\n //cargar los parametros al hash de datos\n datos.put(\"idoperacion\", idoperacion);\n sesion.setPaginaSiguiente(vista);\n break;\n case 1: case 6: case 50: case 51: case 52: case 53: case 97: case 98: case 99:\n paginaSig = request.getParameter(\"paginaSig\")!=null?request.getParameter(\"paginaSig\"):\"\";\n sesion.setPaginaSiguiente(paginaSig);\n break;\n case 3: case 5: case 7:\n //editar documento(3) || baja de documentos(5) || activar documento(7)\n doc.setId(Integer.parseInt(request.getParameter(\"idDoc\")));\n datos.put(\"documento\", doc);\n datos.put(\"varios\", request.getParameter(\"varios\"));\n paginaSig = request.getParameter(\"paginaSig\")!=null?request.getParameter(\"paginaSig\"):\"\";\n sesion.setPaginaSiguiente(paginaSig);\n break;\n case 8:\n //imprimir los docs seleccionados\n datos.put(\"reporte\", application.getRealPath(\"WEB-INF/Reportes/Nomina/Personal/documentosemple.jasper\"));\n //parametros\n param = new HashMap();\n param.put(\"LOGO\", application.getRealPath(\"/Imagenes/\"+datos.get(\"logo\").toString()));\n param.put(\"RUTAIMGS\", application.getRealPath(\"/Imagenes/Personal/Documentos\"));\n Empleado empl = (Empleado)datos.get(\"empleado\");\n param.put(\"EMPLEADO\", new Integer(empl.getNumempleado()));\n param.put(\"DOCS\", request.getParameter(\"dato1\"));\n datos.put(\"parametros\", param);\n break;\n }\n datos.put(\"paso\", paso);\n }", "public void add_Doc_buit(String titol, String autor) {\n \tHashMap<String, Integer> h = new HashMap<>();\n \tHashMap<String, Double> i = new HashMap<>();\n \tthis.M.put(titol+\", \"+autor,h);\n \tthis.MatriuTF_IDF.put(titol+\", \"+autor,i);\n }", "private DIdentificadorDoc obtenerIdentificadorDocMuisca(Long numeroDocumento,\n Integer ideFormato) throws\n DExcepcion {\n DCmdAccConsIdentificadorDoc cmdAccConsIdDoc = (DCmdAccConsIdentificadorDoc)\n getAccion(\"entradasalida.DCmdAccConsIdentificadorDoc\");\n //Documentos MUISCA solamente\n cmdAccConsIdDoc.inicializarConsPorId(numeroDocumento.longValue(), 1, true,\n ideFormato.intValue());\n cmdAccConsIdDoc.ejecutar();\n\n return cmdAccConsIdDoc.getIdentificadorDoc();\n }", "public interface DocumentoInternoSinBinarios {\n Long getId();\n Integer getNivel();\n TipoDocumento getTipo();\n String getCodigo();\n}", "@SuppressWarnings(\"all\")\npublic interface I_LBR_DocLine_ICMS \n{\n\n /** TableName=LBR_DocLine_ICMS */\n public static final String Table_Name = \"LBR_DocLine_ICMS\";\n\n /** AD_Table_ID=1000027 */\n public static final int Table_ID = MTable.getTable_ID(Table_Name);\n\n KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);\n\n /** AccessLevel = 3 - Client - Org \n */\n BigDecimal accessLevel = BigDecimal.valueOf(3);\n\n /** Load Meta Data */\n\n /** Column name AD_Client_ID */\n public static final String COLUMNNAME_AD_Client_ID = \"AD_Client_ID\";\n\n\t/** Get Client.\n\t * Client/Tenant for this installation.\n\t */\n\tpublic int getAD_Client_ID();\n\n /** Column name AD_Org_ID */\n public static final String COLUMNNAME_AD_Org_ID = \"AD_Org_ID\";\n\n\t/** Set Organization.\n\t * Organizational entity within client\n\t */\n\tpublic void setAD_Org_ID (int AD_Org_ID);\n\n\t/** Get Organization.\n\t * Organizational entity within client\n\t */\n\tpublic int getAD_Org_ID();\n\n /** Column name Created */\n public static final String COLUMNNAME_Created = \"Created\";\n\n\t/** Get Created.\n\t * Date this record was created\n\t */\n\tpublic Timestamp getCreated();\n\n /** Column name CreatedBy */\n public static final String COLUMNNAME_CreatedBy = \"CreatedBy\";\n\n\t/** Get Created By.\n\t * User who created this records\n\t */\n\tpublic int getCreatedBy();\n\n /** Column name IsActive */\n public static final String COLUMNNAME_IsActive = \"IsActive\";\n\n\t/** Set Active.\n\t * The record is active in the system\n\t */\n\tpublic void setIsActive (boolean IsActive);\n\n\t/** Get Active.\n\t * The record is active in the system\n\t */\n\tpublic boolean isActive();\n\n /** Column name IsTaxIncluded */\n public static final String COLUMNNAME_IsTaxIncluded = \"IsTaxIncluded\";\n\n\t/** Set Price includes Tax.\n\t * Tax is included in the price \n\t */\n\tpublic void setIsTaxIncluded (boolean IsTaxIncluded);\n\n\t/** Get Price includes Tax.\n\t * Tax is included in the price \n\t */\n\tpublic boolean isTaxIncluded();\n\n /** Column name LBR_CEST_ID */\n public static final String COLUMNNAME_LBR_CEST_ID = \"LBR_CEST_ID\";\n\n\t/** Set CEST\t */\n\tpublic void setLBR_CEST_ID (int LBR_CEST_ID);\n\n\t/** Get CEST\t */\n\tpublic int getLBR_CEST_ID();\n\n\tpublic I_LBR_CEST getLBR_CEST() throws RuntimeException;\n\n /** Column name LBR_DIFAL_RateICMSInterPart */\n public static final String COLUMNNAME_LBR_DIFAL_RateICMSInterPart = \"LBR_DIFAL_RateICMSInterPart\";\n\n\t/** Set DIFAL Share Rate (%)\t */\n\tpublic void setLBR_DIFAL_RateICMSInterPart (BigDecimal LBR_DIFAL_RateICMSInterPart);\n\n\t/** Get DIFAL Share Rate (%)\t */\n\tpublic BigDecimal getLBR_DIFAL_RateICMSInterPart();\n\n /** Column name LBR_DIFAL_TaxAmtFCPUFDest */\n public static final String COLUMNNAME_LBR_DIFAL_TaxAmtFCPUFDest = \"LBR_DIFAL_TaxAmtFCPUFDest\";\n\n\t/** Set DIFAL Tax Amt of \"Fundo de Combate a Pobreza\"\t */\n\tpublic void setLBR_DIFAL_TaxAmtFCPUFDest (BigDecimal LBR_DIFAL_TaxAmtFCPUFDest);\n\n\t/** Get DIFAL Tax Amt of \"Fundo de Combate a Pobreza\"\t */\n\tpublic BigDecimal getLBR_DIFAL_TaxAmtFCPUFDest();\n\n /** Column name LBR_DIFAL_TaxAmtICMSUFDest */\n public static final String COLUMNNAME_LBR_DIFAL_TaxAmtICMSUFDest = \"LBR_DIFAL_TaxAmtICMSUFDest\";\n\n\t/** Set DIFAL Tax Amt in Receiver UF\t */\n\tpublic void setLBR_DIFAL_TaxAmtICMSUFDest (BigDecimal LBR_DIFAL_TaxAmtICMSUFDest);\n\n\t/** Get DIFAL Tax Amt in Receiver UF\t */\n\tpublic BigDecimal getLBR_DIFAL_TaxAmtICMSUFDest();\n\n /** Column name LBR_DIFAL_TaxAmtICMSUFRemet */\n public static final String COLUMNNAME_LBR_DIFAL_TaxAmtICMSUFRemet = \"LBR_DIFAL_TaxAmtICMSUFRemet\";\n\n\t/** Set DIFAL Tax Amt in Sender UF\t */\n\tpublic void setLBR_DIFAL_TaxAmtICMSUFRemet (BigDecimal LBR_DIFAL_TaxAmtICMSUFRemet);\n\n\t/** Get DIFAL Tax Amt in Sender UF\t */\n\tpublic BigDecimal getLBR_DIFAL_TaxAmtICMSUFRemet();\n\n /** Column name LBR_DIFAL_TaxBaseFCPUFDest */\n public static final String COLUMNNAME_LBR_DIFAL_TaxBaseFCPUFDest = \"LBR_DIFAL_TaxBaseFCPUFDest\";\n\n\t/** Set DIFAL Tax Base Amt of \"Fundo de Combate a Pobreza\"\t */\n\tpublic void setLBR_DIFAL_TaxBaseFCPUFDest (BigDecimal LBR_DIFAL_TaxBaseFCPUFDest);\n\n\t/** Get DIFAL Tax Base Amt of \"Fundo de Combate a Pobreza\"\t */\n\tpublic BigDecimal getLBR_DIFAL_TaxBaseFCPUFDest();\n\n /** Column name LBR_DIFAL_TaxRateFCPUFDest */\n public static final String COLUMNNAME_LBR_DIFAL_TaxRateFCPUFDest = \"LBR_DIFAL_TaxRateFCPUFDest\";\n\n\t/** Set DIFAL Tax Rate of \"Fundo de Combate a Pobreza\"\t */\n\tpublic void setLBR_DIFAL_TaxRateFCPUFDest (BigDecimal LBR_DIFAL_TaxRateFCPUFDest);\n\n\t/** Get DIFAL Tax Rate of \"Fundo de Combate a Pobreza\"\t */\n\tpublic BigDecimal getLBR_DIFAL_TaxRateFCPUFDest();\n\n /** Column name LBR_DIFAL_TaxRateICMSUFDest */\n public static final String COLUMNNAME_LBR_DIFAL_TaxRateICMSUFDest = \"LBR_DIFAL_TaxRateICMSUFDest\";\n\n\t/** Set DIFAL Internal Tax Rate in Receiver UF\t */\n\tpublic void setLBR_DIFAL_TaxRateICMSUFDest (BigDecimal LBR_DIFAL_TaxRateICMSUFDest);\n\n\t/** Get DIFAL Internal Tax Rate in Receiver UF\t */\n\tpublic BigDecimal getLBR_DIFAL_TaxRateICMSUFDest();\n\n /** Column name LBR_DocLine_Details_ID */\n public static final String COLUMNNAME_LBR_DocLine_Details_ID = \"LBR_DocLine_Details_ID\";\n\n\t/** Set Doc Line Details.\n\t * Doc Line Details\n\t */\n\tpublic void setLBR_DocLine_Details_ID (int LBR_DocLine_Details_ID);\n\n\t/** Get Doc Line Details.\n\t * Doc Line Details\n\t */\n\tpublic int getLBR_DocLine_Details_ID();\n\n\tpublic I_LBR_DocLine_Details getLBR_DocLine_Details() throws RuntimeException;\n\n /** Column name LBR_DocLine_ICMS_ID */\n public static final String COLUMNNAME_LBR_DocLine_ICMS_ID = \"LBR_DocLine_ICMS_ID\";\n\n\t/** Set Doc Line ICMS.\n\t * Doc Line ICMS\n\t */\n\tpublic void setLBR_DocLine_ICMS_ID (int LBR_DocLine_ICMS_ID);\n\n\t/** Get Doc Line ICMS.\n\t * Doc Line ICMS\n\t */\n\tpublic int getLBR_DocLine_ICMS_ID();\n\n /** Column name LBR_DocLine_ICMS_UU */\n public static final String COLUMNNAME_LBR_DocLine_ICMS_UU = \"LBR_DocLine_ICMS_UU\";\n\n\t/** Set Doc Line ICMS.\n\t * Doc Line ICMS\n\t */\n\tpublic void setLBR_DocLine_ICMS_UU (String LBR_DocLine_ICMS_UU);\n\n\t/** Get Doc Line ICMS.\n\t * Doc Line ICMS\n\t */\n\tpublic String getLBR_DocLine_ICMS_UU();\n\n /** Column name LBR_ICMS_OwnTaxStatus */\n public static final String COLUMNNAME_LBR_ICMS_OwnTaxStatus = \"LBR_ICMS_OwnTaxStatus\";\n\n\t/** Set Declarant ICMS Tax Status.\n\t * ICMS tax status from the point of view of the declarant\n\t */\n\tpublic void setLBR_ICMS_OwnTaxStatus (String LBR_ICMS_OwnTaxStatus);\n\n\t/** Get Declarant ICMS Tax Status.\n\t * ICMS tax status from the point of view of the declarant\n\t */\n\tpublic String getLBR_ICMS_OwnTaxStatus();\n\n /** Column name LBR_ICMS_TaxAmtOp */\n public static final String COLUMNNAME_LBR_ICMS_TaxAmtOp = \"LBR_ICMS_TaxAmtOp\";\n\n\t/** Set ICMS Tax Operation Amount.\n\t * Identifies the ICMS Tax Operation Amount\n\t */\n\tpublic void setLBR_ICMS_TaxAmtOp (BigDecimal LBR_ICMS_TaxAmtOp);\n\n\t/** Get ICMS Tax Operation Amount.\n\t * Identifies the ICMS Tax Operation Amount\n\t */\n\tpublic BigDecimal getLBR_ICMS_TaxAmtOp();\n\n /** Column name LBR_ICMS_TaxBaseType */\n public static final String COLUMNNAME_LBR_ICMS_TaxBaseType = \"LBR_ICMS_TaxBaseType\";\n\n\t/** Set ICMS Tax Base Type.\n\t * Identifies a ICMS Tax Base Type\n\t */\n\tpublic void setLBR_ICMS_TaxBaseType (String LBR_ICMS_TaxBaseType);\n\n\t/** Get ICMS Tax Base Type.\n\t * Identifies a ICMS Tax Base Type\n\t */\n\tpublic String getLBR_ICMS_TaxBaseType();\n\n /** Column name LBR_ICMS_TaxReliefType */\n public static final String COLUMNNAME_LBR_ICMS_TaxReliefType = \"LBR_ICMS_TaxReliefType\";\n\n\t/** Set ICMS Tax Relief Type.\n\t * Identifies the ICMS Tax Relief Type\n\t */\n\tpublic void setLBR_ICMS_TaxReliefType (String LBR_ICMS_TaxReliefType);\n\n\t/** Get ICMS Tax Relief Type.\n\t * Identifies the ICMS Tax Relief Type\n\t */\n\tpublic String getLBR_ICMS_TaxReliefType();\n\n /** Column name LBR_ICMS_TaxStatusSN */\n public static final String COLUMNNAME_LBR_ICMS_TaxStatusSN = \"LBR_ICMS_TaxStatusSN\";\n\n\t/** Set ICMS Tax Status (Simple).\n\t * Identifies a ICMS Tax Status in a simple taxation\n\t */\n\tpublic void setLBR_ICMS_TaxStatusSN (String LBR_ICMS_TaxStatusSN);\n\n\t/** Get ICMS Tax Status (Simple).\n\t * Identifies a ICMS Tax Status in a simple taxation\n\t */\n\tpublic String getLBR_ICMS_TaxStatusSN();\n\n /** Column name LBR_ICMS_TaxStatusTN */\n public static final String COLUMNNAME_LBR_ICMS_TaxStatusTN = \"LBR_ICMS_TaxStatusTN\";\n\n\t/** Set ICMS Tax Status (Standard Taxation).\n\t * Identifies a ICMS Tax Status in a standard taxation\n\t */\n\tpublic void setLBR_ICMS_TaxStatusTN (String LBR_ICMS_TaxStatusTN);\n\n\t/** Get ICMS Tax Status (Standard Taxation).\n\t * Identifies a ICMS Tax Status in a standard taxation\n\t */\n\tpublic String getLBR_ICMS_TaxStatusTN();\n\n /** Column name LBR_ICMSRegime */\n public static final String COLUMNNAME_LBR_ICMSRegime = \"LBR_ICMSRegime\";\n\n\t/** Set ICMS Regime.\n\t * Identifies a ICMS Regime for taxes\n\t */\n\tpublic void setLBR_ICMSRegime (String LBR_ICMSRegime);\n\n\t/** Get ICMS Regime.\n\t * Identifies a ICMS Regime for taxes\n\t */\n\tpublic String getLBR_ICMSRegime();\n\n /** Column name LBR_ICMSST_IsTaxIncluded */\n public static final String COLUMNNAME_LBR_ICMSST_IsTaxIncluded = \"LBR_ICMSST_IsTaxIncluded\";\n\n\t/** Set Price includes Tax.\n\t * Tax is included in the price \n\t */\n\tpublic void setLBR_ICMSST_IsTaxIncluded (boolean LBR_ICMSST_IsTaxIncluded);\n\n\t/** Get Price includes Tax.\n\t * Tax is included in the price \n\t */\n\tpublic boolean isLBR_ICMSST_IsTaxIncluded();\n\n /** Column name LBR_ICMSST_TaxAdded */\n public static final String COLUMNNAME_LBR_ICMSST_TaxAdded = \"LBR_ICMSST_TaxAdded\";\n\n\t/** Set ICMS-ST Added Amount Margin (%).\n\t * Identifies the ICMS-ST Added Amount Margin in percentage\n\t */\n\tpublic void setLBR_ICMSST_TaxAdded (BigDecimal LBR_ICMSST_TaxAdded);\n\n\t/** Get ICMS-ST Added Amount Margin (%).\n\t * Identifies the ICMS-ST Added Amount Margin in percentage\n\t */\n\tpublic BigDecimal getLBR_ICMSST_TaxAdded();\n\n /** Column name LBR_ICMSST_TaxAmt */\n public static final String COLUMNNAME_LBR_ICMSST_TaxAmt = \"LBR_ICMSST_TaxAmt\";\n\n\t/** Set ICMS-ST Tax Amount.\n\t * Defines the ICMS-ST Tax Amount\n\t */\n\tpublic void setLBR_ICMSST_TaxAmt (BigDecimal LBR_ICMSST_TaxAmt);\n\n\t/** Get ICMS-ST Tax Amount.\n\t * Defines the ICMS-ST Tax Amount\n\t */\n\tpublic BigDecimal getLBR_ICMSST_TaxAmt();\n\n /** Column name LBR_ICMSST_TaxAmtUFDes */\n public static final String COLUMNNAME_LBR_ICMSST_TaxAmtUFDes = \"LBR_ICMSST_TaxAmtUFDes\";\n\n\t/** Set ICMS-ST Amount in Receiver UF.\n\t * Identifies the ICMS-ST Amount in Receiver UF\n\t */\n\tpublic void setLBR_ICMSST_TaxAmtUFDes (BigDecimal LBR_ICMSST_TaxAmtUFDes);\n\n\t/** Get ICMS-ST Amount in Receiver UF.\n\t * Identifies the ICMS-ST Amount in Receiver UF\n\t */\n\tpublic BigDecimal getLBR_ICMSST_TaxAmtUFDes();\n\n /** Column name LBR_ICMSST_TaxAmtUFSen */\n public static final String COLUMNNAME_LBR_ICMSST_TaxAmtUFSen = \"LBR_ICMSST_TaxAmtUFSen\";\n\n\t/** Set ICMS-ST Amount withheld in Sender UF.\n\t * Identifies the ICMS-ST Amount withheld in Sender UF\n\t */\n\tpublic void setLBR_ICMSST_TaxAmtUFSen (BigDecimal LBR_ICMSST_TaxAmtUFSen);\n\n\t/** Get ICMS-ST Amount withheld in Sender UF.\n\t * Identifies the ICMS-ST Amount withheld in Sender UF\n\t */\n\tpublic BigDecimal getLBR_ICMSST_TaxAmtUFSen();\n\n /** Column name LBR_ICMSST_TaxAmtWhd */\n public static final String COLUMNNAME_LBR_ICMSST_TaxAmtWhd = \"LBR_ICMSST_TaxAmtWhd\";\n\n\t/** Set ICMS-ST Withheld Amount.\n\t * Identifies the ICMS-ST Withheld Amount\n\t */\n\tpublic void setLBR_ICMSST_TaxAmtWhd (BigDecimal LBR_ICMSST_TaxAmtWhd);\n\n\t/** Get ICMS-ST Withheld Amount.\n\t * Identifies the ICMS-ST Withheld Amount\n\t */\n\tpublic BigDecimal getLBR_ICMSST_TaxAmtWhd();\n\n /** Column name LBR_ICMSST_TaxBAmtUFDes */\n public static final String COLUMNNAME_LBR_ICMSST_TaxBAmtUFDes = \"LBR_ICMSST_TaxBAmtUFDes\";\n\n\t/** Set ICMS-ST Base Amount in Receiver UF.\n\t * Identifies the ICMS-ST Base Amount in Receiver UF\n\t */\n\tpublic void setLBR_ICMSST_TaxBAmtUFDes (BigDecimal LBR_ICMSST_TaxBAmtUFDes);\n\n\t/** Get ICMS-ST Base Amount in Receiver UF.\n\t * Identifies the ICMS-ST Base Amount in Receiver UF\n\t */\n\tpublic BigDecimal getLBR_ICMSST_TaxBAmtUFDes();\n\n /** Column name LBR_ICMSST_TaxBAmtUFSen */\n public static final String COLUMNNAME_LBR_ICMSST_TaxBAmtUFSen = \"LBR_ICMSST_TaxBAmtUFSen\";\n\n\t/** Set ICMS-ST Base Amount withheld in Sender UF.\n\t * Identifies the ICMS-ST Base Amount withheld in Sender UF\n\t */\n\tpublic void setLBR_ICMSST_TaxBAmtUFSen (BigDecimal LBR_ICMSST_TaxBAmtUFSen);\n\n\t/** Get ICMS-ST Base Amount withheld in Sender UF.\n\t * Identifies the ICMS-ST Base Amount withheld in Sender UF\n\t */\n\tpublic BigDecimal getLBR_ICMSST_TaxBAmtUFSen();\n\n /** Column name LBR_ICMSST_TaxBAmtWhd */\n public static final String COLUMNNAME_LBR_ICMSST_TaxBAmtWhd = \"LBR_ICMSST_TaxBAmtWhd\";\n\n\t/** Set ICMS-ST Withheld Base Amount.\n\t * Identifies the ICMS-ST Withheld Base Amount\n\t */\n\tpublic void setLBR_ICMSST_TaxBAmtWhd (BigDecimal LBR_ICMSST_TaxBAmtWhd);\n\n\t/** Get ICMS-ST Withheld Base Amount.\n\t * Identifies the ICMS-ST Withheld Base Amount\n\t */\n\tpublic BigDecimal getLBR_ICMSST_TaxBAmtWhd();\n\n /** Column name LBR_ICMSST_TaxBase */\n public static final String COLUMNNAME_LBR_ICMSST_TaxBase = \"LBR_ICMSST_TaxBase\";\n\n\t/** Set ICMS-ST Tax Base.\n\t * Indicates the ICMS-ST Tax Base\n\t */\n\tpublic void setLBR_ICMSST_TaxBase (BigDecimal LBR_ICMSST_TaxBase);\n\n\t/** Get ICMS-ST Tax Base.\n\t * Indicates the ICMS-ST Tax Base\n\t */\n\tpublic BigDecimal getLBR_ICMSST_TaxBase();\n\n /** Column name LBR_ICMSST_TaxBaseAmt */\n public static final String COLUMNNAME_LBR_ICMSST_TaxBaseAmt = \"LBR_ICMSST_TaxBaseAmt\";\n\n\t/** Set ICMS-ST Tax Base Amount.\n\t * Defines the ICMS-ST Tax Base Amount\n\t */\n\tpublic void setLBR_ICMSST_TaxBaseAmt (BigDecimal LBR_ICMSST_TaxBaseAmt);\n\n\t/** Get ICMS-ST Tax Base Amount.\n\t * Defines the ICMS-ST Tax Base Amount\n\t */\n\tpublic BigDecimal getLBR_ICMSST_TaxBaseAmt();\n\n /** Column name LBR_ICMSST_TaxBaseType */\n public static final String COLUMNNAME_LBR_ICMSST_TaxBaseType = \"LBR_ICMSST_TaxBaseType\";\n\n\t/** Set ICMS-ST Tax Base Type.\n\t * Identifies a ICMS-ST Tax Base Type\n\t */\n\tpublic void setLBR_ICMSST_TaxBaseType (String LBR_ICMSST_TaxBaseType);\n\n\t/** Get ICMS-ST Tax Base Type.\n\t * Identifies a ICMS-ST Tax Base Type\n\t */\n\tpublic String getLBR_ICMSST_TaxBaseType();\n\n /** Column name LBR_ICMSST_TaxRate */\n public static final String COLUMNNAME_LBR_ICMSST_TaxRate = \"LBR_ICMSST_TaxRate\";\n\n\t/** Set ICMS-ST Tax Rate.\n\t * Indicates the ICMS-ST Tax Rate\n\t */\n\tpublic void setLBR_ICMSST_TaxRate (BigDecimal LBR_ICMSST_TaxRate);\n\n\t/** Get ICMS-ST Tax Rate.\n\t * Indicates the ICMS-ST Tax Rate\n\t */\n\tpublic BigDecimal getLBR_ICMSST_TaxRate();\n\n /** Column name LBR_ICMSST_TaxUFDue_ID */\n public static final String COLUMNNAME_LBR_ICMSST_TaxUFDue_ID = \"LBR_ICMSST_TaxUFDue_ID\";\n\n\t/** Set ICMS-ST UF Due.\n\t * Identifies the ICMS-ST UF Due\n\t */\n\tpublic void setLBR_ICMSST_TaxUFDue_ID (int LBR_ICMSST_TaxUFDue_ID);\n\n\t/** Get ICMS-ST UF Due.\n\t * Identifies the ICMS-ST UF Due\n\t */\n\tpublic int getLBR_ICMSST_TaxUFDue_ID();\n\n\tpublic org.compiere.model.I_C_Region getLBR_ICMSST_TaxUFDue() throws RuntimeException;\n\n /** Column name LBR_ProductSource */\n public static final String COLUMNNAME_LBR_ProductSource = \"LBR_ProductSource\";\n\n\t/** Set Product Source.\n\t * Identifies a Product Source\n\t */\n\tpublic void setLBR_ProductSource (String LBR_ProductSource);\n\n\t/** Get Product Source.\n\t * Identifies a Product Source\n\t */\n\tpublic String getLBR_ProductSource();\n\n /** Column name LBR_TaxAmt */\n public static final String COLUMNNAME_LBR_TaxAmt = \"LBR_TaxAmt\";\n\n\t/** Set Tax Amount.\n\t * Defines the Tax Amount\n\t */\n\tpublic void setLBR_TaxAmt (BigDecimal LBR_TaxAmt);\n\n\t/** Get Tax Amount.\n\t * Defines the Tax Amount\n\t */\n\tpublic BigDecimal getLBR_TaxAmt();\n\n /** Column name LBR_TaxAmtCredit */\n public static final String COLUMNNAME_LBR_TaxAmtCredit = \"LBR_TaxAmtCredit\";\n\n\t/** Set Tax Amount Credit.\n\t * Identifies the Tax Amount Credit\n\t */\n\tpublic void setLBR_TaxAmtCredit (BigDecimal LBR_TaxAmtCredit);\n\n\t/** Get Tax Amount Credit.\n\t * Identifies the Tax Amount Credit\n\t */\n\tpublic BigDecimal getLBR_TaxAmtCredit();\n\n /** Column name LBR_TaxBase */\n public static final String COLUMNNAME_LBR_TaxBase = \"LBR_TaxBase\";\n\n\t/** Set Tax Base.\n\t * Indicates the Tax Base\n\t */\n\tpublic void setLBR_TaxBase (BigDecimal LBR_TaxBase);\n\n\t/** Get Tax Base.\n\t * Indicates the Tax Base\n\t */\n\tpublic BigDecimal getLBR_TaxBase();\n\n /** Column name LBR_TaxBaseAmt */\n public static final String COLUMNNAME_LBR_TaxBaseAmt = \"LBR_TaxBaseAmt\";\n\n\t/** Set Tax Base Amount.\n\t * Defines the Tax Base Amount\n\t */\n\tpublic void setLBR_TaxBaseAmt (BigDecimal LBR_TaxBaseAmt);\n\n\t/** Get Tax Base Amount.\n\t * Defines the Tax Base Amount\n\t */\n\tpublic BigDecimal getLBR_TaxBaseAmt();\n\n /** Column name LBR_TaxBaseOwnOperation */\n public static final String COLUMNNAME_LBR_TaxBaseOwnOperation = \"LBR_TaxBaseOwnOperation\";\n\n\t/** Set Tax Base Own Operation (%).\n\t * Identifies the Tax Base Own Operation in percentage\n\t */\n\tpublic void setLBR_TaxBaseOwnOperation (BigDecimal LBR_TaxBaseOwnOperation);\n\n\t/** Get Tax Base Own Operation (%).\n\t * Identifies the Tax Base Own Operation in percentage\n\t */\n\tpublic BigDecimal getLBR_TaxBaseOwnOperation();\n\n /** Column name LBR_TaxDeferralAmt */\n public static final String COLUMNNAME_LBR_TaxDeferralAmt = \"LBR_TaxDeferralAmt\";\n\n\t/** Set Tax Deferral Amount.\n\t * Identifies the Tax Deferral Amount\n\t */\n\tpublic void setLBR_TaxDeferralAmt (BigDecimal LBR_TaxDeferralAmt);\n\n\t/** Get Tax Deferral Amount.\n\t * Identifies the Tax Deferral Amount\n\t */\n\tpublic BigDecimal getLBR_TaxDeferralAmt();\n\n /** Column name LBR_TaxDeferralRate */\n public static final String COLUMNNAME_LBR_TaxDeferralRate = \"LBR_TaxDeferralRate\";\n\n\t/** Set Tax Deferral Rate (%).\n\t * Identifies the Tax Deferral Rate (%)\n\t */\n\tpublic void setLBR_TaxDeferralRate (BigDecimal LBR_TaxDeferralRate);\n\n\t/** Get Tax Deferral Rate (%).\n\t * Identifies the Tax Deferral Rate (%)\n\t */\n\tpublic BigDecimal getLBR_TaxDeferralRate();\n\n /** Column name LBR_TaxRate */\n public static final String COLUMNNAME_LBR_TaxRate = \"LBR_TaxRate\";\n\n\t/** Set Tax Rate.\n\t * Indicates the Tax Rate\n\t */\n\tpublic void setLBR_TaxRate (BigDecimal LBR_TaxRate);\n\n\t/** Get Tax Rate.\n\t * Indicates the Tax Rate\n\t */\n\tpublic BigDecimal getLBR_TaxRate();\n\n /** Column name LBR_TaxRateCredit */\n public static final String COLUMNNAME_LBR_TaxRateCredit = \"LBR_TaxRateCredit\";\n\n\t/** Set Tax Rate Credit (%).\n\t * Identifies the Tax Rate Credit in percentage\n\t */\n\tpublic void setLBR_TaxRateCredit (BigDecimal LBR_TaxRateCredit);\n\n\t/** Get Tax Rate Credit (%).\n\t * Identifies the Tax Rate Credit in percentage\n\t */\n\tpublic BigDecimal getLBR_TaxRateCredit();\n\n /** Column name LBR_TaxReliefAmt */\n public static final String COLUMNNAME_LBR_TaxReliefAmt = \"LBR_TaxReliefAmt\";\n\n\t/** Set Tax Relief Amount.\n\t * Identifies the Tax Relief Amount\n\t */\n\tpublic void setLBR_TaxReliefAmt (BigDecimal LBR_TaxReliefAmt);\n\n\t/** Get Tax Relief Amount.\n\t * Identifies the Tax Relief Amount\n\t */\n\tpublic BigDecimal getLBR_TaxReliefAmt();\n\n /** Column name Updated */\n public static final String COLUMNNAME_Updated = \"Updated\";\n\n\t/** Get Updated.\n\t * Date this record was updated\n\t */\n\tpublic Timestamp getUpdated();\n\n /** Column name UpdatedBy */\n public static final String COLUMNNAME_UpdatedBy = \"UpdatedBy\";\n\n\t/** Get Updated By.\n\t * User who updated this records\n\t */\n\tpublic int getUpdatedBy();\n}", "@Generated(hash = 1070169441)\npublic void setDocumento(Documento documento) {\n synchronized (this) {\n this.documento = documento;\n documentoId = documento == null ? null : documento.getId();\n documento__resolvedKey = documentoId;\n }\n}", "public void ingresarCalificacionDoc(String docencia, String identificacion, String periodo, String calificacion) {\n\t\tSystem.out.println(\"Paso BO\"+ docencia+\" \"+identificacion+\" \"+periodo+\" \"+calificacion);\n\t\tArrayList<String> parameters = new ArrayList<String>();\n\t\tparameters.add(docencia);\n\t\tparameters.add(identificacion);\n\t\tparameters.add(periodo);\n\t\tparameters.add(calificacion);\n\t\ttry{\n\t\t\tthis.objADAO.ingresarCalificacionDoc(parameters);\n\t\t} catch(Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\t\t\n\t}", "public interface DocumentManager extends Manager {\n\n /* Document related properties */\n public static final String DOCUMENT_THUMBNAIL_PROPERTY = \"dell.document.thumbnail\";\n\n /**\n * Method to retrieve the the Document objects list\n *\n * @return - List of Document's\n */\n Collection<Document> getDocuments();\n\n\n /**\n * Method to retrieve the list of Document's using retailer siteID\n *\n * @param retailerSiteID\n * @return -Return the list of Document's with matching siteID\n * @see com.dell.acs.persistence.domain.RetailerSite\n */\n @Deprecated\n Collection<Document> getDocumentByRetailerSiteID(Long retailerSiteID);\n\n // Library page helper method\n @Deprecated\n Collection<Document> getLatestDocuments(Long retailerSiteID);\n\n public boolean doesDocumentExists(Document document);\n /* Document management related methods */\n\n\n /**\n * Method to persist the Document object\n *\n * @return - Return the document object\n */\n Document saveDocument(Document document) throws EntityExistsException;\n\n /**\n * Method to load the Document by ID\n *\n * @param documentID - Document ID\n * @return - Document object with ID = documentID\n */\n Document getDocument(Long documentID) throws EntityNotFoundException;\n\n /**\n * Method to delete a Document object by ID\n *\n * @param documentID - Document ID\n */\n void deleteDocument(Long documentID) throws EntityNotFoundException;\n\n /**\n * Method to get the BASECDN path for Document\n *\n * @param document\n * @return\n */\n String getBaseCDNPathForDocument(Document document);\n\n /**\n * To get the filtered documents.\n *\n * @param paramsMap\n * @return\n */\n List<Map<String, String>> getFilteredDocuments(Map<String, Object> paramsMap);\n\n\n // <======= New methods introduced in sprint 4 =======>\n\n /**\n Retrieve the published document.\n @param documentId, store the document id.\n @param type , store the document type.\n @return published document name.\n */\n @Deprecated\n String getDocumentNameByID(Long documentId,Integer type);\n\n /**\n Check the name existence , so that duplicate entry not allowed.\n It checks during ajax call.\n @param documentName , store the document name.\n @return boolean status , according to existence status.\n @throws NonUniqueResultException\n */\n @Deprecated\n boolean checkNameExistence(String documentName) throws NonUniqueResultException;\n\n /**\n * Method to load the Document by ID and type.\n *\n * @param documentID - Long - document ID\n * @return - Document object with ID = documentID\n * @throws - EntityNotFoundException - if document with given ID and type is not found.\n */\n Document getDocument(Long documentID, Integer type) throws EntityNotFoundException;\n\n /**\n * retrieve the documents on the basis of RetailerSite and source Type.\n *\n * @param retailerSiteID - Long - retailer site ID\n * @param type - Integer - Refer {@link com.dell.acs.content.EntityConstants}\n * @return Collection of {@link Document}\n */\n Collection<Document> getDocuments(Long retailerSiteID, Integer type, ServiceFilterBean filterBean);\n\n /**\n * retrieve the documents on the basis of RetailerSite Name and source Type.\n *\n * @param retailerSiteName - String - retailer site name\n * @param type - Integer - Refer {@link com.dell.acs.content.EntityConstants}\n * @return Collection of {@link}\n */\n Collection<Document> getDocuments(String retailerSiteName, Integer type, ServiceFilterBean filterBean);\n\n\n}", "public DocumentoBase getDocumentoBase()\r\n/* 130: */ {\r\n/* 131:154 */ return this.documentoBase;\r\n/* 132: */ }", "public ingresarBiblioteca() {\n initComponents();\n this.nombreUsuario.setText(usuariosID[0].getNombre());\n this.Picture.setFont(new java.awt.Font(\"Dialog\", java.awt.Font.PLAIN,10));\n usuario.insertarInicio(this.nombreUsuario.getText()/*, carpeta*/);\n usuario.obtenerNodo(0).getArchivo().insertarFinal(\"GENERAL\");//carpeta.insertarFinal(\"GENERAL\");\n }", "private void editar(HttpPresentationComms comms) throws HttpPresentationException, KeywordValueException {\n/* 149 */ int idRecurso = 0;\n/* */ try {\n/* 151 */ idRecurso = Integer.parseInt(comms.request.getParameter(\"idRecurso\"));\n/* */ }\n/* 153 */ catch (Exception e) {}\n/* */ \n/* */ \n/* 156 */ PrcRecursoDAO ob = new PrcRecursoDAO();\n/* 157 */ PrcRecursoDTO reg = ob.cargarRegistro(idRecurso);\n/* 158 */ if (reg != null) {\n/* 159 */ this.pagHTML.getElementIdRecurso().setValue(\"\" + reg.getIdRecurso());\n/* 160 */ this.pagHTML.getElementDescripcionRecurso().setValue(\"\" + reg.getDescripcionRecurso());\n/* 161 */ this.pagHTML.getElementUsuarioInsercion().setValue(\"\" + reg.getUsuarioInsercion());\n/* 162 */ this.pagHTML.getElementFechaInsercion().setValue(\"\" + reg.getFechaInsercion());\n/* 163 */ this.pagHTML.getElementUsuarioModificacion().setValue(\"\" + reg.getUsuarioModificacion());\n/* 164 */ this.pagHTML.getElementFechaModificacion().setValue(\"\" + reg.getFechaModificacion());\n/* 165 */ HTMLSelectElement combo = this.pagHTML.getElementIdTipoRecurso();\n/* 166 */ comboMultivalores(combo, \"tipo_recurso\", \"\" + reg.getIdTipoRecurso(), true);\n/* */ \n/* 168 */ combo = this.pagHTML.getElementIdProcedimiento();\n/* 169 */ llenarCombo(combo, \"prc_procedimientos\", \"id_procedimiento\", \"objetivo\", \"1=1\", \"\" + reg.getIdProcedimiento(), true);\n/* */ \n/* 171 */ combo = this.pagHTML.getElementEstado();\n/* 172 */ comboMultivalores(combo, \"estado_activo_inactivo\", \"\" + reg.getEstado(), true);\n/* */ \n/* */ \n/* 175 */ this.pagHTML.getElementIdRecurso().setReadOnly(true);\n/* */ } \n/* 177 */ this.pagHTML.getElement_operacion().setValue(\"M\");\n/* 178 */ activarVista(\"nuevo\");\n/* */ }", "@SuppressWarnings(\"all\")\npublic interface I_LBR_MDFeUnloadDoc \n{\n\n /** TableName=LBR_MDFeUnloadDoc */\n public static final String Table_Name = \"LBR_MDFeUnloadDoc\";\n\n /** AD_Table_ID=1120355 */\n public static final int Table_ID = MTable.getTable_ID(Table_Name);\n\n KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);\n\n /** AccessLevel = 3 - Client - Org \n */\n BigDecimal accessLevel = BigDecimal.valueOf(3);\n\n /** Load Meta Data */\n\n /** Column name AD_Client_ID */\n public static final String COLUMNNAME_AD_Client_ID = \"AD_Client_ID\";\n\n\t/** Get Client.\n\t * Client/Tenant for this installation.\n\t */\n\tpublic int getAD_Client_ID();\n\n /** Column name AD_Org_ID */\n public static final String COLUMNNAME_AD_Org_ID = \"AD_Org_ID\";\n\n\t/** Set Organization.\n\t * Organizational entity within client\n\t */\n\tpublic void setAD_Org_ID (int AD_Org_ID);\n\n\t/** Get Organization.\n\t * Organizational entity within client\n\t */\n\tpublic int getAD_Org_ID();\n\n /** Column name C_Region_ID */\n public static final String COLUMNNAME_C_Region_ID = \"C_Region_ID\";\n\n\t/** Set Region.\n\t * Identifies a geographical Region\n\t */\n\tpublic void setC_Region_ID (int C_Region_ID);\n\n\t/** Get Region.\n\t * Identifies a geographical Region\n\t */\n\tpublic int getC_Region_ID();\n\n\tpublic org.compiere.model.I_C_Region getC_Region() throws RuntimeException;\n\n /** Column name Created */\n public static final String COLUMNNAME_Created = \"Created\";\n\n\t/** Get Created.\n\t * Date this record was created\n\t */\n\tpublic Timestamp getCreated();\n\n /** Column name CreatedBy */\n public static final String COLUMNNAME_CreatedBy = \"CreatedBy\";\n\n\t/** Get Created By.\n\t * User who created this records\n\t */\n\tpublic int getCreatedBy();\n\n /** Column name DateDoc */\n public static final String COLUMNNAME_DateDoc = \"DateDoc\";\n\n\t/** Set Document Date.\n\t * Date of the Document\n\t */\n\tpublic void setDateDoc (Timestamp DateDoc);\n\n\t/** Get Document Date.\n\t * Date of the Document\n\t */\n\tpublic Timestamp getDateDoc();\n\n /** Column name DateTrx */\n public static final String COLUMNNAME_DateTrx = \"DateTrx\";\n\n\t/** Set Transaction Date.\n\t * Transaction Date\n\t */\n\tpublic void setDateTrx (Timestamp DateTrx);\n\n\t/** Get Transaction Date.\n\t * Transaction Date\n\t */\n\tpublic Timestamp getDateTrx();\n\n /** Column name Description */\n public static final String COLUMNNAME_Description = \"Description\";\n\n\t/** Set Description.\n\t * Optional short description of the record\n\t */\n\tpublic void setDescription (String Description);\n\n\t/** Get Description.\n\t * Optional short description of the record\n\t */\n\tpublic String getDescription();\n\n /** Column name GrandTotal */\n public static final String COLUMNNAME_GrandTotal = \"GrandTotal\";\n\n\t/** Set Grand Total.\n\t * Total amount of document\n\t */\n\tpublic void setGrandTotal (BigDecimal GrandTotal);\n\n\t/** Get Grand Total.\n\t * Total amount of document\n\t */\n\tpublic BigDecimal getGrandTotal();\n\n /** Column name IsActive */\n public static final String COLUMNNAME_IsActive = \"IsActive\";\n\n\t/** Set Active.\n\t * The record is active in the system\n\t */\n\tpublic void setIsActive (boolean IsActive);\n\n\t/** Get Active.\n\t * The record is active in the system\n\t */\n\tpublic boolean isActive();\n\n /** Column name LBR_MDFeDocType */\n public static final String COLUMNNAME_LBR_MDFeDocType = \"LBR_MDFeDocType\";\n\n\t/** Set MDFe Document Type.\n\t * MDFe Document Type\n\t */\n\tpublic void setLBR_MDFeDocType (String LBR_MDFeDocType);\n\n\t/** Get MDFe Document Type.\n\t * MDFe Document Type\n\t */\n\tpublic String getLBR_MDFeDocType();\n\n /** Column name LBR_MDFeUnloadDoc_ID */\n public static final String COLUMNNAME_LBR_MDFeUnloadDoc_ID = \"LBR_MDFeUnloadDoc_ID\";\n\n\t/** Set Documento de Descarregamento do MDFe\t */\n\tpublic void setLBR_MDFeUnloadDoc_ID (int LBR_MDFeUnloadDoc_ID);\n\n\t/** Get Documento de Descarregamento do MDFe\t */\n\tpublic int getLBR_MDFeUnloadDoc_ID();\n\n /** Column name LBR_MDFeUnload_ID */\n public static final String COLUMNNAME_LBR_MDFeUnload_ID = \"LBR_MDFeUnload_ID\";\n\n\t/** Set Descarregamento do Manifesto\t */\n\tpublic void setLBR_MDFeUnload_ID (int LBR_MDFeUnload_ID);\n\n\t/** Get Descarregamento do Manifesto\t */\n\tpublic int getLBR_MDFeUnload_ID();\n\n\tpublic org.adempierelbr.model.I_LBR_MDFeUnload getLBR_MDFeUnload() throws RuntimeException;\n\n /** Column name LBR_NotaFiscal_ID */\n public static final String COLUMNNAME_LBR_NotaFiscal_ID = \"LBR_NotaFiscal_ID\";\n\n\t/** Set Nota Fiscal.\n\t * Primary key table LBR_NotaFiscal\n\t */\n\tpublic void setLBR_NotaFiscal_ID (int LBR_NotaFiscal_ID);\n\n\t/** Get Nota Fiscal.\n\t * Primary key table LBR_NotaFiscal\n\t */\n\tpublic int getLBR_NotaFiscal_ID();\n\n\tpublic org.adempierelbr.model.I_LBR_NotaFiscal getLBR_NotaFiscal() throws RuntimeException;\n\n /** Column name LBR_SubSerie */\n public static final String COLUMNNAME_LBR_SubSerie = \"LBR_SubSerie\";\n\n\t/** Set Sub Serie.\n\t * Sub Serie\n\t */\n\tpublic void setLBR_SubSerie (String LBR_SubSerie);\n\n\t/** Get Sub Serie.\n\t * Sub Serie\n\t */\n\tpublic String getLBR_SubSerie();\n\n /** Column name PIN */\n public static final String COLUMNNAME_PIN = \"PIN\";\n\n\t/** Set PIN.\n\t * Personal Identification Number\n\t */\n\tpublic void setPIN (String PIN);\n\n\t/** Get PIN.\n\t * Personal Identification Number\n\t */\n\tpublic String getPIN();\n\n /** Column name Updated */\n public static final String COLUMNNAME_Updated = \"Updated\";\n\n\t/** Get Updated.\n\t * Date this record was updated\n\t */\n\tpublic Timestamp getUpdated();\n\n /** Column name UpdatedBy */\n public static final String COLUMNNAME_UpdatedBy = \"UpdatedBy\";\n\n\t/** Get Updated By.\n\t * User who updated this records\n\t */\n\tpublic int getUpdatedBy();\n\n /** Column name lbr_Barcode2 */\n public static final String COLUMNNAME_lbr_Barcode2 = \"lbr_Barcode2\";\n\n\t/** Set Barcode 2.\n\t * Second Barcode of the Nota Fiscal\n\t */\n\tpublic void setlbr_Barcode2 (String lbr_Barcode2);\n\n\t/** Get Barcode 2.\n\t * Second Barcode of the Nota Fiscal\n\t */\n\tpublic String getlbr_Barcode2();\n\n /** Column name lbr_CNPJ */\n public static final String COLUMNNAME_lbr_CNPJ = \"lbr_CNPJ\";\n\n\t/** Set CNPJ.\n\t * Used to identify Legal Entities in Brazil\n\t */\n\tpublic void setlbr_CNPJ (String lbr_CNPJ);\n\n\t/** Get CNPJ.\n\t * Used to identify Legal Entities in Brazil\n\t */\n\tpublic String getlbr_CNPJ();\n\n /** Column name lbr_NFSerie */\n public static final String COLUMNNAME_lbr_NFSerie = \"lbr_NFSerie\";\n\n\t/** Set NF Serie\t */\n\tpublic void setlbr_NFSerie (String lbr_NFSerie);\n\n\t/** Get NF Serie\t */\n\tpublic String getlbr_NFSerie();\n\n /** Column name lbr_NFeID */\n public static final String COLUMNNAME_lbr_NFeID = \"lbr_NFeID\";\n\n\t/** Set NFe ID.\n\t * Identification of NFe\n\t */\n\tpublic void setlbr_NFeID (String lbr_NFeID);\n\n\t/** Get NFe ID.\n\t * Identification of NFe\n\t */\n\tpublic String getlbr_NFeID();\n\n /** Column name lbr_NFeProt */\n public static final String COLUMNNAME_lbr_NFeProt = \"lbr_NFeProt\";\n\n\t/** Set NFe Protocol\t */\n\tpublic void setlbr_NFeProt (String lbr_NFeProt);\n\n\t/** Get NFe Protocol\t */\n\tpublic String getlbr_NFeProt();\n}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n\tpublic void aumenta(int i) {\n\t\t\n\t}", "Documento createDocumento();", "public void generarDoc(){\n generarDocP();\n }", "public void generarDocumentosCoactivosAnteriores() {\n\n try {\n\n StringBuilder sql = new StringBuilder();\n\n sql.append(\"Set Language 'Español'\");\n\n Query update = em.createNativeQuery(sql.toString());\n update.executeUpdate();\n\n // Consulta de coactivos\n sql = new StringBuilder();\n sql.append(\n \"SELECT c.id_proceso, c.id_coactivo, p.fecha_inicio, c.valor_total_obligaciones, p.numero_proceso, tp.id_trazabilidad_proceso , tp2.id_trazabilidad_proceso as traza2 \");\n sql.append(\"FROM coactivo c \");\n sql.append(\"JOIN proceso p ON p.id_proceso = c.id_proceso \");\n sql.append(\"JOIN trazabilidad_proceso tp ON p.id_proceso = tp.id_proceso \");\n sql.append(\"AND tp.id_estado_proceso = 22 \");\n sql.append(\"JOIN trazabilidad_proceso tp2 ON p.id_proceso = tp2.id_proceso \");\n sql.append(\"AND tp2.id_estado_proceso = 24 \");\n sql.append(\"WHERE NOT EXISTS (SELECT 1 FROM trazabilidad_proceso tp \");\n sql.append(\n \"WHERE EXISTS (select 1 from documento_proceso dp where dp.id_trazabilidad_proceso = tp.id_trazabilidad_proceso) \");\n sql.append(\"AND tp.id_proceso = p.id_proceso) \");\n sql.append(\"AND CAST(p.numero_proceso AS bigint) <= 6179 \");\n sql.append(\"ORDER BY c.id_coactivo\");\n\n Query query = em.createNativeQuery(sql.toString());\n\n @SuppressWarnings(\"unchecked\")\n List<Object[]> listaResultados = Utilidades.safeList(query.getResultList());\n\n for (Object[] filaCoactivo : listaResultados) {\n iLCoactivo.generarDocumentosAnteriores(filaCoactivo);\n }\n } catch (Exception e) {\n logger.error(\"Error en generación de documento de apertura de coactivo\", e);\n\n }\n }", "private void verRegistro(HttpPresentationComms comms) throws HttpPresentationException, KeywordValueException {\n/* 256 */ int idRecurso = 0;\n/* */ try {\n/* 258 */ idRecurso = Integer.parseInt(comms.request.getParameter(\"idRecurso\"));\n/* */ }\n/* 260 */ catch (Exception e) {}\n/* */ \n/* */ \n/* 263 */ PrcRecursoDAO ob = new PrcRecursoDAO();\n/* 264 */ PrcRecursoDTO reg = ob.cargarRegistro(idRecurso);\n/* 265 */ if (reg != null) {\n/* 266 */ this.pagHTML.setTextIdRecursoEd(\"\" + reg.getIdRecurso());\n/* 267 */ this.pagHTML.setTextIdTipoRecursoEd(\"\" + reg.getNombreIdTipoRecurso());\n/* 268 */ this.pagHTML.setTextDescripcionRecursoEd(\"\" + reg.getDescripcionRecurso());\n/* 269 */ this.pagHTML.setTextIdProcedimientoEd(\"\" + reg.getNombreIdProcedimiento());\n/* 270 */ this.pagHTML.setTextEstadoEd(\"\" + reg.getNombreEstado());\n/* 271 */ this.pagHTML.setTextUsuarioInsercionEd(\"\" + reg.getUsuarioInsercion());\n/* 272 */ this.pagHTML.setTextUsuarioModificacionEd(\"\" + reg.getUsuarioModificacion());\n/* 273 */ this.pagHTML.setTextFechaModificacionEd(\"\" + reg.getFechaModificacion());\n/* */ \n/* 275 */ this.pagHTML.getElementIdRecursoKey().setValue(\"\" + reg.getIdRecurso());\n/* 276 */ this.pagHTML.getElement_operacion().setValue(\"P\");\n/* */ } \n/* 278 */ activarVista(\"editar\");\n/* */ }", "public int getC_DocType_ID();", "public int getC_DocType_ID();", "public String getDocumentNo();", "public String getDocumentNo();", "public String getDocumentNo();", "public void processRequest(OAPageContext pageContext, OAWebBean webBean) {\n super.processRequest(pageContext, webBean);\n CuxDocinfoManageAMImpl pgAM = \n (CuxDocinfoManageAMImpl)pageContext.getRootApplicationModule();\n String docId = pageContext.getParameter(\"UpdateDocId\");\n if (docId == null || \"\".equals(docId)) {\n pgAM.initCreatePG();\n webBean.findChildRecursive(\"DocumentTypeName\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.FALSE);\n webBean.findChildRecursive(\"CountryName\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.FALSE);\n webBean.findChildRecursive(\"DocNumber\").setAttributeValue(this.RENDERED_ATTR, \n Boolean.FALSE);\n webBean.findChildRecursive(\"IsArchive\").setAttributeValue(this.RENDERED_ATTR, \n Boolean.FALSE);\n webBean.findChildRecursive(\"IsEndActive\").setAttributeValue(this.RENDERED_ATTR, \n Boolean.FALSE);\n } else {\n pgAM.initCreatePG(docId);\n webBean.findChildRecursive(\"IsArchive\").setAttributeValue(this.RENDERED_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"IsEndActive\").setAttributeValue(this.RENDERED_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"DocumentTypeName\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"CountryName\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"DocNumber\").setAttributeValue(this.RENDERED_ATTR, \n Boolean.TRUE);\n\n CuxDocinfoManageTVOImpl vo = pgAM.getCuxDocinfoManageTVO1();\n CuxDocinfoManageTVORowImpl row = \n (CuxDocinfoManageTVORowImpl)vo.first();\n\n if (\"CON\".equals(row.getDocTypeCode())) {\n webBean.findChildRecursive(\"DocNumber\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.FALSE);\n }\n\n /*归档后仅能失效或者取消归档*/\n if (\"Y\".equals(row.getIsArchive())) {\n webBean.findChildRecursive(\"DocNumber\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"AreaAlias\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"ProjectName\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"RelationCorpName\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"OtherCorpName\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"LangName\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"IsSigned\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"DocCopyName\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"IsEvlSheet\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"SubmitterPersonName\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"Remark\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n\n }\n if (\"Y\".equals(row.getIsEndActive())) {\n webBean.findChildRecursive(\"DocNumber\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"AreaAlias\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"ProjectName\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"RelationCorpName\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"OtherCorpName\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"LangName\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"IsSigned\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"DocCopyName\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"IsEvlSheet\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"SubmitterPersonName\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"Remark\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"IsArchive\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n webBean.findChildRecursive(\"IsEndActive\").setAttributeValue(this.READ_ONLY_ATTR, \n Boolean.TRUE);\n\n }\n\n }\n\n }", "public void setDocenteId(int docenteId) {\r\n this.docenteId = docenteId;\r\n }", "public TipoDocumentoMB() {\n tipoDoc = new TipoDocPersona();\n }", "public ModificarDocentes1() {\n initComponents();\n }", "public int getC_DocTypeTarget_ID();", "private String getSubDocumentoKey(PreDocumentoEntrata preDoc) {\n\t\t\n\t\treturn (preDoc.getCapitoloEntrataGestione()!=null?preDoc.getCapitoloEntrataGestione().getUid() :\"null\") + \" \" \n\t\t\t\t+ (preDoc.getAccertamento()!=null?preDoc.getAccertamento().getUid():\"null\") + \" \" \n\t\t\t\t+ (preDoc.getSubAccertamento()!=null?preDoc.getSubAccertamento().getUid():\"null\") + \" \"\n\t\t\t\t+ (preDoc.getProvvisorioDiCassa() !=null?preDoc.getProvvisorioDiCassa().getUid() :\"null\") + \" \";\n\t}", "public interface ModeloProdutoProduto extends DCIObjetoDominio , ModeloProdutoProdutoAgregadoI , ModeloProdutoProdutoDerivadaI\n{\n\n\t\n\tpublic long getIdModeloProdutoProduto();\n\tpublic void setIdModeloProdutoProduto(long valor);\n\t\n\t\n\tpublic long getIdModeloProdutoRa();\n\tpublic void setIdModeloProdutoRa(long valor);\n\t\n\t\n\tpublic long getIdProdutoRa();\n\tpublic void setIdProdutoRa(long valor);\n\t\n\t\n}", "com.soa.SolicitarCreditoDocument.SolicitarCredito getSolicitarCredito();", "public ModDocument() {\r\n\t\tsuper();\r\n\t}", "@Override\r\n public String getDocid() {\r\n return docid;\r\n }", "public boolean existeix_Doc(String titol, String autor) {\n return this.M.containsKey(titol+\", \"+autor);\n }", "public interface IJavaDocAttributDao\n{\n List<JavaDocAttribut> getJavaDocAttributs(int idJavaDocMethode);\n}", "com.soa.SolicitarServicioDocument.SolicitarServicio getSolicitarServicio();", "public void setDocumentNo (String DocumentNo);", "public void setDocumentNo (String DocumentNo);", "public void setDocumentNo (String DocumentNo);", "public void setRelDocument(int v) \n {\n \n if (this.relDocument != v)\n {\n this.relDocument = v;\n setModified(true);\n }\n \n \n }", "@Test\n public void test2()\n {\n documentIO.serialize(document);\n documentIO.deserialize(document.getKey());\n }", "public void emprunter(Document doc) {//public boolean emprunterLivre(Livre livre,MEdiatheque mediatheque)\n ajouterEmprunt(new Emprunt(doc));\n }", "public Mediatheque() {\n\n Document libro1 = new Document(new Id(1), new Titre(\"El senor de los anillos\"), new Livre(new Auteur(\"Tolkin\")));\n Document libro2 = new Document(new Id(2), new Titre(\"Dracula\"), new Livre(new Auteur(\"Copola\")));\n Document libro3 = new Document(new Id(3), new Titre(\"The Tower\"), new Livre(new Auteur(\"Charles\")));\n Document libro4 = new Document(new Id(4), new Titre(\"Game Of Thrones\"), new Livre(new Auteur(\"George Martin\")));\n Document libro5 = new Document(new Id(5), new Titre(\"Spiderman\"), new Livre(new Auteur(\"Raimi\")));\n\n Document cd1 = new Document(new Id(6), new Titre(\"Briam Adams\"), new Livre(new Auteur(\"John\")));\n Document cd2 = new Document(new Id(7), new Titre(\"Green Day\"), new Livre(new Auteur(\"They\")));\n Document cd3 = new Document(new Id(8), new Titre(\"Poker Face\"), new Livre(new Auteur(\"Lady Gaga\")));\n Document cd4 = new Document(new Id(9), new Titre(\"Hans Zimmer\"), new Livre(new Auteur(\"Him\")));\n Document cd5 = new Document(new Id(10), new Titre(\"Briam Adams\"), new Livre(new Auteur(\"John\")));\n\n //se agregan estos documentos\n ajoutDoc(libro1, libro2, libro3, libro4, libro5, cd1, cd2, cd3, cd4, cd5);\n\n Adherant adherant1 = new Adherant(\"jorgelu5\");\n Adherant adherant2 = new Adherant(\"jorgel_fant\");\n Adherant adherant3 = new Adherant(\"200311402\");\n Adherant adherant4 = new Adherant(\"Mario\");\n Adherant adherant5 = new Adherant(\"Luis\");\n\n //se agregan estos documentos\n ajoutAd(adherant1, adherant2, adherant3, adherant4, adherant5);\n }", "@Override\r\n public String toString() {\n return tipodocumento;\r\n }", "public void setupBaseConvenienceObjects(MaintenanceDocument document);", "@ProvidedBy(ODocumentWrapperProvider.class)\n@EntityType(value = OSecurityShared.RESTRICTED_CLASSNAME)\npublic interface IORestricted extends IODocumentWrapper {\n\t\n\t@EntityProperty(\"_allow\")\n\tpublic Set<OIdentifiable> getAllowAll();\n\t@EntityProperty(\"_allow\")\n\tpublic IORestricted setAllowAll(Set<OIdentifiable> identifiables);\n\t\n\tpublic default IORestricted addToAllowAll(OIdentifiable identifiable) {\n\t\treturn setAllowAll(addSafely(getAllowAll(), identifiable));\n\t}\n\t\n\tpublic default IORestricted remoteFromAllowAll(OIdentifiable identifiable) {\n\t\treturn setAllowAll(removeSafely(getAllowAll(), identifiable));\n\t}\n\t\n\t@EntityProperty(\"_allowRead\")\n\tpublic Set<OIdentifiable> getAllowRead();\n\t@EntityProperty(\"_allowRead\")\n\tpublic IORestricted setAllowRead(Set<OIdentifiable> identifiables);\n\t\n\tpublic default IORestricted addToAllowRead(OIdentifiable identifiable) {\n\t\treturn setAllowRead(addSafely(getAllowRead(), identifiable));\n\t}\n\t\n\tpublic default IORestricted remoteFromAllowRead(OIdentifiable identifiable) {\n\t\treturn setAllowRead(removeSafely(getAllowRead(), identifiable));\n\t}\n\t\n\t@EntityProperty(\"_allowUpdate\")\n\tpublic Set<OIdentifiable> getAllowUpdate();\n\t@EntityProperty(\"_allowUpdate\")\n\tpublic IORestricted setAllowUpdate(Set<OIdentifiable> identifiables);\n\t\n\tpublic default IORestricted addToAllowUpdate(OIdentifiable identifiable) {\n\t\treturn setAllowUpdate(addSafely(getAllowUpdate(), identifiable));\n\t}\n\t\n\tpublic default IORestricted remoteFromAllowUpdate(OIdentifiable identifiable) {\n\t\treturn setAllowUpdate(removeSafely(getAllowUpdate(), identifiable));\n\t}\n\t\n\t@EntityProperty(\"_allowDelete\")\n\tpublic Set<OIdentifiable> getAllowDelete();\n\t@EntityProperty(\"_allowDelete\")\n\tpublic IORestricted setAllowDelete(Set<OIdentifiable> identifiables);\n\t\n\tpublic default IORestricted addToAllowDelete(OIdentifiable identifiable) {\n\t\treturn setAllowDelete(addSafely(getAllowDelete(), identifiable));\n\t}\n\t\n\tpublic default IORestricted remoteFromAllowDelete(OIdentifiable identifiable) {\n\t\treturn setAllowDelete(removeSafely(getAllowDelete(), identifiable));\n\t}\n\t\n\tpublic static Set<OIdentifiable> addSafely(Set<OIdentifiable> set, OIdentifiable identifiable) {\n\t\tif(set==null) set = new HashSet<OIdentifiable>();\n\t\tset.add(identifiable);\n\t\treturn set;\n\t}\n\t\n\tpublic static Set<OIdentifiable> removeSafely(Set<OIdentifiable> set, OIdentifiable identifiable) {\n\t\tif(set==null) return set;\n\t\tset.remove(identifiable);\n\t\treturn set;\n\t}\n}", "private void indexDocumentHelper(HashMap<String, StringBuilder> fm)\n\t\t\tthrows IOException {\n\n\t\tIndexWriter writer = getIndexWriter();\n\n\t\tDocument doc = new Document();\n\n\t\tfor (int i = 0; i < fieldNames.length; i++) {\n\n\t\t\tif (fieldNames[i].equals(\"DOCNO\")) {\n\n\t\t\t\tdoc.add(new StringField(fieldNames[i], fm.get(fieldNames[i])\n\t\t\t\t\t\t.toString(), Field.Store.YES));\n\t\t\t}\n\n\t\t\telse {\n\t\t\t\tdoc.add(new TextField(fieldNames[i], fm.get(fieldNames[i])\n\t\t\t\t\t\t.toString(), Field.Store.YES));\n\t\t\t}\n\t\t}\n\n\t\twriter.addDocument(doc);\n\n\t}", "public void cargarDocumentos(CategoriaBE objCategoria,UsuarioBE objUsuario){\n this.pgbCargaDocumentos.setMaximum(100);\n int paso= 100/this.nomArch.size();\n String resultado = \"\";\n int valorActual = 0;\n for (int i = 0; i < nomArch.size(); ++i){\n DocumentoBE doc = null;\n try {\n int idDoc = Utilitario.generaCodigo(\"Documento\");\n doc = new DocumentoBE(idDoc, \"activo\" , nomArch.get(i).getName() , objUsuario, null);\n doc.setContenido(DocumentoBL.obtenerContenido(nomArch.get(i)));\n doc.setCategoria(objCategoria);\n\n try {\n ConexionJDBC.abrirConexion();\n if (DocumentoBL.registrar(doc)){\n resultado = \"El archivo \" + nomArch.get(i).getName() + \" fue registrado con exito\";\n String descripcion = GestorTiposOperacion.getTipoOperacion(\"registra\") + \"\\n\";\n descripcion += \"Registro nuevo:\\n\" + doc.getNombre() + \"\\n\";\n descripcion += \"Estado: \" + doc.getEstado();\n JFBase.setOperacion(this.getName(), GestorTiposOperacion.getTipoOperacion(\"registra\"), descripcion);\n JFBase.registrarOperacion();\n ConexionJDBC.cerrarConexion();\n }\n else {\n resultado = \"Error al registrar \" + nomArch.get(i).getName() + \" el archivo no fue registrado\";\n }\n } catch (Exception ex) {\n Logger.getLogger(JDRegistrarDocumento.class.getName()).log(Level.SEVERE, null, ex);\n }\n this.taDatosProgreso.setText(this.taDatosProgreso.getText() + \"\\n\" + resultado);\n valorActual += paso;\n this.pgbCargaDocumentos.setValue(valorActual);\n Rectangle rect = this.pgbCargaDocumentos.getBounds();\n\t\trect.x = 0;\n\t\trect.y = 0;\n\t\tthis.pgbCargaDocumentos.paintImmediately( rect );\n rect = this.pnlDatosProgreso.getBounds();\n rect.x = 0;\n rect.y = 0;\n this.pnlDatosProgreso.paintImmediately(rect);\n } catch (FileNotFoundException ex) {\n Logger.getLogger(JDRegistrarDocumento.class.getName()).log(Level.SEVERE, null, ex);\n } catch (IOException ex) {\n Logger.getLogger(JDRegistrarDocumento.class.getName()).log(Level.SEVERE, null, ex);\n }\n }\n //PanelDocumento.fin=true;\n this.pgbCargaDocumentos.setValue(100);\n this.btnAceptar.setEnabled(true);\n }", "private boolean existeMatrizDocumental(ConcursoPuestoAgr concursoPuestoAgr) {\r\n\t\tString query =\r\n\t\t\t\" SELECT * FROM seleccion.matriz_doc_config_enc \" + \" where id_concurso_puesto_agr = \"\r\n\t\t\t\t+ concursoPuestoAgr.getIdConcursoPuestoAgr();\r\n\t\treturn seleccionUtilFormController.existeNative(query);\r\n\t}", "TypeAssociation getAssocieCommeSujetEvenementNRBC();", "public Idioma getIdiomaOriginal() {\n\t\treturn this.getParrafo().getDocumento().getIdioma();\n\t}", "public Documento() {\n\n\t}", "public void updateDocument(Document arg0) throws ContestManagementException {\r\n }", "public DocMap(Gedcomx doc) {\n // Build all the maps.\n update(doc);\n }", "public void ingresarCalificacionDocencia(ArrayList<Integer> oiddocencia, String identificacion, String periodo, ArrayList<Integer> calificaciones) {\n\t\ttry{\n\t\t\tthis.objADAO.ingresarCalificacionDocencias(oiddocencia, identificacion, periodo, calificaciones);\n\t\t} catch(Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public static void FirstTest(){\n\t\tDocBibliothèque Doc1 = new DocBibliothèque(\"004.178K20PM\", \"Introduction à Java\", \"J.LEBLANC\", 2015,\"Disponible\");\r\n\t\tDocBibliothèque Doc2 = new DocBibliothèque(\"967.4987T248O\", \"Structures de Données\", \"M.MACHIN\", 2017,\"Disponible\");\r\n\t\t\r\n\t\t//création du catalogueD\r\n\t\tCatalogueBibliotheque CatalogueD = new CatalogueBibliotheque();\r\n\t\tCatalogueD.addDoc(Doc1);\r\n\t\tCatalogueD.addDoc(Doc2);\r\n\t\tSystem.out.println(CatalogueD.getDocument(0));\r\n\t\tSystem.out.println(CatalogueD.getDocument(1));\r\n\t\tCatalogueD.supressDoc(Doc2);\r\n\t\tSystem.out.println(CatalogueD.getDocument(0));\r\n\t}", "public PnStrarMateriasDocente() {\n initComponents();\n }", "public void setFilaDatosExportarXmlLiquidacionImpuestoImpor(LiquidacionImpuestoImpor liquidacionimpuestoimpor,Document document,Element element) {\r\n\t\t\r\n\r\n\t\tElement elementId = document.createElement(LiquidacionImpuestoImporConstantesFunciones.ID);\r\n\t\telementId.appendChild(document.createTextNode(liquidacionimpuestoimpor.getId().toString().trim()));\r\n\t\telement.appendChild(elementId);\r\n\r\n\t\tif(parametroGeneralUsuario.getcon_exportar_campo_version()){\r\n\r\n\t\tElement elementVersionRow = document.createElement(LiquidacionImpuestoImporConstantesFunciones.VERSIONROW);\r\n\t\telementVersionRow.appendChild(document.createTextNode(liquidacionimpuestoimpor.getVersionRow().toString().trim()));\r\n\t\telement.appendChild(elementVersionRow);\r\n\t\t}\r\n\r\n\r\n\t\tElement elementpedidocompraimpor_descripcion = document.createElement(LiquidacionImpuestoImporConstantesFunciones.IDPEDIDOCOMPRAIMPOR);\r\n\t\telementpedidocompraimpor_descripcion.appendChild(document.createTextNode(liquidacionimpuestoimpor.getpedidocompraimpor_descripcion()));\r\n\t\telement.appendChild(elementpedidocompraimpor_descripcion);\r\n\r\n\t\tElement elementempresa_descripcion = document.createElement(LiquidacionImpuestoImporConstantesFunciones.IDEMPRESA);\r\n\t\telementempresa_descripcion.appendChild(document.createTextNode(liquidacionimpuestoimpor.getempresa_descripcion()));\r\n\t\telement.appendChild(elementempresa_descripcion);\r\n\r\n\t\tElement elementsucursal_descripcion = document.createElement(LiquidacionImpuestoImporConstantesFunciones.IDSUCURSAL);\r\n\t\telementsucursal_descripcion.appendChild(document.createTextNode(liquidacionimpuestoimpor.getsucursal_descripcion()));\r\n\t\telement.appendChild(elementsucursal_descripcion);\r\n\r\n\t\tElement elementcliente_descripcion = document.createElement(LiquidacionImpuestoImporConstantesFunciones.IDCLIENTE);\r\n\t\telementcliente_descripcion.appendChild(document.createTextNode(liquidacionimpuestoimpor.getcliente_descripcion()));\r\n\t\telement.appendChild(elementcliente_descripcion);\r\n\r\n\t\tElement elementfactura_descripcion = document.createElement(LiquidacionImpuestoImporConstantesFunciones.IDFACTURA);\r\n\t\telementfactura_descripcion.appendChild(document.createTextNode(liquidacionimpuestoimpor.getfactura_descripcion()));\r\n\t\telement.appendChild(elementfactura_descripcion);\r\n\r\n\t\tElement elementnumero_comprobante = document.createElement(LiquidacionImpuestoImporConstantesFunciones.NUMEROCOMPROBANTE);\r\n\t\telementnumero_comprobante.appendChild(document.createTextNode(liquidacionimpuestoimpor.getnumero_comprobante().trim()));\r\n\t\telement.appendChild(elementnumero_comprobante);\r\n\r\n\t\tElement elementnumero_dui = document.createElement(LiquidacionImpuestoImporConstantesFunciones.NUMERODUI);\r\n\t\telementnumero_dui.appendChild(document.createTextNode(liquidacionimpuestoimpor.getnumero_dui().trim()));\r\n\t\telement.appendChild(elementnumero_dui);\r\n\r\n\t\tElement elementfecha = document.createElement(LiquidacionImpuestoImporConstantesFunciones.FECHA);\r\n\t\telementfecha.appendChild(document.createTextNode(liquidacionimpuestoimpor.getfecha().toString().trim()));\r\n\t\telement.appendChild(elementfecha);\r\n\r\n\t\tElement elementfecha_pago = document.createElement(LiquidacionImpuestoImporConstantesFunciones.FECHAPAGO);\r\n\t\telementfecha_pago.appendChild(document.createTextNode(liquidacionimpuestoimpor.getfecha_pago().toString().trim()));\r\n\t\telement.appendChild(elementfecha_pago);\r\n\r\n\t\tElement elementfob = document.createElement(LiquidacionImpuestoImporConstantesFunciones.FOB);\r\n\t\telementfob.appendChild(document.createTextNode(liquidacionimpuestoimpor.getfob().toString().trim()));\r\n\t\telement.appendChild(elementfob);\r\n\r\n\t\tElement elementseguro = document.createElement(LiquidacionImpuestoImporConstantesFunciones.SEGURO);\r\n\t\telementseguro.appendChild(document.createTextNode(liquidacionimpuestoimpor.getseguro().toString().trim()));\r\n\t\telement.appendChild(elementseguro);\r\n\r\n\t\tElement elementflete = document.createElement(LiquidacionImpuestoImporConstantesFunciones.FLETE);\r\n\t\telementflete.appendChild(document.createTextNode(liquidacionimpuestoimpor.getflete().toString().trim()));\r\n\t\telement.appendChild(elementflete);\r\n\r\n\t\tElement elementporcentaje_fodi = document.createElement(LiquidacionImpuestoImporConstantesFunciones.PORCENTAJEFODI);\r\n\t\telementporcentaje_fodi.appendChild(document.createTextNode(liquidacionimpuestoimpor.getporcentaje_fodi().toString().trim()));\r\n\t\telement.appendChild(elementporcentaje_fodi);\r\n\r\n\t\tElement elementporcentaje_iva = document.createElement(LiquidacionImpuestoImporConstantesFunciones.PORCENTAJEIVA);\r\n\t\telementporcentaje_iva.appendChild(document.createTextNode(liquidacionimpuestoimpor.getporcentaje_iva().toString().trim()));\r\n\t\telement.appendChild(elementporcentaje_iva);\r\n\r\n\t\tElement elementtasa_control = document.createElement(LiquidacionImpuestoImporConstantesFunciones.TASACONTROL);\r\n\t\telementtasa_control.appendChild(document.createTextNode(liquidacionimpuestoimpor.gettasa_control().toString().trim()));\r\n\t\telement.appendChild(elementtasa_control);\r\n\r\n\t\tElement elementcfr = document.createElement(LiquidacionImpuestoImporConstantesFunciones.CFR);\r\n\t\telementcfr.appendChild(document.createTextNode(liquidacionimpuestoimpor.getcfr().toString().trim()));\r\n\t\telement.appendChild(elementcfr);\r\n\r\n\t\tElement elementcif = document.createElement(LiquidacionImpuestoImporConstantesFunciones.CIF);\r\n\t\telementcif.appendChild(document.createTextNode(liquidacionimpuestoimpor.getcif().toString().trim()));\r\n\t\telement.appendChild(elementcif);\r\n\r\n\t\tElement elementtotal = document.createElement(LiquidacionImpuestoImporConstantesFunciones.TOTAL);\r\n\t\telementtotal.appendChild(document.createTextNode(liquidacionimpuestoimpor.gettotal().toString().trim()));\r\n\t\telement.appendChild(elementtotal);\r\n\t}", "public String getIddocument() {\r\n\t\treturn iddocument;\r\n\t}", "@Override\n\tpublic void aumentar(int cantidad) {\n\t\t\n\t}", "protected String loadDocumentDetails ()\n\t{\n\t\tMPayment pay = (MPayment)getPO();\n\t\tsetDateDoc(pay.getDateTrx());\n\t\tm_TenderType = pay.getTenderType();\n\t\tm_Prepayment = pay.isPrepayment();\n\t\tm_C_BankAccount_ID = pay.getC_BankAccount_ID();\n\t\t//\tAmount\n\t\tsetAmount(Doc.AMTTYPE_Gross, pay.getPayAmt());\n\t\treturn null;\n\t}", "String prepareLegalDocuments();", "public String navigateDocenteCollection() {\n if (this.getSelected() != null) {\n FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put(\"Docente_items\", this.getSelected().getDocenteCollection());\n }\n return this.mobilePageController.getMobilePagesPrefix() + \"/docente/index\";\n }", "public int getLBR_DocLine_ICMS_ID();", "public void setDocumentoBase(DocumentoBase documentoBase)\r\n/* 135: */ {\r\n/* 136:158 */ this.documentoBase = documentoBase;\r\n/* 137: */ }", "@Generated(hash = 1042367595)\npublic Documento getDocumento() {\n Long __key = this.documentoId;\n if (documento__resolvedKey == null\n || !documento__resolvedKey.equals(__key)) {\n final DaoSession daoSession = this.daoSession;\n if (daoSession == null) {\n throw new DaoException(\"Entity is detached from DAO context\");\n }\n DocumentoDao targetDao = daoSession.getDocumentoDao();\n Documento documentoNew = targetDao.load(__key);\n synchronized (this) {\n documento = documentoNew;\n documento__resolvedKey = __key;\n }\n }\n return documento;\n}", "public void agregarMetadatos(UploadedFile ArticuloPDF, UploadedFile TablaContenidoPDF, UploadedFile cartaAprobacionPDF) throws IOException, GeneralSecurityException, DocumentException, PathNotFoundException, AccessDeniedException {\n MetodosPDF mpdf = new MetodosPDF();\n String codigoEst = this.pubEstIdentificador.getEstCodigo();\n String codigoFirma = mpdf.codigoFirma(codigoEst);\n codigoFirma = codigoFirma.trim();\n\n String nombreCartaAprob = \"Carta de Aprobacion-\" + codigoFirma;\n String nombrePublicacion = \"\";\n String nombreTablaC = \"Tabla de Contenido-\" + codigoFirma;\n\n if (this.pubTipoPublicacion.equalsIgnoreCase(\"revista\")) {\n nombrePublicacion = this.revista.getRevTituloArticulo();\n\n }\n if (this.pubTipoPublicacion.equalsIgnoreCase(\"congreso\")) {\n nombrePublicacion = this.congreso.getCongTituloPonencia();\n }\n if (this.pubTipoPublicacion.equalsIgnoreCase(\"libro\")) {\n nombrePublicacion = this.libro.getLibTituloLibro();\n\n }\n if (this.pubTipoPublicacion.equalsIgnoreCase(\"capitulo_libro\")) {\n\n nombrePublicacion = this.capituloLibro.getCaplibTituloCapitulo();\n }\n\n\n /*Obtiene la ruta de la ubicacion del servidor donde se almacenaran \n temporalmente los archivos ,para luego subirlos al Gestor Documental OpenKm */\n String realPath = FacesContext.getCurrentInstance().getExternalContext().getRealPath(\"/\");\n // String destCartaAprob = realPath + \"WEB-INF\\\\temp\\\\Tabla de Contenido.pdf\";\n String destCartaAprob = realPath + \"WEB-INF\\\\temp\\\\\" + nombreCartaAprob + \".pdf\";\n String destArticulo = realPath + \"WEB-INF\\\\temp\\\\\" + nombrePublicacion + \".pdf\";\n // String destTablaC = realPath + \"WEB-INF\\\\temp\\\\Tabla de Contenido.pdf\";\n String destTablaC = realPath + \"WEB-INF\\\\temp\\\\\" + nombreTablaC + \".pdf\";\n\n\n /* Estampa de Tiempo\n Obtiene el dia y hora actual del servidor para posteriormente adicionarlo\n como Metadato en el documento PDF/A y el Gestor Documental*/\n Date date = new Date();\n DateFormat datehourFormat = new SimpleDateFormat(\"dd/MM/yyyy HH:mm:ss\");\n String estampaTiempo = \"\" + datehourFormat.format(date);\n\n this.setPubFechaRegistro(date);\n\n /* Metodo para almacenar los metadatos de la Carte de Aprobacion , Articulo y Tabla de Contenido \n para almacenarlo en formato PDFA */\n ArrayList<tipoPDF_cargar> subidaArchivos = new ArrayList<>();\n\n /* tipoPDF_cargar cartaAprobacion = new tipoPDF_cargar();\n cartaAprobacion.setNombreArchivo(nombreCartaAprob);\n cartaAprobacion.setRutaArchivo(destCartaAprob);\n cartaAprobacion.setTipoPDF(\"cartaAprobacion\");\n cartaAprobacion.setArchivoIS(cartaAprobacionPDF.getInputstream());\n subidaArchivos.add(cartaAprobacion); */\n if (!cartaAprobacionPDF.getFileName().equalsIgnoreCase(\"\")) {\n tipoPDF_cargar cartaAprobacion = new tipoPDF_cargar();\n cartaAprobacion.setNombreArchivo(nombreCartaAprob);\n cartaAprobacion.setRutaArchivo(destCartaAprob);\n cartaAprobacion.setTipoPDF(\"cartaAprobacion\");\n cartaAprobacion.setArchivoIS(cartaAprobacionPDF.getInputstream());\n subidaArchivos.add(cartaAprobacion);;\n }\n\n if (!ArticuloPDF.getFileName().equalsIgnoreCase(\"\")) {\n tipoPDF_cargar articulo = new tipoPDF_cargar();\n articulo.setNombreArchivo(nombrePublicacion);\n articulo.setRutaArchivo(destArticulo);\n articulo.setTipoPDF(\"tipoPublicacion\");\n articulo.setArchivoIS(ArticuloPDF.getInputstream());\n subidaArchivos.add(articulo);\n }\n if (!TablaContenidoPDF.getFileName().equalsIgnoreCase(\"\")) {\n tipoPDF_cargar tablaContenido = new tipoPDF_cargar();\n tablaContenido.setNombreArchivo(nombreTablaC);\n tablaContenido.setRutaArchivo(destTablaC);\n tablaContenido.setTipoPDF(\"tablaContenido\");\n tablaContenido.setArchivoIS(TablaContenidoPDF.getInputstream());\n subidaArchivos.add(tablaContenido);\n }\n\n CrearPDFA_Metadata(subidaArchivos, estampaTiempo);\n\n String hash = mpdf.obtenerHash(destArticulo);\n\n /* Metodo para almacenar en el Gestor Documental(OPENKM), carta de aprobacion,\n el articulo en formato PDFA y la Tabla de Contenido del Articulo (formato PDFA) */\n // SubirOpenKM(rutasArchivos, nombreArchivos, estampaTiempo, codigoFirma, hash);\n SubirOpenKM(subidaArchivos, estampaTiempo, codigoFirma, hash);\n }", "protected Document() {/* intentionally empty block */}", "public void setIddocument(String iddocument) {\r\n\t\tthis.iddocument = iddocument;\r\n\t}", "private void caricaRegistrazione() {\n\t\tfor(MovimentoEP movimentoEP : primaNota.getListaMovimentiEP()){\n\t\t\t\n\t\t\tif(movimentoEP.getRegistrazioneMovFin() == null) { //caso di prime note libere.\n\t\t\t\tthrow new BusinessException(ErroreCore.OPERAZIONE_NON_CONSENTITA.getErrore(\"La prima nota non e' associata ad una registrazione.\"));\n\t\t\t}\n\t\t\t\n\t\t\tthis.registrazioneMovFinDiPartenza = registrazioneMovFinDad.findRegistrazioneMovFinById(movimentoEP.getRegistrazioneMovFin().getUid());\n\t\t\t\n\t\t}\n\t\t\n\t\tif(this.registrazioneMovFinDiPartenza.getMovimento() == null){\n\t\t\tthrow new BusinessException(\"Movimento non caricato.\");\n\t\t}\n\t\t\n\t}", "public DocumentoVO getDocumento() {\n return documento;\n }", "private void generarDocP(){\n generarPdf(this.getNombre());\n }", "public CitacaoDocJud(DocumentoJuridico documentoJuridicoOrigem, Norma normaDestino) {\r\n\t\tthis.documentoJuridicoOrigem = documentoJuridicoOrigem;\r\n\t\tthis.normaDestino = normaDestino;\r\n\t\tthis.data = documentoJuridicoOrigem.getDataJulgamento();\r\n\t}", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n public void process(IeDocument document) {\n\n }", "public ArrayList<Auxiliar> obtenerObsDocencia(String periodo, String identificacion) {\n\t\tArrayList<Bean> result = new ArrayList<Bean>();\n\t\tint cont = 0;\n\t\ttry {\n\t\t\tresult = this.objADAO.obtenerObsDocencia(periodo, identificacion);\n\t\t\tfor(Bean iteratorBean : result) {\n\t\t\t\tthis.auxiliar.add((Auxiliar) iteratorBean);\n\t\t\t}\n\t\t\t//this.docenteAsesoriaData.add((Asesoria) iteratorBean);\n\t\t} catch (Exception e){\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn getAuxiliar();\n\t}", "private static void alimenterAttributs() {\r\n\t\t\r\n\t\t/* alimente 'properties' avec la valeur \r\n\t\t * fournie par le gestionnaireProperties. */\r\n\t\tproperties = gestionnaireProperties.getProperties();\r\n\t\t\r\n\t\t/* alimente 'pathAbsoluFichierProperties' \r\n\t\t * avec la valeur fournie par le gestionnaireProperties. */\r\n\t\tpathAbsoluFichierProperties \r\n\t\t\t= gestionnaireProperties.getPathAbsoluFichierProperties();\r\n\t\t\r\n\t}", "private void creacion(HttpPresentationComms comms) throws HttpPresentationException, KeywordValueException {\n/* 83 */ String _operacion = comms.request.getParameter(\"_operacion\");\n/* 84 */ String elUsuario = \"\" + comms.session.getUser().getName();\n/* 85 */ int idRecurso = 0;\n/* */ try {\n/* 87 */ idRecurso = Integer.parseInt(comms.request.getParameter(\"idRecurso\"));\n/* */ }\n/* 89 */ catch (Exception e) {\n/* 90 */ throw new ClientPageRedirectException(comms.request.getAppFileURIPath(\"Mensaje.po?codigo=ValorNoValido&p1=idRecurso\"));\n/* */ } \n/* */ \n/* 93 */ RespuestaBD rta = new RespuestaBD();\n/* 94 */ if (_operacion.equals(\"E\")) {\n/* 95 */ PrcRecursoDAO ob = new PrcRecursoDAO();\n/* 96 */ rta = ob.eliminarRegistro(idRecurso);\n/* 97 */ if (!rta.isRta()) {\n/* 98 */ throw new ClientPageRedirectException(comms.request.getAppFileURIPath(\"Mensaje.po?codigo=ErrorPrcRecurso&p1=\" + rta.getMensaje()));\n/* */ }\n/* 100 */ String sPagina = \"PrcRecurso.po?_operacion=X\";\n/* 101 */ throw new ClientPageRedirectException(comms.request.getAppFileURIPath(sPagina));\n/* */ } \n/* 103 */ String idTipoRecurso = comms.request.getParameter(\"idTipoRecurso\");\n/* 104 */ String descripcionRecurso = comms.request.getParameter(\"descripcionRecurso\");\n/* 105 */ int idProcedimiento = 0;\n/* */ try {\n/* 107 */ idProcedimiento = Integer.parseInt(comms.request.getParameter(\"idProcedimiento\"));\n/* */ }\n/* 109 */ catch (Exception e) {}\n/* */ \n/* */ \n/* 112 */ String estado = comms.request.getParameter(\"estado\");\n/* 113 */ PrcRecursoDAO ob = new PrcRecursoDAO();\n/* 114 */ if (_operacion.equals(\"C\")) {\n/* 115 */ rta = ob.crearRegistro(idRecurso, idTipoRecurso, descripcionRecurso, idProcedimiento, estado, elUsuario);\n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* 122 */ idRecurso = rta.getSecuencia();\n/* */ } else {\n/* */ \n/* 125 */ rta = ob.modificarRegistro(idRecurso, idTipoRecurso, descripcionRecurso, idProcedimiento, estado, elUsuario);\n/* */ } \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* 133 */ if (!rta.isRta()) {\n/* 134 */ throw new ClientPageRedirectException(comms.request.getAppFileURIPath(\"Mensaje.po?codigo=ErrorPrcRecurso&p1=\" + rta.getMensaje()));\n/* */ }\n/* */ \n/* 137 */ String sPagina = \"PrcRecurso.po?_operacion=P&idRecurso=\" + idRecurso + \"\";\n/* 138 */ throw new ClientPageRedirectException(comms.request.getAppFileURIPath(sPagina));\n/* */ }", "@Override\r\n\tprotected void agregarObjeto() {\r\n\t\t// opcion 1 es agregar nuevo justificativo\r\n\t\tthis.setTitle(\"PROCESOS - PERMISOS INDIVIDUALES (AGREGANDO)\");\r\n\t\tthis.opcion = 1;\r\n\t\tactivarFormulario();\r\n\t\tlimpiarTabla();\r\n\t\tthis.panelBotones.habilitar();\r\n\t}", "public void newDocument();", "public int getId()\r\n/* 75: */ {\r\n/* 76:110 */ return this.idAutorizacionDocumentoPuntoDeVentaAutoimpresorSRI;\r\n/* 77: */ }", "public ArrayList<String> ModifBaseDescriptif(String nameWord){\n \n String uriWord = rootImportFiles + nameWord;\n String idActuel = null;\n Boolean erreur = false;\n int countUnderscore = 0;\n int countRows = 0;\n ArrayList<ArrayList<String>> docListe = new ArrayList<ArrayList<String>> (); //Création d'un format indicé\n ArrayList<String> returnListe = new ArrayList<String> ();\n returnListe.add(\"\");\n \n try {\n //Importer le word\n FileInputStream fis = new FileInputStream(uriWord);\n XWPFDocument doc = new XWPFDocument(OPCPackage.open(fis));\n List<XWPFTable> table = doc.getTables(); //on extrait tous les tableaux \n \n //Extraction des informations dans un format rigoureux et indicé\n for (XWPFTable xwpfTable : table) { \n //On se trouve dans un tableau particulier. On en extrait les lignes\n countRows = 0;\n String chaineDescription = \"\";\n String chaineParagraph = \"\";\n String runStyle = \"\";\n String testingRunStyle = \"\";\n Boolean first = true;\n ArrayList<String> tableau = new ArrayList<String>();\n List<XWPFTableRow> row = xwpfTable.getRows(); \n for (XWPFTableRow xwpfTableRow : row) { \n List<XWPFTableCell> cell = xwpfTableRow.getTableCells();\n //on extrait les cellules (même si on en a qu'une par ligne)\n for (XWPFTableCell xwpfTableCell : cell) { \n if(xwpfTableCell!=null) { \n if(countRows != 4){ //on est pas dans une description, pas besoin de traiter les styles\n tableau.add(xwpfTableCell.getText());\n }\n else{\n //on est dans une description. On extrait les styles\n for (XWPFParagraph paragraph : xwpfTableCell.getParagraphs()) {\n \n chaineParagraph = \"\";\n runStyle = \"\";\n \n first = true;\n for (XWPFRun run : paragraph.getRuns()) { //on extrait les runs\n \n testingRunStyle = \"normal\";\n \n //on test les textures\n if(!run.isBold() && run.getUnderline().toString().equals(\"SINGLE\") && !run.isItalic())\n testingRunStyle = \"u\";\n if(!run.isBold() && run.getUnderline().toString().equals(\"DASH\") && !run.isItalic())\n testingRunStyle = \"underlinedash\";\n if(!run.isBold() && run.getUnderline().toString().equals(\"NONE\") && run.isItalic())\n testingRunStyle = \"i\";\n if(!run.isBold() && run.getUnderline().toString().equals(\"SINGLE\") && run.isItalic())\n testingRunStyle = \"italic_underline\";\n if(run.isBold() && run.getUnderline().toString().equals(\"NONE\") && !run.isItalic())\n testingRunStyle = \"b\";\n if(run.isBold() && run.getUnderline().toString().equals(\"SINGLE\") && !run.isItalic())\n testingRunStyle = \"bold_underline\";\n if(run.isBold() && run.getUnderline().toString().equals(\"NONE\") && run.isItalic())\n testingRunStyle = \"bold_italic\";\n if(run.isBold() && run.getUnderline().toString().equals(\"SINGLE\") && run.isItalic())\n testingRunStyle = \"bold_underline_italic\";\n \n //on test les couleurs\n if(\"FF0000\".equals(run.getColor()))\n testingRunStyle = \"colorred\";\n if(\"E36C0A\".equals(run.getColor()))\n testingRunStyle = \"colororange\";\n if(\"00B050\".equals(run.getColor()))\n testingRunStyle = \"colorgreen\";\n if(\"0070C0\".equals(run.getColor()))\n testingRunStyle = \"colorblue\";\n \n //on test les surlignages\n if(\"yellow\".equals(run.getTextHightlightColor().toString()))\n testingRunStyle = \"highlightyellow\";\n if(\"cyan\".equals(run.getTextHightlightColor().toString()))\n testingRunStyle = \"highlightcyan\";\n if(\"red\".equals(run.getTextHightlightColor().toString()))\n testingRunStyle = \"highlightred\";\n if(\"green\".equals(run.getTextHightlightColor().toString()))\n testingRunStyle = \"highlightgreen\";\n if(\"magenta\".equals(run.getTextHightlightColor().toString()))\n testingRunStyle = \"highlightmagenta\";\n if(\"lightGray\".equals(run.getTextHightlightColor().toString()))\n testingRunStyle = \"highlightgrey\";\n\n \n //si le style est différent de celui d'avant, on ferme le style d'avant et on ouvre le suivant\n if(!runStyle.equals(testingRunStyle)){\n //s'il y avait un style avant, on le ferme\n if(!first)\n chaineParagraph += \"</\"+runStyle+\">\";\n \n chaineParagraph += \"<\"+testingRunStyle+\">\"; //on ouvre la nouvelle balise de style\n chaineParagraph += run.text();\n runStyle = testingRunStyle;\n }\n else{\n chaineParagraph+= run.text();\n }\n first = false;\n } \n if(!\"\".equals(runStyle))\n chaineParagraph += \"</\"+runStyle+\">\"; //on ferme la dernière balise\n \n if(\"bullet\".equals(paragraph.getNumFmt())){\n chaineDescription += \"<li>\"+chaineParagraph+\"</li>\"; //verif si fermante\n }\n else{ \n chaineDescription += \"<p>\"+chaineParagraph+\"</p>\";\n }\n //chaineDescription += chaineParagraph;\n }\n \n tableau.add(chaineDescription); \n }\n }\n }\n countRows++;\n }\n docListe.add(tableau);\n \n } \n } catch(IOException | InvalidFormatException ex) {\n erreur = true;\n returnListe.set(0, \"Erreur système: l'API POI ne parvient pas à extraire les données\");\n }\n \n //si on a réussi à extraire les données du word, on peut démarrer l'exploitation des données\n if(!erreur){\n //on parcourt la liste des objets\n for(int i = 0; i < docListe.size(); i++){\n //on extrait l'identifiant et on déduit le type d'objet\n idActuel = docListe.get(i).get(0);\n //on compte le nombre de \"_\" dans l'ID\n countUnderscore = 0;\n for (int j = 0; j < idActuel.length(); j++) {\n if (idActuel.charAt(j) == '_') \n countUnderscore++;\n }\n\n JpaUtil.creerContextePersistance();\n try {\n if(countUnderscore < 4){\n if(docListe.get(i).get(1).equals(\"SUPPR\")){ //on traite les suppressions\n //on ajoute à la liste de sortie les idnetifiant à supprimer\n returnListe.add(idActuel);\n }\n else{ //on procède à l'insertion d'un \"titre\" dans la BD\n switch(countUnderscore){\n case 0: //on importe un chapitre en BD\n Chapitre chapitre = null;\n chapitre = chapitreDao.ChercherParId(idActuel);\n JpaUtil.ouvrirTransaction();\n if(chapitre == null){ //on crée le chapitre\n chapitre = new Chapitre(idActuel, docListe.get(i).get(1));\n chapitreDao.Creer(chapitre);\n }\n else{ //on modifie l'intitule du chapitre\n chapitre.setIntituleChapitre(docListe.get(i).get(1));\n chapitreDao.Update(chapitre);\n } \n JpaUtil.validerTransaction();\n break;\n case 1: //on importe une categorie en BD\n Categorie categorie = null;\n categorie = categorieDao.ChercherParId(idActuel); //idActuel est l'identifiant de l'objet que l'on traite\n JpaUtil.ouvrirTransaction();\n if(categorie == null){ //on crée la categorie\n categorie = new Categorie(idActuel, docListe.get(i).get(1));\n categorieDao.Creer(categorie); \n //on va chercher le chapitre parent pour update listeCategorie\n Chapitre chapitreParent = chapitreDao.ChercherParId(idActuel.substring(0, idActuel.lastIndexOf('_'))); //on prend idActuel et on retire le dernier _ et ce qu'il y a derrière\n List<Categorie> listeCategorie = chapitreParent.getListCategorie();\n listeCategorie.add(categorie);\n chapitreParent.setListCategorie(listeCategorie);\n chapitreDao.Update(chapitreParent);\n } else { //on modifie l'initule de la categorie\n categorie.setIntituleCategorie(docListe.get(i).get(1));\n categorieDao.Update(categorie);\n } \n JpaUtil.validerTransaction();\n break; \n\n case 2: //on importe une categorie en BD\n Famille famille = null;\n famille = familleDao.ChercherParId(idActuel);\n JpaUtil.ouvrirTransaction();\n if(famille == null){ //on crée la famille\n famille = new Famille(idActuel, docListe.get(i).get(1));\n familleDao.Creer(famille);\n //on va chercher la categorie parent pour update listeFamille\n Categorie categorieParent = categorieDao.ChercherParId(idActuel.substring(0, idActuel.lastIndexOf('_'))); //on prend idActuel et on retire le dernier _ et ce qu'il y a derrière\n List<Famille> listeFamille = categorieParent.getListeFamille();\n listeFamille.add(famille);\n categorieParent.setListeFamille(listeFamille);\n categorieDao.Update(categorieParent);\n }\n else{ //on modifie l'intitule de la famille\n famille.setIntituleFamille(docListe.get(i).get(1));\n familleDao.Update(famille);\n } \n JpaUtil.validerTransaction();\n break; \n case 3: //on importe une sousFamille en BD\n SousFamille sousFamille = null;\n sousFamille = sousFamilleDao.ChercherParId(idActuel);\n JpaUtil.ouvrirTransaction();\n if(sousFamille == null){ //on crée la sousFamille\n sousFamille = new SousFamille(idActuel, docListe.get(i).get(1));\n sousFamilleDao.Creer(sousFamille);\n //on va chercher la famille parent pour update listeSousFamille\n Famille familleParent = familleDao.ChercherParId(idActuel.substring(0, idActuel.lastIndexOf('_'))); //on prend idActuel et on retire le dernier _ et ce qu'il y a derrière\n List<SousFamille> listeSousFamille = familleParent.getListSousFamille();\n listeSousFamille.add(sousFamille);\n familleParent.setListSousFamille(listeSousFamille);\n familleDao.Update(familleParent);\n }\n else{ //on modifie l'intitule de la sousFamille\n sousFamille.setIntituleSousFamille(docListe.get(i).get(1));\n sousFamilleDao.Update(sousFamille);\n } \n JpaUtil.validerTransaction();\n break;\n }\n }\n }\n //on procède au traitement d'un descriptif\n else{\n //on traite les ajouts\n if(docListe.get(i).get(1).equals(\"AJOUT\")){\n switch(docListe.get(i).get(2)){\n case \"OUVRAGE\":\n Ouvrage ouvrage = null;\n ouvrage = (Ouvrage) descriptifDao.ChercherParId(idActuel);\n JpaUtil.ouvrirTransaction();\n if(ouvrage == null){ //on crée le chapitre\n ouvrage = new Ouvrage(idActuel, docListe.get(i).get(3), docListe.get(i).get(4), docListe.get(i).get(5), docListe.get(i).get(6));\n descriptifDao.Creer(ouvrage);\n //on va chercher la sousFamille parent pour update listeDescriptif\n SousFamille sousFamilleParent = sousFamilleDao.ChercherParId(idActuel.substring(0, idActuel.lastIndexOf('_'))); //on prend idActuel et on retire le dernier _ et ce qu'il y a derrière\n List<Descriptif> listeDescriptif = sousFamilleParent.getListDescriptif();\n listeDescriptif.add(ouvrage);\n sousFamilleParent.setListDescriptif(listeDescriptif);\n sousFamilleDao.Update(sousFamilleParent);\n }\n else{ //on modifie le titre du chapitre\n ouvrage.setNomDescriptif(docListe.get(i).get(3));\n ouvrage.setDescription(docListe.get(i).get(4));\n ouvrage.setCourteDescription(docListe.get(i).get(5));\n descriptifDao.Update(ouvrage);\n } \n JpaUtil.validerTransaction();\n break;\n case \"GENERIQUE\":\n Generique generique = null;\n generique = (Generique) descriptifDao.ChercherParId(idActuel);\n JpaUtil.ouvrirTransaction();\n if(generique == null){ //on crée le chapitre\n generique = new Generique(idActuel, docListe.get(i).get(3), docListe.get(i).get(4), docListe.get(i).get(5));\n descriptifDao.Creer(generique);\n //on va chercher la sousFamille parent pour update listeDescriptif\n SousFamille sousFamilleParent2 = sousFamilleDao.ChercherParId(idActuel.substring(0, idActuel.lastIndexOf('_'))); //on prend idActuel et on retire le dernier _ et ce qu'il y a derrière\n List<Descriptif> listeDescriptif2 = sousFamilleParent2.getListDescriptif();\n listeDescriptif2.add(generique);\n sousFamilleParent2.setListDescriptif(listeDescriptif2);\n sousFamilleDao.Update(sousFamilleParent2);\n }\n else{ //on modifie le titre du chapitre\n generique.setNomDescriptif(docListe.get(i).get(3));\n generique.setDescription(docListe.get(i).get(4));\n generique.setCourteDescription(docListe.get(i).get(5));\n descriptifDao.Update(generique);\n } \n JpaUtil.validerTransaction();\n break; \n case \"PRESTATION\": \n Prestation prestation = null;\n prestation = prestationDao.ChercherParId(idActuel);\n JpaUtil.ouvrirTransaction();\n if(prestation == null){ //on crée la prestation\n prestation = new Prestation(idActuel, docListe.get(i).get(3), docListe.get(i).get(4), docListe.get(i).get(5), docListe.get(i).get(6));\n prestationDao.Creer(prestation);\n //on va chercher l'ouvrage parent pour update listeprestation\n Ouvrage ouvrageParent = (Ouvrage) descriptifDao.ChercherParId(idActuel.substring(0, idActuel.lastIndexOf('_'))); //on prend idActuel et on retire le dernier _ et ce qu'il y a derrière\n List<Prestation> listePrestation = ouvrageParent.getListePrestation();\n listePrestation.add(prestation);\n ouvrageParent.setListePrestation(listePrestation);\n descriptifDao.Update(ouvrageParent);\n }\n else{ //on modifie le titre de la prestation\n prestation.setNomDescriptif(docListe.get(i).get(3));\n prestation.setDescription(docListe.get(i).get(4));\n prestation.setCourteDescription(docListe.get(i).get(5));\n prestationDao.Update(prestation);\n } \n JpaUtil.validerTransaction();\n break;\n }\n }\n //on traite les suppressions\n else{\n //on ajoute à la liste de sortie les idnetifiant à supprimer\n returnListe.add(idActuel);\n }\n } \n } catch(Exception ex){\n returnListe.set(0, \"Problème d'insertion dans la base de donnée (problème de format?). ID: \"+idActuel);\n erreur = true;\n } finally {\n JpaUtil.fermerContextePersistance(); \n }\n }\n }\n \n if(!erreur){\n returnListe.set(0, \"Succes\");\n }\n \n return returnListe;\n }", "public Doc_estado() {\n }", "public interface InoObject extends JMElement {\r\n\t/** Sets the objects document name. May be null,\r\n * because a document is typically not required.\r\n\t */\r\n public void setInoDocname(String pDocname);\r\n\r\n /** Sets the objects ino:id. May be null,\r\n * because an ino:id is no longer required\r\n * nowadays.\r\n */\r\n public void setInoId(String pId);\r\n\r\n /** Returns the objects document name. May be null,\r\n * because a document is typically not required.\r\n */\r\n public String getInoDocname();\r\n\r\n /** Returns the objects ino:id. May be null,\r\n * because an ino:id is no longer required\r\n * nowadays.\r\n */\r\n public String getInoId();\r\n}", "public Principal() {\n initComponents();\n\n System.out.println(\"lista de hoteles disponibles\");\n List<Document> hoteles = db.getAllDocuments(\"hoteles\");\n for (Document hotel : hoteles) {\n this.hoteles.add(hotel.getString(\"nombre\"));\n System.out.println(hotel.getString(\"nombre\"));\n }\n \n List<Document> ciudades = db.getAllDocuments(\"ciudades\");\n for (Document ciudad : ciudades) {\n this.ciudades_destino.add(ciudad.getString(\"nombre\"));\n }\n \n }", "public void setFilaDatosExportarXmlPagosAutorizados(PagosAutorizados pagosautorizados,Document document,Element element) {\r\n\t\t\r\n\r\n\t\tElement elementId = document.createElement(PagosAutorizadosConstantesFunciones.ID);\r\n\t\telementId.appendChild(document.createTextNode(pagosautorizados.getId().toString().trim()));\r\n\t\telement.appendChild(elementId);\r\n\r\n\t\tif(parametroGeneralUsuario.getcon_exportar_campo_version()){\r\n\r\n\t\tElement elementVersionRow = document.createElement(PagosAutorizadosConstantesFunciones.VERSIONROW);\r\n\t\telementVersionRow.appendChild(document.createTextNode(pagosautorizados.getVersionRow().toString().trim()));\r\n\t\telement.appendChild(elementVersionRow);\r\n\t\t}\r\n\r\n\r\n\t\tElement elementempresa_descripcion = document.createElement(PagosAutorizadosConstantesFunciones.IDEMPRESA);\r\n\t\telementempresa_descripcion.appendChild(document.createTextNode(pagosautorizados.getempresa_descripcion()));\r\n\t\telement.appendChild(elementempresa_descripcion);\r\n\r\n\t\tElement elementfecha_corte = document.createElement(PagosAutorizadosConstantesFunciones.FECHACORTE0);\r\n\t\telementfecha_corte.appendChild(document.createTextNode(pagosautorizados.getfecha_corte().toString().trim()));\r\n\t\telement.appendChild(elementfecha_corte);\r\n\r\n\t\tElement elementnombre_cliente = document.createElement(PagosAutorizadosConstantesFunciones.NOMBRECLIENTE);\r\n\t\telementnombre_cliente.appendChild(document.createTextNode(pagosautorizados.getnombre_cliente().trim()));\r\n\t\telement.appendChild(elementnombre_cliente);\r\n\r\n\t\tElement elementnumero_factura = document.createElement(PagosAutorizadosConstantesFunciones.NUMEROFACTURA);\r\n\t\telementnumero_factura.appendChild(document.createTextNode(pagosautorizados.getnumero_factura().trim()));\r\n\t\telement.appendChild(elementnumero_factura);\r\n\r\n\t\tElement elementfecha_emision = document.createElement(PagosAutorizadosConstantesFunciones.FECHAEMISION);\r\n\t\telementfecha_emision.appendChild(document.createTextNode(pagosautorizados.getfecha_emision().toString().trim()));\r\n\t\telement.appendChild(elementfecha_emision);\r\n\r\n\t\tElement elementfecha_vencimiento = document.createElement(PagosAutorizadosConstantesFunciones.FECHAVENCIMIENTO);\r\n\t\telementfecha_vencimiento.appendChild(document.createTextNode(pagosautorizados.getfecha_vencimiento().toString().trim()));\r\n\t\telement.appendChild(elementfecha_vencimiento);\r\n\r\n\t\tElement elementnombre_banco = document.createElement(PagosAutorizadosConstantesFunciones.NOMBREBANCO);\r\n\t\telementnombre_banco.appendChild(document.createTextNode(pagosautorizados.getnombre_banco().trim()));\r\n\t\telement.appendChild(elementnombre_banco);\r\n\r\n\t\tElement elementvalor_por_pagar = document.createElement(PagosAutorizadosConstantesFunciones.VALORPORPAGAR);\r\n\t\telementvalor_por_pagar.appendChild(document.createTextNode(pagosautorizados.getvalor_por_pagar().toString().trim()));\r\n\t\telement.appendChild(elementvalor_por_pagar);\r\n\r\n\t\tElement elementvalor_cancelado = document.createElement(PagosAutorizadosConstantesFunciones.VALORCANCELADO);\r\n\t\telementvalor_cancelado.appendChild(document.createTextNode(pagosautorizados.getvalor_cancelado().toString().trim()));\r\n\t\telement.appendChild(elementvalor_cancelado);\r\n\r\n\t\tElement elementnumero_cuenta = document.createElement(PagosAutorizadosConstantesFunciones.NUMEROCUENTA);\r\n\t\telementnumero_cuenta.appendChild(document.createTextNode(pagosautorizados.getnumero_cuenta().trim()));\r\n\t\telement.appendChild(elementnumero_cuenta);\r\n\r\n\t\tElement elementesta_autorizado = document.createElement(PagosAutorizadosConstantesFunciones.ESTAAUTORIZADO);\r\n\t\telementesta_autorizado.appendChild(document.createTextNode(pagosautorizados.getesta_autorizado().toString().trim()));\r\n\t\telement.appendChild(elementesta_autorizado);\r\n\r\n\t\tElement elementdescripcion = document.createElement(PagosAutorizadosConstantesFunciones.DESCRIPCION);\r\n\t\telementdescripcion.appendChild(document.createTextNode(pagosautorizados.getdescripcion().trim()));\r\n\t\telement.appendChild(elementdescripcion);\r\n\r\n\t\tElement elementfecha_corte_dato = document.createElement(PagosAutorizadosConstantesFunciones.FECHACORTE);\r\n\t\telementfecha_corte_dato.appendChild(document.createTextNode(pagosautorizados.getfecha_corte_dato().toString().trim()));\r\n\t\telement.appendChild(elementfecha_corte_dato);\r\n\r\n\t\tElement elementestado = document.createElement(PagosAutorizadosConstantesFunciones.ESTADO);\r\n\t\telementestado.appendChild(document.createTextNode(pagosautorizados.getestado().trim()));\r\n\t\telement.appendChild(elementestado);\r\n\r\n\t\tElement elementcodigo_cuenta_con_cliente = document.createElement(PagosAutorizadosConstantesFunciones.CODIGOCUENTACONCLIENTE);\r\n\t\telementcodigo_cuenta_con_cliente.appendChild(document.createTextNode(pagosautorizados.getcodigo_cuenta_con_cliente().trim()));\r\n\t\telement.appendChild(elementcodigo_cuenta_con_cliente);\r\n\r\n\t\tElement elementcodigo_cuenta_con_banco = document.createElement(PagosAutorizadosConstantesFunciones.CODIGOCUENTACONBANCO);\r\n\t\telementcodigo_cuenta_con_banco.appendChild(document.createTextNode(pagosautorizados.getcodigo_cuenta_con_banco().trim()));\r\n\t\telement.appendChild(elementcodigo_cuenta_con_banco);\r\n\t}", "com.soa.SolicitarCreditoDocument.SolicitarCredito addNewSolicitarCredito();", "private void reposicionarPersonajes() {\n // TODO implement here\n }", "public void setFilaDatosExportarXmlCostoGastoImpor(CostoGastoImpor costogastoimpor,Document document,Element element) {\r\n\t\t\r\n\r\n\t\tElement elementId = document.createElement(CostoGastoImporConstantesFunciones.ID);\r\n\t\telementId.appendChild(document.createTextNode(costogastoimpor.getId().toString().trim()));\r\n\t\telement.appendChild(elementId);\r\n\r\n\t\tif(parametroGeneralUsuario.getcon_exportar_campo_version()){\r\n\r\n\t\tElement elementVersionRow = document.createElement(CostoGastoImporConstantesFunciones.VERSIONROW);\r\n\t\telementVersionRow.appendChild(document.createTextNode(costogastoimpor.getVersionRow().toString().trim()));\r\n\t\telement.appendChild(elementVersionRow);\r\n\t\t}\r\n\r\n\r\n\t\tElement elementempresa_descripcion = document.createElement(CostoGastoImporConstantesFunciones.IDEMPRESA);\r\n\t\telementempresa_descripcion.appendChild(document.createTextNode(costogastoimpor.getempresa_descripcion()));\r\n\t\telement.appendChild(elementempresa_descripcion);\r\n\r\n\t\tElement elementsucursal_descripcion = document.createElement(CostoGastoImporConstantesFunciones.IDSUCURSAL);\r\n\t\telementsucursal_descripcion.appendChild(document.createTextNode(costogastoimpor.getsucursal_descripcion()));\r\n\t\telement.appendChild(elementsucursal_descripcion);\r\n\r\n\t\tElement elementtipocostogastoimpor_descripcion = document.createElement(CostoGastoImporConstantesFunciones.IDTIPOCOSTOGASTOIMPOR);\r\n\t\telementtipocostogastoimpor_descripcion.appendChild(document.createTextNode(costogastoimpor.gettipocostogastoimpor_descripcion()));\r\n\t\telement.appendChild(elementtipocostogastoimpor_descripcion);\r\n\r\n\t\tElement elementnombre = document.createElement(CostoGastoImporConstantesFunciones.NOMBRE);\r\n\t\telementnombre.appendChild(document.createTextNode(costogastoimpor.getnombre().trim()));\r\n\t\telement.appendChild(elementnombre);\r\n\r\n\t\tElement elementes_activo = document.createElement(CostoGastoImporConstantesFunciones.ESACTIVO);\r\n\t\telementes_activo.appendChild(document.createTextNode(costogastoimpor.getes_activo().toString().trim()));\r\n\t\telement.appendChild(elementes_activo);\r\n\r\n\t\tElement elementcon_agrupa = document.createElement(CostoGastoImporConstantesFunciones.CONAGRUPA);\r\n\t\telementcon_agrupa.appendChild(document.createTextNode(costogastoimpor.getcon_agrupa().toString().trim()));\r\n\t\telement.appendChild(elementcon_agrupa);\r\n\r\n\t\tElement elementcon_prorratea = document.createElement(CostoGastoImporConstantesFunciones.CONPRORRATEA);\r\n\t\telementcon_prorratea.appendChild(document.createTextNode(costogastoimpor.getcon_prorratea().toString().trim()));\r\n\t\telement.appendChild(elementcon_prorratea);\r\n\r\n\t\tElement elementcon_factura = document.createElement(CostoGastoImporConstantesFunciones.CONFACTURA);\r\n\t\telementcon_factura.appendChild(document.createTextNode(costogastoimpor.getcon_factura().toString().trim()));\r\n\t\telement.appendChild(elementcon_factura);\r\n\r\n\t\tElement elementcon_flete = document.createElement(CostoGastoImporConstantesFunciones.CONFLETE);\r\n\t\telementcon_flete.appendChild(document.createTextNode(costogastoimpor.getcon_flete().toString().trim()));\r\n\t\telement.appendChild(elementcon_flete);\r\n\r\n\t\tElement elementcon_arancel = document.createElement(CostoGastoImporConstantesFunciones.CONARANCEL);\r\n\t\telementcon_arancel.appendChild(document.createTextNode(costogastoimpor.getcon_arancel().toString().trim()));\r\n\t\telement.appendChild(elementcon_arancel);\r\n\r\n\t\tElement elementcon_seguro = document.createElement(CostoGastoImporConstantesFunciones.CONSEGURO);\r\n\t\telementcon_seguro.appendChild(document.createTextNode(costogastoimpor.getcon_seguro().toString().trim()));\r\n\t\telement.appendChild(elementcon_seguro);\r\n\r\n\t\tElement elementcon_total_general = document.createElement(CostoGastoImporConstantesFunciones.CONTOTALGENERAL);\r\n\t\telementcon_total_general.appendChild(document.createTextNode(costogastoimpor.getcon_total_general().toString().trim()));\r\n\t\telement.appendChild(elementcon_total_general);\r\n\r\n\t\tElement elementcon_digitado = document.createElement(CostoGastoImporConstantesFunciones.CONDIGITADO);\r\n\t\telementcon_digitado.appendChild(document.createTextNode(costogastoimpor.getcon_digitado().toString().trim()));\r\n\t\telement.appendChild(elementcon_digitado);\r\n\t}" ]
[ "0.6121743", "0.5891941", "0.5883054", "0.5864749", "0.58620495", "0.58490896", "0.5790398", "0.5768333", "0.5732173", "0.57151896", "0.5686522", "0.5666772", "0.56655824", "0.5631346", "0.5574874", "0.55697006", "0.5554917", "0.5539498", "0.55361015", "0.5508285", "0.55067694", "0.5502197", "0.5498197", "0.54971486", "0.5478129", "0.54696494", "0.5455414", "0.5452623", "0.5450615", "0.54485637", "0.5439611", "0.5439611", "0.54340637", "0.54340637", "0.54340637", "0.5430844", "0.54292494", "0.5412724", "0.53976214", "0.53795844", "0.5377725", "0.53557926", "0.5351991", "0.53494817", "0.5346761", "0.5337968", "0.5337855", "0.53359777", "0.53344476", "0.53344476", "0.53344476", "0.53283507", "0.5323453", "0.52726567", "0.5263492", "0.5259513", "0.52339745", "0.5232784", "0.5220206", "0.52192736", "0.5215981", "0.52080333", "0.5207198", "0.5204003", "0.52029014", "0.5201227", "0.52010906", "0.5189452", "0.51858157", "0.5178554", "0.5177891", "0.51739407", "0.51729745", "0.5171749", "0.51698726", "0.5169057", "0.5168844", "0.51663876", "0.5161404", "0.5157611", "0.515512", "0.5153452", "0.5134525", "0.5129873", "0.51294905", "0.5127313", "0.5124976", "0.5123211", "0.51211137", "0.5119074", "0.5112142", "0.5111806", "0.5110954", "0.5110236", "0.51086617", "0.51026666", "0.5099925", "0.5095167", "0.50949645", "0.50925285", "0.5090194" ]
0.0
-1
TODO Autogenerated method stub
@Override public void keyReleased(KeyEvent e) { int keyCode = e.getKeyCode(); if (keyCode == KeyEvent.VK_SPACE) System.exit(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.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 void keyTyped(KeyEvent 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.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
Method to initialize Logger with the command BasicConfigurator.configure() and to set its level.
public static void initializeLogger(Level level) { ClassLoader loader = Thread.currentThread().getContextClassLoader(); URL url = loader.getResource("resources/log4j.xml"); PropertyConfigurator.configure(url); Logger logger = Logger.getLogger(BaseActivator.class); logger.setLevel(level); logger.info("Starting Logger: Level = " + logger.getLevel().getClass()); BaseActivator.setLoggerIsInitialized(true); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected void initLogger() {\n initLogger(\"DEBUG\");\n }", "private void initLogger() {\n\t\ttry {\n\t\t\tjava.util.logging.Logger rootLogger = java.util.logging.Logger.getLogger(\"\");\n\t\t\trootLogger.setUseParentHandlers(false);\n\t\t\tHandler csvFileHandler = new FileHandler(\"logger/log.csv\", 100000, 1, true);\n\t\t\tlogformater = new LogFormatter();\n\t\t\trootLogger.addHandler(csvFileHandler);\n\t\t\tcsvFileHandler.setFormatter(logformater);\n\t\t\tlogger.setLevel(Level.ALL);\n\t\t} catch (IOException ie) {\n\t\t\tSystem.out.println(\"Logger initialization failed\");\n\t\t\tie.printStackTrace();\n\t\t}\n\t}", "void initializeLogging();", "private static void setupLogger() {\n\t\tLogManager.getLogManager().reset();\n\t\t// set the level of logging.\n\t\tlogger.setLevel(Level.ALL);\n\t\t// Create a new Handler for console.\n\t\tConsoleHandler consHandler = new ConsoleHandler();\n\t\tconsHandler.setLevel(Level.SEVERE);\n\t\tlogger.addHandler(consHandler);\n\n\t\ttry {\n\t\t\t// Create a new Handler for file.\n\t\t\tFileHandler fHandler = new FileHandler(\"HQlogger.log\");\n\t\t\tfHandler.setFormatter(new SimpleFormatter());\n\t\t\t// set level of logging\n\t\t\tfHandler.setLevel(Level.FINEST);\n\t\t\tlogger.addHandler(fHandler);\n\t\t}catch(IOException e) {\n\t\t\tlogger.log(Level.SEVERE, \"File logger not working! \", e);\n\t\t}\n\t}", "private void initLogger(BundleContext bc) {\n\t\tBasicConfigurator.configure();\r\n\t\tlogger = Logger.getLogger(Activator.class);\r\n\t\tLogger.getLogger(\"org.directwebremoting\").setLevel(Level.WARN);\r\n\t}", "@BeforeAll\n public static void configureLogger() {\n new SuperStructure(null, null, null, null, null);\n\n Logger.configure(null);\n Logger.start();\n }", "public void configLog()\n\t{\n\t\tlogConfigurator.setFileName(Environment.getExternalStorageDirectory() + File.separator + dataFileName);\n\t\t// Set the root log level\n\t\t//writerConfigurator.setRootLevel(Level.DEBUG);\n\t\tlogConfigurator.setRootLevel(Level.DEBUG);\n\t\t///writerConfigurator.setMaxFileSize(1024 * 1024 * 500);\n\t\tlogConfigurator.setMaxFileSize(1024 * 1024 * 1024);\n\t\t// Set log level of a specific logger\n\t\t//writerConfigurator.setLevel(\"org.apache\", Level.ERROR);\n\t\tlogConfigurator.setLevel(\"org.apache\", Level.ERROR);\n\t\tlogConfigurator.setImmediateFlush(true);\n\t\t//writerConfigurator.configure();\n\t\tlogConfigurator.configure();\n\n\t\t//gLogger = Logger.getLogger(this.getClass());\n\t\t//gWriter = \n\t\tgLogger = Logger.getLogger(\"vdian\");\n\t}", "private void initLogConfig() {\n\t\t logConfigurator = new LogConfigurator();\n\t\t// Setting append log coudn't cover by a new log.\n\t\tlogConfigurator.setUseFileAppender(true);\n\t\t// Define a file path for output log.\n\t\tString filename = StorageUtils.getLogFile();\n\t\tLog.i(\"info\", filename);\n\t\t// Setting log output\n\t\tlogConfigurator.setFileName(filename);\n\t\t// Setting log's level\n\t\tlogConfigurator.setRootLevel(Level.DEBUG);\n\t\tlogConfigurator.setLevel(\"org.apache\", Level.ERROR);\n\t\tlogConfigurator.setFilePattern(\"%d %-5p [%c{2}]-[%L] %m%n\");\n\t\tlogConfigurator.setMaxFileSize(1024 * 1024 * 5);\n\t\t// Set up to use the cache first and then output to a file for a period\n\t\t// of time\n\t\tlogConfigurator.setImmediateFlush(false);\n\t\tlogConfigurator.setUseLogCatAppender(true);\n\t\t// logConfigurator.setResetConfiguration(true);\n\t\tlogConfigurator.configure();\n\t}", "@Override\n\tpublic void initLogger() {\n\t\t\n\t}", "private static void initLogger() {\n if (initialized) {\n return;\n }\n\n initialized = true;\n\n System.out.println(\"\");\n System.out.println(\"=> Begin System Logging Configuration\");\n URL fileUrl = null;\n String filePath = null;\n\n try {\n final Region region = EnvironmentConfiguration.getRegion();\n filePath = \"log4j-\" + region.getCode() + \".xml\";\n System.out.println(\"=> searching for log configuration file : \" + filePath);\n fileUrl = LogFactory.class.getResource(\"/\" + filePath);\n DOMConfigurator.configure(fileUrl);\n System.out.println(\"=> found log configuration file : \" + fileUrl);\n System.out.println(\"=> System Logging has been initialized\");\n }\n catch (final NoClassDefFoundError ncdf) {\n System.out.println(\"=> Logging Configuration Failed\");\n System.err.println(LogFactory.class.getName()\n + \"::loadProps() - Unable to find needed classes. Logging disabled. \" + ncdf);\n }\n catch (final Exception e) {\n System.out.println(\"=> Logging Configuration Failed\");\n System.err.println(\n LogFactory.class.getName() + \"::loadProps() - Unable to initialize logger from file=\"\n + filePath + \". Logging disabled.\");\n }\n System.out.println(\"=> End System Logging Configuration\");\n System.out.println(\"\");\n }", "private void configure() {\r\n LogManager manager = LogManager.getLogManager();\r\n String className = this.getClass().getName();\r\n String level = manager.getProperty(className + \".level\");\r\n String filter = manager.getProperty(className + \".filter\");\r\n String formatter = manager.getProperty(className + \".formatter\");\r\n\r\n //accessing super class methods to set the parameters\r\n\r\n\r\n }", "private void setupLogging() {\n\t\t// Ensure all JDK log messages are deferred until a target is registered\n\t\tLogger rootLogger = Logger.getLogger(\"\");\n\t\tHandlerUtils.wrapWithDeferredLogHandler(rootLogger, Level.SEVERE);\n\n\t\t// Set a suitable priority level on Spring Framework log messages\n\t\tLogger sfwLogger = Logger.getLogger(\"org.springframework\");\n\t\tsfwLogger.setLevel(Level.WARNING);\n\n\t\t// Set a suitable priority level on Roo log messages\n\t\t// (see ROO-539 and HandlerUtils.getLogger(Class))\n\t\tLogger rooLogger = Logger.getLogger(\"org.springframework.shell\");\n\t\trooLogger.setLevel(Level.FINE);\n\t}", "public void configLogger() {\n Logger.addLogAdapter(new AndroidLogAdapter());\n }", "private Logger configureLogging() {\r\n\t Logger rootLogger = Logger.getLogger(\"\");\r\n\t rootLogger.setLevel(Level.FINEST);\r\n\r\n\t // By default there is one handler: the console\r\n\t Handler[] defaultHandlers = Logger.getLogger(\"\").getHandlers();\r\n\t defaultHandlers[0].setLevel(Level.CONFIG);\r\n\r\n\t // Add our logger\r\n\t Logger ourLogger = Logger.getLogger(serviceLocator.getAPP_NAME());\r\n\t ourLogger.setLevel(Level.FINEST);\r\n\t \r\n\t // Add a file handler, putting the rotating files in the tmp directory \r\n\t // \"%u\" a unique number to resolve conflicts, \"%g\" the generation number to distinguish rotated logs \r\n\t try {\r\n\t Handler logHandler = new FileHandler(\"/%h\"+serviceLocator.getAPP_NAME() + \"_%u\" + \"_%g\" + \".log\",\r\n\t 1000000, 3);\r\n\t logHandler.setLevel(Level.FINEST);\r\n\t ourLogger.addHandler(logHandler);\r\n\t logHandler.setFormatter(new Formatter() {\r\n\t\t\t\t\t\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tpublic String format(LogRecord record) {\r\n\t\t\t\t\t\tString result=\"\";\r\n\t\t\t\t\t\tif(record.getLevel().intValue() >= Level.WARNING.intValue()){\r\n\t\t\t\t\t\t\tresult += \"ATTENTION!: \";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tSimpleDateFormat df = new SimpleDateFormat(\"dd-MMM-yyyy HH:mm:ss\");\r\n\t\t\t\t\t\tDate d = new Date(record.getMillis());\r\n\t\t\t\t\t\tresult += df.format(d)+\" \";\r\n\t\t\t\t\t\tresult += \"[\"+record.getLevel()+\"] \";\r\n\t\t\t\t\t\tresult += this.formatMessage(record);\r\n\t\t\t\t\t\tresult += \"\\r\\n\";\r\n\t\t\t\t\t\treturn result;\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t } catch (Exception e) { // If we are unable to create log files\r\n\t throw new RuntimeException(\"Unable to initialize log files: \"\r\n\t + e.toString());\r\n\t }\r\n\r\n\t return ourLogger;\r\n\t }", "public static void loggingExample() {\n\t\tSystem.out.println(\"This is running with the default logger!\");\n\t\tnewLogger.fatal(\"This is fatal\");\n\t\tnewLogger.warn(\"This is the warn level\");\n\t\tnewLogger.info(\"This is the info level\");\n\t\t\n\t}", "private void configureLogging() throws FileNotFoundException, IOException {\n\t\tConfigurationSource source = new ConfigurationSource(new FileInputStream(CONFIG_LOG_LOCATION));\r\n\t\tConfigurator.initialize(null, source);\r\n\t\tlog = LogManager.getLogger(SekaiClient.class);\r\n\t}", "private void init() {\r\n this.log = this.getLog(LOGGER_MAIN);\r\n\r\n if (!(this.log instanceof org.apache.commons.logging.impl.Log4JLogger)) {\r\n throw new IllegalStateException(\r\n \"LogUtil : apache Log4J library or log4j.xml file are not present in classpath !\");\r\n }\r\n\r\n // TODO : check if logger has an appender (use parent hierarchy if needed)\r\n if (this.log.isWarnEnabled()) {\r\n this.log.warn(\"LogUtil : logging enabled now.\");\r\n }\r\n\r\n this.logBase = this.getLog(LOGGER_BASE);\r\n this.logDev = this.getLog(LOGGER_DEV);\r\n }", "protected void initLogger(String logLevel) {\n Logger.setLevel(logLevel);\n }", "public static synchronized void initializeLogger() {\n\t\t\n\t try {\n\t\t String workingDir = System.getProperty(\"user.dir\");\n\t\t String fileName = workingDir + File.separator + \"config\" + File.separator + \"logging.properties\";\n\t\t \n\t\t FileInputStream fileInputStream = new FileInputStream(fileName);\n\t\t LogManager.getLogManager().readConfiguration(fileInputStream);\n\t\t \n\t } catch (IOException ex) {\n\t\t System.err.println(\"Failed to load logging.properlies, please check the file and the path:\" + ex.getMessage()); \n\t ex.printStackTrace();\n\t System.exit(0);\n\t }\n\t}", "private void init() {\n LoggerContext ctx = (LoggerContext) LogManager.getContext(false);\n Configuration config = ctx.getConfiguration();\n LoggerConfig loggerConfig = config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME);\n loggerConfig.setLevel(DEBUG ? Level.DEBUG : Level.INFO);\n ctx.updateLoggers();\n\n // Check if Maven repo exists\n File f = new File(globalConfig.getMavenRepoPath());\n if (!f.exists()) {\n // If not then create\n f.mkdir();\n }\n }", "public void setupLogging() {\n\t\ttry {\n\t\t\t_logger = Logger.getLogger(QoSModel.class);\n\t\t\tSimpleLayout layout = new SimpleLayout();\n\t\t\t_appender = new FileAppender(layout,_logFileName+\".txt\",false);\n\t\t\t_logger.addAppender(_appender);\n\t\t\t_logger.setLevel(Level.ALL);\n\t\t\tSystem.setOut(createLoggingProxy(System.out));\n\t\t}\n\t\tcatch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void initialize() {\n final ConfigurationManager config = ConfigurationManager.getInstance();\n boolean overrideLog = System.getProperty(\"azureus.overridelog\") != null;\n\n for (int i = 0; i < ignoredComponents.length; i++) {\n ignoredComponents[i] = new ArrayList();\n }\n\n if (!overrideLog) {\n config.addListener(new COConfigurationListener() {\n public void configurationSaved() {\n checkLoggingConfig();\n }\n });\n }\n\n checkLoggingConfig();\n config.addParameterListener(CFG_ENABLELOGTOFILE, new ParameterListener() {\n public void parameterChanged(String parameterName) {\n FileLogging.this.reloadLogToFileParam();\n }\n });\n }", "private void configureLogging() throws FileNotFoundException, IOException {\r\n\t\t// Set configuration file for log4j2\r\n\t\tConfigurationSource source = new ConfigurationSource(new FileInputStream(CONFIG_LOG_LOCATION));\r\n\t\tConfigurator.initialize(null, source);\r\n\t\tlog = LogManager.getLogger(SBIWebServer.class);\r\n\t}", "public static void setUp() {\n Handler handler = new LoggerHandler();\n handler.setFormatter(new SimpleFormatter());\n getInstance().addHandler(handler);\n }", "public static void log4jExample() {\n\t\tnewLogger.warn(\"This is the info level\");\n\t\t\n\t}", "public void setup (SProperties config) throws IOException {\n\tString sysLogging =\n\t System.getProperty (\"java.util.logging.config.file\");\n\tif (sysLogging != null) {\n\t System.out.println (\"Logging configure by system property\");\n\t} else {\n\t Logger eh = getLogger (config, \"error\", null, \"rabbit\",\n\t\t\t\t \"org.khelekore.rnio\");\n\t eh.info (\"Log level set to: \" + eh.getLevel ());\n\t}\n\taccessLog = getLogger (config, \"access\", new AccessFormatter (),\n\t\t\t \"rabbit_access\");\n }", "private static void defineLogger() {\n HTMLLayout layout = new HTMLLayout();\n DailyRollingFileAppender appender = null;\n try {\n appender = new DailyRollingFileAppender(layout, \"/Server_Log/log\", \"yyyy-MM-dd\");\n } catch (IOException e) {\n e.printStackTrace();\n }\n logger.addAppender(appender);\n logger.setLevel(Level.DEBUG);\n }", "public static void getLoggerConfiguration() {\n\t\tPropertyConfigurator.configure(System.getProperty(\"user.dir\")+ \"\\\\Config\\\\log4j.properties\");\n\t}", "private void initCemsLogger() {\n if (logger == null) {\n final SimpleDateFormat dateFormat = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\");\n\n final Formatter formatter = new Formatter() {\n @Override\n public String format(LogRecord record) {\n final StringBuilder sb = new StringBuilder();\n sb.append(dateFormat.format(new Date(record.getMillis())));\n sb.append(\" - \");\n sb.append(record.getLevel().getName());\n sb.append(\": \");\n sb.append(record.getMessage());\n sb.append(\"\\n\");\n @SuppressWarnings(\"ThrowableResultOfMethodCallIgnored\")\n final Throwable thrown = record.getThrown();\n if (thrown != null) {\n sb.append(thrown.toString());\n sb.append(\"\\n\");\n }\n return sb.toString();\n }\n };\n\n final ConsoleHandler handler = new ConsoleHandler();\n handler.setFormatter(formatter);\n handler.setLevel(Level.ALL);\n\n logger = Logger.getLogger(\"ga.cems\");\n final Handler[] handlers = logger.getHandlers();\n for (Handler h : handlers) {\n logger.removeHandler(h);\n }\n\n logger.setUseParentHandlers(false);\n logger.addHandler(handler);\n }\n// logger.setLevel(Level.INFO);\n logger.setLevel(logLevel);\n }", "private void configureLogLevels()\r\n { \r\n String level = properties.getProperty(\"LogLevel\");\r\n \r\n switch(level)\r\n {\r\n case \"INFO\": INFO = Level.INFO; \r\n DEBUG = Level.FINE; \r\n WARNING = Level.FINE;\r\n break;\r\n case \"DEBUG\": INFO = Level.INFO;\r\n DEBUG = Level.INFO; \r\n WARNING = Level.INFO;\r\n break;\r\n case \"WARNING\": INFO = Level.FINE; \r\n DEBUG = Level.FINE; \r\n WARNING = Level.INFO; \r\n break;\r\n default: INFO = Level.INFO; \r\n DEBUG = Level.FINE; \r\n WARNING = Level.WARNING;\r\n break;\r\n }\r\n }", "void initializeLogging(String loggingProperties);", "private void initLoggers() {\n _logger = LoggerFactory.getInstance().createLogger();\n _build_logger = LoggerFactory.getInstance().createAntLogger();\n }", "public static void initialize(){\n Logger logger = Logger.getLogger(\"\");\n\n //from: http://stackoverflow.com/questions/6029454/disabling-awt-swing-debug-fine-log-messages\n Logger.getLogger(\"java.awt\").setLevel(Level.OFF);\n Logger.getLogger(\"sun.awt\").setLevel(Level.OFF);\n Logger.getLogger(\"sun.lwawt\").setLevel(Level.OFF);\n Logger.getLogger(\"javax.swing\").setLevel(Level.OFF);\n\n if (uiLoggerFormatter==null){\n uiLoggerFormatter = new SimpleFormatter();\n }\n\n if (consoleLoggerFormatter==null){\n consoleLoggerFormatter = new SimpleFormatter();\n }\n Handler[] handlers = logger.getHandlers();\n // suppress the logging output to the console\n if (!enableConsoleLogger){\n if (handlers[0] instanceof ConsoleHandler) {\n logger.removeHandler(handlers[0]);\n }\n }\n else{\n if (handlers[0] instanceof ConsoleHandler) {\n handlers[0].setFormatter(consoleLoggerFormatter);\n }\n }\n\n setLevel(lvl);\n\n if(fileHandler!=null){\n if (fileLoggerFormatter==null){\n fileLoggerFormatter = new SimpleFormatter();\n }\n fileHandler.setFormatter(fileLoggerFormatter);\n logger.addHandler(fileHandler);\n }\n\n if(enableUILogger){\n txtAreaHandler = new EZUIHandler(uiLoggerSizeLimit);\n txtAreaHandler.setFormatter(uiLoggerFormatter);\n logger.addHandler(txtAreaHandler);\n }\n \n initialized = true;\n }", "static public void setup() throws IOException {\n Logger logger = Logger.getLogger(\"\");\n\n logger.setLevel(Level.INFO);\n Calendar cal = Calendar.getInstance();\n //SimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd HH-mm-ss\");\n SimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd\");\n String dateStr = sdf.format(cal.getTime());\n fileTxt = new FileHandler(\"log_\" + dateStr + \".txt\");\n fileHTML = new FileHandler(\"log_\" + dateStr + \".html\");\n\n // Create txt Formatter\n formatterTxt = new SimpleFormatter();\n fileTxt.setFormatter(formatterTxt);\n logger.addHandler(fileTxt);\n\n // Create HTML Formatter\n formatterHTML = new LogHTMLFormatter();\n fileHTML.setFormatter(formatterHTML);\n logger.addHandler(fileHTML);\n }", "@BeforeClass\n\tpublic static void setup() {\n\t\tLogger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);\n\t\troot.setLevel(Level.INFO);\n\t}", "private static void initializeLog(Properties config)\n {\n // log.file.level = [ ALL | DEBUG | INFO | WARN | ERROR | FATAL ]\n\n try\n {\n PatternLayout layout;\n\n String pattern = config.getProperty(\"log.file.layout\");\n if (null == pattern)\n {\n layout = new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN);\n }\n else\n {\n layout = new PatternLayout(pattern);\n }\n // System.out.println(\"Log4j pattern = \" + pattern);\n // System.out.println(\"Log4j layout = \" + layout);\n\n String fileName = basedir + File.separator + config.getProperty(\"log.dir\") +\n File.separator + config.getProperty(\"log.file\");\n // System.out.println(\"Log4j fileName = \" + fileName);\n\n RollingFileAppender appender = new RollingFileAppender(layout, fileName, true);\n appender.setMaxFileSize(config.getProperty(\"log.file.max.size\"));\n int maxBackup = 14; // default if property not available\n try\n {\n maxBackup = Integer.parseInt(config.getProperty(\"log.file.max.backup\"));\n }\n catch (NumberFormatException e) { }\n appender.setMaxBackupIndex(maxBackup);\n // System.out.println(\"Log4j maxBackup = \" + maxBackup);\n\n Logger log = Logger.getRootLogger();\n log.addAppender(appender);\n log.setLevel(Level.toLevel(config.getProperty(\"log.file.priority\")));\n }\n catch (IOException e)\n {\n System.err.println(\"FAILURE: Error opening log file\");\n System.err.println(e.getMessage());\n System.exit(BAD_RUN);\n }\n }", "private void initJulLogger() {\n SLF4JBridgeHandler.removeHandlersForRootLogger();\n SLF4JBridgeHandler.install();\n }", "@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = \"RV_RETURN_VALUE_IGNORED_BAD_PRACTICE\",\n justification = \"Return value for file delete is not important here.\")\n private void initLogWriter() throws org.apache.geode.admin.AdminException {\n loggingSession.createSession(this);\n\n final LogConfig logConfig = agentConfig.createLogConfig();\n\n // LOG: create logWriterAppender here\n loggingSession.startSession();\n\n // LOG: look in AgentConfigImpl for existing LogWriter to use\n InternalLogWriter existingLogWriter = agentConfig.getInternalLogWriter();\n if (existingLogWriter != null) {\n logWriter = existingLogWriter;\n } else {\n // LOG: create LogWriterLogger\n logWriter = LogWriterFactory.createLogWriterLogger(logConfig, false);\n // Set this log writer in AgentConfigImpl\n agentConfig.setInternalLogWriter(logWriter);\n }\n\n // LOG: create logWriter here\n logWriter = LogWriterFactory.createLogWriterLogger(logConfig, false);\n\n // Set this log writer in AgentConfig\n agentConfig.setInternalLogWriter(logWriter);\n\n // LOG:CONFIG: changed next three statements from config to info\n logger.info(LogMarker.CONFIG_MARKER,\n String.format(\"Agent config property file name: %s\",\n AgentConfigImpl.retrievePropertyFile()));\n logger.info(LogMarker.CONFIG_MARKER, agentConfig.getPropertyFileDescription());\n logger.info(LogMarker.CONFIG_MARKER, agentConfig.toPropertiesAsString());\n }", "private static void setupLogger(Application application) {\n\n\t\tapplication.addComponentMenu(Logger.class, \"Logger\", 0);\n\t\tapplication.addComponentMenuElement(Logger.class, \"Clear log\",\n\t\t\t\t(ActionEvent e) -> application.flushLoggerOutput());\n\t\tapplication.addComponentMenuElement(Logger.class, \"Fine level\", (ActionEvent e) -> logger.setLevel(Level.FINE));\n\t\tapplication.addComponentMenuElement(Logger.class, \"Info level\", (ActionEvent e) -> logger.setLevel(Level.INFO));\n\t\tapplication.addComponentMenuElement(Logger.class, \"Warning level\",\n\t\t\t\t(ActionEvent e) -> logger.setLevel(Level.WARNING));\n\t\tapplication.addComponentMenuElement(Logger.class, \"Severe level\",\n\t\t\t\t(ActionEvent e) -> logger.setLevel(Level.SEVERE));\n\t\tapplication.addComponentMenuElement(Logger.class, \"OFF logging\", (ActionEvent e) -> logger.setLevel(Level.OFF));\n\t}", "private static void setupLogger(String path, String filename, Level level) throws IOException {\n Path logDir = Paths.get(path, filename + \"_log\");\n\t\tif (!Files.exists(logDir)) {\n\t\t\tFiles.createDirectories(logDir);\n\t\t}\n\t\tString fileName = logDir.resolve(\"searsia.log\").toString();\n Handler fileHandler = new FileHandler(fileName, 1048576, 100, true);\n fileHandler.setFormatter(new SimpleFormatter());\n LogManager.getLogManager().reset();\n\t\tLOGGER.addHandler(fileHandler);\n\t\tLOGGER.setLevel(level);\n\t\tLOGGER.warning(\"Searsia restart\");\n\t}", "public void disabled_og4j_testSetLogLevel() throws Exception {\n assertEquals(\"Default Level is ERROR\", LOGGER.getLevel(), Level.ERROR);\n Helper.setLog4JLogLevel(Level.DEBUG);\n assertEquals(\"Default Level is DEBUG\", LOGGER.getLevel(), Level.DEBUG);\n }", "public static void setLogLevel(int level){\n\t\tswitch(level){\n\t\t\tcase ONE: \n\t\t\t\tLogger.getRootLogger().setLevel(Level.ALL); \n\t\t\t\tLOGGER.info(\"Logging Level set to LEVEL.ALL\"); \n\t\t\t\tbreak;\n\t\t\tcase TWO: \n\t\t\t\tLogger.getRootLogger().setLevel(Level.DEBUG); \n\t\t\t\tLOGGER.info(\"Logging Level set to LEVEL.DEBUG\"); \n\t\t\t\tbreak;\n\t\t\tcase THREE:\n\t\t\t\tLogger.getRootLogger().setLevel(Level.ERROR);\n\t\t\t\tLOGGER.info(\"Logging Level set to LEVEL.ERROR\");\n\t\t\t\tbreak;\n\t\t\tcase FOUR:\n\t\t\t\tLogger.getRootLogger().setLevel(Level.FATAL);\n\t\t\t\tLOGGER.info(\"Logging Level set to LEVEL.FATAL\");\n\t\t\t\tbreak;\n\t\t\tcase FIVE:\n\t\t\t\tLogger.getRootLogger().setLevel(Level.INFO);\n\t\t\t\tLOGGER.info(\"Logging Level set to LEVEL.INFO\");\n\t\t\t\tbreak;\n\t\t\tcase SIX:\n\t\t\t\tLogger.getRootLogger().setLevel(Level.OFF); \n\t\t\t\tLOGGER.info(\"Logging Level set to LEVEL.OFF\");\n\t\t\t\tbreak;\n\t\t\tcase SEVEN:\n\t\t\t\tLogger.getRootLogger().setLevel(Level.WARN);\n\t\t\t\tLOGGER.info(\"Logging Level set to LEVEL.WARN\");\n\t\t\t\tbreak;\n\t\t\tcase EIGHT:\n\t\t\t\tLogger.getRootLogger().setLevel(Level.TRACE);\n\t\t\t\tLOGGER.info(\"Logging Level set to LEVEL.WARN\");\n\t\t\t\tbreak;\n\t\t\tdefault: \n\t\t\t\tLogger.getRootLogger().setLevel(Level.ALL);\n\t\t\t\tLOGGER.info(\"Logging Level defaulted to LEVEL.ALL Please add parameter to properties file for custom logging.\");\n\t\t\t\tbreak;\n\t\t}\n\t}", "protected synchronized void initializeLogger(Logger logger) {\n\n if( config==null) {\n _unInitializedLoggers.add( logger );\n } else {\n internalInitializeLogger( logger ); \n }\n }", "public static void setLevel(int level){\n\tlogLevel = level;\n }", "private void initLoggers()\n {\n Logger.getSharedInstance();\n\n for (Logger logger : Logger.getAllLoggers())\n {\n String key = \"Loggers/\" + logger.getNamespace();\n Level desired;\n\n if (!SmartDashboard.containsKey(key))\n {\n // First time this logger has been sent to SmartDashboard\n SmartDashboard.putString(key, logger.getLogLevel().name());\n desired = Level.DEBUG;\n }\n else\n {\n String choice = SmartDashboard.getString(key, \"DEBUG\");\n Level parsed = Level.valueOf(choice);\n if (parsed == null)\n {\n m_logger.error(\"The choice '\" + choice + \"' for logger \" + logger.getNamespace() + \" isn't a valid value.\");\n desired = Level.DEBUG;\n }\n else\n {\n desired = parsed;\n }\n }\n logger.setLogLevel(desired);\n }\n }", "public void setLoggerLevel(TraceLevel level) {\n\t\t//Topology.STREAMS_LOGGER.setLevel(level);\t\t\n\t\t//Topology.TOPOLOGY_LOGGER.setLevel(level); \n\t\tgetConfig().put(ContextProperties.TRACING_LEVEL, java.util.logging.Level.FINE);\t\t\n\t\tSystem.out.println(\"Streams topology logger level: \" + Topology.TOPOLOGY_LOGGER.getLevel());\n\t\t\n\t}", "public void initALog() {\n ALog.Config config = ALog.init(this)\n .setLogSwitch(BuildConfig.DEBUG)// 设置log总开关,包括输出到控制台和文件,默认开\n .setConsoleSwitch(BuildConfig.DEBUG)// 设置是否输出到控制台开关,默认开\n .setGlobalTag(null)// 设置log全局标签,默认为空\n // 当全局标签不为空时,我们输出的log全部为该tag,\n // 为空时,如果传入的tag为空那就显示类名,否则显示tag\n .setLogHeadSwitch(false)// 设置log头信息开关,默认为开\n .setLog2FileSwitch(false)// 打印log时是否存到文件的开关,默认关\n .setDir(\"\")// 当自定义路径为空时,写入应用的/cache/log/目录中\n .setFilePrefix(\"\")// 当文件前缀为空时,默认为\"alog\",即写入文件为\"alog-MM-dd.txt\"\n .setBorderSwitch(true)// 输出日志是否带边框开关,默认开\n .setSingleTagSwitch(true)// 一条日志仅输出一条,默认开,为美化 AS 3.1.0 的 Logcat\n .setConsoleFilter(ALog.V)// log的控制台过滤器,和logcat过滤器同理,默认Verbose\n .setFileFilter(ALog.V)// log文件过滤器,和logcat过滤器同理,默认Verbose\n .setStackDeep(1)// log 栈深度,默认为 1\n .setStackOffset(0)// 设置栈偏移,比如二次封装的话就需要设置,默认为 0\n .setSaveDays(3)// 设置日志可保留天数,默认为 -1 表示无限时长\n // 新增 ArrayList 格式化器,默认已支持 Array, Throwable, Bundle, Intent 的格式化输出\n .addFormatter(new ALog.IFormatter<ArrayList>() {\n @Override\n public String format(ArrayList list) {\n return \"ALog Formatter ArrayList { \" + list.toString() + \" }\";\n }\n });\n ALog.d(config.toString());\n }", "@Override\n public void init() throws Exception {\n // allocate a new logger\n Logger logger = Logger.getLogger(\"processinfo\");\n\n // add some extra output channels, using mask bit 6\n try {\n outputStream = new FileOutputStream(filename);\n logger.addOutput(new PrintWriter(outputStream), new BitMask(MASK.APP));\n } catch (Exception e) {\n LoggerFactory.getLogger(TcpdumpReporter.class).error(e.getMessage());\n }\n\n }", "public static void setupLoggers() {\n SLF4JBridgeHandler.removeHandlersForRootLogger();\n\n // add SLF4JBridgeHandler to j.u.l's root logger\n SLF4JBridgeHandler.install();\n }", "public ModularConfiguration(Logger logger) {\n this.logger = logger;\n }", "public void enableLogging();", "public void customLogger() {\n KOOM.getInstance().setLogger(new KLog.KLogger() {\n @Override\n public void i(String TAG, String msg) {\n //get the log of info level\n }\n\n @Override\n public void d(String TAG, String msg) {\n //get the log of debug level\n }\n\n @Override\n public void e(String TAG, String msg) {\n //get the log of error level\n }\n });\n }", "static public void setLogLevel(final Logger.LEVEL desiredLevel) {\n ThreadPoolWorkQueue.execute(new Runnable() {\n @Override\n public void run() {\n setLevelSync(desiredLevel);\n // we do this mostly to enable unit tests to logger.wait(100) instead of\n // Thread.sleep(100) -- it's faster, more stable, and more deterministic that way\n synchronized (WAIT_LOCK) {\n WAIT_LOCK.notifyAll();\n }\n }\n });\n }", "@BeforeClass\n\tpublic void setup() {\n\t\tlogger = Logger.getLogger(\"AveroRestAPI\");\n\t\tPropertyConfigurator.configure(\"Log4j.properties\");\n\t\tlogger.setLevel(Level.DEBUG);\n\n\t}", "private static void configureLogging(String currentDirectory) {\n System.out.println(\"Looking for watchdog.properties within current working directory : \" + currentDirectory);\n try {\n LogManager manager = LogManager.getLogManager();\n manager.readConfiguration(new FileInputStream(WATCHDOG_LOGGING_PROPERTIES));\n try {\n fileHandler = new FileHandler(WatchDogConfiguration.watchdogLogfilePath, true); //file\n SimpleFormatter simple = new SimpleFormatter();\n fileHandler.setFormatter(simple);\n logger.addHandler(fileHandler);//adding Handler for file\n } catch (IOException e) {\n System.err.println(\"Exception during configuration of logging.\");\n }\n } catch (IOException e) {\n System.err.println(e.getMessage());\n }\n logger.info(String.format(\"Monitoring: %s\", WatchDogConfiguration.watchdogDirectoryMonitored));\n logger.info(String.format(\"Processed: %s\", WatchDogConfiguration.watchdogDirectoryProcessed));\n logger.info(String.format(\"Logfile: %s\", WatchDogConfiguration.watchdogLogfilePath));\n }", "public void setAppenderLogLevel(Level value) {\n\t\tfor(Enumeration<?> aen = LogManager.getRootLogger().getAllAppenders(); aen.hasMoreElements(); ) {\n Appender appender = (Appender) aen.nextElement();\n logger.debug(\"log4j appender: {}\", appender.getName());\n\t\t}\n\t\t\n\t\tConsoleAppender consoleAppender = (ConsoleAppender)LogManager.getRootLogger().getAppender(\"STDOUT\");\n\t\tconsoleAppender.setThreshold(value);\n\t\tconsoleAppender.activateOptions();\n\n\t\tRollingFileAppender appender = (RollingFileAppender)LogManager.getRootLogger().getAppender(\"RollingFileAppender\");\n\t\tappender.setThreshold(value);\n\t\tappender.activateOptions();\n\t}", "private static void setupLogging(IATOptions iatOptions) {\n\t\tPrintStream logS = null;\n\t\t\n\t\ttry {\n\t\t\tFile path = new File(iatOptions.logFilePath_);\n\t\t\tpath.getParentFile().mkdirs();\n\t\t\tlogS = new PrintStream(new FileOutputStream(path));\n\t\t\tSystem.setErr(logS);\n\t\t} catch (Exception e) {\n\t\t\tLogging.Init_LOG.error(\"Cannot open log file\", e);\n\t\t}\n\t}", "private static synchronized Logger initializeLogger(String path) {\r\n\t\tLogger logger = Logger.getLogger(\"Logging\");\r\n\t\tlogger.removeAllAppenders();\r\n\t\tLogger.getRootLogger().removeAllAppenders();\r\n\t\tFileAppender logAppender = null;\r\n\t\tLayout layout = new PatternLayout(\"%d [%M]: %m%n\");\r\n\t\ttry {\r\n\t\t\tlogAppender = new FileAppender(layout, path);\r\n\t\t} catch (IOException e) {\r\n\t\t\tSystem.err.println(\"Problems creating log file...\");\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\tlogger.addAppender(logAppender);\r\n\t\tConsoleAppender consoleAppender = new ConsoleAppender(layout);\r\n\t\tlogger.addAppender(consoleAppender);\r\n\t\tlogger.setLevel(DEBUG);\r\n\t\treturn logger;\r\n\t}", "void setupFileLogging();", "public Logger (){}", "public static Logger getLogger(String name) {\n\t\tif (name != null && name.length() > 0) {\n\t\t\tPropertyConfigurator.configure(\"log4j.properties\");\n\t\t\t// BasicConfigurator.configure();\n\t\t} else {\n\t\t\tBasicConfigurator.configure();\n\t\t}\n\n\t\t// get a logger instance named \"com.foo\"\n\t\t// Logger logger = Logger.getLogger(\"com.foo\");\n\t\t// ApacheLogTest.class.getResource(\"log4j.properties\");\n\t\tLogger logger = Logger.getLogger(name);\n\n\t\t// Now set its level. Normally you do not need to set the\n\t\t// level of a logger programmatically. This is usually done\n\t\t// in configuration files.\n\t\tlogger.setLevel(Level.ALL);\n\n\t\t// Logger barlogger = Logger.getLogger(\"com.foo.Bar\");\n\n\t\t// The logger instance barlogger, named \"com.foo.Bar\",\n\t\t// will inherit its level from the logger named\n\t\t// \"com.foo\" Thus, the following request is enabled\n\t\t// because INFO >= INFO.\n\t\t// barlogger.info(\"Located nearest gas station.\");\n\n\t\t// This request is disabled, because DEBUG < INFO.\n\t\t// barlogger.debug(\"Exiting gas station search\");\n\n\t\t// ///////////// Appenders ////////////////////////\n\n\t\t// Log4j allows logging requests to print to multiple destinations. In\n\t\t// log4j speak, an output destination is called an appender.\n\n\t\t// Currently, appenders exist for the console, files, GUI components,\n\t\t// remote socket servers, JMS, NT Event Loggers, and remote UNIX Syslog\n\t\t// daemons. It is also possible to log asynchronously.\n\n\t\t// ///////////// Layouts ////////////////////////\n\n\t\t// More often than not, users wish to customize not only the output\n\t\t// destination but also the output format. This is accomplished by\n\t\t// associating a layout with an appender. The layout is responsible for\n\t\t// formatting the logging request according to the user's wishes,\n\t\t// whereas an appender takes care of sending the formatted output to its\n\t\t// destination\n\t\treturn logger;\n\t}", "public LogStepMonitorHandler ()\r\n {\r\n setFilter(new LogLevelsFilter(Level.INFO));\r\n }", "@BeforeClass\npublic static void setLogger() {\n System.setProperty(\"log4j.configurationFile\",\"./src/test/resources/log4j2-testing.xml\");\n log = LogManager.getLogger(LocalArtistIndexTest.class);\n}", "public static void initLoad() throws Exception {\n\n String configPath = System.getProperty(\"config.dir\") + File.separatorChar + \"config.cfg\";\n System.out.println(System.getProperty(\"config.dir\"));\n \n Utils.LoadConfig(configPath); \n /*\n \n // log init load \n String dataPath = System.getProperty(\"logsDir\");\n if(!dataPath.endsWith(String.valueOf(File.separatorChar))){\n dataPath = dataPath + File.separatorChar;\n }\n String logDir = dataPath + \"logs\" + File.separatorChar;\n System.out.println(\"logdir:\" + logDir);\n System.setProperty(\"log.dir\", logDir);\n System.setProperty(\"log.info.file\", \"info_sync.log\");\n System.setProperty(\"log.debug.file\", \"error_sync.log\");\n PropertyConfigurator.configure(System.getProperty(\"config.dir\") + File.separatorChar + \"log4j.properties\");\n */\n }", "public void init(String pName) {\n logger = Logger.getLogger(pName);\n mConsoleHandler = new ConsoleHandler();\n mNameLogger = pName;\n File mLogDir = new File(\"./messagesLog\");\n if (!mLogDir.exists()) {\n mLogDir.mkdir();\n }\n LogManager.getLogManager().reset();\n }", "@Override\n public Level getLevel() {\n return privateConfig.loggerConfigLevel;\n }", "private static void setLoggingLevel(Level level) {\n ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME);\n root.setLevel(level);\n }", "private void setupLogging(BuildListener listener) {\n this.listener = listener;\n }", "@BeforeClass\n public static void beforeClass()\n throws Exception\n {\n LoggerConfiguration.logSetup();\n }", "public static void setLoggingLevel(Level newLevel)\n {\n ErrorLogger.setLevel(newLevel);\n }", "public void setLogLevel(int level) {\n logLevel = level;\n }", "private static DefaultLogger getConsoleLogger() {\n DefaultLogger consoleLogger = new DefaultLogger();\n consoleLogger.setErrorPrintStream(System.err);\n consoleLogger.setOutputPrintStream(System.out);\n consoleLogger.setMessageOutputLevel(Project.MSG_INFO);\n \n return consoleLogger;\n }", "private void loggerEinrichten() {\n\t\tlogger.setLevel(Level.INFO);\n//\t\tHandler handler = new FileHandler(\"/home/programmieren/TestFiles/iCalender/temp.log\");\n\t\tHandler handler = new ConsoleHandler();\n\t\thandler.setLevel(Level.FINEST);\n\t\thandler.setFormatter(new Formatter() {\n\t\t\t@Override\n\t\t\tpublic String format(LogRecord record) {\n\t\t\t\treturn record.getSourceClassName() + \".\" + record.getSourceMethodName() + \": \" + record.getMessage()\n\t\t\t\t\t\t+ \"\\n\";\n\t\t\t}\n\t\t});\n\t\tlogger.addHandler(handler);\n\t\tlogger.setUseParentHandlers(false);\n\t\tlogger.finest(\"begonnen\");\n\t}", "static void init(LoggerManager manager) {\n setLogDir(manager.getLogDirFullPath());\n setLogLevel(manager.getLevel());\n sLogcatEnabled = manager.enableLogcat();\n logGenerator = manager.logExecutor;\n\n if (logWriterThread != null) {\n logWriterThread.quit();\n }\n\n logWriterThread = new LogWriterThread(manager);\n logWriterThread.start();\n\n android.util.Log.i(TAG, \"initialized... level=\" + sLogLvlName + \",lvl=\"\n + sLogLvl + \",Logcat Enabled=\" + sLogcatEnabled + \",dir=\" + manager\n .getLogDirFullPath());\n }", "@Override\n public MultiInvokerConfigurationBuilder withLogLevel(LogLevel logLevel) {\n if (logLevel == null) {\n return this;\n }\n this.log = logFactory.create(logLevel);\n return this;\n }", "public static void configureLog(final String logfile) {\n\t\tLoggerContext context = (LoggerContext) LoggerFactory\n\t\t\t\t.getILoggerFactory();\n\n\t\ttry {\n\t\t\tJoranConfigurator configurator = new JoranConfigurator();\n\t\t\tconfigurator.setContext(context);\n\t\t\t// Call context.reset() to clear any previous configuration, e.g.\n\t\t\t// default\n\t\t\t// configuration. For multi-step configuration, omit calling\n\t\t\t// context.reset().\n\t\t\tcontext.reset();\n\t\t\tconfigurator.doConfigure(logfile);\n\t\t} catch (JoranException je) {\n\t\t\tStatusPrinter.printInCaseOfErrorsOrWarnings(context);\n\t\t}\n\t}", "private static void _logInfo ()\n {\n System.err.println (\"Logging is enabled using \" + log.getClass ().getName ());\n }", "public FileAppender()\n {\n //LogManager.getLogManager().reset();\n logger = Logger.getLogger(\"MyLog\");\n\n final Properties loggerProps = new Properties();\n try {\n loggerProps.load(FileAppender.class.getResourceAsStream(\"/logger.properties\"));\n final String filePath = loggerProps.getProperty(Utility.LOGGER_APPENDER_FILE_PATH);\n final FileHandler fh = new FileHandler(filePath);\n logger.addHandler(fh);\n } catch (final IOException e) {\n e.printStackTrace();\n }\n }", "private transactionLogging() throws IOException {\n\n // Initialise the logger\n logger = Logger.getLogger(transactionLogging.class.getName());\n logger.setLevel(Level.INFO);\n // Initialise the fileHandler\n fileHandler = new FileHandler(\"/Users/tomclay/IdeaProjects/Brunel_Sachs_International/log.txt\", true);\n // Initialise formatter, set formatting, and handler. Keep simple formatting\n plainText = new SimpleFormatter();\n fileHandler.setFormatter(plainText);\n logger.addHandler(fileHandler);\n }", "public static void initLogger(Logger l_) {\n l = l_;\n }", "@Override\n public void initializeLogging() {\n // Wraps Android's native log framework.\n LogWrapper logWrapper = new LogWrapper();\n // Using Log, front-end to the logging chain, emulates android.util.log method signatures.\n Log.setLogNode(logWrapper);\n\n // Filter strips out everything except the message text.\n MessageOnlyLogFilter msgFilter = new MessageOnlyLogFilter();\n logWrapper.setNext(msgFilter);\n\n // On screen logging via a fragment with a TextView.\n //LogFragment logFragment = (LogFragment) getSupportFragmentManager()\n // .findFragmentById(R.id.log_fragment);\n //msgFilter.setNext(logFragment.getLogView());\n\n mLogFragment = (LogFragment) getSupportFragmentManager()\n .findFragmentById(R.id.log_fragment);\n msgFilter.setNext(mLogFragment.getLogView());\n\n Log.i(TAG, \"Ready\");\n }", "private void internalInitializeLogger( final Logger logger ) {\n \n java.security.AccessController.doPrivileged(\n new java.security.PrivilegedAction<Object>() {\n public Object run() {\n // Explicitly remove all handlers.\n for (Handler h : logger.getHandlers()) {\n logger.removeHandler(h);\n }\n\n logger.setUseParentHandlers(false);\n for (Handler handler : handlers) {\n logger.addHandler(handler); \n }\n\n Level logLevel = getConfiguredLogLevel(logger.getName());\n if( logLevel != null ) {\n logger.setLevel( logLevel );\n }\n postInitializeLogger( logger );\n return null;\n }\n }\n );\n }", "public Logs() {\n initComponents();\n }", "public static final void onInit() {\r\n if (FORCE_APACHE_COMMONS_LOGGING_DIAGNOSTICS) {\r\n /**\r\n * The name (<code>org.apache.commons.logging.diagnostics.dest</code>) of the property used to\r\n * enable internal commons-logging diagnostic output, in order to get information on what\r\n * logging implementations are being discovered, what classloaders they are loaded through,\r\n * etc.\r\n * <p>\r\n * If a system property of this name is set then the value is assumed to be the name of a\r\n * file. The special strings STDOUT or STDERR (case-sensitive) indicate output to System out\r\n * and System err respectively.\r\n * <p>\r\n * Diagnostic logging should be used only to debug problematic configurations and should not\r\n * be set in normal production use.\r\n */\r\n System.setProperty(\"org.apache.commons.logging.diagnostics.dest\", \"STDOUT\");\r\n }\r\n }", "public void activateConsoleMode() {\n logger.addHandler(mConsoleHandler);\n }", "protected abstract Logger getLogger();", "protected ConsoleHandler() {\n super();\n setConsole(System.err);\n setFormatter(LOG_FORMATTER);\n setLevel(DEFAULT_LEVEL);\n }", "private ExtentLogger() {}", "public static void setJXTALogger(JXTA_LOG_LEVEL logLevel) {\n\t\tswitch (logLevel) {\n\t\tcase FINEST:\n\t\t\tremoveJavaStdLoggerHandlers();\n\t\t\tSystem.setProperty(\"net.jxta.logging.Logging\",\n\t\t\t\t\tJXTA_LOG_LEVEL.FINEST.name());\n\t\t\tSystem.setProperty(\"net.jxta.level\", JXTA_LOG_LEVEL.FINEST.name());\n\t\t\tbreak;\n\t\tcase FINER:\n\t\t\tremoveJavaStdLoggerHandlers();\n\t\t\tSystem.setProperty(\"net.jxta.logging.Logging\",\n\t\t\t\t\tJXTA_LOG_LEVEL.FINER.name());\n\t\t\tSystem.setProperty(\"net.jxta.level\", JXTA_LOG_LEVEL.FINER.name());\n\t\t\tbreak;\n\t\tcase FINE:\n\t\t\tremoveJavaStdLoggerHandlers();\n\t\t\tSystem.setProperty(\"net.jxta.logging.Logging\",\n\t\t\t\t\tJXTA_LOG_LEVEL.FINE.name());\n\t\t\tSystem.setProperty(\"net.jxta.level\", JXTA_LOG_LEVEL.FINE.name());\n\t\t\tbreak;\n\t\tcase INFO:\n\t\t\tremoveJavaStdLoggerHandlers();\n\t\t\tSystem.setProperty(\"net.jxta.logging.Logging\",\n\t\t\t\t\tJXTA_LOG_LEVEL.INFO.name());\n\t\t\tSystem.setProperty(\"net.jxta.level\", JXTA_LOG_LEVEL.INFO.name());\n\t\t\tbreak;\n\t\tcase WARNING:\n\t\t\tremoveJavaStdLoggerHandlers();\n\t\t\tSystem.setProperty(\"net.jxta.logging.Logging\",\n\t\t\t\t\tJXTA_LOG_LEVEL.WARNING.name());\n\t\t\tSystem.setProperty(\"net.jxta.level\", JXTA_LOG_LEVEL.WARNING.name());\n\t\t\tbreak;\n\t\tcase SEVERE:\n\t\t\tremoveJavaStdLoggerHandlers();\n\t\t\tSystem.setProperty(\"net.jxta.logging.Logging\",\n\t\t\t\t\tJXTA_LOG_LEVEL.SEVERE.name());\n\t\t\tSystem.setProperty(\"net.jxta.level\", JXTA_LOG_LEVEL.SEVERE.name());\n\t\t\tbreak;\n\t\tcase OFF:\n\t\t\tremoveJavaStdLoggerHandlers();\n\t\t\tSystem.setProperty(\"net.jxta.logging.Logging\",\n\t\t\t\t\tJXTA_LOG_LEVEL.OFF.name());\n\t\t\tSystem.setProperty(\"net.jxta.level\", JXTA_LOG_LEVEL.OFF.name());\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t}", "private void log4jConfig(String actionName) {\n\t\tString LOG4J_ROLLING_FILE_NAME_TOKEN = \"Launcher\";\n\t Logger rootLogger = LogManager.getRootLogger();\n\t RollingFileAppender fileAppender = (RollingFileAppender)rootLogger.getAppender(\"fileAppender\");\n\n\t // <param name=\"FileNamePattern\" value=\"/var/log/Launcher.log.%d{yyyy-MM-dd}.gz\"/>\n\t String currentLogFile = fileAppender.getFile();\n\t String newLogPattern = currentLogFile.replace(LOG4J_ROLLING_FILE_NAME_TOKEN, actionName);\n\t fileAppender.setFile(newLogPattern);\n\t \n\t fileAppender.activateOptions();\n\t}", "public void setLogLevel(String logLevel) {\n agentConfig.setLogLevel(logLevel);\n logConfigChanged();\n }", "@BeforeClass\n public static void setupClass() {\n build = System.getenv(\"BUILD\");\n \n File logFile = new File(LOG_FILE);\n if(!logFile.exists()) {\n System.out.println(\"Creating log file\");\n try {\n logFile.createNewFile();\n System.out.println(\"Created log file: \" + logFile.getPath());\n } catch (IOException e) {\n System.out.println(e.getMessage());\n //e.printStackTrace();\n }\n }\n \n try {\n FileHandler fileHandler = new FileHandler(logFile.getPath());\n fileHandler.setFormatter(new LogFormatter());\n LOGGER.addHandler(fileHandler);\n \n } catch (SecurityException e) {\n System.out.println(e.getMessage());\n //e.printStackTrace();\n } catch (IOException e) {\n System.out.println(e.getMessage());\n //e.printStackTrace();\n }\n \n LOGGER.setUseParentHandlers(false);\n \n }", "public Log(Logger logger) {\n this.logger = logger;\n }", "public void open() throws IOException {\n\t\tlogger.open();\n\t}", "@Before\n public void setUp() throws Exception {\n logger.setLevel(Level.DEBUG);\n }", "@Override\n\tpublic void onEnable() {\n\t\tMBEPlugin Mbes = (MBEPlugin) this.getPluginManager().getPlugin(\"MbEssentials\");\n\t\t\n\t\t//Get the LogManager from the plugin\n\t\tLogManager log = Mbes.getLogManager();\n\t\t\n\t\t//Make a logger. The string tells the logmanager where to create the log\n\t\tLogger myLog = new Logger(\"plugins\\\\\"); \n\t\t// You can do this Logger myLog = new Logger(new File(\"plugins\\\\mylog.txt\")); it will overide the default name \n\t\t\n\t\t//Attach logger to the logManager\n\t\tlog.attachLogger(myLog);\n\t\t\t\n\t\t\t//write to the log\n\t\t\tlog.writeLog(\"Im logging this\",myLog,false); //Its false so it can log it using the default formatting\n\t\t\t// You can also do this log.writeLog(\"Im logging this\",myLog.getId(),false);\n\t\t}", "protected void setUp() throws Exception {\r\n printStream = new PrintStream(new FileOutputStream(FILE));\r\n\r\n logFactory = new BasicLogFactory(printStream);\r\n\r\n log = (BasicLog) logFactory.createLog(NAME);\r\n }", "public static void initialize() {\n \tinitialize(new Configuration().configure());\n }", "abstract void initiateLog();", "@Test\n public void testCustomLoggingLevels() {\n LogTestLogger customLogger = new LogTestLogger();\n Database.log.setCustom(customLogger);\n\n for(int i = 5; i >= 1; i--) {\n customLogger.getLines().clear();\n customLogger.setLevel(LogLevel.values()[i]);\n Log.v(LogDomain.DATABASE, \"TEST VERBOSE\");\n Log.i(LogDomain.DATABASE, \"TEST INFO\");\n Log.w(LogDomain.DATABASE, \"TEST WARNING\");\n Log.e(LogDomain.DATABASE, \"TEST ERROR\");\n assertEquals(5 - i, customLogger.getLines().size());\n }\n }" ]
[ "0.6689497", "0.6681561", "0.66710705", "0.6651389", "0.6594059", "0.6572551", "0.65362304", "0.651357", "0.65063775", "0.65015465", "0.6493587", "0.63954234", "0.63636607", "0.6358183", "0.62839895", "0.6271482", "0.62675685", "0.626665", "0.6261692", "0.6198976", "0.6193958", "0.61685723", "0.6165542", "0.6135564", "0.612662", "0.61221963", "0.6099474", "0.6071093", "0.6048723", "0.5999579", "0.59806144", "0.5970951", "0.5955445", "0.5842869", "0.5779029", "0.5767964", "0.5631144", "0.56287706", "0.56224173", "0.56184703", "0.56136423", "0.55817664", "0.55783886", "0.55779433", "0.5575993", "0.5563495", "0.55624056", "0.55622864", "0.5552988", "0.5539786", "0.55258065", "0.5513816", "0.55043817", "0.5479141", "0.54787314", "0.5452178", "0.54461706", "0.54414445", "0.54326224", "0.5414608", "0.54090065", "0.53981566", "0.5397456", "0.5362681", "0.53569746", "0.53470975", "0.5345193", "0.53399223", "0.5324042", "0.53219485", "0.53217363", "0.5314793", "0.53137964", "0.53109694", "0.5291167", "0.52889556", "0.5276493", "0.526408", "0.5255457", "0.524004", "0.52106786", "0.52077025", "0.51799566", "0.5175774", "0.51718855", "0.51701635", "0.51306736", "0.51266444", "0.5121647", "0.51136935", "0.51092374", "0.5107644", "0.5093936", "0.5088942", "0.50738794", "0.50511855", "0.5045674", "0.5041777", "0.5038761", "0.50380933" ]
0.67737234
0
Method to get information if logger is initialized.
public static boolean loggerIsInitialized() { return loggerIsInitialized; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean logInfo()\r\n {\r\n return infoLevelHandler.getBoolean();\r\n }", "private static void _logInfo ()\n {\n System.err.println (\"Logging is enabled using \" + log.getClass ().getName ());\n }", "static public boolean isLogging()\n {\n return GetInstance().m_bLog;\n }", "void initializeLogging();", "public boolean isLogging();", "private void init() {\r\n this.log = this.getLog(LOGGER_MAIN);\r\n\r\n if (!(this.log instanceof org.apache.commons.logging.impl.Log4JLogger)) {\r\n throw new IllegalStateException(\r\n \"LogUtil : apache Log4J library or log4j.xml file are not present in classpath !\");\r\n }\r\n\r\n // TODO : check if logger has an appender (use parent hierarchy if needed)\r\n if (this.log.isWarnEnabled()) {\r\n this.log.warn(\"LogUtil : logging enabled now.\");\r\n }\r\n\r\n this.logBase = this.getLog(LOGGER_BASE);\r\n this.logDev = this.getLog(LOGGER_DEV);\r\n }", "public boolean isSetLogInfo() {\n return this.LogInfo != null;\n }", "public boolean isSetLogInfo() {\n return this.LogInfo != null;\n }", "public boolean isSetLogInfo() {\n return this.LogInfo != null;\n }", "public boolean isSetLogInfo() {\n return this.LogInfo != null;\n }", "@Override\n\tpublic void initLogger() {\n\t\t\n\t}", "private static void initLogger() {\n if (initialized) {\n return;\n }\n\n initialized = true;\n\n System.out.println(\"\");\n System.out.println(\"=> Begin System Logging Configuration\");\n URL fileUrl = null;\n String filePath = null;\n\n try {\n final Region region = EnvironmentConfiguration.getRegion();\n filePath = \"log4j-\" + region.getCode() + \".xml\";\n System.out.println(\"=> searching for log configuration file : \" + filePath);\n fileUrl = LogFactory.class.getResource(\"/\" + filePath);\n DOMConfigurator.configure(fileUrl);\n System.out.println(\"=> found log configuration file : \" + fileUrl);\n System.out.println(\"=> System Logging has been initialized\");\n }\n catch (final NoClassDefFoundError ncdf) {\n System.out.println(\"=> Logging Configuration Failed\");\n System.err.println(LogFactory.class.getName()\n + \"::loadProps() - Unable to find needed classes. Logging disabled. \" + ncdf);\n }\n catch (final Exception e) {\n System.out.println(\"=> Logging Configuration Failed\");\n System.err.println(\n LogFactory.class.getName() + \"::loadProps() - Unable to initialize logger from file=\"\n + filePath + \". Logging disabled.\");\n }\n System.out.println(\"=> End System Logging Configuration\");\n System.out.println(\"\");\n }", "public boolean isLogdateInitialized() {\n return logdate_is_initialized; \n }", "public boolean isInfoEnabled()\n/* */ {\n/* 274 */ return getLogger().isInfoEnabled();\n/* */ }", "public Logger getLogger() {\n\treturn _logger;\n }", "@Override\n\tprotected Logger getLogger() {\n\t\treturn HMetis.logger;\n\t}", "private Logger getLogger() {\n return LoggingUtils.getLogger();\n }", "protected void initLogger() {\n initLogger(\"DEBUG\");\n }", "public Logger getLogger(){\n\t\treturn logger;\n\t}", "public boolean isInfoLoggable() {\n return logger.isLoggable(Level.INFO);\n }", "ClassLoaderLogInfo getClassLoaderLogInfo();", "public Logger getLog () {\n return log;\n }", "public Logger getLogger() {\n return logger;\n }", "public Logger getLogger() {\n return logger;\n }", "private static Logger getLogger() {\n return LogDomains.getLogger(ClassLoaderUtil.class, LogDomains.UTIL_LOGGER);\n }", "public MCBLogger getLogger() {\n return logger;\n }", "public Logger getLogger()\n {\n return this.logger;\n }", "private Log getLog() {\n if (controller != null) {\n log = controller.getLog();\n } \n return log ;\n }", "public boolean hasLog() {\r\n\t\treturn hasLog;\r\n\t}", "public static Logger logger() {\n return logger;\n }", "private Logger getLogger() {\n return LoggerFactory.getLogger(ApplicationManager.class);\n }", "public BaseLogger getLogger() {\r\n\t\treturn logger;\r\n\t}", "public static Log getLogger() {\r\n Log l = null;\r\n if (isRunning()) {\r\n l = getInstance().getLog();\r\n }\r\n return l;\r\n }", "public String getLog();", "public Logger getLogger()\n\t{\n\t\treturn logger;\n\t}", "public final Logger getLogger() {\r\n return this.logger;\r\n }", "private void getloggersStatus() { \n\t\tAppClientFactory.getInjector().getSearchService().isClientSideLoggersEnabled(new SimpleAsyncCallback<String>() {\n\n\t\t\t@Override\n\t\t\tpublic void onSuccess(String result) {\n\t\t\t\tAppClientFactory.setClientLoggersEnabled(result);\n\t\t\t}\n\t\t\t\n\t\t});\n\t}", "public static String getLog() {\n\t\tif ((xml == null) || (log == null) || !log.equals(\"yes\")) return \"no\";\n\t\treturn \"yes\";\n\t}", "private void logDeviceInfo() {\n logDeviceLevel();\n }", "private void logDeviceInfo() {\n logDeviceLevel();\n }", "protected Log getLogger() {\n return LOGGER;\n }", "public Logger getLogger()\n/* */ {\n/* 77 */ if (this.logger == null) {\n/* 78 */ this.logger = Hierarchy.getDefaultHierarchy().getLoggerFor(this.name);\n/* */ }\n/* 80 */ return this.logger;\n/* */ }", "public static Logger getLogger()\n {\n if (logger == null)\n {\n Log.logger = LogManager.getLogger(BAG_DESC);\n }\n return logger;\n }", "public boolean logging() {\n\treturn logging;\n }", "private Log getLog(final String key) {\r\n Log l = this.logs.get(key);\r\n\r\n if (l == null) {\r\n l = LogFactory.getLog(key);\r\n\r\n if (l != null) {\r\n this.addLog(key, l);\r\n } else {\r\n throw new IllegalStateException(\"LogUtil : Log4J is not initialized correctly : missing logger [\" + key + \"] = check the log4j configuration file (log4j.xml) !\");\r\n }\r\n }\r\n\r\n return l;\r\n }", "protected static Logger log() {\n return LogSingleton.INSTANCE.value;\n }", "private static Log getLog() {\n if (log == null) {\n log = new SystemStreamLog();\n }\n\n return log;\n }", "public final Logger getLog() {\n return this.log;\n }", "public static boolean isInfoEnabled() {\n\n return debugLogger.isInfoEnabled();\n }", "@Override\n public MagicLogger getLogger() {\n return logger;\n }", "public boolean isInfoLoggingOn() {\n return verbose || !quiet;\n }", "public static final void onInit() {\r\n if (FORCE_APACHE_COMMONS_LOGGING_DIAGNOSTICS) {\r\n /**\r\n * The name (<code>org.apache.commons.logging.diagnostics.dest</code>) of the property used to\r\n * enable internal commons-logging diagnostic output, in order to get information on what\r\n * logging implementations are being discovered, what classloaders they are loaded through,\r\n * etc.\r\n * <p>\r\n * If a system property of this name is set then the value is assumed to be the name of a\r\n * file. The special strings STDOUT or STDERR (case-sensitive) indicate output to System out\r\n * and System err respectively.\r\n * <p>\r\n * Diagnostic logging should be used only to debug problematic configurations and should not\r\n * be set in normal production use.\r\n */\r\n System.setProperty(\"org.apache.commons.logging.diagnostics.dest\", \"STDOUT\");\r\n }\r\n }", "public static boolean isLogEnabled() {\n return mLogEnabled;\n }", "private boolean isLoggable() {\n return Log.isLoggable(tag, level);\n }", "private void initLoggers()\n {\n Logger.getSharedInstance();\n\n for (Logger logger : Logger.getAllLoggers())\n {\n String key = \"Loggers/\" + logger.getNamespace();\n Level desired;\n\n if (!SmartDashboard.containsKey(key))\n {\n // First time this logger has been sent to SmartDashboard\n SmartDashboard.putString(key, logger.getLogLevel().name());\n desired = Level.DEBUG;\n }\n else\n {\n String choice = SmartDashboard.getString(key, \"DEBUG\");\n Level parsed = Level.valueOf(choice);\n if (parsed == null)\n {\n m_logger.error(\"The choice '\" + choice + \"' for logger \" + logger.getNamespace() + \" isn't a valid value.\");\n desired = Level.DEBUG;\n }\n else\n {\n desired = parsed;\n }\n }\n logger.setLogLevel(desired);\n }\n }", "public static Logger getLogger() {\r\n\t\tif (log == null) {\r\n\t\t\tinitLogs();\r\n\t\t}\r\n\t\treturn log;\r\n\t}", "protected abstract Logger getLogger();", "private final Log getLog() {\r\n return this.log;\r\n }", "@Override\n protected Logger getLogger() {\n return LOGGER;\n }", "private synchronized ILogger getLogger()\n {\n if( _logger == null )\n _logger = ClearLogFactory.getLogger( ClearLogFactory.PERSIST_LOG,\n this.getClass() );\n return _logger;\n }", "public void testGetLogger(){\r\n assertNotNull(this.lm.getLogger(LoggerManagerTest.class.getPackage().getName()));\r\n }", "Appendable getLog();", "public static boolean isInfoEnabled1() {\n\n return debugLogger.isInfoEnabled();\n }", "public boolean isLoggingEnabledNow() {\n return this.decider.isLoggingEnabledNow();\n }", "public static Log getLoggerBase() {\r\n Log l = null;\r\n if (isRunning()) {\r\n l = getInstance().getLogBase();\r\n }\r\n return l;\r\n }", "public boolean getDataLogging () {\n return dataLogging;\n }", "private void init() {\n LoggerContext ctx = (LoggerContext) LogManager.getContext(false);\n Configuration config = ctx.getConfiguration();\n LoggerConfig loggerConfig = config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME);\n loggerConfig.setLevel(DEBUG ? Level.DEBUG : Level.INFO);\n ctx.updateLoggers();\n\n // Check if Maven repo exists\n File f = new File(globalConfig.getMavenRepoPath());\n if (!f.exists()) {\n // If not then create\n f.mkdir();\n }\n }", "public Logger getLogger() {\t\t\n\t\treturn logger = LoggerFactory.getLogger(getClazz());\n\t}", "public SegaLogger getLog(){\r\n\t\treturn log;\r\n\t}", "protected Logger getLogger() {\n return LoggerFactory.getLogger(getClass());\n }", "public static Boolean getShowlog()\n\t{\n\t\treturn showlog;\n\t}", "public Log getLog() {\r\n return this.delegate.getLog();\r\n }", "public StatusLogger getStatusLogger();", "protected abstract ILogger getLogger();", "public Boolean getLogged() {\n\t\treturn logged.get();\n\t}", "public static Logger get() {\n\t\treturn LoggerFactory.getLogger(WALKER.getCallerClass());\n\t}", "protected Logger getLogger() {\n return (logger);\n }", "String getLogHandled();", "public boolean isLoggable() {\r\n\t\tif (logger == null) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn logger.isLoggable(level)\r\n\t\t\t\t|| PerformanceLogger.isEnabled();\r\n\t}", "private void initLogger() {\n\t\ttry {\n\t\t\tjava.util.logging.Logger rootLogger = java.util.logging.Logger.getLogger(\"\");\n\t\t\trootLogger.setUseParentHandlers(false);\n\t\t\tHandler csvFileHandler = new FileHandler(\"logger/log.csv\", 100000, 1, true);\n\t\t\tlogformater = new LogFormatter();\n\t\t\trootLogger.addHandler(csvFileHandler);\n\t\t\tcsvFileHandler.setFormatter(logformater);\n\t\t\tlogger.setLevel(Level.ALL);\n\t\t} catch (IOException ie) {\n\t\t\tSystem.out.println(\"Logger initialization failed\");\n\t\t\tie.printStackTrace();\n\t\t}\n\t}", "protected Logger getLogger() {\n if (logger == null) {\n logger = Logger.getLogger(getClass().getName());\n }\n return logger;\n }", "public String getLogDetails() {\r\n return logDetails;\r\n }", "public RevisorLogger getLogger();", "public boolean isLog4JAvailable() {\n return isLogLibraryAvailable(\"Log4J\", LOGGING_IMPL_LOG4J_LOGGER);\n }", "private static Logger getLogger() {\n if (logger == null) {\n try {\n new transactionLogging();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return logger;\n }", "public boolean isLog()\n\t{\n\t\treturn log;\n\t}", "public static Log getLoggerDev() {\r\n Log l = null;\r\n if (isRunning()) {\r\n l = getInstance().getLogDev();\r\n }\r\n return l;\r\n }", "public static synchronized void initializeLogger() {\n\t\t\n\t try {\n\t\t String workingDir = System.getProperty(\"user.dir\");\n\t\t String fileName = workingDir + File.separator + \"config\" + File.separator + \"logging.properties\";\n\t\t \n\t\t FileInputStream fileInputStream = new FileInputStream(fileName);\n\t\t LogManager.getLogManager().readConfiguration(fileInputStream);\n\t\t \n\t } catch (IOException ex) {\n\t\t System.err.println(\"Failed to load logging.properlies, please check the file and the path:\" + ex.getMessage()); \n\t ex.printStackTrace();\n\t System.exit(0);\n\t }\n\t}", "private void initCemsLogger() {\n if (logger == null) {\n final SimpleDateFormat dateFormat = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\");\n\n final Formatter formatter = new Formatter() {\n @Override\n public String format(LogRecord record) {\n final StringBuilder sb = new StringBuilder();\n sb.append(dateFormat.format(new Date(record.getMillis())));\n sb.append(\" - \");\n sb.append(record.getLevel().getName());\n sb.append(\": \");\n sb.append(record.getMessage());\n sb.append(\"\\n\");\n @SuppressWarnings(\"ThrowableResultOfMethodCallIgnored\")\n final Throwable thrown = record.getThrown();\n if (thrown != null) {\n sb.append(thrown.toString());\n sb.append(\"\\n\");\n }\n return sb.toString();\n }\n };\n\n final ConsoleHandler handler = new ConsoleHandler();\n handler.setFormatter(formatter);\n handler.setLevel(Level.ALL);\n\n logger = Logger.getLogger(\"ga.cems\");\n final Handler[] handlers = logger.getHandlers();\n for (Handler h : handlers) {\n logger.removeHandler(h);\n }\n\n logger.setUseParentHandlers(false);\n logger.addHandler(handler);\n }\n// logger.setLevel(Level.INFO);\n logger.setLevel(logLevel);\n }", "abstract void initiateLog();", "public String getLogDetails() {\n return logDetails;\n }", "@Override\n public void initializeLogging() {\n // Wraps Android's native log framework.\n LogWrapper logWrapper = new LogWrapper();\n // Using Log, front-end to the logging chain, emulates android.util.log method signatures.\n Log.setLogNode(logWrapper);\n\n // Filter strips out everything except the message text.\n MessageOnlyLogFilter msgFilter = new MessageOnlyLogFilter();\n logWrapper.setNext(msgFilter);\n\n // On screen logging via a fragment with a TextView.\n //LogFragment logFragment = (LogFragment) getSupportFragmentManager()\n // .findFragmentById(R.id.log_fragment);\n //msgFilter.setNext(logFragment.getLogView());\n\n mLogFragment = (LogFragment) getSupportFragmentManager()\n .findFragmentById(R.id.log_fragment);\n msgFilter.setNext(mLogFragment.getLogView());\n\n Log.i(TAG, \"Ready\");\n }", "public String getLoggerName()\n\t{\n\t\treturn this.loggerName;\n\t}", "abstract public LoggingService getLoggingService();", "public boolean isShowLogging() {\n return showLogging;\n }", "private void initLogger(BundleContext bc) {\n\t\tBasicConfigurator.configure();\r\n\t\tlogger = Logger.getLogger(Activator.class);\r\n\t\tLogger.getLogger(\"org.directwebremoting\").setLevel(Level.WARN);\r\n\t}", "public Logger log() {\n return LOG;\n }", "public boolean isSetLoggers() {\n return this.loggers != null;\n }", "public LogService getLog() {\n\treturn log;\n }", "public Logger getPhotoLogger(){\r\n\treturn logger;\r\n\t}" ]
[ "0.6664043", "0.64602417", "0.6438265", "0.63996834", "0.6359927", "0.6357873", "0.6329416", "0.6329416", "0.6329416", "0.6329416", "0.63289094", "0.621924", "0.6195906", "0.61644983", "0.61326087", "0.6132392", "0.6116723", "0.611672", "0.609686", "0.6092904", "0.6061661", "0.60468394", "0.6032121", "0.6028572", "0.6009507", "0.59977114", "0.59960556", "0.599471", "0.59941006", "0.5979045", "0.5944038", "0.59416693", "0.5935107", "0.59091204", "0.59022444", "0.58942294", "0.5893679", "0.58935827", "0.5885495", "0.5885495", "0.5883066", "0.5863221", "0.5848095", "0.58377516", "0.5825209", "0.58109736", "0.58087933", "0.57999885", "0.57914793", "0.5783776", "0.5781528", "0.57762975", "0.57743865", "0.576945", "0.5748343", "0.5746831", "0.57373005", "0.5727134", "0.57196534", "0.571881", "0.57161987", "0.57146317", "0.57001", "0.5699271", "0.56914514", "0.56843966", "0.5680416", "0.5680204", "0.5674818", "0.56732875", "0.5664915", "0.56634504", "0.56598663", "0.5657228", "0.56483155", "0.5644934", "0.5644352", "0.5636804", "0.5636384", "0.5631467", "0.5630611", "0.56258786", "0.56240577", "0.5600036", "0.5597272", "0.5586822", "0.5586141", "0.558535", "0.557904", "0.5574472", "0.5569223", "0.5567161", "0.55589", "0.55588204", "0.5552274", "0.55421734", "0.553457", "0.55339277", "0.5526989", "0.5511853" ]
0.7144459
0
Method to choose the articles should be saving in the bag according the business rules.
public String chooseArticlesPackage(Bag bag) { StringBuilder result = new StringBuilder(); double countWeightBag=0; if(bag.getArticles() != null) { bag.setArticles(orderArticles(bag.getArticles())); int position=0; int countArticles = 0; while(countWeightBag<bag.getCapacity() && countWeightBag < Constants.MAXIMUN_WEIGHT_BAG && position < bag.getArticles().size()) { Article thing = bag.getArticles().get(position); if(countWeightBag + thing.getWeight() <= bag.getCapacity() && countArticles <= Constants.AMOUNT_MAXIMUN_ARTICLES_PER_BAG) { result.append(thing.getIndex()).append(Constants.COMMA); countWeightBag+=thing.getWeight(); countArticles++; } position++; } } if(countWeightBag == 0) { result.append(Constants.LINE); } return result.toString(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void saveArticlesList();", "public Article save(Article article);", "private boolean saveData() {\n // get data from input controls\n collectDataFromUI();\n\n if (!validateData()) return false;\n\n boolean isTransfer = mCommon.transactionEntity.getTransactionType().equals(TransactionTypes.Transfer);\n if (!isTransfer) {\n mCommon.resetTransfer();\n }\n\n // Transaction. Need the id for split categories.\n\n if (!saveTransaction()) return false;\n\n // Split Categories\n\n if (mCommon.convertOneSplitIntoRegularTransaction()) {\n saveTransaction();\n }\n\n if(!mCommon.isSplitSelected()) {\n // Delete any split categories if split is unchecked.\n mCommon.removeAllSplitCategories();\n }\n if (!saveSplitCategories()) return false;\n\n return true;\n }", "@Override\r\n\tpublic TraitSalaire save(@Context HttpHeaders headers , TraitSalaire entity) {\n\t\t processBeforeSave(entity);\r\n\t\t // controle si préparation \r\n\t\t RestrictionsContainer container = RestrictionsContainer.newInstance();\r\n\t\t container.addEq(\"periode.id\", entity.getPeriode().getId());\r\n\t\t List<BulletinPaie> datas = managerbul.filter(container.getPredicats(), null, new HashSet<String>(), 0, -1);\r\n\t\t if(datas==null||datas.isEmpty()||datas.size()==0){\r\n\t\t\t throw new KerenExecption(\"OPERATION IMPOSSIBLE ::Bien vouloir effectu&eacute; la pr&eacute;paration de la paie de cette p&eacute;riode !!\");\r\n\t\t }\r\n\t\t managerbul.validerSalaire(entity);\r\n\t\tCacheMemory.insert(BuilderHttpHeaders.getidUsers(headers), TypeCacheMemory.PERIODE, entity.getPeriode());\r\n\t\tprocessAfterSave(entity);\r\n\t\treturn entity;\r\n\t}", "@Override\n public void save(Iterable<? extends SideDishEntity> entities) {\n\n }", "@Test\n public void modifierArticleKO(){\n String nomArticle = \"short\";\n Article articleBD = daoArticle.findByNom(nomArticle); //peut renvoyer null si l'article \"Chaussons\" n'existe pas en BD \n \n Double prixHT = 6.55;\n Integer delaisAppros = 4;\n Integer delaisDeLivraisonArt =6; \n Integer quantiteStock = 25;\n Article articleAvecModifications = new Article(nomArticle, prixHT, delaisAppros, delaisDeLivraisonArt, quantiteStock); //attributs d'instance ayant @Column(nullable = false)\n articleAvecModifications.setDescription(\"très bonne qualitée\");\n articleS.modifierArticle(articleBD, articleAvecModifications);\n \n if(articleBD == null){\n System.out.println();System.out.println();System.out.println();System.out.println(\"=============================================================\");\n System.out.println(\"ARTICLE \" + nomArticle + \" N'EXISTE PAS EN BD : \" + articleBD);\n System.out.println();System.out.println();System.out.println();System.out.println(\"=============================================================\"); \n }\n }", "@Override\r\n\tpublic <S extends Candidat> Iterable<S> save(Iterable<S> entities) {\n\t\treturn null;\r\n\t}", "public int enregistrerArticleService (Articles article);", "public void saveBorrowings() {\n\t}", "public abstract boolean testArticle(PubmedArticle article);", "protected abstract void doSave();", "public static void addArticle() {\n double summe = 0.0;\n if (!payProcessStarted) {\n int[] indexes = taArtikel.getSelectedRows();\n for (int index : indexes) {\n GUIOperations.getRecorderXml().setIsPayment(true);\n //Artikel, der eingefügt wird\n Article tmp = atm.getFilteredArtikels().get(index);\n double price = 0.0;\n if (tmp.getPreis() == 0.0) {\n try {\n int help = Integer.parseInt(\n JOptionPane.showInputDialog(mainframe.getParent(),\n \"Bitte geben Sie den Preis für das Produkt \" + tmp.getArticleName() + \" ein (in Cent)\"));\n price = help / 100.0;\n } catch (NumberFormatException ex) {\n JOptionPane.showMessageDialog(mainframe.getParent(), \"Artikel konnte nicht eingefügt werden, \"\n + \"da keine valide Zahl eingegeben worden ist\");\n continue;\n }\n } else {\n price = tmp.getPreis();\n }\n if (recorderXml.getBonStornoType() != -1) {\n WarenruecknahmePreisDlg wpdlg = new WarenruecknahmePreisDlg(mainframe, true, tmp.getPreis());\n wpdlg.setVisible(true);\n price = wpdlg.getPreis();\n price *= -1;\n }\n\n if (tmp.getCategory().equalsIgnoreCase(\"Preis EAN\")) {\n price = -1;\n do {\n try {\n price = Integer.parseInt(JOptionPane.showInputDialog(mainframe, \"Geben Sie den Preis für diesen Artikel mit Preis EAN ein\"));\n } catch (NumberFormatException ex) {\n int cancel = JOptionPane.showConfirmDialog(mainframe, \"Es wurde keine gültige Zahl eingeben! Wollen Sie den Kassiervorgang dieses Artikels abbrechen?\");\n if (cancel == 0) {\n return;\n }\n }\n } while (price == -1);\n price = price / 100;\n }\n\n int amount = -1;\n if (tmp.getCategory().equalsIgnoreCase(\"Gewichts EAN\")) {\n do {\n try {\n amount = Integer.parseInt(JOptionPane.showInputDialog(mainframe, \"Geben Sie die Menge für diesen Artikel mit Gewichts EAN ein (in Gramm)\"));\n } catch (NumberFormatException ex) {\n int cancel = JOptionPane.showConfirmDialog(mainframe, \"Es wurde keine gültige Zahl eingeben! Wollen Sie den Kassiervorgang dieses Artikels abbrechen?\");\n if (cancel == 0) {\n return;\n }\n }\n } while (amount == -1);\n }\n\n Article art = new Article(tmp.getXmlArticleName(), tmp.isLeergut(),\n tmp.isJugendSchutz(), tmp.getEan(), tmp.getArticleName(),\n tmp.isPfand(), tmp.getPfandArtikel(), price, tmp.isRabatt(), tmp.getUst(),\n tmp.isWeight(), tmp.getCategory(), tmp.isEloading(), tmp.isSerialNrRequired());\n art.setIsAbfrage(tmp.isIsAbfrage());\n if (amount != -1) {\n art.setGewichts_ean_menge(amount);\n }\n JugendschutzDlg jdlg = null;\n if (tmp.isJugendSchutz() && !tmp.isIsAbfrage()) {\n jdlg = new JugendschutzDlg(mainframe, true);\n jdlg.setVisible(true);\n if (jdlg.isOk()) {\n art.setJugendSchutzOk(true);\n }\n }\n if (tmp.isEloading()) {\n if (dlm.getAmount() <= 1) {\n if (tmp.isJugendSchutz() && !tmp.isIsAbfrage()) {\n if (jdlg.isOk()) {\n String status = null;\n do {\n ELoadingDlg edlg = new ELoadingDlg(mainframe, true);\n edlg.setVisible(true);\n status = edlg.getStatus();\n } while (status == null);\n art.setEloadingState(status);\n if (status.equalsIgnoreCase(\"server_offline\") || status.equalsIgnoreCase(\"aufladung_nok\")) {\n art.setPriceZero(true);\n }\n }\n } else {\n String status = null;\n if (!tmp.isIsAbfrage()) {\n do {\n ELoadingDlg edlg = new ELoadingDlg(mainframe, true);\n edlg.setVisible(true);\n status = edlg.getStatus();\n\n } while (status == null);\n art.setEloadingState(status);\n if (status.equalsIgnoreCase(\"server_offline\") || status.equalsIgnoreCase(\"aufladung_nok\")) {\n art.setPriceZero(true);\n }\n }\n }\n } else {\n JOptionPane.showMessageDialog(mainframe, \"E-Loading Artikel können nicht mit einer Menge > 1 eingefügt werden\");\n art.setEloadingAmmountOk(false);\n }\n }\n\n int weight = -1;\n Path weight_path = null;\n if (tmp.isWeight() && !tmp.isIsAbfrage()) {\n int result = JOptionPane.showConfirmDialog(mainframe, \"Es wurde ein Gewichtsartikel ausgewählt. Wollen sie diesen \"\n + \"Artikel mithilfe einer Tastatureingabe abwiegen?\");\n if (result == 0) {\n do {\n try {\n weight = Integer.parseInt(JOptionPane.showInputDialog(mainframe, \"Geben Sie bitte das Gewicht für den Artikel ein\"));\n } catch (NumberFormatException ex) {\n int cancel = JOptionPane.showConfirmDialog(mainframe, \"Es wurde keine gültige Zahl eingeben! Wollen Sie den Kassiervorgang dieses Artikels abbrechen?\");\n if (cancel == 0) {\n return;\n }\n }\n } while (weight == -1);\n } else {\n JFileChooser fc = new JFileChooser(System.getProperty(\"user.home\") + File.separator + \"Documents\");\n FileNameExtensionFilter filter = new FileNameExtensionFilter(\"txt-Dateien\", \"txt\");\n fc.setFileFilter(filter);\n if (fc.showOpenDialog(mainframe) == JFileChooser.APPROVE_OPTION) {\n weight_path = fc.getSelectedFile().toPath();\n } else {\n JOptionPane.showMessageDialog(mainframe, \"Es wurde keine Datei ausgewählt! Der Kassiervorgang dieses Artikels wird abgebrochen\");\n return;\n }\n }\n }\n\n if (tmp.isSerialNrRequired() && !tmp.isIsAbfrage()) {\n //Seriennummer einlesen\n if ((tmp.isJugendSchutzOk() && tmp.isJugendSchutz()) || !tmp.isJugendSchutz()) {\n String serNr;\n do {\n serNr = JOptionPane.showInputDialog(null,\n \"Bitte geben Sie eine Seriennummer ein:\");\n } while (serNr == null || serNr.equals(\"\") || !serNr.matches(\"[0-9]+\"));\n art.setSerialNr(serNr);\n }\n }\n if (tmp.isWeight()) {\n if (weight == -1) {\n art.setWeigthArticles(weight_path);\n } else {\n art.setWeigthArticles(weight);\n }\n }\n int tmp_pfand_amount = -1;\n if (tmp.isPfand()) {\n tmp_pfand_amount = dlm.getAmount();\n }\n dlm.addArtikel(art);\n if (tmp.isPfand() && (art.isJugendSchutzOk() || !tmp.isJugendSchutz())) {\n for (Article arti : atm.getAllArtikels()) {\n if (arti.getXmlArticleName().equals(art.getPfandArtikel())) {\n Article newA = new Article(arti.getXmlArticleName(), arti.isLeergut(), arti.isJugendSchutz(), arti.getEan(), arti.getArticleName(), arti.isPfand(), arti.getPfandArtikel(), arti.getPreis(), arti.isRabatt(), arti.getUst(), arti.isWeight(), arti.getCategory(), arti.isEloading());\n dlm.setAmount(tmp_pfand_amount);\n newA.setInXml(false);\n dlm.addArtikel(newA);\n tmp_pfand_amount = -1;\n }\n }\n }\n JButton btBonSt = paArticle.getBtBonstorno();\n if (btBonSt.isEnabled()) {\n btBonSt.setEnabled(false);\n }\n\n JButton btWrue = paArticle.getBtWRUE();\n if (btWrue.isEnabled()) {\n btWrue.setEnabled(false);\n }\n }\n\n setPrice();\n setBonStarted(true);\n tfDigitField.setText(\"\");\n money = 0;\n }\n }", "private void isCanSave() {\r\n\t\tsalvar.setEnabled(!hasErroNome(nome.getText()) && !hasErroIdade(idade.getText()) && validaSituacao());\r\n\t}", "int insertSelective(ArticleDo record);", "protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n RequestDispatcher dispatcher = request.getRequestDispatcher(\"article/create/success.jsp\");\n\n Article article = new Article();\n Shelf shelf = new Shelf();\n List<Shelf> shelfs = new ArrayList<>();\n Context context = null;\n ArticleServiceItf articleServices = null;\n ShelfServiceItf shelfService = null;\n\n try {\n context = new InitialContext();\n shelfService = (ShelfServiceItf) context.lookup(\"java:global/ShelfService\");\n shelf = shelfService.findShelfById(Integer.valueOf(request.getParameter(\"productShelf\")));\n shelfs = shelfService.findAll();\n\n article.setName(request.getParameter(\"productName\"));\n article.setPicturelink(request.getParameter(\"productImage\"));\n article.setBrand(request.getParameter(\"productBrand\"));\n article.setPrix(Float.valueOf(request.getParameter(\"productPrice\")));\n article.setShelf(shelf);\n System.out.println(\"DEBUG productBrand set to: \" + request.getParameter(\"productBrand\"));\n articleServices = (ArticleServiceItf) context.lookup(\"java:global/ArticleService\");\n } catch (Exception e) {\n dispatcher = request.getRequestDispatcher(\"article/create/error.jsp\");\n request.setAttribute(\"error\", e);\n dispatcher.forward(request, response);\n }\n\n //On utilise un Validator afin de vérifier que notre objet Article est en phase avec les contraintes\n ValidatorFactory factory = Validation.buildDefaultValidatorFactory();\n Validator validator = factory.getValidator();\n Set<ConstraintViolation<Article>> constraintViolationSet = validator.validate(article);\n\n if(constraintViolationSet.isEmpty()) {\n //Pas d'erreurs après vérification, on peut persister l'objet\n try {\n articleServices.addArticle(article);\n dispatcher.forward(request, response);\n } catch (ArticleException e) {\n dispatcher = request.getRequestDispatcher(\"article/create/error.jsp\");\n request.setAttribute(\"error\", e);\n dispatcher.forward(request, response);\n }\n }\n else {\n //Une ou plusieurs erreurs pendant la vérification. On informe l'utilisateur\n dispatcher = request.getRequestDispatcher(\"admin/create-article.jsp\");\n request.setAttribute(\"errors\", constraintViolationSet);\n request.setAttribute(\"shelfs\", shelfs);\n dispatcher.forward(request, response);\n }\n }", "@Override\n protected void validateSave(Fornecedor post) {\n\n }", "void accept(Article article);", "@Exclude\n public abstract void save();", "@Override\n\tpublic void posSave() {\n\t\tfor(ItemRequisicionEta tmpItm : itemsAgregados) {\n\t\t\ttmpItm.setReqEtapa(instance);\n\t\t\tgetEntityManager().persist(tmpItm);\n\t\t}\n\t\tgetEntityManager().refresh(etapaRepCliHome.getInstance());\n\t}", "Long save(ArticleForm articleForm) throws ServiceException;", "Collection<E> save(Iterable<E> entities);", "Article saveArticleFromForm(ArticleForm form) throws ServiceException;", "public void saveAlgorithm(){\r\n \tthis.getLog().info(\" saveAlgorithm()\");\r\n \tif(selectedAlgorithmID>=0){\r\n \t\t// edited existing algorithm\r\n \t\talgorithmList.updateAlgorithmToDB(selectedAlgorithm);\r\n \t}else{\r\n \t\t// new algorithm\r\n \t}\r\n \tinitAlgorithmList(selectedAlgorithmID);\r\n }", "private void chooseAddItemsToJcb() {\n if (animalFamilyType.contains(\"Terr\")) {\n addItemJcb(terAnimals);\n } else if (animalFamilyType.contains(\"Air\")) {\n addItemJcb(airAnimals);\n } else if (animalFamilyType.contains(\"Water\")) {\n addItemJcb(waterAnimals);\n }\n }", "private void saveNewCatalog() {\n\n\t}", "@Override\n\tpublic void save(EmpType entity) {\n\t\t\n\t}", "public static boolean addArticle(final ArticleBean newArt) {\n try {\n Session session = driver.session();\n return session.writeTransaction(new TransactionWork<Boolean>() {\n @Override\n public Boolean execute(Transaction tx) {\n return transactionAddArticle(tx, newArt);\n }\n });\n\n\n }\n catch (Exception ex)\n {\n System.err.println(ex.getMessage());\n return false;\n }\n }", "protected void prepareSave() {\r\n EObject cur;\r\n for (Iterator<EObject> iter = getAllContents(); iter.hasNext();) {\r\n cur = iter.next();\r\n \r\n EStructuralFeature idAttr = cur.eClass().getEIDAttribute();\r\n if (idAttr != null && !cur.eIsSet(idAttr)) {\r\n cur.eSet(idAttr, EcoreUtil.generateUUID());\r\n }\r\n }\r\n }", "@Override\r\n\tpublic void save(PartyType entity) {\n\t\t\r\n\t}", "public void saveExisting() {\r\n Part modifiedPart = null;\r\n for (Part part : Inventory.getAllParts()) {\r\n if (Integer.parseInt(iDfield.getText()) == part.getId()) {\r\n modifiedPart = part;\r\n }\r\n }\r\n if (modifiedPart instanceof Outsourced && inHouseSelected) {\r\n replacePart(modifiedPart);\r\n\r\n } else if (modifiedPart instanceof InHouse && !inHouseSelected) {\r\n replacePart(modifiedPart);\r\n } else {\r\n modifiedPart.setName(nameField.getText());\r\n modifiedPart.setStock(Integer.parseInt(invField.getText()));\r\n modifiedPart.setPrice(Double.parseDouble(priceField.getText()));\r\n modifiedPart.setMax(Integer.parseInt(maxField.getText()));\r\n modifiedPart.setMin(Integer.parseInt(minField.getText()));\r\n if (inHouseSelected) {\r\n ((InHouse) modifiedPart).setMachineId(Integer.parseInt(machineOrCompanyField.getText()));\r\n } else {\r\n ((Outsourced) modifiedPart).setCompanyName(machineOrCompanyField.getText());\r\n }\r\n\r\n Inventory.updatePart(Inventory.getAllParts().indexOf(modifiedPart), modifiedPart);\r\n }\r\n\r\n }", "@Given(\"an Article exists under the Section\")\r\n\tpublic void createArticle(){\n\t\ttestArticle = new ArticleModel();\r\n\t\ttestArticle.setId(\"3236549\");\r\n\t\ttestArticle.setDefaultValues(baseFeedDomain);\r\n\t\ttestArticle.setTitle(\"automation 3 article title\");\r\n\t\ttestArticle.setState(\"published\");\r\n\t\ttestArticle.setParentName(\"automation3published\");\r\n\t\ttestArticle.setAuthorFirstName(\"tto\");\r\n\t\ttestArticle.setAuthorLastName(\"Administrator\");\r\n\t\t\t\r\n\t\ttestArticle.setStandFirst(\"automation 3 article standfirst\");\r\n\t\ttestArticle.setSectionNameOverride(\"automation 3 article section name override\");\r\n\t\ttestArticle.setTitleprefix(\"automation 3 article times sport title prefix\");\r\n\t\ttestArticle.setHeadlineTitleOverride(\"automation 3 article headline changed\");\r\n\t\ttestArticle.setArticleStandFirstOverride(\"automation 3 article standfirst changed\");\r\n\t\ttestArticle.setArticleBodyOverride(\"automation 3 article body - changed \");\r\n\t\t\r\n\t\ttestArticle.setFeedLink(baseFeedDomain + \"article/\" + 3236549);\r\n\t\ttestArticle.setArticleBodyOverride(\"<p>\\nautomation 3 article body - changed \\n</p>\\n\");\r\n\t\ttestArticle.setBody(\"<p>\\nautomation 3 article body\\n</p>\\n\");\r\n\t\ttestArticle.setCategory(\"article\");\r\n\t\ttestArticle.setAuthorFirstName(\"tto\");\r\n\t\ttestArticle.setAuthorLastName(\"Administrator\");\r\n\t\ttestArticle.setAuthorId(\"2\");\r\n\t\ttestArticle.setFeedLink(baseFeedDomain + \"article/3236549\");\r\n\t\ttestArticle.setHeadline(\"automation 3 article headline\");\r\n\t\ttestArticle.setAuthorUri(baseFeedDomain + \"author/\" + testArticle.getAuthorId());\r\n\t\t\r\n\t\t//TODO re-implement this once cms asset creation/teardown is available\r\n//\t\tString articleId = cmsHelper.createArticle(testArticle);\r\n//\t\ttestArticle.setArticleId(articleId);\r\n\t\t\t\t\r\n\t}", "protected boolean save() {\n\t\t// if modified... then do save\n\t\tif (stateProperty().getValue().contains(State.Modified) || \n\t\t\t\t// or if loaded from a dataset but was set inactive afterwards\n\t\t\t\t(stateProperty().getValue().contains(State.Dataset) && !activeProperty().getValue())) {\n\t\t\t// Save all the independent children first\n\t\t\tif (children != null) {\n\t\t\t\tfor (BusinessObject child : children.values()) {\n\t\t\t\t\t// Attributes should be managed by the owner, and shouldn't need to manage themselves\n\t\t\t\t\tif(!(child.isAttribute()) &&\n\t\t\t\t\t\t\t// either independent and active, or dependent and inactive\n\t\t\t\t\t\t\tchild.independentProperty().getValue() == isActive()) {\n\t\t\t\t\t\tchild.save();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// We want to call doSave if the value is active, otherwise doDelete should be called\n\t\t\tif (activeProperty().getValue()) {\n\t\t\t\tdoSave();\n\t\t\t} else {\n\t\t\t\tdoDelete();\n\t\t\t}\n\t\t\t\n\t\t\t// Save all the dependent children after this object has been saved\n\t\t\tif (children != null) {\n\t\t\t\tfor (BusinessObject child: children.values()) {\n\t\t\t\t\t// Attributes should be managed by the owner, and shouldn't need to manage themselves\n\t\t\t\t\tif (!(child.isAttribute()) &&\n\t\t\t\t\t\t\t// either independent and inactive, or dependent and active\n\t\t\t\t\t\t\tchild.independentProperty().getValue() != isActive()) {\n\t\t\t\t\t\tchild.save();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Should be safe to assume the following state after successful saving\n\t\t\tstateProperty().getValue().remove(State.Modified);\n\t\t\tif (isActive()) {\n\t\t\t\tstateProperty().getValue().add(State.Dataset);\n\t\t\t} else {\n\t\t\t\tstateProperty().getValue().remove(State.Dataset);\n\t\t\t}\n\t\t\t// Let listeners know about the save\n\t\t\tfireModified(new ModifiedEvent(this, ModifiedEventType.Save));\t\t\t\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "Article createArticle();", "private boolean saveSale()\n {\n boolean notEmpty = false;\n //Add SaleItems to sale\n for(int i = 0; i < saleItems.size(); i++)\n {\n if(saleItems.get(i) != null && saleItems.get(i).getQuantity() > 0)\n {\n newSale.addSaleItem(saleItems.get(i));\n notEmpty = true;\n }\n }\n if(notEmpty)\n {\n //Update InventorySingleton\n updateInventory(newSale);\n //Add sale to database\n db.collection(\"sales\").add(newSale);\n //Add to sale singleton\n SaleSingleton.get(this).addSale(newSale);\n }\n return notEmpty;\n }", "public static void addArticle(Article article) {\n double summe = 0.0;\n if (!payProcessStarted) {\n// int[] indexes = taArtikel.getSelectedRows();\n// for (int index : indexes) {\n GUIOperations.getRecorderXml().setIsPayment(true);\n //Artikel, der eingefügt wird\n Article tmp = article;\n double price = 0.0;\n if (tmp.getPreis() == 0.0) {\n try {\n int help = Integer.parseInt(\n JOptionPane.showInputDialog(mainframe.getParent(),\n \"Bitte geben Sie den Preis für das Produkt \" + tmp.getArticleName() + \" ein (in Cent)\"));\n price = help / 100.0;\n } catch (NumberFormatException ex) {\n JOptionPane.showMessageDialog(mainframe.getParent(), \"Artikel konnte nicht eingefügt werden, \"\n + \"da keine valide Zahl eingegeben worden ist\");\n// continue;\n }\n } else {\n price = tmp.getPreis();\n }\n if (recorderXml.getBonStornoType() != -1) {\n WarenruecknahmePreisDlg wpdlg = new WarenruecknahmePreisDlg(mainframe, true, tmp.getPreis());\n wpdlg.setVisible(true);\n price = wpdlg.getPreis();\n price *= -1;\n }\n\n if (tmp.getCategory().equalsIgnoreCase(\"Preis EAN\")) {\n price = -1;\n do {\n try {\n price = Integer.parseInt(JOptionPane.showInputDialog(mainframe, \"Geben Sie den Preis für diesen Artikel mit Preis EAN ein\"));\n } catch (NumberFormatException ex) {\n int cancel = JOptionPane.showConfirmDialog(mainframe, \"Es wurde keine gültige Zahl eingeben! Wollen Sie den Kassiervorgang dieses Artikels abbrechen?\");\n if (cancel == 0) {\n return;\n }\n }\n } while (price == -1);\n price = price / 100;\n }\n\n int amount = -1;\n if (tmp.getCategory().equalsIgnoreCase(\"Gewichts EAN\")) {\n do {\n try {\n amount = Integer.parseInt(JOptionPane.showInputDialog(mainframe, \"Geben Sie die Menge für diesen Artikel mit Gewichts EAN ein (in Gramm)\"));\n } catch (NumberFormatException ex) {\n int cancel = JOptionPane.showConfirmDialog(mainframe, \"Es wurde keine gültige Zahl eingeben! Wollen Sie den Kassiervorgang dieses Artikels abbrechen?\");\n if (cancel == 0) {\n return;\n }\n }\n } while (amount == -1);\n }\n\n Article art = new Article(tmp.getXmlArticleName(), tmp.isLeergut(),\n tmp.isJugendSchutz(), tmp.getEan(), tmp.getArticleName(),\n tmp.isPfand(), tmp.getPfandArtikel(), price, tmp.isRabatt(), tmp.getUst(),\n tmp.isWeight(), tmp.getCategory(), tmp.isEloading(), tmp.isSerialNrRequired());\n art.setIsAbfrage(tmp.isIsAbfrage());\n if (amount != -1) {\n art.setGewichts_ean_menge(amount);\n }\n JugendschutzDlg jdlg = null;\n if (tmp.isJugendSchutz() && !tmp.isIsAbfrage()) {\n jdlg = new JugendschutzDlg(mainframe, true);\n jdlg.setVisible(true);\n if (jdlg.isOk()) {\n art.setJugendSchutzOk(true);\n }\n }\n if (tmp.isEloading()) {\n if (dlm.getAmount() <= 1) {\n if (tmp.isJugendSchutz() && !tmp.isIsAbfrage()) {\n if (jdlg.isOk()) {\n String status = null;\n do {\n ELoadingDlg edlg = new ELoadingDlg(mainframe, true);\n edlg.setVisible(true);\n status = edlg.getStatus();\n } while (status == null);\n art.setEloadingState(status);\n if (status.equalsIgnoreCase(\"server_offline\") || status.equalsIgnoreCase(\"aufladung_nok\")) {\n art.setPriceZero(true);\n }\n }\n } else {\n String status = null;\n if (!tmp.isIsAbfrage()) {\n do {\n ELoadingDlg edlg = new ELoadingDlg(mainframe, true);\n edlg.setVisible(true);\n status = edlg.getStatus();\n\n } while (status == null);\n art.setEloadingState(status);\n if (status.equalsIgnoreCase(\"server_offline\") || status.equalsIgnoreCase(\"aufladung_nok\")) {\n art.setPriceZero(true);\n }\n }\n }\n } else {\n JOptionPane.showMessageDialog(mainframe, \"E-Loading Artikel können nicht mit einer Menge > 1 eingefügt werden\");\n art.setEloadingAmmountOk(false);\n }\n }\n\n int weight = -1;\n Path weight_path = null;\n if (tmp.isWeight() && !tmp.isIsAbfrage()) {\n int result = JOptionPane.showConfirmDialog(mainframe, \"Es wurde ein Gewichtsartikel ausgewählt. Wollen sie diesen \"\n + \"Artikel mithilfe einer Tastatureingabe abwiegen?\");\n if (result == 0) {\n do {\n try {\n weight = Integer.parseInt(JOptionPane.showInputDialog(mainframe, \"Geben Sie bitte das Gewicht für den Artikel ein\"));\n } catch (NumberFormatException ex) {\n int cancel = JOptionPane.showConfirmDialog(mainframe, \"Es wurde keine gültige Zahl eingeben! Wollen Sie den Kassiervorgang dieses Artikels abbrechen?\");\n if (cancel == 0) {\n return;\n }\n }\n } while (weight == -1);\n } else {\n JFileChooser fc = new JFileChooser(System.getProperty(\"user.home\") + File.separator + \"Documents\");\n FileNameExtensionFilter filter = new FileNameExtensionFilter(\"txt-Dateien\", \"txt\");\n fc.setFileFilter(filter);\n if (fc.showOpenDialog(mainframe) == JFileChooser.APPROVE_OPTION) {\n weight_path = fc.getSelectedFile().toPath();\n } else {\n JOptionPane.showMessageDialog(mainframe, \"Es wurde keine Datei ausgewählt! Der Kassiervorgang dieses Artikels wird abgebrochen\");\n return;\n }\n }\n }\n\n if (tmp.isSerialNrRequired() && !tmp.isIsAbfrage()) {\n //Seriennummer einlesen\n if ((tmp.isJugendSchutzOk() && tmp.isJugendSchutz()) || !tmp.isJugendSchutz()) {\n String serNr;\n do {\n serNr = JOptionPane.showInputDialog(null,\n \"Bitte geben Sie eine Seriennummer ein:\");\n } while (serNr == null || serNr.equals(\"\") || !serNr.matches(\"[0-9]+\"));\n art.setSerialNr(serNr);\n }\n }\n if (tmp.isWeight()) {\n if (weight == -1) {\n art.setWeigthArticles(weight_path);\n } else {\n art.setWeigthArticles(weight);\n }\n }\n int tmp_pfand_amount = -1;\n if (tmp.isPfand()) {\n tmp_pfand_amount = dlm.getAmount();\n }\n dlm.addArtikel(art);\n if (tmp.isPfand() && (art.isJugendSchutzOk() || !tmp.isJugendSchutz())) {\n for (Article arti : atm.getAllArtikels()) {\n if (arti.getXmlArticleName().equals(art.getPfandArtikel())) {\n Article newA = new Article(arti.getXmlArticleName(), arti.isLeergut(), arti.isJugendSchutz(), arti.getEan(), arti.getArticleName(), arti.isPfand(), arti.getPfandArtikel(), arti.getPreis(), arti.isRabatt(), arti.getUst(), arti.isWeight(), arti.getCategory(), arti.isEloading());\n dlm.setAmount(tmp_pfand_amount);\n newA.setInXml(false);\n dlm.addArtikel(newA);\n tmp_pfand_amount = -1;\n }\n }\n }\n JButton btBonSt = paArticle.getBtBonstorno();\n if (btBonSt.isEnabled()) {\n btBonSt.setEnabled(false);\n }\n\n JButton btWrue = paArticle.getBtWRUE();\n if (btWrue.isEnabled()) {\n btWrue.setEnabled(false);\n }\n// }\n\n setPrice();\n setBonStarted(true);\n tfDigitField.setText(\"\");\n money = 0;\n }\n }", "private boolean checkValidity() {\n \n switch (referenceTypeChosen) {\n \n case AIRBUSPN_TYPEARTICLE:\n \n AirbusPN lAirbusPN = null;\n if (!StringUtil.isEmptyOrNull(selectedReferenceName)) {\n lAirbusPN =\n articleBean.findAirbusPNByName(selectedReferenceName);\n // check the Airbus PN existence\n if (lAirbusPN == null) {\n \n // reset the Article Type since Airbus PN is not found\n selectedTypeArticle = null;\n \n Utils.addFacesMessage(\n NavigationConstants.OBSO_MGMT_ERROR_ID,\n MessageBundle\n .getMessage(Constants.AIRBUS_PN_NOT_FOUND));\n return false;\n }\n }\n \n // search corresponding Article Types...\n if (lAirbusPN != null) {\n List<TypeArticle> lAirbusPNTypeArticles =\n articleBean.findAllTypeArticleForPN(lAirbusPN);\n if (lAirbusPNTypeArticles != null) {\n if (lAirbusPNTypeArticles.size() == 1) {\n // if only one Article Type is found, select it\n selectedTypeArticle = lAirbusPNTypeArticles.get(0);\n }\n else if (lAirbusPNTypeArticles.size() == 0) {\n // reset the Article Type since no one has been found\n selectedTypeArticle = null;\n }\n else {\n if (selectedTypeArticle != null\n && !lAirbusPNTypeArticles\n .contains(selectedTypeArticle)) {\n // reset the Article Type since it is no more\n // contained by the available Article Types for the\n // Airbus PN\n selectedTypeArticle = null;\n }\n }\n }\n else {\n // reset the Article Type since no one has been found\n selectedTypeArticle = null;\n }\n }\n \n // if at least one reference is empty, no check can be performed\n if (lAirbusPN == null || selectedTypeArticle == null) {\n return true;\n }\n \n // check that the Airbus PN and the Type Article are not already\n // obsolescence managed\n ObsolescenceReference lAirbusObsolescenceReference =\n new ObsolescenceReference(lAirbusPN, selectedTypeArticle);\n if (obsoBean\n .isReferenceAlreadyManagedIntoObso(lAirbusObsolescenceReference)) {\n \n Utils.addFacesMessage(\n NavigationConstants.OBSO_MGMT_ERROR_ID,\n MessageBundle\n .getMessage(Constants.OBSO_REFERENCE_ALREADY_MANAGED_INTO_OBSOLESCENCE));\n return false;\n }\n \n // check that no article is already obsolescence managed with its\n // manufacturer PN\n if (!obsoBean.isObsoCreationValidForExistingPN(lAirbusPN,\n selectedTypeArticle)) {\n \n Utils.addFacesMessage(\n NavigationConstants.OBSO_MGMT_ERROR_ID,\n MessageBundle\n .getMessage(Constants.OBSO_ALREADY_AIRBUSPN_MANAGED_CONFLICT_ERROR));\n return false;\n }\n \n return true;\n \n case MANUFACTURERPN_TYPEARTICLE:\n \n ManufacturerPN lManufacturerPN = null;\n if (!StringUtil.isEmptyOrNull(selectedReferenceName)) {\n lManufacturerPN =\n articleBean\n .findManufacturerPNByName(selectedReferenceName);\n // check the Manufacturer PN existence\n if (lManufacturerPN == null) {\n \n // reset the Article Type since Manufacturer PN is not found\n selectedTypeArticle = null;\n \n Utils.addFacesMessage(\n NavigationConstants.OBSO_MGMT_ERROR_ID,\n MessageBundle\n .getMessage(Constants.MANUFACTURER_PN_NOT_FOUND));\n return false;\n }\n }\n \n // search corresponding Article Types...\n if (lManufacturerPN != null) {\n List<TypeArticle> lManufacturerPNTypeArticles =\n articleBean.findAllTypeArticleForPN(lManufacturerPN);\n if (lManufacturerPNTypeArticles != null) {\n if (lManufacturerPNTypeArticles.size() == 1) {\n // if only one Type Article is found, select it\n selectedTypeArticle =\n lManufacturerPNTypeArticles.get(0);\n }\n else if (lManufacturerPNTypeArticles.size() == 0) {\n // reset the Article Type since no one has been found\n selectedTypeArticle = null;\n }\n else {\n if (selectedTypeArticle != null\n && !lManufacturerPNTypeArticles\n .contains(selectedTypeArticle)) {\n // reset the Article Type since it is no more\n // contained by the available Article Types for the\n // Manufacturer PN\n selectedTypeArticle = null;\n }\n }\n }\n else {\n // reset the Article Type since no one has been found\n selectedTypeArticle = null;\n }\n }\n \n // if at least one reference is empty, no check can be performed\n if (lManufacturerPN == null || selectedTypeArticle == null) {\n return true;\n }\n \n ObsolescenceReference lManufacturerObsolescenceReference =\n new ObsolescenceReference(lManufacturerPN,\n selectedTypeArticle);\n // check that the Manufacturer PN and the Type Article are not\n // already obsolescence managed\n if (obsoBean\n .isReferenceAlreadyManagedIntoObso(lManufacturerObsolescenceReference)) {\n \n Utils.addFacesMessage(\n NavigationConstants.OBSO_MGMT_ERROR_ID,\n MessageBundle\n .getMessage(Constants.OBSO_REFERENCE_ALREADY_MANAGED_INTO_OBSOLESCENCE));\n return false;\n }\n \n // check that no article is already obsolescence managed with its\n // Airbus PN\n if (!obsoBean.isObsoCreationValidForExistingPN(lManufacturerPN,\n selectedTypeArticle)) {\n \n Utils.addFacesMessage(\n NavigationConstants.OBSO_MGMT_ERROR_ID,\n MessageBundle\n .getMessage(Constants.OBSO_ALREADY_MANUFACTURERPN_MANAGED_CONFLICT_ERROR));\n return false;\n }\n \n return true;\n \n case SOFTWARE:\n \n Software lSoftware = null;\n if (!StringUtil.isEmptyOrNull(selectedReferenceName)) {\n lSoftware = softBean.findByCompleteName(selectedReferenceName);\n // check the software existence\n if (lSoftware == null) {\n \n Utils.addFacesMessage(\n NavigationConstants.OBSO_MGMT_ERROR_ID,\n MessageBundle\n .getMessage(MessageConstants.SOFTWARE_COMPLETENAME_INCORRECT));\n return false;\n }\n }\n \n // if the reference is empty, no check can be performed\n if (lSoftware == null) {\n return true;\n }\n \n ObsolescenceReference lSoftwareObsolescenceReference =\n new ObsolescenceReference(lSoftware);\n // check that the software is not already obsolescence managed\n if (obsoBean\n .isReferenceAlreadyManagedIntoObso(lSoftwareObsolescenceReference)) {\n \n Utils.addFacesMessage(\n NavigationConstants.OBSO_MGMT_ERROR_ID,\n MessageBundle\n .getMessage(Constants.OBSO_REFERENCE_ALREADY_MANAGED_INTO_OBSOLESCENCE));\n return false;\n }\n \n return true;\n \n case TYPEPC:\n TypePC lTypePC = null;\n if (!StringUtil.isEmptyOrNull(selectedReferenceName)) {\n lTypePC = articleBean.findTypePCByName(selectedReferenceName);\n // check the PC Type existence\n if (lTypePC == null) {\n \n Utils.addFacesMessage(\n NavigationConstants.OBSO_MGMT_ERROR_ID,\n MessageBundle\n .getMessage(Constants.PC_TYPE_NOT_FOUND));\n return false;\n }\n }\n \n // if the reference is empty, no check can be performed\n if (lTypePC == null) {\n return true;\n }\n \n ObsolescenceReference lTypePCObsolescenceReference =\n new ObsolescenceReference(lTypePC);\n // check that the PC Type is not already obsolescence managed\n if (obsoBean\n .isReferenceAlreadyManagedIntoObso(lTypePCObsolescenceReference)) {\n \n Utils.addFacesMessage(\n NavigationConstants.OBSO_MGMT_ERROR_ID,\n MessageBundle\n .getMessage(Constants.OBSO_REFERENCE_ALREADY_MANAGED_INTO_OBSOLESCENCE));\n \n return false;\n }\n \n return true;\n \n default:\n return false;\n }\n }", "public void save(CbmCItemFininceItem entity);", "public void filterArticles() {\n filterAgent.score(articles, filterType);\n articles = insertionSort(articles); // sorted articles list\n\n refreshTable();\n if (articles.size() > 0) {\n currentArt = (NewsArticle) articles.elementAt(0);\n }\n }", "public boolean bookSave(Book book) {\n\t\t\r\n\t\treturn true;\r\n\t}", "public BankThing save(BankThing thing);", "public void save()\n\t{\t\n\t\tfor (Preis p : items) {\n\t\t\titmDAO.create(p.getItem());\n\t\t\tprcDAO.create(p);\n\t\t}\n\t\tstrDAO.create(this);\n\t}", "<S extends T> Collection<S> save(Iterable<S> entities);", "void addArticle(Article a);", "@Override\n public boolean onSave(EditTransaction et) {\n et.retrieveData(VisitDrug.CODE, typecode, false, null, null);\n\n ContentValues cv = et.getContentValues();\n cv.put(VisitDrug.CODE, typecode.getSelectId());\n cv.put(\"dentalcode\", typecode.getSelectId());\n if (dentist.getSelectId() != null)\n cv.put(VisitDrug.DOCTOR1, dentist.getSelectId());\n cv.put(\"unit\", \"1\");\n cv.put(\"costprice\", cost);\n cv.put(\"realprice\", real);\n //cv.put(VisitDrug.DOCTOR2, \"waitForMethod\");\n cv.put(VisitDrug._DATEUPDATE, DateTime.getCurrentDateTime());\n return true;\n }", "@Override\n public final void makeFirstPrepareForSave(final Map<String, Object> pAddParam,\n final GoodsLoss pEntity) throws Exception {\n //nothing\n }", "public void saveNew() {\r\n String name, compName;\r\n double price;\r\n int id, inv, max, min, machId;\r\n //Gets the ID of the last part in the inventory and adds 1 to it \r\n id = Inventory.getAllParts().get(Inventory.getAllParts().size() - 1).getId() + 1;\r\n name = nameField.getText();\r\n inv = Integer.parseInt(invField.getText());\r\n price = Double.parseDouble(priceField.getText());\r\n max = Integer.parseInt(maxField.getText());\r\n min = Integer.parseInt(minField.getText());\r\n\r\n if (inHouseSelected) {\r\n machId = Integer.parseInt(machineOrCompanyField.getText());\r\n Part newPart = new InHouse(id, name, price, inv, min, max, machId);\r\n Inventory.addPart(newPart);\r\n } else {\r\n compName = machineOrCompanyField.getText();\r\n Part newPart = new Outsourced(id, name, price, inv, min, max, compName);\r\n Inventory.addPart(newPart);\r\n }\r\n\r\n }", "protected abstract boolean keepEntities(boolean attribute);", "@Override\n\tprotected void onSave(HttpServletRequest request, OrderPickList entity,\n\t\t\tBindException errors) {\n\t\t\n\t}", "public abstract Banner saveBanner(Banner banner);", "public boolean save(Product product);", "public boolean maybeSave(final Bid bid);", "public interface DBService {\n\n Offer save(Offer offer);\n\n}", "@Override\n protected boolean beforeSave(boolean newRecord) {\n if (newRecord){\n\n // Me aseguro de tener la organización correcta\n MZOrdenPago ordenPago = (MZOrdenPago) this.getZ_OrdenPago();\n this.setAD_Org_ID(ordenPago.getAD_Org_ID());\n\n if (this.getZ_GeneraOrdenPago_ID() <= 0){\n this.setZ_GeneraOrdenPago_ID(((MZOrdenPago) this.getZ_OrdenPago()).getZ_GeneraOrdenPago_ID());\n }\n if (this.getC_BPartner_ID() <= 0){\n this.setC_BPartner_ID(((MZOrdenPago) this.getZ_OrdenPago()).getC_BPartner_ID());\n }\n }\n\n // Si selecciono un item de medio de pago ya emitido, cargo datos del mismo en esta linea.\n if ((newRecord) || (is_ValueChanged(X_Z_OrdenPagoMedio.COLUMNNAME_Z_MedioPagoItem_ID))){\n if (this.getZ_MedioPagoItem_ID() > 0){\n MZMedioPagoItem medioPagoItem = (MZMedioPagoItem) this.getZ_MedioPagoItem();\n if (medioPagoItem.isEmitido()){\n\n if (this.getDateEmitted() == null) this.setDateEmitted(medioPagoItem.getDateEmitted());\n if (this.getDueDate() == null) this.setDueDate(medioPagoItem.getDueDate());\n if ((this.getTotalAmt() == null) || (this.getTotalAmt().compareTo(Env.ZERO) <= 0)) this.setTotalAmt(medioPagoItem.getTotalAmt());\n\n if ((!this.getDateEmitted().equals(medioPagoItem.getDateEmitted())) || (!this.getDueDate().equals(medioPagoItem.getDueDate()))\n || (this.getTotalAmt().compareTo(medioPagoItem.getTotalAmt()) != 0)){\n log.saveError(\"ATENCIÓN\", \"No es posible modificar datos de este medio de pago ya que el mismo esta emitido.\");\n return false;\n }\n\n /*\n this.setDateEmitted(medioPagoItem.getDateEmitted());\n this.setDueDate(medioPagoItem.getDueDate());\n this.setTotalAmt(medioPagoItem.getTotalAmt());\n\n */\n }\n }\n }\n\n // Valido fecha de emision debe ser siempre menor a fecha de vencimiento.\n if ((this.getDateEmitted() != null) && (this.getDueDate() != null)){\n if (this.getDueDate().before(this.getDateEmitted())){\n log.saveError(\"ATENCIÓN\", \"La fecha de Vencimiento debe ser mayor o igual a la fecha de Emisión.\");\n return false;\n }\n }\n\n // Valido importe del medio de pago mayor a cero\n if ((this.getTotalAmt() == null) && (this.getTotalAmt().compareTo(Env.ZERO) <= 0)){\n log.saveError(\"ATENCIÓN\", \"Debe indicar importe mayor a cero para este medio de pago.\");\n }\n\n return true;\n }", "private void checkSave(CRM crm,\n\t\t\tMap<Indicator, List<IndicatorValueScore>> indicatorMap,\n\t\t\tIterable<CorporationType> crmTypes,\n\t\t\tIterable<Certificate> certificates, Communicatee communicatee,\n\t\t\tIterable<Communicatee> communicatees, Iterable<Associate> associates)\n\t\t\tthrows Exception {\n\t}", "@Override\n public boolean shouldRiderSit()\n {\n return entityData.get(SHOULD_SIT);\n }", "boolean isValidForBasket(Collection<Item> items);", "boolean saveExpense(Expenses exp);", "public void updateArticles(Map<String, UserArticleProgressDao> completedArticlesMap,\n List<ArticleDao> artilces, Set<String> bookMarkArticles, User user,\n List<String> mandatoryArticles, ArticlesFactory articlesFactory) {\n filters = new HashSet<String>();\n List<UserArticleProgressDto> mandatoryArticlesDto = new ArrayList<>();\n List<UserArticleProgressDto> nonMandatoryArticles = new ArrayList<>();\n List<UserArticleProgressDto> completedArticles = new ArrayList<>();\n artilces.stream().forEach(\n a -> {\n Article article = articlesFactory.getArticle(a.getArticle().getId());\n if (!completedArticlesMap.containsKey(a.getArticle().getId())) {\n UserArticleProgressDto uap = new UserArticleProgressDto(a);\n if (bookMarkArticles.contains(a.getArticle().getId())) {\n uap.setArticleBookmarked(true);\n }\n \n uap.setUserArticleStatus(ArticleStatus.NOT_STARTED);\n filters.add(uap.getArticleTypeFormatted());\n if (article.getArticleReccomendations().contains(user.getEmail())) {\n uap.setArticleRecommendedByUser(true);\n }\n if (mandatoryArticles.contains(a.getArticle().getId())) {\n uap.setMandatoryArticle(true);\n mandatoryArticlesDto.add(uap);\n } else {\n nonMandatoryArticles.add(uap);\n }\n } else {\n UserArticleProgressDao userArticleProgressDao = completedArticlesMap.get(a.getArticle()\n .getId());\n UserArticleProgressDto uap = new UserArticleProgressDto(userArticleProgressDao, a.getArticle());\n if (bookMarkArticles.contains(article.getId())) {\n uap.setArticleBookmarked(true);\n }\n uap.setUserArticleStatus(userArticleProgressDao.getArticleStatus());\n incrementArticlesCompleted();\n filters.add(uap.getArticleTypeFormatted());\n if (article.getArticleReccomendations()\n .contains(user.getEmail())) {\n uap.setArticleRecommendedByUser(true);\n }\n if (mandatoryArticles.contains(article.getId())) {\n uap.setMandatoryArticle(true);\n }\n completedArticles.add(uap);\n }\n });\n userArticlesProgress = new ArrayList<>();\n userArticlesProgress.addAll(mandatoryArticlesDto);\n userArticlesProgress.addAll(nonMandatoryArticles);\n userArticlesProgress.addAll(completedArticles);\n \n \n setTotalArticles(userArticlesProgress.size());\n \n }", "@Test\n @DisplayName(\"Deve salvar um livro\")\n public void saveBookTest() {\n given(bookToSaveMocked.getIsbn()).willReturn(BookHelperTest.DOM_CASMURRO_ISBN);\n given(bookRepositoryMocked.existsByIsbn(BookHelperTest.DOM_CASMURRO_ISBN)).willReturn(false);\n given(bookRepositoryMocked.save(bookToSaveMocked)).willReturn(bookSavedMocked);\n\n // When execute save\n Book bookSaved = bookService.save(bookToSaveMocked);\n\n // Then validate save return\n assertThat(bookSaved).isNotNull();\n\n // And verify mocks interaction\n verify(bookToSaveMocked, times(1)).getIsbn();\n verify(bookRepositoryMocked, times(1)).existsByIsbn(BookHelperTest.DOM_CASMURRO_ISBN);\n verify(bookRepositoryMocked, times(1)).save(Mockito.any(Book.class));\n }", "public abstract void saveOrder(Order order);", "public void einfuegen(Artikel artikel) throws ArtikelExistiertBereitsException {\n\t\tif (!artikelBestand.contains(artikel))\n\t\t\tartikelBestand.add(artikel);\n\t\telse\n\t\t\tthrow new ArtikelExistiertBereitsException(artikel, \" - in 'einfuegen()'\");\n\t}", "public void crearCategoria(Categoria categoria){\n categoriaRepo.save(categoria); \n }", "void save(E entity);", "private static boolean transactionAddArticle(Transaction tx, ArticleBean newArt) {\n HashMap<String, Object> parameters = new HashMap<>();\n parameters.put(\"author\", newArt.getAuthor());\n parameters.put(\"id\", newArt.getId());\n parameters.put(\"timestamp\", newArt.getTimestamp().toString());\n parameters.put(\"title\", newArt.getTitle());\n parameters.put(\"game1\", newArt.getListGame().get(0));\n parameters.put(\"game2\", (newArt.getListGame().size() == 2) ? newArt.getListGame().get(1) : \"\" );\n String query = \"\";\n\n if (newArt.getListGame().size() == 1 || newArt.getListGame().get(1).equals(\"\")) {\n query =\n \"MATCH(u:User {username:$author}), (g1:Game{name:$game1})\"\n + \" CREATE (u)-[p:PUBLISHED{timestamp:$timestamp}]->(a:Article{idArt:$id, title:$title})\"\n + \" CREATE (g1)<-[:REFERRED]-(a)\"\n + \" return a \";\n } else {\n query =\n \"MATCH(u:User {username:$author}), (g1:Game{name:$game1}), (g2:Game{name:$game2}) \"\n + \" CREATE (u)-[p:PUBLISHED{timestamp:$timestamp}]->(a:Article{idArt:$id, title:$title}) \"\n + \" CREATE (g1)<-[:REFERRED]-(a)-[:REFERRED]->(g2) \"\n + \" return a \";\n }\n\n\n Result result = tx.run(query, parameters);\n if(result.hasNext()) {\n return true;\n }\n\n return false;\n }", "@Override\n\tprotected void save() throws Exception {\n\t\t//turn the list of data into a unique list of tickets\n\t\tMap<String, ExtTicketVO> tickets= new HashMap<>(data.size());\n\t\tfor (SOHDRFileVO dataVo : data) {\n\t\t\t//035 are harvests and all we care about\n\t\t\tif (\"035\".equals(dataVo.getSoType())) {\n\t\t\t\tExtTicketVO vo = transposeTicketData(dataVo, new ExtTicketVO());\n\t\t\t\ttickets.put(vo.getTicketId(), vo);\n\t\t\t}\n\t\t}\n\n\t\tpopulateTicketDBData(tickets);\n\n\t\ttickets = removeGhostRecords(tickets);\n\n\t\t//don't bother with the rest of this class if we have no tickets\n\t\tif (tickets.isEmpty()) return;\n\n\t\tdecomissionUnits(tickets.keySet()); //ticket\n\n\t\tpurgePartShipments(tickets.keySet()); //calls purgeShipments to cascade deletion\n\n\t\tsetDispositionCode(tickets); //ticket_data attr_dispositionCode\tNONREPAIRABLE\n\n\t\tcorrectLedgerEntries(tickets);\n\t}", "@Override\n\tpublic void checkeoDeBateria() {\n\n\t}", "public void save() {\n\t\tList<EmbeddedEntity> embeddedEntities = new ArrayList<>();\n\t\tfor (FeedItem item : items)\n\t\t\tembeddedEntities.add(item.getEntity());\n\t\tEntity feed = new Entity(getKey());\n\t\tfeed.setUnindexedProperty(\"items\", embeddedEntities); //NOI18N\n\t\tdatastore.put(feed);\n\t}", "@Override\n\t@Transactional\n\n\tpublic void initCategorie() {\n\t\tStream.of(\"Action\",\"Drame\",\"Guerre\",\"Fantastique\",\"Science-fiction\",\"Thriller\").forEach(cat->{\n\t\t\tCategorie categorie=new Categorie();\n\t\t\tcategorie.setName(cat);\n\t\t\tcategorieRepository.save(categorie);\n\t\t});\n\t}", "public boolean canSave()\n {\n return true;\n }", "public boolean canSave()\n {\n return true;\n }", "public void setArticle() {\n\t\tint lastCharPosition = this.countryName.length()-1;\n\t\t\n\t\tif(this.isException())\n\t\t\tthis.article = \"le\";\n\t\t\n\t\tfor(int i = 0; i < this.vocals.length; i++) {\n\t\t\tif (this.countryName.indexOf(vocals[i]) == 0) {\n\t\t\t\tarticle = \"l\\'\";\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(this.countryName.indexOf('e') == lastCharPosition){\n\t\t\tthis.article = \"la\";\n\t\t}else if (this.countryName.indexOf('s') == lastCharPosition) {\n\t\t\tthis.article = \"les\";\n\t\t}else {\n\t\t\tthis.article = \"le\";\n\t\t}\n\t}", "void saveProduct(Product product);", "@Override\n public void run(String... args) throws Exception {\n Outfit outfit = new Outfit();\n outfit.setCurrentoutfit(true);\n outfitRepository.save(outfit);\n\n\n// Category category = new Category();\n//\n// category.setTops(\"Tops\");\n// category.setBottoms(\"Bottoms\");\n// category.setShoes(\"sneakers\");\n// category.setAccessories(\"\");\n// category.setJackets(\"\");\n// categoryRepository.save(category);\n Category tops = new Category();\n tops.setCategoryType(\"Tops\");\n categoryRepository.save(tops);\n\n Category bottoms = new Category();\n bottoms.setCategoryType(\"Bottoms\");\n categoryRepository.save(bottoms);\n\n Category accessories = new Category();\n accessories.setCategoryType(\"Accessories\");\n categoryRepository.save(accessories);\n\n Category shoes = new Category();\n shoes.setCategoryType(\"Shoes\");\n categoryRepository.save(shoes);\n\n Category jackets = new Category();\n jackets.setCategoryType(\"Jacket\");\n categoryRepository.save(jackets);\n/**\n * Here is where the items start for Outfit 1\n * */\n Item topOne = new Item();\n topOne.setCategory(tops);\n topOne.setColor(\"Black\");\n topOne.setFabricMaterial(\"cotton\");\n topOne.setSize(7);\n topOne.setItemName(\"Shirt\");\n topOne.setImages(\"image/women.png\");\n itemRepository.save(topOne);\n\n Item bottomOne = new Item();\n bottomOne.setCategory(bottoms);\n bottomOne.setColor(\"Light Blue\");\n bottomOne.setFabricMaterial(\"Denim\");\n bottomOne.setSize(31);\n bottomOne.setItemName(\"Bleached Light Blue Jeans\");\n itemRepository.save(bottomOne);\n\n Item shoeOne = new Item();\n shoeOne.setCategory(shoes);\n shoeOne.setColor(\"Black\");\n shoeOne.setFabricMaterial(\"Mesh\");\n shoeOne.setSize(7);\n shoeOne.setItemName(\"Shoe\");\n itemRepository.save(shoeOne);\n\n Item accessoryOne = new Item();\n accessoryOne.setCategory(accessories);\n accessoryOne.setColor(\"Gold\");\n accessoryOne.setFabricMaterial(\"Gold\");\n accessoryOne.setSize(1);\n accessoryOne.setItemName(\"Gold Watch\");\n itemRepository.save(accessoryOne);\n\n\n Item jacketOne = new Item();\n jacketOne.setCategory(jackets);\n jacketOne.setColor(\"Black\");\n jacketOne.setFabricMaterial(\"Leather\");\n jacketOne.setSize(30);\n jacketOne.setItemName(jacketOne.getColor() + \" Jacket\");\n itemRepository.save(jacketOne);\n\n\n /**\n * Here is where the items start for Outfit 2\n * */\n Item topTwo = new Item();\n topTwo.setCategory(tops);\n topTwo.setColor(\"White\");\n topTwo.setFabricMaterial(\"Blend\");\n topTwo.setSize(7);\n topTwo.setItemName(\"Crew Neck Tee Shirt\");\n itemRepository.save(topTwo);\n\n Item bottomTwo = new Item();\n bottomTwo.setCategory(bottoms);\n bottomTwo.setColor(\"Grey\");\n bottomTwo.setFabricMaterial(\"Denim\");\n bottomTwo.setSize(34);\n bottomTwo.setItemName(\"Skinny Jeans\");\n itemRepository.save(bottomTwo);\n\n Item shoeTwo = new Item();\n shoeTwo.setCategory(shoes);\n shoeTwo.setColor(\"White, Black, Red\");\n shoeTwo.setFabricMaterial(\"Mesh\");\n shoeTwo.setSize(7);\n shoeTwo.setItemName(\"Tennis Shoes\");\n itemRepository.save(shoeTwo);\n\n Item accessoryTwo = new Item();\n accessoryTwo.setCategory(accessories);\n accessoryTwo.setColor(\"Green\");\n accessoryTwo.setFabricMaterial(\"\");\n accessoryTwo.setSize(7);\n accessoryTwo.setItemName(\"Shirt\");\n itemRepository.save(accessoryTwo);\n\n Item jacketTwo = new Item();\n jacketTwo.setCategory(jackets);\n jacketTwo.setColor(\"Tan\");\n jacketTwo.setFabricMaterial(\"Leather\");\n jacketTwo.setSize(30);\n jacketTwo.setItemName(jacketTwo.getColor() + \" Jacket\");\n itemRepository.save(jacketTwo);\n\n\n /**\n * Here is where the items start for Outfit 3\n * */\n Item topThree = new Item();\n topThree.setCategory(tops);\n topThree.setColor(\"red\");\n topThree.setFabricMaterial(\"cotton\");\n topThree.setSize(7);\n topThree.setItemName(\"Shirt\");\n itemRepository.save(topThree);\n\n Item bottomThree = new Item();\n bottomThree.setCategory(bottoms);\n bottomThree.setColor(\"green\");\n bottomThree.setFabricMaterial(\"cotton\");\n bottomThree.setSize(31);\n bottomThree.setItemName(\"Jeans\");\n itemRepository.save(bottomThree);\n\n Item shoeThree = new Item();\n shoeThree.setCategory(shoes);\n shoeThree.setColor(\"green\");\n shoeThree.setFabricMaterial(\"\");\n shoeThree.setSize(7);\n shoeThree.setItemName(\"Shoe\");\n itemRepository.save(shoeThree);\n\n Item accessoryThree = new Item();\n accessoryThree.setCategory(accessories);\n accessoryThree.setColor(\"green\");\n accessoryThree.setFabricMaterial(\"\");\n accessoryThree.setSize(7);\n accessoryThree.setItemName(\"Shirt\");\n itemRepository.save(accessoryThree);\n\n\n\n\n\n /**\n * Here is where the items start for Outfit 4\n * */\n Item topFour = new Item();\n topFour.setCategory(tops);\n topFour.setColor(\"red\");\n topFour.setFabricMaterial(\"cotton\");\n topFour.setSize(7);\n topFour.setItemName(\"Shirt\");\n itemRepository.save(topFour);\n\n Item bottomFour = new Item();\n bottomFour.setCategory(bottoms);\n bottomFour.setColor(\"green\");\n bottomFour.setFabricMaterial(\"cotton\");\n bottomFour.setSize(31);\n bottomFour.setItemName(\"Jeans\");\n itemRepository.save(bottomFour);\n\n Item shoeFour = new Item();\n shoeFour.setCategory(shoes);\n shoeFour.setColor(\"green\");\n shoeFour.setFabricMaterial(\"\");\n shoeFour.setSize(7);\n shoeFour.setItemName(\"Shoe\");\n itemRepository.save(shoeFour);\n\n Item accessoryFour = new Item();\n accessoryFour.setCategory(accessories);\n accessoryFour.setColor(\"green\");\n accessoryFour.setFabricMaterial(\"\");\n accessoryFour.setSize(7);\n accessoryFour.setItemName(\"Shirt\");\n itemRepository.save(accessoryFour);\n\n\n\n\n\n /**\n * Here is where the items start for Outfit 5\n * */\n Item topFive = new Item();\n topFive.setCategory(tops);\n topFive.setColor(\"red\");\n topFive.setFabricMaterial(\"cotton\");\n topFive.setSize(7);\n topFive.setItemName(\"Shirt\");\n itemRepository.save(topFive);\n\n Item bottomFive = new Item();\n bottomFive.setCategory(bottoms);\n bottomFive.setColor(\"green\");\n bottomFive.setFabricMaterial(\"cotton\");\n bottomFive.setSize(31);\n bottomFive.setItemName(\"Jeans\");\n itemRepository.save(bottomFive);\n\n Item shoeFive = new Item();\n shoeFive.setCategory(shoes);\n shoeFive.setColor(\"green\");\n shoeFive.setFabricMaterial(\"\");\n shoeFive.setSize(7);\n shoeFive.setItemName(\"Shoe\");\n itemRepository.save(shoeFive);\n\n Item accessoriesFive = new Item();\n accessoriesFive.setCategory(accessories);\n accessoriesFive.setColor(\"green\");\n accessoriesFive.setFabricMaterial(\"\");\n accessoriesFive.setSize(7);\n accessoriesFive.setItemName(\"Shirt\");\n itemRepository.save(accessoriesFive);\n }", "void save(Cartera entity);", "public abstract boolean saveRequired();", "int needsSaving();", "private void addArticle() {\n\t\tAdminComposite.display(\"\", STATUS_SUCCESS, SUCCESS_FONT_COLOR);\n\t\tQuotationDetailsDTO detail = new QuotationDetailsDTO();\n\t\ttry {\n\t\t\tdetail = createQuotationDetail(detail);\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\tif (validateMandatoryParameters(detail)) {\n\t\t\taddToArticleTable(detail);\n\t\t}\n\t}", "Article enableArticle(Article art, boolean enable) {\n for (Article article : list) {\n if (article.equals(art)) {\n article.setEnabled(enable);\n return article;\n }\n }\n return null;\n }", "@Override\r\n\tpublic void save(Plate tipo) {\n\t\t\r\n\t}", "protected boolean processCustomSaveDocumentBusinessRules(MaintenanceDocument document) {\n boolean isValid = true;\n OleDiscoveryExportProfile oleDiscoveryExportProfile = (OleDiscoveryExportProfile) document.getNewMaintainableObject().getDataObject();\n isValid &= validateForDuplicateMARCField(oleDiscoveryExportProfile);\n isValid &= validateForDuplicateItemField(oleDiscoveryExportProfile);\n return isValid;\n }", "protected abstract boolean onSave(CommitBuilder commit)\n throws IOException, ConfigInvalidException;", "public interface Offer {\n\n /**\n * Apply this offer to the given DiscountingContext\n * either the same context if we have not applied the offer\n * or a new context which reflects any new discounts applied\n * and required items used up\n * @param context\n * @return\n */\n DiscountingContext apply(DiscountingContext context);\n\n /**\n * Is this offer valid for the given date\n * @param date\n * @return true if it is valid false otherwise\n */\n boolean isValidForDate(LocalDate date);\n\n /**\n * Is this offer potentially valid for the given collection of items\n *\n * This is an opportunity to count ourselves out of the running\n * if the basket is missing a key component of the offer\n *\n * @param items\n * @return true if the offer is valid for the given set of items\n */\n boolean isValidForBasket(Collection<Item> items);\n\n}", "protected abstract List<Sentence> prepareSummary(Article article);", "int insertSelective(ArticleTag record);", "@Override\r\n\tprotected void onBoSave() throws Exception {\n\t\t\r\n\t\t\r\n\t\tsuper.onBoSave();\r\n\t\t// 修改按钮属性\r\n\t\tif(myaddbuttun){\r\n\t\t\tgetButtonManager().getButton(IBillButton.Add).setEnabled(true);\r\n\t\t\tgetButtonManager().getButton(\r\n\t\t\t\t\tnc.ui.wds.w8006080202.tcButtun.ITcButtun.Con)\r\n\t\t\t\t\t.setEnabled(true);\r\n\t\t\tgetButtonManager().getButton(\r\n\t\t\t\t\tnc.ui.wds.w8006080202.tcButtun.ITcButtun.Pp)\r\n\t\t\t\t\t.setEnabled(false);\r\n\t\t\tmyaddbuttun=true;\r\n\t\t\t// 转到卡片面,实现按钮的属性转换\r\n\t\t\tgetBillUI().setCardUIState();\r\n\t\t\tsuper.onBoReturn();\r\n\t\t}else{\r\n\t\t\tgetButtonManager().getButton(IBillButton.Add).setEnabled(false);\r\n\t\t\tgetButtonManager().getButton(\r\n\t\t\t\t\tnc.ui.wds.w8006080202.tcButtun.ITcButtun.Con)\r\n\t\t\t\t\t.setEnabled(false);\r\n\t\t\tgetButtonManager().getButton(\r\n\t\t\t\t\tnc.ui.wds.w8006080202.tcButtun.ITcButtun.Pp)\r\n\t\t\t\t\t.setEnabled(true);\r\n\t\t\tmyaddbuttun=false;\r\n\t\t\t// 转到卡片面,实现按钮的属性转换\r\n\t\t\tgetBillUI().setCardUIState();\r\n\t\t\tsuper.onBoReturn();\r\n\t\t}\r\n\t}", "@Override\n\tpublic void save(CorsoDiLaurea corso) {\n\t\t\n\t}", "@Override\n\tpublic <S extends Basket> List<S> save(Iterable<S> arg0) {\n\t\treturn null;\n\t}", "public boolean speichereArtikel(Artikel a) throws IOException {\n \n try {\n \n oos.writeObject(a);\n \n return true;\n \n } catch (IOException e) {\n \n return false;\n }\n \n \n }", "public void saveAll(Collection<Product> products);", "@Override\n public void save() {\n \n }", "private boolean AcquireNYArticles()\n {\n NYArticleLoader articleLoader = new NYArticleLoader(this);\n titles = articleLoader.AcquireAllTitles();\n publishDates = articleLoader.AcquireAllPublishedDates();\n authors = articleLoader.AcquireAllAuthors();\n\n if(titles.size() == 0 || publishDates.size() == 0 || authors.size() == 0)\n {\n Toast.makeText(this,\"Failed to load articles\", Toast.LENGTH_SHORT).show();\n return false;\n }\n else\n {\n return true;\n }\n }", "private void makeBag(final HashMap<Integer, Integer> legalGoods,\n final HashMap<Integer, Integer> illegalGoods) {\n if (!legalGoods.isEmpty()) {\n this.putLegalGoods(legalGoods);\n } else {\n this.putIllegalGood(illegalGoods);\n this.setDeclaredGood(0);\n }\n }", "public abstract void leerPersistencia();", "public static Result submit() {\n Pallet pallet = palletForm.bindFromRequest().get();\n SetOfArticle sOA = setOfArticleForm.bindFromRequest().get();\n pallet.setTimeEntrance(new Date());\n sOA.setPallet(pallet);\n Ebean.beginTransaction();\n try {\n pallet.getTag1().save();\n pallet.getTag2().save();\n pallet.save();\n sOA.save();\n Ebean.commitTransaction();\n } catch (PersistenceException e) {\n flash(\"danger\", \"Pallet couldn't be created.\");\n return badRequest(newForm.render(palletForm, setOfArticleForm));\n } finally {\n Ebean.endTransaction();\n }\n flash(\"success\", \"Pallet with IDs: \" + pallet.getTag1().getId()+ \", \" + pallet.getTag2().getId() +\n \" and \" + sOA.getAmount() + \" pieces of \" +\n Article.find.byId(sOA.getArticle().getId()).getName() + \" added to database!\");\n return redirect(controllers.routes.PalletView.list());\n }", "@BeforeClass public static void saveEnabled() {\n enabled = Item.EXTENDED_READ.getEnabled();\n }", "public MainItemOrdered save(MainItemOrdered mainItemOrdered);", "@Override\n public void save()\n {\n \n }", "public void save() {\n super.storageSave(listPedidosAssistencia.toArray());\n }", "void SaveBudgetKeyAdditional(BudgetKeyAdditionalEntity budgetKeyAdditionalEntity);", "public abstract boolean processSaveDocument(Document document);", "public boolean saveDietTreatment()\n {\n // check for empty elements\n validateDietTreatment(true);\n\n if (getErrors().getLength() > 0) return false;\n\n try\n {\n // set default treatment state\n _dietTreatment.setTreatmentState(_defaultState);\n\n HibernateUtil.currentSession().beginTransaction();\n DietTreatmentDAO dao = DAOFactory.getInstance()\n .getDietTreatmentDAO();\n dao.makePersistent(_dietTreatment.getModel());\n HibernateUtil.currentSession().getTransaction().commit();\n return true;\n }\n catch (HibernateException e)\n {\n LOG.error(\"Could not save diettreatment\", e);\n HibernateUtil.currentSession().getTransaction().rollback();\n return false;\n }\n }" ]
[ "0.5610241", "0.54518723", "0.5235617", "0.51539737", "0.5147993", "0.50872564", "0.5083981", "0.50445807", "0.5023662", "0.49780244", "0.49702287", "0.49584982", "0.49335268", "0.49208653", "0.49139953", "0.490096", "0.49002793", "0.48890278", "0.48764122", "0.48634726", "0.48609364", "0.48582748", "0.48560616", "0.4853757", "0.48397133", "0.48331234", "0.4832868", "0.48323846", "0.48148936", "0.48027995", "0.47984296", "0.4789471", "0.4777791", "0.47607252", "0.47564694", "0.47404096", "0.47143072", "0.47087136", "0.4702105", "0.46996456", "0.46958408", "0.46956867", "0.46911228", "0.46877354", "0.4687375", "0.4679418", "0.46792126", "0.4671899", "0.46688625", "0.46617165", "0.46605274", "0.46394765", "0.46379563", "0.46373484", "0.4629342", "0.4617093", "0.4616769", "0.46080613", "0.46055943", "0.4600216", "0.45986226", "0.45982984", "0.45949408", "0.45944726", "0.45905033", "0.45840198", "0.45791626", "0.45790744", "0.45750064", "0.45750064", "0.45719856", "0.45694432", "0.4567974", "0.45655903", "0.45647275", "0.4563204", "0.45599562", "0.45573285", "0.45461276", "0.45413196", "0.45411804", "0.4540146", "0.45382464", "0.45379746", "0.45327833", "0.4522755", "0.4517302", "0.45165813", "0.45165753", "0.4512496", "0.450689", "0.4506489", "0.45052198", "0.45047936", "0.45045888", "0.45041433", "0.4501882", "0.45001742", "0.44992018", "0.44987115", "0.4497486" ]
0.0
-1
Method to order the articles for analizing each one, so take the decisition of the articles bring in bag.
private List<Article> orderArticles(List<Article> things){ Comparator<Article> comparatorPrizes = new Comparator<Article>() { public int compare(Article x, Article y) { return (int) (x.getPrize() - y.getPrize()); } }; Collections.sort(things,comparatorPrizes); Collections.reverse(things); return things; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void sortEntities(){\n for (int i = 1; i < sorted.size; i++) {\n for(int j = i ; j > 0 ; j--){\n \tEntity e1 = sorted.get(j);\n \tEntity e2 = sorted.get(j-1);\n if(getRL(e1) < getRL(e2)){\n sorted.set(j, e2);\n sorted.set(j-1, e1);\n }\n }\n }\n }", "public String chooseArticlesPackage(Bag bag) {\n\t\t StringBuilder result = new StringBuilder();\n\t\t double countWeightBag=0;\n\t\t if(bag.getArticles() != null) {\n\t\t\t bag.setArticles(orderArticles(bag.getArticles()));\t\t \n\t\t int position=0;\n\t\t int countArticles = 0;\n\t\t while(countWeightBag<bag.getCapacity() \n\t\t \t\t && countWeightBag < Constants.MAXIMUN_WEIGHT_BAG\n\t\t \t\t && position < bag.getArticles().size()) {\n\t\t Article thing = bag.getArticles().get(position);\n\t\t if(countWeightBag + thing.getWeight() <= bag.getCapacity() \n\t\t \t\t && countArticles <= Constants.AMOUNT_MAXIMUN_ARTICLES_PER_BAG) {\n\t\t result.append(thing.getIndex()).append(Constants.COMMA);\n\t\t countWeightBag+=thing.getWeight();\n\t\t countArticles++;\t\t \n\t\t }\n\t\t position++;\n\t\t }\t\t \n\t\t }\n\t\t if(countWeightBag == 0) {\n\t \t result.append(Constants.LINE);\n\t }\n\t return result.toString();\n\t }", "public Artikel [] getArticles (Predicate<Artikel> predicate, BiPredicate<Artikel, Artikel> biPredicate){\n Artikel [] sortierteListe = new Artikel[getArtikelAnzahl()];\n int p = 0;\n for (int i = 0; i < key; i++) {\n if (predicate.test(getArtikel(i))) {\n sortierteListe[p] = getArtikel(i);\n p++;\n }\n }\n\n if(p > 1) {\n sortierteListe = sortieren(biPredicate, sortierteListe, p);\n }\n return sortierteListe;\n }", "public void orderByAscendantPrice() {\n\t\ttry {\n\t\t\t// Display the order list\n\t\t\tdiv_Order.click();\n\n\t\t\t// Select option order by ascendant price\n\t\t\ta_AscendantOption.click();\n\n\t\t\tList<WebElement> articleList = driver.findElements(by_ResultsArticles);\n\t\t\tDouble previousTotalArticle = null;\n\t\t\tfor (WebElement article : articleList) {\n\t\t\t\tDouble priceArticle;\n\t\t\t\tDouble totalArticle;\n\t\t\t\tString name = article.findElement(By.tagName(\"h3\")).getText();\n\t\t\t\tString price = article.findElement(By.xpath(\"ul/li[@class='lvprice prc']/span\")).getText();\n\n\t\t\t\tString shipping = null;\n\t\t\t\tDouble shippingArticle = 0.0;\n\t\t\t\tif (checkShippingElementExist(article)) {\n\t\t\t\t\tshipping = article.findElement(By.xpath(\"ul/li[@class='lvshipping']//span[@class='fee']\"))\n\t\t\t\t\t\t\t.getText();\n\t\t\t\t\tshippingArticle = getPriceNumber(shipping);\n\t\t\t\t}\n\n\t\t\t\tpriceArticle = getPriceNumber(price);\n\t\t\t\ttotalArticle = priceArticle + shippingArticle;\n\n\t\t\t\t// Assertions\n\t\t\t\tif (previousTotalArticle != null) {\n\t\t\t\t\tassertTrue(previousTotalArticle <= totalArticle);\n\t\t\t\t} else {\n\t\t\t\t\tassertTrue(0 < totalArticle);\n\t\t\t\t}\n\n\t\t\t\t// Print the first five results\n\t\t\t\tString infoArticle = String.format(\"The article %s has a total price of $%s\", name,\n\t\t\t\t\t\ttotalArticle.toString());\n\t\t\t\tSystem.out.println(infoArticle);\n\n\t\t\t\tpreviousTotalArticle = totalArticle;\n\t\t\t}\n\t\t} catch (Exception | AssertionError e) {\n\t\t\tString errorMessage = String.format(\"An error ocurred while ordering by ascendant price\", e.getMessage());\n\t\t\tthrow new Error(errorMessage);\n\t\t}\n\t}", "private void sortArticleByViews() {\n final DatabaseReference database;\n database = FirebaseDatabase.getInstance().getReference();\n\n database.child(\"Views\").addListenerForSingleValueEvent(new ValueEventListener() {\n @Override\n public void onDataChange(DataSnapshot dataSnapshot) {\n Map<Integer,ArrayList<Article>> articlesTreeMap;\n articlesTreeMap = new TreeMap<>(Collections.reverseOrder());\n for(Article a : articles) {\n DataSnapshot viewArticleSnapShot = null;\n for (DataSnapshot snapshot : dataSnapshot.getChildren()) {\n if (a.getLink() != null && a.getLink() != \"\" && snapshot.child(\"Link\").getValue().equals(a.getLink())) {\n viewArticleSnapShot = snapshot;\n break;\n }\n }\n int views = 0;\n if (viewArticleSnapShot != null) {\n views = Integer.parseInt(viewArticleSnapShot.child(\"Count\").getValue().toString());\n }\n if(!articlesTreeMap.containsKey(views)) {\n articlesTreeMap.put(views, new ArrayList<Article>());\n }\n articlesTreeMap.get(views).add(a);\n }\n\n articles.clear();\n for(Map.Entry<Integer,ArrayList<Article>> entry : articlesTreeMap.entrySet()) {\n ArrayList<Article> list = entry.getValue();\n articles.addAll(list);\n }\n mSectionsPagerAdapter.notifyDataSetChanged();\n }\n\n @Override\n public void onCancelled(DatabaseError d) {\n Log.d(\"Login DbError Msg ->\", d.getMessage());\n Log.d(\"Login DbError Detail ->\", d.getDetails());\n }\n });\n }", "public void sortKnowledgeBase()\n {\n int i;\n Random random;\n String aPredicate;\n StringTokenizer tokenizer;\n //------------\n random = new Random();\n i = 0;\n while (i < knowledgeBase.size())\n {\n aPredicate = knowledgeBase.get(i).commitments.get(0).predicate;\n tokenizer = new StringTokenizer(aPredicate,\"(), \");\n if(tokenizer.nextToken().equals(\"secuencia\"))\n knowledgeBase.get(i).priority = random.nextInt(100);\n //end if\n else\n knowledgeBase.get(i).priority = random.nextInt(10000);\n //end else\n i = i + 1;\n }//end while\n Collections.sort(knowledgeBase);\n }", "public void sortByBreed() {\n\t\tAnimalCompare animalCompare = new AnimalCompare();\n\t\tCollections.sort(animals, animalCompare);\n\t}", "private void sort() {\n\t\tCollections.sort(this.entities, comparator);\n\t}", "private void sortArticlesByRating() {\n final DatabaseReference database;\n database = FirebaseDatabase.getInstance().getReference();\n\n database.child(\"Ratings\").addListenerForSingleValueEvent(new ValueEventListener() {\n @Override\n public void onDataChange(DataSnapshot dataSnapshot) {\n Map<Double,ArrayList<Article>> articlesTreeMap;\n articlesTreeMap = new TreeMap<>(Collections.reverseOrder());\n for(Article a : articles) {\n DataSnapshot ratingArticleSnapShot = null;\n for (DataSnapshot snapshot : dataSnapshot.getChildren()) {\n if (a.getLink() != null && a.getLink() != \"\" && snapshot.child(\"Link\").getValue().equals(a.getLink())) {\n ratingArticleSnapShot = snapshot;\n break;\n }\n }\n Double rating = 0.0;\n if (ratingArticleSnapShot != null) {\n int totalVoteCount = 0, weightedSum = 0;\n for(int i=1 ;i<=5 ;i++) {\n int numberOfVotes = Integer.parseInt(ratingArticleSnapShot.child(\"Votes\").child(String.valueOf(i)).getValue().toString());\n weightedSum += (i * numberOfVotes);\n totalVoteCount += numberOfVotes;\n }\n rating = ((double) weightedSum) / ((double) totalVoteCount);\n }\n if(!articlesTreeMap.containsKey(rating)) {\n articlesTreeMap.put(rating, new ArrayList<Article>());\n }\n articlesTreeMap.get(rating).add(a);\n }\n\n articles.clear();\n for(Map.Entry<Double,ArrayList<Article>> entry : articlesTreeMap.entrySet()) {\n ArrayList<Article> list = entry.getValue();\n articles.addAll(list);\n }\n mSectionsPagerAdapter.notifyDataSetChanged();\n }\n\n @Override\n public void onCancelled(DatabaseError d) {\n Log.d(\"Login DbError Msg ->\", d.getMessage());\n Log.d(\"Login DbError Detail ->\", d.getDetails());\n }\n });\n }", "public void sortAuthor(){\r\n \r\n Book temp; // used for swapping books in the array\r\n for(int i=0; i<items.size(); i++) {\r\n\r\n\t // Check to see the item is a book. We will only\r\n //use books.\r\n\t if(items.get(i).getItemType() != Item.ItemTypes.BOOK)\r\n\t continue;\r\n\t\t\t\t\t\r\n\t for(int j=i+1; j<items.size(); j++) {\r\n\t\t // We consider only books\r\n\t // We consider only magazines\r\n\t if(items.get(j).getItemType() != Item.ItemTypes.BOOK)\r\n\t\t continue;\r\n\t\t // Compare the authors of the two books\r\n\t if(((Book)items.get(i)).getAuthor().compareTo(((Book)items.get(j)).getAuthor()) > 0) {\r\n\t\t // Swap the items\r\n\t\t temp = (Book)items.get(i);\r\n\t\t items.remove(i);\r\n\t\t items.add(i, items.get(j-1));\r\n\t\t items.remove(j);\r\n\t\t items.add(j, temp);\r\n\t }\r\n\t }\r\n\t }\r\n\t\t// Print the magazines\r\n for(int i=0; i<items.size(); i++)\r\n\t if(items.get(i).getItemType() == Item.ItemTypes.BOOK)\r\n\t\tSystem.out.println(items.get(i).toString());\r\n \t\r\n }", "private List<Article> sortTopics(Article queryTopic, List<Article>relatedTopics) throws Exception {\n for (Article art:relatedTopics) \n art.setWeight(_comparer.getRelatedness(art, queryTopic)) ;\n\n //Now that the weight attribute is set, sorting will be in descending order of weight.\n //If weight was not set, it would be in ascending order of id. \n Collections.sort(relatedTopics) ;\n return relatedTopics ;\n }", "public List<Artikel> getArtikelBestandSortiertNachArtikelnummer() {\n\t\tList<Artikel> ergebnis = new Vector<Artikel>();\n\t\tergebnis.addAll(artikelBestand);\n\t\tCollections.sort(ergebnis, new SortierungNachArtikelnummer());\n\t\treturn ergebnis;\n\t}", "public void orderMeal(ArrayList<Item> mealItems) {\r\n\r\n\r\n\r\n this.o.orderItem(new Meal(mealItems));\r\n }", "public void orderAlphabet(){\n market.orderAlphabet();\n car = market.products;\n }", "public void orderByDescendantPrice() {\n\t\ttry {\n\t\t\t// Display the order list\n\t\t\tdiv_Order.click();\n\n\t\t\t// Select option order by ascendant price\n\t\t\ta_DescendantOption.click();\n\n\t\t\tList<WebElement> articleList = driver.findElements(by_ResultsArticles);\n\t\t\tDouble previousTotalArticle = null;\n\t\t\tfor (WebElement article : articleList) {\n\t\t\t\tDouble priceArticle;\n\t\t\t\tDouble totalArticle;\n\t\t\t\tString name = article.findElement(By.tagName(\"h3\")).getText();\n\t\t\t\tString price = article.findElement(By.xpath(\"ul/li[@class='lvprice prc']/span\")).getText();\n\n\t\t\t\tString shipping = null;\n\t\t\t\tDouble shippingArticle = 0.0;\n\t\t\t\tif (checkShippingElementExist(article)) {\n\t\t\t\t\tshipping = article.findElement(By.xpath(\"ul/li[@class='lvshipping']//span[@class='fee']\"))\n\t\t\t\t\t\t\t.getText();\n\t\t\t\t\tshippingArticle = getPriceNumber(shipping);\n\t\t\t\t}\n\n\t\t\t\tpriceArticle = getPriceNumber(price);\n\t\t\t\ttotalArticle = priceArticle + shippingArticle;\n\n\t\t\t\t// Assertions\n\t\t\t\tif (previousTotalArticle != null) {\n\t\t\t\t\tassertTrue(previousTotalArticle >= totalArticle);\n\t\t\t\t} else {\n\t\t\t\t\tassertTrue(0 < totalArticle);\n\t\t\t\t}\n\n\t\t\t\t// Print the first five results\n\t\t\t\tString infoArticle = String.format(\"The article %s has a total price of $%s\", name,\n\t\t\t\t\t\ttotalArticle.toString());\n\t\t\t\tSystem.out.println(infoArticle);\n\n\t\t\t\tpreviousTotalArticle = totalArticle;\n\t\t\t}\n\t\t} catch (Exception | AssertionError e) {\n\t\t\tString errorMessage = String.format(\"An error ocurred while ordering by desscendant price\", e.getMessage());\n\t\t\tthrow new Error(errorMessage);\n\t\t}\n\t}", "List<Article> findTop4ByStatusOrderByClickDesc(Boolean status);", "public void filterArticles() {\n filterAgent.score(articles, filterType);\n articles = insertionSort(articles); // sorted articles list\n\n refreshTable();\n if (articles.size() > 0) {\n currentArt = (NewsArticle) articles.elementAt(0);\n }\n }", "Vector<NewsArticle> insertionSort(Vector<NewsArticle> articles) {\n int i, j;\n int size = articles.size();\n NewsArticle sortedList[] = new NewsArticle[articles.size()];\n\n articles.copyInto(sortedList);\n NewsArticle temp;\n\n for (i = 1; i < size; i++) {\n temp = sortedList[i];\n\n j = i;\n while ((j > 0) && (sortedList[j - 1].getScore(filterType) < temp.getScore(filterType))) {\n sortedList[j] = sortedList[j - 1];\n j = j - 1;\n }\n sortedList[j] = temp;\n }\n Vector<NewsArticle> outList = new Vector<NewsArticle>();\n\n for (i = 0; i < size; i++) {\n temp = sortedList[i];\n outList.addElement(temp);\n }\n return outList;\n }", "public void SortByPrice() {\n for (int i = 1; i < LastIndex; i++) {\n int x = i;\n while (x >= 1) {\n if (ForChild[x - 1].getPrice() > ForChild[x].getPrice()) {\n Confectionery sweets = ForChild[x - 1];\n ForChild[x - 1] = ForChild[x];\n ForChild[x] = sweets;\n\n }\n x -= 1;\n }\n }\n }", "private void processArticle(String rawArticleText, Article article, Context context) throws IOException, InterruptedException {\n if (!rawArticleText.trim().isEmpty()) {\n String[] splitSentences = rawArticleText.split(\"\\\\.\\\\s\");\n PriorityQueue<Sentence> sortedSentences = new PriorityQueue<>();\n\n for (int sentenceIndex = 0; sentenceIndex < splitSentences.length; sentenceIndex++) {\n String rawSentence = splitSentences[sentenceIndex];\n Double sentenceTfIdf = getSentenceTfIdf(rawSentence, article);\n sortedSentences.add(new Sentence(sentenceTfIdf, rawSentence, sentenceIndex));\n }\n\n String summary = topOrderedSentences(sortedSentences);\n context.write(new IntWritable(article.id), new Text(summary));\n }\n }", "public void sortElements(){\n\t\tgetInput();\n\t\tPeople[] all = countAndSort(people, 0, people.length-1);\n\t\t//PrintArray(all);\n\t\tSystem.out.println(InversionCount);\n\t}", "@Override\n\tpublic void placeOrder() {\n\t\t\n\t}", "public List<Artikel> getArtikelBestandSortiertNachBezeichnung() {\n\t\tList<Artikel> ergebnis = new Vector<Artikel>();\n\t\tergebnis.addAll(artikelBestand);\n\t\tCollections.sort(ergebnis, new SortierungNachBezeichnung());\n\t\treturn ergebnis;\n\t}", "public void sort()\n\t{\n\t\tfor(int i=0;i<bowlers.size()-1;i++)\n\t\t{\n\t\t\tfor(int j=i+1;j<bowlers.size();j++)\n\t\t\t{\n\t\t\t\tif(bowlers.get(i).getBall()<bowlers.get(j).getBall())\n\t\t\t\t{\n\t\t\t\t\tBowler bowler=bowlers.get(i);\n\t\t\t\t\tbowlers.set(i,bowlers.get(j));\n\t\t\t\t\tbowlers.set(j,bowler);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int i=0;i<bowlers.size();i++)\n\t\t{\n\t\tSystem.out.println(bowlers.get(i).getBall());\n\t\t}\n\t}", "public Artikel[] getSorted(BiPredicate<Artikel, Artikel> biPredicate){\n Artikel [] liste = new Artikel[key];\n int i = 0;\n for (Map.Entry<Integer, Artikel> integerArtikelEntry : lager.entrySet()) {\n liste[i] = integerArtikelEntry.getValue();\n i++;\n }\n\n //BubbleSort\n boolean sorted = false;\n Artikel temp;\n while (!sorted){\n sorted = true;\n for (i = 0; i < liste.length - 1; i++){\n if(biPredicate.test(liste[i], liste[i+1])){\n temp = liste[i];\n liste[i] = liste[i+1];\n liste[i+1] = temp;\n sorted = false;\n }\n }\n }\n return liste;\n }", "public void sortAscending()\r\n\t{\r\n\t\tList<Book> oldItems = items;\r\n\t\titems = new ArrayList<Book>(items);\r\n\t\tCollections.sort(items);\r\n\t\tfirePropertyChange(\"books\", oldItems, items);\r\n\t}", "private static List<MoneyLoss> sortLosses(Collection<MoneyLoss> unsortedLosses)\n {\n //Sort budget items first on frequency and then alphabetically\n ArrayList<MoneyLoss> oneTimeItems = new ArrayList<MoneyLoss>();\n ArrayList<MoneyLoss> dailyItems = new ArrayList<MoneyLoss>();\n ArrayList<MoneyLoss> weeklyItems = new ArrayList<MoneyLoss>();\n ArrayList<MoneyLoss> biweeklyItems = new ArrayList<MoneyLoss>();\n ArrayList<MoneyLoss> monthlyItems = new ArrayList<MoneyLoss>();\n ArrayList<MoneyLoss> yearlyItems = new ArrayList<MoneyLoss>();\n\n for (MoneyLoss loss : unsortedLosses)\n {\n switch (loss.lossFrequency())\n {\n case oneTime:\n {\n oneTimeItems.add(loss);\n break;\n }\n case daily:\n {\n dailyItems.add(loss);\n break;\n }\n case weekly:\n {\n weeklyItems.add(loss);\n break;\n }\n case biWeekly:\n {\n biweeklyItems.add(loss);\n break;\n }\n case monthly:\n {\n monthlyItems.add(loss);\n break;\n }\n case yearly:\n {\n yearlyItems.add(loss);\n break;\n }\n }\n }\n\n Comparator<MoneyLoss> comparator = new Comparator<MoneyLoss>() {\n @Override\n public int compare(MoneyLoss lhs, MoneyLoss rhs) {\n return lhs.expenseDescription().compareTo(rhs.expenseDescription());\n }\n };\n\n Collections.sort(oneTimeItems, comparator);\n Collections.sort(dailyItems, comparator);\n Collections.sort(weeklyItems, comparator);\n Collections.sort(biweeklyItems, comparator);\n Collections.sort(monthlyItems, comparator);\n Collections.sort(yearlyItems, comparator);\n\n ArrayList<MoneyLoss> sortedItems = new ArrayList<MoneyLoss>();\n BadBudgetApplication.appendItems(sortedItems, oneTimeItems);\n BadBudgetApplication.appendItems(sortedItems, dailyItems);\n BadBudgetApplication.appendItems(sortedItems, weeklyItems);\n BadBudgetApplication.appendItems(sortedItems, biweeklyItems);\n BadBudgetApplication.appendItems(sortedItems, monthlyItems);\n BadBudgetApplication.appendItems(sortedItems, yearlyItems);\n\n return sortedItems;\n }", "public void triCollection(){\r\n Collections.sort(collection);\r\n }", "public void sort() {\n documents.sort();\n }", "public void sortYear(){\r\n\r\n\t\t// sort magazines by year inside the items array\r\n Magazine temp; // used for swapping magazines in the array\r\n\t for(int i=0; i<items.size(); i++) {\r\n\r\n\t\t// Check to see the item is a magazine. We will only\r\n\t\t//use magazines.\r\n\t if(items.get(i).getItemType() != Item.ItemTypes.MAGAZINE)\r\n\t continue;\r\n\t\t\t\r\n\t for(int j=i+1; j<items.size(); j++) {\r\n\t\t // We consider only magazines\r\n\t if(items.get(j).getItemType() != Item.ItemTypes.MAGAZINE)\r\n\t\t continue;\r\n\t\t // Compare the years of the two magazines\r\n\t if(((Magazine)items.get(i)).getYear() < \r\n\t \t((Magazine)items.get(j)).getYear()) {\r\n\t\t // Swap the items\r\n\t\t temp = (Magazine)items.get(i);\r\n\t\t items.remove(i);\r\n\t\t items.add(i, items.get(j-1));\r\n\t\t items.remove(j);\r\n\t\t items.add(j, temp);\r\n\t }\r\n\t }\r\n\t }\r\n\t\t// Print the magazines\r\n\t\tfor(int i=0; i<items.size(); i++)\r\n\t\t\tif(items.get(i).getItemType() == Item.ItemTypes.MAGAZINE)\r\n\t\t\t\tSystem.out.println(items.get(i).toString());\r\n }", "private void sortSongs(Context context)\n {\n boolean foundArtist;\n for (Song song : songs)\n {\n foundArtist = false;\n for (Artist artist : artists)\n {\n if (song.artistName.equals(artist.name))\n {\n artist.addSong(song);\n foundArtist = true;\n break;\n }\n }\n if (!foundArtist)\n artists.add(new Artist(song));\n }\n\n //sorts all songs\n sortSongs(songs);\n\n //sort artists\n sortArtists(artists);\n\n //sort albums, songs and set cover\n for (Artist artist : artists)\n {\n //albums\n sortAlbums(artist.albums);\n\n for (Album album : artist.albums)\n {\n //sort album songs\n sortSongs(album.songs);\n\n //set cover\n album.cover = ImageLoader.getAlbumart(context, album.songs.get(0).albumId);\n }\n }\n }", "public void sortBySize() {\n\t\tCollections.sort(animals);\n\t}", "public List<Article> processAllArticles(List<ArticleGeneral> allArticles) {\n\t\t\tDocument document;\n\t\t\tList<Article> articles = new ArrayList<Article>();\n\t\t\tfor (ArticleGeneral articleGeneral : allArticles) {\n\t\t\t\tdocument = connectToPage(articleGeneral.getLink());\n\t\t\t\tString nameItem = getNameOfArticle(document);\n\t\t\t\tString color = getColorOfArticle(document);\n\t\t\t\tString price = getPriceOfArticle(document);\n\t\t\t\tList<String> sizes = getSizesOfArticle(document);\n\t\t\t\tboolean isSoldOut = true;\n\t\t\t\tif (!sizes.isEmpty()) {\n\t\t\t\t\tisSoldOut = false;\n\t\t\t\t}\n\t\t\t\tString link = document.baseUri();\n\t\t\t\tArticle article = new Article(nameItem, color, price, sizes, isSoldOut, link);\n\t\t\t\tarticles.add(article);\n\t\t\t\tSystem.out.println(document.select(\"h1\"));\n\t\t\t}\n\t\t\treturn articles;\n\t}", "public void sortCompetitors(){\n\t\t}", "private void sortMedApts(List<MedicationAppointment> medApts2) {\n \t}", "public void diaryArticleInflater() {\r\n\r\n\t\tArticleInflater ap = new ArticleInflater();\r\n\t\tfor (int i = 0; i < this.diaries.size(); i++) {\r\n\t\t\tDiary diary = this.diaries.get(i);\r\n\t\t\tList<String> urlsList = diary.getUrls();\r\n\t\t\tfor (int j = 0; j < urlsList.size(); j++) {\r\n\t\t\t\tArticle article = ap.run(urlsList.get(j), diary);\r\n\t\t\t\tarticles.add(article);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tap.close();\r\n\t}", "int order();", "public void ordenarHabitantesAsc() {\r\n Collections.sort(ciudades, new HabitantesComparator());\r\n }", "protected abstract List<Sentence> prepareSummary(Article article);", "@Override\n public void loadArticles() {\n mUserArticlesDownloaded = false;\n mGroupArticlesDownloaded = false;\n\n //to load user articles\n loadUserArticles();\n\n Log.d(TAG, \"loadArticles: \" + UserManager.getInstance().getUserData().getGroupNow());\n //to load group articles if exist\n if (!UserManager.getInstance().getUserData().getGroupNow().equals(\"\")) {\n loadGroupArticles();\n } else {\n mGroupArticlesDownloaded = true;\n }\n }", "void sortEntities(ArrayList<Entity> entities){\n Collections.sort(entities, new Comparator<Entity>() {\n @Override\n public int compare(Entity e1, Entity e2) {\n if(e1.getCollisionBox().bottom < e2.getCollisionBox().bottom) return -1;\n else if(e1.getCollisionBox().bottom == e2.getCollisionBox().bottom) return 0;\n else return 1;\n }\n });\n }", "public void sort(){\n\t\tCollections.sort(_ligacoes, (new Comparator<Ligacao>() {\n\t\t\t@Override\n\t\t\tpublic int compare(Ligacao l1, Ligacao l2){\n\t\t\t\tint resultado = Integer.compare(l1.getCusto(), l2.getCusto());\n\t\t\t\tif (resultado == 0)\n\t\t\t\t\tresultado = Boolean.compare(l1.isAerea(), l2.isAerea());\n\t\t\t\treturn resultado;\n\t\t\t}\n\t\t}));\n\t}", "public void createSummary(){\n\n for(int j=0;j<=noOfParagraphs;j++){\n int primary_set = paragraphs.get(j).sentences.size()/5;\n\n //Sort based on score (importance)\n Collections.sort(paragraphs.get(j).sentences,new SentenceComparator());\n for(int i=0;i<=primary_set;i++){\n contentSummary.add(paragraphs.get(j).sentences.get(i));\n }\n }\n\n //To ensure proper ordering\n Collections.sort(contentSummary,new SentenceComparatorForSummary());\n printSummary();\n }", "private static void populateArtworkSorts() {\r\n if (artworkSorts.isEmpty()) {\r\n artworkSorts.add(SORT_FAV_ASC);\r\n artworkSorts.add(SORT_FAV_DESC);\r\n artworkSorts.add(SORT_NAME_ASC);\r\n artworkSorts.add(SORT_NAME_DESC);\r\n }\r\n }", "Ordering<Part> getOrdering();", "@Override\n\tpublic void sortDeck() {\n\t\tfor(int i = 0; i < getCount() - 1; i++) {\n\t\t\tfor(int j = i + 1; j < getCount(); j++) {\n\t\t\t\tif(aktuellesDeck[i].compareTo(aktuellesDeck[j]) == 1) {\n\t\t\t\t\tSkatCard speicherCard = new SkatCard(aktuellesDeck[i].getSuit(), aktuellesDeck[i].getRank());\n\t\t\t\t\taktuellesDeck[i] = null;\n\t\t\t\t\taktuellesDeck[i] = new SkatCard(aktuellesDeck[j].getSuit(), aktuellesDeck[j].getRank());\n\t\t\t\t\taktuellesDeck[j] = null;\n\t\t\t\t\taktuellesDeck[j] = new SkatCard(speicherCard.getSuit(), speicherCard.getRank());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t\n\t}", "private void sortOutlines() {\r\n Collections.sort(outlines, reversSizeComparator);\r\n }", "@Override\n public void sort() {\n int cont = 0;\n int mov = 0;\n for (int i = 0; i < (100 - 1); i++) {\n int menor = i;\n for (int j = (i + 1); j < 100; j++){\n if (array[menor] > array[j]){\n cont= cont + 1;\n menor = j;\n mov = mov + 1;\n }\n }\n swap(menor, i);\n mov = mov + 3;\n }\n System.out.println(cont + \" comparações\");\n System.out.println(mov + \" Movimenteções\");\n }", "@Override\n public void sort(IAlg algorithm, boolean decrescent){}", "public void sortGivenArray_popularity() { \n int i, j, k; \n for(i = movieList.size()/2; i > 0; i /= 2) {\n for(j = i; j < movieList.size(); j++) {\n Movie key = movieList.get(j);\n for(k = j; k >= i; k -= i) {\n if(key.rents > movieList.get(k-i).rents) {\n movieList.set(k, movieList.get(k-i));\n } else {\n break; \n }\n }\n movieList.set(k, key);\n }\n } \n }", "public void sort() {\r\n // sort the process variables\r\n Arrays.sort(pvValues, categoryComparator);\r\n fireTableDataChanged();\r\n }", "public void shuffleItems() {\n LoadProducts(idCategory);\n }", "private void blendInArtificialOrderings(Collection<ScreenshotImportMetadatas> metadatas) {\n metadatas.forEach(this::blendInArtificialOrderings);\n }", "private void prepareAlbums() {\n int[] images = new int[]{\n R.drawable.book4,\n R.drawable.banner1,\n R.drawable.book2,\n R.drawable.book1,\n R.drawable.banner2,\n R.drawable.book3,\n R.drawable.banner3,\n R.drawable.book4,\n R.drawable.banner4,\n R.drawable.book2,\n R.drawable.book1,\n };\n\n News a = new News(\"Kejriwal calls Delhi 'gas chamber' as air pollution hits severe levels, visibility down to 200m.\", images[0]);\n newsList.add(a);\n\n a = new News(\"Recovery of US-made rifle shows Pak complicity in Kashmir militancy: Army\", images[1]);\n newsList.add(a);\n\n a = new News(\"The recovery of US-made rifle, meant for Pakistani army\", images[2]);\n newsList.add(a);\n\n a = new News(\"This weapon (the M4 carbine) is with the special forces of Pakistan army. \", images[3]);\n newsList.add(a);\n\n a = new News(\"A police spokesperson said that it was the same group\", images[4]);\n newsList.add(a);\n\n a = new News(\"This weapon (the M4 carbine) is with the special forces of Pakistan army. \", images[5]);\n newsList.add(a);\n\n a = new News(\"A police spokesperson said that it was the same group\", images[6]);\n newsList.add(a);\n\n a = new News(\"he three slain militants killed on Monday night were identified as Waseem Ganaie\", images[7]);\n newsList.add(a);\n\n a = new News(\"he three slain militants killed on Monday night were identified as Waseem Ganaie\", images[8]);\n newsList.add(a);\n\n a = new News(\"A police spokesperson said that it was the same group\", images[9]);\n newsList.add(a);\n\n adapter.notifyDataSetChanged();\n }", "public void sort() {\r\n\t\tCollections.sort(parts);\r\n\t}", "public void calculatePriceOrder() {\n log.info(\"OrdersBean : calculatePriceOrder!\");\n this.priceOrder = 0;\n for (ContractsEntity c : contractsBean.getContractsEntities()\n ) {\n this.priceOrder += c.getFinalPrice();\n }\n }", "void order() {\n\n\t\tSystem.out.println(\"In Zomato order method\");\n\t\tclass Hotels {\n\t\t\tString name;\n\t\t\tHotels(String name ) {\n\t\t\t\tthis.name = name;\n\t\t\t}\n\n\t\t\tvoid orderPlaced() {\n\t\t\t\tSystem.out.println(\"Order placd at hotel \"+ name);\n\t\t\t}\n\t\t}\n\t}", "public void setupArticlesList();", "public void sortByTagCount() {\r\n this.addSortField(\"\", \"*\", SORT_DESCENDING, \"count\");\r\n }", "private static void sortSlidesByNumberTags() {\n\t\tCollections.sort(slideList, new Comparator<Slide>() {\n\t\t\tpublic int compare(Slide s1, Slide s2) {\n\n\t\t\t\tInteger sS1 = s1.getTagList().size();\n\t\t\t\tInteger sS2 = s2.getTagList().size();\n\n\t\t\t\tint sComp = sS1.compareTo(sS2);\n\n\t\t\t\treturn -1 * sComp;\n\t\t\t}\n\t\t});\n\t}", "public void orderItem(Item i) {\r\n\r\n\r\n\r\n this.o.orderItem(i);\r\n\r\n }", "private void sortAlphabet()\n {\n for(int i = 0; i < movieList.size(); i++){\n for(int j = 1; j < movieList.size() - i; j++)\n {\n Movie a = movieList.get(j-1);\n Movie b = movieList.get(j);\n int result = a.getTitle().compareTo(b.getTitle());\n if(result > 0)\n {\n movieList.set(j-1, b);\n movieList.set(j, a);\n }\n }\n }\n }", "@Override\n\tpublic void sortir() {\n\t\tif (!estVide()) {\n\t\t\tTC next = getProchain();\t\t\t\t//On recupere le prochain\n\t\t\tsalle.get(next.getPrio()).remove(next);\t//Antinomie de entrer\n\t\t}\n\t}", "private static void sortNoun() throws Exception{\r\n\t\tBufferedReader[] brArray = new BufferedReader[ actionNumber ];\r\n\t\tBufferedWriter[] bwArray = new BufferedWriter[ actionNumber ];\r\n\t\tString line = null;\r\n\t\tfor(int i = 0; i < actionNameArray.length; ++i){\r\n\t\t\tSystem.out.println(\"sorting for \" + actionNameArray[ i ]);\r\n\t\t\tbrArray[ i ] = new BufferedReader( new FileReader(TFIDF_URL + actionNameArray[ i ] + \".tfidf\"));\r\n\t\t\tHashMap<String, Double> nounTFIDFMap = new HashMap<String, Double>();\r\n\t\t\tint k = 0;\r\n\t\t\t// 1. Read tfidf data\r\n\t\t\twhile((line = brArray[ i ].readLine())!=null){\r\n\t\t\t\tnounTFIDFMap.put(nounList.get(k), Double.parseDouble(line));\r\n\t\t\t\tk++;\r\n\t\t\t}\r\n\t\t\tbrArray[ i ].close();\r\n\t\t\t// 2. Rank according to tfidf\r\n\t\t\tValueComparator bvc = new ValueComparator(nounTFIDFMap);\r\n\t\t\tTreeMap<String, Double> sortedMap = new TreeMap<String, Double>(bvc);\r\n\t\t\tsortedMap.putAll(nounTFIDFMap);\r\n\t\t\t\r\n\t\t\t// 3. Write to disk\r\n\t\t\tbwArray[ i ] = new BufferedWriter(new FileWriter( SORTED_URL + actionNameArray[ i ] + \".sorted\"));\r\n\t\t\tfor(String nounKey : sortedMap.keySet()){\r\n\t\t\t\tbwArray[ i ].append(nounKey + \"\\t\" + nounTFIDFMap.get(nounKey) + \"\\n\");\r\n\t\t\t}\r\n\t\t\tbwArray[ i ].close();\r\n\t\t}\r\n\t}", "private void sort(int inicio, int fim){\n\t\tint tamanho = fim - inicio + 1;\n\t\tif(tamanho==1) return;\n\t\tint metade = inicio + tamanho/2;\n\t\tsort(inicio, metade-1);\n\t\tsort(metade, fim);\n\t\tmerge(inicio,metade-1,metade,fim);\n\t}", "protected void arrangeBestOrder ()\n \t{\n \t\tObject[] duplLoans = null;\n \t\ttry\n \t\t{\n \t\t\tduplLoans = theLoanList.popFirstDuplicates();\n \t\t}\n \t\tcatch (NoSuchElementException ex)\n \t\t{\n \t\t\tlog.error(\"The list of duplicate loan lists is empty\");\n \t\t\treturn;\n \t\t}\n \n \t\tDuplicateLoanDataVO bestSourceLoan = null;\n \t\tDuplicateLoanDataVO firstDataVO = null;\n \t\tDuplicateLoanDataVO nextDataVO = null;\n \t\tString xmlValue = null;\n \t\tString apsId1 = null;\n \t\tString providerType1 = null;\n \t\tString apsId2 = null;\n \t\tString providerType2 = null;\n \n \t\tfor (int ndx = 1; ndx < duplLoans.length; ndx++)\n \t\t{\n \t\t\tfirstDataVO = (DuplicateLoanDataVO)duplLoans[0];\n \t\t\tnextDataVO = (DuplicateLoanDataVO)duplLoans[ndx];\n \n \t\t\tapsId1 = firstDataVO.getAwardId();\n \t\t\tproviderType1 = firstDataVO.getProviderType();\n \t\t\tapsId2 = nextDataVO.getAwardId();\n \t\t\tproviderType2 = nextDataVO.getProviderType();\n \n \t\t\tif (apsId1 == null)\n \t\t\t{\n \t\t\t\tapsId1 = XMLParser.getNodeValue(firstDataVO.getDocument(), \"APSUniqueAwardID\");\n \t\t\t\tfirstDataVO.setAwardId(apsId1);\n \t\t\t}\n \n \t\t\tif (providerType1 == null)\n \t\t\t{\n \t\t\t\tproviderType1 = XMLParser.getNodeValue(firstDataVO.getDocument(), \"DataProviderType\");\n \t\t\t\tfirstDataVO.setProviderType(providerType1);\n \t\t\t}\n \n \t\t\tif (apsId2 == null)\n \t\t\t{\n \t\t\t\tapsId2 = XMLParser.getNodeValue(nextDataVO.getDocument(), \"APSUniqueAwardID\");\n \t\t\t\tnextDataVO.setAwardId(apsId2);\n \t\t\t}\n \n \t\t\tif (providerType2 == null)\n \t\t\t{\n \t\t\t\tproviderType2 = XMLParser.getNodeValue(nextDataVO.getDocument(), \"DataProviderType\");\n \t\t\t\tnextDataVO.setProviderType(providerType2);\n \t\t\t}\n \n \t\t\tif (log.isDebugEnabled())\n \t\t\t{\n \t\t\t\tlog.debug(\"Comparing Award ID: \" + apsId1 + \" with provider type '\" + providerType1 +\n \t\t\t\t \"' to Award ID: \" + apsId2 + \" with provider type '\" + providerType2 + \"' \");\n \t\t\t}\n \n \t\t\tbestSourceLoan = determineBestSource(firstDataVO, nextDataVO);\n \t\t\tif (bestSourceLoan != null && bestSourceLoan == nextDataVO)\n \t\t\t{\n \t\t\t\t// we need to rearrange things so that the \"best\" is at\n \t\t\t\t// the \"head\" of the array (element 0).\n \n \t\t\t\tDuplicateLoanDataVO best = (DuplicateLoanDataVO)duplLoans[ndx];\n \t\t\t\tduplLoans[ndx] = duplLoans[0];\n \t\t\t\tduplLoans[0] = best;\n \n \t\t\t\tif (log.isDebugEnabled())\n \t\t\t\t{\n \t\t\t\t\tString apsId = nextDataVO.getAwardId();\n \t\t\t\t\tString providerType = nextDataVO.getProviderType();\n \t\t\t\t\tlog.debug(\"Award ID: \" + apsId + \" with provider type '\" + providerType + \"' is now the 'best' source\");\n \t\t\t\t}\n \t\t\t}\n \t\t\telse\n \t\t\t{\n \t\t\t\tif (log.isDebugEnabled())\n \t\t\t\t{\n \t\t\t\t\tString apsId = firstDataVO.getAwardId();\n \t\t\t\t\tString providerType = firstDataVO.getProviderType();\n \t\t\t\t\tlog.debug(\"Award ID: \" + apsId + \" with provider type '\" + providerType + \"' is still the 'best' source\");\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\ttheLoanList.pushLastDuplicates(duplLoans);\n \t}", "private void setVoteOrder() {\n\t\tfor (int i = 1; i < temp.size(); i++) {\n\t\t\t// deleting the comma from the name\n\t\t\tString s = temp.elementAt(i).replaceAll(\",\", \"\");\n\t\t\t// creating a vector \"tempVoteOrder\" to store the preferences of\n\t\t\t// each voter\n=======\n\t\t\tCandidats.add(candidat);\n\t\t\ttempCandidats = tempCandidats.replaceFirst(\n\t\t\t\t\ttempCandidats.substring(0, tempCandidats.indexOf(\",\") + 1),\n\t\t\t\t\t\"\");// delete the first candidat in the String\n\t\t}\n\t\tfor (int j = 0; j < Candidats.size(); j++)\n\t\t\tCandidats.elementAt(j).setVowsPerRound(Candidats.size());// fill the\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// vector\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// of\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// size\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// \"candidats\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// by\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// 0's\n\t}", "void sort()\n {\n Card.arraySort(cards, topCard);\n }", "public void sortareDesc(List<Autor> autoriList){\n\t\tboolean ok;\t\t\t\t \n\t\tdo { \n\t\t ok = true;\n\t\t for (int i = 0; i < autoriList.size() - 1; i++)\n\t\t if (autoriList.get(i).getNrPublicatii() < autoriList.get(i+1).getNrPublicatii()){ \n\t\t \t Autor aux = autoriList.get(i);\t\t//schimbarea intre autori\n\t\t \t Autor aux1 = autoriList.get(i+1);\t\n\t\t \t try {\n\t\t \t\t \trepo.schimbareAutori(aux,aux1);\n\t\t\t } catch (Exception e) {\n\t\t\t System.out.println(e.getMessage());\n\t\t\t }\n\t\t\t\t ok = false;\n\t\t\t}\n\t\t}\n\t while (!ok);\n\t }", "private void updateOrder() {\n Arrays.sort(positions);\n }", "public void ordenaArray(){\t\t\n\t\tCollections.sort(anos, new Comparator<Integer>(){\n\t\t\t@Override\n\t\t\tpublic int compare(Integer ano1, Integer ano2) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn ano1.compareTo(ano2);\n\t\t\t}\n\t\t});\n\t}", "private void sortDice() {\r\n for (int index = 0; index < dice.size(); index++) {\r\n for (int subIndex = index; subIndex < dice.size(); subIndex++) {\r\n if (dice.get(subIndex).compareTo((dice.get(index))) > 0) {\r\n final Integer temp = dice.get(index);\r\n dice.set(index, dice.get(subIndex));\r\n dice.set(subIndex, temp);\r\n }\r\n }\r\n }\r\n }", "public void sortByAndser() {\r\n\t\tQuestion[][] question2DArray = new Question[displayingList.size()][];\r\n\t\tfor (int i = 0; i < displayingList.size(); i++) {\r\n\t\t\tquestion2DArray[i] = new Question[1];\r\n\t\t\tquestion2DArray[i][0] = displayingList.get(i);\r\n\t\t}\r\n\r\n\t\twhile (question2DArray.length != 1) {\r\n\t\t\tquestion2DArray = (Question[][]) merge2DArray(question2DArray);\r\n\t\t}\r\n\t\tdisplayingList.removeAll(displayingList);\r\n\t\tfor (int i = 0; i < question2DArray[0].length; i++) {\r\n\t\t\tdisplayingList.add(question2DArray[0][i]);\r\n\t\t}\r\n\t}", "public ArrayList<Producto> getProductosOrdenados(ArrayList<Producto> productosEncontrados,Cliente comprador) {\n \n //Comparador para ordenar los productos por su urgencia y proximidad\n\n ArrayList <Producto> productosOrdenados=new ArrayList<>();\n ArrayList <Producto> muyCerca = new ArrayList<>();\n ArrayList <Producto> cerca = new ArrayList<>();\n ArrayList <Producto> lejos = new ArrayList<>();\n String codigoPostalComprador = comprador.getUbicacion().getCodigoPostal();\n String codigoPostalProducto;\n Comparator porUrgencia = new Comparator() { \n public int compare(Object o1, Object o2) {\n\n\n Producto p1 = (Producto)o1;\n Producto p2 = (Producto)o2;\n\n String bool1;\n String bool2;\n if(p1.getUrgente()){\n bool1=\"0\";\n }else{\n bool1=\"1\";\n }\n if(p2.getUrgente()){\n bool2=\"0\";\n }else{\n bool2=\"1\";\n }\n\n String b1 = bool1;\n String b2 = bool2; \n return b1.compareTo(b2);\n }\n };\n\n for(Producto cadaProducto : productosEncontrados){\n codigoPostalProducto=cadaProducto.getUbicacionCliente().getCodigoPostal();\n if(codigoPostalComprador.substring(0, 3).equalsIgnoreCase(codigoPostalProducto.substring(0, 3))){\n muyCerca.add(cadaProducto);\n }else{\n if(codigoPostalComprador.substring(0, 2).equalsIgnoreCase(codigoPostalProducto.substring(0, 2))){\n cerca.add(cadaProducto);\n }else{\n lejos.add(cadaProducto);\n }\n }\n\n }\n if(muyCerca.size()>0){ \n Collections.sort(muyCerca,porUrgencia);\n productosOrdenados.addAll(muyCerca);\n }\n if(cerca.size()>0){\n Collections.sort(cerca,porUrgencia);\n productosOrdenados.addAll(cerca);\n } \n if(lejos.size()>0){\n Collections.sort(lejos,porUrgencia);\n productosOrdenados.addAll(lejos);\n }\n return productosOrdenados;\n \n \n }", "@Override\r\n\tpublic void addSort() {\n\t\t\r\n\t}", "public void sort() {\n }", "public void articles() throws Exception\r\n\t{\r\n\t\tCommonMethods.wait(driver,articles);\r\n\t\tCommonMethods.click(articles);\r\n\t\tCommonMethods.wait(driver,read);\r\n\t\tCommonMethods.click(read);\r\n\t\tCommonMethods.wait(driver,allArticles);\r\n\t\tCommonMethods.click(allArticles);\r\n\t}", "@Override\n\tpublic void inorder() {\n\n\t}", "protected void processOrder( Game game )\n {\n }", "public static WordFrq[] sort(WordFrq b[]){\n WordFrq temp;\n int i=0;\n while (i < 3) {\n for (i = 1; i < 3; i++) {\n if (b[i-1].count > b[i].count) {\n temp = b[i];\n b[i] = b[i-1];\n b[i-1] = temp;\n break;\n }\n }\n }\n\n\n return b;\n\n\n\n\n\n }", "public void sortieBloc() {\n this.tableLocaleCourante = this.tableLocaleCourante.getTableLocalPere();\n }", "public List<Idea> allIdeasLikersAsc() {\n\n List<Idea> ideas = ideaRepo.findAll();\n\n ideas.sort(new Comparator<Idea>() {\n @Override\n public int compare(Idea i1, Idea i2) {\n if(i1.getLikers().size() == i2.getLikers().size()){\n return 0;\n }\n return i1.getLikers().size() < i2.getLikers().size() ? -1 : 1;\n }\n });\n\n return ideas;\n\n }", "public void RearrangeItems() {\n Collections.shuffle(images, new Random(System.currentTimeMillis()));\n Collections.shuffle(text, new Random(System.currentTimeMillis()));\n Adapter adapter = new Adapter(MainActivity.this, images, text);\n recyclerView.setAdapter(adapter);\n }", "@Override\n public int compare(Item i1,Item i2){\n return i2.mark.compareTo(i1.mark);\n\n // return i1.mark.compareTo(i2,mark);\n //This is the ascending version of the same.\n }", "public void sort()\n {\n\tstrack.sort((Node n1, Node n2) ->\n\t{\n\t if (n1.getCost() < n2.getCost()) return -1;\n\t if (n1.getCost() > n2.getCost()) return 1;\n\t return 0;\n\t});\n }", "public void sort(){\n ArrayList<Card> sortedCards = new ArrayList<Card>();\n ArrayList<Card> reds = new ArrayList<Card>();\n ArrayList<Card> yellows = new ArrayList<Card>();\n ArrayList<Card> greens = new ArrayList<Card>();\n ArrayList<Card> blues = new ArrayList<Card>();\n ArrayList<Card> specials = new ArrayList<Card>();\n for(int i = 0; i < cards.size(); i++){\n if(cards.get(i).getColor() == RED){\n reds.add(cards.get(i));\n }else if(cards.get(i).getColor() == YELLOW){\n yellows.add(cards.get(i));\n }else if(cards.get(i).getColor() == GREEN){\n greens.add(cards.get(i));\n }else if(cards.get(i).getColor() == BLUE){\n blues.add(cards.get(i));\n }else if(cards.get(i).getColor() == ALL){\n specials.add(cards.get(i));\n }\n }\n cards = new ArrayList<Card>();\n for(Card c: reds){\n sortedCards.add(c);\n }\n for(Card c: yellows){\n sortedCards.add(c);\n }\n for(Card c: greens){\n sortedCards.add(c);\n }\n for(Card c: blues){\n sortedCards.add(c);\n }\n for(Card c: specials){\n sortedCards.add(c);\n }\n for(Card c: sortedCards){\n cards.add(c);\n }\n }", "public void ordenarAdyacenciasPorPeso() {\n\t\tfor(int i = 1; i <= cantNodos; i++) {\n\t\t\tCollections.sort(adyacencias[i], new PesoNodoComparator(pesoNodos));\n\t\t}\n\t}", "public void printAlphabetically() {\n if (getAnimals().size() > 0) {\n System.out.println(\"======== Animals sorted alphabetically ========\");\n getAnimals().stream()\n .sorted(Comparator.comparing(Animal::getName)).collect(Collectors.toList())\n .forEach(animal -> System.out.println(printDetails(animal)));\n System.out.println(\"================================== =-_-= ======\");\n } else {\n System.out.println(\"Nothing to print\");\n }\n }", "public void automerge() {\n\t\tif (automerge) {\n\t\t\tfor(int i = 0; i<create_modifier+1;i++) {\n\t\t\t\tmerge();\n\t\t\t}\n\t\tif(autoidentify) {\n\t\t\tauto_identify_crystal(autoIdentifyTier); // replace this eventually\n\t\t}\n\t\t\t//collection();\n\t\t}\n\t}", "public static void main(String[] args) {\n String [] folge = {\"ab\",\"cd\", \"aa\"};\n new SortierenBeiEinfugen().sortiereAbsteigend(folge);\n System.out.println(Arrays.toString(folge));\n new SortierenBeiEinfugen().sortiereAufsteigend(folge);\n System.out.println(Arrays.toString(folge));\n\n\n\n\n\n\n int[] feld = {2,8,5,6,3,1,4,7};\n\n int countVergleich=0;\n int countTausch = 0;\n for (int i = 0; i < feld.length; i++) {\n for (int j = i; j > 0 ; j--) {\n countVergleich++;\n if (feld[j - 1]>(feld[j]) ) {\n int temp = feld[j];\n feld[j] = feld[j - 1];\n feld[j - 1] = temp;\n countTausch++;\n } else {\n System.out.println(countVergleich);\n System.out.println(countTausch);\n break;\n }\n }\n }\n }", "public void sortDescending()\r\n\t{\r\n\t\tList<Book> oldItems = items;\r\n\t\titems = new ArrayList<Book>(items);\r\n\t\tCollections.sort(items, Collections.reverseOrder());\r\n\t\tfirePropertyChange(\"books\", oldItems, items);\r\n\t}", "@Test\n public void testItem_Ordering() {\n OasisList<Integer> baseList = new SegmentedOasisList<>(2, 2);\n\n List<Integer> expResult = Arrays.asList(1, 2, 6, 8);\n baseList.addAll(expResult);\n\n for (int i = 0; i < expResult.size(); i++) {\n assertEquals(expResult.get(i), baseList.get(i));\n }\n }", "public static void sortByPlaceCount(List<Apartment> apartments) {\n Collections.sort(apartments, SORT_BY_PLACE_COUNT);\n }", "public void sort() {\n\n try {\n if (cards != null) {\n cards.sort(Comparator.comparing(Flashcard::getRepetitionDate));\n LogHelper.writeToLog(Level.INFO, \"Karten von Model.Deck \" + name + \" sortiert.\");\n\n } else {\n LogHelper.writeToLog(Level.INFO, \"Karten von Model.Deck \" + name + \" nicht sortiert (null).\");\n }\n } catch (Exception ex) {\n LogHelper.writeToLog(Level.INFO, \"Fehler beim Sortieren der Karten\" + ex);\n }\n }", "private void sorterOppgaver(String type)\r\n\t{\r\n\t\t int k;\r\n\t\t int j;\r\n\t\t//switch(type){\r\n\t\t\t//case\t\"random\":\r\n\r\n\t\t\t\tfor(int i=1;i>this.oppgaver.length;i++)\r\n\t\t\t\t{\r\n\t\t\t\t\t// Loop og lag ei tilfeldig liste\r\n\t\t\t\t\tk = (int) Math.random()*this.oppgaver.length;\r\n\t\t\t\t\toppgaver[this.oppgaver.length]=this.oppgaver[i];\r\n\t\t\t\t\toppgaver[i]=oppgaver[k];\r\n\t\t\t\t\toppgaver[k]=oppgaver[this.oppgaver.length];\r\n\t\t\t\t}\r\n\t\t\t\t//break;\r\n\t\t\t//case \t\"alfabetisk\":\r\n\t\t\t\t// Sorter elementa i array alfabetisk.\r\n\t\t\t\t//break;\r\n\t\t\t//default:\r\n\t\t\t\t// Sorter elementa slik dei vart skrive inn av læraren, altså etter key i oppgave-arrayen.\r\n\t\t}", "public void sort()\n {\n com.jayway.restassured.response.Response response= given().relaxedHTTPSValidation().when().get(\"http://18.222.188.206:3333/accounts?_sort=title&_order=asc\");\n response.then().assertThat().statusCode(200);\n System.out.println(\"The accounts that are sorted according to it's title is displayed below:\");\n response.prettyPrint();\n \n }", "private static List<Article> createArticleList() {\n List<Article> articles = new ArrayList();\n articles.add(new Article(1l, \"Ball\", new Double(5.5), Type.TOY));\n articles.add(new Article(2l, \"Hammer\", new Double(250.0), Type.TOOL));\n articles.add(new Article(3l, \"Doll\", new Double(12.75), Type.TOY));\n return articles;\n }", "void sort() {\n Card.arraySort(this.myCards, numCards);\n }", "private List<? extends Publication> sortPublicationsAfterTitle(Collection<? extends Publication> publicationList) {\n\n return publicationList.stream().sorted(Comparator.comparing(Publication::getTitle)).collect(Collectors.toList());\n }", "public static void sortByPrice(List<Apartment> apartments) {\n Collections.sort(apartments, SORT_BY_PRICE);\n }" ]
[ "0.60410684", "0.59956723", "0.59458756", "0.583357", "0.5767155", "0.5711642", "0.56232727", "0.55985063", "0.55979586", "0.55874187", "0.543234", "0.54294276", "0.53926784", "0.5381414", "0.53752685", "0.53720593", "0.5367483", "0.53539354", "0.53316844", "0.5317036", "0.5296568", "0.52520686", "0.5250099", "0.52276", "0.51884174", "0.5183818", "0.5171014", "0.5162613", "0.5161488", "0.51587325", "0.5137885", "0.5133879", "0.510992", "0.5071912", "0.5058583", "0.50584954", "0.5027396", "0.50044733", "0.4989507", "0.49753606", "0.49734354", "0.497033", "0.49541664", "0.49514455", "0.4951218", "0.49496752", "0.4939761", "0.49365065", "0.49260816", "0.4922432", "0.49212956", "0.49203277", "0.49078423", "0.49076518", "0.4900108", "0.4893854", "0.48927528", "0.48824117", "0.48817712", "0.48785883", "0.4868076", "0.4865301", "0.48640415", "0.4858819", "0.48557186", "0.48521218", "0.48402134", "0.48339102", "0.48308462", "0.48262706", "0.48192826", "0.48190168", "0.48170862", "0.4815649", "0.48123223", "0.48105243", "0.48040888", "0.47978526", "0.47972044", "0.47970068", "0.47950548", "0.479378", "0.47906423", "0.4788931", "0.47831205", "0.4782937", "0.47795188", "0.47755978", "0.4773489", "0.47730282", "0.47648284", "0.47628596", "0.47609326", "0.4750453", "0.47468537", "0.47463304", "0.47403315", "0.47403273", "0.47402835", "0.47332424" ]
0.68575495
0
Interval at which the news should be collected. No news within this interval will be collected. This is in Minutes / / Class constructor for RSS parser. / / ID of the source that is being parsed / Recognizable Name of the source that is being parsed / Accessible URL of the source
public RssParser(int _SourceID, String _SourceName, String _SrcURL, int _ReadInterval) { SourceID = _SourceID; SourceName = _SourceName; Src_URL = _SrcURL; ReadInterval = _ReadInterval; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int getInterval() { return _interval; }", "public SourceRecord(Integer id, String url, String name, Short invalid, Long lastUpdateTime, Long lastFetchTime, Short autoFetchInterval, String basePath) {\n super(Source.SOURCE);\n\n set(0, id);\n set(1, url);\n set(2, name);\n set(3, invalid);\n set(4, lastUpdateTime);\n set(5, lastFetchTime);\n set(6, autoFetchInterval);\n set(7, basePath);\n }", "@Scheduled(fixedRate = 120000)\n public void readRss() {\n\n List<ItemNews> itemList = new ArrayList<>();\n\n try {\n String url = \"https://www.nytimes.com/svc/collections/v1/publish/https://www.nytimes.com/section/world/rss.xml\";\n\n try (XmlReader reader = new XmlReader(new URL(url))) {\n SyndFeed feed = new SyndFeedInput().build(reader);\n for (SyndEntry entry : feed.getEntries()) {\n LocalDateTime localDateTime = entry.getPublishedDate().toInstant()\n .atZone(ZoneId.systemDefault())\n .toLocalDateTime();\n ItemNews item = new ItemNews();\n item.setTitle(entry.getTitle());\n item.setAuthor(entry.getAuthor());\n item.setLink(entry.getLink());\n item.setDescription(entry.getDescription().getValue());\n item.setDateTime(localDateTime);\n modifyItem(item);\n itemList.add(item);\n }\n }\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n if (!itemList.isEmpty()) {\n Collections.sort(itemList , Comparator.comparing(ItemNews::getDateTime));\n saveItems(itemList);\n }\n }", "default public int getAliveInterval() \t\t\t\t\t{ return 1000; }", "long getIntervalInSeconds();", "private RSS(Properties props) throws ParameterError {\n super(new String[0], null);\n Logger static_logger = Logging.getLogger(RSS.class);\n if (static_logger.isDebugEnabled()) {\n static_logger.debug(\"QRS Property=\" + props);\n }\n this.props = props;\n instance = this;\n this.sitesurl_string = props.getProperty(\"qrs.SitesURL\");\n data_feeds = new Hashtable<String, DataFeed>();\n\n String raw_feed_data = props.getProperty(\"qrs.DataFeeds\");\n if (raw_feed_data != null) {\n StringTokenizer tokenizer = new StringTokenizer(raw_feed_data, \" \");\n while (tokenizer.hasMoreTokens()) {\n String feed_name = tokenizer.nextToken().trim();\n makeFeed(feed_name, props);\n }\n }\n\n String sysstat_interval_str = props.getProperty(\"qrs.sysstat\");\n if (sysstat_interval_str != null) {\n int sysstat_interval = Integer.parseInt(sysstat_interval_str);\n TimerQueueingDataFeed feed = new TimerQueueingDataFeed();\n registerFeed(feed, \"DirectEntry\");\n DirectSysStatSupplier supplier = new DirectSysStatSupplier(null, feed);\n supplier.schedule(sysstat_interval);\n }\n\n String gui_id = props.getProperty(GUI_PROPERTY);\n if (gui_id != null) {\n new org.cougaar.qos.qrs.gui.MainWindow(gui_id);\n }\n\n }", "protected void scrapeUrl() {\n String baseUrl = \"https://time.com\";\n int sectionsLen = TIME_SECTIONS.length;\n DateTimeFormatter ISOFormatter = DateTimeFormatter.ofPattern(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\", Locale.ENGLISH);\n\n for (int i = 0; i < sectionsLen; i++) {\n try {\n //Fetch the website and store it in Document object\n Document doc = Jsoup.connect(baseUrl + TIME_SECTIONS[i]).get();\n\n //Retrieve all articles from Document object\n Elements articles = doc.getElementsByTag(\"article\");\n\n NewsItem newsItem = null;\n\n Map<String, Integer> pathMap = new HashMap<>();\n\n //Go through each article tag and scrape key data\n for (Element article : articles) {\n newsItem = new NewsItem();\n\n Elements articleTitleURL = article.select(\"h3\");\n Elements articleExcerpt = article.getElementsByClass(\"summary margin-8-bottom desktop-only\");\n Elements articleImgURL = article.getElementsByClass(\"media-img margin-16-bottom\");\n\n //Checking for duplicate article\n if (pathMap.containsKey(articleTitleURL.select(\"a\").attr(\"href\"))) {\n int newsItemPos = pathMap.get(articleTitleURL.select(\"a\").attr(\"href\"));\n String currentCategory = newsItems.get(newsItemPos).getCategory();\n newsItems.get(newsItemPos).setCategory(currentCategory + \",\" + TIME_CATEGORIES[i]);\n }\n //Otherwise creating new NewsItem\n else {\n newsItem.setCategory(TIME_CATEGORIES[i]);\n newsItem.setTitle(articleTitleURL.select(\"a\").text());\n newsItem.setPageUrl(baseUrl + articleTitleURL.select(\"a\").attr(\"href\"));\n newsItem.setExcerpt(articleExcerpt.text());\n newsItem.setImgUrl(articleImgURL.select(\"div\").attr(\"data-src\"));\n newsItem.setPublishedDate(articlePublishedDate(newsItem.getPageUrl(), ISOFormatter));\n\n //Add new NewsItem to list\n newsItems.add(newsItem);\n //Mapping current articles url path to its corresponding NewsItem object to handle duplicates\n pathMap.put(articleTitleURL.select(\"a\").attr(\"href\"), newsItems.size() - 1);\n }\n }\n\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }", "public URL ParseRSSFromFeed() throws java.net.MalformedURLException\n {\n URL feedUrl = new URL(Src_URL);\n return feedUrl;\n }", "public int getRefreshInterval() {\n return (tozAdCampaignRetrievalInterval);\n }", "String getSourceUsageURLModificiationTime();", "public int getPollInterval();", "public int getInterval() {\r\n return interval;\r\n }", "public long getIntervalInMs() {\n return intervalInMs;\n }", "public void setInterval(int interval) {\r\n this.interval = interval;\r\n }", "private static FeedSource createFeedSource(String name, URL url) {\n FeedSource feedSource = new FeedSource();\n feedSource.fetchFrequency = FetchFrequency.MINUTES;\n feedSource.fetchInterval = 1;\n feedSource.deployable = false;\n feedSource.name = name;\n feedSource.projectId = project.id;\n feedSource.retrievalMethod = FeedRetrievalMethod.FETCHED_AUTOMATICALLY;\n feedSource.url = url;\n return feedSource;\n }", "public void setRefreshInterval(String interval) {\n tozAdCampaignRetrievalInterval = parseIntegerValue(interval,0);\n AppyAdService.getInstance().debugOut(TAG,\"Set refresh interval to \"+tozAdCampaignRetrievalInterval);\n }", "public void setInterval( String interval )\n\t{\n\t\tthis.interval = interval;\n\t}", "public static RemoteViews getTimeView(Context context){\r\n\t\t\t\t //String path = \"http://news.yahoo.com/rss/sports/\";\r\n\t\t\t\t //String path = \"http://chinatimes.feedsportal.com/c/33012/f/537199/index.rss\";\r\n\t\t\t\t String path = \"http://rss.5286phone.com/5.xml\";\r\n\t\t\t /* ����getRss()ȡ�ý������List */\r\n\t\t\t\t//CharSequence ch=DateFormat.format(\"hh:mm:ss\", time.toMillis(false));\r\n\t\t\t getRss(path);\r\n\t\t\t \r\n\t\t\tRemoteViews views=new RemoteViews(context.getPackageName(), R.layout.newswidget);\r\n\t\t\t//time.setToNow();\r\n\t\t\t//ʱ���ʽ��\r\n\t\t \r\n\t\t\tString currentInfo1 = null;\r\n\t\t\tString currentInfo2 = null;\r\n\t\t\tString currentInfo3 = null;\r\n\t\t\tString currentlink1 = null;\r\n\t\t\tString currentlink2 = null;\r\n\t\t\tString currentlink3 = null;\r\n\t\t\tif(li!=null&&li.size()>0)\r\n\t\t\t{\t\r\n\t\t\t int i = new java.util.Random().nextInt(li.size()-4);\r\n\t\t\t //zdd eboda 20120714 \r\n\t\t\t // int i = new java.util.Random().nextInt(li.size()-4)+1;\r\n\t\t\t currentInfo1 = li.get(i).getTitle();\r\n\t\t\t currentInfo2 = li.get(i+1).getTitle();\r\n\t\t\t currentInfo3 = li.get(i+2).getTitle();\r\n\t\t\t /*zdd eboda 20120714 \r\n\t\t\t currentInfo1 = li.get(0).getTitle();\r\n\t\t\t currentInfo2 = li.get(i).getTitle();\r\n\t\t\t currentInfo3 = li.get(i+1).getTitle();\r\n\t\t\t */\r\n\t\t\t currentlink1 = li.get(i).getLink();\r\n\t\t\t currentlink2 = li.get(i+1).getLink();\r\n\t\t\t currentlink3 = li.get(i+2).getLink();\r\n\r\n\t\t\t Uri uri1 = Uri.parse(currentlink1);\r\n\t\t\t Intent intent1 = new Intent(Intent.ACTION_VIEW,uri1);\r\n\t\t PendingIntent pendingIntent1 = PendingIntent.getActivity(context, 0, intent1, 0);\r\n\t\t\t views.setOnClickPendingIntent(R.id.newstitle1, pendingIntent1);\r\n\t\t\t Uri uri2 = Uri.parse(currentlink2);\r\n\t\t\t Intent intent2 = new Intent(Intent.ACTION_VIEW,uri2);\r\n\t\t PendingIntent pendingIntent2 = PendingIntent.getActivity(context, 0, intent2, 0);\r\n\t\t\t views.setOnClickPendingIntent(R.id.newstitle2, pendingIntent2);\r\n\t\t\t Uri uri3 = Uri.parse(currentlink3);\r\n\t\t\t Intent intent3 = new Intent(Intent.ACTION_VIEW,uri3);\r\n\t\t PendingIntent pendingIntent3 = PendingIntent.getActivity(context, 0, intent3, 0);\r\n//\t\t\t views.setOnClickPendingIntent(R.id.newstitle1, pendingIntent1);\r\n//\t\t\t views.setOnClickPendingIntent(R.id.newstitle2, pendingIntent2);\r\n\t\t\t views.setOnClickPendingIntent(R.id.newstitle3, pendingIntent3);\r\n\t\t\t views.setTextViewText(R.id.newstitle1, currentInfo1);\r\n\t\t \t views.setTextViewText(R.id.newstitle2, currentInfo2);\r\n\t\t\t views.setTextViewText(R.id.newstitle3, currentInfo3);\r\n\t\t\t \r\n\t\t\t}\r\n\t\t\treturn views;\r\n\t\t}", "Duration getDefaultPollInterval();", "@Override\n\tpublic int withIntervalInSeconds() {\n\t\treturn 10;\n\t}", "void setStatisticsInterval(long interval, TimeUnit timeUnit);", "public Activity() {\n title = \"\";\n comment = \"\";\n startTime = (new GregorianCalendar()).getTime();\n endTime = (new GregorianCalendar()).getTime();\n }", "private List<Request> getStartRequest () {\n String startUrl = \"http://www.yidianzixun.com/home/q/news_list_for_channel?channel_id=sc4&cstart=20&cend=30&infinite=true&refresh=1&__from__=pc&multi=5&appid=web_yidian\";\n List<Request> list = new ArrayList<>();\n list.add(new Request(startUrl).putExtra(RequestExtraKey.KEY_BEGIN_DATE, getStartTime()));\n return list;\n }", "public int interval() {\n return 30;\n }", "public void interval() {\n APIlib.getInstance().addJSLine(jsBase + \".interval();\");\n }", "public Interval getInterval() { return interval; }", "public void createTimer()\n {\n if (timer != null )\n return;\n \n logger.trace(\"Creating rss timer and task.\");\n RssTimerRefreshFeed refresh = new RssTimerRefreshFeed(this);\n this.timer = new Timer();\n this.timer.scheduleAtFixedRate(refresh, 100, PERIOD_REFRESH_RSS);\n \n logger.trace(\"Done.\");\n }", "public NewsSource(String name, String link, String rss_link)\n\t{\n\t\tthis.name = name;\n\t\tthis.link = link;\n\t\tthis.rss_link = rss_link;\n\t}", "public int getUpdateInterval()\n {\n return updateInterval;\n }", "public void setInterval(int x){\n interval = x;\n }", "public IntervalPatternTransformer(int interval)\r\n {\r\n this.interval = interval;\r\n }", "public int getAvpfRrInterval();", "public int getIntervalMinutes();", "public void setInterval(int interval)\n\t{\n\t\tthis.interval = (long) interval;\n\t}", "@Override\n\tpublic void loadNews() {\n\t\tif(newsUrl.contains(\"xyz\")) {\n\t\t\tnewsUrl = \"abc\";\n\t\t}\n\t\t\n\t\tif(realNews==null) {\n\t\t\trealNews = new RealNews(newsUrl);\n\t\t}\n\t\trealNews.loadNews();\n\t}", "public static long getIntervalNumber() {\n return getSecondsSinceEpoch() / SECS_TO_10MINS;\n }", "public void setPollingInterval(int seconds) {\n pollingInterval = seconds;\n }", "public IndexIntervalCallNoParser() {\n super(LocatingStrategy.INDEX_INTERVAL);\n }", "long getMediaScanInterval();", "public void turnOnRss(final String url) {\n ParseFeedTask task = tasks.get(url);\n if (task == null) {\n System.out.println(String.format(\"Rss with url %s is not found\", url));\n return;\n }\n RssConfiguration configuration = task.getConfiguration();\n if (configuration.getTurnOn()) {\n System.out.println(\"Rss is already running\");\n return;\n }\n configuration.setTurnOn(true);\n try {\n PropertiesHandler.writeProperties(configuration);\n ScheduledFuture future = scheduledExecutorService.scheduleWithFixedDelay(task, configuration.getPollPeriod(), configuration.getPollPeriod(), TimeUnit.SECONDS);\n futures.put(url, future);\n System.out.println(String.format(\"Rss %s is running\", url));\n } catch (IOException e) {\n System.out.println(String.format(\"An error occurred during the change poll period for feed %s\", url));\n }\n }", "public int getIntervalSeconds() {\n return this.intervalSeconds;\n }", "public void LoadNews()\n {\n String url = \"https://newsapi.org/v1/articles?source=the-next-web&apiKey=533af958594143758318137469b41ba9\";\n Load_News = new StringRequest(Request.Method.GET,url,Success,Error);\n rQueue = ApplicationSingleton.getInstance().getQueue();\n rQueue.add(Load_News);\n\n\n }", "public S interval(String interval) {\n builder.interval(interval);\n return self;\n }", "private void updateInterval() {\n this.mNetworkUpdateInterval = Settings.System.getInt(this.mContext.getContentResolver(), \"status_bar_network_speed_interval\", 4000);\n }", "public SnapshotFeedReader(String feedurl) {\n super(feedurl);\n this.feed = new SnapshotFeed();\n this.links = new HashSet<AtomLink>();\n }", "public void setRequestInterval(int requestInterval) {\n final int minSecs = 15;\n final int maxSecs = 600; // 10 minutes\n\n if (requestInterval <= 0) {\n requestInterval = 0;\n } else if (requestInterval < minSecs) {\n // Too often. Cannot request ads more frequently than minSecs apart.\n AdManager.clientError(\"AdView.setRequestInterval(\" + requestInterval + \") seconds must be >= \" + minSecs);\n } else if (requestInterval > maxSecs) {\n // Too infrequent. If setting this value there is no reason to have ads update more than maxSecs apart.\n AdManager.clientError(\"AdView.setRequestInterval(\" + requestInterval + \") seconds must be <= \" + maxSecs);\n }\n\n int requestIntervalMillisecs = requestInterval * 1000;\n this.requestInterval = requestIntervalMillisecs;\n\n // Set the timer to handle requesting fresh ads.\n if (requestInterval == 0) {\n // Stop the current timer (if there is one).\n manageRequestIntervalTimer(false);\n } else {\n // Start the timer.\n Log.i(AdManager.LOG, \"Requesting fresh ads every \" + requestInterval + \" seconds.\");\n manageRequestIntervalTimer(true);\n }\n }", "void start(String feedAddr) {\n this.scheduler = Executors.newSingleThreadScheduledExecutor(r -> new Thread(r, \"f\" + feedAddr));\n this.scheduler.scheduleAtFixedRate(this.newsProducer, this.newsProducingRateInMillis,\n this.newsProducingRateInMillis, TimeUnit.MILLISECONDS);\n }", "News(String title, String section, String storyUrl, String thumbnailUrl, String date) {\n\t\tthis.mTitle = title;\n\t\tthis.mSection = section;\n\t\tthis.mStoryUrl = storyUrl;\n\t\tthis.mThumbnailUrl = thumbnailUrl;\n\t\tthis.mDate = date;\n\t}", "@Override\n\tpublic synchronized void onRefresh() {\n\t\ttry {\n\t\t\t// 此处可取当前时间,为刷新时间\n\t\t\tcurDate = new Date(System.currentTimeMillis());\n\t\t\tsdf = new SimpleDateFormat(\"MM-dd HH:mm\");\n\t\t\tif (System.currentTimeMillis() - time > 500) {\n\t\t\t\tURL = URL.substring(0, URL.lastIndexOf(\"_\") + 1);\n\t\t\t\tURL = URL + \"1.xml\";\n\t\t\t\tif (lsnb != null) {\n\t\t\t\t\tlsnb_temp.addAll(lsnb);\n\t\t\t\t\tlsnb = null;\n\t\t\t\t}\n\n\t\t\t\tnew AsyncLoadNews(lsnb, URL).execute();\n\t\t\t} else {\n\t\t\t\tToast toast = Toast.makeText(getActivity(), \"目前是最新数据!\",\n\t\t\t\t\t\tToast.LENGTH_LONG);\n\t\t\t\t// toast.getView().setBackgroundResource(R.drawable.red_toast_bg);\n\t\t\t\ttoast.getView().setPadding(20, 10, 20, 10);\n\t\t\t\ttoast.show();\n\t\t\t\tonLoadStop();\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}", "public Integer getInterval() {\n\t\treturn interval;\n\t}", "@Override\n\t\tpublic synchronized void onRefresh() {\n\t\t\ttry {\n\t\t\t\t//此处可取当前时间,为刷新时间\n\t\t\t\tcurDate = new Date(System.currentTimeMillis());\n\t\t\t\tsdf = new SimpleDateFormat(\"MM-dd HH:mm\");\n\t\t\t\tif(System.currentTimeMillis()-time>500){\n\t\t\t\t\tURL = URL.substring(0, URL.lastIndexOf(\"_\")+1);\n\t\t\t\t\tURL = URL+\"1.xml\";\n\t\t\t\t\tif(lsnb != null){\n\t\t\t\t\t\tlsnb_temp.addAll(lsnb);\n\t\t\t\t\t\tlsnb = null;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tnew AsyncLoadNews(flag,lsnb,URL).execute();\n\t\t\t\t}else{\n\t\t\t\t\tToast toast = Toast.makeText(getActivity(), \"目前是最新数据!\", Toast.LENGTH_LONG);\n//\t\t\t\t\ttoast.getView().setBackgroundResource(R.drawable.red_toast_bg);\n\t\t\t\t\ttoast.getView().setPadding(20, 10, 20, 10);\n\t\t\t\t\ttoast.show();\n\t\t\t\t\tonLoadStop();\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}\n\t\t\t\n\t\t}", "public void changePollPeriod(final String url, final Long newPollPeriod) {\n ParseFeedTask task = tasks.get(url);\n if (task == null) {\n System.out.println(String.format(\"Rss with url %s is not found\", url));\n return;\n }\n RssConfiguration configuration = task.getConfiguration();\n configuration.setPollPeriod(newPollPeriod);\n try {\n PropertiesHandler.writeProperties(configuration);\n if (configuration.getTurnOn()) {\n ScheduledFuture future = futures.get(url);\n if (future == null) {\n return;\n }\n future.cancel(false);\n future = scheduledExecutorService.scheduleAtFixedRate(task, configuration.getPollPeriod(), configuration.getPollPeriod(), TimeUnit.SECONDS);\n futures.put(url, future);\n }\n } catch (IOException e) {\n System.out.println(String.format(\"An error occurred during the change poll period for feed %s\", url));\n }\n }", "@Override\n public List<News> loadInBackground() {\n if (mUrl == null) {\n return null;\n }\n // Perform the network request, parse the response, and extract a list of articles.\n List<News> news = QueryUtils.fetchNewsData(mUrl);\n return news;\n }", "public AtomFeed(String feedURL) throws ParserConfigurationException, IOException\r\n\t{\r\n\t\tthis.feedURL = feedURL;\r\n\t\txml = null;\r\n\t\tdocumentbuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();\r\n\t\tif (!refresh()) throw new IOException();\r\n\t}", "private synchronized void processNews() throws ClientProtocolException,\n\t\t\t\tIOException, JSONException {\n\n\t\t\tlong lastTime = mAdapter.getItem(mCount - 1).date;\n\t\t\tlong startTime = lastTime - Utils.MONTH;\n\n\t\t\tsetNews(ApiHandler.getData(lastTime, startTime));\n\t\t\tmHandler.sendEmptyMessage(UPDATE_LIST);\n\t\t}", "@Override\n\tpublic void update(long interval) {\n\n\t}", "private String loadXmlFromNetwork(String urlString) throws XmlPullParserException, IOException {\n InputStream stream = null;\n StackOverflowXmlParser stackOverflowXmlParser = new StackOverflowXmlParser();\n List<Entry> entries = null;\n String title = null;\n String url = null;\n String summary = null;\n Calendar rightNow = Calendar.getInstance();\n DateFormat formatter = new SimpleDateFormat(\"MMM dd h:mmaa\");\n int count = 1;\n\n // Checks whether the user set the preference to include summary text\n SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);\n boolean pref = sharedPrefs.getBoolean(\"summaryPref\", false);\n\n StringBuilder htmlString = new StringBuilder();\n htmlString.append(\"<h3>\" + getResources().getString(R.string.page_title) + \"</h3>\");\n htmlString.append(\"<em>\" + getResources().getString(R.string.updated) + \" \" +\n formatter.format(rightNow.getTime()) + \"</em>\");\n\n try {\n stream = downloadUrl(urlString);\n entries = stackOverflowXmlParser.parse(stream);\n // Makes sure that the InputStream is closed after the app is\n // finished using it.\n } finally {\n if (stream != null) {\n stream.close();\n }\n }\n\n // StackOverflowXmlParser returns a List (called \"entries\") of Entry objects.\n // Each Entry object represents a single post in the XML feed.\n // This section processes the entries list to combine each entry with HTML markup.\n // Each entry is displayed in the UI as a link that optionally includes\n // a text summary.\n for (Entry entry : entries) {\n \t\n \tString photo = \"\";\n \tString video = \"video\";\n htmlString.append(\"<p><a href='\");\n photo = \"https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=\"+entry.link+\"&sensor=true&key=AIzaSyBeNRBzRlJQy0-L8OlYFTnMcJ9LRb6h_-s\";\n \n \n htmlString.append(photo);\n htmlString.append(\"'>\" + entry.title + \"</a></p>\");\n if(count == 1 ||count == 3 ||count == 6 ||count == 8 ||count == 9) {\n \tvideo =\"http://192.168.0.16:8010/cloud/my_videos/\"+Integer.toString(count);\n \thtmlString.append(\"<a href='\"+video+\"'> - Video</a>\");\n }\n count++;\n \n // If the user set the preference to include summary text,\n // adds it to the display.\n if (pref) {\n htmlString.append(entry.summary);\n }\n }\n// URL url2 = new URL(\"http://192.168.0.16:8000/cloud/images/\");\n// HttpURLConnection conn2 = (HttpURLConnection) url2.openConnection();\n//\t\t\n// //conn2.setDoOutput(true);\n// conn2.setConnectTimeout(10000 /* milliseconds */);\n// conn2.setRequestMethod(\"GET\");\n// conn2.setDoInput(true);\n// conn2.connect();\n// //OutputStream out1 = new BufferedOutputStream(conn2.getOutputStream());\n// \n// \n// InputStream in = new BufferedInputStream(conn2.getInputStream());\n// BufferedReader br = new BufferedReader(new InputStreamReader(in));\n// String test = br.readLine();\n// String output=\"\";\n// while(test != null) {\n// \toutput = output +test;\n// \ttest = br.readLine();\n// }\n// output=\"<html><body><video width=\\\"320\\\" height=\\\"240\\\" controls><source src=\\\"movie.mp4\\\" type=\\\"video/mp4\\\"><source src=\\\"movie.ogg\\\" type=\\\"video/ogg\\\">Your browser does not support the video tag.</video></body></html>\";\n \n return htmlString.toString();\n }", "private synchronized void processNewsInitial()\n\t\t\t\tthrows ClientProtocolException, IOException, JSONException {\n\t\t\tlong lastTime = System.currentTimeMillis() / 1000;\n\t\t\tlong startTime = lastTime - Utils.MONTH;\n\t\t\tsetNews(ApiHandler.getData(lastTime, startTime));\n\t\t\tmHandler.sendEmptyMessage(CREATE_LIST);\n\t\t}", "public AgentDiscoveryThread(AgentServer owner, InetAddress multicastAddress, \n int multicastPort, int interval) {\n this.multicastAddress = multicastAddress;\n this.multicastPort = multicastPort;\n this.owner = owner;\n this.interval = interval;\n }", "@Scheduled(cron = \"0 0 0/2 * * ?\")\n\tpublic void pullNewsFeedFromNyTimes() throws Exception {\n\t\tNyTimes nyTimes = getNewsFromNyTimes();\n\t\tlogger.info(\"Completed fetching news from Ny Times at :\" + new java.util.Date());\n\t}", "public void startPolling() {\n\n if (wContext == null) {\n wContext = WebContextFactory.get();\n }\n if (t == null) {\n t = new DateUpdater();\n t.setPriority(Thread.MIN_PRIORITY);\n t.setDaemon(true);\n t.start();\n }\n\n }", "public static void setInterval(int intervalVal) {\n\n interval = intervalVal;\n }", "@Override\n\t\tprotected List<NewsBean> doInBackground(Void... params) {\n\t\t\tsynchronized (this) {\n\t\t\t\treturn new ParseXMLUtil().parseNewsXml(ls, url);\n\t\t\t}\n\t\t}", "int getHeartbeatInterval();", "protected void setInterval(int seconds) {\n interval = seconds * 1000L;\n }", "@Override\n protected String doInBackground(String... args) {\n // rss link url\n String query_url = args[0];\n\n // weather object of rss.\n woeid = parser.getRSSFeedWeather2(query_url);\n\n // updating UI from Background Thread\n runOnUiThread(new Runnable() {\n public void run() {\n /**\n * Updating parsed data into text view.\n * */\n Intent intent = new Intent(MainActivity.this, Summit.class);\n String description = woeid.getWoeid();\n intent.putExtra(EXTRA_MESSAGE, description);\n // Log.d(\"Long\", description);\n startActivity(intent);\n }\n });\n return null;\n }", "void setHeartbeatInterval(int interval);", "public TopListTimer() {\r\n\t\tsuper(-1, 1000 * 30);\r\n\t}", "public IdleTimer() {\r\n\t\t\tinActivitySession = false;\r\n\t\t}", "public int getCheckInterval();", "public synchronized static int getScanInterval(){\n return prefs.getInt(SCAN_INTERVAL, 1);\n }", "public static void main(String[] args) {\n\t\tNewsLKSpider spider = new NewsLKSpider();\r\n\t\tint i = 0;\r\n\t\twhile (i <= 280) {\r\n\t\t\tSystem.out.println(i);\r\n\t\t\tString thisUrl = spider.newsURL + String.valueOf(i);\r\n\t\t\tString referer = \"\";\r\n\t\t\tif (i == 0) {\r\n\t\t\t\treferer = spider.newsReferer;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\treferer = spider.newsURL + String.valueOf(i - 20);\r\n\t\t\t}\r\n\t\t\tString searchContent = spider.getContent(thisUrl, spider.searchCookie, referer);\r\n\t\t\tspider.getAElement(searchContent);\r\n\t\t\tint times = (int) (Math.random() * 10000 + 10000.);\r\n\t\t\tSystem.out.println(times);\r\n\t\t\ttry {\r\n\t\t\t\tThread.sleep(times);\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\ti = i + 20;\r\n\t\t}\r\n\t\tSystem.out.println(\"There are \" + spider.aElemenets.size() + \" news in list.\");\r\n\t\ti = 0;\r\n\t\tSet<Entry<String,String>> keyValue= spider.aElemenets.entrySet();\r\n\t\tfor (Entry<String,String> onePaire : keyValue) {\r\n\t\t\tSystem.out.println(i + \" : \" + onePaire.getValue());\r\n\t\t\tspider.getNewsContent(onePaire.getValue(), onePaire.getKey());\r\n\t\t\ti += 1;\r\n\t\t\tint times = (int) (Math.random() * 10000 + 5000.);\r\n\t\t\tSystem.out.println(\"Sleep times :\"+times);\r\n\t\t\ttry {\r\n\t\t\t\tThread.sleep(times);\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}\r\n\t}", "public void addRss(final String url, final String outputFileName, final Long pollPeriod, final Long itemsAmount,\n final List<String> parameters) {\n try {\n if (isNotValidRss(url)) {\n System.out.println(\"Rss is not valid.\");\n return;\n }\n RssConfiguration configuration = PropertiesHandler.createNewRssConfiguration(url, outputFileName, pollPeriod, itemsAmount, parameters);\n ParseFeedTask task = new ParseFeedTask(configuration);\n ScheduledFuture future = scheduledExecutorService.scheduleWithFixedDelay(task, configuration.getPollPeriod(), configuration.getPollPeriod(), TimeUnit.SECONDS);\n futures.put(url, future);\n tasks.put(url, task);\n } catch (IOException e) {\n System.out.println(String.format(\"An error occurred during the adding feed %s\", url));\n } catch (FeedException e) {\n System.out.println(String.format(\"Sorry, but feed %s is not valid.\", url));\n }\n }", "@Override\n\tpublic void startMonitoring(int interval, String hostname) {\n\n\t\tString key = hostname + \":\" + interval;\n\t\tlogger.debug(\"started monitoring host: \" + hostname);\n\t\ttimer.scheduleAtFixedRate(new MyTimerTask(paysafeUrl, restTemplate, monitoredHosts, key), new Date(),\n\t\t\t\tinterval * 1000);\n\n\t}", "@Override\n\t\tprotected List<NewsBean> doInBackground(Void... params) {\n\t\t\tsynchronized (this) {\t\t\t\n\t\t\t\treturn new ParseXMLUtil().parseNewsXml(ls,url);\n\t\t\t}\t\t\t\n\t\t}", "long getRepeatIntervalPref();", "public long getCheckInterval()\r\n\t{\r\n\t\treturn checkInterval;\r\n\t}", "private static void read(String fileName) {\n try {\n BufferedReader sc = null;\n sc = new BufferedReader(new FileReader(fileName));\n String temp = sc.readLine();\n interval = Integer.parseInt(temp);\n System.out.println(\"Interval = \" + interval + \" seconds.\");\n while ((temp = sc.readLine()) != null) {\n String[] entry = temp.split(\",\");\n url = entry[0];\n cores = Integer.parseInt(entry[1]);\n System.out.println(url + \" : \" + cores);\n }\n sc.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n }", "abstract public int getServiceInterval();", "public static void setExpireInterval(ParsePush push, long interval ) {\t \n\t\tpush.setExpirationTimeInterval(interval);\n\t}", "public CronTimer(String name, int min) {\n this.name = name;\n cronExpression = \"*\" + \" \" + \"0/\" + min + \" \" + \"* * * ?\";\n }", "public Visit() {\n\t\t//dateTime = LocalDateTime.now();\n\t}", "public int getDefaultDisplayInterval() {\n return (defaultDisplayInterval);\n }", "public List<NewsNotifications> getNewsFeed(int limit);", "public long getPingInterval()\n {\n return _pingInterval;\n }", "public News (\n\t\t Long in_newsId\n ) {\n\t\tthis.setNewsId(in_newsId);\n }", "@Override\n protected Void doInBackground(Void... arg0) {\n helper = new LiveFeedParser(999);\n helper.get();\n viewEntries = helper.getViewEntries();\n return null;\n }", "public static Observable<Long> getObservableTakeDuration() {\n return observableIntervalSrc;//todo\n }", "protected void update(IInterval interval) {}", "public void setCheckInterval(long checkInterval)\r\n\t{\r\n\t\tthis.checkInterval = checkInterval;\r\n\t}", "private boolean pull(String url) {\r\n\t\ttry {\r\n\t\t\tHttpURLConnection con = (HttpURLConnection) new URL(url).openConnection();\r\n\t\t\tint respCode = con.getResponseCode();\r\n\t\t\tif (respCode != HttpURLConnection.HTTP_OK) {\r\n\t\t\t\tHaypiLog.d(TAG, respCode + \" \" + con.getResponseMessage());\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\tInputStream in = con.getInputStream();\r\n\t\t\tByteArrayOutputStream out = new ByteArrayOutputStream(4096);\r\n\t\t\tbyte[] buf = new byte[2048];\r\n\t\t\tint n;\r\n\t\t\twhile ((n = in.read(buf)) > -1) {\r\n\t\t\t\tout.write(buf, 0, n);\r\n\t\t\t}\r\n\t\t\tString encoding = con.getContentEncoding();\r\n\t\t\tif (encoding == null) {\r\n\t\t\t\tencoding = \"UTF-8\";\r\n\t\t\t}\r\n\t\t\tString resp = out.toString(encoding);\r\n\t\t\tString[] ss = HaypiUtil.split(resp, \"\\r\\n\");\r\n\r\n\t\t\tif (ss.length >= 3 && ss[0].equals(\"0\") && ss[1].equals(\"0\")) {\r\n\t\t\t\tint index = 2;\r\n\t\t\t\tint count = Integer.parseInt(ss[index++]);\r\n\t\t\t\tif (count > 0) {\r\n\t\t\t\t\tArrayList<News> list = new ArrayList<News>();\r\n\t\t\t\t\tfor (; count > 0; count--) {\r\n\t\t\t\t\t\tint version = Integer.parseInt(ss[index++]);\r\n\t\t\t\t\t\tif (version <= News.lastNewsVersion)\r\n\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\tNews.lastNewsVersion = version;\r\n\t\t\t\t\t\tNews entity = new News();\r\n\t\t\t\t\t\tentity.setNew(true);\r\n\t\t\t\t\t\tentity.setVersion(version);\r\n\t\t\t\t\t\tentity.setStartTime(Integer.parseInt(ss[index++]));\r\n\t\t\t\t\t\tentity.setEndTime(Integer.parseInt(ss[index++]));\r\n\t\t\t\t\t\tentity.setSubject(ss[index++]);\r\n\t\t\t\t\t\tentity.setDescription(ss[index++]);\r\n\t\t\t\t\t\tentity.setContent(ss[index++]);\r\n\t\t\t\t\t\tentity.setToken(ss[index++]);\r\n\t\t\t\t\t\tentity.setButtonText(ss[index++]);\r\n\t\t\t\t\t\tentity.setNewsType(News.TYPE.values()[Integer.parseInt(ss[index++])]);\r\n\t\t\t\t\t\tentity.setTopNews(\"1\".equals(ss[index++]));\r\n\t\t\t\t\t\tentity.setParams1(ss[index++]);\r\n\t\t\t\t\t\tentity.setParams2(ss[index++]);\r\n\t\t\t\t\t\tentity.setParams3(ss[index++]);\r\n\t\t\t\t\t\tlist.add(entity);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (list.size() > 0) {\r\n\t\t\t\t\t\tNews.add(list);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tcon.disconnect();\r\n\t\t\treturn true;\r\n\t\t} catch (Exception e) {\r\n\t\t\tHaypiLog.e(TAG, \"poll\", e);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "public Long getScanInterval() {\n return JacksonUtils.asLong(getProperty(SCAN_INTERVAL));\n }", "public void setCheckInterval(long checkInterval) {\n this.checkInterval = checkInterval;\n }", "public Sources()\n {\n super(NAMESPACE, ELEMENT);\n }", "public long getIntervalSeconds()\n {\n return __m_IntervalSeconds;\n }", "@SimpleProperty(description = \"The default duration (in seconds) of each scan for this probe\")\n\tpublic float DefaultDuration(){\n\t\t\n\t\treturn SCHEDULE_DURATION;\n\t}", "long getNextCollectTimestampMs();", "public double interval() {\n return interval;\n }", "@Scheduled(fixedRate = checkRate - 1000) // Un minuto menos\n public void getUrls() {\n urlList = shortURLRepository.listAll();\n }", "public S interval(Long interval) {\n builder.interval(interval);\n return self;\n }" ]
[ "0.55621874", "0.5536951", "0.5411229", "0.5259436", "0.5256928", "0.52357477", "0.5231611", "0.5201289", "0.5184466", "0.51359737", "0.5132839", "0.5110152", "0.5074536", "0.5044714", "0.5042041", "0.50379074", "0.5013031", "0.49804315", "0.4979164", "0.49747318", "0.497329", "0.49718344", "0.49478018", "0.49440128", "0.4933247", "0.49025896", "0.4875777", "0.4865611", "0.48545784", "0.48428765", "0.4834199", "0.48318544", "0.4823535", "0.48092735", "0.48004442", "0.47978595", "0.47901466", "0.47718564", "0.4756359", "0.47451934", "0.4738061", "0.47322258", "0.47282425", "0.47273654", "0.4724235", "0.4719997", "0.4717151", "0.4698104", "0.4697747", "0.46885026", "0.4686784", "0.46701026", "0.4641467", "0.46346954", "0.4632281", "0.46298364", "0.46257144", "0.46189865", "0.46159548", "0.4614824", "0.45889404", "0.45826864", "0.45784444", "0.45747253", "0.45684615", "0.4560984", "0.45590523", "0.4553697", "0.45535493", "0.45527288", "0.45456126", "0.45267484", "0.45160872", "0.45117658", "0.44967988", "0.44905865", "0.44904023", "0.44883865", "0.44874027", "0.44752", "0.44725358", "0.44696078", "0.44680873", "0.44638607", "0.4463576", "0.4460018", "0.44436458", "0.44397277", "0.44396344", "0.44358343", "0.4434136", "0.44328588", "0.4430358", "0.4424399", "0.4416755", "0.44151488", "0.44117677", "0.4409258", "0.44088805", "0.44064313" ]
0.68212944
0
/ / Parse RSS feeds but only one URL at a time. Notice the function only has a single source URL in args. / Parsing multiple source URI has to be done via loop in the calling function. /
public void PopulateRSSData() { try { URL Feed = ParseRSSFromFeed(); ParseRSS(Feed); } catch(java.net.MalformedURLException exp) { String message = exp.getMessage(); System.out.println(message); } catch(com.rometools.rome.io.FeedException fexp) { String message = fexp.getMessage(); System.out.println(message); } catch(java.io.IOException ioexp) { String message = ioexp.getMessage(); System.out.println(message); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public URL ParseRSSFromFeed() throws java.net.MalformedURLException\n {\n URL feedUrl = new URL(Src_URL);\n return feedUrl;\n }", "public List<LinkDetails> scrapeRSSPageForLinks(String rssUrl) {\n\t\tString description = \"\";\n\t\tString title = \"\";\n\t\tString link = \"\";\n\t\tString pubdate = \"\";\n\t\tURL url;\n\t\tInputStream in;\n\n\t\tList<LinkDetails> rssProcessedData = new ArrayList<LinkDetails>();\n\n\t\ttry {\n\t\t\turl = new URL(rssUrl);\n\t\t} catch (MalformedURLException e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t}\n\n\t\ttry {\n\t\t\tin = url.openStream();\n\t\t} catch (IOException e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t}\n\n\t\t// create XML input factory\n\t\tXMLInputFactory inputFactory = XMLInputFactory.newInstance();\n\n\t\t// read the XML document\n\t\ttry {\n\n\t\t\tXMLEventReader eventReader = inputFactory.createXMLEventReader(in);\n\n\t\t\tboolean isFeedHeader = true;\n\t\t\twhile (eventReader.hasNext()) {\n\t\t\t\tXMLEvent event = eventReader.nextEvent();\n\t\t\t\tif (event.isStartElement()) {\n\t\t\t\t\tString localPart = event.asStartElement().getName().getLocalPart();\n\n\t\t\t\t\t// System.out.println(localPart);\n\n\t\t\t\t\tswitch (localPart) {\n\n\t\t\t\t\tcase \"item\":\n\t\t\t\t\t\t// if (isFeedHeader) {\n\t\t\t\t\t\t// isFeedHeader = false;\n\t\t\t\t\t\t// System.out.println(\" title: \"+title+ \" description: \"+ description + \" link:\n\t\t\t\t\t\t// \"+link+\" pubDate: \"+pubdate);\n\t\t\t\t\t\t// }\n\t\t\t\t\t\tevent = eventReader.nextEvent();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase \"title\":\n\t\t\t\t\t\ttitle = getCharacterData(event, eventReader);\n\t\t\t\t\t\t// System.out.println(\"title: \"+title);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"description\":\n\t\t\t\t\t\tdescription = getCharacterData(event, eventReader);\n\t\t\t\t\t\t// System.out.println(\"description: \"+description);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"link\":\n\t\t\t\t\t\tlink = getCharacterData(event, eventReader);\n\t\t\t\t\t\tSystem.out.println(\"link: \" + link);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"pubDate\":\n\t\t\t\t\t\tpubdate = getCharacterData(event, eventReader);\n\t\t\t\t\t\t// System.out.println(\"pubDate: \"+pubdate);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\t\t\t\t} else if (event.isEndElement()) {\n\t\t\t\t\tif (event.asEndElement().getName().getLocalPart() == (\"item\")) {\n\n\t\t\t\t\t\tLinkDetails linkDetails = new LinkDetails(link, title, description, pubdate);\n\t\t\t\t\t\trssProcessedData.add(linkDetails);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (XMLStreamException e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t}\n\n\t\treturn rssProcessedData;\n\t}", "List<SyndFeed> getRssFeeds(Set<String> feedUrls) throws FeedException, IOException,\n FetcherException;", "public void ParseRSS(URL feedUrl) throws com.rometools.rome.io.FeedException, java.io.IOException {\n //TODO: EVERY THING HERE SHOULD BE IN A TRANSACTION\n List<String> HashFields = new ArrayList<>();\n SyndFeedInput input = new SyndFeedInput();\n SyndFeed feed = input.build(new XmlReader(feedUrl));\n RSSChannelElements ChannelElements = new RSSChannelElements();\n Date CurrentDate = new Date();\n SimpleDateFormat SDF = new java.text.SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss.SSS\");\n //GET ADDITIONAL PROPERTIES OF THE CHANNEL\n //GET CHANNEL AUTHOR\n String ch_author = feed.getAuthor();\n ChannelElements.Author = ch_author;\n //GET PUBLISHED DATE\n Date ch_PubDate = feed.getPublishedDate();\n ChannelElements.PublishedDate = ch_PubDate;\n //GET LANGUAGE\n String ch_Language = feed.getLanguage();\n ChannelElements.Language = ch_Language;\n //GET WEBMASTER\n String ch_WebMaster = feed.getWebMaster();\n ChannelElements.webMaster = ch_WebMaster;\n //GET MANAGING EDITOR\n String ch_ME = feed.getManagingEditor();\n ChannelElements.managingEditor = ch_ME;\n //GET GENERATOR\n String ch_generator = feed.getGenerator();\n ChannelElements.Generator = ch_generator;\n //GET DESCRIPTION\n String ch_description = feed.getDescription();\n ChannelElements.Description = ch_description;\n int CurrentChannelID = 0;\n //TODO: DO THIS IN A STORED PROCEDURE\n try\n {\n TimeValidations ValidateTime = new TimeValidations();\n if (ValidateTime.IsWithinValidWindow(CurrentDate, ch_PubDate, ReadInterval))\n {\n //INSERT TO DB THE CHANNEL DETAILS\n CurrentChannelID = InsertChannelDetails(ChannelElements);\n }\n }\n catch(java.sql.SQLException exp)\n {\n String message = exp.getMessage();\n System.out.println(message);\n }\n\n\n //GET ELEMENTS FROM THE \"ITEMS\"\n List entries = feed.getEntries();\n Iterator it = entries.iterator();\n while (it.hasNext()) {\n RSSFields RssFieldValues = new RSSFields();\n SyndEntry entry = (SyndEntry) it.next();\n //GET TITLE\n System.out.println(entry.getTitle());\n String Title = entry.getTitle();\n RssFieldValues.Title = Title;\n //HashFields.add(Title);\n //GET LINK\n System.out.println(entry.getLink());\n RssFieldValues.Link = entry.getLink();\n HashFields.add(RssFieldValues.Link);\n //GET DESCRIPTION\n SyndContent description = entry.getDescription();\n System.out.println(description.getValue());\n RssFieldValues.Description = description.getValue();\n //HashFields.add(description.getValue());\n //GET PUBLISHED DATE\n Date Pub_Date = entry.getPublishedDate();\n System.out.println(SDF.format(Pub_Date));\n RssFieldValues.PublishedDate = entry.getPublishedDate();\n //GET UPDATED DATE\n Date U_date = entry.getUpdatedDate();\n System.out.println(U_date);\n RssFieldValues.UpdatedDate = entry.getPublishedDate();\n //GET AUTHOR\n String Author = entry.getAuthor();\n RssFieldValues.Author = Author;\n System.out.println(Author);\n //GET COMMENTS;\n String Comments = entry.getComments();\n RssFieldValues.Comments = Comments;\n System.out.println();\n try {\n //org.joda.time.Period P = new org.joda.time.Period(Pub_Date, CurrentDate);\n //if(SDF.parse(Pub_Date.toString()) == SDF.parse(CurrentDate.toString()))\n //org.joda.time.Period p = new org.joda.time.Period(CurrentDate, Pub_Date);\n //ONLY INSERT IF THE FEED IS WITHIN THE SPECIFIED PERIOD\n TimeValidations ValidateTime = new TimeValidations();\n if (ValidateTime.IsWithinValidWindow(CurrentDate, U_date, ReadInterval))\n {\n //INSERT NEWS SPECIFIC VALUES TO DB\n HashGenerator Gen = new HashGenerator();\n RssFieldValues.ComputedHash = Gen.HashCalculator(HashFields);\n InsertToDB(RssFieldValues, CurrentChannelID);\n }\n } catch (java.sql.SQLException ex) {\n String message = ex.getMessage();\n System.out.println(message);\n }\n }\n // System.out.println(feed);\n }", "@Override\n\t\tprotected Boolean doInBackground(Void... params) {\n\t\t\tlinklist = parseRSS();\n\t\t\treturn updateDatabase(linklist);\n\t\t}", "public static void processFeed(FeedContext fc) {\n\n String feedUrl = fc.getFeedUrl();\n mLog.info(\"Processing Atom feed at URL: \" + feedUrl);\n\n try {\n AbderaAtomParser atomParser = new AbderaAtomParser(new URL(feedUrl));\n atomParser.persistFeed(fc);\n\n mLog.info(\"Finished processing Atom feed at URL \" + feedUrl);\n }\n catch (MalformedURLException url_e) {\n mLog.error(\"MalformedURL found for \" + fc.getFeedUrl());\n }\n catch (ArrayIndexOutOfBoundsException a) {\n // this happens if the feed is empty (typically an activity stream),\n // need a better way to track this though\n \tmLog.warn(\"Feed at URL [\" + feedUrl + \"] is probably empty, but this \" +\n \t\t\t\"exception should have been prevented.\");\n }\n catch (Exception e) {\n mLog.error(\"Error processing feed at [\" + fc.getFeedUrl() + \"]: \" + e.getMessage());\n }\n catch (Throwable t) {\n mLog.error(\"Error processing feed at [\" + fc.getFeedUrl() + \"]: \" + t.getMessage());\n }\n }", "private String getURL(String feedUrl) {\n\tStringBuilder sb = null;\n\ttry {\n for(int i = 3; i>0; i--) {\n\t sb = new StringBuilder();\n URL url = new URL(feedUrl);\n\tHttpURLConnection uc = (HttpURLConnection) url.openConnection();\n\tuc.setRequestProperty(\"User-Agent\", \"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.22) Gecko/20110902 Firefox/3.6.22 GTB7.1 ( .NET CLR 3.5.30729)\");\n\tuc.setRequestProperty(\"Accept\", \"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\");\n\tuc.setRequestProperty(\"Accept-Language\", \"en-us,en;q=0.5\");\n\tuc.setRequestProperty(\"Accept-Encoding\", \"gzip,deflate\");\n\tuc.setRequestProperty(\"Accept-Charset\", \"ISO-8859-1,utf-8;q=0.7,*;q=0.7\");\n\tuc.setRequestProperty(\"Keep-Alive\", \"115\");\n\tuc.setRequestProperty(\"Connection\", \"keep-alive\");\n\tuc.setDoOutput(true);\n\tuc.setDoInput(true);\n\tuc.setUseCaches(false);\n\tuc.setRequestMethod(\"POST\");\n\tuc.setRequestProperty(\"Content-Type\", \"text/xml\");\n\t\n\tBufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));//uc.getInputStream()\n\tString inputLine;\n\tboolean refreshAgain = false;\n\twhile ((inputLine = in.readLine()) != null) {\n\t\tsb.append(inputLine);\n\t\tif( inputLine.contains(\"Refresh\") ) {\n\t\t\trefreshAgain = true;\n\t\t\tSystem.out.println(\"Refresh\");\n\t\t}\n\t}\n\tin.close();\n\tuc.disconnect();\t\t\n//\tRefresh\n\tif( refreshAgain ) {\n\t Thread.sleep(1000);\n\t}\n\telse break;\n }\n }catch(Exception ee){}\nreturn sb.toString();\n}", "public List<RssItem> getItems() throws Exception {\n if (rssUrl.equals(\"http://www.prothom-alo.com/\"))\n return ProthomAlo.GetLinks();\n if (rssUrl.equals(\"http://www.bhorerkagoj.net/online/\"))\n return Bhorerkagoj.GetLinks();\n SAXParserFactory factory = SAXParserFactory.newInstance();\n SAXParser saxParser = factory.newSAXParser();\n\n RssParseHandler handler = new RssParseHandler();\n\n saxParser.parse(rssUrl, handler);\n\n\n return handler.getItems();\n\n }", "public static List<DeebResource> parse(String sourceCode, String url, Context context) {\n LinkedList<DeebResource> resources = new LinkedList<DeebResource>();\n \n // get XML Document from a parser\n String xmlDocument = null;\n \n if(url.contains(\"europeana\")) {\n Log.d(LOG_TAG, \"trying to parse json\");\n xmlDocument = JSONParser.parseJSON(sourceCode);\n }\n else if(url.contains(\"openarchives\")) {\n Log.d(LOG_TAG, \"trying to parse xml\");\n // TODO connect XMLParser\n }\n else if(url.contains(\"dbpedia\")) {\n Log.d(LOG_TAG, \"trying to parse rdf\");\n \n try {\n xmlDocument = LDParser.parseLD(sourceCode);\n }\n catch(ParserConfigurationException e) {\n Log.w(LOG_TAG, Log.getStackTraceString(e));\n }\n catch(SAXException e) {\n Log.w(LOG_TAG, Log.getStackTraceString(e));\n }\n catch(IOException e) {\n Log.w(LOG_TAG, Log.getStackTraceString(e));\n }\n }\n else {\n Log.d(LOG_TAG, \"trying to use the default parser\");\n // TODO connect MicrodataParser\n }\n \n if(xmlDocument == null) {\n Log.w(LOG_TAG, \"nothing could be parsed\");\n return resources;\n }\n \n // apply XSL to receive RDFXML\n Log.d(LOG_TAG, \"applying xml_to_rdfxml.xsl\");\n ByteArrayOutputStream rdfXml = applyXSL(context,\n new ByteArrayInputStream(xmlDocument.getBytes()), R.raw.xml_to_rdfxml);\n \n // TODO get resources from rdfXml\n \n // TODO return the data from this request (for visualization)\n return resources;\n }", "public List<RssFeedItem> getItems() throws Exception {\n // using SaxParser as the method of parsing the feed. \n SAXParserFactory factory = SAXParserFactory.newInstance();\n SAXParser saxParser = factory.newSAXParser();\n // SAX parser handler object which handles feed elements\n RssParseHandler handler = new RssParseHandler();\n saxParser.parse(rssUrl, handler);\n // The result of the parsing process is being stored in the handler object\n return handler.getItems();\n }", "private String getURL(String feedUrl) {\n\tStringBuilder sb = null;\n\ttry {\n for(int i = 3; i>0; i--) {\n\t sb = new StringBuilder();\n URL url = new URL(feedUrl);\n//User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.22) Gecko/20110902 Firefox/3.6.22 GTB7.1 ( .NET CLR 3.5.30729)\n//Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\n//Accept-Language: en-us,en;q=0.5\n//Accept-Encoding: gzip,deflate\n//Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\n//Keep-Alive: 115\n//Connection: keep-alive\n//\tHttpsURLConnection uc = (HttpsURLConnection) url.openConnection();\n\tHttpURLConnection uc = (HttpURLConnection) url.openConnection();\n\tuc.setRequestProperty(\"User-Agent\", \"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.22) Gecko/20110902 Firefox/3.6.22 GTB7.1 ( .NET CLR 3.5.30729)\");\n//Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\n\tuc.setRequestProperty(\"Accept\", \"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\");\n\tuc.setRequestProperty(\"Accept-Language\", \"en-us,en;q=0.5\");\n\tuc.setRequestProperty(\"Accept-Encoding\", \"gzip,deflate\");\n\tuc.setRequestProperty(\"Accept-Charset\", \"ISO-8859-1,utf-8;q=0.7,*;q=0.7\");\n\tuc.setRequestProperty(\"Keep-Alive\", \"115\");\n\tuc.setRequestProperty(\"Connection\", \"keep-alive\");\n//Keep-Alive: 115\n//Connection: keep-alive\n//\tif (userName != null && password != null) {\n//\t\tuc.setRequestProperty(\"Authorization\", \"Basic \" + encodedAuthenticationString);\n//\t}\n\t// ori setting??\n//\tuc.setReadTimeout(TIME_OUT);\n//\tuc.setFollowRedirects(true);\n//\tuc.setInstanceFollowRedirects(true);\n//\tuc.setAllowUserInteraction(true);\n\tuc.setDoOutput(true);\n\tuc.setDoInput(true);\n\tuc.setUseCaches(false);\n\tuc.setRequestMethod(\"POST\");\n\tuc.setRequestProperty(\"Content-Type\", \"text/xml\");\n\t\n\tBufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));//uc.getInputStream()\n\tString inputLine;\n//\t'aa7c.com')\" onmouseout=\"menuLayers.hide()\">Available</a>\n\tboolean refreshAgain = false;\n\twhile ((inputLine = in.readLine()) != null) {\n//\t\tSystem.out.println(inputLine);\n\t\tsb.append(inputLine);\n\t\tif( inputLine.contains(\"Refresh\") ) {\n\t\t\trefreshAgain = true;\n\t\t\tSystem.out.println(\"Refresh\");\n\t\t}\n\t}\n\tin.close();\n\tuc.disconnect();\t\t\n//\tRefresh\n\tif( refreshAgain ) {\n\t Thread.sleep(1000);\n\t}\n\telse break;\n }\n }catch(Exception ee){}\nreturn sb.toString();\n}", "@Override\n\t\tprotected List<NewsBean> doInBackground(Void... params) {\n\t\t\tsynchronized (this) {\n\t\t\t\treturn new ParseXMLUtil().parseNewsXml(ls, url);\n\t\t\t}\n\t\t}", "public static void processFeed(String feedUrl) throws Exception {\n processFeed(new FeedContext(feedUrl));\n }", "public static ArrayList<Map<String,String>> getContFromRssNoHtml(String urlAdress) {\n\n URL url = null;\n Iterator itEntries = null;\n try {\n //thetume ton browser Agent se browser-like gia na apofigume 403 errors\n System.setProperty(\"http.agent\", \"Mozilla/5.0 (Windows NT 10.0; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0\");\n url = new URL(urlAdress);\n HttpURLConnection httpcon = (HttpURLConnection) url.openConnection();\n httpcon.setRequestProperty(\"User-Agent\",\n \"Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20100101 Firefox/19.0\");\n // Reading the feed\n SyndFeedInput input = new SyndFeedInput();\n SyndFeed feed = input.build(new XmlReader(httpcon));\n List entries = feed.getEntries();\n itEntries = entries.iterator();\n } catch (MalformedURLException e) {\n e.printStackTrace();\n } catch (FeedException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n //contAr has all the entries\n ArrayList<Map<String,String>> contAr = new ArrayList<Map<String, String>>();\n\n //contMap has all the entries contents\n Map<String,String> contMap = new HashMap<String, String>();\n contMap.put(\"URI\",urlAdress);\n\n\n while (itEntries.hasNext()) {\n contMap = new HashMap<String, String>();\n SyndEntry entry = (SyndEntry) itEntries.next();\n System.out.println(entry.getUri());\n contMap.put(\"Title\",entry.getTitle());\n contMap.put(\"Link\",entry.getLink());\n contMap.put(\"Description\",entry.getDescription().getValue());\n\n contAr.add(contMap);\n System.out.println();\n }\n return contAr;\n }", "@Override\n\t\tprotected List<NewsBean> doInBackground(Void... params) {\n\t\t\tsynchronized (this) {\t\t\t\n\t\t\t\treturn new ParseXMLUtil().parseNewsXml(ls,url);\n\t\t\t}\t\t\t\n\t\t}", "public AtomFeed(String feedURL) throws ParserConfigurationException, IOException\r\n\t{\r\n\t\tthis.feedURL = feedURL;\r\n\t\txml = null;\r\n\t\tdocumentbuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();\r\n\t\tif (!refresh()) throw new IOException();\r\n\t}", "public SnapshotFeedReader(String feedurl) {\n super(feedurl);\n this.feed = new SnapshotFeed();\n this.links = new HashSet<AtomLink>();\n }", "public static void getFeed(String url) {\n if (rssReader != null) {\n rssReader.loadFeeds(url);\n }\n }", "public void addRss(final String url, final String outputFileName, final Long pollPeriod, final Long itemsAmount,\n final List<String> parameters) {\n try {\n if (isNotValidRss(url)) {\n System.out.println(\"Rss is not valid.\");\n return;\n }\n RssConfiguration configuration = PropertiesHandler.createNewRssConfiguration(url, outputFileName, pollPeriod, itemsAmount, parameters);\n ParseFeedTask task = new ParseFeedTask(configuration);\n ScheduledFuture future = scheduledExecutorService.scheduleWithFixedDelay(task, configuration.getPollPeriod(), configuration.getPollPeriod(), TimeUnit.SECONDS);\n futures.put(url, future);\n tasks.put(url, task);\n } catch (IOException e) {\n System.out.println(String.format(\"An error occurred during the adding feed %s\", url));\n } catch (FeedException e) {\n System.out.println(String.format(\"Sorry, but feed %s is not valid.\", url));\n }\n }", "public FeedManager loadFeed() throws IOException, XmlPullParserException {\n\t\tInputStream stream = null;\n\t\tSolsticeXmlParser solsticeXmlParser = new SolsticeXmlParser();\n\n\t\ttry {\n\t\t\tstream = downloadUrl(URL);\n\t\t\treturn solsticeXmlParser.parse(stream);\n\t\t} finally {\n\t\t\tif (stream != null) {\n\t\t\t\tstream.close();\n\t\t\t}\n\t\t}\n\t}", "public RssParser(int _SourceID, String _SourceName, String _SrcURL, int _ReadInterval)\n {\n SourceID = _SourceID;\n SourceName = _SourceName;\n Src_URL = _SrcURL;\n ReadInterval = _ReadInterval;\n }", "public void refreshAllRssFeeds()\n {\n Vector rssContactList = new Vector();\n rssContactList = opSetPersPresence.getContactListRoot().\n getRssURLList(rssContactList);\n Iterator rssContact = rssContactList.iterator();\n while(rssContact.hasNext())\n {\n ContactRssImpl contact = (ContactRssImpl)rssContact.next();\n try\n {\n \n submitRssQuery(contact, false);\n }\n catch (Exception ex)\n {\n logger.error(\"Failed to refresh feed for \" + contact, ex);\n }\n }\n }", "private String loadXmlFromNetwork(String urlString) throws XmlPullParserException, IOException {\n InputStream stream = null;\n StackOverflowXmlParser stackOverflowXmlParser = new StackOverflowXmlParser();\n List<Entry> entries = null;\n String title = null;\n String url = null;\n String summary = null;\n Calendar rightNow = Calendar.getInstance();\n DateFormat formatter = new SimpleDateFormat(\"MMM dd h:mmaa\");\n int count = 1;\n\n // Checks whether the user set the preference to include summary text\n SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);\n boolean pref = sharedPrefs.getBoolean(\"summaryPref\", false);\n\n StringBuilder htmlString = new StringBuilder();\n htmlString.append(\"<h3>\" + getResources().getString(R.string.page_title) + \"</h3>\");\n htmlString.append(\"<em>\" + getResources().getString(R.string.updated) + \" \" +\n formatter.format(rightNow.getTime()) + \"</em>\");\n\n try {\n stream = downloadUrl(urlString);\n entries = stackOverflowXmlParser.parse(stream);\n // Makes sure that the InputStream is closed after the app is\n // finished using it.\n } finally {\n if (stream != null) {\n stream.close();\n }\n }\n\n // StackOverflowXmlParser returns a List (called \"entries\") of Entry objects.\n // Each Entry object represents a single post in the XML feed.\n // This section processes the entries list to combine each entry with HTML markup.\n // Each entry is displayed in the UI as a link that optionally includes\n // a text summary.\n for (Entry entry : entries) {\n \t\n \tString photo = \"\";\n \tString video = \"video\";\n htmlString.append(\"<p><a href='\");\n photo = \"https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=\"+entry.link+\"&sensor=true&key=AIzaSyBeNRBzRlJQy0-L8OlYFTnMcJ9LRb6h_-s\";\n \n \n htmlString.append(photo);\n htmlString.append(\"'>\" + entry.title + \"</a></p>\");\n if(count == 1 ||count == 3 ||count == 6 ||count == 8 ||count == 9) {\n \tvideo =\"http://192.168.0.16:8010/cloud/my_videos/\"+Integer.toString(count);\n \thtmlString.append(\"<a href='\"+video+\"'> - Video</a>\");\n }\n count++;\n \n // If the user set the preference to include summary text,\n // adds it to the display.\n if (pref) {\n htmlString.append(entry.summary);\n }\n }\n// URL url2 = new URL(\"http://192.168.0.16:8000/cloud/images/\");\n// HttpURLConnection conn2 = (HttpURLConnection) url2.openConnection();\n//\t\t\n// //conn2.setDoOutput(true);\n// conn2.setConnectTimeout(10000 /* milliseconds */);\n// conn2.setRequestMethod(\"GET\");\n// conn2.setDoInput(true);\n// conn2.connect();\n// //OutputStream out1 = new BufferedOutputStream(conn2.getOutputStream());\n// \n// \n// InputStream in = new BufferedInputStream(conn2.getInputStream());\n// BufferedReader br = new BufferedReader(new InputStreamReader(in));\n// String test = br.readLine();\n// String output=\"\";\n// while(test != null) {\n// \toutput = output +test;\n// \ttest = br.readLine();\n// }\n// output=\"<html><body><video width=\\\"320\\\" height=\\\"240\\\" controls><source src=\\\"movie.mp4\\\" type=\\\"video/mp4\\\"><source src=\\\"movie.ogg\\\" type=\\\"video/ogg\\\">Your browser does not support the video tag.</video></body></html>\";\n \n return htmlString.toString();\n }", "private static void processFeed(String url, String file, SimpleWriter out) \n {\n \tXMLTree rss = new XMLTree1(url);\n \t\n \t// make sure the rss tree is a valid rss tree\n if(!ensureValidRSSTree(rss, out))\n {\n \tout.println(\"This is not a valid RSS Tree.\");\n \treturn;\n }\n \n // print entire document to file\n outputHeader(rss.child(0), out);\n outputFooter(out);\n \n }", "public interface RssFetcherService {\n\n /**\n * Returns a list of SyndFeed generated by an array of feed urls.\n *\n * @param feedUrls set of rss feed urls\n * @return a list of Rome SyndFeeds generated by the list of urls\n * @throws IOException an I/O exception has occurred\n * @throws FeedException an Feed exception has occurred\n * @throws FetcherException an FetcherException has occurred\n */\n List<SyndFeed> getRssFeeds(Set<String> feedUrls) throws FeedException, IOException,\n FetcherException;\n\n List<Map<String, String>> getAllInformationFromLatestFeed();\n}", "public Feed getFeed(URL feedURLObject, Date lastUpdatedDate, boolean summary) {\n inputStream = null;\n FeedHandler feedHandler = new FeedHandler(lastUpdatedDate, summary);\n if (xmlReader != null && feedURLObject != null) {\n try {\n String encoding = detectEncoding(feedURLObject);\n if (inputStream == null) {\n if (\"file\".equals(feedURLObject.getProtocol())) {\n inputStream = feedURLObject.openStream();\n } else {\n inputStream = client.loadInputStream(feedURLObject);\n }\n }\n InputSource inputSource = new InputSource(inputStream);\n if (encoding != null) {\n inputSource.setEncoding(encoding);\n }\n\n xmlReader.setContentHandler(feedHandler);\n xmlReader.parse(inputSource);\n\n } catch (EndSAXException e) {\n // No problem\n } catch (IOException e) {\n System.err.println(e.getMessage());\n } catch (SAXException e) {\n System.err.println(e.getMessage());\n } finally {\n if (inputStream != null) {\n try {\n inputStream.close();\n } catch (IOException e) {\n System.err.println(e.getMessage());\n }\n }\n }\n }\n return feedHandler.getFeed();\n }", "private String loadXmlFromNetwork(String urlString) throws XmlPullParserException, IOException {\n\t InputStream stream = null;\n\t // Instantiate the parser\n\t StackOverflowXmlParser stackOverflowXmlParser = new StackOverflowXmlParser();\n\t List<Entry> entries = null;\n\t String title = null;\n\t String url = null;\n\t String summary = null;\n\t Calendar rightNow = Calendar.getInstance(); \n\t DateFormat formatter = new SimpleDateFormat(\"MMM dd h:mmaa\");\n\t \n\t // Checks whether the user set the preference to include summary text\n\t SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);\n\t boolean pref = sharedPrefs.getBoolean(\"summaryPref\", false);\n\t \n\t StringBuilder htmlString = new StringBuilder();\n\t htmlString.append(\"<h3>\" + \"title: \" + \"</h3>\");\n\t htmlString.append(\"<em>\" + \" \" + formatter.format(rightNow.getTime()) + \"</em>\");\n\t \n\t try {\n\t stream = downloadUrl(urlString); \n\t entries = stackOverflowXmlParser.parse(stream);\n\t // Makes sure that the InputStream is closed after the app is\n\t // finished using it.\n\t } finally {\n\t if (stream != null) {\n\t stream.close();\n\t } \n\t }\n\t \n\t // StackOverflowXmlParser returns a List (called \"entries\") of Entry objects.\n\t // Each Entry object represents a single post in the XML feed.\n\t // This section processes the entries list to combine each entry with HTML markup.\n\t // Each entry is displayed in the UI as a link that optionally includes\n\t // a text summary.\n\t for (Entry entry : entries) { \n\t htmlString.append(\"<p><a href='\");\n\t htmlString.append(entry.link);\n\t htmlString.append(\"'>\" + entry.title + \"</a></p>\");\n\t // If the user set the preference to include summary text,\n\t // adds it to the display.\n\t if (pref) {\n\t htmlString.append(entry.summary);\n\t }\n\t }\n\t return htmlString.toString();\n\t}", "private RSS(Properties props) throws ParameterError {\n super(new String[0], null);\n Logger static_logger = Logging.getLogger(RSS.class);\n if (static_logger.isDebugEnabled()) {\n static_logger.debug(\"QRS Property=\" + props);\n }\n this.props = props;\n instance = this;\n this.sitesurl_string = props.getProperty(\"qrs.SitesURL\");\n data_feeds = new Hashtable<String, DataFeed>();\n\n String raw_feed_data = props.getProperty(\"qrs.DataFeeds\");\n if (raw_feed_data != null) {\n StringTokenizer tokenizer = new StringTokenizer(raw_feed_data, \" \");\n while (tokenizer.hasMoreTokens()) {\n String feed_name = tokenizer.nextToken().trim();\n makeFeed(feed_name, props);\n }\n }\n\n String sysstat_interval_str = props.getProperty(\"qrs.sysstat\");\n if (sysstat_interval_str != null) {\n int sysstat_interval = Integer.parseInt(sysstat_interval_str);\n TimerQueueingDataFeed feed = new TimerQueueingDataFeed();\n registerFeed(feed, \"DirectEntry\");\n DirectSysStatSupplier supplier = new DirectSysStatSupplier(null, feed);\n supplier.schedule(sysstat_interval);\n }\n\n String gui_id = props.getProperty(GUI_PROPERTY);\n if (gui_id != null) {\n new org.cougaar.qos.qrs.gui.MainWindow(gui_id);\n }\n\n }", "@Override\n protected Void doInBackground(Void... arg0) {\n helper = new LiveFeedParser(999);\n helper.get();\n viewEntries = helper.getViewEntries();\n return null;\n }", "public Set<Anchor> parse(Reader reader, String url) {\n\n Set<Anchor> elements = new HashSet<>();\n String urtContent = null;\n try {\n urtContent = readFully(reader);\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (urtContent == null){\n return elements;\n }\n\n mTag = pTag.matcher(urtContent);\n\n while (mTag.find()) {\n\n String href = mTag.group(1); // get the values of href\n String linkElem = mTag.group(2); // get the text of link Html Element\n\n mLink = pLink.matcher(href);\n\n while (mLink.find()) {\n\n String link = mLink.group(1);\n Anchor anchor = new Anchor();\n anchor.setUrl(link);\n anchor.setText(linkElem);\n\n elements.add(anchor);\n\n }\n }\n return elements;\n }", "@Override\n protected String doInBackground(String... arguments) {\n // Extract arguments\n String urlIn = arguments[0];\n String theaddress=\"\",thetitle=\"\", theimg=\"\", s=\"\";\n ArrayList<String> addressarray= new ArrayList<String>();\n ArrayList<String> titlearray= new ArrayList<String>();\n ArrayList<String> imgarray = new ArrayList<String>();\n ArrayList<String> pricearray = new ArrayList<String>();\n BufferedReader in = null;\n InputStream ins = null;\n\n if (titlePattern == null)\n titlePattern = Pattern.compile(titleRE); // slow, only do once, and not on UI thread\n if(addressPattern == null){\n addressPattern = Pattern.compile(addressRE); // slow, only do once, and not on UI thread\n }\n if(imgPattern == null){\n imgPattern = Pattern.compile(imageRE); // slow, only do once, and not on UI thread\n }\n if(dPattern == null){\n dPattern = Pattern.compile(dRE); // slow, only do once, and not on UI thread\n }\n try {\n int count = 0;\n for(int j=1;j<=3;j++){\n pagenum=j;\n urlIn = urlIn.substring(0, urlIn.length()-1);\n urlIn = urlIn + pagenum;\n ins = openHttpConnection(urlIn);\n in = new BufferedReader(new InputStreamReader(ins));\n\n /* //this approach only reads in a stream\n URL url = new URL(urlIn);\n in = new BufferedReader(\n new InputStreamReader(\n url.openStream()));\n */\n\n String inputLine;\n while ((inputLine = in.readLine()) != null) {\n Matcher amatch = titlePattern.matcher(inputLine);\n if (amatch.find()) {//find title\n thetitle = amatch.group();\n thetitle = thetitle.substring(4,thetitle.length()-5);\n titlearray.add(thetitle);\n }\n Matcher bmatch = addressPattern.matcher(inputLine);\n if (bmatch.find()) {//find address\n theaddress = bmatch.group();\n theaddress = theaddress.substring(10,theaddress.length()-4);\n addressarray.add(theaddress);\n\n inputLine = in.readLine(); //skip a line\n inputLine = in.readLine(); //skip a line\n inputLine = in.readLine(); //skip a line\n inputLine = in.readLine(); //skip a line\n inputLine = in.readLine(); //skip a line\n inputLine = in.readLine(); //skip a line\n inputLine = in.readLine(); //skip a line\n inputLine = in.readLine(); //skip a line\n inputLine = in.readLine(); //skip a line\n inputLine = in.readLine(); //skip a line\n\n Matcher m = dPattern.matcher(inputLine);\n if (m.find()) {\n s = m.group();\n pricearray.add(s);\n// Log.e(\"IMPORTANT\", s);\n }\n }\n Matcher cmatch = imgPattern.matcher(inputLine);\n if (cmatch.find()) {//find image URL\n theimg = cmatch.group();\n theimg = theimg.substring(10,theimg.length()-1);\n imgarray.add(theimg);\n }\n count++;\n }\n }\n for(int i=0; i<addressarray.size(); i++){\n Property returnproperty = new Property(titlearray.get(i),addressarray.get(i), imgarray.get(i), pricearray.get(i));\n datasource.createProperty(returnproperty.getTitle(), returnproperty.getAddress(), returnproperty.getImgURL(), returnproperty.getPrice());\n Log.e(\"Adding Property to DB\", returnproperty.toString());\n }\n Log.e(\"end count\", \"\" + count);\n return getString(R.string.unknown); // never found the pattern\n } catch (IOException e) {\n Log.e(\"ScrapeTemperatures\", \"Unable to open url: \" + url);\n return getString(R.string.unknown);\n } catch (Exception e) {\n Log.e(\"ScrapeTemperatures\", e.toString());\n return getString(R.string.unknown);\n } finally {\n if (in != null)\n try {\n in.close();\n } catch (IOException e) {\n // ignore, we tried and failed to close, limp along anyway\n }\n }\n }", "public Iterator<List<URL>> getUrlIterator(Context context,\n LinearLayout listUrlGroups,\n InputSource source) {\n \tList<List<URL>> urlLists = getUrlLists(context, \n listUrlGroups,\n source);\n \treturn urlLists != null && urlLists.size() > 0\n ? urlLists.iterator() \n : null;\n }", "private URL getFeedUrl() throws MalformedURLException{\n String feedUrl = \"http://\" + host + \":\" + port + \"/xmlfeed\";\n URL url = new URL(feedUrl);\n return url;\n }", "@Scheduled(fixedRate = 120000)\n public void readRss() {\n\n List<ItemNews> itemList = new ArrayList<>();\n\n try {\n String url = \"https://www.nytimes.com/svc/collections/v1/publish/https://www.nytimes.com/section/world/rss.xml\";\n\n try (XmlReader reader = new XmlReader(new URL(url))) {\n SyndFeed feed = new SyndFeedInput().build(reader);\n for (SyndEntry entry : feed.getEntries()) {\n LocalDateTime localDateTime = entry.getPublishedDate().toInstant()\n .atZone(ZoneId.systemDefault())\n .toLocalDateTime();\n ItemNews item = new ItemNews();\n item.setTitle(entry.getTitle());\n item.setAuthor(entry.getAuthor());\n item.setLink(entry.getLink());\n item.setDescription(entry.getDescription().getValue());\n item.setDateTime(localDateTime);\n modifyItem(item);\n itemList.add(item);\n }\n }\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n if (!itemList.isEmpty()) {\n Collections.sort(itemList , Comparator.comparing(ItemNews::getDateTime));\n saveItems(itemList);\n }\n }", "private static List<Message> parse(File f, String sourceUrlString) {\n \t\treturn null;\n \t}", "public RSS getRSS(URL url) throws JAXBException {\n\t\tJAXBContext ctx = JAXBContext.newInstance(RSS.class);\n\t\tUnmarshaller um = ctx.createUnmarshaller();\n\t\tRSS rss = (RSS) um.unmarshal(url);\n\t\treturn rss;\n\t}", "private void parseResponse(String response, List<NewsDetailItem> items) {\n\n Pattern pText = Pattern.compile(ITEM_TEXT_PREF + \".*?\" + ITEM_TEXT_POSTF);\n Pattern pTitle = Pattern.compile(TITLE_PREF + \".*?\" + TITLE_POSTF);\n Pattern pDate = Pattern.compile(\"class=\\\"metadata\\\">.*?</a>\");\n Pattern pDate2 = Pattern.compile(\"</strong>.*?<\");\n\n Pattern pImage2 = Pattern.compile(IMG_PREF + \".*?\" + IMG_POSTF);\n\n Pattern pVideo = Pattern.compile(VIDEO_PREF + \".*?\" + VIDEO_POSTF);\n\n Pattern pImageUrl = Pattern.compile(IMG_URL_PREF + \".*?\" + IMG_URL_POSTF);\n\n Pattern pComment = Pattern.compile(\"li class=\\\" item\\\" id=\\\"comment.*?</li>\");\n Pattern pAuthor = Pattern.compile(\"class=\\\"commentauthor\\\".*?</span>\");\n\n Pattern pAuthorName1 = Pattern.compile(\"'>.*?</span>\");\n Pattern pAuthorName2 = Pattern.compile(\"/>.*?</span>\");\n Pattern pAuthorImage = Pattern.compile(AUTHOR_IMAGE_PREF + \".*?\" + AUTHOR_IMAGE_POSTF);\n\n Pattern pCommentText = Pattern.compile(\"<span id=\\\"co_.*?</li>\");\n Pattern pCommentId = Pattern.compile(COMMENT_ID_PREFIX + \".*?\" + COMMENT_ID_POSTFIX);\n\n Pattern pCommentTex2t = Pattern.compile(\"dislike-counter.*?comment-toolbar\"); //Pattern.compile(COMMENT_PREFIX + \".*?\" + COMMENT_POSTFIX);\n Pattern pCommentText3 = Pattern.compile(COMMENT_PREFIX + \".*?\" + COMMENT_POSTFIX);\n Pattern pThumbsDown = Pattern.compile(\"dislike-counter-comment.*?</span>\");\n Pattern pThumbsUp = Pattern.compile(\"like-counter-comment.*?</span>\");\n Pattern pThumb2 = Pattern.compile(THUMB_PREF + \".*?\" + THUMB_POSTF);\n\n Pattern pCommentDate = Pattern.compile(COMMENTDATE_PREF + \".*?\" + COMMENTDATE_POSTF);\n Pattern pWidth = Pattern.compile(WIDTH_PREF + \".*?\" + WIDTH_POSTF);\n Pattern pHeight = Pattern.compile(HEIGHT_PREF + \".*?\" + HEIGHT_POSTF);\n\n Pattern pAkismet = Pattern.compile(\"vortex_ajax_comment\"+\".*?\"+\";\");\n\n Pattern pAkismet2 = Pattern\n .compile(\"\\\"nonce\\\":\\\".*?\"+\"\\\"\");\n\n Pattern pValue = Pattern.compile(\"value=\\\".*?\\\"\");\n\n Pattern pAk_js = Pattern\n .compile(\"id=\\\"ak_js\\\".*?/>\");\n\n\n String akismet = \"\";\n String ak_js = \"\";\n String postId = \"\";\n Matcher makismet_comment = pAkismet.matcher(response);\n if (makismet_comment.find()) {\n Matcher mvalue = pAkismet2.matcher(makismet_comment.group());\n if (mvalue.find()) {\n akismet = mvalue.group();\n akismet = akismet.replace(\"\\\"\", \"\");\n akismet = akismet.replace(\"nonce:\", \"\");\n }\n }\n\n Matcher mak_js = pAk_js.matcher(response);\n if (mak_js.find()) {\n Matcher mvalue = pValue.matcher(mak_js.group());\n if (mvalue.find()) {\n ak_js = mvalue.group();\n ak_js = ak_js.replace(\"\\\"\", \"\");\n ak_js = ak_js.replace(\"value=\", \"\");\n }\n }\n\n\n Pattern ppost_id = Pattern.compile(\"name=\\\"comment_post_ID\\\".*?/>\");\n Matcher mpost_id = ppost_id.matcher(response);\n if (mpost_id.find()) {\n Matcher mvalue = pValue.matcher(mpost_id.group());\n if (mvalue.find()) {\n postId = mvalue.group();\n postId = postId.replace(\"\\\"\", \"\");\n postId = postId.replace(\"value=\", \"\");\n }\n }\n\n Matcher itemMatcher;\n itemMatcher = pDate.matcher(response);\n String date = \"\";\n if (itemMatcher.find()) {\n itemMatcher = pDate2.matcher(itemMatcher.group());\n if (itemMatcher.find()) {\n date = itemMatcher.group().substring(10);\n date = date.substring(0, date.length() - 2);\n }\n }\n\n Matcher mTitle = pTitle.matcher(response);\n if (mTitle.find()) {\n String itemText = mTitle.group().substring(TITLE_PREF.length()); //(\" dc:title=\\\"\".length()).replace(\"\\\"\", \"\");\n itemText = itemText.substring(0, itemText.length() - TITLE_POSTF.length());\n NewsDetailItem item = new NewsDetailItem();\n item.setText(itemText);\n item.setDate(date);\n item.setContentType(NewsDetailDBHelper.NewsItemType.TITLE.ordinal());\n item.setPostUrl(mUrl);\n item.setCommentId(postId);\n item.setAkismet(akismet);\n item.setAk_js(ak_js);\n items.add(item);\n }\n\n Matcher mText = pText.matcher(response);\n int imageEnd = 0;\n int textStart;\n\n if (mText.find()) {\n String text = mText.group().substring(ITEM_TEXT_PREF.length());\n text = text.substring(0, text.length() - ITEM_TEXT_POSTF.length());\n Matcher mImage = pImage2.matcher(text);\n while (mImage.find()) {\n int textEnd = mImage.start();\n textStart = imageEnd;\n imageEnd = mImage.end();\n String itemText = text.substring(textStart, textEnd);\n addTextItem(items, itemText);\n processImageItem(items, mImage.group(), pImageUrl, pWidth, pHeight);\n }\n\n Matcher mVideo = pVideo.matcher(text);\n while (mVideo.find()) {\n int textEnd = mVideo.start();\n textStart = imageEnd;\n imageEnd = mVideo.end();\n String itemText = \"\";\n if (textEnd >= textStart) {\n itemText = text.substring(textStart, textEnd);\n }\n addTextItem(items, itemText);\n processVideoItem(items, mVideo.group(), pImageUrl, pWidth, pHeight);\n }\n\n text = text.substring(imageEnd);\n addTextItem(items, text);\n }\n\n\n NewsDetailItem item = new NewsDetailItem();\n item.setContentType(NewsDetailDBHelper.NewsItemType.REPLY_HEADER.ordinal());\n item.setPostUrl(mUrl);\n items.add(item);\n\n Matcher mComment = pComment.matcher(response);\n while (mComment.find()) {\n item = new NewsDetailItem();\n item.setContentType(NewsDetailDBHelper.NewsItemType.REPLY.ordinal());\n item.setPostUrl(mUrl);\n items.add(item);\n item.setAkismet(akismet);\n String comment = mComment.group();\n\n // if (comment.contains(CAN_CHANGE_KARMA_PREFIX)) {\n item.setCanChangeKarma(1);\n // } else {\n // item.setCanChangeKarma(0);\n // }\n\n Matcher mAuthor = pAuthor.matcher(comment);\n if (mAuthor.find()) {\n String authorText = mAuthor.group();\n item.setAuthorImage(getAuthorImgage(authorText, pAuthorImage));\n item.setAuthor(getAuthorName(authorText, pAuthorName1, pAuthorName2));\n }\n Matcher mCommentText = pCommentText.matcher(comment);\n if (mCommentText.find()) {\n String s = mCommentText.group();\n mCommentText = pCommentTex2t.matcher(s);\n if (mCommentText.find()) {\n mCommentText = pCommentText3.matcher(mCommentText.group());\n if (mCommentText.find()) {\n String commentText = mCommentText.group().substring(COMMENT_PREFIX.length());\n commentText = commentText.substring(0, commentText.length() - COMMENT_POSTFIX.length());\n commentText = commentText.replace(\"<p>\", \"\");\n commentText = commentText.replace(\"</p>\", \"\");\n item.setText(commentText);\n }\n }\n }\n Matcher mCommentId = pCommentId.matcher(comment);\n if (mCommentId.find()) {\n String commentId = mCommentId.group().substring(COMMENTDATE_PREF.length());\n commentId = commentId.substring(0, commentId.length() - COMMENT_ID_POSTFIX.length());\n item.setCommentId(commentId);\n }\n Matcher mCommentDate = pCommentDate.matcher(comment);\n if (mCommentDate.find()) {\n String commentDate = mCommentDate.group().substring(COMMENTDATE_PREF.length());\n commentDate = commentDate.substring(0, commentDate.length() - COMMENTDATE_POSTF.length());\n item.setDate(commentDate);\n }\n item.setKarmaUp(getKarma(comment, pThumbsUp, pThumb2));\n item.setkarmaDown(getKarma(comment, pThumbsDown, pThumb2));\n }\n }", "public List<RSSItem> getRSSItems() {\n String SearchURL = FeedContext;\n Log.getInstance().write(Log.LOGLEVEL_VERBOSE, \"RecordingEpisode.getRSSItems FeedContext = \" + FeedContext);\n return RSSHelper.getRSSItems(SearchURL);\n }", "public void openNewFeed(final String datfeed) {\n\n //close the navigation drawer\n closeDrawer();\n\n //show swipe refresh\n swiperefresh.setRefreshing(true);\n\n //detect if there's a connection issue or not: if there's a connection problem stop refreshing and show message\n if (cM.getActiveNetworkInfo() == null) {\n Toast toast = Toast.makeText(getBaseContext(), R.string.no_internet, Toast.LENGTH_SHORT);\n toast.show();\n swiperefresh.setRefreshing(false);\n\n } else {\n\n Thread thread = new Thread(new Runnable() {\n @Override\n public void run() {\n DOMParser tmpDOMParser = new DOMParser();\n fFeed = tmpDOMParser.parseXml(datfeed);\n ListActivity.this.runOnUiThread(new Runnable() {\n\n @Override\n public void run() {\n if (fFeed != null && fFeed.getItemCount() > 0) {\n\n adapter.notifyDataSetChanged();\n\n //close swipe refresh\n swiperefresh.setRefreshing(false);\n\n //set feedURL calling setFeedString method, it is important if we want working swipe refresh listener\n setFeedString(datfeed);\n }\n }\n });\n }\n });\n thread.start();\n }\n }", "public abstract XMLDocument parse(URL url);", "@Override\n \t\tprotected Bitmap doInBackground(String... urls) {\n \t\t\tString urldisplay = urls[0];\n \t\t\tBitmap mIcon11 = null;\n \t\t\ttry {\n \t\t\t\tInputStream in = new java.net.URL(urldisplay).openStream();\n \t\t\t\tmIcon11 = BitmapFactory.decodeStream(in);\n \t\t\t} catch (Exception e) {\n \t\t\t\tLog.e(\"Error\", e.getMessage());\n \t\t\t\te.printStackTrace();\n \t\t\t}\n \t\t\tif (mIcon11 != null) addBitmapToMemoryCache(urls[0], mIcon11);\n \t\t\treturn mIcon11;\n \t\t}", "private List<FeedItemRO> getFeedFromGoogle() {\n\t\t// create RO list\n\t\tList<FeedItemRO> feedItemROs = new ArrayList<>();\n\t\t// parse the data with ROME library inside a try-catch so that if there is a connection problem it will throw an exception.\n\t\tURL feedUrl;\n\t\ttry {\n\t\t\tfeedUrl = new URL(\"https://news.google.com/gn/news/?ned=us&gl=US&hl=en&output=rss\");\n\t\t\tSyndFeedInput input = new SyndFeedInput();\n\t\t\tSyndFeed feed = input.build(new XmlReader(feedUrl));\n\t\t\t\n\t\t\t// every news story in the feed is an entry, for each one construct a RO with title, link, description and add it to the list. \n\t\t\tList<SyndEntry> entries = feed.getEntries();\n\t\t\tfor (SyndEntry syndEntry : entries) {\n\t\t\t\tfeedItemROs.add(new FeedItemRO(syndEntry.getTitle(),syndEntry.getLink(), syndEntry.getDescription().getValue()));\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\t//Should be logged properly\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\t// return RO list of news stories.\n\t\treturn feedItemROs;\n\t}", "public static void processFeeds(List<FeedContext> fcs) {\n for (FeedContext fc : fcs) {\n try {\n processFeed(fc);\n }\n catch (Exception e) {\n mLog.error(\"Skipping feed at URL [\" + fc.getFeedUrl() +\n \"] due to error while processing: \" + e,e);\n }\n\t\t}\n\t}", "public Feed getFeed(String feedURL, Date lastUpdatedDate) throws MalformedURLException {\n return getFeed(feedURL, lastUpdatedDate, false);\n }", "@Override\n protected String doInBackground(String... args) {\n // rss link url\n String query_url = args[0];\n\n // weather object of rss.\n woeid = parser.getRSSFeedWeather2(query_url);\n\n // updating UI from Background Thread\n runOnUiThread(new Runnable() {\n public void run() {\n /**\n * Updating parsed data into text view.\n * */\n Intent intent = new Intent(MainActivity.this, Summit.class);\n String description = woeid.getWoeid();\n intent.putExtra(EXTRA_MESSAGE, description);\n // Log.d(\"Long\", description);\n startActivity(intent);\n }\n });\n return null;\n }", "public Object parseChannel(int rssType, Document doc) throws Exception;", "public static ArrayList<DigitalNewspapers> getDigitalNewsSources(){\n\n Uri builtUri = Uri.parse(BASE_NEWSAPI_SOURCES_EP).buildUpon()\n .build();\n\n URL url = null;\n\n try {\n url = new URL(builtUri.toString());\n return doCall(url);\n\n } catch (MalformedURLException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n return null;\n }", "public static void main(String[] args) throws MalformedURLException, InterruptedException\n\t{\n\n\t\tint meterNum = 10;\n//\t\tif(Integer.parseInt(args[1]) > 0) {\n//\t\t\tmeterNum = Integer.parseInt(args[1]);\n//\t\t}\n\t\t\n\t\tint threadNum = 5;\n\t\tint totalDocNum = 10;\n\t\t\n\t\tSystem.gc();\n\t\t\n\t\tmeterStream[] ms = new meterStream[meterNum]; \t\t\t\n\t\t\n\t\tfor(int i = 0 ; i < meterNum ; i++)\n\t\t{\n\t\t\tms[i] = new meterStream();\n\t\t\t//ms[i].setUrl(\"http://service2.allenworkspace.net/xml/xmldata/testxml\"+(i+1)+\".xml\");\n\t\t\tms[i].setUrl(\"http://program.allenworkspace.net/xml/xmldata/testxml\"+(i+1)+\".xml\");\t\t\t\t\t\t\t\t\t\n\t\t\t\n\t\t}\n\t\t\n\t\t/*\n\t\tString[] xpathArray = new String[] {\"/a0CC175B9C0F1B6A831C399E269772661/a92EB5FFEE6AE2FEC3AD71C777531578F/@aB80BB7740288FDA1F201890375A60C8F\",\n\t\t\t\t\"/a0CC175B9C0F1B6A831C399E269772661/a4A8A08F09D37B73795649038408B5F33/@a2063C1608D6E0BAF80249C42E2BE5804\"};\n\t\t*/\n\t\t\n\t\tString[] xpathArray = new String[] {\"/a0CC175B9C0F1B6A831C399E269772661/a92EB5FFEE6AE2FEC3AD71C777531578F/\",\n\t\t\t\t\"/a0CC175B9C0F1B6A831C399E269772661/a4A8A08F09D37B73795649038408B5F33/\"};//YFilter專用\n\t\t\n\t\tList<String> xpathList = new ArrayList<String>();\n\t\tCollections.addAll(xpathList, xpathArray);\n\t\t\n\t\t//List<XMLDogTask> taskPool = null;\n\t\t//List<SaxonTask> taskPool = null;\n\t\tList<YFilterTask> taskPool = null;\n\t\t\n\t\tif(threadNum > 0) {\n\t\t\t//taskPool = TaskPool.CreateXMLDogTasks(threadNum, xpathList);\n\t\t\t//taskPool = TaskPool.CreateSaxonTasks(threadNum, xpathList);\n\t\t\ttaskPool = TaskPool.CreateYFilterTasks(threadNum, xpathList);\n\t\t\t\n\t\t\t/*\n\t\t\tfor(int i = 0; i < threadNum; ++i) {\n\t\t\t\tDefaultNamespaceContext nsContext = new DefaultNamespaceContext(); // an implementation of javax.xml.namespace.NamespaceContext\n\t\t\t\tnsContext.declarePrefix(\"xsd\", Namespaces.URI_XSD);\n\t\t\t\tdog = new XMLDog(nsContext);\n\t\t\t\ttry \n\t\t\t\t{\n\t\t\t\t\tExpression xpath1 = dog.addXPath(\"/a0CC175B9C0F1B6A831C399E269772661/a92EB5FFEE6AE2FEC3AD71C777531578F/@aB80BB7740288FDA1F201890375A60C8F\");\n\t\t\t\t\tExpression xpath2 = dog.addXPath(\"/a0CC175B9C0F1B6A831C399E269772661/a4A8A08F09D37B73795649038408B5F33/@a2063C1608D6E0BAF80249C42E2BE5804\");\t\n\t\t\t\t} \n\t\t\t\tcatch (SAXPathException e) \n\t\t\t\t{\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\t} */\n\t\t}\n\t\t\n\t\tExecutorService executorService = Executors.newFixedThreadPool(threadNum);\n\t\tExecutorService reducerService = Executors.newCachedThreadPool(); \n\t\tList<Future<List<String>>> resultList = null;\n\t\t\n\t\tlong starttime = System.currentTimeMillis();\n\t\t\n\t\tfor(int i = 0 ; i < totalDocNum ; i++ )\n\t\t{\n\t\t\t//callXMLDogFilter myFilter = new callXMLDogFilter(ms[i%meterNum].strURI);\n\t\t\t//callSaxonFilter myFilter = new callSaxonFilter(ms[i%meterNum].strURI);\n\t\t\tcallYFilter myFilter = new callYFilter(ms[i%meterNum].strURI);\n\t\t\t\n\t\t\tmyFilter.SetTaskList(taskPool);\n\t\t\t// myFilter.setStream(ms[i%meterNum].getStream());\n\t\t\t/* myThreads[t] = new Thread(testFilter[t]);\n\t\t\tmyThreads[t].start(); */\n\t\t\tFuture<List<String>> result = executorService.submit(myFilter);\n\t\t\tif(i % meterNum == 0) {\n\t\t\t\tresultList = new ArrayList<Future<List<String>>>();\n\t\t\t} \n\t\t\tresultList.add(result);\n\t\t\tif(resultList.size() == meterNum) {\n\t\t\t\t//ExecuteService myReducer = Executors.newFixedThreadPool(threadNum)\n\t\t\t\tString taskID = (i/meterNum)+\"\";\n\t\t\t\t\n\t\t\t\t//XMLDogTaskReducer reducer = (XMLDogTaskReducer) TaskReducerFactory.Create(\"XMLDogTaskReducer\");\n\t\t\t\t//SaxonTaskReducer reducer = (SaxonTaskReducer) TaskReducerFactory.Create(\"SaxonTaskReducer\");\n\t\t\t\tYFilterTaskReducer reducer = (YFilterTaskReducer) TaskReducerFactory.Create(\"YFilterTaskReducer\");\n\t\t\t\t\n\t\t\t\treducer.SetID(taskID);\n\t\t\t\treducer.resultList = resultList;\t\t\t\t\t\n\t\t\t\treducerService.execute(reducer);\n\t\t\t}\n\t\t\t// resultList.add(result);\n\t\t}\n\t\texecutorService.shutdown(); \n\t\texecutorService.awaitTermination(30, TimeUnit.MINUTES);\n\t\treducerService.shutdown();\n\t\treducerService.awaitTermination(30, TimeUnit.MINUTES);\n\t\t\t\t\n\t\tlong endTime = System.currentTimeMillis();\n\t\tSystem.out.println((\"duration:\" + (endTime - starttime)));\n\t}", "@Override\n protected List<Flower> doInBackground(String... params) {\n // InputStream in = null;\n String content = HttpManager.getData(params[0]);\n flowerList = JSONParser.parserFeed(content);\n return flowerList;\n }", "private void parseJsonFeed(JSONObject response) {\n try {\n JSONArray feedArray = response.getJSONArray(\"feed\");\n\n for (int i = 0; i < feedArray.length(); i++) {\n JSONObject feedObj = (JSONObject) feedArray.get(i);\n\n FeedItem item = new FeedItem();\n item.setId(feedObj.getInt(\"organisation_id\"));\n item.setPortId(feedObj.getInt(\"portfolio_id\"));\n item.setName(feedObj.getString(\"name\"));\n //int id=item.getId();\n // Image might be null sometimes\n String image = feedObj.isNull(\"image\") ? null : feedObj.getString(\"image\");\n item.setImge(image);\n item.setStatus(feedObj.getString(\"status\"));\n item.setProfilePic(feedObj.getString(\"profilePic\"));\n item.setTimeStamp(feedObj.getString(\"timeStamp\"));\n item.setCommentCount(feedObj.getString(\"commentCount\"));\n\n // url might be null sometimes\n String feedUrl = feedObj.isNull(\"url\") ? null : feedObj.getString(\"url\");\n item.setUrl(feedUrl);\n\n feedItems.add(item);\n }\n\n\n // notify data changes to list adapater\n listAdapter.notifyDataSetChanged();\n\n\n } catch (JSONException e) {\n e.printStackTrace();\n }\n }", "private List<DBFeedModel> parseResult(ConnectionResult connectionResult) {\n try {\n JSONObject response = new JSONObject(connectionResult.getResult());\n JSONArray posts = response.optJSONArray(\"posts\");\n List<DBFeedModel> feedsList = new ArrayList<>();\n\n for (int i = 0; i < posts.length(); i++) {\n JSONObject post = posts.optJSONObject(i);\n DBFeedModel item = new DBFeedModel();\n item.setViewType(Constants.FEED_VIEW_TYPE_LEFT);\n item.setTitle(post.optString(\"title\"));\n item.setThumb(post.optString(\"thumbnail\"));\n item.setUrl(\"http://m.dantri.com.vn/xa-hoi/hai-phong-yeu-cau-thao-do-rong-vang-dau-pikachu-gay-tranh-cai-20170108172552427.htm\");\n feedsList.add(item);\n }\n\n return feedsList;\n } catch (JSONException e) {\n e.printStackTrace();\n }\n\n return null;\n }", "public DocumentListFeed getAllFeeds() throws MalformedURLException, IOException, ServiceException;", "public void refreshRssFeed( ContactRssImpl rssURL)\n {\n submitRssQuery(rssURL, true);\n }", "private static FeedSource createFeedSource(String name, URL url) {\n FeedSource feedSource = new FeedSource();\n feedSource.fetchFrequency = FetchFrequency.MINUTES;\n feedSource.fetchInterval = 1;\n feedSource.deployable = false;\n feedSource.name = name;\n feedSource.projectId = project.id;\n feedSource.retrievalMethod = FeedRetrievalMethod.FETCHED_AUTOMATICALLY;\n feedSource.url = url;\n return feedSource;\n }", "@Override\n protected String doInBackground(String... urls) {\n String response = \"\";\n HttpURLConnection urlConnection = null;\n for (String url : urls) {\n try {\n URL urlObject = new URL(url);\n urlConnection = (HttpURLConnection) urlObject.openConnection();\n\n InputStream content = urlConnection.getInputStream();\n\n BufferedReader buffer = new BufferedReader(new InputStreamReader(content));\n String s = \"\";\n while ((s = buffer.readLine()) != null) {\n response += s;\n }\n\n } catch (Exception e) {\n response = \"Unable to download the list of posts, Reason: \"\n + e.getMessage();\n }\n finally {\n if (urlConnection != null)\n urlConnection.disconnect();\n }\n }\n return response;\n\n }", "public List<Recurso> getRecursos(String feedUrl, boolean ind) {\r\n\t\tURL url = null;\r\n\t\tthis.individual = ind;\r\n\t\t\r\n\t\ttry {\r\n\r\n\t\t\tSAXParserFactory spf = SAXParserFactory.newInstance();\r\n\t\t\tSAXParser sp = spf.newSAXParser();\r\n\t\t\tXMLReader xr = sp.getXMLReader();\r\n\r\n\t\t\turl = new URL(feedUrl);\r\n\r\n\t\t\txr.setContentHandler(this);\r\n\t\t\txr.parse(new InputSource(url.openStream()));\r\n\r\n\t\t} catch (IOException e) {\r\n\t\t\tLog.e(\"RSS Handler IO\", e.getMessage() + \" >> \" + e.toString());\r\n\t\t} catch (SAXException e) {\r\n\t\t\tLog.e(\"RSS Handler SAX\", e.toString());\r\n\t\t} catch (ParserConfigurationException e) {\r\n\t\t\tLog.e(\"RSS Handler Parser Config\", e.toString());\r\n\t\t}\r\n\r\n\t\treturn listaRecursos;\r\n\t}", "public synchronized Node parse(String url) throws IOException,SAXException\n {\n if(log.isDebugEnabled())\n log.debug(\"parse: \"+url);\n return parse(new InputSource(url));\n }", "public Feed getFeed(String feedURL, Date lastUpdatedDate, boolean summary) throws MalformedURLException {\n return getFeed(new URL(feedURL), lastUpdatedDate, summary);\n }", "public void parse(String uri, DefaultHandler handler) throws SAXException,\n IOException {\n if (uri == null) {\n throw new IllegalArgumentException(\"uri must not be null\");\n }\n parse(new InputSource(uri), handler);\n }", "public static void main(String[] args) {\n\t\tNewsLKSpider spider = new NewsLKSpider();\r\n\t\tint i = 0;\r\n\t\twhile (i <= 280) {\r\n\t\t\tSystem.out.println(i);\r\n\t\t\tString thisUrl = spider.newsURL + String.valueOf(i);\r\n\t\t\tString referer = \"\";\r\n\t\t\tif (i == 0) {\r\n\t\t\t\treferer = spider.newsReferer;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\treferer = spider.newsURL + String.valueOf(i - 20);\r\n\t\t\t}\r\n\t\t\tString searchContent = spider.getContent(thisUrl, spider.searchCookie, referer);\r\n\t\t\tspider.getAElement(searchContent);\r\n\t\t\tint times = (int) (Math.random() * 10000 + 10000.);\r\n\t\t\tSystem.out.println(times);\r\n\t\t\ttry {\r\n\t\t\t\tThread.sleep(times);\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\ti = i + 20;\r\n\t\t}\r\n\t\tSystem.out.println(\"There are \" + spider.aElemenets.size() + \" news in list.\");\r\n\t\ti = 0;\r\n\t\tSet<Entry<String,String>> keyValue= spider.aElemenets.entrySet();\r\n\t\tfor (Entry<String,String> onePaire : keyValue) {\r\n\t\t\tSystem.out.println(i + \" : \" + onePaire.getValue());\r\n\t\t\tspider.getNewsContent(onePaire.getValue(), onePaire.getKey());\r\n\t\t\ti += 1;\r\n\t\t\tint times = (int) (Math.random() * 10000 + 5000.);\r\n\t\t\tSystem.out.println(\"Sleep times :\"+times);\r\n\t\t\ttry {\r\n\t\t\t\tThread.sleep(times);\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}\r\n\t}", "public void parse(String uri, HandlerBase handler) throws SAXException,\n IOException {\n if (uri == null) {\n throw new IllegalArgumentException(\"uri must not be null\");\n }\n parse(new InputSource(uri), handler);\n }", "@Override\n\tprotected Bitmap doInBackground(URL... urls) {\n\t\t\n\t try {\n\t \tHttpURLConnection connection = (HttpURLConnection) urls[0].openConnection();\n\t \tconnection.setDoInput(true);\n\n\t\t\tconnection.connect();\n\n\t\t\tInputStream input;\n\n\t\t\tinput = connection.getInputStream();\n\t\t Bitmap bitmap = BitmapFactory.decodeStream(input);\n\t\t\treturn bitmap;\n\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 return null;\n\t}", "public Object parseItem(int rssType, Document doc, int index) throws Exception;", "private boolean isNotValidRss(final String url) throws FeedException, IOException {\n final SyndFeed feed = FeedHandler.getFeed(url);\n final List<SyndEntry> items = feed.getEntries();\n if (items.isEmpty()) {\n return true;\n }\n for (SyndEntry item : items) {\n if (item.getPublishedDate() == null) {\n return true;\n }\n }\n return false;\n }", "Schedule[] parse(String url, String name) throws IOException;", "private int getHitsAndArticlesByURL(Category node, String url)\r\n\t{\r\n\t\tDocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();\r\n\t\tint NumRes = 0;\r\n\t\tString totalHits;\r\n\t\ttry{\r\n\t\t\tURL queryurl = new URL(url);\r\n\t\t\tURLConnection connection = queryurl.openConnection();\r\n\t\t\tconnection.setDoInput(true);\r\n\t\t\tInputStream inStream = connection.getInputStream();\r\n\t\t\tDocumentBuilder dombuilder = domfac.newDocumentBuilder();\r\n\t\t\tDocument doc = dombuilder.parse(inStream);\r\n\t\t\tElement root = doc.getDocumentElement();\r\n\t\t\tNodeList resultset_web = root.getElementsByTagName(\"resultset_web\");\r\n\t\t\tNode resultset = resultset_web.item(0);\r\n\t\t\t\r\n\t\t\ttotalHits = resultset.getAttributes().getNamedItem(\"totalhits\").getNodeValue();\r\n\t\t\tNumRes = Integer.parseInt(totalHits);\r\n\t\t\t\r\n\t\t\tint count = 0;\r\n\t\t\tNodeList results = resultset.getChildNodes(); \r\n\t\t\tif(results != null)\r\n\t\t\t{\t\t\t\r\n\t\t\t\tfor(int i = 0 ; i < results.getLength(); i++){\r\n\t\t\t\t\tNode result = results.item(i);\t\t\t\t\t\t\t\t\r\n\t\t\t\t\tArticle newArticle = new Article();\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(result.getNodeType()==Node.ELEMENT_NODE){\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tfor(Node node1 = result.getFirstChild(); node1 != null; node1 = node1.getNextSibling()){\r\n\t\t\t\t\t\t\tif(node1.getNodeType()==Node.ELEMENT_NODE){\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tif(node1.getNodeName().equals(\"url\") && node1.getFirstChild() != null && count < 4){\r\n\t\t\t\t\t\t\t\t\tcount++;\r\n\t\t\t\t\t\t\t\t\tString pageUrl = node1.getFirstChild().getNodeValue();\r\n\t\t\t\t\t\t\t\t\tArticle article = new Article();\r\n\t\t\t\t\t\t\t\t\tarticle.URL = pageUrl;\r\n\t\t\t\t\t\t\t\t\tarticle.words = getWordsLynx.runLynx(pageUrl);\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tnode.articles.add(article);\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}\r\n\t\t\t\t\t}\t\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}catch(ParserConfigurationException e){\r\n\t\t\te.printStackTrace();\r\n\t\t\treturn -1;\r\n\t\t}catch(SAXException e){\r\n\t\t\te.printStackTrace();\r\n\t\t\treturn -1;\r\n\t\t}catch(IOException e){\r\n\t\t\te.printStackTrace();\r\n\t\t\treturn -1;\r\n\t\t}\r\n\r\n\t\treturn NumRes;\r\n\t}", "java.lang.String getFeed();", "@Override\n protected Bitmap doInBackground(String... urls) {\n Bitmap bitmap = null;\n Bitmap thumbnail = null;\n try {\n URL url = new URL(urls[0]);\n // Read bitmap from url\n bitmap = BitmapFactory.decodeStream(url.openConnection().getInputStream());\n // Resize bitmap to thumbnail\n thumbnail = Bitmap.createScaledBitmap(bitmap, 149, 101, true);\n } catch(IOException e) {\n System.out.println(e);\n } finally {\n if (thumbnail != null) {\n // Save bitmap and thumbnail into cache\n ImageCache.addBitmapToMemoryCache(urls[0], bitmap);\n ImageCache.addthumbnailToMemoryCache(urls[0], thumbnail);\n }\n if (this.isThumbnail) {\n return thumbnail;\n } else {\n return bitmap;\n }\n }\n }", "public interface RSSService {\n\n //if only RSS feeds used the last-modified tag..\n @HEAD\n Call<Void> headFeed(@Url String url);\n\n @GET\n Call<RSSFeed> getFeed(@Url String url);\n}", "public void addURLSeries(List urls) {\n/* 143 */ List listToAdd = null;\n/* 144 */ if (urls != null) {\n/* 145 */ listToAdd = new ArrayList(urls);\n/* */ }\n/* 147 */ this.urlSeries.add(listToAdd);\n/* */ }", "private void refreshFeed() {\n Calendar cal = new GregorianCalendar();\n cal.set(Calendar.HOUR_OF_DAY, 0);\n cal.set(Calendar.MINUTE, 0);\n cal.set(Calendar.SECOND, 0);\n cal.set(Calendar.DATE, cal.get(Calendar.DATE) - DEFAULT_DAYS_BACK);\n String asOfDate = iso8601.fromCalendar(cal);\n \n feedService.feed(asOfDate, new Callback<List<Post>>() {\n @Override\n public void success(List<Post> posts, Response response) {\n Log.i(TAG, \"Received \" + posts.size() + \" posts from the feed service.\");\n \n ArrayList<Post> p = new ArrayList<Post>(posts);\n postArrayAdapter = new PostArrayAdapter(context, R.layout.listitem_feed, p);\n listView.setAdapter(postArrayAdapter);\n }\n \n @Override\n public void failure(RetrofitError retrofitError) {\n //TODO: Handle this better\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 }\n });\n }", "@Override\n protected ArrayList<Object> doInBackground(String... params) {\n RequestBody postData = new FormEncodingBuilder()\n .add(\"type\", \"json\")\n .build();\n\n ArrayList<Object> feedDataList = CMFeedJsonUtil.feed(params[0], postData);\n Log.d(\"Tag\", feedDataList.toString());\n return feedDataList;\n }", "public void setRssUrlList(List<String> rssUrlList) {\n\t\tthis.rssUrlList = rssUrlList;\n\t}", "private void pullLinks(String htmlPage) {\n\n Document doc = Jsoup.parse(htmlPage);\n Elements links = doc.select(\"a[href]\");\n\n for (Element link : links) {\n\n String possibleUrl = link.attr(\"abs:href\");\n\n if (!possibleUrl.equals(\"\")) {\n// Log.v(\"pullLinks\", \" will try to make URL from\" + possibleUrl);\n //if the link attr isn't empty, make a URL\n URL theUrl = NetworkUtils.makeURL(possibleUrl);\n\n if (RegexUtils.urlDomainNameMatch(firstLinkAsString, theUrl.toString())) {\n //if the string version of url is within the same domain as original query\n if (!visitedLinks.contains(theUrl.toString())) {\n// Log.v(\"DLAsyncTask.pullLinks\", \" thinks that \" + theUrl.toString() + \" wasn't visited, add into collected...\");\n collectedLinks.add(theUrl.toString());\n }\n }\n }\n\n }\n }", "public List<List<URL>> getUrlLists(Context context,\n LinearLayout listUrlGroups,\n InputSource source) {\n \tList<List<URL>> variableNumberOfInputURLs = \n new ArrayList<List<URL>>();\n \t\n \ttry {\n switch (source) {\n // If the user selects the defaults source, return the\n // default list of URL lists.\n case DEFAULT:\n variableNumberOfInputURLs = getDefaultUrlList();\n break;\n\t \n // Take input from the Android UI.\n case USER:\n // Iterate over the children of the LinearLayout that\n // holds the list of URL lists.\n int numChildViews = \n listUrlGroups.getChildCount();\n for (int i = 0; i < numChildViews; ++i) {\n AutoCompleteTextView child = (AutoCompleteTextView)\n listUrlGroups.getChildAt(i);\n \n // Create a new URL list and add each URL\n // separated by commas to the list\n List<URL> urls = new ArrayList<URL>();\n StringTokenizer tokenizer =\n new StringTokenizer(child.getText().toString(), \", \");\n\n while (tokenizer.hasMoreTokens()) \n urls.add(new URL(tokenizer.nextToken().trim()));\n \n // Add the list of URLs to the main list\n variableNumberOfInputURLs.add(urls);\n }\n\n break;\n \t\t\t\n default:\n UiUtils.showToast(context,\n \"Invalid Source\");\n return null;\n }\n \t} catch (MalformedURLException e) {\n UiUtils.showToast(context,\n \"Invalid URL\");\n return null;\n \t}\n \t\n \treturn variableNumberOfInputURLs;\n }", "public Object parseImage(int rssType, Document doc) throws Exception;", "private void parseLastfm() {\t\t\r\n\t\tfor(String artist : library.getCopyArtists()) {\r\n\t\t\ttry {\r\n\t\t\t\tartist = URLEncoder.encode(artist, \"UTF-8\");\r\n\t\t\t} catch (UnsupportedEncodingException e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t\tthis.wq.execute(new Fetcher(artist, library));\r\n\t\t}\r\n\t}", "public boolean isRSS() { return _rss!=null; }", "private void setFeedString(String feed_string) {\n\n feedURL = feed_string;\n }", "protected Drawable doInBackground(String... url) {\n try {\n\t\t\tInputStream is = (InputStream) new URL(url[0]).getContent();\n\t\t\tDrawable d = Drawable.createFromStream(is, \"src\");\n\t\t\treturn d;\n\t\t} \n\t\t\t\t\n\t\tcatch (Exception e) {\n\t\t\t//do nothing\n\t\t\treturn null;\n\t\t}\n }", "@Deprecated\n public static void _main(String args[])\n {\n System.out.println(\"Starting...\");\n\n CoroutineManager co = new CoroutineManager();\n int appCoroutineID = co.co_joinCoroutineSet(-1);\n if (appCoroutineID == -1)\n {\n System.out.println(\"ERROR: Couldn't allocate coroutine number.\\n\");\n return;\n }\n IncrementalSAXSource parser=\n createIncrementalSAXSource();\n\n // Use a serializer as our sample output\n com.sun.org.apache.xml.internal.serialize.XMLSerializer trace;\n trace=new com.sun.org.apache.xml.internal.serialize.XMLSerializer(System.out,null);\n parser.setContentHandler(trace);\n parser.setLexicalHandler(trace);\n\n // Tell coroutine to begin parsing, run while parsing is in progress\n\n for(int arg=0;arg<args.length;++arg)\n {\n try\n {\n InputSource source = new InputSource(args[arg]);\n Object result=null;\n boolean more=true;\n parser.startParse(source);\n for(result = parser.deliverMoreNodes(more);\n result==Boolean.TRUE;\n result = parser.deliverMoreNodes(more))\n {\n System.out.println(\"\\nSome parsing successful, trying more.\\n\");\n\n // Special test: Terminate parsing early.\n if(arg+1<args.length && \"!\".equals(args[arg+1]))\n {\n ++arg;\n more=false;\n }\n\n }\n\n if (result instanceof Boolean && ((Boolean)result)==Boolean.FALSE)\n {\n System.out.println(\"\\nParser ended (EOF or on request).\\n\");\n }\n else if (result == null) {\n System.out.println(\"\\nUNEXPECTED: Parser says shut down prematurely.\\n\");\n }\n else if (result instanceof Exception) {\n throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException((Exception)result);\n // System.out.println(\"\\nParser threw exception:\");\n // ((Exception)result).printStackTrace();\n }\n\n }\n\n catch(SAXException e)\n {\n e.printStackTrace();\n }\n }\n\n }", "public Feed getFeed(String feedURL, boolean summary) throws MalformedURLException {\n return getFeed(feedURL, null, summary);\n }", "public FeedParsers() {\n super(FEED_PARSERS_KEY);\n }", "@Override\r\n\tpublic void run()\r\n\t{\r\n\t\twhile(true)\r\n\t\t{\r\n\t\t\t//System.out.println(\"beginning of Parser code\");\r\n\t\t\t\r\n\t\t\t//pull a page from the page que\r\n\t\t\ttry \r\n\t\t\t{\r\n\t\t\t\tpageText = SharedPage.getNextPage();\r\n\t\t\t\t//System.out.println(\"Parser Page Pulled\");\r\n\t\t\t} \r\n\t\t\tcatch (InterruptedException e) \r\n\t\t\t{\r\n\t\t\t\t//do nothing\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t//search the page for all links in anchor (<a href=\"\") elements\r\n\t\t\t\r\n\t\t\t//Regex\r\n\t\t\t//loop will execute for each link found\r\n\t\t\tPattern pattern = Pattern.compile(\"href=\\\"(http:.*?)\\\"\");\r\n\t\t\tMatcher matcher = null;\r\n\t\t\t\r\n\t\t\t//Some pages are returning null values\r\n\t\t\tif(pageText != null)\r\n\t\t\t{\r\n\t\t\t\tmatcher = pattern.matcher(pageText);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t//add each link found to the link queue\r\n\t\t\t\r\n\t\t\t//sometimes matcher is returning null values\r\n\t\t\twhile(matcher != null && matcher.find())\r\n\t\t\t{\r\n\t\t\t\tString link = matcher.group(1);\r\n\t\t\t\r\n\t\t\t\ttry \r\n\t\t\t\t{\r\n\t\t\t\t\tSharedLink.addLink(link);\r\n\t\t\t\t} \r\n\t\t\t\tcatch (InterruptedException e) \r\n\t\t\t\t{\r\n\t\t\t\t\t//do nothing\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t//search the page for keywords specified by the user of the webcrawler\r\n\t\t\tArrayList<String> keywords = WebCrawlerConsole.getKeywords();\r\n\t\t\t\r\n\t\t\t\tfor(String word : keywords)\r\n\t\t\t\t{\r\n\t\t\t\t\t//cannot split pageText if it is null\r\n\t\t\t\t\tif(pageText != null)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tString[] keywordSearch = pageText.split(word);\r\n\t\t\t\t\t\tfor(int i=0; i < keywordSearch.length; i++)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tWebCrawlerConsole.keywordHit();\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//System.out.println(\"end of Parser code\");\r\n\t\t}\r\n\t}", "public void init() {\n BufferedReader in = null;\n try {\n //URL feed = new URL(\"http://twitter.com/statuses/user_timeline/48274520.rss\");\n URL feed = new URL(\"http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=g_damian\");\n in = new BufferedReader(new InputStreamReader(feed.openStream()));\n String inputLine;\n String data = null;\n while ((inputLine = in.readLine()) != null) {\n inputLine = inputLine.trim();\n if (inputLine.startsWith(\"<created_at>\") && inputLine.endsWith(\"</created_at>\")) {\n inputLine = inputLine.substring(12, inputLine.length() - 13);\n data = inputLine.replaceAll(\"\\\\+\\\\d* \", \"\");\n }\n if (inputLine.startsWith(\"<text>\") && inputLine.endsWith(\"</text>\")) {\n inputLine = inputLine.substring(6, inputLine.length() - 7);\n buffer.append(escapeMessage(inputLine));\n buffer.append(\"<br/>[\" + data + \"]\");\n buffer.append(\"\\n\");\n }\n }\n in.close();\n } catch (MalformedURLException ex) {\n Logger.getLogger(ShowTweetsApplet.class.getName()).log(Level.SEVERE, null, ex);\n appendException(buffer, ex);\n } catch (IOException ex) {\n Logger.getLogger(ShowTweetsApplet.class.getName()).log(Level.SEVERE, null, ex);\n appendException(buffer, ex);\n } finally {\n try {\n if (in != null) {\n in.close();\n }\n } catch (IOException ex) {\n Logger.getLogger(ShowTweetsApplet.class.getName()).log(Level.SEVERE, null, ex);\n appendException(buffer, ex);\n }\n }\n }", "public MsxReader ( URL url ) {\r\n\t\tsuper();\r\n\r\n\t\taddURL(url);\r\n\t}", "protected void scrapeUrl() {\n String baseUrl = \"https://time.com\";\n int sectionsLen = TIME_SECTIONS.length;\n DateTimeFormatter ISOFormatter = DateTimeFormatter.ofPattern(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\", Locale.ENGLISH);\n\n for (int i = 0; i < sectionsLen; i++) {\n try {\n //Fetch the website and store it in Document object\n Document doc = Jsoup.connect(baseUrl + TIME_SECTIONS[i]).get();\n\n //Retrieve all articles from Document object\n Elements articles = doc.getElementsByTag(\"article\");\n\n NewsItem newsItem = null;\n\n Map<String, Integer> pathMap = new HashMap<>();\n\n //Go through each article tag and scrape key data\n for (Element article : articles) {\n newsItem = new NewsItem();\n\n Elements articleTitleURL = article.select(\"h3\");\n Elements articleExcerpt = article.getElementsByClass(\"summary margin-8-bottom desktop-only\");\n Elements articleImgURL = article.getElementsByClass(\"media-img margin-16-bottom\");\n\n //Checking for duplicate article\n if (pathMap.containsKey(articleTitleURL.select(\"a\").attr(\"href\"))) {\n int newsItemPos = pathMap.get(articleTitleURL.select(\"a\").attr(\"href\"));\n String currentCategory = newsItems.get(newsItemPos).getCategory();\n newsItems.get(newsItemPos).setCategory(currentCategory + \",\" + TIME_CATEGORIES[i]);\n }\n //Otherwise creating new NewsItem\n else {\n newsItem.setCategory(TIME_CATEGORIES[i]);\n newsItem.setTitle(articleTitleURL.select(\"a\").text());\n newsItem.setPageUrl(baseUrl + articleTitleURL.select(\"a\").attr(\"href\"));\n newsItem.setExcerpt(articleExcerpt.text());\n newsItem.setImgUrl(articleImgURL.select(\"div\").attr(\"data-src\"));\n newsItem.setPublishedDate(articlePublishedDate(newsItem.getPageUrl(), ISOFormatter));\n\n //Add new NewsItem to list\n newsItems.add(newsItem);\n //Mapping current articles url path to its corresponding NewsItem object to handle duplicates\n pathMap.put(articleTitleURL.select(\"a\").attr(\"href\"), newsItems.size() - 1);\n }\n }\n\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }", "public void turnOnRss(final String url) {\n ParseFeedTask task = tasks.get(url);\n if (task == null) {\n System.out.println(String.format(\"Rss with url %s is not found\", url));\n return;\n }\n RssConfiguration configuration = task.getConfiguration();\n if (configuration.getTurnOn()) {\n System.out.println(\"Rss is already running\");\n return;\n }\n configuration.setTurnOn(true);\n try {\n PropertiesHandler.writeProperties(configuration);\n ScheduledFuture future = scheduledExecutorService.scheduleWithFixedDelay(task, configuration.getPollPeriod(), configuration.getPollPeriod(), TimeUnit.SECONDS);\n futures.put(url, future);\n System.out.println(String.format(\"Rss %s is running\", url));\n } catch (IOException e) {\n System.out.println(String.format(\"An error occurred during the change poll period for feed %s\", url));\n }\n }", "public void run() {\n\t\t\tString html = \"\";\n\t\t\ttry {\n\t\t\t\thtml = HTTPFetcher.fetchHTML(this.url);\n\t\t\t} catch (UnknownHostException e) {\n\t\t\t\tSystem.out.println(\"Unknown host\");\n\t\t\t} catch (MalformedURLException e) {\n\t\t\t\tSystem.out.println(\"MalformedURL\");\n\t\t\t} catch (IOException e) {\n\t\t\t\tSystem.out.println(\"IOException\");\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tif(html != null) {\n\t\t\t\t\tthis.newLinks = LinkParser.listLinks(new URL(this.url), html);\n\t\t\t\t}\n\t\t\t} catch (MalformedURLException e) {\n\t\t\t\tSystem.out.println(\"MalformedURL\");\n\t\t\t}\n\t\t\tif(newLinks != null) {\n\t\t\t\tfor(URL theURL : newLinks) {\n\t\t\t\t\tif(!(urls.contains(theURL))) {\n\t\t\t\t\t\tsynchronized(urls) {\n\t\t\t\t\t\t\turls.add(theURL);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinnerCrawl(theURL, limit);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tInvertedIndex local = new InvertedIndex();\n\t\t\t\tString no_html = HTMLCleaner.stripHTML(html.toString());\n\t\t\t\tString[] the_words = WordParser.parseWords(no_html);\n\t\t\t\tlocal.addAll(the_words, this.url);\n\t\t\t\tindex.addAll(local);\n\t\t\t}\n\t\t}", "private ExchangeRates loadXmlFromNetwork(String urlString) throws XmlPullParserException, IOException {\n\t\tInputStream stream = null;\n\t\tECBParser parser = new ECBParser();\n\t\t\n\t\ttry {\n\t\t\tstream = downloadStream(urlString);\n\t\t\tsaveToSd(stream);\n\t\t\tparser.parse(readFromSd(), exchangeRates);\n\t\t} finally {\n\t\t\tif (stream != null) {\n\t\t\t\tstream.close();\n\t\t\t}\n\t\t}\n\n\t\treturn exchangeRates;\n\t}", "@Override\n protected Bitmap doInBackground(String... urls) {\n log(\"BEGIN doInBackground\");\n\n String url = urls[0];\n Bitmap bitmap = null;\n\n try {\n InputStream in = new URL(url).openStream();\n bitmap = BitmapFactory.decodeStream(in);\n Log.i(\"DownloadImageTask\", \"Image downloaded with success.\");\n } catch (Exception e) {\n Log.e(\"Error\", e.getMessage());\n e.printStackTrace();\n }\n\n log(\"END doInBackground\");\n\n return bitmap;\n }", "protected void onPostExecute(String feed) {\n }", "protected void onPostExecute(String feed) {\n }", "protected Feed(String url, List<String> userTitle, Settings settings) {\n\t\tthis.url = url;\n\t\tthis.items = Collections.synchronizedSet(new HashSet<FeedItem>());\n\t\tthis.userTitle = new ArrayList<>(userTitle);\n\t\tthis.settings = settings;\n\t}", "public void addFeedIntoFolder(String feedURL, String name);", "@Override\n public void crawl() {\n Document doc;\n try {\n\n\n doc = Jsoup.connect(rootURL).userAgent(\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A\").get();\n\n Elements articles = doc.select(\"section.list article\");\n\n System.out.println(\"Number of articles found:\"+articles.size());\n //list of links found\n for(Element article: articles){\n\n Element titleLink = article.select(\"a\").first();\n System.out.println(titleLink.attr(\"abs:href\"));\n\n //if the url found is in the cache, do not retrieve the url.\n if(urlCache.contains(titleLink.attr(\"abs:href\"))) {\n System.out.println(\"Doucment found in cache, ignoring document\");\n continue;\n }\n\n storeDocument(Jsoup.connect(titleLink.attr(\"abs:href\")).get());\n\n //add the URL to the cache so that we don't retrieve it again.\n urlCache.add(titleLink.attr(\"abs:href\"));\n }\n\n\n } catch (Exception e){\n logger.log(Level.SEVERE, \"Error Retrieving from URL\", e);\n e.printStackTrace();\n }\n }", "void startCrawler() throws ParserConfigurationException, SAXException, IOException;", "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 }", "@Override\n\t\t\tprotected List<NewsBean> doInBackground(CarouselBean... params) {\n\t\t\t\t\n\t\t\t\tsynchronized (params) {\n\t\t\t\t\treturn new ParseXMLUtil().parseCarouselXml(params[0]);\n\t\t\t\t}\n\t\t\t}", "private void readFeed(XmlPullParser parser) throws XmlPullParserException, IOException {\n\n String name;\n\n while (parser.next() != XmlPullParser.END_TAG) {\n if (parser.getEventType() != XmlPullParser.START_TAG) {\n\n if (complete_flag) {\n break;\n }\n continue;\n }\n name = parser.getName();\n // Starts by looking for the entry tag\n if (name.equals(\"student\")) {\n readEntry(parser);\n } else {\n skip(parser);\n }\n }\n\n }" ]
[ "0.69046986", "0.65805674", "0.6246149", "0.6024916", "0.600455", "0.59115267", "0.5872272", "0.5772476", "0.5771507", "0.5753881", "0.5634839", "0.56343263", "0.56238735", "0.5615778", "0.5574957", "0.55691755", "0.5554161", "0.5536199", "0.5526821", "0.5525043", "0.5495744", "0.5495132", "0.54949355", "0.5471914", "0.544268", "0.54042816", "0.53907543", "0.53691053", "0.53595537", "0.53491443", "0.533507", "0.5330595", "0.52948177", "0.527112", "0.52459234", "0.52326256", "0.5230947", "0.5228929", "0.5225262", "0.52077705", "0.51909375", "0.5187841", "0.5179443", "0.517459", "0.51733375", "0.51704377", "0.50903875", "0.5085787", "0.5070092", "0.5056963", "0.5055348", "0.505442", "0.50489515", "0.5048043", "0.5046063", "0.50236464", "0.4994144", "0.4982799", "0.49804398", "0.49625346", "0.49582884", "0.49511185", "0.4943585", "0.49209848", "0.49207577", "0.4914784", "0.49098402", "0.4899877", "0.48797393", "0.487893", "0.48672357", "0.4859593", "0.48430172", "0.48281854", "0.4823784", "0.48182568", "0.4817684", "0.47932404", "0.47887847", "0.47838673", "0.47831577", "0.47827023", "0.47628793", "0.47595096", "0.47581854", "0.4756169", "0.47545964", "0.4751579", "0.47459528", "0.47454113", "0.4730222", "0.471532", "0.471532", "0.47135437", "0.47113186", "0.470823", "0.47028598", "0.47017908", "0.47015095", "0.47003567" ]
0.65198725
2
/ / Return source URL from the given string. /
public URL ParseRSSFromFeed() throws java.net.MalformedURLException { URL feedUrl = new URL(Src_URL); return feedUrl; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String getUrl(final String sourceURL) {\n\n String result = null;\n\n if (sourceURL == null) {\n // if only one URL is configured, \"default URL\" should mean that\n // URL.\n List<String> urls = descriptor().getUrls();\n if (!urls.isEmpty()) {\n result = urls.get(0);\n }\n return result;\n }\n for (String j : descriptor().getUrls()) {\n if (j.equals(sourceURL)) {\n result = j;\n break;\n }\n }\n return result;\n }", "String getUrl();", "String getUrl();", "String getUrl();", "String getUrl();", "String getUrl();", "java.lang.String getUrl();", "java.lang.String getUrl();", "java.lang.String getUrl();", "java.lang.String getUrl();", "java.lang.String getUrl();", "java.lang.String getUrl();", "protected static String getSource(String url) {\n String source = \"\";\n try {\n URL link = new URL(url);\n BufferedReader reader =\n new BufferedReader(new InputStreamReader(link.openStream(), \"UTF-8\"));\n String input;\n while ((input = reader.readLine()) != null) {\n if (input.trim().equals(\"\"))\n continue;\n source += (source.equals(\"\") ? \"\" : \"\\n\") + input;\n }\n reader.close();\n } catch (MalformedURLException e) {\n throw new RuntimeException(\"[Source:43] The URL provided does not exist or invalid.\");\n } catch (UnsupportedEncodingException e) {\n throw new RuntimeException(\"[Source:45] The site farted, we can't even comprehend the \" +\n \"encoding of the \" +\n \"character.\");\n } catch (IOException e) {\n throw new RuntimeException(\"[Source:47] Something interrupted the connection or failed to \" +\n \"operate.\");\n }\n return source;\n }", "public static String getURLString(String str) {\n String str2 = \"\";\n try {\n String substring = str.substring(str.indexOf(\"url\\\">\") + 5);\n return substring.substring(0, substring.indexOf(\"<\"));\n } catch (Exception e) {\n e.printStackTrace();\n return str2;\n }\n }", "URL getUrl();", "java.net.URL getUrl();", "Uri getUrl();", "String url();", "private URI makeUri(String source) throws URISyntaxException {\n if (source == null)\n source = \"\";\n\n if ((source.length()>0)&&((source.substring(source.length() - 1)).equals(\"/\") ))\n source=source.substring(0, source.length() - 1);\n\n return new URI( source.toLowerCase() );\n }", "@Override\n\tpublic String buildURL(String string) {\n\t\treturn null;\n\t}", "private static URL generateUrl(String requestedUrlString) {\n URL url = null;\n\n try {\n url = new URL(requestedUrlString);\n } catch (MalformedURLException e) {\n Log.e(LOG_TAG, \"Error creating a URL object : generateURL() block\", e);\n }\n return url;\n }", "String getSourceString();", "public void setSource(String str) {\n\t\tMatcher m = Constants.REGEXP_FIND_SOURCE.matcher(str);\n\t\tif (m.find()) {\n\t\t\tsource = m.group(1);\n\t\t} else {\n\t\t\tsource = Utils.getString(R.string.tweet_source_web);\n\t\t}\n\t}", "public Uri getUrl() {\n return Uri.parse(urlString);\n }", "protected Source convertString2Source(String param) {\n Source src;\n try {\n src = uriResolver.resolve(param, null);\n } catch (TransformerException e) {\n src = null;\n }\n if (src == null) {\n src = new StreamSource(new File(param));\n }\n return src;\n }", "String getSourceUsageURL();", "public String source(String src)\n\t{\n\t\tint i;\n\t\tString [] toks = src.split(\"\\\\s+\");\n\t\tString ret = toks[sourceStart];\n\t\tfor (i = sourceStart + 1; i < sourceEnd; i++) {\n\t\t\tret += \" \" + toks[i];\n\t\t}\n\t\treturn ret;\n\t}", "private String getSource() {\n SharedPreferences settings =\n PreferenceManager.getDefaultSharedPreferences(Collect.getInstance().getBaseContext());\n String serverUrl = settings.getString(PreferencesActivity.KEY_SERVER_URL, null);\n String source = null;\n // Remove the protocol\n if(serverUrl.startsWith(\"http\")) {\n \tint idx = serverUrl.indexOf(\"//\");\n \tif(idx > 0) {\n \t\tsource = serverUrl.substring(idx + 2);\n \t} else {\n \t\tsource = serverUrl;\n \t}\n }\n \n return source;\n }", "private static URL stringToUrl(String stringUrl) throws MalformedURLException{\r\n\t\treturn new URL(stringUrl);\r\n\t}", "String getSource();", "String getUri( );", "public URL getSource() {\n return url;\n }", "java.lang.String getSrc();", "protected abstract String getUrl();", "java.lang.String getSource();", "java.lang.String getSource();", "public String getURL();", "public URL standardizeURL(URL startingURL);", "public URL makeFullUrl(String scrapedString, URL base);", "private String getUrlHost(String url) {\n // httpx://host/.....\n\n int hostStart = url.indexOf(\"//\");\n if (hostStart == -1) {\n return \"\";\n }\n int hostEnd = url.indexOf(\"/\", hostStart + 2);\n if (hostEnd == -1) {\n return url.substring(hostStart + 2);\n } else {\n return url.substring(hostStart + 2, hostEnd);\n }\n\n }", "public String getUrl();", "public String getUrl();", "public String getUrl();", "public String getUrl();", "private String get_url() {\n File file = new File(url);\n return file.getAbsolutePath();\n }", "protected URL stringToURL(String urlString){\n try{\n URL url = new URL(urlString);\n return url;\n }catch(MalformedURLException e){\n e.printStackTrace();\n }\n return null;\n }", "private static String handleUrl(String s) {\n if (s.endsWith(\"/..\")) {\n int idx = s.lastIndexOf('/');\n s = s.substring(0, idx - 1);\n idx = s.lastIndexOf('/');\n String gs = s.substring(0, idx);\n if (!gs.equals(\"smb:/\")) {\n s = gs;\n }\n }\n if (!s.endsWith(\"/\")) {\n s += \"/\";\n }\n System.out.println(\"now its \" + s);\n return s;\n }", "public abstract String getURL();", "public String getSourceDownloadUrl();", "private static URL createUrl(String stringUrl) {\n URL url = null;\n try {\n url = new URL(stringUrl);\n } catch (MalformedURLException e) {\n Log.e(LOG_TAG, \"Problem building the URL \", e);\n }\n return url;\n }", "String getSrc();", "public abstract String getUrl();", "private String getURL() {\n String url = profileLocation.getText().toString();\n if (url == null || url.length() == 0) {\n return url;\n }\n // if it's not the last (which should be \"Raw\") choice, we'll use the prefix\n if (!url.contains(\"://\")) { // if there is no (http|jr):// prefix, we'll assume it's a http://bit.ly/ URL\n url = \"http://bit.ly/\" + url;\n }\n return url;\n }", "private static URL createUrl(String stringUrl) {\n URL url = null;\n try {\n url = new URL(stringUrl);\n } catch (MalformedURLException e) {\n Log.e(LOG_TAG, \"Error with creating URL \", e);\n }\n return url;\n }", "private static URL createUrl(String stringUrl) {\n URL url = null;\n try {\n url = new URL(stringUrl);\n } catch (MalformedURLException e) {\n Log.e(LOG_TAG, \"Error with creating URL \", e);\n }\n return url;\n }", "public String getUrlSourcePage(String url) throws IOException {\n\t\t\t URL URL = new URL(url);\n\t\t\t URLConnection uc = URL.openConnection();\n\t\t\t \n\t\t\t // allow GZip encodings \n\t\t\t // the encoding type\n\t\t\t BufferedReader in = null;\n\t\t\t if (uc.getHeaderField(\"Content-Encoding\") != null && uc.getHeaderField(\"Content-Encoding\").equals(\"gzip\")) {\n\t\t\t in = new BufferedReader(new InputStreamReader(new GZIPInputStream(uc.getInputStream())));\n\t\t\t } else { in = new BufferedReader(new InputStreamReader(uc.getInputStream())); }\n\t\t\t \n\t\t\t String inputLine;\n\t\t\t StringBuilder sb = new StringBuilder();\n\t\t\t while ((inputLine = in.readLine()) != null)\n\t\t\t sb.append(inputLine);\n\t\t\t in.close();\n\t\t\t \n\t\t\t return sb.toString();\n\t\t\t }", "private String parsingURL(String requestURL) {\n\t\tint pos = 0;\n\t\tif (requestURL.startsWith(\"http://\")) {\n\t\t\tpos = \"http://\".length();\n\t\t}\n\t\telse {\n\t\t\tpos = \"https://\".length();\n\t\t}\n\t\t\n\t\tint pos2 = requestURL.indexOf(\":\", pos);\n\t\tif (pos2 < 0) {\n\t\t\tpos2 = requestURL.length();\n\t\t}\n\t\t\n\t\tint pos3 = requestURL.indexOf(\"/\", pos);\n\t\tif (pos3 < 0) {\n\t\t\tpos3 = requestURL.length();\n\t\t}\n\t\t\n\t\tpos2 = Math.min(pos2, pos3);\n\t\t\n\t\tString host = requestURL.substring(pos, pos2);\n\t\t/**\n\t\t * parsing request url\n\t\t */\n\t\treturn host;\n\t}", "public String getTextUrl(String text) {\n return StrUtils.createUrlFromString(text);\n }", "private InputSource urlLookup(ResourceLocation matchingEntry) {\n\n String uri = matchingEntry.getLocation();\n URL baseURL;\n\n //\n // The ResourceLocation may specify a relative url for its\n // location attribute. This is resolved using the appropriate\n // base.\n //\n if (matchingEntry.getBase() != null) {\n baseURL = matchingEntry.getBase();\n } else {\n try {\n baseURL = FILE_UTILS.getFileURL(getProject().getBaseDir());\n } catch (MalformedURLException ex) {\n throw new BuildException(\"Project basedir cannot be converted to a URL\");\n }\n }\n\n URL url;\n\n try {\n url = new URL(baseURL, uri);\n } catch (MalformedURLException ex) {\n url = null;\n }\n\n InputSource source = null;\n if (url != null) {\n try {\n InputStream is = null;\n URLConnection conn = url.openConnection();\n if (conn != null) {\n conn.setUseCaches(false);\n is = conn.getInputStream();\n }\n if (is != null) {\n source = new InputSource(is);\n String sysid = url.toExternalForm();\n source.setSystemId(sysid);\n log(\"catalog entry matched as a URL: '\"\n + sysid + \"'\", Project.MSG_DEBUG);\n }\n } catch (IOException ex) {\n // ignore\n }\n }\n\n return source;\n\n }", "public java.lang.String getUrl() {\n java.lang.Object ref = url_;\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 url_ = s;\n }\n return s;\n }\n }", "public String getURL()\n {\n return getURL(\"http\");\n }", "String getURI();", "String getURI();", "String getURI();", "private URL createUrl(String stringUrl) {\n URL url = null;\n try {\n url = new URL(stringUrl);\n } catch (MalformedURLException exception) {\n Log.e(LOG_TAG, \"Error with creating URL\", exception);\n return null;\n }\n return url;\n }", "private static URL createUrl(String stringUrl) {\n URL url = null;\n try {\n url = new URL(stringUrl);\n } catch (MalformedURLException exception) {\n Log.e(LOG_TAG, \"Error with creating URL\", exception);\n return null;\n }\n return url;\n }", "String getSourceRepoUrl();", "private String extractRealUrl(String url) {\n return acceptsURL(url) ? url.replace(\"p6spy:\", \"\") : url;\n }", "String getUri();", "public final native String getUrl() /*-{\n return this.getUrl();\n }-*/;", "public java.lang.String getUrl() {\n java.lang.Object ref = url_;\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 url_ = s;\n }\n return s;\n }\n }", "public java.lang.String getUrl() {\n java.lang.Object ref = url_;\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 url_ = s;\n }\n return s;\n }\n }", "@java.lang.Override\n public java.lang.String getUrl() {\n java.lang.Object ref = url_;\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 url_ = s;\n return s;\n }\n }", "public final native String getURL(String path)/*-{\n\t\treturn $wnd.chrome.extension.getURL(path);\n\t}-*/;", "private void processUrl (String stringUrl)\n\t{\n\t\tURL correctUrl=null;\n\t\t// we need the URL\n\t\t// we first try to convert it directly\n\t\ttry {\n\t\t\tcorrectUrl=new URL(stringUrl);\n\t\t} catch (MalformedURLException e) {System.out.println(\"Not found : \"+stringUrl);return;}\n\n\t\tallInformation.getNemo().addJcamp(stringUrl);\n\t}", "protected abstract String getPublicUrl(URL url);", "public String getSourceUrl() {\n return sourceUrl;\n }", "public NameValue<String, String> getSourceURL() {\n return getSourceURL(false);\n }", "public String nextURL()\n {\n if (empty())\n return null;\n int start = position;\n if (!consume(\"url(\"))\n return null;\n\n skipWhitespace();\n\n String url = nextCSSString();\n if (url == null)\n url = nextLegacyURL(); // legacy quote-less url(...). Called a <url-token> in the CSS3 spec.\n\n if (url == null) {\n position = start;\n return null;\n }\n\n skipWhitespace();\n\n if (empty() || consume(\")\"))\n return url;\n\n position = start;\n return null;\n }", "java.lang.String getUri();", "java.lang.String getUri();", "private static String getUrlString(String urlSpec) throws IOException {\n String urlString = StringUtils.EMPTY_STRING;\n byte[] bytes = getUrlBytes(urlSpec);\n if (!Utils.isNull(bytes)) {\n urlString = new String(bytes);\n }\n return urlString;\n }", "@Override\n\tpublic URL getURL(String uri) throws MalformedURLException {\n\t\tif (uri.length() == 0) {\n\t\t\tthrow new MalformedURLException(\"Empty URI\");\n\t\t}\n\t\tURL url;\n\t\tif (uri.indexOf(\"://\") < 0) {\n\t\t\turl = new URL(getBaseURL(), uri);\n\t\t} else {\n\t\t\turl = new URL(uri);\n\t\t}\n\t\treturn url;\n\t}", "public String getUrl() {\n Object ref = url_;\n if (ref instanceof String) {\n return (String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n String s = bs.toStringUtf8();\n if (bs.isValidUtf8()) {\n url_ = s;\n }\n return s;\n }\n }", "public String getSource(String cat);", "public static String unEscapeURL(String src) {\n\t StringBuffer bf = new StringBuffer();\n\t char[] s = src.toCharArray();\n\t for (int k = 0; k < s.length; ++k) {\n\t char c = s[k];\n\t if (c == '%') {\n\t if (k + 2 >= s.length) {\n\t bf.append(c);\n\t continue;\n\t }\n\t int a0 = PRTokeniser.getHex(s[k + 1]);\n\t int a1 = PRTokeniser.getHex(s[k + 2]);\n\t if (a0 < 0 || a1 < 0) {\n\t bf.append(c);\n\t continue;\n\t }\n\t bf.append((char)(a0 * 16 + a1));\n\t k += 2;\n\t }\n\t else\n\t bf.append(c);\n\t }\n\t return bf.toString();\n\t}", "public static String getValidUrl(String url){\n String result = null;\n if(url.startsWith(\"http://\")){\n result = url;\n }\n else if(url.startsWith(\"/\")){\n result = \"http://www.chenshiyu.com\" + url;\n }\n return result;\n }", "public java.lang.CharSequence getURL() {\n return URL;\n }", "public java.lang.String getUrl() {\n java.lang.Object ref = url_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n url_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public java.lang.String getUrl() {\n java.lang.Object ref = url_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n url_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public Address interpretUrl(String url);", "void first_normalize_url(String rawurl, PointerByReference ptr);", "String getBaseUri();", "public static URL buildurl(String url1)\n {\n URL url = null;\n try\n {\n url = new URL(url1.toString());\n\n }\n catch(MalformedURLException e)\n {\n e.printStackTrace();\n }\n return url;\n }", "public java.lang.CharSequence getURL() {\n return URL;\n }", "private static URL createURL(String urlString) {\n\n // Create an empty url\n URL url = null;\n\n try {\n // Try to make a url from urlString param\n url = new URL(urlString);\n\n } catch (MalformedURLException e) {\n e.printStackTrace();\n Log.v(LOG_TAG, \"Error creating URL: \" + e);\n }\n\n //Return the new url\n return url;\n }", "String getUrl(String key);", "public abstract String getSource();", "public java.lang.String getUrl() {\n java.lang.Object ref = url_;\n if (!(ref instanceof java.lang.String)) {\n java.lang.String s = ((com.google.protobuf.ByteString) ref)\n .toStringUtf8();\n url_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public java.lang.String getUrl() {\n java.lang.Object ref = url_;\n if (!(ref instanceof java.lang.String)) {\n java.lang.String s = ((com.google.protobuf.ByteString) ref)\n .toStringUtf8();\n url_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public java.lang.String getUrl() {\n java.lang.Object ref = url_;\n if (!(ref instanceof java.lang.String)) {\n java.lang.String s = ((com.google.protobuf.ByteString) ref)\n .toStringUtf8();\n url_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }" ]
[ "0.69550294", "0.6820826", "0.6820826", "0.6820826", "0.6820826", "0.6820826", "0.68058455", "0.68058455", "0.68058455", "0.68058455", "0.68058455", "0.68058455", "0.66520625", "0.65738666", "0.6533551", "0.65140945", "0.6494836", "0.64634305", "0.64284575", "0.6428314", "0.6415205", "0.6412657", "0.6372974", "0.63509125", "0.6338384", "0.6266164", "0.6254213", "0.622611", "0.6126787", "0.61131227", "0.6108244", "0.6093842", "0.608304", "0.60416454", "0.6033538", "0.6033538", "0.6029832", "0.6017815", "0.5970536", "0.59662384", "0.59639734", "0.59639734", "0.59639734", "0.59639734", "0.5958232", "0.5922608", "0.59186846", "0.5910085", "0.5907539", "0.5903866", "0.5899782", "0.5843478", "0.58352494", "0.5817934", "0.5817934", "0.58157706", "0.58048874", "0.57965535", "0.5793689", "0.5778773", "0.57613766", "0.5758296", "0.5758296", "0.5758296", "0.57562685", "0.57555014", "0.57460696", "0.57437855", "0.5741796", "0.5739515", "0.57381326", "0.57381326", "0.57352567", "0.57342017", "0.57285744", "0.57282335", "0.57250124", "0.5723143", "0.5722067", "0.5718763", "0.5718763", "0.57056737", "0.5705192", "0.56981677", "0.56962323", "0.56853145", "0.56816673", "0.564883", "0.562682", "0.562682", "0.5616958", "0.5610905", "0.5596736", "0.5596715", "0.5593904", "0.55934864", "0.55837345", "0.5582254", "0.558195", "0.558195", "0.5576343" ]
0.0
-1
/ / Parse RSS from the input URL and insert to DB. / / RSS feed URL
public void ParseRSS(URL feedUrl) throws com.rometools.rome.io.FeedException, java.io.IOException { //TODO: EVERY THING HERE SHOULD BE IN A TRANSACTION List<String> HashFields = new ArrayList<>(); SyndFeedInput input = new SyndFeedInput(); SyndFeed feed = input.build(new XmlReader(feedUrl)); RSSChannelElements ChannelElements = new RSSChannelElements(); Date CurrentDate = new Date(); SimpleDateFormat SDF = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); //GET ADDITIONAL PROPERTIES OF THE CHANNEL //GET CHANNEL AUTHOR String ch_author = feed.getAuthor(); ChannelElements.Author = ch_author; //GET PUBLISHED DATE Date ch_PubDate = feed.getPublishedDate(); ChannelElements.PublishedDate = ch_PubDate; //GET LANGUAGE String ch_Language = feed.getLanguage(); ChannelElements.Language = ch_Language; //GET WEBMASTER String ch_WebMaster = feed.getWebMaster(); ChannelElements.webMaster = ch_WebMaster; //GET MANAGING EDITOR String ch_ME = feed.getManagingEditor(); ChannelElements.managingEditor = ch_ME; //GET GENERATOR String ch_generator = feed.getGenerator(); ChannelElements.Generator = ch_generator; //GET DESCRIPTION String ch_description = feed.getDescription(); ChannelElements.Description = ch_description; int CurrentChannelID = 0; //TODO: DO THIS IN A STORED PROCEDURE try { TimeValidations ValidateTime = new TimeValidations(); if (ValidateTime.IsWithinValidWindow(CurrentDate, ch_PubDate, ReadInterval)) { //INSERT TO DB THE CHANNEL DETAILS CurrentChannelID = InsertChannelDetails(ChannelElements); } } catch(java.sql.SQLException exp) { String message = exp.getMessage(); System.out.println(message); } //GET ELEMENTS FROM THE "ITEMS" List entries = feed.getEntries(); Iterator it = entries.iterator(); while (it.hasNext()) { RSSFields RssFieldValues = new RSSFields(); SyndEntry entry = (SyndEntry) it.next(); //GET TITLE System.out.println(entry.getTitle()); String Title = entry.getTitle(); RssFieldValues.Title = Title; //HashFields.add(Title); //GET LINK System.out.println(entry.getLink()); RssFieldValues.Link = entry.getLink(); HashFields.add(RssFieldValues.Link); //GET DESCRIPTION SyndContent description = entry.getDescription(); System.out.println(description.getValue()); RssFieldValues.Description = description.getValue(); //HashFields.add(description.getValue()); //GET PUBLISHED DATE Date Pub_Date = entry.getPublishedDate(); System.out.println(SDF.format(Pub_Date)); RssFieldValues.PublishedDate = entry.getPublishedDate(); //GET UPDATED DATE Date U_date = entry.getUpdatedDate(); System.out.println(U_date); RssFieldValues.UpdatedDate = entry.getPublishedDate(); //GET AUTHOR String Author = entry.getAuthor(); RssFieldValues.Author = Author; System.out.println(Author); //GET COMMENTS; String Comments = entry.getComments(); RssFieldValues.Comments = Comments; System.out.println(); try { //org.joda.time.Period P = new org.joda.time.Period(Pub_Date, CurrentDate); //if(SDF.parse(Pub_Date.toString()) == SDF.parse(CurrentDate.toString())) //org.joda.time.Period p = new org.joda.time.Period(CurrentDate, Pub_Date); //ONLY INSERT IF THE FEED IS WITHIN THE SPECIFIED PERIOD TimeValidations ValidateTime = new TimeValidations(); if (ValidateTime.IsWithinValidWindow(CurrentDate, U_date, ReadInterval)) { //INSERT NEWS SPECIFIC VALUES TO DB HashGenerator Gen = new HashGenerator(); RssFieldValues.ComputedHash = Gen.HashCalculator(HashFields); InsertToDB(RssFieldValues, CurrentChannelID); } } catch (java.sql.SQLException ex) { String message = ex.getMessage(); System.out.println(message); } } // System.out.println(feed); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public URL ParseRSSFromFeed() throws java.net.MalformedURLException\n {\n URL feedUrl = new URL(Src_URL);\n return feedUrl;\n }", "public void PopulateRSSData()\n {\n try\n {\n URL Feed = ParseRSSFromFeed();\n ParseRSS(Feed);\n }\n catch(java.net.MalformedURLException exp)\n {\n String message = exp.getMessage();\n System.out.println(message);\n }\n catch(com.rometools.rome.io.FeedException fexp)\n {\n String message = fexp.getMessage();\n System.out.println(message);\n }\n catch(java.io.IOException ioexp)\n {\n String message = ioexp.getMessage();\n System.out.println(message);\n }\n }", "@Override\n\t\tprotected Boolean doInBackground(Void... params) {\n\t\t\tlinklist = parseRSS();\n\t\t\treturn updateDatabase(linklist);\n\t\t}", "public void addRss(final String url, final String outputFileName, final Long pollPeriod, final Long itemsAmount,\n final List<String> parameters) {\n try {\n if (isNotValidRss(url)) {\n System.out.println(\"Rss is not valid.\");\n return;\n }\n RssConfiguration configuration = PropertiesHandler.createNewRssConfiguration(url, outputFileName, pollPeriod, itemsAmount, parameters);\n ParseFeedTask task = new ParseFeedTask(configuration);\n ScheduledFuture future = scheduledExecutorService.scheduleWithFixedDelay(task, configuration.getPollPeriod(), configuration.getPollPeriod(), TimeUnit.SECONDS);\n futures.put(url, future);\n tasks.put(url, task);\n } catch (IOException e) {\n System.out.println(String.format(\"An error occurred during the adding feed %s\", url));\n } catch (FeedException e) {\n System.out.println(String.format(\"Sorry, but feed %s is not valid.\", url));\n }\n }", "public List<LinkDetails> scrapeRSSPageForLinks(String rssUrl) {\n\t\tString description = \"\";\n\t\tString title = \"\";\n\t\tString link = \"\";\n\t\tString pubdate = \"\";\n\t\tURL url;\n\t\tInputStream in;\n\n\t\tList<LinkDetails> rssProcessedData = new ArrayList<LinkDetails>();\n\n\t\ttry {\n\t\t\turl = new URL(rssUrl);\n\t\t} catch (MalformedURLException e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t}\n\n\t\ttry {\n\t\t\tin = url.openStream();\n\t\t} catch (IOException e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t}\n\n\t\t// create XML input factory\n\t\tXMLInputFactory inputFactory = XMLInputFactory.newInstance();\n\n\t\t// read the XML document\n\t\ttry {\n\n\t\t\tXMLEventReader eventReader = inputFactory.createXMLEventReader(in);\n\n\t\t\tboolean isFeedHeader = true;\n\t\t\twhile (eventReader.hasNext()) {\n\t\t\t\tXMLEvent event = eventReader.nextEvent();\n\t\t\t\tif (event.isStartElement()) {\n\t\t\t\t\tString localPart = event.asStartElement().getName().getLocalPart();\n\n\t\t\t\t\t// System.out.println(localPart);\n\n\t\t\t\t\tswitch (localPart) {\n\n\t\t\t\t\tcase \"item\":\n\t\t\t\t\t\t// if (isFeedHeader) {\n\t\t\t\t\t\t// isFeedHeader = false;\n\t\t\t\t\t\t// System.out.println(\" title: \"+title+ \" description: \"+ description + \" link:\n\t\t\t\t\t\t// \"+link+\" pubDate: \"+pubdate);\n\t\t\t\t\t\t// }\n\t\t\t\t\t\tevent = eventReader.nextEvent();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase \"title\":\n\t\t\t\t\t\ttitle = getCharacterData(event, eventReader);\n\t\t\t\t\t\t// System.out.println(\"title: \"+title);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"description\":\n\t\t\t\t\t\tdescription = getCharacterData(event, eventReader);\n\t\t\t\t\t\t// System.out.println(\"description: \"+description);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"link\":\n\t\t\t\t\t\tlink = getCharacterData(event, eventReader);\n\t\t\t\t\t\tSystem.out.println(\"link: \" + link);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"pubDate\":\n\t\t\t\t\t\tpubdate = getCharacterData(event, eventReader);\n\t\t\t\t\t\t// System.out.println(\"pubDate: \"+pubdate);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\t\t\t\t} else if (event.isEndElement()) {\n\t\t\t\t\tif (event.asEndElement().getName().getLocalPart() == (\"item\")) {\n\n\t\t\t\t\t\tLinkDetails linkDetails = new LinkDetails(link, title, description, pubdate);\n\t\t\t\t\t\trssProcessedData.add(linkDetails);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (XMLStreamException e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t}\n\n\t\treturn rssProcessedData;\n\t}", "public static void processFeed(FeedContext fc) {\n\n String feedUrl = fc.getFeedUrl();\n mLog.info(\"Processing Atom feed at URL: \" + feedUrl);\n\n try {\n AbderaAtomParser atomParser = new AbderaAtomParser(new URL(feedUrl));\n atomParser.persistFeed(fc);\n\n mLog.info(\"Finished processing Atom feed at URL \" + feedUrl);\n }\n catch (MalformedURLException url_e) {\n mLog.error(\"MalformedURL found for \" + fc.getFeedUrl());\n }\n catch (ArrayIndexOutOfBoundsException a) {\n // this happens if the feed is empty (typically an activity stream),\n // need a better way to track this though\n \tmLog.warn(\"Feed at URL [\" + feedUrl + \"] is probably empty, but this \" +\n \t\t\t\"exception should have been prevented.\");\n }\n catch (Exception e) {\n mLog.error(\"Error processing feed at [\" + fc.getFeedUrl() + \"]: \" + e.getMessage());\n }\n catch (Throwable t) {\n mLog.error(\"Error processing feed at [\" + fc.getFeedUrl() + \"]: \" + t.getMessage());\n }\n }", "public AtomFeed(String feedURL) throws ParserConfigurationException, IOException\r\n\t{\r\n\t\tthis.feedURL = feedURL;\r\n\t\txml = null;\r\n\t\tdocumentbuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();\r\n\t\tif (!refresh()) throw new IOException();\r\n\t}", "private void saveNewFeed() {\n String rssUrl = mUrlEditText.getText().toString();\n\n if (!rssUrl.equals(\"\") && userNotAlreadyFollowing(rssUrl)) {\n getActivity().setProgressBarIndeterminateVisibility(true);\n\n FeedProcessingService service = new FeedProcessingService(getActivity(), mFeedHandler);\n service.getAndProcessFeed(rssUrl);\n }\n }", "public static void processFeed(String feedUrl) throws Exception {\n processFeed(new FeedContext(feedUrl));\n }", "private static void processFeed(String url, String file, SimpleWriter out) \n {\n \tXMLTree rss = new XMLTree1(url);\n \t\n \t// make sure the rss tree is a valid rss tree\n if(!ensureValidRSSTree(rss, out))\n {\n \tout.println(\"This is not a valid RSS Tree.\");\n \treturn;\n }\n \n // print entire document to file\n outputHeader(rss.child(0), out);\n outputFooter(out);\n \n }", "private String loadXmlFromNetwork(String urlString) throws XmlPullParserException, IOException {\n InputStream stream = null;\n StackOverflowXmlParser stackOverflowXmlParser = new StackOverflowXmlParser();\n List<Entry> entries = null;\n String title = null;\n String url = null;\n String summary = null;\n Calendar rightNow = Calendar.getInstance();\n DateFormat formatter = new SimpleDateFormat(\"MMM dd h:mmaa\");\n int count = 1;\n\n // Checks whether the user set the preference to include summary text\n SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);\n boolean pref = sharedPrefs.getBoolean(\"summaryPref\", false);\n\n StringBuilder htmlString = new StringBuilder();\n htmlString.append(\"<h3>\" + getResources().getString(R.string.page_title) + \"</h3>\");\n htmlString.append(\"<em>\" + getResources().getString(R.string.updated) + \" \" +\n formatter.format(rightNow.getTime()) + \"</em>\");\n\n try {\n stream = downloadUrl(urlString);\n entries = stackOverflowXmlParser.parse(stream);\n // Makes sure that the InputStream is closed after the app is\n // finished using it.\n } finally {\n if (stream != null) {\n stream.close();\n }\n }\n\n // StackOverflowXmlParser returns a List (called \"entries\") of Entry objects.\n // Each Entry object represents a single post in the XML feed.\n // This section processes the entries list to combine each entry with HTML markup.\n // Each entry is displayed in the UI as a link that optionally includes\n // a text summary.\n for (Entry entry : entries) {\n \t\n \tString photo = \"\";\n \tString video = \"video\";\n htmlString.append(\"<p><a href='\");\n photo = \"https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=\"+entry.link+\"&sensor=true&key=AIzaSyBeNRBzRlJQy0-L8OlYFTnMcJ9LRb6h_-s\";\n \n \n htmlString.append(photo);\n htmlString.append(\"'>\" + entry.title + \"</a></p>\");\n if(count == 1 ||count == 3 ||count == 6 ||count == 8 ||count == 9) {\n \tvideo =\"http://192.168.0.16:8010/cloud/my_videos/\"+Integer.toString(count);\n \thtmlString.append(\"<a href='\"+video+\"'> - Video</a>\");\n }\n count++;\n \n // If the user set the preference to include summary text,\n // adds it to the display.\n if (pref) {\n htmlString.append(entry.summary);\n }\n }\n// URL url2 = new URL(\"http://192.168.0.16:8000/cloud/images/\");\n// HttpURLConnection conn2 = (HttpURLConnection) url2.openConnection();\n//\t\t\n// //conn2.setDoOutput(true);\n// conn2.setConnectTimeout(10000 /* milliseconds */);\n// conn2.setRequestMethod(\"GET\");\n// conn2.setDoInput(true);\n// conn2.connect();\n// //OutputStream out1 = new BufferedOutputStream(conn2.getOutputStream());\n// \n// \n// InputStream in = new BufferedInputStream(conn2.getInputStream());\n// BufferedReader br = new BufferedReader(new InputStreamReader(in));\n// String test = br.readLine();\n// String output=\"\";\n// while(test != null) {\n// \toutput = output +test;\n// \ttest = br.readLine();\n// }\n// output=\"<html><body><video width=\\\"320\\\" height=\\\"240\\\" controls><source src=\\\"movie.mp4\\\" type=\\\"video/mp4\\\"><source src=\\\"movie.ogg\\\" type=\\\"video/ogg\\\">Your browser does not support the video tag.</video></body></html>\";\n \n return htmlString.toString();\n }", "public void refreshRssFeed( ContactRssImpl rssURL)\n {\n submitRssQuery(rssURL, true);\n }", "private URL getFeedUrl() throws MalformedURLException{\n String feedUrl = \"http://\" + host + \":\" + port + \"/xmlfeed\";\n URL url = new URL(feedUrl);\n return url;\n }", "@Scheduled(fixedRate = 120000)\n public void readRss() {\n\n List<ItemNews> itemList = new ArrayList<>();\n\n try {\n String url = \"https://www.nytimes.com/svc/collections/v1/publish/https://www.nytimes.com/section/world/rss.xml\";\n\n try (XmlReader reader = new XmlReader(new URL(url))) {\n SyndFeed feed = new SyndFeedInput().build(reader);\n for (SyndEntry entry : feed.getEntries()) {\n LocalDateTime localDateTime = entry.getPublishedDate().toInstant()\n .atZone(ZoneId.systemDefault())\n .toLocalDateTime();\n ItemNews item = new ItemNews();\n item.setTitle(entry.getTitle());\n item.setAuthor(entry.getAuthor());\n item.setLink(entry.getLink());\n item.setDescription(entry.getDescription().getValue());\n item.setDateTime(localDateTime);\n modifyItem(item);\n itemList.add(item);\n }\n }\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n if (!itemList.isEmpty()) {\n Collections.sort(itemList , Comparator.comparing(ItemNews::getDateTime));\n saveItems(itemList);\n }\n }", "public static void getFeed(String url) {\n if (rssReader != null) {\n rssReader.loadFeeds(url);\n }\n }", "private String loadXmlFromNetwork(String urlString) throws XmlPullParserException, IOException {\n\t InputStream stream = null;\n\t // Instantiate the parser\n\t StackOverflowXmlParser stackOverflowXmlParser = new StackOverflowXmlParser();\n\t List<Entry> entries = null;\n\t String title = null;\n\t String url = null;\n\t String summary = null;\n\t Calendar rightNow = Calendar.getInstance(); \n\t DateFormat formatter = new SimpleDateFormat(\"MMM dd h:mmaa\");\n\t \n\t // Checks whether the user set the preference to include summary text\n\t SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);\n\t boolean pref = sharedPrefs.getBoolean(\"summaryPref\", false);\n\t \n\t StringBuilder htmlString = new StringBuilder();\n\t htmlString.append(\"<h3>\" + \"title: \" + \"</h3>\");\n\t htmlString.append(\"<em>\" + \" \" + formatter.format(rightNow.getTime()) + \"</em>\");\n\t \n\t try {\n\t stream = downloadUrl(urlString); \n\t entries = stackOverflowXmlParser.parse(stream);\n\t // Makes sure that the InputStream is closed after the app is\n\t // finished using it.\n\t } finally {\n\t if (stream != null) {\n\t stream.close();\n\t } \n\t }\n\t \n\t // StackOverflowXmlParser returns a List (called \"entries\") of Entry objects.\n\t // Each Entry object represents a single post in the XML feed.\n\t // This section processes the entries list to combine each entry with HTML markup.\n\t // Each entry is displayed in the UI as a link that optionally includes\n\t // a text summary.\n\t for (Entry entry : entries) { \n\t htmlString.append(\"<p><a href='\");\n\t htmlString.append(entry.link);\n\t htmlString.append(\"'>\" + entry.title + \"</a></p>\");\n\t // If the user set the preference to include summary text,\n\t // adds it to the display.\n\t if (pref) {\n\t htmlString.append(entry.summary);\n\t }\n\t }\n\t return htmlString.toString();\n\t}", "public RSS getRSS(URL url) throws JAXBException {\n\t\tJAXBContext ctx = JAXBContext.newInstance(RSS.class);\n\t\tUnmarshaller um = ctx.createUnmarshaller();\n\t\tRSS rss = (RSS) um.unmarshal(url);\n\t\treturn rss;\n\t}", "private void pageContent( String url) {\n\t\t\n\t\tif ( !url.matches(URL)) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tList<String> outlinks = null; // out link urls\n\t\tUrlBean bean = null; // basic info of the url\n\t\t\n\t\tbean = new UrlBean();\n\t\ttry {\n\t\t\t\n\t\t\tconn = Jsoup.connect(url).timeout(5000);\n\t\t\tif ( conn == null) {\n\t\t\t\treturn ;\n\t\t\t}\n\t\t\t\n\t\t\tdocument = conn.get(); // 得到网页源代码,超时时间是5秒\n\t\t\t\n\t\t\t/*\n\t\t\t * 文章基本信息\n\t\t\t */\n\t\t\telements = document.getElementsByTag(\"title\");\n\t\t\tif ( elements!= null && elements.size() != 0) {\n\t\t\t\telement = elements.get(0);\n\t\t\t}\n\t\t\tString title = element.text();\n\t\t\tbean.setTitle(title);\n\t\t\tbean.setKeywords(title);\n\t\t\t\n\t\t\telements = document.getElementsByTag(\"a\");\n\t\t\tif ( elements != null) {\n\t\t\t\tString linkUrl = null;\n\t\t\t\toutlinks = new ArrayList<String>();\n\t\t\t\tfor ( int i = 0; i < elements.size(); i++) {\n\t\t\t\t\tlinkUrl = elements.get(i).attr(\"href\");\n\t\t\t\t\tif ( linkUrl.matches(URL)) {\n\t\t\t\t\t\toutlinks.add(linkUrl);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t\treturn;\n\t\t} \n\t\t\n\t\tbean.setUrl(url);\n\t\tbean.setId(urlId++);\n\t\tbean.setRank(1);\n\t\tif ( outlinks != null) {\n\t\t\tint count = outlinks.size();\n\t\t\tbean.setOutlinks(count);\n\t\t\tfor ( int i = 0; i < count; i++) {\n\t\t\t\turlsSet.add(outlinks.get(i));\n\t\t\t}\n\t\t\tif ( new AllInterface().addOneUrlInfo(bean, outlinks)) {\n\t\t\t\tSystem.out.println(\"Add to database successfully, url is '\" + url + \"'.\");\n\t\t\t} else {\n\t\t\t\tSystem.out.println(\"Fail to add to database, maybe url exists. Url is '\" + url + \"'.\");\n\t\t\t}\n\t\t\tSystem.out.println(\"[\" + count + \" urls remain...]\");\n\t\t\tSystem.out.println();\n\t\t} else {\n\t\t\tSystem.out.println(\"Error occurs in crawl, url is '\" + url + \"'.\");\n\t\t\tSystem.out.println(\"[[FINISHED]]\");\n\t\t\tSystem.out.println();\n\t\t}\n\t\t\n\t}", "private boolean isNotValidRss(final String url) throws FeedException, IOException {\n final SyndFeed feed = FeedHandler.getFeed(url);\n final List<SyndEntry> items = feed.getEntries();\n if (items.isEmpty()) {\n return true;\n }\n for (SyndEntry item : items) {\n if (item.getPublishedDate() == null) {\n return true;\n }\n }\n return false;\n }", "private String getURL(String feedUrl) {\n\tStringBuilder sb = null;\n\ttry {\n for(int i = 3; i>0; i--) {\n\t sb = new StringBuilder();\n URL url = new URL(feedUrl);\n\tHttpURLConnection uc = (HttpURLConnection) url.openConnection();\n\tuc.setRequestProperty(\"User-Agent\", \"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.22) Gecko/20110902 Firefox/3.6.22 GTB7.1 ( .NET CLR 3.5.30729)\");\n\tuc.setRequestProperty(\"Accept\", \"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\");\n\tuc.setRequestProperty(\"Accept-Language\", \"en-us,en;q=0.5\");\n\tuc.setRequestProperty(\"Accept-Encoding\", \"gzip,deflate\");\n\tuc.setRequestProperty(\"Accept-Charset\", \"ISO-8859-1,utf-8;q=0.7,*;q=0.7\");\n\tuc.setRequestProperty(\"Keep-Alive\", \"115\");\n\tuc.setRequestProperty(\"Connection\", \"keep-alive\");\n\tuc.setDoOutput(true);\n\tuc.setDoInput(true);\n\tuc.setUseCaches(false);\n\tuc.setRequestMethod(\"POST\");\n\tuc.setRequestProperty(\"Content-Type\", \"text/xml\");\n\t\n\tBufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));//uc.getInputStream()\n\tString inputLine;\n\tboolean refreshAgain = false;\n\twhile ((inputLine = in.readLine()) != null) {\n\t\tsb.append(inputLine);\n\t\tif( inputLine.contains(\"Refresh\") ) {\n\t\t\trefreshAgain = true;\n\t\t\tSystem.out.println(\"Refresh\");\n\t\t}\n\t}\n\tin.close();\n\tuc.disconnect();\t\t\n//\tRefresh\n\tif( refreshAgain ) {\n\t Thread.sleep(1000);\n\t}\n\telse break;\n }\n }catch(Exception ee){}\nreturn sb.toString();\n}", "public SnapshotFeedReader(String feedurl) {\n super(feedurl);\n this.feed = new SnapshotFeed();\n this.links = new HashSet<AtomLink>();\n }", "public abstract XMLDocument parse(URL url);", "public long createFeed(String feedName,String feedURL,String encoding) {\r\n final ContentValues initialValues = new ContentValues();\r\n initialValues.put(FEED_NAME, feedName);\r\n initialValues.put(FEED_URL, feedURL);\r\n initialValues.put(XML_ENCODING, encoding);\r\n return mDB.insert(Tables.FEED_SOURCE, null, initialValues);\r\n }", "private RSS(Properties props) throws ParameterError {\n super(new String[0], null);\n Logger static_logger = Logging.getLogger(RSS.class);\n if (static_logger.isDebugEnabled()) {\n static_logger.debug(\"QRS Property=\" + props);\n }\n this.props = props;\n instance = this;\n this.sitesurl_string = props.getProperty(\"qrs.SitesURL\");\n data_feeds = new Hashtable<String, DataFeed>();\n\n String raw_feed_data = props.getProperty(\"qrs.DataFeeds\");\n if (raw_feed_data != null) {\n StringTokenizer tokenizer = new StringTokenizer(raw_feed_data, \" \");\n while (tokenizer.hasMoreTokens()) {\n String feed_name = tokenizer.nextToken().trim();\n makeFeed(feed_name, props);\n }\n }\n\n String sysstat_interval_str = props.getProperty(\"qrs.sysstat\");\n if (sysstat_interval_str != null) {\n int sysstat_interval = Integer.parseInt(sysstat_interval_str);\n TimerQueueingDataFeed feed = new TimerQueueingDataFeed();\n registerFeed(feed, \"DirectEntry\");\n DirectSysStatSupplier supplier = new DirectSysStatSupplier(null, feed);\n supplier.schedule(sysstat_interval);\n }\n\n String gui_id = props.getProperty(GUI_PROPERTY);\n if (gui_id != null) {\n new org.cougaar.qos.qrs.gui.MainWindow(gui_id);\n }\n\n }", "public synchronized Node parse(String url) throws IOException,SAXException\n {\n if(log.isDebugEnabled())\n log.debug(\"parse: \"+url);\n return parse(new InputSource(url));\n }", "public FeedManager loadFeed() throws IOException, XmlPullParserException {\n\t\tInputStream stream = null;\n\t\tSolsticeXmlParser solsticeXmlParser = new SolsticeXmlParser();\n\n\t\ttry {\n\t\t\tstream = downloadUrl(URL);\n\t\t\treturn solsticeXmlParser.parse(stream);\n\t\t} finally {\n\t\t\tif (stream != null) {\n\t\t\t\tstream.close();\n\t\t\t}\n\t\t}\n\t}", "private boolean pull(String url) {\r\n\t\ttry {\r\n\t\t\tHttpURLConnection con = (HttpURLConnection) new URL(url).openConnection();\r\n\t\t\tint respCode = con.getResponseCode();\r\n\t\t\tif (respCode != HttpURLConnection.HTTP_OK) {\r\n\t\t\t\tHaypiLog.d(TAG, respCode + \" \" + con.getResponseMessage());\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\tInputStream in = con.getInputStream();\r\n\t\t\tByteArrayOutputStream out = new ByteArrayOutputStream(4096);\r\n\t\t\tbyte[] buf = new byte[2048];\r\n\t\t\tint n;\r\n\t\t\twhile ((n = in.read(buf)) > -1) {\r\n\t\t\t\tout.write(buf, 0, n);\r\n\t\t\t}\r\n\t\t\tString encoding = con.getContentEncoding();\r\n\t\t\tif (encoding == null) {\r\n\t\t\t\tencoding = \"UTF-8\";\r\n\t\t\t}\r\n\t\t\tString resp = out.toString(encoding);\r\n\t\t\tString[] ss = HaypiUtil.split(resp, \"\\r\\n\");\r\n\r\n\t\t\tif (ss.length >= 3 && ss[0].equals(\"0\") && ss[1].equals(\"0\")) {\r\n\t\t\t\tint index = 2;\r\n\t\t\t\tint count = Integer.parseInt(ss[index++]);\r\n\t\t\t\tif (count > 0) {\r\n\t\t\t\t\tArrayList<News> list = new ArrayList<News>();\r\n\t\t\t\t\tfor (; count > 0; count--) {\r\n\t\t\t\t\t\tint version = Integer.parseInt(ss[index++]);\r\n\t\t\t\t\t\tif (version <= News.lastNewsVersion)\r\n\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\tNews.lastNewsVersion = version;\r\n\t\t\t\t\t\tNews entity = new News();\r\n\t\t\t\t\t\tentity.setNew(true);\r\n\t\t\t\t\t\tentity.setVersion(version);\r\n\t\t\t\t\t\tentity.setStartTime(Integer.parseInt(ss[index++]));\r\n\t\t\t\t\t\tentity.setEndTime(Integer.parseInt(ss[index++]));\r\n\t\t\t\t\t\tentity.setSubject(ss[index++]);\r\n\t\t\t\t\t\tentity.setDescription(ss[index++]);\r\n\t\t\t\t\t\tentity.setContent(ss[index++]);\r\n\t\t\t\t\t\tentity.setToken(ss[index++]);\r\n\t\t\t\t\t\tentity.setButtonText(ss[index++]);\r\n\t\t\t\t\t\tentity.setNewsType(News.TYPE.values()[Integer.parseInt(ss[index++])]);\r\n\t\t\t\t\t\tentity.setTopNews(\"1\".equals(ss[index++]));\r\n\t\t\t\t\t\tentity.setParams1(ss[index++]);\r\n\t\t\t\t\t\tentity.setParams2(ss[index++]);\r\n\t\t\t\t\t\tentity.setParams3(ss[index++]);\r\n\t\t\t\t\t\tlist.add(entity);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (list.size() > 0) {\r\n\t\t\t\t\t\tNews.add(list);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tcon.disconnect();\r\n\t\t\treturn true;\r\n\t\t} catch (Exception e) {\r\n\t\t\tHaypiLog.e(TAG, \"poll\", e);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "private String getURL(String feedUrl) {\n\tStringBuilder sb = null;\n\ttry {\n for(int i = 3; i>0; i--) {\n\t sb = new StringBuilder();\n URL url = new URL(feedUrl);\n//User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.22) Gecko/20110902 Firefox/3.6.22 GTB7.1 ( .NET CLR 3.5.30729)\n//Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\n//Accept-Language: en-us,en;q=0.5\n//Accept-Encoding: gzip,deflate\n//Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\n//Keep-Alive: 115\n//Connection: keep-alive\n//\tHttpsURLConnection uc = (HttpsURLConnection) url.openConnection();\n\tHttpURLConnection uc = (HttpURLConnection) url.openConnection();\n\tuc.setRequestProperty(\"User-Agent\", \"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.22) Gecko/20110902 Firefox/3.6.22 GTB7.1 ( .NET CLR 3.5.30729)\");\n//Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\n\tuc.setRequestProperty(\"Accept\", \"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\");\n\tuc.setRequestProperty(\"Accept-Language\", \"en-us,en;q=0.5\");\n\tuc.setRequestProperty(\"Accept-Encoding\", \"gzip,deflate\");\n\tuc.setRequestProperty(\"Accept-Charset\", \"ISO-8859-1,utf-8;q=0.7,*;q=0.7\");\n\tuc.setRequestProperty(\"Keep-Alive\", \"115\");\n\tuc.setRequestProperty(\"Connection\", \"keep-alive\");\n//Keep-Alive: 115\n//Connection: keep-alive\n//\tif (userName != null && password != null) {\n//\t\tuc.setRequestProperty(\"Authorization\", \"Basic \" + encodedAuthenticationString);\n//\t}\n\t// ori setting??\n//\tuc.setReadTimeout(TIME_OUT);\n//\tuc.setFollowRedirects(true);\n//\tuc.setInstanceFollowRedirects(true);\n//\tuc.setAllowUserInteraction(true);\n\tuc.setDoOutput(true);\n\tuc.setDoInput(true);\n\tuc.setUseCaches(false);\n\tuc.setRequestMethod(\"POST\");\n\tuc.setRequestProperty(\"Content-Type\", \"text/xml\");\n\t\n\tBufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));//uc.getInputStream()\n\tString inputLine;\n//\t'aa7c.com')\" onmouseout=\"menuLayers.hide()\">Available</a>\n\tboolean refreshAgain = false;\n\twhile ((inputLine = in.readLine()) != null) {\n//\t\tSystem.out.println(inputLine);\n\t\tsb.append(inputLine);\n\t\tif( inputLine.contains(\"Refresh\") ) {\n\t\t\trefreshAgain = true;\n\t\t\tSystem.out.println(\"Refresh\");\n\t\t}\n\t}\n\tin.close();\n\tuc.disconnect();\t\t\n//\tRefresh\n\tif( refreshAgain ) {\n\t Thread.sleep(1000);\n\t}\n\telse break;\n }\n }catch(Exception ee){}\nreturn sb.toString();\n}", "public MsxReader ( URL url ) {\r\n\t\tsuper();\r\n\r\n\t\taddURL(url);\r\n\t}", "protected Feed(String url, List<String> userTitle, Settings settings) {\n\t\tthis.url = url;\n\t\tthis.items = Collections.synchronizedSet(new HashSet<FeedItem>());\n\t\tthis.userTitle = new ArrayList<>(userTitle);\n\t\tthis.settings = settings;\n\t}", "private void setFeedString(String feed_string) {\n\n feedURL = feed_string;\n }", "public void addFeedIntoFolder(String feedURL, String name);", "List<SyndFeed> getRssFeeds(Set<String> feedUrls) throws FeedException, IOException,\n FetcherException;", "@Override\n protected String doInBackground(String... args) {\n // rss link url\n String query_url = args[0];\n\n // weather object of rss.\n woeid = parser.getRSSFeedWeather2(query_url);\n\n // updating UI from Background Thread\n runOnUiThread(new Runnable() {\n public void run() {\n /**\n * Updating parsed data into text view.\n * */\n Intent intent = new Intent(MainActivity.this, Summit.class);\n String description = woeid.getWoeid();\n intent.putExtra(EXTRA_MESSAGE, description);\n // Log.d(\"Long\", description);\n startActivity(intent);\n }\n });\n return null;\n }", "public static ArrayList<Map<String,String>> getContFromRssNoHtml(String urlAdress) {\n\n URL url = null;\n Iterator itEntries = null;\n try {\n //thetume ton browser Agent se browser-like gia na apofigume 403 errors\n System.setProperty(\"http.agent\", \"Mozilla/5.0 (Windows NT 10.0; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0\");\n url = new URL(urlAdress);\n HttpURLConnection httpcon = (HttpURLConnection) url.openConnection();\n httpcon.setRequestProperty(\"User-Agent\",\n \"Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20100101 Firefox/19.0\");\n // Reading the feed\n SyndFeedInput input = new SyndFeedInput();\n SyndFeed feed = input.build(new XmlReader(httpcon));\n List entries = feed.getEntries();\n itEntries = entries.iterator();\n } catch (MalformedURLException e) {\n e.printStackTrace();\n } catch (FeedException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n //contAr has all the entries\n ArrayList<Map<String,String>> contAr = new ArrayList<Map<String, String>>();\n\n //contMap has all the entries contents\n Map<String,String> contMap = new HashMap<String, String>();\n contMap.put(\"URI\",urlAdress);\n\n\n while (itEntries.hasNext()) {\n contMap = new HashMap<String, String>();\n SyndEntry entry = (SyndEntry) itEntries.next();\n System.out.println(entry.getUri());\n contMap.put(\"Title\",entry.getTitle());\n contMap.put(\"Link\",entry.getLink());\n contMap.put(\"Description\",entry.getDescription().getValue());\n\n contAr.add(contMap);\n System.out.println();\n }\n return contAr;\n }", "public void updateURL(String url) {\n\t\tthis.url = url;\n\t\ttry{\n\t\t\tthis.content = BrowsrDocumentValidator.assertIsValidBrowsrDocument(new URL(url));\n\t\t} catch (Exception exception){\n\t\t\tthis.content = new Text(exception.toString());\n\t\t}\n\t}", "public void openNewFeed(final String datfeed) {\n\n //close the navigation drawer\n closeDrawer();\n\n //show swipe refresh\n swiperefresh.setRefreshing(true);\n\n //detect if there's a connection issue or not: if there's a connection problem stop refreshing and show message\n if (cM.getActiveNetworkInfo() == null) {\n Toast toast = Toast.makeText(getBaseContext(), R.string.no_internet, Toast.LENGTH_SHORT);\n toast.show();\n swiperefresh.setRefreshing(false);\n\n } else {\n\n Thread thread = new Thread(new Runnable() {\n @Override\n public void run() {\n DOMParser tmpDOMParser = new DOMParser();\n fFeed = tmpDOMParser.parseXml(datfeed);\n ListActivity.this.runOnUiThread(new Runnable() {\n\n @Override\n public void run() {\n if (fFeed != null && fFeed.getItemCount() > 0) {\n\n adapter.notifyDataSetChanged();\n\n //close swipe refresh\n swiperefresh.setRefreshing(false);\n\n //set feedURL calling setFeedString method, it is important if we want working swipe refresh listener\n setFeedString(datfeed);\n }\n }\n });\n }\n });\n thread.start();\n }\n }", "public Feed getFeed(String feedURL, Date lastUpdatedDate) throws MalformedURLException {\n return getFeed(feedURL, lastUpdatedDate, false);\n }", "public static Article scrape (String string_url) {\n try {\n\n Article article = new Article();\n\n URL url = new URL(string_url);\n\n final HTMLDocument htmlDoc = HTMLFetcher.fetch(url);\n\n final BoilerpipeExtractor extractor = CommonExtractors.ARTICLE_EXTRACTOR;\n\n final HTMLHighlighter hh = HTMLHighlighter.newExtractingInstance();\n hh.setOutputHighlightOnly(true);\n\n TextDocument doc = new BoilerpipeSAXInput(htmlDoc.toInputSource()).getTextDocument();\n extractor.process(doc);\n final InputSource is = htmlDoc.toInputSource();\n article.html_text = hh.process(doc, is);\n article.source = string_url;\n article.title = doc.getTitle();\n article.encoded_source = TextHelper.toSHA1(string_url);\n return article;\n } catch (Exception ex) {\n ExceptionNotification.printException(ex);\n return new Article();\n }\n }", "protected void onPostExecute(String feed) {\n\t\t}", "protected void onPostExecute(String feed) {\n }", "protected void onPostExecute(String feed) {\n }", "private List<DBFeedModel> parseResult(ConnectionResult connectionResult) {\n try {\n JSONObject response = new JSONObject(connectionResult.getResult());\n JSONArray posts = response.optJSONArray(\"posts\");\n List<DBFeedModel> feedsList = new ArrayList<>();\n\n for (int i = 0; i < posts.length(); i++) {\n JSONObject post = posts.optJSONObject(i);\n DBFeedModel item = new DBFeedModel();\n item.setViewType(Constants.FEED_VIEW_TYPE_LEFT);\n item.setTitle(post.optString(\"title\"));\n item.setThumb(post.optString(\"thumbnail\"));\n item.setUrl(\"http://m.dantri.com.vn/xa-hoi/hai-phong-yeu-cau-thao-do-rong-vang-dau-pikachu-gay-tranh-cai-20170108172552427.htm\");\n feedsList.add(item);\n }\n\n return feedsList;\n } catch (JSONException e) {\n e.printStackTrace();\n }\n\n return null;\n }", "@Override\n protected Void doInBackground(Void... arg0) {\n helper = new LiveFeedParser(999);\n helper.get();\n viewEntries = helper.getViewEntries();\n return null;\n }", "@Override\n\tpublic InputStream createForumRss(String objectId, String link)\n\t\t\tthrows Exception {\n\t\treturn null;\n\t}", "public static void processFeed(FeedContext fc, Feed feed) {\n try {\n\t\t\tAbderaAtomParser parser = new AbderaAtomParser(feed);\n\t\t\tparser.persistFeed(fc);\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\tmLog.error(\"Error processing feed at [\" + fc.getFeedUrl() + \"]: \" + e.getMessage());\n\t\t}\n }", "public void turnOnRss(final String url) {\n ParseFeedTask task = tasks.get(url);\n if (task == null) {\n System.out.println(String.format(\"Rss with url %s is not found\", url));\n return;\n }\n RssConfiguration configuration = task.getConfiguration();\n if (configuration.getTurnOn()) {\n System.out.println(\"Rss is already running\");\n return;\n }\n configuration.setTurnOn(true);\n try {\n PropertiesHandler.writeProperties(configuration);\n ScheduledFuture future = scheduledExecutorService.scheduleWithFixedDelay(task, configuration.getPollPeriod(), configuration.getPollPeriod(), TimeUnit.SECONDS);\n futures.put(url, future);\n System.out.println(String.format(\"Rss %s is running\", url));\n } catch (IOException e) {\n System.out.println(String.format(\"An error occurred during the change poll period for feed %s\", url));\n }\n }", "public void processUrl() {\n try {\n\n JsonNode rootNode = getJsonRootNode(getJsonFromURL()); // todo: pass url in this method (to support multi-urls)\n getValuesFromJsonNodes(rootNode);\n setAndFormatValues();\n\n } catch (Exception e) {\n System.out.println(\"ERROR: caught error in processUrl()\");\n e.printStackTrace();\n }\n }", "public Feed getFeed(URL feedURLObject, Date lastUpdatedDate, boolean summary) {\n inputStream = null;\n FeedHandler feedHandler = new FeedHandler(lastUpdatedDate, summary);\n if (xmlReader != null && feedURLObject != null) {\n try {\n String encoding = detectEncoding(feedURLObject);\n if (inputStream == null) {\n if (\"file\".equals(feedURLObject.getProtocol())) {\n inputStream = feedURLObject.openStream();\n } else {\n inputStream = client.loadInputStream(feedURLObject);\n }\n }\n InputSource inputSource = new InputSource(inputStream);\n if (encoding != null) {\n inputSource.setEncoding(encoding);\n }\n\n xmlReader.setContentHandler(feedHandler);\n xmlReader.parse(inputSource);\n\n } catch (EndSAXException e) {\n // No problem\n } catch (IOException e) {\n System.err.println(e.getMessage());\n } catch (SAXException e) {\n System.err.println(e.getMessage());\n } finally {\n if (inputStream != null) {\n try {\n inputStream.close();\n } catch (IOException e) {\n System.err.println(e.getMessage());\n }\n }\n }\n }\n return feedHandler.getFeed();\n }", "protected void update(FeedItemHandler handler, Date cacheExpiryDate, ExecutorService executor) {\n\t\ttry {\n\t\t\tURLConnection connection = new URL(url).openConnection();\n\t\t\tconnection.setConnectTimeout(settings.getFeedConnectTimeout());\n\t\t\tconnection.setReadTimeout(settings.getFeedReadTimeout());\n\t\t\tconnection.connect();\n\t\t\tSyndFeedInput feedInput = new SyndFeedInput();\n\t\t\tCharset charset = Charset.forName(\"utf-8\"); //NOI18N\n\t\t\tif (connection.getContentEncoding() != null) {\n\t\t\t\tcharset = Charset.forName(connection.getContentEncoding());\n\t\t\t} else if (connection.getContentType() != null) {\n\t\t\t\tString[] contentTypeParts = connection.getContentType().split(\";\"); //NOI18N\n\t\t\t\tfor (String contentTypePart : contentTypeParts) {\n\t\t\t\t\tString[] contentTypePartComponents = contentTypePart.trim().split(\"=\", 2); //NOI18N\n\t\t\t\t\tif (contentTypePartComponents.length == 2 && contentTypePartComponents[0].matches(\"charset\")) //NOI18N\n\t\t\t\t\t\tcharset = Charset.forName(contentTypePartComponents[1].trim());\n\t\t\t\t}\n\t\t\t}\n\t\t\tSyndFeed feed = feedInput.build(new InputStreamReader(connection.getInputStream(), charset));\n\t\t\ttitle = feed.getTitle();\n\t\t\tencoding = feed.getEncoding();\n\t\t\thandleEntries(feed.getEntries(), handler, cacheExpiryDate, executor);\n\t\t} catch (IOException | IllegalArgumentException ex) {\n\t\t\tthrow new RuntimeException(MessageFormat.format(messages.getString(\"CANNOT_UPDATE_FEED\"), new Object[]{url}), ex);\n\t\t} catch (Exception ex) {\n\t\t\tthrow new RuntimeException(MessageFormat.format(messages.getString(\"CANNOT_UPDATE_FEED\"), new Object[]{url}), ex);\n\t\t}\n\t}", "public String insertUrl(Url url)\r\n\t{\n\t\tthis.mongo.insert(url);\r\n\t\treturn null;\r\n\t}", "private static FeedSource createFeedSource(String name, URL url) {\n FeedSource feedSource = new FeedSource();\n feedSource.fetchFrequency = FetchFrequency.MINUTES;\n feedSource.fetchInterval = 1;\n feedSource.deployable = false;\n feedSource.name = name;\n feedSource.projectId = project.id;\n feedSource.retrievalMethod = FeedRetrievalMethod.FETCHED_AUTOMATICALLY;\n feedSource.url = url;\n return feedSource;\n }", "public Object parseItem(int rssType, Document doc, int index) throws Exception;", "public static void validate(FeedProvider _feedProvider) throws FeedInvalidException {\n\t\tif(_feedProvider.getnNumber() == null || _feedProvider.getnNumber().equals(\"\") \r\n\t\t\t\t|| _feedProvider.getNickName() == null || _feedProvider.getNickName().equals(\"\")\r\n\t\t\t\t|| _feedProvider.getUrl() == null || _feedProvider.getUrl().equals(\"\") )\r\n\t\t\tthrow new FeedInvalidException(message_02);\r\n\t\t\r\n\t\tUrlValidator urlValidator = new UrlValidator();\t\t \r\n\t //validation URL\r\n\t if (!urlValidator.isValid(_feedProvider.getUrl())) \r\n\t \tthrow new FeedInvalidException(message);\r\n\t \r\n\t // verify if URL is a valid RSS\r\n\t try {\r\n\t\t \r\n\t \tDocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();\r\n\t\t org.w3c.dom.Document doc = builder.parse(_feedProvider.getUrl()); \r\n\t\t boolean validRss = doc.getDocumentElement().getNodeName().equalsIgnoreCase(\"rss\");\r\n\t\t if(!validRss)\r\n\t\t \tthrow new FeedInvalidException(message);\r\n\t\t \r\n\t } catch (FeedInvalidException fe) {\r\n\t \t\r\n\t\t throw fe;\r\n\t\t \r\n\t } catch (Exception e) {\r\n\t \t//for unknown case\r\n\t \tthrow new FeedInvalidException( message +\"\\n\"+ e.getMessage() );\r\n\t\t}\r\n\t \r\n\t}", "private int getHitsAndArticlesByURL(Category node, String url)\r\n\t{\r\n\t\tDocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();\r\n\t\tint NumRes = 0;\r\n\t\tString totalHits;\r\n\t\ttry{\r\n\t\t\tURL queryurl = new URL(url);\r\n\t\t\tURLConnection connection = queryurl.openConnection();\r\n\t\t\tconnection.setDoInput(true);\r\n\t\t\tInputStream inStream = connection.getInputStream();\r\n\t\t\tDocumentBuilder dombuilder = domfac.newDocumentBuilder();\r\n\t\t\tDocument doc = dombuilder.parse(inStream);\r\n\t\t\tElement root = doc.getDocumentElement();\r\n\t\t\tNodeList resultset_web = root.getElementsByTagName(\"resultset_web\");\r\n\t\t\tNode resultset = resultset_web.item(0);\r\n\t\t\t\r\n\t\t\ttotalHits = resultset.getAttributes().getNamedItem(\"totalhits\").getNodeValue();\r\n\t\t\tNumRes = Integer.parseInt(totalHits);\r\n\t\t\t\r\n\t\t\tint count = 0;\r\n\t\t\tNodeList results = resultset.getChildNodes(); \r\n\t\t\tif(results != null)\r\n\t\t\t{\t\t\t\r\n\t\t\t\tfor(int i = 0 ; i < results.getLength(); i++){\r\n\t\t\t\t\tNode result = results.item(i);\t\t\t\t\t\t\t\t\r\n\t\t\t\t\tArticle newArticle = new Article();\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(result.getNodeType()==Node.ELEMENT_NODE){\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tfor(Node node1 = result.getFirstChild(); node1 != null; node1 = node1.getNextSibling()){\r\n\t\t\t\t\t\t\tif(node1.getNodeType()==Node.ELEMENT_NODE){\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tif(node1.getNodeName().equals(\"url\") && node1.getFirstChild() != null && count < 4){\r\n\t\t\t\t\t\t\t\t\tcount++;\r\n\t\t\t\t\t\t\t\t\tString pageUrl = node1.getFirstChild().getNodeValue();\r\n\t\t\t\t\t\t\t\t\tArticle article = new Article();\r\n\t\t\t\t\t\t\t\t\tarticle.URL = pageUrl;\r\n\t\t\t\t\t\t\t\t\tarticle.words = getWordsLynx.runLynx(pageUrl);\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tnode.articles.add(article);\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}\r\n\t\t\t\t\t}\t\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}catch(ParserConfigurationException e){\r\n\t\t\te.printStackTrace();\r\n\t\t\treturn -1;\r\n\t\t}catch(SAXException e){\r\n\t\t\te.printStackTrace();\r\n\t\t\treturn -1;\r\n\t\t}catch(IOException e){\r\n\t\t\te.printStackTrace();\r\n\t\t\treturn -1;\r\n\t\t}\r\n\r\n\t\treturn NumRes;\r\n\t}", "@Override\n protected RSSItem doInBackground(RSSItem... params) {\n \tDatabaseUtil databaseUtil = DatabaseUtil.initDatabase(context);\n \t\tif (databaseUtil == null) {\n \t\t\tLog.w(TAG, \"database init failed\");\n \t\t\treturn item;\n \t\t}\n \titem = params[0];\n \t\titem.setFav(databaseUtil.changeFav(item));\n return item;\n }", "@Override\n\t\tprotected List<NewsBean> doInBackground(Void... params) {\n\t\t\tsynchronized (this) {\n\t\t\t\treturn new ParseXMLUtil().parseNewsXml(ls, url);\n\t\t\t}\n\t\t}", "private void parseResponse(String response, List<NewsDetailItem> items) {\n\n Pattern pText = Pattern.compile(ITEM_TEXT_PREF + \".*?\" + ITEM_TEXT_POSTF);\n Pattern pTitle = Pattern.compile(TITLE_PREF + \".*?\" + TITLE_POSTF);\n Pattern pDate = Pattern.compile(\"class=\\\"metadata\\\">.*?</a>\");\n Pattern pDate2 = Pattern.compile(\"</strong>.*?<\");\n\n Pattern pImage2 = Pattern.compile(IMG_PREF + \".*?\" + IMG_POSTF);\n\n Pattern pVideo = Pattern.compile(VIDEO_PREF + \".*?\" + VIDEO_POSTF);\n\n Pattern pImageUrl = Pattern.compile(IMG_URL_PREF + \".*?\" + IMG_URL_POSTF);\n\n Pattern pComment = Pattern.compile(\"li class=\\\" item\\\" id=\\\"comment.*?</li>\");\n Pattern pAuthor = Pattern.compile(\"class=\\\"commentauthor\\\".*?</span>\");\n\n Pattern pAuthorName1 = Pattern.compile(\"'>.*?</span>\");\n Pattern pAuthorName2 = Pattern.compile(\"/>.*?</span>\");\n Pattern pAuthorImage = Pattern.compile(AUTHOR_IMAGE_PREF + \".*?\" + AUTHOR_IMAGE_POSTF);\n\n Pattern pCommentText = Pattern.compile(\"<span id=\\\"co_.*?</li>\");\n Pattern pCommentId = Pattern.compile(COMMENT_ID_PREFIX + \".*?\" + COMMENT_ID_POSTFIX);\n\n Pattern pCommentTex2t = Pattern.compile(\"dislike-counter.*?comment-toolbar\"); //Pattern.compile(COMMENT_PREFIX + \".*?\" + COMMENT_POSTFIX);\n Pattern pCommentText3 = Pattern.compile(COMMENT_PREFIX + \".*?\" + COMMENT_POSTFIX);\n Pattern pThumbsDown = Pattern.compile(\"dislike-counter-comment.*?</span>\");\n Pattern pThumbsUp = Pattern.compile(\"like-counter-comment.*?</span>\");\n Pattern pThumb2 = Pattern.compile(THUMB_PREF + \".*?\" + THUMB_POSTF);\n\n Pattern pCommentDate = Pattern.compile(COMMENTDATE_PREF + \".*?\" + COMMENTDATE_POSTF);\n Pattern pWidth = Pattern.compile(WIDTH_PREF + \".*?\" + WIDTH_POSTF);\n Pattern pHeight = Pattern.compile(HEIGHT_PREF + \".*?\" + HEIGHT_POSTF);\n\n Pattern pAkismet = Pattern.compile(\"vortex_ajax_comment\"+\".*?\"+\";\");\n\n Pattern pAkismet2 = Pattern\n .compile(\"\\\"nonce\\\":\\\".*?\"+\"\\\"\");\n\n Pattern pValue = Pattern.compile(\"value=\\\".*?\\\"\");\n\n Pattern pAk_js = Pattern\n .compile(\"id=\\\"ak_js\\\".*?/>\");\n\n\n String akismet = \"\";\n String ak_js = \"\";\n String postId = \"\";\n Matcher makismet_comment = pAkismet.matcher(response);\n if (makismet_comment.find()) {\n Matcher mvalue = pAkismet2.matcher(makismet_comment.group());\n if (mvalue.find()) {\n akismet = mvalue.group();\n akismet = akismet.replace(\"\\\"\", \"\");\n akismet = akismet.replace(\"nonce:\", \"\");\n }\n }\n\n Matcher mak_js = pAk_js.matcher(response);\n if (mak_js.find()) {\n Matcher mvalue = pValue.matcher(mak_js.group());\n if (mvalue.find()) {\n ak_js = mvalue.group();\n ak_js = ak_js.replace(\"\\\"\", \"\");\n ak_js = ak_js.replace(\"value=\", \"\");\n }\n }\n\n\n Pattern ppost_id = Pattern.compile(\"name=\\\"comment_post_ID\\\".*?/>\");\n Matcher mpost_id = ppost_id.matcher(response);\n if (mpost_id.find()) {\n Matcher mvalue = pValue.matcher(mpost_id.group());\n if (mvalue.find()) {\n postId = mvalue.group();\n postId = postId.replace(\"\\\"\", \"\");\n postId = postId.replace(\"value=\", \"\");\n }\n }\n\n Matcher itemMatcher;\n itemMatcher = pDate.matcher(response);\n String date = \"\";\n if (itemMatcher.find()) {\n itemMatcher = pDate2.matcher(itemMatcher.group());\n if (itemMatcher.find()) {\n date = itemMatcher.group().substring(10);\n date = date.substring(0, date.length() - 2);\n }\n }\n\n Matcher mTitle = pTitle.matcher(response);\n if (mTitle.find()) {\n String itemText = mTitle.group().substring(TITLE_PREF.length()); //(\" dc:title=\\\"\".length()).replace(\"\\\"\", \"\");\n itemText = itemText.substring(0, itemText.length() - TITLE_POSTF.length());\n NewsDetailItem item = new NewsDetailItem();\n item.setText(itemText);\n item.setDate(date);\n item.setContentType(NewsDetailDBHelper.NewsItemType.TITLE.ordinal());\n item.setPostUrl(mUrl);\n item.setCommentId(postId);\n item.setAkismet(akismet);\n item.setAk_js(ak_js);\n items.add(item);\n }\n\n Matcher mText = pText.matcher(response);\n int imageEnd = 0;\n int textStart;\n\n if (mText.find()) {\n String text = mText.group().substring(ITEM_TEXT_PREF.length());\n text = text.substring(0, text.length() - ITEM_TEXT_POSTF.length());\n Matcher mImage = pImage2.matcher(text);\n while (mImage.find()) {\n int textEnd = mImage.start();\n textStart = imageEnd;\n imageEnd = mImage.end();\n String itemText = text.substring(textStart, textEnd);\n addTextItem(items, itemText);\n processImageItem(items, mImage.group(), pImageUrl, pWidth, pHeight);\n }\n\n Matcher mVideo = pVideo.matcher(text);\n while (mVideo.find()) {\n int textEnd = mVideo.start();\n textStart = imageEnd;\n imageEnd = mVideo.end();\n String itemText = \"\";\n if (textEnd >= textStart) {\n itemText = text.substring(textStart, textEnd);\n }\n addTextItem(items, itemText);\n processVideoItem(items, mVideo.group(), pImageUrl, pWidth, pHeight);\n }\n\n text = text.substring(imageEnd);\n addTextItem(items, text);\n }\n\n\n NewsDetailItem item = new NewsDetailItem();\n item.setContentType(NewsDetailDBHelper.NewsItemType.REPLY_HEADER.ordinal());\n item.setPostUrl(mUrl);\n items.add(item);\n\n Matcher mComment = pComment.matcher(response);\n while (mComment.find()) {\n item = new NewsDetailItem();\n item.setContentType(NewsDetailDBHelper.NewsItemType.REPLY.ordinal());\n item.setPostUrl(mUrl);\n items.add(item);\n item.setAkismet(akismet);\n String comment = mComment.group();\n\n // if (comment.contains(CAN_CHANGE_KARMA_PREFIX)) {\n item.setCanChangeKarma(1);\n // } else {\n // item.setCanChangeKarma(0);\n // }\n\n Matcher mAuthor = pAuthor.matcher(comment);\n if (mAuthor.find()) {\n String authorText = mAuthor.group();\n item.setAuthorImage(getAuthorImgage(authorText, pAuthorImage));\n item.setAuthor(getAuthorName(authorText, pAuthorName1, pAuthorName2));\n }\n Matcher mCommentText = pCommentText.matcher(comment);\n if (mCommentText.find()) {\n String s = mCommentText.group();\n mCommentText = pCommentTex2t.matcher(s);\n if (mCommentText.find()) {\n mCommentText = pCommentText3.matcher(mCommentText.group());\n if (mCommentText.find()) {\n String commentText = mCommentText.group().substring(COMMENT_PREFIX.length());\n commentText = commentText.substring(0, commentText.length() - COMMENT_POSTFIX.length());\n commentText = commentText.replace(\"<p>\", \"\");\n commentText = commentText.replace(\"</p>\", \"\");\n item.setText(commentText);\n }\n }\n }\n Matcher mCommentId = pCommentId.matcher(comment);\n if (mCommentId.find()) {\n String commentId = mCommentId.group().substring(COMMENTDATE_PREF.length());\n commentId = commentId.substring(0, commentId.length() - COMMENT_ID_POSTFIX.length());\n item.setCommentId(commentId);\n }\n Matcher mCommentDate = pCommentDate.matcher(comment);\n if (mCommentDate.find()) {\n String commentDate = mCommentDate.group().substring(COMMENTDATE_PREF.length());\n commentDate = commentDate.substring(0, commentDate.length() - COMMENTDATE_POSTF.length());\n item.setDate(commentDate);\n }\n item.setKarmaUp(getKarma(comment, pThumbsUp, pThumb2));\n item.setkarmaDown(getKarma(comment, pThumbsDown, pThumb2));\n }\n }", "Object create(URL url) throws IOException, SAXException, ParserConfigurationException;", "@Override\n\t\tprotected List<NewsBean> doInBackground(Void... params) {\n\t\t\tsynchronized (this) {\t\t\t\n\t\t\t\treturn new ParseXMLUtil().parseNewsXml(ls,url);\n\t\t\t}\t\t\t\n\t\t}", "@Override\r\n\tpublic void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n\t\ttry{\r\n\t\t\tURL feedUrl = new URL(\"http://blog.rss.naver.com/leeminji25.xml\");\r\n\t\t\tSyndFeedInput input = new SyndFeedInput();\r\n\t\t\tSyndFeed syndFeed = input.build(new XmlReader(feedUrl));\r\n\t\t\t\r\n\t\t\t/* RSS */\r\n\t\t\tSystem.out.println( syndFeed.getFeedType() );\r\n\t\t\tList<SyndEntry> entries = syndFeed.getEntries();\r\n\t\t\trequest.setAttribute(\"entries\", entries);\t\r\n\r\n\t\t}catch(Exception e){\r\n\t\t\tSystem.out.println(e.getMessage());\r\n\t\t}\r\n\r\n\t\tRequestDispatcher dispatcher = request.getRequestDispatcher(\"/content/blog.jsp\");\r\n\t\tdispatcher.forward(request, response);\r\n\t}", "private boolean extractArticleFromUrl(URL url) {\n\n\t\tif (!mDBh.urlExistsInWebsite(url)) {\n\t\t\tString content = null;\n\n\t\t\t//REMEMBER TO: when switching content format text <-> HTML, change the textType in SIMMO Document\n\n\t\t\t//Extract the content as plain text\n//\t\t\ttry {\n//\t\t\t\tfinal InputSource is = HTMLFetcher.fetch(url).toInputSource();\n//\t\t\t\tfinal BoilerpipeSAXInput in;\n//\t\t\t\tin = new BoilerpipeSAXInput(is);\n//\t\t\t\tfinal TextDocument doc = in.getTextDocument();\n//\t\t\t\tcontent = ArticleExtractor.INSTANCE.getText(doc);\n//\t\t\t} catch (SAXException e) {\n//\t\t\t\tSystem.out.println(\"KIndex :: Scrapper.extractArticleFromUrl() SAXException for url: \" + url.toString());\n//\t\t\t\te.printStackTrace();\n//\t\t\t\treturn false;\n//\t\t\t} catch (BoilerpipeProcessingException e) {\n//\t\t\t\tSystem.out.println(\"KIndex :: Scrapper.extractArticleFromUrl() BoilerpipeProcessingException for url: \" + url.toString());\n//\t\t\t\te.printStackTrace();\n//\t\t\t\treturn false;\n//\t\t\t} catch (IOException e) {\n//\t\t\t\tSystem.out.println(\"KIndex :: Scrapper.extractArticleFromUrl() IOException for url: \" + url.toString());\n//\t\t\t\te.printStackTrace();\n//\t\t\t\treturn false;\n//\t\t\t}\n\n\t\t\t//extract the content as HTML\n\t\t\tfinal BoilerpipeExtractor extractor = CommonExtractors.DEFAULT_EXTRACTOR;\n\t\t\tfinal HTMLHighlighter hh = HTMLHighlighter.newExtractingInstance();\n\t\t\ttry {\n\t\t\t\tcontent = hh.process(url, extractor);\n\t\t\t} catch (IOException e) {\n\t\t\t\tSystem.out.println(\"KIndex :: Scrapper.extractArticleFromUrl() IOException for url: \" + url.toString());\n\t\t\t\te.printStackTrace();\n\t\t\t\treturn false;\n\t\t\t} catch (BoilerpipeProcessingException e) {\n\t\t\t\tSystem.out.println(\"KIndex :: Scrapper.extractArticleFromUrl() BoilerpipeProcessingException for url: \" + url.toString());\n\t\t\t\te.printStackTrace();\n\t\t\t\treturn false;\n\t\t\t} catch (SAXException e) {\n\t\t\t\tSystem.out.println(\"KIndex :: Scrapper.extractArticleFromUrl() SAXException for url: \" + url.toString());\n\t\t\t\te.printStackTrace();\n\t\t\t\treturn false;\n\t\t\t}\n\n\n\t\t\t//checking if website already exist\n\n\t\t\t//Storing content in Simmo\n\t\t\t//Create a Simmo Webpage\n\t\t\tWebpage wp = new Webpage();\n\t\t\twp.setUrl(url.toString());\n\n\t\t\tCalendar cal = Calendar.getInstance();\n\t\t\twp.setCreationDate(cal.getTime());\n\n\t\t\t//Create a Simmo Text\n\t\t\tText txt = new Text();\n\t\t\ttxt.setContent(content);\n\t\t\ttxt.setTextType(Text.TEXT_TYPE.HTML);\n//\t\t\ttxt.setTextType(Text.TEXT_TYPE.TXT);\n\n\t\t\t//Add Text to Webpage\n\t\t\twp.addItem(txt);\n\n\t\t\t//Store Webpage to db\n\t\t\tDAOManager manager = new DAOManager(MongoDBHandler.getTrgDBName());\n\t\t\tmanager.saveWebpage(wp);\n\n\n\t\t\t//Politeness policy of one second.\n\t\t\ttry {\n\t\t\t\tThread.sleep(1000); //1000 milliseconds is one second.\n\t\t\t} catch (InterruptedException ex) {\n\t\t\t\t//Thread.currentThread().interrupt();\n\t\t\t\tSystem.out.println(\"Could not make the thread sleep\");\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\t\tSystem.out.println(\"Already exist in database: \" + url.toString());\n\t\treturn false;\n\t}", "private void parseJsonFeed(JSONObject response) {\n try {\n JSONArray feedArray = response.getJSONArray(\"feed\");\n\n for (int i = 0; i < feedArray.length(); i++) {\n JSONObject feedObj = (JSONObject) feedArray.get(i);\n\n FeedItem item = new FeedItem();\n item.setId(feedObj.getInt(\"organisation_id\"));\n item.setPortId(feedObj.getInt(\"portfolio_id\"));\n item.setName(feedObj.getString(\"name\"));\n //int id=item.getId();\n // Image might be null sometimes\n String image = feedObj.isNull(\"image\") ? null : feedObj.getString(\"image\");\n item.setImge(image);\n item.setStatus(feedObj.getString(\"status\"));\n item.setProfilePic(feedObj.getString(\"profilePic\"));\n item.setTimeStamp(feedObj.getString(\"timeStamp\"));\n item.setCommentCount(feedObj.getString(\"commentCount\"));\n\n // url might be null sometimes\n String feedUrl = feedObj.isNull(\"url\") ? null : feedObj.getString(\"url\");\n item.setUrl(feedUrl);\n\n feedItems.add(item);\n }\n\n\n // notify data changes to list adapater\n listAdapter.notifyDataSetChanged();\n\n\n } catch (JSONException e) {\n e.printStackTrace();\n }\n }", "public LessonInfo parseAndSave(String url, String xmlFile) throws Exception {\n\t\t\n\t\tif (StringUtils.isEmpty(url)) {\n\t\t\tthrow new InvalidParameterException(\"url\");\n\t\t}\n\t\t\n\t\tXmlSocket socket = new XmlSocket(url);\n\t\tDocument doc = null;\n\t\ttry {\n\t\t\tdoc = socket.connect();\n\t\t} catch (Exception ex) {\n\t\t\tthrow new DocumentException(\"lesson xml url unavailable:\" + url);\n\t\t}\n\t\tLessonInfo info = new LessonInfo();\n\t\t\n\t\tElement root = doc.getRootElement();\t\t\n\t\tparseGeneralInfo(root, info);\n\t\tparseAllFiles(root, info);\n\t\t\n\t\tconvertToXml(doc, xmlFile);\n\t\t\n\t\treturn info;\n\t}", "public interface RSSService {\n\n //if only RSS feeds used the last-modified tag..\n @HEAD\n Call<Void> headFeed(@Url String url);\n\n @GET\n Call<RSSFeed> getFeed(@Url String url);\n}", "private void processUrl (String stringUrl)\n\t{\n\t\tURL correctUrl=null;\n\t\t// we need the URL\n\t\t// we first try to convert it directly\n\t\ttry {\n\t\t\tcorrectUrl=new URL(stringUrl);\n\t\t} catch (MalformedURLException e) {System.out.println(\"Not found : \"+stringUrl);return;}\n\n\t\tallInformation.getNemo().addJcamp(stringUrl);\n\t}", "public int parse(String inputString) {\n manager.init();\n\n Map<String, List<String>> commandMap = new HashMap<>();\n List<String> blocks = Arrays.asList(inputString.split(\" \"));\n commandMap.put(blocks.get(0), blocks.size() > 1 ? blocks.subList(1, blocks.size()) : Collections.EMPTY_LIST);\n\n // item properties\n if (commandMap.containsKey(\"ip\")) {\n List<String> params = commandMap.get(\"ip\");\n if (params.size() > 0) {\n // set item properties\n manager.setItemParams(params);\n manager.prettyPrint(\"Successfully set Item Properties to: \" + params);\n } else {\n // get item properties\n manager.printItemParams();\n }\n }\n\n // channel properties\n if (commandMap.containsKey(\"cp\")) {\n List<String> params = commandMap.get(\"fp\");\n if (params.size() > 0) {\n // set channel properties\n manager.setChannelParams(params);\n manager.prettyPrint(\"Successfully set Channel Properties to: \" + params);\n } else {\n // get channel properties\n manager.printChannelParams();\n }\n }\n\n // rss\n if (commandMap.containsKey(\"rss\")) {\n List<String> params = commandMap.get(\"rss\");\n if (params.size() > 0) {\n switch (params.get(0)) {\n case \"add\": {\n if (params.size() != 3) {\n throw new IllegalArgumentException(\"Not enough params for -rss add\");\n }\n String rssLink = params.get(1);\n String file = params.get(2);\n manager.createFileIfNotExists(file);\n manager.associateRssToFile(rssLink, file);\n manager.prettyPrint(\n \"Successfully added new RSS Feed: \" + rssLink,\n \"Associated file is: \" + file\n );\n break;\n }\n case \"del\": {\n if (params.size() != 2) {\n throw new IllegalArgumentException(\"Not enough params for -rss del\");\n }\n String rssLink = params.get(1);\n manager.diassociateRss(rssLink);\n manager.prettyPrint(\"Successfully removed new RSS Feed: \" + rssLink);\n break;\n }\n case \"on\": {\n if (params.size() != 2) {\n throw new IllegalArgumentException(\"Not enough params for -rss on\");\n }\n String rssLink = params.get(1);\n manager.turnRSSOn(rssLink);\n manager.prettyPrint(\"Successfully turned RSS Feed \" + rssLink + \" on\");\n break;\n }\n case \"off\": {\n if (params.size() != 2) {\n throw new IllegalArgumentException(\"Not enough params for -rss off\");\n }\n String rssLink = params.get(1);\n manager.turnRSSOff(rssLink);\n manager.prettyPrint(\"Successfully turned RSS Feed \" + rssLink + \" off\");\n break;\n }\n }\n } else {\n manager.printRss();\n }\n } else if (commandMap.containsKey(\"time\")) {\n List<String> params = commandMap.get(\"time\");\n if (params.size() > 0) {\n if (params.size() != 1) {\n throw new IllegalArgumentException(\"Not enough params for -time\");\n }\n String newTimeToPoll = params.get(0);\n manager.setTimeToPoll(Long.valueOf(newTimeToPoll));\n manager.prettyPrint(\"Successfully set polling time to \" + newTimeToPoll);\n\n } else {\n manager.printTimeToPoll();\n }\n } else if (commandMap.containsKey(\"h\")) {\n manager.printHelp();\n } else if (commandMap.containsKey(\"exit\")) {\n return 1;\n }\n return 0;\n }", "abstract protected void insertByURL(URL url,\n\t\t\t\t\tDefaultListModel model,\n\t\t\t\t\tint index)\n\tthrows Exception;", "@Override\n public Uri insert(Uri url, ContentValues init) {\n String table = null;\n Uri origin = null;\n ContentValues value;\n if (init != null) {\n value = new ContentValues(init);\n } else {\n value = new ContentValues();\n }\n \n SQLiteDatabase db;\n\t// Modifyed by amt_chenjing for switchui-2192 20120715 begin\n try {\n db = mOpenHelper.getWritableDatabase();\n } catch (SQLiteException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n return null;\n }\n\t// Modifyed by amt_chenjing for switchui-2192 20120715 end\n long rowId = 0;\n switch(graphyUri.match(url)){\n case ALL_APPS:\n case ONE_APP:\n table = Apps.TABLE_NAME;\n origin = Apps.CONTENT_URI;\n rowId = db.insert(table, Apps.COMPONENT, value);\n break;\n case ALL_RANKS:\n case ONE_RANK:\n table = Ranks.TABLE_NAME;\n origin = Ranks.CONTENT_URI;\n rowId = db.insert(table, null, value);\n break;\n case ALL_MANUALS:\n case ONE_MANUAL:\n table = ManualList.TABLE_NAME;\n origin = ManualList.CONTENT_URI;\n rowId = db.insert(table, null, value);\n break;\t\n default:\n throw new IllegalArgumentException(\"cannot delete from uri:\"+url);\n }\n \n if (rowId < 0) {\n throw new SQLException(\"Failed to insert row into\"+url);\n }\n \n Uri newUrl = ContentUris.withAppendedId(origin, rowId);\n if (table.equals(ManualList.TABLE_NAME)) {\n getContext().getContentResolver().notifyChange(newUrl, null);\n }\n return newUrl;\n }", "private void processUrls(){\n // Strip quoted tweet URL\n if(quotedTweetId > 0){\n if(entities.urls.size() > 0 &&\n entities.urls.get(entities.urls.size() - 1)\n .expandedUrl.endsWith(\"/status/\" + String.valueOf(quotedTweetId))){\n // Match! Remove that bastard.\n entities.urls.remove(entities.urls.size() - 1);\n }\n }\n\n // Replace minified URLs\n for(Entities.UrlEntity entity : entities.urls){\n // Find the starting index for this URL\n entity.indexStart = text.indexOf(entity.minifiedUrl);\n // Replace text\n text = text.replace(entity.minifiedUrl, entity.displayUrl);\n // Find the last index for this URL\n entity.indexEnd = entity.indexStart + entity.displayUrl.length();\n }\n }", "@Override\n protected void onHandleIntent(Intent workIntent) {\n // Gets a URL to read from the incoming Intent's \"data\" value\n String urlString = workIntent.getDataString();\n\n // URL to download from\n URL url;\n\n //block that tries to connect to xml data, and throws an IOException if one occurs\n try {\n // Convert the incoming data string to a URL.\n url = new URL(urlString);\n\n /**\n * Tries to open a connection to the URL. If an IO error occurs, this throws an\n * IOException\n */\n URLConnection urlConnection = url.openConnection();\n\n // If the connection is an HTTP connection, continue\n if (urlConnection instanceof HttpURLConnection) {\n // Broadcasts an Intent indicating that processing has started.\n mBroadcaster.broadcastIntentWithState(Constants.STATE_ACTION_STARTED);\n\n // Casts the connection to a HTTP connection\n HttpURLConnection httpURLConnection = (HttpURLConnection) urlConnection;\n\n // Reports that the service is about to connect to the RSS feed\n mBroadcaster.broadcastIntentWithState(Constants.STATE_ACTION_CONNECTING);\n\n // Get response code from site\n int responseCode = httpURLConnection.getResponseCode();\n\n // Continue if response is OK\n if (responseCode == HttpURLConnection.HTTP_OK) {\n // Get content length (in bytes) to calculate progress from\n int contentLength = httpURLConnection.getContentLength();\n\n InputStream inputStream = urlConnection.getInputStream();\n\n // Save to file\n //FileOutputStream outputStream = new FileOutputStream(Constants.XML_SAVE_FILE_PATH);\n // Save to internal storage instead\n File file = new File(getFilesDir(), Constants.XML_SAVE_FILE_NAME);\n FileOutputStream outputStream = new FileOutputStream(file);\n\n // keep track of how much is downloaded\n int totalBytesRead = 0;\n int progressDone = 0;\n // Report downloading state\n mBroadcaster.broadcastIntentWithState(Constants.STATE_ACTION_DOWNLOADING);\n\n int bytesRead = -1;\n byte[] buffer = new byte[BUFFER_SIZE];\n while ((bytesRead = inputStream.read(buffer)) != -1) {\n outputStream.write(buffer, 0, bytesRead);\n totalBytesRead += bytesRead;\n progressDone = totalBytesRead/contentLength * 100;\n // TODO: broadcast progress\n }\n\n outputStream.close();\n inputStream.close();\n httpURLConnection.disconnect();\n // Report download complete\n mBroadcaster.broadcastIntentWithState(Constants.STATE_ACTION_DOWNLOAD_COMPLETE);\n }\n\n }\n else {\n // Report that action failed\n mBroadcaster.broadcastIntentWithState(Constants.STATE_ACTION_FAILED);\n return;\n }\n\n // TODO: make sure tvheadend is running\n // Open sockect connection to xmltv.sock\n String socketName = getFilesDir() + \"/xmltv.sock\";\n Log.d(\"socketConnection\", \"Connecting to \" + socketName);\n LocalSocketAddress socketAddress = new LocalSocketAddress(socketName,\n LocalSocketAddress.Namespace.FILESYSTEM);\n LocalSocket socket = new LocalSocket();\n socket.connect(socketAddress);\n if (socket.isConnected()) {\n mBroadcaster.broadcastIntentWithState(Constants.STATE_ACTION_SOCKET_CONNECTED);\n\n // open xml file\n File file = new File(getFilesDir(), Constants.XML_SAVE_FILE_NAME);\n FileInputStream inputStream = new FileInputStream(file);\n\n // get socket output stream\n OutputStream outputStream = socket.getOutputStream();\n\n // write xml data to xmltv socket\n int bytesRead = -1;\n byte[] buffer = new byte[BUFFER_SIZE];\n while ((bytesRead = inputStream.read(buffer)) != -1) {\n outputStream.write(buffer, 0, bytesRead);\n }\n outputStream.close();;\n inputStream.close();\n socket.close();\n }\n else {\n // Report that action failed\n mBroadcaster.broadcastIntentWithState(Constants.STATE_ACTION_FAILED);\n return;\n }\n // Done successfully\n // set last update time - THIS could be DANGEROUS since shared prefs is not thread safe!\n Date now = new Date();\n EpgStoredSettings settings = new EpgStoredSettings(getApplicationContext());\n settings.setLastUpdateTime(now);\n // notify status fragment\n mBroadcaster.broadcastIntentWithState(Constants.STATE_ACTION_COMPLETE);\n }\n catch (MalformedURLException e) {\n e.printStackTrace();\n // Report that action failed\n mBroadcaster.broadcastIntentWithState(Constants.STATE_ACTION_FAILED);\n\n }\n catch (IOException e) {\n e.printStackTrace();\n // Report that action failed\n mBroadcaster.broadcastIntentWithState(Constants.STATE_ACTION_FAILED);\n }\n catch (SecurityException e)\n {\n e.printStackTrace();\n // Report that action failed\n mBroadcaster.broadcastIntentWithState(Constants.STATE_ACTION_FAILED);\n }\n }", "@Override\n protected String doInBackground(String... arguments) {\n // Extract arguments\n String urlIn = arguments[0];\n String theaddress=\"\",thetitle=\"\", theimg=\"\", s=\"\";\n ArrayList<String> addressarray= new ArrayList<String>();\n ArrayList<String> titlearray= new ArrayList<String>();\n ArrayList<String> imgarray = new ArrayList<String>();\n ArrayList<String> pricearray = new ArrayList<String>();\n BufferedReader in = null;\n InputStream ins = null;\n\n if (titlePattern == null)\n titlePattern = Pattern.compile(titleRE); // slow, only do once, and not on UI thread\n if(addressPattern == null){\n addressPattern = Pattern.compile(addressRE); // slow, only do once, and not on UI thread\n }\n if(imgPattern == null){\n imgPattern = Pattern.compile(imageRE); // slow, only do once, and not on UI thread\n }\n if(dPattern == null){\n dPattern = Pattern.compile(dRE); // slow, only do once, and not on UI thread\n }\n try {\n int count = 0;\n for(int j=1;j<=3;j++){\n pagenum=j;\n urlIn = urlIn.substring(0, urlIn.length()-1);\n urlIn = urlIn + pagenum;\n ins = openHttpConnection(urlIn);\n in = new BufferedReader(new InputStreamReader(ins));\n\n /* //this approach only reads in a stream\n URL url = new URL(urlIn);\n in = new BufferedReader(\n new InputStreamReader(\n url.openStream()));\n */\n\n String inputLine;\n while ((inputLine = in.readLine()) != null) {\n Matcher amatch = titlePattern.matcher(inputLine);\n if (amatch.find()) {//find title\n thetitle = amatch.group();\n thetitle = thetitle.substring(4,thetitle.length()-5);\n titlearray.add(thetitle);\n }\n Matcher bmatch = addressPattern.matcher(inputLine);\n if (bmatch.find()) {//find address\n theaddress = bmatch.group();\n theaddress = theaddress.substring(10,theaddress.length()-4);\n addressarray.add(theaddress);\n\n inputLine = in.readLine(); //skip a line\n inputLine = in.readLine(); //skip a line\n inputLine = in.readLine(); //skip a line\n inputLine = in.readLine(); //skip a line\n inputLine = in.readLine(); //skip a line\n inputLine = in.readLine(); //skip a line\n inputLine = in.readLine(); //skip a line\n inputLine = in.readLine(); //skip a line\n inputLine = in.readLine(); //skip a line\n inputLine = in.readLine(); //skip a line\n\n Matcher m = dPattern.matcher(inputLine);\n if (m.find()) {\n s = m.group();\n pricearray.add(s);\n// Log.e(\"IMPORTANT\", s);\n }\n }\n Matcher cmatch = imgPattern.matcher(inputLine);\n if (cmatch.find()) {//find image URL\n theimg = cmatch.group();\n theimg = theimg.substring(10,theimg.length()-1);\n imgarray.add(theimg);\n }\n count++;\n }\n }\n for(int i=0; i<addressarray.size(); i++){\n Property returnproperty = new Property(titlearray.get(i),addressarray.get(i), imgarray.get(i), pricearray.get(i));\n datasource.createProperty(returnproperty.getTitle(), returnproperty.getAddress(), returnproperty.getImgURL(), returnproperty.getPrice());\n Log.e(\"Adding Property to DB\", returnproperty.toString());\n }\n Log.e(\"end count\", \"\" + count);\n return getString(R.string.unknown); // never found the pattern\n } catch (IOException e) {\n Log.e(\"ScrapeTemperatures\", \"Unable to open url: \" + url);\n return getString(R.string.unknown);\n } catch (Exception e) {\n Log.e(\"ScrapeTemperatures\", e.toString());\n return getString(R.string.unknown);\n } finally {\n if (in != null)\n try {\n in.close();\n } catch (IOException e) {\n // ignore, we tried and failed to close, limp along anyway\n }\n }\n }", "public RssParser(int _SourceID, String _SourceName, String _SrcURL, int _ReadInterval)\n {\n SourceID = _SourceID;\n SourceName = _SourceName;\n Src_URL = _SrcURL;\n ReadInterval = _ReadInterval;\n }", "@Override\n\tpublic InputStream createUserRss(String userId, String link)\n\t\t\tthrows Exception {\n\t\treturn null;\n\t}", "public Buoy addBuoy(String title, String link, String textDescription, String htmlDescription) throws BuoyException\n {\n Buoy buoy = null;\n\n // If title is null then cannot process much. Since we have no\n // unioque way to identify the buoy\n if (title == null)\n {\n throw new BuoyException(\"Buoy record in feed with null title element\");\n\n } else\n {\n\n // Extract station ID, Full Name and URL link\n \n buoy = createBuoy(title);\n buoy.setLinkURL(link);\n\n // Extract Data Fields by parsing the HTML Description\n List<String> strongTags = extractDataFields(htmlDescription);\n\n // Use the extracted placeholders to set the reporting time\n // and Weather\n if (strongTags != null && strongTags.size() > 1)\n {\n String reportTime = strongTags.get(0);\n buoy.setReportTime(reportTime);\n strongTags.remove(0);\n\n //System.out.println(\"Buoy : <\" + buoy.getStationID() + \"> Reporting @ <\" + reportTime + \">\");\n int i = 0;\n String leftTag = \"\";\n String rightTag = \"\";\n String value = \"\";\n for (String tag : strongTags)\n {\n\n leftTag = tag;\n if (i < strongTags.size() - 1)\n {\n rightTag = strongTags.get(i + 1);\n } else\n {\n rightTag = \"\";\n }\n i++;\n value = extractDataValue(textDescription, leftTag, rightTag);\n\n if (tag.startsWith(LOCATION_PREFIX))\n {\n // Treat this differently\n extractLatLongAndRelativeLocation(buoy, value);\n\n } else\n {\n // Add the waether condition value to the list of data\n buoy.addWeatherCondition(tag.replace(\":\", \"\"), value);\n }\n }\n } else\n {\n throw new BuoyException(\"Buoy record in feed with incomplete Weather Conditions\");\n }\n }\n\n return buoy;\n }", "@Override\n public void crawl() {\n Document doc;\n try {\n\n\n doc = Jsoup.connect(rootURL).userAgent(\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A\").get();\n\n Elements articles = doc.select(\"section.list article\");\n\n System.out.println(\"Number of articles found:\"+articles.size());\n //list of links found\n for(Element article: articles){\n\n Element titleLink = article.select(\"a\").first();\n System.out.println(titleLink.attr(\"abs:href\"));\n\n //if the url found is in the cache, do not retrieve the url.\n if(urlCache.contains(titleLink.attr(\"abs:href\"))) {\n System.out.println(\"Doucment found in cache, ignoring document\");\n continue;\n }\n\n storeDocument(Jsoup.connect(titleLink.attr(\"abs:href\")).get());\n\n //add the URL to the cache so that we don't retrieve it again.\n urlCache.add(titleLink.attr(\"abs:href\"));\n }\n\n\n } catch (Exception e){\n logger.log(Level.SEVERE, \"Error Retrieving from URL\", e);\n e.printStackTrace();\n }\n }", "public HtmlList(StringReader page, String url) throws InvalidUrlException {\r\n super(page, url);\r\n initBeforeParsing();\r\n try {\r\n parsePage(page);\r\n } catch (Exception e) {\r\n throw new InvalidUrlException(url);\r\n }\r\n }", "protected void scrapeUrl() {\n String baseUrl = \"https://time.com\";\n int sectionsLen = TIME_SECTIONS.length;\n DateTimeFormatter ISOFormatter = DateTimeFormatter.ofPattern(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\", Locale.ENGLISH);\n\n for (int i = 0; i < sectionsLen; i++) {\n try {\n //Fetch the website and store it in Document object\n Document doc = Jsoup.connect(baseUrl + TIME_SECTIONS[i]).get();\n\n //Retrieve all articles from Document object\n Elements articles = doc.getElementsByTag(\"article\");\n\n NewsItem newsItem = null;\n\n Map<String, Integer> pathMap = new HashMap<>();\n\n //Go through each article tag and scrape key data\n for (Element article : articles) {\n newsItem = new NewsItem();\n\n Elements articleTitleURL = article.select(\"h3\");\n Elements articleExcerpt = article.getElementsByClass(\"summary margin-8-bottom desktop-only\");\n Elements articleImgURL = article.getElementsByClass(\"media-img margin-16-bottom\");\n\n //Checking for duplicate article\n if (pathMap.containsKey(articleTitleURL.select(\"a\").attr(\"href\"))) {\n int newsItemPos = pathMap.get(articleTitleURL.select(\"a\").attr(\"href\"));\n String currentCategory = newsItems.get(newsItemPos).getCategory();\n newsItems.get(newsItemPos).setCategory(currentCategory + \",\" + TIME_CATEGORIES[i]);\n }\n //Otherwise creating new NewsItem\n else {\n newsItem.setCategory(TIME_CATEGORIES[i]);\n newsItem.setTitle(articleTitleURL.select(\"a\").text());\n newsItem.setPageUrl(baseUrl + articleTitleURL.select(\"a\").attr(\"href\"));\n newsItem.setExcerpt(articleExcerpt.text());\n newsItem.setImgUrl(articleImgURL.select(\"div\").attr(\"data-src\"));\n newsItem.setPublishedDate(articlePublishedDate(newsItem.getPageUrl(), ISOFormatter));\n\n //Add new NewsItem to list\n newsItems.add(newsItem);\n //Mapping current articles url path to its corresponding NewsItem object to handle duplicates\n pathMap.put(articleTitleURL.select(\"a\").attr(\"href\"), newsItems.size() - 1);\n }\n }\n\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }", "public interface RssFetcherService {\n\n /**\n * Returns a list of SyndFeed generated by an array of feed urls.\n *\n * @param feedUrls set of rss feed urls\n * @return a list of Rome SyndFeeds generated by the list of urls\n * @throws IOException an I/O exception has occurred\n * @throws FeedException an Feed exception has occurred\n * @throws FetcherException an FetcherException has occurred\n */\n List<SyndFeed> getRssFeeds(Set<String> feedUrls) throws FeedException, IOException,\n FetcherException;\n\n List<Map<String, String>> getAllInformationFromLatestFeed();\n}", "@Asynchronous\n public Future<?> doGenerate() {\n final AtomLink atomLink = newChannelAtomLink();\n final Channel channel = newChannel(atomLink);\n\n visitor.visit(p -> {\n final String url = visitor.buildLink(p);\n\n final Guid guid = new Guid();\n guid.setValue(url + \"?rssGuid=\" + Long.toString(p.getId()));\n\n final AtomLink link = new AtomLink();\n link.setRel(\"self\");\n link.setType(atomLink.getType());\n link.setHref(atomLink.getHref() + \"?post=\" + p.getId());\n\n final Item item = new Item();\n item.setTitle(p.getTitle());\n item.setLink(url);\n item.setDescription(p.getSummary());\n item.setPubDate(RFC_1123_DATE_TIME.format(ZonedDateTime.ofInstant(p.getUpdated().toInstant(), ZoneId.systemDefault())));\n item.setGuid(guid);\n item.setAtomLink(link);\n channel.getItem().add(item);\n });\n\n final Rss rss = new Rss();\n rss.setChannel(channel);\n this.rss = rss;\n return new AsyncResult<>(true);\n }", "public Parser(URL url) {\n \t\t\ttry {\n \t\t\t\tload(url.openStream());\n \t\t\t} catch (Exception e) {\n \t\t\t\t// continue ... actual parsing will report errors\n \t\t\t}\n \t\t}", "public Object parseImage(int rssType, Document doc) throws Exception;", "public interface RSSItemListener {\n\n void addRSSItem(RSSItem rssItem);\n\n ArrayList<RSSItem> getAllRSSItems();\n\n int getRSSItemCount();\n\n}", "java.lang.String getFeed();", "void setUrl(String url) {\n this.url = Uri.parse(url);\n }", "public void init() {\n BufferedReader in = null;\n try {\n //URL feed = new URL(\"http://twitter.com/statuses/user_timeline/48274520.rss\");\n URL feed = new URL(\"http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=g_damian\");\n in = new BufferedReader(new InputStreamReader(feed.openStream()));\n String inputLine;\n String data = null;\n while ((inputLine = in.readLine()) != null) {\n inputLine = inputLine.trim();\n if (inputLine.startsWith(\"<created_at>\") && inputLine.endsWith(\"</created_at>\")) {\n inputLine = inputLine.substring(12, inputLine.length() - 13);\n data = inputLine.replaceAll(\"\\\\+\\\\d* \", \"\");\n }\n if (inputLine.startsWith(\"<text>\") && inputLine.endsWith(\"</text>\")) {\n inputLine = inputLine.substring(6, inputLine.length() - 7);\n buffer.append(escapeMessage(inputLine));\n buffer.append(\"<br/>[\" + data + \"]\");\n buffer.append(\"\\n\");\n }\n }\n in.close();\n } catch (MalformedURLException ex) {\n Logger.getLogger(ShowTweetsApplet.class.getName()).log(Level.SEVERE, null, ex);\n appendException(buffer, ex);\n } catch (IOException ex) {\n Logger.getLogger(ShowTweetsApplet.class.getName()).log(Level.SEVERE, null, ex);\n appendException(buffer, ex);\n } finally {\n try {\n if (in != null) {\n in.close();\n }\n } catch (IOException ex) {\n Logger.getLogger(ShowTweetsApplet.class.getName()).log(Level.SEVERE, null, ex);\n appendException(buffer, ex);\n }\n }\n }", "@Override\r\n\tpublic boolean shouldOverrideUrlLoading(WebView view, String url) {\n\t\tedittext=(EditText)activity.findViewById(R.id.editText1);\r\n\t\tedittext.setText(url);\r\n\t\t\r\n\t\t\r\n\t\tCalendar c = Calendar.getInstance();\r\n\t\t \r\n\t\tSimpleDateFormat df = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\");\r\n\t\tString formattedDate = df.format(c.getTime());\r\n\t\t\r\n\t\tview.loadUrl(url);\r\n\t\tsqlitedatabase.execSQL(\"insert into history values('\"+url+\"','\"+formattedDate+\"')\");\r\n\t\t\r\n\t\treturn super.shouldOverrideUrlLoading(view, url);\r\n\t}", "public long insertFeedEntry(ActivityFeedEntity activityFeed) throws SQLException;", "public static List<DeebResource> parse(String sourceCode, String url, Context context) {\n LinkedList<DeebResource> resources = new LinkedList<DeebResource>();\n \n // get XML Document from a parser\n String xmlDocument = null;\n \n if(url.contains(\"europeana\")) {\n Log.d(LOG_TAG, \"trying to parse json\");\n xmlDocument = JSONParser.parseJSON(sourceCode);\n }\n else if(url.contains(\"openarchives\")) {\n Log.d(LOG_TAG, \"trying to parse xml\");\n // TODO connect XMLParser\n }\n else if(url.contains(\"dbpedia\")) {\n Log.d(LOG_TAG, \"trying to parse rdf\");\n \n try {\n xmlDocument = LDParser.parseLD(sourceCode);\n }\n catch(ParserConfigurationException e) {\n Log.w(LOG_TAG, Log.getStackTraceString(e));\n }\n catch(SAXException e) {\n Log.w(LOG_TAG, Log.getStackTraceString(e));\n }\n catch(IOException e) {\n Log.w(LOG_TAG, Log.getStackTraceString(e));\n }\n }\n else {\n Log.d(LOG_TAG, \"trying to use the default parser\");\n // TODO connect MicrodataParser\n }\n \n if(xmlDocument == null) {\n Log.w(LOG_TAG, \"nothing could be parsed\");\n return resources;\n }\n \n // apply XSL to receive RDFXML\n Log.d(LOG_TAG, \"applying xml_to_rdfxml.xsl\");\n ByteArrayOutputStream rdfXml = applyXSL(context,\n new ByteArrayInputStream(xmlDocument.getBytes()), R.raw.xml_to_rdfxml);\n \n // TODO get resources from rdfXml\n \n // TODO return the data from this request (for visualization)\n return resources;\n }", "public void refresh(View view) {\n Intent intent = new Intent(this, RSSService.class);\n intent.putExtra(\"RSS_URL\", url);\n startService(intent);\n\n }", "private void getArticles() throws Exception {\n\t\t\tHttpClient httpClient = new DefaultHttpClient();\n\n\t\t\tStringBuilder uriBuilder = new StringBuilder(BASE_URL);\n\t\t\turiBuilder.append(mURL);\n\n\t\t\tHttpGet request = new HttpGet(uriBuilder.toString());\n\t\t\tHttpResponse response = httpClient.execute(request);\n\n\t\t\tint status = response.getStatusLine().getStatusCode();\n\n\t\t\tif (status != HttpStatus.SC_OK) {\n\n\t\t\t\t// Log whatever the server returns in the response body.\n\t\t\t\tByteArrayOutputStream ostream = new ByteArrayOutputStream();\n\n\t\t\t\tresponse.getEntity().writeTo(ostream);\n\t\t\t\tmHandler.sendEmptyMessage(0);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tInputStream content = response.getEntity().getContent();\n\t\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(content));\n\t\t\tStringBuilder result = new StringBuilder();\n\n\t\t\tString line;\n\t\t\twhile ((line = reader.readLine()) != null) {\n\t\t\t\tresult.append(line);\n\t\t\t}\n\n\t\t\t// Clean up and close connection.\n\t\t\tcontent.close();\n\n\t\t\tString html = result.toString();\n\t\t\t//This is our regex to match each article\n\t\t\t//This website's html is not xml compatible so regex is next best thing\n\t\t\tPattern p = Pattern.compile(\"<td class=\\\"title\\\"><a href=\\\"(.*?)\\\".*?>(.*?)<\\\\/a>(<span class=\\\"comhead\\\">(.*?)<\\\\/span>)?.*?<\\\\/td><\\\\/tr><tr><td colspan=2><\\\\/td><td class=\\\"subtext\\\">.*? by <a href=\\\"user\\\\?.*?\\\">(.*?)<\\\\/a>.*?<a href=\\\"item\\\\?id=(.*?)\\\">\");\n\t\t\tMatcher m = p.matcher(html);\n\t\t\tList<Article> articles = new ArrayList<Article>();\n\t\t\twhile(m.find()) {\n\t\t\t\tString url = m.group(1);\n\t\t\t\tString title = m.group(2);\n\t\t\t\tString domain = m.group(4);\n\t\t\t\tString author = m.group(5);\n\t\t\t\tString discussionID = m.group(6);\n\t\t\t\tArticle eachArticle = new Article(title, domain, url, author, discussionID);\n\t\t\t\tarticles.add(eachArticle); \n\t\t\t}\n\n\t\t\tMessage msg = mHandler.obtainMessage();\n\t\t\tBundle bundle = new Bundle();\n\t\t\tbundle.putParcelableArrayList(\"articles\", (ArrayList<? extends Parcelable>) articles);\n\t\t\tmsg.setData(bundle);\n\t\t\tmHandler.sendMessage(msg);\n\t\t}", "public Feed getFeed(String feedURL, Date lastUpdatedDate, boolean summary) throws MalformedURLException {\n return getFeed(new URL(feedURL), lastUpdatedDate, summary);\n }", "private Uri insertContentValues(Uri uri, UrlType urlType, ContentValues contentValues) {\n switch (urlType) {\n case EVENT:\n return insertEvent(uri, contentValues);\n case PERSON:\n return insertPerson(uri, contentValues);\n case PERSON_EVENTS:\n return insertPersonEvent(uri, contentValues);\n case PERSON_MEDIA:\n return insertPersonMedia(uri, contentValues);\n case SEARCH:\n return insertSearch(uri, contentValues);\n default:\n throw new IllegalArgumentException(\"Unknown url \" + uri);\n }\n }", "private synchronized void processNews() throws ClientProtocolException,\n\t\t\t\tIOException, JSONException {\n\n\t\t\tlong lastTime = mAdapter.getItem(mCount - 1).date;\n\t\t\tlong startTime = lastTime - Utils.MONTH;\n\n\t\t\tsetNews(ApiHandler.getData(lastTime, startTime));\n\t\t\tmHandler.sendEmptyMessage(UPDATE_LIST);\n\t\t}", "private ExchangeRates loadXmlFromNetwork(String urlString) throws XmlPullParserException, IOException {\n\t\tInputStream stream = null;\n\t\tECBParser parser = new ECBParser();\n\t\t\n\t\ttry {\n\t\t\tstream = downloadStream(urlString);\n\t\t\tsaveToSd(stream);\n\t\t\tparser.parse(readFromSd(), exchangeRates);\n\t\t} finally {\n\t\t\tif (stream != null) {\n\t\t\t\tstream.close();\n\t\t\t}\n\t\t}\n\n\t\treturn exchangeRates;\n\t}", "public boolean isRSS() { return _rss!=null; }", "public void parseInputStream(InputStream is) throws IOException {\n\t\tStringBuilder sb = new StringBuilder();\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(is));\n\t\tString str = null;\n\t\twhile((str = br.readLine()) != null) {\n\t\t\tsb.append(str).append(\"\\n\\r\");\n\t\t}\n\t\t\n\t\ttry {\n\t\t\tJSONObject jObject = new JSONObject(sb.toString());\n\t\t\tfinal String access_token = jObject.getString(\"access_token\");\n\t\t\tfinal String token_type = jObject.getString(\"token_type\");\n\t\t\tfinal String expires_in = jObject.getString(\"expires_in\");\n\t\t\tfinal String refresh_token = jObject.getString(\"refresh_token\");\n\t\t\t\n\t\t\tmHandler.post(new Runnable() {\n\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\tgetGmailAtomFeed(access_token,token_type);\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} catch (JSONException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void setRssUrlList(List<String> rssUrlList) {\n\t\tthis.rssUrlList = rssUrlList;\n\t}", "private void parseData(String url, String response) {\n\n if (response.isEmpty()) {\n if (!mErrorMessage.isEmpty()) {\n alertParseErrorAndFinish(mErrorMessage);\n } else {\n renderData();\n }\n } else {\n if (mItemTotal == 0) {\n //---------------------------------------------------------------------------------\n // 목록 파싱하기 - 아메바 블로그의 HTML 코드가 변경됨. 파서 다시 만들어야 함. 2016-09-10\n //---------------------------------------------------------------------------------\n switch (mSiteData.getId()) {\n case Config.BLOG_ID_AKB48_TEAM8:\n Akb48Parser akb48Parser = new Akb48Parser();\n akb48Parser.parseTeam8ReportList(response, mNewDataList);\n break;\n case Config.BLOG_ID_SKE48_SELECTED:\n case Config.BLOG_ID_NMB48_OFFICIAL:\n BaseParser parser = new BaseParser();\n parser.parseAmebaList(response, mNewDataList);\n mItemTotal = mNewDataList.size();\n break;\n case Config.BLOG_ID_NGT48_MANAGER:\n Ngt48Parser ngt48manager = new Ngt48Parser();\n ngt48manager.parseLineBlogList(response, mNewDataList);\n //Collections.sort(mNewDataList);\n //Collections.sort(mNewDataList, Collections.reverseOrder());\n break;\n case Config.BLOG_ID_NGT48_PHOTOLOG:\n Ngt48Parser ngt48photo = new Ngt48Parser();\n ngt48photo.parseMemberBlogList(response, mNewDataList);\n //Collections.sort(mNewDataList);\n Collections.sort(mNewDataList, Collections.reverseOrder());\n break;\n }\n }\n\n //-------------------------------\n // 항목별 사진 파싱하기\n //-------------------------------\n if (mItemTotal > 0) { // && mItemTotal >= mItemCount) {\n if (mItemCount > 0) {\n BaseParser parser = new BaseParser();\n String[] array = parser.parseAmebaArticle(response);\n\n WebData webData = mNewDataList.get(mItemCount - 1);\n webData.setContent(array[0]);\n webData.setImageUrl(array[1]);\n }\n\n if (mItemCount < mItemTotal) {\n WebData webData = mNewDataList.get(mItemCount);\n String reqUrl = webData.getUrl();\n String reqAgent = Config.USER_AGENT_MOBILE;\n\n requestData(reqUrl, reqAgent);\n updateProgress();\n\n mItemCount++;\n } else {\n mItemTotal = 0;\n mItemCount = 0;\n mPbLoadingHorizontalMore.setProgress(0);\n }\n }\n\n if (mItemTotal == 0) {\n renderData();\n }\n }\n }", "public void refreshAllRssFeeds()\n {\n Vector rssContactList = new Vector();\n rssContactList = opSetPersPresence.getContactListRoot().\n getRssURLList(rssContactList);\n Iterator rssContact = rssContactList.iterator();\n while(rssContact.hasNext())\n {\n ContactRssImpl contact = (ContactRssImpl)rssContact.next();\n try\n {\n \n submitRssQuery(contact, false);\n }\n catch (Exception ex)\n {\n logger.error(\"Failed to refresh feed for \" + contact, ex);\n }\n }\n }" ]
[ "0.6959614", "0.6898664", "0.67438", "0.6496058", "0.6477775", "0.62868774", "0.62531036", "0.6247518", "0.61168456", "0.6023782", "0.5967723", "0.59606135", "0.58757323", "0.58617777", "0.58349127", "0.5826652", "0.5826206", "0.575102", "0.5749206", "0.5734009", "0.57313734", "0.57033473", "0.56982327", "0.56627864", "0.55422395", "0.5514469", "0.5508336", "0.54906094", "0.54364306", "0.54273385", "0.541293", "0.5401769", "0.5399225", "0.53868", "0.53837955", "0.53541553", "0.5335702", "0.53033465", "0.5299705", "0.5282387", "0.5282107", "0.5282107", "0.5279427", "0.5278717", "0.5273255", "0.5266662", "0.525882", "0.5245205", "0.5227818", "0.5224441", "0.52179205", "0.5216222", "0.5194042", "0.5174988", "0.5171803", "0.5168755", "0.51686907", "0.51549983", "0.5151421", "0.51404935", "0.51072", "0.5088297", "0.50860685", "0.5077517", "0.5065409", "0.5064826", "0.50324965", "0.5012205", "0.5009463", "0.5008319", "0.50069463", "0.5004459", "0.49779585", "0.4968828", "0.49660006", "0.49641445", "0.49575925", "0.4948332", "0.4940238", "0.49393436", "0.493593", "0.49331045", "0.49329415", "0.4925133", "0.49155906", "0.49059895", "0.49039358", "0.49033892", "0.4888277", "0.48821464", "0.48775044", "0.48705655", "0.48675966", "0.4857633", "0.4856458", "0.48553538", "0.48460662", "0.48444328", "0.4843682", "0.48421788" ]
0.6881146
2
/ / Insert the parsed RSS fields (Individual Fields Specific) to DB. / / Class containing all parsed values
public void InsertToDB(RSSFields RssFieldValues, int ChannelID) throws java.sql.SQLException { String SQLQuery = "INSERT INTO tbl_ex_RSSData " + " (SourceID, ChannelInstanceID, Title, Link, Description,PublishedDate,UpdatedDate, ParsedDate, Hash) " + " VALUES " + " (?, ?, ?, ?, ?, ?, ?,GetDate(), ?)"; PreparedStatement InsertQuery = DBAction.con.prepareStatement(SQLQuery); InsertQuery.setInt(1, SourceID); InsertQuery.setInt(2, ChannelID); InsertQuery.setString(3, RssFieldValues.Title); InsertQuery.setString(4, RssFieldValues.Link); InsertQuery.setString(5,RssFieldValues.Description); InsertQuery.setTimestamp(6,new java.sql.Timestamp(RssFieldValues.PublishedDate.getTime())); InsertQuery.setTimestamp(7,new java.sql.Timestamp(RssFieldValues.UpdatedDate.getTime())); InsertQuery.setString(8, RssFieldValues.ComputedHash); InsertQuery.execute(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void PopulateRSSData()\n {\n try\n {\n URL Feed = ParseRSSFromFeed();\n ParseRSS(Feed);\n }\n catch(java.net.MalformedURLException exp)\n {\n String message = exp.getMessage();\n System.out.println(message);\n }\n catch(com.rometools.rome.io.FeedException fexp)\n {\n String message = fexp.getMessage();\n System.out.println(message);\n }\n catch(java.io.IOException ioexp)\n {\n String message = ioexp.getMessage();\n System.out.println(message);\n }\n }", "public void ParseRSS(URL feedUrl) throws com.rometools.rome.io.FeedException, java.io.IOException {\n //TODO: EVERY THING HERE SHOULD BE IN A TRANSACTION\n List<String> HashFields = new ArrayList<>();\n SyndFeedInput input = new SyndFeedInput();\n SyndFeed feed = input.build(new XmlReader(feedUrl));\n RSSChannelElements ChannelElements = new RSSChannelElements();\n Date CurrentDate = new Date();\n SimpleDateFormat SDF = new java.text.SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss.SSS\");\n //GET ADDITIONAL PROPERTIES OF THE CHANNEL\n //GET CHANNEL AUTHOR\n String ch_author = feed.getAuthor();\n ChannelElements.Author = ch_author;\n //GET PUBLISHED DATE\n Date ch_PubDate = feed.getPublishedDate();\n ChannelElements.PublishedDate = ch_PubDate;\n //GET LANGUAGE\n String ch_Language = feed.getLanguage();\n ChannelElements.Language = ch_Language;\n //GET WEBMASTER\n String ch_WebMaster = feed.getWebMaster();\n ChannelElements.webMaster = ch_WebMaster;\n //GET MANAGING EDITOR\n String ch_ME = feed.getManagingEditor();\n ChannelElements.managingEditor = ch_ME;\n //GET GENERATOR\n String ch_generator = feed.getGenerator();\n ChannelElements.Generator = ch_generator;\n //GET DESCRIPTION\n String ch_description = feed.getDescription();\n ChannelElements.Description = ch_description;\n int CurrentChannelID = 0;\n //TODO: DO THIS IN A STORED PROCEDURE\n try\n {\n TimeValidations ValidateTime = new TimeValidations();\n if (ValidateTime.IsWithinValidWindow(CurrentDate, ch_PubDate, ReadInterval))\n {\n //INSERT TO DB THE CHANNEL DETAILS\n CurrentChannelID = InsertChannelDetails(ChannelElements);\n }\n }\n catch(java.sql.SQLException exp)\n {\n String message = exp.getMessage();\n System.out.println(message);\n }\n\n\n //GET ELEMENTS FROM THE \"ITEMS\"\n List entries = feed.getEntries();\n Iterator it = entries.iterator();\n while (it.hasNext()) {\n RSSFields RssFieldValues = new RSSFields();\n SyndEntry entry = (SyndEntry) it.next();\n //GET TITLE\n System.out.println(entry.getTitle());\n String Title = entry.getTitle();\n RssFieldValues.Title = Title;\n //HashFields.add(Title);\n //GET LINK\n System.out.println(entry.getLink());\n RssFieldValues.Link = entry.getLink();\n HashFields.add(RssFieldValues.Link);\n //GET DESCRIPTION\n SyndContent description = entry.getDescription();\n System.out.println(description.getValue());\n RssFieldValues.Description = description.getValue();\n //HashFields.add(description.getValue());\n //GET PUBLISHED DATE\n Date Pub_Date = entry.getPublishedDate();\n System.out.println(SDF.format(Pub_Date));\n RssFieldValues.PublishedDate = entry.getPublishedDate();\n //GET UPDATED DATE\n Date U_date = entry.getUpdatedDate();\n System.out.println(U_date);\n RssFieldValues.UpdatedDate = entry.getPublishedDate();\n //GET AUTHOR\n String Author = entry.getAuthor();\n RssFieldValues.Author = Author;\n System.out.println(Author);\n //GET COMMENTS;\n String Comments = entry.getComments();\n RssFieldValues.Comments = Comments;\n System.out.println();\n try {\n //org.joda.time.Period P = new org.joda.time.Period(Pub_Date, CurrentDate);\n //if(SDF.parse(Pub_Date.toString()) == SDF.parse(CurrentDate.toString()))\n //org.joda.time.Period p = new org.joda.time.Period(CurrentDate, Pub_Date);\n //ONLY INSERT IF THE FEED IS WITHIN THE SPECIFIED PERIOD\n TimeValidations ValidateTime = new TimeValidations();\n if (ValidateTime.IsWithinValidWindow(CurrentDate, U_date, ReadInterval))\n {\n //INSERT NEWS SPECIFIC VALUES TO DB\n HashGenerator Gen = new HashGenerator();\n RssFieldValues.ComputedHash = Gen.HashCalculator(HashFields);\n InsertToDB(RssFieldValues, CurrentChannelID);\n }\n } catch (java.sql.SQLException ex) {\n String message = ex.getMessage();\n System.out.println(message);\n }\n }\n // System.out.println(feed);\n }", "private void insertFields()\n {\n RideDetails details=new RideDetails();\n details.setStartPt(editStartingPt.getText().toString());\n details.setEndPt(editEndingPt.getText().toString());\n\n try {\n details.setTravelDate(dateFormatter.parse(editDate.getText().toString()));\n\n } catch (ParseException e) {\n e.printStackTrace();\n }\n\n details.setNoSpot(Integer.parseInt(editNoSpot.getText().toString()));\n\n\n dbOperations(details);\n\n }", "private RSS(Properties props) throws ParameterError {\n super(new String[0], null);\n Logger static_logger = Logging.getLogger(RSS.class);\n if (static_logger.isDebugEnabled()) {\n static_logger.debug(\"QRS Property=\" + props);\n }\n this.props = props;\n instance = this;\n this.sitesurl_string = props.getProperty(\"qrs.SitesURL\");\n data_feeds = new Hashtable<String, DataFeed>();\n\n String raw_feed_data = props.getProperty(\"qrs.DataFeeds\");\n if (raw_feed_data != null) {\n StringTokenizer tokenizer = new StringTokenizer(raw_feed_data, \" \");\n while (tokenizer.hasMoreTokens()) {\n String feed_name = tokenizer.nextToken().trim();\n makeFeed(feed_name, props);\n }\n }\n\n String sysstat_interval_str = props.getProperty(\"qrs.sysstat\");\n if (sysstat_interval_str != null) {\n int sysstat_interval = Integer.parseInt(sysstat_interval_str);\n TimerQueueingDataFeed feed = new TimerQueueingDataFeed();\n registerFeed(feed, \"DirectEntry\");\n DirectSysStatSupplier supplier = new DirectSysStatSupplier(null, feed);\n supplier.schedule(sysstat_interval);\n }\n\n String gui_id = props.getProperty(GUI_PROPERTY);\n if (gui_id != null) {\n new org.cougaar.qos.qrs.gui.MainWindow(gui_id);\n }\n\n }", "private void populateFields() {\n\n if (mReportCursor == null) {\n return;\n }\n\n Cursor c = mReportCursor;\n mValueText.setText(c.getString(c.getColumnIndexOrThrow(ReportPeer.KEY_VALUE)));\n }", "public void insert( RssGeneratedFile rssFile )\n {\n int nNewPrimaryKey = newPrimaryKey( );\n rssFile.setId( nNewPrimaryKey );\n\n DAOUtil daoUtil = new DAOUtil( SQL_QUERY_INSERT );\n daoUtil.setInt( 1, rssFile.getId( ) );\n daoUtil.setInt( 2, rssFile.getPortletId( ) );\n daoUtil.setString( 3, rssFile.getName( ) );\n daoUtil.setInt( 4, rssFile.getState( ) );\n daoUtil.setTimestamp( 5, new java.sql.Timestamp( new java.util.Date( ).getTime( ) ) );\n daoUtil.setString( 6, rssFile.getDescription( ) );\n daoUtil.setString( 7, rssFile.getWorkgroup( ) );\n daoUtil.setString( 8, rssFile.getTypeResourceRss( ) );\n daoUtil.setInt( 9, rssFile.getMaxItems( ) );\n daoUtil.setString( 10, rssFile.getFeedType( ) );\n daoUtil.setString( 11, rssFile.getEncoding( ) );\n daoUtil.executeUpdate( );\n daoUtil.free( );\n }", "public Object parseItem(int rssType, Document doc, int index) throws Exception;", "public void setupFields()\n {\n FieldInfo field = null;\n field = new FieldInfo(this, \"ID\", Constants.DEFAULT_FIELD_LENGTH, null, null);\n field.setDataClass(Integer.class);\n field.setHidden(true);\n field = new FieldInfo(this, \"LastChanged\", Constants.DEFAULT_FIELD_LENGTH, null, null);\n field.setDataClass(Date.class);\n field.setHidden(true);\n field = new FieldInfo(this, \"Deleted\", 10, null, new Boolean(false));\n field.setDataClass(Boolean.class);\n field.setHidden(true);\n field = new FieldInfo(this, \"Description\", 25, null, null);\n field = new FieldInfo(this, \"CurrencyCode\", 3, null, null);\n field = new FieldInfo(this, \"LastRate\", 10, null, null);\n field.setDataClass(Double.class);\n field.setScale(-1);\n field = new FieldInfo(this, \"RateChangedDate\", 12, null, null);\n field.setDataClass(Date.class);\n field.setScale(Constants.DATE_ONLY);\n field = new FieldInfo(this, \"RateChangedBy\", 16, null, null);\n field.setDataClass(Integer.class);\n field = new FieldInfo(this, \"CostingRate\", 10, null, null);\n field.setDataClass(Double.class);\n field.setScale(-1);\n field = new FieldInfo(this, \"CostingChangedDate\", 12, null, null);\n field.setDataClass(Date.class);\n field.setScale(Constants.DATE_ONLY);\n field = new FieldInfo(this, \"CostingChangedBy\", 16, null, null);\n field.setDataClass(Integer.class);\n field = new FieldInfo(this, \"RoundAt\", 1, null, null);\n field.setDataClass(Short.class);\n field = new FieldInfo(this, \"IntegerDesc\", 20, null, \"Dollar\");\n field = new FieldInfo(this, \"FractionDesc\", 20, null, null);\n field = new FieldInfo(this, \"FractionAmount\", 10, null, new Integer(100));\n field.setDataClass(Integer.class);\n field = new FieldInfo(this, \"Sign\", 3, null, \"$\");\n field = new FieldInfo(this, \"LanguageID\", Constants.DEFAULT_FIELD_LENGTH, null, null);\n field.setDataClass(Integer.class);\n field = new FieldInfo(this, \"NaturalInteger\", 20, null, null);\n field = new FieldInfo(this, \"NaturalFraction\", 20, null, null);\n }", "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 }", "private void init() {\n FieldWrapper id = new FieldWrapper();\n id.fieldDescription = new HashMap<String, Object>();\n id.fieldDescription.put(\"fullName\", \"Id\");\n id.fieldDescription.put(\"type\", \"Text\");\n\n FieldWrapper name = new FieldWrapper();\n name.fieldDescription = new HashMap<String, Object>();\n name.fieldDescription.put(\"fullName\", \"Name\");\n\n FieldWrapper createdBy = new FieldWrapper();\n createdBy.fieldDescription = new HashMap<String, Object>();\n createdBy.fieldDescription.put(\"fullName\", \"CreatedBy\");\n createdBy.fieldDescription.put(\"type\", \"Lookup\");\n\n FieldWrapper lastModifiedBy = new FieldWrapper();\n lastModifiedBy.fieldDescription = new HashMap<String, Object>();\n lastModifiedBy.fieldDescription.put(\"fullName\", \"LastModifiedBy\");\n lastModifiedBy.fieldDescription.put(\"type\", \"Lookup\");\n\n FieldWrapper owner = new FieldWrapper();\n owner.fieldDescription = new HashMap<String, Object>();\n owner.fieldDescription.put(\"fullName\", \"Owner\");\n owner.fieldDescription.put(\"type\", \"Lookup\");\n\n fieldDescribe = new HashMap<String, FieldWrapper>();\n\n fieldDescribe.put((String) id.fieldDescription.get(\"fullName\"), id);\n fieldDescribe.put((String) name.fieldDescription.get(\"fullName\"), name);\n fieldDescribe.put((String) createdBy.fieldDescription.get(\"fullName\"), createdBy);\n fieldDescribe.put((String) lastModifiedBy.fieldDescription.get(\"fullName\"), lastModifiedBy);\n fieldDescribe.put((String) owner.fieldDescription.get(\"fullName\"), owner);\n }", "@Override\n\t\tprotected Boolean doInBackground(Void... params) {\n\t\t\tlinklist = parseRSS();\n\t\t\treturn updateDatabase(linklist);\n\t\t}", "public void fillFromEntry(BlogEntry entry) {\n\t\tif(entry.getId()==null) {\n\t\t\tthis.id = \"\";\n\t\t} else {\n\t\t\tthis.id = entry.getId().toString();\n\t\t}\n\t\tthis.title = entry.getTitle();\n\t\tthis.text = entry.getText();\n\t\t\n\t}", "public void parse(DBObject db) {\n\t\tthis.setId((String) db.get(\"id\"));\n\t\tthis.setTitle((String) db.get(\"title\"));\n\t\tthis.setCompany_name((String) db.get(\"company_name\"));\n\t\tthis.setWelfare((String) db.get(\"welfare\"));\n\t\tthis.setCity((String) db.get(\"city\"));\n\t\tthis.setPublication_date((String) db.get(\"publication_date\"));\n\t\tthis.setJob_property((String) db.get(\"job_property\"));\n\t\tthis.setYears((String) db.get(\"years\"));\n\t\tthis.setEducation((String) db.get(\"education\"));\n\t\tthis.setRecruitment_number((String) db.get(\"recruitment_number\"));\n\t\tthis.setJob_category((String) db.get(\"job_category\"));\n\t\tthis.setJob_description((String) db.get(\"job_description\"));\n\t\tthis.setCompany_description((String) db.get(\"company_description\"));\n\t\tthis.setCompany_size((String) db.get(\"company_size\"));\n\t\tthis.setCompany_type((String) db.get(\"company_type\"));\n\t\tthis.setCompany_industry((String) db.get(\"company_size\"));\n\t\tthis.setCompany_web((String) db.get(\"company_web\"));\n\t\tthis.setCompany_address((String) db.get(\"company_address\"));\n\t\tthis.setCreate_time((String) db.get(\"create_time\"));\n\t\tthis.setResource((String) db.get(\"resource\"));\n\t}", "private static List<Post> parseResults(ResultSet results) throws SQLException {\r\n\tList<Post> postList = new LinkedList<Post>();\r\n\r\n\twhile (results.next()) {\r\n\t Post p = new Post();\r\n\r\n\t p.id = results.getInt(\"id\");\r\n\t p.author = results.getString(\"author\");\r\n\t \r\n\t long date = results.getInt(\"date\") * 1000L; // milliseconds\r\n\t p.date = new Date(date);\r\n\t \r\n\t p.isPublic = results.getInt(\"isPublic\") == 1;\r\n\t p.setContent(results.getString(\"content\"));\r\n\r\n\t postList.add(p);\r\n\t}\r\n\r\n\treturn postList;\r\n }", "private List<DBFeedModel> parseResult(ConnectionResult connectionResult) {\n try {\n JSONObject response = new JSONObject(connectionResult.getResult());\n JSONArray posts = response.optJSONArray(\"posts\");\n List<DBFeedModel> feedsList = new ArrayList<>();\n\n for (int i = 0; i < posts.length(); i++) {\n JSONObject post = posts.optJSONObject(i);\n DBFeedModel item = new DBFeedModel();\n item.setViewType(Constants.FEED_VIEW_TYPE_LEFT);\n item.setTitle(post.optString(\"title\"));\n item.setThumb(post.optString(\"thumbnail\"));\n item.setUrl(\"http://m.dantri.com.vn/xa-hoi/hai-phong-yeu-cau-thao-do-rong-vang-dau-pikachu-gay-tranh-cai-20170108172552427.htm\");\n feedsList.add(item);\n }\n\n return feedsList;\n } catch (JSONException e) {\n e.printStackTrace();\n }\n\n return null;\n }", "private void parseData() {\n\t\t\r\n\t}", "private static void addFields(StringBuilder xml, final String input) {\n\t\tMatcher m = FIELDS.matcher(input);\n\n\t\twhile (m.find()) {\n\t\t\tString tag = FIELDS_TO_TAGS.get(m.group(1));\n\n\t\t\tif (tag != null) {\n\t\t\t\tString value = m.group(2);\n\n\t\t\t\t// test for semester\n\t\t\t\tMatcher semMatcher = SEMESTER.matcher(value);\n\t\t\t\tif (semMatcher.find()) {\n\t\t\t\t\tif (semMatcher.group(1).equals(\"WS\")) {\n\t\t\t\t\t\tvalue = \"20\" + semMatcher.group(2)\n\t\t\t\t\t\t\t+ \"/20\" + semMatcher.group(3);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvalue = semMatcher.group(2) + semMatcher.group(3);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\taddTag(xml, tag, value);\n\t\t\t}\n\t\t}\n\t}", "protected void createFields()\n {\n createEffectiveLocalDtField();\n createDiscontinueLocalDtField();\n createScanTypeField();\n createContractNumberField();\n createContractTypeField();\n createProductTypeField();\n createStatusIndicatorField();\n createCivilMilitaryIndicatorField();\n createEntryUserIdField();\n createLastUpdateUserIdField();\n createLastUpdateTsField();\n }", "public void store( RssGeneratedFile rssFile )\n {\n DAOUtil daoUtil = new DAOUtil( SQL_QUERY_UPDATE_RSS_FILE );\n\n daoUtil.setInt( 1, rssFile.getPortletId( ) );\n daoUtil.setString( 2, rssFile.getName( ) );\n daoUtil.setInt( 3, rssFile.getState( ) );\n daoUtil.setTimestamp( 4, new java.sql.Timestamp( new java.util.Date( ).getTime( ) ) );\n daoUtil.setString( 5, rssFile.getDescription( ) );\n daoUtil.setString( 6, rssFile.getWorkgroup( ) );\n daoUtil.setString( 7, rssFile.getTypeResourceRss( ) );\n daoUtil.setInt( 8, rssFile.getMaxItems( ) );\n daoUtil.setString( 9, rssFile.getFeedType( ) );\n daoUtil.setString( 10, rssFile.getEncoding( ) );\n daoUtil.setInt( 11, rssFile.getId( ) );\n\n daoUtil.executeUpdate( );\n daoUtil.free( );\n }", "public ArticleData() {\r\n\t\tid = Constants.EMPTY_STRING;\r\n\t\tname = Constants.EMPTY_STRING;\r\n\t\turl = Constants.EMPTY_STRING;\r\n\t\tdesc = Constants.EMPTY_STRING;\r\n\t\tlevels = Constants.EMPTY_STRING;\r\n\t\twebSiteId = Constants.EMPTY_STRING;\r\n\t\tmatched = Constants.EMPTY_STRING;\r\n\t\tcreateBy = Constants.EMPTY_STRING;\r\n\t\tcreateDate = Constants.EMPTY_STRING;\r\n\t\tlastUpdateBy = Constants.EMPTY_STRING;\r\n\t\tlastUpdateDate = Constants.EMPTY_STRING;\r\n\t\tenabled = Constants.EMPTY_STRING;\r\n\t\tpostTableName = Constants.EMPTY_STRING;\r\n\t\treturnPage = Constants.EMPTY_STRING;\r\n\t\twebSiteShowName = Constants.EMPTY_STRING;\r\n\t\treturnDirect = Constants.EMPTY_STRING;\r\n\t\tkeyWordTableName = Constants.EMPTY_STRING;\r\n\t\ttitle = Constants.EMPTY_STRING;\r\n\t\ttitleCounter = Constants.EMPTY_STRING;\r\n\t\tbufferStartCounter = Constants.EMPTY_STRING;\r\n\t\tbufferEndCounter = Constants.EMPTY_STRING;\r\n\t\tcatId = Constants.EMPTY_STRING;\r\n\t\tpostUrl = Constants.EMPTY_STRING;\r\n\t}", "private void prepare( ) {\n super.prepare( schema.getCount( ) );\n serializer = new FieldSerializer[ fieldCount ];\n for ( int i = 0; i < fieldCount; i++ ) {\n FieldSchema field = schema.getField( i );\n serializer[i] = serializerByType[ field.getType().ordinal() ];\n }\n }", "private void initData() {\r\n allElements = new Vector<PageElement>();\r\n\r\n String className = Utility.getDisplayName(queryResult.getOutputEntity());\r\n List<AttributeInterface> attributes = Utility.getAttributeList(queryResult);\r\n int attributeSize = attributes.size();\r\n //int attributeLimitInDescStr = (attributeSize < 10) ? attributeSize : 10;\r\n\r\n Map<String, List<IRecord>> allRecords = queryResult.getRecords();\r\n serviceURLComboContents.add(\" All service URLs \");\r\n for (String url : allRecords.keySet()) {\r\n\r\n List<IRecord> recordList = allRecords.get(url);\r\n \r\n StringBuilder urlNameSize = new StringBuilder( url );\r\n urlNameSize = new StringBuilder( urlNameSize.substring(urlNameSize.indexOf(\"//\")+2));\r\n urlNameSize = new StringBuilder(urlNameSize.substring(0,urlNameSize.indexOf(\"/\")));\r\n urlNameSize.append(\" ( \" + recordList.size() + \" )\");\r\n serviceURLComboContents.add(urlNameSize.toString());\r\n Vector<PageElement> elements = new Vector<PageElement>();\r\n for (IRecord record : recordList) {\r\n StringBuffer descBuffer = new StringBuffer();\r\n for (int i = 0; i < attributeSize; i++) {\r\n Object value = record.getValueForAttribute(attributes.get(i));\r\n if (value != null) {\r\n if (i != 0) {\r\n descBuffer.append(',');\r\n }\r\n descBuffer.append(value);\r\n }\r\n }\r\n String description = descBuffer.toString();\r\n // if (description.length() > 150) {\r\n // //150 is allowable chars at 1024 resolution\r\n // description = description.substring(0, 150);\r\n // //To avoid clipping of attribute value in-between\r\n // int index = description.lastIndexOf(\",\");\r\n // description = description.substring(0, index);\r\n // }\r\n PageElement element = new PageElementImpl();\r\n element.setDisplayName(className + \"_\" + record.getRecordId().getId());\r\n element.setDescription(description);\r\n\r\n DataRow dataRow = new DataRow(record, queryResult.getOutputEntity());\r\n dataRow.setParent(parentDataRow);\r\n dataRow.setAssociation(queryAssociation);\r\n\r\n Vector recordListUserObject = new Vector();\r\n recordListUserObject.add(dataRow);\r\n recordListUserObject.add(record);\r\n\r\n element.setUserObject(recordListUserObject);\r\n\r\n allElements.add(element);\r\n elements.add(element);\r\n }\r\n URLSToResultRowMap.put(urlNameSize.toString(), elements);\r\n }\r\n }", "private void processFields(Element node, EplusObject object) {\n\t\tList<Element> children = node.getChildren();\n\t\tIterator<Element> iterator = children.iterator();\n\t\twhile (iterator.hasNext()) {\n\t\t\tElement child = iterator.next();\n\t\t\tKeyValuePair pair = new KeyValuePair(child.getAttributeValue(\"description\"), child.getText());\n\t\t\tobject.addField(pair);\n\t\t}\n\t}", "@Override\n public ArrayList<HashMap> extractFields(List<Field> fields) {\n FieldExtractor extractor\n = new FieldExtractor((Element) fetcher.getHTMLDocument(), source);\n return extractor.run(fields);\n }", "public void parsePost()\n {\n Hashtable table = new Hashtable();\n try\n {\n\n String[] pairs = Utilities.splitString(content, \"&\");\n for (int i = 0; i < pairs.length; i++)\n {\n String[] pair = Utilities.splitString(pairs[i], \"=\");\n table.put(pair[0], pair[1]);\n }\n Variables.updateTableWithTable(table);\n Variables.save();\n }\n catch (Exception e)\n {\n Utilities.debugLine(\"WebServer.parsePost(): ERROR\" + content, DEBUG);\n }\n Utilities.debugLine(\"WebServer.parsePost(): Variables were \" + content, DEBUG);\n Utilities.debugLine(\"WebServer.parsePost(): HASHTABLE = \" + table.toString(), DEBUG);\n\n }", "private void saveDBValues() {\r\n this.pl_DB.setParam(\"Hostname\", this.rhostfield.getText());\r\n this.pl_DB.setParam(\"Port\", this.rportfield.getText());\r\n this.pl_DB.setParam(\"Username\", this.ruserfield.getText());\r\n\r\n String pw = \"\";\r\n for (int i = 0; i < this.rpasswdfield.getPassword().length; i++) {\r\n pw += this.rpasswdfield.getPassword()[i];\r\n }\r\n this.pl_DB.setParam(\"Password\", pw);\r\n this.pl_DB.setParam(\"Database\", this.rdatabasefield.getText());\r\n this.pl_DB.setParam(\"nodeTableName\", this.rtablename1efield.getText());\r\n this.pl_DB.setParam(\"nodeColIDName\", this.colnodeIdfield.getText());\r\n this.pl_DB.setParam(\"nodeColLabelName\", this.colnodeLabelfield.getText());\r\n this.pl_DB.setParam(\"edgeTableName\", this.rtablename2efield.getText());\r\n this.pl_DB.setParam(\"edgeCol1Name\", this.coledge1field.getText());\r\n this.pl_DB.setParam(\"edgeCol2Name\", this.coledge2field.getText());\r\n this.pl_DB.setParam(\"edgeColWeightName\", this.colweightfield.getText());\r\n this.pl_DB.setParam(\"resultTableName\", this.otablenamefield.getText());\r\n\r\n this.is_alg_started = false;\r\n this.is_already_read_from_DB = false;\r\n this.is_already_renumbered = false;\r\n }", "private ContentValues fillContentValues(Trip theTrip) {\n ContentValues dbData = new ContentValues();\n\n // Create JSON string from the dt_list\n String jsonObjStr = dtListToJson(theTrip);\n\n // Add the Trip data to a ContentValues object\n dbData.put(TRIP_NAME, theTrip.getName());\n dbData.put(TRIP_START_DATE, theTrip.getStart().toString());\n dbData.put(TRIP_END_DATE, theTrip.getEnd().toString());\n dbData.put(TRIP_DT_LIST, jsonObjStr);\n\n return dbData;\n }", "public void createDataFeeds(){\n\n\t\tfinal MyDbHelper helper = new MyDbHelper(this);\n\t\tfinal SQLiteDatabase db = helper.getWritableDatabase();\n\t\t\n\t\tContentValues values = new ContentValues();\n\t\t\n\t\tDummyFeed.createFeeds(db, values);\t\t\n\t\t\n\t\tdb.close();\n\t\t\n\t}", "public List<LinkDetails> scrapeRSSPageForLinks(String rssUrl) {\n\t\tString description = \"\";\n\t\tString title = \"\";\n\t\tString link = \"\";\n\t\tString pubdate = \"\";\n\t\tURL url;\n\t\tInputStream in;\n\n\t\tList<LinkDetails> rssProcessedData = new ArrayList<LinkDetails>();\n\n\t\ttry {\n\t\t\turl = new URL(rssUrl);\n\t\t} catch (MalformedURLException e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t}\n\n\t\ttry {\n\t\t\tin = url.openStream();\n\t\t} catch (IOException e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t}\n\n\t\t// create XML input factory\n\t\tXMLInputFactory inputFactory = XMLInputFactory.newInstance();\n\n\t\t// read the XML document\n\t\ttry {\n\n\t\t\tXMLEventReader eventReader = inputFactory.createXMLEventReader(in);\n\n\t\t\tboolean isFeedHeader = true;\n\t\t\twhile (eventReader.hasNext()) {\n\t\t\t\tXMLEvent event = eventReader.nextEvent();\n\t\t\t\tif (event.isStartElement()) {\n\t\t\t\t\tString localPart = event.asStartElement().getName().getLocalPart();\n\n\t\t\t\t\t// System.out.println(localPart);\n\n\t\t\t\t\tswitch (localPart) {\n\n\t\t\t\t\tcase \"item\":\n\t\t\t\t\t\t// if (isFeedHeader) {\n\t\t\t\t\t\t// isFeedHeader = false;\n\t\t\t\t\t\t// System.out.println(\" title: \"+title+ \" description: \"+ description + \" link:\n\t\t\t\t\t\t// \"+link+\" pubDate: \"+pubdate);\n\t\t\t\t\t\t// }\n\t\t\t\t\t\tevent = eventReader.nextEvent();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase \"title\":\n\t\t\t\t\t\ttitle = getCharacterData(event, eventReader);\n\t\t\t\t\t\t// System.out.println(\"title: \"+title);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"description\":\n\t\t\t\t\t\tdescription = getCharacterData(event, eventReader);\n\t\t\t\t\t\t// System.out.println(\"description: \"+description);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"link\":\n\t\t\t\t\t\tlink = getCharacterData(event, eventReader);\n\t\t\t\t\t\tSystem.out.println(\"link: \" + link);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"pubDate\":\n\t\t\t\t\t\tpubdate = getCharacterData(event, eventReader);\n\t\t\t\t\t\t// System.out.println(\"pubDate: \"+pubdate);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\t\t\t\t} else if (event.isEndElement()) {\n\t\t\t\t\tif (event.asEndElement().getName().getLocalPart() == (\"item\")) {\n\n\t\t\t\t\t\tLinkDetails linkDetails = new LinkDetails(link, title, description, pubdate);\n\t\t\t\t\t\trssProcessedData.add(linkDetails);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (XMLStreamException e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t}\n\n\t\treturn rssProcessedData;\n\t}", "public SolrInputDocument collect(FlexDocument f) {\n\n\t\tSolrInputDocument cls_doc = new SolrInputDocument();\n\n\t\tfor( FlexLine l : f ){\n\t\t\tString fieldName = l.field();\n\t\t\tfor( String val : l.values() ){\n\t\t\t\tcls_doc.addField(fieldName, val);\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn cls_doc;\n\t}", "private static ArrayList<Publication> getParserAuthor() {\n\t\n\t ArrayList<Publication> list= new ArrayList<Publication>(); \n //获取DOM解析器 \n DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); \n DocumentBuilder builder; \n try { \n builder = factory.newDocumentBuilder(); \n Document doc; \n doc = builder.parse(new File(\"Myxml.xml\")); \n //得到一个element根元素,获得根节点 \n Element root = doc.getDocumentElement(); \n System.out.println(\"根元素:\"+root.getNodeName()); \n \n //子节点 \n NodeList personNodes = root.getElementsByTagName(\"publication\"); \n for(int i = 0; i<personNodes.getLength();i++){ \n Element personElement = (Element) personNodes.item(i); \n Publication publication = new Publication(); \n NodeList childNodes = personElement.getChildNodes(); \n //System.out.println(\"*****\"+childNodes.getLength()); \n \n for (int j = 0; j < childNodes.getLength(); j++) { \n if(childNodes.item(j).getNodeType()==Node.ELEMENT_NODE){ \n if(\"authors\".equals(childNodes.item(j).getNodeName())){ \n publication.setAuthors(childNodes.item(j).getFirstChild().getNodeValue()); \n }else if(\"id\".equals(childNodes.item(j).getNodeName())){ \n publication.setId(childNodes.item(j).getFirstChild().getNodeValue()); \n } \n } \n } \n list.add(publication); \n } \n for(Publication publication2 : list){ //为了查看数据是否正确,进行打印结果 \n System.out.println(publication2.toString()); \n } \n } catch (SAXException e) { \n e.printStackTrace(); \n } catch (IOException e) { \n e.printStackTrace(); \n } catch (ParserConfigurationException e) { \n e.printStackTrace(); \n } \n return list;\n}", "public void loadData(){\n try {\n entities.clear();\n\n DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();\n DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();\n Document document = documentBuilder.parse(fileName);\n\n Node root = document.getDocumentElement();\n NodeList nodeList = root.getChildNodes();\n for (int i = 0; i < nodeList.getLength(); i++){\n Node node = nodeList.item(i);\n if (node.getNodeType() == Node.ELEMENT_NODE){\n Element element = (Element) node;\n Department department = createDepartmentFromElement(element);\n try{\n super.save(department);\n } catch (RepositoryException | ValidatorException e) {\n e.printStackTrace();\n }\n }\n }\n } catch (SAXException | ParserConfigurationException | IOException e) {\n e.printStackTrace();\n }\n }", "private void addFields(StringBuilder xml) {\n\t\tfor(FieldRequest field : fields) {\n\t\t\tstartElementWithAttributes(xml, \"Delta\");\n\t\t\taddStringAttribute(xml, \"id\", field.getId());\n\t\t\taddBooleanAttribute(xml, \"masked\", field.getMasked());\n\t\t\tcloseSimpleElementWithAttributes(xml);\n\t\t}\n\t}", "@Override\n protected Void doInBackground(Void... arg0) {\n helper = new LiveFeedParser(999);\n helper.get();\n viewEntries = helper.getViewEntries();\n return null;\n }", "private List<PDFAFieldDescription> parseFieldDescription(\n\t\t\tXMPMetadata metadata) throws XmpParsingException,\n\t\t\tXMLStreamException {\n\t\tList<PDFAFieldDescription> fields = new ArrayList<PDFAFieldDescription>();\n\t\t// <rdf:Seq>\n\t\texpectNextSpecificTag(XMLStreamReader.START_ELEMENT, \"Seq\",\n\t\t\t\t\"Expected Seq Declaration\");\n\t\tint elmtType = reader.get().nextTag();\n\t\tString name, type, description;\n\t\twhile (elmtType == XMLStreamReader.START_ELEMENT) {\n\t\t\texpectCurrentLocalName(\"li\");\n\t\t\telmtType = reader.get().nextTag();\n\t\t\tname = null;\n\t\t\ttype = null;\n\t\t\tdescription = null;\n\n\t\t\twhile (elmtType == XMLStreamReader.START_ELEMENT) {\n\t\t\t\tif (reader.get().getLocalName().equals(\"name\")) {\n\t\t\t\t\tname = reader.get().getElementText();\n\t\t\t\t} else if (reader.get().getLocalName().equals(\"valueType\")) {\n\t\t\t\t\ttype = reader.get().getElementText();\n\t\t\t\t} else if (reader.get().getLocalName().equals(\"description\")) {\n\t\t\t\t\tdescription = reader.get().getElementText();\n\t\t\t\t} else {\n\t\t\t\t\tthrow new XmpUnexpectedElementException(\n\t\t\t\t\t\t\t\"Unexpected property definition in one of ValueType Field Descriptions of PDF/A Extension schemas description\");\n\t\t\t\t}\n\t\t\t\telmtType = reader.get().nextTag();\n\t\t\t}\n\t\t\tif ((name != null) && (type != null) && (description != null)) {\n\t\t\t\tPDFAFieldDescription tmp = new PDFAFieldDescription(metadata);\n\t\t\t\ttmp.setNameValue(name);\n\t\t\t\ttmp.setValueTypeValue(type);\n\t\t\t\ttmp.setDescriptionValue(description);\n\t\t\t\tfields.add(tmp);\n\t\t\t} else {\n\t\t\t\tthrow new XmpRequiredPropertyException(\n\t\t\t\t\t\t\"One valuetype field declaration in PDF/A Extension is not complete\");\n\t\t\t}\n\t\t\t// expectNextTag(XMLStreamReader.END_ELEMENT,\"Expected element end\");\n\t\t\telmtType = reader.get().nextTag();\n\t\t}\n\t\texpectNextSpecificTag(XMLStreamReader.END_ELEMENT, \"field\",\n\t\t\t\t\"Expected End of Properties Declaration\");\n\t\tif (fields.size() != 0) {\n\t\t\treturn fields;\n\t\t}\n\t\treturn null;\n\t}", "public void setParseFields() {\n setParseRating();\n setParsePrice();\n setParsePhone();\n setParseRestaurantId();\n setParseAlias();\n setParseIsClosed();\n setParseReviewCount();\n setParseName();\n setParseUrl();\n setParseImageUrl();\n setParseDistance();\n setParseAddress();\n setParseCuisine();\n setParseTransactions();\n }", "private void parseValues() {\n final Element table = this.doc.select(\"table\").get(0);\n final Elements rows = table.select(\"tr\");\n for (int ind = 1; ind < rows.size(); ind += 1) {\n String label = rows.get(ind).select(\"td\").get(0).select(\"code\").get(0).text();\n label = label.substring(label.lastIndexOf('.') + 1);\n final String value = rows.get(ind).select(\"td\").get(1).text();\n this.values.put(label, value);\n }\n }", "public BaseField setupField(int iFieldSeq)\n {\n BaseField field = null;\n if (iFieldSeq == 0)\n field = new HotelField(this, PRODUCT_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);\n //if (iFieldSeq == 1)\n // field = new DateField(this, START_DATE, Constants.DEFAULT_FIELD_LENGTH, null, null);\n //if (iFieldSeq == 2)\n // field = new DateField(this, END_DATE, Constants.DEFAULT_FIELD_LENGTH, null, null);\n //if (iFieldSeq == 3)\n // field = new StringField(this, DESCRIPTION, 10, null, null);\n //if (iFieldSeq == 4)\n // field = new CityField(this, CITY_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);\n //if (iFieldSeq == 5)\n // field = new CityField(this, TO_CITY_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);\n //if (iFieldSeq == 6)\n // field = new ContinentField(this, CONTINENT_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);\n //if (iFieldSeq == 7)\n // field = new RegionField(this, REGION_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);\n //if (iFieldSeq == 8)\n // field = new CountryField(this, COUNTRY_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);\n //if (iFieldSeq == 9)\n // field = new StateField(this, STATE_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);\n //if (iFieldSeq == 10)\n // field = new VendorField(this, VENDOR_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);\n if (iFieldSeq == 11)\n field = new HotelRateField(this, RATE_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);\n if (iFieldSeq == 12)\n field = new HotelClassField(this, CLASS_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);\n //if (iFieldSeq == 13)\n // field = new DateField(this, DETAIL_DATE, Constants.DEFAULT_FIELD_LENGTH, null, null);\n //if (iFieldSeq == 14)\n // field = new ShortField(this, PAX, Constants.DEFAULT_FIELD_LENGTH, null, new Short((short)2));\n //if (iFieldSeq == 15)\n // field = new HotelScreenRecord_LastChanged(this, LAST_CHANGED, Constants.DEFAULT_FIELD_LENGTH, null, null);\n //if (iFieldSeq == 16)\n // field = new BooleanField(this, REMOTE_QUERY_ENABLED, Constants.DEFAULT_FIELD_LENGTH, null, null);\n //if (iFieldSeq == 17)\n // field = new ShortField(this, BLOCKED, Constants.DEFAULT_FIELD_LENGTH, null, null);\n //if (iFieldSeq == 18)\n // field = new ShortField(this, OVERSELL, Constants.DEFAULT_FIELD_LENGTH, null, null);\n //if (iFieldSeq == 19)\n // field = new BooleanField(this, CLOSED, Constants.DEFAULT_FIELD_LENGTH, null, null);\n //if (iFieldSeq == 20)\n // field = new BooleanField(this, DELETE, Constants.DEFAULT_FIELD_LENGTH, null, null);\n //if (iFieldSeq == 21)\n // field = new BooleanField(this, READ_ONLY, Constants.DEFAULT_FIELD_LENGTH, null, null);\n //if (iFieldSeq == 22)\n // field = new ProductSearchTypeField(this, PRODUCT_SEARCH_TYPE_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);\n //if (iFieldSeq == 23)\n // field = new ProductTypeField(this, PRODUCT_TYPE_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);\n if (iFieldSeq == 24)\n field = new PaxCategorySelect(this, PAX_CATEGORY_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);\n if (field == null)\n field = super.setupField(iFieldSeq);\n return field;\n }", "private void insertCastsData(Connection conn)\n\t{\n\t\ttry {\n\t\t\tString filmid = null;\n\t\t\tString actorstageName = null;\n\t\t\tint starId;\n\t\t\tint movieId;\n\t\t\tint flag = 0;\n\t\t\tPreparedStatement ptinsertStarMovie = null;\n\t\t\tptinsertStarMovie = (PreparedStatement) conn.prepareStatement(\"Insert into stars_in_movies (starId, movieId) Values (? ,?);\");\n\n\t\t\tElement docElem = dom.getDocumentElement();\n\t\t\tNodeList dirfilmsList = docElem.getElementsByTagName(\"dirfilms\");\n\t\t\tfor (int i = 0; i < dirfilmsList.getLength(); i++) {\n\t\t\t\tElement dirfilmsElem = (Element) dirfilmsList.item(i);\n\t\t\t\tNodeList filmcList = dirfilmsElem.getElementsByTagName(\"filmc\");\n\t\t\t\tif (filmcList != null) {\n\t\t\t\t\tfor (int j = 0; j < filmcList.getLength(); j++) {\n\t\t\t\t\t\tElement filmcElem = (Element) filmcList.item(j);\n\t\t\t\t\t\tNodeList mList = filmcElem.getElementsByTagName(\"m\");\n\t\t\t\t\t\tif (mList != null) {\n\t\t\t\t\t\t\tfor (int k = 0; k < mList.getLength(); k++) {\n\t\t\t\t\t\t\t\tfilmid = null;\n\t\t\t\t\t\t\t\tactorstageName = null;\n\t\t\t\t\t\t\t\tflag = 0;\n\t\t\t\t\t\t\t\t// count3++;\n\t\t\t\t\t\t\t\tElement mElem = (Element) mList.item(k);\n\t\t\t\t\t\t\t\t// Get Film ID\n\t\t\t\t\t\t\t\tNodeList fList = mElem.getElementsByTagName(\"f\");\n\t\t\t\t\t\t\t\tif (fList != null && fList.getLength() > 0) {\n\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\tfilmid = fList.item(0).getFirstChild().getNodeValue();\n\t\t\t\t\t\t\t\t\t\tfilmid = filmid.trim();\n\t\t\t\t\t\t\t\t\t} catch (Exception e1) {\n\t\t\t\t\t\t\t\t\t\t// do nothing\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\tNodeList aList = mElem.getElementsByTagName(\"a\");\n\t\t\t\t\t\t\t\tif (aList != null) {\n\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\tactorstageName = aList.item(0).getFirstChild().getNodeValue();\n\t\t\t\t\t\t\t\t\t\tactorstageName = actorstageName.trim();\n\t\t\t\t\t\t\t\t\t\tactorstageName = actorstageName.toLowerCase();\n\t\t\t\t\t\t\t\t\t} catch (Exception e2) {\n\t\t\t\t\t\t\t\t\t\t// do nothing\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\tif (actorstageName != null && filmid != null) {\n\n\t\t\t\t\t\t\t\t\tif (!movie_map.containsKey(filmid)) {\n\t\t\t\t\t\t\t\t\t\tflag = 1;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif (!star_map.containsKey(actorstageName)) {\n\t\t\t\t\t\t\t\t\t\tflag = 1;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif (flag == 0) {\n\t\t\t\t\t\t\t\t\t\tstarId = star_map.get(actorstageName);\n\t\t\t\t\t\t\t\t\t\tmovieId = movie_map.get(filmid);\n\t\t\t\t\t\t\t\t\t\tptinsertStarMovie.setString(1, \"nm\" + starId);\n\t\t\t\t\t\t\t\t\t\tptinsertStarMovie.setString(2, \"tt\" + movieId);\n\t\t\t\t\t\t\t\t\t\tptinsertStarMovie.addBatch();\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\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tptinsertStarMovie.executeBatch();\n\t\t\tconn.commit();\n\t\t\tptinsertStarMovie.close();\n\t\t\t// PreparedStatement temp = (PreparedStatement)\n\t\t\t// conn.prepareStatement(\"ALTER IGNORE TABLE stars_in_movies ADD\n\t\t\t// constraint myuniqueconstaint UNIQUE (star_id, movie_id);\");\n\t\t\t// temp.executeUpdate();\n\t\t\t// temp.close();\n\n\t\t} catch (SQLException e) {\n\t\t\tSystem.out.println(e.getMessage());\n\t\t}\n\t}", "void onPrepareForSubmit() {\n\t\t// Create the same list as was rendered.\n\t\t// Loop will write its input field values into the list's objects.\n\n\t\tcreatePersonsList();\n\n\t\t// Prepare to take a copy of each field.\n\n\t\trowNum = -1;\n\t\tfirstNameFieldCopyByRowNum = new HashMap<Integer, FieldCopy>();\n\t\tlastNameFieldCopyByRowNum = new HashMap<Integer, FieldCopy>();\n\t\tregionFieldCopyByRowNum = new HashMap<Integer, FieldCopy>();\n\t\tstartDateFieldCopyByRowNum = new HashMap<Integer, FieldCopy>();\n\t}", "public FeedParsers() {\n super(FEED_PARSERS_KEY);\n }", "@Override\n public void process(StreamingInput<Tuple> stream, Tuple tuple) throws Exception {\n \t\n \t// Collect fields to add to JSON output.\n\t\tStreamSchema schema = tuple.getStreamSchema();\n \tSet<String> attributeNames = schema.getAttributeNames();\n \tJSONObject jsonFields = new JSONObject();\n\t \n\tfor (String attributeName : attributeNames) {\n\t\tif (schema.getAttribute(attributeName).getType().getMetaType() == Type.MetaType.RSTRING) {\n\t\t\tjsonFields.put(attributeName, tuple.getObject(attributeName).toString());\n\t\t} else {\n\t\t\tjsonFields.put(attributeName, tuple.getObject(attributeName));\n\t\t}\n\t}\n \n \t// Add timestamp, if specified, for time-based queries.\n \tif (timestampName != null) {\n \t\tDateFormat df = new SimpleDateFormat(\"yyyy'-'MM'-'dd'T'HH':'mm':'ss.SSSZZ\");\n \t\t\n \t\tif (attributeNames.contains(timestampName) && schema.getAttribute(timestampName).getType().getMetaType() == Type.MetaType.RSTRING\n \t\t\t&& !tuple.getString(timestampName).equals(\"\")) {\n \t\t\tString timestampToInsert = tuple.getString(timestampName);\n \t\t\tjsonFields.put(timestampName, df.format(timestampToInsert));\n \t\t} else {\n \t\t\tjsonFields.put(timestampName, df.format(new Date(System.currentTimeMillis())));\n \t\t}\n \t}\n \t\n \t// Get index name/type/id specified inside tuple (default: from params).\n \tString indexToInsert = index;\n \tString typeToInsert = type;\n \tString idToInsert = null;\n \t\n \tif (attributeNames.contains(index) && schema.getAttribute(index).getType().getMetaType() == Type.MetaType.RSTRING\n \t\t\t&& !tuple.getString(index).equals(\"\")) {\n \t\tindexToInsert = tuple.getString(index);\n \t}\n \t\n \tif (attributeNames.contains(type) && schema.getAttribute(type).getType().getMetaType() == Type.MetaType.RSTRING\n \t\t\t&& !tuple.getString(type).equals(\"\")) {\n \t\ttypeToInsert = tuple.getString(type);\n \t}\n\n \tif (id != null && attributeNames.contains(id) && schema.getAttribute(id).getType().getMetaType() == Type.MetaType.RSTRING\n \t\t\t&& !tuple.getString(id).equals(\"\")) {\n \t\tidToInsert = tuple.getString(id);\n \t}\n \t\n \tif (connectedToElasticsearch(indexToInsert, typeToInsert)) {\n \t\n \t\t// Add jsonFields to bulkBuilder.\n \tString source = jsonFields.toString();\n \t\n \tif (idToInsert != null) {\n \t\tbulkBuilder.addAction(new Index.Builder(source).index(indexToInsert).type(typeToInsert).id(idToInsert).build());\n \t} else {\n \t\tbulkBuilder.addAction(new Index.Builder(source).index(indexToInsert).type(typeToInsert).build());\n \t}\n \t\n \tcurrentBulkSize++;\n \t\n \t// If bulk size met, output jsonFields to Elasticsearch.\n \tif(currentBulkSize >= bulkSize) {\n\t \tBulk bulk = bulkBuilder.build();\n\t \tBulkResult result;\n\t \t\n\t \ttry {\n\t\t \tresult = client.execute(bulk);\n\t \t} catch (NoHttpResponseException e) {\n\t \t\t_trace.error(e);\n\t \t\treturn;\n\t \t}\n\t \t\n \t\t\tif (result.isSucceeded()) {\n \t\t\t\tlong currentNumInserts = numInserts.getValue();\n \t\t\t\tnumInserts.setValue(currentNumInserts + bulkSize);\n \t\t\t\tcurrentBulkSize = 0;\n \t\t\t} else {\n \t\t\t\tfor (BulkResultItem item : result.getItems()) {\n \t\t\t\t\tif (item.error != null) {\n \t\t\t\t\t\tnumInserts.increment();\n \t\t\t\t\t} else {\n \t\t\t\t\t\ttotalFailedRequests.increment();\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t}\n \t\t\t\n \t\t\t// Clear bulkBuilder. Gets recreated in connectedToElasticsearch().\n \t\t\tbulkBuilder = null;\n \t\t\t\n \t\t\t// Get size metrics for current type.\n \t\t\tif (sizeMetricsEnabled && mapperSizeInstalled) {\n\t \t\t\tString query = \"{\\n\" +\n\t \t \" \\\"query\\\" : {\\n\" +\n\t \t \" \\\"match_all\\\" : {}\\n\" +\n\t \t \" },\\n\" +\n\t \t \" \\\"aggs\\\" : {\\n\" +\n\t \t \" \\\"size_metrics\\\" : {\\n\" +\n\t \t \" \\\"extended_stats\\\" : {\\n\" +\n\t \t \" \\\"field\\\" : \\\"_size\\\"\\n\" +\n\t \t \" }\\n\" +\n\t \t \" }\\n\" +\n\t \t \" }\\n\" +\n\t \t \"}\";\n\t \t\t\t\n\t \t Search search = new Search.Builder(query)\n\t \t .addIndex(indexToInsert)\n\t \t .addType(typeToInsert)\n\t \t .build();\n\t \t \n\t \t SearchResult searchResult = client.execute(search);\n\t \t \n\t \t if (searchResult.isSucceeded()) {\n\t\t \t ExtendedStatsAggregation sizeMetrics = searchResult.getAggregations().getExtendedStatsAggregation(\"size_metrics\");\n\t\t \t\t\t\n\t\t \t if (sizeMetrics != null) {\n\t\t \t \tif (sizeMetrics.getAvg() != null) {\n\t\t\t\t \t\t\tavgInsertSizeBytes.setValue(sizeMetrics.getAvg().longValue());\n\t\t \t \t}\n\t\t \t \tif (sizeMetrics.getMax() != null) {\n\t\t \t \t\tmaxInsertSizeBytes.setValue(sizeMetrics.getMax().longValue());\n\t\t \t \t}\n\t\t \t \tif (sizeMetrics.getMin() != null) {\n\t\t \t \t\tminInsertSizeBytes.setValue(sizeMetrics.getMin().longValue());\n\t\t \t \t}\n\t\t \t \tif (sizeMetrics.getSum() != null) {\n\t\t \t \t\tsumInsertSizeBytes.setValue(sizeMetrics.getSum().longValue());\n\t\t \t \t}\n\t\t \t }\n\t \t }\n \t\t\t}\n \t\t}\n \t}\n }", "private static void populateDB(){\r\n try {\r\n\r\n Connection con = DBConnection.getConnection();\r\n Statement st=con.createStatement();\r\n DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();\r\n DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();\r\n\r\n Document document = docBuilder.parse (UserPopulateDB.class.getResource(\"../configurations/users.xml\").getPath());\r\n document.getDocumentElement().normalize();\r\n System.out.println (\"Initial element within document is \" + document.getDocumentElement().getNodeName());\r\n NodeList listOfUsers = document.getElementsByTagName(\"user\");\r\n for(int s=0; s<listOfUsers.getLength(); s++){\r\n Node firstUserNode = listOfUsers.item(s);\r\n\r\n if(firstUserNode.getNodeType() == Node.ELEMENT_NODE){\r\n Element firstUserElement = (Element)firstUserNode;\r\n NodeList usernameList = firstUserElement.getElementsByTagName(\"username\");\r\n Element usernameElement =(Element)usernameList.item(0);\r\n\r\n NodeList textFNList = usernameElement.getChildNodes();\r\n String username=((Node)textFNList.item(0)).getNodeValue().trim();\r\n\r\n NodeList emailList = firstUserElement.getElementsByTagName(\"email\");\r\n Element emailElement =(Element)emailList.item(0);\r\n\r\n NodeList textLNList = emailElement.getChildNodes();\r\n String email= ((Node)textLNList.item(0)).getNodeValue().trim();\r\n\r\n NodeList passwordList = firstUserElement.getElementsByTagName(\"password\");\r\n Element passwordElement =(Element)passwordList.item(0);\r\n\r\n NodeList textPNList = passwordElement.getChildNodes();\r\n String password= ((Node)textPNList.item(0)).getNodeValue().trim();\r\n\r\n int i=st.executeUpdate(\"insert into users(username,email,password) values('\"+username+\"','\"+email+\"','\"+password+\"')\");\r\n }\r\n }\r\n System.out.println(\"Data is successfully inserted!\");\r\n }catch (Exception err) {\r\n System.out.println(\"User Data can't be loaded into DB: \" + err.getMessage ());\r\n }\r\n }", "private static void collectVariables(Document document){\n //collecting all the nodes inside a list\n nodeList = document.selectNodes(NOTES);\n\n //initialising the lists\n entriesList = new ArrayList<>();\n locationsList = new ArrayList<>();\n attachmentList = new ArrayList<>();\n tagsForEntryList = new ArrayList<>();\n\n //hashSet for handling the duplicate fileNames\n fileNameSet = new LinkedHashSet<>();\n\n //linkedHashMap for storing the uid for each tag\n uidForEachTag = new LinkedHashMap<>();\n uidForEachLocation = new LinkedHashMap<>();\n\n //id set for storing unique location id\n locationsIdSet = new LinkedHashSet<>();\n\n Tags tags;\n Location location;\n Entry entry;\n Attachment attachment;\n\n byte[] decoded = null;\n\n //looping through the list\n for(Node node : nodeList){\n\n String title = \"\";\n String parsedHtml = \"\";\n String formattedDate = \"\";\n String location_uid = \"\";\n String mime = \"\";\n String fileName = \"\";\n String attachment_uid = null;\n String entry_uid = \"\";\n String type = \"photo\";\n String baseEncoding;\n String tag_uid = \"\";\n\n //get all tags including duplicates\n if( node.selectSingleNode(TAG) !=null) {\n List<Node> evernote_tags = node.selectNodes(TAG);\n for (Node evenote_tag : evernote_tags) {\n //generate unique id for the tag and map it.\n //if the name id pair does not exist\n if(!uidForEachTag.containsKey(evenote_tag.getText())) {\n uidForEachTag.put(evenote_tag.getText(), Entry.generateRandomUid());\n }\n //create new diaro.Tags Object\n tags = new Tags(uidForEachTag.get(evenote_tag.getText()),evenote_tag.getText());\n tagsForEntryList.add(tags);\n }\n }\n\n //get all Locations\n // using diaro.Entry.concatLatLng to add title as {<Latitude></Latitude>,<Longitude></Longitude>}\n if( node.selectSingleNode(LATITUDE) != null && node.selectSingleNode(LONGITUDE) != null) {\n String latitude = String.format(\"%.5f\",Double.parseDouble(node.selectSingleNode(LATITUDE).getText()));\n String longitude = String.format(\"%.5f\",Double.parseDouble(node.selectSingleNode(LONGITUDE).getText()));\n String location_title = (ImportUtils.concatLatLng(latitude, longitude));\n\n //mapping every uid to the address\n if(!uidForEachLocation.containsKey(location_title)) {\n uidForEachLocation.put(location_title, Entry.generateRandomUid());\n }\n location_uid = uidForEachLocation.get(location_title);\n location = new Location(location_uid,latitude,longitude,location_title, location_title, DEFAULT_ZOOM);\n if (!locationsIdSet.contains(location.location_uid)) {\n locationsList.add(location);\n locationsIdSet.add(location.location_uid);\n }\n }\n\n //get all Entries\n if(node.selectSingleNode(TITLE) != null ){\n title = node.selectSingleNode(TITLE).getText();\n }\n if(node.selectSingleNode(CONTENT) != null ){\n String text = node.selectSingleNode(CONTENT).getText();\n // using Jsoup to parseXml HTML inside Content\n parsedHtml = Jsoup.parse(text).text();\n }\n if(node.selectSingleNode(CREATED) != null){\n String date = node.selectSingleNode(CREATED).getText().substring(0, 8);\n String month = date.substring(4, 6);\n String day = date.substring(6, 8);\n String year = date.substring(2, 4);\n formattedDate = String.format(\"%s/%s/%s\", month, day, year);\n }\n\n //get all the tags\n //append all the string stringBuilder\n if(tagsForEntryList.size() != 0){\n for(Tags tag : tagsForEntryList) {\n tag_uid = tag_uid + (\",\") + (String.join(\",\", tag.tagsId));\n }\n tag_uid = tag_uid + (\",\");\n System.out.println(tag_uid);\n\n }\n entry = new Entry();\n entry.setUid(Entry.generateRandomUid());\n entry.setTz_offset(OFFSET);\n entry.setDate(formattedDate);\n entry.setText(parsedHtml);\n entry.setTitle(title);\n entry.setFolder_uid(FOLDER_UID);\n entry.setLocation_uid(location_uid);\n entry.setTags(tag_uid);\n //clear the list\n //clear the tag_uid variable for next loop\n tagsForEntryList.clear();\n tag_uid = \"\";\n //add entry in the list\n entriesList.add(entry);\n\n //get all the attachments\n if (node.selectSingleNode(RESOURCE) != null) {\n List<Node> attachmentsForEachEntry = node.selectNodes(RESOURCE);\n //loop through all the attachments for a single note/entry\n for (Node attachmentForeach : attachmentsForEachEntry) {\n try {\n mime = attachmentForeach.selectSingleNode(MIME).getText();\n\n }catch( NullPointerException e){\n e.printStackTrace();\n }\n // check for a valid attachment\n if(checkForImageMime(mime)) {\n try {\n fileName = attachmentForeach.selectSingleNode(RESOURCE_ATTRIBUTE_FILENAME).getText();\n attachment_uid = Entry.generateRandomUid();\n entry_uid = entry.uid;\n baseEncoding = attachmentForeach.selectSingleNode(DATA).getText();\n //----- please do a check for valid Base64--\n decoded = Base64.getMimeDecoder().decode(baseEncoding);\n // assign primary_photo uid to entry\n entry.primary_photo_uid = attachment_uid;\n }catch(IllegalArgumentException | NullPointerException e){\n e.printStackTrace();\n }\n // check if the fileName already exists\n // if true generate a new fileName to prevent duplicates\n if(fileNameSet.add(fileName)){\n fileNameSet.add(fileName);\n attachment = new Attachment(attachment_uid, entry_uid, type,fileName,decoded);\n }else{\n String newFileName = ImportUtils.generateNewFileName(fileName);\n fileNameSet.add(newFileName);\n attachment = new Attachment(attachment_uid, entry_uid, type,newFileName,decoded);\n }\n attachmentList.add(attachment);\n }\n }\n }\n }\n\n }", "private void createTempDatabase() {\n\t\thandler = new ERXmlDocumentHandler(doc);\n\t\tList<String> filter = initFilter(subjectId);\n\t\tparseEntitys(filter);\n\t}", "protected void addMetadataFieldsFromParameters() {\n for (Map.Entry<String, String> e: parameters.entrySet()) {\n if (e.getKey().startsWith(\"meta-\")) {\n String fieldName = e.getKey().substring(5);\n String fieldValue = e.getValue();\n currentDoc.addTextualMetadataField(fieldName, fieldValue, getDocWriter().metadataFieldType(false));\n }\n }\n }", "public FlexData() {\n entryCollectionList = null;\n entryCollectionMap = null;\n type = Type.UNKNOWN;\n standardDateFormat = \"yyyy-MM-dd\"; // DB2-Datum\n\t}", "static void processFile(File xmlFile) {\n Document doc = null;\n try {\n doc = builder.parse(xmlFile);\n }\n catch (IOException e) {\n e.printStackTrace();\n System.exit(3);\n }\n catch (SAXException e) {\n System.out.println(\"Parsing error on file \" + xmlFile);\n System.out.println(\" (not supposed to happen with supplied XML files)\");\n e.printStackTrace();\n System.exit(3);\n }\n \n /* At this point 'doc' contains a DOM representation of an 'Items' XML\n * file. Use doc.getDocumentElement() to get the root Element. */\n System.out.println(\"Successfully parsed - \" + xmlFile);\n \n /* Fill in code here (you will probably need to write auxiliary\n methods). */\n \n Element[] elems = getElementsByTagNameNR(doc.getDocumentElement(), \"Item\");\n for(Element e : elems) {\n\n String itemId = e.getAttribute(\"ItemID\");\n String name = getElementTextByTagNameNR(e, \"Name\");\n String currently = strip(getElementTextByTagNameNR(e, \"Currently\"));\n String buy_price = strip(getElementTextByTagNameNR(e, \"Buy_Price\"));\n String first_bid = strip(getElementTextByTagNameNR(e, \"First_Bid\"));\n String number_of_bids = getElementTextByTagNameNR(e, \"Number_of_Bids\");\n String country = getElementTextByTagNameNR(e, \"Country\");\n String started = changeTime(getElementTextByTagNameNR(e, \"Started\"));\n String ends = changeTime(getElementTextByTagNameNR(e, \"Ends\"));\n Element seller = getElementByTagNameNR(e, \"Seller\");\n String sellerId = seller.getAttribute(\"UserID\");\n String sellerRatings = seller.getAttribute(\"Rating\");\n String location = getElementTextByTagNameNR(e, \"Location\");\n Element locate = getElementByTagNameNR(e, \"Location\");\n String latitude = locate.getAttribute(\"Latitude\");\n String longitude = locate.getAttribute(\"Longitude\");\n String description = getElementTextByTagNameNR(e, \"Description\");\n if(description.length() > 4000)\n description = description.substring(0, 4001);\n\n // add the record to the list\n items.add(itemRecord(itemId, name, currently, buy_price, first_bid, number_of_bids, country,\n started, ends, sellerId, location, latitude, longitude, description));\n\n // add the category infomation and belongsTo information\n Element[] cates = getElementsByTagNameNR(e, \"Category\");\n for(Element c : cates) {\n String cate = getElementText(c);\n if(category.containsKey(cate) == false) {\n int cnt = category.size();\n category.put(cate, cnt);\n }\n int index = category.get(cate);\n String caterecord = itemId + columnSeparator + index;\n belongsTo.add(caterecord);\n }\n\n // add the user information\n if(users.containsKey(sellerId)) {\n users.get(sellerId).sellRating = sellerRatings;\n }\n else {\n User u = new User(sellerId);\n u.sellRating = sellerRatings;\n users.put(sellerId, u);\n }\n\n // add the bid infromation and bider inforamtion\n Element[] ebids = getElementsByTagNameNR(getElementByTagNameNR(e, \"Bids\"), \"Bid\");\n for(Element b : ebids) {\n Element bidder = getElementByTagNameNR(b, \"Bidder\");\n String bidderId = bidder.getAttribute(\"UserID\");\n String bidderRating = bidder.getAttribute(\"Rating\");\n String bidderloc = getElementTextByTagNameNR(bidder, \"Location\");\n String biddercoun = getElementTextByTagNameNR(bidder, \"Country\");\n String amount = strip(getElementTextByTagNameNR(b, \"Amount\"));\n String time = changeTime(getElementTextByTagNameNR(b, \"Time\"));\n\n\n if(users.containsKey(bidderId) == false) {\n User u = new User(bidderId);\n users.put(bidderId, u);\n }\n users.get(bidderId).location = bidderloc;\n users.get(bidderId).country = biddercoun;\n users.get(bidderId).bidRating = bidderRating;\n bids.add(bidRecord(itemId, bidderId, time, amount));\n }\n\n }\n \n \n /**************************************************************/\n \n }", "public static void processFeed(FeedContext fc) {\n\n String feedUrl = fc.getFeedUrl();\n mLog.info(\"Processing Atom feed at URL: \" + feedUrl);\n\n try {\n AbderaAtomParser atomParser = new AbderaAtomParser(new URL(feedUrl));\n atomParser.persistFeed(fc);\n\n mLog.info(\"Finished processing Atom feed at URL \" + feedUrl);\n }\n catch (MalformedURLException url_e) {\n mLog.error(\"MalformedURL found for \" + fc.getFeedUrl());\n }\n catch (ArrayIndexOutOfBoundsException a) {\n // this happens if the feed is empty (typically an activity stream),\n // need a better way to track this though\n \tmLog.warn(\"Feed at URL [\" + feedUrl + \"] is probably empty, but this \" +\n \t\t\t\"exception should have been prevented.\");\n }\n catch (Exception e) {\n mLog.error(\"Error processing feed at [\" + fc.getFeedUrl() + \"]: \" + e.getMessage());\n }\n catch (Throwable t) {\n mLog.error(\"Error processing feed at [\" + fc.getFeedUrl() + \"]: \" + t.getMessage());\n }\n }", "public void addDepartmentRow(Departmentdetails departmentDetailsFeed);", "int insert(WpPostsWithBLOBs record);", "@Override\n protected void initializeFields() {\n \tsuper.initializeFields();\n\n \taddField(new DcField(DcMediaObject._A_TITLE, getIndex(), \"Title\", \n false, true, false, true, \n 255, ComponentFactory._SHORTTEXTFIELD, getIndex(), DcRepository.ValueTypes._STRING,\n \"Title\"));\n addField(new DcField(DcMediaObject._B_DESCRIPTION, getIndex(), \"Description\", \n false, true, false, true, \n 0, ComponentFactory._LONGTEXTFIELD, getIndex(), DcRepository.ValueTypes._STRING,\n \"Description\"));\n addField(new DcField(DcMediaObject._C_YEAR, getIndex(), \"Year\", \n false, true, false, true, \n 4, ComponentFactory._NUMBERFIELD, getIndex(), DcRepository.ValueTypes._LONG,\n \"Year\"));\n\n if (getIndex() != DcModules._IMAGE && !isAbstract())\n addField(new DcField(DcMediaObject._D_LANGUAGE, getIndex(), \"Languages\", \n true, true, false, true, \n 255, ComponentFactory._REFERENCESFIELD, DcModules._LANGUAGE, DcRepository.ValueTypes._DCOBJECTCOLLECTION,\n \"Languages\"));\n \n addField(new DcField(DcMediaObject._E_RATING, getIndex(), \"Rating\", \n false, true, false, true, \n 255, ComponentFactory._RATINGCOMBOBOX, getIndex(), DcRepository.ValueTypes._LONG,\n \"Rating\"));\n addField(new DcField(DcMediaObject._F_COUNTRY, getIndex(), \"Countries\", \n true, true, false, true, \n 255, ComponentFactory._REFERENCESFIELD, DcModules._COUNTRY, DcRepository.ValueTypes._DCOBJECTCOLLECTION,\n \"Countries\")); \n }", "private void addNewsAllToDatabase(LinkedList<NewsDetail> newsDetails) {\n new InsertNewsAsyncTask(newsDao).execute(newsDetails);\n }", "public static void setFields(DBFField[] fields) throws UnsupportedEncodingException {\r\n int i = 0;\r\n\r\n fields[i] = new DBFField();\r\n fields[i].setName(\"TIPREG\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_C);\r\n fields[i].setFieldLength(1);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"DOCFEC\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_D);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"DOCSER\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_C);\r\n fields[i].setFieldLength(10);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"DOCNUM\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_C);\r\n fields[i].setFieldLength(6);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"CODTIP\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_C);\r\n fields[i].setFieldLength(2);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"CODMOD\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_C);\r\n fields[i].setFieldLength(2);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"CODTER\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_C);\r\n fields[i].setFieldLength(5);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"CTACON\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_C);\r\n fields[i].setFieldLength(12);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"BASEBAS\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_C);\r\n fields[i].setFieldLength(10);\r\n// fields[i].setDecimalCount(2);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"IMPTBAS\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_C);\r\n fields[i].setFieldLength(10);\r\n// fields[i].setDecimalCount(2);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"PORNOR\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_N);\r\n fields[i].setFieldLength(6);\r\n fields[i].setDecimalCount(2);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"RECBAS\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_N);\r\n fields[i].setFieldLength(10);\r\n fields[i].setDecimalCount(2);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"PORREC\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_N);\r\n fields[i].setFieldLength(6);\r\n fields[i].setDecimalCount(2);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"PORTES\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_N);\r\n fields[i].setFieldLength(11);\r\n fields[i].setDecimalCount(2);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"PORFIN\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_N);\r\n fields[i].setFieldLength(6);\r\n fields[i].setDecimalCount(2);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"RFDPP\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_N);\r\n fields[i].setFieldLength(11);\r\n fields[i].setDecimalCount(2);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"DESHOR\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_N);\r\n fields[i].setFieldLength(11);\r\n fields[i].setDecimalCount(2);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"DESKM\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_N);\r\n fields[i].setFieldLength(11);\r\n fields[i].setDecimalCount(2);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"TOTFAC\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_C);\r\n fields[i].setFieldLength(14);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"FECVTO1\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_D);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"IMPVTO1\");\r\n //fields[i].setDataType(DBFField.FIELD_TYPE_N);\r\n // Es numerico pero para insertar valor \"XXX,YY\" \r\n //hay que meterlo como string y despues cambiarlo en dbfmanager -> Structura\r\n fields[i].setDataType(DBFField.FIELD_TYPE_C);\r\n fields[i].setFieldLength(10);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"FECVTO2\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_D);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"IMPVTO2\");\r\n // Misma razon que IMPVTO1\r\n fields[i].setDataType(DBFField.FIELD_TYPE_C);\r\n fields[i].setFieldLength(10);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"FECVTO3\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_D);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"IMPVTO3\");\r\n // Misma razon que IMPVTO1\r\n fields[i].setDataType(DBFField.FIELD_TYPE_C);\r\n fields[i].setFieldLength(10);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"FECVTO4\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_D);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"IMPVTO4\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_N);\r\n fields[i].setFieldLength(10);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"FECVTO5\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_D);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"IMPVTO5\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_N);\r\n fields[i].setFieldLength(10);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"FECVTO6\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_D);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"IMPVTO6\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_N);\r\n fields[i].setFieldLength(10);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"DIETENT\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_N);\r\n fields[i].setFieldLength(10);\r\n fields[i].setDecimalCount(2);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"CODFORPAG\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_C);\r\n fields[i].setFieldLength(3);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"TIPFORPAG\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_C);\r\n fields[i].setFieldLength(1);\r\n //logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n \r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"BASEIMPCC\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_C);\r\n fields[i].setFieldLength(10);\r\n// logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n fields[++i] = new DBFField();\r\n fields[i].setName(\"CC\");\r\n fields[i].setDataType(DBFField.FIELD_TYPE_N);\r\n fields[i].setFieldLength(10);\r\n fields[i].setDecimalCount(0);\r\n// logger.log(Level.INFO, \"Campo {0}-{1} - DataType : {2}\", new Object[]{i, fields[i].getName(), getFieldDataType(fields[i].getDataType())});\r\n\r\n //logger.log(Level.INFO, \"Total columnas en fichero .dbf = {0}\", i);\r\n }", "public void putNext(Tuple tuple) throws IOException {\n\t\tint sqlPos = 1;\n\t\ttry {\n\t\t\tint size = tuple.size();\n\t\t\tfor (int i = 0; i < size; i++) {\n\t\t\t\ttry {\n\t\t\t\t\tObject field = tuple.get(i);\n\t\t\t\t\tif(field != null){\n\t\t\t\t\t\tif(\"\\\\N\".equalsIgnoreCase(field.toString())){\n\t\t\t\t\t\t\tfield = null;\n\t\t\t\t\t\t}\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\n\t\t\t\t\tswitch (DataType.findType(field)) {\n\t\t\t\t\tcase DataType.NULL:\n\t\t\t\t\t\tps.setNull(sqlPos, java.sql.Types.VARCHAR);\n\t\t\t\t\t\tsqlPos++;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase DataType.BOOLEAN:\n\t\t\t\t\t\tps.setBoolean(sqlPos, (Boolean) field);\n\t\t\t\t\t\tsqlPos++;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase DataType.INTEGER:\n\t\t\t\t\t\tps.setInt(sqlPos, (Integer) field);\n\t\t\t\t\t\tsqlPos++;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase DataType.LONG:\n\t\t\t\t\t\tps.setLong(sqlPos, (Long) field);\n\t\t\t\t\t\tsqlPos++;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase DataType.FLOAT:\n\t\t\t\t\t\tps.setFloat(sqlPos, (Float) field);\n\t\t\t\t\t\tsqlPos++;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase DataType.DOUBLE:\n\t\t\t\t\t\tps.setDouble(sqlPos, (Double) field);\n\t\t\t\t\t\tsqlPos++;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase DataType.DATETIME:\n\t\t\t\t\t\tps.setTimestamp(sqlPos, new Timestamp(((DateTime) field).getMillis()));\n\t\t\t\t\t\tsqlPos++;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase DataType.BYTEARRAY:\n\t\t\t\t\t\tbyte[] b = ((DataByteArray) field).get();\n\t\t\t\t\t\tps.setBytes(sqlPos, b);\n\t\t\t\t\t\tsqlPos++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase DataType.CHARARRAY:\n\t\t\t\t\t\tps.setString(sqlPos, (String) field);\n\t\t\t\t\t\tsqlPos++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase DataType.BYTE:\n\t\t\t\t\t\tps.setByte(sqlPos, (Byte) field);\n\t\t\t\t\t\tsqlPos++;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase DataType.MAP:\n\t\t\t\t\tcase DataType.TUPLE:\n\t\t\t\t\tcase DataType.BAG:\n\t\t\t\t\t\tthrow new RuntimeException(\"Cannot store a non-flat tuple \"\n\t\t\t\t\t\t\t\t+ \"using DbStorage\");\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow new RuntimeException(\"Unknown datatype \"\n\t\t\t\t\t\t\t\t+ DataType.findType(field));\n\n\t\t\t\t\t}\n\n\t\t\t\t} catch (ExecException ee) {\n\t\t\t\t\tthrow new RuntimeException(ee);\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tps.addBatch();\n\t\t\tcount++;\n\t\t\tif (count > batchSize) {\n\t\t\t\tcount = 0;\n\t\t\t\tps.executeBatch();\n\t\t\t\tps.clearBatch();\n\t\t\t\tps.clearParameters();\n\t\t\t}\n\t\t} catch (SQLException e) {\n\t\t\ttry {\n\t\t\t\tlog\n\t\t\t\t.error(\"Unable to insert record:\" + tuple.toDelimitedString(\"\\t\"),\n\t\t\t\t\t\te);\n\t\t\t} catch (ExecException ee) {\n\t\t\t\t// do nothing\n\t\t\t}\n\t\t\tif (e.getErrorCode() == 1366) {\n\t\t\t\t// errors that come due to utf-8 character encoding\n\t\t\t\t// ignore these kind of errors TODO: Temporary fix - need to find a\n\t\t\t\t// better way of handling them in the argument statement itself\n\t\t\t} else {\n\t\t\t\tthrow new RuntimeException(\"JDBC error\", e);\n\t\t\t}\n\t\t}\n\t}", "private void getSavedDBValues() {\r\n boolean isSet[] = new boolean[12];\r\n for (int i = 0; i < 12; i++)\r\n isSet[i] = false;\r\n\r\n if (this.pl_DB.getParam(\"Hostname\") != null) {\r\n this.hostnameString = this.pl_DB.getParam(\"Hostname\");\r\n isSet[0] = true;\r\n } else\r\n this.hostnameString = hostnameString_default;\r\n if (this.pl_DB.getParam(\"Port\") != null) {\r\n try {\r\n this.portNr = Integer.parseInt(this.pl_DB.getParam(\"Port\"));\r\n } catch (NumberFormatException e) {\r\n this.portNr = portNr_default;\r\n }\r\n isSet[1] = true;\r\n } else\r\n this.portNr = portNr_default;\r\n if (this.pl_DB.getParam(\"Database\") != null) {\r\n this.databaseString = this.pl_DB.getParam(\"Database\");\r\n isSet[2] = true;\r\n } else\r\n this.databaseString = databaseString_default;\r\n if (this.pl_DB.getParam(\"Username\") != null) {\r\n this.usernameString = this.pl_DB.getParam(\"Username\");\r\n isSet[3] = true;\r\n } else\r\n this.usernameString = rusernameString_default;\r\n if (this.pl_DB.getParam(\"Password\") != null) {\r\n this.passwdString = this.pl_DB.getParam(\"Password\");\r\n } else\r\n this.passwdString = \"\";\r\n if (this.pl_DB.getParam(\"nodeTableName\") != null) {\r\n this.NodeTableString = this.pl_DB.getParam(\"nodeTableName\");\r\n isSet[4] = true;\r\n } else\r\n this.NodeTableString = nodeList_DBtable_default;\r\n if (this.pl_DB.getParam(\"nodeColIDName\") != null) {\r\n this.NodeIDColString = this.pl_DB.getParam(\"nodeColIDName\");\r\n isSet[5] = true;\r\n } else\r\n this.NodeIDColString = node_ids_DBcol_default;\r\n if (this.pl_DB.getParam(\"nodeColLabelName\") != null) {\r\n this.NodeLabelColString = this.pl_DB.getParam(\"nodeColLabelName\");\r\n isSet[6] = true;\r\n } else\r\n this.NodeLabelColString = node_labels_DBcol_default;\r\n if (this.pl_DB.getParam(\"edgeTableName\") != null) {\r\n this.EdgeTableString = this.pl_DB.getParam(\"edgeTableName\");\r\n isSet[7] = true;\r\n } else\r\n this.EdgeTableString = edgeList_DBtable_default;\r\n if (this.pl_DB.getParam(\"edgeCol1Name\") != null) {\r\n this.EdgeCo1String = this.pl_DB.getParam(\"edgeCol1Name\");\r\n isSet[8] = true;\r\n } else\r\n this.EdgeCo1String = edgeList_DBcol1_default;\r\n if (this.pl_DB.getParam(\"edgeCol2Name\") != null) {\r\n this.EdgeCol2String = this.pl_DB.getParam(\"edgeCol2Name\");\r\n isSet[9] = true;\r\n } else\r\n this.EdgeCol2String = edgeList_DBcol2_default;\r\n if (this.pl_DB.getParam(\"edgeColWeightName\") != null) {\r\n this.EdgeWeightColString = this.pl_DB.getParam(\"edgeColWeightName\");\r\n isSet[10] = true;\r\n } else\r\n this.EdgeWeightColString = edgeList_DBcolweight_default;\r\n if (this.pl_DB.getParam(\"resultTableName\") != null) {\r\n this.resultTableString = this.pl_DB.getParam(\"resultTableName\");\r\n isSet[11] = true;\r\n } else\r\n this.resultTableString = result_DBtable_default;\r\n\r\n for (int i = 0; i < 12; i++) {\r\n if (isSet[i])\r\n this.isDBValuesSet = true;\r\n else {\r\n this.isDBValuesSet = false;\r\n break;\r\n }\r\n }\r\n\r\n this.is_alg_started = false;\r\n this.is_already_read_from_DB = false;\r\n this.is_already_renumbered = false;\r\n }", "public static void bulkInsert(SQLiteDatabase db, ArrayList<NewsItemClass> newsItems) {\n\n db.beginTransaction();\n try {\n for (NewsItemClass a : newsItems) {\n ContentValues cv = new ContentValues();\n cv.put(COLUMN_NEWS_SOURCE, a.getnAuthor());\n cv.put(COLUMN_NEWS_AUTHOR, a.getnAuthor());\n cv.put(COLUMN_NEWS_TITLE, a.getnTitle());\n cv.put(COLUMN_NEWS_DESCRIPTION, a.getnDescription());\n cv.put(COLUMN_NEWS_URL, a.getnUrl());\n cv.put(COLUMN_NEWS_URL_TO_IMAGE, a.getnUrlToImage());\n cv.put(COLUMN_NEWS_PUBLISHED_AT, a.getnPublishedAt());\n db.insert(TABLE_NAME, null, cv);\n }\n db.setTransactionSuccessful();\n } finally {\n db.endTransaction();\n db.close();\n }\n }", "@Override void init(Element element) {\n String name = element.getTagName();\n if (name.equals(\"published\")) {\n this.published = element.getTextContent().trim();\n }\n else if (name.equals(\"content\")) {\n this.content = parseContent(element);\n }\n else {\n super.init(element);\n }\n }", "public static StringBuffer writeXML_DBFields(StringBuffer sb, int indent, DBField fld[], DBFieldValues fldVals, boolean soapXML)\n {\n for (int i = 0; i < fld.length; i++) {\n String name = fld[i].getName();\n String value = (fldVals != null)? fldVals.getFieldValueAsString(name) : null;\n DBFactory.writeXML_DBField(sb, indent, fld[i], false/*inclInfo*/, value, soapXML);\n }\n return sb;\n }", "private void parseAndPopulate(String in) {\r\n\t\tIParser parser = new AbbyyOCRDataParser(in);\r\n\t\tocrData = parser.parse();\r\n\t\tStore.addData(ocrData);\r\n\t\t\r\n\t\tEditText np = (EditText)findViewById(R.id.patient_et);\r\n\t\tEditText nm = (EditText)findViewById(R.id.medicine_et);\r\n\t\tEditText cd = (EditText)findViewById(R.id.consumption_et);\r\n\t\t\r\n\t\tPatient2Medicine p2m = ocrData.getPatient2Medicine();\r\n\t\tnp.setText(ocrData.getPatient().getName());\r\n\t\tnm.setText(ocrData.getMedicine().getMedicine());\r\n\t\tcd.setText(p2m.getFrequencyOfIntake()\r\n\t\t\t\t+ \" \" + p2m.getQuantityPerIntake() + \" by \" + p2m.getMode());\r\n\t\t\r\n\t}", "public NewsParamPanel() {\n initComponents();\n titleAnalyzer.setFieldName(\"TITLE\");\n dateAnalyzer.setFieldName(\"DATE\");\n sourceExtractor.setFieldName(\"SOURCENAME\");\n authorExtractor.setFieldName(\"AUTHOR\");\n commentsExtractor.setFieldName(\"COMMENT_COUNT\");\n clicksExtractor.setFieldName(\"CLICK_COUNT\");\n transmitExtractor.setFieldName(\"TRANSMIT_COUNT\");\n summaryExtractor.setFieldName(\"SUMMARY\");\n chnlExtractor.setFieldName(\"CHANNEL\");\n contentExtractor.setFieldName(\"CONTENT\");\n }", "@Override\r\n protected void setFieldValues (Object ... fields)\r\n {\n \r\n }", "@Override\n\tprotected void prepare() {\n\t\tfor(ProcessInfoParameter parameter :getParameter()){\n\t\t\tString name = parameter.getParameterName();\n\t\t\tif(parameter.getParameter() == null){\n\t\t\t\t;\n\t\t\t}else if(name.equals(\"XX_TipoRetencion\")){\n\t\t\t\tp_TypeRetention = (String) parameter.getParameter();\n\t\t\t}\n\t\t\telse if(name.equals(\"C_Invoice_From_ID\"))\n\t\t\t\tp_Invoice_From = parameter.getParameterAsInt();\t\n\t\t\telse if(name.equals(\"C_Invoice_To_ID\"))\n\t\t\t\tp_Invoice_To = parameter.getParameterAsInt();\t\n\t\t\telse if(name.equals(\"DateDoc\"))\n\t\t\t\tp_DateDoc = (Timestamp) parameter.getParameter();\t\t\n\t\t}\n\t}", "public void fromXml(Element e)\n throws PSUnknownNodeTypeException\n {\n // base class handling\n super.fromXml(e);\n\n //save state so we can restore when finished w/ updates\n int state = getState();\n\n setPosition(PSXMLDomUtil.checkAttributeInt(e, SEQUENCE_ATTR, false));\n\n //todo: ph - this is not safe\n // Read the field name from the primary key:\n m_strFieldName = getLocator().getPart(KEY_COL_FIELDNAME);\n\n PSXmlTreeWalker tree = new PSXmlTreeWalker(e);\n\n Element elOp = tree.getNextElement(XML_NODE_OPERATOR);\n tree.setCurrent(e);\n if (elOp == null)\n {\n Object[] args = {getNodeName(), XML_NODE_OPERATOR, \"null\"};\n throw new PSUnknownNodeTypeException(\n IPSObjectStoreErrors.XML_ELEMENT_INVALID_CHILD, args);\n }\n \n String op = PSXmlTreeWalker.getElementData(elOp);\n if (!isValidOperator(op))\n {\n Object[] args = {getNodeName(), XML_NODE_OPERATOR, op};\n throw new PSUnknownNodeTypeException(\n IPSObjectStoreErrors.XML_ELEMENT_INVALID_CHILD, args);\n }\n \n // this one is optional for backward compatibility\n Element extElOp = tree.getNextElement(XML_NODE_EXTOPERATOR);\n tree.setCurrent(e);\n String extOp = PSXmlTreeWalker.getElementData(extElOp); // empty if not found\n \n Element elFieldType = tree.getNextElement(XML_NODE_FIELDTYPE);\n tree.setCurrent(e);\n if (elFieldType == null)\n {\n Object[] args = {getNodeName(), XML_NODE_FIELDTYPE, \"null\"};\n throw new PSUnknownNodeTypeException(\n IPSObjectStoreErrors.XML_ELEMENT_INVALID_CHILD, args);\n }\n\n m_strFieldType = PSXmlTreeWalker.getElementData(elFieldType);\n\n if (!isValidFieldType(m_strFieldType))\n {\n Object[] args = {getNodeName(), XML_NODE_FIELDTYPE, m_strFieldType};\n throw new PSUnknownNodeTypeException(\n IPSObjectStoreErrors.XML_ELEMENT_INVALID_CHILD, args);\n }\n\n Element elFieldLabel = tree.getNextElement(XML_NODE_FIELDLABEL);\n tree.setCurrent(e);\n if (elFieldLabel == null)\n {\n Object[] args = {getNodeName(), XML_NODE_FIELDLABEL, \"null\"};\n throw new PSUnknownNodeTypeException(\n IPSObjectStoreErrors.XML_ELEMENT_INVALID_CHILD, args);\n }\n\n m_strDisplayName = PSXmlTreeWalker.getElementData(elFieldLabel);\n\n Element elFieldMnemonic = tree.getNextElement(XML_NODE_FIELDMNEMONIC);\n tree.setCurrent(e);\n if (elFieldMnemonic != null)\n setMnemonic(PSXmlTreeWalker.getElementData(elFieldLabel));\n\n // Optional\n Element elVal = tree.getNextElement(XML_NODE_FIELDVALUE);\n tree.setCurrent(e);\n\n List values = null;\n if (elVal != null)\n {\n String value = PSXmlTreeWalker.getElementData(elVal);\n if (null != value )\n {\n if (value.length() > 0)\n {\n values = PSStringOperation.getSplittedList(value, ',');\n }\n else\n values = new ArrayList();\n }\n }\n // method handles all cases\n setValues(op, extOp, values);\n\n Element elDesc = tree.getNextElement(XML_NODE_DESCRIPTION);\n tree.setCurrent(e);\n\n if (elDesc != null)\n m_strDescription = PSXmlTreeWalker.getElementData(elDesc);\n\n // optional keywords\n m_choices = null;\n Element elChoices = tree.getNextElement(PSDisplayChoices.XML_NODE_NAME);\n if (elChoices != null)\n m_choices = new PSDisplayChoices(elChoices);\n tree.setCurrent(e);\n\n //set state to match what it was in serialized object\n setState(state);\n }", "private void getData() {\n ArticleBean articleBean = new ArticleBean();\n articleBean.setTime(\"1月16日\");\n articleBean.setTitle(\"文章内容\");\n articleBean.setName(\"xzh\");\n mList.add(articleBean);\n mList.add(articleBean);\n mList.add(articleBean);\n }", "public static StringBuffer writeXML_DBFields(StringBuffer sb, int indent, DBField fld[], DBFieldValues fldVals)\n {\n return DBFactory.writeXML_DBFields(sb, indent, fld, fldVals, false);\n }", "private void fillFieldsList(List<String> lines, int numberOfFields) throws Exception {\n for (int index = 1; index < numberOfFields; index++) {\n String[] fieldTypes = lines.get(index).split(\" \");\n switch (fieldTypes[0]) {\n case \"property\":\n fields.add(new PropertyField());\n break;\n case \"service\":\n fields.add(new ServiceField(Integer.parseInt(fieldTypes[1])));\n break;\n case \"lucky\":\n fields.add(new LuckyField(Integer.parseInt(fieldTypes[1])));\n break;\n default:\n throw new Exception(\"No field defined for this board \");\n }\n }\n\n }", "private void populateFields() {\n if (mRowId != null) {\n Cursor reminder = mDbHelper.fetchReminder(mRowId);\n startManagingCursor(reminder);\n mTitleText.setText(reminder.getString(\n \t reminder.getColumnIndexOrThrow(RemindersDbAdapter.KEY_TITLE)));\n mBodyText.setText(reminder.getString(\n reminder.getColumnIndexOrThrow(RemindersDbAdapter.KEY_BODY)));\n \n\n // Get the date from the database and format it for our use. \n SimpleDateFormat dateTimeFormat = new SimpleDateFormat(DATE_TIME_FORMAT);\n Date date = null;\n\t\t\ttry {\n\t\t\t\tString dateString = reminder.getString(reminder.getColumnIndexOrThrow(RemindersDbAdapter.KEY_DATE_TIME)); \n\t\t\t\tdate = dateTimeFormat.parse(dateString);\n\t mCalendar.setTime(date); \n\t\t\t} catch (ParseException e) {\n\t\t\t\tLog.e(\"ReminderEditActivity\", e.getMessage(), e); \n\t\t\t} \n } else {\n \t// This is a new task - add defaults from preferences if set. \n \tSharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); \n \tString defaultTitleKey = getString(R.string.pref_task_title_key); \n \tString defaultTimeKey = getString(R.string.pref_default_time_from_now_key); \n \t\n \tString defaultTitle = prefs.getString(defaultTitleKey, null);\n \tString defaultTime = prefs.getString(defaultTimeKey, null); \n \t\n \tif(defaultTitle != null)\n \t\tmTitleText.setText(defaultTitle); \n \t\n \tif(defaultTime != null)\n \t\tmCalendar.add(Calendar.MINUTE, Integer.parseInt(defaultTime));\n \t\n }\n \n updateDateButtonText(); \n updateTimeButtonText(); \n \t\n }", "public FieldScrapper() \r\n {\r\n }", "private Map<String, Element> populate(URL url) \n\t{\n\t\t// LinkedHashMap maintains insertion order when iterating over the keys or elements.\n\t\tMap<String, Element> fields = new LinkedHashMap<String, Element>();\n\n\t\tpiseMarshaller = initPiseMarshaller(url);\n\t\tfor (String param : piseMarshaller.getExtendedVisibleSet())\n\t\t{\n\t\t\tif (userSupplied.keySet().contains(param))\n\t\t\t{\n\t\t\t\t//log.debug(\"user supplied \" + param + \" so not adding to this.parameters\");\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tString value = null;\n\t\t\tString type = piseMarshaller.getType(param);\n\n\t\t\t// Add the parameters of type InFile and Sequence with value = empty string to indicate that the user hasn't set a value (yet).\n\t\t\tif (type.equals(\"InFile\") || type.equals(\"Sequence\"))\n\t\t\t{\n\t\t\t\tfields.put(param, new Element(\"\", true, piseMarshaller.getType(param)));\n\t\t\t\t//log.debug(\"populate: \" + param + \"=''\");\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// If there is a default value for the param ...\n\t\t\tString vdef = piseMarshaller.getVdef(param);\n\t\t\tif (vdef != null)\n\t\t\t{\n\t\t\t\t// Get rid of leading and trailing quotes if any.\n\t\t\t\tvdef = vdef.trim();\n\t\t\t\tif (vdef.startsWith(\"\\\"\"))\n\t\t\t\t{\n\t\t\t\t\tvdef = vdef.replaceFirst(\"\\\"\", \"\");\n\t\t\t\t}\n\t\t\t\tif (vdef.endsWith(\"\\\"\"))\n\t\t\t\t{\n\t\t\t\t\tvdef = vdef.substring(0, vdef.length() - 1);\n\t\t\t\t}\n\t\t\t\tvalue = vdef;\n\t\t\t} else if (type != null && type.equals(\"Switch\"))\n\t\t\t{\n\t\t\t\tvalue = \"0\";\n\t\t\t} else\n\t\t\t{\n\t\t\t\tvalue = \"\";\n\t\t\t}\n\t\t\tfields.put(param, new Element(value, true, type));\n\t\t\t//log.debug(\"populate: \" + param + \"=\" + \"'\" + value + \"'\");\n\t\t}\n\t\treturn fields;\n\t}", "public void getData(fyiReporting.RDL.Report rpt, String xmlData, Fields flds, Filters f) throws Exception {\n Rows uData = this.getMyUserData(rpt);\n if (uData != null)\n {\n this.setMyData(rpt,uData);\n return ;\n }\n \n int fieldCount = flds.getItems().Count;\n XmlDocument doc = new XmlDocument();\n doc.PreserveWhitespace = false;\n doc.LoadXml(xmlData);\n XmlNode xNode = new XmlNode();\n xNode = doc.LastChild;\n if (xNode == null || !(StringSupport.equals(xNode.Name, \"Rows\") || StringSupport.equals(xNode.Name, \"fyi:Rows\")))\n {\n throw new Exception(\"Error: XML Data must contain top level rows.\");\n }\n \n Rows _Data = new Rows(rpt,null,null,null);\n List<Row> ar = new List<Row>();\n _Data.setData(ar);\n int rowCount = 0;\n for (Object __dummyForeachVar4 : xNode.ChildNodes)\n {\n XmlNode xNodeRow = (XmlNode)__dummyForeachVar4;\n if (xNodeRow.NodeType != XmlNodeType.Element)\n continue;\n \n if (!StringSupport.equals(xNodeRow.Name, \"Row\"))\n continue;\n \n Row or = new Row(_Data,fieldCount);\n for (Object __dummyForeachVar3 : xNodeRow.ChildNodes)\n {\n XmlNode xNodeColumn = (XmlNode)__dummyForeachVar3;\n Field fld = (Field)(flds.getItems()[xNodeColumn.Name]);\n // Find the column\n if (fld == null)\n continue;\n \n // Extraneous data is ignored\n TypeCode tc = fld.getqColumn() != null ? fld.getqColumn().getcolType() : fld.getType();\n if (xNodeColumn.InnerText == null || xNodeColumn.InnerText.Length == 0)\n or.getData()[fld.getColumnNumber()] = null;\n else if (tc == TypeCode.String)\n or.getData()[fld.getColumnNumber()] = xNodeColumn.InnerText;\n else\n {\n try\n {\n or.getData()[fld.getColumnNumber()] = Convert.ChangeType(xNodeColumn.InnerText, tc, NumberFormatInfo.InvariantInfo);\n }\n catch (Exception __dummyCatchVar2)\n {\n // all conversion errors result in a null value\n or.getData()[fld.getColumnNumber()] = null;\n }\n \n } \n }\n // Apply the filters\n if (f == null || f.apply(rpt,or))\n {\n or.setRowNumber(rowCount);\n //\n rowCount++;\n ar.Add(or);\n }\n \n }\n ar.TrimExcess();\n // free up any extraneous space; can be sizeable for large # rows\n if (f != null)\n f.applyFinalFilters(rpt,_Data,false);\n \n setMyData(rpt,_Data);\n }", "private void parseClass(Class<?> clazz,\n DBSerializationInfo serializationInfo)\n throws DBSerializationException {\n\n System.out.println(\"\\n\\nCurrent Class: \" + clazz);\n\n if (clazz.getName().equals(\n \"org.jutility.serialization.database.BaseProperty\")) {\n throw new NullPointerException();\n }\n\n // Class is an element type:\n // Retrieving database schema and table for this class.\n if (serializationInfo.isElementType()) {\n DBElementType typeAnnotation = clazz\n .getAnnotation(DBElementType.class);\n\n\n // System.out.println(\" Database Table: \" +\n // typeAnnotation.table());\n serializationInfo.setTable(typeAnnotation.table());\n\n\n for (String parameter : typeAnnotation.constructorParameters()) {\n\n serializationInfo.getConstructorParameters().add(parameter);\n\n }\n // System.out.println(\"ConstructorParameters: \"\n // + serializationInfo.getConstructorParameters());\n }\n // Class is a value type:\n // Retrieving database schema and table for this class.\n else if (serializationInfo.isValueType()) {\n\n // System.out.println(\" VALUE TYPE \");\n\n DBValueType typeAnnotation = clazz.getAnnotation(DBValueType.class);\n\n for (String parameter : typeAnnotation.constructorParameters()) {\n\n serializationInfo.getConstructorParameters().add(parameter);\n }\n\n }\n\n\n // Retrieving all fields defined in this class.\n // This does not include any inherited fields.\n // Fields are ideally only used as fall-back.\n List<Field> fields = Arrays.asList(clazz.getDeclaredFields());\n\n if (fields.size() == 0) {\n // System.out.println(\" Class \" + clazz.getName()\n // + \" doesn't have fields\");\n }\n else {\n // System.out.println(\" Fields:\");\n // Parsing fields.\n this.parseFields(fields, serializationInfo);\n }\n\n\n // Retrieving all methods defined in this class.\n // This does not include any inherited methods.\n // Methods (getters/setters) are preferred to field access.\n List<Method> methods = Arrays.asList(clazz.getDeclaredMethods());\n\n if (methods.size() == 0) {\n // System.out.println(\" Class \" + clazz.getName()\n // + \" doesn't have methods\");\n }\n else {\n // System.out.println(\" Methods:\");\n // Parsing methods.\n this.parseMethods2(methods, serializationInfo);\n }\n }", "@Override\n\tpublic void postParse() {\n\t}", "@Override\n\tpublic void postParse() {\n\t}", "void fillDatabase() {\n Type.type( \"FOOD\" );\n Type.type( \"HOT\" );\n Type.type( \"SNACK\" );\n }", "public void parse() throws XMLStreamException {\n\t\tInputStream dictStream = ClassLoader.getSystemResourceAsStream(fixFileName);\n\t\tXMLStreamReader reader = factory.createXMLStreamReader(dictStream);\n\t\tString curFieldName = \"\";\n\t\twhile (reader.hasNext()) {\n\t\t\tint event = reader.next();\n\t\t\tswitch (event) {\n\t\t\tcase XMLStreamConstants.START_ELEMENT:\n\t\t\t\tString elementName = reader.getLocalName();\n\t\t\t\telementNames.add(elementName);\n\t\t\t\tif (\"fields\".equals(elementName)) {\n\t\t\t\t\tisFieldsElement = true;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (\"field\".equals(elementName) && isFieldsElement) {\n\t\t\t\t\tString num = reader.getAttributeValue(null, \"number\");\n\t\t\t\t\tcurFieldName = reader.getAttributeValue(null, \"name\");\n\t\t\t\t\tFieldParser.logger.info(num + \", \" + curFieldName);\n\t\t\t\t\t// Integer tagNumber = Integer.parseInt(num);\n\t\t\t\t\ttagNameToNumber.put(curFieldName, num);\n\t\t\t\t\ttagNumberToName.put(num, curFieldName);\n\t\t\t\t\tMap<String, String> tagValueToTagValueDesc = tagNameToTagValueDesc.get(curFieldName);\n\t\t\t\t\tif (tagValueToTagValueDesc == null) {\n\t\t\t\t\t\ttagValueToTagValueDesc = new ConcurrentHashMap<>();\n\t\t\t\t\t\ttagNameToTagValueDesc.put(curFieldName, tagValueToTagValueDesc);\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (\"value\".equals(elementName) && !\"\".equals(curFieldName)) {\n\t\t\t\t\tMap<String, String> tagValueToTagValueDesc = tagNameToTagValueDesc.get(curFieldName);\n\t\t\t\t\tString enumNum = reader.getAttributeValue(null, \"enum\");\n\t\t\t\t\tString enumDesc = reader.getAttributeValue(null, \"description\");\n\t\t\t\t\ttagValueToTagValueDesc.put(enumNum, enumDesc);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase XMLStreamConstants.END_ELEMENT:\n\t\t\t\telementName = reader.getLocalName();\n\t\t\t\tif (\"fields\".equals(elementName)) {\n\t\t\t\t\tisFieldsElement = false;\n\t\t\t\t\tcurFieldName = \"\";\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t\treader.close();\n\t}", "@Override\n\tpublic void endElement(String uri, String localName, String qName) throws SAXException {\n\n\t\tif (localName.equalsIgnoreCase(\"title\")){\n if (currentArticle.getTitle() != null && currentArticle.getGuid() != null) {\n articleList.add(currentArticle);\n\n currentArticle = new Article();\n\n }\n currentArticle.setTitle(chars.toString());\n\t\t} else if (localName.equalsIgnoreCase(\"guid\")){\n currentArticle.setGuid(chars.toString());\n\t\t} else if (localName.equalsIgnoreCase(\"description\")){\n currentArticle.setDescription(chars.toString());\n\t\t} else if (localName.equalsIgnoreCase(\"url\")){\n try {\n currentArticle.setUrl(new URL(chars.toString()));\n } catch (MalformedURLException e) {\n e.printStackTrace();\n }\n } else if (localName.equalsIgnoreCase(\"pubDate\")){\n currentArticle.setPubDate(chars.toString());\n\t\t} else if (localName.equalsIgnoreCase(\"author\")){\n currentArticle.setAuthor(chars.toString());\n\t\t}\n\t}", "@Override\n\tpublic void addPost(Scanner sc) {\n\t\tPost p = new Post();\n\t\tp.setMemberId(cur.getId());\n\t\tsc.nextLine();\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.insertPost(p);\n\t}", "int insert(WxNews record);", "private void save_items(Connection connection, String table_name, String[] columns,\r\n int url_id, LinkedList<String> values) throws SQLException{\r\n \r\n PreparedStatement prep_state = create_prepared_insert(connection, table_name, columns);\r\n Iterator values_it = values.iterator();\r\n \r\n int counter = 1;\r\n while(values_it.hasNext()){\r\n String word = (String) values_it.next();\r\n String[] storing_values = {Integer.toString(url_id), word};\r\n set_strings(prep_state, storing_values);\r\n \r\n prep_state.addBatch();\r\n \r\n if(counter % batch_limit == 0){\r\n prep_state.executeBatch();\r\n }\r\n }\r\n \r\n prep_state.executeBatch();\r\n \r\n close_prepared_statement(prep_state);\r\n }", "public ResultObject bulkInsert(List<String> logList)throws ParserException;", "@SuppressWarnings(\"deprecation\")\n\tpublic void writeTable()\n\t{\n\t\tIterator<WPPost> itr = readValues.iterator();\n\t\t\n\t\twhile(itr.hasNext())\n\t\t{\n\t\t\tWPPost post = itr.next();\n\t\t\tPreparedStatement prStm;\n\t\t\tint res = 0;\n\t\t\t\n\t\t\ttry \n\t\t\t{\n\t\t\t\tif(post.getPostDateGMT() == null)\n\t\t\t\t{\n\t\t\t\t\tpost.setPostDateGMT(new Timestamp(0));\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(post.getPostModifiedGMT() == null)\n\t\t\t\t{\n\t\t\t\t\tpost.setPostModifiedGMT(new Timestamp(0));\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tprStm = conn.prepareStatement(WRITE_STATEMENT);\n\t\t\t\tprStm.setInt(1, post.getId());\n\t\t\t\tprStm.setInt(2, post.getPostAuthor());\n\t\t\t\tprStm.setTimestamp(3, post.getPostDate());\n\t\t\t\tprStm.setTimestamp(4, post.getPostDateGMT());\n\t\t\t\tprStm.setString(5, post.getPostContent());\n\t\t\t\tprStm.setString(6, post.getPostTitle());\n\t\t\t\tprStm.setString(7, post.getPostExcerpt());\n\t\t\t\tprStm.setString(8, post.getPostStatus());\n\t\t\t\tprStm.setString(9, post.getCommentStatus());\n\t\t\t\tprStm.setString(10, post.getPingStatus());\n\t\t\t\tprStm.setString(11, post.getPostPassword());\n\t\t\t\tprStm.setString(12, post.getPostName());\n\t\t\t\tprStm.setString(13, post.getToPing());\n\t\t\t\tprStm.setString(14, post.getPinged());\n\t\t\t\tprStm.setTimestamp(15, post.getPostModified());\n\t\t\t\tprStm.setTimestamp(16, post.getPostModifiedGMT());\n\t\t\t\tprStm.setString(17, post.getPostContentFiltered());\n\t\t\t\tprStm.setInt(18, post.getPostParent());\n\t\t\t\tprStm.setString(19, post.getGuid());\n\t\t\t\tprStm.setInt(20, post.getMenuOrder());\n\t\t\t\tprStm.setString(21, post.getPostType());\n\t\t\t\tprStm.setString(22, post.getPostMimeType());\n\t\t\t\tprStm.setInt(23, post.getCommentCount());\n\t\t\t\t\n\t\t\t\tres = prStm.executeUpdate();\n\t\t\t\t\n\t\t\t\tif(res == 0)\n\t\t\t\t{\n\t\t\t\t\ttry \n\t\t\t\t\t{\n\t\t\t\t\t\tthrow new WriteWPPostException(post.toString());\n\t\t\t\t\t} \n\t\t\t\t\tcatch (WriteWPPostException e) \n\t\t\t\t\t{\n\t\t\t\t\t\t//e.printStackTrace(); // TODO Debug Mode! Delete This!\n\t\t\t\t\t\tthis.rowsWithErrors.add(post);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} \n\t\t\tcatch (SQLException e1) \n\t\t\t{\n\t\t\t\t//e1.printStackTrace(); // TODO Debug Mode! Delete This!\n\t\t\t\tthis.rowsWithErrors.add(post);\n\t\t\t}\n\t\t}\n\t}", "Plist()\n {\n m_dateFormat = new SimpleDateFormat(\"yyyy-MM-dd'T'HH:mm:ss'Z'\");\n m_dateFormat.setTimeZone(TimeZone.getTimeZone(\"Z\"));\n m_simpleTypes = new HashMap<Class<?>, ElementType>();\n m_simpleTypes.put(Integer.class, ElementType.INTEGER);\n m_simpleTypes.put(Byte.class, ElementType.INTEGER);\n m_simpleTypes.put(Short.class, ElementType.INTEGER);\n m_simpleTypes.put(Short.class, ElementType.INTEGER);\n m_simpleTypes.put(Long.class, ElementType.INTEGER);\n m_simpleTypes.put(String.class, ElementType.STRING);\n m_simpleTypes.put(Float.class, ElementType.REAL);\n m_simpleTypes.put(Double.class, ElementType.REAL);\n m_simpleTypes.put(byte[].class, ElementType.DATA);\n m_simpleTypes.put(Boolean.class, ElementType.TRUE);\n m_simpleTypes.put(Date.class, ElementType.DATE);\n }", "private void insertData() {\r\n PodamFactory factory = new PodamFactoryImpl();\r\n for (int i = 0; i < 3; i++) {\r\n MonitoriaEntity entity = factory.manufacturePojo(MonitoriaEntity.class);\r\n\r\n em.persist(entity);\r\n data.add(entity);\r\n }\r\n }", "@Override\r\n\tpublic void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException{\t\t\r\n\t\tif(qName.equalsIgnoreCase(\"Study\")) {\r\n\t\t\tString id=attributes.getValue(\"id\");\t\t\t\r\n\t\t\t//initialize Study object and set ID attribute\r\n\t\t\tstudy=new Study();\r\n\t\t\tstudy.setStudyID(id);\r\n\t\t\tbStudyName=true;\t\t\t\r\n\t\t}\r\n\t\telse if(qName.equalsIgnoreCase(\"Reading\")) {\r\n\t\t\tString type=attributes.getValue(\"type\");\r\n\t\t\tString id=attributes.getValue(\"id\");\r\n\t\t\t\r\n\t\t\t//initialize item object and set ID and Type attributes\r\n\t\t\titem = new Item();\r\n\t\t\titem.setReadingID(id);\r\n\t\t\titem.setReadingType(type);\r\n\t\t\t\r\n\t\t\t//initialize list\r\n\t\t\tif(itemList==null) {\r\n\t\t\t\titemList=new ArrayList<>();\r\n\t\t\t}\t\t\t\r\n\t\t}\r\n\t\telse if (qName.equalsIgnoreCase(\"Value\")) {\r\n\t\t\t//Set boolean values for fields, will be used in setting Item variables\r\n\t\t\tString unit=attributes.getValue(\"unit\");\r\n\t\t\titem.setUnit(unit);\r\n\t\t\tbReadingValue=true;\r\n\t\t}\r\n\t\telse if(qName.equalsIgnoreCase(\"Site\")) {\r\n\t\t\tbSiteID=true;\r\n\t\t}\r\n\t\t\r\n\t\t//create a data container\r\n\t\tstringBuilder=new StringBuilder();\r\n\t}", "int insert(PmPost record);", "public FillTableParser(DbBase db) {\n\t\tthis.db = db;\n\t}", "private void parseResponse(String response, List<NewsDetailItem> items) {\n\n Pattern pText = Pattern.compile(ITEM_TEXT_PREF + \".*?\" + ITEM_TEXT_POSTF);\n Pattern pTitle = Pattern.compile(TITLE_PREF + \".*?\" + TITLE_POSTF);\n Pattern pDate = Pattern.compile(\"class=\\\"metadata\\\">.*?</a>\");\n Pattern pDate2 = Pattern.compile(\"</strong>.*?<\");\n\n Pattern pImage2 = Pattern.compile(IMG_PREF + \".*?\" + IMG_POSTF);\n\n Pattern pVideo = Pattern.compile(VIDEO_PREF + \".*?\" + VIDEO_POSTF);\n\n Pattern pImageUrl = Pattern.compile(IMG_URL_PREF + \".*?\" + IMG_URL_POSTF);\n\n Pattern pComment = Pattern.compile(\"li class=\\\" item\\\" id=\\\"comment.*?</li>\");\n Pattern pAuthor = Pattern.compile(\"class=\\\"commentauthor\\\".*?</span>\");\n\n Pattern pAuthorName1 = Pattern.compile(\"'>.*?</span>\");\n Pattern pAuthorName2 = Pattern.compile(\"/>.*?</span>\");\n Pattern pAuthorImage = Pattern.compile(AUTHOR_IMAGE_PREF + \".*?\" + AUTHOR_IMAGE_POSTF);\n\n Pattern pCommentText = Pattern.compile(\"<span id=\\\"co_.*?</li>\");\n Pattern pCommentId = Pattern.compile(COMMENT_ID_PREFIX + \".*?\" + COMMENT_ID_POSTFIX);\n\n Pattern pCommentTex2t = Pattern.compile(\"dislike-counter.*?comment-toolbar\"); //Pattern.compile(COMMENT_PREFIX + \".*?\" + COMMENT_POSTFIX);\n Pattern pCommentText3 = Pattern.compile(COMMENT_PREFIX + \".*?\" + COMMENT_POSTFIX);\n Pattern pThumbsDown = Pattern.compile(\"dislike-counter-comment.*?</span>\");\n Pattern pThumbsUp = Pattern.compile(\"like-counter-comment.*?</span>\");\n Pattern pThumb2 = Pattern.compile(THUMB_PREF + \".*?\" + THUMB_POSTF);\n\n Pattern pCommentDate = Pattern.compile(COMMENTDATE_PREF + \".*?\" + COMMENTDATE_POSTF);\n Pattern pWidth = Pattern.compile(WIDTH_PREF + \".*?\" + WIDTH_POSTF);\n Pattern pHeight = Pattern.compile(HEIGHT_PREF + \".*?\" + HEIGHT_POSTF);\n\n Pattern pAkismet = Pattern.compile(\"vortex_ajax_comment\"+\".*?\"+\";\");\n\n Pattern pAkismet2 = Pattern\n .compile(\"\\\"nonce\\\":\\\".*?\"+\"\\\"\");\n\n Pattern pValue = Pattern.compile(\"value=\\\".*?\\\"\");\n\n Pattern pAk_js = Pattern\n .compile(\"id=\\\"ak_js\\\".*?/>\");\n\n\n String akismet = \"\";\n String ak_js = \"\";\n String postId = \"\";\n Matcher makismet_comment = pAkismet.matcher(response);\n if (makismet_comment.find()) {\n Matcher mvalue = pAkismet2.matcher(makismet_comment.group());\n if (mvalue.find()) {\n akismet = mvalue.group();\n akismet = akismet.replace(\"\\\"\", \"\");\n akismet = akismet.replace(\"nonce:\", \"\");\n }\n }\n\n Matcher mak_js = pAk_js.matcher(response);\n if (mak_js.find()) {\n Matcher mvalue = pValue.matcher(mak_js.group());\n if (mvalue.find()) {\n ak_js = mvalue.group();\n ak_js = ak_js.replace(\"\\\"\", \"\");\n ak_js = ak_js.replace(\"value=\", \"\");\n }\n }\n\n\n Pattern ppost_id = Pattern.compile(\"name=\\\"comment_post_ID\\\".*?/>\");\n Matcher mpost_id = ppost_id.matcher(response);\n if (mpost_id.find()) {\n Matcher mvalue = pValue.matcher(mpost_id.group());\n if (mvalue.find()) {\n postId = mvalue.group();\n postId = postId.replace(\"\\\"\", \"\");\n postId = postId.replace(\"value=\", \"\");\n }\n }\n\n Matcher itemMatcher;\n itemMatcher = pDate.matcher(response);\n String date = \"\";\n if (itemMatcher.find()) {\n itemMatcher = pDate2.matcher(itemMatcher.group());\n if (itemMatcher.find()) {\n date = itemMatcher.group().substring(10);\n date = date.substring(0, date.length() - 2);\n }\n }\n\n Matcher mTitle = pTitle.matcher(response);\n if (mTitle.find()) {\n String itemText = mTitle.group().substring(TITLE_PREF.length()); //(\" dc:title=\\\"\".length()).replace(\"\\\"\", \"\");\n itemText = itemText.substring(0, itemText.length() - TITLE_POSTF.length());\n NewsDetailItem item = new NewsDetailItem();\n item.setText(itemText);\n item.setDate(date);\n item.setContentType(NewsDetailDBHelper.NewsItemType.TITLE.ordinal());\n item.setPostUrl(mUrl);\n item.setCommentId(postId);\n item.setAkismet(akismet);\n item.setAk_js(ak_js);\n items.add(item);\n }\n\n Matcher mText = pText.matcher(response);\n int imageEnd = 0;\n int textStart;\n\n if (mText.find()) {\n String text = mText.group().substring(ITEM_TEXT_PREF.length());\n text = text.substring(0, text.length() - ITEM_TEXT_POSTF.length());\n Matcher mImage = pImage2.matcher(text);\n while (mImage.find()) {\n int textEnd = mImage.start();\n textStart = imageEnd;\n imageEnd = mImage.end();\n String itemText = text.substring(textStart, textEnd);\n addTextItem(items, itemText);\n processImageItem(items, mImage.group(), pImageUrl, pWidth, pHeight);\n }\n\n Matcher mVideo = pVideo.matcher(text);\n while (mVideo.find()) {\n int textEnd = mVideo.start();\n textStart = imageEnd;\n imageEnd = mVideo.end();\n String itemText = \"\";\n if (textEnd >= textStart) {\n itemText = text.substring(textStart, textEnd);\n }\n addTextItem(items, itemText);\n processVideoItem(items, mVideo.group(), pImageUrl, pWidth, pHeight);\n }\n\n text = text.substring(imageEnd);\n addTextItem(items, text);\n }\n\n\n NewsDetailItem item = new NewsDetailItem();\n item.setContentType(NewsDetailDBHelper.NewsItemType.REPLY_HEADER.ordinal());\n item.setPostUrl(mUrl);\n items.add(item);\n\n Matcher mComment = pComment.matcher(response);\n while (mComment.find()) {\n item = new NewsDetailItem();\n item.setContentType(NewsDetailDBHelper.NewsItemType.REPLY.ordinal());\n item.setPostUrl(mUrl);\n items.add(item);\n item.setAkismet(akismet);\n String comment = mComment.group();\n\n // if (comment.contains(CAN_CHANGE_KARMA_PREFIX)) {\n item.setCanChangeKarma(1);\n // } else {\n // item.setCanChangeKarma(0);\n // }\n\n Matcher mAuthor = pAuthor.matcher(comment);\n if (mAuthor.find()) {\n String authorText = mAuthor.group();\n item.setAuthorImage(getAuthorImgage(authorText, pAuthorImage));\n item.setAuthor(getAuthorName(authorText, pAuthorName1, pAuthorName2));\n }\n Matcher mCommentText = pCommentText.matcher(comment);\n if (mCommentText.find()) {\n String s = mCommentText.group();\n mCommentText = pCommentTex2t.matcher(s);\n if (mCommentText.find()) {\n mCommentText = pCommentText3.matcher(mCommentText.group());\n if (mCommentText.find()) {\n String commentText = mCommentText.group().substring(COMMENT_PREFIX.length());\n commentText = commentText.substring(0, commentText.length() - COMMENT_POSTFIX.length());\n commentText = commentText.replace(\"<p>\", \"\");\n commentText = commentText.replace(\"</p>\", \"\");\n item.setText(commentText);\n }\n }\n }\n Matcher mCommentId = pCommentId.matcher(comment);\n if (mCommentId.find()) {\n String commentId = mCommentId.group().substring(COMMENTDATE_PREF.length());\n commentId = commentId.substring(0, commentId.length() - COMMENT_ID_POSTFIX.length());\n item.setCommentId(commentId);\n }\n Matcher mCommentDate = pCommentDate.matcher(comment);\n if (mCommentDate.find()) {\n String commentDate = mCommentDate.group().substring(COMMENTDATE_PREF.length());\n commentDate = commentDate.substring(0, commentDate.length() - COMMENTDATE_POSTF.length());\n item.setDate(commentDate);\n }\n item.setKarmaUp(getKarma(comment, pThumbsUp, pThumb2));\n item.setkarmaDown(getKarma(comment, pThumbsDown, pThumb2));\n }\n }", "@Insert({\n \"insert into NEWS (NEWS_ID, TITLE, \",\n \"BODY, IMG_URL, URL, \",\n \"CREATE_TIME)\",\n \"values (#{newsId,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, \",\n \"#{body,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, \",\n \"#{createTime,jdbcType=TIMESTAMP})\"\n })\n int insert(News record);", "void populateData();", "private void addSomeItemsToDB () throws Exception {\n/*\n Position pos;\n Course course;\n Ingredient ing;\n\n PositionDAO posdao = new PositionDAO();\n CourseDAO coursedao = new CourseDAO();\n IngredientDAO ingdao = new IngredientDAO();\n\n ing = new Ingredient(\"Mozzarella\", 10,30);\n ingdao.insert(ing);\n\n // Salads, Desserts, Main course, Drinks\n pos = new Position(\"Pizza\");\n posdao.insert(pos);\n\n course = new Course(\"Salads\", \"Greek\", \"Cucumber\", \"Tomato\", \"Feta\");\n coursedao.insert(course);\n\n ing = new Ingredient(\"-\", 0,0);\n ingdao.insert(ing);\n */\n }", "public void duplicateAndInsertElements() {\n\t\t\n\t\tif (highlightedFields.isEmpty()) return;\n\t\t\n\t\t// highlighted fields change while adding. Make a copy first\n\t\tArrayList<XmlNode> tempArray = new ArrayList<XmlNode>(highlightedFields);\n\t\t\n\t\tcopyAndInsertElements(tempArray);\n\t}", "private void createData() {\n//\n// tour = new Tour();\n// tour.setTitle(\"Death Valley\");\n// tour.setDescription(\"A tour to Death Valley\");\n// tour.setPrice(900);\n// tour.setImage(\"death_valley\");\n// tour = dataSource.create(tour);\n// Log.i(LOGTAG, \"Tour created with id \" + tour.getId());\n//\n// tour = new Tour();\n// tour.setTitle(\"San Francisco\");\n// tour.setDescription(\"A tour to San Francisco\");\n// tour.setPrice(1200);\n// tour.setImage(\"san_francisco\");\n// tour = dataSource.create(tour);\n// Log.i(LOGTAG, \"Tour created with id \" + tour.getId());\n\n ToursPullParser parser = new ToursPullParser();\n tours = parser.parseXML(this);\n\n for (Tour tour : tours) {\n dataSource.create(tour);\n }\n\n }", "@SuppressWarnings(\"rawtypes\")\n\tpublic void buildFieldDetails(List elements) throws Exception {\n\t\tFieldBuilder.getInstance(configuration, writer.getClassDoc(),\n\t\t\t\tconfiguration.getWriterFactory().getFieldWriter(writer)).build(elements);\n\t}", "private void insertTableValues(SQLFormater dbCreatorSQLFormater, String[] fields, String[][] values) {\n for(int j = 0; j < values.length; j++)\n {\n String[] rowValues = values[j]; // get massive with all values of current row\n for (int i = 0; i < fields.length; i++) {\n String fieldName = fields[i]; // current field name\n String currentValue = rowValues[i]; // current value\n dbCreatorSQLFormater.insertValue(fieldName, currentValue);\n }\n dbConnection.execute(dbCreatorSQLFormater.getValuesToInsert(j+1)); // inserting values of current row into data base, starting from 1\n }\n }", "void fill(Row row) {\n if (row == null) return;\n for (Column column : getColumns()) {\n String name = column.getName();\n Object value = row.get(name);\n Classes.setFieldValue(this, name, value);\n }\n }", "public static void processFeed(FeedContext fc, Feed feed) {\n try {\n\t\t\tAbderaAtomParser parser = new AbderaAtomParser(feed);\n\t\t\tparser.persistFeed(fc);\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\tmLog.error(\"Error processing feed at [\" + fc.getFeedUrl() + \"]: \" + e.getMessage());\n\t\t}\n }", "protected abstract DBObject parse(InputStream is) throws DeserializationException;", "public void save()\n\t{\t\n\t\tfor (Preis p : items) {\n\t\t\titmDAO.create(p.getItem());\n\t\t\tprcDAO.create(p);\n\t\t}\n\t\tstrDAO.create(this);\n\t}", "public void postParse() \r\n\t{\n\t\tcolumnMap = new HashMap<String, ColumnDefinition>();\r\n\t\t\r\n\t\tfor (ColumnDefinition def : getColumns())\r\n\t\t{\r\n\t\t\tcolumnMap.put(def.getName(), def);\r\n\t\t}\r\n\t\t\r\n\t\tfor (ColumnDefinition def : getColumns())\r\n\t\t{\r\n\t\t\tdef.postParse();\r\n\t\t}\r\n\t}" ]
[ "0.61580324", "0.5749993", "0.54414856", "0.5254157", "0.5201817", "0.51893395", "0.5069257", "0.50674003", "0.50623953", "0.5042099", "0.50344926", "0.50231296", "0.501948", "0.49955225", "0.49757916", "0.49554634", "0.49366093", "0.49243394", "0.49241367", "0.48519573", "0.485178", "0.48218456", "0.4821038", "0.4787621", "0.4784661", "0.47752696", "0.4770199", "0.476141", "0.47476408", "0.47104478", "0.47096694", "0.47092474", "0.47032428", "0.46970809", "0.4691107", "0.4679525", "0.46559912", "0.46399564", "0.46262404", "0.46214005", "0.46205056", "0.46165875", "0.46113235", "0.46014628", "0.45949036", "0.45935783", "0.45923918", "0.45852688", "0.45838016", "0.45808327", "0.4580221", "0.45639694", "0.4561224", "0.45561835", "0.45490333", "0.45403272", "0.4532722", "0.45195198", "0.45194054", "0.45182192", "0.45146722", "0.45120892", "0.45113572", "0.45085394", "0.45069376", "0.45021215", "0.4500031", "0.44888476", "0.4484511", "0.4482336", "0.4482028", "0.44737536", "0.44694045", "0.44694045", "0.4462243", "0.44620803", "0.44590813", "0.4441606", "0.44379085", "0.44361946", "0.44340518", "0.44331637", "0.44327432", "0.4431069", "0.44294518", "0.44284505", "0.44283533", "0.44206306", "0.44131735", "0.44102734", "0.44100168", "0.4407361", "0.4405334", "0.44027004", "0.43973547", "0.4395427", "0.4386569", "0.4385969", "0.43857697", "0.43810856" ]
0.5708017
2
/ / Insert the parsed RSS fields (Channel Specifics) to DB. / / Class containing all parsed values for channel specific data
public int InsertChannelDetails(RSSChannelElements ChannelElements) throws java.sql.SQLException { String SQLQuery = "INSERT INTO tbl_ex_channeldetails " + " (SourceID, AuthorName, Language, PublishedDate, WebMaster, LastBuildDate, ManagingEditor, Generator, Description) " + " SELECT " + " ?, ?, ?, ?, ?, ?, ?, ?, ? " + " WHERE NOT EXISTS " + " (SELECT SourceID, Language, Description FROM tbl_ex_channeldetails " + " WHERE" + " SourceID = ? " + " AND Language = ? " + " AND Description = ?)" + " SELECT MAX(ChannelID) as channelID FROM tbl_ex_channeldetails WHERE SourceID = ?"; PreparedStatement InsertQuery = DBAction.con.prepareStatement(SQLQuery); InsertQuery.setInt(1, SourceID); InsertQuery.setString(2, ChannelElements.Author); InsertQuery.setString(3, ChannelElements.Language); if(ChannelElements.PublishedDate != null) InsertQuery.setTimestamp(4, new java.sql.Timestamp(ChannelElements.PublishedDate.getTime())); else InsertQuery.setNull(4, Types.DATE); InsertQuery.setString(5, ChannelElements.webMaster); if(ChannelElements.LastBuildDate != null) InsertQuery.setTimestamp(6, new java.sql.Timestamp(ChannelElements.LastBuildDate.getTime())); else InsertQuery.setNull(6, Types.DATE); InsertQuery.setString(7, ChannelElements.managingEditor); InsertQuery.setString(8, ChannelElements.Generator); InsertQuery.setString(9, ChannelElements.Description); InsertQuery.setInt(10, SourceID); InsertQuery.setString(11, ChannelElements.Language); InsertQuery.setString(12, ChannelElements.Description); InsertQuery.setInt(13, SourceID); ResultSet rs = InsertQuery.executeQuery(); int ChannelID = 0; while(rs.next()){ ChannelID = rs.getInt("channelID"); //IDTable } System.out.println("ChannelID IST: " + ChannelID); return ChannelID; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void ParseRSS(URL feedUrl) throws com.rometools.rome.io.FeedException, java.io.IOException {\n //TODO: EVERY THING HERE SHOULD BE IN A TRANSACTION\n List<String> HashFields = new ArrayList<>();\n SyndFeedInput input = new SyndFeedInput();\n SyndFeed feed = input.build(new XmlReader(feedUrl));\n RSSChannelElements ChannelElements = new RSSChannelElements();\n Date CurrentDate = new Date();\n SimpleDateFormat SDF = new java.text.SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss.SSS\");\n //GET ADDITIONAL PROPERTIES OF THE CHANNEL\n //GET CHANNEL AUTHOR\n String ch_author = feed.getAuthor();\n ChannelElements.Author = ch_author;\n //GET PUBLISHED DATE\n Date ch_PubDate = feed.getPublishedDate();\n ChannelElements.PublishedDate = ch_PubDate;\n //GET LANGUAGE\n String ch_Language = feed.getLanguage();\n ChannelElements.Language = ch_Language;\n //GET WEBMASTER\n String ch_WebMaster = feed.getWebMaster();\n ChannelElements.webMaster = ch_WebMaster;\n //GET MANAGING EDITOR\n String ch_ME = feed.getManagingEditor();\n ChannelElements.managingEditor = ch_ME;\n //GET GENERATOR\n String ch_generator = feed.getGenerator();\n ChannelElements.Generator = ch_generator;\n //GET DESCRIPTION\n String ch_description = feed.getDescription();\n ChannelElements.Description = ch_description;\n int CurrentChannelID = 0;\n //TODO: DO THIS IN A STORED PROCEDURE\n try\n {\n TimeValidations ValidateTime = new TimeValidations();\n if (ValidateTime.IsWithinValidWindow(CurrentDate, ch_PubDate, ReadInterval))\n {\n //INSERT TO DB THE CHANNEL DETAILS\n CurrentChannelID = InsertChannelDetails(ChannelElements);\n }\n }\n catch(java.sql.SQLException exp)\n {\n String message = exp.getMessage();\n System.out.println(message);\n }\n\n\n //GET ELEMENTS FROM THE \"ITEMS\"\n List entries = feed.getEntries();\n Iterator it = entries.iterator();\n while (it.hasNext()) {\n RSSFields RssFieldValues = new RSSFields();\n SyndEntry entry = (SyndEntry) it.next();\n //GET TITLE\n System.out.println(entry.getTitle());\n String Title = entry.getTitle();\n RssFieldValues.Title = Title;\n //HashFields.add(Title);\n //GET LINK\n System.out.println(entry.getLink());\n RssFieldValues.Link = entry.getLink();\n HashFields.add(RssFieldValues.Link);\n //GET DESCRIPTION\n SyndContent description = entry.getDescription();\n System.out.println(description.getValue());\n RssFieldValues.Description = description.getValue();\n //HashFields.add(description.getValue());\n //GET PUBLISHED DATE\n Date Pub_Date = entry.getPublishedDate();\n System.out.println(SDF.format(Pub_Date));\n RssFieldValues.PublishedDate = entry.getPublishedDate();\n //GET UPDATED DATE\n Date U_date = entry.getUpdatedDate();\n System.out.println(U_date);\n RssFieldValues.UpdatedDate = entry.getPublishedDate();\n //GET AUTHOR\n String Author = entry.getAuthor();\n RssFieldValues.Author = Author;\n System.out.println(Author);\n //GET COMMENTS;\n String Comments = entry.getComments();\n RssFieldValues.Comments = Comments;\n System.out.println();\n try {\n //org.joda.time.Period P = new org.joda.time.Period(Pub_Date, CurrentDate);\n //if(SDF.parse(Pub_Date.toString()) == SDF.parse(CurrentDate.toString()))\n //org.joda.time.Period p = new org.joda.time.Period(CurrentDate, Pub_Date);\n //ONLY INSERT IF THE FEED IS WITHIN THE SPECIFIED PERIOD\n TimeValidations ValidateTime = new TimeValidations();\n if (ValidateTime.IsWithinValidWindow(CurrentDate, U_date, ReadInterval))\n {\n //INSERT NEWS SPECIFIC VALUES TO DB\n HashGenerator Gen = new HashGenerator();\n RssFieldValues.ComputedHash = Gen.HashCalculator(HashFields);\n InsertToDB(RssFieldValues, CurrentChannelID);\n }\n } catch (java.sql.SQLException ex) {\n String message = ex.getMessage();\n System.out.println(message);\n }\n }\n // System.out.println(feed);\n }", "public void PopulateRSSData()\n {\n try\n {\n URL Feed = ParseRSSFromFeed();\n ParseRSS(Feed);\n }\n catch(java.net.MalformedURLException exp)\n {\n String message = exp.getMessage();\n System.out.println(message);\n }\n catch(com.rometools.rome.io.FeedException fexp)\n {\n String message = fexp.getMessage();\n System.out.println(message);\n }\n catch(java.io.IOException ioexp)\n {\n String message = ioexp.getMessage();\n System.out.println(message);\n }\n }", "public void InsertToDB(RSSFields RssFieldValues, int ChannelID) throws java.sql.SQLException\n {\n String SQLQuery = \"INSERT INTO tbl_ex_RSSData \" +\n \" (SourceID, ChannelInstanceID, Title, Link, Description,PublishedDate,UpdatedDate, ParsedDate, Hash) \" +\n \" VALUES \" +\n \" (?, ?, ?, ?, ?, ?, ?,GetDate(), ?)\";\n PreparedStatement InsertQuery = DBAction.con.prepareStatement(SQLQuery);\n InsertQuery.setInt(1, SourceID);\n InsertQuery.setInt(2, ChannelID);\n InsertQuery.setString(3, RssFieldValues.Title);\n InsertQuery.setString(4, RssFieldValues.Link);\n InsertQuery.setString(5,RssFieldValues.Description);\n InsertQuery.setTimestamp(6,new java.sql.Timestamp(RssFieldValues.PublishedDate.getTime()));\n InsertQuery.setTimestamp(7,new java.sql.Timestamp(RssFieldValues.UpdatedDate.getTime()));\n InsertQuery.setString(8, RssFieldValues.ComputedHash);\n InsertQuery.execute();\n }", "public Object parseChannel(int rssType, Document doc) throws Exception;", "private RSS(Properties props) throws ParameterError {\n super(new String[0], null);\n Logger static_logger = Logging.getLogger(RSS.class);\n if (static_logger.isDebugEnabled()) {\n static_logger.debug(\"QRS Property=\" + props);\n }\n this.props = props;\n instance = this;\n this.sitesurl_string = props.getProperty(\"qrs.SitesURL\");\n data_feeds = new Hashtable<String, DataFeed>();\n\n String raw_feed_data = props.getProperty(\"qrs.DataFeeds\");\n if (raw_feed_data != null) {\n StringTokenizer tokenizer = new StringTokenizer(raw_feed_data, \" \");\n while (tokenizer.hasMoreTokens()) {\n String feed_name = tokenizer.nextToken().trim();\n makeFeed(feed_name, props);\n }\n }\n\n String sysstat_interval_str = props.getProperty(\"qrs.sysstat\");\n if (sysstat_interval_str != null) {\n int sysstat_interval = Integer.parseInt(sysstat_interval_str);\n TimerQueueingDataFeed feed = new TimerQueueingDataFeed();\n registerFeed(feed, \"DirectEntry\");\n DirectSysStatSupplier supplier = new DirectSysStatSupplier(null, feed);\n supplier.schedule(sysstat_interval);\n }\n\n String gui_id = props.getProperty(GUI_PROPERTY);\n if (gui_id != null) {\n new org.cougaar.qos.qrs.gui.MainWindow(gui_id);\n }\n\n }", "private List<DBFeedModel> parseResult(ConnectionResult connectionResult) {\n try {\n JSONObject response = new JSONObject(connectionResult.getResult());\n JSONArray posts = response.optJSONArray(\"posts\");\n List<DBFeedModel> feedsList = new ArrayList<>();\n\n for (int i = 0; i < posts.length(); i++) {\n JSONObject post = posts.optJSONObject(i);\n DBFeedModel item = new DBFeedModel();\n item.setViewType(Constants.FEED_VIEW_TYPE_LEFT);\n item.setTitle(post.optString(\"title\"));\n item.setThumb(post.optString(\"thumbnail\"));\n item.setUrl(\"http://m.dantri.com.vn/xa-hoi/hai-phong-yeu-cau-thao-do-rong-vang-dau-pikachu-gay-tranh-cai-20170108172552427.htm\");\n feedsList.add(item);\n }\n\n return feedsList;\n } catch (JSONException e) {\n e.printStackTrace();\n }\n\n return null;\n }", "public void createDataFeeds(){\n\n\t\tfinal MyDbHelper helper = new MyDbHelper(this);\n\t\tfinal SQLiteDatabase db = helper.getWritableDatabase();\n\t\t\n\t\tContentValues values = new ContentValues();\n\t\t\n\t\tDummyFeed.createFeeds(db, values);\t\t\n\t\t\n\t\tdb.close();\n\t\t\n\t}", "public ProcessedDynamicData( int channelId ) {\r\n this();\r\n this.channelId = channelId;\r\n }", "public static void getChannelsSuccess(List<ChannelInfo> channels) {\n\n\n rssListview.setItems(list);\n // rssListviewItem.setItems(list);\n\n }", "public void insert( RssGeneratedFile rssFile )\n {\n int nNewPrimaryKey = newPrimaryKey( );\n rssFile.setId( nNewPrimaryKey );\n\n DAOUtil daoUtil = new DAOUtil( SQL_QUERY_INSERT );\n daoUtil.setInt( 1, rssFile.getId( ) );\n daoUtil.setInt( 2, rssFile.getPortletId( ) );\n daoUtil.setString( 3, rssFile.getName( ) );\n daoUtil.setInt( 4, rssFile.getState( ) );\n daoUtil.setTimestamp( 5, new java.sql.Timestamp( new java.util.Date( ).getTime( ) ) );\n daoUtil.setString( 6, rssFile.getDescription( ) );\n daoUtil.setString( 7, rssFile.getWorkgroup( ) );\n daoUtil.setString( 8, rssFile.getTypeResourceRss( ) );\n daoUtil.setInt( 9, rssFile.getMaxItems( ) );\n daoUtil.setString( 10, rssFile.getFeedType( ) );\n daoUtil.setString( 11, rssFile.getEncoding( ) );\n daoUtil.executeUpdate( );\n daoUtil.free( );\n }", "public void store( RssGeneratedFile rssFile )\n {\n DAOUtil daoUtil = new DAOUtil( SQL_QUERY_UPDATE_RSS_FILE );\n\n daoUtil.setInt( 1, rssFile.getPortletId( ) );\n daoUtil.setString( 2, rssFile.getName( ) );\n daoUtil.setInt( 3, rssFile.getState( ) );\n daoUtil.setTimestamp( 4, new java.sql.Timestamp( new java.util.Date( ).getTime( ) ) );\n daoUtil.setString( 5, rssFile.getDescription( ) );\n daoUtil.setString( 6, rssFile.getWorkgroup( ) );\n daoUtil.setString( 7, rssFile.getTypeResourceRss( ) );\n daoUtil.setInt( 8, rssFile.getMaxItems( ) );\n daoUtil.setString( 9, rssFile.getFeedType( ) );\n daoUtil.setString( 10, rssFile.getEncoding( ) );\n daoUtil.setInt( 11, rssFile.getId( ) );\n\n daoUtil.executeUpdate( );\n daoUtil.free( );\n }", "public List<LinkDetails> scrapeRSSPageForLinks(String rssUrl) {\n\t\tString description = \"\";\n\t\tString title = \"\";\n\t\tString link = \"\";\n\t\tString pubdate = \"\";\n\t\tURL url;\n\t\tInputStream in;\n\n\t\tList<LinkDetails> rssProcessedData = new ArrayList<LinkDetails>();\n\n\t\ttry {\n\t\t\turl = new URL(rssUrl);\n\t\t} catch (MalformedURLException e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t}\n\n\t\ttry {\n\t\t\tin = url.openStream();\n\t\t} catch (IOException e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t}\n\n\t\t// create XML input factory\n\t\tXMLInputFactory inputFactory = XMLInputFactory.newInstance();\n\n\t\t// read the XML document\n\t\ttry {\n\n\t\t\tXMLEventReader eventReader = inputFactory.createXMLEventReader(in);\n\n\t\t\tboolean isFeedHeader = true;\n\t\t\twhile (eventReader.hasNext()) {\n\t\t\t\tXMLEvent event = eventReader.nextEvent();\n\t\t\t\tif (event.isStartElement()) {\n\t\t\t\t\tString localPart = event.asStartElement().getName().getLocalPart();\n\n\t\t\t\t\t// System.out.println(localPart);\n\n\t\t\t\t\tswitch (localPart) {\n\n\t\t\t\t\tcase \"item\":\n\t\t\t\t\t\t// if (isFeedHeader) {\n\t\t\t\t\t\t// isFeedHeader = false;\n\t\t\t\t\t\t// System.out.println(\" title: \"+title+ \" description: \"+ description + \" link:\n\t\t\t\t\t\t// \"+link+\" pubDate: \"+pubdate);\n\t\t\t\t\t\t// }\n\t\t\t\t\t\tevent = eventReader.nextEvent();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase \"title\":\n\t\t\t\t\t\ttitle = getCharacterData(event, eventReader);\n\t\t\t\t\t\t// System.out.println(\"title: \"+title);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"description\":\n\t\t\t\t\t\tdescription = getCharacterData(event, eventReader);\n\t\t\t\t\t\t// System.out.println(\"description: \"+description);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"link\":\n\t\t\t\t\t\tlink = getCharacterData(event, eventReader);\n\t\t\t\t\t\tSystem.out.println(\"link: \" + link);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"pubDate\":\n\t\t\t\t\t\tpubdate = getCharacterData(event, eventReader);\n\t\t\t\t\t\t// System.out.println(\"pubDate: \"+pubdate);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\t\t\t\t} else if (event.isEndElement()) {\n\t\t\t\t\tif (event.asEndElement().getName().getLocalPart() == (\"item\")) {\n\n\t\t\t\t\t\tLinkDetails linkDetails = new LinkDetails(link, title, description, pubdate);\n\t\t\t\t\t\trssProcessedData.add(linkDetails);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (XMLStreamException e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t}\n\n\t\treturn rssProcessedData;\n\t}", "@Override\n\t\tprotected Boolean doInBackground(Void... params) {\n\t\t\tlinklist = parseRSS();\n\t\t\treturn updateDatabase(linklist);\n\t\t}", "@Scheduled(fixedRate = 120000)\n public void readRss() {\n\n List<ItemNews> itemList = new ArrayList<>();\n\n try {\n String url = \"https://www.nytimes.com/svc/collections/v1/publish/https://www.nytimes.com/section/world/rss.xml\";\n\n try (XmlReader reader = new XmlReader(new URL(url))) {\n SyndFeed feed = new SyndFeedInput().build(reader);\n for (SyndEntry entry : feed.getEntries()) {\n LocalDateTime localDateTime = entry.getPublishedDate().toInstant()\n .atZone(ZoneId.systemDefault())\n .toLocalDateTime();\n ItemNews item = new ItemNews();\n item.setTitle(entry.getTitle());\n item.setAuthor(entry.getAuthor());\n item.setLink(entry.getLink());\n item.setDescription(entry.getDescription().getValue());\n item.setDateTime(localDateTime);\n modifyItem(item);\n itemList.add(item);\n }\n }\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n if (!itemList.isEmpty()) {\n Collections.sort(itemList , Comparator.comparing(ItemNews::getDateTime));\n saveItems(itemList);\n }\n }", "private void fillData()\n\t{\n\t\tNightliesAdapter na = new NightliesAdapter( context );\n\t\ttry\n\t\t{\n\t\t\tna.read();\n\n\t\t\t// get Downloads\n\t\t\tCursor cur_dl = na.getDownloadsCursor();\n\t\t\tcur_dl.moveToFirst();\n\n\t\t\t// we will start db records from 1: 0 reserved for our custom record\n\t\t\tint count_dl = cur_dl.getCount() + 1;\n\t\t\tif ( count_dl > 1 )\n\t\t\t{\n\t\t\t\tdownloads = new DownloadsRecord[count_dl];\n\t\t\t\tchangelogs = new ChangeLogRecord[count_dl][];\n\n\t\t\t\tDownloadsRecord dr;\n\t\t\t\tlong dateTo = ( new Date() ).getTime();\n\t\t\t\tlong dateFrom = cur_dl.getLong( cur_dl.getColumnIndex( NightliesAdapter.CM_DATE ) );\n\n\t\t\t\t// empty first record\n\t\t\t\tdr = new DownloadsRecord();\n\t\t\t\tdr.filename = \"next nightly\";\n\t\t\t\tdr.type = \"nightly\";\n\t\t\t\tdr.size = \"\";\n\t\t\t\tdr.md5sum = \"\";\n\t\t\t\tdr.date_added = new Date();\n\t\t\t\tdownloads[0] = dr;\n\n\t\t\t\t// get change log data\n\t\t\t\tchangelogs[0] = fillChangeLogData( na, dateFrom, dateTo );\n\n\t\t\t\tfor ( int i = 1; i < count_dl && !cur_dl.isAfterLast(); i++ )\n\t\t\t\t{\n\t\t\t\t\tdr = new DownloadsRecord();\n\t\t\t\t\tdr.filename = cur_dl.getString( cur_dl\n\t\t\t\t\t\t\t.getColumnIndex( NightliesAdapter.CM_FILENAME ) );\n\t\t\t\t\tdr.type = cur_dl.getString( cur_dl.getColumnIndex( NightliesAdapter.CM_TYPE ) );\n\t\t\t\t\tdr.md5sum = cur_dl.getString( cur_dl\n\t\t\t\t\t\t\t.getColumnIndex( NightliesAdapter.CM_MD5SUM ) );\n\t\t\t\t\tdr.size = cur_dl.getString( cur_dl.getColumnIndex( NightliesAdapter.CM_SIZE ) );\n\t\t\t\t\tdateFrom = cur_dl.getLong( cur_dl.getColumnIndex( NightliesAdapter.CM_DATE ) );\n\t\t\t\t\tdr.date_added = new Date( dateFrom );\n\t\t\t\t\tdownloads[i] = dr;\n\n\t\t\t\t\t// get change log data\n\t\t\t\t\tchangelogs[i] = fillChangeLogData( na, dateFrom, dateTo );\n\n\t\t\t\t\tdateTo = dateFrom;\n\t\t\t\t\tcur_dl.moveToNext();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tdownloads = new DownloadsRecord[1];\n\t\t\t\tchangelogs = new ChangeLogRecord[1][0];\n\n\t\t\t\t// no records found\n\t\t\t\tDownloadsRecord dr = new DownloadsRecord();\n\t\t\t\tdr.filename = \"No Records found, please refresh\";\n\t\t\t\tdr.type = \"nightly\";\n\t\t\t\tdr.size = \"\";\n\t\t\t\tdr.md5sum = \"\";\n\t\t\t\tdr.date_added = null;\n\t\t\t\tdownloads[0] = dr;\n\t\t\t}\n\t\t}\n\t\tcatch ( SQLException e )\n\t\t{\n\t\t\t// data base does not exist or cannot be opened for read\n\t\t\tdownloads = new DownloadsRecord[1];\n\t\t\tchangelogs = new ChangeLogRecord[1][0];\n\n\t\t\t// no records found\n\t\t\tDownloadsRecord dr = new DownloadsRecord();\n\t\t\tdr.filename = \"Problem with DB, please refresh\";\n\t\t\tdr.type = \"nightly\";\n\t\t\tdr.size = \"\";\n\t\t\tdr.md5sum = \"\";\n\t\t\tdr.date_added = null;\n\t\t\tdownloads[0] = dr;\n\n\t\t\tLog.e( TAG, \"DB Fail\", e );\n\t\t}\n\t\tcatch ( CursorIndexOutOfBoundsException e )\n\t\t{\n\t\t\tdownloads = new DownloadsRecord[1];\n\t\t\tchangelogs = new ChangeLogRecord[1][0];\n\n\t\t\t// no records found\n\t\t\tDownloadsRecord dr = new DownloadsRecord();\n\t\t\tdr.filename = \"Problem with DB, please refresh\";\n\t\t\tdr.type = \"nightly\";\n\t\t\tdr.size = \"\";\n\t\t\tdr.md5sum = \"\";\n\t\t\tdr.date_added = null;\n\t\t\tdownloads[0] = dr;\n\n\t\t\tLog.e( TAG, \"DB Fail\", e );\n\t\t}\n\t\tfinally\n\t\t{\n\t\t\tif ( na != null )\n\t\t\t{\n\t\t\t\tna.close();\n\t\t\t}\n\t\t}\n\t}", "@Override\n protected Void doInBackground(Void... arg0) {\n helper = new LiveFeedParser(999);\n helper.get();\n viewEntries = helper.getViewEntries();\n return null;\n }", "void insert(CmsChannel record);", "public static void processFeed(FeedContext fc) {\n\n String feedUrl = fc.getFeedUrl();\n mLog.info(\"Processing Atom feed at URL: \" + feedUrl);\n\n try {\n AbderaAtomParser atomParser = new AbderaAtomParser(new URL(feedUrl));\n atomParser.persistFeed(fc);\n\n mLog.info(\"Finished processing Atom feed at URL \" + feedUrl);\n }\n catch (MalformedURLException url_e) {\n mLog.error(\"MalformedURL found for \" + fc.getFeedUrl());\n }\n catch (ArrayIndexOutOfBoundsException a) {\n // this happens if the feed is empty (typically an activity stream),\n // need a better way to track this though\n \tmLog.warn(\"Feed at URL [\" + feedUrl + \"] is probably empty, but this \" +\n \t\t\t\"exception should have been prevented.\");\n }\n catch (Exception e) {\n mLog.error(\"Error processing feed at [\" + fc.getFeedUrl() + \"]: \" + e.getMessage());\n }\n catch (Throwable t) {\n mLog.error(\"Error processing feed at [\" + fc.getFeedUrl() + \"]: \" + t.getMessage());\n }\n }", "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 }", "public void createFullFeed() {\n\n\t\tList<ProductDetailsDocument> productDataFromMongo = getProductListFromDb();\n\t\ttry {\n\t\t\tcreateCsvForProduct(productDataFromMongo);\n\t\t} catch (ClassNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}", "private void parseJsonFeed(JSONObject response) {\n try {\n JSONArray feedArray = response.getJSONArray(\"feed\");\n\n for (int i = 0; i < feedArray.length(); i++) {\n JSONObject feedObj = (JSONObject) feedArray.get(i);\n\n FeedItem item = new FeedItem();\n item.setId(feedObj.getInt(\"organisation_id\"));\n item.setPortId(feedObj.getInt(\"portfolio_id\"));\n item.setName(feedObj.getString(\"name\"));\n //int id=item.getId();\n // Image might be null sometimes\n String image = feedObj.isNull(\"image\") ? null : feedObj.getString(\"image\");\n item.setImge(image);\n item.setStatus(feedObj.getString(\"status\"));\n item.setProfilePic(feedObj.getString(\"profilePic\"));\n item.setTimeStamp(feedObj.getString(\"timeStamp\"));\n item.setCommentCount(feedObj.getString(\"commentCount\"));\n\n // url might be null sometimes\n String feedUrl = feedObj.isNull(\"url\") ? null : feedObj.getString(\"url\");\n item.setUrl(feedUrl);\n\n feedItems.add(item);\n }\n\n\n // notify data changes to list adapater\n listAdapter.notifyDataSetChanged();\n\n\n } catch (JSONException e) {\n e.printStackTrace();\n }\n }", "public ArticleData() {\r\n\t\tid = Constants.EMPTY_STRING;\r\n\t\tname = Constants.EMPTY_STRING;\r\n\t\turl = Constants.EMPTY_STRING;\r\n\t\tdesc = Constants.EMPTY_STRING;\r\n\t\tlevels = Constants.EMPTY_STRING;\r\n\t\twebSiteId = Constants.EMPTY_STRING;\r\n\t\tmatched = Constants.EMPTY_STRING;\r\n\t\tcreateBy = Constants.EMPTY_STRING;\r\n\t\tcreateDate = Constants.EMPTY_STRING;\r\n\t\tlastUpdateBy = Constants.EMPTY_STRING;\r\n\t\tlastUpdateDate = Constants.EMPTY_STRING;\r\n\t\tenabled = Constants.EMPTY_STRING;\r\n\t\tpostTableName = Constants.EMPTY_STRING;\r\n\t\treturnPage = Constants.EMPTY_STRING;\r\n\t\twebSiteShowName = Constants.EMPTY_STRING;\r\n\t\treturnDirect = Constants.EMPTY_STRING;\r\n\t\tkeyWordTableName = Constants.EMPTY_STRING;\r\n\t\ttitle = Constants.EMPTY_STRING;\r\n\t\ttitleCounter = Constants.EMPTY_STRING;\r\n\t\tbufferStartCounter = Constants.EMPTY_STRING;\r\n\t\tbufferEndCounter = Constants.EMPTY_STRING;\r\n\t\tcatId = Constants.EMPTY_STRING;\r\n\t\tpostUrl = Constants.EMPTY_STRING;\r\n\t}", "public Object parseItem(int rssType, Document doc, int index) throws Exception;", "@Override\n protected RSSItem doInBackground(RSSItem... params) {\n \tDatabaseUtil databaseUtil = DatabaseUtil.initDatabase(context);\n \t\tif (databaseUtil == null) {\n \t\t\tLog.w(TAG, \"database init failed\");\n \t\t\treturn item;\n \t\t}\n \titem = params[0];\n \t\titem.setFav(databaseUtil.changeFav(item));\n return item;\n }", "@POST\n\t\t\t@Path(\"/post\")\n\t\t\t@Consumes(MediaType.APPLICATION_FORM_URLENCODED)\n\t\t\t@Produces({MediaType.APPLICATION_XML})\n\t\t\tpublic Rows postChannel(@Context UriInfo uriInfo,@Context HttpHeaders header,@FormParam(\"body\") String xml) {\n\t\t\t\tRows rows = null;\n\t\t\t\tChannelDao post;\n\t\t\t\ttry {\n\t\t\t\t\tpost=new ChannelDao(uriInfo,header);\n\t\t\t\t\tpost.setPostXml(xml.trim());\n\t\t\t\t\tpost.postChannelContainer();\n\t\t\t\t\trows=post.getChannelRowModified();\n\t\t\t\t} catch (AuthenticationException e) {\n\t\t\t\t\t rows=new TemplateUtility().getFailedMessage(e.getMessage());\n\t\t\t\t\t e.printStackTrace();\n\t\t\t\t} catch (DaoException d) {\n\t\t\t\t\t d.printStackTrace();\n\t\t\t\t}\n\t\t\t\treturn rows;\n\t\t\t}", "@Override\n protected ArrayList<Object> doInBackground(String... params) {\n RequestBody postData = new FormEncodingBuilder()\n .add(\"type\", \"json\")\n .build();\n\n ArrayList<Object> feedDataList = CMFeedJsonUtil.feed(params[0], postData);\n Log.d(\"Tag\", feedDataList.toString());\n return feedDataList;\n }", "private synchronized void processNews() throws ClientProtocolException,\n\t\t\t\tIOException, JSONException {\n\n\t\t\tlong lastTime = mAdapter.getItem(mCount - 1).date;\n\t\t\tlong startTime = lastTime - Utils.MONTH;\n\n\t\t\tsetNews(ApiHandler.getData(lastTime, startTime));\n\t\t\tmHandler.sendEmptyMessage(UPDATE_LIST);\n\t\t}", "@Override\n public List<Announcement> onLoadInBackground() {\n return databaseLoader.getChannelDBM().getAnnouncements(channelId);\n }", "private void getData() {\n ArticleBean articleBean = new ArticleBean();\n articleBean.setTime(\"1月16日\");\n articleBean.setTitle(\"文章内容\");\n articleBean.setName(\"xzh\");\n mList.add(articleBean);\n mList.add(articleBean);\n mList.add(articleBean);\n }", "public interface ActivityFeedDAO extends ActivitiesDAO\n{\n public static final int MAX_LEN_USER_ID = 255; // needs to match schema: feed_user_id, post_user_id\n public static final int MAX_LEN_SITE_ID = 255; // needs to match schema: site_network\n public static final int MAX_LEN_ACTIVITY_TYPE = 255; // needs to match schema: activity_type\n public static final int MAX_LEN_ACTIVITY_SUMMARY = 4000; // needs to match schema: activity_summary\n public static final int MAX_LEN_ACTIVITY_FORMAT = 255; // needs to match schema: activity_format\n public static final int MAX_LEN_APP_TOOL_ID = 36; // needs to match schema: app_tool\n \n public long insertFeedEntry(ActivityFeedEntity activityFeed) throws SQLException;\n \n public int deleteFeedEntries(Date keepDate) throws SQLException;\n \n public int deleteUserFeedEntries(String feedUserId, String format, Date keepDate) throws SQLException;\n \n public int deleteSiteFeedEntries(String siteId, String format, Date keepDate) throws SQLException;\n \n public List<ActivityFeedEntity> selectFeedsToClean(int maxFeedSize) throws SQLException;\n \n public List<ActivityFeedEntity> selectUserFeedEntries(String feedUserId, String format, String siteId, boolean excludeThisUser, boolean excludeOtherUsers) throws SQLException;\n \n public List<ActivityFeedEntity> selectSiteFeedEntries(String siteUserId, String format) throws SQLException;\n}", "private static void prepareAdvData() {\n ADV_DATA.add(createDateTimePacket());\n ADV_DATA.add(createDeviceIdPacket());\n ADV_DATA.add(createDeviceSettingPacket());\n for (int i = 0; i < 3; i++) {\n ADV_DATA.add(createBlackOutTimePacket(i));\n }\n for (int i = 0; i < 3; i++) {\n ADV_DATA.add(createBlackOutDatePacket(i));\n }\n }", "private void populateFields() {\n\n if (mReportCursor == null) {\n return;\n }\n\n Cursor c = mReportCursor;\n mValueText.setText(c.getString(c.getColumnIndexOrThrow(ReportPeer.KEY_VALUE)));\n }", "private void parseData() {\n\t\t\r\n\t}", "public void refreshAllRssFeeds()\n {\n Vector rssContactList = new Vector();\n rssContactList = opSetPersPresence.getContactListRoot().\n getRssURLList(rssContactList);\n Iterator rssContact = rssContactList.iterator();\n while(rssContact.hasNext())\n {\n ContactRssImpl contact = (ContactRssImpl)rssContact.next();\n try\n {\n \n submitRssQuery(contact, false);\n }\n catch (Exception ex)\n {\n logger.error(\"Failed to refresh feed for \" + contact, ex);\n }\n }\n }", "public void setRssData(RSSFilingData rssData) {\n this.rssData = rssData;\n }", "public interface FeedParserConstants {\n\tpublic static final String TITLE = \"title\";\n\tpublic static final String DESCRIPTION = \"description\";\n\tpublic static final String CHANNEL = \"channel\";\n\tpublic static final String COPYRIGHT = \"copyright\";\n\tpublic static final String LINK = \"link\";\n\tpublic static final String AUTHOR = \"creator\";\n\tpublic static final String ITEM = \"item\";\n\tpublic static final String PUB_DATE = \"pubDate\";\n\tpublic static final String CONTENT = \"encoded\";\n}", "private Feed(Entity entity, Settings settings) {\n\t\tthis.url = entity.getKey().getName();\n\t\tthis.items = Collections.synchronizedSet(new HashSet<FeedItem>());\n\t\tList<EmbeddedEntity> savedItems = (List<EmbeddedEntity>) entity.getProperty(\"items\"); //NOI18N\n\t\tif (savedItems != null)\n\t\t\tfor (EmbeddedEntity item : savedItems)\n\t\t\t\tthis.items.add(new FeedItem(this, item));\n\t\tthis.settings = settings;\n\t}", "public interface INewsContentModel extends IBaseModel {\n\n void loadData(String channelID, String channelName, String page);\n\n}", "private synchronized void processNewsInitial()\n\t\t\t\tthrows ClientProtocolException, IOException, JSONException {\n\t\t\tlong lastTime = System.currentTimeMillis() / 1000;\n\t\t\tlong startTime = lastTime - Utils.MONTH;\n\t\t\tsetNews(ApiHandler.getData(lastTime, startTime));\n\t\t\tmHandler.sendEmptyMessage(CREATE_LIST);\n\t\t}", "private void parseResponse(String response, List<NewsDetailItem> items) {\n\n Pattern pText = Pattern.compile(ITEM_TEXT_PREF + \".*?\" + ITEM_TEXT_POSTF);\n Pattern pTitle = Pattern.compile(TITLE_PREF + \".*?\" + TITLE_POSTF);\n Pattern pDate = Pattern.compile(\"class=\\\"metadata\\\">.*?</a>\");\n Pattern pDate2 = Pattern.compile(\"</strong>.*?<\");\n\n Pattern pImage2 = Pattern.compile(IMG_PREF + \".*?\" + IMG_POSTF);\n\n Pattern pVideo = Pattern.compile(VIDEO_PREF + \".*?\" + VIDEO_POSTF);\n\n Pattern pImageUrl = Pattern.compile(IMG_URL_PREF + \".*?\" + IMG_URL_POSTF);\n\n Pattern pComment = Pattern.compile(\"li class=\\\" item\\\" id=\\\"comment.*?</li>\");\n Pattern pAuthor = Pattern.compile(\"class=\\\"commentauthor\\\".*?</span>\");\n\n Pattern pAuthorName1 = Pattern.compile(\"'>.*?</span>\");\n Pattern pAuthorName2 = Pattern.compile(\"/>.*?</span>\");\n Pattern pAuthorImage = Pattern.compile(AUTHOR_IMAGE_PREF + \".*?\" + AUTHOR_IMAGE_POSTF);\n\n Pattern pCommentText = Pattern.compile(\"<span id=\\\"co_.*?</li>\");\n Pattern pCommentId = Pattern.compile(COMMENT_ID_PREFIX + \".*?\" + COMMENT_ID_POSTFIX);\n\n Pattern pCommentTex2t = Pattern.compile(\"dislike-counter.*?comment-toolbar\"); //Pattern.compile(COMMENT_PREFIX + \".*?\" + COMMENT_POSTFIX);\n Pattern pCommentText3 = Pattern.compile(COMMENT_PREFIX + \".*?\" + COMMENT_POSTFIX);\n Pattern pThumbsDown = Pattern.compile(\"dislike-counter-comment.*?</span>\");\n Pattern pThumbsUp = Pattern.compile(\"like-counter-comment.*?</span>\");\n Pattern pThumb2 = Pattern.compile(THUMB_PREF + \".*?\" + THUMB_POSTF);\n\n Pattern pCommentDate = Pattern.compile(COMMENTDATE_PREF + \".*?\" + COMMENTDATE_POSTF);\n Pattern pWidth = Pattern.compile(WIDTH_PREF + \".*?\" + WIDTH_POSTF);\n Pattern pHeight = Pattern.compile(HEIGHT_PREF + \".*?\" + HEIGHT_POSTF);\n\n Pattern pAkismet = Pattern.compile(\"vortex_ajax_comment\"+\".*?\"+\";\");\n\n Pattern pAkismet2 = Pattern\n .compile(\"\\\"nonce\\\":\\\".*?\"+\"\\\"\");\n\n Pattern pValue = Pattern.compile(\"value=\\\".*?\\\"\");\n\n Pattern pAk_js = Pattern\n .compile(\"id=\\\"ak_js\\\".*?/>\");\n\n\n String akismet = \"\";\n String ak_js = \"\";\n String postId = \"\";\n Matcher makismet_comment = pAkismet.matcher(response);\n if (makismet_comment.find()) {\n Matcher mvalue = pAkismet2.matcher(makismet_comment.group());\n if (mvalue.find()) {\n akismet = mvalue.group();\n akismet = akismet.replace(\"\\\"\", \"\");\n akismet = akismet.replace(\"nonce:\", \"\");\n }\n }\n\n Matcher mak_js = pAk_js.matcher(response);\n if (mak_js.find()) {\n Matcher mvalue = pValue.matcher(mak_js.group());\n if (mvalue.find()) {\n ak_js = mvalue.group();\n ak_js = ak_js.replace(\"\\\"\", \"\");\n ak_js = ak_js.replace(\"value=\", \"\");\n }\n }\n\n\n Pattern ppost_id = Pattern.compile(\"name=\\\"comment_post_ID\\\".*?/>\");\n Matcher mpost_id = ppost_id.matcher(response);\n if (mpost_id.find()) {\n Matcher mvalue = pValue.matcher(mpost_id.group());\n if (mvalue.find()) {\n postId = mvalue.group();\n postId = postId.replace(\"\\\"\", \"\");\n postId = postId.replace(\"value=\", \"\");\n }\n }\n\n Matcher itemMatcher;\n itemMatcher = pDate.matcher(response);\n String date = \"\";\n if (itemMatcher.find()) {\n itemMatcher = pDate2.matcher(itemMatcher.group());\n if (itemMatcher.find()) {\n date = itemMatcher.group().substring(10);\n date = date.substring(0, date.length() - 2);\n }\n }\n\n Matcher mTitle = pTitle.matcher(response);\n if (mTitle.find()) {\n String itemText = mTitle.group().substring(TITLE_PREF.length()); //(\" dc:title=\\\"\".length()).replace(\"\\\"\", \"\");\n itemText = itemText.substring(0, itemText.length() - TITLE_POSTF.length());\n NewsDetailItem item = new NewsDetailItem();\n item.setText(itemText);\n item.setDate(date);\n item.setContentType(NewsDetailDBHelper.NewsItemType.TITLE.ordinal());\n item.setPostUrl(mUrl);\n item.setCommentId(postId);\n item.setAkismet(akismet);\n item.setAk_js(ak_js);\n items.add(item);\n }\n\n Matcher mText = pText.matcher(response);\n int imageEnd = 0;\n int textStart;\n\n if (mText.find()) {\n String text = mText.group().substring(ITEM_TEXT_PREF.length());\n text = text.substring(0, text.length() - ITEM_TEXT_POSTF.length());\n Matcher mImage = pImage2.matcher(text);\n while (mImage.find()) {\n int textEnd = mImage.start();\n textStart = imageEnd;\n imageEnd = mImage.end();\n String itemText = text.substring(textStart, textEnd);\n addTextItem(items, itemText);\n processImageItem(items, mImage.group(), pImageUrl, pWidth, pHeight);\n }\n\n Matcher mVideo = pVideo.matcher(text);\n while (mVideo.find()) {\n int textEnd = mVideo.start();\n textStart = imageEnd;\n imageEnd = mVideo.end();\n String itemText = \"\";\n if (textEnd >= textStart) {\n itemText = text.substring(textStart, textEnd);\n }\n addTextItem(items, itemText);\n processVideoItem(items, mVideo.group(), pImageUrl, pWidth, pHeight);\n }\n\n text = text.substring(imageEnd);\n addTextItem(items, text);\n }\n\n\n NewsDetailItem item = new NewsDetailItem();\n item.setContentType(NewsDetailDBHelper.NewsItemType.REPLY_HEADER.ordinal());\n item.setPostUrl(mUrl);\n items.add(item);\n\n Matcher mComment = pComment.matcher(response);\n while (mComment.find()) {\n item = new NewsDetailItem();\n item.setContentType(NewsDetailDBHelper.NewsItemType.REPLY.ordinal());\n item.setPostUrl(mUrl);\n items.add(item);\n item.setAkismet(akismet);\n String comment = mComment.group();\n\n // if (comment.contains(CAN_CHANGE_KARMA_PREFIX)) {\n item.setCanChangeKarma(1);\n // } else {\n // item.setCanChangeKarma(0);\n // }\n\n Matcher mAuthor = pAuthor.matcher(comment);\n if (mAuthor.find()) {\n String authorText = mAuthor.group();\n item.setAuthorImage(getAuthorImgage(authorText, pAuthorImage));\n item.setAuthor(getAuthorName(authorText, pAuthorName1, pAuthorName2));\n }\n Matcher mCommentText = pCommentText.matcher(comment);\n if (mCommentText.find()) {\n String s = mCommentText.group();\n mCommentText = pCommentTex2t.matcher(s);\n if (mCommentText.find()) {\n mCommentText = pCommentText3.matcher(mCommentText.group());\n if (mCommentText.find()) {\n String commentText = mCommentText.group().substring(COMMENT_PREFIX.length());\n commentText = commentText.substring(0, commentText.length() - COMMENT_POSTFIX.length());\n commentText = commentText.replace(\"<p>\", \"\");\n commentText = commentText.replace(\"</p>\", \"\");\n item.setText(commentText);\n }\n }\n }\n Matcher mCommentId = pCommentId.matcher(comment);\n if (mCommentId.find()) {\n String commentId = mCommentId.group().substring(COMMENTDATE_PREF.length());\n commentId = commentId.substring(0, commentId.length() - COMMENT_ID_POSTFIX.length());\n item.setCommentId(commentId);\n }\n Matcher mCommentDate = pCommentDate.matcher(comment);\n if (mCommentDate.find()) {\n String commentDate = mCommentDate.group().substring(COMMENTDATE_PREF.length());\n commentDate = commentDate.substring(0, commentDate.length() - COMMENTDATE_POSTF.length());\n item.setDate(commentDate);\n }\n item.setKarmaUp(getKarma(comment, pThumbsUp, pThumb2));\n item.setkarmaDown(getKarma(comment, pThumbsDown, pThumb2));\n }\n }", "public void run() {\n String query = \"INSERT INTO CustomData (Server, Plugin, ColumnID, DataPoint, Updated) VALUES\";\n int currentSeconds = (int) (System.currentTimeMillis() / 1000);\n\n // Iterate through each column\n for (Map.Entry<Column, Integer> entry : customData.entrySet()) {\n Column column = entry.getKey();\n int value = entry.getValue();\n\n // append the query\n query += \" (\" + server.getId() + \", \" + plugin.getId() + \", \" + column.getId() + \", \" + value + \", \" + currentSeconds + \"),\";\n }\n\n // Remove the last comma\n query = query.substring(0, query.length() - 1);\n\n // add the duplicate key entry\n query += \" ON DUPLICATE KEY UPDATE DataPoint = VALUES(DataPoint) , Updated = VALUES(Updated)\";\n\n // queue the query\n new RawQuery(mcstats, query).save();\n }", "public NewsParamPanel() {\n initComponents();\n titleAnalyzer.setFieldName(\"TITLE\");\n dateAnalyzer.setFieldName(\"DATE\");\n sourceExtractor.setFieldName(\"SOURCENAME\");\n authorExtractor.setFieldName(\"AUTHOR\");\n commentsExtractor.setFieldName(\"COMMENT_COUNT\");\n clicksExtractor.setFieldName(\"CLICK_COUNT\");\n transmitExtractor.setFieldName(\"TRANSMIT_COUNT\");\n summaryExtractor.setFieldName(\"SUMMARY\");\n chnlExtractor.setFieldName(\"CHANNEL\");\n contentExtractor.setFieldName(\"CONTENT\");\n }", "@Override\r\n public Entradas consultarEntradaPorRss(Rss rss){\r\n \tString hql = \"SELECT ent FROM Entradas ent, ColeccionesRss colrss, Rss rss WHERE \"\r\n \t\t\t+ \" colrss.rss.codigoRss = rss.codigoRss AND ent.rss.codigoRss = rss.codigoRss AND rss.codigoRss = \"+rss.getCodigoRss();\r\n \tQuery query = sessionFactory.getCurrentSession().createQuery(hql);\r\n \tEntradas entrada = (Entradas) query.uniqueResult();\r\n \treturn entrada;\r\n \t\r\n }", "@Override\r\n public Entradas consultarEntradas(Rss rss){\r\n \tString hql = \"SELECT ent FROM Rss rss, Entradas ent WHERE ent.rss.codigoRss = \"+rss.getCodigoRss();\r\n \tQuery query = sessionFactory.getCurrentSession().createQuery(hql);\r\n \tEntradas entradas = (Entradas) query.uniqueResult();\r\n \treturn entradas;\r\n }", "@Override\n\t\tprotected String doInBackground(String... params) {\n\t\t\tHttpPost httppost = new HttpPost(params[0]);\n\t\t\tString op = \"\";\n\t\t\ttry {\n\t\t\t\t// Add your data\n\n\t\t\t\t// Execute HTTP Post Request\n\t\t\t\tHttpResponse response = HTTPStuff.httpClient.execute(httppost);\n\t\t\t\top = EntityUtils.toString(response.getEntity());\n\t\t\t\tjObj = new JSONObject(op);\n\t\t\t\tsuccess = jObj.getBoolean(\"success\");\n\t\t\t\tif (success) {\n\t\t\t\t\tJSONArray jArr = jObj.getJSONArray(\"data\");\n\t\t\t\t\tLog.d(\"jatin\", \"\" + jArr.length());\n\t\t\t\t\tcontent_ids = new String[jArr.length()];\n\t\t\t\t\tfeedContent = new FeedContent[jArr.length()];\n\t\t\t\t\t for (int i = 0; i < jArr.length(); i++) {\n\t\t\t\t\t\t jObj2 = jArr.getJSONObject(i);\n\t\t\t\t\t\t content_ids[i] = jObj2.getString(\"content_id\");\n\t\t\t\t\t\t feedContent[i]=new FeedContent();\n\t\t\t\t\t\t feedContent[i].content_id=Integer.parseInt(jObj2.getString(\"content_id\"));\n\t\t\t\t\t\t feedContent[i].user_id=Integer.parseInt(jObj2.getString(\"user_id\"));\n\t\t\t\t\t\t feedContent[i].content_text=jObj2.getString(\"content_text\");\n\t\t\t\t\t\t feedContent[i].name=jObj2.getString(\"name\");\n\t\t\t\t\t\t feedContent[i].img=jObj2.getString(\"img\");\n\t\t\t\t\t\t SimpleDateFormat df = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\");\n\t\t\t\t\t\t try {\n\t\t\t\t\t\t\tfeedContent[i].time=df.parse(jObj2.getString(\"time\"));\n\t\t\t\t\t\t} catch (ParseException e) {\n\t\t\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t} \n\t\t\t\t\t\t feedContent[i].content_text=jObj2.getString(\"content_text\");\n\t\t\t\t\t\t \n\t\t\t\t\t }\n\t\t\t\t\treturn \"success\";\n\t\t\t\t} else {\n\t\t\t\t\tJSONObject jObj2 = jObj.getJSONObject(\"errors\");\n\t\t\t\t\treturn jObj2.getString(\"0\");\n\t\t\t\t}\n\t\t\t} catch (ClientProtocolException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t} catch (IOException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t} catch (JSONException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn \"Unknown Error!\";\n\t\t}", "public static void processFeed(FeedContext fc, Feed feed) {\n try {\n\t\t\tAbderaAtomParser parser = new AbderaAtomParser(feed);\n\t\t\tparser.persistFeed(fc);\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\tmLog.error(\"Error processing feed at [\" + fc.getFeedUrl() + \"]: \" + e.getMessage());\n\t\t}\n }", "private void parseChannelNodes(NodeList nodeList,ArrayList<Publication> publications) {\n for(int i = 0; i < nodeList.getLength(); i++){\n Node node = nodeList.item(i);\n if(!\"#text\".equals(node.getNodeName())) {\n Publication publication = new Publication(Integer.toString(Math.abs(new Random().nextInt())));\n parseChildNodes(publication,node);\n System.out.println(publication.toString());\n publications.add(publication);\n }\n }\n }", "private void createData() {\n//\n// tour = new Tour();\n// tour.setTitle(\"Death Valley\");\n// tour.setDescription(\"A tour to Death Valley\");\n// tour.setPrice(900);\n// tour.setImage(\"death_valley\");\n// tour = dataSource.create(tour);\n// Log.i(LOGTAG, \"Tour created with id \" + tour.getId());\n//\n// tour = new Tour();\n// tour.setTitle(\"San Francisco\");\n// tour.setDescription(\"A tour to San Francisco\");\n// tour.setPrice(1200);\n// tour.setImage(\"san_francisco\");\n// tour = dataSource.create(tour);\n// Log.i(LOGTAG, \"Tour created with id \" + tour.getId());\n\n ToursPullParser parser = new ToursPullParser();\n tours = parser.parseXML(this);\n\n for (Tour tour : tours) {\n dataSource.create(tour);\n }\n\n }", "public ChannelDetails() {\n\t\t// TODO Auto-generated constructor stub\n\t}", "@Override void init(Element element) {\n String name = element.getTagName();\n if (name.equals(\"published\")) {\n this.published = element.getTextContent().trim();\n }\n else if (name.equals(\"content\")) {\n this.content = parseContent(element);\n }\n else {\n super.init(element);\n }\n }", "private void insertLatestData() {\n String[] names = new String[feedbacks.size()];\n String[] ratings = new String[feedbacks.size()];\n String[] reviews = new String[feedbacks.size()];\n for (int i = 0; i < feedbacks.size(); i++) {\n names[i] = \"Name: \" + feedbacks.get(i).getName();\n ratings[i] = \"Rating: \" + feedbacks.get(i).getRatingBar();\n reviews[i] = \"Review: \" + feedbacks.get(i).getReview();\n }\n feedbackListAdapter = new FeedbackListAdapter(ViewPsmFeedbackActivity.this, names, ratings, reviews);\n listFeedback.setAdapter(feedbackListAdapter);\n }", "public interface Feed extends Element {\n\n /**\n * Returns the feed type.\n */\n public FeedType getType();\n \n /**\n * Convenience method to retrieve the feed title.\n */\n public String getTitle();\n \n /**\n * Convenience method to retrieve the feed link.\n */\n public String getLink();\n \n /**\n * Convenience method to retrieve the feed description.\n */\n public String getDescription();\n \n /**\n * Convenience method to retrieve the language.\n */\n public String getLanguage();\n \n /**\n * Convenience method to retrieve the copyright.\n */\n public String getCopyright();\n \n /**\n * Convenience method to retrieve the published date.\n */\n public Date getPubDate();\n \n /**\n * Convenience method to retrieve a list of categories.\n */\n public List<String> getCategories();\n \n /**\n * Returns a list of Items in the feed.\n */\n public List<Item> getItemList();\n}", "private void addNewsAllToDatabase(LinkedList<NewsDetail> newsDetails) {\n new InsertNewsAsyncTask(newsDao).execute(newsDetails);\n }", "public void setJListItems(List<ConnectionData> channels){\r\n\t\tfor(int i =0; i<=channels.size()-1; i++){\r\n\t\t\tgetThisDataRate();\r\n\t\t\tif(channels.get(i).getDataRate()==dataRate){\r\n\t\t\t\tmodel.addElement(channels.get(i));\r\n\t\t\t}\r\n\t\t}\r\n\t}", "@Override\n\tprotected void setupData() {\n\t\tisFirst = getIntent().getExtras().getBoolean(\"IS_FIRST\");\n\t\tcid = getIntent().getExtras().getString(FirstCategoryAct.class.getName());\n\t\tString title;\n\t\tif(isFirst){\n\t\t\ttitle = getIntent().getExtras().getString(\"TITLE_BAR\") + getResources().getString(R.string.tv_article_all);\n\t\t}else{\n\t\t\ttitle = getResources().getString(R.string.tv_article_all2);\n\t\t}\n\t\t\n\t\tsetGCenter(true, title);\n\t\tsetGLeft(true, R.drawable.back_selector);\n\n\t\tgetData(NET_ARTICLE, false);\n\t}", "public static ArrayList<Map<String,String>> getContFromRssNoHtml(String urlAdress) {\n\n URL url = null;\n Iterator itEntries = null;\n try {\n //thetume ton browser Agent se browser-like gia na apofigume 403 errors\n System.setProperty(\"http.agent\", \"Mozilla/5.0 (Windows NT 10.0; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0\");\n url = new URL(urlAdress);\n HttpURLConnection httpcon = (HttpURLConnection) url.openConnection();\n httpcon.setRequestProperty(\"User-Agent\",\n \"Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20100101 Firefox/19.0\");\n // Reading the feed\n SyndFeedInput input = new SyndFeedInput();\n SyndFeed feed = input.build(new XmlReader(httpcon));\n List entries = feed.getEntries();\n itEntries = entries.iterator();\n } catch (MalformedURLException e) {\n e.printStackTrace();\n } catch (FeedException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n //contAr has all the entries\n ArrayList<Map<String,String>> contAr = new ArrayList<Map<String, String>>();\n\n //contMap has all the entries contents\n Map<String,String> contMap = new HashMap<String, String>();\n contMap.put(\"URI\",urlAdress);\n\n\n while (itEntries.hasNext()) {\n contMap = new HashMap<String, String>();\n SyndEntry entry = (SyndEntry) itEntries.next();\n System.out.println(entry.getUri());\n contMap.put(\"Title\",entry.getTitle());\n contMap.put(\"Link\",entry.getLink());\n contMap.put(\"Description\",entry.getDescription().getValue());\n\n contAr.add(contMap);\n System.out.println();\n }\n return contAr;\n }", "public void fillFromEntry(BlogEntry entry) {\n\t\tif(entry.getId()==null) {\n\t\t\tthis.id = \"\";\n\t\t} else {\n\t\t\tthis.id = entry.getId().toString();\n\t\t}\n\t\tthis.title = entry.getTitle();\n\t\tthis.text = entry.getText();\n\t\t\n\t}", "private void saveNewFeed() {\n String rssUrl = mUrlEditText.getText().toString();\n\n if (!rssUrl.equals(\"\") && userNotAlreadyFollowing(rssUrl)) {\n getActivity().setProgressBarIndeterminateVisibility(true);\n\n FeedProcessingService service = new FeedProcessingService(getActivity(), mFeedHandler);\n service.getAndProcessFeed(rssUrl);\n }\n }", "public void updateChannel(String channel) {\n Log.d(\"BC\", \"update channel \" + channel);\n long startTime = 0l;\n long endTime = 0l;\n Cursor cursor = getContentResolver().query(\n ChannelData.BROKEN_CONTENT_URI,\n null,\n null,\n new String[]{channel},\n null\n );\n if (cursor.getCount() > 0) {\n if (cursor.moveToFirst()) {\n startTime = cursor.getLong(cursor.getColumnIndex(\n ChannelData.PARENT\n ));\n endTime = cursor.getLong(cursor.getColumnIndex(\n ChannelData.ITEM_ID\n ));\n }\n Log.w(TAG, \"Found broken threads in \" + channel + \", \"\n + new Date(startTime) + \" / \"+ new Date(endTime));\n }\n cursor.close();\n cursor = getContentResolver().query(\n Roster.CONTENT_URI,\n new String[]{Roster.LAST_UPDATED},\n \"jid=?\",\n new String[]{channel},\n null\n );\n if (cursor.getCount() == 1) {\n cursor.moveToFirst();\n startTime = cursor.getLong(\n cursor.getColumnIndex(Roster.LAST_UPDATED));\n IQ iq = new ChannelFetch(channel, startTime);\n try {\n send(iq);\n } catch (RemoteException e) {\n e.printStackTrace();\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n }\n cursor.close();\n DiscoverInfo info = new DiscoverInfo();\n info.setNode(channel);\n info.setType(org.jivesoftware.smack.packet.IQ.Type.GET);\n info.setTo(\"broadcaster.buddycloud.com\");\n try {\n send(info);\n } catch (InterruptedException e) {\n e.printStackTrace(System.err);\n } catch (RemoteException e) {\n e.printStackTrace();\n }\n }", "int insert(WxNews record);", "void getCompanyInfoFromText() {\r\n\r\n String first = texts.get(0).getText();\r\n String cID = first;\r\n String second = texts.get(1).getText();\r\n String cNAME = second;\r\n String third = texts.get(2).getText();\r\n String password = third;\r\n String forth = texts.get(3).getText();\r\n String GUR = forth;\r\n double d = Double.parseDouble(GUR);\r\n String fifth = texts.get(4).getText();\r\n String EUR = fifth;\r\n double dd = Double.parseDouble(EUR);\r\n String sixth = texts.get(5).getText();\r\n String TSB = sixth ;\r\n String TT = \"2018-04-/08:04:26\";\r\n StringBuffer sb = new StringBuffer();\r\n sb.append(TT).insert(8,TSB);\r\n String ts = sb.toString();\r\n\r\n companyInfo.add(new CompanyInfo(cID,cNAME,password,d,dd,ts));\r\n\r\n new CompanyInfo().WriteFiles_append(companyInfo);\r\n }", "public void PushEventStatisticsFromDB() {\n\t\tmyDBUtil.open();\n\t\tCursor mCursor = myDBUtil.queryMarkIsZero();\n\t\tmCursor.moveToFirst();\n\t\tdo {\n\t\t\tfinal EventStatisticsData eventStatisticsData = new EventStatisticsData();\n\t\t\tString[] colums = new String[]{\n\t\t\t\t\t\"behavior\", \"appId\", \"appSrc\", \"packageName\", \"client\", \"listenArea\",\n\t\t\t\t\t\"listenContextId\", \"listenContextSrc\", \"clientVersion\", \"referenceId\",\n\t\t\t\t\t\"appName\", \"appVersion\"};\n\t\t\tint index;\n\t\t\tString value;\n\t\t\tfor (int i = 0; i < colums.length; i++) {\n\t\t\t\tindex = mCursor.getColumnIndex(colums[i]);\n\t\t\t\tvalue = mCursor.getString(index);\n\t\t\t\teventStatisticsData.SetParamFromApp(i, value);\n\t\t\t}\n\t\t\tindex = mCursor.getColumnIndex(\"_id\");\n\t\t\tfinal int id = mCursor.getInt(index);\n\t\t\tGetIPFromServer(new GetIpCallback() {\n\t\t\t\t@Override\n\t\t\t\tpublic void solve(String result) {\n\t\t\t\t\tif (result != null && eventStatisticsData != null) {\n\t\t\t\t\t\tpushStatisticsEvent(eventStatisticsData, false, id);\n\t\t\t\t\t\tLog.d(TAG, \"im here don't insert to db,just update\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t} while (mCursor.moveToNext());\n\t\tmCursor.close();\n\t\tmyDBUtil.close();\n\t}", "private static Dataset<Row> loadbetaFeed() {\n\t\tconf.set(TableInputFormat.INPUT_TABLE, RSSFeedUtils.betatable);\n\t\tconf.set(TableInputFormat.SCAN_COLUMN_FAMILY, RSSFeedUtils.hbaseTab_cf);\n\t\t\n\t\tString feedCols = RSSFeedUtils.hbaseTab_cf + \":rssFeed \" + RSSFeedUtils.hbaseTab_cf + \":title \" + RSSFeedUtils.hbaseTab_cf + \":articleLink \" \n\t\t\t\t\t\t+ RSSFeedUtils.hbaseTab_cf + \":description \" + RSSFeedUtils.hbaseTab_cf + \":articleDate \" + RSSFeedUtils.hbaseTab_cf + \":categories\";\n\t\t\n\t\tconf.set(TableInputFormat.SCAN_COLUMNS, feedCols);\n\t\tJavaPairRDD<ImmutableBytesWritable, Result> feedPairRDD = jsc.newAPIHadoopRDD(conf, TableInputFormat.class, ImmutableBytesWritable.class, Result.class);\n\t\t\n\t\tJavaRDD<DatasetBean> feedRDD = feedPairRDD.map(new Function<Tuple2<ImmutableBytesWritable,Result>, DatasetBean>() {\n\t\t\t\n\t\t\tprivate static final long serialVersionUID = 1L;\n\t\t\tpublic DatasetBean call(Tuple2<ImmutableBytesWritable, Result> arg0) throws Exception {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tResult r = arg0._2;\n\t\t\t\t//keylist.add(new Delete(r.getRow())); \n\t\t\t\t\n\t\t\t\tDatasetBean databean = new DatasetBean();\n\t\t\t\tdatabean.setRssFeed(Bytes.toString(r.getValue(Bytes.toBytes(RSSFeedUtils.hbaseTab_cf), Bytes.toBytes(\"rssFeed\"))));\n\t\t\t\tdatabean.setTitle(Bytes.toString(r.getValue(Bytes.toBytes(RSSFeedUtils.hbaseTab_cf), Bytes.toBytes(\"title\"))));\n\t\t\t\tdatabean.setArticleLink(Bytes.toString(r.getValue(Bytes.toBytes(RSSFeedUtils.hbaseTab_cf), Bytes.toBytes(\"articleLink\"))));\n\t\t\t\tdatabean.setDescription(Bytes.toString(r.getValue(Bytes.toBytes(RSSFeedUtils.hbaseTab_cf), Bytes.toBytes(\"description\"))));\n\t\t\t\tdatabean.setCategories(Bytes.toString(r.getValue(Bytes.toBytes(RSSFeedUtils.hbaseTab_cf), Bytes.toBytes(\"categories\"))));\n\t\t\t\tdatabean.setArticleDate(Bytes.toString(r.getValue(Bytes.toBytes(RSSFeedUtils.hbaseTab_cf), Bytes.toBytes(\"articleDate\"))));\n\t\t\t\t\n\t\t\t\treturn databean;\n\t\t\t}\n\t\t});\n\t\t\n\t\tDataset<Row> feeddataset = sparkSession.createDataFrame(feedRDD, DatasetBean.class);\n\t\treturn feeddataset;\n\t}", "private void parseJsonFeed(JSONObject response) {\n try {\n JSONArray newsArray = response.getJSONArray(\"news\");\n hidePDialog();\n\n for (int i = 0; i < newsArray.length(); i++) {\n JSONObject feedObj = (JSONObject) newsArray.get(i);\n\n NewsItem news = new NewsItem();\n\n news.setId(feedObj.getString(\"id\"));\n news.setTitle(feedObj.getString(\"title\"));\n news.setDate(\"Posted on \" + feedObj.getString(\"created_at\"));\n news.setBrief(feedObj.getString(\"brief\"));\n\n //news.setDate(feedObj.getString(\"mdate\"));\n// String rd = feedObj.getString(\"mdate\");\n// news.setDate(\"Release date: \" + rd);\n\n mItems.add(news);\n }\n\n // notify data changes to list adapater\n newsAdapter.notifyDataSetChanged();\n\n } catch (JSONException e) {\n e.printStackTrace();\n hidePDialog();\n }\n }", "private void initData() {\r\n allElements = new Vector<PageElement>();\r\n\r\n String className = Utility.getDisplayName(queryResult.getOutputEntity());\r\n List<AttributeInterface> attributes = Utility.getAttributeList(queryResult);\r\n int attributeSize = attributes.size();\r\n //int attributeLimitInDescStr = (attributeSize < 10) ? attributeSize : 10;\r\n\r\n Map<String, List<IRecord>> allRecords = queryResult.getRecords();\r\n serviceURLComboContents.add(\" All service URLs \");\r\n for (String url : allRecords.keySet()) {\r\n\r\n List<IRecord> recordList = allRecords.get(url);\r\n \r\n StringBuilder urlNameSize = new StringBuilder( url );\r\n urlNameSize = new StringBuilder( urlNameSize.substring(urlNameSize.indexOf(\"//\")+2));\r\n urlNameSize = new StringBuilder(urlNameSize.substring(0,urlNameSize.indexOf(\"/\")));\r\n urlNameSize.append(\" ( \" + recordList.size() + \" )\");\r\n serviceURLComboContents.add(urlNameSize.toString());\r\n Vector<PageElement> elements = new Vector<PageElement>();\r\n for (IRecord record : recordList) {\r\n StringBuffer descBuffer = new StringBuffer();\r\n for (int i = 0; i < attributeSize; i++) {\r\n Object value = record.getValueForAttribute(attributes.get(i));\r\n if (value != null) {\r\n if (i != 0) {\r\n descBuffer.append(',');\r\n }\r\n descBuffer.append(value);\r\n }\r\n }\r\n String description = descBuffer.toString();\r\n // if (description.length() > 150) {\r\n // //150 is allowable chars at 1024 resolution\r\n // description = description.substring(0, 150);\r\n // //To avoid clipping of attribute value in-between\r\n // int index = description.lastIndexOf(\",\");\r\n // description = description.substring(0, index);\r\n // }\r\n PageElement element = new PageElementImpl();\r\n element.setDisplayName(className + \"_\" + record.getRecordId().getId());\r\n element.setDescription(description);\r\n\r\n DataRow dataRow = new DataRow(record, queryResult.getOutputEntity());\r\n dataRow.setParent(parentDataRow);\r\n dataRow.setAssociation(queryAssociation);\r\n\r\n Vector recordListUserObject = new Vector();\r\n recordListUserObject.add(dataRow);\r\n recordListUserObject.add(record);\r\n\r\n element.setUserObject(recordListUserObject);\r\n\r\n allElements.add(element);\r\n elements.add(element);\r\n }\r\n URLSToResultRowMap.put(urlNameSize.toString(), elements);\r\n }\r\n }", "private void submitRssQuery(ContactRssImpl rssContact,\n boolean userRequestedUpdate)\n {\n Message msg;\n boolean newName = false;\n boolean newItem = false;\n boolean update = false;\n String newDisplayName = new String();\n String oldDisplayName = new String();\n \n RssFeedReader rssFeed = rssContact.getRssFeedReader();\n try\n {\n rssFeed.retrieveFlow();\n }\n catch (OperationFailedException ex)\n {\n logger.error(\"Failed to retrieve RSS flow. Error was: \"\n + ex.getMessage()\n , ex);\n return;\n }\n \n \n //we recover the feed's old name\n oldDisplayName = rssContact.getDisplayName();\n \n //we change the contact's displayName according to the feed's title\n newDisplayName = rssFeed.getTitle();\n if (! (newDisplayName.equals(oldDisplayName)))\n {\n newName = true;\n }\n rssContact.setDisplayName(newDisplayName);\n \n //we create the message containing the new items retrieved\n msg = createMessage(rssFeed.feedToString(rssContact.getLastItemKey()));\n \n //if a newer date is available for the current feed/contact looking\n //the date of each item of the feed retrieved, we update this date\n if (rssFeed.getLastItemKey().usesDate())\n {\n if(rssFeed.getLastItemKey().getItemDate()\n .compareTo(rssContact.getLastItemKey().getItemDate()) > 0)\n {\n rssContact.setLastItemKey(\n new RssItemKey(rssFeed.getLastItemKey().getItemDate()));\n newItem = true;\n update = true;\n }\n }\n else\n {\n if (!rssFeed.getLastItemKey().getItemUri().equalsIgnoreCase(\n rssContact.getLastItemKey().getItemUri()))\n {\n rssContact.setLastItemKey(\n new RssItemKey(rssFeed.getLastItemKey().getItemUri()));\n \n newItem = true;\n update = true;\n }\n }\n \n //if we have a new date or a new name on this feed/contact, we fire\n //that the contact has his properties modified in order to save it\n if (newName || newItem)\n this.opSetPersPresence.fireContactPropertyChangeEvent(\n ContactPropertyChangeEvent.\n PROPERTY_DISPLAY_NAME, rssContact,\n oldDisplayName, newDisplayName);\n \n //if the feed has been updated or if the user made a request on a\n //specific feed/contact, we fire a new message containing the new items\n //to the user\n if(update || userRequestedUpdate)\n fireMessageReceived(msg, rssContact);\n }", "private void insertCastsData(Connection conn)\n\t{\n\t\ttry {\n\t\t\tString filmid = null;\n\t\t\tString actorstageName = null;\n\t\t\tint starId;\n\t\t\tint movieId;\n\t\t\tint flag = 0;\n\t\t\tPreparedStatement ptinsertStarMovie = null;\n\t\t\tptinsertStarMovie = (PreparedStatement) conn.prepareStatement(\"Insert into stars_in_movies (starId, movieId) Values (? ,?);\");\n\n\t\t\tElement docElem = dom.getDocumentElement();\n\t\t\tNodeList dirfilmsList = docElem.getElementsByTagName(\"dirfilms\");\n\t\t\tfor (int i = 0; i < dirfilmsList.getLength(); i++) {\n\t\t\t\tElement dirfilmsElem = (Element) dirfilmsList.item(i);\n\t\t\t\tNodeList filmcList = dirfilmsElem.getElementsByTagName(\"filmc\");\n\t\t\t\tif (filmcList != null) {\n\t\t\t\t\tfor (int j = 0; j < filmcList.getLength(); j++) {\n\t\t\t\t\t\tElement filmcElem = (Element) filmcList.item(j);\n\t\t\t\t\t\tNodeList mList = filmcElem.getElementsByTagName(\"m\");\n\t\t\t\t\t\tif (mList != null) {\n\t\t\t\t\t\t\tfor (int k = 0; k < mList.getLength(); k++) {\n\t\t\t\t\t\t\t\tfilmid = null;\n\t\t\t\t\t\t\t\tactorstageName = null;\n\t\t\t\t\t\t\t\tflag = 0;\n\t\t\t\t\t\t\t\t// count3++;\n\t\t\t\t\t\t\t\tElement mElem = (Element) mList.item(k);\n\t\t\t\t\t\t\t\t// Get Film ID\n\t\t\t\t\t\t\t\tNodeList fList = mElem.getElementsByTagName(\"f\");\n\t\t\t\t\t\t\t\tif (fList != null && fList.getLength() > 0) {\n\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\tfilmid = fList.item(0).getFirstChild().getNodeValue();\n\t\t\t\t\t\t\t\t\t\tfilmid = filmid.trim();\n\t\t\t\t\t\t\t\t\t} catch (Exception e1) {\n\t\t\t\t\t\t\t\t\t\t// do nothing\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\tNodeList aList = mElem.getElementsByTagName(\"a\");\n\t\t\t\t\t\t\t\tif (aList != null) {\n\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\tactorstageName = aList.item(0).getFirstChild().getNodeValue();\n\t\t\t\t\t\t\t\t\t\tactorstageName = actorstageName.trim();\n\t\t\t\t\t\t\t\t\t\tactorstageName = actorstageName.toLowerCase();\n\t\t\t\t\t\t\t\t\t} catch (Exception e2) {\n\t\t\t\t\t\t\t\t\t\t// do nothing\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\tif (actorstageName != null && filmid != null) {\n\n\t\t\t\t\t\t\t\t\tif (!movie_map.containsKey(filmid)) {\n\t\t\t\t\t\t\t\t\t\tflag = 1;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif (!star_map.containsKey(actorstageName)) {\n\t\t\t\t\t\t\t\t\t\tflag = 1;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif (flag == 0) {\n\t\t\t\t\t\t\t\t\t\tstarId = star_map.get(actorstageName);\n\t\t\t\t\t\t\t\t\t\tmovieId = movie_map.get(filmid);\n\t\t\t\t\t\t\t\t\t\tptinsertStarMovie.setString(1, \"nm\" + starId);\n\t\t\t\t\t\t\t\t\t\tptinsertStarMovie.setString(2, \"tt\" + movieId);\n\t\t\t\t\t\t\t\t\t\tptinsertStarMovie.addBatch();\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\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tptinsertStarMovie.executeBatch();\n\t\t\tconn.commit();\n\t\t\tptinsertStarMovie.close();\n\t\t\t// PreparedStatement temp = (PreparedStatement)\n\t\t\t// conn.prepareStatement(\"ALTER IGNORE TABLE stars_in_movies ADD\n\t\t\t// constraint myuniqueconstaint UNIQUE (star_id, movie_id);\");\n\t\t\t// temp.executeUpdate();\n\t\t\t// temp.close();\n\n\t\t} catch (SQLException e) {\n\t\t\tSystem.out.println(e.getMessage());\n\t\t}\n\t}", "@Override\n\tpublic void characters(char[] ch, int start, int length)\n\t\t\tthrows SAXException {\n\t\tsuper.characters(ch, start, length);\n\t\tsb.append(ch, start, length);\n\t\tString s = sb.toString();\n\t\tif (tag.equals(\"id\") && isFeed) {\n\t\t\tcommentsInfo.setId(Integer.parseInt(s));\n\t\t} else if (tag.equals(\"title\") && isFeed) {\n\t\t\tcommentsInfo.setTitle(s);\n\t\t} else if (tag.equals(\"published\") && isFeed) {\n\t\t\tcommentsInfo.setPublished(s);\n\t\t} else if (tag.equals(\"updated\") && isFeed) {\n\t\t\tcommentsInfo.setUpdated(s);\n\t\t} else if (tag.equals(\"name\") && isFeed) {\n\t\t\tcommentsInfo.setAuthorName(s);\n\t\t} else if (tag.equals(\"uri\") && isFeed) {\n\t\t\tcommentsInfo.setAuthorUri(s);\n\t\t} else if (tag.equals(\"content\") && isFeed) {\n\t\t\tcommentsInfo.setContent(s);\n\t\t}\n\n\t}", "@Override\n protected String doInBackground(String... params) {\n Map<String, String> payload = new HashMap<String, String>();\n DBHelper db = new DBHelper(context);\n List<Channel> channels = db.getAllChannels();\n String channelString = \"[\";\n for (Channel ch: channels) {\n if(sharedPreferences.getBoolean(\"channel_\"+ch.id,false)){\n channelString += \"\"+ch.id+\",\";\n }\n }\n if(!channelString.equals(\"[\"))\n channelString = channelString.substring(0,channelString.length()-1);\n\n channelString += \"]\";\n Log.d(TAG,channelString);\n // get device IMEI number\n TelephonyManager mngr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);\n String IMEI = \"UNKNOWN\";\n try {\n IMEI = mngr.getDeviceId();\n }catch(Exception e){\n Log.d(TAG,\"Unable to get IMEI\");\n }\n\n payload.put(\"channels\", channelString);\n payload.put(\"IMEI\", IMEI);\n payload.put(\"token\", sharedPreferences.getString(NoticeBoardPreferences.GCM_TOKEN,\"NULL\"));\n String url = NoticeBoardPreferences.URL_SYNC_DB;\n\n NetworkHandler nh = new NetworkHandler(payload, url);\n String result = nh.callServer();\n if(result.equals(\"No response\")){\n pd.dismiss();\n this.cancel(true);\n }\n Log.d(TAG, result);\n\n JSONHandler json = new JSONHandler(result);\n if(json.jsonObject == null){\n Toast.makeText(context,\"Server Error!!!\",Toast.LENGTH_LONG).show();\n cancel(true);\n }\n\n notices = new ArrayList<Notice>();\n channels = new ArrayList<Channel>();\n JSONArray notes = json.getArray(\"notices\");\n\n for (int i = 0; i < notes.length(); i++) {\n try {\n notices.add(new JSONHandler(notes.getString(i)).getNotice());\n } catch (JSONException e) {\n Log.d(TAG, \"JSONException > \" + notes.toString());\n }\n }\n\n JSONArray chans = json.getArray(\"channels\");\n for (int i = 0; i < chans.length(); i++) {\n try {\n channels.add(new JSONHandler(chans.getString(i)).getChannel());\n } catch (JSONException e) {\n Log.d(TAG, \"JSONException > \" + chans.toString());\n }\n }\n\n db.onUpgrade(db.getWritableDatabase(), 1, 1);\n\n for (Notice n : notices) {\n db.insertNotice(n);\n }\n\n for (Channel ch : channels) {\n if(firstRun){\n ch.getAndSetImage(context);\n }\n db.insertChannel(ch);\n }\n\n NoticeBoardPreferences.channels = channels;\n Collections.reverse(notices);\n\n return null;\n }", "public Buoy addBuoy(String title, String link, String textDescription, String htmlDescription) throws BuoyException\n {\n Buoy buoy = null;\n\n // If title is null then cannot process much. Since we have no\n // unioque way to identify the buoy\n if (title == null)\n {\n throw new BuoyException(\"Buoy record in feed with null title element\");\n\n } else\n {\n\n // Extract station ID, Full Name and URL link\n \n buoy = createBuoy(title);\n buoy.setLinkURL(link);\n\n // Extract Data Fields by parsing the HTML Description\n List<String> strongTags = extractDataFields(htmlDescription);\n\n // Use the extracted placeholders to set the reporting time\n // and Weather\n if (strongTags != null && strongTags.size() > 1)\n {\n String reportTime = strongTags.get(0);\n buoy.setReportTime(reportTime);\n strongTags.remove(0);\n\n //System.out.println(\"Buoy : <\" + buoy.getStationID() + \"> Reporting @ <\" + reportTime + \">\");\n int i = 0;\n String leftTag = \"\";\n String rightTag = \"\";\n String value = \"\";\n for (String tag : strongTags)\n {\n\n leftTag = tag;\n if (i < strongTags.size() - 1)\n {\n rightTag = strongTags.get(i + 1);\n } else\n {\n rightTag = \"\";\n }\n i++;\n value = extractDataValue(textDescription, leftTag, rightTag);\n\n if (tag.startsWith(LOCATION_PREFIX))\n {\n // Treat this differently\n extractLatLongAndRelativeLocation(buoy, value);\n\n } else\n {\n // Add the waether condition value to the list of data\n buoy.addWeatherCondition(tag.replace(\":\", \"\"), value);\n }\n }\n } else\n {\n throw new BuoyException(\"Buoy record in feed with incomplete Weather Conditions\");\n }\n }\n\n return buoy;\n }", "void fetchFactFeeds();", "@Override\n protected void initializeFields() {\n \tsuper.initializeFields();\n\n \taddField(new DcField(DcMediaObject._A_TITLE, getIndex(), \"Title\", \n false, true, false, true, \n 255, ComponentFactory._SHORTTEXTFIELD, getIndex(), DcRepository.ValueTypes._STRING,\n \"Title\"));\n addField(new DcField(DcMediaObject._B_DESCRIPTION, getIndex(), \"Description\", \n false, true, false, true, \n 0, ComponentFactory._LONGTEXTFIELD, getIndex(), DcRepository.ValueTypes._STRING,\n \"Description\"));\n addField(new DcField(DcMediaObject._C_YEAR, getIndex(), \"Year\", \n false, true, false, true, \n 4, ComponentFactory._NUMBERFIELD, getIndex(), DcRepository.ValueTypes._LONG,\n \"Year\"));\n\n if (getIndex() != DcModules._IMAGE && !isAbstract())\n addField(new DcField(DcMediaObject._D_LANGUAGE, getIndex(), \"Languages\", \n true, true, false, true, \n 255, ComponentFactory._REFERENCESFIELD, DcModules._LANGUAGE, DcRepository.ValueTypes._DCOBJECTCOLLECTION,\n \"Languages\"));\n \n addField(new DcField(DcMediaObject._E_RATING, getIndex(), \"Rating\", \n false, true, false, true, \n 255, ComponentFactory._RATINGCOMBOBOX, getIndex(), DcRepository.ValueTypes._LONG,\n \"Rating\"));\n addField(new DcField(DcMediaObject._F_COUNTRY, getIndex(), \"Countries\", \n true, true, false, true, \n 255, ComponentFactory._REFERENCESFIELD, DcModules._COUNTRY, DcRepository.ValueTypes._DCOBJECTCOLLECTION,\n \"Countries\")); \n }", "private void prepareData() {\n eventList = databaseHandler.getLatestDistinctEvents(prefs.getString(KEY_SORT_FIELD, \"name\"),\n prefs.getBoolean(KEY_SORT_ORDER_ASCENDING, true));\n\n // Send list to adapter\n eventLogAdapter.updateData(eventList);\n }", "private void saveDBValues() {\r\n this.pl_DB.setParam(\"Hostname\", this.rhostfield.getText());\r\n this.pl_DB.setParam(\"Port\", this.rportfield.getText());\r\n this.pl_DB.setParam(\"Username\", this.ruserfield.getText());\r\n\r\n String pw = \"\";\r\n for (int i = 0; i < this.rpasswdfield.getPassword().length; i++) {\r\n pw += this.rpasswdfield.getPassword()[i];\r\n }\r\n this.pl_DB.setParam(\"Password\", pw);\r\n this.pl_DB.setParam(\"Database\", this.rdatabasefield.getText());\r\n this.pl_DB.setParam(\"nodeTableName\", this.rtablename1efield.getText());\r\n this.pl_DB.setParam(\"nodeColIDName\", this.colnodeIdfield.getText());\r\n this.pl_DB.setParam(\"nodeColLabelName\", this.colnodeLabelfield.getText());\r\n this.pl_DB.setParam(\"edgeTableName\", this.rtablename2efield.getText());\r\n this.pl_DB.setParam(\"edgeCol1Name\", this.coledge1field.getText());\r\n this.pl_DB.setParam(\"edgeCol2Name\", this.coledge2field.getText());\r\n this.pl_DB.setParam(\"edgeColWeightName\", this.colweightfield.getText());\r\n this.pl_DB.setParam(\"resultTableName\", this.otablenamefield.getText());\r\n\r\n this.is_alg_started = false;\r\n this.is_already_read_from_DB = false;\r\n this.is_already_renumbered = false;\r\n }", "private void init() {\n FieldWrapper id = new FieldWrapper();\n id.fieldDescription = new HashMap<String, Object>();\n id.fieldDescription.put(\"fullName\", \"Id\");\n id.fieldDescription.put(\"type\", \"Text\");\n\n FieldWrapper name = new FieldWrapper();\n name.fieldDescription = new HashMap<String, Object>();\n name.fieldDescription.put(\"fullName\", \"Name\");\n\n FieldWrapper createdBy = new FieldWrapper();\n createdBy.fieldDescription = new HashMap<String, Object>();\n createdBy.fieldDescription.put(\"fullName\", \"CreatedBy\");\n createdBy.fieldDescription.put(\"type\", \"Lookup\");\n\n FieldWrapper lastModifiedBy = new FieldWrapper();\n lastModifiedBy.fieldDescription = new HashMap<String, Object>();\n lastModifiedBy.fieldDescription.put(\"fullName\", \"LastModifiedBy\");\n lastModifiedBy.fieldDescription.put(\"type\", \"Lookup\");\n\n FieldWrapper owner = new FieldWrapper();\n owner.fieldDescription = new HashMap<String, Object>();\n owner.fieldDescription.put(\"fullName\", \"Owner\");\n owner.fieldDescription.put(\"type\", \"Lookup\");\n\n fieldDescribe = new HashMap<String, FieldWrapper>();\n\n fieldDescribe.put((String) id.fieldDescription.get(\"fullName\"), id);\n fieldDescribe.put((String) name.fieldDescription.get(\"fullName\"), name);\n fieldDescribe.put((String) createdBy.fieldDescription.get(\"fullName\"), createdBy);\n fieldDescribe.put((String) lastModifiedBy.fieldDescription.get(\"fullName\"), lastModifiedBy);\n fieldDescribe.put((String) owner.fieldDescription.get(\"fullName\"), owner);\n }", "int insertSelective(WxNews record);", "public BBCMetaData(int channel, int cid, int cidSeries, int height) {\n this.channel = channel;\n this.cid = cid;\n this.cidSeries = cidSeries;\n this.height = height;\n }", "private void createTempDatabase() {\n\t\thandler = new ERXmlDocumentHandler(doc);\n\t\tList<String> filter = initFilter(subjectId);\n\t\tparseEntitys(filter);\n\t}", "public interface RSSItemListener {\n\n void addRSSItem(RSSItem rssItem);\n\n ArrayList<RSSItem> getAllRSSItems();\n\n int getRSSItemCount();\n\n}", "public abstract void updateFromFeed(Map<String,List<Map<String,String>>> data);", "public void createPackageContents() {\r\n\t\tif (isCreated)\r\n\t\t\treturn;\r\n\t\tisCreated = true;\r\n\r\n\t\t// Create classes and their features\r\n\t\tdataChannelEClass = createEClass(DATA_CHANNEL);\r\n\t\tcreateEAttribute(dataChannelEClass, DATA_CHANNEL__CAPACITY);\r\n\t\tcreateEReference(dataChannelEClass, DATA_CHANNEL__SOURCE_EVENT_GROUP);\r\n\t\tcreateEReference(dataChannelEClass, DATA_CHANNEL__SINK_EVENT_GROUP);\r\n\t\tcreateEReference(dataChannelEClass, DATA_CHANNEL__DATA_CHANNEL_SOURCE_CONNECTOR);\r\n\t\tcreateEReference(dataChannelEClass, DATA_CHANNEL__DATA_CHANNEL_SINK_CONNECTOR);\r\n\t\tcreateEReference(dataChannelEClass, DATA_CHANNEL__PARTITIONING);\r\n\t\tcreateEReference(dataChannelEClass, DATA_CHANNEL__TIME_GROUPING);\r\n\t\tcreateEReference(dataChannelEClass, DATA_CHANNEL__JOINS);\r\n\t\tcreateEAttribute(dataChannelEClass, DATA_CHANNEL__OUTGOING_DISTRIBUTION);\r\n\t\tcreateEAttribute(dataChannelEClass, DATA_CHANNEL__SCHEDULING);\r\n\t\tcreateEAttribute(dataChannelEClass, DATA_CHANNEL__PUT_POLICY);\r\n\t}", "private void fillData() {\n\t\tmCursor = dbHelper.getResultsByTime();\n\t\tstartManagingCursor(mCursor);\n\n\t\tdataListAdapter = new SimpleCursorAdapter(this, R.layout.row, mCursor,\n\t\t\t\tFROM, TO);\n\t\tmConversationView.setAdapter(dataListAdapter);\n\t}", "public static List<News> parseNewsInfo(String newsString)\n {\n List<News> newsList = new ArrayList<News>();\n try\n {\n JSONObject jsonObject = new JSONObject(newsString);\n Log.i(\"MY_TEST_JSON_OBJECT\", \"\" + jsonObject);\n JSONArray data = jsonObject.getJSONArray(\"T1348647853363\");\n Log.i(\"data_LENGTH\", data.length() + \"\");\n for(int i = 1; i < data.length(); i++){\n Log.i(\"data_LENGTH-------\", i + \"\");\n News tmp_news = new News();\n Log.i(\"data_LENGTH-------\", \"A\" + i);\n JSONObject tmp = data.getJSONObject(i);\n Log.i(\"data_LENGTH-------\", \"B\" + i);\n tmp_news.setTitle(tmp.getString(\"title\"));\n Log.i(\"data_LENGTH-------\", \"C\" + i);\n try {\n tmp_news.setUrl(tmp.getString(\"url_3w\"));\n }catch (Exception e){\n tmp_news.setUrl(\"\");\n }\n Log.i(\"data_LENGTH-------\", \"D\" + i);\n tmp_news.setSource(\"\");\n Log.i(\"data_LENGTH-------\", \"E\" + i);\n tmp_news.setLmodify(\"\");\n Log.i(\"data_LENGTH-------\", \"F\" + i);\n tmp_news.setImgSrc(\"\");\n Log.i(\"data_LENGTH-------\", \"G\" + i);\n tmp_news.setSubtitle(\"\");\n Log.i(\"data_LENGTH-------\", \"H\" + i);\n tmp_news.setPtime(tmp.getString(\"ptime\"));\n Log.i(\"data_LENGTH-------\", \"I\" + i);\n newsList.add(tmp_news);\n }\n }\n catch (Exception e)\n {\n e.printStackTrace();\n }\n\n return newsList;\n }", "public void setupFields()\n {\n FieldInfo field = null;\n field = new FieldInfo(this, \"ID\", Constants.DEFAULT_FIELD_LENGTH, null, null);\n field.setDataClass(Integer.class);\n field.setHidden(true);\n field = new FieldInfo(this, \"LastChanged\", Constants.DEFAULT_FIELD_LENGTH, null, null);\n field.setDataClass(Date.class);\n field.setHidden(true);\n field = new FieldInfo(this, \"Deleted\", 10, null, new Boolean(false));\n field.setDataClass(Boolean.class);\n field.setHidden(true);\n field = new FieldInfo(this, \"Description\", 25, null, null);\n field = new FieldInfo(this, \"CurrencyCode\", 3, null, null);\n field = new FieldInfo(this, \"LastRate\", 10, null, null);\n field.setDataClass(Double.class);\n field.setScale(-1);\n field = new FieldInfo(this, \"RateChangedDate\", 12, null, null);\n field.setDataClass(Date.class);\n field.setScale(Constants.DATE_ONLY);\n field = new FieldInfo(this, \"RateChangedBy\", 16, null, null);\n field.setDataClass(Integer.class);\n field = new FieldInfo(this, \"CostingRate\", 10, null, null);\n field.setDataClass(Double.class);\n field.setScale(-1);\n field = new FieldInfo(this, \"CostingChangedDate\", 12, null, null);\n field.setDataClass(Date.class);\n field.setScale(Constants.DATE_ONLY);\n field = new FieldInfo(this, \"CostingChangedBy\", 16, null, null);\n field.setDataClass(Integer.class);\n field = new FieldInfo(this, \"RoundAt\", 1, null, null);\n field.setDataClass(Short.class);\n field = new FieldInfo(this, \"IntegerDesc\", 20, null, \"Dollar\");\n field = new FieldInfo(this, \"FractionDesc\", 20, null, null);\n field = new FieldInfo(this, \"FractionAmount\", 10, null, new Integer(100));\n field.setDataClass(Integer.class);\n field = new FieldInfo(this, \"Sign\", 3, null, \"$\");\n field = new FieldInfo(this, \"LanguageID\", Constants.DEFAULT_FIELD_LENGTH, null, null);\n field.setDataClass(Integer.class);\n field = new FieldInfo(this, \"NaturalInteger\", 20, null, null);\n field = new FieldInfo(this, \"NaturalFraction\", 20, null, null);\n }", "private void publishfeed(String type,JSONObject jsonRoot) throws JSONException {\n\t\t\tJSONObject jLocation = jsonRoot.getJSONObject(\"weather\").getJSONObject(\"location\");\n\t\t\tJSONObject jCondition = jsonRoot.getJSONObject(\"weather\").getJSONObject(\"condition\");\n\t\t\tString city = jLocation.getString(\"city\");\n\t\t\tString region = jLocation.getString(\"region\");\n\t\t\tString country = jLocation.getString(\"country\");\n\t\t\tString text = jCondition.getString(\"text\");\n\t\t\tString temp = jCondition.getString(\"temp\");\n\t\t\tString unit = jsonRoot.getJSONObject(\"weather\").getJSONObject(\"units\").getString(\"temperature\");\n\t\t\tString feed = jsonRoot.getJSONObject(\"weather\").getString(\"feed\");\n\t\t\tString detail = jsonRoot.getJSONObject(\"weather\").getString(\"link\");\n\t\t\tString imgUrl = \"\";\n\t\t\tString name =\"\";\n\t\t\tString caption = \"\";\n\t\t\tString description = \"\";\n\t\t\t\n\t\t\tif(!region.equals(\"\")){\n\t\t\t\tname = city + \",\" + region + \",\" + country;\n\t\t\t} else{\n\t\t\t\tname = city + \",\" + country;\n\t\t\t}\n\t\t\t\n\t\t\tif(type.equals(\"current\")){\n\t\t\t\tcaption = \"The current condition for \" + city + \"is \" + text;\n\t\t\t\tdescription = \"Temperature is \" + temp + (char) 0x00B0 + unit;\n\t\t\t\timgUrl = jsonRoot.getJSONObject(\"weather\").getString(\"img\");\n\t\t\t} else {\n\t\t\t\tcaption = \"Weather forecast for \" + city;\n\t\t\t\timgUrl = \"http://www-scf.usc.edu/~csci571/2013Fall/hw8/weather.jpg\";\n\t\t\t\tJSONArray jsonForecasts = jsonRoot.getJSONObject(\"weather\").getJSONArray(\"forecast\");\n\t\t\t\tfor(int i = 0; i < jsonForecasts.length(); i++){\n\t\t\t\t\tJSONObject obj = jsonForecasts.getJSONObject(i);\n\t\t\t\t\tdescription += obj.getString(\"day\") + \": \" + obj.getString(\"text\") + \", \" \n\t\t\t\t\t + obj.getString(\"high\") + \"/\" + obj.getString(\"low\") + (char) 0x00B0 + unit + \" \";\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tJSONObject property = new JSONObject(); \n\t\t\tproperty.put(\"text\", \"here\"); \n\t\t\tproperty.put(\"href\", detail); \n\t\t\tJSONObject properties = new JSONObject(); \n\t\t\tproperties.put(\"Look at details\", property); \n\t\t\tBundle params = new Bundle();\n\t\t\tparams.putString(\"name\", name);\n\t\t params.putString(\"caption\", caption);\n\t\t params.putString(\"description\", description);\n\t\t params.putString(\"link\", feed);\n\t\t params.putString(\"picture\", imgUrl);\n\t\t params.putString(\"properties\", properties.toString());\n\t\t WebDialog feedDialog = (\n\t\t\t new WebDialog.FeedDialogBuilder(MainActivity.this,\n\t\t\t Session.getActiveSession(),\n\t\t\t params))\n\t\t\t .setOnCompleteListener(new OnCompleteListener() {\n\n\t\t\t @Override\n\t\t\t public void onComplete(Bundle values,\n\t\t\t FacebookException error) {\n\t\t\t if (error == null) {\n\t\t\t // When the story is posted, echo the success\n\t\t\t // and the post Id.\n\t\t\t final String postId = values.getString(\"post_id\");\n\t\t\t if (postId != null) {\n\t\t\t Toast.makeText(MainActivity.this,\n\t\t\t \"Posted story, id: \"+postId,\n\t\t\t Toast.LENGTH_SHORT).show();\n\t\t\t } else {\n\t\t\t // User clicked the Cancel button\n\t\t\t Toast.makeText(MainActivity.this.getApplicationContext(), \n\t\t\t \"Publish cancelled\", \n\t\t\t Toast.LENGTH_SHORT).show();\n\t\t\t }\n\t\t\t } else if (error instanceof FacebookOperationCanceledException) {\n\t\t\t // User clicked the \"x\" button\n\t\t\t Toast.makeText(MainActivity.this.getApplicationContext(), \n\t\t\t \"Publish cancelled\", \n\t\t\t Toast.LENGTH_SHORT).show();\n\t\t\t } else {\n\t\t\t // Generic, ex: network error\n\t\t\t Toast.makeText(MainActivity.this.getApplicationContext(), \n\t\t\t \"Error posting story\", \n\t\t\t Toast.LENGTH_SHORT).show();\n\t\t\t }\n\t\t\t }\n\n\t\t\t })\n\t\t\t .build();\n\t\t\t feedDialog.show();\n\n\t\t}", "private static String constructValues(productCategory product,ArrayList<String> attributes,String partNumber)\n {\n //Since we will already have INSERT INTO *Category* we can start with the '('\n\n /* STMT: INSERT INTO *Category* */\n StringBuilder val = new StringBuilder(\" (\");\n\n /* STMT: INSERT INTO *Category* ( */\n\n val.append(product.categoryName.getValue());\n if(attributes.size() > 0)\n {\n val.append(\"_Part_Number,\");\n }\n else\n {\n val.append(\"_Part_Number\");\n }\n\n //the attributes array holds the names of\n //each column in the specified category table\n //here we add them all to the string in the\n //proper format\n for(int i=0; i<attributes.size(); i++)\n {\n attributes.set(i,attributes.get(i).replace(\" \",\"_\"));\n val.append(attributes.get(i));\n //If we are at the last attribute we\n //don't need to add the extra comma\n if(i != attributes.size()-1)\n {\n val.append(\",\");\n }\n\n }\n\n /* STMT: INSERT INTO *Category* (*All columns in table* */\n\n //Close the columns and start values\n val.append(\") VALUES ('\");\n\n /* STMT: INSERT INTO *Category* (*All columns in table*) VALUES (' */\n\n //Since attributes does not contain the part\n //number we have to add that separately\n val.append(partNumber);\n\n /* STMT: INSERT INTO *Category* (*All columns in table*) VALUES ('*PartNumber* */\n\n //It is possible that a product category can\n //have no attributes except the part number.\n //if this is the case make sure we don't add\n //the extra comma in the statement\n if(!attributes.isEmpty())\n {\n val.append(\"',\");\n }\n else\n {\n val.append(\"'\");\n }\n\n /* STMT: INSERT INTO *Category* (*All columns in table*) VALUES ('*PartNumber*', */\n\n\n //Now we can get the actual values for each column\n //by pulling the values from the productCategory\n //'product' object's 'attributes' array\n for(int i=0; i<product.attributes.size(); i++)\n {\n val.append(\"'\");\n val.append(product.attributes.get(i));\n //If we are at the last value make sure\n //we don't add the extra comma\n if(i != product.attributes.size()-1)\n {\n val.append(\"',\");\n }\n else\n {\n val.append(\"'\");\n }\n }\n\n /* STMT: INSERT INTO *Category* (*All columns in table*) VALUES ('*PartNumber*,'*All Values*' */\n\n //finally we close the statement\n val.append(\");\");\n\n /* STMT: INSERT INTO *Category* (*All columns in table*) VALUES ('*PartNumber*,'*All Values*'); */\n\n return val.toString();\n }", "@POST\n\t\t\t@Path(\"/formdata\")\n\t\t\t@Consumes(MediaType.MULTIPART_FORM_DATA)\n\t\t\t@Produces({MediaType.APPLICATION_XML})\n\t\t\tpublic Rows postFormDataChannel(@Context UriInfo uriInfo,@Context HttpHeaders header,@FormDataParam(\"body\") String xml) {\n\t\t\t\tRows rows = null;\n\t\t\t\tChannelDao post;\n\t\t\t\ttry {\n\t\t\t\t\tpost=new ChannelDao(uriInfo,header);\n\t\t\t\t\tpost.setPostXml(xml.trim());\n\t\t\t\t\tif(post.postChannelContainer()){\n\t\t\t\t\t\trows=post.getChannelRowModified();\n\t\t\t\t\t}else{\n\t\t\t\t\t rows=new TemplateUtility().getFailedMessage(\"{\\\"rowcount\\\":0,\\\"errormsg\\\":\\\"Record could not be saved!\\\"}\");\n\t\t\t\t\t}\n\t\t\t\t} catch (AuthenticationException e) {\n\t\t\t\t\t rows=new TemplateUtility().getFailedMessage(e.getMessage());\n\t\t\t\t\t e.printStackTrace();\n\t\t\t\t} catch (DaoException d) {\n\t\t\t\t\t d.printStackTrace();\n\t\t\t\t}\n\t\t\t\treturn rows;\n\t\t\t}", "public void processsBusinessLogic(String siteUrl)\n\t\t\tthrows ClientProtocolException, IOException {\n\t\tString htmlString = readHtmlStreamAsString(siteUrl);\n\n\t\t/*\n\t\t * Parses HTML page. and put the related data into model object.\n\t\t */\n\t\tweeklyTopic = new WeeklyTopic();\n\t\tweeklyTopic = this.parseHtmlStringIntoModel(htmlString, weeklyTopic);\n\n\t\tif (StringUtil.isEmpty(weeklyTopic.getTopic())\n\t\t\t\t|| StringUtil.isEmpty(weeklyTopic.getTopicDescription())) {\n\t\t\t// if no topic this week\n\t\t\treturn;\n\t\t}\n\n\t\t/*\n\t\t * Save model object information into database\n\t\t */\n\t\t// Preparation Process. Get a ServiceManager to retrieve Service.\n\t\tServiceManager mgr = ServiceManager.getInstance(this.context);\n\t\tWeeklyTopicService weeklyTopicSerice = (WeeklyTopicService) mgr\n\t\t\t\t.getService(WeeklyTopicService.class.getName());\n\n\t\tint weekNumber = -1;\n\n\t\tboolean weeklyTopicExists = weeklyTopicSerice.exists(\n\t\t\t\tweeklyTopic.getYear(), weeklyTopic.getWeek());\n\n\t\t// if weekly topic exists, get its id, if not, insert entry and get its\n\t\t// id\n\t\tif (weeklyTopicExists) {\n\t\t\tweekNumber = weeklyTopicSerice.getTopicIdByYearAndWeek(\n\t\t\t\t\tweeklyTopic.getYear(), weeklyTopic.getWeek());\n\t\t} else {\n\t\t\tweekNumber = weeklyTopicSerice.addTopic(weeklyTopic.getYear(),\n\t\t\t\t\tweeklyTopic.getWeek(), weeklyTopic.getTopic(),\n\t\t\t\t\tweeklyTopic.getTopicDescription());\n\t\t}\n\n\t\tif (weekNumber < 0) {\n\t\t\t// error\n\t\t\tlogger.error(\"week number < 0. \");\n\t\t\treturn;\n\t\t}\n\n\t\t/*\n\t\t * Save daily topic information into database\n\t\t */\n\n\t\t// Get a Service to talk to database.\n\t\tDailyTopicService dailyTopicService = (DailyTopicService) mgr\n\t\t\t\t.getService(DailyTopicService.class.getName());\n\n\t\t// Save a list of daily topics to database\n\t\tList<DailyTopic> dailyTopics = weeklyTopic.getDailyTopics();\n\t\tfor (DailyTopic dt : dailyTopics) {\n\n\t\t\t// check if weekday topic already existed\n\t\t\tboolean weekDayTopicExists = dailyTopicService.exists(dt\n\t\t\t\t\t.getIssueDate());\n\n\t\t\tif (weekDayTopicExists) {\n\t\t\t\t// weekday topic exists. skip it\n\t\t\t\tif (logger.isDebugEnabled()) {\n\t\t\t\t\tlogger.debug(\"weekday topic exists. info :\" + dt.toString());\n\t\t\t\t}\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tdailyTopicService.addDailyTopic(dt.getIssueDate(), dt.getWord(),\n\t\t\t\t\tdt.getDefinition(), weekNumber, dt.getTopicLink());\n\t\t}\n\n\t\t/*\n\t\t * Read each of the daily topic, and save its information to database.\n\t\t */\n\n\t\t// Get a Service to talk to database\n\t\tDailyTopicWordsAndQuoteService dailyTopicWordsQuoteService = (DailyTopicWordsAndQuoteService) mgr\n\t\t\t\t.getService(DailyTopicWordsAndQuoteService.class.getName());\n\n\t\t// Get Ids and Urls\n\t\tList<Map<String, Object>> idsAndUrls = dailyTopicService\n\t\t\t\t.getIdsAndUrls(weekNumber);\n\n\t\t// Talk the list of Ids and Urls to Parse daily topic detail words and\n\t\t// quotes information;\n\t\tfor (Map<String, Object> idAndUrl : idsAndUrls) {\n\t\t\t// request info from url\n\t\t\tint id = (Integer) idAndUrl.get(\"id\");\n\t\t\tString url = (String) idAndUrl.get(\"topic_link\");\n\n\t\t\tif (logger.isDebugEnabled()) {\n\t\t\t\tlogger.debug(id);\n\t\t\t\tlogger.debug(url);\n\t\t\t}\n\n\t\t\t// Read htmlString and populate data model\n\t\t\twordsAndQuote = new DailyTopicWordsAndQuote();\n\t\t\twordsAndQuote = extractAndPopulateDailyTopicWords(url,\n\t\t\t\t\twordsAndQuote);\n\n\t\t\t// Save information in data model to database\n\t\t\tdailyTopicService.updateImageUrlandQuotes(id,\n\t\t\t\t\twordsAndQuote.getImageUrl(),\n\t\t\t\t\twordsAndQuote.getEnglishQuote(),\n\t\t\t\t\twordsAndQuote.getChineseQuote());\n\n\t\t\t// Get the daily words list and walk through them.\n\t\t\t// Save the data while talking through\n\t\t\tList<DailyWord> dailyWords = wordsAndQuote.getWords();\n\n\t\t\tfor (DailyWord aWord : dailyWords) {\n\n\t\t\t\tboolean wordExists = dailyTopicWordsQuoteService.exists(\n\t\t\t\t\t\taWord.getWord(), id);\n\n\t\t\t\tif (wordExists) {\n\t\t\t\t\t// skip insertion\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// save back to database with id\n\t\t\t\tdailyTopicWordsQuoteService.addDailyTopicWords(aWord.getWord(),\n\t\t\t\t\t\taWord.getDefinition(), id);\n\t\t\t}\n\n\t\t}\n\n\t}", "private void initializeData() {\n posts = new ArrayList<>();\n posts.add(new Posts(\"Emma Wilson\", \"23 years old\", R.drawable.logo));\n posts.add(new Posts(\"Lavery Maiss\", \"25 years old\", R.drawable.star));\n posts.add(new Posts(\"Lillie Watts\", \"35 years old\", R.drawable.profile));\n }", "public ArrayList<Publication> parseXML(){\n ArrayList<Publication> publications = new ArrayList<Publication>();\n try {\n System.out.println(\"Starting parse xml\");\n DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\n DocumentBuilder builder = factory.newDocumentBuilder();\n Document document = builder.parse(new File(\"dblp_abstract_dataset.xml\"));\n document.getDocumentElement().normalize();\n NodeList nodeList = document.getDocumentElement().getChildNodes();\n parseChannelNodes(nodeList,publications);\n System.out.println(\"publications count: \"+publications.size());\n }catch (ParserConfigurationException ex){\n ex.printStackTrace();\n } catch (SAXException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return publications;\n }", "@Override\n\tprotected Feed newFeed() {\n\t\treturn new Feed(this.feedType);\n\t}", "@Override\r\n\tpublic void initAditionalPanelElements() {\n\t\tchartDataset = new TimeSeriesCollection();\r\n\t\tfor(int i = 0; i < categoryVariableBuffers.size(); i++) \r\n\t\t\tchartDataset.addSeries(categoryVariableBuffers.get(i).getDataSerie());\r\n\t}", "public void readFeed() {\n\t\tfeedSvc.getFeed(date, new GetFeedCallback());\n\t\tdate=new Date();\n\t}", "public void init() {\n\n\t\tif (optionFields == null) {\n\t\t\toptionFields = new HashMap<String, MetaVal>();\n\t\t}\n\t\tif (inputFields == null) {\n\t\t\tinputFields = new HashMap<String, MetaVal>();\n\t\t}\n\t\tif (outputFields == null) {\n\t\t\toutputFields = new HashMap<String, MetaVal>();\n\t\t}\n\n\t\t// repository xml key tag, metavalue default, web tag, and size are set here\n\t\t// OPTIONS\n\t\toptionFields.put(TAG_OPTION_DOMINANT_BUSINESS, new MetaVal(\"yes\", \"ReturnDominantBusiness:\", 0));\n\t\toptionFields.put(TAG_OPTION_INCLUDE_CENSUS, new MetaVal(\"false\", \"GrpCensus\", 0));\n\n\n\t\t// INPUTS\n\t\tinputFields.put(TAG_INPUT_BUSINESS_NAME, new MetaVal(\"\", \"comp\", 50));\n\t\tinputFields.put(TAG_INPUT_ADDRESS_LINE1, new MetaVal(\"\", \"a1\", 50));\n\t\tinputFields.put(TAG_INPUT_ADDRESS_LINE2, new MetaVal(\"\", \"a2\", 20));\n\t\tinputFields.put(TAG_INPUT_CITY, new MetaVal(\"\", \"city\", 50));\n\t\tinputFields.put(TAG_INPUT_STATE, new MetaVal(\"\", \"state\", 3));\n\t\tinputFields.put(TAG_INPUT_POSTAL_CODE, new MetaVal(\"\", \"postal\", 10));\n\t\tinputFields.put(TAG_INPUT_COUNTRY, new MetaVal(\"US\", \"ctry\", 50));\n\t\tinputFields.put(TAG_INPUT_PHONE, new MetaVal(\"\", \"phone\", 12));\n\t\tinputFields.put(TAG_INPUT_ADDRESS_KEY, new MetaVal(\"\", \"mak\", 50));\n\t\tinputFields.put(TAG_INPUT_STOCK_TICKER, new MetaVal(\"\", \"stock\", 10));\n\t\tinputFields.put(TAG_INPUT_WEB_ADDRESS, new MetaVal(\"\", \"web\", 50));\n\n\t\t// OUTPUTS\n\t\toutputFields.put(TAG_OUTPUT_RESULTS, new MetaVal(\"MD_Results\", \"Results\", 50));\n\t\toutputFields.put(TAG_OUTPUT_COMPANY_NAME, new MetaVal(\"MD_CompanyName\", \"CompanyName\", 50));\n\t\toutputFields.put(TAG_OUTPUT_ADDRESS_LINE1, new MetaVal(\"MD_AddressLine1\", \"AddressLine1\", 50));\n\t\toutputFields.put(TAG_OUTPUT_SUITE, new MetaVal(\"MD_Suite\", \"Suite\", 50));\n\t\toutputFields.put(TAG_OUTPUT_CITY, new MetaVal(\"MD_City\", \"City\", 50));\n\t\toutputFields.put(TAG_OUTPUT_STATE, new MetaVal(\"MD_State\", \"State\", 50));\n\n\t\toutputFields.put(TAG_OUTPUT_COUNTRY_NAME, new MetaVal(\"MD_CountryName\", \"CountryName\", 50));\n\t\toutputFields.put(TAG_OUTPUT_COUNTRY_CODE, new MetaVal(\"MD_CountryCode\", \"CountryCode\", 50));\n\t\toutputFields.put(TAG_OUTPUT_EIN, new MetaVal(\"MD_EIN\", \"EIN\", 50));\n\n\t\toutputFields.put(TAG_OUTPUT_POSTAL_CODE, new MetaVal(\"MD_PostalCode\", \"PostalCode\", 10));\n\t\toutputFields.put(TAG_OUTPUT_LOCATION_TYPE, new MetaVal(\"MD_LocationType\", \"LocationType\", 50));\n// outputFields.put(TAG_OUTPUT_FEMALE_OWNED, new MetaVal(\"MD_FemaleOwned\", \"FemaleOwned\", 50));\n// outputFields.put(TAG_OUTPUT_SMALL_BUSINESS, new MetaVal(\"MD_SmallBusiness\", \"SmallBusiness\", 50));\n// outputFields.put(TAG_OUTPUT_HOME_BASED_BUSINESS, new MetaVal(\"MD_HomeBasedBusiness\", \"HomeBasedBusiness\", 50));\n\t\toutputFields.put(TAG_OUTPUT_PHONE, new MetaVal(\"MD_Phone\", \"Phone\", 50));\n// outputFields.put(TAG_OUTPUT_LOCAL_EMPLOYEES_ESTIMATE, new MetaVal(\"MD_LocalEmployeesEstimate\", \"LocalEmployeesEstimate\",\n// 50));\n// outputFields.put(TAG_OUTPUT_LOCAL_SALES_ESTIMATE, new MetaVal(\"MD_LocalSalesEstimate\", \"LocalSalesEstimate\", 50));\n\t\toutputFields.put(TAG_OUTPUT_EMPLOYEES_ESTIMATE, new MetaVal(\"MD_TotalEmployeesEstimate\", \"EmployeesEstimate\", 50));\n\t\toutputFields.put(TAG_OUTPUT_SALES_ESTIMATE, new MetaVal(\"MD_TotalSalesEstimate\", \"SalesEstimate\", 50));\n\t\toutputFields.put(TAG_OUTPUT_STOCK_TICKER, new MetaVal(\"MD_StockTicker\", \"StockTicker\", 50));\n\t\toutputFields.put(TAG_OUTPUT_WEB_ADDRESS, new MetaVal(\"MD_WebAddress\", \"WebAddress\", 50));\n\t\toutputFields.put(TAG_OUTPUT_SIC_CODE, new MetaVal(\"MD_SICCode1\", \"SICCode1\", 50));\n\t\toutputFields.put(TAG_OUTPUT_SIC_DESCRIPTION, new MetaVal(\"MD_SICDescription1\", \"SICDescription1\", 50));\n\t\toutputFields.put(TAG_OUTPUT_SIC_CODE2, new MetaVal(\"MD_SICCode2\", \"SICCode2\", 50));\n\t\toutputFields.put(TAG_OUTPUT_SIC_DESCRIPTION2, new MetaVal(\"MD_SICDescription2\", \"SICDescription2\", 50));\n\t\toutputFields.put(TAG_OUTPUT_SIC_CODE3, new MetaVal(\"MD_SICCode3\", \"SICCode3\", 50));\n\t\toutputFields.put(TAG_OUTPUT_SIC_DESCRIPTION3, new MetaVal(\"MD_SICDescription3\", \"SICDescription3\", 50));\n\t\toutputFields.put(TAG_OUTPUT_NAICS_CODE, new MetaVal(\"MD_NAICSCode1\", \"NAICSCode1\", 50));\n\t\toutputFields.put(TAG_OUTPUT_NAICS_DESCRIPTION, new MetaVal(\"MD_NAICSDescription1\", \"NAICSDescription1\", 50));\n\t\toutputFields.put(TAG_OUTPUT_NAICS_CODE2, new MetaVal(\"MD_NAICSCode2\", \"NAICSCode2\", 50));\n\t\toutputFields.put(TAG_OUTPUT_NAICS_DESCRIPTION2, new MetaVal(\"MD_NAICSDescription2\", \"NAICSDescription2\", 50));\n\t\toutputFields.put(TAG_OUTPUT_NAICS_CODE3, new MetaVal(\"MD_NAICSCode3\", \"NAICSCode3\", 50));\n\t\toutputFields.put(TAG_OUTPUT_NAICS_DESCRIPTION3, new MetaVal(\"MD_NAICSDescription3\", \"NAICSDescription3\", 50));\n\n\t\toutputFields.put(TAG_OUTPUT_CENSUS_BLOCK, new MetaVal(\"MD_CensusBlock\", \"CensusBlock\", 50));\n\t\toutputFields.put(TAG_OUTPUT_CENSUS_TRACT, new MetaVal(\"MD_CensusTract\", \"CensusTract\", 50));\n\t\toutputFields.put(TAG_OUTPUT_COUNTY_FIPS, new MetaVal(\"MD_CountyFIPS\", \"CountyFIPS\", 50));\n\t\toutputFields.put(TAG_OUTPUT_COUNTY_NAME, new MetaVal(\"MD_CountyName\", \"CountyName\", 50));\n\t\toutputFields.put(TAG_OUTPUT_DELIVERY_INDICATOR, new MetaVal(\"MD_DeliveryIndicator\", \"DeliveryIndicator\", 50));\n\t\toutputFields.put(TAG_OUTPUT_LATITUDE, new MetaVal(\"MD_Latitude\", \"Latitude\", 50));\n\t\toutputFields.put(TAG_OUTPUT_LONGITUDE, new MetaVal(\"MD_Longitude\", \"Longitude\", 50));\n\t\toutputFields.put(TAG_OUTPUT_MD_ADDRESS_KEY, new MetaVal(\"MD_MelissaAddressKey\", \"MelissaAddressKey\", 50));\n\t\toutputFields.put(TAG_OUTPUT_MD_ADDRESS_KEY_BASE, new MetaVal(\"MD_MelissaAddressKeyBase\", \"MelissaAddressKeyBase\", 50));\n\t\toutputFields.put(TAG_OUTPUT_PLUS_4, new MetaVal(\"MD_Plus4\", \"Plus4\", 50));\n\t\toutputFields.put(TAG_OUTPUT_PLACE_NAME, new MetaVal(\"MD_PlaceName\", \"PlaceName\", 50));\n\t\toutputFields.put(TAG_OUTPUT_PLACE_CODE, new MetaVal(\"MD_PlaceCode\", \"PlaceCode\", 50));\n\n\t\toutputFields.put(TAG_OUTPUT_FIRST_NAME_1, new MetaVal(\"MD_FirstName1\", \"NameFirst\", 50));\n\t\toutputFields.put(TAG_OUTPUT_LAST_NAME_1, new MetaVal(\"MD_LastName1\", \"NameLast\", 50));\n\t\toutputFields.put(TAG_OUTPUT_GENDER_1, new MetaVal(\"MD_Gender1\", \"Gender\", 50));\n\t\toutputFields.put(TAG_OUTPUT_TITLE_1, new MetaVal(\"MD_Title1\", \"Title\", 50));\n\t\toutputFields.put(TAG_OUTPUT_EMAIL_1, new MetaVal(\"MD_Email1\", \"Email\", 50));\n\n\t\toutputFields.put(TAG_OUTPUT_FIRST_NAME_2, new MetaVal(\"MD_FirstName2\", \"NameFirst\", 50));\n\t\toutputFields.put(TAG_OUTPUT_LAST_NAME_2, new MetaVal(\"MD_LastName2\", \"NameLast\", 50));\n\t\toutputFields.put(TAG_OUTPUT_GENDER_2, new MetaVal(\"MD_Gender2\", \"Gender\", 50));\n\t\toutputFields.put(TAG_OUTPUT_TITLE_2, new MetaVal(\"MD_Title2\", \"Title\", 50));\n\t\toutputFields.put(TAG_OUTPUT_EMAIL_2, new MetaVal(\"MD_Email2\", \"Email\", 50));\n\n\t}", "public JsonObjectBuilder update() {\n\t\tDeque<RSSFeedItem> pulledData = pullFeed();\n\t\tif (pulledData == null || pulledData.isEmpty()) return null;\n\t\t\n\t\tDeque<RSSFeedItem> newData = null;\n\t\t\n\t\tRSSFeedItem newItem;\n\t\twhile (!pulledData.isEmpty()) {\n\t\t\tnewItem = pulledData.removeLast();\n\t\t\tif (!itemDeque.contains(newItem)) {\n\t\t\t\t\n\t\t\t\t// Initialize\n\t\t\t\tif (newData == null) newData = new ArrayDeque<>();\n\t\t\t\t\n\t\t\t\tnewData.add(newItem);\n\t\t\t\titemDeque.push(newItem);\n\t\t\t\t\n\t\t\t\tif (itemDeque.size() > RSSParser.maxItemsStored) {\n\t\t\t\t\titemDeque.removeLast();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (newData == null) return null;\n\t\treturn getObjectBuilder(newData);\n\t}", "private void initData() {\n Author steinbeck = new Author(\"John\", \"Steinbeck\");\n Publisher p1 = new Publisher(\"Covici Friede\", \"111 Main Street\", \"Santa Cruz\", \"CA\", \"95034\");\n Book omam = new Book(\"Of Mice And Men\", \"11234\", p1);\n \n publisherRepository.save(p1);\n\n steinbeck.getBooks().add(omam);\n omam.getAuthors().add(steinbeck);\n authorRepository.save(steinbeck);\n bookRepository.save(omam);\n\n // Create Crime & Punishment\n Author a2 = new Author(\"Fyodor\", \"Dostoevsky\");\n Publisher p2 = new Publisher( \"The Russian Messenger\", \"303 Stazysky Rao\", \"Rustovia\", \"OAL\", \"00933434-3943\");\n Book b2 = new Book(\"Crime and Punishment\", \"22334\", p2);\n a2.getBooks().add(b2);\n b2.getAuthors().add(a2);\n\n publisherRepository.save(p2);\n authorRepository.save(a2);\n bookRepository.save(b2);\n }", "private void getSavedDBValues() {\r\n boolean isSet[] = new boolean[12];\r\n for (int i = 0; i < 12; i++)\r\n isSet[i] = false;\r\n\r\n if (this.pl_DB.getParam(\"Hostname\") != null) {\r\n this.hostnameString = this.pl_DB.getParam(\"Hostname\");\r\n isSet[0] = true;\r\n } else\r\n this.hostnameString = hostnameString_default;\r\n if (this.pl_DB.getParam(\"Port\") != null) {\r\n try {\r\n this.portNr = Integer.parseInt(this.pl_DB.getParam(\"Port\"));\r\n } catch (NumberFormatException e) {\r\n this.portNr = portNr_default;\r\n }\r\n isSet[1] = true;\r\n } else\r\n this.portNr = portNr_default;\r\n if (this.pl_DB.getParam(\"Database\") != null) {\r\n this.databaseString = this.pl_DB.getParam(\"Database\");\r\n isSet[2] = true;\r\n } else\r\n this.databaseString = databaseString_default;\r\n if (this.pl_DB.getParam(\"Username\") != null) {\r\n this.usernameString = this.pl_DB.getParam(\"Username\");\r\n isSet[3] = true;\r\n } else\r\n this.usernameString = rusernameString_default;\r\n if (this.pl_DB.getParam(\"Password\") != null) {\r\n this.passwdString = this.pl_DB.getParam(\"Password\");\r\n } else\r\n this.passwdString = \"\";\r\n if (this.pl_DB.getParam(\"nodeTableName\") != null) {\r\n this.NodeTableString = this.pl_DB.getParam(\"nodeTableName\");\r\n isSet[4] = true;\r\n } else\r\n this.NodeTableString = nodeList_DBtable_default;\r\n if (this.pl_DB.getParam(\"nodeColIDName\") != null) {\r\n this.NodeIDColString = this.pl_DB.getParam(\"nodeColIDName\");\r\n isSet[5] = true;\r\n } else\r\n this.NodeIDColString = node_ids_DBcol_default;\r\n if (this.pl_DB.getParam(\"nodeColLabelName\") != null) {\r\n this.NodeLabelColString = this.pl_DB.getParam(\"nodeColLabelName\");\r\n isSet[6] = true;\r\n } else\r\n this.NodeLabelColString = node_labels_DBcol_default;\r\n if (this.pl_DB.getParam(\"edgeTableName\") != null) {\r\n this.EdgeTableString = this.pl_DB.getParam(\"edgeTableName\");\r\n isSet[7] = true;\r\n } else\r\n this.EdgeTableString = edgeList_DBtable_default;\r\n if (this.pl_DB.getParam(\"edgeCol1Name\") != null) {\r\n this.EdgeCo1String = this.pl_DB.getParam(\"edgeCol1Name\");\r\n isSet[8] = true;\r\n } else\r\n this.EdgeCo1String = edgeList_DBcol1_default;\r\n if (this.pl_DB.getParam(\"edgeCol2Name\") != null) {\r\n this.EdgeCol2String = this.pl_DB.getParam(\"edgeCol2Name\");\r\n isSet[9] = true;\r\n } else\r\n this.EdgeCol2String = edgeList_DBcol2_default;\r\n if (this.pl_DB.getParam(\"edgeColWeightName\") != null) {\r\n this.EdgeWeightColString = this.pl_DB.getParam(\"edgeColWeightName\");\r\n isSet[10] = true;\r\n } else\r\n this.EdgeWeightColString = edgeList_DBcolweight_default;\r\n if (this.pl_DB.getParam(\"resultTableName\") != null) {\r\n this.resultTableString = this.pl_DB.getParam(\"resultTableName\");\r\n isSet[11] = true;\r\n } else\r\n this.resultTableString = result_DBtable_default;\r\n\r\n for (int i = 0; i < 12; i++) {\r\n if (isSet[i])\r\n this.isDBValuesSet = true;\r\n else {\r\n this.isDBValuesSet = false;\r\n break;\r\n }\r\n }\r\n\r\n this.is_alg_started = false;\r\n this.is_already_read_from_DB = false;\r\n this.is_already_renumbered = false;\r\n }", "public PostingList readPosting(FileChannel fc) throws IOException {\n\t\tlong position = fc.position();\n\t\tByteBuffer buffer = ByteBuffer.allocate(VBNUM_SIZE * 2);\n\t\tint numOfBytesRead;\n\n\t\tnumOfBytesRead = fc.read(buffer);\n\t\tif (numOfBytesRead == -1) return null;\n\n\n\t\tbuffer.rewind();\n\n\t\t// TODO check following code ! logically 20170415 yes 16\n\n\t\tint [] termHead = new int[2];\n\t\tfor (int ns = 0; ns < 2; ns++) {\n\t\t\tbyte[] vbnum = new byte[VBNUM_SIZE];\n\t\t\tbyte temp = 0;\n\t\t\tint i = 0;\n\t\t\tfor (; buffer.hasRemaining() && ((temp = buffer.get()) >> 7 == 0); i++) {\n\t\t\t\tvbnum[i] = temp;\n\t\t\t}\n\t\t\tvbnum[i] = temp;\n\t\t\ti++; //nums of byte\n\t\t\ttermHead[ns] = number(vbnum, i);\n\t\t\t//termHead[ns] = number(vbnum, buffer.position());\n\t\t\t//size += buffer.position();\n\t\t}\n\t\t// set position after read two vb number\n position = position + buffer.position();\n\t\tfc.position(position);\n\n\t\tbuffer = ByteBuffer.allocate(VBNUM_SIZE * termHead[1]);\n if (fc.read(buffer) == -1) return null;\n buffer.rewind();\n\n Pair<PostingList, Integer> results = gapDecode(termHead[1], buffer, termHead[0]);\n PostingList postingList = results.getFirst();\n\n position = position + results.getSecond();\n\t\tfc.position(position);\n\t\treturn postingList;\n\t}", "public FeedParsers() {\n super(FEED_PARSERS_KEY);\n }", "protected abstract WebMarkupContainer createChannelRow();" ]
[ "0.6648855", "0.62885463", "0.6230488", "0.61157876", "0.5583709", "0.5302745", "0.5246573", "0.52407354", "0.5179852", "0.5114815", "0.51018476", "0.4998882", "0.49852285", "0.4953471", "0.49506631", "0.49451917", "0.48825562", "0.48614934", "0.48165137", "0.4805462", "0.47845873", "0.4775507", "0.4751759", "0.4722212", "0.4706436", "0.47058", "0.46935323", "0.4669462", "0.46543133", "0.46539414", "0.4630183", "0.46298787", "0.46206316", "0.46177402", "0.46177205", "0.46171328", "0.4603917", "0.45984206", "0.4594155", "0.45924994", "0.4568599", "0.45486772", "0.451989", "0.45103368", "0.44912517", "0.448913", "0.44816187", "0.44785365", "0.44765237", "0.44760063", "0.44713986", "0.44693875", "0.4464211", "0.4460108", "0.44594818", "0.44576475", "0.44565734", "0.44541404", "0.44417465", "0.44405335", "0.44385388", "0.44381547", "0.4434531", "0.4430715", "0.4423174", "0.4420913", "0.44178674", "0.44131246", "0.4407351", "0.439757", "0.43931702", "0.43857592", "0.43827054", "0.43795556", "0.4376335", "0.43727544", "0.4361962", "0.4358895", "0.43575966", "0.4347266", "0.43462178", "0.43371928", "0.43351275", "0.43316144", "0.432934", "0.4319826", "0.43172047", "0.43144938", "0.43114567", "0.43087542", "0.43083483", "0.42953405", "0.42914772", "0.42856306", "0.42854542", "0.42826453", "0.4282643", "0.42821893", "0.42816132", "0.42799458" ]
0.51533395
9
Create an independent copy of this JSON member.
public JsonMember copy() { return new JsonMember(name, value.copy()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public JsonFactory copy()\n/* */ {\n/* 324 */ _checkInvalidCopy(JsonFactory.class);\n/* */ \n/* 326 */ return new JsonFactory(this, null);\n/* */ }", "@SuppressWarnings(\"unchecked\")\n @Override\n public <T extends JsonNode> T deepCopy() { return (T) this; }", "public Hello dup (Hello self)\n {\n if (self == null)\n return null;\n\n Hello copy = new Hello ();\n if (self.getIdentity () != null)\n copy.setAddress (self.getIdentity ());\n copy.ipaddress = self.ipaddress;\n copy.mailbox = self.mailbox;\n copy.groups = new ArrayList <String> (self.groups);\n copy.status = self.status;\n copy.headers = new VersionedMap (self.headers);\n return copy;\n }", "public State dup (State self)\n {\n if (self == null)\n return null;\n\n State copy = new State ();\n if (self.getIdentity () != null)\n copy.setAddress (self.getIdentity ());\n copy.address = self.address;\n copy.addressPort = self.addressPort;\n copy.generation = self.generation;\n copy.max_version = self.max_version;\n copy.extra = new VersionedMap (self.extra);\n return copy;\n }", "public Punch getShallowCopy(){\n Punch p = new Punch();\n p.id = id;\n p.time = time;\n //p.taskId = punchTask.getID();\n return p;\n }", "public Object clone() {\n return this.copy();\n }", "default Member saveMember(Member member) {\n return new Member();\n }", "public Ping dup (Ping self)\n {\n if (self == null)\n return null;\n\n Ping copy = new Ping ();\n if (self.getIdentity () != null)\n copy.setAddress (self.getIdentity ());\n copy.digest = new ArrayList <State> (self.digest);\n return copy;\n }", "@Override\n public TopicObject copy() {\n return new TopicObject(this);\n }", "public Object clone(){\n \t\n \treturn this;\n \t\n }", "public Field copy()\n {\n return new Field(name, type, vis);\n }", "public Instance cloneShallow() {\n Instance copy;\n try {\n copy = new Instance(getNameValue().toString());\n } catch (JNCException e) {\n copy = null;\n }\n return (Instance)cloneShallowContent(copy);\n }", "@Override\n public User clone(){\n return new User(this);\n }", "protected Shingle copy() {\n return new Shingle(this);\n }", "public Object clone() {\n // No problems cloning here since private variables are immutable\n return super.clone();\n }", "@Override\n public Data clone() {\n final Data data = new Data(name, code, numeric, symbol, fractionSymbol, fractionsPerUnit, rounding, formatString,\n triangulated.clone());\n return data;\n }", "Prototype makeCopy();", "public QueueEntry copy() {\n return new QueueEntry(playerName, string, loc, type);\n }", "public Complex makeDeepCopy() {\r\n Complex complex2 = new Complex(this.getReal(), this.getImaginary());\r\n return complex2;\r\n }", "IGLProperty clone();", "public PingOk dup (PingOk self)\n {\n if (self == null)\n return null;\n\n PingOk copy = new PingOk ();\n if (self.getIdentity () != null)\n copy.setAddress (self.getIdentity ());\n copy.request = new ArrayList <State> (self.request);\n copy.response = new ArrayList <State> (self.response);\n return copy;\n }", "public Record copy() {\n\t\treturn new Record(video, numOwned, numOut, numRentals);\n\t}", "public MemberAddress clone() {\r\n try {\r\n return (MemberAddress)super.clone();\r\n } catch (CloneNotSupportedException e) {\r\n throw new IllegalStateException(\"Failed to clone the entity: \" + toString(), e);\r\n }\r\n }", "public Shout dup (Shout self)\n {\n if (self == null)\n return null;\n\n Shout copy = new Shout ();\n if (self.getIdentity () != null)\n copy.setAddress (self.getIdentity ());\n copy.group = self.group;\n copy.content = self.content.duplicate ();\n return copy;\n }", "@Override\r\n public Object clone() {\r\n\r\n Coordinate c = new Coordinate( this );\r\n return c;\r\n }", "@Override\n public UserProfile copy() {\n UserProfile userProfile = new UserProfile();\n copyTo(userProfile);\n return userProfile;\n }", "@Override\n public Object clone() {\n return super.clone();\n }", "public Record copy() {\n return new Record(\n this.id,\n this.location.copy(),\n this.score\n );\n }", "public Function clone();", "public Whisper dup (Whisper self)\n {\n if (self == null)\n return null;\n\n Whisper copy = new Whisper ();\n if (self.getIdentity () != null)\n copy.setAddress (self.getIdentity ());\n copy.content = self.content.duplicate ();\n return copy;\n }", "public Client copy() {\n\t\tClient clone = new Client(ID, Email, PostalAddress);\n\t\treturn(clone);\n\t}", "@Override\n public FieldEntity copy()\n {\n return state.copy();\n }", "public Object clone()\n {\n try {\n Object newObj = super.clone();\n ((LDAPUrl)newObj).url = (com.github.terefang.jldap.ldap.LDAPUrl)this.url.clone();\n return newObj;\n } catch( CloneNotSupportedException ce) {\n throw new RuntimeException(\"Internal error, cannot create clone\");\n }\n }", "Object clone();", "Object clone();", "public CopyBuilder copy() {\n return new CopyBuilder(this);\n }", "public /*@ non_null @*/ Object clone() {\n return this;\n }", "default Member getNormalMember(Long memberSn) {\n return new Member();\n }", "protected Factorization copy(){\n Factorization newFactor = new Factorization(this.mdc);\n //shallow copy\n newFactor.setRecipes(recipes);\n newFactor.setIngredients(ingredients);\n newFactor.setUserMap(userMap);\n newFactor.setUserMapReversed(userMap_r);\n newFactor.setRecipeMap(recipeMap);\n newFactor.setRecipeMapReversed(recipeMap_r);\n newFactor.setIngredientMap(ingredientMap);\n newFactor.setIngredientMapReversed(ingredientMap_r);\n \n //deep copy\n List<User> userCopy = new ArrayList<User>();\n for(User curr: this.users){\n userCopy.add(new User(curr.getId()));\n }\n newFactor.setUsers(userCopy);\n newFactor.setDataset(dataset.copy());\n newFactor.updateInitialSpace();\n return newFactor;\n }", "public Instance clone() {\n Instance copy;\n try {\n copy = new Instance(getNameValue().toString());\n } catch (JNCException e) {\n copy = null;\n }\n return (Instance)cloneContent(copy);\n }", "public ParticleRenderData copy()\n\t{\n\t\tRenderData copy = super.copy();\n\t\tParticleRenderData pcopy = new ParticleRenderData(new Vector3f(), new Euler(), new Vector3f());\n\t\tpcopy.transform = copy.transform;\n\t\tpcopy.postStage = this.postStage;\n\t\tpcopy.currStage = this.currStage;\n\t\tpcopy.particleColor = this.particleColor;\n\t\treturn pcopy;\n\t}", "public DessertVO clone() {\r\n return (DessertVO) super.clone();\r\n }", "protected Enemy copy()\r\n\t{\r\n\t\treturn new DwarfEnemy();\r\n\t}", "private void selfClone() {\n stroke = stroke.clone();\n }", "private ImmutablePerson(ImmutablePerson other) {\n firstName = other.firstName;\n middleName = other.middleName;\n lastName = other.lastName;\n nickNames = new ArrayList<>(other.nickNames);\n }", "public Tree<K, V> copy() {\n\t\tTree<K, V> copy = EmptyTree.getInstance(), t = this;\n\t\treturn copy(t, copy);\n\t}", "final public Attr clone() {\r\n\t\t\tif(Vector == null)\r\n\t\t\t\treturn new Attr(Name, Value, null);\r\n\t\t\telse if(Object == null)\r\n\t\t\t\treturn new Attr(Name, Value, Vector.clone());\r\n\t\t\telse\r\n\t\t\t\treturn new Attr(Name, Value, Vector.clone(), Object);\r\n\t\t}", "public JSONNode() {\n map = new HashMap<>();\n }", "public Update cloneShallow() {\n return (Update)cloneShallowContent(new Update());\n }", "@Override \n public Object clone() {\n try {\n Resource2Builder result = (Resource2Builder)super.clone();\n result.self = result;\n return result;\n } catch (CloneNotSupportedException e) {\n throw new InternalError(e.getMessage());\n }\n }", "@Override\n public AggregationBuilder clone() {\n try {\n AggregationBuilder clone = (AggregationBuilder) super.clone();\n clone.root = root.clone();\n clone.current = clone.root;\n return clone;\n } catch(CloneNotSupportedException ex){\n return null;\n }\n }", "public Object clone()\n {\n PSRelation copy = new PSRelation(new PSCollection(m_keyNames.iterator()),\n new PSCollection(m_keyValues.iterator()));\n \n copy.m_componentState = m_componentState;\n copy.m_databaseComponentId = m_databaseComponentId;\n copy.m_id = m_id;\n\n return copy;\n }", "@Override\n protected Currency clone() {\n final Currency currency = new Currency();\n if (data != null) {\n currency.data = data.clone();\n }\n return currency;\n\n }", "RecordInfo clone();", "public JSONSchema clone() {\n JSONSchema clonedSchema = new JSONSchema().id(_id).title(_title).description(_description).required(_required).\n types(Collections2.transform(_types.values(), JSONSchemaTypes.CloningFunction.INSTANCE));\n\n if (_referencesSchema != null) {\n clonedSchema.setReferencesSchema(_referencesSchema);\n } else if (_referencesSchemaID != null) {\n clonedSchema.setReferencesSchemaID(_referencesSchemaID);\n }\n\n if (_extendsSchema != null) {\n clonedSchema.setExtendsSchema(_extendsSchema);\n } else if (_extendsSchemaID != null) {\n clonedSchema.setExtendsSchemaID(_extendsSchemaID);\n }\n\n return clonedSchema;\n }", "public Object clone()\n\t{\n\t\tObject myClone = new Object();\n\t\tmyClone = myName + myNumberWins;\n\t\treturn myClone;\n\t}", "protected T copy() {\n\n // Initialize.\n T copy = null;\n\n try {\n\n // Create an instance of this entity class.\n copy = this.entityClass.newInstance();\n\n // Create a copy.\n copy.setCreateTime(this.getCreateTime());\n copy.setId(this.getId());\n copy.setModifyTime(this.getModifyTime());\n }\n catch (IllegalAccessException e) {\n // Ignore.\n }\n catch (InstantiationException e) {\n // Ignore.\n }\n\n return copy;\n }", "public Weapon copy() {\r\n\t\treturn new Weapon(this.getName(), this.getDescription(), this.getType(), this.getSize(), this.getPrice(), this.getMultChanged());\r\n\t}", "@Override\n public Vector3 clone()\n {\n return new Vector3(this);\n }", "Member() {}", "public Weapon clone() {\n\t\treturn new Weapon(this);\n\t}", "public AccessPath copy() {\n HashMap m = new HashMap();\n IdentityHashCodeWrapper ap = IdentityHashCodeWrapper.create(this);\n AccessPath p = new AccessPath(this._field, this._n, this._last);\n m.put(ap, p);\n this.copy(m, p);\n return p;\n }", "public T copyOnWrite() {\n T r = ref;\n if(r.getRefCount() <= 1) { return r; }\n @SuppressWarnings(\"unchecked\")\n T r2 = (T)r.clone();\n r.removeRef();\n ref = r2;\n r2.addRef();\n return r2;\n }", "public SearchResponseBuilder<T, ST, P> getCopy() {\n SearchResponseBuilder<T, ST, P> searchResponseBuilder =\n new SearchResponseBuilder<T, ST, P>(responseClass, annotatedClass, solrField2ParamEnumMap,\n solrField2javaPropertiesMap);\n searchResponseBuilder.hlFieldPropertyPropertiesMap = hlFieldPropertyPropertiesMap;\n return searchResponseBuilder;\n }", "@Override\n public ChatReceivePacket copy() {\n return new ChatReceivePacket(this);\n }", "public Object clone();", "public Object clone();", "public Object clone();", "public Object clone();", "public NewMemberRequest build() {\r\n return newMemberRequest;\r\n }", "@Override\n public GeoPoint clone() {\n return new GeoPoint(this.latitude, this.longitude);\n }", "public static JSONBuilder newInstance(){\n return new JSONBuilder();\n }", "public StateInfo copy() {\n return new StateInfo(this);\n }", "Model copy();", "public BufferTWeak cloneMe() {\r\n BufferTWeak ib = new BufferTWeak(uc);\r\n ib.increment = increment;\r\n ib.set(new Object[objects.length]);\r\n for (int i = 0; i < objects.length; i++) {\r\n ib.objects[i] = this.objects[i];\r\n }\r\n ib.offset = this.offset;\r\n ib.count = this.count;\r\n return ib;\r\n }", "public Person build(){\n return new Person(this);\n }", "@Override\n public synchronized WebBackForwardList clone() {\n return new WebBackForwardListImpl(this);\n }", "public SoPickedPoint \ncopy() \n//\n////////////////////////////////////////////////////////////////////////\n{\n SoPickedPoint newCopy = new SoPickedPoint(this);\n return newCopy;\n}", "@Override\n public String getObjectCopy() {\n return null;\n }", "public Object clone() { return new ReferenceType((Name) name.clone()); }", "default PropertyBox cloneBox() {\n\t\treturn builder(this).invalidAllowed(this.isInvalidAllowed()).copyValues(this).build();\n\t}", "protected void assignObjectField(Object jsonResponseInstance, JsonElement jsonElement, String member, Class clazz){\n\n Field memberField;\n try {\n memberField = jsonResponseInstance.getClass().getDeclaredField(member);\n memberField.setAccessible(true);\n if (jsonElement == null){\n memberField.set(jsonResponseInstance, clazz.newInstance());\n }else {\n memberField.set(jsonResponseInstance, gson.fromJson(jsonElement, clazz));\n }\n } catch (NoSuchFieldException | InstantiationException | IllegalAccessException e) {\n e.printStackTrace();\n }\n }", "public MappingInfo copy()\r\n\t{\r\n\t\tArrayList<MappingCell> mappingCells = new ArrayList<MappingCell>();\r\n\t\tfor(MappingCell mappingCell : mappingCellHash.get())\r\n\t\t\tmappingCells.add(mappingCell);\r\n\t\treturn new MappingInfo(mapping.copy(),mappingCells);\r\n\t}", "public Object clone() {\n FileTransfer ft = new FileTransfer();\n ft.mLogicalFile = new String(this.mLogicalFile);\n ft.mFlags = (BitSet) this.mFlags.clone();\n ft.mTransferFlag = this.mTransferFlag;\n ft.mSize = this.mSize;\n ft.mType = this.mType;\n ft.mJob = new String(this.mJob);\n ft.mPriority = this.mPriority;\n ft.mURLForRegistrationOnDestination = this.mURLForRegistrationOnDestination;\n ft.mMetadata = (Metadata) this.mMetadata.clone();\n ft.mVerifySymlinkSource = this.mVerifySymlinkSource;\n // the maps are not cloned underneath\n\n return ft;\n }", "static <T> T clone(T in) throws IOException {\n\t\tByteArrayOutputStream bOut = new ByteArrayOutputStream();\n\t\tMap<Long, Object> smugglerCache = new HashMap<>();\n\t\ttry (ObjectOutputStream out = new LiveObjectOutputStream(bOut, smugglerCache)) {\n\t\t\tout.writeObject(in);\n\t\t}\n\t\ttry {\n\t\t\treturn (T) new LiveObjectInputStream(\n\t\t\t\t\tnew ByteArrayInputStream(bOut.toByteArray()),\n\t\t\t\t\tsmugglerCache)\n\t\t\t\t.readObject();\n\t\t} catch (ClassNotFoundException e) {\n\t\t\tthrow new AssertionError(\"We just serialized this object a minute ago. The class cannot be missing\", e);\n\t\t}\n\t}", "Component deepClone();", "@Override\n\t@SuppressWarnings(\"unchecked\")\n\tpublic Object clone() throws CloneNotSupportedException\n\t{\n\t\tJsonObject newArray = (JsonObject)super.clone();\n\t\tnewArray.values = (HashMap<String, Value>)values.clone();\n\t\treturn newArray;\n\t}", "DSGeneMarker deepCopy();", "public Coordinates copy() {\n\t\treturn new Coordinates(this);\n\t}", "@Override\n\tpublic function copy() {\n\t\tMonom M=new Monom(this.get_coefficient(),this.get_power());\n\t\t\n\t\treturn M;\n\t}", "@Override\n public LocalStore<V> copy() {\n return this;\n }", "public O copy() {\n return value();\n }", "public T copy() {\n T ret = createLike();\n ret.getMatrix().setTo(this.getMatrix());\n return ret;\n }", "public Object clone() {\r\n return new DateTimeFormat(dateFormat);\r\n }", "void create(Member member);", "public abstract Node copy();", "@Override\n public MultiCache clone () {\n return new MultiCache(this);\n }", "@Override\n\tpublic Object clone() {\n\t\treturn null;\n\t}", "public abstract Instance duplicate();", "Field getCopy();" ]
[ "0.6518772", "0.5967288", "0.59662026", "0.5787729", "0.5778709", "0.5711762", "0.5687242", "0.56691307", "0.5663928", "0.56497574", "0.56295407", "0.5622642", "0.5622604", "0.56200916", "0.55804497", "0.55768555", "0.5573292", "0.55479026", "0.55453193", "0.5503251", "0.5496581", "0.5488838", "0.5488193", "0.5486487", "0.54586196", "0.5451321", "0.54492843", "0.5444386", "0.54273224", "0.54213434", "0.54174596", "0.5403358", "0.53698593", "0.5369414", "0.5369414", "0.5351664", "0.53461266", "0.53444386", "0.53428364", "0.5333768", "0.5333172", "0.5328551", "0.53240955", "0.5317828", "0.53167206", "0.5314636", "0.5307119", "0.5306289", "0.53004986", "0.5285199", "0.5284754", "0.5283829", "0.52821344", "0.5281637", "0.52810985", "0.527997", "0.52773786", "0.52768177", "0.5276385", "0.5269048", "0.5268126", "0.5262696", "0.5260716", "0.52587855", "0.5248825", "0.5243067", "0.5243067", "0.5243067", "0.5243067", "0.5240191", "0.5239847", "0.5239832", "0.5236008", "0.5235395", "0.52344626", "0.5232211", "0.5229303", "0.52259636", "0.5216204", "0.52114105", "0.5209763", "0.52076", "0.52035224", "0.5192052", "0.51837987", "0.51834893", "0.5183365", "0.5181036", "0.5181018", "0.5177381", "0.51768595", "0.51729035", "0.51677305", "0.51661617", "0.51654005", "0.5158254", "0.5149988", "0.5147037", "0.514461", "0.514023" ]
0.837041
0
uwi solution (ideas: created 2d array if we wanna keep things together like here difficulty profit. Monolith array approach.)
public int _maxProfitAssignmentBetter(int[] difficulty, int[] profit, int[] worker) { int n = difficulty.length; int [][] dp = new int [n][]; for (int i = 0; i < n; i ++) dp [i] = new int[] { difficulty[i], profit[i] }; Arrays.sort(dp, (a, b) -> (a [0] != b [0]) ? (a [0] - b [0]) : -(a [1] - b [1])); int[] xs = new int[n]; for (int i = 0; i < n; i ++) xs [i] = dp [i][0]; for (int i = 1; i < n; i ++) dp[i][1] = Math.max(dp [i][1], dp [i - 1][1]); int ret = 0; for(int w : worker){ int ind = Arrays.binarySearch(xs, w); if (ind < 0) ind = -ind - 2; if (ind >= 0) ret += dp[ind][1]; } return ret; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void main(String[] args) { \r\n int[][] a = new int[3][5]; // прямоугольный массив\r\n int size1 = a.length;\r\n int size2 = a[0].length;\r\n int[][] b = new int[3][]; // массив переменной длины (тут - треугольный)\r\n b[0] = new int[1];\r\n b[1] = new int[2];\r\n b[2] = new int[3];\r\n int c[] = new int[] {1,2,3,};\r\n c = new int[]{0,1,2,3}; // а вот так не сработает: c = {0,1,2,3};\r\n \r\n int[] array1D= {0,1,2,3}; \r\n int[][] array2D= {{0,1,5,10},{2,3,1,0,5,55,16},{0,1}};\r\n int[][][] array3D= {\r\n { {2,3,1,0},\r\n {2,3,1,0},\r\n {2,3,1,0}},\r\n \r\n { {2,3,1,0},\r\n {2,3,1,0},\r\n {2,3,1,0}},\r\n \r\n { {2,3,1,0},\r\n {2,3,1,0},\r\n {2,3,1,0}}};\r\n System.out.println(\"============array1D==========\");\r\n System.out.println(array1D);\r\n System.out.println(Arrays.toString(array1D)); //Работает на глубину одного измерения (для одномерных масивов)\r\n System.out.println(\"============array2D==========\");\r\n System.out.println(array2D);\r\n System.out.println(Arrays.toString(array2D)); \r\n System.out.println(Arrays.deepToString(array2D));\r\n System.out.println(\"============array3D==========\");\r\n System.out.println(array3D);\r\n System.out.println(Arrays.toString(array3D));\r\n System.out.println(Arrays.deepToString(array3D));\r\n }", "static int[][] packU(int n, int[] from, int[] to) {\n// this part of code is taken from \"uwi\" submission of codechef problem KNODES \n int[][] g = new int[n][];\n int[] p = new int[n];\n for (int f : from) {\n p[f]++;\n }\n for (int t : to) {\n p[t]++;\n }\n for (int i = 0; i < n; i++) {\n g[i] = new int[p[i]];\n }\n for (int i = 0; i < from.length; i++) {\n g[from[i]][--p[from[i]]] = to[i];\n g[to[i]][--p[to[i]]] = from[i];\n }\n return g;\n }", "private static void demoMultiDArrays() {\r\n\t\tint[][] nums = new int[3][5];\r\n\t\tnums[0][2] = 10;\r\n//\t\tcompact, hard to read version: **note: slower. its worse in every way.**\r\n//\t\tnums[nums.length-1][nums[nums.length-1].length-1] = 14;\r\n\t\tint lastRow = nums.length-1;\r\n\t\tint lastCol = nums[lastRow].length-1;\r\n\t\tnums[lastRow][lastCol] = 14;\r\n//\t\tcompact, hard to read version: **note: slower. its worse in every way.**\r\n//\t\tnums[0][0] = nums[0][2] + nums[nums.length-1][nums[nums.length-1].length-1];\r\n\t\tnums[0][0] = nums[0][2]+nums[lastRow][lastCol];\r\n\t\t\r\n\t\t//return length of the cols in nums\r\n\t\t//return the length of the rows in nums\r\n\t\tfor (int[] rowData : nums) {\r\n\t\t\tSystem.out.print(\"[\");\r\n\t\t\tfor (int colData : rowData) {\r\n\t\t\t\tSystem.out.print(colData);\r\n\t\t\t\tSystem.out.print(\",\\t\");\r\n\t\t\t}\r\n\t\t\tSystem.out.println(\"], \");\r\n\t\t}\r\n\t\t\r\n\t}", "private static int[] generateArray(int i, int j) {\n int[] col = new int[j+1];\n for(int k = 0; k <= j; k++)\n {\n col[k] = (i+k)%Algo.x.length;\n } \n return col;\n }", "int main()\n {\n int tri[][] = {{1, 0, 0},\n {4, 8, 0},\n {1, 5, 3}};\n return 0;\n }", "public static void main(String[] args) {\n\r\n\t\tint[][] array = new int[5][5];\r\n\t\t\r\n\t//좌측 코드는 5행 5열 2차원 배열을 생성함\r\n\t\t//25개의 방이 생성되고 메모리에 총 100바이트 생성함\r\n\t\t\r\n\t\tint[][] array = new int[][] {\r\n\t\t\t{100,20,30},\r\n\t\t\t{30,40,50},\r\n\t\t\t{40,50,60}\r\n\t\t};//선언과 동시에 3행 3열의 값을 초기화를 해주고 있다. 메모리에 총 9*4=36byte가 생성됨ㄴ\r\n\t\t}", "public static void main(String[] args) {\n\t\tint width=35;\n\t\tint length=31;\n\t\tlong[][] dp = new long[width+1][length+1];\n\t\tdp[0][0]=0;\n\t\tfor(int i=1;i<length+1;i++){\n\t\t\tif(badCheck(0,i,0,i-1)){\n\t\t\t\tdp[0][i]=0;\n\t\t\t\tfor(int k=i+1;k<length+1;k++){\n\t\t\t\t\tdp[0][k]=0;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}else{\n\t\t\t\tdp[0][i]=1;\n\t\t\t}\n\t\t}\n\t\tfor(int i=1;i<width+1;i++){\n\t\t\tif(badCheck(i,0,i-1,0)){\n\t\t\t\tdp[i][0]=0;\n\t\t\t\tfor(int k=i+1;k<width+1;k++){\n\t\t\t\t\tdp[k][0]=0;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}else{\n\t\t\t\tdp[i][0]=1;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\tfor(int i=1;i<=width;i++){\n\t\t\tfor(int j=1;j<=length;j++){\n\t\t\t\tif(!badCheck(i-1,j,i,j)){\n\t\t\t\t\tdp[i][j]+=dp[i-1][j];\n\t\t\t\t}\n\t\t\t\tif(!badCheck(i,j-1,i,j)){\n\t\t\t\t\tdp[i][j]+=dp[i][j-1];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//System.out.println(dp[6][6]);\n\t\t//System.out.println(dp[2][2]);\n\t\t//System.out.println(dp[1][1]);\n\t\tSystem.out.println(dp[35][31]);\n\t}", "public int[][] turfu() {\r\n\t\tint[][] tab = new int[matrice[0].length][matrice.length]; \r\n\t\tint n =0; \r\n\t\tfor(int i=0; i<tab.length; i++) {\r\n\t\t\tfor(int j=0; j< tab[0].length; j++) {\r\n\t\t\t\ttab[i][j] = matrice[j][n]; \r\n\t\t\t}\r\n\t\t\tn++;\r\n\t\t}\r\n\t\treturn tab; \r\n\t}", "static void TwoDimTrav(int[][] arr, int row, int col){\n\n int[] dr = new int[]{ -1, 1, 0, 0};\n int[] dc = new int[]{ 0, 0, 1, -1};\n\n for(int i = 0; i < 4; i++){\n int newRow = row + dr[i];\n int newCol = col + dc[i];\n\n if(newRow < 0 || newCol < 0 || newRow >= arr.length || newCol >= arr[0].length)\n continue;\n\n // do your code here\n\n }\n\n // All Directions\n // North, South, East, West, NW NE SW SE\n // dr = [ -1, 1, 0, 0 -1, -1, 1, 1 ]\n // dc = [ 0, 0, 1, -1 -1, 1, 1, -1 ]\n\n// int[] dr = new int[]{ -1, 1, 0, 0, -1, -1, 1, 1};\n// int[] dc = new int[]{ 0, 0, 1, -1, -1, 1, -1, 1};\n//\n// for(int i = 0; i < 8; i++){\n// int newRow = row + dr[i];\n// int newCol = col + dc[i];\n//\n// if(newRow < 0 || newCol < 0 || newRow >= arr.length || newCol >= arr[0].length)\n// continue;\n//\n// // do your code here\n//\n// }\n }", "public static void main(String[] args) {\n\t\tint row = 8;\r\n\t\tint [][]arr = new int[row][row];\t//8行8列\r\n\t\t\r\n\t\tfor(int i=0;i<row;i++){\t//外循环构造第一维数组\r\n\t\t\tfor(int j=0;j<=i;j++){\t//内循环构造第一维数组指向的第二维数组,每一行的列数和行数相等\r\n\t\t\t\t//第一列(j=0)和对角线列(j=i)的值都为1\r\n\t\t\t\tif(j==0 || j==i){\r\n\t\t\t\t\tarr[i][j] = 1;\r\n\t\t\t\t}\r\n\t\t\t\t//非第一列和对角线列的数组元素值,是其正上方的数(arr[i-1][j])和其左上角的数(arr[i-1][j-1])之和\r\n\t\t\t\telse{\r\n\t\t\t\t\tarr[i][j] = arr[i-1][j]+arr[i-1][j-1];\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//打印输出\r\n\t\tfor(int i=0;i<row;i++){\r\n\t\t\tfor(int j=0;j<=i;j++){\r\n\t\t\t\tSystem.out.print(arr[i][j]+\" \");\r\n\t\t\t}\r\n\t\t\tSystem.out.println();\r\n\t\t}\r\n\r\n\t}", "public static void main(String[] args) {\n\n// --> 4\n// int[][] arcustom ={{1,2,3}, 4>3 i = i + 1\n// {4,5,6}, 4 < 6 j = j-1\n // {7,8,9}}; -----> n+n = 2n\n//// // Important question\n// ----> n^2\n//\n// printWave(arcustom);\n//\n// int [][] ar = new int[4][2];\n//\n// for (int i = 0; i <ar.length ; i++) {\n// for (int j = 0; j < ar[i].length ; j++) {\n//\n// System.out.println(ar[i][j]);\n// }\n// }\n//\n// System.out.println();\n// System.out.println();\n//\n int [][] ar1 = new int[4][];\n\n ar1[0] = new int[6];\n ar1[1] =new int[5];\n ar1[2] = new int [3];\n ar1[3] = new int[2];\n\n\n for (int i = 0; i <ar1.length ; i++) {\n for (int j = 0; j < ar1[i].length ; j++) {\n\n System.out.print(ar1[i][j] + \" \");\n }\n System.out.println();\n }\n }", "static long[] riddle(long[] arr) {\n // complete this function\n return arr;\n }", "@SuppressWarnings(\"unused\")\n\tpublic static void main(String[] args) {\n\n\t\tint[] myArray = new int[2];\n\t\tmyArray[0] = 1;\n\t\tmyArray[1] = 2;\n\n\t\t// 2D array symmetrical\n\n\t\tint[][] array2d = new int[2][4]; // 2 rows and 4 columns\n\t\tint another2dArray[][] = new int[2][4];\n\n\t\tint[] other2dArray[] = new int[2][4]; // Valid 2 dimensional array\n\n\t\t// 2D Asymmetrical array declaration\n\n\t\tString[][] myAsymmetricalAray = new String[][] { \n\t\t\t { \"One\", \"Two\" }, \t\t\t\t // 1st row 2 columns\n\t\t\t\t{ \"Three\", \"Four\", \"Five\" }, \t\t // 2nd row 3 columns\n\t\t\t\t{ \"Six\", \"Seven\", \"Eight\", \"Nine\" }, // 3rd row with 4 columns\n\t\t\t\tnull\n\n\t\t};\n\n\t\t// Para cada primeira dimensão, existe um número variável para a segunda\n\t\t// dimensão\n\t\t// Isso não seria possível iniciando o array da forma fixa tradicional\n\n\t\t// [0] -> 2 colunas\n\t\t// [1] -> 3 colunas\n\t\t// [2] -> 4 colunas\n\n\t\tSystem.out.print(myAsymmetricalAray[0][0] + \" \");\n\t\tSystem.out.print(myAsymmetricalAray[0][1] + \" \");\n\t\tSystem.out.println();\n\n\t\tSystem.out.print(myAsymmetricalAray[1][0] + \" \");\n\t\tSystem.out.print(myAsymmetricalAray[1][1] + \" \");\n\t\tSystem.out.print(myAsymmetricalAray[1][2] + \" \");\n\t\tSystem.out.println();\n\n\t\tSystem.out.print(myAsymmetricalAray[2][0] + \" \");\n\t\tSystem.out.print(myAsymmetricalAray[2][1] + \" \");\n\t\tSystem.out.print(myAsymmetricalAray[2][2] + \" \");\n\t\tSystem.out.print(myAsymmetricalAray[2][2] + \" \");\n\n\t\t// 3D Array\n\t\tint[][][] array3D = new int[3][3][3];\n\t\tint oneMorearray3D[][][] = new int[3][3][3];\n\t\t\n\n\t\tint[] oneMorearray3D2[][] = new int[3][3][3]; // very confusing but legal declaration\n\n\t\t// Initialization\n\t\tint[][][] threeDArray = { \n\t\t\t\t{ { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }, \t\t\t//Page 1\n\t\t\t\t{ { 10, 11, 12 }, { 13, 14, 15 }, { 16, 17, 18 } }, //Page 2\n\t\t\t\t{ { 19, 20, 21 }, { 22, 23, 24 }, { 25, 26, 27 } } //Page 3\n\t\t\t\t\n\t\t};\n\n\t}", "Soldat[][] getUnites();", "public static void main(String[] args) {\n\t\tint i,j,k = 0;\r\n\t\tint [][][] a = { // 면,행,열 부분을 초기화함\r\n\t\t\t\t{\r\n\t\t\t\t{1,2,3,0,0},\r\n\t\t\t\t{4,5,6,0,0},\r\n\t\t\t\t{7,8,9,0,0},\r\n\t\t\t\t{0,0,0,0,0},\r\n\t\t\t\t{0,0,0,0,0}\r\n\t\t\t\t}\r\n\t\t\t\t,\r\n\t\t\t\t{\r\n\t\t\t\t{10,11,12,0,0},\r\n\t\t\t\t{13,14,15,0,0},\r\n\t\t\t\t{16,17,18,0,0},\r\n\t\t\t\t{0,0,0,0,0},\r\n\t\t\t\t{0,0,0,0,0}\r\n\t\t\t\t}\r\n\t\t\t\t\t\t};\r\n\t\t\r\n\t\tfor(k = 0; k <2; k++){\r\n\t\tfor(i = 0; i < 3; i++){\r\n\t\t\tfor(j = 0; j < 3; j++){\r\n\t\t\t\t\r\n\t\t\t\ta[k][i][3] += a[k][i][j];\r\n\t\t\t\ta[k][3][j] += a[k][i][j];\r\n\t\t\t}// end of for(j\r\n\t\t\ta[k][i][4] = a[k][i][j] / 3 ;\r\n\t\t}// end of for(i\r\n\t\t/*\r\n\t\ta[k][4][0] += a[k][3][0] / 3;\r\n\t\ta[k][4][1] += a[k][3][1] / 3;\r\n\t\ta[k][4][2] += a[k][3][2] / 3;\r\n\t\t*/\r\n\t\tfor(j = 0; j<3; j++){\r\n\t\t\ta[k][4][j] = a[k][i][j] / 3;\r\n\t\t}\r\n\t\t}//end of for(k\r\n\t\t\r\n\t\t//출력문\r\n\t\tfor(k=0;k<2;k++){\r\n\t\tSystem.out.printf(\"%d반의 성적\\n\",k+1);\r\n\t\tSystem.out.println(\"국어/영어/수학/총합/평균\");\r\n\t\tSystem.out.println(\"----------------\");\r\n\t\tfor(i=0;i<5;i++){\r\n\t\t\tfor(j=0;j<5;j++){\r\n\t\t\t\tSystem.out.printf(\"%3d\", a[k][i][j]);\r\n\t\t\t}// end of for(j \r\n\t\t\t\tSystem.out.printf(\"\\n\");\r\n\t\t}// end of for(i \r\n\t}// end of for(k 반\r\n\t}", "public static void main(String[] args) {\r\n\t\t// creating 2D array\r\n//\t\tchar arrayCharacter[][] = new char[5][2];\r\n//\t\t// inserting values in it\r\n//\t\t//1st row\r\n//\t\tarrayCharacter[0][0] = 'a';\r\n//\t\tarrayCharacter[0][1] = 'b';\r\n//\t\t//2nd row\r\n//\t\tarrayCharacter[1][0] = 'c';\r\n//\t\tarrayCharacter[1][1] = 'd';\r\n//\t\t//3rd row\r\n//\t\tarrayCharacter[2][0] = 'e';\r\n//\t\tarrayCharacter[2][1] = 'f';\r\n//\t\t//4th row\r\n//\t\tarrayCharacter[3][0] = 'g';\r\n//\t\tarrayCharacter[3][1] = 'h';\r\n//\t\t//5th row\r\n//\t\tarrayCharacter[4][0] = 'i';\r\n//\t\tarrayCharacter[5][1] = 'j';\r\n\t\t\r\n\t\tchar arrayCharacter[][] = {{'a','b'},{'c','d'},{'e','f'},{'g','h'},{'i','j'}};\r\n\t\t\r\n//\t\tSystem.out.println(arrayCharacter[3][1]);\r\n//\t\tSystem.out.println(arrayCharacter[0][0]+\" \"+arrayCharacter[4][1]);\r\n\t\t\r\n//\t\tSystem.out.println(\"Number of rows: \"+arrayCharacter.length); // number of rows\r\n//\t\tSystem.out.println(\"Number of column: \"+arrayCharacter[0].length); // number of columns\r\n\t\t\r\n\t\t// traversing into 2D array -> using 2 for loops: 1st for loop for row & 2nd for loop or column\r\n//\t\tfor(int i=0;i<arrayCharacter.length; i++) { // traverses through rows\r\n//\t\t\tfor(int j=0; j<arrayCharacter[i].length; j++) { // traverses through column\r\n//\t\t\t\tSystem.out.print(arrayCharacter[i][j]+\"|\");\r\n//\t\t\t}\r\n//\t\t}\r\n\t\t\r\n\r\n\t\tint arrayInt[][] = {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15}};\r\n\t\t\r\n\t\tSystem.out.println(\"Number of rows: \"+arrayInt.length); // number of rows\r\n\t\tSystem.out.println(\"Number of column: \"+arrayInt[0].length); // number of columns\r\n\t\t\r\n\t\tfor(int i=0;i<arrayInt.length; i++) { // traverses through rows\r\n\t\t\tfor(int j=0; j<arrayInt[i].length; j++) { // traverses through column\r\n\t\t\t\tSystem.out.print(arrayInt[i][j]+\"|\");\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\t// Assignment:\r\n//\t\t\t1. 1D array => FirstName, LastName, DOB, Age then traverse through using both for & while loop to extract data\r\n//\t\t\t2. 2D array => Customer Name, email address, phone number then traverse through it using for loop to extract data -> try while as well\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\r\n\t}", "public int[] popBubbles(int[][] darts) {\n\n int[] ret = new int[darts.length];\n int ptr = 0;\n for (int[] d: darts) {\n ret[ptr++] = grid[d[0]][d[1]];\n }\n\n int row = grid.length;\n int col = grid[0].length;\n WeightedQuickUnionUF wuf = new WeightedQuickUnionUF(row*col + 1);\n System.out.println(Arrays.deepToString(grid));\n for (int[] d: darts) {\n grid[d[0]][d[1]] = 0;\n }\n System.out.println(Arrays.deepToString(grid));\n System.out.println(wuf.count());\n build(wuf);\n System.out.println(wuf.count());\n int count = wuf.count();\n for (int i=darts.length-1; i>=0; i--) {\n int[] d = darts[i];\n if (ret[i] == 1) {\n System.out.println(Arrays.deepToString(grid));\n grid[d[0]][d[1]] = 1;\n System.out.println(Arrays.deepToString(grid));\n System.out.println(wuf.count());\n build(wuf);\n System.out.println(wuf.count());\n ret[i] = count - wuf.count() - 1;\n count = wuf.count();\n }\n }\n return ret;\n }", "public MHKEncryption_Array(){\n\t\t\tBigInteger wgenerator = new BigInteger(\"2\");\n\t\t\twsum = BigInteger.ZERO;\n\t\t\tfor(int i = 0;i < 640;i++){\n\t\t\t\twgenerator = wgenerator.multiply(new BigInteger(\"2\")).subtract(BigInteger.ONE); \n\t\t\t\tw[i] = wgenerator;\n\t\t\t\twsum = wsum.add(wgenerator);\n\t\t\t}\n\t}", "@Test\n public void testCreateRowIndices2(){\n int[][] a = new int[4][2];\n a[0][0] = 0;\n a[0][1] = 0;\n a[1][0] = 0;\n a[1][1] = 1;\n a[2][0] = 0;\n a[2][1] = 2;\n a[3][0] = 2;\n a[3][1] = 1;\n\n double[][] input = new double[4][3];\n\n for(int i = 0 ; i < a.length ; i++){\n input[a[i][0]][a[i][1]] = 1;\n }\n\n int[][] myIndices = HarderArrayProblems.createRowIndices(input);\n for(int i = 0 ; i < a.length ; i++){\n assertEquals(a[i][0], myIndices[i][0]);\n assertEquals(a[i][1], myIndices[i][1]);\n }\n\n }", "public static void main(String[] args)\n {\n\n SuperMuli m=new SubMuli();\n System.out.println(m.muliplyExtra(1, 2));\n /*\n SuperMuli m = new SubMuli();\n m.printTypeName();\n System.out.println(\",\" + m.index);\n */ \n\n //byte arr[]=new byte[]{2,3,4,5};\n //for (final int i:getCharArray(arr)) \n //System.out.print(i+\" \");\n\n //int a[5]=new int[]{2,3,4,5,6};\n\n //int [][]a5=new int[5]{2,3,4,5,6};\n //int[][] a3=new int[5][];\n //int a4[][][] a3={{{1,2}},{{3,4}},{5,6}};\n //int[,] a2=new int[5,5];\n /*int j=0;\n int a[]={2,4};\n do for(int i:a)\n System.out.print(i+\" \");\n while(j++ <1);\n */\n\n System.out.println(\"\\nEnded...\");\n\n\n }", "public Matrix[] palu() {\n\t\tHashMap<Integer, Integer> permutations = new HashMap<Integer,Integer>();\n\t\tMatrix m = copy();\n\t\tint pivotRow = 0;\n\t\tfor (int col = 0; col < m.N; col++) {\n\t\t\tif (pivotRow < m.M) {\n\t\t\t\tint switchTo = m.M - 1;\n\t\t\t\twhile (pivotRow != switchTo && \n\t\t\t\t\t\tm.ROWS[pivotRow][col].equals(new ComplexNumber(0))) {\n\t\t\t\t\tm = m.rowSwitch(pivotRow, switchTo);\n\t\t\t\t\tpermutations.put(pivotRow, switchTo);\n\t\t\t\t\tswitchTo--;\n\t\t\t\t}\n\t\t\t\tif (!m.ROWS[pivotRow][col].equals(new ComplexNumber(0))) {\n\t\t\t\t\t// We got a non-zero pivot\n\t\t\t\t\tfor (int lowerRow = pivotRow + 1; lowerRow < m.M;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlowerRow++) {\n\t\t\t\t\t\tComplexNumber factor1 = new ComplexNumber(-1);\n\t\t\t\t\t\tComplexNumber factor2 = m.ROWS[lowerRow][col];\n\t\t\t\t\t\tComplexNumber factor3 = m.ROWS[pivotRow][col];\n\t\t\t\t\t\tComplexNumber factor4 = new ComplexNumber(1);\n\t\t\t\t\t\tComplexNumber factor5 = factor1.multiply(factor2);\n\t\t\t\t\t\tComplexNumber factor6 = factor4.divide(factor3);\n\t\t\t\t\t\tComplexNumber weight = factor5.multiply(factor6);\n\n\t\t\t\t\t\tm = m.rowAdd(lowerRow, pivotRow, weight);\n\t\t\t\t\t}\n\t\t\t\t\tpivotRow++;\n\t\t\t\t\t/* Keep the same pivot row if we currently have a\n\t\t\t\t\t * zero-pivot. Move on to see if there's a pivot in the\n\t\t\t\t\t * next column.\n\t\t\t\t\t */\n\t\t\t\t}\t\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tMatrix p = identity(m.M);\n\t\tfor (Integer rowI : permutations.keySet()) {\n\t\t\tp.rowSwitch(rowI, permutations.get(rowI));\n\t\t}\n\t\tMatrix l = identity(m.M);\n\t\tMatrix u = p.multiply(copy());\n\t\t\n\t\tpivotRow = 0;\n\t\tfor (int col = 0; col < u.N; col++) {\n\t\t\tif (pivotRow < u.M) {\n\t\t\t\t// Should not have to do any permutations\n\t\t\t\tif (!u.ROWS[pivotRow][col].equals(new ComplexNumber(0))) {\n\t\t\t\t\t// We got a non-zero pivot\n\t\t\t\t\tfor (int lowerRow = pivotRow + 1; lowerRow < u.M;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlowerRow++) {\n\t\t\t\t\t\tComplexNumber factor1 = new ComplexNumber(-1);\n\t\t\t\t\t\tComplexNumber factor2 = u.ROWS[lowerRow][col];\n\t\t\t\t\t\tComplexNumber factor3 = u.ROWS[pivotRow][col];\n\t\t\t\t\t\tComplexNumber factor4 = new ComplexNumber(1);\n\t\t\t\t\t\tComplexNumber factor5 = factor1.multiply(factor2);\n\t\t\t\t\t\tComplexNumber factor6 = factor4.divide(factor3);\n\t\t\t\t\t\tComplexNumber weight = factor5.multiply(factor6);\n\n\t\t\t\t\t\tu = u.rowAdd(lowerRow, pivotRow, weight);\n\t\t\t\t\t\tl = l.rowAdd(lowerRow, pivotRow, weight);\n\t\t\t\t\t}\n\t\t\t\t\tpivotRow++;\n\t\t\t\t\t/* Keep the same pivot row if we currently have a\n\t\t\t\t\t * zero-pivot. Move on to see if there's a pivot in the\n\t\t\t\t\t * next column.\n\t\t\t\t\t */\n\t\t\t\t}\t\n\t\t\t}\n\t\t}\n\t\t\n\t\tl = l.inverse();\n\t\tMatrix[] palu = {p, this, l, u};\n\t\treturn palu;\n\t}", "static int[][] packU(int n, int[] from, int[] to) {\n int[][] g = new int[n][];\n int[] p = new int[n];\n for (int f : from) {\n p[f]++;\n }\n for (int t : to) {\n p[t]++;\n }\n for (int i = 0; i < n; i++) {\n g[i] = new int[p[i]];\n }\n for (int i = 0; i < from.length; i++) {\n g[from[i]][--p[from[i]]] = to[i];\n g[to[i]][--p[to[i]]] = from[i];\n }\n return g;\n }", "public static void main(String[] args)\n {\n int[][] ints;\n int[][] ints1;\n\n\n\n\n ints = new int[][]{\n {1, 2, 3, 4, 5, 6, 7, 8, 9},\n {10, 11, 12, 13, 14, 15, 16, 17, 18},\n {19, 20, 21, 22, 23, 24, 25, 26, 27},\n {28, 29, 30, 31, 32, 33, 34, 35, 36},\n {37, 38, 39, 40, 41, 42, 43, 44, 45},\n {46, 47, 48, 49, 50, 51, 52, 53, 54},\n {55, 56, 57, 58, 59, 60, 61, 62, 63},\n {64, 65, 66, 67, 68, 69, 70, 0, 71},\n {73, 74, 75, 76, 77, 78, 79, 80, 72}\n };\n\n ints = new int[][]{\n {1,0},\n {2,3},\n };\n ints1 = new int[][]{\n {1, 2, 3},\n {4, 5, 6},\n {7, 0, 8}\n };\n\n ints1 = new int[][]{\n {1, 2, 3},\n {4, 8, 5},\n {7, 0, 6}\n };\n ints = new int[][]{\n {5, 0, 4},\n {2, 3, 8},\n {7,1,6}\n };\n ints1 = new int[][]{\n {1, 6, 4},\n {7, 0, 8},\n {2, 3, 5}\n };\n\n ints1 = new int[][]{\n {6, 0, 5},\n {8, 7, 4},\n {3, 2, 1}\n };\n ints1 = new int[][]{\n {11, 0, 4, 7},\n {2, 15, 1, 8},\n {5, 14, 9, 3},\n {13, 6, 12, 10 }\n };\n\n\n ints1 = new int[][]{\n {14, 13, 5, 3},\n {0, 1, 8, 12},\n {6, 2, 4, 10},\n {11, 9, 15, 7 }\n };\n\n ints1 = new int[][]{\n {8, 4, 7},\n {1,5,6},\n {3,2,0}\n };\n\n\n ints1 = new int[][]{\n {8, 4, 7},\n {1,5,6},\n {3,2,0}\n };\n\n\n ints = new int[][]{\n {1, 2, 3},\n {4, 6,5},\n {7, 8,0}\n };\n ints1 = new int[][]{\n {8, 4, 7},\n {1,5,6},\n {3,2,0}\n };\n ints = new int[][]{\n {1,0},\n {2,3},\n };\n System.out.println(System.currentTimeMillis());\n Board board = new Board(ints);\n Solver solution = new Solver(board);\n\n for (Board el :solution.solution())\n {\n System.out.println(el);\n }\n System.out.println(System.currentTimeMillis());\n\n\n }", "public List<int[][]> evaluate(IBoard board){\n\n int area = board.getHeight() * board.getWidth();\n\n int[][] newArray = new int[area][2];\n\n int k = 0;\n\n while (k < newArray.length) {\n for (int i = 0; i < board.getHeight(); i++) {\n for (int j = 0; j < board.getWidth(); j++) {\n newArray[k][0] = i;\n newArray[k][1] = j;\n k++;\n }\n }\n }\n\n List<int[][]> Allmoves = new ArrayList<>();\n\n int res = newArray.length / board.getHeight();\n\n /*For rows*/\n int q = 0;\n int w = res;\n\n for (int i = 0; i < res; i++) {\n int[][] arr = new int[res][2];\n\n int e = 0;\n\n for (int j = q; j < w; j++) {\n arr[e][0] = newArray[j][0];\n arr[e][1] = newArray[j][1];\n e++;\n }\n\n w += res;\n q += res;\n\n Allmoves.add(arr);\n\n }\n\n /*For columns*/\n int r = 0;\n for (int i = 0; i < res; i++) {\n\n int[][] arr = new int[res][2];\n int e = 0;\n\n for (int j = 0; j < res; j++) {\n arr[e][0] = newArray[r][0];\n arr[e][1] = newArray[r][1];\n\n r += res;\n e++;\n }\n r = 0;\n r += i + 1;\n\n Allmoves.add(arr);\n }\n\n /*For diagonal - 1*/\n int[][] arr = new int[res][2];\n int d1 = res + 1;\n int d = 0;\n int e = 0;\n for (int i = 0; i < res; i++) {\n arr[e][0] = newArray[d][0];\n arr[e][1] = newArray[d][1];\n d += d1;\n e++;\n }\n\n Allmoves.add(arr);\n\n int[][] arr1 = new int[res][2];\n int d2 = res - 1;\n int D = res - 1;\n int p = 0;\n for (int i = 0; i < res; i++) {\n arr1[p][0] = newArray[D][0];\n arr1[p][1] = newArray[D][1];\n D += d2;\n p++;\n }\n\n Allmoves.add(arr1);\n\n return Allmoves;\n\n }", "public static void main(String[] args) {\n int[][] array = new int[6][6];\n int sum=0, result=0, sub=0;\n Scanner sc = new Scanner(System.in);\n //System.out.println(\"Enter array elements\")\n for(int x=0 ; x < 6; x++){\n for( int y=0; y < 6; y++) {\n array[x][y]= sc.nextInt();\n }\n }\n //System.out.println(\"Desired Sum : \")\n for( int k=0; k < 4; k++){\n for( int m=0; m < 4; m++){\n for ( int i=k; i < k+3; i++ ){\n int j=0; \n for ( j=m; j < m+3; j++){\n if( i != k+1){\n sum += array[i][j];\n }\n else{\n sum += array[i][j+1];\n break;\n }\n }\n }\n result = Math.max(result, sum);\n sum = 0; \n }\n }\n System.out.println(result);\n \n }", "private void buildArray() throws VerificationException\n {\n \tindices = new int[length];\n \tcommonality = new int[length];\n \n \tcommonality[0] = -1;\n \tfor( int i=0; i<indices.length; i++ ){\n \t indices[i] = i;\n \t}\n \n sort();\n }", "private int[][][] mkGridCube(char[] xs, char[] ys, int band) {\n int[][][] result = new int[3][ys.length + 1][xs.length + 1];\n\n //we need to initialized things.\n //the top matrix is the -> so along the top row (which is of length band)\n // each j =0 is the gap cost, and initially we are extending the gap, so\n // j = 1 to start there means you are skipping 2, so it's j-1 + extend. \n // along the first column, we are simply opening the gap for the first time.\n // vise versa for the bottom matrix. \n //first adjust the band if we need to. it may be unneccessarily big. \n if (band == -1 || band > result[0][0].length) {\n band = result[0][0].length;\n }\n System.out.println(\"band: \" + band);\n //now fill er up!\n result[UPPER][0][0] = OPEN_GAP;\n result[LOWER][0][0] = OPEN_GAP;\n result[MIDDLE][0][0] = 0;\n for (int j = 1; j < band; j++) {\n //the gap extention cost is added each time for this matrix.\n result[UPPER][0][j] = result[UPPER][0][j - 1] + EXTEND_GAP;\n\n //in this matrix, the top row is all initial gaps. \n result[LOWER][0][j] = OPEN_GAP + OPEN_GAP + (j) * EXTEND_GAP;\n\n result[MIDDLE][0][j] = -10000;//result[UPPER][0][j - 1] + score(xs[j - 1], ys[0]); //maybe?? I think? there is no cost to before, right?\n }\n int imax = band > result[LOWER].length ? result[LOWER].length : band;\n for (int i = 1; i < imax; i++) {\n result[UPPER][i][0] = OPEN_GAP + OPEN_GAP + (i) * EXTEND_GAP;//initGapCost;\n result[LOWER][i][0] = result[LOWER][i - 1][0] + EXTEND_GAP;\n result[MIDDLE][i][0] = -10000;//result[LOWER][i - 1][0] + score(xs[0], ys[i - 1]);\n\n }\n //the matrices have been initialized. we are ready to begin filling with: \n /*\n ↓\n si,j= max ( ↓si−1,j −σ\n si−1,j − (ρ + σ)\n →\n s i,j= max ( →s i,j−1 −σ\n si,j−1 − (ρ + σ)\n\n si,j = max\n\n\n\nsi−1,j−1 + δ(vi\n, wj )\n↓\nsi,j\n→\ns i,j\n */\n\n for (int i = 1; i < result[LOWER].length; i++) {\n LinearEquation diageq = mkDiagEquation(result[MIDDLE]);\n int from = Math.round(diageq.getX(i)) - band;\n if (from < 1) {\n from = 1;\n }\n int to = Math.round(diageq.getX(i)) + band;\n if (to > result[LOWER][0].length) {\n to = result[LOWER][0].length;\n }\n System.out.println(\"from: \" + from + \" to: \" + to);\n for (int j = from; j < to; j++) {\n\n result[LOWER][i][j] = Integer.max(\n result[LOWER][i - 1][j] + EXTEND_GAP,\n result[MIDDLE][i - 1][j] + OPEN_GAP);\n\n result[UPPER][i][j] = Integer.max(\n result[UPPER][i][j - 1] + EXTEND_GAP,\n result[MIDDLE][i][j - 1] + OPEN_GAP\n );\n result[MIDDLE][i][j] = Integer.max(Integer.max(\n result[MIDDLE][i - 1][j - 1],\n result[LOWER][i][j]),\n result[UPPER][i][j]) + score(ys[i - 1], xs[j - 1]);\n\n }\n\n }\n System.out.println(\"UPPER\");\n print2D(result[UPPER]);\n System.out.println(\"MIDDLE\");\n print2D(result[MIDDLE]);\n System.out.println(\"LOWER\");\n print2D(result[LOWER]);\n\n System.out.println(\"done\");\n return result;\n }", "public static void main(String... args)\n{\nint[][] b = {\n\t{1,2,3},\n\t{4,5,6},\n\t{7,8,9}\n\t};\n//int[][] c = new int[4][];\n//System.out.println(b[1][0]);\n//int[][][] d = new int[3][3][3];\n//int[][][] e = new int[][][]{\n//\t{{1,2,3},{4,5,6},{7,8,9}},\n//\t{{1,2,3},{4,5,6},{7,8,9}},\n//\t{{1,2,3},{4,5,6},{7,8,9}}\n//\t};\n\nObject[][][] cubbies = new Object[3][0][5];\nint[][] java = new int[2][2];\nint bla ='a';\n\nchar[] c = new char[2];\n//int length = c.size();\nList<String> ob1 = new ArrayList<>();\nob1.size();\n\n//int[][] array3 = {1,2,3},{0};\n\n\t//System.out.println(b[0][0].length);\nOUTER: for(int[] row: b)\n{\n\tINNER: for(int i=0;i<row.length;i++)\n\t{\n\t\tif(row[i]%2==0)\n\t\tcontinue INNER;\n\t\tSystem.out.print(\" \"+row[i]);\n\t}\n\tSystem.out.println();\n}\n}", "INDArray getBoardScores() {\n //creez un vector ce va contine aceste scoruri si va putea fi folosit la antrenare\n INDArray boardScores = Nd4j.zeros(1, size * size);\n\n //creez o copie a tablei pentru a o putea modifica\n Stone[][] boardCopy = Board.getBoard(), board = new Stone[size][size];\n\n //gasesc recursiv scorurile tablei curente\n float[][] boardScoresFloat = new float[size][size];\n //simulez o mutare a jucatorului\n int stonesNr = Board.getStonesNr();\n for(int i = 0; i < size; i++)\n for(int j = 0; j < size; j++){\n Chain chain = new Chain();\n Stone stone = new Stone(color ? \"black\" : \"white\", chain);\n stone.setPosition(i, j);\n for (int k = 0; k < boardCopy.length; k++) {\n board[k] = Arrays.copyOf(boardCopy[k], boardCopy[k].length);\n }\n int[] lib = Control.verifyLiberties(board, stone, i, j);\n if(board[i][j] == null && lib[0] + lib[1] != 0){\n int depth = 0;\n int dif = size / 2;\n boardScoresFloat[i][j] = getQScore(board, i, j, depth, depth)\n + new Random().nextInt(1000 / stonesNr) - (500 / stonesNr)\n - abs(i - dif) - abs(j - dif);\n }\n else{\n boardScoresFloat[i][j] = -5000;\n }\n }\n\n //normalizez vectorul\n //aflu norma vectorului de valori\n double sum = 0;\n for(int i = 0; i < size; i++)\n for(int j = 0; j < size; j++)\n sum += boardScoresFloat[i][j] * boardScoresFloat[i][j];\n sum = Math.sqrt(sum);\n //aplic norma\n for(int i = 0; i < size; i++)\n for(int j = 0; j < size; j++)\n boardScoresFloat[i][j] /= sum;\n\n //inserez rezultatele gasite intr-un INDArray\n int poz = 0;\n for(int i = 0; i < size; i++)\n for(int j = 0; j < size; j++){\n boardScores.putScalar(new int[]{0, poz}, boardScoresFloat[i][j]);\n poz++;\n }\n //System.out.println(boardScores);\n return boardScores;\n }", "public static void main(String[] args) {\n\t\tint[][] arr = new int[2][3];\n\t\tint tmp=10;\n\t\tfor (int i = 0; i < 2; i++) {\n\t\t\tfor (int j = 0; j < 3; j++) {\n\t\t\t\tarr[i][j]=tmp;\n\t\t\t\ttmp+=10;\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < arr.length; i++) {\n\t\t\tfor (int j = 0; j < arr[0].length; j++) {\n\t\t\t\tSystem.out.println(arr[i][j]);\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(\"=================\");\n\t\t\n\t\t//동적 배열 가능\n\t\tint[][] arr2=new int[3][];\n\t\tarr2[0]=new int[5];\n\t\tarr2[0]=new int[10];\n\t\t\n\t}", "public double[] test() {\r\n BigInteger a = generator.getA();\r\n BigInteger m = generator.getM();\r\n BigInteger h, hPrime, p, pPrime;\r\n BigInteger r, s;\r\n BigInteger q;\r\n BigInteger U[][], V[][];\r\n int t;\r\n\r\n //Step 1: Initialization\r\n h = a;\r\n hPrime = m;\r\n p = BigInteger.ONE;\r\n pPrime = BigInteger.ZERO;\r\n r = a;\r\n s = a.multiply(a).add(BigInteger.ONE);\r\n t = 1;\r\n //End of Step 1: Initialization\r\n\r\n //Step 2: Euclidean step to handle the case when t=2.\r\n U = new BigInteger[t][t];\r\n V = new BigInteger[t][t];\r\n //In this step, U & V have only one element\r\n do {\r\n q = hPrime.divide(h);\r\n U[0][0] = hPrime.subtract(q.multiply(h)); //Same as hPrime % h?\r\n V[0][0] = pPrime.subtract(q.multiply(p));\r\n BigInteger temp = U[0][0].multiply(U[0][0]).add(V[0][0].multiply(V[0][0]));\r\n if (temp.compareTo(s) >= 0) { //if temp>=s\r\n break;\r\n }\r\n //else if u2+v2<s do the following and loop back\r\n s = temp;\r\n hPrime = h;\r\n h = U[0][0];\r\n pPrime = p;\r\n p = V[0][0];\r\n } while (true);\r\n //End of Step 2: Euclidean step for t=2\r\n\r\n //Step 3: Compute nu2\r\n U[0][0] = U[0][0].subtract(h);\r\n V[0][0] = V[0][0].subtract(p);\r\n if (U[0][0].multiply(U[0][0]).add(V[0][0].multiply(V[0][0])).compareTo(s)==-1) {\r\n s = U[0][0].multiply(U[0][0]).add(V[0][0].multiply(V[0][0]));\r\n hPrime = U[0][0];\r\n pPrime = V[0][0];\r\n }\r\n t++; //t=2\r\n nu[t - 1] = s.doubleValue(); //nu2\r\n\r\n //Setting up the matrices\r\n U = new BigInteger[t][t];\r\n V = new BigInteger[t][t];\r\n\r\n //U:\r\n U[0][0] = h.negate();\r\n U[0][1] = p;\r\n U[1][0] = hPrime.negate();\r\n U[1][1] = pPrime;\r\n\r\n //V:\r\n V[0][0] = pPrime;\r\n V[0][1] = hPrime;\r\n V[1][0] = p.negate();\r\n V[1][1] = h.negate();\r\n\r\n if (pPrime.compareTo(BigInteger.ZERO) > 0) //if pPrime>0 then V = -V\r\n {\r\n for (int i = 0; i < t; i++) {\r\n for (int j = 0; j < t; j++) {\r\n V[i][j] = V[i][j].negate();\r\n }\r\n }\r\n }\r\n //End of Step 3: Compute nu2\r\n\r\n //Step 4: For values 2<t<=T\r\n while (t < T) {\r\n t++; //3, 4,..., T\r\n //System.out.println(\"t=\"+t);\r\n \r\n r = a.multiply(r).mod(m);\r\n\r\n BigInteger uIncreased[][] = new BigInteger[t][t];\r\n BigInteger vIncreased[][] = new BigInteger[t][t];\r\n\r\n for (int i = 0; i < t; i++) {\r\n for (int j = 0; j < t; j++) {\r\n uIncreased[i][j] = vIncreased[i][j] = BigInteger.ZERO;\r\n }\r\n }\r\n \r\n //setting Ut and Vt i.e. last rows of the new U and V\r\n uIncreased[t - 1][0] = r.negate();\r\n vIncreased[t - 1][0] = BigInteger.ZERO;\r\n// for (int i = 1; i < t - 1; i++) {\r\n// uIncreased[t - 1][i] = vIncreased[t - 1][i] = BigInteger.ZERO;\r\n// }\r\n uIncreased[t - 1][t - 1] = BigInteger.ONE;\r\n vIncreased[t - 1][t - 1] = m;\r\n\r\n //copy u & v to uIncreased & vIncreased\r\n for (int i = 0; i < U.length; i++) {\r\n int j;\r\n for (j = 0; j < U[i].length; j++) {\r\n uIncreased[i][j] = U[i][j];\r\n vIncreased[i][j] = V[i][j];\r\n }\r\n //Uit = 0 , Vit = Vi1*r - q*m where q = round(vi1*r/m) for 1<=i<t. Here j=t now.\r\n// uIncreased[i][j] = 0;\r\n //q = Math.round(vIncreased[i][1] * r / (double)m); //casting to prevent precision loss by division\r\n //q = vIncreased[i][1].multiply(r).divide(m);\r\n q = divideAndRound(vIncreased[i][0].multiply(r), m);\r\n vIncreased[i][j] = vIncreased[i][0].multiply(r).subtract(q.multiply(m));\r\n\r\n //Ut = Ut + q*Ui\r\n uIncreased[t - 1] = (new Vector(uIncreased[t - 1]).add(new Vector(uIncreased[i]).multiplyScalar(q))).toArray();\r\n }\r\n \r\n U = uIncreased;\r\n V = vIncreased;\r\n\r\n BigInteger utSq = new Vector(U[t - 1]).selfProduct();\r\n if (utSq.compareTo(s) < 0) {\r\n s = utSq;\r\n }\r\n\r\n int k = t - 1; //last index where the transformation shortened atleast one of the Vi\r\n int j = 0; //current row index for transformation(Knuth's algo is 1-based, arrays here are 0-based)\r\n\r\n //Step 7: Advance j. Starts elsewhere according to Knuth's algo. Modified to prevent gotos.\r\n do {\r\n //Step 5: Transform\r\n for (int i = 0; i < t; i++) {\r\n Vector vI = new Vector(V[i]);\r\n Vector vJ = new Vector(V[j]);\r\n BigInteger vIDotJ = vI.multiply(vJ);\r\n BigInteger vJDotJ = vJ.selfProduct();\r\n //System.out.println(vIDotJ.multiply(new BigInteger(\"2\"))+\" & \"+vJDotJ+\" i= \"+i+\" j= \"+j);\r\n if (i != j && vIDotJ.abs().multiply(new BigInteger(\"2\")).compareTo(vJDotJ) > -1) {\r\n q = divideAndRound(vIDotJ, vJDotJ); //casting to prevent precision loss by division\r\n //Vi = Vi - q*Vj\r\n V[i] = vI.subtract(vJ.multiplyScalar(q)).toArray();\r\n //Uj = Uj + q*Ui\r\n U[j] = new Vector(U[j]).add(new Vector(U[i]).multiplyScalar(q)).toArray();\r\n k = j;\r\n }\r\n }\r\n //End of Step 5: Transform\r\n\r\n //Step 6: Examine new bound\r\n if (k == j) {\r\n BigInteger ujSq = new Vector(U[j]).selfProduct();\r\n if (ujSq.compareTo(s) < 0) {\r\n s = ujSq;\r\n }\r\n }\r\n //End of Step 6: Examine new bound\r\n j = (j + 1) % t;\r\n } while (j != k);\r\n //System.out.println(\"Ended loop of step 7\");\r\n //End of Step 7: Advance j\r\n\r\n //Step 8: Prepare for search\r\n BigInteger X[] = new BigInteger[t];\r\n BigInteger Y[] = new BigInteger[t];\r\n BigInteger Z[] = new BigInteger[t];\r\n //extra overhead of initializing BigInteger arrays :(\r\n for (int i = 0; i < t; i++) {\r\n X[i] = Y[i] = Z[i] = BigInteger.ZERO;\r\n }\r\n \r\n k = t - 1;\r\n //Setting Z\r\n for (int i = 0; i < t; i++) {\r\n Vector vI = new Vector(V[i]);\r\n //Z[i] = (BigInteger) Math.floor(Math.sqrt(Math.floor((vI.selfProduct() * s / (double)m)/ m))); //If m is too big m^2 becomes inf, \r\n //so divide by m twice instead of dividing by m^2\r\n //Exploiting the fact that floor(a/b^2) = floor(floor(a/b)/b)\r\n //The BigIntegers are actually small enough before taking square roots hence sqrt(double) works fine enough\r\n String temp = String.valueOf(Math.floor(Math.sqrt(Math.floor(\r\n vI.selfProduct().multiply(s).divide(m).divide(m).doubleValue()))));\r\n Z[i] = new BigInteger(temp.substring(0, temp.length()-2));\r\n //----------------------------------------------------------------------------------------------------\r\n }\r\n //End of Step 8: Prepare for search\r\n\r\n //Step 9: Advance Xk\r\n do {\r\n if (X[k].compareTo(Z[k])!=0) { //X[k] != Z[k]\r\n X[k] = X[k].add(BigInteger.ONE);\r\n Y = new Vector(Y).add(new Vector(U[k])).toArray();\r\n\r\n //Step 10: Advance k\r\n do {\r\n ++k;\r\n if (k <= t - 1) {\r\n X[k] = Z[k].negate();\r\n Y = new Vector(Y).subtract(new Vector(U[k]).multiplyScalar(Z[k].multiply(new BigInteger(\"2\")))).toArray();\r\n } else {\r\n BigInteger ySq = new Vector(Y).selfProduct();\r\n if (ySq.compareTo(s) < 0) {\r\n s = ySq;\r\n }\r\n break;\r\n }\r\n } while (true);\r\n //End of Step 10: Advance k\r\n }\r\n //End of Step 9: Advance Xk\r\n //Step 11: Decrease k\r\n --k;\r\n //System.out.println(\"Stuck at k=\"+k);\r\n } while (k >= 0);\r\n nu[t - 1] = s.doubleValue();\r\n //End of Step 11: Decrease k\r\n }\r\n //End of Step 4: For values 2<t<=T\r\n \r\n //Calculating mu\r\n calculateMu();\r\n //\r\n //Show a comprehensive summary of the test results\r\n showSummary();\r\n return getNu();\r\n }", "public static void main(String[] args) {\n\t\tint a[][]=new int [5][5];\r\n\t\tfor(int i=0;i<a.length; i++)\r\n\t\t{\r\n\t\t\tfor (int j=0;j<a[i].length;j++)\r\n\t\t\t{\r\n\t\t\t\tif(i==0 ||j==0||i==4||j==4)\r\n\t\t\t\t{\r\n\t\t\t\t\ta[i][j]=1;\r\n\t\t\t\t}\r\n\t\t\t\r\n\t\t\t\tSystem.out.print(a[i][j]+\" \");\r\n\t\t\t}\r\n\t\t\tSystem.out.println();\r\n\t\t}\r\n\r\n\t}", "@Test\n public void testCreateRowIndices3(){\n int[][] a = new int[4][2];\n a[0][0] = 0;\n a[0][1] = 0;\n a[1][0] = 0;\n a[1][1] = 1;\n a[2][0] = 0;\n a[2][1] = 2;\n a[3][0] = 2;\n a[3][1] = 1;\n\n double[][] input = new double[4][4];\n\n for(int i = 0 ; i < a.length ; i++){\n input[a[i][0]][a[i][1]] = 1;\n }\n\n int[][] myIndices = HarderArrayProblems.createRowIndices(input);\n for(int i = 0 ; i < a.length ; i++){\n assertEquals(a[i][0], myIndices[i][0]);\n assertEquals(a[i][1], myIndices[i][1]);\n }\n }", "public abstract ParallelLongArray allUniqueElements();", "public static void main(String[] args) {\n\t\tint[] arr = {2,6};\n\t\tfor (int i = 0; i < arr.length; i++) {\n\t\t\n\t\t\t\n\t\t\tint[] arrNew = null;\n\t\t\tfor (int j = 1; j < 100; j++) {\n\t\t\t\tarrNew[j] = arr[i] *j ;\n\t\t\t}\n\t\t}\n\t}", "private boolean[][] makeSet(int[] sol, int n) {\n boolean[][] ret = new boolean[n][universalSetSize];\n int r = 0;\n for (int i = 0; i < n; i++) { // Row\n int row = sol[i];\n System.arraycopy(input[row], 0, ret[r], 0, input[i].length);\n r++;\n }\n return ret;\n }", "public int[][][] testIntArray(int[][][] in) throws java.rmi.RemoteException {\n for (int i=0; i < in.length; i++) {\n int[][] array2 = in[i];\n if (array2 != null)\n for (int j=0; j < array2.length; j++) {\n int[] array3 = array2[j];\n if (array3 != null)\n for (int k=0; k <array3.length; k++) {\n if (array3[k] == i + 10*j + 100*k)\n array3[k] += 1000;\n }\n }\n }\n return in;\n }", "public static int[][] raggedArray(){\n int n=(int)(Math.random()*11);\n n+=10; \n //this randomly assigns n to between 10 and 20\n int[][] ragged=new int[n][];\n //initialize this array with n first components\n //forloop to assign each inner array a length\n for(int i=0; i<n; i++){\n int m=(int)(Math.random()*11);\n m+=10; //m is between 10 and 20\n ragged[i]=new int[m];\n //another for loop to assign values\n for(int k=0; k<m; k++){\n int val=(int)(Math.random()*1001);\n int sign=(int)(Math.random()*2);\n if(sign==0){\n \n }\n else{\n val*=-1;\n //makes it 50/50 to be negative\n }\n ragged[i][k]=val;\n //assigns value to that spot of array\n }\n }\n return ragged;\n }", "private double[][] a2() {\n double[][] r = a;\n for (int j = 0; j < nBinVars; j++) {\n final int v = intVars[j];\n if (existsBinConstraint(v)) {\n LOG.debug(\"existsBinConstraint\", v);\n this.nBinVars2--;\n continue;\n }\n double[] constraint = new double[n];\n constraint[v - 1] = 1d;\n r = Maths.append(r, constraint);\n }\n return r;\n }", "public static void main(String[] args) {\n\t\tint[] marks = {10,20,30,60,40,50,70}; // element = 7\n\t\tint[] marks2 = new int[10]; \n\t\tmarks2[0] = 10;\n\t\tmarks2[1] = 10;\n\t\tmarks2[2] = 10;\n\t\tmarks2[3] = 10;\n\t\tmarks2[4] = 10;\n\t\tmarks2[5] = 10;\n\t\tmarks2[6] = 10;\n\t\tmarks2[7] = 10;\n\t\tmarks2[8] = 10;\n\t\tmarks2[9] = 10;\n\t\t\n\t\t// array works on index concept.\n\t\t// 7 - length of this array\n\t\t// highest index - 6\n\t\t// System.out.println(marks.length); // size = 7\n\t\t\n//\t\tfor(int i = 0; i < marks2.length; i++) {\n//\t\t\tSystem.out.println(marks2[i]);\n//\t\t}\n\t\t\n\t\tfor(int i = (marks.length-1) ; i >= 0 ;i--) {\n\t\t\tSystem.out.println(marks[i]);\n\t\t}\n\t\t\n\t\t// advantages\n\t\t// keep the collection\n\t\t// fastest available collection in any object oriented language\n\t\t// when we create array - we have to give size of that array \n\t\t// 10 of int(4) = 10*4 = 40 byte (JVM )\n\t\t\n\t\t// disavantage \n\t\t// array - we cannot chnage the size \n\t\t\n\t\t\n\t\t// multidimentional - 1D array\n\t\t// 2D array - 2 dimentions\n\t\tint[][] matrix = {{10,20},{20,30}}; // directly values \n\t\t\n\t\tint[][] matrix2 = new int[2][2]; // directly values\n\t\tmatrix2[0][0] = 10;\n\t\tmatrix2[0][1] = 20;\n\t\tmatrix2[1][0] = 20;\n\t\tmatrix2[1][1] = 30;\n\t\t\n\t\tint[][] matrix1 = new int[2][6]; // size\n\t\t// student 1 marks\n\t\tmatrix1[0][0] = 10;\n\t\tmatrix1[0][1] = 20;\n\t\tmatrix1[0][2] = 20;\n\t\tmatrix1[0][3] = 20;\n\t\tmatrix1[0][4] = 20;\n\t\tmatrix1[0][5] = 20;\n\t\t// student 2 marks\n\t\tmatrix1[1][0] = 10;\n\t\tmatrix1[1][1] = 20;\n\t\tmatrix1[1][2] = 20;\n\t\tmatrix1[1][3] = 20;\n\t\tmatrix1[1][4] = 20;\n\t\tmatrix1[1][5] = 20;\n\t\t\n\t\t\n\t\t\n\t}", "private void declareArrays() {\n int iNumTimesteps = m_oLegend.getNumberOfTimesteps(),\n i, j, k;\n \n //Create arrays to hold raw data.\n mp_fLiveTreeVolumeTotals = new double[m_iNumSpecies][iNumTimesteps + 1][m_iNumSizeClasses];\n mp_fSnagVolumeTotals = new double[m_iNumSpecies][iNumTimesteps + 1][m_iNumSizeClasses]; \n mp_iLiveTreeCounts = new long[m_iNumSpecies][iNumTimesteps + 1][m_iNumSizeClasses];\n mp_iSnagCounts = new long[m_iNumSpecies][iNumTimesteps + 1][m_iNumSizeClasses];\n mp_fLiveTreeDBHTotal = new double[m_iNumSpecies][iNumTimesteps + 1];\n mp_fSnagDBHTotal = new double[m_iNumSpecies][iNumTimesteps + 1];\n mp_fTallestLiveTrees = new float[m_iNumSpecies+1][iNumTimesteps + 1][10];\n mp_fTallestSnags = new float[m_iNumSpecies+1][iNumTimesteps + 1][10];\n \n //Initialize all values with 0s\n for (i = 0; i < mp_fTallestLiveTrees.length; i++) {\n for (j = 0; j < mp_fTallestLiveTrees[i].length; j++) {\n for (k = 0; k < mp_fTallestLiveTrees[i][j].length; k++) {\n mp_fTallestLiveTrees[i][j][k] = 0;\n mp_fTallestSnags[i][j][k] = 0;\n }\n }\n }\n \n for (i = 0; i < m_iNumSpecies; i++) {\n for (j = 0; j <= iNumTimesteps; j++) {\n mp_fLiveTreeDBHTotal[i][j] = 0;\n mp_fSnagDBHTotal[i][j] = 0;\n for (k = 0; k < m_iNumSizeClasses; k++) {\n mp_iLiveTreeCounts[i][j][k] = 0;\n mp_iSnagCounts[i][j][k] = 0;\n mp_fLiveTreeVolumeTotals[i][j][k] = 0;\n mp_fSnagVolumeTotals[i][j][k] = 0;\n }\n }\n }\n }", "public static void main(String[] args) {\n\t\tint[][] array = new int[5][6];\r\n\t\tint[] x = {1,2};array[0] = x;\r\n\t\tSystem.out.println(\"array[0][1] is \" + array[0][1]);\r\n\t\tSystem.out.println(Arrays.deepToString(array));\r\n\t\t\r\n\t\tint[][] arr = {{1,2}, {3,4}, {5,6}};\r\n\t\tfor (int i = arr.length - 1; i >= 0; i--) \r\n\t\t{for (int j = arr[i].length - 1; j >= 0; j--)\r\n\t\t\tSystem.out.print(arr[i][j] + \" \");\r\n\t\tSystem.out.println();\r\n\t\t}\r\n\t\tint[][] array1 = {{1,2}, {3,4}, {5,6}};\r\n\t\tint sum = 0;\r\n\t\tfor (int i = 0; i < array1.length; i++)\r\n\t\t\tsum += array1[i][0];\r\n\t\tSystem.out.println(sum);\r\n\t\r\n\tint [][]matrix = new int [10] [10];\r\n\t\r\n\tfor (int row = 0; row < matrix.length; row++) {\r\n\t\tfor (int column = 0; column < matrix[row].length; column++) {\r\n\t\tmatrix[row][column] = (int)(Math.random() * 100); }}\r\n\tSystem.out.println(Arrays.deepToString(matrix));\r\n\r\n\tfor (int i = 0; i < matrix.length; i++) {\r\n\t\tfor (int j = 0; j < matrix[i].length; j++) {\r\n\t\t\tint i1 = (int)(Math.random() * matrix.length);\r\n\t\t\tint j1 = (int)(Math.random() * matrix[i].length);\r\n\t\t\tint temp = matrix[i][j];\r\n\t\t\tmatrix[i][j] = matrix[i1][j1];\r\n\t\t\tmatrix[i1][j1] = temp;\r\n\t\t}\r\n\t}System.out.println(Arrays.deepToString(matrix));\r\n\t}", "public static double [][] inv(double [][] a) {\n int N = a.length;\n double [] col = new double[N];\n int [] indx = new int[N];\n double [][] y = new double[N][N];\n \n double d = ludcmp(a, indx);\n for (int j=0; j<N; j++ ) {\n for (int i=0; i<N; i++) \n col[i] = 0.0;\n col[j] = 1.0;\n lubksb(a, indx, col);\n for (int i=0; i<N; i++)\n y[i][j] = col[i];\n }\n return y; \n }", "public int[] a(int paramInt1, int paramInt2, int paramInt3, int paramInt4)\r\n/* 11: */ {\r\n/* 12:13 */ int i = paramInt1 - 1;\r\n/* 13:14 */ int j = paramInt2 - 1;\r\n/* 14:15 */ int k = paramInt3 + 2;\r\n/* 15:16 */ int m = paramInt4 + 2;\r\n/* 16:17 */ int[] arrayOfInt1 = this.a.a(i, j, k, m);\r\n/* 17: */ \r\n/* 18:19 */ int[] arrayOfInt2 = boy.a(paramInt3 * paramInt4);\r\n/* 19:20 */ for (int n = 0; n < paramInt4; n++) {\r\n/* 20:21 */ for (int i1 = 0; i1 < paramInt3; i1++)\r\n/* 21: */ {\r\n/* 22:22 */ int i2 = c(arrayOfInt1[(i1 + 0 + (n + 1) * k)]);\r\n/* 23:23 */ int i3 = c(arrayOfInt1[(i1 + 2 + (n + 1) * k)]);\r\n/* 24:24 */ int i4 = c(arrayOfInt1[(i1 + 1 + (n + 0) * k)]);\r\n/* 25:25 */ int i5 = c(arrayOfInt1[(i1 + 1 + (n + 2) * k)]);\r\n/* 26:26 */ int i6 = c(arrayOfInt1[(i1 + 1 + (n + 1) * k)]);\r\n/* 27:27 */ if ((i6 != i2) || (i6 != i4) || (i6 != i3) || (i6 != i5)) {\r\n/* 28:28 */ arrayOfInt2[(i1 + n * paramInt3)] = arm.w.az;\r\n/* 29: */ } else {\r\n/* 30:30 */ arrayOfInt2[(i1 + n * paramInt3)] = -1;\r\n/* 31: */ }\r\n/* 32: */ }\r\n/* 33: */ }\r\n/* 34:35 */ return arrayOfInt2;\r\n/* 35: */ }", "public static void main(String[] args) {\n\r\nint sale[][][] = new int[][][] {{{1,2,3,4},{5,6,7,8}},{{9,10,11,12,13},{14,15,16,17}}};\r\n\r\nfor(int i=0; i<2; i++)\r\n\tfor(int j=0; j<2; j++)\r\n\t\tfor( int k=0; k<2; k++)\r\n\t\t\tSystem.out.println(sale[i][j][k]);\r\n\r\n\r\n\t}", "short[][] productionTable();", "public int[][] MatrisKuralaUygun(int[][] girdi) {\n\t\tint Kontrol = 0; // cali hucreler kontrol etmek icin\r\n\t\tint[][] output = new int[girdi.length][girdi[0].length]; // [row][colum]\r\n\t\tfor (int i = 0; i < girdi.length; i++) {\r\n\t\t\tfor (int j = 0; j < girdi[0].length; j++) {\r\n\t\t\t\tfor (int k = 1; k < output[0].length - 1; k++) {// bu dongu tek seferlik calisir bir eklemek veya\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// cikarmak icin\r\n\t\t\t\t\tif (j < 3 && i == 0) {// burda 0'inci satir icin // [0][0] saginda ve altiginda bakildi\r\n\t\t\t\t\t\tif (j != 2) {// hepsi Kontrola toplaniyor\r\n\t\t\t\t\t\t\tKontrol += girdi[i][j + k];\r\n\t\t\t\t\t\t} // [0][1] saginda ve solunda ve altinda hucrelere bakildi\r\n\t\t\t\t\t\tKontrol += girdi[i + k][j];//\r\n\t\t\t\t\t\tif (j != 0) { // [0][2] sol ve alt hucrelere\r\n\t\t\t\t\t\t\tKontrol += girdi[i][j - k];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else if (i == 1 && j == 0) {// birinci satir sifirinci dikey\r\n\t\t\t\t\t\tKontrol += girdi[i][j + k];\r\n\t\t\t\t\t\tKontrol += girdi[i + k][j]; // [1][0] ust ve alt ve sag hucrelere bakildi\r\n\t\t\t\t\t\tKontrol += girdi[i - k][j];\r\n\t\t\t\t\t} else if ((i == 1 || i == 2) && (j == 2 || j == 1)) {\r\n\t\t\t\t\t\tKontrol += girdi[i][j - k];\r\n\t\t\t\t\t\tKontrol += girdi[i + k][j];// [1][1] hem ust ve alt ve sag ve sol hucrelere bakildi\r\n\t\t\t\t\t\tif (j != 2) {\r\n\t\t\t\t\t\t\tKontrol += girdi[i][j + k];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tKontrol += girdi[i - k][j];\r\n\r\n\t\t\t\t\t} else if (i == 3 && (j < 3)) {// 2'inci satir icin\r\n\t\t\t\t\t\tif (j != 0) {\r\n\t\t\t\t\t\t\tKontrol += girdi[i][j - k];\r\n\t\t\t\t\t\t} // [2][1] hem ust ve sag ve sol hucrelere bakildi\r\n\t\t\t\t\t\tKontrol += girdi[i - k][j];\r\n\r\n\t\t\t\t\t\tif (j != 2) {\r\n\t\t\t\t\t\t\tKontrol += girdi[i][j + k];\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 (girdi[i][j] == 1 && Kontrol < 2) { // canli ise ve kontrol 2 den az ise\r\n\t\t\t\t\toutput[i][j] = 0;// sifir yazdir\r\n\t\t\t\t\tKontrol = 0;// Kontrol sifirlamamiz cok onemli yoksa kontrol hem artar\r\n\t\t\t\t} else if (girdi[i][j] == 1 && (Kontrol == 2 || Kontrol == 3)) { // canli ise ve kontrol 2 ve 3 ise\r\n\t\t\t\t\toutput[i][j] = 1;\r\n\t\t\t\t\tKontrol = 0;// burda onemli\r\n\t\t\t\t} else if (girdi[i][j] == 1 && Kontrol > 3) { // canli ise ve kontrol 3 den cok ise\r\n\t\t\t\t\toutput[i][j] = 0;\r\n\t\t\t\t\tKontrol = 0;\r\n\t\t\t\t} else if (girdi[i][j] == 0 && Kontrol == 3) { // canli ise ve kontrol 3 ise\r\n\t\t\t\t\toutput[i][j] = 1;\r\n\t\t\t\t\tKontrol = 0;\r\n\t\t\t\t} else {\r\n\t\t\t\t\toutput[i][j] = girdi[i][j];// eger yukardaki kosulari girilmedi ise aynisi yazdir\r\n\r\n\t\t\t\t\tKontrol = 0;// ve yine Kontrol sifir\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t\treturn output;// dizi donduruyor\r\n\r\n\t}", "public static void main(String[] args) {\n for (int i = 1; i < 3; i++){\n for(int j = 0; j < 4; j++){\n System.out.println(\"i=\" + i + \" j=\" + j);\n }\n }\n //2D arrays put arrays inside of arrays\n int[][] grid = {\n {1,2,3},\n {4,5,6},\n {7,8,9}\n };\n }", "public abstract zzob[] zza(zzhw[] zzhwArr, zznp[] zznpArr, int[][][] iArr) throws zzhd;", "public static String[][] m3427b() {\n Vector vector = new Vector();\n String[][] f = C5030by.m3323f();\n if (f != null) {\n for (int length = f.length - 1; length >= 0; length--) {\n vector.addElement(f[length]);\n }\n }\n String[][] a = C5047co.m3446a();\n if (a != null) {\n for (int length2 = a.length - 1; length2 >= 0; length2--) {\n vector.addElement(a[length2]);\n }\n }\n String[][] a2 = C5075dp.m3559a();\n if (a2 != null) {\n for (int length3 = a2.length - 1; length3 >= 0; length3--) {\n vector.addElement(a2[length3]);\n }\n }\n String[][] a3 = C5070dk.m3552a();\n if (a3 != null) {\n for (int length4 = a3.length - 1; length4 >= 0; length4--) {\n vector.addElement(a3[length4]);\n }\n }\n String[][] a4 = C5061db.m3525a();\n if (a4 != null) {\n for (int length5 = a4.length - 1; length5 >= 0; length5--) {\n vector.addElement(a4[length5]);\n }\n }\n String[][] o = C5034cb.m3377o();\n if (o != null) {\n for (int length6 = o.length - 1; length6 >= 0; length6--) {\n vector.addElement(o[length6]);\n }\n }\n String[][] a5 = C4984aq.m3190a();\n if (a5 != null) {\n for (int length7 = a5.length - 1; length7 >= 0; length7--) {\n vector.addElement(a5[length7]);\n }\n }\n String[][] a6 = m3426a();\n if (a6 != null) {\n for (int length8 = a6.length - 1; length8 >= 0; length8--) {\n vector.addElement(a6[length8]);\n }\n }\n String[][] strArr = (String[][]) Array.newInstance(String.class, new int[]{vector.size(), 4});\n if (strArr != null) {\n for (int length9 = strArr.length - 1; length9 >= 0; length9--) {\n strArr[length9] = (String[]) vector.elementAt(length9);\n }\n }\n return strArr;\n }", "public static int[][] init() {\n int[][] arr={\n {0,1,0,1,0,0,0},\n {0,0,1,0,0,1,0},\n {1,0,0,1,0,1,0},\n {0,0,1,0,0,1,0},\n {0,0,1,1,0,1,0},\n {1,0,0,0,0,0,0}\n };\n return arr;\n }", "public static void main(String[] args) {\n\t\tint[] w = { 1, 4, 3 };\n\t\tint[] val = { 1500, 3000, 2000 };\n\t\tint m = 4;\n\t\tint n = val.length;\n\t\tint[][] v = new int[n + 1][m + 1];\n\t\tint[][] path = new int[n + 1][m + 1];\n\t\tfor (int i = 0; i < v.length; i++) {\n\t\t\tv[i][0] = 0;\n\t\t}\n\t\tfor (int i = 0; i < v[0].length; i++) {\n\t\t\tv[0][i] = 0;\n\t\t}\n\t\tfor (int i = 0; i < v.length; i++) {\n\t\t\tfor (int j = 0; j < v[i].length; j++) {\n\t\t\t\tSystem.out.print(v[i][j] + \" \");\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t}\n\t\tfor (int i = 1; i < v.length; i++) {\n\t\t\tfor (int j = 1; j < v[i].length; j++) {\n\t\t\t\tif(w[i-1]>j) {\n\t\t\t\t\tv[i][j]=v[i-1][j];\n\t\t\t\t}else {\n\t\t\t\t\tif(v[i-1][j]<val[i-1]+v[i-1][j-w[i-1]]) {\n\t\t\t\t\t\tv[i][j]=val[i-1]+v[i-1][j-w[i-1]];\n\t\t\t\t\t\tpath[i][j]=1;\n\t\t\t\t\t}else {\n\t\t\t\t\t\tv[i][j]=v[i-1][j];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int[] i:v) {\n\t\t\tSystem.out.println(Arrays.toString(i));\n\t\t}\n\t}", "public static void main(String[] args) {\n\n for(int i=0; i<3;i++){\n // arr[i] = new Array1(i+3,i*2);\n //arr[0] = arr.getArray(3,5);\n\n }\n\n }", "public test.wsdl.marrays.Foo[][][] testFooArray(test.wsdl.marrays.Foo[][][] in) throws java.rmi.RemoteException {\n for (int i=0; i < in.length; i++) {\n Foo[][] array2 = in[i];\n if (array2 != null)\n for (int j=0; j < array2.length; j++) {\n Foo[] array3 = array2[j];\n if (array3 != null)\n for (int k=0; k <array3.length; k++) {\n if (array3[k].getValue() == i + 10*j + 100*k)\n array3[k].setValue(i + 10*j + 100*k + 1000);\n }\n }\n }\n return in;\n }", "@Test\n public void testCreateTranspose2(){\n double[][] a = new double[5][5];\n for(int i = 0 ; i < a.length ; i++){\n for(int j = 0 ; j < a[0].length ; j++){\n a[i][j] = Math.random();\n }\n }\n double[][] newA = HarderArrayProblems.createTranspose(a);\n checkTranspose(a, newA);\n }", "@Test\r\n\tpublic void testArrayPos(){\n\t\tfor(int y=0;y<5;y++){\r\n\t\t\tfor(int x=0;x<5;x++){\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private void makeArrays()\n\t{\n\t\tfor (String key : sub.keySet())\n\t\t\tsub.put(key, ((List<String>) sub.get(key)).toArray(s0));\n\t\tfor (String key : attrs.keySet())\n\t\t\tattrs.put(key, ((List<String>) attrs.get(key)).toArray(s0));\n\t\tfor (String key : defs.keySet())\n\t\t\tdefs.put(key, ((List<String>) defs.get(key)).toArray(s0));\n\t\tfor (String key : smodes.keySet())\n\t\t{\n\t\t\tList<Integer> list = (List<Integer>) smodes.get(key);\n\t\t\tint[] array = new int[list.size()];\n\t\t\tfor (int i = 0; i < list.size(); i++)\n\t\t\t\tarray[i] = list.get(i);\n\t\t\tsmodes.put(key, array);\n\t\t}\n\t\tfor (String key : amodes.keySet())\n\t\t{\n\t\t\tList<Integer> list = (List<Integer>) amodes.get(key);\n\t\t\tint[] array = new int[list.size()];\n\t\t\tfor (int i = 0; i < list.size(); i++)\n\t\t\t\tarray[i] = list.get(i);\n\t\t\tamodes.put(key, array);\n\t\t}\n\t}", "private int getSumD2(int[][] a) {\n int sum = 0;\n\n int jd1 = 0;\n int jd2 = a.length - 1;\n while (jd1 < a.length) {\n sum += a[jd1][jd2];\n jd2--;\n jd1++;\n }\n return sum;\n }", "Array createArray();", "@Test\n public void testCreateRowIndices1(){\n\n double[][] input = new double[4][3];\n int[][] myIndices = HarderArrayProblems.createRowIndices(input);\n assertEquals(0, myIndices.length);\n assertEquals(0, myIndices[0].length);\n }", "bgx mo11923a(bju bju, bhr bhr, int i, int[] iArr, biv biv, int i2, long j, boolean z, boolean z2);", "VectorArray getNeutHar();", "public abstract Case[][] generate();", "public static String [][] inMixColumnss(String s[][]) {\n String [][] ss=new String[4][4];\n for (int c = 0; c < 4; c++) {\n \n ss[0][c] =Integer.toHexString( (byte) (GMul(0x0E,Integer.parseInt(s[0][c], 16)) ^ GMul(0x0B, Integer.parseInt(s[1][c], 16)) ^ GMul(0x0D, Integer.parseInt(s[2][c], 16)) ^ GMul(0x09, Integer.parseInt(s[3][c], 16))) & 0xFF);\n ss[1][c] =Integer.toHexString( (byte) (GMul(0x09,Integer.parseInt(s[0][c], 16)) ^ GMul(0x0E, Integer.parseInt(s[1][c], 16)) ^ GMul(0x0B, Integer.parseInt(s[2][c], 16)) ^ GMul(0x0D, Integer.parseInt(s[3][c], 16))) & 0xFF);\n ss[2][c] =Integer.toHexString( (byte) (GMul(0x0D,Integer.parseInt(s[0][c], 16)) ^ GMul(0x09, Integer.parseInt(s[1][c], 16)) ^ GMul(0x0E, Integer.parseInt(s[2][c], 16)) ^ GMul(0x0B, Integer.parseInt(s[3][c], 16))) & 0xFF);\n ss[3][c] =Integer.toHexString( (byte) (GMul(0x0B,Integer.parseInt(s[0][c], 16)) ^ GMul(0x0D, Integer.parseInt(s[1][c], 16)) ^ GMul(0x09, Integer.parseInt(s[2][c], 16)) ^ GMul(0x0E, Integer.parseInt(s[3][c], 16))) & 0xFF);\n }\nreturn ss;\n}", "private static double [][] exe_helper (double [] rf) throws Exception {\r\n\t\r\n\t\tint p1 = rf.length; // [nf,p1]=size(rf);\r\n\t\tint p0 = p1-1;\r\n\t\tdouble [] rr = null;\r\n\t\tdouble [] ar = null;\r\n\t\t\r\n\t\tif (p0!=0)\r\n\t\t{\r\n\t\t\tdouble [] a = new double [] {rf[1]}; //a = rf(:,2); // array eith a single elemtne, at the moment\r\n\r\n\t\t\t// rr=[ones(nf,1) -a zeros(nf,p0-1)];\r\n\t\t\trr = new double[p0+1];\r\n\t\t\tArrays.fill(rr, 0.0);\r\n\t\t\trr[0] = 1;\r\n\t\t\trr[1] = -a[0];\r\n\r\n\t\t\t// e = (a.^2-1);\r\n\t\t\tdouble e = a[0]*a[0]-1;\r\n\r\n\t\t\tfor (int n = 2; n<=p0; n++) // for n = 2:p0\r\n\t\t\t{\r\n\t\t\t\tdouble k = rf[n]; // k=rf(:,n+1); // It s a column vector\r\n\r\n\t\t\t\t// rr(:,n+1) =k.*e - sum(rr(:,n:-1:2).*a,2);\r\n\t\t\t\trr[n] = k*e - MyMath.sum(MyMath.arrayTimes(MyMath.select(rr, n-1, 1, -1), a));\r\n\r\n\t\t\t\t// a = [a+k(:,ones(1,n-1)).*a(:,n-1:-1:1) k];\r\n\t\t\t\tdouble [] aa = new double[a.length +1];\r\n\t\t\t\tfor (int i=0; i<a.length; i++)\r\n\t\t\t\t\taa[i] = a[i] + k*a[n-2-i];\r\n\t\t\t\taa[aa.length-1] = k;\r\n\t\t\t\ta = aa;\r\n\r\n\t\t\t\t// e = e.*(1-k.^2);\r\n\t\t\t\te *= (1-k*k);\r\n\t\t\t}\r\n\t\t\t \r\n\t\t\t// ar = [ones(nf,1) a];\r\n\t\t\tar = new double [1+a.length];\r\n\t\t\tar[0] = 1;\r\n\t\t\tSystem.arraycopy(a, 0, ar, 1, a.length);\r\n\t\t\t\r\n\t\t\tdouble r0 = 1.0/MyMath.sum(MyMath.arrayTimes(rr, ar)); // r0=sum(rr.*ar,2).^(-1);\r\n\t\t\t\r\n\t\t\tMyMath.timesSelf(rr, r0); // rr=rr.*r0(:,ones(1,p1));\r\n\t\t\t\r\n\t\t\t// if nargin>1 && ~isempty(p)\r\n\t\t\t// if p<p0\r\n\t\t\t// rr(:,p+2:p1)=[];\r\n\t\t\t// else\r\n\t\t\t//\r\n\t\t\t// rr=[rr zeros(nf,p-p0)];\r\n\t\t\t// af=-ar(:,p1:-1:2);\r\n\t\t\t// for i=p0+1:p\r\n\t\t\t// rr(:,i+1)=sum(af.*rr(:,i-p0+1:i),2);\r\n\t\t\t// end\r\n\t\t\t// end\r\n\t\t\t// end\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\trr = new double [] {1.0}; // rr=ones(nf,1);\r\n\t\t\tar = new double [] {1.0}; // ar=rr;\r\n\t\t}\r\n\r\n\t\treturn new double [][] {rr, ar};\r\n\t}", "public static void main(String[] args) {\n\t\t\n\t\tint [][] numbers = {{2,3,4},{6,7,8}};\n\t\tSystem.out.println(Arrays.deepToString(numbers));\n\t\t//multidimensional arrays\n\n\t}", "public static void main(String[] args) {\n double [][]x;\r\n double []y;\r\n int N,M;\r\n Scanner inp = new Scanner(System.in);\r\n System.out.print(\"N=\"); N=inp.nextInt();\r\n System.out.print(\"M=\"); M=inp.nextInt();\r\n x=new double[N][M];\r\n for (int i=0; i<N; i++)\r\n for (int j=0; j<M; j++)\r\n {\r\n System.out.print(\"x(\"+i+\",\"+j+\")=\");\r\n x[i][j]=inp.nextDouble();\r\n }\r\n inp.close();\r\n\r\n\r\n int Ny=0;\r\n y=new double[N];\r\n for (int i=0; i<N; i+=2)\r\n {\r\n double P=1;\r\n for (int j=0; j<M; j++)\r\n if (x[i][j]%2==0)\r\n P*=x[i][j];\r\n\r\n if (P%2==0)\r\n {y[Ny]=P;\r\n Ny++;\r\n }\r\n\r\n\r\n }\r\n\r\n if (Ny==0)\r\n System.out.println(\"Нет элементов.\");\r\n System.out.println(\"Исходная матрица:\");\r\n for (int i=0; i<N; i++) {\r\n for (int j=0; j<M; j++)\r\n System.out.printf(\"%7.2f\", x[i][j]);\r\n System.out.println();\r\n }\r\n\r\n System.out.println(\"Сформированный массив:\");\r\n for (int i=0; i<Ny; i++)\r\n System.out.println(\"y(\"+i+\")=\"+y[i]);\r\n\r\n }", "private Sign[] flattenBoard(){\r\n Sign[] flatBoard = new Sign[10]; // an array to save the board as one dimensional array\r\n int count = 1; //counter to help the transition from matrix to array\r\n\r\n /* transfer the matrix to array */\r\n for (int i=0;i<3;i++)\r\n for (int j=0;j<3;j++)\r\n flatBoard[count++] = board[i][j];\r\n\r\n return flatBoard;\r\n }", "public static void main(String[] args) {\n\n pairsSum();\n\n printAllSubArrays();\n\n tripletZero();\n\n // int[][] sub = subsets();\n\n PairsSum sum = new PairsSum();\n int[] arr = { 10, 1, 2, 3, 4, 5, 6, 1 };\n boolean flag = sum.almostIncreasingSequence(arr);\n System.out.println(flag);\n\n String s = \"\";\n for (int i = 0; i < 100000; i++) {\n // s += \"CodefightsIsAwesome\";\n }\n long start = System.currentTimeMillis();\n // int k = subStr(s, \"IsA\");\n System.out.println(System.currentTimeMillis() - start);\n // System.out.println(k);\n\n String[] a = { \"aba\", \"aa\", \"ad\", \"vcd\", \"aba\" };\n String[] b = sum.allLongestStrings(a);\n System.out.println(Arrays.deepToString(b));\n\n List<String> al = new ArrayList<>();\n al.toArray();\n\n Map<Integer, Integer> map = new HashMap<>();\n Set<Integer> keySet = map.keySet();\n for (Integer integer : keySet) {\n\n }\n\n String st = reverseBracksStack(\"a(bc(de)f)g\");\n System.out.println(st);\n\n int[] A = { 1, 2, 3, 2, 2, 3, 3, 33 };\n int[] B = { 1, 2, 2, 2, 2, 3, 2, 33 };\n\n System.out.println(sum.isIPv4Address(\"2.2.34\"));\n\n Integer[] AR = { 5, 3, 6, 7, 9 };\n int h = sum.avoidObstacles(AR);\n System.out.println(h);\n\n int[][] image = { { 36, 0, 18, 9 }, { 27, 54, 9, 0 }, { 81, 63, 72, 45 } };\n int[][] im = { { 7, 4, 0, 1 }, { 5, 6, 2, 2 }, { 6, 10, 7, 8 }, { 1, 4, 2, 0 } };\n int[][] res = sum.boxBlur(im);\n\n for (int i = 0; i < res.length; i++) {\n for (int j = 0; j < res[0].length; j++) {\n System.out.print(res[i][j] + \" \");\n }\n System.out.println();\n }\n\n boolean[][] ms = { { true, false, false, true }, { false, false, true, false }, { true, true, false, true } };\n int[][] mines = sum.minesweeper(ms);\n for (int i = 0; i < mines.length; i++) {\n for (int j = 0; j < mines[0].length; j++) {\n System.out.print(mines[i][j] + \" \");\n }\n System.out.println();\n }\n\n System.out.println(sum.variableName(\"var_1__Int\"));\n\n System.out.println(sum.chessBoard());\n\n System.out.println(sum.depositProfit(100, 20, 170));\n\n String[] inputArray = { \"abc\", \"abx\", \"axx\", \"abx\", \"abc\" };\n System.out.println(sum.stringsRearrangement(inputArray));\n\n int[][] queens = { { 1, 1 }, { 3, 2 } };\n int[][] queries = { { 1, 1 }, { 0, 3 }, { 0, 4 }, { 3, 4 }, { 2, 0 }, { 4, 3 }, { 4, 0 } };\n boolean[] r = sum.queensUnderAttack(5, queens, queries);\n\n }", "private static BigInteger[][] multiply (BigInteger a[][], BigInteger b[][])\n {\n BigInteger x = (a[0][0].multiply(b[0][0])).add(a[0][1].multiply(b[1][0]));\n BigInteger y = (a[0][0].multiply(b[0][1])).add(a[0][1].multiply(b[1][1]));\n BigInteger z = (a[1][0].multiply(b[0][0])).add(a[1][1].multiply(b[1][0]));\n BigInteger w = (a[1][0].multiply(b[0][1])).add(a[1][1].multiply(b[1][1]));\n \n return new BigInteger[][]{{x, y},{z, w}};\n }", "public static void main(String[] args) {\n\t\t\r\n\t\tint[][] arr=new int[][]{{21,22},{32,25},{25,58}};\r\nfor (int i = 0; i < arr.length; i++) {\r\n\tfor (int j = 0; j < 2; j++) {\r\n\t\tSystem.out.println(arr[i][j]+\" \");\r\n\t\t\r\n\t}\r\n\tSystem.out.println(\" \");\r\n\t\r\n}\r\n//int[][][] arr2=new int[][][] {{{10,12},{30}},{{30,15},{80}}};\r\n//for (int i = 0; i < arr2.length; i++) {\r\n//\tfor (int j = 0; j < 2; j++) {\r\n//\t\tfor (int j2 = 0; j2 < 3; j2++) {\r\n//\t\t\tSystem.out.println(arr2[i][j][j2]+\" \");\r\n//\t\t\t\r\n//\t\t}\r\n//\t\tSystem.out.println(\" \");\r\n//\t\t\r\n//\t}\r\n//\t\r\n//}\r\n\t}", "private static int[][] AddToArr(int[][] arr, int[][] symbol, int length, int offset) {\n\r\n\t\tfor (int i = 0; i < 5; i++) {\r\n\t\t\tfor (int j = 0; j < length; j++) {\r\n\t\t\t\tif (symbol[i][j] > 0) {\r\n\r\n\t\t\t\t\tarr[i][j + offset] = 1;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn arr;\r\n\t}", "public static int[][][] packWU(int n, int[] from, int[] to, int[] w) {\n int[][][] g = new int[n][][];\n int[] p = new int[n];\n for (int f : from) {\n p[f]++;\n }\n for (int t : to) {\n p[t]++;\n }\n for (int i = 0; i < n; i++) {\n g[i] = new int[p[i]][2];\n }\n for (int i = 0; i < from.length; i++) {\n --p[from[i]];\n g[from[i]][p[from[i]]][0] = to[i];\n g[from[i]][p[from[i]]][1] = w[i];\n --p[to[i]];\n g[to[i]][p[to[i]]][0] = from[i];\n g[to[i]][p[to[i]]][1] = w[i];\n }\n return g;\n }", "public static void main(String[] args) {\n\t\tint array0[] = new int[0];\r\n\t\tint array3[] = new int[3];\r\n\t\tint array5[] = new int[5];\r\n\t\tint array15[] = new int[15];\r\n\t\tint array16[] = new int[16];\r\n\t\tint array17[] = new int[17];\r\n\t\tint array19[] = new int[19];\r\n\t\tint array20[] = new int[20];\r\n\t\tint array200[] = new int[200];\r\n\t\tint array1000[] = new int[1000];\r\n\r\n\t\t// iX => integer with value X\r\n\t\tint i0 = 0;\r\n\t\tint i20 = 20;\r\n\t\tint i1 = 1;\r\n\t\tint i2 = 2;\r\n\t\tint i3 = 3;\r\n\t\tint i4 = 4;\r\n\t\tint i_5 = -5;\r\n\t\tint p = i2 * i_5; // p is [-10,-10]\r\n\r\n\t\tarray0[0] = 5; // Illegal upper bound\r\n\r\n\t\tarray0[1] = 5; // Illegal upper bound\r\n\r\n\t\tarray5[p] = 5; // Illegal lower bound\r\n\r\n\t\tp = 2 * i2; // p is [4,4]\r\n\r\n\t\tarray5[p] = 5; // Good\r\n\r\n\t\tp *= p; // p is [16,16]\r\n\r\n\t\tarray16[p] = 5; // Illegal upper bound (legal index range is 0-15)\r\n\r\n\t\tarray17[p] = 5; // Good\r\n\r\n\t\tp = i2 * i3; // p is [6,6]\r\n\r\n\t\tboolean b = args.length == 0;\r\n\r\n\t\tif (b) {\r\n\t\t\tp = p * i3; // p is [18,18]\r\n\t\t}\r\n\r\n\t\t// now p is [6,18]\r\n\r\n\t\tarray17[p] = 5; // Potentially illegal upper bound\r\n\t\tarray19[p] = 5; // Good\r\n\r\n\t\tp = 2; // p is [2,2]\r\n\r\n\t\tfor (int i = 0; i < 5; i++) {\r\n\t\t\tp *= 2;\r\n\t\t}\r\n\r\n\t\t// now p is [2,INF]\r\n\r\n\t\tarray19[p] = 5; // Potentially illegal upper bound // TODO problem\r\n\r\n\t\tp = p - 4; // p is [-2,INF]\r\n\r\n\t\tarray1000[p] = 5; // Potentially illegal lower and upper bounds\r\n\r\n\t\tp = 2; // p is [2,2]\r\n\r\n\t\tfor (int i = 0; i < 5; i++) {\r\n\t\t\tarray3[i] = 5; // Potentially illegal upper bound\r\n\t\t\tarray16[i] = 5; // Good\r\n\t\t\tp *= -2;\r\n\t\t}\r\n\r\n\t\tint i = 5, j = 10;\r\n\r\n\t\tif (b) {\r\n\t\t\ti = 15;\r\n\t\t\tj = 20;\r\n\t\t}\r\n\r\n\t\t// now i is [5,15], j is [10,20]\r\n\r\n\t\tif (i != j) {\r\n\t\t\tarray16[j] = 5; // Potentially illegal upper bound\r\n\t\t} else {\r\n\t\t\tarray16[j] = 5; // Good\r\n\t\t}\r\n\r\n\t\t// p is [-INF,INF]\r\n\r\n\t\tarray1000[p] = 5; // Potentially illegal lower and upper bounds\r\n\r\n\t}", "public void displayData(int[][] arr);", "private int mcHelper(int[][] arr, int[][] g, int i, int j) {\n int mcsum = 0;\n for (int k = 0; k < 4; k++) {\n int a = g[i][k] ^ 0x42;\n int b = arr[k][j];\n mcsum ^= mcCalc(a, b);\n }\n return mcsum;\n }", "private static int[] square(int[] w, int[] x)\n {\n // Note: this method allows w to be only (2 * x.Length - 1) words if result will fit\n// if (w.length != 2 * x.length)\n// {\n// throw new IllegalArgumentException(\"no I don't think so...\");\n// }\n\n long c;\n\n int wBase = w.length - 1;\n\n for (int i = x.length - 1; i != 0; --i)\n {\n long v = x[i] & IMASK;\n\n c = v * v + (w[wBase] & IMASK);\n w[wBase] = (int)c;\n c >>>= 32;\n\n for (int j = i - 1; j >= 0; --j)\n {\n long prod = v * (x[j] & IMASK);\n\n c += (w[--wBase] & IMASK) + ((prod << 1) & IMASK);\n w[wBase] = (int)c;\n c = (c >>> 32) + (prod >>> 31);\n }\n\n c += w[--wBase] & IMASK;\n w[wBase] = (int)c;\n\n if (--wBase >= 0)\n {\n w[wBase] = (int)(c >> 32);\n }\n wBase += i;\n }\n\n c = x[0] & IMASK;\n\n c = c * c + (w[wBase] & IMASK);\n w[wBase] = (int)c;\n\n if (--wBase >= 0)\n {\n w[wBase] += (int)(c >> 32);\n }\n\n return w;\n }", "public static void main(String[] args) {\n\t\t\n\t int a, b;\n\t int arr[] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 };\n\t int range[][]={{3,7}, {4,6}, {5,5}};\n\n\t for (int i = 0; i < range.length; i++){\n\t \t\n\t \ta = range[i][0];\n\t \tb = range[i][1];\n\n\t\t\tfor(int j = 0; j < (b-a)/2; j++){\n\t\t\t\tint temp = arr[a-1+j];\n\t\t\t\tarr[a-1+j] =arr[b-1-j]; \n\t\t\t\tarr[b-1-j] = temp;\n\t\t\t}\n\t }\n\n\t\tSystem.out.print (\"결과 : \"+\"[ \");\n\t\t\n\t\tfor(int i=0; i<arr.length ; i++ ) {\n\t\t\tSystem.out.print (arr[i] + \" \" );\n\n\t\t}\n\t\tSystem.out.print (\"]\");\n\t}", "public static int[][] meDian(int[][] pixels){\r\n\t\t\t\r\n\t\t\tArrayList<Integer> a = new ArrayList<>();\r\n\t\t\tint[][] temp = new int[3][3];\r\n\t\t int height = pixels.length;\r\n\t\t int width = pixels[0].length;\r\n\t\t\t\r\n\t\t\tfor(int col = 0; col < pixels.length; col++){\r\n\t\t\t\tmResult[0][col] = pixels[0][col];\r\n\t\t\t\tmResult[width -1][col] = pixels[width - 1][col];\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tfor (int row = 0 ; row < pixels.length ; row++) {\r\n\t\t mResult[row][0] = pixels[0][row];\r\n\t\t mResult[row][height - 1] = pixels[row][height - 1];\r\n\t\t }\r\n\t\t\t\r\n\t\t\tfor (int row = 1 ; row < height - 1 ; row++) {\r\n\t\t for (int col = 1 ; col < width - 1 ; col++) {\r\n\t\t \tfor(int i = -1; i <= 1; i++){\r\n\t\t \t\tfor(int j = -1; j <= 1; j++){\r\n\t\t \t\t\ta.add(pixels[row+i][col+j]);\r\n\t\t \t\t}\r\n\t\t \t}\r\n\t\t \tCollections.sort(a);\r\n \t\tmResult[row][col] = a.get(4);\r\n \t\ta.clear();\r\n\t\t }\r\n\t\t}\r\n\t\t\treturn mResult;\r\n\t}", "public static int[][] hgAlgorithm(double[][] array, String sumType) {\r\n\t\tdouble[][] cost = copyOf(array); // Create the cost matrix\r\n\r\n\t\tif (sumType.equalsIgnoreCase(\"max\")) // Then array is weight array. Must\r\n\t\t\t\t\t\t\t\t\t\t\t\t// change to cost.\r\n\t\t{\r\n\t\t\tdouble maxWeight = findLargest(cost);\r\n\t\t\tfor (int i = 0; i < cost.length; i++) // Generate cost by\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t// subtracting.\r\n\t\t\t{\r\n\t\t\t\tfor (int j = 0; j < cost[i].length; j++) {\r\n\t\t\t\t\tcost[i][j] = (maxWeight - cost[i][j]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tdouble maxCost = findLargest(cost); // Find largest cost matrix element\r\n\t\t\t\t\t\t\t\t\t\t\t// (needed for step 6).\r\n\r\n\t\tint[][] mask = new int[cost.length][cost[0].length]; // The mask array.\r\n\t\tint[] rowCover = new int[cost.length]; // The row covering vector.\r\n\t\tint[] colCover = new int[cost[0].length]; // The column covering vector.\r\n\t\tint[] zero_RC = new int[2]; // Position of last zero from Step 4.\r\n\t\tint step = 1;\r\n\t\tboolean done = false;\r\n\t\twhile (done == false) // main execution loop\r\n\t\t{\r\n\t\t\tswitch (step) {\r\n\t\t\tcase 1:\r\n\t\t\t\tstep = hg_step1(step, cost);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 2:\r\n\t\t\t\tstep = hg_step2(step, cost, mask, rowCover, colCover);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 3:\r\n\t\t\t\tstep = hg_step3(step, mask, colCover);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 4:\r\n\t\t\t\tstep = hg_step4(step, cost, mask, rowCover, colCover, zero_RC);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 5:\r\n\t\t\t\tstep = hg_step5(step, mask, rowCover, colCover, zero_RC);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 6:\r\n\t\t\t\tstep = hg_step6(step, cost, rowCover, colCover, maxCost);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 7:\r\n\t\t\t\tdone = true;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}// end while\r\n\r\n\t\tint[][] assignment = new int[array.length][2]; // Create the returned\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// array.\r\n\t\tfor (int i = 0; i < mask.length; i++) {\r\n\t\t\tfor (int j = 0; j < mask[i].length; j++) {\r\n\t\t\t\tif (mask[i][j] == 1) {\r\n\t\t\t\t\tassignment[i][0] = i;\r\n\t\t\t\t\tassignment[i][1] = j;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// If you want to return the min or max sum, in your own main method\r\n\t\t// instead of the assignment array, then use the following code:\r\n\t\t/*\r\n\t\t * double sum = 0; for (int i=0; i<assignment.length; i++) { sum = sum +\r\n\t\t * array[assignment[i][0]][assignment[i][1]]; } return sum;\r\n\t\t */\r\n\t\t// Of course you must also change the header of the method to:\r\n\t\t// public static double hgAlgorithm (double[][] array, String sumType)\r\n\r\n\t\treturn assignment;\r\n\t}", "void show(double[][][] arr,String name){\n \n System.out.println(name+\"Array\");\n Vector Size = new Vector(arr.length,arr[0].length,arr[0][0].length);\n \n for(int i=0;i<Size.x;i++){\n \n for(int j=0;j<Size.y;j++){\n \n for(int k=0;k<Size.z;k++){\n \n System.out.print(arr[i][j][k]+\" \");\n }\n System.out.println();\n }\n System.out.println();\n }\n\n}", "public static void main(String[] args) {\n\t\tint ma[][] = new int[3][2];\n\t\t//how to print multi-dimentional array\n\t\tSystem.out.println(Arrays.deepToString(ma)); //[ [0, 0], [0, 0], [0, 0] ]\n\t\t\n\t\t//how to assing values to the elements\n\t\tma[0][1] = 2;\n\t\tSystem.out.println(Arrays.deepToString(ma)); //[ [0, 2], [0, 0], [0, 0] ]\n\t\t\n\t\tma[2][0] = 5;\n\t\tSystem.out.println(Arrays.deepToString(ma)); //[ [0, 2], [0, 0], [5, 0] ]\n\t\t\n\t\tma[0][0] = 1;\n\t\tSystem.out.println(Arrays.deepToString(ma)); //[ [1, 2], [0, 0], [5, 0] ]\n\t\t\n\t\tma[1][0] = 3;\n\t\tSystem.out.println(Arrays.deepToString(ma)); //[ [1, 2], [3, 0], [5, 0] ]\n\t\t\n\t\tma[1][1] = 4;\n\t\tSystem.out.println(Arrays.deepToString(ma)); //[ [1, 2], [3, 4], [5, 0] ]\n\t\t\n\t\tma[2][1] = 6;\n\t\tSystem.out.println(Arrays.deepToString(ma)); //[ [1, 2], [3, 0], [5, 6] ]\n\t\t\n\t\tint maa[][] = { {1}, {3, 4}, {5, 6, 7} };\n\t\tSystem.out.println(Arrays.deepToString(maa));\n\t\t\n\t\t//how to print a specific inner arrays on the console\n\t\tSystem.out.println(Arrays.toString(maa[1])); //[3,4]\n\t\t\n\t\t// how to print a specific element in a multidimentioanl array\n\t\tSystem.out.println(maa[2][1]); // 6\n\t\t\n\t\t// How to print all elements one by one on the console in the same line with aa \"*\" at the beginning \n\t\t//of very elemnt\n\t\t\n\t\tfor(int i=0; i<maa.length; i++) {\n\t\t\t\n\t\t\tfor (int k=0; k<maa[i].length; k++) {\n\t\t\t\tSystem.out.print(\"*\" + maa[i][k]); //*1*3*4*5*6*7\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println();\n\t\t\n\t\t//How to find the product of all elements in the array \"maa\"\n\n\t\tint product = 1; // for addition begin with 1\n\t\tfor(int i=0; i<maa.length; i++) {\n\t\t\tfor(int k=0; k<maa[i].length; k++) {\n\t\t\t\tproduct = product * maa[i][k];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"The product of all elements: \" + product); //The product of all elements: 2520\n\t\t\n\t\t// How to find the sum of all elements (Homework)\n\t\t\n\t\tint sum = 0; // for sum begin with 0\n\t\tfor(int i=0; i<maa.length; i++) {\n\t\t\tfor(int k=0; k<maa[i].length; k++) {\n\t\t\t\tsum = sum + maa[i][k];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"The sum of all elements: \" + sum); //The sum of all elements: 26\n\t\t\n\n\t\t//yeni bi array yaz otomatik\n\t\tint count=1;\n\t\t\tfor(int i=0;i<3;i++) {\n\t\t\tfor(int k=0;k<2;k++) {\n\t\t\t\tma[i][k]=count;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(Arrays.deepToString(ma)); //[[1, 2], [3, 4], [5, 6]]\n\t\n\t\t \n\t}", "public static void playWithPrimitiveArray() {\n //int a1, a2, a3, a4, a5, a6;\n //o sat nhau nhung khong duoc goi la mang\n int a[] = {1, 3, 5, 7, 9, 2, 6, 1000, 2000};\n //co 7 bien int da dc khai bao, o sat nhau, cung chung ten la a\n //khai bao cung 1 luc\n // ko chi ra kci hthuoc luc khai bao, khac voi C day\n int[] b = {1, 3, 5, 7, 9, 2, 6, 1000, 2000};\n //in mang\n System.out.println(\"The array has (by using for i): \");\n //In toan bo mang thoe phong cach for each\n for (int i : a) //voi moi i thuoc vao cac gia tri trong a[]\n {\n System.out.print(i + \" \");\n }\n System.out.println(\"\");\n for (int i = 0; i < b.length; i++) {\n System.out.print(b[i] + \" \");\n }\n //tinh tong trong b[]\n int sum = 0;\n for (int i : b) {\n sum += i;\n }\n System.out.println(\"Sum: \" + sum);\n //it xai mang kieu khai bao o tren, vi thuong chua biet truoc value bo vao mang\n //gs ta can luu luong mua trong nam, so biet duoc luong mua cac ngay con lai do chua dien ra\n //the nen se xai cach khai bao sau: khai bao mang truoc, gan value sau\n //gan value sau bang toan hoac Scanner\n int[] c = new int[10]; //xin 10 bien int nhen, cung ten la c\n //nho ngoac vuong la xin so bien , hem phai pheu~ de do, pheu phai (do value vao)\n //nho la mang primitive, nen moi bien[] la bien primitive, chua truc tiep value\n c[0] = 1;\n c[1] = 12;\n c[2] = 2204;\n c[7] = 7508;\n for (int i : c) {\n System.out.print(i + \" \");\n }\n System.out.println(\"\");\n //default bien trong mang khong duoc gan gia tri co gia tri mac dinh la 0.\n //cach khai bao mang a, b la new int[] ngam (implicit)\n //cach khai bao mang c goi la khai bao tuong minh (explicit) \n }", "int compteMonstres(Soldat unites[][]);", "public static void main(String[] args) {\n int twoD[][] = new int [4][];\r\n twoD[0] = new int[1];\r\n twoD[1] = new int[2];\r\n twoD[2] = new int[3];\r\n twoD[3] = new int[4];\r\n System.out.println(\"2차원 배열에서 형의길이는\" + twoD.length);\r\n System.out.println(\"첫 번쨰 형의 요소 수는\" + twoD[0].length);\r\n System.out.println(\"첫 번쨰 형의 요소 수는\" + twoD[1].length);\r\n System.out.println(\"첫 번쨰 형의 요소 수는\" + twoD[2].length);\r\n System.out.println(\"첫 번쨰 형의 요소 수는\" + twoD[3].length);\r\n \r\n int i,j,k = 0;\r\n for( i=0; i < twoD.length; i++ )\r\n \tfor(j=0; j< twoD[0].length; j ++)\r\n \t{\r\n \t\ttwoD[i][j] = k;\r\n \t\tk++;\r\n \t\t}\r\n for(i=0; i < twoD.length; i++ )\r\n {\r\n \tfor(j=0; j < twoD[i].length; j++)\r\n \t\tSystem.out.println(twoD[i][j] + \" \");\r\n \tSystem.out.println();\r\n }\r\n\t}", "public static void main(String[] args) {\n\t\tint[] arr= {6,9,5,7,4};\r\n\t\t//int[] arr= {3,9,9,3,5,7,2};\r\n\t\t//int[] arr= {1,5,3,6,7,6,5};\r\n\t\tint[] tmp=solution(arr);\r\n\t\tfor(int i=0;i<tmp.length;i++)\r\n\t\t\tSystem.out.print(tmp[i]+\" \");\r\n\t}", "public void constructArray(){\n\t\tfor (int col = 0; col < cols; col++){\n\t\t\tfor (int row = 0; row < rows; row++){\n\t\t\t\tmap[col][row] = new Pixel();\n\t\t\t}\n\t\t}\n\t}", "private MrnWoatlas5[] doGet(Vector result) {\n if (dbg) System.out.println (\"vector size = \" + result.size());\n int latitudeCol = db.getColNumber(LATITUDE);\n int longitudeCol = db.getColNumber(LONGITUDE);\n int depthCol = db.getColNumber(DEPTH);\n int temperatureMinCol = db.getColNumber(TEMPERATURE_MIN);\n int temperatureMaxCol = db.getColNumber(TEMPERATURE_MAX);\n int salinityMinCol = db.getColNumber(SALINITY_MIN);\n int salinityMaxCol = db.getColNumber(SALINITY_MAX);\n int oxygenMinCol = db.getColNumber(OXYGEN_MIN);\n int oxygenMaxCol = db.getColNumber(OXYGEN_MAX);\n int nitrateMinCol = db.getColNumber(NITRATE_MIN);\n int nitrateMaxCol = db.getColNumber(NITRATE_MAX);\n int phosphateMinCol = db.getColNumber(PHOSPHATE_MIN);\n int phosphateMaxCol = db.getColNumber(PHOSPHATE_MAX);\n int silicateMinCol = db.getColNumber(SILICATE_MIN);\n int silicateMaxCol = db.getColNumber(SILICATE_MAX);\n int chlorophyllMinCol = db.getColNumber(CHLOROPHYLL_MIN);\n int chlorophyllMaxCol = db.getColNumber(CHLOROPHYLL_MAX);\n MrnWoatlas5[] cArray = new MrnWoatlas5[result.size()];\n for (int i = 0; i < result.size(); i++) {\n Vector row = (Vector) result.elementAt(i);\n cArray[i] = new MrnWoatlas5();\n if (latitudeCol != -1)\n cArray[i].setLatitude ((String) row.elementAt(latitudeCol));\n if (longitudeCol != -1)\n cArray[i].setLongitude ((String) row.elementAt(longitudeCol));\n if (depthCol != -1)\n cArray[i].setDepth ((String) row.elementAt(depthCol));\n if (temperatureMinCol != -1)\n cArray[i].setTemperatureMin((String) row.elementAt(temperatureMinCol));\n if (temperatureMaxCol != -1)\n cArray[i].setTemperatureMax((String) row.elementAt(temperatureMaxCol));\n if (salinityMinCol != -1)\n cArray[i].setSalinityMin ((String) row.elementAt(salinityMinCol));\n if (salinityMaxCol != -1)\n cArray[i].setSalinityMax ((String) row.elementAt(salinityMaxCol));\n if (oxygenMinCol != -1)\n cArray[i].setOxygenMin ((String) row.elementAt(oxygenMinCol));\n if (oxygenMaxCol != -1)\n cArray[i].setOxygenMax ((String) row.elementAt(oxygenMaxCol));\n if (nitrateMinCol != -1)\n cArray[i].setNitrateMin ((String) row.elementAt(nitrateMinCol));\n if (nitrateMaxCol != -1)\n cArray[i].setNitrateMax ((String) row.elementAt(nitrateMaxCol));\n if (phosphateMinCol != -1)\n cArray[i].setPhosphateMin ((String) row.elementAt(phosphateMinCol));\n if (phosphateMaxCol != -1)\n cArray[i].setPhosphateMax ((String) row.elementAt(phosphateMaxCol));\n if (silicateMinCol != -1)\n cArray[i].setSilicateMin ((String) row.elementAt(silicateMinCol));\n if (silicateMaxCol != -1)\n cArray[i].setSilicateMax ((String) row.elementAt(silicateMaxCol));\n if (chlorophyllMinCol != -1)\n cArray[i].setChlorophyllMin((String) row.elementAt(chlorophyllMinCol));\n if (chlorophyllMaxCol != -1)\n cArray[i].setChlorophyllMax((String) row.elementAt(chlorophyllMaxCol));\n } // for i\n return cArray;\n }", "public static void main(String[] args) {\n\r\n\t\tint a[][] = new int[2][3];\r\n\r\n\t\ta[0][0] = 2;\r\n\t\ta[0][1] = 4;\r\n\t\ta[0][2] = 5;\r\n\t\ta[1][0] = 3;\r\n\t\ta[1][1] = 4;\r\n\t\ta[1][2] = 7;\r\n\r\n\t\t// int b[][]= {{2,4,5},{3,4,7}}.....; you can declare Multidimesion as well\r\n\r\n\t\t// System.out.println(a[1][0]);\r\n\r\n\t\tfor (int i = 0; i < 2; i++)\r\n\r\n\t\t{\r\n for(int j=0; j<3;j++)\r\n {\r\n \t System.out.println(a[i][j]+ \"\");\r\n }\r\n\t\t} \r\n\r\n\t}", "int[][][] generateChecker(int size);", "void mo12207a(int[] iArr);", "public static void main(String[] args) {\n\t\t\n\t\tint[] arr1D = {1,2,3};\n\t\t\n\t//\t2 dimensional array: array that contains multiple 1 dimensional arrays\n\t\t\n\t\tint[][] arr2D = { {1,2,3} , {4,5,6} };\n\t\t\n\t\t\n\t\tString[] arr = {\"A\" ,\"B\"};\n\t\t\n\t\t//\t\t\t\t\t\t 0 1 0 1 2\n\t\tString[][] str2D = { {\"A\" ,\"B\"} , {\"C\" ,\"D\",\"E\"} };\n\t\t//\t\t\t\t\t\t\t 0 1\n\t\t\n// [represents the index number of 1 dimensional arrays ][ represents the index number of the values]\n\t\t\n\t\t\t\t// print A:\n\t\t\t\tSystem.out.println( str2D[0][0] );\n\t\t\t\t\n\t\t\t\t// print D:\n\t\t\t\tSystem.out.println( str2D[1][1] );\n\t\t\t\t\n\t\t\t\t//print E:\n\t\t\t\tSystem.out.println(str2D[1][2]);\n\t\t\n\t\t\t\t// print [A ,B]:\n\t\t\t\tSystem.out.println( str2D[0] );\n\t\t\t\tSystem.out.println( Arrays.toString( str2D[0] ) );\n\t\t\t\t\n\t\t\t\t// print [C, D, E]:\n\t\t\t\tSystem.out.println( str2D[1] );\n\t\t\t\tSystem.out.println( Arrays.toString( str2D[1] ));\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t//print [[A,B], [C, D, E]]\n\t\t\t\tSystem.out.println( Arrays.toString(str2D) );\n\t\t\t\tSystem.out.println( Arrays.deepToString( str2D ) );\n\t\n\t\t\t// Arrays.deepToString(variableName ): converts multi-Dimensional Arrays to STring value\n\t\t\t\n\t\t\t\t\n\t\t\t// \t 0 1 0 1 0 1 \n\t\t\tint[][] Numbers2D = {\t{1,2} , {3, 4} , {5, 6, 7, 8, 9 , 10} };\n\t\t\t//\t\t\t\t\t 0 1 2\n\t\t\t\t\n\t\t\t\t// print 6:\n\t\t\tSystem.out.println( Numbers2D[2][1] );\n\t\t\t\n\t\t\t\t// print 10:\n\t\t\tSystem.out.println( Numbers2D[2][5] );\n\t\t\t\n\t\t\t\t// print {5, 6, 7, 8, 9 , 10}:\n\t\t\tSystem.out.println( Numbers2D[2] );\n\t\t\tSystem.out.println( Arrays.toString( Numbers2D[2] ) );\n\t\t\t\n\t\t\t\t// print the entire 2D array:\n\t\t\tSystem.out.println(Arrays.deepToString( Numbers2D ));\n\t\t\t\t\n\t\t\t\t\n\t\t// 3 dimensional array contains multiple 2 dimensional arrays\n\t\tint[][] Array2D = { {1,2}, {3,4} };\n\t\t//\t\t\t\t\t\t\t 0 1 0 1\n\t\tint[][][] Array3D = { { {1,2}, {3,4} } , { {5, 6}, {7, 8} } };\n// 0 1\t\n//[index numbers of 2D array][ index number of 1D array] [ index number of value]\n\n\t\t\t//print 8:\n\t\tSystem.out.println(Array3D[1][1][1]);\n\t\t\n\t\t// print {5, 6}:\n\t\tSystem.out.println( Array3D[1][0] );\n\t\tSystem.out.println( Arrays.toString( Array3D[1][0] ) );\n\t\t\n\t\t// print { {5, 6}, {7, 8} }:\n\t\tSystem.out.println( Array3D[1] );\n\t\tSystem.out.println( Arrays.toString( Array3D[1] ) );\n\t\tSystem.out.println( Arrays.deepToString( Array3D[1] ));\n\t\t\n\t\t\n\t\t// print the entire 3d array:\n\t\t\tSystem.out.println(Arrays.deepToString( Array3D ));\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\tint[][][] numbers3D = { { {1,2} } , { {3,4} } };\t\n\t\t\n\t\t\n\t\t\n\t//\t4 dimensional array contains multiple 3 dimensional arrays\n\tint[][][][] numbers4D = { { { {1,2} } , { {3,4} } } , { { {1,2} } , { {3,4} } } };\t\n\t\n\t\n\t\n\t\n\t\t\n\t}", "private static long[][] generatePerfectSquares() {\n ArrayList<Long> a = new ArrayList<>(10000);\n ArrayList<Long> b = new ArrayList<>(10000);\n\n for (long i = 1; i < 1000000; i += 2) {\n long sqr = i * i;\n if ((i + 1) % 4 == 0) {\n a.add(sqr);\n }\n\n if ((i + 1) % 3 == 0) {\n b.add(sqr);\n }\n }\n\n long[][] res = new long[2][];\n res[0] = new long[a.size()];\n res[1] = new long[b.size()];\n\n for (int i = 0; i < a.size(); i++) {\n res[0][i] = a.get(i);\n }\n\n for (int i = 0; i < b.size(); i++) {\n res[1][i] = b.get(i);\n }\n\n return res;\n }", "public static void main(String[] arg) {\r\n \r\n int[][] filledSudoku = { \r\n { 11, 2, 5, 7, 4, 10, 9, 15, 6, 14, 0, 1, 12, 3, 8, 13 },\r\n { 14, 4, 0, 9, 11, 8, 2, 12, 13, 5, 3, 10, 15, 1, 7, 6 },\r\n { 1, 10, 15, 12, 6, 13, 7, 3, 4, 9, 8, 2, 11, 5, 14, 0 },\r\n { 13, 8, 6, 3, 5, 14, 1, 0, 11, 7, 15, 12, 10, 9, 4, 2 },\r\n { 0, 7, 14, 2, 8, 11, 4, 9, 1, 6, 10, 5, 13, 12, 3, 15 },\r\n { 3, 5, 9, 1, 10, 12, 14, 7, 2, 4, 13, 15, 8, 0, 6, 11 },\r\n { 12, 15, 10, 13, 2, 1, 3, 6, 8, 11, 14, 0, 7, 4, 5, 9 },\r\n { 6, 11, 8, 4, 0, 15, 5, 13, 7, 12, 9, 3, 14, 2, 10, 1 },\r\n { 2, 14, 1, 15, 3, 7, 11, 4, 5, 10, 6, 9, 0, 13, 12, 8 },\r\n { 7, 6, 12, 8, 9, 2, 10, 5, 0, 13, 1, 11, 4, 14, 15, 3 },\r\n { 4, 9, 3, 5, 14, 0, 13, 8, 15, 2, 12, 7, 6, 11, 1, 10 },\r\n { 10, 13, 11, 0, 15, 6, 12, 1, 3, 8, 4, 14, 9, 7, 2, 5 },\r\n { 9, 1, 2, 14, 7, 4, 0, 11, 10, 15, 5, 6, 3, 8, 13, 12 },\r\n { 8, 3, 7, 10, 13, 9, 6, 2, 12, 1, 11, 4, 5, 15, 0, 14 },\r\n { 15, 0, 4, 11, 12, 5, 8, 10, 14, 3, 2, 13, 1, 6, 9, 7 },\r\n { 5, 12, 13, 6, 1, 3, 15, 14, 9, 0, 7, 8, 2, 10, 11, 4 } };\r\n \r\n int[][] oneEmptyCell = { \r\n { 11, 2, -1, 7, 4, 10, 9, 15, 6, 14, 0, 1, 12, 3, 8, 13 },\r\n { 14, 4, 0, 9, 11, 8, 2, 12, 13, 5, 3, 10, 15, 1, 7, 6 },\r\n { 1, 10, 15, 12, 6, 13, 7, 3, 4, 9, 8, 2, 11, 5, 14, 0 },\r\n { 13, 8, 6, 3, 5, 14, 1, 0, 11, 7, 15, 12, 10, 9, 4, 2 },\r\n { 0, 7, 14, 2, 8, 11, 4, 9, 1, 6, 10, 5, 13, 12, 3, 15 },\r\n { 3, 5, 9, 1, 10, 12, 14, 7, 2, 4, 13, 15, 8, 0, 6, 11 },\r\n { 12, 15, 10, 13, 2, 1, 3, 6, 8, 11, 14, 0, 7, 4, 5, 9 },\r\n { 6, 11, 8, 4, 0, 15, 5, 13, 7, 12, 9, 3, 14, 2, 10, 1 },\r\n { 2, 14, 1, 15, 3, 7, 11, 4, 5, 10, 6, 9, 0, 13, 12, 8 },\r\n { 7, 6, 12, 8, 9, 2, 10, 5, 0, 13, 1, 11, 4, 14, 15, 3 },\r\n { 4, 9, 3, 5, 14, 0, 13, 8, 15, 2, 12, 7, 6, 11, 1, 10 },\r\n { 10, 13, 11, 0, 15, 6, 12, 1, 3, 8, 4, 14, 9, 7, 2, 5 },\r\n { 9, 1, 2, 14, 7, 4, 0, 11, 10, 15, 5, 6, 3, 8, 13, 12 },\r\n { 8, 3, 7, 10, 13, 9, 6, 2, 12, 1, 11, 4, 5, 15, 0, 14 },\r\n { 15, 0, 4, 11, 12, 5, 8, 10, 14, 3, 2, 13, 1, 6, 9, 7 },\r\n { 5, 12, 13, 6, 1, 3, 15, 14, 9, 0, 7, 8, 2, 10, 11, 4 } };\r\n \r\n int[][] oneEmptyCellSolution = { \r\n { 11, 2, 5, 7, 4, 10, 9, 15, 6, 14, 0, 1, 12, 3, 8, 13 },\r\n { 14, 4, 0, 9, 11, 8, 2, 12, 13, 5, 3, 10, 15, 1, 7, 6 },\r\n { 1, 10, 15, 12, 6, 13, 7, 3, 4, 9, 8, 2, 11, 5, 14, 0 },\r\n { 13, 8, 6, 3, 5, 14, 1, 0, 11, 7, 15, 12, 10, 9, 4, 2 },\r\n { 0, 7, 14, 2, 8, 11, 4, 9, 1, 6, 10, 5, 13, 12, 3, 15 },\r\n { 3, 5, 9, 1, 10, 12, 14, 7, 2, 4, 13, 15, 8, 0, 6, 11 },\r\n { 12, 15, 10, 13, 2, 1, 3, 6, 8, 11, 14, 0, 7, 4, 5, 9 },\r\n { 6, 11, 8, 4, 0, 15, 5, 13, 7, 12, 9, 3, 14, 2, 10, 1 },\r\n { 2, 14, 1, 15, 3, 7, 11, 4, 5, 10, 6, 9, 0, 13, 12, 8 },\r\n { 7, 6, 12, 8, 9, 2, 10, 5, 0, 13, 1, 11, 4, 14, 15, 3 },\r\n { 4, 9, 3, 5, 14, 0, 13, 8, 15, 2, 12, 7, 6, 11, 1, 10 },\r\n { 10, 13, 11, 0, 15, 6, 12, 1, 3, 8, 4, 14, 9, 7, 2, 5 },\r\n { 9, 1, 2, 14, 7, 4, 0, 11, 10, 15, 5, 6, 3, 8, 13, 12 },\r\n { 8, 3, 7, 10, 13, 9, 6, 2, 12, 1, 11, 4, 5, 15, 0, 14 },\r\n { 15, 0, 4, 11, 12, 5, 8, 10, 14, 3, 2, 13, 1, 6, 9, 7 },\r\n { 5, 12, 13, 6, 1, 3, 15, 14, 9, 0, 7, 8, 2, 10, 11, 4 } };\r\n\r\n int[][] fourEmptyCells = { \r\n { 11, 2, 5, 7, 4, 10, 9, 15, 6, 14, 0, 1, 12, 3, 8, 13 },\r\n { 14, 4, 0, 9, 11, 8, 2, 12, 13, 5, 3, 10, 15, 1, 7, 6 },\r\n { 1, 10, 15, 12, 6, 13, 7, 3, 4, 9, 8, 2, 11, 5, 14, 0 },\r\n { 13, 8, 6, 3, 5, 14, 1, 0, 11, 7, 15, 12, 10, 9, 4, 2 },\r\n { 0, 7, 14, 2, 8, 11, 4, 9, 1, 6, 10, 5, 13, 12, 3, 15 },\r\n { 3, 5, 9, 1, 10, 12, 14, 7, 2, 4, 13, 15, 8, 0, 6, 11 },\r\n { -1, -1, 10, 13, 2, 1, 3, 6, 8, 11, 14, 0, 7, 4, 5, 9 },\r\n { -1, -1, 8, 4, 0, 15, 5, 13, 7, 12, 9, 3, 14, 2, 10, 1 },\r\n { 2, 14, 1, 15, 3, 7, 11, 4, 5, 10, 6, 9, 0, 13, 12, 8 },\r\n { 7, 6, 12, 8, 9, 2, 10, 5, 0, 13, 1, 11, 4, 14, 15, 3 },\r\n { 4, 9, 3, 5, 14, 0, 13, 8, 15, 2, 12, 7, 6, 11, 1, 10 },\r\n { 10, 13, 11, 0, 15, 6, 12, 1, 3, 8, 4, 14, 9, 7, 2, 5 },\r\n { 9, 1, 2, 14, 7, 4, 0, 11, 10, 15, 5, 6, 3, 8, 13, 12 },\r\n { 8, 3, 7, 10, 13, 9, 6, 2, 12, 1, 11, 4, 5, 15, 0, 14 },\r\n { 15, 0, 4, 11, 12, 5, 8, 10, 14, 3, 2, 13, 1, 6, 9, 7 },\r\n { 5, 12, 13, 6, 1, 3, 15, 14, 9, 0, 7, 8, 2, 10, 11, 4 } };\r\n \r\n int[][] fourEmptyCellsSolution = { \r\n { 11, 2, 5, 7, 4, 10, 9, 15, 6, 14, 0, 1, 12, 3, 8, 13 },\r\n { 14, 4, 0, 9, 11, 8, 2, 12, 13, 5, 3, 10, 15, 1, 7, 6 },\r\n { 1, 10, 15, 12, 6, 13, 7, 3, 4, 9, 8, 2, 11, 5, 14, 0 },\r\n { 13, 8, 6, 3, 5, 14, 1, 0, 11, 7, 15, 12, 10, 9, 4, 2 },\r\n { 0, 7, 14, 2, 8, 11, 4, 9, 1, 6, 10, 5, 13, 12, 3, 15 },\r\n { 3, 5, 9, 1, 10, 12, 14, 7, 2, 4, 13, 15, 8, 0, 6, 11 },\r\n { 12, 15, 10, 13, 2, 1, 3, 6, 8, 11, 14, 0, 7, 4, 5, 9 },\r\n { 6, 11, 8, 4, 0, 15, 5, 13, 7, 12, 9, 3, 14, 2, 10, 1 },\r\n { 2, 14, 1, 15, 3, 7, 11, 4, 5, 10, 6, 9, 0, 13, 12, 8 },\r\n { 7, 6, 12, 8, 9, 2, 10, 5, 0, 13, 1, 11, 4, 14, 15, 3 },\r\n { 4, 9, 3, 5, 14, 0, 13, 8, 15, 2, 12, 7, 6, 11, 1, 10 },\r\n { 10, 13, 11, 0, 15, 6, 12, 1, 3, 8, 4, 14, 9, 7, 2, 5 },\r\n { 9, 1, 2, 14, 7, 4, 0, 11, 10, 15, 5, 6, 3, 8, 13, 12 },\r\n { 8, 3, 7, 10, 13, 9, 6, 2, 12, 1, 11, 4, 5, 15, 0, 14 },\r\n { 15, 0, 4, 11, 12, 5, 8, 10, 14, 3, 2, 13, 1, 6, 9, 7 },\r\n { 5, 12, 13, 6, 1, 3, 15, 14, 9, 0, 7, 8, 2, 10, 11, 4 } };\r\n \r\n int[][] invalidRow = { \r\n { 11, 2, 5, 7, 4, 1, 9, 15, 6, 14, 0, 1, 12, 3, 8, 13 },\r\n { 14, 4, 0, 9, 11, 8, 2, 12, 13, 5, 3, 10, 15, 1, 7, 6 },\r\n { 1, 10, 15, 12, 6, 13, 7, 3, 4, 9, 8, 2, 11, 5, 14, 0 },\r\n { 13, 8, 6, 3, 5, 14, 1, 0, 11, 7, 15, 12, 10, 9, 4, 2 },\r\n { 0, 7, 14, 2, 8, 11, 4, 9, 1, 6, 10, 5, 13, 12, 3, 15 },\r\n { 3, 5, 9, 1, 10, 12, 14, 7, 2, 4, 13, 15, 8, 0, 6, 11 },\r\n { 12, 15, 10, 13, 2, 1, 3, 6, 8, 11, 14, 0, 7, 4, 5, 9 },\r\n { 6, 11, 8, 4, 0, 15, 5, 13, 7, 12, 9, 3, 14, 2, 10, 1 },\r\n { 2, 14, 1, 15, 3, 7, 11, 4, 5, 10, 6, 9, 0, 13, 12, 8 },\r\n { 7, 6, 12, 8, 9, 2, 10, 5, 0, 13, 1, 11, 4, 14, 15, 3 },\r\n { 4, 9, 3, 5, 14, 0, 13, 8, 15, 2, 12, 7, 6, 11, 1, 10 },\r\n { 10, 13, 11, 0, 15, 6, 12, 1, 3, 8, 4, 14, 9, 7, 2, 5 },\r\n { 9, 1, 2, 14, 7, 4, 0, 11, 10, 15, 5, 6, 3, 8, 13, 12 },\r\n { 8, 3, 7, 10, 13, 9, 6, 2, 12, 1, 11, 4, 5, 15, 0, 14 },\r\n { 15, 0, 4, 11, 12, 5, 8, 10, 14, 3, 2, 13, 1, 6, 9, 7 },\r\n { 5, 12, 13, 6, 1, 3, 15, 14, 9, 0, 7, 8, 2, 10, 11, 4 } };\r\n\r\n int[][] invalidColumn = { \r\n { 11, 2, 5, 7, 4, 10, 9, 15, 6, 14, 0, 1, 12, 3, 8, 13 },\r\n { 14, 4, 0, 9, 11, 8, 2, 12, 13, 5, 3, 10, 15, 1, 7, 6 },\r\n { 1, 10, 15, 12, 6, 13, 7, 3, 4, 9, 8, 2, 11, 5, 14, 0 },\r\n { 13, 8, 6, 3, 5, 14, 1, 0, 11, 7, 15, 12, 10, 9, 4, 2 },\r\n { 0, 7, 14, 2, 8, 11, 4, 9, 1, 6, 10, 5, 13, 12, 3, 15 },\r\n { 3, 5, 9, 1, 10, 12, 14, 7, 2, 4, 13, 15, 8, 0, 6, 11 },\r\n { 1, 15, 10, 13, 2, 1, 3, 6, 8, 11, 14, 0, 7, 4, 5, 9 },\r\n { 6, 11, 8, 4, 0, 15, 5, 13, 7, 12, 9, 3, 14, 2, 10, 1 },\r\n { 2, 14, 1, 15, 3, 7, 11, 4, 5, 10, 6, 9, 0, 13, 12, 8 },\r\n { 7, 6, 12, 8, 9, 2, 10, 5, 0, 13, 1, 11, 4, 14, 15, 3 },\r\n { 4, 9, 3, 5, 14, 0, 13, 8, 15, 2, 12, 7, 6, 11, 1, 10 },\r\n { 10, 13, 11, 0, 15, 6, 12, 1, 3, 8, 4, 14, 9, 7, 2, 5 },\r\n { 9, 1, 2, 14, 7, 4, 0, 11, 10, 15, 5, 6, 3, 8, 13, 12 },\r\n { 8, 3, 7, 10, 13, 9, 6, 2, 12, 1, 11, 4, 5, 15, 0, 14 },\r\n { 15, 0, 4, 11, 12, 5, 8, 10, 14, 3, 2, 13, 1, 6, 9, 7 },\r\n { 5, 12, 13, 6, 1, 3, 15, 14, 9, 0, 7, 8, 2, 10, 11, 4 } };\r\n \r\n int[][] example1 = {\r\n { -1, 15, -1, 1, -1, -1, 14, 8, 13, 3, -1, -1, -1, 12, -1, 0 },\r\n { 2, 13, -1, -1, -1, -1, -1, 5, 0, 11, -1, 10, -1, -1, -1, 1 },\r\n { -1, 4, -1, -1, -1, 13, 1, 0, 15, -1, -1, 7, -1, -1, -1, -1 },\r\n { -1, 6, 12, -1, 15, -1, -1, 9, -1, -1, 14, -1, 8, -1, -1, -1 },\r\n { 8, -1, 1, 15, -1, -1, -1, 10, 3, -1, 9, -1, 14, -1, -1, -1 },\r\n { 11, -1, 4, -1, -1, -1, 8, -1, 6, 1, -1, -1, -1, -1, 12, -1 },\r\n { -1, -1, 3, 13, -1, -1, 4, -1, -1, 15, -1, -1, 2, -1, 8, -1 },\r\n { 10, -1, -1, -1, 2, -1, -1, -1, -1, 0, -1, -1, -1, 7, -1, -1 },\r\n { -1, -1, 15, -1, -1, -1, 5, -1, -1, -1, -1, 2, -1, -1, -1, 4 },\r\n { -1, 5, -1, 4, -1, -1, 7, -1, -1, 9, -1, -1, 15, 10, -1, -1 },\r\n { -1, 10, -1, -1, -1, -1, 6, 3, -1, 12, -1, -1, -1, 13, -1, 5 },\r\n { -1, -1, -1, 6, -1, 1, -1, 4, 7, -1, -1, -1, 3, 9, -1, 2 },\r\n { -1, -1, -1, 12, -1, 8, -1, -1, 2, -1, -1, 3, -1, 4, 5, -1 },\r\n { -1, -1, -1, -1, 7, -1, -1, 12, 9, 6, 4, -1, -1, -1, 0, -1 },\r\n { 5, -1, -1, -1, 13, -1, 3, 6, 11, -1, -1, -1, -1, -1, 15, 14 },\r\n { 4, -1, 6, -1, -1, -1, 2, 15, 12, 5, -1, -1, 9, -1, 13, -1 }, };\r\n \r\n int[][] emptySudoku = {\r\n { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },\r\n { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },\r\n { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },\r\n { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },\r\n { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },\r\n { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },\r\n { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },\r\n { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },\r\n { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },\r\n { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },\r\n { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },\r\n { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },\r\n { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },\r\n { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },\r\n { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },\r\n { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, };\r\n \r\n \r\n testSudoku(\"filledSudoku\", filledSudoku, filledSudoku);\r\n System.out.println(\"Number of Recursion calls: \" + HexadecimalSudoku.numOfRecursionCalls);\r\n System.out.println();\r\n\r\n testSudoku(\"oneEmptyCell\", oneEmptyCell, oneEmptyCell);\r\n System.out.println(\"Number of Recursion calls: \" + HexadecimalSudoku.numOfRecursionCalls);\r\n System.out.println();\r\n\r\n testSudoku(\"fourEmptyCells\", fourEmptyCells, fourEmptyCellsSolution);\r\n System.out.println(\"Number of Recursion calls: \" + HexadecimalSudoku.numOfRecursionCalls);\r\n System.out.println();\r\n \r\n testSudoku(\"invalidRow\", invalidRow, null);\r\n System.out.println(\"Should print out: sudoku row 0 has 1 at both positions 5 and 11\");\r\n System.out.println();\r\n \r\n testSudoku(\"invalidColumn\", invalidColumn, null);\r\n System.out.println(\"Should print out: sudoku column 0 has 1 at both positions 2 and 6\");\r\n System.out.println();\r\n\r\n testSudoku(\"emptySudoku\", emptySudoku, emptySudoku);\r\n System.out.println(\"Number of Recursion calls: \" + HexadecimalSudoku.numOfRecursionCalls);\r\n System.out.println(\"Number of Iterations: \" + HexadecimalSudoku.numOfIterations);\r\n System.out.println();\r\n \r\n// int ex1Count = 0;\r\n// for (int i = 0; i < 16; i++) {\r\n// for (int j = 0; j < 16; j++) {\r\n// if (example1[i][j] == -1) {\r\n// ex1Count++;\r\n// } \r\n// }\r\n// }\r\n// \r\n// testSudoku(\"example1\", example1, null);\r\n// System.out.println(\"Number of Recursion calls: \" + HexadecimalSudoku.numOfRecursionCalls);\r\n// System.out.println();\r\n }", "public native int[][] __int2dArrayMethod( long __swiftObject, int[][] arg );", "public static void main (String[] args) {\n int[][] twoD = new int[3][4];\n// Where x is an integer\n// [[x, x, x, x],\n// [x, x, x, x],\n// [x, x, x, x]]\n\n// int[][][] threeD = new int[3][4][3];\n\n// 4x3\n int[][] twoDInit = {{1, 3, 5}, {4, 3, 5}, {1, 4, 5}, {4, 3, 5}};\n\n for (int i = 0; i < twoDInit.length; i++) {\n for (int j = 0; j < twoDInit[i].length; j++) {\n System.out.println(twoDInit[i][j]);\n }\n }\n\n for (int[] ints : twoDInit) {\n for (int anInt : ints) {\n System.out.println(anInt);\n }\n }\n\n for (int i = 0; i < 5; i++) {\n for (int j = 0; j < 7; j++) {\n System.out.print(\"*\");\n }\n System.out.println();\n }\n\n for (int i = 0; i < 5; i++) {\n for (int j = 0; j < i + 1; j++) {\n System.out.print(\"*\");\n }\n System.out.println();\n }\n }", "public void populateNoiseArray(double[] p_76308_1_, double p_76308_2_, double p_76308_4_, double p_76308_6_, int p_76308_8_, int p_76308_9_, int p_76308_10_, double p_76308_11_, double p_76308_13_, double p_76308_15_, double p_76308_17_) {\n/* 81 */ if (p_76308_9_ == 1) {\n/* */ \n/* 83 */ boolean var64 = false;\n/* 84 */ boolean var65 = false;\n/* 85 */ boolean var21 = false;\n/* 86 */ boolean var68 = false;\n/* 87 */ double var70 = 0.0D;\n/* 88 */ double var73 = 0.0D;\n/* 89 */ int var75 = 0;\n/* 90 */ double var77 = 1.0D / p_76308_17_;\n/* */ \n/* 92 */ for (int var30 = 0; var30 < p_76308_8_; var30++) {\n/* */ \n/* 94 */ double var31 = p_76308_2_ + var30 * p_76308_11_ + this.xCoord;\n/* 95 */ int var78 = (int)var31;\n/* */ \n/* 97 */ if (var31 < var78)\n/* */ {\n/* 99 */ var78--;\n/* */ }\n/* */ \n/* 102 */ int var34 = var78 & 0xFF;\n/* 103 */ var31 -= var78;\n/* 104 */ double var35 = var31 * var31 * var31 * (var31 * (var31 * 6.0D - 15.0D) + 10.0D);\n/* */ \n/* 106 */ for (int var37 = 0; var37 < p_76308_10_; var37++)\n/* */ {\n/* 108 */ double var38 = p_76308_6_ + var37 * p_76308_15_ + this.zCoord;\n/* 109 */ int var40 = (int)var38;\n/* */ \n/* 111 */ if (var38 < var40)\n/* */ {\n/* 113 */ var40--;\n/* */ }\n/* */ \n/* 116 */ int var41 = var40 & 0xFF;\n/* 117 */ var38 -= var40;\n/* 118 */ double var42 = var38 * var38 * var38 * (var38 * (var38 * 6.0D - 15.0D) + 10.0D);\n/* 119 */ int var19 = this.permutations[var34] + 0;\n/* 120 */ int var66 = this.permutations[var19] + var41;\n/* 121 */ int var67 = this.permutations[var34 + 1] + 0;\n/* 122 */ int var22 = this.permutations[var67] + var41;\n/* 123 */ var70 = lerp(var35, func_76309_a(this.permutations[var66], var31, var38), grad(this.permutations[var22], var31 - 1.0D, 0.0D, var38));\n/* 124 */ var73 = lerp(var35, grad(this.permutations[var66 + 1], var31, 0.0D, var38 - 1.0D), grad(this.permutations[var22 + 1], var31 - 1.0D, 0.0D, var38 - 1.0D));\n/* 125 */ double var79 = lerp(var42, var70, var73);\n/* 126 */ int var10001 = var75++;\n/* 127 */ p_76308_1_[var10001] = p_76308_1_[var10001] + var79 * var77;\n/* */ }\n/* */ \n/* */ } \n/* */ } else {\n/* */ \n/* 133 */ int var19 = 0;\n/* 134 */ double var20 = 1.0D / p_76308_17_;\n/* 135 */ int var22 = -1;\n/* 136 */ boolean var23 = false;\n/* 137 */ boolean var24 = false;\n/* 138 */ boolean var25 = false;\n/* 139 */ boolean var26 = false;\n/* 140 */ boolean var27 = false;\n/* 141 */ boolean var28 = false;\n/* 142 */ double var29 = 0.0D;\n/* 143 */ double var31 = 0.0D;\n/* 144 */ double var33 = 0.0D;\n/* 145 */ double var35 = 0.0D;\n/* */ \n/* 147 */ for (int var37 = 0; var37 < p_76308_8_; var37++) {\n/* */ \n/* 149 */ double var38 = p_76308_2_ + var37 * p_76308_11_ + this.xCoord;\n/* 150 */ int var40 = (int)var38;\n/* */ \n/* 152 */ if (var38 < var40)\n/* */ {\n/* 154 */ var40--;\n/* */ }\n/* */ \n/* 157 */ int var41 = var40 & 0xFF;\n/* 158 */ var38 -= var40;\n/* 159 */ double var42 = var38 * var38 * var38 * (var38 * (var38 * 6.0D - 15.0D) + 10.0D);\n/* */ \n/* 161 */ for (int var44 = 0; var44 < p_76308_10_; var44++) {\n/* */ \n/* 163 */ double var45 = p_76308_6_ + var44 * p_76308_15_ + this.zCoord;\n/* 164 */ int var47 = (int)var45;\n/* */ \n/* 166 */ if (var45 < var47)\n/* */ {\n/* 168 */ var47--;\n/* */ }\n/* */ \n/* 171 */ int var48 = var47 & 0xFF;\n/* 172 */ var45 -= var47;\n/* 173 */ double var49 = var45 * var45 * var45 * (var45 * (var45 * 6.0D - 15.0D) + 10.0D);\n/* */ \n/* 175 */ for (int var51 = 0; var51 < p_76308_9_; var51++) {\n/* */ \n/* 177 */ double var52 = p_76308_4_ + var51 * p_76308_13_ + this.yCoord;\n/* 178 */ int var54 = (int)var52;\n/* */ \n/* 180 */ if (var52 < var54)\n/* */ {\n/* 182 */ var54--;\n/* */ }\n/* */ \n/* 185 */ int var55 = var54 & 0xFF;\n/* 186 */ var52 -= var54;\n/* 187 */ double var56 = var52 * var52 * var52 * (var52 * (var52 * 6.0D - 15.0D) + 10.0D);\n/* */ \n/* 189 */ if (var51 == 0 || var55 != var22) {\n/* */ \n/* 191 */ var22 = var55;\n/* 192 */ int var69 = this.permutations[var41] + var55;\n/* 193 */ int var71 = this.permutations[var69] + var48;\n/* 194 */ int var72 = this.permutations[var69 + 1] + var48;\n/* 195 */ int var74 = this.permutations[var41 + 1] + var55;\n/* 196 */ int var75 = this.permutations[var74] + var48;\n/* 197 */ int var76 = this.permutations[var74 + 1] + var48;\n/* 198 */ var29 = lerp(var42, grad(this.permutations[var71], var38, var52, var45), grad(this.permutations[var75], var38 - 1.0D, var52, var45));\n/* 199 */ var31 = lerp(var42, grad(this.permutations[var72], var38, var52 - 1.0D, var45), grad(this.permutations[var76], var38 - 1.0D, var52 - 1.0D, var45));\n/* 200 */ var33 = lerp(var42, grad(this.permutations[var71 + 1], var38, var52, var45 - 1.0D), grad(this.permutations[var75 + 1], var38 - 1.0D, var52, var45 - 1.0D));\n/* 201 */ var35 = lerp(var42, grad(this.permutations[var72 + 1], var38, var52 - 1.0D, var45 - 1.0D), grad(this.permutations[var76 + 1], var38 - 1.0D, var52 - 1.0D, var45 - 1.0D));\n/* */ } \n/* */ \n/* 204 */ double var58 = lerp(var56, var29, var31);\n/* 205 */ double var60 = lerp(var56, var33, var35);\n/* 206 */ double var62 = lerp(var49, var58, var60);\n/* 207 */ int var10001 = var19++;\n/* 208 */ p_76308_1_[var10001] = p_76308_1_[var10001] + var62 * var20;\n/* */ } \n/* */ } \n/* */ } \n/* */ } \n/* */ }", "@Test\n public void testCreateTranspose3(){\n double[][] a = new double[4][2];\n for(int i = 0 ; i < a.length ; i++){\n for(int j = 0 ; j < a[0].length ; j++){\n a[i][j] = Math.random();\n }\n }\n double[][] newA = HarderArrayProblems.createTranspose(a);\n checkTranspose(a, newA);\n }", "public static void main(String[] args) {\n\n String[] days = {\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\",\"Sunday\"}; //String Array\n\n int[] count = {1,2,3,4,5,6,7,8,9,10}; //int Array\n\n //Accessing an array element\n System.out.println(days[2]); //Outputs wednesday 0-6 (0 is inclusive in an array as always)\n\n //Modify individual elements in an array\n days[2] = \"Wed\";\n System.out.println(days[2]);\n\n //Output array length\n System.out.println(days.length); //Outputs the length of the array in digits (7)\n\n //Foreach should be used to loop through an array\n //however you can use a for loop and use the .length as the counter benchmark\n for (int y = 0; y < days.length; y++) {\n System.out.println(days[y]); //Y gives the array element number because it loops through from 0 the same as the arrays start\n }\n\n //MULTI-DIMENSIONAL ARRAYS TOMORROW!\n\n //A multi dimensional array is an array consisting on rows and columns (2d array) - basically a table\n\n int[][] dimArray = {{1,2,3,3,21,3,1,233},{4,5,6,5,6,7,6,4,5,3,4}};\n\n int firstRow = dimArray[0][0]; //Outputs 1 (1st row being the 1st brackets which is 0 (array counts)\n int secondRow = dimArray[1][0]; //Outputs 4 (2nd row being the 2nd brackets which is 0 (array counts)\n\n System.out.println(firstRow);\n System.out.println(secondRow);\n\n String[][] dimArrayMulti = {{\"a\",\"a\",\"a\"},{\"b\",\"b\"},{\"c\",\"c\",\"c\",\"c\",\"c\"}}; //Rows can be infinite, additional brackets\n //Also variable type can be substituted like the example here (String)\n\n System.out.println(dimArrayMulti[0][2] + dimArrayMulti[1][1] + dimArrayMulti[2][3]); //Called upon like this\n\n //How to loop through a multi 2d array\n int multiLoopArray[][] = {{0,0,0,0,0,0},{1,1,1,1,1,1,1,},{2,2,2,2,2,2},{3,3,3,3},{4,4,4,4,4,4,}}; //5 rows\n System.out.println(multiLoopArray.length);\n\n System.out.println(\"This is the multi-loop output START\");\n for (int f = 0; f < multiLoopArray.length; f++) { //Counts the length of the array columns (1st level/dimension)\n for (int g = 0; g < multiLoopArray[f].length; g++) { //Using the index from \"f\" counts the length of the array rows (2nd level/dimension)\n System.out.println(multiLoopArray[f][g]);\n }\n }\n System.out.println(\"This is the multi-loop output END\");\n }", "public static void main(String[] args) throws Exception {\r\n Scanner input = new Scanner(System.in);\r\n int n;\r\n // System.out.println(\"Enter the number of element\");\r\n n = input.nextInt();\r\n // System.out.println(\"here is n\"+n);\r\n int arr[] = new int[n];\r\n // System.out.println(\"Enter the element of the array\");\r\n for (int i = 0; i < n; i++) {\r\n arr[i] = input.nextInt();\r\n }\r\n int sol_arr_1[][] = new int[n][n], sol_arr_2[][] = new int[n][n];\r\n \r\n //*****intialization*****//\r\n for(int i=0;i<n;i++)\r\n {\r\n for(int j=0;j<n;j++)\r\n {\r\n sol_arr_1[i][j]=0;\r\n sol_arr_2[i][j]=0;\r\n }\r\n }\r\n //*****end*****//\r\n \r\n \r\n \r\n \r\n \r\n int k_for_j = 1;\r\n int i = 0, j = 1;\r\n for (int q = 0; q < n - 1; q++) {\r\n // System.out.println(\"q=\"+q);\r\n j = k_for_j;\r\n i=0;\r\n if (q == 0) {\r\n while (j < n) {\r\n sol_arr_1[i][j] = (arr[i] + arr[j]) % 100;\r\n sol_arr_2[i][j] = (arr[i] * arr[j]);\r\n i++;\r\n j++;\r\n }\r\n }\r\n else\r\n {\r\n while(j<n)\r\n {\r\n int color1,smog1;\r\n color1=(arr[j]+sol_arr_1[i][j-1])%100;\r\n smog1=sol_arr_2[i][j-1]+(arr[j]*sol_arr_1[i][j-1]);\r\n int color2,smog2;\r\n color2 =(sol_arr_1[i+1][j]+arr[j-2])%100;\r\n smog2=(sol_arr_1[i+1][j]*arr[j-2])+sol_arr_2[i+1][j];\r\n if(smog1>smog2)\r\n {\r\n sol_arr_1[i][j]=color2;\r\n sol_arr_2[i][j]=smog2;\r\n }\r\n else\r\n {\r\n sol_arr_1[i][j]=color1;\r\n sol_arr_2[i][j]=smog1;\r\n }\r\n i++;\r\n j++;\r\n }\r\n }\r\n k_for_j++;\r\n }\r\n System.out.println(sol_arr_2[0][n-1]);\r\n }", "public static void main(String[] args) {\n int [][] flats; // A 2-D Array\n flats = new int[3][3];\n flats[0][0] = 101; flats[1][0] = 201; flats[2][0] = 301;\n flats[0][1] = 102; flats[1][1] = 202; flats[2][1] = 302;\n flats[0][2] = 103; flats[1][2] = 203; flats[2][2] = 303;\n\n\n //Displaying the Array (for loop)\n System.out.println(\"Printing a 2-D array using for loop\");\n for (int i=0; i<flats.length; i++){\n for (int j=0; j<flats[i].length; j++) {\n System.out.print(flats[i][j]);\n System.out.print(\" \");\n }\n System.out.print(\"\\n\");\n }\n }" ]
[ "0.6106231", "0.6083643", "0.6067454", "0.59514195", "0.5936942", "0.5873287", "0.58613163", "0.5814743", "0.58097625", "0.580849", "0.5793755", "0.578277", "0.5769761", "0.57694197", "0.57693076", "0.57388145", "0.5736039", "0.5733333", "0.5720896", "0.57055694", "0.56939787", "0.5692983", "0.5667297", "0.56603247", "0.5642285", "0.5641416", "0.56193477", "0.56060493", "0.5600693", "0.5591355", "0.5588443", "0.5571862", "0.55610293", "0.5531334", "0.5524027", "0.55235106", "0.5504689", "0.55012816", "0.5496692", "0.54897904", "0.54895526", "0.548924", "0.5488463", "0.5487496", "0.5484834", "0.5484135", "0.547949", "0.5474801", "0.5473243", "0.54732066", "0.5461579", "0.54589474", "0.5458931", "0.5447899", "0.5445871", "0.54440165", "0.54398054", "0.5437552", "0.5431248", "0.5428265", "0.5425706", "0.5414897", "0.5413833", "0.53967416", "0.5393061", "0.53902256", "0.538814", "0.5382637", "0.53727245", "0.5372333", "0.5372279", "0.5367473", "0.5366094", "0.5364323", "0.5360774", "0.53504145", "0.53457713", "0.5341134", "0.533917", "0.5338396", "0.53369176", "0.533118", "0.5325309", "0.5322766", "0.5321829", "0.5313953", "0.5312294", "0.530926", "0.53087795", "0.5300127", "0.53000087", "0.5292206", "0.52776027", "0.52739644", "0.5270695", "0.52705115", "0.5268184", "0.52662534", "0.5264025", "0.5256132", "0.52540225" ]
0.0
-1
we can use the first dimension of 2d array as index of 1d array itself use the other dimension as values. (optimized monolith approach)
public int _maxProfitAssignmentBest(int[] difficulty, int[] profit, int[] worker) { // value index reverse array int [] dp = new int [100001]; // nice strategy to use in multi-array approach // using difficulty as index, profit as value. // (difficulty array sorted by default, effort saved) for (int idx = 0; idx < difficulty.length; idx ++) { // overwrite profit values and keep the max one. (in case of conflict) dp [difficulty [idx]] = Math.max (dp [difficulty [idx]], profit [idx]); } // maximize profits stored linearly for (int idx = 1; idx < dp.length; idx ++) dp [idx] = Math.max (dp [idx - 1], dp [idx]); // build ans int ans = 0; for (int w : worker) ans += dp [w]; return ans; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void main(String[] args) { \r\n int[][] a = new int[3][5]; // прямоугольный массив\r\n int size1 = a.length;\r\n int size2 = a[0].length;\r\n int[][] b = new int[3][]; // массив переменной длины (тут - треугольный)\r\n b[0] = new int[1];\r\n b[1] = new int[2];\r\n b[2] = new int[3];\r\n int c[] = new int[] {1,2,3,};\r\n c = new int[]{0,1,2,3}; // а вот так не сработает: c = {0,1,2,3};\r\n \r\n int[] array1D= {0,1,2,3}; \r\n int[][] array2D= {{0,1,5,10},{2,3,1,0,5,55,16},{0,1}};\r\n int[][][] array3D= {\r\n { {2,3,1,0},\r\n {2,3,1,0},\r\n {2,3,1,0}},\r\n \r\n { {2,3,1,0},\r\n {2,3,1,0},\r\n {2,3,1,0}},\r\n \r\n { {2,3,1,0},\r\n {2,3,1,0},\r\n {2,3,1,0}}};\r\n System.out.println(\"============array1D==========\");\r\n System.out.println(array1D);\r\n System.out.println(Arrays.toString(array1D)); //Работает на глубину одного измерения (для одномерных масивов)\r\n System.out.println(\"============array2D==========\");\r\n System.out.println(array2D);\r\n System.out.println(Arrays.toString(array2D)); \r\n System.out.println(Arrays.deepToString(array2D));\r\n System.out.println(\"============array3D==========\");\r\n System.out.println(array3D);\r\n System.out.println(Arrays.toString(array3D));\r\n System.out.println(Arrays.deepToString(array3D));\r\n }", "@Test\n public void testCreateRowIndices2(){\n int[][] a = new int[4][2];\n a[0][0] = 0;\n a[0][1] = 0;\n a[1][0] = 0;\n a[1][1] = 1;\n a[2][0] = 0;\n a[2][1] = 2;\n a[3][0] = 2;\n a[3][1] = 1;\n\n double[][] input = new double[4][3];\n\n for(int i = 0 ; i < a.length ; i++){\n input[a[i][0]][a[i][1]] = 1;\n }\n\n int[][] myIndices = HarderArrayProblems.createRowIndices(input);\n for(int i = 0 ; i < a.length ; i++){\n assertEquals(a[i][0], myIndices[i][0]);\n assertEquals(a[i][1], myIndices[i][1]);\n }\n\n }", "public long[][] flatTo2D (long[] in_array1d){\n\t\tint sl = (int)Math.sqrt(in_array1d.length);\n\t\tlong[][] out_array = new long[sl][sl]; //declares output 2D array\n\t\tint q = 0; //temporary variable, used in following nested for loop\n\t\tfor(int a = 0; a < sl; a++){ //loops until a == side length\n\t\t\tfor(int b = 0; a < sl ; b++){ //loops until b == side length\n\t\t\t\t//q is initially set to zero. With each iteration of the b for-loop, the value of\n\t\t\t\t//out_array[a][b] is replaced with in_array[q], and q is incremented by 1. This means\n\t\t\t\t//that, for every iteration of the a for-loop, q is incremented by sl\n\t\t\t\tout_array[a][b] = in_array1d[q]; \n\t\t\t\tq = q + 1;\n\t\t\t\t}\n\t\t\t}\n\t\treturn out_array;\n\t\t}", "@Test\n public void testCreateRowIndices3(){\n int[][] a = new int[4][2];\n a[0][0] = 0;\n a[0][1] = 0;\n a[1][0] = 0;\n a[1][1] = 1;\n a[2][0] = 0;\n a[2][1] = 2;\n a[3][0] = 2;\n a[3][1] = 1;\n\n double[][] input = new double[4][4];\n\n for(int i = 0 ; i < a.length ; i++){\n input[a[i][0]][a[i][1]] = 1;\n }\n\n int[][] myIndices = HarderArrayProblems.createRowIndices(input);\n for(int i = 0 ; i < a.length ; i++){\n assertEquals(a[i][0], myIndices[i][0]);\n assertEquals(a[i][1], myIndices[i][1]);\n }\n }", "public Object[][] get2DArray();", "public native int[][] __int2dArrayMethod( long __swiftObject, int[][] arg );", "public static void main(String [] args) {\n\t\tint [][] numbers =new int[2][3];\n\t\t\n\t //enter into array into row index 0 and column index 2\n\t\tnumbers[0][2] =8; \n\t\tnumbers[1][0] =5;\n\t\tnumbers[0][0] =9;\n\t\tnumbers[0][1] =6;\n\t\tnumbers[1][1] =2;\n\t\tnumbers[1][2]= 3;\n\t\t\n\t\n\t\t\n\t\t\n\t\t//2nd way of creating 2D-Array\n\t\tint [][] numbers2 = {{5,6,8},\n\t\t\t\t {9,2,3}\n\t\t };\n\t\t\n\t\tSystem.out.println(\"Let`s get some values from numbers2\");\n\t\t//first get it, then print it\n\t\tint value =numbers2[1][0];\n System.out.println(value);\n \n //get and print in one step\n System.out.println(numbers2[1][1]);\n\t \n \n //1D array is married to for loop\n //2D array is married to nested loop\n \n \n //how many rows?\n int row= numbers2.length;\n \n //how many coloumns iin first row?\n int coloumns=numbers2[0].length;\n \n for(int row=0; row<numbers2.length; row++) {\n \tSystem.out.println(\"I am in the \"+row+\" row\");\n \tfor(int col=0; col<numbers2[row].length; col++) {\n \t\tSystem.out.println(\"I am in the column\" +col);\n \t\tSystem.out.println(\"The value is \"+numbers2[row][col]);\n \t}\n \tSystem.out.println();\n }\n \n\n}", "public static void main(String[] args) {\n\t\tint[][] array = new int[5][6];\r\n\t\tint[] x = {1,2};array[0] = x;\r\n\t\tSystem.out.println(\"array[0][1] is \" + array[0][1]);\r\n\t\tSystem.out.println(Arrays.deepToString(array));\r\n\t\t\r\n\t\tint[][] arr = {{1,2}, {3,4}, {5,6}};\r\n\t\tfor (int i = arr.length - 1; i >= 0; i--) \r\n\t\t{for (int j = arr[i].length - 1; j >= 0; j--)\r\n\t\t\tSystem.out.print(arr[i][j] + \" \");\r\n\t\tSystem.out.println();\r\n\t\t}\r\n\t\tint[][] array1 = {{1,2}, {3,4}, {5,6}};\r\n\t\tint sum = 0;\r\n\t\tfor (int i = 0; i < array1.length; i++)\r\n\t\t\tsum += array1[i][0];\r\n\t\tSystem.out.println(sum);\r\n\t\r\n\tint [][]matrix = new int [10] [10];\r\n\t\r\n\tfor (int row = 0; row < matrix.length; row++) {\r\n\t\tfor (int column = 0; column < matrix[row].length; column++) {\r\n\t\tmatrix[row][column] = (int)(Math.random() * 100); }}\r\n\tSystem.out.println(Arrays.deepToString(matrix));\r\n\r\n\tfor (int i = 0; i < matrix.length; i++) {\r\n\t\tfor (int j = 0; j < matrix[i].length; j++) {\r\n\t\t\tint i1 = (int)(Math.random() * matrix.length);\r\n\t\t\tint j1 = (int)(Math.random() * matrix[i].length);\r\n\t\t\tint temp = matrix[i][j];\r\n\t\t\tmatrix[i][j] = matrix[i1][j1];\r\n\t\t\tmatrix[i1][j1] = temp;\r\n\t\t}\r\n\t}System.out.println(Arrays.deepToString(matrix));\r\n\t}", "private int getSumD2(int[][] a) {\n int sum = 0;\n\n int jd1 = 0;\n int jd2 = a.length - 1;\n while (jd1 < a.length) {\n sum += a[jd1][jd2];\n jd2--;\n jd1++;\n }\n return sum;\n }", "public static void main(String[] args) {\n int[][] array = {{1,3,6}, {5,6,7}};\n\n int[] a = array[1];\n int b = array[1][1];\n System.out.println(a[1]);\n System.out.println(b);\n }", "public native short[][] __short2dArrayMethod( long __swiftObject, short[][] arg );", "static void TwoDimTrav(int[][] arr, int row, int col){\n\n int[] dr = new int[]{ -1, 1, 0, 0};\n int[] dc = new int[]{ 0, 0, 1, -1};\n\n for(int i = 0; i < 4; i++){\n int newRow = row + dr[i];\n int newCol = col + dc[i];\n\n if(newRow < 0 || newCol < 0 || newRow >= arr.length || newCol >= arr[0].length)\n continue;\n\n // do your code here\n\n }\n\n // All Directions\n // North, South, East, West, NW NE SW SE\n // dr = [ -1, 1, 0, 0 -1, -1, 1, 1 ]\n // dc = [ 0, 0, 1, -1 -1, 1, 1, -1 ]\n\n// int[] dr = new int[]{ -1, 1, 0, 0, -1, -1, 1, 1};\n// int[] dc = new int[]{ 0, 0, 1, -1, -1, 1, -1, 1};\n//\n// for(int i = 0; i < 8; i++){\n// int newRow = row + dr[i];\n// int newCol = col + dc[i];\n//\n// if(newRow < 0 || newCol < 0 || newRow >= arr.length || newCol >= arr[0].length)\n// continue;\n//\n// // do your code here\n//\n// }\n }", "public static int[][] intArray1Dto2D(int[] matrixVal) {\n int size = (int) Math.sqrt(matrixVal.length);\n int[][] values = new int[size][size];\n int i, j, k;\n for (i = 0, k = 0; i < size; ++i) {\n for (j = 0; j < size; ++j) {\n values[i][j] = matrixVal[k];\n k++;\n }\n }\n return values;\n }", "public static void main(String[] args) {\n\t\t\n\t\tint[] arr1D = {1,2,3};\n\t\t\n\t//\t2 dimensional array: array that contains multiple 1 dimensional arrays\n\t\t\n\t\tint[][] arr2D = { {1,2,3} , {4,5,6} };\n\t\t\n\t\t\n\t\tString[] arr = {\"A\" ,\"B\"};\n\t\t\n\t\t//\t\t\t\t\t\t 0 1 0 1 2\n\t\tString[][] str2D = { {\"A\" ,\"B\"} , {\"C\" ,\"D\",\"E\"} };\n\t\t//\t\t\t\t\t\t\t 0 1\n\t\t\n// [represents the index number of 1 dimensional arrays ][ represents the index number of the values]\n\t\t\n\t\t\t\t// print A:\n\t\t\t\tSystem.out.println( str2D[0][0] );\n\t\t\t\t\n\t\t\t\t// print D:\n\t\t\t\tSystem.out.println( str2D[1][1] );\n\t\t\t\t\n\t\t\t\t//print E:\n\t\t\t\tSystem.out.println(str2D[1][2]);\n\t\t\n\t\t\t\t// print [A ,B]:\n\t\t\t\tSystem.out.println( str2D[0] );\n\t\t\t\tSystem.out.println( Arrays.toString( str2D[0] ) );\n\t\t\t\t\n\t\t\t\t// print [C, D, E]:\n\t\t\t\tSystem.out.println( str2D[1] );\n\t\t\t\tSystem.out.println( Arrays.toString( str2D[1] ));\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t//print [[A,B], [C, D, E]]\n\t\t\t\tSystem.out.println( Arrays.toString(str2D) );\n\t\t\t\tSystem.out.println( Arrays.deepToString( str2D ) );\n\t\n\t\t\t// Arrays.deepToString(variableName ): converts multi-Dimensional Arrays to STring value\n\t\t\t\n\t\t\t\t\n\t\t\t// \t 0 1 0 1 0 1 \n\t\t\tint[][] Numbers2D = {\t{1,2} , {3, 4} , {5, 6, 7, 8, 9 , 10} };\n\t\t\t//\t\t\t\t\t 0 1 2\n\t\t\t\t\n\t\t\t\t// print 6:\n\t\t\tSystem.out.println( Numbers2D[2][1] );\n\t\t\t\n\t\t\t\t// print 10:\n\t\t\tSystem.out.println( Numbers2D[2][5] );\n\t\t\t\n\t\t\t\t// print {5, 6, 7, 8, 9 , 10}:\n\t\t\tSystem.out.println( Numbers2D[2] );\n\t\t\tSystem.out.println( Arrays.toString( Numbers2D[2] ) );\n\t\t\t\n\t\t\t\t// print the entire 2D array:\n\t\t\tSystem.out.println(Arrays.deepToString( Numbers2D ));\n\t\t\t\t\n\t\t\t\t\n\t\t// 3 dimensional array contains multiple 2 dimensional arrays\n\t\tint[][] Array2D = { {1,2}, {3,4} };\n\t\t//\t\t\t\t\t\t\t 0 1 0 1\n\t\tint[][][] Array3D = { { {1,2}, {3,4} } , { {5, 6}, {7, 8} } };\n// 0 1\t\n//[index numbers of 2D array][ index number of 1D array] [ index number of value]\n\n\t\t\t//print 8:\n\t\tSystem.out.println(Array3D[1][1][1]);\n\t\t\n\t\t// print {5, 6}:\n\t\tSystem.out.println( Array3D[1][0] );\n\t\tSystem.out.println( Arrays.toString( Array3D[1][0] ) );\n\t\t\n\t\t// print { {5, 6}, {7, 8} }:\n\t\tSystem.out.println( Array3D[1] );\n\t\tSystem.out.println( Arrays.toString( Array3D[1] ) );\n\t\tSystem.out.println( Arrays.deepToString( Array3D[1] ));\n\t\t\n\t\t\n\t\t// print the entire 3d array:\n\t\t\tSystem.out.println(Arrays.deepToString( Array3D ));\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\tint[][][] numbers3D = { { {1,2} } , { {3,4} } };\t\n\t\t\n\t\t\n\t\t\n\t//\t4 dimensional array contains multiple 3 dimensional arrays\n\tint[][][][] numbers4D = { { { {1,2} } , { {3,4} } } , { { {1,2} } , { {3,4} } } };\t\n\t\n\t\n\t\n\t\n\t\t\n\t}", "public static double[][] array1Dto2D(int[] matrixVal) {\n int size = (int) Math.sqrt(matrixVal.length);\n double[][] values = new double[size][size];\n int i, j, k;\n for (i = 0, k = 0; i < size; ++i) {\n for (j = 0; j < size; ++j) {\n values[i][j] = matrixVal[k];\n k++;\n }\n }\n return values;\n }", "public static void main(String[] args) {\n \tRandom m = new Random();\r\nint [][] dArray = new int[3][3];\r\n // 2. use two for loops to set all the elements in the 2D array to\r\n // a different integer\r\n // BE SURE TO USE THE ARRAY'S length VARIABLE\r\n for (int i = 0; i < dArray.length; i++) {\r\n \tfor (int j = 0; j < dArray[i].length; j++) {\r\n\t\t\t\tdArray[i][j] = m.nextInt(9)+1;\r\n\t\t\t}\r\n\t\t}\r\n // 3. print the third element from the second 1D array (2DArray[1][2])\r\nSystem.out.println(dArray[1][2]);\r\n // 4. set the third element from the second 1D array to a different\r\n // value\r\ndArray[1][2] = 10;\r\n // 5. print the element again and verify the value has changed\r\nSystem.out.println(dArray[1][2]);\r\n }", "public static void main(String[] args) {\n\t\t\r\n\t\tint[][] arr=new int[][]{{21,22},{32,25},{25,58}};\r\nfor (int i = 0; i < arr.length; i++) {\r\n\tfor (int j = 0; j < 2; j++) {\r\n\t\tSystem.out.println(arr[i][j]+\" \");\r\n\t\t\r\n\t}\r\n\tSystem.out.println(\" \");\r\n\t\r\n}\r\n//int[][][] arr2=new int[][][] {{{10,12},{30}},{{30,15},{80}}};\r\n//for (int i = 0; i < arr2.length; i++) {\r\n//\tfor (int j = 0; j < 2; j++) {\r\n//\t\tfor (int j2 = 0; j2 < 3; j2++) {\r\n//\t\t\tSystem.out.println(arr2[i][j][j2]+\" \");\r\n//\t\t\t\r\n//\t\t}\r\n//\t\tSystem.out.println(\" \");\r\n//\t\t\r\n//\t}\r\n//\t\r\n//}\r\n\t}", "public int getElementArray2(int index)\n {\n return array2[index];\n }", "public int[] create1DArrayFrom2D(int[][] array2D) {\r\n\t\t//printArray2D(array2D);\r\n\t\tint[] array1D = new int[array2D.length * array2D[0].length];\r\n\t\tfor (int i = 0; i < array2D.length; i++) {\r\n\t\t\tfor (int j = 0; j < array2D[i].length; j++) {\r\n\t\t\t\t//System.out.println(\"i: \"+i+\" j: \"+j+\" length: \"+array2D[0].length);\r\n\t\t\t\tarray1D[i * array2D[0].length + j] = array2D[i][j];\r\n\t\t\t}\r\n\t\t}\r\n\t\t//printArray1D(array1D);\r\n\t\treturn array1D;\r\n\t}", "private static void demoMultiDArrays() {\r\n\t\tint[][] nums = new int[3][5];\r\n\t\tnums[0][2] = 10;\r\n//\t\tcompact, hard to read version: **note: slower. its worse in every way.**\r\n//\t\tnums[nums.length-1][nums[nums.length-1].length-1] = 14;\r\n\t\tint lastRow = nums.length-1;\r\n\t\tint lastCol = nums[lastRow].length-1;\r\n\t\tnums[lastRow][lastCol] = 14;\r\n//\t\tcompact, hard to read version: **note: slower. its worse in every way.**\r\n//\t\tnums[0][0] = nums[0][2] + nums[nums.length-1][nums[nums.length-1].length-1];\r\n\t\tnums[0][0] = nums[0][2]+nums[lastRow][lastCol];\r\n\t\t\r\n\t\t//return length of the cols in nums\r\n\t\t//return the length of the rows in nums\r\n\t\tfor (int[] rowData : nums) {\r\n\t\t\tSystem.out.print(\"[\");\r\n\t\t\tfor (int colData : rowData) {\r\n\t\t\t\tSystem.out.print(colData);\r\n\t\t\t\tSystem.out.print(\",\\t\");\r\n\t\t\t}\r\n\t\t\tSystem.out.println(\"], \");\r\n\t\t}\r\n\t\t\r\n\t}", "public static int[] twoToOne(int[][] two_board){\n int[] one_board = new int[24];\n int i=0;\n for(int row=0; row<ROW; row++){\n for(int column = 0; column < COLUMN; column++){\n one_board[i] = two_board[row][column];\n i++;\n }\n }\n return one_board;\n }", "private double[][] createTwoDArray(double[][] result, double[][] observed){\n //set up an array to hold the new merged data\n //the fist dimension is only 2 elements, one for each of the \n //arrays to be merged\n double[][] d = new double[2][result.length * result[0].length];\n \n //create an int counter to keep track of the index value for the \n //new array \n int index = 0;\n //cycle through both dimensions for the results and observed\n for (int i = 0; i < result.length; i++) {\n for (int j = 0; j < result[i].length; j++) {\n //add the values into the new array\n //observed in dimension 1\n d[0][index] = observed[i][j];\n //result in dimension 2\n d[1][index] = result[i][j];\n //inrement the index for the new array\n index++;\n }\n }\n //return the new 2D array\n return d;\n }", "private int[][] convertToTwnDimensionMatrix(int[] oneDimensionMatrix, int varNum)\r\n\t{\r\n\t\t// oneDimensionMatrix: the one dimension matrix that you want to convert:\r\n\t\t// matrixSize: the size (equals to the row or the column length) of the two dimension matrix of the result\r\n\t\tint[][] result = new int[varNum][varNum];\r\n\t\t\r\n\t\tfor (int m = 0; m < varNum; m++)\r\n\t\t{\r\n\t\t\tfor (int n = 0; n < varNum; n++)\r\n\t\t\t{\r\n\t\t\t\tresult[m][n] = oneDimensionMatrix[m*varNum + n];\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t return result;\r\n\t}", "public int getElementArray1(int index)\n {\n return array1[index];\n }", "static Map<Integer, int[][]> subArray(int[][] entry, int numberOfZone) {\n Map<Integer, int[][]> map = new HashMap<>();\n int sqrt = (int) Math.sqrt(numberOfZone);\n int size = entry.length / sqrt;\n for (int i = 0; i < numberOfZone; i++) {\n int[][] na = new int[size][size];//TODO Here is the first problem for array size multiple of threads. if fix be careful to fix other double For that are not using image[0].length but image.length\n for (int x = 0; x < size; x++) {\n System.arraycopy(entry[x + size * (i % sqrt)], size * (i / sqrt), na[x], 0, size);\n }\n map.put(i, na);\n }\n return map;\n }", "public interface Array2D {\n}", "public void mixColumns(int[][] arr) {//method for mixColumns\n int[][] tarr = new int[4][4];\n for (int i = 0; i < 4; i++) {\n System.arraycopy(arr[i], 0, tarr[i], 0, 4);\n }\n for (int i = 0; i < 4; i++) {\n for (int j = 0; j < 4; j++) {\n arr[i][j] = mcHelper(tarr, galois, i, j);\n }\n }\n }", "public static double[][] array1Dto2D(Integer[] matrixVal) {\n int size = (int) Math.sqrt(matrixVal.length);\n double[][] values = new double[size][size];\n int i, j, k;\n for (i = 0, k = 0; i < size; ++i) {\n for (j = 0; j < size; ++j) {\n values[i][j] = matrixVal[k];\n k++;\n }\n }\n return values;\n }", "static int[][] getColumns(int[] array){\n int[][] rezultArray = new int[n][n];\n int index = 0;\n for (int i = 0; i < n; i++){\n for (int j = i; j < n * n; j += n){\n rezultArray[i][index++] = array[j];\n }\n index = 0;\n }\n return rezultArray;\n }", "private int[] convertToOneDimensionMatrix(int[][] twoDimensionMatrix, int varNum)\r\n\t{\r\n\t // twoDimensionMatrix: the two dimension matrix that you want to convert\r\n\t\t// varNum: the size (equals to the row or the column length) of the two dimension matrix \r\n\t\t\r\n\t\t// length: the total number of units of the two dimension matrix that you want to convert:\r\n\t\tint length = varNum * varNum;\r\n\t\t\r\n\t\t// tempArrayList: store the result in the format of ArrayList, then convert it to int[]:\r\n\t\tArrayList <Integer> tempArrayList = new ArrayList<Integer>();\r\n\t\t\r\n\t\t// result (one dimensional)\r\n\t\tint[] result = new int[length];\r\n\t\t\r\n\t\tfor(int m = 0; m < varNum; m++)\r\n\t\t{\r\n\t\t\tfor(int n = 0; n < varNum; n++)\r\n\t\t\t{\r\n\t\t\t\ttempArrayList.add(twoDimensionMatrix[m][n]);\r\n\t\t\t}\r\n\t\t}\r\n\t\t// convert the tempArrayList to int[]:\r\n\t\tfor (int i = 0; i < tempArrayList.size(); i++)\r\n\t\t{\r\n\t\t\tresult[i] = tempArrayList.get(i);\r\n\t\t}\r\n\t\t\r\n\t\treturn result;\r\n\t\t\r\n\t}", "@Test\n public void testCreateRowIndices1(){\n\n double[][] input = new double[4][3];\n int[][] myIndices = HarderArrayProblems.createRowIndices(input);\n assertEquals(0, myIndices.length);\n assertEquals(0, myIndices[0].length);\n }", "public native long[][] __long2dArrayMethod( long __swiftObject, long[][] arg );", "public static void main(String[] args) {\n\r\nint sale[][][] = new int[][][] {{{1,2,3,4},{5,6,7,8}},{{9,10,11,12,13},{14,15,16,17}}};\r\n\r\nfor(int i=0; i<2; i++)\r\n\tfor(int j=0; j<2; j++)\r\n\t\tfor( int k=0; k<2; k++)\r\n\t\t\tSystem.out.println(sale[i][j][k]);\r\n\r\n\r\n\t}", "private static short[][] tempArray(short[] arr, int N) {\n short[][] result = new short[N][N];\n int k = 0;\n for (int i = 0; i < N; i++)\n for (int j = 0; j < N; j++)\n result[i][j] = arr[k++];\n return result;\n }", "private int xyTo1D(int i, int j) {\n return (mGridSize * (i - 1) + j);\n }", "public static void main(String[] args) {\n\t\tint ma[][] = new int[3][2];\n\t\t//how to print multi-dimentional array\n\t\tSystem.out.println(Arrays.deepToString(ma)); //[ [0, 0], [0, 0], [0, 0] ]\n\t\t\n\t\t//how to assing values to the elements\n\t\tma[0][1] = 2;\n\t\tSystem.out.println(Arrays.deepToString(ma)); //[ [0, 2], [0, 0], [0, 0] ]\n\t\t\n\t\tma[2][0] = 5;\n\t\tSystem.out.println(Arrays.deepToString(ma)); //[ [0, 2], [0, 0], [5, 0] ]\n\t\t\n\t\tma[0][0] = 1;\n\t\tSystem.out.println(Arrays.deepToString(ma)); //[ [1, 2], [0, 0], [5, 0] ]\n\t\t\n\t\tma[1][0] = 3;\n\t\tSystem.out.println(Arrays.deepToString(ma)); //[ [1, 2], [3, 0], [5, 0] ]\n\t\t\n\t\tma[1][1] = 4;\n\t\tSystem.out.println(Arrays.deepToString(ma)); //[ [1, 2], [3, 4], [5, 0] ]\n\t\t\n\t\tma[2][1] = 6;\n\t\tSystem.out.println(Arrays.deepToString(ma)); //[ [1, 2], [3, 0], [5, 6] ]\n\t\t\n\t\tint maa[][] = { {1}, {3, 4}, {5, 6, 7} };\n\t\tSystem.out.println(Arrays.deepToString(maa));\n\t\t\n\t\t//how to print a specific inner arrays on the console\n\t\tSystem.out.println(Arrays.toString(maa[1])); //[3,4]\n\t\t\n\t\t// how to print a specific element in a multidimentioanl array\n\t\tSystem.out.println(maa[2][1]); // 6\n\t\t\n\t\t// How to print all elements one by one on the console in the same line with aa \"*\" at the beginning \n\t\t//of very elemnt\n\t\t\n\t\tfor(int i=0; i<maa.length; i++) {\n\t\t\t\n\t\t\tfor (int k=0; k<maa[i].length; k++) {\n\t\t\t\tSystem.out.print(\"*\" + maa[i][k]); //*1*3*4*5*6*7\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println();\n\t\t\n\t\t//How to find the product of all elements in the array \"maa\"\n\n\t\tint product = 1; // for addition begin with 1\n\t\tfor(int i=0; i<maa.length; i++) {\n\t\t\tfor(int k=0; k<maa[i].length; k++) {\n\t\t\t\tproduct = product * maa[i][k];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"The product of all elements: \" + product); //The product of all elements: 2520\n\t\t\n\t\t// How to find the sum of all elements (Homework)\n\t\t\n\t\tint sum = 0; // for sum begin with 0\n\t\tfor(int i=0; i<maa.length; i++) {\n\t\t\tfor(int k=0; k<maa[i].length; k++) {\n\t\t\t\tsum = sum + maa[i][k];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"The sum of all elements: \" + sum); //The sum of all elements: 26\n\t\t\n\n\t\t//yeni bi array yaz otomatik\n\t\tint count=1;\n\t\t\tfor(int i=0;i<3;i++) {\n\t\t\tfor(int k=0;k<2;k++) {\n\t\t\t\tma[i][k]=count;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(Arrays.deepToString(ma)); //[[1, 2], [3, 4], [5, 6]]\n\t\n\t\t \n\t}", "private int getSumD1(int[][] a) {\n int sum = 0;\n for (int j = 0; j < a.length; j++) {\n sum += a[j][j];\n }\n return sum;\n }", "@SuppressWarnings(\"unused\")\n\tpublic static void main(String[] args) {\n\n\t\tint[] myArray = new int[2];\n\t\tmyArray[0] = 1;\n\t\tmyArray[1] = 2;\n\n\t\t// 2D array symmetrical\n\n\t\tint[][] array2d = new int[2][4]; // 2 rows and 4 columns\n\t\tint another2dArray[][] = new int[2][4];\n\n\t\tint[] other2dArray[] = new int[2][4]; // Valid 2 dimensional array\n\n\t\t// 2D Asymmetrical array declaration\n\n\t\tString[][] myAsymmetricalAray = new String[][] { \n\t\t\t { \"One\", \"Two\" }, \t\t\t\t // 1st row 2 columns\n\t\t\t\t{ \"Three\", \"Four\", \"Five\" }, \t\t // 2nd row 3 columns\n\t\t\t\t{ \"Six\", \"Seven\", \"Eight\", \"Nine\" }, // 3rd row with 4 columns\n\t\t\t\tnull\n\n\t\t};\n\n\t\t// Para cada primeira dimensão, existe um número variável para a segunda\n\t\t// dimensão\n\t\t// Isso não seria possível iniciando o array da forma fixa tradicional\n\n\t\t// [0] -> 2 colunas\n\t\t// [1] -> 3 colunas\n\t\t// [2] -> 4 colunas\n\n\t\tSystem.out.print(myAsymmetricalAray[0][0] + \" \");\n\t\tSystem.out.print(myAsymmetricalAray[0][1] + \" \");\n\t\tSystem.out.println();\n\n\t\tSystem.out.print(myAsymmetricalAray[1][0] + \" \");\n\t\tSystem.out.print(myAsymmetricalAray[1][1] + \" \");\n\t\tSystem.out.print(myAsymmetricalAray[1][2] + \" \");\n\t\tSystem.out.println();\n\n\t\tSystem.out.print(myAsymmetricalAray[2][0] + \" \");\n\t\tSystem.out.print(myAsymmetricalAray[2][1] + \" \");\n\t\tSystem.out.print(myAsymmetricalAray[2][2] + \" \");\n\t\tSystem.out.print(myAsymmetricalAray[2][2] + \" \");\n\n\t\t// 3D Array\n\t\tint[][][] array3D = new int[3][3][3];\n\t\tint oneMorearray3D[][][] = new int[3][3][3];\n\t\t\n\n\t\tint[] oneMorearray3D2[][] = new int[3][3][3]; // very confusing but legal declaration\n\n\t\t// Initialization\n\t\tint[][][] threeDArray = { \n\t\t\t\t{ { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }, \t\t\t//Page 1\n\t\t\t\t{ { 10, 11, 12 }, { 13, 14, 15 }, { 16, 17, 18 } }, //Page 2\n\t\t\t\t{ { 19, 20, 21 }, { 22, 23, 24 }, { 25, 26, 27 } } //Page 3\n\t\t\t\t\n\t\t};\n\n\t}", "public static void main(String[] args) {\n\t\tint[][] no1 = {{1,2,3},{4,5,6}};\r\n\t\t\r\n\t\tint[][] no2 = new int[3][2];\r\n\t\t\r\n\t\tfor(int[]arr : no1) {\r\n\t\t\tSystem.out.println(Arrays.toString(arr));\r\n\t\t}\r\n\t\tfor(int i=0; i<no2.length; i++) {\r\n\t\t\tfor(int j=0; j<no2[i].length; j++) {\r\n\t\t\t\tno2[i][j] = no1[j][i];\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tSystem.out.println();\r\n\t\tfor(int[]arr : no2) {\r\n\t\t\tSystem.out.println(Arrays.toString(arr));\r\n\t\t}\r\n\t}", "public native boolean[][] __boolean2dArrayMethod( long __swiftObject, boolean[][] arg );", "public static void print2DArray(int input[][]) {\n int m = input.length;\n if (m == 0)\n return;\n int n = input[0].length;\n\n for (int i = 0; i < m; i++) {\n int k = i;\n while (k < m) {\n for (int j = 0; j < n; j++) {\n System.out.print(input[i][j] + \" \");\n }\n k++;\n System.out.println();\n }\n }\n }", "protected abstract NDArray[] onMatrix(NDArray matrix);", "private int[][] convertTo2D(char[] array1D)\n {\n int n = (int) Math.sqrt(array1D.length);\n int[][] array2D = new int[n][n];\n \n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < n; j++)\n {\n array2D[i][j] = (int) (array1D[i * n + j]);\n }\n }\n \n return array2D;\n }", "public int[][] create2DArrayFrom1D(int[] array1D, int height, int width) {\r\n\t\t//printArray1D(array1D);\r\n\t\tint[][] array2D = new int[height][width];\r\n\t\tfor (int i = 0; i < height; i++) {\r\n\t\t\tfor (int j = 0; j < width; j++) {\r\n\t\t\t\t//System.out.println(\"i: \"+i+\" j: \"+j+\" width: \"+width);\r\n\t\t\t\tarray2D[i][j] = array1D[i * width + j];\r\n\t\t\t}\r\n\t\t}\r\n\t\t//printArray2D(array2D);\r\n\t\treturn array2D;\r\n\t}", "int[] populateArray(int[] firstArr,int[] secondArr){\n\t\tlength = firstArr.length + secondArr.length; //Getting length of the resultant array\n\t\tresultArr = new int[length]; //set resultant array length\n\t\tfor(kCounter = 0 ; kCounter < length; kCounter++){\n\t\t\t//checking index of the array is even or odd\n\t\t\tif(kCounter % 2 == 0){\n\t\t\t\tresultArr[kCounter] = secondArr[iCounter]; //if position is even then add element to even index\n\t\t\t\tiCounter++;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tresultArr[kCounter] = firstArr[jCounter]; //if position is odd then add element to odd index\n\t\t\t\tjCounter++;\n\t\t\t}\n\t\t}\n\t\treturn resultArr;\n\t}", "private void recompose(int[][] array,int[][] red,int[][] green,int[][] blue){\n\t\tfor(int i=0;i<array.length;i++){\n\t\t\tfor(int j=0;j<array[0].length;j++){\n\t\t\t\tarray[i][j]=GImage.createRGBPixel(red[i][j],green[i][j],blue[i][j]);\n\t\t\t}\n\t\t}\n\t\t//Your code ends here\n\t}", "static int[][] unite4arrays(Map<Integer, int[][]> map, int size) {\n int sqrt = (int) Math.sqrt( map.keySet().size());\n int[][] result = new int[size * sqrt][size * sqrt];\n for (int i = 0; i < map.keySet().size(); i++) {\n\n for (int x = 0; x < size; x++) {\n for (int y = 0; y < size; y++) {\n result[x + size * (i % sqrt)][y + size * (i / sqrt)] = map.get(i)[x][y];\n }\n }\n\n }\n return result;\n }", "public static void main(String[] args) {\n\r\n\t\tString[] Array1D = {\"THIS IS A NEW ARRAY\", \"AND THE SECOND VALUE\"};\r\n\r\n\t\tSystem.out.println(\"Arrays: \"+Arrays.toString(Array1D));\r\n\t\t\r\n\t\tString[][] Array2D = {\r\n\t\t\t\t{\"THIS IS A NEW ARRAY 1 \", \"AND THE SECOND VALUE 1 \"},\r\n\t\t\t\t{\"THIS IS A NEW ARRAY 2\", \"AND THE SECOND VALUE 2 \"},\r\n\t\t\t\t{\"THIS IS A NEW ARRAY 3 \", \"AND THE SECOND VALUE 3 \"},\r\n\t\t\t\t{\"THIS IS A NEW ARRAY 4\", \"AND THE SECOND VALUE 4\"},\r\n\t\t};\r\n\r\n\t\tfor(String i: Array1D)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"i: \"+i);\r\n\t\t}\r\n\t\t\r\n\t\tfor(String[] i: Array2D)\r\n\t\t{\r\n\t\t\tfor(String j: i)\r\n\t\t\t{\r\n\t\t\t\tSystem.out.println(\"i:\"+i.hashCode()+\" j: \"+j);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void myMethod(int[][] a){\n\t\t\t…\n\t\t}", "protected int xyTo1D(final int i, final int j) {\n return i * m + j;\n }", "@SuppressWarnings(\"unchecked\")\n\tprivate void flatten(Object partOfArrayDim, T[] flat, int position, int[] counter) {\n\t\tif (partOfArrayDim == null || partOfArrayDim.getClass().isArray() == false) {\n\t\t\tthrow new IllegalArgumentException(\"\"+partOfArrayDim);\n\t\t}\n\t\t// if in last dimension, only there you can set values\n\t\tif (position == size.length-1) {\n\t\t\tfor (Object o : (Object[]) partOfArrayDim) {\n\t\t\t\tflat[counter[0]++] = (T) o;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tfor (Object o : (Object[]) partOfArrayDim) {\n\t\t\tflatten(o, flat, position+1, counter);\n\t\t}\n\n\t}", "@Override public double atd_impl(int idx) {\n if( null==_fact ) return _c[0].atd(idx); // simple wrapping of 1 vec\n _t.reset();\n for(int i = 0; i < _c.length; i++)\n _t.setInput(i, _c[i].atd(idx));\n return _t.apply(); // Make the call per-row\n }", "public static void main (String[] args) {\n int[][] twoD = new int[3][4];\n// Where x is an integer\n// [[x, x, x, x],\n// [x, x, x, x],\n// [x, x, x, x]]\n\n// int[][][] threeD = new int[3][4][3];\n\n// 4x3\n int[][] twoDInit = {{1, 3, 5}, {4, 3, 5}, {1, 4, 5}, {4, 3, 5}};\n\n for (int i = 0; i < twoDInit.length; i++) {\n for (int j = 0; j < twoDInit[i].length; j++) {\n System.out.println(twoDInit[i][j]);\n }\n }\n\n for (int[] ints : twoDInit) {\n for (int anInt : ints) {\n System.out.println(anInt);\n }\n }\n\n for (int i = 0; i < 5; i++) {\n for (int j = 0; j < 7; j++) {\n System.out.print(\"*\");\n }\n System.out.println();\n }\n\n for (int i = 0; i < 5; i++) {\n for (int j = 0; j < i + 1; j++) {\n System.out.print(\"*\");\n }\n System.out.println();\n }\n }", "private void indirectArrayCopy(int[] src, int[] ptr, int[] dst) {\n\t\tfor (int i = 0, len = ptr.length; i < len; i++) {\n\t\t\tdst[i] = src[ptr[i]];\n\t\t}\n\t}", "public static void main(String[] args) {\r\n\t\t// creating 2D array\r\n//\t\tchar arrayCharacter[][] = new char[5][2];\r\n//\t\t// inserting values in it\r\n//\t\t//1st row\r\n//\t\tarrayCharacter[0][0] = 'a';\r\n//\t\tarrayCharacter[0][1] = 'b';\r\n//\t\t//2nd row\r\n//\t\tarrayCharacter[1][0] = 'c';\r\n//\t\tarrayCharacter[1][1] = 'd';\r\n//\t\t//3rd row\r\n//\t\tarrayCharacter[2][0] = 'e';\r\n//\t\tarrayCharacter[2][1] = 'f';\r\n//\t\t//4th row\r\n//\t\tarrayCharacter[3][0] = 'g';\r\n//\t\tarrayCharacter[3][1] = 'h';\r\n//\t\t//5th row\r\n//\t\tarrayCharacter[4][0] = 'i';\r\n//\t\tarrayCharacter[5][1] = 'j';\r\n\t\t\r\n\t\tchar arrayCharacter[][] = {{'a','b'},{'c','d'},{'e','f'},{'g','h'},{'i','j'}};\r\n\t\t\r\n//\t\tSystem.out.println(arrayCharacter[3][1]);\r\n//\t\tSystem.out.println(arrayCharacter[0][0]+\" \"+arrayCharacter[4][1]);\r\n\t\t\r\n//\t\tSystem.out.println(\"Number of rows: \"+arrayCharacter.length); // number of rows\r\n//\t\tSystem.out.println(\"Number of column: \"+arrayCharacter[0].length); // number of columns\r\n\t\t\r\n\t\t// traversing into 2D array -> using 2 for loops: 1st for loop for row & 2nd for loop or column\r\n//\t\tfor(int i=0;i<arrayCharacter.length; i++) { // traverses through rows\r\n//\t\t\tfor(int j=0; j<arrayCharacter[i].length; j++) { // traverses through column\r\n//\t\t\t\tSystem.out.print(arrayCharacter[i][j]+\"|\");\r\n//\t\t\t}\r\n//\t\t}\r\n\t\t\r\n\r\n\t\tint arrayInt[][] = {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15}};\r\n\t\t\r\n\t\tSystem.out.println(\"Number of rows: \"+arrayInt.length); // number of rows\r\n\t\tSystem.out.println(\"Number of column: \"+arrayInt[0].length); // number of columns\r\n\t\t\r\n\t\tfor(int i=0;i<arrayInt.length; i++) { // traverses through rows\r\n\t\t\tfor(int j=0; j<arrayInt[i].length; j++) { // traverses through column\r\n\t\t\t\tSystem.out.print(arrayInt[i][j]+\"|\");\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\t// Assignment:\r\n//\t\t\t1. 1D array => FirstName, LastName, DOB, Age then traverse through using both for & while loop to extract data\r\n//\t\t\t2. 2D array => Customer Name, email address, phone number then traverse through it using for loop to extract data -> try while as well\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\r\n\t}", "@Test\n public void testCreateTranspose2(){\n double[][] a = new double[5][5];\n for(int i = 0 ; i < a.length ; i++){\n for(int j = 0 ; j < a[0].length ; j++){\n a[i][j] = Math.random();\n }\n }\n double[][] newA = HarderArrayProblems.createTranspose(a);\n checkTranspose(a, newA);\n }", "private static void fillArray(int[][] array) {\n for (int i = 0; i < array.length; i++)\n for (int j = 0; j < array[i].length; j++)\n array[i][j] = i + j;\n\n // The following lines do nothing\n array = new int[1][1];\n array[0][0] = 239;\n }", "public native float[][] __float2dArrayMethod( long __swiftObject, float[][] arg );", "private Board swapTiles1d(short[] swap1, short[] swap2) {\n short[][] arr = tempArray(arr1d, N);\n int[][] tempTiles = new int[N][N];\n for (int i = 0; i < N; i++)\n for (int j = 0; j < N; j++)\n tempTiles[i][j] = (int) arr[i][j];\n int temp = tempTiles[swap1[0]][swap1[1]];\n tempTiles[swap1[0]][swap1[1]] = tempTiles[swap2[0]][swap2[1]];\n tempTiles[swap2[0]][swap2[1]] = temp;\n return new Board(tempTiles);\n }", "@Test\r\n\tvoid deepArrayCopyElementsMultiDim() {\r\n\t\tInteger[][] intArr = new Integer[10][];\r\n\t\tfor (int i = 0; i < 10; i++) {\r\n\t\t\tintArr[i] = new Integer[4];\r\n\t\t\tfor (int j = 0; j < 4; j++) {\r\n\t\t\t\tintArr[i][j] = 1;\r\n\t\t\t}\r\n\t\t}\r\n\t\tInteger[][] clone = ArrayUtil.deepArrayCopy(intArr);\r\n\t\tassertTrue(Arrays.deepEquals(intArr, clone));\r\n\t}", "private E getFromArray(int i, int j) {\r\n\t\treturn mElements.get(j*mRowCount+i);\r\n\t}", "private static BigInteger[][] multiply (BigInteger a[][], BigInteger b[][])\n {\n BigInteger x = (a[0][0].multiply(b[0][0])).add(a[0][1].multiply(b[1][0]));\n BigInteger y = (a[0][0].multiply(b[0][1])).add(a[0][1].multiply(b[1][1]));\n BigInteger z = (a[1][0].multiply(b[0][0])).add(a[1][1].multiply(b[1][0]));\n BigInteger w = (a[1][0].multiply(b[0][1])).add(a[1][1].multiply(b[1][1]));\n \n return new BigInteger[][]{{x, y},{z, w}};\n }", "public static void main(String[] args)\n {\n int[][] ints;\n int[][] ints1;\n\n\n\n\n ints = new int[][]{\n {1, 2, 3, 4, 5, 6, 7, 8, 9},\n {10, 11, 12, 13, 14, 15, 16, 17, 18},\n {19, 20, 21, 22, 23, 24, 25, 26, 27},\n {28, 29, 30, 31, 32, 33, 34, 35, 36},\n {37, 38, 39, 40, 41, 42, 43, 44, 45},\n {46, 47, 48, 49, 50, 51, 52, 53, 54},\n {55, 56, 57, 58, 59, 60, 61, 62, 63},\n {64, 65, 66, 67, 68, 69, 70, 0, 71},\n {73, 74, 75, 76, 77, 78, 79, 80, 72}\n };\n\n ints = new int[][]{\n {1,0},\n {2,3},\n };\n ints1 = new int[][]{\n {1, 2, 3},\n {4, 5, 6},\n {7, 0, 8}\n };\n\n ints1 = new int[][]{\n {1, 2, 3},\n {4, 8, 5},\n {7, 0, 6}\n };\n ints = new int[][]{\n {5, 0, 4},\n {2, 3, 8},\n {7,1,6}\n };\n ints1 = new int[][]{\n {1, 6, 4},\n {7, 0, 8},\n {2, 3, 5}\n };\n\n ints1 = new int[][]{\n {6, 0, 5},\n {8, 7, 4},\n {3, 2, 1}\n };\n ints1 = new int[][]{\n {11, 0, 4, 7},\n {2, 15, 1, 8},\n {5, 14, 9, 3},\n {13, 6, 12, 10 }\n };\n\n\n ints1 = new int[][]{\n {14, 13, 5, 3},\n {0, 1, 8, 12},\n {6, 2, 4, 10},\n {11, 9, 15, 7 }\n };\n\n ints1 = new int[][]{\n {8, 4, 7},\n {1,5,6},\n {3,2,0}\n };\n\n\n ints1 = new int[][]{\n {8, 4, 7},\n {1,5,6},\n {3,2,0}\n };\n\n\n ints = new int[][]{\n {1, 2, 3},\n {4, 6,5},\n {7, 8,0}\n };\n ints1 = new int[][]{\n {8, 4, 7},\n {1,5,6},\n {3,2,0}\n };\n ints = new int[][]{\n {1,0},\n {2,3},\n };\n System.out.println(System.currentTimeMillis());\n Board board = new Board(ints);\n Solver solution = new Solver(board);\n\n for (Board el :solution.solution())\n {\n System.out.println(el);\n }\n System.out.println(System.currentTimeMillis());\n\n\n }", "public native double[][] __double2dArrayMethod( long __swiftObject, double[][] arg );", "public static void display2dArray(int [][] arr){\n for (int i = 0; i < arr.length; i++){ \n System.out.println(Arrays.toString(arr[i]));\n }\n \n // the iterative approach\n for (int i = 0; i < arr.length; i++){\n for (int j = 0; j < arr[i].length; j++){\n System.out.print(arr[i][j]+ \" \");\n }\n System.out.println();\n }\n System.out.println();\n }", "public int x (int index) { return coords[index][0]; }", "public static void initTwoD(int[][] array) {\n System.out.println(\"Entering random numbers in matrix of \" + array.length + \" rows and \" + array[0].length + \" columns: \");\n for (int row = 0; row < array.length; row++) {\n for (int column = 0; column < array[0].length; column++) {\n array[row][column] = (int) (Math.random() * 100);\n }\n }\n\n }", "public Matrix extract(){\r\n\t\t\r\n\t\tDouble[][] newVal = new Double[col][row - 1];\r\n\t\t\r\n\t\tfor(Double[] row: AllVal){\r\n\t\t\t\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t}", "public static String[][][] holoport(String[][][] A, String[][][] B) {\n if (A.length <= B.length) {\n\n for (int i = 0; i < A.length; i++) {\n //B[i] = A[i];\n if (A[i].length <= B[i].length) {\n for (int j = 0; j < A[i].length; j++) {\n //B[i][j] = A[i][j];\n if (A[i][j].length < B[i][j].length) {\n for (int k = 0; k < A[i][j].length; k++) {\n B[i][j][k] = A[i][j][k];\n //System.out.println(B[i][j][k]);\n }\n }\n else {\n for (int k = 0; k < B[i][j].length; k++) {\n if (i <= A[i][j].length) {\n B[i][j][k] = A[i][j][k];\n }\n else {\n B[i][j][k] = \"$$$$$$\";\n }\n }\n }\n }\n }\n else {\n for (int j = 0; j < B[i].length; j++) {\n if (A[i][j].length < B[i][j].length) {\n for (int k = 0; k < A[i][j].length; k++) {\n B[i][j][k] = A[i][j][k];\n //System.out.println(B[i][j][k]);\n }\n }\n else {\n for (int k = 0; k < B[i][j].length; k++) {\n if (i <= A[i][j].length) {\n B[i][j][k] = A[i][j][k];\n }\n else {\n B[i][j][k] = \"$$$$$$\";\n }\n }\n\n }\n }\n }\n }\n }\n else {\n for (int i = 0; i < B.length; i++) {\n //B[i] = A[i];\n if (A[i].length <= B[i].length) {\n for (int j = 0; j < A[i].length; j++) {\n //B[i][j] = A[i][j];\n if (A[i][j].length < B[i][j].length) {\n for (int k = 0; k < A[i][j].length; k++) {\n B[i][j][k] = A[i][j][k];\n //System.out.println(B[i][j][k]);\n }\n }\n else {\n for (int k = 0; k < B[i][j].length; k++) {\n if (i <= A[i][j].length) {\n B[i][j][k] = A[i][j][k];\n }\n else {\n B[i][j][k] = \"$$$$$$\";\n }\n }\n }\n }\n }\n else {\n for (int j = 0; j < B[i].length; j++) {\n if (A[i][j].length < B[i][j].length) {\n for (int k = 0; k < A[i][j].length; k++) {\n B[i][j][k] = A[i][j][k];\n //System.out.println(B[i][j][k]);\n }\n }\n else {\n for (int k = 0; k < B[i][j].length; k++) {\n if (i <= A[i][j].length) {\n B[i][j][k] = A[i][j][k];\n }\n else {\n B[i][j][k] = \"$$$$$$\";\n }\n }\n\n }\n }\n }\n }\n }\n //fill array with $ when nothing is put into those spots\n for (int i = 0; i < B.length; i++) {\n for (int j = 0; j < B[i].length; j++) {\n for (int k = 0; k < B[i][j].length; k++) {\n if (B[i][j][k] == null) {\n B[i][j][k] = \"$$$$$$\";\n }\n }\n }\n }\n //return filled array with old array and $\n return B;\n\n }", "@Test\n public void testCreateTranspose1(){\n double[][] a = new double[1][1];\n a[0][0] = Math.random();\n double[][] newA = HarderArrayProblems.createTranspose(a);\n checkTranspose(a, newA);\n }", "public void setTwoDarray(double[][] aarray){\r\n\t\tif(this.nrow != aarray.length)throw new IllegalArgumentException(\"row length of this Matrix differs from that of the 2D array argument\");\r\n\t\tif(this.ncol != aarray[0].length)throw new IllegalArgumentException(\"column length of this Matrix differs from that of the 2D array argument\");\r\n\t\tfor(int i=0; i<nrow; i++){\r\n\t\t \tif(aarray[i].length!=ncol)throw new IllegalArgumentException(\"All rows must have the same length\");\r\n \t\t\tfor(int j=0; j<ncol; j++){\r\n \t\t \t\tthis.matrix[i][j]=aarray[i][j];\r\n \t\t\t}\r\n\t\t}\r\n\t}", "public static <T> T[][] clone2DArray(T[][] array) {\r\n\t int rows = array.length ;\r\n\r\n\t //clone the 'shallow' structure of array\r\n\t T[][] newArray = array.clone();\r\n\r\n\t //clone the 'deep' structure of array\r\n\t for(int row = 0 ; row < rows; row++){\r\n\t newArray[row] = array[row].clone();\r\n\t }\r\n\r\n\t return newArray;\r\n\t}", "public Double[][] toPresent() throws IndexOutOfBoundsException;", "public static int[] array(int[] arr1, int[] arr2) {\n\n int[] arr3 = new int[arr1.length + arr2.length]; //now the length = 5\n int j = 0;//will represent indexes of 3rd array\n\n for (int each : arr1) { //1, 2, 3\n arr3[j++] = each;\n }\n\n for (int each : arr2) {\n arr3[j++] = each;\n }\n\n return arr3;\n }", "public static native void OpenMM_3D_DoubleArray_set(PointerByReference array, int index1, int index2, PointerByReference values);", "public test.wsdl.marrays.Foo[][][] testFooArray(test.wsdl.marrays.Foo[][][] in) throws java.rmi.RemoteException {\n for (int i=0; i < in.length; i++) {\n Foo[][] array2 = in[i];\n if (array2 != null)\n for (int j=0; j < array2.length; j++) {\n Foo[] array3 = array2[j];\n if (array3 != null)\n for (int k=0; k <array3.length; k++) {\n if (array3[k].getValue() == i + 10*j + 100*k)\n array3[k].setValue(i + 10*j + 100*k + 1000);\n }\n }\n }\n return in;\n }", "public static int[] getindex(int[] values) {\n\t \n\t \n\t \n\t int[] b = {64,128,192,256};\n\t \n\t int redindex = 0;\n\t int greenindex=0;\n\t int blueindex=0;\n\t \n\t for(int i=0; i<indexlevel8.length;i++) {\n\t if(values[0] <= indexlevel8[i]) { redindex = i; break;}\n\t }\n\t \n\t for(int i=0; i<indexlevel8.length;i++) {\n\t\t if(values[1] <= indexlevel8[i]) { greenindex = i; break;}\n\t\t }\n\t \n\t for(int i=0; i<b.length;i++) {\n\t\t if(values[2] <= b[i]) { blueindex = i; break;}\n\t }\n\t \n\t values[0] = redindex*32+16;\n\t values[1] = greenindex*32+16;\n\t values[2] = blueindex*64+32;\n\t \n\t \n\t return values; // the values of the lookup table for 8bit scale\n }", "public short[][] getIntensity(){ return intensity; }", "public Matrix3D(double[] d1) {\n super(3,3);\n int k = -1;\n for (int i=0 ; i<3 ; i++) { // loop over rows\n for (int j=0 ; j<3 ; j++) { // loop over columns\n k++;\n set(i,j,d1[k]); // d[i][j] = d1[k];\n }\n }\n }", "Nda<V> concatAt( int axis, Nda<V> other, Nda<V>... ndArrays );", "public void duplicateOriginalArray() {\n for (int r=0; r<pixels.length; r++) {\n for (int c=0; c<pixels.length; c++) {\n if (pixels[r][c] == true)\n visited[r][c] = true;\n else\n visited[r][c]= false;\n }\n }\n }", "public static <T> void forEach2DArrayElement(final T[][] array, final Array2DPointAction action) {\n\t\tfor (int y = 0; y < array.length; ++y) {\n\t\t\tfor (int x = 0; x < array[0].length; ++x) {\n\t\t\t\taction.execute(x, y);\n\t\t\t}\n\t\t}\n\t}", "static void updateGrid(int[][] G, int[][][] P){\n \n \n for(int i=1; i<G.length; i++){\n for (int j=1; j<G[i].length; j++){\n if (P[i][j][0]==1){ //if there's only one candidate left in P[i][j][0]\n if (G[i][j]==0){ //double check it's not filled already\n for (int k=1; k<G[i].length; k++){ //enter loop to check the THIRD DIMENSION\n if (P[i][j][k]==1){ //grab the index number of the last candidate\n G[i][j] = k; //SMACK\n }\n }\n }\n }\n \n }\n \n }\n \n \n }", "private static final double[][] doubleArray2d (final List points) {\n final int m = points.size();\n final int n = ((List) points.get(0)).size();\n final double[][] a = new double[m][n];\n for (int i=0;i<m;i++) {\n final List row = (List) points.get(i);\n for (int j=0;j<n;j++) {\n a[i][j] = ((Number) row.get(j)).doubleValue(); } }\n return a; }", "static Matrix vectorize(Matrix input) {\n int m = input.getRowDimension();\n int n = input.getColumnDimension();\n\n Matrix result = new Matrix(m * n, 1);\n for (int p = 0; p < n; p++) {\n for (int q = 0; q < m; q++) {\n result.set(p * m + q, 0, input.get(q, p));\n }\n }\n return result;\n }", "private double[][] a2() {\n double[][] r = a;\n for (int j = 0; j < nBinVars; j++) {\n final int v = intVars[j];\n if (existsBinConstraint(v)) {\n LOG.debug(\"existsBinConstraint\", v);\n this.nBinVars2--;\n continue;\n }\n double[] constraint = new double[n];\n constraint[v - 1] = 1d;\n r = Maths.append(r, constraint);\n }\n return r;\n }", "private int xyTo1D(final int row, final int col) {\n return (row - 1) * size + (col - 1);\n }", "public void redimensionarArray() {\r\n\t\t\r\n\t\tint nuevaCapacidad = tamanioArrayPosicionesCelulas * 2;\r\n\t\t// Copia los arrays originales y les da la nueva capacidad se quiere tener.\r\n\t\tfilasDeCelulas = Arrays.copyOf(filasDeCelulas, nuevaCapacidad);\r\n\t\tcolumnasDeCelulas = Arrays.copyOf(columnasDeCelulas, nuevaCapacidad);\r\n\t\t\r\n\t\t// Actualizamos el valor del array.\r\n\t\ttamanioArrayPosicionesCelulas = nuevaCapacidad;\r\n\t}", "@Test\r\n\tpublic void testArrayPos(){\n\t\tfor(int y=0;y<5;y++){\r\n\t\t\tfor(int x=0;x<5;x++){\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public static <T extends Comparable<? super T>>\r\n \t\t\t\t\t\t boolean find2D(T[][] arr, T key)\r\n {\r\n \tfor(int row=0;row<arr.length;row++) {\r\n \t\tfor(int col=0;col<arr[0].length;col++) {\r\n \t\t\tif(arr[row][col].compareTo(key)==0) {\r\n \t\t\t\treturn true;\r\n \t\t\t}\r\n \t\t}\r\n \t}\r\n \treturn false;\r\n }", "public static void RepeatedElementsRow(int[][] array) {\n\n }", "public native byte[][] __byte2dArrayMethod( long __swiftObject, byte[][] arg );", "public static void transpose(int[][] myArr2D)\n {\n if(isRect(myArr2D)== false)\n {\n System.out.println(\"The array is not a rectangle\");\n }\n else\n {\n for( int row = 0; row < myArr2D.length; row++)\n { \n for( int col = row; col < myArr2D.length; col++)\n { \n int z = myArr2D[row][col];\n myArr2D[row][col] = myArr2D[col][row];\n myArr2D[col][row] = z;\n }\n }\n }\n }", "private static int[] multRow(int[] column)\n\t{\n\t\tint[] result = new int[column.length];\n\t\t\n\t\tfor(int row=0; row<multCon.length; row++)\n\t\t\tfor(int col=0; col<multCon[row].length; col++)\n\t\t\t\tresult[row] ^= galoisMult(multCon[row][col],column[col]);\n\t\t\n\t\treturn result;\n\t}", "public static void main(String[] args) {\n\n String[] days = {\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\",\"Sunday\"}; //String Array\n\n int[] count = {1,2,3,4,5,6,7,8,9,10}; //int Array\n\n //Accessing an array element\n System.out.println(days[2]); //Outputs wednesday 0-6 (0 is inclusive in an array as always)\n\n //Modify individual elements in an array\n days[2] = \"Wed\";\n System.out.println(days[2]);\n\n //Output array length\n System.out.println(days.length); //Outputs the length of the array in digits (7)\n\n //Foreach should be used to loop through an array\n //however you can use a for loop and use the .length as the counter benchmark\n for (int y = 0; y < days.length; y++) {\n System.out.println(days[y]); //Y gives the array element number because it loops through from 0 the same as the arrays start\n }\n\n //MULTI-DIMENSIONAL ARRAYS TOMORROW!\n\n //A multi dimensional array is an array consisting on rows and columns (2d array) - basically a table\n\n int[][] dimArray = {{1,2,3,3,21,3,1,233},{4,5,6,5,6,7,6,4,5,3,4}};\n\n int firstRow = dimArray[0][0]; //Outputs 1 (1st row being the 1st brackets which is 0 (array counts)\n int secondRow = dimArray[1][0]; //Outputs 4 (2nd row being the 2nd brackets which is 0 (array counts)\n\n System.out.println(firstRow);\n System.out.println(secondRow);\n\n String[][] dimArrayMulti = {{\"a\",\"a\",\"a\"},{\"b\",\"b\"},{\"c\",\"c\",\"c\",\"c\",\"c\"}}; //Rows can be infinite, additional brackets\n //Also variable type can be substituted like the example here (String)\n\n System.out.println(dimArrayMulti[0][2] + dimArrayMulti[1][1] + dimArrayMulti[2][3]); //Called upon like this\n\n //How to loop through a multi 2d array\n int multiLoopArray[][] = {{0,0,0,0,0,0},{1,1,1,1,1,1,1,},{2,2,2,2,2,2},{3,3,3,3},{4,4,4,4,4,4,}}; //5 rows\n System.out.println(multiLoopArray.length);\n\n System.out.println(\"This is the multi-loop output START\");\n for (int f = 0; f < multiLoopArray.length; f++) { //Counts the length of the array columns (1st level/dimension)\n for (int g = 0; g < multiLoopArray[f].length; g++) { //Using the index from \"f\" counts the length of the array rows (2nd level/dimension)\n System.out.println(multiLoopArray[f][g]);\n }\n }\n System.out.println(\"This is the multi-loop output END\");\n }", "public static void print2DArr1(int[][] myArr2D)\n {\n for(int row = 0; row < myArr2D.length; row++)\n { \n for( int col = 0; col < myArr2D[row].length; col++)\n {\n if(col == myArr2D[row].length-1)\n System.out.format(\"%4d%n\",myArr2D[row][col]);\n else\n System.out.format(\"%4d\",myArr2D[row][col]);\n }\n }\n }", "private static void merge(int[] array, int[] left, int[] right) {\n\n int i;\n\n for(i = 0; i < left.length; i++) {\n\n array[i] = left[i];\n }\n\n for (int j = 0; j < right.length; j++, i++) {\n\n array[i] = right[j];\n }\n }", "public native char[][] __char2dArrayMethod( long __swiftObject, char[][] arg );", "private Position[] concatArrays(Position[] first, Position[] second)\r\n {\r\n int size = first.length + second.length;\r\n Position[] a = new Position[size];\r\n int pt = 0;\r\n\r\n for (Position tmpPos : first)\r\n {\r\n a[pt] = tmpPos;\r\n pt++;\r\n }\r\n\r\n for (Position tmpPos : second)\r\n {\r\n a[pt] = tmpPos;\r\n pt++;\r\n }\r\n\r\n return a;\r\n }", "void locate(int pos, int [] ind)\n\t{\n\t\tind[0] = (int) pos / dimy; // x\n\t\tind[1] = pos % dimy; // y\t\n\t}", "private String[][] twoDArray(LinkedList<QuadTree> Linked) {\n if (Linked.size() < 1) {\n return new String[0][0];\n } else if (Linked.size() == 1) {\n return new String[1][1];\n } else {\n int rowCount, columnCount;\n Set<Double> count = new HashSet<>();\n for (QuadTree q : Linked) {\n count.add(q.ullat);\n }\n rowCount = count.size();\n columnCount = Linked.size() / rowCount;\n return new String[rowCount][columnCount];\n }\n }" ]
[ "0.6236481", "0.61202514", "0.5996663", "0.5735107", "0.57283896", "0.5681327", "0.5627206", "0.56223404", "0.5601616", "0.55920273", "0.55790454", "0.55749685", "0.5562486", "0.55511606", "0.55037206", "0.5490395", "0.54409057", "0.54161805", "0.5411116", "0.5408849", "0.53961855", "0.5392464", "0.5383473", "0.5334209", "0.53217244", "0.53176147", "0.5309831", "0.52997375", "0.5293829", "0.52789426", "0.5264543", "0.52625394", "0.5262041", "0.5239518", "0.5239486", "0.5228223", "0.5213827", "0.52054584", "0.5205124", "0.52046496", "0.516679", "0.51622885", "0.5161015", "0.51585495", "0.51577425", "0.51536274", "0.51491225", "0.5145964", "0.5137997", "0.51357573", "0.51251364", "0.51184124", "0.5105201", "0.51044846", "0.5090983", "0.5090426", "0.50823355", "0.50743365", "0.50728136", "0.50641596", "0.50538564", "0.5053257", "0.50468427", "0.5042077", "0.50419664", "0.504106", "0.5032821", "0.5032187", "0.50320333", "0.50166357", "0.50130504", "0.5012302", "0.5006459", "0.5004587", "0.5002328", "0.49911836", "0.49873924", "0.49827957", "0.49789318", "0.4975871", "0.4964472", "0.4963089", "0.4948005", "0.4946999", "0.4942339", "0.4939986", "0.49385646", "0.493471", "0.49329928", "0.4931346", "0.49312982", "0.4924914", "0.49214163", "0.49135536", "0.49133515", "0.49085495", "0.48977005", "0.48826313", "0.4882394", "0.48770943", "0.48713976" ]
0.0
-1
we can optimize while collection. Build forward during the Collection time. (optimized monolith approach)
public int _maxProfitAssignmentSortedCollectors(int[] difficulty, int[] profit, int[] worker) { int n = difficulty.length; int [][] dp = new int [n][2]; // difficulty, profit pair (dp) for (int idx = 0; idx < n; idx ++) { dp [idx][0] = difficulty [idx]; dp [idx][1] = profit [idx]; } Arrays.sort (dp, (a, b) -> a [0] - b [0]); // sort the collectors. Arrays.sort (worker); int ans = 0, best = 0, idx = 0; for (int w : worker) { // compute maxima and save it for next we well to build upon the max (best) seen so far. while (idx < n && w >= dp [idx][0]) { // increase difficulty slowly best = Math.max (best, dp [idx][1]); idx ++; } ans += best; } return ans; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@SuppressWarnings(\"serial\")\r\n\tprivate void fcbuild() {\n\t\tfor (int i = 0; i < keys.size(); i++) {\r\n\t\t\tString s = keys.get(i);\r\n\t\t\tfc.add(new ArrayList<String>() {\r\n\t\t\t\t{\r\n\t\t\t\t\tadd(sharedV.get(s).get(0));\r\n\t\t\t\t\tadd(s);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tfor (int i = 0; i < sharedV.size(); i++) {\r\n\t\t\tfor (int j = i + 1; j < sharedV.size(); j++) {\r\n\t\t\t\tif (sharedV.get(keys.get(i)).containsAll(sharedV.get(keys.get(j)))\r\n\t\t\t\t\t\t&& sharedV.get(keys.get(j)).containsAll(sharedV.get(keys.get(i)))) {\r\n\r\n\t\t\t\t\tString s = sharedV.get(keys.get(i)).get(0); // c1\r\n\t\t\t\t\tint ii = i;\r\n\t\t\t\t\tint jj = j;\r\n\t\t\t\t\tfc.add(new ArrayList<String>() {\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tadd(s);\r\n\t\t\t\t\t\t\tadd(keys.get(ii));\r\n\t\t\t\t\t\t\tadd(keys.get(jj));\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\r\n\t\t}\r\n\r\n\t\toptimizefc();\r\n\r\n\t}", "private void buildReachable() {\n // This is a simple search algorithm.\n // It doesn't matter whether it's depth-first or breadth-first.\n this.reachables = new ArrayList<Boolean>();\n for (int n = 0; n < code.size(); n++) {\n this.reachables.add(false);\n }\n\n ArrayDeque<Integer> next = new ArrayDeque<Integer>();\n if (!code.isEmpty()) {\n next.add(0);\n }\n \n while (!next.isEmpty()) {\n int here = next.remove();\n \n if (this.reachables.get(here)) {\n continue;\n }\n this.reachables.set(here, true);\n next.addAll(this.succ(here));\n }\n }", "boolean scavengeSome()\r\n/* 472: */ {\r\n/* 473:505 */ Recycler.WeakOrderQueue cursor = this.cursor;\r\n/* 474: */ Recycler.WeakOrderQueue prev;\r\n/* 475:506 */ if (cursor == null)\r\n/* 476: */ {\r\n/* 477:507 */ Recycler.WeakOrderQueue prev = null;\r\n/* 478:508 */ cursor = this.head;\r\n/* 479:509 */ if (cursor == null) {\r\n/* 480:510 */ return false;\r\n/* 481: */ }\r\n/* 482: */ }\r\n/* 483: */ else\r\n/* 484: */ {\r\n/* 485:513 */ prev = this.prev;\r\n/* 486: */ }\r\n/* 487:516 */ boolean success = false;\r\n/* 488: */ do\r\n/* 489: */ {\r\n/* 490:518 */ if (cursor.transfer(this))\r\n/* 491: */ {\r\n/* 492:519 */ success = true;\r\n/* 493:520 */ break;\r\n/* 494: */ }\r\n/* 495:522 */ Recycler.WeakOrderQueue next = Recycler.WeakOrderQueue.access$1800(cursor);\r\n/* 496:523 */ if (Recycler.WeakOrderQueue.access$1900(cursor).get() == null)\r\n/* 497: */ {\r\n/* 498:527 */ if (cursor.hasFinalData()) {\r\n/* 499:529 */ while (cursor.transfer(this)) {\r\n/* 500:530 */ success = true;\r\n/* 501: */ }\r\n/* 502: */ }\r\n/* 503:537 */ if (prev != null) {\r\n/* 504:538 */ Recycler.WeakOrderQueue.access$1700(prev, next);\r\n/* 505: */ }\r\n/* 506: */ }\r\n/* 507: */ else\r\n/* 508: */ {\r\n/* 509:541 */ prev = cursor;\r\n/* 510: */ }\r\n/* 511:544 */ cursor = next;\r\n/* 512:546 */ } while ((cursor != null) && (!success));\r\n/* 513:548 */ this.prev = prev;\r\n/* 514:549 */ this.cursor = cursor;\r\n/* 515:550 */ return success;\r\n/* 516: */ }", "@Override\n\tvoid collect() {\n\t\t\n\t}", "void buildHeap() {\n for (int i = parent(size - 1); i >= 0; i--) {\n percolateDown(i);\n }\n }", "public void f() {\n if (getAndIncrement() == 0) {\n SpscLinkedArrayQueue<Object> spscLinkedArrayQueue = this.c;\n Subscriber<?> subscriber = this.a;\n boolean z = true;\n int i2 = 1;\n while (!this.n) {\n if (this.g.get() != null) {\n spscLinkedArrayQueue.clear();\n this.d.dispose();\n h(subscriber);\n return;\n }\n boolean z2 = this.k.get() == 0;\n Integer num = (Integer) spscLinkedArrayQueue.poll();\n boolean z3 = num == null;\n if (z2 && z3) {\n this.e.clear();\n this.f.clear();\n this.d.dispose();\n subscriber.onComplete();\n return;\n } else if (z3) {\n i2 = addAndGet(-i2);\n if (i2 == 0) {\n return;\n }\n } else {\n Object poll = spscLinkedArrayQueue.poll();\n if (num == o) {\n int i3 = this.l;\n this.l = i3 + 1;\n this.e.put(Integer.valueOf(i3), poll);\n try {\n Object apply = this.h.apply(poll);\n Objects.requireNonNull(apply, \"The leftEnd returned a null Publisher\");\n Publisher publisher = (Publisher) apply;\n FlowableGroupJoin.c cVar = new FlowableGroupJoin.c(this, z, i3);\n this.d.add(cVar);\n publisher.subscribe(cVar);\n if (this.g.get() != null) {\n spscLinkedArrayQueue.clear();\n this.d.dispose();\n h(subscriber);\n return;\n }\n long j2 = this.b.get();\n long j3 = 0;\n for (TRight tright : this.f.values()) {\n try {\n Object obj = (Object) this.j.apply(poll, tright);\n Objects.requireNonNull(obj, \"The resultSelector returned a null value\");\n if (j3 != j2) {\n subscriber.onNext(obj);\n j3++;\n } else {\n ExceptionHelper.addThrowable(this.g, new MissingBackpressureException(\"Could not emit value due to lack of requests\"));\n spscLinkedArrayQueue.clear();\n this.d.dispose();\n h(subscriber);\n return;\n }\n } catch (Throwable th) {\n i(th, subscriber, spscLinkedArrayQueue);\n return;\n }\n }\n if (j3 != 0) {\n BackpressureHelper.produced(this.b, j3);\n }\n } catch (Throwable th2) {\n i(th2, subscriber, spscLinkedArrayQueue);\n return;\n }\n } else if (num == p) {\n int i4 = this.m;\n this.m = i4 + 1;\n this.f.put(Integer.valueOf(i4), poll);\n try {\n Object apply2 = this.i.apply(poll);\n Objects.requireNonNull(apply2, \"The rightEnd returned a null Publisher\");\n Publisher publisher2 = (Publisher) apply2;\n FlowableGroupJoin.c cVar2 = new FlowableGroupJoin.c(this, false, i4);\n this.d.add(cVar2);\n publisher2.subscribe(cVar2);\n if (this.g.get() != null) {\n spscLinkedArrayQueue.clear();\n this.d.dispose();\n h(subscriber);\n return;\n }\n long j4 = this.b.get();\n long j5 = 0;\n for (TLeft tleft : this.e.values()) {\n try {\n Object obj2 = (Object) this.j.apply(tleft, poll);\n Objects.requireNonNull(obj2, \"The resultSelector returned a null value\");\n if (j5 != j4) {\n subscriber.onNext(obj2);\n j5++;\n } else {\n ExceptionHelper.addThrowable(this.g, new MissingBackpressureException(\"Could not emit value due to lack of requests\"));\n spscLinkedArrayQueue.clear();\n this.d.dispose();\n h(subscriber);\n return;\n }\n } catch (Throwable th3) {\n i(th3, subscriber, spscLinkedArrayQueue);\n return;\n }\n }\n if (j5 != 0) {\n BackpressureHelper.produced(this.b, j5);\n }\n } catch (Throwable th4) {\n i(th4, subscriber, spscLinkedArrayQueue);\n return;\n }\n } else if (num == q) {\n FlowableGroupJoin.c cVar3 = (FlowableGroupJoin.c) poll;\n this.e.remove(Integer.valueOf(cVar3.c));\n this.d.remove(cVar3);\n } else {\n FlowableGroupJoin.c cVar4 = (FlowableGroupJoin.c) poll;\n this.f.remove(Integer.valueOf(cVar4.c));\n this.d.remove(cVar4);\n }\n z = true;\n }\n }\n spscLinkedArrayQueue.clear();\n }\n }", "void buildHeap() {\n\tfor(int i=parent(size-1); i>=0; i--) {\n\t percolateDown(i);\n\t}\n }", "protected void runBeforeIteration() {}", "private static void backPressureFix() {\n\t\tFlowable.range(1, 1000000)\n\t\t//below map will run in sequential\n\t\t//since sequential it has to complete whole task then only it can allow consumer to start\n\t\t\t.map(item -> {\n\t\t\t\tSystem.out.println(\"Produced item \"+item +\" using thread \"+Thread.currentThread().getName());\n\t\t\t\treturn item;\n\t\t\t})\n\t\t\t.observeOn(Schedulers.io())\n\t\t\t//.subscribeOn(Schedulers.io())//with this whole pipelein runs in seprate thread paralleley\n\t\t\t//below will run in concurrent\n\t\t\t.subscribe(item ->{\n\t\t\t\t//mimcing slowness\n\t\t\t\tThreadUtil.sleep(300);\n\t\t\t\tSystem.out.println(\"Consumed item \"+item +\" using thread \"+Thread.currentThread().getName());\n\t\t\t})\n\t\t\t\n\t\t\t;\n\t\t\n\t\t//since running in async we need to sleep\n\t\tThreadUtil.sleep(10000000);\n\t\t\t\n\t}", "private void prepareNext() {\n this.hasNext = false;\n while (!this.hasNext && this.nodesIterator.hasNext()) {\n this.next = this.nodesIterator.next();\n this.hasNext = this.computeHasNext();\n }\n }", "Collect getColl();", "void moveLaterFutureTargetsToIterator() {moveStackToIterator(laterFutureTargets);}", "@Override\n\tprotected void cutOffLazyCollections(Direction entity) {\n\t}", "Foreach createForeach();", "StackManipulation cached();", "private void garbageColl(){\n\t\tfor(Page p: pageList){\n\t\t\tp.garbageColl();\n\t\t}\n\t\tpageIndex = 0;\n\t}", "public void buildModel() {\n double loss_pre = Double.MAX_VALUE;\n for (int iter = 0; iter < maxIter; iter ++) {\n Long start = System.currentTimeMillis();\n if (showProgress)\n System.out.println(\"Iteration \"+(iter+1)+\" started\");\n // Update user latent vectors\n IntStream.range(0,userCount).parallel().peek(i->update_user(i)).forEach(j->{});\n /*\n for (int u = 0; u < userCount; u ++) {\n update_user(u);\n }\n */\n if (showProgress) {\n System.out.println(\"Users updated for \" + (System.currentTimeMillis() - start) + \"millis\");\n start = System.currentTimeMillis();\n }\n\n IntStream.range(0,itemCount).parallel().peek(i->update_item(i)).forEach(j->{});\n // Update item latent vectors\n /*\n for (int i = 0; i < itemCount; i ++) {\n update_item(i);\n }\n */\n if (showProgress) {\n System.out.println(\"Items updated for \" + (System.currentTimeMillis() - start) + \"millis\");\n start = System.currentTimeMillis();\n }\n\n // Show loss\n if (showLoss)\n loss_pre = showLoss(iter, start, loss_pre);\n\n\n } // end for iter\n\n }", "void moveFutureTargetsToIterator() {moveStackToIterator(newFutureTargets);}", "public void crossref(){\r\n reftable = new ArrayList();\r\n if(!log.isEmpty() && ses.isEmpty()){\r\n for(int i=0 ; i<log.size() ; i++){\r\n all_log alg = new all_log(log.get(i).getuserid(), log.get(i).getuserip(), log.get(i).geturl(), log.get(i).gettime(), \"\", \"\");\r\n reftable.add(alg);\r\n }\r\n }else if(!ses.isEmpty() && log.isEmpty()) {\r\n for(int i=0 ; i<ses.size() ; i++){\r\n ArrayList<AndroidRec> ad = ses.get(i).getrec();\r\n for(int j=0 ; j<ad.size() ; j++) {\r\n all_log alg = new all_log(\"unknow\", \"unknow\", ad.get(j).geturl(), ad.get(j).gettime(), ad.get(j).getsystem(), ad.get(j).getsoft());\r\n reftable.add(alg);\r\n }\r\n }\r\n }else if(!ses.isEmpty() && !log.isEmpty()){\r\n for(int i=0 ; i<log.size() ; i++){\r\n all_log alg = new all_log(log.get(i).getuserid(), log.get(i).getuserip(), log.get(i).geturl(), log.get(i).gettime(), \"\", \"\");\r\n reftable.add(alg);\r\n }\r\n\r\n \r\n \r\n for(int k=0 ; k<ses.size() ; k++) {\r\n ArrayList<usersort> sort = new ArrayList<usersort>();\r\n ArrayList userid = new ArrayList(); \r\n ArrayList<Integer> poss = new ArrayList(); \r\n ArrayList<AndroidRec> ad = new ArrayList();\r\n ad.addAll(ses.get(k).getrec());\r\n \r\n for(int n=0 ; n<ad.size() ; n++){\r\n long andtime = Long.parseLong(ad.get(n).gettime());\r\n for(int t=0 ; t<reftable.size() ; t++){\r\n long logtime = (Long.parseLong(reftable.get(t).gettime()))*1000;\r\n if((logtime-andtime)>60000)\r\n break;\r\n if(Math.abs(andtime - logtime) <= 60000){\r\n String andurl = ad.get(n).geturl();\r\n String logurl = reftable.get(t).geturl();\r\n if(andurl.equals(logurl)){\r\n userid.add(reftable.get(t).getid());\r\n poss.add(n);\r\n poss.add(t);\r\n }\r\n }\r\n }\r\n }\r\n //find correct in matches\r\n \r\n for(int i=0 ; i<userid.size() ; i++){\r\n if(sort.isEmpty()){\r\n usersort so = new usersort(userid.get(i).toString());\r\n sort.add(so);\r\n }\r\n for(int j=0 ; j<sort.size() ; j++){ \r\n if(userid.get(i).toString().equals(sort.get(j).getid())){\r\n sort.get(j).accnum();\r\n }else if(j==(sort.size()-1) && !userid.get(i).toString().equals(sort.get(j).getid())){\r\n usersort so = new usersort(userid.get(i).toString());\r\n sort.add(so);\r\n }\r\n }\r\n }\r\n String correctuser = \"\";\r\n int usernum = 0;\r\n for(int s=0 ; s<sort.size() ; s++){\r\n if((sort.get(s).getnum())>usernum){\r\n usernum = sort.get(s).getnum();\r\n correctuser = sort.get(s).getid();\r\n }\r\n }\r\n //\r\n \r\n //\r\n if(!ad.isEmpty()){\r\n int del = 0;\r\n for(int i=0 ; i<poss.size() ; i+=2){\r\n if((reftable.get(poss.get(i+1))).getid().equals(correctuser)){\r\n if(!ad.isEmpty()){\r\n reftable.get(poss.get(i+1)).setsys(ad.get(poss.get(i)-del).getsystem());\r\n reftable.get(poss.get(i+1)).setsoft(ad.get(poss.get(i)-del).getsoft());\r\n int index = poss.get(i) - del;\r\n ad.remove(index);\r\n del = del + 1;\r\n }\r\n }\r\n }\r\n }\r\n for(int i=0 ; i<ad.size() ; i++){\r\n all_log alg = new all_log(\"unknow\", \"unknow\", ad.get(i).geturl(), ad.get(i).gettime(), ad.get(i).getsystem(), ad.get(i).getsoft());\r\n reftable.add(alg);\r\n }\r\n sort.clear();\r\n }\r\n }\r\n\r\n for(int i=0 ; i<reftable.size() ; i++){\r\n long sort = 0;\r\n if(reftable.get(i).gettime().length() == 13){\r\n sort = Long.parseLong(reftable.get(i).gettime());\r\n }else if (reftable.get(i).gettime().length() == 10){\r\n sort = Long.parseLong(reftable.get(i).gettime())*1000;\r\n }\r\n reftable.get(i).settime((new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\").format(new Date(sort))).toString());\r\n //System.out.println(reftable.get(i).toString());\r\n //System.out.println(reftable.size());\r\n }\r\n }", "private void optimizefc() {\n\r\n\t\tfor (int i = 0; i < fc.size(); i++) {\r\n\t\t\tString c = fc.get(i).get(0);\r\n\t\t\tif (!keys.containsAll(cliques.get(c))) {\r\n\t\t\t\tfc.remove(i);\r\n\t\t\t\toptimizefc();\r\n\t\t\t}\r\n\t\t}\r\n\t}", "protected List<QueryIterator> nextStage(List<Binding> bindingsCouldBeParent) {\n\n\t\tList<QueryIterator> allIterators = new ArrayList<QueryIterator>();\n\t\tString filterType = (String) getExecContext().getContext().get(\n\t\t\t\tConstants.FILTER_TYPE);\n\t\t// creating filter Ops.\n\t\tList<Op> filterOps = QCFilter.substitute(opService,\n\t\t\t\tbindingsCouldBeParent, filterType);\n\t\tfor (int i = 0; i < filterOps.size(); i++) {\n\t\t\t// creating numeric binding list using numeric op\n\t\t\tList<Binding> bindingList = ServiceBound\n\t\t\t\t\t.exec((OpService) filterOps.get(i), getExecContext()\n\t\t\t\t\t\t\t.getContext());\n\n\t\t\t// logger.debug(\"Binding pairs is beginning to be generated...\");\n\t\t\t// long before = System.currentTimeMillis();\n\t\t\t// find binding pairs\n\t\t\tList<BindingPair> bindingPairs = generateBindingPairs(bindingList,\n\t\t\t\t\tbindingsCouldBeParent, opService.getService(),\n\t\t\t\t\t((OpService) filterOps.get(i)).getService());\n\t\t\t// long after = System.currentTimeMillis();\n\t\t\t// logger.debug(MessageFormat.format(\n\t\t\t// \"Binding pairs has been generated in \\\"{0}\\\" miliseconds\",\n\t\t\t// after - before));\n\n\t\t\t// logger.debug(\"Binding pairs is beginning to be intersected...\");\n\t\t\t// before = System.currentTimeMillis();\n\t\t\t// intersect bindings and their parents contained in binding pairs\n\t\t\tbindingPairs = intersectBindingPairs(bindingPairs);\n\t\t\t// after = System.currentTimeMillis();\n\t\t\t// logger.debug(MessageFormat\n\t\t\t// .format(\"Binding pairs has been intersected in \\\"{0}\\\" miliseconds\",\n\t\t\t// after - before));\n\n\t\t\t// logger.debug(\"Query iterators is beginning to be generated...\");\n\t\t\t// before = System.currentTimeMillis();\n\t\t\t// make query iterators using binding pairs\n\t\t\tList<QueryIterator> queryIterators = generateQueryIterators(bindingPairs);\n\t\t\t// after = System.currentTimeMillis();\n\t\t\t// logger.debug(MessageFormat\n\t\t\t// .format(\"Query iterators has been generated in \\\"{0}\\\" miliseconds\",\n\t\t\t// after - before));\n\n\t\t\t// reverse iterators\n\t\t\tCollections.reverse(queryIterators);\n\t\t\tallIterators.addAll(queryIterators);\n\t\t}\n\t\treturn allIterators;\n\t}", "public void buildHeap() {\n\t\tthis.makeComplete();\n\t\tfor(int i = this.size/2; i >= 1; i--)\n\t\t\tthis.heapify(i);\n\t}", "public void prefetch() {\n\t}", "private boolean buildConcurrentRulesForward(\r\n \t\t\tfinal Rule ri_1, final int i_1,\r\n \t\t\tfinal Rule ri, final int i,\t\t\t\r\n \t\t\tfinal Graph g) {\r\n \t\tSystem.out.println(\"=== >>> ApplicabilityChecker.buildConcurrentRulesForwards:: \"+ri_1.getName()+\" & \"+ri.getName());\r\n\r\n \t\tboolean result = false;\r\n \t\t\r\n \t\tfinal List<List<ConcurrentRule>> \r\n\t\tcrListsOfRuleI = this.getListsOfConcurrentRulesOfRule(ri, i);\r\n \t\t\r\n \t\tfinal List<List<ConcurrentRule>> \r\n\t\tcrListsOfRuleI_1 = this.getListsOfConcurrentRulesOfRule(ri_1, i_1);\r\n \t\tif (crListsOfRuleI_1 != null && !crListsOfRuleI_1.isEmpty()) {\r\n \t\t\tfor (int l=0; l<crListsOfRuleI_1.size() && !result; l++) { \r\n \t\t\t\tList<ConcurrentRule> listAll = new Vector<ConcurrentRule>();\r\n \t\t\t\tcrListsOfRuleI.add(listAll);\r\n \t\t\t\tList<ConcurrentRule> crList = crListsOfRuleI_1.get(l);\r\n \t\t\t\tfor (int c=0; c<crList.size() && !result; c++) {\r\n \t\t\t\t\tConcurrentRule cr = crList.get(c);\r\n \t\t\t\t\tList<ConcurrentRule> list = this.makeConcurrentRulesDuetoDependency(cr, ri, null);\r\n \t\t\t\t\tlistAll.addAll(list);\r\n \t\t\t\t\tif (!list.isEmpty()) {\r\n \t\t \t\t\t\tint d = crListsOfRuleI.size();\r\n \t\t \t\t\t\tfor (int j = 0; j<list.size(); j++) {\r\n \t\t \t\t\t\t\tConcurrentRule crj = list.get(j);\t\t\t\t\r\n \t\t \t\t\t\t\tif (isConcurrentRuleApplicable(i, ri, \r\n \t\t \t\t\t\t\t\t\tthis.ruleSequence.getRules(), g, \r\n \t\t \t\t\t\t\t\t\tcrj, d, ApplicabilityConstants.DIRECT_ENABLING_PREDECESSOR)) {\r\n \t\t \t\t\t\t\t\tresult = true;\r\n \t\t \t\t\t\t\t}\r\n \t\t \t\t\t\t\telse {\r\n \t\t \t\t\t\t\t\tlist.remove(j);\r\n \t\t \t\t\t\t\t\tj--;\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}\r\n \t\t\t}\r\n \t\t} \r\n \t\tif (!result) {\r\n\t \t\tfor (int k=0; k<i; k++) {\t\r\n\t \t\t\tRule r = this.ruleSequence.getRule(k);\r\n\t \t\t\tint k1 = k+1;\r\n\t \t\t\tRule r1 = this.ruleSequence.getRule(k1);\r\n\t \t\t\tList<ConcurrentRule> list = null;\r\n\t \t\t\tif (k==0) {\r\n\t \t\t\t\tlist = this.makeConcurrentRulesDuetoDependency(r, k, r1, k1, null);\t\r\n\t \t\t\t\tcrListsOfRuleI.add(list); \t\t\t\t\r\n\t \t\t\t} \r\n\t \t\t\telse //if (this.depth == -1 || k < this.depth) \r\n\t \t\t\t{\t\t\t\t\t\t\t\t\r\n\t \t\t\t\tList<ConcurrentRule> listOfPreRule = this.getConcurrentRulesOfRule(r, k, k-1);\r\n\t \t\t\t\tif (listOfPreRule == null || listOfPreRule.isEmpty()) {\r\n\t \t\t\t\t\tfinal List<List<ConcurrentRule>> \r\n\t \t\t\t\t\tcrListsOfPreRule = this.getListsOfConcurrentRulesOfRule(r, k); \r\n\t \t\t\t\t\t\r\n\t \t\t\t\t\tthis.completeConcurrentRules(r, k, crListsOfPreRule, k-1, null);\r\n\t \t\t\t\t\t\r\n\t \t\t\t\t\tlistOfPreRule = this.getConcurrentRulesOfRule(r, k, k-1);\r\n\t \t\t\t\t\tif (listOfPreRule == null || listOfPreRule.isEmpty()) {\r\n\t \t\t\t\t\t\tresult = false;\r\n\t \t\t\t\t\t\tbreak;\r\n\t \t\t\t\t\t} \r\n\t \t\t\t\t}\r\n\t \t\t\t\t\r\n\t \t\t\t\tlist = new Vector<ConcurrentRule>();\r\n\t\t\t\t\tfor (int c=0; c<listOfPreRule.size(); c++) {\r\n\t\t\t\t\t\tfinal ConcurrentRule cr = listOfPreRule.get(c);\r\n\t\t\t\t\t\tlist.addAll(this.makeConcurrentRulesDuetoDependency(cr, r1, null));\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcrListsOfRuleI.add(list);\r\n\t \t\t\t} \r\n\t\r\n\t \t\t\tif (!list.isEmpty()) {\r\n\t \t\t\t\tint d = crListsOfRuleI.size();\r\n\t \t\t\t\tfor (int c = 0; c<list.size(); c++) {\r\n\t \t\t\t\t\tConcurrentRule cr = list.get(c);\t\t\t\t\r\n\t \t\t\t\t\tif (isConcurrentRuleApplicable(i, ri, \r\n\t \t\t\t\t\t\t\tthis.ruleSequence.getRules(), g, \r\n\t \t\t\t\t\t\t\tcr, d, ApplicabilityConstants.DIRECT_ENABLING_PREDECESSOR)) {\r\n\t \t\t\t\t\t\tresult = true;\r\n\t \t\t\t\t\t}\r\n//\t \t\t\t\t\telse {\r\n//\t \t\t\t\t\t\tlist.remove(c);\r\n//\t \t\t\t\t\t\tc--;\r\n//\t \t\t\t\t\t}\r\n\t \t\t\t\t}\r\n\t \t\t\t\tif (result)\r\n\t \t\t\t\t\tbreak;\r\n\t \t\t\t}\r\n\t \t \t}\r\n \t\t}\r\n// \t\tSystem.out.println(\"---> ApplicabilityChecker.buildConcurrentRulesForward:: result: \"+result);\r\n \t\treturn result;\r\n \t}", "void runC() {\n\t\tArrayList<Link> links_s2 = new ArrayList<Link>(links_s);\n\t\tArrayList<Link> links_p2 = new ArrayList<Link>(links_p);\n\t\talgorithmC = new HashSet<Link>(algorithmC(links_p2, links_s2));\n\t}", "private void workOnQueue() {\n }", "@Override\n protected Long compute() {\n if (dataList.size() <= BATCHSIZE)\n return sum();\n else {\n final List<AggregateWorker> tasks = new ArrayList<>();\n int index = dataList.size();\n while (index > 0) {\n int startIndex = (index - BATCHSIZE >= 0) ? (index - BATCHSIZE) : 0;\n // System.out.println(\"Created task for \" + startIndex + \" to \" + index);\n Collection<Long> subList = dataList.subList(startIndex, index);\n final AggregateWorker task = new AggregateWorker(subList);\n task.fork();\n tasks.add(task);\n index = index - BATCHSIZE;\n }\n long result = 0;\n for (final AggregateWorker task : tasks) {\n result += task.join();\n }\n return result;\n }\n }", "@Override public final void compute2() {\n assert _left == null && _rite == null && _res == null;\n if( _hi-_lo >= 2 ) { // Multi-chunk case: just divide-and-conquer to 1 chunk\n final int mid = (_lo+_hi)>>>1; // Mid-point\n _left = clone();\n _rite = clone();\n _left._hi = mid; // Reset mid-point\n _rite._lo = mid; // Also set self mid-point\n addToPendingCount(1); // One fork awaiting completion\n _left.fork(); // Runs in another thread/FJ instance\n _rite.compute2(); // Runs in THIS F/J thread\n return; // Not complete until the fork completes\n }\n // Zero or 1 chunks, and further chunk might not be homed here\n if( _hi > _lo ) { // Single chunk?\n Vec v0 = _fr.firstReadable();\n if( v0.chunkKey(_lo).home() ) { // And chunk is homed here?\n\n // Make decompression chunk headers for these chunks\n Chunk bvs[] = new Chunk[_fr._vecs.length];\n for( int i=0; i<_fr._vecs.length; i++ )\n if( _fr._vecs[i] != null )\n bvs[i] = _fr._vecs[i].elem2BV(_lo);\n\n // Call all the various map() calls that apply\n if( _fr._vecs.length == 1 ) map(bvs[0]);\n if( _fr._vecs.length == 2 && bvs[0] instanceof NewChunk) map((NewChunk)bvs[0], bvs[1]);\n if( _fr._vecs.length == 2 ) map(bvs[0], bvs[1]);\n if( _fr._vecs.length == 3 ) map(bvs[0], bvs[1], bvs[2]);\n if( true ) map(bvs );\n _res = self(); // Save results since called map() at least once!\n // Further D/K/V put any new vec results.\n for( Chunk bv : bvs )bv.close(_lo+_outputChkOffset,_fs);\n }\n }\n tryComplete(); // And this task is complete\n }", "private static void backPressureChallenge() {\n\t\tObservable.range(1, 1000000)\n\t\t//below map will run in sequential\n\t\t//since sequential it has to complete whole task then only it can allow consumer to start\n\t\t\t.map(item -> {\n\t\t\t\tSystem.out.println(\"Produced item \"+item +\" using thread \"+Thread.currentThread().getName());\n\t\t\t\treturn item;\n\t\t\t})\n\t\t\t.observeOn(Schedulers.io())\n\t\t\t//.subscribeOn(Schedulers.io())//with this whole pipelein runs in seprate thread paralleley\n\t\t\t//below will run in concurrent\n\t\t\t.subscribe(item ->{\n\t\t\t\t//mimcing slowness\n\t\t\t\tThreadUtil.sleep(300);\n\t\t\t\tSystem.out.println(\"Consumed item \"+item +\" using thread \"+Thread.currentThread().getName());\n\t\t\t})\n\t\t\t\n\t\t\t;\n\t\t\n\t\t//since running in async we need to sleep\n\t\tThreadUtil.sleep(10000000);\n\t}", "@Override\n\t\tprotected void compute() {\n\t\t\tif (end - start < workSize) {\n\t\t\t\tresultsQueue.offer(new Results(start, end, findPrimes(start, end)));\n\t\t\t} else {\n\t\t\t\t// Divide into two pieces\n\t\t\t\tint mid = (start + end) / 2;\n\n\t\t\t\tinvokeAll(new FindPrimes(start, mid), new FindPrimes(mid + 1, end));\n\t\t\t}\n\t\t}", "private void buildReferencedClassSet() throws CheckedAnalysisException, InterruptedException {\n\n if (PROGRESS) {\n System.out.println(\"Adding referenced classes\");\n }\n Set<String> referencedPackageSet = new HashSet<String>();\n\n LinkedList<ClassDescriptor> workList = new LinkedList<ClassDescriptor>();\n workList.addAll(appClassList);\n\n Set<ClassDescriptor> seen = new HashSet<ClassDescriptor>();\n Set<ClassDescriptor> appClassSet = new HashSet<ClassDescriptor>(appClassList);\n\n Set<ClassDescriptor> badAppClassSet = new HashSet<ClassDescriptor>();\n HashSet<ClassDescriptor> knownDescriptors = new HashSet<ClassDescriptor>(DescriptorFactory.instance()\n .getAllClassDescriptors());\n int count = 0;\n Set<ClassDescriptor> addedToWorkList = new HashSet<ClassDescriptor>(appClassList);\n\n // add fields\n //noinspection ConstantIfStatement\n if (false)\n for (ClassDescriptor classDesc : appClassList) {\n try {\n XClass classNameAndInfo = Global.getAnalysisCache().getClassAnalysis(XClass.class, classDesc);\n for (XField f : classNameAndInfo.getXFields()) {\n String sig = f.getSignature();\n ClassDescriptor d = DescriptorFactory.createClassDescriptorFromFieldSignature(sig);\n if (d != null && addedToWorkList.add(d))\n workList.addLast(d);\n }\n } catch (RuntimeException e) {\n bugReporter.logError(\"Error scanning \" + classDesc + \" for referenced classes\", e);\n if (appClassSet.contains(classDesc)) {\n badAppClassSet.add(classDesc);\n }\n } catch (MissingClassException e) {\n // Just log it as a missing class\n bugReporter.reportMissingClass(e.getClassDescriptor());\n if (appClassSet.contains(classDesc)) {\n badAppClassSet.add(classDesc);\n }\n }\n }\n\n while (!workList.isEmpty()) {\n if (Thread.interrupted()) {\n throw new InterruptedException();\n }\n ClassDescriptor classDesc = workList.removeFirst();\n\n if (seen.contains(classDesc)) {\n continue;\n }\n seen.add(classDesc);\n\n if (!knownDescriptors.contains(classDesc)) {\n count++;\n if (PROGRESS && count % 5000 == 0) {\n System.out.println(\"Adding referenced class \" + classDesc);\n }\n }\n\n referencedPackageSet.add(classDesc.getPackageName());\n\n // Get list of referenced classes and add them to set.\n // Add superclasses and superinterfaces to worklist.\n try {\n XClass classNameAndInfo = Global.getAnalysisCache().getClassAnalysis(XClass.class, classDesc);\n\n ClassDescriptor superclassDescriptor = classNameAndInfo.getSuperclassDescriptor();\n if (superclassDescriptor != null && addedToWorkList.add(superclassDescriptor)) {\n workList.addLast(superclassDescriptor);\n }\n\n for (ClassDescriptor ifaceDesc : classNameAndInfo.getInterfaceDescriptorList()) {\n if (addedToWorkList.add(ifaceDesc))\n workList.addLast(ifaceDesc);\n }\n\n ClassDescriptor enclosingClass = classNameAndInfo.getImmediateEnclosingClass();\n if (enclosingClass != null && addedToWorkList.add(enclosingClass))\n workList.addLast(enclosingClass);\n\n } catch (RuntimeException e) {\n bugReporter.logError(\"Error scanning \" + classDesc + \" for referenced classes\", e);\n if (appClassSet.contains(classDesc)) {\n badAppClassSet.add(classDesc);\n }\n } catch (MissingClassException e) {\n // Just log it as a missing class\n bugReporter.reportMissingClass(e.getClassDescriptor());\n if (appClassSet.contains(classDesc)) {\n badAppClassSet.add(classDesc);\n }\n } catch (CheckedAnalysisException e) {\n // Failed to scan a referenced class --- just log the error and\n // continue\n bugReporter.logError(\"Error scanning \" + classDesc + \" for referenced classes\", e);\n if (appClassSet.contains(classDesc)) {\n badAppClassSet.add(classDesc);\n }\n }\n }\n // Delete any application classes that could not be read\n appClassList.removeAll(badAppClassSet);\n DescriptorFactory.instance().purge(badAppClassSet);\n\n for (ClassDescriptor d : DescriptorFactory.instance().getAllClassDescriptors()) {\n referencedPackageSet.add(d.getPackageName());\n }\n referencedClassSet = new ArrayList<ClassDescriptor>(DescriptorFactory.instance().getAllClassDescriptors());\n\n // Based on referenced packages, add any resolvable package-info classes\n // to the set of referenced classes.\n if (PROGRESS) {\n referencedPackageSet.remove(\"\");\n System.out.println(\"Added \" + count + \" referenced classes\");\n System.out.println(\"Total of \" + referencedPackageSet.size() + \" packages\");\n for (ClassDescriptor d : referencedClassSet)\n System.out.println(\" \" + d);\n\n }\n\n }", "private void setAllLocalResults() {\n TreeMap<FlworKey, List<FlworTuple>> keyValuePairs = mapExpressionsToOrderedPairs();\n // get only the values(ordered tuples) and save them in a list for next() calls\n keyValuePairs.forEach((key, valueList) -> valueList.forEach((value) -> _localTupleResults.add(value)));\n\n _child.close();\n if (_localTupleResults.size() == 0) {\n this._hasNext = false;\n } else {\n this._hasNext = true;\n }\n }", "@SuppressWarnings({ \"rawtypes\", \"unchecked\" })\n\tdefault EagerFutureStream<Collection<U>> batchByTime(long time, TimeUnit unit) {\n\t\n\t\tint size = this.getLastActive().list().size();\n\t\tList[] list = {new ArrayList<U>()};\n\t\tint[] count = {0};\n\t\tSimpleTimer[] timer = {new SimpleTimer()};\n\t\treturn (EagerFutureStream)this.map(next-> { \n\t\t\t\tsynchronized(timer){\n\t\t\t\t\tcount[0]++;\n\t\t\t\t\tif(unit.toNanos(time)-timer[0].getElapsedNanoseconds()>0){\n\t\t\t\t\t\t\n\t\t\t\t\t\tlist[0].add(next);\n\t\t\t\t\t} else{\n\t\t\t\t\t\tlist[0].add(next);\n\t\t\t\t\t\tList<U> result = list[0];\n\t\t\t\t\t\tlist[0] = new ArrayList<U>();\n\t\t\t\t\t\t timer[0] = new SimpleTimer();\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\tif(count[0]==size){\n\t\t\t\t\t\tlist[0].add(next);\n\t\t\t\t\t\t\n\t\t\t\t\t\tList<U> result = list[0];\n\t\t\t\t\t\tlist[0] = new ArrayList<U>();\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}\n\t\t\t\t\treturn new ArrayList();\n\t\t\t\t}\n\t\t\t}\t).filter(l->l.size()>0);\n\t\t\n\t}", "private void d() {\n Queue<c> queue;\n Queue<c> queue2 = queue = i;\n synchronized (queue2) {\n long l2 = System.currentTimeMillis();\n Iterator iterator = i.iterator();\n while (iterator.hasNext()) {\n if (l2 - ((c)iterator.next()).a < 60000L) continue;\n iterator.remove();\n }\n if (i.size() >= 15) {\n for (int i2 = 0; i2 < 5; ++i2) {\n i.remove();\n }\n }\n return;\n }\n }", "public void fetch(){ \n for(int i = 0; i < this.queries.size(); i++){\n fetch(i);\n }\n }", "protected class_496 method_1607() {\n if (this.field_934.field_183 != this.field_938) {\n throw new ConcurrentModificationException();\n } else {\n class_496 var1 = this.field_937;\n if (var1 == null) {\n throw new NoSuchElementException(\"No next() entry in the iteration\");\n } else {\n class_496[] var2 = this.field_934.field_181;\n int var3 = this.field_935;\n\n class_496 var4;\n for(var4 = var1.field_903; var4 == null && var3 > 0; var4 = var2[var3]) {\n --var3;\n }\n\n this.field_937 = var4;\n this.field_935 = var3;\n this.field_936 = var1;\n return var1;\n }\n }\n }", "private void preComp(long from, long to) {\n\t\tfor (long i = from; i < to; i++) {\n\t\t\tif (isEmirp(i)) {\t\t\t\t\n\t\t\t\tpreComputedEmirps.add(i);\n\t\t\t}\n\t\t}\n\t\tlastComputedUpTo = to;\n\t}", "public void buildPred() {\n // Effectively, succ() gives us an adjacency list representation of the\n // block's flow graph. Reverse every edge to get the backwards graph.\n // Note that, while the forwards flow graph can have at most 2 out-edges\n // from every node, the backwards flow graph could have arbitrarily many,\n // although most nodes will have 1 and few will have more than 2.\n this.preds = new ArrayList<ArrayList<Integer>>();\n for (int n = 0; n < code.size(); n++) {\n this.preds.add(new ArrayList<Integer>());\n }\n for (int from = 0; from < code.size(); from++) {\n for (Integer to : this.succ(from)) {\n if (!this.preds.get(to).contains(from)) {\n this.preds.get(to).add(from);\n }\n }\n }\n }", "private void bfs() {\n\t\tQueue<Node> q = new ArrayDeque<>();\n\t\tq.add(treeNodes.get(0));\n\t\twhile (!q.isEmpty()) {\n\t\t\tint size = q.size();\n\t\t\tfor (int i = 0; i < size; i++) {\n\t\t\t\tNode curr = q.poll();\n\t\t\t\ttime += curr.informTime;\n\t\t\t\tSet<Node> nextNodes = curr.nextNodes;\n\t\t\t\tif (nextNodes == null || curr.id == treeNodes.get(0).id)\n\t\t\t\t\tcontinue;\n\t\t\t\tfor (Node node : nextNodes) {\n\t\t\t\t\tq.add(node);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}", "private void constructorPostProcessing()\n {\n prepareNextRequest();\n fetchNextBatch();\n advanceObjectSummary();\n }", "public void runOneIteration() {\n // Update user latent vectors\n\n //IntStream.range(0,userCount).peek(i->update_user(i)).forEach(j->{});\n\n for (int u = 0; u < userCount; u ++) {\n update_user(u);\n }\n\n // Update item latent vectors\n for (int i = 0; i < itemCount; i ++) {\n update_item(i);\n }\n }", "public void intermediateProcessing() {\n //empty\n }", "void genPromote(Collection ret, int from, int to, int bits) {\n\tfor (char i = KNIGHT; i <= QUEEN; ++i) {\n\tBouger g = new Bouger(from, to, i, (bits | 32), 'P');\n\tg.setScore(1000000 + (i * 10));\n\tret.add(g);\n\t}\n\t}", "public void m() {\n for (Map.Entry key : this.f80656a.a().entrySet()) {\n List list = (List) key.getKey();\n if (!this.l.contains(list)) {\n this.l.add(d.a(list));\n }\n }\n if (this.l.size() > 0) {\n this.f80657b.a(new f(), this.l);\n }\n }", "private static void iterator() {\n\t\t\r\n\t}", "protected void optimizeBushes() {\r\n\t\tfor (int i = 0; i < execBushes.size(); i++) {\r\n\t\t\tLog.info(String.format(\r\n\t\t\t\t\t\"Performing POR Analysis on Bush Sequence %d of %d\", i + 1,\r\n\t\t\t\t\texecBushes.size()));\r\n\r\n\t\t\t// optimization only works for sequence lengths >= 3\r\n\t\t\tList<EventType> sequence = execBushes.get(i);\r\n\t\t\tif (sequence.size() < 3)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t// is bush already redundant?\r\n\t\t\tif (redundantExecBushes.contains(sequence)) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\t// is bush PO-reducible?\r\n\t\t\tif (isPOReducible(sequence)) {\r\n\t\t\t\t// create redundant sequence (for later checking)\r\n\t\t\t\tList<EventType> redundantSequence = new ArrayList<EventType>();\r\n\t\t\t\tredundantSequence.add(sequence.get(1));\r\n\t\t\t\tredundantSequence.add(sequence.get(0));\r\n\t\t\t\tredundantSequence.add(sequence.get(2));\r\n\t\t\t\tredundantExecBushes.add(redundantSequence);\r\n\t\t\t}\r\n\r\n\t\t\trequiredExecBushes.add(sequence);\r\n\t\t}\r\n\t}", "public void emitLoop() {\n Subscriber<? super R> child2 = this.child;\n Queue<Object> queue2 = this.queue;\n NotificationLite<R> nl = NotificationLite.instance();\n AtomicLong requested2 = this.requested;\n long r = requested2.get();\n while (true) {\n boolean max = r == LongCompanionObject.MAX_VALUE;\n if (!checkTerminated(this.done, queue2.isEmpty(), child2)) {\n long e = 0;\n while (r != 0) {\n boolean d = this.done;\n Object o = queue2.poll();\n boolean empty = o == null;\n if (checkTerminated(d, empty, child2)) {\n return;\n }\n if (empty) {\n break;\n }\n R v = nl.getValue(o);\n try {\n child2.onNext(v);\n r--;\n e--;\n } catch (Throwable ex) {\n Exceptions.throwOrReport(ex, child2, v);\n return;\n }\n }\n if (e != 0 && !max) {\n r = requested2.addAndGet(e);\n }\n synchronized (this) {\n if (!this.missed) {\n this.emitting = false;\n return;\n }\n this.missed = false;\n }\n } else {\n return;\n }\n }\n }", "@Override\r\n protected void compute() {\r\n //if count != 0 || splitA.length == 1 then go, else for loop to make splitA.length subtasks to run splitArrayB and then they all call mergeAB\r\n if(global_count == 0){\r\n splitArrayB();\r\n }\r\n if(global_count != 0 || splitA.length == 1){\r\n mergeAB();\r\n }\r\n else{\r\n List<ConcurrentMerge> subtasks = new ArrayList<>();\r\n ConcurrentMerge temp;\r\n for(int i = 0; i < splitA.length; i++){\r\n global_count++;\r\n temp = new ConcurrentMerge(A, B, splitA, splitB, C, global_count);\r\n subtasks.add(temp);\r\n }\r\n invokeAll(subtasks);\r\n }\r\n }", "private void postLocal() {\n reduce3(_nleft); // Reduce global results from neighbors.\n reduce3(_nrite);\n if( _fs != null ) // Block on all other pending tasks, also\n _fs.blockForPending();\n // Finally, must return all results in 'this' because that is the API -\n // what the user expects\n int nlo = _nlo, nhi = _nhi; // Save these before copyOver crushes them\n if( _res == null ) _nlo = -1; // Flag for no local results *at all*\n else if( _res != this ) // There is a local result, and its not self\n copyOver(_res); // So copy into self\n if( nlo==0 && nhi == H2O.CLOUD.size() ) // All-done on head of whole MRTask tree?\n _fr.closeAppendables(); // Final close ops on any new appendable vec\n }", "public void runExploration() {\n List<Queue<String>> smallSkierQueues = partitionQueue(skierQueue);\n List<Queue<String>> smallLiftQueues = partitionQueue(liftQueue);\n List<Queue<String>> smallhourQueues = partitionQueue(hourQueue);\n\n // run threads here\n long startTime = System.nanoTime();\n for(int i = 0; i < 8; i++) {\n SmallSkierThread runSmallSkier = new SmallSkierThread(smallSkierQueues.get(i));\n SmallLiftThread runSmallLift = new SmallLiftThread(smallLiftQueues.get(i));\n SmallHourThread runSmallHour = new SmallHourThread(smallhourQueues.get(i));\n runSmallSkier.start();\n runSmallHour.start();\n runSmallLift.start();\n }\n // -> Aggregate results here\n // ...\n // ...\n // ...\n // <- End aggregation\n long endTime = System.nanoTime();\n long duration = endTime - startTime;\n System.out.println(\"Concurrent Solution Runtime: \" + duration/1000f + \" microseconds\");\n }", "@Override\n protected void runOneIteration() throws Exception {\n }", "private void buildPostingList(){\n boolean isEndOfList = false;\n// boolean moveToNextDoc = false;\n ArrayList<Integer> tempList = new ArrayList<>(); // tempList to hold doc wise posting List\n\n while(!isEndOfList){\n boolean skipDoc = false;\n int doc = children.get(0).nextCandidate();\n if(doc == -1) {\n // End of list. No more windows to collect. Exit.\n isEndOfList = true; break;\n }\n int distance = super.getDiskReader().getRetrievedDocToLengthMap().get(doc);\n // Check if doc exists in all other children.\n // If it exists, skip to that Document.\n for(QueryNode child : children){\n /* skipToDoc skips the pointer in child node to the current doc.\n */\n if(!child.skipToDoc(doc)) {\n skipDoc = true;\n break;\n }\n\n }\n if(!skipDoc) {\n /* From here, all nodes have the document. Proceed to calculating number of windows in doc */\n\n tempList.clear();\n tempList.add(doc); //\n tempList.add(0); // doc term frequency. We will update this later.\n int fkid = 0; // doc term frequency tracker\n// int i = startTermIndex+1;\n int minPosIndex = 0; // holds the index of the node which has current minimum Pos\n int minPos = children.get(minPosIndex).nextPos(); // initialize min Pos.\n boolean isEndOfDoc = false;\n while(!isEndOfDoc) {\n if(minPos == -1) break; // End of document. Move to next doc\n for (int i = 0; i < children.size(); i++) {\n int pos = children.get(i).nextPos();\n if(pos == -1){\n isEndOfDoc = true;\n break;\n }\n if (pos < minPos) {\n minPos = pos;\n minPosIndex = i;\n }\n }\n if(isEndOfDoc) break;\n /* Check for window size against min pos */\n for (int i = 0; i < children.size(); i++) {\n int pos = children.get(i).nextPos();\n\n if (pos - minPos < distance) {\n // Valid candidate so far.\n // check if last term.\n if (i == children.size() - 1) {\n tempList.add(children.get(minPosIndex).nextPos());\n fkid++;\n // update all the child node pointers to next position. No double dipping\n for(QueryNode child : children)\n child.updatePos();\n\n\n }\n\n } else {\n // Candidate failed.\n // update minimum position to next pos and repeat process\n children.get(minPosIndex).updatePos();\n minPos = children.get(minPosIndex).nextPos();\n break;\n\n }\n }\n\n }\n\n\n /* The document has been consumed. If the temp List size is > 2, we have collected windows.\n Add them to the posting list.\n */\n if (tempList.size() > 2) {\n tempList.set(1, fkid);\n cqi += fkid;\n postingList.addAll(new ArrayList<>(tempList));\n }\n }\n// if(moveToNextDoc) continue;\n children.get(0).updateToNextDoc();\n }\n }", "public void resolvePageReferences()\n{\n int count = _pages.size();\n while(count-- > 0)\n getPage(count).resolvePageReferences(this);\n}", "@Override\n protected abstract SecondOrderCollection wrapped();", "private void processUnprocessed()\n {\n List<Geometry> unprocAdds;\n myUnprocessedGeometryLock.lock();\n try\n {\n // Processing the unprocessed geometries may result in them being\n // added back to one of the unprocessed maps, so create a clean set\n // of maps for them to be added to.\n if (myUnprocessedAdds.isEmpty())\n {\n unprocAdds = null;\n }\n else\n {\n unprocAdds = myUnprocessedAdds;\n myUnprocessedAdds = New.list();\n }\n }\n finally\n {\n myUnprocessedGeometryLock.unlock();\n }\n\n if (unprocAdds != null)\n {\n distributeGeometries(unprocAdds, Collections.<Geometry>emptyList());\n }\n }", "void assignToLists() {\n\n int lastOuterIndex = -1;\n int lastRightIndex = -1;\n for (int i = 0; i < rangeVariables.length; i++) {\n if (rangeVariables[i].isLeftJoin) {\n lastOuterIndex = i;\n }\n if(rangeVariables[i].isRightJoin) {\n lastOuterIndex = i;\n lastRightIndex = i;\n }\n\n if (lastOuterIndex == i) {\n joinExpressions[i].addAll(tempJoinExpressions[i]);\n } else {\n for (int j = 0; j < tempJoinExpressions[i].size(); j++) {\n assignToJoinLists(\n (Expression) tempJoinExpressions[i].get(j),\n joinExpressions, lastOuterIndex + 1);\n }\n }\n }\n\n for (int i = 0; i < queryExpressions.size(); i++) {\n assignToWhereLists((Expression) queryExpressions.get(i),\n whereExpressions, lastRightIndex);\n }\n }", "private void dispatch(List<Request> requests) {\n List<Request> inbox = new ArrayList<>(requests);\n\n // run everything in a single transaction\n dao.tx(tx -> {\n int offset = 0;\n Set<UUID> projectsToSkip = new HashSet<>();\n\n while (true) {\n // fetch the next few ENQUEUED processes from the DB\n List<ProcessQueueEntry> candidates = new ArrayList<>(dao.next(tx, offset, BATCH_SIZE));\n if (candidates.isEmpty() || inbox.isEmpty()) {\n // no potential candidates or no requests left to process\n break;\n }\n\n uniqueProjectsHistogram.update(countUniqueProjects(candidates));\n\n // filter out the candidates that shouldn't be dispatched at the moment\n for (Iterator<ProcessQueueEntry> it = candidates.iterator(); it.hasNext(); ) {\n ProcessQueueEntry e = it.next();\n\n // currently there are no filters applicable to standalone (i.e. without a project) processes\n if (e.projectId() == null) {\n continue;\n }\n\n // see below\n if (projectsToSkip.contains(e.projectId())) {\n it.remove();\n continue;\n }\n\n // TODO sharded locks?\n boolean locked = dao.tryLock(tx);\n if (!locked || !pass(tx, e)) {\n // the candidate didn't pass the filter or can't lock the queue\n // skip to the next candidate (of a different project)\n it.remove();\n }\n\n // only one process per project can be dispatched at the time, currently the filters are not\n // designed to run multiple times per dispatch \"tick\"\n\n // TODO\n // this can be improved if filters accepted a list of candidates and returned a list of\n // those who passed. However, statistically each batch of candidates contains unique project IDs\n // so \"multi-entry\" filters are less effective and just complicate things\n // in the future we might need to consider batching up candidates by project IDs and using sharded\n // locks\n projectsToSkip.add(e.projectId());\n }\n\n List<Match> matches = match(inbox, candidates);\n if (matches.isEmpty()) {\n // no matches, try fetching the next N records\n offset += BATCH_SIZE;\n continue;\n }\n\n for (Match m : matches) {\n ProcessQueueEntry candidate = m.response;\n\n // mark the process as STARTING and send it to the agent\n // TODO ProcessQueueDao#updateStatus should be moved to ProcessManager because it does two things (updates the record and inserts a status history entry)\n queueDao.updateStatus(tx, candidate.key(), ProcessStatus.STARTING);\n\n sendResponse(m);\n\n inbox.remove(m.request);\n }\n }\n });\n }", "private boolean completeConcurrentRules(\r\n\t\t\tfinal Rule r,\r\n\t\t\tfinal int rIndx,\r\n\t\t\tfinal List<List<ConcurrentRule>> crsOfRule,\r\n\t\t\tfinal int listIndx,\r\n\t\t\tfinal Hashtable<?, ?> matchmap) {\n \t\t\r\n\t\tboolean res = false;\r\n\t\tif (listIndx >= crsOfRule.size()) {\r\n\t\t\tint x = listIndx;\r\n\t\t\tint preIndx = rIndx-1;\r\n\t\t\tRule preRule = this.ruleSequence.getRule(preIndx);\r\n\t\t\tif (x == 0) {\r\n\t\t\t\tList<ConcurrentRule> list = this.makeConcurrentRulesDuetoDependency(preRule, preIndx, r, rIndx, matchmap);\t\t\t\t\r\n\t\t\t\tcrsOfRule.add(list);\r\n\t\t\t\tres = true;\r\n\t\t\t} else {\r\n\t\t\t\tList<ConcurrentRule>\r\n\t\t\t\tcrListOfPreRule = this.getConcurrentRulesOfRule(preRule, preIndx, x-1);\r\n\t\t\t\tif (crListOfPreRule == null || crListOfPreRule.isEmpty()) {\r\n\t\t\t\t\t// create a new list of lists to fill\r\n\t\t\t\t\tfinal List<List<ConcurrentRule>> \r\n\t\t\t\t\tconRuleListsOfPreRule = this.getListsOfConcurrentRulesOfRule(preRule, preIndx);\t\r\n\t\t\t\t\t// put this list to fill\r\n\t\t\t\t\tthis.completeConcurrentRules(preRule, rIndx-1, conRuleListsOfPreRule, x-1, matchmap);\r\n\t\t\t\t\t// get the (x-1) list\r\n\t\t\t\t\tcrListOfPreRule = this.getConcurrentRulesOfRule(preRule, preIndx, x-1);\r\n\t\t\t\t} \r\n\t\t\t\t\t\r\n\t\t\t\tif (crListOfPreRule != null) {\r\n\t\t\t\t\tfinal List<ConcurrentRule> list = new Vector<ConcurrentRule>();\r\n\t\t\t\t\tfor (int c=0; c<crListOfPreRule.size(); c++) {\r\n\t\t\t\t\t\tfinal ConcurrentRule cr = crListOfPreRule.get(c);\r\n\t\t\t\t\t\tlist.addAll(this.makeConcurrentRulesDuetoDependency(cr, r, matchmap));\r\n\t\t\t\t\t}\r\n\t\t\t\t\twhile (crsOfRule.size() < x) {\r\n\t\t\t\t\t\tcrsOfRule.add(new Vector<ConcurrentRule>());\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcrsOfRule.add(list);\r\n\t\t\t\t\tres = true;\r\n\t\t\t\t}\t\t\t\t\t\r\n\t\t\t}\r\n\t\t}\t\t\r\n\t\treturn res;\r\n\t}", "private Collection<?> buildForEachCollection(final ExecutionContext executionContext)\n {\n String text = foreach.getTextTrim();\n if (text != null && text.startsWith(\"#{\"))\n {\n return evaluateForEachExpression(executionContext, text);\n }\n return (Collection<?>) FieldInstantiator.getValue(List.class, foreach);\n }", "private void prepareTheList()\n {\n int count = 0;\n for (String imageName : imageNames)\n {\n RecyclerUtils pu = new RecyclerUtils(imageName, imageDescription[count] ,images[count]);\n recyclerUtilsList.add(pu);\n count++;\n }\n }", "public void m17237a(java.util.List<java.lang.Integer> r6) {\n /*\n r5 = this;\n r0 = 0;\n if (r6 == 0) goto L_0x0009;\n L_0x0003:\n r1 = r6.size();\n if (r1 != 0) goto L_0x000a;\n L_0x0009:\n return;\n L_0x000a:\n r1 = r5.f20994d;\n r1.lock();\n r2 = r5.m17234d();\n r1 = \"\";\n L_0x0016:\n r3 = r6.size();\t Catch:{ SQLiteException -> 0x0077, IllegalStateException -> 0x00a0, Exception -> 0x00c9 }\n if (r0 >= r3) goto L_0x003b;\n L_0x001c:\n r3 = new java.lang.StringBuilder;\t Catch:{ SQLiteException -> 0x0077, IllegalStateException -> 0x00a0, Exception -> 0x00c9 }\n r3.<init>();\t Catch:{ SQLiteException -> 0x0077, IllegalStateException -> 0x00a0, Exception -> 0x00c9 }\n r1 = r3.append(r1);\t Catch:{ SQLiteException -> 0x0077, IllegalStateException -> 0x00a0, Exception -> 0x00c9 }\n r3 = r6.get(r0);\t Catch:{ SQLiteException -> 0x0077, IllegalStateException -> 0x00a0, Exception -> 0x00c9 }\n r1 = r1.append(r3);\t Catch:{ SQLiteException -> 0x0077, IllegalStateException -> 0x00a0, Exception -> 0x00c9 }\n r3 = \",\";\n r1 = r1.append(r3);\t Catch:{ SQLiteException -> 0x0077, IllegalStateException -> 0x00a0, Exception -> 0x00c9 }\n r1 = r1.toString();\t Catch:{ SQLiteException -> 0x0077, IllegalStateException -> 0x00a0, Exception -> 0x00c9 }\n r0 = r0 + 1;\n goto L_0x0016;\n L_0x003b:\n r0 = r1.length();\t Catch:{ SQLiteException -> 0x0077, IllegalStateException -> 0x00a0, Exception -> 0x00c9 }\n if (r0 <= 0) goto L_0x006e;\n L_0x0041:\n r0 = 0;\n r3 = r1.length();\t Catch:{ SQLiteException -> 0x0077, IllegalStateException -> 0x00a0, Exception -> 0x00c9 }\n r3 = r3 + -1;\n r0 = r1.substring(r0, r3);\t Catch:{ SQLiteException -> 0x0077, IllegalStateException -> 0x00a0, Exception -> 0x00c9 }\n r1 = \"result\";\n r3 = new java.lang.StringBuilder;\t Catch:{ SQLiteException -> 0x0077, IllegalStateException -> 0x00a0, Exception -> 0x00c9 }\n r3.<init>();\t Catch:{ SQLiteException -> 0x0077, IllegalStateException -> 0x00a0, Exception -> 0x00c9 }\n r4 = \"_id in (\";\n r3 = r3.append(r4);\t Catch:{ SQLiteException -> 0x0077, IllegalStateException -> 0x00a0, Exception -> 0x00c9 }\n r0 = r3.append(r0);\t Catch:{ SQLiteException -> 0x0077, IllegalStateException -> 0x00a0, Exception -> 0x00c9 }\n r3 = \")\";\n r0 = r0.append(r3);\t Catch:{ SQLiteException -> 0x0077, IllegalStateException -> 0x00a0, Exception -> 0x00c9 }\n r0 = r0.toString();\t Catch:{ SQLiteException -> 0x0077, IllegalStateException -> 0x00a0, Exception -> 0x00c9 }\n r3 = 0;\n r2.delete(r1, r0, r3);\t Catch:{ SQLiteException -> 0x0077, IllegalStateException -> 0x00a0, Exception -> 0x00c9 }\n L_0x006e:\n r2.close();\n r0 = r5.f20994d;\n r0.unlock();\n goto L_0x0009;\n L_0x0077:\n r0 = move-exception;\n r1 = \"SynthesizeResultDb\";\n r3 = new java.lang.StringBuilder;\t Catch:{ all -> 0x00f2 }\n r3.<init>();\t Catch:{ all -> 0x00f2 }\n r4 = \"exception:\";\n r3 = r3.append(r4);\t Catch:{ all -> 0x00f2 }\n r0 = r0.toString();\t Catch:{ all -> 0x00f2 }\n r0 = r3.append(r0);\t Catch:{ all -> 0x00f2 }\n r0 = r0.toString();\t Catch:{ all -> 0x00f2 }\n com.baidu.tts.chainofresponsibility.logger.LoggerProxy.m17001d(r1, r0);\t Catch:{ all -> 0x00f2 }\n r2.close();\n r0 = r5.f20994d;\n r0.unlock();\n goto L_0x0009;\n L_0x00a0:\n r0 = move-exception;\n r1 = \"SynthesizeResultDb\";\n r3 = new java.lang.StringBuilder;\t Catch:{ all -> 0x00f2 }\n r3.<init>();\t Catch:{ all -> 0x00f2 }\n r4 = \"exception:\";\n r3 = r3.append(r4);\t Catch:{ all -> 0x00f2 }\n r0 = r0.toString();\t Catch:{ all -> 0x00f2 }\n r0 = r3.append(r0);\t Catch:{ all -> 0x00f2 }\n r0 = r0.toString();\t Catch:{ all -> 0x00f2 }\n com.baidu.tts.chainofresponsibility.logger.LoggerProxy.m17001d(r1, r0);\t Catch:{ all -> 0x00f2 }\n r2.close();\n r0 = r5.f20994d;\n r0.unlock();\n goto L_0x0009;\n L_0x00c9:\n r0 = move-exception;\n r1 = \"SynthesizeResultDb\";\n r3 = new java.lang.StringBuilder;\t Catch:{ all -> 0x00f2 }\n r3.<init>();\t Catch:{ all -> 0x00f2 }\n r4 = \"exception:\";\n r3 = r3.append(r4);\t Catch:{ all -> 0x00f2 }\n r0 = r0.toString();\t Catch:{ all -> 0x00f2 }\n r0 = r3.append(r0);\t Catch:{ all -> 0x00f2 }\n r0 = r0.toString();\t Catch:{ all -> 0x00f2 }\n com.baidu.tts.chainofresponsibility.logger.LoggerProxy.m17001d(r1, r0);\t Catch:{ all -> 0x00f2 }\n r2.close();\n r0 = r5.f20994d;\n r0.unlock();\n goto L_0x0009;\n L_0x00f2:\n r0 = move-exception;\n r2.close();\n r1 = r5.f20994d;\n r1.unlock();\n throw r0;\n */\n throw new UnsupportedOperationException(\"Method not decompiled: com.baidu.tts.e.c.a(java.util.List):void\");\n }", "private static ArrayList<MyAbstractContainer> variousBBC_concurrency() {\n ArrayList<MyAbstractContainer> result = new ArrayList<MyAbstractContainer>();\n for (ByteBuffer bb : variousBB_concurrency(CONCURRENCY_TEST_SIZE)) {\n result.add(new MyBBContainer(bb));\n }\n return result;\n }", "@Override\r\n\t\t\tpublic void run() {\n\t\t\t\tlong start=System.currentTimeMillis();\r\n\t\t\t\tHashSetAdd hsd=new HashSetAdd();\r\n\t\t\t\tHashSet<String> hs2=hsd.add();\r\n\t\t\t\tSystem.out.println(\"size2=:\"+hs2.size());\r\n\t\t\t\tIterator<String> iter = hs2.iterator();\r\n\t\t\t\twhile(iter.hasNext()){\r\n\t\t\t\t String result = iter.next();\r\n\t\t\t\t }\r\n\t\t\t\t\r\n\t\t\t\tlong end=System.currentTimeMillis();\r\n\t\t\t\tSystem.out.println(\"time2=: \"+(end-start));\r\n\t\t\t}", "@Override protected void compute2() {\n addToPendingCount(_env.peekAry().numCols()-1);\n int nchks=0;\n for (int i =0; i < _argcnt; ++i)\n nchks+=_env.peekAryAt(-i).anyVec().nChunks();\n\n _espc = new long[nchks+1];\n int coffset = _env.peekAry().anyVec().nChunks();\n long[] first_espc = _env.peekAry().anyVec().get_espc();\n System.arraycopy(first_espc, 0, _espc, 0, first_espc.length);\n for (int i=1; i< _argcnt; ++i) {\n long roffset = _espc[coffset];\n long[] espc = _env.peekAryAt(-i).anyVec().get_espc();\n int j = 1;\n for (; j < espc.length; j++)\n _espc[coffset + j] = roffset+ espc[j];\n coffset += _env.peekAryAt(-i).anyVec().nChunks();\n }\n\n Key[] keys = _env.peekAry().anyVec().group().addVecs(_env.peekAry().numCols());\n _vecs = new Vec[keys.length];\n for (int i=0; i<_vecs.length; ++i)\n _vecs[i] = new Vec( keys[i], _espc, null, _env.peekAry().vec(i).get_type());\n\n for (int i=0; i < Math.min(_maxP, _vecs.length); ++i) forkVecTask(i);\n }", "private void primeNext() {\n if (currentIterator != null && currentIterator.hasNext()) {\n return;\n }\n\n // Move to the next collection.\n collectionIndex++;\n\n // If we are out of bounds, we are done.\n if (collectionIndex >= collections.length) {\n currentIterator = null;\n return;\n }\n\n currentIterator = collections[collectionIndex].iterator();\n\n // This iterator may be empty, so just try to prime again.\n primeNext();\n }", "void prefetchValues(Collection<R> entities);", "void queueInternalLinks(Elements paragraphs) {\n // FILL THIS IN!\n\t\tfor(Element paragraph: paragraphs)\n\t\t{\n\t\t\tIterable<Node> iterator = new WikiNodeIterable(paragraph);\n\t\t\tfor(Node node: iterator)\n\t\t\t{\n\t\t\t\tif(node instanceof Element)\n\t\t\t\t{\n\t\t\t\t\tString link = node.attr(\"href\");\n\t\t\t\t\tif(link.startsWith(\"/wiki/\"))\n\t\t\t\t\t{\n\t\t\t\t\t\tqueue.add(\"https://en.wikipedia.org\" + ((Element)node).attr(\"href\"));\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private void goForwardOne() \n {\n if (m_bufferOffset_ < 0) {\n // we're working on the source and not normalizing. fast path.\n // note Thai pre-vowel reordering uses buffer too\n m_source_.setIndex(m_source_.getIndex() + 1);\n }\n else {\n // we are in the buffer, buffer offset will never be 0 here\n m_bufferOffset_ ++;\n }\n }", "@Override\r\n\tprotected void onReduceMp()\r\n\t{\n\t}", "public GridLongList flush() {\n GridLongList res = null;\n\n if (size == 0) {\n boolean stripesChanged = false;\n\n if (emptyFlushCnt >= 0 && ++emptyFlushCnt >= EMPTY_FLUSH_GC_THRESHOLD) {\n for (int i = 0; i < STRIPES_COUNT; i++) {\n synchronized (stripeLocks[i]) {\n GridLongList stripe = stripes[i];\n\n if (stripe != null) {\n if (stripe.isEmpty())\n stripes[i] = null;\n else {\n // Pages were concurrently added to the stripe.\n stripesChanged = true;\n\n break;\n }\n }\n }\n }\n\n if (!stripesChanged)\n emptyFlushCnt = -1;\n }\n\n if (!stripesChanged)\n return null;\n }\n\n emptyFlushCnt = 0;\n\n for (int i = 0; i < STRIPES_COUNT; i++) {\n synchronized (stripeLocks[i]) {\n GridLongList stripe = stripes[i];\n\n if (stripe != null && !stripe.isEmpty()) {\n if (res == null)\n res = new GridLongList(size);\n\n if (sizeUpdater.addAndGet(this, -stripe.size()) == 0 && pagesCacheLimit != null)\n pagesCacheLimit.incrementAndGet();\n\n res.addAll(stripe);\n\n stripe.clear();\n }\n }\n }\n\n return res;\n }", "protected void runBeforeIterations() {}", "protected void runAfterIteration() {}", "private void doBuildScroller() {\r\n\t\t\r\n\t}", "protected ClusterMerger updateBeam()\n {\n for (boolean process = false; !process; )\n {\n ClusterMerger top = beam.getFirst();\n process = top.getDepth() >= maxDepth;\n\n if (!process)\n {\n ClusterMerger merger = top.next();\n if (merger != null) beam.addFirst(merger);\n else process = true;\n }\n }\n\n return beam.removeFirst();\n }", "@SuppressWarnings(\"unused\")\n\t@Override\n\tpublic void run() {\n\t\tList<LineageCacheEntry> lockedOrLiveEntries = new ArrayList<>();\n\t\tint count = 0;\n\n\t\t// Stop if 1) Evicted the request number of entries, 2) The parallel\n\t\t// CPU instruction is ended, and 3) No non-live entries left in the cache.\n\t\tlong t0 = DMLScript.STATISTICS ? System.nanoTime() : 0;\n\t\t/*while (!LineageGPUCacheEviction.isGPUCacheEmpty())\n\t\t{\n\t\t\tif (LineageCacheConfig.STOPBACKGROUNDEVICTION)\n\t\t\t\t// This logic reduces #evictions if the cpu instructions is so small\n\t\t\t\t// that it ends before the background thread reaches this condition.\n\t\t\t\t// However, this check decreases race conditions.\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tif (numEvicts > 0 && count > numEvicts)\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tLineageCacheEntry le = LineageGPUCacheEviction.pollFirstEntry();\n\t\t\tGPUObject cachedGpuObj = le.getGPUObject();\n\t\t\tGPUObject headGpuObj = cachedGpuObj.lineageCachedChainHead != null\n\t\t\t\t\t? cachedGpuObj.lineageCachedChainHead : cachedGpuObj;\n\t\t\t// Check and continue if any object in the linked list is locked\n\t\t\tboolean lockedOrLive = false;\n\t\t\tGPUObject nextgpuObj = headGpuObj;\n\t\t\twhile (nextgpuObj!= null) {\n\t\t\t\tif (!nextgpuObj.isrmVarPending() || nextgpuObj.isLocked()) // live or locked\n\t\t\t\t\tlockedOrLive = true;\n\t\t\t\tnextgpuObj = nextgpuObj.nextLineageCachedEntry;\n\t\t\t}\n\t\t\tif (lockedOrLive) {\n\t\t\t\tlockedOrLiveEntries.add(le);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// TODO: First remove the gobj chains that don't contain any live and dirty objects.\n\t\t\t//currentAvailableMemory += headGpuObj.getSizeOnDevice();\n\n\t\t\t// Copy from device to host for all live and dirty objects\n\t\t\tboolean copied = false;\n\t\t\tnextgpuObj = headGpuObj;\n\t\t\twhile (nextgpuObj!= null) {\n\t\t\t\t// Keeping isLinCached as True here will save data deletion by copyFromDeviceToHost\n\t\t\t\tif (!nextgpuObj.isrmVarPending() && nextgpuObj.isDirty()) { //live and dirty\n\t\t\t\t\tnextgpuObj.copyFromDeviceToHost(null, true, true);\n\t\t\t\t\tcopied = true;\n\t\t\t\t}\n\t\t\t\tnextgpuObj.setIsLinCached(false);\n\t\t\t\tnextgpuObj = nextgpuObj.nextLineageCachedEntry;\n\t\t\t}\n\n\t\t\t// Copy from device cache to CPU lineage cache if not already copied\n\t\t\tLineageGPUCacheEviction.copyToHostCache(le, null, copied);\n\n\t\t\t// For all the other objects, remove and clear data (only once)\n\t\t\tnextgpuObj = headGpuObj;\n\t\t\tboolean freed = false;\n\t\t\tsynchronized (nextgpuObj.getGPUContext().getMemoryManager().getGPUMatrixMemoryManager().gpuObjects) {\n\t\t\t\twhile (nextgpuObj!= null) {\n\t\t\t\t\t// If not live or live but not dirty\n\t\t\t\t\tif (nextgpuObj.isrmVarPending() || !nextgpuObj.isDirty()) {\n\t\t\t\t\t\tif (!freed) {\n\t\t\t\t\t\t\tnextgpuObj.clearData(null, true);\n\t\t\t\t\t\t\t//FIXME: adding to rmVar cache causes multiple failures due to concurrent\n\t\t\t\t\t\t\t//access to the rmVar cache and other data structures. VariableCP instruction\n\t\t\t\t\t\t\t//and other instruction free memory and add to rmVar cache in parallel to\n\t\t\t\t\t\t\t//the background eviction task, which needs to be synchronized.\n\t\t\t\t\t\t\tfreed = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tnextgpuObj.clearGPUObject();\n\t\t\t\t\t}\n\t\t\t\t\tnextgpuObj = nextgpuObj.nextLineageCachedEntry;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Clear the GPUOjects chain\n\t\t\tGPUObject currgpuObj = headGpuObj;\n\t\t\twhile (currgpuObj.nextLineageCachedEntry != null) {\n\t\t\t\tnextgpuObj = currgpuObj.nextLineageCachedEntry;\n\t\t\t\tcurrgpuObj.lineageCachedChainHead = null;\n\t\t\t\tcurrgpuObj.nextLineageCachedEntry = null;\n\t\t\t\tnextgpuObj.lineageCachedChainHead = null;\n\t\t\t\tcurrgpuObj = nextgpuObj;\n\t\t\t}\n\n\t\t\t//if(currentAvailableMemory >= size)\n\t\t\t\t// This doesn't guarantee allocation due to fragmented freed memory\n\t\t\t//\tA = cudaMallocNoWarn(tmpA, size, null); \n\t\t\tif (DMLScript.STATISTICS) {\n\t\t\t\tLineageCacheStatistics.incrementGpuAsyncEvicts();\n\t\t\t}\n\t\t\tcount++;\n\t\t}\n\n\t\t// Add the locked entries back to the eviction queue\n\t\tif (!lockedOrLiveEntries.isEmpty())\n\t\t\tLineageGPUCacheEviction.addEntryList(lockedOrLiveEntries);\n\t\t\n\t\tif (DMLScript.STATISTICS) //TODO: dedicated statistics for lineage\n\t\t\tGPUStatistics.cudaEvictTime.add(System.nanoTime() - t0); */\n\t}", "BasicSet NextLClosure(BasicSet M,BasicSet A){\r\n\t\t//ConceptLattice cp=new ConceptLattice(context);\r\n\t\t//ApproximationSimple ap=new ApproximationSimple(cp);\r\n\t\tMap <String,Integer> repbin=this.RepresentationBinaire(M);\r\n\t\tVector<BasicSet> fermes=new Vector<BasicSet>();\r\n\t\tSet<String> key=repbin.keySet();\r\n\t\tObject[] items= key.toArray();\r\n\r\n\t\t/* on recupere la position i qui correspond a la derniere position de M*/\r\n\t\tint i=M.size()-1;\r\n\t\tboolean success=false;\r\n\t\tBasicSet plein=new BasicSet();\r\n\t\tVector <String> vv=context.getAttributes();\r\n\t\tplein.addAll(vv);\r\n\r\n\r\n\t\twhile(success==false ){\t\t\r\n\r\n\t\t\tString item=items[i].toString();\r\n\r\n\t\t\tif(!A.contains(item)){\t\r\n\r\n\t\t\t\t/* Ensemble contenant item associe a i*/\r\n\t\t\t\tBasicSet I=new BasicSet();\r\n\t\t\t\tI.add(item);\r\n\r\n\t\t\t\t/*A union I*/\t\r\n\t\t\t\tA=A.union(I);\r\n\t\t\t\tBasicSet union=(BasicSet) A.clone();\r\n\t\t\t\t//System.out.println(\" union \"+union);\r\n\r\n\t\t\t\t//fermes.add(union);\r\n\r\n\t\t\t\tfermes.add(union);\r\n\r\n\r\n\t\t\t\t/* Calcul du ferme de A*/\r\n\r\n\r\n\t\t\t\tBasicSet b=this.LpClosure(A);\r\n\t\t\t\t//System.out.println(\"b procchain \"+b);\r\n\r\n\t\t\t\tBasicSet diff=new BasicSet();\r\n\t\t\t\tdiff=b.difference(A);\r\n\t\t\t\tMap <String,Integer> repB=this.RepresentationBinaire(diff);\r\n\t\t\t\tBasicSet test=new BasicSet();\r\n\t\t\t\tMap <String,Integer> testt=RepresentationBinaire(test);\r\n\t\t\t\ttestt.put(item, 1);\r\n\r\n\t\t\t\t/* on teste si l ensemble B\\A est plus petit que l ensemble contenant i\r\n\t\t\t\t * Si B\\A est plus petit alors on affecte B à A.\r\n\t\t\t\t **/\r\n\r\n\t\t\t\tif(item.equals(b.first())||LecticOrder(repB,testt)){\r\n\t\t\t\t\t//System.out.println(\"A succes=true \"+ A);\r\n\t\t\t\t\tA=b;\r\n\t\t\t\t\tsuccess=true;\t \r\n\r\n\t\t\t\t}else{\r\n\t\t\t\t\tA.remove(item);\r\n\t\t\t\t}\t\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tA.remove(item);\r\n\t\t\t}\t\t\t\r\n\t\t\ti--;\r\n\t\t}\t\t\r\n\t\treturn A;\r\n\t}", "private void c()\r\n/* 91: */ {\r\n/* 92:103 */ for (cvl localcvl : this.d) {\r\n/* 93:104 */ localcvl.a(this);\r\n/* 94: */ }\r\n/* 95: */ }", "private static ArrayDeque<View> m36213i(View view) {\n ArrayDeque<View> arrayDeque = new ArrayDeque<>();\n int i = 0;\n View view2 = view;\n while (true) {\n if (view2.getParent() == null && view2 != view.getRootView()) {\n break;\n }\n i++;\n if (i <= 50) {\n arrayDeque.add(view2);\n if (!(view2.getParent() instanceof View)) {\n break;\n }\n view2 = (View) view2.getParent();\n } else {\n C10969p.m36113a(3, \"VisibilityInfo\", (Object) null, \"Short-circuiting chain retrieval, reached max\");\n break;\n }\n }\n return arrayDeque;\n }", "@Override\r\n\tprotected void compute() {\n\t\t\r\n\t}", "private void startHeavyLifting(int first, int count)\n {\n }", "@Override\n public void build() {\n\n // Create the missive\n this.createMissive();\n }", "private void processQueue() {\n WeakValue<V, K> weakValue;\n while ((weakValue = (WeakValue<V, K>) queue.poll()) != null) {\n // remove it from the cache\n weakCache.remove(weakValue.key);\n }\n }", "public void c() {\n List<Long> b2 = this.f17034e.b();\n ArrayList arrayList = new ArrayList();\n List<Long> a2 = this.f17035f.a(new OrderKey(false, 9));\n new ArrayList();\n ArrayList arrayList2 = new ArrayList();\n ArrayList arrayList3 = new ArrayList();\n for (Long next : b2) {\n DBCheckoutItem a3 = this.f17032c.a(next.longValue());\n if (a3 == null) {\n arrayList.add(next);\n } else {\n CheckoutItem checkoutItem = new CheckoutItem();\n List<DBOrderDetail> a4 = this.i.a(next);\n ArrayList arrayList4 = new ArrayList();\n for (DBOrderDetail next2 : a4) {\n DBUserInfo a5 = this.f17033d.a(next2.c());\n if (a5 == null) {\n arrayList3.add(Integer.valueOf(next2.c()));\n }\n DBUserInfo a6 = this.f17033d.a(next2.E());\n if (a6 == null) {\n arrayList3.add(Integer.valueOf(next2.E()));\n }\n OrderDetail orderDetail = new OrderDetail();\n if (this.f17033d.c(next2.E())) {\n b.a(next2, a5, orderDetail);\n } else {\n b.a(next2, a6, orderDetail);\n }\n long firstItemSnapshotId = orderDetail.getFirstItemSnapshotId();\n if (firstItemSnapshotId > 0) {\n DBItemSnapShot c2 = this.f17036g.c(firstItemSnapshotId);\n if (c2 == null) {\n new aq().a(next2.b(), firstItemSnapshotId);\n } else {\n com.shopee.app.data.store.b.a.a(c2, this.h, orderDetail);\n }\n } else {\n com.shopee.app.data.store.b.a.a((DBItemSnapShot) null, this.h, orderDetail);\n }\n if (a2.contains(Long.valueOf(orderDetail.getCheckoutId()))) {\n orderDetail.setUnread(true);\n } else {\n orderDetail.setUnread(false);\n }\n arrayList4.add(orderDetail);\n }\n if (arrayList3.size() > 0) {\n new au().a((List<Integer>) arrayList3);\n }\n List<DBCheckoutOrder> i2 = a3.i();\n ArrayList arrayList5 = new ArrayList();\n for (DBCheckoutOrder a7 : i2) {\n CheckoutOrderInfo checkoutOrderInfo = new CheckoutOrderInfo();\n b.a(a7, (String) null, checkoutOrderInfo);\n arrayList5.add(checkoutOrderInfo);\n }\n b.a(a3, (List<OrderDetail>) arrayList4, (List<CheckoutOrderInfo>) arrayList5, this.j.getChangePaymentOption(), checkoutItem);\n if (a2.contains(Long.valueOf(checkoutItem.getCheckoutId()))) {\n checkoutItem.setUnread(true);\n } else {\n checkoutItem.setUnread(false);\n }\n arrayList2.add(checkoutItem);\n }\n }\n this.f16402a.a(\"CHECKOUT_LIST_LOCAL_LOAD\", new com.garena.android.appkit.b.a(arrayList2));\n }", "public void m63703d() {\n Throwable th;\n ZipCoordinator zipCoordinator = this;\n if (getAndIncrement() == 0) {\n C17455a[] c17455aArr = zipCoordinator.f53839c;\n Observer observer = zipCoordinator.f53837a;\n Object obj = zipCoordinator.f53840d;\n boolean z = zipCoordinator.f53841e;\n int i = 1;\n while (true) {\n int length = c17455aArr.length;\n int i2 = 0;\n int i3 = 0;\n int i4 = 0;\n while (i2 < length) {\n int i5;\n C17455a c17455a = c17455aArr[i2];\n if (obj[i3] == null) {\n boolean z2 = c17455a.f53845c;\n Object poll = c17455a.f53844b.poll();\n boolean z3 = poll == null;\n i5 = i2;\n if (!m63700a(z2, z3, observer, z, c17455a)) {\n if (z3) {\n i4++;\n } else {\n obj[i3] = poll;\n }\n } else {\n return;\n }\n }\n C17455a c17455a2 = c17455a;\n i5 = i2;\n if (c17455a2.f53845c && !z) {\n th = c17455a2.f53846d;\n if (th != null) {\n m63698a();\n observer.onError(th);\n return;\n }\n }\n i3++;\n i2 = i5 + 1;\n }\n if (i4 != 0) {\n i = addAndGet(-i);\n if (i == 0) {\n return;\n }\n } else {\n try {\n observer.onNext(C15684a.m58895a(zipCoordinator.f53838b.apply(obj.clone()), \"The zipper returned a null value\"));\n Arrays.fill(obj, null);\n } catch (Throwable th2) {\n th = th2;\n C15678a.m58850b(th);\n m63698a();\n observer.onError(th);\n return;\n }\n }\n }\n }\n }", "public void process() {\n cycleID.incrementAndGet();\r\n List<ChunkBB> chunkbbs;\r\n synchronized (loadedChunks) {\r\n chunkbbs = new LinkedList<>(loadedChunks);\r\n }\r\n\r\n Condition cond = chunkbbs.stream().map(\r\n b -> GAIA_STATES.WORLD_UUID.eq(b.getWorld())\r\n .and(GAIA_STATES.X.gt(b.getX() * 16))\r\n .and(GAIA_STATES.Z.gt(b.getZ() * 16))\r\n .and(GAIA_STATES.X.le(b.getX() * 16 + 16))\r\n .and(GAIA_STATES.Z.le(b.getZ() * 16 + 16))\r\n ).reduce(DSL.falseCondition(), (a, b) -> a.or(b));\r\n\r\n Gaia.DBI().submit((conf) -> {\r\n DSLContext ctx = DSL.using(conf);\r\n ctxref.set(ctx);\r\n ReturnContainer rec;\r\n\r\n while ((rec = input.poll()) != null) {\r\n switch (rec.getState()) {\r\n case DELETE:\r\n LOG.fine(\"[\" + cycleID + \"]Deleting:\\n\" + rec);\r\n ctx.executeDelete(rec.getRec());\r\n break;\r\n case UPDATE:\r\n try {\r\n LOG.fine(\"[\" + cycleID + \"]Updating:\\n\" + rec);\r\n ctx.executeUpdate(rec.getRec());\r\n } catch (Exception e) {\r\n LOG.log(Level.SEVERE, \"[\" + cycleID + \"]Failed to update record.\\n\" + rec.getRec(), e);\r\n }\r\n break;\r\n default:\r\n LOG.severe(\"[\" + cycleID + \"]Failed to process record.\\n\" + rec.getRec() + \"\\nUnknown state: \" + rec.getState());\r\n }\r\n }\r\n if (output.isEmpty()) {\r\n List<GaiaStatesRecord> recs = ctx\r\n .selectFrom(GAIA_STATES)\r\n .where(GAIA_STATES.TRANSITION_TIME.lt(new Timestamp(System.currentTimeMillis())))\r\n .and(cond)\r\n .fetch();\r\n if (!recs.isEmpty()) {\r\n LOG.fine(\"Adding \" + recs.size() + \" records to output queue.\");\r\n output.addAll(recs);\r\n }\r\n }\r\n ctxref.set(null);\r\n });\r\n }", "private void initializeNextItem() {\n while (!messagesToReturn.hasNext() && dbCursor.hasNext()) {\n messagesToReturn = storageStrategy.extractEventMessages(dbCursor.next(), actualAggregateIdentifier,\n eventSerializer, upcasterChain).iterator();\n }\n next = messagesToReturn.hasNext() ? messagesToReturn.next() : null;\n }", "private synchronized void buildConcreteProcessor(Environment env) throws Exception {\n if (this.concreteProcessor != null && this.source.getLastModified() == this.lastModified) {\n // Nothing changed\n return;\n }\n\n long startTime = System.currentTimeMillis();\n\n // Dispose the old processor, if any\n if (this.concreteProcessor != null) {\n this.concreteProcessor.markForDisposal();\n }\n\n // Get a builder\n TreeBuilder builder = (TreeBuilder)this.builderSelector.select(\"sitemap\");\n ConcreteTreeProcessor newProcessor = new ConcreteTreeProcessor(this);\n long newLastModified;\n this.setupLogger(newProcessor);\n //FIXME (SW): why do we need to enterProcessor here?\n CocoonComponentManager.enterEnvironment(env, this.manager, this);\n try {\n if (builder instanceof Recomposable) {\n ((Recomposable)builder).recompose(this.manager);\n }\n builder.setProcessor(newProcessor);\n\n newLastModified = this.source.getLastModified();\n\n ProcessingNode root = builder.build(this.source);\n\n newProcessor.setProcessorData(builder.getSitemapComponentManager(), root, builder.getDisposableNodes());\n } finally {\n CocoonComponentManager.leaveEnvironment();\n this.builderSelector.release(builder);\n }\n\n if (this.getLogger().isDebugEnabled()) {\n double time = (this.lastModified - startTime) / 1000.0;\n this.getLogger().debug(\"TreeProcessor built in \" + time + \" secs from \" + this.source.getURI());\n }\n\n // Switch to the new processor (ensure it's never temporarily null)\n this.concreteProcessor = newProcessor;\n this.lastModified = newLastModified;\n }", "public void mo442d() {\n long j;\n long j2;\n int i;\n long j3;\n boolean z;\n C0245a[] aVarArr;\n int i2;\n int i3;\n C3683c<? super U> cVar = this.f472a;\n int i4 = 1;\n while (!mo443e()) {\n C0211f<U> fVar = this.f477f;\n long j4 = this.f482m.get();\n boolean z2 = j4 == Long.MAX_VALUE;\n if (fVar != null) {\n j = 0;\n while (true) {\n long j5 = 0;\n Object obj = null;\n while (true) {\n if (j4 == 0) {\n break;\n }\n Object e_ = fVar.mo386e_();\n if (!mo443e()) {\n if (e_ == null) {\n obj = e_;\n break;\n }\n cVar.onNext(e_);\n j++;\n j5++;\n j4--;\n obj = e_;\n } else {\n return;\n }\n }\n if (j5 != 0) {\n if (z2) {\n j4 = Long.MAX_VALUE;\n } else {\n j4 = this.f482m.addAndGet(-j5);\n }\n }\n if (j4 == 0 || obj == null) {\n break;\n }\n }\n } else {\n j = 0;\n }\n boolean z3 = this.f478g;\n C0211f<U> fVar2 = this.f477f;\n C0245a[] aVarArr2 = (C0245a[]) this.f481j.get();\n int length = aVarArr2.length;\n if (!z3 || ((fVar2 != null && !fVar2.mo384b()) || length != 0)) {\n if (length != 0) {\n i = i4;\n long j6 = this.f485p;\n int i5 = this.f486q;\n if (length <= i5 || aVarArr2[i5].f462a != j6) {\n if (length <= i5) {\n i5 = 0;\n }\n int i6 = i5;\n for (int i7 = 0; i7 < length && aVarArr2[i6].f462a != j6; i7++) {\n i6++;\n if (i6 == length) {\n i6 = 0;\n }\n }\n this.f486q = i6;\n this.f485p = aVarArr2[i6].f462a;\n i5 = i6;\n }\n int i8 = i5;\n z = false;\n int i9 = 0;\n while (true) {\n if (i9 >= length) {\n aVarArr = aVarArr2;\n break;\n } else if (!mo443e()) {\n C0245a aVar = aVarArr2[i8];\n Object obj2 = null;\n while (!mo443e()) {\n C0212g<U> gVar = aVar.f467f;\n if (gVar == null) {\n aVarArr = aVarArr2;\n i2 = length;\n } else {\n aVarArr = aVarArr2;\n i2 = length;\n long j7 = 0;\n while (j2 != 0) {\n try {\n obj2 = gVar.mo386e_();\n if (obj2 == null) {\n break;\n }\n cVar.onNext(obj2);\n if (!mo443e()) {\n j2--;\n j7++;\n } else {\n return;\n }\n } catch (Throwable th) {\n Throwable th2 = th;\n C0171b.m584b(th2);\n aVar.dispose();\n this.f479h.mo516a(th2);\n if (!this.f474c) {\n this.f483n.mo407a();\n }\n if (!mo443e()) {\n mo439b(aVar);\n i9++;\n i3 = i2;\n z = true;\n } else {\n return;\n }\n }\n }\n if (j7 != 0) {\n j2 = !z2 ? this.f482m.addAndGet(-j7) : Long.MAX_VALUE;\n aVar.mo433a(j7);\n }\n if (!(j2 == 0 || obj2 == null)) {\n aVarArr2 = aVarArr;\n length = i2;\n }\n }\n boolean z4 = aVar.f466e;\n C0212g<U> gVar2 = aVar.f467f;\n if (z4 && (gVar2 == null || gVar2.mo384b())) {\n mo439b(aVar);\n if (!mo443e()) {\n j++;\n z = true;\n } else {\n return;\n }\n }\n if (j2 == 0) {\n break;\n }\n int i10 = i8 + 1;\n i3 = i2;\n i8 = i10 == i3 ? 0 : i10;\n i9++;\n length = i3;\n aVarArr2 = aVarArr;\n }\n return;\n } else {\n return;\n }\n }\n this.f486q = i8;\n this.f485p = aVarArr[i8].f462a;\n j3 = j;\n } else {\n i = i4;\n j3 = j;\n z = false;\n }\n if (j3 != 0 && !this.f480i) {\n this.f483n.mo408a(j3);\n }\n if (z) {\n i4 = i;\n } else {\n i4 = addAndGet(-i);\n if (i4 == 0) {\n return;\n }\n }\n } else {\n Throwable a = this.f479h.mo515a();\n if (a != C0315e.f669a) {\n if (a == null) {\n cVar.onComplete();\n } else {\n cVar.onError(a);\n }\n }\n return;\n }\n }\n }", "private void pushNow(Recycler.DefaultHandle<?> item)\r\n/* 529: */ {\r\n/* 530:567 */ if ((Recycler.DefaultHandle.access$1500(item) | Recycler.DefaultHandle.access$1100(item)) != 0) {\r\n/* 531:568 */ throw new IllegalStateException(\"recycled already\");\r\n/* 532: */ }\r\n/* 533:570 */ Recycler.DefaultHandle.access$1502(item, Recycler.DefaultHandle.access$1102(item, Recycler.OWN_THREAD_ID));\r\n/* 534: */ \r\n/* 535:572 */ int size = this.size;\r\n/* 536:573 */ if ((size >= this.maxCapacity) || (dropHandle(item))) {\r\n/* 537:575 */ return;\r\n/* 538: */ }\r\n/* 539:577 */ if (size == this.elements.length) {\r\n/* 540:578 */ this.elements = ((Recycler.DefaultHandle[])Arrays.copyOf(this.elements, Math.min(size << 1, this.maxCapacity)));\r\n/* 541: */ }\r\n/* 542:581 */ this.elements[size] = item;\r\n/* 543:582 */ this.size = (size + 1);\r\n/* 544: */ }", "private void addFromQueue()\n\t{\n\t\twhile( humanQueue.size()>0 )\n\t\t\thumans.add(humanQueue.remove(0));\n\t\twhile( zombieQueue.size()>0 )\n\t\t\tzombies.add(zombieQueue.remove(0));\n\t}", "@Override\n\tpublic void run() {\n\t\tresult =\n\t\t\tStream.iterate(new int[]{0, 1}, s -> new int[]{s[1], s[0] + s[1]})\n\t\t\t\t.limit(limit)\n\t\t\t\t.map(n -> n[0])\n\t\t\t\t.collect(toList());\n\n\t}", "public static void Execute ()\n\t{\n\t\tReceiveCollection (SpawnCrawler (target));\n\t\t\n\t\tList<String> initialCollection = overCollection;\n\t\t\n\t\tif ( ! initialCollection.isEmpty ())\n\t\t{\n\t\t\n\t\t\tfor (String collected : initialCollection)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tif (collected.contains (\"http\"))\n\t\t\t\t\tReceiveCollection (SpawnCrawler (collected));\n\t\t\t\telse\n\t\t\t\t\tReceiveCollection (SpawnCrawler (target + collected));\n\t\t\t\t\n\t\t\t}\n\t\t\n\t\t}\n\t\t\n\t\t/*\n\t\t * Several loops should commence here where the system reiteratively goes over all the newly acquired URLs\n\t\t * so it may extend itself beyond the first and second depth.\n\t\t * However this process should be halted once it reaches a certain configurable depth.\n\t\t */\n\t\tint depth = 0;\n\t\tint newFoundings = 0;\n\t\t\n\t\tdepthLoop: while (depth <= MAX_DEPTH)\n\t\t{\n\t\t\t\n\t\t\tfor (String collected : overCollection)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tif (collected.contains (\"http\"))\n\t\t\t\t\tSpawnCrawler (collected);\n\t\t\t\telse\n\t\t\t\t\tSpawnCrawler (target + collected);\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif (newFoundings <= 0)\n\t\t\t\tbreak depthLoop;\n\t\t\t\n\t\t\tdepth++;\n\t\t\t\t\t\t\n\t\t}\n\t\t\n\t}", "@Override\r\n\tpublic void iterateCount() {\n\t\t\r\n\t}", "public List<String> go() throws Exception {\n //start timer\n// long start = System.currentTimeMillis();\n\n // first we generate the candidates of size 1\n createItemsetsOfSize1();\n int itemsetNumber = 1; //the current itemset being looked at\n// int nbFrequentSets = 0;\n\n // the variable numberOfRound represent the max length of the association rules. \n // e.g 3 stay for max 3 words for each rules\n //int numberOfRound = 3;\n int numberOfRound = 3;\n\n //for(int i=0;i<numberOfRound;i++){\n int i = 0;\n while (itemsets.size() > 0 && i < numberOfRound) {\n calculateFrequentItemsets();\n\n if (!itemsets.isEmpty() && i + 1 < numberOfRound) {\n// nbFrequentSets += itemsets.size();\n\n Logger.getLogger(Apriori.class.getName()).log(Level.INFO, \"Found {0} frequent itemsets of size {1} (with support {2}%)\", new Object[]{itemsets.size(), itemsetNumber, minSup * 100});;\n createNewItemsetsFromPreviousOnes();\n }\n i++;\n itemsetNumber++;\n }\n\n return listOfItemsets;\n }", "public void addToNextMoves(GameTile[][] visibleMap) {\r\n\t\t\r\n\t\t//Breadth First Search Code\r\n//\t\tWumpusState state = new WumpusState(visibleMap, playerX, playerY, wumpusX, wumpusY);\r\n\r\n\t\tQueue<WumpusState> queue = new LinkedList<WumpusState>();\t\t\t\t//use the queue in the same way\t\r\n\t\tHashMap<String, Boolean> visitedStates = new HashMap<String, Boolean>();\t//add all children to the queue, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//add all the children to the hash and set values to true.\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//once all the children have been visited, generate children sequentially for the children that already been added \r\n\t\tWumpusState state = new WumpusState(visibleMap, playerX, playerY);\r\n\t\tlong nodesExpanded = 0;\r\n\t\t\r\n\t\tqueue.add(state);\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\tif(currentState.getPlayerX() == 4 && currentState.getPlayerY() == 1) {\r\n\t\t\t\tnodesExpanded = visitedStates.size();\r\n\t\t\t\tSystem.out.println(\"Nodes Expanded: \"+nodesExpanded);\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(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\tnextMoves.add(AgentAction.declareVictory);\r\n\t\t\t\treturn;\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}\t\r\n\t}", "protected void runAfterIterations() {}", "public androidx.recyclerview.widget.RecyclerView.C1085v mo12723a(androidx.recyclerview.widget.RecyclerView.C1085v r15, java.util.List<androidx.recyclerview.widget.RecyclerView.C1085v> r16, int r17, int r18) {\n /*\n r14 = this;\n r0 = r15\n android.view.View r1 = r0.itemView\n int r1 = r1.getWidth()\n int r1 = r17 + r1\n android.view.View r2 = r0.itemView\n int r2 = r2.getHeight()\n int r2 = r18 + r2\n android.view.View r3 = r0.itemView\n int r3 = r3.getLeft()\n int r3 = r17 - r3\n android.view.View r4 = r0.itemView\n int r4 = r4.getTop()\n int r4 = r18 - r4\n int r5 = r16.size()\n r6 = 0\n r7 = -1\n r8 = 0\n L_0x0028:\n if (r8 >= r5) goto L_0x00be\n r9 = r16\n java.lang.Object r10 = r9.get(r8)\n androidx.recyclerview.widget.RecyclerView$v r10 = (androidx.recyclerview.widget.RecyclerView.C1085v) r10\n if (r3 <= 0) goto L_0x0053\n android.view.View r11 = r10.itemView\n int r11 = r11.getRight()\n int r11 = r11 - r1\n if (r11 >= 0) goto L_0x0053\n android.view.View r12 = r10.itemView\n int r12 = r12.getRight()\n android.view.View r13 = r0.itemView\n int r13 = r13.getRight()\n if (r12 <= r13) goto L_0x0053\n int r11 = java.lang.Math.abs(r11)\n if (r11 <= r7) goto L_0x0053\n r6 = r10\n goto L_0x0054\n L_0x0053:\n r11 = r7\n L_0x0054:\n if (r3 >= 0) goto L_0x0076\n android.view.View r7 = r10.itemView\n int r7 = r7.getLeft()\n int r7 = r7 - r17\n if (r7 <= 0) goto L_0x0076\n android.view.View r12 = r10.itemView\n int r12 = r12.getLeft()\n android.view.View r13 = r0.itemView\n int r13 = r13.getLeft()\n if (r12 >= r13) goto L_0x0076\n int r7 = java.lang.Math.abs(r7)\n if (r7 <= r11) goto L_0x0076\n r11 = r7\n r6 = r10\n L_0x0076:\n if (r4 >= 0) goto L_0x0098\n android.view.View r7 = r10.itemView\n int r7 = r7.getTop()\n int r7 = r7 - r18\n if (r7 <= 0) goto L_0x0098\n android.view.View r12 = r10.itemView\n int r12 = r12.getTop()\n android.view.View r13 = r0.itemView\n int r13 = r13.getTop()\n if (r12 >= r13) goto L_0x0098\n int r7 = java.lang.Math.abs(r7)\n if (r7 <= r11) goto L_0x0098\n r11 = r7\n r6 = r10\n L_0x0098:\n if (r4 <= 0) goto L_0x00b9\n android.view.View r7 = r10.itemView\n int r7 = r7.getBottom()\n int r7 = r7 - r2\n if (r7 >= 0) goto L_0x00b9\n android.view.View r12 = r10.itemView\n int r12 = r12.getBottom()\n android.view.View r13 = r0.itemView\n int r13 = r13.getBottom()\n if (r12 <= r13) goto L_0x00b9\n int r7 = java.lang.Math.abs(r7)\n if (r7 <= r11) goto L_0x00b9\n r6 = r10\n goto L_0x00ba\n L_0x00b9:\n r7 = r11\n L_0x00ba:\n int r8 = r8 + 1\n goto L_0x0028\n L_0x00be:\n return r6\n */\n throw new UnsupportedOperationException(\"Method not decompiled: app.zenly.locator.recommendation.swipeable.touchhelper.ItemTouchHelper.C5319g.mo12723a(androidx.recyclerview.widget.RecyclerView$v, java.util.List, int, int):androidx.recyclerview.widget.RecyclerView$v\");\n }", "protected void cacheLoadThroughSubjects()\n {\n }", "private void optimizeLimitCount() {\n TreeNode currentTreeNode = treeLeaf;\n while (!(currentTreeNode instanceof SourceTreeNode)) {\n if (currentTreeNode instanceof CountGlobalTreeNode) {\n CountGlobalTreeNode countGlobalTreeNode = CountGlobalTreeNode.class.cast(currentTreeNode);\n if (countGlobalTreeNode.getAfterRequirementList().isEmpty() &&\n countGlobalTreeNode.getBeforeRequirementList().isEmpty() &&\n countGlobalTreeNode.getInputNode() instanceof RangeGlobalTreeNode) {\n RangeGlobalTreeNode rangeGlobalTreeNode = RangeGlobalTreeNode.class.cast(countGlobalTreeNode.getInputNode());\n if (rangeGlobalTreeNode.getAfterRequirementList().isEmpty() &&\n rangeGlobalTreeNode.getBeforeRequirementList().isEmpty() &&\n rangeGlobalTreeNode.getLow() == 0 &&\n rangeGlobalTreeNode.getHigh() > 0) {\n countGlobalTreeNode.setLimitCount(rangeGlobalTreeNode.getHigh());\n countGlobalTreeNode.setInputNode(rangeGlobalTreeNode.getInputNode());\n if (countGlobalTreeNode.getInputNode() instanceof EdgeTreeNode) {\n ((EdgeTreeNode) countGlobalTreeNode.getInputNode()).setFetchPropFlag(true);\n }\n }\n }\n }\n currentTreeNode = UnaryTreeNode.class.cast(currentTreeNode).getInputNode();\n }\n }", "BasicSet NextClosure(BasicSet M,BasicSet A){\r\n\t\tConceptLattice cp=new ConceptLattice(context);\r\n\t\tApproximationSimple ap=new ApproximationSimple(cp);\r\n\t\tMap <String,Integer> repbin=this.RepresentationBinaire(M);\r\n\t\tVector<BasicSet> fermes=new Vector<BasicSet>();\r\n\t\tSet<String> key=repbin.keySet();\r\n\t\tObject[] items= key.toArray();\r\n\r\n\t\t/* on recupere la position i qui correspond a la derniere position de M*/\r\n\t\tint i=M.size()-1;\r\n\t\tboolean success=false;\r\n\t\tBasicSet plein=new BasicSet();\r\n\t\tVector <String> vv=context.getAttributes();\r\n\t\tplein.addAll(vv);\r\n\r\n\r\n\t\twhile(success==false ){\t\t\r\n\r\n\t\t\tString item=items[i].toString();\r\n\r\n\t\t\tif(!A.contains(item)){\t\r\n\r\n\t\t\t\t/* Ensemble contenant item associe a i*/\r\n\t\t\t\tBasicSet I=new BasicSet();\r\n\t\t\t\tI.add(item);\r\n\r\n\t\t\t\t/*A union I*/\t\r\n\t\t\t\tA=A.union(I);\r\n\t\t\t\tBasicSet union=(BasicSet) A.clone();\r\n\t\t\t\t//System.out.println(\" union \"+union);\r\n\r\n\t\t\t\t//fermes.add(union);\r\n\r\n\t\t\t\tfermes.add(union);\r\n\t\t\t\t//System.out.println(\"ll11 \"+fermes);\r\n\r\n\t\t\t\t/* Calcul du ferme de A*/\r\n\t\t\t\tBasicSet b=ap.CalculYseconde(A,context);\r\n\r\n\t\t\t\t//BasicSet b=this.LpClosure(A);\r\n\t\t\t\t//System.out.println(\"b procchain \"+b);\r\n\r\n\t\t\t\t//System.out.println(\"b sec \"+b);\r\n\t\t\t\tBasicSet diff=new BasicSet();\r\n\t\t\t\tdiff=b.difference(A);\r\n\t\t\t\tMap <String,Integer> repB=this.RepresentationBinaire(diff);\r\n\t\t\t\tBasicSet test=new BasicSet();\r\n\t\t\t\tMap <String,Integer> testt=RepresentationBinaire(test);\r\n\t\t\t\ttestt.put(item, 1);\r\n\r\n\t\t\t\t/* on teste si l ensemble B\\A est plus petit que l ensemble contenant i\r\n\t\t\t\t * Si B\\A est plus petit alors on affecte B à A.\r\n\t\t\t\t **/\r\n\r\n\t\t\t\tif(item.equals(b.first())||LecticOrder(repB,testt)){\r\n\t\t\t\t\t//System.out.println(\"A succes=true \"+ A);\r\n\t\t\t\t\tA=b;\r\n\t\t\t\t\tsuccess=true;\t \r\n\r\n\t\t\t\t}else{\r\n\t\t\t\t\tA.remove(item);\r\n\t\t\t\t}\t\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tA.remove(item);\r\n\t\t\t}\t\t\t\r\n\t\t\ti--;\r\n\t\t}\t\t\r\n\t\treturn A;\r\n\t}", "@Override\n public void run($ collection) {\n\n CleanupRunnable.run();\n }" ]
[ "0.59323645", "0.5700556", "0.55240124", "0.52680767", "0.5250331", "0.51783586", "0.5167583", "0.51598936", "0.5149548", "0.50912684", "0.50867754", "0.5041359", "0.5040846", "0.50114423", "0.5007294", "0.5006007", "0.49995074", "0.4998849", "0.49722576", "0.49718934", "0.49701864", "0.49515244", "0.49514508", "0.4947405", "0.49379757", "0.4937695", "0.49273384", "0.4920323", "0.4914925", "0.49104387", "0.49010533", "0.4898544", "0.48853603", "0.4884708", "0.48811918", "0.48809093", "0.48661032", "0.48645815", "0.4862356", "0.4859583", "0.4859364", "0.48494488", "0.48473513", "0.48409605", "0.48250863", "0.48173463", "0.4812428", "0.48120892", "0.48116004", "0.4801174", "0.48009193", "0.48008648", "0.4797598", "0.47937357", "0.47909147", "0.47901368", "0.47857752", "0.47824538", "0.47786072", "0.47784254", "0.4772654", "0.4763989", "0.47587058", "0.4756834", "0.4756602", "0.47561565", "0.47553498", "0.4755135", "0.47509673", "0.475075", "0.47477207", "0.47462013", "0.47430757", "0.47411135", "0.47394136", "0.47366983", "0.47364417", "0.473347", "0.47329897", "0.47262025", "0.47204077", "0.47108215", "0.47105578", "0.4710138", "0.47065535", "0.4700976", "0.46943215", "0.46933094", "0.46910036", "0.469016", "0.46831834", "0.4682664", "0.4681774", "0.46804437", "0.46800286", "0.4677401", "0.46753892", "0.46750313", "0.4674316", "0.46721154", "0.46664402" ]
0.0
-1
my approach similar to uwi. (ideas: created a third array indexes to store the relation between difficulty and profit. Distributed arrays approach.)
public int _maxProfitAssignment(int[] difficulty, int[] profit, int[] worker) { Integer [] indexes = new Integer [difficulty.length]; for (int idx = 0; idx < indexes.length; idx ++) indexes [idx] = idx; Arrays.sort(indexes, (a, b) -> difficulty [a] != difficulty [b] ? difficulty [a] - difficulty [b] : (profit [b] - profit [a])); // maxprofit is not working until we sort difficulty properly. int [] maxProfit = new int [profit.length]; maxProfit [0] = profit [indexes [0]]; for (int idx = 1; idx < indexes.length; idx ++) maxProfit [idx] = Math.max(maxProfit [idx - 1], profit [indexes [idx]]); int ans = 0; for (int val : worker) { int idx = binarySearch(indexes, difficulty, val); if (idx >= 0) ans += maxProfit [idx]; } return ans; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void buildArray() throws VerificationException\n {\n \tindices = new int[length];\n \tcommonality = new int[length];\n \n \tcommonality[0] = -1;\n \tfor( int i=0; i<indices.length; i++ ){\n \t indices[i] = i;\n \t}\n \n sort();\n }", "public static Object[] ticket_combo(int l, Set<Set<Object>> ticket_indices_powerset, Object[] all_number_subset_array, Object[] winning_number_subset_array) {\n \n Set<Object> curr_t = new HashSet<Object>(); //carries one ticket\n Set<Object> set_to_buy = new HashSet<Object>(); //carries one winning combo\n Set<Object> curr_win_combo = new HashSet<Object>(); //carries one ticket combo\n \n boolean has_winning = false;\n int match_count = 0;\n int ticket_amount_count = all_number_subset_array.length; //smallest amount of tickets needed so far\n \n // a combo to possibly buy\n for(Set<Object> curr_indices_subset : ticket_indices_powerset) {\n int curr_num_tickets_to_buy = curr_indices_subset.toArray().length;\n if(ticket_amount_count <= curr_num_tickets_to_buy && has_winning)\n {\n continue;\n }\n //copy a winning array\n Object[] winning_number_subset_array_copy = Arrays.copyOf(winning_number_subset_array, winning_number_subset_array.length);\n //setup a counter of uncovered winning combos\n int uncovered_winning_possibilities = winning_number_subset_array_copy.length;\n Object[] curr_indices_subset_array = curr_indices_subset.toArray();\n \n //take each ticket in a combo\n for(Object curr_index : curr_indices_subset_array) {\n int curr_index_int = ((Integer) curr_index).intValue() - 1;\n curr_t = (java.util.HashSet<java.lang.Object>) all_number_subset_array[curr_index_int];\n \n //see which winning combos you can cross out\n for(int i = 0; i < winning_number_subset_array_copy.length; i++) {\n match_count = 0;\n curr_win_combo = (java.util.HashSet<java.lang.Object>) winning_number_subset_array[i];\n if (winning_number_subset_array_copy[i] instanceof Integer)\n {\n continue;\n }\n \n for(Object combo_num : curr_win_combo) {\n for(Object ticket_num : curr_t) {\n if(((Integer)combo_num).intValue() == ((Integer)ticket_num).intValue())\n {\n match_count++;\n }\n }\n }\n if(match_count >= l)\n {\n uncovered_winning_possibilities--;\n winning_number_subset_array_copy[i] = 0;\n }\n }\n }\n //after ticket combo loop\n if((uncovered_winning_possibilities == 0) && (!has_winning || (curr_num_tickets_to_buy < ticket_amount_count)))\n {\n has_winning = true;\n ticket_amount_count = curr_num_tickets_to_buy;\n set_to_buy = curr_indices_subset;\n \n }\n }\n Object[] final_ticket_indeces = set_to_buy.toArray();\n return final_ticket_indeces;\n }", "private int getIndex(int... elements) {\n int index = 0;\n for (int i = 0; i < elements.length; i++) index += elements[i] * Math.pow(universeSize, i);\n return index;\n }", "public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(new FileReader(\"talent.in\"));// new InputStreamReader(System.in)); //\n PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(\"talent.out\")));\n int N = sc.nextInt();\n int minWeight = sc.nextInt();\n int[] weight = new int[N];\n int[] value = new int[N];\n int totalTalent = 0;\n for (int i = 0; i < N; i++) {\n int wt = sc.nextInt();\n int val = sc.nextInt();\n weight[i] = wt;\n value[i] = val;\n totalTalent += val;\n }\n\n // Store, for a given talent, what is the smallest weight used to achieve it?\n int[] dp = new int[totalTalent + 1];\n Arrays.fill(dp, (int) 1e9);\n dp[0] = 0;\n // the min weight to produce 0 talent is 0. However,\n // it is necessary to make everything else big because we can only BUILD\n // from 0\n double bestRatio = 0;\n for (int cow = 0; cow < N; cow++) {\n // look at each cow, and go DOWN THROUGH THE dp array, updating the\n // best weight achievable BEHIND US. This countercurrent motion ensures no repeated\n // counting of a single cow's talents\n int contribution = value[cow];\n int wt = weight[cow];\n for (int talent = totalTalent; talent >= 0; talent--) {\n int boostedTalent = contribution + talent;\n int boostedWeight = dp[talent] + wt;\n // with the min weight of a certain talent,\n // is it possible to get a smaller boostedWeight for a boostedTalent\n if (boostedTalent <= totalTalent) {\n // If we are in bounds,\n if (boostedWeight < dp[boostedTalent]) {\n // and the attempted team has a better weight value\n // then update it!\n // Initially, when everything is 1 billion, this cannot\n // happen except for from the base cases, building outward\n dp[boostedTalent] = boostedWeight;\n\n // At the same time, we can be more efficient by constantly\n // checking if we had enough weight first of all, and\n // second of all had a better talent/weight ratio!\n double ratio = (double) boostedTalent / boostedWeight;\n if (ratio > bestRatio && boostedWeight >= minWeight) {\n bestRatio = ratio;\n }\n }\n }\n }\n }\n\n out.println((int) (1000 * bestRatio));\n out.close();\n }", "public void\tgetData() throws IOException{\n\t\tint i,j, val;\n\t\tint profitOfItems[], weight[];\n\t\t\n\t\tSystem.out.println(\"Enter the weight of the Knapsack ( must be positive):\");\n\t\tknapsackWeight = KnapsackAlgorithmImplementation.getNumber();\n\t\t\n\t\tSystem.out.println(\"\\nEnter the number of items to put in knapsack ( must be positive):\");\n\t\tnumberOfItems = KnapsackAlgorithmImplementation.getNumber();\n\t\t\n\t\tprofitOfItems = new int[numberOfItems + 1];\n\t\tfor ( i = 1 ; i <= numberOfItems ; i++) {\n\t\t\tSystem.out.println(\"Enter profit of item \" + String.valueOf(i));\n\t\t\tprofitOfItems[i] = KnapsackAlgorithmImplementation.getNumber();\n\t\t}\t\n\t\t\n\t\tweight = new int[numberOfItems + 1];\n\t\tfor ( i = 1 ; i <= numberOfItems ; i++) {\n\t\t\tSystem.out.println(\"Enter weight of item \" + String.valueOf(i));\n\t\t\tweight[i] = KnapsackAlgorithmImplementation.getNumber();\n\t\t}\t\n\t\t\n\t\tProfit = new int[numberOfItems + 1][knapsackWeight + 1];\n\t\tDir\t = new int[numberOfItems + 1][knapsackWeight + 1];\n\t\t\n\t\tfor ( j = 0 ; j <= knapsackWeight; j++) {\n\t\t\tProfit[0][j] = 0;\t\n\t\t}\t\n\t\tfor ( i = 0 ; i <= numberOfItems; i++) {\n\t\t\tProfit[i][0] = 0;\t\n\t\t}\n\t\tfor ( i = 1 ; i <= numberOfItems; i++) { \n\t\t\tfor ( j = 1 ; j <= knapsackWeight; j++) {\n\t\t\t\tif ( weight[i] > j) {\n\t\t\t\t\tProfit[i][j] = Profit[i-1][j];\n\t\t\t\t\tDir[i][j] = 1;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tval = profitOfItems[i] + Profit[i-1][j - weight[i]];\n\t\t\t\t\tProfit[i][j] = Find_Max( Profit[i-1][j] , val); \n\t\t\t\t\tif ( Profit[i][j] == val)\n\t\t\t\t\t\tDir[i][j] = 2;\n\t\t\t\t\telse\n\t\t\t\t\t\tDir[i][j] = 1;\t\n\t\t\t\t}\t\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"Maximum profit that can fit in the knapsack is :\" + Profit[numberOfItems][knapsackWeight]);\n\t\tPrint_KnapsackItems(Dir,weight);\t\t\n\t}", "static int dynamicProgramming(int problem) {\r\n\t\tint items = problems.get(problem).size();\r\n\t\tint cap = capacities.get(problem);\r\n\r\n\t\tint x = 0;\r\n\t\tfor(int i = 1; i < items + 1; i++, x++) {\r\n\t\t\tweights[i] = problems.get(problem).get(x).weight;\r\n\t\t\tprofits[i] = problems.get(problem).get(x).profit;\r\n\t\t}\r\n\r\n\t\tint[][] P = new int[items + 1][cap + 1];\r\n\r\n\t\tfor(int i = 0; i < items + 1; i++) {\r\n\t\t\tfor(int j = 0; j < cap + 1; j++) {\r\n\t\t\t\tP[i][j] = -1;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor(int c = 0; c < cap + 1; c++) {\r\n\t\t\tP[0][c] = 0;\r\n\t\t}\r\n\r\n\t\tfor(int i = 1; i < items + 1; i++) {\r\n\t\t\tP[i][0] = 0;\r\n\t\t\tfor(int c = 1; c < cap + 1; c++) {\r\n\t\t\t\tif(i >= 2 && c >= 2) {\r\n\t\t\t\t\tP[i-2][c-2] = -1;\r\n\t\t\t\t}\r\n\t\t\t\tif(weights[i] <= c && P[i-1][c-weights[i]] + profits[i] > P[i-1][c]) {\r\n\t\t\t\t\tP[i][c] = P[i-1][c-weights[i]] + profits[i];\r\n\t\t\t\t} else {\r\n\t\t\t\t\tP[i][c] = P[i-1][c];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn P[items][cap];\r\n\t}", "public int[] podium(){\n //TODO\n int [] pod = new int[3];\n int [] tab = Trier(this.scores);\n int n= this.scores.length;\n pod[2]= tab[n-1];\n pod[1]= tab[n-2];\n pod[0]= tab[n-3];\n return pod;\n \n \n }", "public int _maxProfitAssignmentBetter(int[] difficulty, int[] profit, int[] worker) {\n int n = difficulty.length;\n int [][] dp = new int [n][];\n\n for (int i = 0; i < n; i ++)\n dp [i] = new int[] { difficulty[i], profit[i] };\n\n Arrays.sort(dp, (a, b) -> (a [0] != b [0]) ? (a [0] - b [0]) : -(a [1] - b [1]));\n\n int[] xs = new int[n];\n for (int i = 0; i < n; i ++) xs [i] = dp [i][0];\n for (int i = 1; i < n; i ++) dp[i][1] = Math.max(dp [i][1], dp [i - 1][1]);\n\n int ret = 0;\n for(int w : worker){\n int ind = Arrays.binarySearch(xs, w);\n if (ind < 0) ind = -ind - 2;\n if (ind >= 0)\n ret += dp[ind][1];\n }\n return ret;\n }", "public static void main(String[] args) {\n\t\tint array0[] = new int[0];\r\n\t\tint array3[] = new int[3];\r\n\t\tint array5[] = new int[5];\r\n\t\tint array15[] = new int[15];\r\n\t\tint array16[] = new int[16];\r\n\t\tint array17[] = new int[17];\r\n\t\tint array19[] = new int[19];\r\n\t\tint array20[] = new int[20];\r\n\t\tint array200[] = new int[200];\r\n\t\tint array1000[] = new int[1000];\r\n\r\n\t\t// iX => integer with value X\r\n\t\tint i0 = 0;\r\n\t\tint i20 = 20;\r\n\t\tint i1 = 1;\r\n\t\tint i2 = 2;\r\n\t\tint i3 = 3;\r\n\t\tint i4 = 4;\r\n\t\tint i_5 = -5;\r\n\t\tint p = i2 * i_5; // p is [-10,-10]\r\n\r\n\t\tarray0[0] = 5; // Illegal upper bound\r\n\r\n\t\tarray0[1] = 5; // Illegal upper bound\r\n\r\n\t\tarray5[p] = 5; // Illegal lower bound\r\n\r\n\t\tp = 2 * i2; // p is [4,4]\r\n\r\n\t\tarray5[p] = 5; // Good\r\n\r\n\t\tp *= p; // p is [16,16]\r\n\r\n\t\tarray16[p] = 5; // Illegal upper bound (legal index range is 0-15)\r\n\r\n\t\tarray17[p] = 5; // Good\r\n\r\n\t\tp = i2 * i3; // p is [6,6]\r\n\r\n\t\tboolean b = args.length == 0;\r\n\r\n\t\tif (b) {\r\n\t\t\tp = p * i3; // p is [18,18]\r\n\t\t}\r\n\r\n\t\t// now p is [6,18]\r\n\r\n\t\tarray17[p] = 5; // Potentially illegal upper bound\r\n\t\tarray19[p] = 5; // Good\r\n\r\n\t\tp = 2; // p is [2,2]\r\n\r\n\t\tfor (int i = 0; i < 5; i++) {\r\n\t\t\tp *= 2;\r\n\t\t}\r\n\r\n\t\t// now p is [2,INF]\r\n\r\n\t\tarray19[p] = 5; // Potentially illegal upper bound // TODO problem\r\n\r\n\t\tp = p - 4; // p is [-2,INF]\r\n\r\n\t\tarray1000[p] = 5; // Potentially illegal lower and upper bounds\r\n\r\n\t\tp = 2; // p is [2,2]\r\n\r\n\t\tfor (int i = 0; i < 5; i++) {\r\n\t\t\tarray3[i] = 5; // Potentially illegal upper bound\r\n\t\t\tarray16[i] = 5; // Good\r\n\t\t\tp *= -2;\r\n\t\t}\r\n\r\n\t\tint i = 5, j = 10;\r\n\r\n\t\tif (b) {\r\n\t\t\ti = 15;\r\n\t\t\tj = 20;\r\n\t\t}\r\n\r\n\t\t// now i is [5,15], j is [10,20]\r\n\r\n\t\tif (i != j) {\r\n\t\t\tarray16[j] = 5; // Potentially illegal upper bound\r\n\t\t} else {\r\n\t\t\tarray16[j] = 5; // Good\r\n\t\t}\r\n\r\n\t\t// p is [-INF,INF]\r\n\r\n\t\tarray1000[p] = 5; // Potentially illegal lower and upper bounds\r\n\r\n\t}", "public static int[][] hgAlgorithm(double[][] array, String sumType) {\r\n\t\tdouble[][] cost = copyOf(array); // Create the cost matrix\r\n\r\n\t\tif (sumType.equalsIgnoreCase(\"max\")) // Then array is weight array. Must\r\n\t\t\t\t\t\t\t\t\t\t\t\t// change to cost.\r\n\t\t{\r\n\t\t\tdouble maxWeight = findLargest(cost);\r\n\t\t\tfor (int i = 0; i < cost.length; i++) // Generate cost by\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t// subtracting.\r\n\t\t\t{\r\n\t\t\t\tfor (int j = 0; j < cost[i].length; j++) {\r\n\t\t\t\t\tcost[i][j] = (maxWeight - cost[i][j]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tdouble maxCost = findLargest(cost); // Find largest cost matrix element\r\n\t\t\t\t\t\t\t\t\t\t\t// (needed for step 6).\r\n\r\n\t\tint[][] mask = new int[cost.length][cost[0].length]; // The mask array.\r\n\t\tint[] rowCover = new int[cost.length]; // The row covering vector.\r\n\t\tint[] colCover = new int[cost[0].length]; // The column covering vector.\r\n\t\tint[] zero_RC = new int[2]; // Position of last zero from Step 4.\r\n\t\tint step = 1;\r\n\t\tboolean done = false;\r\n\t\twhile (done == false) // main execution loop\r\n\t\t{\r\n\t\t\tswitch (step) {\r\n\t\t\tcase 1:\r\n\t\t\t\tstep = hg_step1(step, cost);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 2:\r\n\t\t\t\tstep = hg_step2(step, cost, mask, rowCover, colCover);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 3:\r\n\t\t\t\tstep = hg_step3(step, mask, colCover);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 4:\r\n\t\t\t\tstep = hg_step4(step, cost, mask, rowCover, colCover, zero_RC);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 5:\r\n\t\t\t\tstep = hg_step5(step, mask, rowCover, colCover, zero_RC);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 6:\r\n\t\t\t\tstep = hg_step6(step, cost, rowCover, colCover, maxCost);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 7:\r\n\t\t\t\tdone = true;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}// end while\r\n\r\n\t\tint[][] assignment = new int[array.length][2]; // Create the returned\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// array.\r\n\t\tfor (int i = 0; i < mask.length; i++) {\r\n\t\t\tfor (int j = 0; j < mask[i].length; j++) {\r\n\t\t\t\tif (mask[i][j] == 1) {\r\n\t\t\t\t\tassignment[i][0] = i;\r\n\t\t\t\t\tassignment[i][1] = j;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// If you want to return the min or max sum, in your own main method\r\n\t\t// instead of the assignment array, then use the following code:\r\n\t\t/*\r\n\t\t * double sum = 0; for (int i=0; i<assignment.length; i++) { sum = sum +\r\n\t\t * array[assignment[i][0]][assignment[i][1]]; } return sum;\r\n\t\t */\r\n\t\t// Of course you must also change the header of the method to:\r\n\t\t// public static double hgAlgorithm (double[][] array, String sumType)\r\n\r\n\t\treturn assignment;\r\n\t}", "void CalculateProbabilities()\n\t{\n\t int i;\n\t double maxfit;\n\t maxfit=fitness[0];\n\t for (i=1;i<FoodNumber;i++)\n\t {\n\t if (fitness[i]>maxfit)\n\t maxfit=fitness[i];\n\t }\n\n\t for (i=0;i<FoodNumber;i++)\n\t {\n\t prob[i]=(0.9*(fitness[i]/maxfit))+0.1;\n\t }\n\n\t}", "private int[] attdef(board current,int player)\r\n { \r\n int temp[][]=new int[100][100];\r\n possible_location attack = new possible_location();\r\n count_values attack_v = new count_values();\r\n \r\n //get good location of possible pieces\r\n temp=attack.list_loc(current,player); \r\n \r\n //counting values for each possible pieces\r\n for (int i=0;i <= temp[99][99];i++ )\r\n {\r\n temp[i][2]=attack_v.count_values(current,temp[i][0],temp[i][1],player); \r\n }\r\n \r\n \r\n \r\n //error handling, if there is no possible location, the computer decide a new location\r\n if (temp[99][99]<0)\r\n {\r\n temp[99][99] = 0;\r\n int i=8,j=8;\r\n \r\n while (current.board[i][j]!=0)\r\n {\r\n j++; \r\n \r\n if ((current.board[i][j]==0))\r\n {\r\n i++;\r\n }\r\n } \r\n \r\n temp[0][0]=j;\r\n temp[0][1]=i;\r\n }\r\n \r\n \r\n int max=0,max_V=0;\r\n //find the best value\r\n for (int i=0;i<=temp[99][99];i++)\r\n {\r\n if (max<temp[i][2])\r\n {\r\n max=temp[i][2];\r\n max_V=i;\r\n }\r\n else if (max==temp[i][2])\r\n { //if there is same highest value, the computer will random\r\n Random random = new Random();\r\n if (random.nextInt(2)==0)\r\n {\r\n max=temp[i][2];\r\n max_V=i; \r\n }\r\n }\r\n\r\n } \r\n \r\n //return computer's descision\r\n int descision[] = {temp[max_V][0],temp[max_V][1],temp[max_V][2]};\r\n return descision;\r\n \r\n \r\n }", "public static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n//\t\tPrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tint N= Integer.parseInt(st.nextToken());\n\t\tint T= Integer.parseInt(st.nextToken());\n\t\t\n\t\t//for each N, three possible problem sets (P, A, G)\n\t\t//and P (prep time: min), V (value)\n\t\t//P <= A <= G\n\t\t\n\t\t//given limit T\n\t\t//find max profit\n\t\tint[][] v = new int[N+1][3+1];\n\t\tint[][] w = new int[N+1][3+1];\n\t\t\n\t\t//one \n\t\t\n\t\tfor (int i = 1; i <= N; i++) {\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\tfor (int j = 1; j <= 3; j++) {\n\t\t\t\tw[i][j] = Integer.parseInt(st.nextToken());\n\t\t\t\tv[i][j] = Integer.parseInt(st.nextToken());\n\t\t\t}\n\t\t}\n//\t\tfor (int i = 1; i <= N; i++) {\n//\t\t\tfor (int j = 1; j <= 3; j++) {\n//\t\t\t\tSystem.out.println(w[i][j] + \" \"+ v[i][j]);\n//\t\t\t}\n//\t\t}\n\t\tint[][] dp = new int[2][T+1];\n\t\t//where k looks at the kth row of the values/weight array\n\t\tfor (int k = 1; k <= N; k++) {\n\t\t\tfor (int x = 0; x <= T; x++) {\n\t\t\t\t//going through each weight and value\n\t\t\t\tboolean ran = false;\n\t\t\t\tfor (int a = 1; a <= 3; a++) {\t\t\t\t\t\n\t\t\t\t\tif (w[k][a] > x) {\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tran = true;\n\t\t\t\t\t\tdp[1][x] = Math.max(Math.max(dp[0][x],dp[0][x-w[k][a]] + v[k][a]),dp[1][x]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!ran) {\n\t\t\t\t\tdp[1][x] = dp[0][x];\n\t\t\t\t}\n\t\t\t}\n\t\t\tdp[0] = dp[1].clone();\n//\t\t\tfor (int[] row: dp) {\n//\t\t\t\tfor (int m: row) {\n//\t\t\t\t\tSystem.out.print(m + \" \");\n//\t\t\t\t}\n//\t\t\t\tSystem.out.println();\n//\t\t\t}\n\t\t}\n\t\t\n//\t\tfor (int[] row: dp) {\n//\t\t\tfor (int m: row) {\n//\t\t\t\tSystem.out.print(m + \" \");\n//\t\t\t}\n//\t\t\tSystem.out.println();\n//\t\t}\n\t\tSystem.out.println(dp[1][T]);\n\t}", "public void solucioInicial2() {\n int grupsRecollits = 0;\n for (int i=0; i<numCentres*helisPerCentre; ++i) {\n Helicopter hel = new Helicopter();\n helicopters.add(hel);\n }\n int indexHelic = 0;\n int indexGrup = 0;\n int places = 15;\n while (indexGrup < numGrups) {\n int trajecte[] = {-1,-1,-1};\n for (int i=0; i < 3 && indexGrup<numGrups; ++i) {\n Grupo grup = grups.get( indexGrup );\n if (places - grup.getNPersonas() >= 0) {\n places -= grup.getNPersonas();\n trajecte[i] = indexGrup;\n indexGrup++;\n\n }\n else i = 3;\n }\n Helicopter helicopter = helicopters.get( indexHelic );\n helicopter.addTrajecte( trajecte, indexHelic/helisPerCentre );\n places = 15;\n indexHelic++;\n if (indexHelic == numCentres*helisPerCentre) indexHelic = 0;\n }\n }", "public static void main(String[] args) {\n int[] example1 = {1, 3, 5, 7, 9, 11, 13, 15, 17, 2, 4, 6, 8, 10, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30};\n int target1 = 59;\n int[] example2 = {2, 4, 6, 8, 10, 12, 14, 16, 18, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30};\n int target2 = 59;\n int[] example3 = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 2, 4, 6, 8, 10, 12, 14, 16, 18};\n int target3 = 34;\n\n int[] result1;\n int[] result2;\n int[] result3;\n\n // 1.Brute Force\n System.out.println(\"Brute Force start\");\n long startBF = System.currentTimeMillis();\n result1 = twoSum_1(example1, target1);\n result2 = twoSum_2(example2, target2);\n result3 = twoSum_3(example3, target3);\n println(\"Brute Force result1 \", result1);\n println(\"Brute Force result2 \", result2);\n println(\"Brute Force result3 \", result3);\n System.out.println(\"Brute Force costs: \" + (System.currentTimeMillis() - startBF));\n\n // 2.Two Pass Hash Table\n System.out.println(\"Two Pass Hash Table start\");\n long startTP = System.currentTimeMillis();\n result1 = twoSum_1(example1, target1);\n result2 = twoSum_2(example2, target2);\n result3 = twoSum_3(example3, target3);\n println(\"Two Pass Hash Table start result1 \", result1);\n println(\"Two Pass Hash Table start result2 \", result2);\n println(\"Two Pass Hash Table start result3 \", result3);\n System.out.println(\"Two Pass Hash Table costs: \" + (System.currentTimeMillis() - startTP));\n\n // 3.One Pass Hash Table\n System.out.println(\"One Pass Hash Table start\");\n long startOP = System.currentTimeMillis();\n result1 = twoSum_1(example1, target1);\n result2 = twoSum_2(example2, target2);\n result3 = twoSum_3(example3, target3);\n println(\"Two Pass Hash Table start result1 \", result1);\n println(\"Two Pass Hash Table start result2 \", result2);\n println(\"Two Pass Hash Table start result3 \", result3);\n System.out.println(\"Two Pass Hash Table costs: \" + (System.currentTimeMillis() - startOP));\n }", "private void makeStat(int nbrParties){\n\t\tint indexTemps=0;//position à laquelle ajouter un temps de partie dans le tableaux tempsPartie\n\t\twhile(nbrParties >0){//tant qu'il reste des parties à faire\n\n\t\t\tboolean gagne=false;\n\t\t\tPlayer joueurAjouer=null;\n\t\t\tlong beforeTime=System.currentTimeMillis();\n\t\t\twhile(!gagne){//tant qu'aucun joueur n'a gagné on joue\n\t\t\t\tjoueurAjouer=jeu.whichPlayer();\n\t\t\t\t\n\t\t\t\tint value=joueurAjouer.play(jeu.getGameboard(),joueurs, null, null);\n\t\t\t\tgagne=jeu.win(joueurAjouer);\n\t\t\t\t\n\t\t\t\twhile(gagne==false &&value!=GameBoard.OK){\n\t\t\t\t\tvalue=joueurAjouer.play(jeu.getGameboard(),joueurs, null, null);\n\t\t\t\t\tgagne=jeu.win(joueurAjouer);\n\t\t\t\t\t\n\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\n\t\t\tlong afterTime=System.currentTimeMillis();\n\t\t\ttempsPartie[indexTemps]=afterTime-beforeTime;\n\t\t\tindexTemps++;\n\t\t\t\n\t\t\tif(joueurAjouer==joueur1){\n\t\t\t\tif(joueur1.getNbrJoueur()==1){// signifie que c'est lui qui a commence la partie\n\t\t\t\t\tstatJ1[0]+=1;//on incremente le nombre de parties gagnées en tant que J1\n\t\t\t\t}else{\n\t\t\t\t\tstatJ1[1]+=1;//on incremente le nombre de parties gagnées en tant que J2\n\t\t\t\t}\n\t\t\t\tstatJ1[2]+=1;// on incremente le nombre de parties totales\n\t\t\t}\n\t\t\t\n\t\t\tif(joueurAjouer==joueur2){\n\t\t\t\tif(joueur2.getNbrJoueur()==1){// signifie que c'est lui qui a commence la partie\n\t\t\t\t\tstatJ2[0]+=1;//on incremente le nombre de parties gagnées en tant que J1\n\t\t\t\t}else{\n\t\t\t\t\tstatJ2[1]+=1;//on incremente le nombre de parties gagnées en tant que J2\n\t\t\t\t}\n\t\t\t\tstatJ2[2]+=1;// on incremente le nombre de parties totales\n\t\t\t}\n\t\t\t\n\t\t\tstatJ1[3]+=Player.getNbrMurDepart()-joueur1.getNombreMur();\n\t\t\tstatJ1[4]+=joueur1.getNbrDeplacement();\n\t\t\t\n\t\t\tstatJ2[3]+=Player.getNbrMurDepart()-joueur2.getNombreMur();\n\t\t\tstatJ2[4]+=joueur2.getNbrDeplacement();\n\t\t\tresetGame();\n\t\t\tnbrParties--;\n\t\t}\n\t\tstatJ1[5]+=statJ1[3]+statJ1[4];\n\t\tstatJ2[5]+=statJ2[3]+statJ2[4];\n\t}", "public void calculations(){\n\n int temp_size1 = fight_list.get(0).t1.members.size();\n int[] t1_counter = new int[temp_size1 + 1]; //counter for deaths: 0, 1, 2..., party size.\n float t1_avg = 0; //Average number of deaths.\n\n //We don't need to calculate for t2 right now, because t2 is just monsters.\n //temp_size = fight_list.get(0).t2.members.size();\n //int[] t2_counter = new int[temp_size + 1];\n\n for(FightResult fig : this.fight_list){\n int i = 0;\n while(i != fig.t1_deaths){\n i++;\n }\n t1_counter[i]++;\n t1_avg += fig.t1_deaths;\n }//end for\n\n System.out.println(t1_avg);\n System.out.println(Float.toString(t1_avg/fight_list.size()) + \" / \" + Integer.toString(temp_size1));\n\n String axis = \"# of deaths: \\t\";\n int axis_int = 0;\n String t1_results = \"Happened: \\t\";\n for(int i : t1_counter){\n axis += Integer.toString(axis_int++) + \"\\t\";\n t1_results += Integer.toString(i) + \"\\t\";\n }//end for\n System.out.println(axis);\n System.out.println(t1_results);\n\n float tpk_amount = t1_counter[temp_size1]; //by taking the size, we take the item at the end of the array. In this case, the number where everyone dies.\n tpk_amount = (tpk_amount/fight_list.size())*100;\n System.out.println(\"Probability of TPK: \" + Float.toString(tpk_amount) + \" %.\");\n\n System.out.println(\"\\n--------\\n\");\n }", "public int[] solver(int startPlayerId, int curplayer, int[][] oneP, int[][][] memory, int count) {\n\r\n int[][] one = oneP.clone(); // OnePlay Input\r\n int[] k; // onePlay points\r\n int j = curplayer;\r\n int[][][] m = memory.clone();\r\n int[] minCard = new int[3];\r\n int[] t;\r\n ArrayList<int[]> store = new ArrayList<>();\r\n minCard[2] = 100000;\r\n t = new int[3];\r\n for (int i = 0; i < 4; i++) { // 4 types of cards\r\n for (int l = 2; l < cardPerPlayer + 2; l++) {\r\n if (m[j][i][l] == 1 || m[j][i][l] == 2) {\r\n one[j][0] = i;\r\n one[j][1] = l;\r\n remove(new int[] { i, l }, m);\r\n if ((j + 1) % players != startPlayerId) {\r\n t = solver(startPlayerId, (j + 1) % players, one, m, count);\r\n one[(j + 1) % players][0] = t[0];\r\n one[(j + 1) % players][1] = t[1];\r\n }\r\n // } else if ((j + 2) % players != startPlayerId) {\r\n // t = solver(startPlayerId, (j + 2) % players, one, m, count);\r\n // one[(j + 1) % players][0] = t[0];\r\n // one[(j + 1) % players][1] = t[1];\r\n // } else if ((j + 3) % players != startPlayerId) {\r\n // t = solver(startPlayerId, (j + 3) % players, one, m, count);\r\n // one[(j + 1) % players][0] = t[0];\r\n // one[(j + 1) % players][1] = t[1];\r\n // }\r\n\r\n k = onePlay(one, startPlayerId);\r\n int curpoint = 0;\r\n if (count != cardPerPlayer - 1) { // cardPerPlayer - 1 = 12\r\n t = solver(k[0], k[0], new int[4][2], m, count++);\r\n curpoint = t[2];\r\n }\r\n\r\n if (k[0] == myID) {\r\n curpoint += k[1] + k[2] * 12;\r\n }\r\n store.add(new int[] { i, l, curpoint });\r\n if (curpoint < minCard[2]) {\r\n minCard[2] = curpoint;\r\n minCard[0] = i;\r\n minCard[1] = l;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return minCard;\r\n }", "private double[] genHealthAndSpeed() {\n double multiplier = genMultiplier();\n double[] healthAndSpeed = new double[2]; //0 for health, 1 for speed\n healthAndSpeed[0] = (100+currentDifficulty)*multiplier;\n healthAndSpeed[1] = 2*(1+(1-multiplier));\n return healthAndSpeed;\n }", "public StandardSolution (long[] nums){\n \t\tsequence = nums;\n \t\tpartitions = new boolean[sequence.length];\n \t\t\n \t\tRandom rand = new Random();\n \t\tfor (int i = 0; i < partitions.length; i++){\n \t\t\t// worry about seeing?\n \t\t\tpartitions[i] = rand.nextBoolean();\n \t\t}\n \t}", "Couple[] Exchange (Couple[] v,Gift[] G) throws IOException{\n \n \n int i;\n String y;\n int s = 0;\n int e = 99;\n \n for (i = 0; i < 10; i++) {\n \n y = v[i].btype;\n \n \n if (\"Generous\" == y) {\n \n if ((v[i].spend <= v[i].bd)) {\n \n if (v[i].spend <= v[i].m) {\n \n v[i].lc = v[i].lc + 1;\n v[i].lv = v[i].lv + G[e].price;\n v[i].spend = v[i].spend +G[e].price;\n e--;\n \n }else {\n \n v[i].lc = v[i].lc + 1;\n v[i].lv = v[i].lv + G[e].price;\n v[i].spend = v[i].spend +G[e].price;\n v[i].extra = v[i].extra + G[e].price;\n e--;\n \n \n }\n \n }\n \n }else if (\"Miser\" == y) {\n \n if (v[i].spend <= v[i].m) {\n \n v[i].spend = v[i].spend + G[s].price;\n s++;\n }\n \n \n }else if (\"Geeky\" == y) {\n \n if (v[i].spend <= v[i].m) {\n \n v[i].spend = v[i].spend + G[s].price;\n s++;\n }else {\n \n v[i].spend = v[i].spend + G[e].price;\n v[i].extra = v[i].extra + G[e].price;\n \n } \n }\n \n \n \n }\n\n return v;\n}", "public static void main(String[]args){\n\r\n int []arr = new int[100];\r\n int []arr2 = new int[50];\r\n int []arr3 = {1,2,3,4,5,6,7,8};\r\n int number = 5;\r\n LogicalOp op = new LogicalOp();\r\n// op.writeOnArray(arr);\r\n\r\n// arr2 = op.evenArray(arr2);\r\n// for(int i=0;i<arr2.length;i++)\r\n// System.out.println(arr2[i]);\r\n\r\n //System.out.println(\"Mean value: \"+op.meanValue(arr3));\r\n\r\n// String[] arrOfStr = {\"ana\",\"are\",\"mere\",\"pere\",\"mere\"};\r\n// String str = \"mere\";\r\n// System.out.println(op.isContaingString(arrOfStr,str));\r\n\r\n// System.out.println(op.findPosition(arr3,number));\r\n\r\n //op.displayLines();\r\n\r\n// int[]modifArr = op.modifiedArr(arr3,number);\r\n// for(int item: modifArr)\r\n// System.out.print(item+\" \");\r\n\r\n\r\n //System.out.println(\"Second minimum: \"+op.secondMin(arr3));\r\n\r\n int[] empty = new int[arr3.length];\r\n empty = op.populateArray(arr3,empty);\r\n for(int item:empty)\r\n System.out.print(item+\" \");\r\n\r\n\r\n\r\n }", "public static void main(String[] args) {\n\n pairsSum();\n\n printAllSubArrays();\n\n tripletZero();\n\n // int[][] sub = subsets();\n\n PairsSum sum = new PairsSum();\n int[] arr = { 10, 1, 2, 3, 4, 5, 6, 1 };\n boolean flag = sum.almostIncreasingSequence(arr);\n System.out.println(flag);\n\n String s = \"\";\n for (int i = 0; i < 100000; i++) {\n // s += \"CodefightsIsAwesome\";\n }\n long start = System.currentTimeMillis();\n // int k = subStr(s, \"IsA\");\n System.out.println(System.currentTimeMillis() - start);\n // System.out.println(k);\n\n String[] a = { \"aba\", \"aa\", \"ad\", \"vcd\", \"aba\" };\n String[] b = sum.allLongestStrings(a);\n System.out.println(Arrays.deepToString(b));\n\n List<String> al = new ArrayList<>();\n al.toArray();\n\n Map<Integer, Integer> map = new HashMap<>();\n Set<Integer> keySet = map.keySet();\n for (Integer integer : keySet) {\n\n }\n\n String st = reverseBracksStack(\"a(bc(de)f)g\");\n System.out.println(st);\n\n int[] A = { 1, 2, 3, 2, 2, 3, 3, 33 };\n int[] B = { 1, 2, 2, 2, 2, 3, 2, 33 };\n\n System.out.println(sum.isIPv4Address(\"2.2.34\"));\n\n Integer[] AR = { 5, 3, 6, 7, 9 };\n int h = sum.avoidObstacles(AR);\n System.out.println(h);\n\n int[][] image = { { 36, 0, 18, 9 }, { 27, 54, 9, 0 }, { 81, 63, 72, 45 } };\n int[][] im = { { 7, 4, 0, 1 }, { 5, 6, 2, 2 }, { 6, 10, 7, 8 }, { 1, 4, 2, 0 } };\n int[][] res = sum.boxBlur(im);\n\n for (int i = 0; i < res.length; i++) {\n for (int j = 0; j < res[0].length; j++) {\n System.out.print(res[i][j] + \" \");\n }\n System.out.println();\n }\n\n boolean[][] ms = { { true, false, false, true }, { false, false, true, false }, { true, true, false, true } };\n int[][] mines = sum.minesweeper(ms);\n for (int i = 0; i < mines.length; i++) {\n for (int j = 0; j < mines[0].length; j++) {\n System.out.print(mines[i][j] + \" \");\n }\n System.out.println();\n }\n\n System.out.println(sum.variableName(\"var_1__Int\"));\n\n System.out.println(sum.chessBoard());\n\n System.out.println(sum.depositProfit(100, 20, 170));\n\n String[] inputArray = { \"abc\", \"abx\", \"axx\", \"abx\", \"abc\" };\n System.out.println(sum.stringsRearrangement(inputArray));\n\n int[][] queens = { { 1, 1 }, { 3, 2 } };\n int[][] queries = { { 1, 1 }, { 0, 3 }, { 0, 4 }, { 3, 4 }, { 2, 0 }, { 4, 3 }, { 4, 0 } };\n boolean[] r = sum.queensUnderAttack(5, queens, queries);\n\n }", "protected static Object[] calcGainRatios(InstanceList ilist, int[] instIndices, int minNumInsts)\n {\n int numInsts = instIndices.length;\n Alphabet dataDict = ilist.getDataAlphabet();\n LabelAlphabet targetDict = (LabelAlphabet) ilist.getTargetAlphabet();\n double[] targetCounts = new double[targetDict.size()];\n\n // Accumulate target label counts and make sure\n // the sum of each instance's target label is 1\n for (int ii = 0; ii < numInsts; ii++) {\n Instance inst = ilist.get(instIndices[ii]);\n Labeling labeling = inst.getLabeling();\n double labelWeightSum = 0;\n for (int ll = 0; ll < labeling.numLocations(); ll++) {\n int li = labeling.indexAtLocation(ll);\n double labelWeight = labeling.valueAtLocation(ll);\n labelWeightSum += labelWeight;\n targetCounts[li] += labelWeight;\n }\n assert(Maths.almostEquals(labelWeightSum, 1));\n }\n\n // Calculate the base entropy Info(D) and the the \n // label distribution of the given instances\n double[] targetDistribution = new double[targetDict.size()];\n double baseEntropy = 0;\n for (int ci = 0; ci < targetDict.size(); ci++) {\n double p = targetCounts[ci] / numInsts;\n targetDistribution[ci] = p;\n if (p > 0)\n baseEntropy -= p * Math.log(p) / log2;\n }\n\n LabelVector baseLabelDistribution = new LabelVector(targetDict, targetDistribution);\n double infoGainSum = 0;\n int totalNumSplitPoints = 0;\n double[] passTestTargetCounts = new double[targetDict.size()];\n // Maps feature index -> Hashtable, and each table \n // maps (split point) -> (info gain, split ratio)\n HashMap[] featureToInfo = new HashMap[dataDict.size()]; \n \n // Go through each feature's split points in ascending order\n for (int fi = 0; fi < dataDict.size(); fi++) {\n \n if ((fi+1) % 1000 == 0)\n logger.info(\"at feature \" + (fi+1) + \" / \" + dataDict.size());\n \n featureToInfo[fi] = new HashMap();\n Arrays.fill(passTestTargetCounts, 0);\n // Sort instances on this feature's values\n instIndices = sortInstances(ilist, instIndices, fi);\n\n // Iterate through the sorted instances\n for (int ii = 0; ii < numInsts-1; ii++) {\n Instance inst = ilist.get(instIndices[ii]);\n Instance instPlusOne = ilist.get(instIndices[ii+1]);\n FeatureVector fv1 = (FeatureVector) inst.getData();\n FeatureVector fv2 = (FeatureVector) instPlusOne.getData();\n double lower = fv1.value(fi);\n double higher = fv2.value(fi);\n\n // Accumulate the label weights for instances passing the test\n Labeling labeling = inst.getLabeling();\n for (int ll = 0; ll < labeling.numLocations(); ll++) {\n int li = labeling.indexAtLocation(ll);\n double labelWeight = labeling.valueAtLocation(ll);\n passTestTargetCounts[li] += labelWeight;\n }\n\n if (Maths.almostEquals(lower, higher) || inst.getLabeling().toString().equals(instPlusOne.getLabeling().toString()))\n continue;\n\n // For this (feature, spilt point) pair, calculate the \n // info gain of using this pair to split insts into those \n // with value of feature <= p versus > p\n totalNumSplitPoints++;\n double splitPoint = (lower + higher) / 2;\n double numPassInsts = ii+1;\n \n // If this split point creates a partition \n // with too few instances, ignore it\n double numFailInsts = numInsts - numPassInsts;\n if (numPassInsts < minNumInsts || numFailInsts < minNumInsts)\n continue;\n \n // If all instances pass or fail this test, it is useless\n double passProportion = numPassInsts / numInsts;\n if (Maths.almostEquals(passProportion, 0) || Maths.almostEquals(passProportion, 1))\n continue; \n \n // Calculate the entropy of instances passing and failing the test\n double passEntropy = 0;\n double failEntropy = 0;\n double p;\n \n for (int ci = 0; ci < targetDict.size(); ci++) {\n if (numPassInsts > 0) {\n p = passTestTargetCounts[ci] / numPassInsts;\n if (p > 0)\n passEntropy -= p * Math.log(p) / log2;\n }\n if (numFailInsts > 0) {\n double failTestTargetCount = targetCounts[ci] - passTestTargetCounts[ci];\n p = failTestTargetCount / numFailInsts;\n if (p > 0)\n failEntropy -= p * Math.log(p) / log2;\n }\n }\n \n // Calculate Gain(D, T), the information gained \n // by testing on this (feature, split-point) pair\n double gainDT = baseEntropy \n - passProportion * passEntropy\n - (1-passProportion) * failEntropy; \n infoGainSum += gainDT;\n // Calculate Split(D, T), the split information\n double splitDT = \n - passProportion * Math.log(passProportion) / log2\n - (1-passProportion) * Math.log(1-passProportion) / log2;\n // Calculate the gain ratio\n double gainRatio = gainDT / splitDT;\n featureToInfo[fi].put(Double.valueOf(splitPoint),\n new Point2D.Double(gainDT, gainRatio));\n } // End loop through sorted instances\n } // End loop through features\n\n // For each feature's split point with at least average gain, \n // get the maximum gain ratio and the associated split point\n // (using the info gain as tie breaker)\n double[] gainRatios = new double[dataDict.size()];\n double[] splitPoints = new double[dataDict.size()];\n int numSplitsForBestFeature = 0;\n\n // If all feature vectors are identical or no splits are worthy, return all 0s\n if (totalNumSplitPoints == 0 || Maths.almostEquals(infoGainSum, 0))\n return new Object[] {gainRatios, splitPoints, Double.valueOf(baseEntropy), \n baseLabelDistribution, Integer.valueOf(numSplitsForBestFeature)};\n\n double avgInfoGain = infoGainSum / totalNumSplitPoints;\n double maxGainRatio = 0;\n double gainForMaxGainRatio = 0; // tie breaker\n \n int xxx = 0;\n \n \n for (int fi = 0; fi < dataDict.size(); fi++) {\n double featureMaxGainRatio = 0;\n double featureGainForMaxGainRatio = 0;\n double bestSplitPoint = Double.NaN;\n\n for (Iterator iter = featureToInfo[fi].keySet().iterator(); iter.hasNext(); ) {\n Object key = iter.next();\n Point2D.Double pt = (Point2D.Double) featureToInfo[fi].get(key);\n double splitPoint = ((Double) key).doubleValue();\n double infoGain = pt.getX();\n double gainRatio = pt.getY();\n\n if (infoGain >= avgInfoGain) {\n if (gainRatio > featureMaxGainRatio || (gainRatio == featureMaxGainRatio && infoGain > featureGainForMaxGainRatio)) {\n featureMaxGainRatio = gainRatio;\n featureGainForMaxGainRatio = infoGain;\n bestSplitPoint = splitPoint;\n }\n }\n else {\n xxx++;\n }\n \n }\n assert(! Double.isNaN(bestSplitPoint));\n gainRatios[fi] = featureMaxGainRatio;\n splitPoints[fi] = bestSplitPoint;\n\n if (featureMaxGainRatio > maxGainRatio || (featureMaxGainRatio == maxGainRatio && featureGainForMaxGainRatio > gainForMaxGainRatio)) {\n maxGainRatio = featureMaxGainRatio;\n gainForMaxGainRatio = featureGainForMaxGainRatio;\n numSplitsForBestFeature = featureToInfo[fi].size();\n }\n }\n \n logger.info(\"label distrib:\\n\" + baseLabelDistribution);\n logger.info(\"base entropy=\" + baseEntropy + \", info gain sum=\" + infoGainSum + \", total num split points=\" + totalNumSplitPoints + \", avg info gain=\" + avgInfoGain + \", num splits with < avg gain=\" + xxx);\n \n return new Object[] {gainRatios, splitPoints, Double.valueOf(baseEntropy), \n baseLabelDistribution, Integer.valueOf(numSplitsForBestFeature)};\n }", "public abstract double[] solveDual(int[][] matrix, double[] profitTable, int[] teamTable);", "INDArray getBoardScores() {\n //creez un vector ce va contine aceste scoruri si va putea fi folosit la antrenare\n INDArray boardScores = Nd4j.zeros(1, size * size);\n\n //creez o copie a tablei pentru a o putea modifica\n Stone[][] boardCopy = Board.getBoard(), board = new Stone[size][size];\n\n //gasesc recursiv scorurile tablei curente\n float[][] boardScoresFloat = new float[size][size];\n //simulez o mutare a jucatorului\n int stonesNr = Board.getStonesNr();\n for(int i = 0; i < size; i++)\n for(int j = 0; j < size; j++){\n Chain chain = new Chain();\n Stone stone = new Stone(color ? \"black\" : \"white\", chain);\n stone.setPosition(i, j);\n for (int k = 0; k < boardCopy.length; k++) {\n board[k] = Arrays.copyOf(boardCopy[k], boardCopy[k].length);\n }\n int[] lib = Control.verifyLiberties(board, stone, i, j);\n if(board[i][j] == null && lib[0] + lib[1] != 0){\n int depth = 0;\n int dif = size / 2;\n boardScoresFloat[i][j] = getQScore(board, i, j, depth, depth)\n + new Random().nextInt(1000 / stonesNr) - (500 / stonesNr)\n - abs(i - dif) - abs(j - dif);\n }\n else{\n boardScoresFloat[i][j] = -5000;\n }\n }\n\n //normalizez vectorul\n //aflu norma vectorului de valori\n double sum = 0;\n for(int i = 0; i < size; i++)\n for(int j = 0; j < size; j++)\n sum += boardScoresFloat[i][j] * boardScoresFloat[i][j];\n sum = Math.sqrt(sum);\n //aplic norma\n for(int i = 0; i < size; i++)\n for(int j = 0; j < size; j++)\n boardScoresFloat[i][j] /= sum;\n\n //inserez rezultatele gasite intr-un INDArray\n int poz = 0;\n for(int i = 0; i < size; i++)\n for(int j = 0; j < size; j++){\n boardScores.putScalar(new int[]{0, poz}, boardScoresFloat[i][j]);\n poz++;\n }\n //System.out.println(boardScores);\n return boardScores;\n }", "private void declareArrays() {\n int iNumTimesteps = m_oLegend.getNumberOfTimesteps(),\n i, j, k;\n \n //Create arrays to hold raw data.\n mp_fLiveTreeVolumeTotals = new double[m_iNumSpecies][iNumTimesteps + 1][m_iNumSizeClasses];\n mp_fSnagVolumeTotals = new double[m_iNumSpecies][iNumTimesteps + 1][m_iNumSizeClasses]; \n mp_iLiveTreeCounts = new long[m_iNumSpecies][iNumTimesteps + 1][m_iNumSizeClasses];\n mp_iSnagCounts = new long[m_iNumSpecies][iNumTimesteps + 1][m_iNumSizeClasses];\n mp_fLiveTreeDBHTotal = new double[m_iNumSpecies][iNumTimesteps + 1];\n mp_fSnagDBHTotal = new double[m_iNumSpecies][iNumTimesteps + 1];\n mp_fTallestLiveTrees = new float[m_iNumSpecies+1][iNumTimesteps + 1][10];\n mp_fTallestSnags = new float[m_iNumSpecies+1][iNumTimesteps + 1][10];\n \n //Initialize all values with 0s\n for (i = 0; i < mp_fTallestLiveTrees.length; i++) {\n for (j = 0; j < mp_fTallestLiveTrees[i].length; j++) {\n for (k = 0; k < mp_fTallestLiveTrees[i][j].length; k++) {\n mp_fTallestLiveTrees[i][j][k] = 0;\n mp_fTallestSnags[i][j][k] = 0;\n }\n }\n }\n \n for (i = 0; i < m_iNumSpecies; i++) {\n for (j = 0; j <= iNumTimesteps; j++) {\n mp_fLiveTreeDBHTotal[i][j] = 0;\n mp_fSnagDBHTotal[i][j] = 0;\n for (k = 0; k < m_iNumSizeClasses; k++) {\n mp_iLiveTreeCounts[i][j][k] = 0;\n mp_iSnagCounts[i][j][k] = 0;\n mp_fLiveTreeVolumeTotals[i][j][k] = 0;\n mp_fSnagVolumeTotals[i][j][k] = 0;\n }\n }\n }\n }", "static void makeAllWaysCacheDistToMethod(){\n allWaysCache = new long[8][NumToCheck + 1];\n int currentDescriptor = 0;\n for (int jump = 1; jump <= 3; jump++){\n for (int j = jump; j <= NumToCheck; j += jump){\n allWaysCache[currentDescriptor][j] = 1;\n }\n currentDescriptor++;\n }\n //1,2\n addShifted(allWaysCache[3], allWaysCache[0], 3);\n addShifted(allWaysCache[3], allWaysCache[1], 3);\n cummulativeShift(allWaysCache[3], 3);\n //1,3\n addShifted(allWaysCache[4], allWaysCache[0], 4);\n addShifted(allWaysCache[4], allWaysCache[2], 4);\n cummulativeShift(allWaysCache[4], 4);\n //2,3\n addShifted(allWaysCache[5], allWaysCache[1], 5);\n addShifted(allWaysCache[5], allWaysCache[2], 5);\n cummulativeShift(allWaysCache[5], 5);\n //1,2,3\n addShifted(allWaysCache[6], allWaysCache[3], 6);\n addShifted(allWaysCache[6], allWaysCache[4], 6);\n addShifted(allWaysCache[6], allWaysCache[5], 6);\n cummulativeShift(allWaysCache[6], 6);\n\n //do I want to add them together?\n //I think I do,\n for (int i = 0; i < 6; i++){\n for (int j = 0; j <= NumToCheck; j++){\n allWaysCache[6][j] += allWaysCache[i][j];\n }\n }\n addShifted(allWaysCache[5], allWaysCache[1], 0);\n addShifted(allWaysCache[5], allWaysCache[2], 0);\n addShifted(allWaysCache[4], allWaysCache[0], 0);\n addShifted(allWaysCache[4], allWaysCache[2], 0);\n addShifted(allWaysCache[3], allWaysCache[0], 0);\n addShifted(allWaysCache[3], allWaysCache[1], 0);\n for (int i = 0; i <= 6; i++){\n allWaysCache[i][0] = 1;\n }\n\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 }", "public static void checkConsistency(){\n double[] aNormalW=new double[numberOfObjectives];\n double randomIndex=0;\n double sum=0;\n for (int row=0;row<numberOfObjectives;row++){\n for (int column=0;column<numberOfObjectives;column++){\n\n sum+=weights[column]*objectives[row][column];\n }\n df.setRoundingMode(RoundingMode.UP);\n aNormalW[row]= Double.valueOf(df.format(sum));\n sum=0;\n }\n double awtDividedByWt=0;\n for (int i=0;i<numberOfObjectives;i++){\n awtDividedByWt+=aNormalW[i]/weights[i];\n decimalFormat.setRoundingMode(RoundingMode.HALF_UP);\n Double.valueOf(decimalFormat.format(awtDividedByWt));\n }\n double reciprocalNumber=(double) 1/numberOfObjectives;\n decimalFormat.setRoundingMode(RoundingMode.UP);\n Double.valueOf(decimalFormat.format(reciprocalNumber));\n double step3=reciprocalNumber*awtDividedByWt;\n decimalFormat.setRoundingMode(RoundingMode.UP);\n double numerator=Double.valueOf(decimalFormat.format(step3))-numberOfObjectives;\n double denominator=numberOfObjectives-1;\n decimalFormat.setRoundingMode(RoundingMode.UP);\n double ci=Double.valueOf(decimalFormat.format(numerator)) /denominator;\n decimalFormat.setRoundingMode(RoundingMode.CEILING);\n System.out.println(\"Consistency Index (CI)= \"+Double.valueOf(decimalFormat.format(ci)));\n System.out.println();\n double ciDividedByRI=ci/table23(numberOfObjectives);\n decimalFormat.setRoundingMode(RoundingMode.UP);\n // Double.valueOf(df.format(ciDividedByRI));\n if (ciDividedByRI<0.10){\n randomIndex=ci/table23(numberOfObjectives);\n decimalFormat.setRoundingMode(RoundingMode.UP);\n System.out.println(\"Random Index (RI)= \"+Double.valueOf(decimalFormat.format(randomIndex)));\n System.out.println(\"degree of consistency is satisfactory !!\");\n }else {\n System.out.println(\"the AHP may not yield meaningful results !!\");\n }\n System.out.println();\n }", "int compteMonstres(Soldat unites[][]);", "public abstract NSMutableArray<I_WorkFlowItem> tachesObligatoires();", "public static void main(String[] args) {\n int l1=1000, l2=1000;\n int[] a1=new int[l1];\n int[] a2=new int[l2];\n int[] combine = new int[l1+l2];\n\n Random r = new Random();\n for (int i=0; i<a1.length; ++i){\n a1[i]=r.nextInt(a1.length*3);\n combine[i]=a1[i];\n }\n\n for (int i=0; i<a2.length; ++i){\n a2[i]=r.nextInt(a2.length*3);\n combine[l1+i]=a2[i];\n }\n\n Arrays.sort(a1);\n Arrays.sort(a2);\n Arrays.sort(combine);\n\n cnt=0;\n int m = findByRank(a1, 0, a1.length, a2, 0, a2.length, (a1.length+a2.length)/2);\n int m2 = combine[combine.length/2-1];\n\n System.out.printf(\"m=%d, m2=%d, cnt=%d\", m, m2, cnt);\n\n\n\n }", "private static int[] getTimesTable(int requiredSize, int requiredNumber) \n\t{\n\t\t// local array for the loop to amend and then return\n\t\tint [] timesArray = new int [requiredSize];\n\t\n\t\tfor (int i = 1; i <= requiredSize; i++)\n\t\t{\n\t\t\t// amends the local timesArray array\n\t\t\ttimesArray[i -1] = requiredNumber * i; \n\t\t\t//System.out.println(timesArray[i -1] = requiredNumber * i); // testing purposes so you can see the value before ammending the array\n\t\t}\n\t\t\n\t\t// returns local array as result for the main method array\n\t\treturn timesArray;\n\t}", "public static void main(String[] args)\n\t{\n \n\t\tSystem.out.println(\"Enter the size of transaction array\");\n int trSize = sc.nextInt();\n\n // creating an array of provided size\n int[] transactions = new int[trSize];\n \n // get the elements of the array (in a loop)\n System.out.println(\"Enter the values of array\");\n for (int i = 0; i < transactions.length; i++) {\n transactions[i] = sc.nextInt();\n }\n // get the number of targets\n System.out.println(\"Enter the total no of targets that needs to be achieved\");\n int numTargets = sc.nextInt();\n \n // get in target one-by-one (loop)\n for (int i = 0; i < numTargets; i++) {\n \n \t// Get TargetValue\n System.out.println(\"Enter the value of target\");\n int target = sc.nextInt();\n \n int sum =0;\n for ( int j=0; j < transactions.length; j++) {\n \tsum = sum + transactions[j];\n \t\n \tif ( sum >= target) {\n \tSystem.out.println(\"Target achieved after \" + (j+1) + \" transactions\" );\n \tbreak; // break out of the innermost for loop\n \t}\n \t\n \t//we come to the last transactions, yet target is not achieved\n \tif (j == transactions.length - 1) {\n \t\tSystem.out.println( \"Given target is not achieved\");\n \t}\n \t\n }\n \n \n\t}\n\n}", "private void cpu_jogada(){\n\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(matriz[i][j] == jd2){\n // verificarAtaque(i,j,jd2);\n //verificarAtaque as posssibilidades de\n // ataque : defesa : aleatorio\n //ataque tem prioridade 1 - ve se tem como comer quem ataca\n //defesa tem prioridade 2 - ou movimenta a peca que esta sob ataque ou movimenta a outa para ajudar\n //aleatorio nao tem prioridade -- caso nao esteja sob ataque ou defesa\n }\n }\n }\n }", "public int[] twoSum2(int[] nums, int target) {\n int max = nums[0];\n int min = max;\n // get rank\n for (int e : nums) {\n if (e > max) {\n max = e;\n }\n if (e < min) {\n min = e;\n }\n }\n // show up table\n Integer[] showUpMap = new Integer[max - min + 1];\n LinkedList[] indicesMap = new LinkedList[max - min + 1];\n for (int i = 0; i < nums.length; i++) {\n showUpMap[nums[i] - min] = 1;\n if (indicesMap[nums[i] - min] == null) {\n indicesMap[nums[i] - min] = new LinkedList<Integer>();\n }\n indicesMap[nums[i] - min].add(i);\n }\n System.out.println(Arrays.toString(showUpMap));\n System.out.println(Arrays.toString(indicesMap));\n for (int i = 0; i < showUpMap.length; i++) {\n boolean show = showUpMap[i] != null;\n if (show) {\n int a = i + min;\n int need = target - a;\n if (need - min < showUpMap.length &&\n showUpMap[need - min] != null) {\n int ai = (int) indicesMap[i].get(0);\n int bi = (int) indicesMap[need - min].get(0);\n if (ai == bi) {\n bi = (int) indicesMap[need - min].get(1);\n }\n return new int[]{ai, bi};\n }\n }\n }\n return null;\n }", "double calculateGLBasicMass(int i1, int i2, int i3)\n {\n\n // Array of Glycerolipid's num of Carbon, Hydrogen repeated (for SN1 Dropdown Menu's values)\n int[] arrayGL_sn1 = {\n 5,10, 7,14, 9,18, 11,22, 13,26, 15,30, 16,32, 17,34,\n 17,32, 18,36, 18,34, 19,40, 19,38, 19,38, 19,36, 20,40,\n 20,38, 20,36, 21,44, 21,42, 21,42, 21,40, 21,40, 21,38,\n 21,36, 21,36, 21,34, 22,44, 23,48, 23,46, 23,46, 23,44,\n 23,42, 23,40, 23,38, 23,36, 24,48, 25,50, 25,48, 25,46,\n 25,44, 25,42, 25,40, 25,38, 26,52, 27,54, 27,52, 28,56, 29,58};\n\n // addCarbon array: Amount of increase in Carbon when on certain sn2 & sn3 index position\n int[] addCarbon = {\n 0, 2, 4, 6, 8, 10, 12, 13, 14, 14, 15, 15, 16, 16, 17, 17, 17,\n 18, 18, 18, 18, 18, 18, 18, 19, 20, 20, 20, 20,\t20,\t20, 21, 22,\n 22,\t22,\t22,\t22, 22, 22, 23, 24, 24, 25, 26 };\n\n // addHydrogen array: Amount of increase in Hydrogen when on certain sn2 & sn3 index position\n int[] addHydrogen = {\n 0, 2, 6, 10, 14, 18, 22, 24, 26, 24, 28, 26, 30, 28, 32, 30, 28,\n 34,\t32,\t32,\t30,\t28,\t28,\t26,\t36,\t38,\t36,\t34,\t32,\t30,\t28,\t40,\t42,\n 40,\t38,\t36,\t34,\t32,\t30,\t44,\t46,\t44,\t48,\t50 };\n\n // Get the # of C & H depending on the index position of SN1's dropdown menu\n int numOfC = arrayGL_sn1[i1 * 2], numOfH = arrayGL_sn1[i1 * 2 + 1];\n\n // Add carbon & hydrogen depending on SN2 and SN3 dropdown menu's index position\n numOfC = numOfC + addCarbon[i2] + addCarbon[i3];\n numOfH = numOfH + addHydrogen[i2] + addHydrogen[i3];\n\n /* Set Number of Carbon & Hydrogen */\n setNumC(numOfC); setNumH(numOfH);\n\n /* Set Number of Oxygen */\n\n // If SN1 Dropdown index is not O or P\n if (i1 != 11 && i1 != 12 && i1 != 18 && i1 != 19 && i1 != 28 && i1 != 29) {\n\n if (i2 == 0 && i3 == 0){ setNumO(4); }\n else if (i2 == 0 || i3 == 0) { setNumO(5); }\n else setNumO(6);\n\n // If SN1 Dropdown index is O or P\n } else {\n\n if (i2 == 0 && i3 == 0){ setNumO(3); }\n else if (i2 == 0 || i3 == 0) { setNumO(4); }\n else setNumO(5);\n }\n\n // Sets the basic mass based on the elemental composition of the monoisotopic distribution\n setMass(calculateInitialMass(getNumC(), getNumH(), getNumO(), getNumN(), getNumAg(),\n getNumLi(), getNumNa(), getNumK(), getNumCl(), getNumP(), getNumS(), getNumF()));\n\n // Return basic mass\n return getMass();\n }", "public static int zeroOneKnapsack(int[] weight, int[] value, int capacity) {\n\t\tint[][] dp = new int[weight.length + 1][capacity + 1];\n\n\t\tfor (int i = 0; i < weight.length + 1 ; i++) {\n\t\t\t for (int j = 0; j < capacity + 1; j++) {\n\t\t\t\t\n\t\t\t\t // base condition for memoization\n\t\t\t\t // first row and first column for 2d matrix is initialised to 0\n\t\t\t\t // profit = 0 when number of items = 0 or bag capacity = 0 \n\t\t\t\t if (i == 0 || j == 0) { \n\t\t\t\t\t dp[i][j] = 0;\n\t\t\t\t } \n\t\t\t\t \n\t\t\t\t // weight of item under consideration is less than capacity of bag\n\t\t\t\t // value of i in 2d matrix corresponds to (i-1)th element in weight and value arrays\n\t\t\t\t // hence, weight(i-1) is compared with the corresponding matrix cell capacity(i.e.column)\n\t\t\t\t \n\t\t\t\t else if (weight[i-1] <= j){\n\t\t\t\t\t \n\t\t\t\t\t // possibility 1: when item having weight(i-1) is added to bag\n\t\t\t\t\t // item having weight(i-1) has value(i-1)\n\t\t\t\t\t // this value added to array value for (i-1)th row and (j-weight[i-1])th column\n\t\t\t\t\t // because :\n\t\t\t\t\t // 1) the total capacity reduced by weight(i-1) after deciding item inclusion\n\t\t\t\t\t // 2) total no.of elements reduced by 1 after deciding item inclusion\n\t\t\t\t\t \n\t\t\t\t\t int a = value[i-1] + dp[i-1][j-weight[i-1]];\n\t\t\t\t\t \n\t\t\t\t\t// possibility 1: when item having weight(i-1) is not added to bag\n\t\t\t\t\t// 1) the total capacity remains as is after deciding item exclusion\n\t\t\t\t\t// 2) total no.of elements reduced by 1 after deciding item exclusion\n\t\t\t\t\t \n\t\t\t\t\t int b = dp[i-1][j];\n\t\t\t\t\t \n\t\t\t\t\t // max of a and b taken to find maximum profit value \n\t\t\t\t\t dp[i][j] = Math.max(a, b);\t \n\t\t\t\t\t \n\t\t\t\t }\n\t\t\t\t \n\t\t\t\t \n\t\t\t\t // weight of item under consideration is more than capacity of bag\n\t\t\t\t // hence item having weight(i-1) is not added to bag\n\t\t\t\t else {\n\t\t\t\t\t \n\t\t\t\t\t// 1) the total capacity remains as is after deciding item exclusion\n\t\t\t\t\t// 2) total no.of elements reduced by 1 after deciding item exclusion\n\t\t\t\t\t \n\t\t\t\t\t dp[i][j] = dp[i-1][j];\n\t\t\t\t\t \n\t\t\t\t }\n\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn dp[weight.length][capacity];\n\t\t\n\t}", "@Test\n public void testBuildGraph_FactorArr_booleanArrArr() {\n\n char[][] adjacency = new char[][]{\n {0, 0, 0, 0, 0, 0, 0, 1, 0, 0},\n {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},\n {0, 1, 0, 0, 0, 0, 0, 0, 0, 0},\n {0, 0, 1, 0, 0, 0, 0, 0, 0, 0},\n {0, 0, 0, 1, 0, 0, 0, 0, 0, 0},\n {0, 0, 0, 0, 0, 0, 1, 0, 0, 0},\n {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},\n {0, 0, 0, 0, 1, 0, 0, 0, 0, 0},\n {0, 0, 0, 0, 0, 1, 0, 0, 0, 0},\n {0, 0, 0, 0, 0, 0, 0, 0, 1, 0},\n };\n\n CostFunction[][] factors = new CostFunction[][]{\n {factory.buildCostFunction( new Variable[]{v[0],v[7]}, 0 )},\n {},\n {factory.buildCostFunction( new Variable[]{v[1],v[2]}, 0 )},\n {factory.buildCostFunction( new Variable[]{v[2],v[3]}, 0 )},\n {factory.buildCostFunction( new Variable[]{v[3],v[4]}, 0 ),\n factory.buildCostFunction( new Variable[]{v[1],v[3],v[4]}, 0 )},\n {factory.buildCostFunction( new Variable[]{v[1],v[5]}, 0 )},\n {factory.buildCostFunction( new Variable[]{v[2],v[6]}, 0 ),\n factory.buildCostFunction( new Variable[]{v[1],v[6],v[7]}, 0 ),\n factory.buildCostFunction( new Variable[]{v[0],v[6]}, 0 )},\n {factory.buildCostFunction( new Variable[]{v[3],v[7]}, 0 )},\n {factory.buildCostFunction( new Variable[]{v[4],v[8]}, 0 ),\n factory.buildCostFunction( new Variable[]{v[5],v[8]}, 0 ),\n factory.buildCostFunction( new Variable[]{v[0],v[8]}, 0 )},\n {factory.buildCostFunction( new Variable[]{v[2],v[5],v[9]}, 0 ),\n factory.buildCostFunction( new Variable[]{v[5],v[6],v[9]}, 0 ),\n factory.buildCostFunction( new Variable[]{v[4],v[7],v[9]}, 0 ),\n factory.buildCostFunction( new Variable[]{v[0],v[8],v[9]}, 0 )},\n };\n\n GdlFactory gf = new GdlFactory();\n UPGraph result = JunctionTreeAlgo.buildGraph(gf, factors, adjacency);\n //System.out.println(result);\n }", "int countSusbset(int n, int w){\n int dp[][] = new int[n+1][w+1];\n for(int i=0;i<=n;i++){\n for(int j=0;j<=w;j++){\n //when no items are there and target sum is 0, only one empty subset is possible\n if(i == 0 && j == 0){\n dp[i][j] = 1;\n }\n //no items left and target sum is greater than 0, no set is possible\n else if(i == 0 && j > 0){\n dp[i][j] = 0; \n }\n //if target sum is 0, no matter how many items we have , only one empty subset is possible\n else if(j == 0){\n dp[i][j] = 1;\n }\n //since item > target sum, so exclude\n else if(arr[i-1] > j){\n dp[i][j] = dp[i-1][j];\n }else{\n //two cases include and exclude\n dp[i][j] = dp[i-1][j] + dp[i-1][j - arr[i-1]];\n }\n }\n }\n return dp[n][w];\n}", "@SuppressWarnings(\"boxing\")\n public int[] getMatching() {\n if (this.n == -1 || this.m == -1) {\n throw new IllegalStateException(\"Graph size not specified.\");\n }\n if (this.n == 0) {\n return new int[0];\n }\n ensurePositiveWeights();\n\n // Step 0: Initialization\n this.eligibleS.clear();\n this.eligibleT.clear();\n for (Integer i = 0; i < this.n; i++) {\n this.sMatches[i] = -1;\n\n this.u[i] = this.maxWeight; // ambiguous on p. 205 of Lawler, but see p. 202\n\n // this is really first run of Step 1.0\n this.sLabels[i] = EMPTY_LABEL;\n this.eligibleS.add(i);\n }\n\n for (int j = 0; j < this.m; j++) {\n this.tMatches[j] = -1;\n\n this.v[j] = 0;\n this.pi[j] = Double.POSITIVE_INFINITY;\n\n // this is really first run of Step 1.0\n this.tLabels[j] = NO_LABEL;\n }\n\n while (true) {\n // Augment the matching until we can't augment any more given the\n // current settings of the dual variables.\n while (true) {\n // Steps 1.1-1.4: Find an augmenting path\n int lastNode = findAugmentingPath();\n if (lastNode == -1) {\n break; // no augmenting path\n }\n\n // Step 2: Augmentation\n flipPath(lastNode);\n for (int i = 0; i < this.n; i++)\n this.sLabels[i] = NO_LABEL;\n\n for (int j = 0; j < this.m; j++) {\n this.pi[j] = Double.POSITIVE_INFINITY;\n this.tLabels[j] = NO_LABEL;\n }\n\n // This is Step 1.0\n this.eligibleS.clear();\n for (int i = 0; i < this.n; i++) {\n if (this.sMatches[i] == -1) {\n this.sLabels[i] = EMPTY_LABEL;\n this.eligibleS.add(i);\n }\n }\n\n this.eligibleT.clear();\n }\n\n // Step 3: Change the dual variables\n\n // delta1 = min_i u[i]\n double delta1 = Double.POSITIVE_INFINITY;\n for (int i = 0; i < this.n; i++) {\n if (this.u[i] < delta1) {\n delta1 = this.u[i];\n }\n }\n\n // delta2 = min_{j : pi[j] > 0} pi[j]\n double delta2 = Double.POSITIVE_INFINITY;\n for (int j = 0; j < this.m; j++) {\n if ((this.pi[j] >= TOL) && (this.pi[j] < delta2)) {\n delta2 = this.pi[j];\n }\n }\n\n if (delta1 < delta2) {\n // In order to make another pi[j] equal 0, we'd need to\n // make some u[i] negative.\n break; // we have a maximum-weight matching\n }\n\n changeDualVars(delta2);\n }\n\n int[] matching = new int[this.n];\n for (int i = 0; i < this.n; i++) {\n matching[i] = this.sMatches[i];\n }\n return matching;\n }", "public static void knapsackDynamicProgramming(objects[] items, int capacity, int n) \r\n { \r\n\t\t//use bubble sort to sort item by their weight\t\t\t\t\r\n\t\tfor (int i = 0; i < n-1; i++) \t\t\t\t\r\n\t\t{ \t\t \r\n\t\t\tfor (int j = 0; j < (n-i-1); j++) \t\t \r\n\t\t\t{\t\t \r\n\t\t\t\tif (items[j].weight < items[j+1].weight) \t\t \r\n\t\t\t\t{ \t\t \t\r\n\t\t\t\t\tobjects temp = items[j]; \t\t \r\n\t\t\t\t\titems[j] = items[j+1]; \t\t \r\n\t\t\t\t\titems[j+1] = temp; \t\t \t\t\t\t\t\r\n\t\t\t\t}\t\t \r\n\t\t\t}\t\t\t\t\r\n\t\t}\r\n\t\t\r\n \tif(n <= 0 || capacity <= 0)\r\n \t{\r\n \t\tSystem.out.print(\"Error capacity and object numbers can't be 0\");\r\n \t}\r\n \r\n \tint matrixTable[][] = new int[n+1][capacity+1]; \r\n \r\n \tfor (int i = 0; i <= n; i++) \r\n \t{ \r\n \t\tfor (int j = 0; j <= capacity; j++) \r\n \t\t{ \r\n \t\t\t//Preset row 0 value and column value to 0\r\n \t\t\tif (i==0 || j==0) \r\n \t {\r\n \t\t\t\tmatrixTable[i][j] = 0; \r\n \t }\r\n \r\n \t\t\t//If current row number is greater than current weight number\r\n \t\t\telse if (items[i-1].weight <= j) \r\n \t\t\t{\r\n \t\t\t\t//Compare the top value with top value plus value(use weight as the value to go left)result\r\n \t\t\t\t//and use the greatest value for the current one.\r\n \t\t\t\tmatrixTable[i][j] = Math.max(items[i-1].profit + matrixTable[i-1][j-items[i-1].weight], matrixTable[i-1][j]); \r\n \t\t\t}\r\n \t\t\t//If row number is less than current weight number just use the top value\r\n \t\t\telse \r\n \t\t\t{ \t \r\n \t\t\t\tmatrixTable[i][j] = matrixTable[i-1][j];\r\n \t\t\t}\r\n \t\t} \t\r\n \t} \r\n \t\r\n\t\tint totalProfit = matrixTable[n][capacity]; \t\t\r\n\t\tint temp = matrixTable[n][capacity];\r\n\t\tint [] itemInKnapsack = new int [n];\r\n\t\t\r\n\t\t//solving which item is in the knapsack\r\n for (int i = n; i > 0 && temp > 0; i--) { \r\n \r\n \r\n \tif (temp == matrixTable[i - 1][capacity]) \r\n \t{\r\n continue;\r\n \t}\r\n \t//if the top value is different than it is include in the knapsack\r\n else \r\n { \r\n itemInKnapsack[i-1] = items[i-1].index; //Save item number\r\n temp = temp - items[i - 1].profit; \r\n capacity = capacity - items[i - 1].weight; \r\n } \r\n } \r\n \r\n printResult(itemInKnapsack, totalProfit, 2); //Call print result\r\n }", "public static int[] mucScore(LeanDocument key, LeanDocument response)\n{\n // System.out.println(\"==========================================================\");\n // System.out.println(\"Key:\\n\"+key.toStringNoSing()+\"\\n*************************\\nResponse:\\n\"+response.toStringNoSing());\n\n Iterator<TreeMap<Integer, Integer>> goldChains = key.chainIterator();\n // double mucRecall = 0.0;\n int mucRecallNom = 0;\n int mucRecallDenom = 0;\n while (goldChains.hasNext()) {\n TreeMap<Integer, Integer> keyChain = goldChains.next();\n if (keyChain.size() > 1) {\n int numInt = numIntersect(key, keyChain, response);\n\n // int numMatched = getNumMatched(key, keyChain);\n // if(numMatched>0){\n // mucRecallNom += numMatched-numInt;\n mucRecallNom += (keyChain.size() - numInt);\n // mucRecallDenom += numMatched-1;\n mucRecallDenom += keyChain.size() - 1;\n\n // System.out.println(keyChain+\"\\n\"+(keyChain.size() - numInt)+\"/\"+(keyChain.size()-1));\n // }\n }\n }\n int[] result = { mucRecallNom, mucRecallDenom };\n\n return result;\n}", "public static void main(String[] args)\n {\n int[][] ints;\n int[][] ints1;\n\n\n\n\n ints = new int[][]{\n {1, 2, 3, 4, 5, 6, 7, 8, 9},\n {10, 11, 12, 13, 14, 15, 16, 17, 18},\n {19, 20, 21, 22, 23, 24, 25, 26, 27},\n {28, 29, 30, 31, 32, 33, 34, 35, 36},\n {37, 38, 39, 40, 41, 42, 43, 44, 45},\n {46, 47, 48, 49, 50, 51, 52, 53, 54},\n {55, 56, 57, 58, 59, 60, 61, 62, 63},\n {64, 65, 66, 67, 68, 69, 70, 0, 71},\n {73, 74, 75, 76, 77, 78, 79, 80, 72}\n };\n\n ints = new int[][]{\n {1,0},\n {2,3},\n };\n ints1 = new int[][]{\n {1, 2, 3},\n {4, 5, 6},\n {7, 0, 8}\n };\n\n ints1 = new int[][]{\n {1, 2, 3},\n {4, 8, 5},\n {7, 0, 6}\n };\n ints = new int[][]{\n {5, 0, 4},\n {2, 3, 8},\n {7,1,6}\n };\n ints1 = new int[][]{\n {1, 6, 4},\n {7, 0, 8},\n {2, 3, 5}\n };\n\n ints1 = new int[][]{\n {6, 0, 5},\n {8, 7, 4},\n {3, 2, 1}\n };\n ints1 = new int[][]{\n {11, 0, 4, 7},\n {2, 15, 1, 8},\n {5, 14, 9, 3},\n {13, 6, 12, 10 }\n };\n\n\n ints1 = new int[][]{\n {14, 13, 5, 3},\n {0, 1, 8, 12},\n {6, 2, 4, 10},\n {11, 9, 15, 7 }\n };\n\n ints1 = new int[][]{\n {8, 4, 7},\n {1,5,6},\n {3,2,0}\n };\n\n\n ints1 = new int[][]{\n {8, 4, 7},\n {1,5,6},\n {3,2,0}\n };\n\n\n ints = new int[][]{\n {1, 2, 3},\n {4, 6,5},\n {7, 8,0}\n };\n ints1 = new int[][]{\n {8, 4, 7},\n {1,5,6},\n {3,2,0}\n };\n ints = new int[][]{\n {1,0},\n {2,3},\n };\n System.out.println(System.currentTimeMillis());\n Board board = new Board(ints);\n Solver solution = new Solver(board);\n\n for (Board el :solution.solution())\n {\n System.out.println(el);\n }\n System.out.println(System.currentTimeMillis());\n\n\n }", "public static void main(String[] args) {\n\t\tint width=35;\n\t\tint length=31;\n\t\tlong[][] dp = new long[width+1][length+1];\n\t\tdp[0][0]=0;\n\t\tfor(int i=1;i<length+1;i++){\n\t\t\tif(badCheck(0,i,0,i-1)){\n\t\t\t\tdp[0][i]=0;\n\t\t\t\tfor(int k=i+1;k<length+1;k++){\n\t\t\t\t\tdp[0][k]=0;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}else{\n\t\t\t\tdp[0][i]=1;\n\t\t\t}\n\t\t}\n\t\tfor(int i=1;i<width+1;i++){\n\t\t\tif(badCheck(i,0,i-1,0)){\n\t\t\t\tdp[i][0]=0;\n\t\t\t\tfor(int k=i+1;k<width+1;k++){\n\t\t\t\t\tdp[k][0]=0;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}else{\n\t\t\t\tdp[i][0]=1;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\tfor(int i=1;i<=width;i++){\n\t\t\tfor(int j=1;j<=length;j++){\n\t\t\t\tif(!badCheck(i-1,j,i,j)){\n\t\t\t\t\tdp[i][j]+=dp[i-1][j];\n\t\t\t\t}\n\t\t\t\tif(!badCheck(i,j-1,i,j)){\n\t\t\t\t\tdp[i][j]+=dp[i][j-1];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//System.out.println(dp[6][6]);\n\t\t//System.out.println(dp[2][2]);\n\t\t//System.out.println(dp[1][1]);\n\t\tSystem.out.println(dp[35][31]);\n\t}", "public void ruleOutPos(){\n for(int i=0;i<scores.length;i++) {\n for(int j=0;j<scores[i].length;j++) {\n scores[i][j][13] = 0;//0=pass, >0 is fail, set to pass initially\n\n //check Ns - bit crude - what to discount regions with high N\n double ns = (double) scores[i][j][14] / (double) pLens[j];\n if (ns >= minPb | ns >= minPm)//\n scores[i][j][13] += 4;\n\n //probe\n if (hasProbe){\n if (j == 1 | j == 4) {\n double perc = (double) scores[i][j][0] / (double) primers[j].length();\n if (perc >= minPb) {\n scores[i][j][12] = 1;//flag for failed % test\n scores[i][j][13] += 2;\n }\n }\n }\n //primer\n else {\n //if more than 2 mismatches in 1-4nt at 3'\n if(scores[i][j][11]>max14nt) {\n scores[i][j][13]+=1;\n }\n //use mLen (combined F and R length) initially to find initial candidates - filter later\n double perc=(double)scores[i][j][0]/(double)mLen;\n double percI=(double)scores[i][j][0]/(double)pLens[j];\n\n if(perc>=minPm | percI>=minPmI) {\n scores[i][j][12]=1;//flag for failed % test\n scores[i][j][13]+=2;\n }\n }\n }\n }//end of finding positions that prime loop\n }", "private static int computeCost(int[] arr, int[] combo) {\n int [] cost = new int[combo.length];\n int startCol = 0;\n for(int i = 0; i < combo.length; i++) {\n cost[i] = getCostForPartition(arr, startCol, combo[i]);\n startCol += combo[i];\n }\n // get total cost\n int retval = 0;\n for (int value : cost) {\n retval += value;\n }\n return retval;\n }", "private int[] assign(List<T> medoids, List<T> data) {\n\t\tint[] out = new int[data.size()];\n\t\tfor (int i = 0; i < data.size(); i++) {\n\t\t\tdouble bestDistance = dm.measure(data.get(i), medoids.get(0));\n\t\t\tint bestIndex = 0;\n\t\t\tfor (int j = 1; j < medoids.size(); j++) {\n\t\t\t\tdouble tmpDistance = dm.measure(data.get(i), medoids.get(j));\n\t\t\t\tif (tmpDistance < bestDistance) {\n\t\t\t\t\tbestDistance = tmpDistance;\n\t\t\t\t\tbestIndex = j;\n\t\t\t\t}\n\t\t\t}\n\t\t\tout[i] = bestIndex;\n\n\t\t}\n\t\treturn out;\n\n\t}", "@Override\r\n\tpublic int challengeThree(int[] arr) {\n\t\treturn 0;\r\n\t}", "Soldat[][] getUnites();", "MixtureOfExperts(int nExperts){\r\n\t\twritePosteriorThreshold = 0.0;\r\n\t\testimationPosteriorThreshold = 0.0;\r\n\t\tnumberOfExperts = nExperts;\r\n\t\tlogProbOfCluster = new float[numberOfExperts];\r\n numberOfUsers = 0;\r\n \r\n\t}", "public static int[][] neighborhoodSearch(float[] benefit, float[] weight, int[] knapsackWeight){\n\n /*\n Using greedy algorithm to put items in knapsacks\n */\n\n // number of items\n int itemLen = benefit.length;\n // number of knapsacks\n int knapsackLen = knapsackWeight.length;\n // key: index of item, value: benefit / weight of item\n Map<Integer, Float> benefitPerWeightToIndexMap = new TreeMap<>();\n // if item i is included in knapsack j, result[i][j] = 1, otherwise result[i][j] = 0\n int[][] result = new int[itemLen][knapsackLen];\n // initialize the map\n for (int i = 0; i < itemLen; i++) {\n benefitPerWeightToIndexMap.put(i, (benefit[i] / weight[i]));\n }\n\n // the value comparator for sorting the entrySet in the map by value in descending order (using lambda)\n Comparator<Map.Entry<Integer, Float>> valueComparator = (o1, o2) -> o2.getValue().compareTo(o1.getValue());\n // convert the map to list to sort it by value comparator\n List<Map.Entry<Integer, Float>> benefitPerWeightToIndexList = new ArrayList<>(benefitPerWeightToIndexMap.entrySet());\n benefitPerWeightToIndexList.sort(valueComparator);\n\n printBenefitPerWeightList(benefitPerWeightToIndexList);\n\n int greedyTotalBenefit = 0;\n\n // put items in list into knapsacks\n for (int j = 0; j < knapsackLen; j++) {\n // the items have been put in and ready to be delete\n List<Map.Entry<Integer, Float>> deleteList = new ArrayList<>();\n for (Map.Entry<Integer, Float> entry:\n benefitPerWeightToIndexList) {\n int i = entry.getKey();\n if (weight[i] <= knapsackWeight[j]) {\n result[i][j] = 1;\n greedyTotalBenefit += benefit[i];\n deleteList.add(entry);\n knapsackWeight[j] -= weight[i];\n }\n }\n // delete the items have been put in\n benefitPerWeightToIndexList.removeAll(deleteList);\n }\n // After greedy algorithm\n System.out.println(\"------After greedy algorithm------\");\n printKnapsackWeight(knapsackWeight);\n printItemsNotIncluded(benefitPerWeightToIndexList);\n System.out.println(\"Total benefit:\" + greedyTotalBenefit);\n printResult(result);\n\n /*\n Search neighborhood\n */\n\n int neighborTotalBenefit = greedyTotalBenefit;\n\n // traversing knapsacks\n for (int j1 = 0; j1 < knapsackLen - 1; j1++) {\n for (int j2 = j1 + 1; j2 < knapsackLen; j2++) {\n // traversing items in the two knapsacks\n for (int i1 = 0; i1 < itemLen; i1++) {\n for (int i2 = 0; i2 < itemLen; i2++) {\n // judge if item i1 and item i2 exists in knapsack j1 and j2 respectively\n if (result[i1][j1] == 1 && result[i2][j2] == 1) {\n // tempList for update benefitPerWeightToIndexList in iteration\n List<Map.Entry<Integer, Float>> tempList = new ArrayList<>(benefitPerWeightToIndexList);\n // traversing items that have not been included\n for (Map.Entry<Integer, Float> entry:\n benefitPerWeightToIndexList) {\n int i3 = entry.getKey();\n // judge if the neighborhood solution is feasible\n if (knapsackWeight[j2] + weight[i2] - weight[i1] >= 0\n && knapsackWeight[j1] + weight[i1] - weight[i3] >= 0) {\n // judge if the neighborhood solution is better\n if (neighborTotalBenefit - benefit[i2] + benefit[i3] > neighborTotalBenefit) {\n // change the current solution to the neighborhood solution\n result[i1][j1] = 0;\n result[i1][j2] = 1;\n\n result[i2][j2] = 0;\n\n result[i3][j1] = 1;\n\n tempList.remove(entry);\n int finalI2 = i2;\n tempList.add(new Map.Entry<Integer, Float>() {\n @Override\n public Integer getKey() {\n return finalI2;\n }\n\n @Override\n public Float getValue() {\n return benefit[finalI2] / weight[finalI2];\n }\n\n @Override\n public Float setValue(Float value) {\n return null;\n }\n });\n\n knapsackWeight[j1] += weight[i1] - weight[i3];\n knapsackWeight[j2] += weight[i2] - weight[i1];\n\n neighborTotalBenefit = (int) (neighborTotalBenefit - benefit[i2] + benefit[i3]);\n\n System.out.println(\"------Find a better solution------\");\n System.out.println(\"Remove item\" + i2 + \" in \" + \"knapsack\" + j2 + \", move item\" + i1 + \" from knapsack\" + j1 + \" to \" + \"knapsack\" + j2 + \" and put item\" + i3 + \" in knapsack\" + j1);\n printKnapsackWeight(knapsackWeight);\n printItemsNotIncluded(tempList);\n System.out.println(\"Total benefit:\" + neighborTotalBenefit);\n printResult(result);\n }\n }\n }\n // update the list after traversing the list\n benefitPerWeightToIndexList = tempList;\n }\n }\n }\n }\n }\n\n return result;\n }", "public abstract double solve(int[][] matrix, double[] profitTable, int[] teamTable);", "@Test\n public void testCreateRowIndices2(){\n int[][] a = new int[4][2];\n a[0][0] = 0;\n a[0][1] = 0;\n a[1][0] = 0;\n a[1][1] = 1;\n a[2][0] = 0;\n a[2][1] = 2;\n a[3][0] = 2;\n a[3][1] = 1;\n\n double[][] input = new double[4][3];\n\n for(int i = 0 ; i < a.length ; i++){\n input[a[i][0]][a[i][1]] = 1;\n }\n\n int[][] myIndices = HarderArrayProblems.createRowIndices(input);\n for(int i = 0 ; i < a.length ; i++){\n assertEquals(a[i][0], myIndices[i][0]);\n assertEquals(a[i][1], myIndices[i][1]);\n }\n\n }", "public abstract int[] solve(double[][] costs);", "public void bsetCostElements() {\n\t\t\t\n\t\t\t\n\t\tfor (int obj = 0; obj < finalLocation.length; obj++) {\n\t\t for (int time = 0; time < finalLocation[obj].length; time++) {\n\t\t\t\n\t\t bfCost[obj][time].bstorageCost=totalCostCalculation.btotalResidentCost[time][obj][finalLocation[obj][time]].bstorageCost;\n\t\t\t bfCost[obj][time].breadCost=totalCostCalculation.btotalResidentCost[time][obj][finalLocation[obj][time]].breadCost;\n\t\t\t bfCost[obj][time].bwriteCost=totalCostCalculation.btotalResidentCost[time][obj][finalLocation[obj][time]].bwriteCost;\n\t\t\t bfCost[obj][time].btranCost=totalCostCalculation.btotalResidentCost[time][obj][finalLocation[obj][time]].btranCost;\n\t\t\t \n\t\t\t //1. we calculate latency cost for two cases separately: when the object is in the hot tier or cool tier.\n\t\t\t if (finalLocation[obj][time]==0){//Object is in the cool tier\n\t\t\t\t bfCost[obj][time].bdelayCost=totalCostCalculation.btotalResidentCost[time][obj][0].bdelayCost;\n\t\t\t\t \n\t\t\t }else{// object is in both tiers and, in consequence, the latency cost of writes is the maximum latency of writing in both tiers, and the read latency is the one in hot tier.\n\t\t\t\t bfCost[obj][time].bedelCost=fc.bdelayMaxWriteReadCost(workloadGenerator.objectListRegion[obj], 1, obj, time);\n\t\t\t }\n\t\t\t \n\t\t /* 2. Here we calculate storage cost and transaction cost to make consistent data. This requires just write transaction. Since in our cost \n calculation make a computation for both read and writes.\n\t\t */\n\t\t \n\t\t if(finalLocation[obj][time]==1){//NOTE: in above cost storage, we calculate the cost of object in either in hot or cold tier. \n\t\t \t //So here we calculate the storage cost in cold tier when the object is in hot tier.\n\t\t \t bfCost[obj][time].bstorageCost=bfCost[obj][time].bstorageCost.add(totalCostCalculation.btotalResidentCost[time][obj][0].bstorageCost);\n\t\t bfCost[obj][time].bconsisCost=totalCostCalculation.btotalResidentCost[time][obj][0].bconsisCost;\n\t\t }\n\t\t\t bfCost[obj][time].bnonMigrationCost=bfCost[obj][time].bstorageCost.add(bfCost[obj][time].breadCost).add( bfCost[obj][time].bwriteCost).\n\t\t\t\t\t add(bfCost[obj][time].btranCost).add( bfCost[obj][time].bconsisCost).\n\t\t\t\t\t add(bfCost[obj][time].bdelayCost);\n\t\t\t\t\t //totalCostCalculation.btotalResidentCost[time][obj][finalLocation[obj][time]].bnonMigrationCost.add(bfCost[obj][time].bconsisCost);\n\t\t\t \n\t\t\t //3. We need to calculate just transfer cost between cold to hot tier. From hot to cold tier does not make sense because we have a copy of data in cold tier.\n\t\t if(breakPoint==1){//If breakPoint is ONE then for serving every user, the object for each time slot is transfered from Cold to Hot tier.\n\t\t \t \n\t\t }\n\t\t else if(time>0 && finalLocation[obj][time-1]==0 && finalLocation[obj][time]==1){\n\t\t\t bfCost[obj][time].bmigrationCost=totalCostCalculation.btotalMigrationCost[time][obj][finalLocation[obj][time-1]][finalLocation[obj][time]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\t\t\n\t}", "public int _maxProfitAssignmentSortedCollectors(int[] difficulty, int[] profit, int[] worker) {\n int n = difficulty.length;\n int [][] dp = new int [n][2]; // difficulty, profit pair (dp)\n\n for (int idx = 0; idx < n; idx ++) {\n dp [idx][0] = difficulty [idx];\n dp [idx][1] = profit [idx];\n }\n\n Arrays.sort (dp, (a, b) -> a [0] - b [0]);\n\n // sort the collectors.\n Arrays.sort (worker);\n\n int ans = 0, best = 0, idx = 0;\n for (int w : worker) {\n // compute maxima and save it for next we well to build upon the max (best) seen so far.\n while (idx < n && w >= dp [idx][0]) { // increase difficulty slowly\n best = Math.max (best, dp [idx][1]);\n idx ++;\n }\n ans += best;\n }\n return ans;\n }", "public void fillHeuristicArrayTD(){\n int[] temp;\n //every var gets a score based on how many clauses it satisfies\n for(int i = 0; i< heuristicArrayTD.length; i++){\n temp=variables.clone();\n temp[i]=0;\n heuristicArrayTD[i]=testAstar(temp);\n temp[i]=1;\n heuristicArrayTD[i]+=testAstar(temp);\n }\n }", "public static void main (String args[]) {\n\t\tint[][] ar = BandedArraySearch.create(13);\n\t\tnew BandedArraySolution(ar).trial();\n\t}", "public static void main(String[] args) throws FileNotFoundException {\n FileReader fileReader = new FileReader(\"C:\\\\Users\\\\Stephanie\\\\Projects\\\\HackerRank\\\\src\\\\data\");\n\n Scanner sc = new Scanner(fileReader);\n DecimalFormat df = new DecimalFormat(\"##.00\");\n int n = sc.nextInt();\n\n\n sc.nextLine();\n int i, k = 0, j = 0;\n double arr[] = new double[n - 20];\n int arr_x[] = new int[n - 20];\n int miss_index[] = new int[20];\n for (i = 0; i < n; i++) {\n String temp[] = sc.nextLine().split(\"\\t\");\n\n if (temp[1].startsWith(\"Missing\")) {\n miss_index[j] = i;\n j++;\n } else {\n arr[k] = Double.parseDouble(temp[1]);\n arr_x[k] = i;\n k++;\n }\n\n }\n\n System.out.println(Arrays.toString(arr));\n System.out.println(Arrays.toString(arr_x));\n System.out.println(Arrays.toString(miss_index));\n\n double ansy, ansx, a, b, x0, x1, y0, y1;\n int temp, q1, q2, qq1, qq2;\n\n for (i = 0; i < 20; i++) {\n if (miss_index[i] < arr_x[0]) {\n System.out.println(i+\" miss_index[i]: \"+miss_index[i]+\" arr_x[0]: \"+arr_x[0]);\n x0 = arr_x[0];\n x1 = arr_x[1];\n y0 = arr[0];\n y1 = arr[1];\n\n } else if (miss_index[i] > arr_x[n - 21]) {\n x0 = arr_x[n - 21];\n x1 = arr_x[n - 22];\n y0 = arr[n - 21];\n y1 = arr[n - 22];\n\n\n } else {\n temp = 0;\n while (miss_index[i] > arr_x[temp]) {\n temp++;\n }\n x0 = arr_x[temp - 1];\n x1 = arr_x[temp];\n y0 = arr[temp - 1];\n y1 = arr[temp];\n\n }\n a = (y1 - y0) / (x1 - x0);\n b = y0 - a * x0;\n ansx = miss_index[i];\n ansy = a * ansx + b;\n System.out.println(df.format(ansy));\n }\n\n }", "private int[] vtinit(ProblemData a) {\r\n\r\n\r\n int[] vector = new int[a.getProcesses().length];\r\n for (int i = 0; i < a.getProcesses().length; i++) {\r\n vector[i] = a.getProcesses()[i].getWeight();\r\n }\r\n return vector;\r\n\r\n }", "private void createCase(int growFactor, Result[] myResults, int index) {\n\t\tint[] myArray1 = createArray(growFactor, growFactor-1);\n\t\tmyResults[index] = new Result(growFactor, linealSearch(myArray1, growFactor-1), binarySearch(myArray1, growFactor-1));\n\t}", "public static void main(String[] args) throws IOException {\n BufferedReader f = new BufferedReader(new FileReader(\"gymnastics.in\"));\n PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(\"gymnastics.out\")));\n\n //reads in and initializes n and k values\n StringTokenizer st = new StringTokenizer(f.readLine());\n int k = Integer.parseInt(st.nextToken());\n int n = Integer.parseInt(st.nextToken());\n //total number of possible pairs (nC2)\n int numberPairs = (factorial(n).divide(factorial(n-2).multiply(BigInteger.valueOf(2)))).intValue();\n // (2 * factorial(n-2)));\n //array of ordered arrays containing data from one cow practice session\n int[][] trials = new int[k][n];\n //array of arrays containing each pair (2 elements each)\n int[][] pairs = new int[numberPairs][2];\n\n //initializes trials array\n for(int i = 0; i < k; i++){\n st = new StringTokenizer(f.readLine());\n for(int a = 0; a < n; a++) {\n trials[i][a] = Integer.parseInt(st.nextToken());\n }\n }\n\n //initializes pairs array\n int index = 0;\n for (int i = 0; i < n; i++) {\n for (int l = i + 1; l < n; l++) {\n int[] pair = {trials[0][i], trials[0][l]};\n pairs[index] = pair;\n index = index + 1;\n }\n }\n System.out.println();\n //test function, subtracts 1 from total number of pairs each time a pair is found to be inconsistent\n for (int i = 0; i < pairs.length; i++) {\n index = 0;\n String[] checkArray = new String[k];\n for (int a = 0; a < trials.length; a++) {\n checkArray[index] = check(pairs[i][0], pairs[i][1], trials[a]);\n index = index + 1;\n }\n\n if (checkArray[0] == \"less\") {\n if (contains(checkArray, \"more\")) {\n numberPairs = numberPairs - 1;\n }\n }\n\n if (checkArray[0] == \"more\") {\n if (contains(checkArray, \"less\")) {\n numberPairs = numberPairs - 1;\n }\n }\n }\n\n out.print(numberPairs);\n out.close();\n }", "static int hireAssistant(int tab[]) {\n int best = 0;\n for(int i = 0; i<tab.length; i++) {\n if(tab[i] > best)\n best = tab[i];\n }\n return best;\n }", "public int _maxProfitAssignmentBest(int[] difficulty, int[] profit, int[] worker) {\n // value index reverse array\n int [] dp = new int [100001];\n\n // nice strategy to use in multi-array approach\n // using difficulty as index, profit as value.\n // (difficulty array sorted by default, effort saved)\n for (int idx = 0; idx < difficulty.length; idx ++) {\n // overwrite profit values and keep the max one. (in case of conflict)\n dp [difficulty [idx]] = Math.max (dp [difficulty [idx]], profit [idx]);\n }\n\n // maximize profits stored linearly\n for (int idx = 1; idx < dp.length; idx ++)\n dp [idx] = Math.max (dp [idx - 1], dp [idx]);\n\n // build ans\n int ans = 0;\n for (int w : worker)\n ans += dp [w];\n\n return ans;\n }", "public static void main(String[] args) {\n\t\tRegularTicket[] arr = new RegularTicket[15];\n\t\t// Populates array with tickets in corresponding indices. \n\t\tcreateArray(arr);\n\t\t// Prints each ticket String representation and total profit from all tickets.\n\t\tprint(arr);\n\t}", "public static void main(String[] args) {\n\t\tint[] marks = {10,20,30,60,40,50,70}; // element = 7\n\t\tint[] marks2 = new int[10]; \n\t\tmarks2[0] = 10;\n\t\tmarks2[1] = 10;\n\t\tmarks2[2] = 10;\n\t\tmarks2[3] = 10;\n\t\tmarks2[4] = 10;\n\t\tmarks2[5] = 10;\n\t\tmarks2[6] = 10;\n\t\tmarks2[7] = 10;\n\t\tmarks2[8] = 10;\n\t\tmarks2[9] = 10;\n\t\t\n\t\t// array works on index concept.\n\t\t// 7 - length of this array\n\t\t// highest index - 6\n\t\t// System.out.println(marks.length); // size = 7\n\t\t\n//\t\tfor(int i = 0; i < marks2.length; i++) {\n//\t\t\tSystem.out.println(marks2[i]);\n//\t\t}\n\t\t\n\t\tfor(int i = (marks.length-1) ; i >= 0 ;i--) {\n\t\t\tSystem.out.println(marks[i]);\n\t\t}\n\t\t\n\t\t// advantages\n\t\t// keep the collection\n\t\t// fastest available collection in any object oriented language\n\t\t// when we create array - we have to give size of that array \n\t\t// 10 of int(4) = 10*4 = 40 byte (JVM )\n\t\t\n\t\t// disavantage \n\t\t// array - we cannot chnage the size \n\t\t\n\t\t\n\t\t// multidimentional - 1D array\n\t\t// 2D array - 2 dimentions\n\t\tint[][] matrix = {{10,20},{20,30}}; // directly values \n\t\t\n\t\tint[][] matrix2 = new int[2][2]; // directly values\n\t\tmatrix2[0][0] = 10;\n\t\tmatrix2[0][1] = 20;\n\t\tmatrix2[1][0] = 20;\n\t\tmatrix2[1][1] = 30;\n\t\t\n\t\tint[][] matrix1 = new int[2][6]; // size\n\t\t// student 1 marks\n\t\tmatrix1[0][0] = 10;\n\t\tmatrix1[0][1] = 20;\n\t\tmatrix1[0][2] = 20;\n\t\tmatrix1[0][3] = 20;\n\t\tmatrix1[0][4] = 20;\n\t\tmatrix1[0][5] = 20;\n\t\t// student 2 marks\n\t\tmatrix1[1][0] = 10;\n\t\tmatrix1[1][1] = 20;\n\t\tmatrix1[1][2] = 20;\n\t\tmatrix1[1][3] = 20;\n\t\tmatrix1[1][4] = 20;\n\t\tmatrix1[1][5] = 20;\n\t\t\n\t\t\n\t\t\n\t}", "@Test\n @Order(1)\n void algorithms() {\n \n Combination initialComb = new Combination();\n for (int i = 0; i < assignementProblem.getAssignmentData().getLength(); i++) {\n initialComb.add((long) i + 1);\n }\n assignementProblem.setInCombination(initialComb);\n executeAlgo(SearchTestUtil.ALGO.TABU);\n executeAlgo(SearchTestUtil.ALGO.RECUIT);\n }", "short[][] productionTable();", "static double reliability(vmnode vm, jobnode[] jobs, int[] assigned, int ind) {\n double pow, bw, mem;\n pow = bw = mem = 0;\n\n for (int i = 0; i < jobs.length; i++) {\n if (assigned[i] == ind) {\n pow = pow + 1.0 * jobs[i].pow;\n bw = bw + 1.0 * jobs[i].bw;\n }\n }\n pow = 0.5 * (vm.powavail * 1.0 / pow);\n bw = 0.3 * (vm.bwavail * 1.0 / bw);\n mem = 0.2 * (vm.memavail + vm.memused) / vm.memused;\n if (vm.memused == 0.0) {\n return 1000000.0;\n }\n return (pow + bw + mem);\n }", "public static double ludcmp(double a[][], int indx[])\n\t\t\t{\n\tint n = a.length;\n\tint i = 0, imax = 0, j = 0, k = 0;\n\tdouble big, dum, sum, temp;\n\tdouble d = 1.0;\n\tdouble vv[] = new double[n];\n\tfor (i = 0; i < n; i++) {\n big = 0.0;\n for (j = 0; j < n; j++)\n if ((temp = Math.abs(a[i][j])) > big)\n\t\tbig = temp;\n\n\tif (big == 0.0) {\n try {\n // no non-zero largest element\n\n throw new NRException(\"Error: Singular linearized system. Computation cannot proceed.\");\n } catch (NRException ex) {\n ex.printStackTrace();\n }\n\n\t}\n\tvv[i] = 1.0 / big;\n }\n\n for (j = 0; j < n; j++) {\n\tfor (i = 0; i < j; i++) {\n sum = a[i][j];\n for (k = 0; k < i; k++)\n sum -= (a[i][k] * a[k][j]);\n a[i][j] = sum;\n\t}\n\tbig = 0.0;\n\tfor (i = j; i < n; i++) {\n sum = a[i][j];\n for (k = 0; k < j; k++)\n sum -= (a[i][k] * a[k][j]);\n a[i][j] = sum;\n\t\n if ((dum = vv[i] * Math.abs(sum)) >= big) {\n\t\tbig = dum;\n\t\timax = i;\n\t\t}\n\t}\n\tif (j != imax) {\n\t\tfor (k = 0; k < n; k++) {\n\t\tdum = a[imax][k];\n\t\ta[imax][k] = a[j][k];\n\t\ta[j][k] = dum;\n }\n d = -d;\n vv[imax] = vv[j];\n }\n\tindx[j] = imax;\n\t// replace zero values with a nigh zero value so that\n\t// we don't get any divisions by zero.\n if (a[j][j] == 0.0)\n\t a[j][j] = TINY;\n\n\tif (j != n-1) {\n\tdum = 1.0 / (a[j][j]);\n\tfor (i = j + 1; i < n; i++)\n\t a[i][j] *= dum;\n\t}\n }\n\treturn d;\n\t}", "private void EvalFitness(){\r\n _FitVal=0;\r\n for(int i=0; i<7;i++)\r\n for(int j=i+1;j<8;j++){\r\n if( _Data[i]==_Data[j]) _FitVal++;\r\n if(j-i==Math.abs(_Data[i]-_Data[j])) _FitVal++;\r\n }\r\n }", "public void doPartition() {\n int sum = 0;\n for (int q = 0; q < w.queryCount; q++) {\n for (int a = 0; a < w.attributeCount; a++) {\n sum += w.usageMatrix[q][a];\n }\n }\n\n if (sum == w.queryCount * w.attributeCount) {\n partitioning = new int[w.attributeCount];\n return;\n }\n\n\t\t//ArrayUtils.printArray(usageMatrix, \"Usage Matrix\", \"Query\", null);\n\t\t\n\t\t// generate candidate partitions (all possible primary partitions)\n\t\tint[][] candidatePartitions = generateCandidates(w.usageMatrix);\n\t\t//ArrayUtils.printArray(candidatePartitions, \"Number of primary partitions:\"+candidatePartitions.length, \"Partition \", null);\n\t\t\n\t\t// generate the affinity matrix and METIS input file \n\t\tint[][] matrix = affinityMatrix(candidatePartitions, w.usageMatrix);\n\t\t//ArrayUtils.printArray(matrix, \"Partition Affinity Matrix Size: \"+matrix.length, null, null);\n\t\twriteGraphFile(graphFileName, matrix);\n\t\t\n\t\t// run METIS using the graph file\n\t\ttry {\n\t\t\tProcess p = Runtime.getRuntime().exec(metisLocation+\" \"+graphFileName+\" \"+K);\n\t\t\tp.waitFor();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t\tSystem.exit(1);\n\t\t} catch (InterruptedException e) {\n\t\t\te.printStackTrace();\n\t\t} \n\t\t\n\t\t// read primary partition groups created by METIS \n\t\tint[][][] primaryPartitionGroups = readPartitionFile(candidatePartitions); // TODO exception here for too few groups or attributes...\n\t\t//for(int[][] primaryPartitionGroup: primaryPartitionGroups)\n\t\t//\tArrayUtils.printArray(primaryPartitionGroup, \"Partition Group\", \"Partition\", null);\n\t\t\n\t\t\n\t\t//int i=0;\n\t\tList<int[][]> bestLayouts = new ArrayList<int[][]>();\n\t\tfor(int[][] primaryPartitionGroup: primaryPartitionGroups){\n\t\t\tminCost = Double.MAX_VALUE;\n\t\t\t\n\t\t\t// Candidate Merging\n\t\t\t//System.out.println(\"Primary Partition Group:\"+(i+1));\n\t\t\tList<BigInteger> mergedCandidatePartitions = mergeCandidates(primaryPartitionGroup);\n\t\t\t//System.out.println(\"Number of merged partitions:\"+mergedCandidatePartitions.size());\n\t\t\t\n\t\t\t// Layout Generation\n\t\t\tgenerateLayout(mergedCandidatePartitions, primaryPartitionGroup);\n\t\t\tbestLayouts.add(bestLayout);\t\t\t\n\t\t\t//ArrayUtils.printArray(bestLayout, \"Layout:\"+(++i), null, null);\n\t\t}\n\t\t\n\t\t// Combine sub-Layouts\n\t\tList<int[][]> mergedBestLayouts = mergeAcrossLayouts(bestLayouts, bestLayouts.size());\n\t\tpartitioning = PartitioningUtils.getPartitioning(mergedBestLayouts);\n\t}", "public int calculateMinimumHP(ArrayList<ArrayList<Integer>> grid) {\n\t\t\t\t int m =grid.size(), n = grid.get(0).size();\n\t\t\t\t int[][][] dp = new int[m+1][n+1][2];\n\t\t\t\t \n\t\t\t\t dp[0][0][0] = 0;\n\t\t\t\t dp[0][0][1] = 0;\n\t\t\t\t dp[0][1][0] = 1; // start with life\n\t\t\t\t dp[0][1][1] = 0; // balance life\n\t\t\t\t dp[1][0][0] = 1;\n\t\t\t\t dp[1][0][1] = 0;\n\t\t\t\t for(int i=2;i<dp[0].length;i++){\n\t\t\t\t\t dp[0][i][0] = Integer.MAX_VALUE;\n\t\t\t\t\t dp[0][i][1] = 0;\n\t\t\t\t }\n\t\t\t\t for(int i=2;i<dp.length;i++){\n\t\t\t\t\t dp[i][0][0] = Integer.MAX_VALUE;\n\t\t\t\t\t dp[i][0][1] = 0;\n\t\t\t\t }\n\t\t\t\t \n\t\t\t\t for(int i=1;i<dp.length;i++){\n\t\t\t\t\t for(int j=1;j<dp[0].length;j++){\n\t\t\t\t\t\t \n\t\t\t\t\t\t if(grid.get(i-1).get(j-1) < 0){\n\t\t\t\t\t\t\t int[] fromCell = dp[i-1][j][0]< dp[i][j-1][0]?dp[i-1][j]:dp[i][j-1];\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t dp[i][j][0] = fromCell[0] - grid.get(i-1).get(j-1) - fromCell[1];\n\t\t\t\t\t\t\t dp[i][j][1] = fromCell[1]+ grid.get(i-1).get(j-1)>0?fromCell[1]+ grid.get(i-1).get(j-1):0;\n\t\t\t\t\t\t }else{\n\t\t\t\t\t\t\t int[] fromCell = dp[i-1][j][0]< dp[i][j-1][0]?dp[i-1][j]:dp[i][j-1];\n\t\t\t\t\t\t\t dp[i][j][0] = fromCell[0];\n\t\t\t\t\t\t\t dp[i][j][1] = fromCell[1]+grid.get(i-1).get(j-1);\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\t return dp[m][n][0];\n\t\t\t\t \n\t\t\t }", "private static void setTooNear(int[][] mainArray, int firstTask, int secondTask, ArrayList<String> tooNearArray, int[] forcedList) {\r\n\t\t\r\n\t for (int count = 0 ; count < 8; count++) {\r\n\t \t\tif(forcedList[count] == firstTask) {\r\n\t \t\t\tif (count == 7) { //if machine 8, forbidden next is machine 1.\r\n\t \t\t\t\tif (isForced(count,firstTask,forcedList)) {\r\n\t \t\t\t\t\tif (isForced(count+1, secondTask, forcedList)) {\r\n\t \t\t\t\t\t\tOutputWriter.writeFile(forcedList, 0, \"No valid solution possible!\");\r\n\t \t\t\t\t\t\tSystem.exit(0);\r\n\t \t\t\t\t\t}\r\n\t \t\t\t\t\telse {\tmainArray[0][secondTask] = -1;\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\tif (isForced(count,firstTask, forcedList)) {\r\n\t \t\t\t\t\tif (isForced(count+1, secondTask, forcedList)) {\r\n\t \t\t\t\t\t\tOutputWriter.writeFile(forcedList, 0, \"No valid solution possible!\");\r\n\t \t\t\t\t\t\tSystem.exit(0);\r\n\t \t\t\t\t\t}\r\n\t \t\t\t\t\telse {\tmainArray[count+1][secondTask] = -1;\r\n\t \t\t\t\t\t}\r\n\t \t\t\t\t}\t\t\r\n\t \t\t\t}\r\n\r\n\t \t\t}\r\n\t }\r\n\t}", "private int find_bestSplit(KnowledgeBase kb, int attIndex, ArrayList<ArrayList<ArrayList<Integer>>> multiple_counters) {\r\n\t\tif(multiple_counters.size() >0){\r\n\t\t\tfloat best_Gini = calculImpurity2D(kb.getSamples().size(),multiple_counters.get(0));; // it's a minimum!!\r\n\t\t\tint index_Best_Gini =0;\r\n\t\t\tfloat tmp_gini;\r\n\t\t\tfor(int i=1;i<multiple_counters.size();i++){\r\n\t\t\t\ttmp_gini = calculImpurity2D(kb.getSamples().size(),multiple_counters.get(i));\r\n\t\t\t\tif(tmp_gini<best_Gini){\r\n\t\t\t\t\tbest_Gini = tmp_gini;\r\n\t\t\t\t\tindex_Best_Gini = i;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn index_Best_Gini;\r\n\t\t}\r\n\t\treturn 0;\r\n\t\t\r\n\t\t\r\n\t}", "private void coins_a2W(){\n\t\tthis.cube[4] = this.cube[17]; \n\t\tthis.cube[17] = this.cube[20];\n\t\tthis.cube[20] = this.cube[36];\n\t\tthis.cube[36] = this.cube[33];\n\t\tthis.cube[33] = this.cube[4];\n\t}", "private void setupStuff() {\n\t\tm_seenNumbers = new double[featureArray.length][];\n\t\tm_Weights = new double[featureArray.length][];\n\t\tm_NumValues = new int[featureArray.length];\n\t\tm_SumOfWeights = new double[featureArray.length];\n\t\tfeatureTotals = new int[featureArray.length];\n\n\t\tfor (int i = 0; i < featureArray.length; i++) {\n\t\t\tm_NumValues[i] = 0;\n\t\t\tm_seenNumbers[i] = new double[100];\n\t\t\tm_Weights[i] = new double[100];\n\t\t}\n\n\t\t/*\n\t\t * initialize structures for probabilities of each class and of each\n\t\t * feature\n\t\t */\n\t\tclassCounts = new double[MLearner.NUMBER_CLASSES];\n\t\tprobs = new HashMap[MLearner.NUMBER_CLASSES][featureArray.length];\n\t\tRealprobs = new HashMap[MLearner.NUMBER_CLASSES][featureArray.length];\n\t\tfor (int i = 0; i < MLearner.NUMBER_CLASSES; i++) {\n\t\t\tfor (int j = 0; j < featureArray.length; j++) {\n\t\t\t\tif (featureArray[j]) {//only create if we are using that\n\t\t\t\t\t// feature\n\t\t\t\t\tprobs[i][j] = new HashMap();\n\t\t\t\t\tif (EmailInternalConfigurationWindow.isFeatureDiscrete(j)) {\n\t\t\t\t\t\tprobs[i][j].put(\"_default\", new Double(0));\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tclassCounts[i] = 0;\n\t\t}\n\n\t}", "public static int ruolette(ArrayList<Integer> fitvalores, ArrayList<int[]> poblacion, int semilla){ \n int totalfitnes = 0;\n int totalfitnesnuevo = 0;\n int indtablero = 0;\n int semi=semilla;\n int tpoblacion=poblacion.size();\n int []nuevofitness = new int [fitvalores.size()];\n double []nproporcion = new double [fitvalores.size()];\n ArrayList <Double> proporcion = new ArrayList<>();//proporcion j la ruleta\n ArrayList <Double> ruleta = new ArrayList<>();\n //obtener el max fitnes\n for(int i=0;i<fitvalores.size();i++){ //total de fitnes\n totalfitnes=totalfitnes+fitvalores.get(i);\n }\n \n for(int i=0;i<fitvalores.size();i++){ //poner datos en el nuevo fittnes inverso\n double pro=(tpoblacion*tpoblacion-tpoblacion)-fitvalores.get(i);\n nuevofitness[i]= (int) pro;\n // System.out.println(\"nuevo fitnes\"+nuevofitness[i]);\n } \n for(int i=0;i<fitvalores.size();i++){ //total de fitnes nuevo o inverso\n totalfitnesnuevo=(totalfitnesnuevo+nuevofitness[i]);//para que los mejores casos usen mas espacio\n }\n \n for(int i=0;i<fitvalores.size();i++){ //poner datos en el array proporcion\n double var1=nuevofitness[i];\n double var2=totalfitnesnuevo;\n double pro=var1/var2;\n nproporcion[i]=pro;\n //System.out.println(\"nueva proporcion \"+nproporcion[i]);\n } \n ruleta.add(nproporcion[0]);\n // System.out.println(\"primera propporniaso \"+nproporcion[0]);\n for(int i=1;i<fitvalores.size();i++){ //poner datos en la ruleta\n double var1=ruleta.get(i-1);\n double var2=nproporcion[i];\n ruleta.add(var1+var2);\n //System.out.println(\"ruleta \"+ruleta.get(i));\n }\n double num=randomadec(0,1,semi);\n // System.out.println(\"numero random dec \"+num); \n for(int i=0;i<fitvalores.size();i++){ //poner datos en el array proporcion\n // System.out.println(ruleta.get(i));\n if(num<ruleta.get(i)){\n indtablero=i;\n //System.out.println(\"se guardo el tablero \"+indtablero);\n break;\n }\n }\n return indtablero;//esto devuelve el indice del tablero ganador en la ruleta\n }", "public static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\n\t\tint a[] = {2,1,3,-4,-2};\n\t\t//int a[] = {1 ,2, 3, 7, 5};\n\t\tboolean found = false;\n\t\t\n\t\t//this will solve in o n^2\n\t\tfor(int i = 0 ; i < a.length ; i++){\n\t\t\tint sum = 0;\n\t\t\tfor(int j = i ; j< a.length ; j++){\n\t\t\t\tsum += a[j] ;\n\t\t\t\tif(sum == 0){\n\t\t\t\t\tfound = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\tif(found)\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\t\n\t\t// link : https://www.youtube.com/watch?v=PSpuM9cimxA&list=PLKKfKV1b9e8ps6dD3QA5KFfHdiWj9cB1s&index=49\n\t\tSystem.out.println(found + \" found\");\n\t\tfound = false;\n\t\t//solving with O of N with the help sets\n\t\t// x + 0 = y\n\t\tSet<Integer> set = new HashSet<>();\n\t\tint sum = 0;\n\t\tfor(int element : a){\n\t\t\tset.add(sum);\n\t\t\tsum += element;\n\t\t\tif(set.contains(sum)){\n\t\t\t\tfound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println();\n\t\tSystem.out.println(set);\n\t\t\n\t\tSystem.out.println(found + \" found\");\n\t\t\n\t\t\n\t\tfound = false;\n\t\t// when the sum of subarray is K\n\t\t\n\t\t//solving with O of N with the help sets\n\t\t//x + k = y >>>\n\t\tSet<Integer> set1 = new HashSet<>();\n\t\tint k = 12;\n\t\tint summ = 0;\n\t\tfor(int element : a){\n\t\t\tset1.add(summ);\n\t\t\tsumm += element;\n\t\t\tif(set1.contains(summ - k)){ // y - k = x(alredy presnt or not)\n\t\t\t\tfound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(set1);\n\t\tSystem.out.println();\n\t\tSystem.out.println(found + \" found\");\n\t\t\n\t\t\n\t}", "public static void main(String[] args) throws Exception {\r\n Scanner input = new Scanner(System.in);\r\n int n;\r\n // System.out.println(\"Enter the number of element\");\r\n n = input.nextInt();\r\n // System.out.println(\"here is n\"+n);\r\n int arr[] = new int[n];\r\n // System.out.println(\"Enter the element of the array\");\r\n for (int i = 0; i < n; i++) {\r\n arr[i] = input.nextInt();\r\n }\r\n int sol_arr_1[][] = new int[n][n], sol_arr_2[][] = new int[n][n];\r\n \r\n //*****intialization*****//\r\n for(int i=0;i<n;i++)\r\n {\r\n for(int j=0;j<n;j++)\r\n {\r\n sol_arr_1[i][j]=0;\r\n sol_arr_2[i][j]=0;\r\n }\r\n }\r\n //*****end*****//\r\n \r\n \r\n \r\n \r\n \r\n int k_for_j = 1;\r\n int i = 0, j = 1;\r\n for (int q = 0; q < n - 1; q++) {\r\n // System.out.println(\"q=\"+q);\r\n j = k_for_j;\r\n i=0;\r\n if (q == 0) {\r\n while (j < n) {\r\n sol_arr_1[i][j] = (arr[i] + arr[j]) % 100;\r\n sol_arr_2[i][j] = (arr[i] * arr[j]);\r\n i++;\r\n j++;\r\n }\r\n }\r\n else\r\n {\r\n while(j<n)\r\n {\r\n int color1,smog1;\r\n color1=(arr[j]+sol_arr_1[i][j-1])%100;\r\n smog1=sol_arr_2[i][j-1]+(arr[j]*sol_arr_1[i][j-1]);\r\n int color2,smog2;\r\n color2 =(sol_arr_1[i+1][j]+arr[j-2])%100;\r\n smog2=(sol_arr_1[i+1][j]*arr[j-2])+sol_arr_2[i+1][j];\r\n if(smog1>smog2)\r\n {\r\n sol_arr_1[i][j]=color2;\r\n sol_arr_2[i][j]=smog2;\r\n }\r\n else\r\n {\r\n sol_arr_1[i][j]=color1;\r\n sol_arr_2[i][j]=smog1;\r\n }\r\n i++;\r\n j++;\r\n }\r\n }\r\n k_for_j++;\r\n }\r\n System.out.println(sol_arr_2[0][n-1]);\r\n }", "public void testTwoWayDistribution() {\n for(int p = 0; p < 20; p++) {\n int[] landings = new int[2];\n for(long in = 0; in < 100000; in++) {\n long longHash = FPGenerator.std64.fp(p+\"a\"+in);\n// long longHash = rand.nextLong();\n// long longHash = ArchiveUtils.doubleMurmur((p+\":\"+in).getBytes());\n landings[conhash.bucketFor(longHash, 2)]++;\n }\n// System.out.println(landings[0]+\",\"+landings[1]);\n assertTrue(\"excessive changes\",Math.abs(landings[0]-landings[1]) < 2000); \n }\n }", "static long[] q3PolyMul(int maxDistanceLeft, ThreadVariables t){\n\n //precomputation is as simple as running distTo cutoff 1 with bases less than the multiplcity, and it is equivalent by wilf inversion\n\n long[] all = allWaysCache(123);\n long[] currentContains = new long[maxDistanceLeft + 1];\n System.arraycopy(all,0,currentContains,0,maxDistanceLeft + 1);\n Polynomial[] shifts = generateShiftsPolyMethod(maxDistanceLeft, t);\n //Polynomial[] correctShifts = generateShiftsHardcoded(maxDistanceLeft, t);\n //Polynomial[] shifts = correctShifts;\n for (int i = 1; i < 8; i++){\n //System.out.println(correctShifts[i]);\n System.out.println(shifts[i]);\n }\n //I think indexes could be designed so 7-index is index in other array due to symmetry of complements\n\n\n subtract(currentContains, shifts[1].productWith(allWaysCache(23), maxDistanceLeft));\n subtract(currentContains, shifts[2].productWith(allWaysCache(13), maxDistanceLeft));\n subtract(currentContains, shifts[3].productWith(allWaysCache(12), maxDistanceLeft));\n //System.out.print(\"Poly: Values after first removal: \");\n //printArray(currentContains);\n\n //it might be possible to modify these to avoid doing the last exclusion\n\n add(currentContains, shifts[4].trivialProductWith(3, maxDistanceLeft));\n add(currentContains, shifts[5].trivialProductWith(2, maxDistanceLeft));\n add(currentContains, shifts[6].trivialProductWith(1, maxDistanceLeft));\n //System.out.print(\"Poly: Values after second removal: \");\n //printArray(currentContains);\n subtract(currentContains, shifts[7].getFullArray(maxDistanceLeft));\n //System.out.println(shifts[7]);\n //System.out.print(\"Poly: final values: \");\n //printArray(currentContains);\n return currentContains;\n }", "public static void main(String[] args){\n int MIN = Integer.parseInt(args[0]);\n MAX = Integer.parseInt(args[1]);\n cutoffs = new int[args.length - 2];\n cache = new ArrayList<IndexedArrayList<SuperSavvyTrieHelper2>>();\n for (int i = 2; i < args.length; i++){\n cutoffs[i - 2] = Integer.parseInt(args[i]);\n cache.add(new IndexedArrayList<SuperSavvyTrieHelper2>());\n }\n for (int i = 0; i < cutoffs.length / 2; i++){\n int temp = cutoffs[i];\n cutoffs[i] = cutoffs[cutoffs.length - 1 - i];\n cutoffs[cutoffs.length - 1 - i] = temp;\n }\n multiplicitiesUsed = new boolean[MAX + 1];\n basesUsed = new DoublyLinkedArray(MAX + 1);\n SuperSavvyTrieHelper2.setCorrespondance(basesUsed);\n /*\n long count1 = lowerRecursion(MAX, 0);\n long count2 = middleRecursion(MAX, 0);\n long count3 = upperRecursion(MAX, 0);\n long total = count1 + count2 + count3;\n System.out.printf(\"%d + %d + %d = %d\\n\", count1, count2, count3, total);\n */\n hitCounts = new long[cutoffs.length];\n missCounts = new long[cutoffs.length];\n statCollector = new StatCollector(cutoffs);\n\n long startTime = System.nanoTime();\n long[] values = new long[MAX - MIN + 1];\n for (int i = MIN; i <= MAX; i++) {\n values[i - MIN] = upperRecursionWrapper(i);\n }\n //long[] testValues = new long[] {1752443,1911046, 2067456,2249444,2429337, 2647532,2852449,3101167,3350292,3632299,3916575};\n for (int i = 0; i < values.length; i++){\n //if (testValues[i] != values[i]){\n System.out.printf(\"%d: %d\\n\", i + MIN, values[i]);\n //}\n }\n long endTime = System.nanoTime();\n System.out.printf(\"%f,\", (double)(endTime - startTime) / 1000000000.0);\n long totalMissCounts = 0;\n long totalMissWeight1 = 0;\n long totalMissWeight2 = 0;\n long totalMissWeight3 = 0;\n /*\n for (int i = 0; i < cutoffs.length; i++){\n long totalCounts = hitCounts[i] + missCounts[i];\n totalMissCounts += missCounts[i];\n totalMissWeight1 += missCounts[i] * cutoffs[i];\n totalMissWeight2 += (hitCounts[i] / missCounts[i]) * cutoffs[i];\n totalMissWeight3 += (hitCounts[i] - missCounts[i]) * cutoffs[i] * cutoffs[i];\n System.out.printf(\"\\tCache %d: %d/%d/%d (%.5f%%)\", cutoffs[i], hitCounts[i], missCounts[i], totalCounts, (double) hitCounts[i] / totalCounts);\n }\n System.out.printf(\"\\t\\tMissCounts: %d, weighted: %d, ratio: %d, diff^2: %d\\n\", totalMissCounts, totalMissWeight1, totalMissWeight2, totalMissWeight3);\n */\n statCollector.printAll();\n }", "public static void main(String[] args) throws IOException {\n int max = 100000;\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n N = Integer.parseInt(br.readLine());\n\n int arr[] = new int[max+1];\n\n for (int p=2; p<=99999; p++)\n {\n if (arr[p] == 0)\n { arr[p] = 1;\n for (int i=p*2; i<=max; i += p) {\n arr[i]++;\n }\n }\n }\n\n int mat[][] = new int[6][max+1];\n// for (int i = 2; i < arr.length; i++) {\n// mat[arr[i]][i] = 1;\n// }\n\n for (int i = 1; i < 6; i++) {\n for (int j = 2; j < mat[0].length; j++) {\n if(arr[j] == i) {\n mat[i][j] = mat[i][j - 1]+1;\n } else {\n mat[i][j] = mat[i][j - 1];\n }\n }\n }\n\n\n for (int i = 0; i < N; i++) {\n String str[] = br.readLine().split(\" \");\n int a = Integer.parseInt(str[0]);\n int b = Integer.parseInt(str[1]);\n int k = Integer.parseInt(str[2]);\n int ans = mat[k][b]-mat[k][a-1];\n System.out.println(ans);\n }\n }", "private static Population getBestPossibleParettoOfAGS(){\n int numberOfRounds = 10;\n Population allFrontsMembers = new Population();\n\n NSGAII nsgaii = new NSGAII();\n SPEA2 spea2 = new SPEA2();\n AEMMT aemmt = new AEMMT();\n AEMMD aemmd = new AEMMD();\n MOEAD moead = new MOEAD();\n\n ProblemKnapsackFromFile problem = new ProblemKnapsackFromFile(macPathGetProblemFrom);\n progressBar = new ProgressBar((double) numberOfRounds);\n\n for (int i = 0; i < numberOfRounds; i++) {\n\n Parameters.NUMBER_OF_GENERATIONS = problem.items.size() < 100? 100 : 200;\n\n System.out.println(\"NSGAII\");\n nsgaii.runAlgorithm(problem);\n allFrontsMembers.population.addAll(nsgaii.paretto.membersAtThisFront);\n\n System.out.println(\"SPEA2\");\n spea2.runAlgorithm(problem);\n allFrontsMembers.population.addAll(spea2.paretto.membersAtThisFront);\n\n //moead.runAlgorithm(problem);\n //allFrontsMembers.population.addAll( moead.pareto.membersAtThisFront);\n\n Parameters.NUMBER_OF_GENERATIONS = 15000;\n System.out.println(\"AEMMT\");\n aemmt.runAlgorithm(problem);\n allFrontsMembers.population.addAll(aemmt.paretto.membersAtThisFront);\n\n System.out.println(\"AEMMD\");\n aemmd.runAlgorithm(problem);\n allFrontsMembers.population.addAll(aemmd.paretto.membersAtThisFront);\n\n progressBar.addJobDone();\n\n allFrontsMembers.fastNonDominatedSort();\n Problem.removeSimilar(allFrontsMembers.fronts.allFronts.get(0),problem);\n allFrontsMembers.population = allFrontsMembers.fronts.allFronts.get(0).membersAtThisFront;\n }\n\n problem.printResolutionMessage();\n //Printer.printBinaryMembers(allFrontsMembers);\n System.out.println(\"ALL FRONTS SIZE: \"+allFrontsMembers.population.size());\n\n return allFrontsMembers;\n }", "public static void ComputeTables() {\n int[][] nbl2bit\n = {\n new int[]{1, 0, 0, 0}, new int[]{1, 0, 0, 1}, new int[]{1, 0, 1, 0}, new int[]{1, 0, 1, 1},\n new int[]{1, 1, 0, 0}, new int[]{1, 1, 0, 1}, new int[]{1, 1, 1, 0}, new int[]{1, 1, 1, 1},\n new int[]{-1, 0, 0, 0}, new int[]{-1, 0, 0, 1}, new int[]{-1, 0, 1, 0}, new int[]{-1, 0, 1, 1},\n new int[]{-1, 1, 0, 0}, new int[]{-1, 1, 0, 1}, new int[]{-1, 1, 1, 0}, new int[]{-1, 1, 1, 1}\n };\n\n int step, nib;\n\n /* loop over all possible steps */\n for (step = 0; step <= 48; step++) {\n /* compute the step value */\n int stepval = (int) (Math.floor(16.0 * Math.pow(11.0 / 10.0, (double) step)));\n\n\n /* loop over all nibbles and compute the difference */\n for (nib = 0; nib < 16; nib++) {\n diff_lookup[step * 16 + nib] = nbl2bit[nib][0]\n * (stepval * nbl2bit[nib][1]\n + stepval / 2 * nbl2bit[nib][2]\n + stepval / 4 * nbl2bit[nib][3]\n + stepval / 8);\n }\n }\n }", "public void readSet() throws IOException {\n temps = new HashSet<String>();\n readDescription();\n // adds the words in the temporary set to the temp array\n for (String w : temps) {\n if (w.equals(\"dana\")) {\n System.out.println(w + \" was called +1\");\n }\n int v = d.getValue(w);\n arr[v]++;\n if (w.equals(\"subj\")) {\n System.out.println(w + \" was called +1\");\n System.out.println(arr[v] + \" is the number of the array of \" + w);\n }\n }\n temps = new HashSet<String>();\n readDescription();\n // does the same thing above, except since this is the second\n // description, subtract 1 from array\n for (String w : temps) {\n int v = d.getValue(w);\n arr[v]--;\n if (w.equals(\"subj\")) {\n System.out.println(w + \" was called -1\");\n System.out.println(arr[v] + \" is the number of the array of \" + w);\n }\n }\n // get the prices\n int p1 = getPrice();\n int p2 = getPrice();\n // get the answer value\n // a should be the correct answer\n // b should be the answer they choose\n int a = getAnswer();\n int b = getAnswer();\n // System.out.println(\"The correct answer is: \" + a +\n // \" The chosen answer is: \" + b);\n int y_real;\n DecimalFormat numberFormat = new DecimalFormat(\"#.####\");\n double real_ratio;\n double mturk_ratio;\n if (p1 > p2) {\n y_real = p1 - p2;\n real_ratio = (double) p1 / p2;\n } else {\n y_real = p2 - p1;\n real_ratio = (double) p2 / p1;\n }\n int pdiff;\n if (a == b) {\n pdiff = y_real;\n mturk_ratio = real_ratio;\n } else {\n pdiff = -y_real;\n mturk_ratio = 1 / real_ratio;\n }\n if (p2 > p1) {\n for (int i = 0; i < arr.length; i++) {\n arr[i] = -arr[i];\n }\n }\n w.write(pdiff + \" \");\n w.write(numberFormat.format(real_ratio) + \" \");\n w.write(numberFormat.format(mturk_ratio) + \" \");\n for (int i = 0; i < size; i++) {\n if (i != arr.length - 1) {\n w.write(arr[i] + \" \");\n } else {\n w.write(arr[i]);\n }\n }\n w.write(\"\\n\");\n arr = new int[size];\n }", "public static void main(String[] args) {\n int[] array1 = {50, 39, 21, 88, 17};\n int max = 0;\n for (int value : array1) {\n if (value > max)\n max = value;\n }\n System.out.print(\"Maximum value in the array is \" + max);\n System.out.println();\n\n // Separate zeros from non-zeros in an array\n int[] array2 = {50, 0, 39, 21, 0, 0, 88, 17};\n int index = 0;\n for (int i=0; i<array2.length; i++) {\n if (array2[i] != 0){\n array2[index] = array2[i];\n index++;\n }\n }\n while ( index < array2.length ) {\n array2[index] = 0;\n index++;\n }\n System.out.println( Arrays.toString(array2) );\n\n // Find intersection of two arrays in java\n int[] x = {50, 39, 21, 88, 17};\n int[] y = {21, 13, 63, 17, 46};\n\n HashSet<Integer> xSet = new HashSet<>();\n for (int value : x) xSet.add(value);\n\n System.out.print(\"Intersection of two arrays: \");\n for (int value : y) {\n if (xSet.contains(value))\n System.out.print(value + \" \");\n }\n System.out.println();\n\n // Find continuous sub array whose sum is equal to given number\n int[] array3 = {42, 15, 12, 8, 6, 32};\n int given = 26;\n int sum;\n\n System.out.print(\"Continuous sub array whose sum is \" + given + \": \");\n for ( int i = 0; i<array3.length; i++ ) {\n sum = array3[i];\n for (int j = i+1; j < array3.length; j++) {\n sum = sum + array3[j];\n if (sum == given){\n for (int k = i; k <= j; k++)\n System.out.print(array3[k]+\" \");\n System.out.println();\n }\n else if (sum > given)\n break;\n }\n }\n\n }", "static long arrayManipulation(int n, int[][] queries) {\r\n long result = 0, sum = 0;\r\n long[] arr = new long[n];\r\n for(int i = 0; i < queries.length; i++){\r\n int firstIndex = queries[i][0] - 1;\r\n int lastIndex = queries[i][1] - 1;\r\n long numberToAdd = queries[i][2];\r\n arr[firstIndex] += numberToAdd;\r\n if (lastIndex+1 < n)\r\n arr[lastIndex+1] -= numberToAdd;\r\n }\r\n\r\n for(long l : arr){\r\n sum += l;\r\n if(sum > result)\r\n result = sum;\r\n }\r\n\r\n return result;\r\n }", "static void hashTestCase(int givArr[]) {\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tint mod = givArr[i] % m;\n\t\t\tarray[mod] = givArr[i];\n\t\t}\n\t}", "public static void main(String[] args) {\n\t\tScanner scan=new Scanner(System.in);\n\t\tint N=scan.nextInt();\n\t\tint a=scan.nextInt();\n\t\tint b=scan.nextInt();\n\t\tint[] nums=new int[N];\n\t\tint[][] weight=new int[N][N];\n\t\tfor(int i=0;i<N;i++){\n\t\t\tnums[i]=scan.nextInt();\n\t\t\tweight[i][i]=nums[i];\n\t\t}\n\t\tfor(int i=0;i<N;i++){\n\t\t\tfor(int j=i+1;j<N;j++){\n\t\t\t\tweight[i][j]=weight[i][j-1]+nums[j];\n\t\t\t}\n\t\t}\n\t\tlong[][] dp=new long[N][N];\n\t\tfor(int i=2;i<=N;i++){//dis\n\t\t\tfor(int j=0;j<=N-i;j++){//start\n\t\t\t\tint end=j+i-1;\n\t\t\t\tlong min=Integer.MAX_VALUE;\n\t\t\t\tfor(int k=j;k<end;k++){\n\t\t\t\t\tmin=Math.min(min, dp[j][k]+dp[k+1][end]+weight[j][k]*a+weight[k+1][end]*b);\n\t\t\t\t}\n\t\t\t\tdp[j][end]=min;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(dp[0][N-1]);\n\t\tscan.close();\n\t}", "public static void main(String[] args) {\n\t\t\r\n\t\t\r\n\t\tArrayOfFraction arr1= new ArrayOfFraction();\r\n\t\tarr1.add(new Fraction(3,1));\r\n\t\tarr1.add(new Fraction(4,2));\r\n\t\tarr1.add(new Fraction(5,3));\r\n\t\tarr1.add(new Fraction(6,7));\r\n\t\t\r\n\t\tfor(int i=0;i<arr1.size();i++)\r\n\t\t{\r\n\t\t\tSystem.out.println(arr1.a[i].divide());\r\n\t\t}\r\n//\t\tFraction fr1 = new Fraction();\r\n//\t\tfr1.input();\r\n//\t\tarr1.add(fr1);\r\n//\t\t\r\n//\t\tFraction fr2 = new Fraction();\r\n//\t\tfr2.input();\r\n//\t\tarr1.add(fr2);\r\n//\t\t\r\n//\t\tFraction fr3 = new Fraction();\r\n//\t\tfr3.input();\r\n//\t\tarr1.add(fr3);\r\n//\t\t\r\n//\t\tarr1.output();\r\n\t\t\r\n//\t\tSystem.out.println(\"get ra gia tri index: \"+arr1.get(0));\r\n\r\n//\t\tFraction fr4 = new Fraction();\r\n//\t\tfr4.input();\r\n//\t\tarr1.set(2,fr4 );\r\n//\t\tarr1.output();\r\n//\t\t\r\n//\t\t\r\n//\t\tFraction fr5 = new Fraction();\r\n//\t\tfr5.input();\r\n//\t\tarr1.add(1, fr5);\r\n//\t\tarr1.output();\r\n\t\t\r\n//\t\tarr1.remove(2);\r\n//\t\tarr1.output();\r\n\t\t\r\n//\t\tFraction fr6 = new Fraction();\r\n//\t\tfr6.input();\r\n//\t\tSystem.out.println(arr1.indexOf(fr6));\r\n\t\t\r\n//\t\tFraction fr7 = new Fraction();\r\n//\t\tfr7.input();\r\n//\t\tSystem.out.println(arr1.indexOf(r7));\r\n\t\t\r\n\t\t\r\n//\t\tSystem.out.println(arr1.toString());\r\n\t\t\r\n\t}", "private void genProb() {\n\t\tint row;\n\t\tint column;\n\t\tint removed1;\n\t\tint removed2;\n\n\t\tfor (int i = 0; i < DIFFICULTY / 2;) {\n\t\t\trow = rand.nextInt(9);\n\t\t\tcolumn = rand.nextInt(9);\n\t\t\twhile (problem[row][column] == 0 || (row == 4 && column == 4)) {\n\t\t\t\trow = rand.nextInt(9);\n\t\t\t\tcolumn = rand.nextInt(9);\n\t\t\t}\n\n\t\t\t// Clearing random boxes.\n\t\t\tremoved1 = problem[row][column];\n\t\t\tremoved2 = problem[8 - row][8 - column];\n\t\t\tproblem[row][column] = 0;\n\t\t\tproblem[8 - row][8 - column] = 0;\n\n\t\t\tcopy(problem, comp);\n\n\t\t\tif (!solve(0, 0, 0, comp)) { // Case of unsolvable.\n\t\t\t\t// Putting back original values.\n\t\t\t\tproblem[row][column] = removed1;\n\t\t\t\tproblem[8 - row][8 - column] = removed2;\n\t\t\t} else {\n\t\t\t\tif (unique()) { // Case of solution is unique.\n\t\t\t\t\ti++;\n\t\t\t\t} else { // Case of solution is not unique.\n\t\t\t\t\t// Putting back original values.\n\t\t\t\t\tproblem[row][column] = removed1;\n\t\t\t\t\tproblem[8 - row][8 - column] = removed2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public static void main(String[] args) {\n\t\tArrayList<Integer> primelist = sieve(7071);\n\t\tArrayList<Double> second = new ArrayList<Double>();\n\t\tfor(int one : primelist) \n\t\t\tsecond.add(Math.pow(one, 2));\n\t\tArrayList<Double> third = new ArrayList<Double>();\n\t\tprimelist = sieve(368);\n\t\tfor(int one : primelist)\n\t\t\tthird.add(Math.pow(one, 3));\n\t\tArrayList<Double> fourth = new ArrayList<Double>();\n\t\tprimelist = sieve(84);\n\t\tfor(int one : primelist)\n\t\t\tfourth.add(Math.pow(one, 4));\n\n\t\tArrayList<Double> possibilities = new ArrayList<Double>();\n\t\tfor (int k = fourth.size() - 1; k >=0 ; k--) {\n\t\t\tfor (int j = 0; j < third.size(); j++) {\n\t\t\t\tdouble sum = fourth.get(k) + third.get(j);\n\t\t\t\tif (sum > 50000000)\n\t\t\t\t\tbreak;\n\t\t\t\telse {\n\t\t\t\t\tfor (int i = 0; i < second.size(); i++) {\n\t\t\t\t\t\tdouble nextsum = sum + second.get(i);\n\t\t\t\t\t\tif (nextsum > 50000000)\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t// I am not sure whether it can be proved that the sum is unique.\n\t\t\t\t\t\t\tif (!possibilities.contains(nextsum))\n\t\t\t\t\t\t\t\tpossibilities.add(nextsum);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint totalcount = possibilities.size();\n\t\tSystem.out.println(totalcount);\n\t}", "public void calculateEffectiveness(){\n double[] typeEffective = new double[18];\n \n for(int i = 0; i < 18; i++){\n typeEffective[i] = tc.getEffectiveNumber(i, tc.convertType(type1));\n }\n \n if(type2 != null){\n for(int i = 0; i < 18; i++){\n typeEffective[i] *= tc.getEffectiveNumber(i, tc.convertType(type2));\n }\n }\n \n for(int i = 0; i < 18; i++){\n if(typeEffective[i] != 1){\n if(typeEffective[i] > 1){\n double[] newWeak = {i,typeEffective[i]};\n weak.add(newWeak);\n }else{\n double[] newStrong = {i,typeEffective[i]};\n strong.add(newStrong);\n }\n }\n }\n }", "@Test\n public void testFactor_intArr_intArr() {\n System.out.println(\"factor\");\n int[] number = new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};\n int[] weighting = new int[]{2, 1, 2, 1, 2, 1, 2, 1, 2};\n AbstractMethod instance = new AbstractMethodImpl();\n int[] expResult = new int[]{0, 1, 4, 3, 8, 5, 12, 7, 16, 9};\n int[] result = instance.factor(number, weighting);\n assertArrayEquals(expResult, result);\n\n }", "private static void find_coins(int[] d, int k, int n) {\n\t\t\n\t}", "public static void main(String[] args) \n {\n int[] array1 = new int[10]; // create the array object/declare variable array and initialize it with an array object\n System.out.printf(\"%s%8s%n\", \"Index1\", \"Value\"); // column headings\n //output each array element's value\n for (int counter = 0; counter < array1.length; counter++)\n System.out.printf(\"%5d%8d%n\", counter, array1[counter]);\n \n //fig 7.3: Initializing the elements of an array with an array initializer\n int[] array2 = { 32, 27, 64, 18, 95, 14, 90, 70, 60, 37 };// initializer list specifies the initial value for each element\n System.out.printf(\"%s%8s%n\", \"Index2\", \"Value\"); // column headings\n // output each array element's value\n for (int counter = 0; counter < array2.length; counter++)\n System.out.printf(\"%5d%8d%n\", counter, array2[counter]);\n \n //fig 7.4: Calculating the values to be placed into the elements of an array. \n final int ARRAY_LENGTH = 10;// declare constant\n int[] array3 = new int[ARRAY_LENGTH]; // create array \n // calculate value for each array element\n for (int counter = 0; counter < array3.length; counter++)\n array3[counter] = 2 + 2 * counter;\n System.out.printf(\"%s%8s%n\", \"Index3\", \"Value\"); // column headings \n // output each array element's value\n for (int counter = 0; counter < array3.length; counter++)\n System.out.printf(\"%5d%8d%n\", counter, array3[counter]);\n }" ]
[ "0.5661348", "0.55741626", "0.5551597", "0.55431396", "0.55388886", "0.553581", "0.5500462", "0.5494798", "0.54739", "0.5432241", "0.5417037", "0.53727186", "0.53550833", "0.53529763", "0.5311245", "0.52881646", "0.52619565", "0.5260917", "0.5254436", "0.52511024", "0.5244527", "0.52437174", "0.5242457", "0.5217711", "0.5212873", "0.51961637", "0.51792264", "0.5177254", "0.5176823", "0.51712716", "0.5164753", "0.51572835", "0.514308", "0.51293373", "0.5125508", "0.5118507", "0.5109598", "0.51070064", "0.5093574", "0.50897753", "0.50846785", "0.5084131", "0.5083072", "0.5080775", "0.50805783", "0.50744516", "0.50734895", "0.50692755", "0.50683767", "0.50639415", "0.5060889", "0.5060427", "0.50581497", "0.50556", "0.5051615", "0.5048557", "0.50463885", "0.504507", "0.5044551", "0.50404334", "0.5039978", "0.5038317", "0.5026038", "0.50254637", "0.5025342", "0.50236183", "0.50212604", "0.5018753", "0.50178885", "0.5015065", "0.5011741", "0.5011493", "0.5009919", "0.50097656", "0.5003648", "0.5001959", "0.49960414", "0.499426", "0.49937922", "0.49935728", "0.49921975", "0.49909917", "0.49894848", "0.49846682", "0.4983365", "0.49821046", "0.49801543", "0.49793172", "0.49782088", "0.49725902", "0.49723402", "0.4971883", "0.49694797", "0.49694663", "0.4968446", "0.49636364", "0.4962779", "0.4962444", "0.4956971", "0.49508545" ]
0.5275454
16
Gets jaxb context data.
@Test void getJaxbContextData(SoftAssertions softly) { ComparatorJaxbContextDataProvider target = new ComparatorJaxbContextDataProvider(); Collection<JaxbContextData> actual = target.getJaxbContextData(); softly.assertThat(actual) .containsExactly(new JaxbContextData(ObjectFactory.class.getPackage())); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private JAXBContext getJaxContext()\n {\n JAXBContext jc = null;\n \n try\n {\n jc = JAXBContext.newInstance(\"generated\");\n }\n catch (JAXBException e)\n {\n e.printStackTrace();\n }\n return jc;\n }", "public Object getPayload(JAXBContext context);", "com.google.protobuf.ByteString\n getContextBytes();", "Map<String, Object> getContext();", "public final Object getContextInfo() {\n return this.info;\n }", "public com.google.protobuf.ByteString getContext() {\n return context_;\n }", "public com.google.protobuf.ByteString getContext() {\n return context_;\n }", "public String getContext() { return context; }", "public String getContext() {\n return context;\n }", "public String getContext() {\n return context;\n }", "public String getContext() {\n return context;\n }", "com.google.protobuf.ByteString getContext();", "public static Context getContext(){\n return appContext;\n }", "public Object getContextObject() {\n return context;\n }", "public String getContext() {\n\t\treturn context;\n\t}", "public String getContext() {\r\n\t\treturn context;\r\n\t}", "public org.apache.axis2.context.xsd.ServiceContext getServiceContext(){\n return localServiceContext;\n }", "public Context getContext() {\n return context;\n }", "@Override\r\n\tpublic Context getContext() {\r\n\t\treturn this.context;\r\n\t}", "public org.apache.axis2.context.xsd.ConfigurationContext getConfigurationContext(){\n return localConfigurationContext;\n }", "public static JAXBContext getJAXBContext() throws JAXBException {\n synchronized (ContextUtils.class) {\n if (jaxbContext == null) {\n jaxbContext =\n JAXBContext.newInstance(\n WSA_OBJECT_FACTORY.getClass().getPackage().getName(),\n WSA_OBJECT_FACTORY.getClass().getClassLoader());\n }\n }\n return jaxbContext;\n }", "public Context getContext() {\n\t\treturn context;\n\t}", "public Context getContext() {\r\n\t\treturn context;\r\n\t}", "@JsonProperty(\"context\")\n public Context getContext() {\n return context;\n }", "Context getContext();", "public static BundleContext getContext() {\n return context;\n }", "public org.apache.axis2.context.xsd.ConfigurationContext getRootContext(){\n return localRootContext;\n }", "public static Context getContext() {\n\t\treturn context;\n\t}", "public static Context getContext() {\n\t\treturn context;\n\t}", "public Map<String, Object> context() {\n return unmodifiableMap(context);\n }", "protected RestContext getContext() {\n\t\tif (context.get() == null)\n\t\t\tthrow new InternalServerError(\"RestContext object not set on resource.\");\n\t\treturn context.get();\n\t}", "ContextBucket getContext() {\n\treturn context;\n }", "public Map<String, Object> clientContext() {\n return clientContext;\n }", "@Override\n public Context getContext() {\n return this.getApplicationContext();\n }", "@java.lang.Override public int getContextValue() {\n return context_;\n }", "@java.lang.Override public int getContextValue() {\n return context_;\n }", "public Context getContext() {\n return this.mService.mContext;\n }", "public com.google.protobuf.ByteString\n getContextBytes() {\n java.lang.Object ref = context_;\n if (ref instanceof String) {\n com.google.protobuf.ByteString b = \n com.google.protobuf.ByteString.copyFromUtf8(\n (java.lang.String) ref);\n context_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "public ContextRequest getContext() {\n\t\treturn context;\n\t}", "public com.google.protobuf.ByteString\n getContextBytes() {\n java.lang.Object ref = context_;\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 context_ = b;\n return b;\n } else {\n return (com.google.protobuf.ByteString) ref;\n }\n }", "String getContextPath() {\n return contextPath;\n }", "Context getContext() {\n Context context = mContextRef.get();\n return context != null ? context : AppUtil.getAppContext();\n }", "public ConfigContext getConfigContext() {\n\n return (ConfigContext)getSource();\n\n }", "public static String getTestdataContext() {\r\n if (testdataContext == null) {\r\n testdataContext = PropertiesProvider.getInstance().getProperty(\"testdata.context\", \"/testdata\");\r\n }\r\n return testdataContext;\r\n }", "public Attributes getContextAttributes() {\r\n return this.atts;\r\n }", "public java.lang.String getContext() {\n java.lang.Object ref = context_;\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 context_ = s;\n return s;\n }\n }", "public static BundleContext getBundleContext()\r\n {\r\n return bundleContext;\r\n }", "protected static JAXBContext getJaxbContext(Class<?> clazz) {\n\t\tJAXBContext jaxbContext = jaxbContexts.get(clazz);\n\t\tif (jaxbContext == null) {\n\t\t\ttry {\n\t\t\t\tjaxbContext = JAXBContext.newInstance(clazz, CollectionWrapper.class);\n\t\t\t\tjaxbContexts.putIfAbsent(clazz, jaxbContext);\n\t\t\t} catch (JAXBException ex) {\n\t\t\t\tthrow new SystemException(ex, \"不能为类 [{0}]创建JAXBContext: {1}\", clazz, ex.getMessage());\n\t\t\t}\n\t\t}\n\t\treturn jaxbContext;\n\t}", "public static Context getResourceContext() {\n return context;\n }", "ApplicationContext getAppCtx();", "public PortletContext getPortletContext ()\n {\n \treturn config.getPortletContext();\n }", "java.lang.String getContext();", "public java.lang.String getContext() {\n java.lang.Object ref = context_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n context_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public IRuntimeContext getContext() {\n return fContext;\n }", "public Context getContext() {\n\t\treturn null;\n\t}", "public static Context getContext() {\n if (sContext == null) {\n throw new RuntimeException(APPLICATION_CONTEXT_IS_NULL);\n }\n return sContext;\n }", "public ComponentContext getContext()\n\t{\n\t\treturn context;\n\t}", "Context context();", "Context context();", "public String getContextProperty() {\n return _contextProperty;\n }", "protected abstract JAXBContext getJAXBContext(Class[] classes, ClassLoaderResolver clr) throws JAXBException;", "public cl_context getContext() {\r\n return context;\r\n }", "public Object getConnectionContext() {\n return connectionContext;\n }", "public Context getContext() {\n return this.mContext;\n }", "public Context getContext() {\n return this.mContext;\n }", "public Context getContext() {\n\t\treturn ctx;\n\t}", "public IContextInformation getContextInformation()\n {\n return null;\n }", "private Context getContext() {\n return mContext;\n }", "private Context getContext() {\n return mContext;\n }", "@Override\n\tpublic String getContextPath() {\n\t\treturn contextPath;\n\t}", "public static Map<String, Object> getJsonldContext() {\n if (jsonldContext == null) {\n jsonldContext = new HashMap<String, Object>();\n Map<String, String> map = get().getNsPrefixMap();\n for (Map.Entry<String, String> entry : map.entrySet()) {\n jsonldContext.put(entry.getKey(), entry.getValue());\n }\n }\n return jsonldContext;\n }", "public String getContext() {\n\t\treturn this.getClass().getSimpleName();\n\t}", "public String getContextString();", "public NamespaceContext getNamespaceContext() {\n LOGGER.entering(JsonXmlStreamReader.class.getName(), \"getNamespaceContext\");\n NamespaceContext result = new JsonNamespaceContext();\n LOGGER.exiting(JsonXmlStreamReader.class.getName(), \"getNamespaceContext\", result);\n return result;\n }", "public ContextNode getContextNode();", "public Context getContext() {\n return mContext;\n }", "public ActionBeanContext getContext() {\r\n return context;\r\n }", "public Context getContext() {\n\t\treturn mContext;\n\t}", "public ServletContext getContext() {\r\n\t\treturn new ContextWrapper(getEvent().getServletContext());\r\n\t}", "public UserContext getUserContext();", "protected AbstractApplicationContext getServicesContext() {\r\n\t\treturn this.servicesContext;\r\n\t}", "public static Context getAppContext() {\n return _BaseApplication.context;\n }", "public Context getContext() {\n return contextMain;\n }", "public org.omg.CORBA.Context read_Context() {\n throw new org.omg.CORBA.NO_IMPLEMENT();\n }", "public String getOperationContext() {\n return this.operationContext;\n }", "public String getOperationContext() {\n return this.operationContext;\n }", "public static Context getContext() {\n\t\treturn instance;\n\t}", "@Override\r\n\tpublic Context getContext() {\n\t\treturn null;\r\n\t}", "public Context getContext() {\n return this;\n }", "CTX_Context getContext();", "public ModuleContext getContext() {\r\n return context;\r\n }", "public UsersResourceContext getContext() {\n return _context;\n }", "@Override\r\n\tpublic Context getContext()\r\n\t{\n\t\treturn this.getActivity().getApplicationContext();\r\n\t}", "public BackingMapManagerContext getContext();", "public Context getApplicationContext();", "private Context getApplicationContext() {\n\t\treturn this.cordova.getActivity().getApplicationContext();\n\t}", "private Context getApplicationContext() {\n\t\treturn this.cordova.getActivity().getApplicationContext();\n\t}", "private static synchronized JAXBContext context(Class<? extends Object> clazz) throws JAXBException {\r\n\t\tif(jaxbContext == null){\r\n\t\t\tjaxbContext = JAXBContext.newInstance(new Class[]{clazz});\r\n\t\t\tclasses.add(clazz);\r\n\t\t}\r\n\t\telse if(!classes.contains(clazz)){\r\n\t\t\ttry{\r\n\t\t\t\tclasses.add(clazz);\r\n\t\t\t\tjaxbContext = JAXBContext.newInstance(classes.toArray(new Class[classes.size()]));\r\n\t\t\t}\r\n\t\t\tcatch(JAXBException e){\r\n\t\t\t\tclasses.remove(clazz);\r\n\t\t\t\tthrow e;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn jaxbContext;\r\n\t}", "public static ApplicationContext getApplicationContext() {\n return appContext;\n }", "private Context getThreadContext() throws NamingException {\n final ThreadContext threadContext = ThreadContext.getThreadContext();\n if (skipEjbContext(threadContext)) {\n return ContextBindings.getClassLoader();\n }\n final Context context = threadContext.getBeanContext().getJndiEnc();\n return context;\n }" ]
[ "0.6841471", "0.664883", "0.6500057", "0.6495569", "0.629308", "0.6238154", "0.62332904", "0.6204135", "0.61953574", "0.61953574", "0.61953574", "0.61879784", "0.6119424", "0.611207", "0.6103814", "0.6098982", "0.6069671", "0.60670257", "0.60236675", "0.60156196", "0.5991049", "0.59689707", "0.5967854", "0.5952034", "0.59445834", "0.5944032", "0.59336615", "0.5926761", "0.5926761", "0.588842", "0.5847091", "0.5837154", "0.58234054", "0.5819379", "0.5809338", "0.57750595", "0.57594216", "0.57451475", "0.57415414", "0.5725264", "0.57061213", "0.57058054", "0.5695599", "0.56629837", "0.5660658", "0.5642409", "0.56393653", "0.56298196", "0.56138104", "0.5599594", "0.558859", "0.55755347", "0.557199", "0.55664074", "0.5565519", "0.5545166", "0.5520894", "0.55173653", "0.55173653", "0.5515966", "0.5503507", "0.54963386", "0.54779655", "0.5448752", "0.5448752", "0.54460746", "0.544565", "0.54347783", "0.54347783", "0.5433211", "0.5412489", "0.5395388", "0.5383475", "0.5368761", "0.53604406", "0.53446317", "0.53414935", "0.53378", "0.53286827", "0.53263116", "0.53257537", "0.5319118", "0.5313854", "0.5311458", "0.5310907", "0.5310907", "0.53068227", "0.53009224", "0.5298678", "0.5291281", "0.52852136", "0.52796423", "0.52774966", "0.52718836", "0.5266752", "0.5262696", "0.5262696", "0.52588403", "0.5245831", "0.5244035" ]
0.53532803
75
old data include method below, there is comment
public void scandb_book_info(String table_name) { sql = " SELECT * from " + table_name + ";"; try { result = statement.executeQuery(sql); while (result.next()) { set_book_info(result.getInt("id"), result.getString("name"), result.getString("url")); } } catch (SQLException e) { e.printStackTrace(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected void loadData()\n {\n }", "public void setIncludes(String includes)\n {\n this.includes = includes;\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "protected abstract void loadData();", "private void parseData() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void crawl_data() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void updateData() {\n\t\t\r\n\t}", "private void addSampleData() {\r\n }", "public abstract void loadData();", "public abstract void loadData();", "@Override\n\tpublic void queryData() {\n\t\t\n\t}", "private static void includeExtract(IASTPreprocessorIncludeStatement include) {\n\t\tvxlFragment.append(VxlManager.includeDirective(StringProcessor.processString(include.getName().toString())));\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}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void getData() {\n\t\t\n\t}", "void loadData();", "void loadData();", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "public void Data(){\n\t\t\t\t\t\t\n\t\t\t\t\t}", "private static void parseInclude(Document doc) throws XPathExpressionException, IOException, SAXException {\n NodeList nodeList = (NodeList) XPATH_SERVER_INCLUDE.evaluate(doc, XPathConstants.NODESET);\n\n for (int i = 0; i < nodeList.getLength(); i++) {\n String nodeValue = nodeList.item(i).getAttributes().getNamedItem(\"location\").getNodeValue();\n\n if (!nodeValue.isEmpty()) {\n Document docIncl = getIncludeDoc(nodeValue);\n\n if (docIncl != null) {\n parseApplication(docIncl, XPATH_SERVER_APPLICATION);\n parseApplication(docIncl, XPATH_SERVER_WEB_APPLICATION);\n parseApplication(docIncl, XPATH_SERVER_ENTERPRISE_APPLICATION);\n // handle nested include elements\n parseInclude(docIncl);\n }\n }\n }\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "void include(Set<S> segments);", "void addingGlobalData() {\n\n }", "private ProcessedDynamicData( ) {\r\n super();\r\n }", "private void Initialized_Data() {\n\t\t\r\n\t}", "void addData();", "private RowData() {\n initFields();\n }", "@Override\n\tprotected void getDataFromUCF() {\n\n\t}", "@Override\r\n\tprotected void load() {\n\t\t\r\n\t}", "public void setIncluded(boolean included);", "public String[] getIncludes()\n {\n return m_includes;\n }", "@Override\n\tprotected void getDataRefresh() {\n\t\t\n\t}", "public Agg include(Object value) {\n attrList.put(\"include\", value);\n return this;\n }", "@Override\n protected void initData() {\n }", "@Override\n protected void initData() {\n }", "protected abstract void retrievedata();", "@Override\n\t\tvoid loadData() throws IOException {\n\t\t\tsuper.loadData();\n\t\t}", "private void loadData(){\n\t\t \n\t\t model.getDataVector().clear();\n\t\t ArrayList<Person> personList = DataBase.getInstance().getPersonList();\n\t\t for(Person person : personList){\n\t\t\t addRow(person.toBasicInfoStringArray());\n\t\t }\n\t\t \n\t }", "@Override\n\tprotected void load() {\n\n\t}", "@Override\n\tprotected void load() {\n\n\t}", "@Override\n\tprotected void load() {\n\t\t\n\t}", "@Override\n\tprotected void load() {\n\t\t\n\t}", "@Override\n\tprotected void load() {\n\t\t\n\t}", "@Override\n\tprotected void initData(){\n\t\tsuper.initData();\n\t}", "protected MergeSpellingData()\r\n\t{\r\n\t}", "void populateData();", "@Override\n\tvoid putData() {\n\t\tSystem.out.println(\"Brand : \"+brand);\n\t\tSystem.out.println(\"Model : \"+model);\n\t\tSystem.out.println(\"Year of manufacture : \"+year_of_manufacture);\n\t\tSystem.out.println(\"CC : \"+cc);\n\t}", "public boolean isIncludeMetaData() {\n\t\treturn includeMetaData;\n\t}", "public abstract boolean promulgationDataDefined();", "private void handleInclude() {\n definedGrammar.include(getGrammar(getAbsPath()));\n }", "@Override\r\n protected void fetchData() {\n\r\n }", "private void addData() {\n Details d1 = new Details(\"Arpitha\", \"+91-9448907664\", \"25/05/1997\");\n Details d2 = new Details(\"Abhijith\", \"+91-993602342\", \"05/10/1992\");\n details.add(d1);\n details.add(d2);\n }", "@Parameters()\n\tpublic static Collection<Object[]> data() {\n\t\treturn Arrays.asList(new Object[][] { { Oldfile_empty, Newfile }, { Oldfile, Newfile_empty },\n\t\t\t\t{ Oldfile_empty, Newfile_empty } });\n\t}", "@Override\n public RavenJObject getAdditionalData() {\n return additionalData;\n }", "protected boolean isIncluded(String name) {\r\n return (this.includeRE == null) ? true : this.includeRE.match(name);\r\n }", "private void InitData() {\n\t}", "public static void populateData() {\n\n }", "public boolean isIncludeMetaData() {\n\t\t\treturn includeMetaData;\n\t\t}", "public void setIncludes( List<IncludeClasses> includes )\n {\n this.includes = includes;\n }", "public boolean getIncluded();", "public boolean isData() {return true; }", "@Test\n public void fieldInclude() throws Exception {\n Document doc = new Document();\n DocumentBuilder builder = new DocumentBuilder(doc);\n\n // We can use an INCLUDE field to import a portion of another document in the local file system.\n // The bookmark from the other document that we reference with this field contains this imported portion.\n FieldInclude field = (FieldInclude) builder.insertField(FieldType.FIELD_INCLUDE, true);\n field.setSourceFullName(getMyDir() + \"Bookmarks.docx\");\n field.setBookmarkName(\"MyBookmark1\");\n field.setLockFields(false);\n field.setTextConverter(\"Microsoft Word\");\n\n Assert.assertTrue(field.getFieldCode().matches(\" INCLUDE .* MyBookmark1 \\\\\\\\c \\\"Microsoft Word\\\"\"));\n\n doc.updateFields();\n doc.save(getArtifactsDir() + \"Field.INCLUDE.docx\");\n //ExEnd\n\n doc = new Document(getArtifactsDir() + \"Field.INCLUDE.docx\");\n field = (FieldInclude) doc.getRange().getFields().get(0);\n\n Assert.assertEquals(FieldType.FIELD_INCLUDE, field.getType());\n Assert.assertEquals(\"First bookmark.\", field.getResult());\n Assert.assertTrue(field.getFieldCode().matches(\" INCLUDE .* MyBookmark1 \\\\\\\\c \\\"Microsoft Word\\\"\"));\n\n Assert.assertEquals(getMyDir() + \"Bookmarks.docx\", field.getSourceFullName());\n Assert.assertEquals(\"MyBookmark1\", field.getBookmarkName());\n Assert.assertFalse(field.getLockFields());\n Assert.assertEquals(\"Microsoft Word\", field.getTextConverter());\n }", "public interface loadDataService {\n public List<Row> getComboContent( String sType,String comboType, Map<String,String[]> parameterMap , usersInfo loggedUser) throws Exception;\n public Result getGridContent(PagingObject po, String gridType,Map<String,String[]> parameterMap,String searchText , usersInfo loggedUser,String statusID,String from,String where ) throws Exception;\n public List<listInfo> loadStrukturList(String partID,long langID) throws Exception;\n public finalInfo getOrgInfo(long treeID) throws Exception;\n public categoryFinalInfo getCategoryInfo(long treeID) throws Exception;\n public carriersInfo getCariesInfo(long carryID) throws Exception;\n public carriersInfo getOrganizationInfo(long carryID) throws Exception;\n public List<contact> getOrgContacts(long treeID) throws Exception;\n public person getEmployeeInfo( long empId) throws Exception;\n public List<examples> getExamplesInfo(long exmpID,String langID) throws Exception;\n public List<contact> getPersonContact(long perID) throws Exception;\n public List<docList> loadQRphoto(Connection con, long exmplID,long picType) throws Exception;\n public List<docList> loadPhoto(Connection con, long exmplID,long picType) throws Exception;\n public List<docList> getExamplesPictures(Connection cc, long relID, long relType) throws Exception;\n public List<examples> getExamplesOperation(Connection cc, long relID, long langID) throws Exception;\n public int checkUser(String uName) throws Exception;\n public int checkDictRecord(String text, int dictType,String org,String pos) throws Exception ;\n public usersInfo loadUserInfo(String pID) throws Exception;\n public List<person> loadEmpList( int OrgID) throws Exception;\n public List<Row> getSelectContent( String type, Map<String, String[]> parameterMap , usersInfo loggedUser) throws Exception;\n public List<subjElement> getADVSearchMenuList(String partID) throws Exception;\n public String getADVInfo(String paramID,String paramVal,String val,String cond,String typ)throws Exception;\n public List<listInfo> loadComboForAdvancedSearch(String prmID,long parametr) throws Exception;\n public List<docList> loadRightPanelPhoto(long realID, int iType) throws Exception;\n public List<categoryFinalInfo> getCategoryStructure(long catID, int id) throws Exception;\n}", "private void include(\r\n @CheckForNull String parent, int line,\r\n @Nonnull String name, boolean quoted, boolean next)\r\n throws IOException,\r\n LexerException {\r\n if (name.startsWith(\"/\")) {\r\n VirtualFile file = filesystem.getFile(name);\r\n if (include(file))\r\n return;\r\n StringBuilder buf = new StringBuilder();\r\n buf.append(\"File not found: \").append(name);\r\n error(line, 0, buf.toString());\r\n return;\r\n }\r\n\r\n VirtualFile pdir = null;\r\n if (quoted) {\r\n if (parent != null) {\r\n VirtualFile pfile = filesystem.getFile(parent);\r\n pdir = pfile.getParentFile();\r\n }\r\n if (pdir != null) {\r\n VirtualFile ifile = pdir.getChildFile(name);\r\n if (include(ifile))\r\n return;\r\n }\r\n if (include(quoteincludepath, name))\r\n return;\r\n } else {\r\n int idx = name.indexOf('/');\r\n if (idx != -1) {\r\n String frameworkName = name.substring(0, idx);\r\n String headerName = name.substring(idx + 1);\r\n String headerPath = frameworkName + \".framework/Headers/\" + headerName;\r\n if (include(frameworkspath, headerPath))\r\n return;\r\n }\r\n }\r\n\r\n if (include(sysincludepath, name))\r\n return;\r\n\r\n StringBuilder buf = new StringBuilder();\r\n buf.append(\"File not found: \").append(name);\r\n buf.append(\" in\");\r\n if (quoted) {\r\n buf.append(\" .\").append('(').append(pdir).append(')');\r\n for (String dir : quoteincludepath)\r\n buf.append(\" \").append(dir);\r\n }\r\n for (String dir : sysincludepath)\r\n buf.append(\" \").append(dir);\r\n error(line, 0, buf.toString());\r\n }", "@Override\n public void DataIsInserted() {\n }", "private XIncluder() {}", "boolean hasData2();", "boolean hasData2();", "final void getData() {\n\t\t//The final method can't be overriden\n\t}", "private void addDataForListView() {\n \t\n \tif(loadable)\n \t{\t\n \tloadable = false;\n \tdirection = BACKWARD;\n \tstrUrl = Url.composeHotPageUrl(type_id, class_id, last_id);\n \trequestData();\n \t}\n\t}", "public void updateData() {}", "protected void initDataFields() {\r\n //this module doesn't require any data fields\r\n }", "private void verificaData() {\n\t\t\n\t}", "public boolean isIncluded(IResource included) {\n ensureInitialized();\n String mapKey = getMapKey(included);\n List<String> result = mIncludedBy.get(mapKey);\n if (result == null) {\n String name = getResourceName(included);\n if (!name.equals(mapKey)) {\n result = mIncludedBy.get(name);\n }\n }\n\n return result != null && result.size() > 0;\n }", "public AddData() {\n\t\tsuper();\n\t\tfilled = false;\n\t}", "private void setIncludedBy(String includer, List<String> included) {\n for (String target : included) {\n List<String> list = mIncludedBy.get(target);\n if (list == null) {\n list = new ArrayList<String>(2); // We don't expect many includes\n mIncludedBy.put(target, list);\n }\n if (!list.contains(includer)) {\n list.add(includer);\n }\n }\n }", "@Override\n public void load() {\n }", "@Override\n\tpublic void initData() {\n\n\n\n\t}", "@VisibleForTesting\n /* package */ void setIncluded(String includer, List<String> included, boolean detectCycles) {\n // Remove previously linked inverse mappings\n List<String> oldIncludes = mIncludes.get(includer);\n if (oldIncludes != null && oldIncludes.size() > 0) {\n for (String includee : oldIncludes) {\n List<String> includers = mIncludedBy.get(includee);\n if (includers != null) {\n includers.remove(includer);\n }\n }\n }\n\n mIncludes.put(includer, included);\n // Reverse mapping: for included items, point back to including file\n setIncludedBy(includer, included);\n\n if (detectCycles) {\n detectCycles(includer);\n }\n }", "@Override\n\tpublic void processData() {\n\t\t\n\t}", "@java.lang.Override\n public boolean hasData() {\n return data_ != null;\n }", "private boolean importSolrConfigData() {\n\t\treturn importData(\"/solr/solr.impex\");\n\t}", "private boolean includePrimaryKeyColumns() {\n\t\treturn false;\r\n\t}", "private boolean addData(HeaderEntry he, DataRecord dr) {\n if (getSizeLeft() > (4 + dr.getData().length)) {\n\n //write the header\n byte[] headerEntry = he.getHeader();\n\n serialize[headerPointer] = headerEntry[0];\n serialize[headerPointer + 1] = headerEntry[1];\n serialize[headerPointer + 2] = headerEntry[2];\n serialize[headerPointer + 3] = headerEntry[3];\n\n headerPointer += 4;\n \n //write the datas\n byte[] dataRecord = dr.getData();\n\n int sum = 0;\n for (int i = dataRecord.length - 1; i >= 0; i--) {\n serialize[datasPointer - sum] = dataRecord[i];\n sum++;\n }\n\n datasPointer -= sum;\n return true;\n }\n return false;\n }", "abstract void initializeNeededData();", "private void loadData()\r\n\t{\r\n\t\taddProduct(\"Area\", \"Education\");\r\n\t\taddProduct(\"Area\", \"Environment\");\r\n\t\taddProduct(\"Area\", \"Health\");\r\n\r\n\t\taddProduct(\"Domain\", \"Documentation\");\r\n\t\taddProduct(\"Domain\", \"Project Activity\");\r\n\t\taddProduct(\"Domain\", \"Technology\");\r\n\r\n\t\taddProduct(\"City\", \"Bangalore\");\r\n\t\taddProduct(\"City\", \"Hyderabad\");\r\n\t\taddProduct(\"City\", \"Lucknow\");\r\n\r\n\t\taddProduct(\"Activity_Type\", \"Onsite\");\r\n\t\taddProduct(\"Activity_Type\", \"Offsite\");\r\n\r\n\t}", "@Override\r\n\tprotected void initSelfData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initSelfData() {\n\t\t\r\n\t}", "public TransferAllDetails include() {\n return this.include;\n }", "@java.lang.Override\n public boolean hasData() {\n return data_ != null;\n }", "@Override\r\n public void dataAdded(DataSet data) {\n rebuildColumns();\r\n }", "@Override\n public boolean addDataSourceInfo(DataSource ds) {\n return false;\n }", "@Override\r\n\t\tpublic BatchArgumentBuilder addData(Document data) {\n\t\t\tthrow new UnsupportedOperationException(\"Not implemented yet.\");\r\n\t\t}" ]
[ "0.6139704", "0.570362", "0.56979764", "0.56438124", "0.54716027", "0.5469597", "0.5439888", "0.54363495", "0.5430885", "0.5430885", "0.54282075", "0.5379788", "0.532639", "0.53243023", "0.53243023", "0.53243023", "0.53243023", "0.53243023", "0.53243023", "0.53006124", "0.526728", "0.5261604", "0.5261604", "0.5259672", "0.52490807", "0.52490807", "0.5246264", "0.52361035", "0.5232745", "0.52069265", "0.52036077", "0.5199397", "0.5195691", "0.51909983", "0.5185827", "0.51837415", "0.517547", "0.51457727", "0.51389736", "0.51355964", "0.51326025", "0.51318467", "0.51318467", "0.5130048", "0.5118303", "0.511448", "0.51135784", "0.51135784", "0.51009536", "0.51009536", "0.51009536", "0.5099717", "0.5095692", "0.5094492", "0.50819975", "0.5080738", "0.50796103", "0.5077596", "0.50652534", "0.50638247", "0.5061386", "0.50546366", "0.5052656", "0.50458854", "0.5044398", "0.50391954", "0.50318885", "0.5028146", "0.50278866", "0.50194436", "0.50084937", "0.49962768", "0.49949387", "0.4990025", "0.49856523", "0.49856523", "0.49847266", "0.49774522", "0.49755433", "0.49676347", "0.4964477", "0.4962617", "0.49563965", "0.49530107", "0.49530065", "0.4951887", "0.4943538", "0.4939647", "0.49363184", "0.49265403", "0.49238637", "0.49232993", "0.4911226", "0.49081802", "0.48965758", "0.48965758", "0.48944494", "0.4893584", "0.4892326", "0.48900658", "0.48836106" ]
0.0
-1
constructor init the Buttons of the StartMenu
@Override public final void initButtons(int x, int y, int addy){ String data = s_datapath; addButton(data + "SM_NeuesSpiel" + s_typ, x, y, 1); addButton(data + "OM_SpielSpeichern" + s_typ, x, y + addy, 2); addButton(data + "SM_SpielLaden" + s_typ, x, y + addy * 2, 3); //addButton(data,x, y + addy*3, 4); addButton(data + "Menu_Element_Blank" + s_typ, x,/*715*/ y + addy * 4, 5); addButton(data + "SM_SpielBeenden" + s_typ, x,/*845*/ y + addy * 5, 6); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void initMenu() {\n\t\t\r\n\t\treturnToGame = new JButton(\"Return to Game\");\r\n\t\treturnToGame.setBounds(900, 900, 0, 0);\r\n\t\treturnToGame.setBackground(Color.BLACK);\r\n\t\treturnToGame.setForeground(Color.WHITE);\r\n\t\treturnToGame.setVisible(false);\r\n\t\treturnToGame.addActionListener(this);\r\n\t\t\r\n\t\treturnToStart = new JButton(\"Main Menu\");\r\n\t\treturnToStart.setBounds(900, 900, 0, 0);\r\n\t\treturnToStart.setBackground(Color.BLACK);\r\n\t\treturnToStart.setForeground(Color.WHITE);\r\n\t\treturnToStart.setVisible(false);\r\n\t\treturnToStart.addActionListener(this);\r\n\t\t\r\n\t\t//add(menubackground);\r\n\t\tadd(returnToGame);\r\n\t\tadd(returnToStart);\r\n\t}", "public StartMenu(){\n\t\tmenu.setTitle(\"COP4331 Spring '14 - Battle Ship!\");\n\t\t\n\t\t//startGame JButton will begin a new game\n\t\tstartEasyGame = new JButton(\"Start Easy Game\");\n\t\tstartEasyGame.addActionListener(new ActionListener(){\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\t\tsetSkill(0);\n\t\t\t\tplay = true;\n\t\t\t}\n\t\t});\n\t\t\n\t\tstartAdvancedGame = new JButton(\"Start Advanced Game\");\n\t\tstartAdvancedGame.addActionListener(new ActionListener(){\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\t\tsetSkill(1);\n\t\t\t\tplay = true;\n\t\t\t}\n\t\t});\n\t\t\n\t\t\t\n\t\t//exitGame JButton will end the program\n\t\texitGame = new JButton(\"Exit Game\");\n\t\texitGame.addActionListener(new ActionListener(){\n\t\t\tpublic void actionPerformed(ActionEvent arg0){\n\t\t\t\tclose = true;\n\t\t\t}\n\t\t});\n\t\t\n\t\tmenu.add(startEasyGame);\n\t\tmenu.add(startAdvancedGame);\n\t\tmenu.add(exitGame);\t\t\n\t}", "public Menu getStartMenu() {\n Menu menu = new Menu(new Point(475, 0), 672-475, 320, 8, 1, new Cursor(new Point(0, 7)), \"exit\");\n Button PokedexButton = new Button(new Point(475, 0), 672-475, 40, \"Pokédex\", new Point(0, 7), \"Pokédex\");\n Button PokemonButton = new Button(new Point(475, 40), 672-475, 40, \"Pokémon\", new Point(0, 6), \"Pokémon\");\n Button BagButton = new Button(new Point(475, 80), 672-475, 40, \"Bag\", new Point(0, 5), \"Bag\");\n Button PokenavButton = new Button(new Point(475, 120), 672-475, 40, \"Pokénav\", new Point(0, 4), \"Pokénav\");\n Button PlayerButton = new Button(new Point(475, 160), 672-475, 40, trainer.getName(), new Point(0, 3), trainer.getName());\n Button SaveButton = new Button(new Point(475, 200), 672-475, 40, \"save\", new Point(0, 2), \"Save\");\n Button OptionButton = new Button(new Point(475, 240), 672-475, 40, \"add_menu_other\", new Point(0, 1), \"Options\");\n Button ExitButton = new Button(new Point(475, 280), 672-475, 40, \"exit\", new Point(0, 0), \"exit\");\n menu.addButton(PokedexButton);\n menu.addButton(PokemonButton);\n menu.addButton(BagButton);\n menu.addButton(PokenavButton);\n menu.addButton(PlayerButton);\n menu.addButton(SaveButton);\n menu.addButton(OptionButton);\n menu.addButton(ExitButton);\n menu.getButton(menu.getCursor().getPos()).Highlight();\n return menu;\n }", "public startingMenu() {\r\n initComponents();\r\n }", "public MainMenuScreen(MainController controller) {\n this.controller = controller;\n startButton = new Button(\"start_button\", new SpriteBatch());\n optionsButton = new Button(\"options_button\", new SpriteBatch());\n topButton = new Button(\"top_button\", new SpriteBatch());\n exitButton = new Button(\"exit_button\", new SpriteBatch());\n }", "public void addMenuItems()\n\t{\n\t\tstartButton = new JButton(\"Start\");\n\t\tstartButton.setLayout(null);\n\t\tstartButton.setBounds(350, 225, 100, 50);\n\t\t\n\t\toptionsButton = new JButton(\"Options\");\n\t\toptionsButton.setLayout(null);\n\t\toptionsButton.setBounds(350, 275, 100, 50);\n\t\t\n\t\texitButton = new JButton(\"Exit\");\n\t\texitButton.setLayout(null);\n\t\texitButton.setBounds(350, 375, 100, 50);\n\t\texitButton.setActionCommand(\"exit\");\n\t\texitButton.addActionListener((ActionListener) this);\n\t\t\n\t\tmainMenuPanel.add(startButton);\n\t\tmainMenuPanel.add(optionsButton);\n\t\tmainMenuPanel.add(startButton);\n\t}", "private void initMenu() {\n\t\tloadImage();\r\n\t\t// Add listeners to buttons\r\n\t\tstartGame.addActionListener(new StartGameListener());\r\n\t\texitGame.addActionListener(new ExitGameListener());\r\n\t\t// Setting buttons in the middle of the screen\r\n\t\tsetLayout(new GridBagLayout());\r\n\t\tGridBagConstraints gbc = new GridBagConstraints();\r\n\t\tgbc.gridx = 0;\r\n\t\tgbc.gridy = 0;\r\n\t\tadd(startGame, gbc);\r\n\r\n\t\tgbc.gridx = 0;\r\n\t\tgbc.gridy = 1;\r\n\t\t// Resize \"exitGame\" button to \"startGame\" button size\r\n\t\texitGame.setPreferredSize(startGame.getPreferredSize());\r\n\t\t// Set insets between two buttons in 100 px\r\n\t\tgbc.insets = new Insets(100, 0, 0, 0);\r\n\t\tadd(exitGame, gbc);\r\n\t}", "private void initButtons() {\r\n\t\texitGameButton\t\t= game.screenHelper.createTextButton(BUTTON_EXIT_GAME_TEXT, BUTTON_EXIT_GAME_MOUSEOVER_TEXT, menuText);\r\n\t\tcancelExitButton\t= game.screenHelper.createTextButton(BUTTON_CANCEL_EXIT_TEXT, BUTTON_CANCEL_EXIT_MOUSEOVER_TEXT, menuText);\r\n\t\tcancelExitButton.addListener(new ChangeScreenInputListener(new MenuScreenChangeCommand()));\r\n\t\t// Event Listeners \r\n\t\t// TODO: clean up this giant piece of shitty code.\r\n\t\t\r\n\t\texitGameButton.addListener(new InputListener() {\r\n\t\t\tpublic boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {\r\n\t\t\t\texitGame();\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t});\r\n\t}", "public void init() {\r\n\r\n add(btnUn);\r\n add(btnDeux);\r\n add(btnTrois);\r\n add(btnQuatre);\r\n add(btnCinq);\r\n\r\n btnUn.setBounds(120, 120, 100, 75);\r\n btnDeux.setBounds(120, 310, 100, 75);\r\n btnDeux.setTransferHandler(new TransferHandler(\"icon\"));\r\n btnTrois.setBounds(360, 310, 100, 75);\r\n btnQuatre.setBounds(160, 600, 100, 75);\r\n btnQuatre.setTransferHandler(new TransferHandler(\"icon\"));\r\n btnCinq.setBounds(360, 600, 100, 75);\r\n\r\n }", "public void initializeMenuItems() {\n\t\tuserMenuButton = new MenuButton();\n\t\tmenu1 = new MenuItem(bundle.getString(\"mVmenu1\")); //\n\t\tmenu2 = new MenuItem(bundle.getString(\"mVmenu2\")); //\n\t}", "private void init(){\r\n\t\tImageIcon newTaskImg = new ImageIcon(\"resources/images/New.png\");\r\n\t\tImageIcon pauseImg = new ImageIcon(\"resources/images/Pause.png\");\r\n\t\tImageIcon resumeImg = new ImageIcon (\"resources/images/Begin.png\");\r\n\t\tImageIcon stopImg = new ImageIcon(\"resources/images/Stop.png\");\r\n\t\tImageIcon removeImg = new ImageIcon(\"resources/images/Remove.gif\");\r\n\t\tImageIcon shareImg = new ImageIcon(\"resources/images/Share.png\");\r\n\t\tImageIcon inboxImg = new ImageIcon(\"resources/images/Inbox.png\");\r\n\t\t\r\n\t\tnewTask = new JButton(newTaskImg);\r\n\t\tnewTask.setToolTipText(\"New Task\");\r\n\t\tpause = new JButton (pauseImg);\r\n\t\tpause.setToolTipText(\"Pause\");\r\n\t\trestart = new JButton (resumeImg);\r\n\t\trestart.setToolTipText(\"Restart\");\r\n\t\tstop = new JButton(stopImg);\r\n\t\tstop.setToolTipText(\"Stop\");\r\n\t\tremove = new JButton(removeImg);\r\n\t\tremove.setToolTipText(\"Remove\");\r\n\t\tshare = new JButton(shareImg);\r\n\t\tshare.setToolTipText(\"Share\");\r\n\t\tinbox = new JButton(inboxImg);\r\n\t\tinbox.setToolTipText(\"Inbox\");\r\n\t\t\r\n\t}", "public void init() {\n Assets.init();\n titleAnimation = new Animation(Assets.titleMoving, 180);\n startButton = new MenuButton((game.getWidth()/2 - 100), 220, 100, 200, MenuButtonType.START, this);\n highscoreButton = new MenuButton((game.getWidth()/2 - 100), 370, 100, 200, MenuButtonType.HIGHSCORE, this);\n backButton = new NavigationButton(37, 720, 120, 60, NavigationButton.NavButtonType.BACK, this.getGame());\n tutorialButton = new MenuButton((game.getWidth()/2 - 100), 520, 100, 200, MenuButtonType.INSTRUCTIONS, this);\n \n showTutorial = false;\n }", "@Override\n public void initialiseButtons() {\n resumeButton = new Button(buttonLeft, resumeButtonTop, buttonRight, resumeButtonBottom, Assets.resume);\n restartButton = new Button(buttonLeft, restartButtonTop, buttonRight, restartButtonBottom, Assets.restart);\n instructionsButton = new Button(buttonLeft, instructionsButtonTop, buttonRight, instructionsButtonBottom, Assets.instructions);\n quitButton = new Button(buttonLeft, quitButtonTop, buttonRight, quitButtonBottom, Assets.quit);\n backArrowButton = new Button(-8,-10,120,100, Assets.backArrowButton);\n saveGameButton = new Button(buttonLeft,saveGameButtonTop,buttonRight,saveGameButtonBottom,Assets.saveGame);\n }", "private void initializeFeatures() {\n\t\tint buttonLength = 2*super.getXLength()/3;\n\t\tint buttonHeight = super.getYLength()/6;\n\t\tint startX = super.getXPos() + super.getXLength()/2 - buttonLength/2; \n\t\tint startY = super.getYPos() + super.getYLength()/2 - buttonHeight/2;\n\t\tint spacingBetweenButtons = 10; \n\t\tstart = new StartButton(parent,startX,startY,buttonLength,buttonHeight);\n\t\tinstructions = new InstructionsButton(parent,startX,startY + spacingBetweenButtons+buttonHeight,buttonLength,buttonHeight);\n\t\tquit = new QuitButton(parent,startX,startY + 2*(buttonHeight + spacingBetweenButtons),buttonLength,buttonHeight);\n\t}", "private void configureButtons() {\n\n backToMenu = new JButton(\"Menu\");\n if(isWatching){\n backToMenu.setBounds(575, 270, 100, 50);\n }\n else{\n backToMenu.setBounds(30, 800, 100, 50);\n }\n backToMenu.setFont(new Font(\"Broadway\", Font.PLAIN, 20));\n backToMenu.setBackground(Color.RED);\n backToMenu.setFocusable(false);\n backToMenu.addActionListener(this);\n add(backToMenu);\n }", "public MenuButton getStartButton() {\n return startButton;\n }", "protected void init(){\n ac = new ButtonEventManager(this);\n \n nameField = new JTextField();\n \n done = new JButton(\"DONE\");\n back = new JButton(\"MAIN MENU\");\n quit = new JButton(\"QUIT\");\n \n done.setActionCommand(\"go to game menu after saving\");\n back.setActionCommand(\"go to the main menu\");\n quit.setActionCommand(\"quit the game\");\n \n Font font = new Font(\"Arial\", Font.PLAIN, 10);\n \n nameField.setFont(font);\n \n nameField.setBounds(2 * this.getWidth() / 3 - buttonWidth / 2, (int)(0.4 * this.getHeight() - textFieldHeight / 2), buttonWidth, textFieldHeight);\n \n done.setBounds((this.getWidth() / 2 - buttonWidth) / 2, (int)(0.7 * this.getHeight() - buttonHeight / 2), buttonWidth, buttonHeight);\n back.setBounds((this.getWidth() - buttonWidth) / 2, (int)(0.7 * this.getHeight() - buttonHeight / 2), buttonWidth, buttonHeight);\n quit.setBounds(3 * (this.getWidth() - buttonWidth) / 2, (int)(0.7 * this.getHeight() - buttonHeight / 2), buttonWidth, buttonHeight);\n \n done.addActionListener(ac);\n back.addActionListener(ac);\n quit.addActionListener(ac);\n \n add(nameField);\n \n add(done);\n add(back);\n add(quit);\n }", "public void initMenu(){\n\t}", "private void createButton(){\n addButton();\n addStartButton();\n }", "public void init()\n {\n Container screen = getContentPane();\n buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS));\n buttonPanel.add(attackButton);\n attackButton.setBackground(Color.WHITE);\n buttonPanel.add(defendButton);\n buttonPanel.add(fireButton);\n buttonPanel.add(iceButton);\n buttonPanel.add(hPotionButton);\n buttonPanel.add(mPotionButton);\n attackButton.addActionListener(this);\n defendButton.addActionListener(this);\n hPotionButton.addActionListener(this);\n mPotionButton.addActionListener(this);\n fireButton.addActionListener(this);\n iceButton.addActionListener(this);\n offScreen = new BufferedImage(500,500, BufferedImage.TYPE_INT_RGB);\n add(buttonPanel, BorderLayout.EAST);\n }", "public abstract void initButton(int buttonIndex);", "public void startMenu() {\n setTitle(\"Nier Protomata\");\n setSize(ICoord.LAST_COL + ICoord.ADD_SIZE,\n ICoord.LAST_ROW + ICoord.ADD_SIZE);\n \n setButton();\n }", "private void createButtons() {\n\tTexture startGameTex = new Texture(\n\t\tGdx.files.internal(\"assets/data/menu/menu_start.png\"));\n\tTexture plane_p1_tex = new Texture(\n\t\tGdx.files.internal(\"assets/data/menu/menu_player1.png\"));\n\tTexture plane_p2_tex = new Texture(\n\t\tGdx.files.internal(\"assets/data/menu/menu_player2.png\"));\n\n\tplayButton = new Button(\"\", font, 0, 0, new TextureRegion(startGameTex,\n\t\t0, 0, 161, 20), new TextureRegion(startGameTex, 0, 0, 161, 20),\n\t\tnew ScreenSwitchHandler(Screen.GAME));\n\tplaneButton_p1 = new Button(\"\", font, 0, 0, new TextureRegion(\n\t\tplane_p1_tex, 0, 0, 161, 20), new TextureRegion(plane_p1_tex,\n\t\t0, 0, 161, 20), new ScreenSwitchHandler(Screen.PLANE_P1));\n\tplaneButton_p2 = new Button(\"\", font, 0, 0, new TextureRegion(\n\t\tplane_p2_tex, 0, 0, 161, 20), new TextureRegion(plane_p2_tex,\n\t\t0, 0, 161, 20), new ScreenSwitchHandler(Screen.PLANE_P2));\n\toptionsButton = new Button(\"Options\", font, new ScreenSwitchHandler(\n\t\tScreen.OPTIONS));\n\texitButton = new Button(\"Exit\", font, new ButtonHandler() {\n\t @Override\n\t public void onClick() {\n\t\tGdx.app.exit();\n\t }\n\n\t @Override\n\t public void onRelease() {\n\t\t// TODO Auto-generated method stub\n\n\t }\n\t});\n }", "private void init()\n {\n btnUser.setOnAction(buttonHandler);\n btnHome.setOnAction(event -> changeScene(\"store/fxml/home/home.fxml\"));\n btnCategories.setOnAction(event -> changeScene(\"store/fxml/category/categories.fxml\"));\n btnTopApps.setOnAction(buttonHandler);\n btnPurchased.setOnAction(buttonHandler);\n btnMenu.setOnAction(buttonHandler);\n btnSearch.setOnAction(buttonHandler);\n btnFeatured.setOnAction(buttonHandler);\n\n itmLogout = new MenuItem(\"Logout\");\n itmAddApp = new MenuItem(\"Add app\");\n itmUsers = new MenuItem(\"Manage users\");\n itmCategories = new MenuItem(\"Manage categories\");\n\n itmAddApp.setOnAction(itemHandler);\n itmLogout.setOnAction(itemHandler);\n itmUsers.setOnAction(itemHandler);\n itmCategories.setOnAction(itemHandler);\n\n if (user.getId() != null)\n {\n btnMenu.setVisible(true);\n if (user.getAdmin())\n btnMenu.getItems().addAll(itmAddApp, itmCategories, itmUsers, itmLogout);\n else\n btnMenu.getItems().add(itmLogout);\n\n ImageView imageView = new ImageView(user.getPicture());\n imageView.setFitHeight(25);\n imageView.setFitWidth(25);\n\n btnUser.setText(user.getUsername());\n }\n else\n btnMenu.setVisible(false);\n }", "public void initGui()\n {\n StringTranslate var1 = StringTranslate.getInstance();\n int var2 = this.func_73907_g();\n\n for (int var3 = 0; var3 < this.options.keyBindings.length; ++var3)\n {\n this.controlList.add(new GuiSmallButton(var3, var2 + var3 % 2 * 160, this.height / 6 + 24 * (var3 >> 1), 70, 20, this.options.getOptionDisplayString(var3)));\n }\n\n this.controlList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, var1.translateKey(\"gui.done\")));\n this.screenTitle = var1.translateKey(\"controls.minimap.title\");\n }", "private void initButtons() {\n HBox buttons = new HBox(50);\n yes = new Button(\"Yes!\");\n no = new Button(\"No!\");\n buttons.getChildren().addAll(yes,no);\n buttons.setAlignment(Pos.CENTER);\n root.getChildren().addAll(buttons);\n }", "private void setButtons(JPanel menuContent) {\r\n\t \t \r\n \tJButton button_start = new JButton(start);\r\n \tbutton_start.setText(\"button_start\");\r\n\t \tbutton_start.setLocation(450, 300);\r\n\t\tbutton_start.setSize(405, 50);\r\n\t\tbutton_start.setBorderPainted(false);\r\n\t\tbutton_start.setFocusPainted(false);\r\n\t\tbutton_start.setContentAreaFilled(false);\r\n\t\tbutton_start.setCursor(new Cursor(Cursor.HAND_CURSOR));\r\n\t\tbutton_start.addActionListener(new ActionListener() {\r\n\t\t\t@Override\r\n\t\t\tpublic void actionPerformed(ActionEvent e) {\r\n\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\tbutton_press.playSound(BUTTON_PRESS);\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t \t \r\n\t \tJButton button_howto = new JButton(howto);\r\n\t \tbutton_howto.setText(\"button_howto\");\r\n\t \tbutton_howto.setLocation(450, 360);\r\n\t \tbutton_howto.setSize(405, 50);\r\n\t \tbutton_howto.setBorderPainted(false);\r\n\t \tbutton_howto.setFocusPainted(false);\r\n\t \tbutton_howto.setContentAreaFilled(false);\r\n\t \tbutton_howto.setCursor(new Cursor(Cursor.HAND_CURSOR));\r\n\t \tbutton_howto.addActionListener(new ActionListener() {\r\n\t\t\t@Override\r\n\t\t\tpublic void actionPerformed(ActionEvent e) {\r\n\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\tbutton_press.playSound(BUTTON_PRESS);\r\n\t\t\t}\r\n\t\t});\r\n\t \t\r\n\t \tJButton button_options = new JButton(options);\r\n\t \tbutton_options.setText(\"button_options\");\r\n\t \tbutton_options.setLocation(450, 420);\r\n\t \tbutton_options.setSize(405, 50);\r\n\t \tbutton_options.setBorderPainted(false);\r\n\t \tbutton_options.setFocusPainted(false);\r\n\t \tbutton_options.setContentAreaFilled(false);\r\n\t \tbutton_options.setCursor(new Cursor(Cursor.HAND_CURSOR));\r\n\t \tbutton_options.addActionListener(new ActionListener() {\r\n\t\t\t@Override\r\n\t\t\tpublic void actionPerformed(ActionEvent e) {\r\n\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\tbutton_press.playSound(BUTTON_PRESS);\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t \tJButton button_lboards = new JButton(lboards);\r\n\t \tbutton_lboards.setText(\"button_lboards\");\r\n\t \tbutton_lboards.setLocation(450, 480);\r\n\t \tbutton_lboards.setSize(405, 50);\r\n\t \tbutton_lboards.setBorderPainted(false);\r\n\t \tbutton_lboards.setFocusPainted(false);\r\n\t \tbutton_lboards.setContentAreaFilled(false);\r\n\t \tbutton_lboards.setCursor(new Cursor(Cursor.HAND_CURSOR));\r\n\t \tbutton_lboards.addActionListener(new ActionListener() {\r\n\t\t\t@Override\r\n\t\t\tpublic void actionPerformed(ActionEvent e) {\r\n\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\tbutton_press.playSound(BUTTON_PRESS);\r\n\t\t\t}\r\n\t\t});\r\n\t \t\r\n\t \tJButton button_exit = new JButton(exit);\r\n\t \tbutton_exit.setText(\"button_exit\");\r\n\t \tbutton_exit.setLocation(450, 540);\r\n\t \tbutton_exit.setSize(405, 50);\r\n\t \tbutton_exit.setBorderPainted(false);\r\n\t \tbutton_exit.setFocusPainted(false);\r\n\t \tbutton_exit.setContentAreaFilled(false);\r\n\t \tbutton_exit.setCursor(new Cursor(Cursor.HAND_CURSOR));\r\n\t \tbutton_exit.addActionListener(new ActionListener() {\r\n\t\t\t@Override\r\n\t\t\tpublic void actionPerformed(ActionEvent e) {\r\n\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\tbutton_press.playSound(BUTTON_PRESS);\r\n\t\t\t}\r\n\t\t});\r\n\t \t\r\n\t \t//adds the buttons to the JPanel\r\n\t menuContent.add(button_start);\r\n\t menuContent.add(button_howto);\r\n\t menuContent.add(button_options);\r\n\t menuContent.add(button_lboards);\r\n\t menuContent.add(button_exit);\r\n\t\t\r\n\t}", "public menu() {\n initComponents();\n }", "public menu() {\n initComponents();\n }", "private void setButtons()\n\t{\n\t\tstartSim = new JButton(\"Start Sim\");\n\t\tstartSim.addActionListener(this);\n\t\tpauseSim = new JButton(\"Pause Sim\");\n\t\tpauseSim.addActionListener(this);\n\t\taddEat = new JButton(\"Add Eatery\");\n\t\taddEat.addActionListener(this);\n\t\tsubEat = new JButton(\"Subtract Eatery\");\n\t\tsubEat.addActionListener(this);\n\t\taddCash = new JButton(\"Add Cashier\");\n\t\taddCash.addActionListener(this);\n\t\tsubCash = new JButton(\"Subtract Cashier\");\n\t\tsubCash.addActionListener(this);\n\t}", "private void init() {\n\t\t\n\t\t// Buttons\n\t\tendButton = new JButton(\"Spiel beenden\");\n\t\tendButton.setBackground(Color.white);\n\t\tendButton.setForeground(Color.black);\n\t\tendButton.setFont(endButton.getFont().deriveFont(20.0f));\n\t\tendButton.setBorder(BorderFactory.createStrokeBorder(new BasicStroke(1.5f), Color.black));\n\t\t\n\t\tanleitungButton = new JButton(\"Anleitung\");\n\t\tanleitungButton.setBackground(endButton.getBackground());\n\t\tanleitungButton.setForeground(endButton.getForeground());\n\t\tanleitungButton.setFont(endButton.getFont());\n\t\tanleitungButton.setBorder(endButton.getBorder());\n\t\t\n\t\tbackButton = new JButton(\"zurück\");\n\t\tbackButton.setBackground(endButton.getBackground());\n\t\tbackButton.setForeground(endButton.getForeground());\n\t\tbackButton.setFont(endButton.getFont());\n\t\tbackButton.setBorder(endButton.getBorder());\n\t\t\n\t\tbuttonPanel = new JPanel(new GridLayout(3, 1, 0, 50));\n\t\tbuttonPanel.add(endButton);\n\t\tbuttonPanel.add(anleitungButton);\n\t\tbuttonPanel.add(backButton);\n\t\tbuttonPanel.setBackground(Color.red.darker());\n\t\t\n\t\tgetContentPane().setLayout(new BorderLayout(40, 40));\n\t\tgetContentPane().add(buttonPanel, BorderLayout.CENTER);\n\t\tgetContentPane().add(new JLabel(), BorderLayout.NORTH);\n\t\tgetContentPane().add(new JLabel(), BorderLayout.SOUTH);\n\t\tgetContentPane().add(new JLabel(), BorderLayout.WEST);\n\t\tgetContentPane().add(new JLabel(), BorderLayout.EAST);\n\t\tgetContentPane().setBackground(buttonPanel.getBackground());\n\t\t\n\t\t// ACTIONLISTENER\n\t\tendButton.addActionListener(new ActionListener() {\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tdispose();\n\t\t\t\tSystem.exit(0);\n\t\t\t\tcancelGameandGoBackToHome(e);\t\t\t\n\t\t\t}\n\t\t});\n\t\t\n\t\tanleitungButton.addActionListener(new ActionListener() {\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tdispose();\n\t\t\t\topenAnleitung(e);\n\t\t\t}\n\t\t});\n\t\t\n\t\tbackButton.addActionListener(new ActionListener() {\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tdispose();\n\t\t\t\tbackToGame(e);\t\t\t\t\t\n\t\t\t}\n\t\t});\n\t}", "private void buttonInitiation() {\n submit = new JButton(\"Submit\");\n submit.setBounds(105, 250, 90, 25);\n this.add(submit);\n goBack = new JButton(\"Return to Main Menu\");\n goBack.setBounds(205, 250, 200, 25);\n this.add(goBack);\n }", "private void initialize() {\r\n\r\n // add default buttons\r\n addButton(getToggleButton(),\"toggle\");\r\n addButton(getFinishButton(),\"finish\");\r\n addButton(getCancelButton(),\"cancel\");\r\n addActionListener(new ActionListener() {\r\n\r\n public void actionPerformed(ActionEvent e) {\r\n String cmd = e.getActionCommand();\r\n if(\"toggle\".equalsIgnoreCase(cmd)) change();\r\n else if(\"finish\".equalsIgnoreCase(cmd)) finish();\r\n else if(\"cancel\".equalsIgnoreCase(cmd)) cancel();\r\n }\r\n\r\n });\r\n\r\n }", "public Menu_Ingreso() {\n initComponents();\n setLocationRelativeTo(null);\n }", "public void init(){\n\t\tsetBackground(Color.green);\n\t\tmsg = \"Let's Play\";\n//\t\tmsg1 = \"Your Frinds Choice\";\n\t\tSystem.out.println(cpu);\n\t\tb1 = new Button(\"Stone\");\n\t\tb2 = new Button(\"Paper\");\n\t\tb3 = new Button(\"Seaser\");\n\t\tb1.addActionListener(this);\n\t\tb2.addActionListener(this);\n\t\tb3.addActionListener(this);\n\t\tadd(b1);\n\t\tadd(b2);\n\t\tadd(b3);\n\t}", "public void initializeButtons(){\n\t\t\tplay.setBounds(40,90,280,30);\n\t\t\tadd(play);\n\t\t\tplay.addActionListener(new PlayGame());\n\t\t\tplay.setVisible(true);\n\t\t\t\n\t\t\tenterquestion.setBounds(40,140,280,30);\n\t\t\tadd(enterquestion);\n\t\t\tenterquestion.addActionListener(new EnterQuestion());\n\t\t\tenterquestion.setVisible(true);\n\t\t\t\n\t\t\tdirections.setBounds(40,190,280,30);\n\t\t\tadd(directions);\n\t\t\tdirections.addActionListener(new Instructor());\n\t\t\tdirections.setVisible(true);\n\t\t\t\n\t\t\t\n\t\t}", "public Primary(){\r\n\t\tsuper(\"Welcome to Louis' Sushi bar!!!!\"); \r\n\t\tsetLayout(new FlowLayout());\r\n\t\tsetDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n\t\tsetSize(500, 200);\r\n\t\tsetVisible(true);\r\n\t\t\r\n\t\t\r\n//this is initailizing all the JLabels and buttons and adding an action listener to the buttons, here is here create the buttons for the different menus\r\n\t\tContinue = new JLabel(\"LOUIS' SHUSHI BAR, PRESS which menu you you would like to go to \");\r\n\t\tsushimenu = new JButton(\"SUSHI MENU\");\r\n\t\tsushimenu.addActionListener(this);\r\n\t\tmeatmenu = new JButton(\"MEAT MENU\");\r\n\t\tmeatmenu.addActionListener(this);\r\n\t\tsoupsaladmenu = new JButton(\"SOUP MENU\");\r\n\t\tsoupsaladmenu.addActionListener(this);\r\n\t\tadd (Continue);\r\n\t\tadd (sushimenu);\r\n\t\tadd (meatmenu);\r\n\t\tadd(soupsaladmenu);\r\n\t\r\n\t}", "public static void initPauseMenu() {\n pausemenu.setBounds(0, 0, Display.WIDTH, Display.HEIGHT);\n pausemenu.setOpaque(false);\n\n pausemenu_resume_btn.setBounds(250, 210, 300, 50);\n pausemenu_resume_btn.setFont(main_menu_button_font);\n pausemenu_resume_btn.setFocusPainted(false);\n pausemenu_resume_btn.setOpaque(false);\n pausemenu_resume_btn.setBorderPainted(false);\n pausemenu_resume_btn.addActionListener(e -> game.resume());\n\n pausemenu_settings_btn.setBounds(250, 270, 300, 50);\n pausemenu_settings_btn.setFont(main_menu_button_font);\n pausemenu_settings_btn.setFocusPainted(false);\n pausemenu_settings_btn.setOpaque(false);\n pausemenu_settings_btn.setBorderPainted(false);\n pausemenu_settings_btn.addActionListener(e -> {\n options_menu.remove(options_back_button_tomainmenu);\n options_menu.add(options_back_button_topausemenu);\n PanelSlide.slideToLeft(pausemenu, options_menu, -1, -1);\n });\n\n pausemenu_quit_btn.setBounds(250, 330, 300, 50);\n pausemenu_quit_btn.setFont(main_menu_button_font);\n pausemenu_quit_btn.setFocusPainted(false);\n pausemenu_quit_btn.setOpaque(false);\n pausemenu_quit_btn.setBorderPainted(false);\n pausemenu_quit_btn.addActionListener(e -> {\n int pane = JOptionPane.showOptionDialog(null, \"Ana menüye dönmek istediğinize emin misiniz?\",\n \"Ana Menüye Dön\", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, singleplayer_menu_yesno, 1);\n if (pane == 0) {\n main_menu.forward();\n }\n });\n\n pausemenu.add(pausemenu_resume_btn);\n pausemenu.add(pausemenu_settings_btn);\n pausemenu.add(pausemenu_quit_btn);\n }", "public Menu() {\n initComponents();\n }", "public Menu() {\n initComponents();\n }", "public Menu() {\n initComponents();\n }", "private void initComponents() {\n\t\tbtn_pause =new JButton(\"暂停游戏\");\n\t\tbtn_continue =new JButton(\"继续游戏\");\n\t\tbtn_restart =new JButton(\"重新开始\");\n\t\tbtn_rank =new JButton(\"游戏排行\");\n\t\tbtn_admin =new JButton(\"后台管理\");\n\t\t\n\t\t\n\t\t//给按钮设置单击监听\n\t\tbtn_pause.addActionListener(this);\n\t\tbtn_continue.addActionListener(this);\n\t\tbtn_restart.addActionListener(this);\n\t\tbtn_rank.addActionListener(this);\n\t\tbtn_admin.addActionListener(this);\n\t}", "private void prepare()\r\n {\r\n MenuButton menubutton = new MenuButton();\r\n addObject(menubutton, 268, 406);\r\n Tittle tittle2 = new Tittle();\r\n addObject(tittle2, 544, 422);\r\n Exit exit2 = new Exit();\r\n addObject(exit2, 863, 427);\r\n tittle2.setLocation(545, 401);\r\n exit2.setLocation(848, 414);\r\n tittle2.setLocation(545, 411);\r\n }", "public Menu_Train() {\n initComponents();\n }", "public OptionPanel(Main w) {\r\n\t\tthis.w = w;\r\n\t\tstartButton = new JButton();\r\n\t\texitButton = new JButton();\r\n\t\t\r\n\t}", "public MenuTamu() {\n initComponents();\n \n }", "private void initBtnsArray()\r\n {\r\n for (int i = 0; i < this.buttons.length; i++)\r\n this.buttons[i] = new Button(\"Button #\" + i);\r\n }", "private void initCommandButtons(char[] levelLetters) {\n\t\tthis.btnTopFirst = (Button) findViewById(R.id.buttonTopFirst);\n\t\tthis.btnTopSecond = (Button) findViewById(R.id.buttonTopSecond);\n\t\tthis.btnTopThird = (Button) findViewById(R.id.buttonTopThird);\n\t\tthis.btnTopFourth = (Button) findViewById(R.id.buttonTopFourth);\n\n\t\tthis.btnBotFirst = (Button) findViewById(R.id.buttonBotFirst);\n\t\tthis.btnBotSecond = (Button) findViewById(R.id.buttonBotSecond);\n\t\tthis.btnBotThird = (Button) findViewById(R.id.buttonBotThird);\n\t\tthis.btnBotFourth = (Button) findViewById(R.id.buttonBotFourth);\n\t\tthis.letterButtons = new Button[] { btnBotFirst, btnBotSecond,\n\t\t\t\tbtnBotThird, btnBotFourth, btnTopFirst, btnTopSecond,\n\t\t\t\tbtnTopThird, btnTopFourth };\n\t\tthis.btnEndWord = (Button) findViewById(R.id.btnEndWord);\n\n\t\t// End word should be disabled by default\n\t\tthis.btnEndWord.setEnabled(false);\n\n\t\t// Populate level letters\n\t\tint index = 0;\n\t\tfor (Button btn : this.letterButtons) {\n\t\t\tbtn.setText(\"\" + levelLetters[index]);\n\t\t\tindex++;\n\t\t}\n\t}", "public MainMenu() {\n super();\n }", "public ScreenMainMenu() {\n\t\tsuper(AdapterInputMainMenu.class);\n\t\tobj.add(new MainMenuInteractObjTest<>(gRef,200,200,new Rectangle(0,0,32,32)));\n\t\tChartset.detect(\"resources\\\\Charts\");\n\t}", "public MainMenu() {\n initComponents();\n }", "public MainMenu() {\n initComponents();\n }", "public MainMenu() {\n initComponents();\n }", "private void initMenu() {\n \n JMenuBar menuBar = new JMenuBar();\n \n JMenu commands = new JMenu(\"Commands\");\n \n JMenuItem add = new JMenuItem(\"Add\");\n add.addActionListener((ActionEvent e) -> {\n changeState(\"Add\");\n });\n commands.add(add);\n \n JMenuItem search = new JMenuItem(\"Search\");\n search.addActionListener((ActionEvent e) -> {\n changeState(\"Search\");\n });\n commands.add(search);\n \n JMenuItem quit = new JMenuItem(\"Quit\");\n quit.addActionListener((ActionEvent e) -> {\n System.out.println(\"QUITING\");\n System.exit(0);\n });\n commands.add(quit);\n \n menuBar.add(commands);\n \n setJMenuBar(menuBar);\n }", "public PauseMenu() {\r\n\t\tinitialize();\r\n\t}", "private void createBeginningButtons() {\n\t createStartButtons(myResources.getString(\"game1\"), 0, 0);\n\t\tcreateStartButtons(myResources.getString(\"game2\"), 0, 1);\n\t\tcreateStartButtons(myResources.getString(\"game3\"), 0, 2);\n\t\tcreateStartButtons(myResources.getString(\"game4\"), 0, 3);\n\t\tcreateStartButtons(myResources.getString(\"game5\"), 0, 4);\n\t\tcreateInstructionButton();\n\t\tcreateStartingLabel();\n\t\tcreateGridSizeButton();\n }", "public menu() {\n initComponents();\n this.setLocationRelativeTo(null);\n }", "public MenuBangunRuang() {\n initComponents();\n }", "private void init_buttons(){\r\n /**\r\n * BOTON NUEVO\r\n */\r\n im_tool1.setOnMouseClicked((MouseEvent mouseEvent) -> {\r\n if(mouseEvent.getButton().equals(MouseButton.PRIMARY)){\r\n if(mouseEvent.getClickCount() > 0){\r\n botonInicio();\r\n botonNuevo();\r\n }\r\n }\r\n });\r\n /**\r\n * BOTON EDITAR\r\n */\r\n im_tool2.setOnMouseClicked((MouseEvent mouseEvent) -> {\r\n if(mouseEvent.getButton().equals(MouseButton.PRIMARY)){\r\n if(mouseEvent.getClickCount() > 0){\r\n botonEditar();\r\n }\r\n }\r\n });\r\n /**\r\n * BOTON GUARDAR\r\n */\r\n im_tool3.setOnMouseClicked((MouseEvent mouseEvent) -> {\r\n if(mouseEvent.getButton().equals(MouseButton.PRIMARY)){\r\n if(mouseEvent.getClickCount() > 0){\r\n botonGuardar();\r\n }\r\n }\r\n }); \r\n /**\r\n * BOTON ELIMINAR\r\n */\r\n im_tool4.setOnMouseClicked((MouseEvent mouseEvent) -> {\r\n if(mouseEvent.getButton().equals(MouseButton.PRIMARY)){\r\n if(mouseEvent.getClickCount() > 0){\r\n botonEliminar();\r\n }\r\n }\r\n });\r\n /**\r\n * BOTON IMPRIMIR\r\n */\r\n im_tool5.setOnMouseClicked((MouseEvent mouseEvent) -> {\r\n if(mouseEvent.getButton().equals(MouseButton.PRIMARY)){\r\n if(mouseEvent.getClickCount() > 0){ \r\n botonImprimir();\r\n }\r\n }\r\n });\r\n /**\r\n * BOTON REGRESAR\r\n */\r\n im_tool6.setOnMouseClicked((MouseEvent mouseEvent) -> {\r\n if(mouseEvent.getButton().equals(MouseButton.PRIMARY)){\r\n if(mouseEvent.getClickCount() > 0){\r\n botonInicio();\r\n }\r\n }\r\n });\r\n /**\r\n * BOTON POR ASIGNAR\r\n */\r\n im_tool7.setOnMouseClicked((MouseEvent mouseEvent) -> {\r\n if(mouseEvent.getButton().equals(MouseButton.PRIMARY)){\r\n if(mouseEvent.getClickCount() > 0){\r\n //\r\n }\r\n }\r\n });\r\n /**\r\n * BOTON NOTAS DE CREDITO\r\n */\r\n im_tool8.setOnMouseClicked((MouseEvent mouseEvent) -> {\r\n if(mouseEvent.getButton().equals(MouseButton.PRIMARY)){\r\n if(mouseEvent.getClickCount() > 0){\r\n //\r\n }\r\n }\r\n });\r\n /**\r\n * BOTON DEVOLUCION\r\n */\r\n im_tool9.setOnMouseClicked((MouseEvent mouseEvent) -> {\r\n if(mouseEvent.getButton().equals(MouseButton.PRIMARY)){\r\n if(mouseEvent.getClickCount() > 0){\r\n //\r\n }\r\n }\r\n });\r\n /**\r\n * BOTON BUSCAR\r\n */\r\n im_tool12.setOnMouseClicked((MouseEvent mouseEvent) -> {\r\n if(mouseEvent.getButton().equals(MouseButton.PRIMARY)){\r\n switch (mouseEvent.getClickCount()){\r\n case 1:\r\n botonInicio();\r\n botonBuscar();\r\n break;\r\n case 2:\r\n Datos.setIdButton(2003041);\r\n Gui.getInstance().showBusqueda(\"Busqueda\"); \r\n break;\r\n }\r\n }\r\n });\r\n /**\r\n * SELECCION EN LA TABLA\r\n */\r\n tb_guias.setOnMouseClicked((MouseEvent mouseEvent) -> {\r\n if(mouseEvent.getButton().equals(MouseButton.PRIMARY)){\r\n if(mouseEvent.getClickCount() > 0){\r\n if ((tb_guias.getItems() != null) && (!tb_guias.getItems().isEmpty()))\r\n selectedRowGuide();\r\n }\r\n }\r\n }); \r\n /**\r\n * metodo para mostrar buscar el nro de guia\r\n * param: ENTER O TAB\r\n */\r\n tf_nroguia.setOnKeyReleased((KeyEvent ke) -> {\r\n if (ke.getCode().equals(KeyCode.ENTER)){\r\n //Valida que el evento se haya generado en el campo de busqueda\r\n if(((Node)ke.getSource()).getId().equals(\"tf_nroguia\")){\r\n //Solicita los datos y envia la Respuesta a imprimirse en la Pantalla\r\n Datos.setLog_cguias(new log_CGuias()); \r\n boolean boo = Ln.getInstance().check_log_CGuias_rela_caja(tf_nroguia.getText()); \r\n numGuias = 0;\r\n if(boo){\r\n Datos.setRep_log_cguias(Ln.getInstance().find_log_CGuias(tf_nroguia.getText(), \"\", \"ncaja\", Integer.parseInt(rows)));\r\n loadTable(Datos.getRep_log_cguias()); \r\n }\r\n else{\r\n change_im_val(0, im_checkg); \r\n Gui.getInstance().showMessage(\"El Nro. de \" + ScreenName + \" NO existe!\", \"A\");\r\n tf_nroguia.requestFocus();\r\n }\r\n }\r\n }\r\n });\r\n /**\r\n * metodo para mostrar buscar el nro de guia\r\n * param: ENTER O TAB\r\n */\r\n tf_nrorguia.setOnKeyReleased((KeyEvent ke) -> {\r\n if (ke.getCode().equals(KeyCode.ENTER)){\r\n //Valida que el evento se haya generado en el campo de busqueda\r\n if(((Node)ke.getSource()).getId().equals(\"tf_nrorguia\")){\r\n //Solicita los datos y envia la Respuesta a imprimirse en la Pantalla\r\n boolean booa = true; \r\n if(booa){\r\n boolean booc = Ln.getInstance().check_log_CGuias_caja(tf_nrorguia.getText()); \r\n if(booc){\r\n change_im_val(0, im_checkg); \r\n Gui.getInstance().showMessage(\"El Nro. de Guia ya esta relacionado!\", \"A\");\r\n tf_nrorguia.requestFocus();\r\n }\r\n else{\r\n for (int i = 0; i < log_guide_guia.size(); i++) {\r\n if(tf_nrorguia.getText().equals(tb_guias.getItems().get(i).getGuias())){\r\n booa = false;\r\n Gui.getInstance().showMessage(\"El Nro. de Guia ya esta relacionado!\", \"A\");\r\n tf_nrorguia.requestFocus();\r\n break;\r\n }\r\n } \r\n if(booa){\r\n log_Guide_rel_inv guide_carga = new log_Guide_rel_inv();\r\n\r\n List<Fxp_Archguid_gfc> data = \r\n Ln.getList_log_Archguid_gfc(Ln.getInstance().find_Archguid_gfc(tf_nrorguia.getText()));\r\n\r\n if (data.get(0).getStat_guia().equals(\"X\")\r\n || data.get(0).getStat_guia().equals(\"C\")){\r\n guide_carga.setNumorden(String.valueOf((log_guide_guia.size() + 1)));\r\n guide_carga.setGuias(tf_nrorguia.getText());\r\n guide_carga.setNumfact(data.get(0).getNumfact());\r\n guide_carga.setNumclie(data.get(0).getNumclie());\r\n\r\n if (data.get(0).getStat_guia().equals(\"A\")){\r\n if (tipoOperacion == 1)\r\n guide_carga.setStat_guia(null);\r\n else\r\n guide_carga.setStat_guia(data.get(0).getStat_guia());\r\n }\r\n else{\r\n guide_carga.setStat_guia(null);\r\n }\r\n \r\n \r\n log_guide_guia.add(guide_carga);\r\n\r\n loadTableGuide_guias();\r\n change_im_val(200, im_checkg); \r\n\r\n numFactCarga = numFactCarga + data.get(0).getNumfact();\r\n numClieCarga = numClieCarga + data.get(0).getNumclie();\r\n\r\n tf_nrorguia.setText(\"\");\r\n }else{\r\n if (data.get(0).getStat_guia().equals(\"\")){\r\n Gui.getInstance().showMessage(\"El Nro. de Guia NO tiene relación de Guia de Carga!\", \"A\");\r\n }\r\n else{\r\n Gui.getInstance().showMessage(\"El Nro. de Guia ya esta relacionado!\", \"A\");\r\n }\r\n tf_nrorguia.requestFocus();\r\n }\r\n \r\n }\r\n }\r\n }\r\n else{\r\n change_im_val(0, im_checkg); \r\n Gui.getInstance().showMessage(\"El Nro. de Guia NO existe!\", \"A\");\r\n tf_nrorguia.requestFocus();\r\n }\r\n }\r\n }\r\n });\r\n }", "public DropMainMenu() {\n initComponents();\n }", "private void buttonInit() {\n panel.add(createButton);\n panel.add(editButton);\n panel.add(changeButton);\n createButton.addActionListener(this);\n editButton.addActionListener(this);\n changeButton.addActionListener(this);\n submitNewUser.addActionListener(this);\n editAccTypeBtn.addActionListener(this);\n changePassBtn.addActionListener(this);\n }", "public Component startButton() {\n startButton = new JButton(\"Start\");\n setFocusable(false);\n return startButton;\n }", "public StartupOptions() {\n initComponents();\n done.addActionListener(Seasonality.bi);\n\n }", "public ButtonMenuPanelBuyer() {\n initComponents();\n }", "private void initToolbar() {\n\t\tButton nextStep = new Button(\"Next Step\");\n\t\tnextStep.setOnMouseClicked(new EventHandler<Event>() {\n\t\t\t@Override\n\t\t\tpublic void handle(Event event) {\n\t\t\t\tcontrol.performOneStep();\n\t\t\t}\n\t\t});\n\t\tthis.getItems().add(nextStep);\n\n\t\t// Make and set Start Button\n\t\tButton startButton = new Button(\"Start Game\");\n\t\tstartButton.setOnMouseClicked(new EventHandler<Event>() {\n\n\t\t\t@Override\n\t\t\tpublic void handle(Event event) {\n\t\t\t\tcontrol.startGame();\n\t\t\t}\n\t\t});\n\t\tthis.getItems().add(startButton);\n\n\t\t// Make and set Pause Button\n\t\tButton pauseButton = new Button(\"Pause Game\");\n\t\tpauseButton.setOnMouseClicked(new EventHandler<Event>() {\n\n\t\t\t@Override\n\t\t\tpublic void handle(Event event) {\n\t\t\t\tcontrol.pauseGame();\n\t\t\t}\n\t\t});\n\t\tthis.getItems().add(pauseButton);\n\n\t\t//Text Field for GameSpeed\n\t\tText gameSpeedText = new Text(\"Delay between steps: \" + initialSpeed +\"ms\");\n\t\tthis.getItems().add(gameSpeedText);\n\t\t\n\t\t//Make and add Slider for GameSpeed control\n\t\tSlider gameSpeedSlider = new Slider(10, 250, initialSpeed);\n\t\tcontrol.setGameSpeed(initialSpeed);\n\t\t\n\t\tgameSpeedSlider.valueProperty().addListener(\n\t\t (observable, oldvalue, newvalue) ->\n\t\t {\n\t\t int i = newvalue.intValue();\n\t\t //This sets the delay in the controller\n\t\t control.setGameSpeed(i);\n\t\t //Text Label that displays delay\n\t\t gameSpeedText.setText(\"Delay between steps: \" + i +\"ms\");\n\t\t } );\n\t\t\n\t\tthis.getItems().add(gameSpeedSlider);\n\t\n\t\t\n\t\t\n\t}", "private void initAction() {\n\t\timg_back.setOnClickListener(this);\n\t\tbtn_delete.setOnClickListener(this);\n\t\tbtn_update.setOnClickListener(this);\n\t}", "public void initGui()\n {\n StringTranslate var2 = StringTranslate.getInstance();\n int var4 = this.height / 4 + 48;\n\n this.controlList.add(new GuiButton(1, this.width / 2 - 100, var4 + 24 * 1, \"Offline Mode\"));\n this.controlList.add(new GuiButton(2, this.width / 2 - 100, var4, \"Online Mode\"));\n\n this.controlList.add(new GuiButton(3, this.width / 2 - 100, var4 + 48, var2.translateKey(\"menu.mods\")));\n\t\tthis.controlList.add(new GuiButton(0, this.width / 2 - 100, var4 + 72 + 12, 98, 20, var2.translateKey(\"menu.options\")));\n\t\tthis.controlList.add(new GuiButton(4, this.width / 2 + 2, var4 + 72 + 12, 98, 20, var2.translateKey(\"menu.quit\")));\n this.controlList.add(new GuiButtonLanguage(5, this.width / 2 - 124, var4 + 72 + 12));\n }", "public void initGui()\n {\n this.buttonList.clear();\n this.multilineMessage = this.fontRendererObj.listFormattedStringToWidth(this.message.getFormattedText(), this.width - 50);\n this.field_175353_i = this.multilineMessage.size() * this.fontRendererObj.FONT_HEIGHT;\n this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 2 + this.field_175353_i / 2 + this.fontRendererObj.FONT_HEIGHT, I18n.format(\"gui.toMenu\", new Object[0])));\n if(!TabGUI.openTabGUI) return;\n this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 2 + 20 + this.field_175353_i / 2 + this.fontRendererObj.FONT_HEIGHT, 100, 20, \"Reconnect\"));\n this.buttonList.add(new GuiButton(2, this.width / 2, this.height / 2 + 20 + this.field_175353_i / 2 + this.fontRendererObj.FONT_HEIGHT, 100, 20, \"Random Alt\"));\n }", "public void init() {\n\t\tMenu menu = new Menu();\n\t\tmenu.register();\n\n\t\t// Application.getInstance().getGUILog().showMessage(\"Show a popup the proper\n\t\t// way !\");\n\n\t\t// final ActionsConfiguratorsManager manager =\n\t\t// ActionsConfiguratorsManager.getInstance();\n\n\t\t// final MDAction action = new ExampleAction();\n\t\t// Adding action to main menu\n\t\t// manager.addMainMenuConfigurator(new MainMenuConfigurator(action));\n\t\t// Adding action to main toolbar\n\t\t// manager.addMainToolbarConfigurator(new MainToolbarConfigurator(action));\n\n\t\t// pluginDir = getDescriptor().getPluginDirectory().getPath();\n\n\t\t// Creating submenu in the MagicDraw main menu\n\t\t// ActionsConfiguratorsManager manager =\n\t\t// ActionsConfiguratorsManager.getInstance();\n\t\t// manager.addMainMenuConfigurator(new\n\t\t// MainMenuConfigurator(getSubmenuActions()));\n\n\t\t/**\n\t\t * @Todo: load project options (@see myplugin.generator.options.ProjectOptions)\n\t\t * from ProjectOptions.xml and take ejb generator options\n\t\t */\n\n\t\t// for test purpose only:\n\t\t// GeneratorOptions ejbOptions = new GeneratorOptions(\"c:/temp\", \"ejbclass\",\n\t\t// \"templates\", \"{0}.java\", true, \"ejb\");\n\t\t// ProjectOptions.getProjectOptions().getGeneratorOptions().put(\"EJBGenerator\",\n\t\t// ejbOptions);\n\n\t\t// ejbOptions.setTemplateDir(pluginDir + File.separator +\n\t\t// ejbOptions.getTemplateDir()); //apsolutna putanja\n\t}", "private void buttonInit(){\n for(int i=0; i < 3; i++){\n choice[i] = new JButton();\n\n }\n choice[0].setText(\"10x10 / 8 bombs\");\n choice[0].setBackground(new Color(86, 160, 189));\n\n\n choice[0].addActionListener(l-> makeGamePanel(10, 8));\n\n choice[1].setText(\"15x15 / 30 bombs\");\n choice[1].setBackground(new Color(238, 160, 160));\n\n\n choice[1].addActionListener(l-> makeGamePanel(15,30));\n\n choice[2].setText(\"24x24 / 70 bombs\");\n choice[2].setBackground(new Color(253, 230, 122));\n choice[2].setFont(new Font(Font.MONOSPACED, Font.BOLD, 30));\n choice[2].setForeground(new Color(45, 68, 73));\n\n choice[2].addActionListener(l-> makeGamePanel(24,70));\n\n this.add(choice[0], BorderLayout.LINE_START); this.add(choice[1], BorderLayout.LINE_END); this.add(choice[2], BorderLayout.CENTER);\n }", "public vistaMenu() {\n initComponents();\n this.setLocationRelativeTo(null);\n }", "public MenuKullanimi()\n {\n initComponents();\n setLocationRelativeTo(null);\n }", "public Tela_Menu2() {\n initComponents();\n }", "public Menus() {\n initComponents();\n }", "private ButtonPane()\r\n\t\t\t{ super(new String[]{\"OK\",\"Cancel\"},1,2); }", "@FXML\n private void initialize(){\n\n //set default button\n chooseDirectoryButton.setDefaultButton(true);\n\n //Disable both button on start up\n startWatcherButton.setDisable(true);\n stopWatcherButton.setDisable(true);\n }", "public UIMenu() {\n initComponents();\n setLocationRelativeTo(null);\n background.requestFocusInWindow();\n createButtonMode.setVisible(false);\n loginButtonMode.setVisible(false);\n repassword.setVisible(false);\n inputRePass.setVisible(false);\n }", "@Override\n\tpublic void initGui()\n {\n this.controlList.clear();\n //Keyboard.enableRepeatEvents(true);\n\n int var1 = (this.width - this.bookImageWidth) / 2;\n int var2 = (this.height - this.bookImageHeight - 40) / 2;\n this.controlList.add(this.buttonNextPage = new GuiButtonNextPage(1, var1 + 120, var2 + 154, true));\n this.controlList.add(this.buttonPreviousPage = new GuiButtonNextPage(2, var1 + 38, var2 + 154, false));\n this.controlList.add(this.buttonIndex = new GuiButtonNextPage(8, var1 + 28, var2 + 10, false));\n this.controlList.add(this.buttonMenu1 = new GuiButtonSelect(3, var1 + 35, var2 + 30, 110, 20, \"\"));\n this.controlList.add(this.buttonMenu2 = new GuiButtonSelect(4, var1 + 35, var2 + 55, 110, 20, \"\"));\n this.controlList.add(this.buttonMenu3 = new GuiButtonSelect(5, var1 + 35, var2 + 80, 110, 20, \"\"));\n this.controlList.add(this.buttonMenu4 = new GuiButtonSelect(6, var1 + 35, var2 + 105, 110, 20, \"\"));\n this.controlList.add(this.buttonMenu5 = new GuiButtonSelect(7, var1 + 35, var2 + 130, 110, 20, \"\"));\n this.controlList.add(this.bookmark = new GuiButtonBookmark(9, var1 + 142, var2 + 7, false));\n this.updateButtons();\n }", "public void setStartButton(JButton startButton) {\n\t\tthis.startButton = startButton;\n\t}", "public void initialize() {\n\t\tbombLabel.setText(\"Flag: \" + game.getFlagCounter() + \"/\" + game.getNumOfBombs());\n\t\ttimerLabel.setText(\"Time: \" + 0);\n\t\tboard.getStyleClass().add(\"grid\");\n\t\tbtnArray = new Button[game.getHeight()][game.getWidth()];\n\t\tfor (int x = 0; x < game.getHeight(); x++) {\n\t\t\tfor (int y = 0; y < game.getWidth(); y++) {\n\t\t\t\tButton btn = new Button(\"\");\n\t\t\t\tbtnArray[x][y] = btn;\n\t\t\t\tbtn.setMaxSize(50, 50);\n\t\t\t\tbtn.setMinSize(50, 50);\n\t\t\t\t//Add Button to the board (GridPane)\n\t\t\t\tboard.add(btn, x, y);\n\t\t\t\tbtn.setId(x + \" . \" + y);\n\t\t\t\tbtn.setOnMouseClicked(e -> TileClicked(e));\n\t\t\t}\n\t\t}\n\t}", "@Override\n\tprotected void InitButtonListener() {\n\t\tLayoutTop.setOnClickListener(new View.OnClickListener() {\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tClickOption();\n\t\t\t\t\n\t\t\t}\n\t\t});\n\t}", "public void InitializeMenu(){\n\t\tmnbBar = new JMenuBar();\n\t\tmnuFile = new JMenu(\"File\");\n\t\tmnuFormat = new JMenu(\"Format\");\n\t\tmniOpen = new JMenuItem(\"Open\");\n\t\tmniExit = new JMenuItem(\"Exit\");\n\t\tmniSave = new JMenuItem(\"Save\");\n\t\tmniSaveAs = new JMenuItem(\"Save as\");\n\t\tmniSaveAs.setMnemonic(KeyEvent.VK_A);\n\t\tmniSave.setMnemonic(KeyEvent.VK_S);\n\t\tmniChangeBgColor = new JMenuItem(\"Change Backgroud Color\");\n\t\tmniChangeFontColor = new JMenuItem(\"Change Font Color\");\n\t\t//them menu item vao menu file\n\t\tmnuFile.add(mniOpen);\n\t\tmnuFile.addSeparator();\n\t\tmnuFile.add(mniExit);\n\t\tmnuFile.add(mniSaveAs);\n\t\tmnuFile.add(mniSave);\n\t\t//them menu item vao menu format\n\t\tmnuFormat.add(mniChangeBgColor);\n\t\tmnuFormat.addSeparator();\n\t\tmnuFormat.add(mniChangeFontColor);\n\t\t//them menu file va menu format vao menu bar\n\t\tmnbBar.add(mnuFile);\n\t\tmnbBar.add(mnuFormat);\n\t\t//thiet lap menubar thanh menu chinh cua frame\n\t\tsetJMenuBar(mnbBar);\n\t}", "public void setMenu() {\n\t \n\t\ttop = new JPanel(new FlowLayout(FlowLayout.LEFT));\n\t add(top, BorderLayout.CENTER);\n\t \n\t lPro = new JLabel(\"Projects: \");\n\t top.add(lPro);\n\t \n\t cPro = new JComboBox();\n\t getProject();\n\t\ttop.add(cPro);\n\t\t\n\t\tview = new JButton(\"View Sample\");\n\t\ttop.add(view);\n\t\t\n\t\tbottom = new JPanel(new FlowLayout(FlowLayout.CENTER));\n\t\tadd(bottom, BorderLayout.SOUTH);\n\t\t\n\t\tcancel = new JButton(\"Cancel\");\n\t\tbottom.add(cancel);\n\t\t\n\t\tdownload = new JButton(\"Download\");\n\t\tbottom.add(download);\n\t\t\n\t\tsetActionListener();\t\n\t}", "public menuAddStasiun() {\n initComponents();\n }", "public void initPlayerMenu() {\n Font f = new Font(\"Helvetica\", Font.BOLD, 16);\n\n menuPanel = new JPanel();\n menuPanel.setPreferredSize(new Dimension(buttonWidth, buttonHeight));\n menuPanel.setLayout(null);\n\n menuBar = new JMenuBar();\n menuBar.setPreferredSize(new Dimension(buttonWidth, buttonHeight));\n menuBar.setBounds(0, 0, buttonWidth, buttonHeight);\n menuBar.setLayout(null);\n\n playerMenu = new JMenu();\n playerMenu.setText(\"Players\");\n playerMenu.setFont(f);\n playerMenu.setBounds(0, 0, buttonWidth, buttonHeight);\n playerMenu.setBackground(new Color(0xeaf1f7));\n playerMenu.setHorizontalTextPosition(SwingConstants.CENTER);\n playerMenu.setOpaque(true);\n playerMenu.setBorder(BorderFactory.createBevelBorder(0));\n\n menuBar.add(playerMenu);\n menuPanel.add(menuBar);\n }", "public MenuPrincipal() {\n\t\tinitComponents();\n\t\tbtnSplines.setVisible(false);\n\t\tbtnEcuacionesNolineales.addActionListener(new ActionListener() {\n\n\t\t\t@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tGestorInterfazPrincipal.iniciarUnidad1();\n\t\t\t}\n\t\t});\n\t\tbtnSistemasdeEcuaciones.addActionListener(new ActionListener() {\n\n\t\t\t@Override\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\t\tGestorInterfazPrincipal.iniciarSistemasEcuaciones();\n\t\t\t}\n\t\t});\n\t\tbtnGraficador.addActionListener(new ActionListener() {\n\n\t\t\t@Override\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\t\tGestorInterfazPrincipal.iniciarGraficador();\n\t\t\t}\n\t\t});\n\t\tbtnInterpolacion.addActionListener(new ActionListener() {\n\n\t\t\t@Override\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\t\tGestorInterfazPrincipal.iniciarInterpolacion();\n\t\t\t}\n\t\t});\n\t\tbtnDiferenciacion.addActionListener(new ActionListener() {\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\t\tGestorInterfazPrincipal.iniciarDiferenciacion();\n\t\t\t}\n\t\t});\n\t\tbtnIntegracion.addActionListener(new ActionListener() {\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\t\tGestorInterfazPrincipal.iniciarIntegracion();\n\t\t\t}\n\t\t});\n\n\t}", "private void initNodeListe() {\n\t\t\n\t\tbtnAddTransaction = new JFXButton();\n\t\tbtnAddTransaction.setButtonType(JFXButton.ButtonType.RAISED);\n\t\tbtnAddTransaction.getStyleClass()\n\t\t\t\t.addAll(\"RoundButton\", \"NeutralButton\");\n\t\tbtnOutgo = new JFXButton(\"D\");\n\t\tbtnOutgo.setButtonType(JFXButton.ButtonType.RAISED);\n\t\tbtnOutgo.getStyleClass().addAll(\"RoundButton\", \"RedButton\");\n\t\tbtnIncome = new JFXButton(\"R\");\n\t\tbtnIncome.setButtonType(JFXButton.ButtonType.RAISED);\n\t\tbtnIncome.getStyleClass().addAll(\"RoundButton\", \"GreenButton\");\n\t\t\n\t\tnodeAjout.addAnimatedNode(btnAddTransaction);\n\t\tnodeAjout.addAnimatedNode(btnOutgo);\n\t\tnodeAjout.addAnimatedNode(btnIncome);\n\t\tnodeAjout.setSpacing(5d);\n\t\tnodeAjout.setRotate(180);\n\t\t\n\t\tImageView image = new ImageView(new Image(\n\t\t\t\tgetClass().getResourceAsStream(\"/gui/Image/add.png\")));\n\t\timage.setFitWidth(20);\n\t\timage.setFitHeight(20);\n\t\tbtnAddTransaction.setGraphic(image);\n\t\t\n\t}", "public PlayerScheduleMenu() {\n initComponents();\n }", "public MenuButtons(String nameOfButton) {\n Text text = new Text(nameOfButton);\n text.setFont(Font.font(null, FontWeight.BOLD, 18));\n text.setFill(Color.WHITESMOKE);\n\n //A rectangle that will be a part of the button\n Rectangle rectangle = new Rectangle(250,30);\n rectangle.setOpacity(0.3);\n rectangle.setFill(Color.BLUE);\n\n setAlignment(Pos.CENTER_LEFT);\n getChildren().addAll(rectangle, text);\n\n setOnMouseEntered(e -> {\n rectangle.setTranslateX(5);\n text.setTranslateX(5);\n rectangle.setFill(Color.DARKBLUE);\n });\n\n setOnMouseExited(e -> {\n rectangle.setTranslateX(0);\n text.setTranslateX(0);\n rectangle.setFill(Color.BLUE);\n });\n\n DropShadow shadowEffect = new DropShadow();\n shadowEffect.setInput(new Glow());\n\n setOnMousePressed(e -> setEffect(shadowEffect));\n setOnMouseReleased(e -> setEffect(null));\n }", "private void init() {\n setBackground(LIGHT_GRAY);\n Box layout = new Box(BoxLayout.Y_AXIS);\n\n jump = createButton(\"Jump\", null);\n exit = createButton(\"Exit!\", null);\n fly = createButton(\"Fly\", null);\n Jfloat = createButton(\"Float\", null);\n layout.add(Box.createRigidArea(new Dimension(0, 150)));\n layout.add(jump);\n layout.add(Box.createRigidArea(new Dimension(0, 25)));\n layout.add(Jfloat);\n layout.add(Box.createRigidArea(new Dimension(0, 25)));\n layout.add(fly);\n layout.add(Box.createRigidArea(new Dimension(0, 25)));\n layout.add(exit);\n add(layout);\n }", "public StartScreen() {\n initComponents();\n }", "public Menu2() {\n initComponents();\n }", "public LinkButton() {\n\t\tsuper();\n\t\tinit();\n\t}", "private void initMenu()\n {\n bar = new JMenuBar();\n fileMenu = new JMenu(\"File\");\n crawlerMenu = new JMenu(\"Crawler\"); \n aboutMenu = new JMenu(\"About\");\n \n bar.add(fileMenu);\n bar.add(crawlerMenu);\n bar.add(aboutMenu);\n \n exit = new JMenuItem(\"Exit\");\n preferences = new JMenuItem(\"Preferences\");\n author = new JMenuItem(\"Author\");\n startCrawlerItem = new JMenuItem(\"Start\");\n stopCrawlerItem = new JMenuItem(\"Stop\");\n newIndexItem = new JMenuItem(\"New index\");\n openIndexItem = new JMenuItem(\"Open index\");\n \n stopCrawlerItem.setEnabled(false);\n \n fileMenu.add(newIndexItem);\n fileMenu.add(openIndexItem);\n fileMenu.add(exit);\n aboutMenu.add(author);\n crawlerMenu.add(startCrawlerItem);\n crawlerMenu.add(stopCrawlerItem);\n crawlerMenu.add(preferences);\n \n author.addActionListener(this);\n preferences.addActionListener(this);\n exit.addActionListener(this);\n startCrawlerItem.addActionListener(this);\n stopCrawlerItem.addActionListener(this);\n newIndexItem.addActionListener(this);\n openIndexItem.addActionListener(this);\n \n frame.setJMenuBar(bar);\n }", "private void startButtonAction(){\n scoreboard.setStartAction(event->initControl());\n }", "private void initUI() {\n tvQuote = (TextView) findViewById(R.id.tvQuote);\n tvBeginButton = (TextView) findViewById(R.id.tvBeginButton);\n\n tvBeginButton.setOnClickListener(this);\n\n loadBackground();\n }", "private void initEvent() {\n\t\tmBtnPower.setOnClickListener(this);\n\t\tmBtnProfile.setOnClickListener(this);\n\t\tmBtnArea.setOnClickListener(this);\n\t\tmBtnSkipTime.setOnClickListener(this);\n\t\tmBtnFrequencyPoint.setOnClickListener(this);\n\t\tmBtnAlgorithm.setOnClickListener(this);\n\t}", "public OptionsMenu() {\n initComponents();\n }", "@Override\r\n\tpublic void initGui() {\r\n\t final int buttonSize = SIZE_X - 10;\r\n\r\n\t _curScrollValue = 0;\r\n\t buttonList.clear();\r\n\t _selectedList.clear();\r\n\r\n\t _deleteButton = new GuiButton(0, (width - buttonSize) / 2, (height + SIZE_Y) / 2 + 12, buttonSize, 20, \"Delete Selected Waypoints\");\r\n\t \r\n\t // load the saved waypoint data to initialize this gui\r\n\t UltraTeleportWaypoint.load();\r\n\t}", "public frameMenu() {\n initComponents();\n }" ]
[ "0.7706423", "0.748784", "0.73391783", "0.72927845", "0.7196089", "0.71318763", "0.7069379", "0.7053129", "0.7037119", "0.6958277", "0.6920505", "0.6889352", "0.6835056", "0.68298167", "0.6813985", "0.67969644", "0.6793507", "0.6788672", "0.67333007", "0.67274106", "0.67176706", "0.6713738", "0.6701132", "0.6695852", "0.6682144", "0.667927", "0.66726136", "0.66670895", "0.66670895", "0.6665597", "0.6657112", "0.6646992", "0.66355354", "0.6633335", "0.66133803", "0.659002", "0.6586526", "0.656341", "0.6555393", "0.6555393", "0.6555393", "0.6546907", "0.6543888", "0.6537658", "0.6523497", "0.65134543", "0.64979875", "0.6493138", "0.64913565", "0.64820653", "0.64762646", "0.64762646", "0.64762646", "0.64761525", "0.6472286", "0.6470756", "0.645518", "0.64547217", "0.64513683", "0.64496905", "0.64469", "0.6430535", "0.64284354", "0.6425725", "0.64205694", "0.64178747", "0.6415213", "0.6413855", "0.6409131", "0.6385608", "0.6380498", "0.63793623", "0.63754934", "0.63571143", "0.63556886", "0.6345384", "0.6334663", "0.633172", "0.63268906", "0.63255465", "0.63237494", "0.6321298", "0.63186747", "0.63118154", "0.6309753", "0.62840515", "0.6276774", "0.6271568", "0.6266508", "0.6264212", "0.6257976", "0.62544894", "0.6250585", "0.6249131", "0.62487507", "0.6244321", "0.6237359", "0.622901", "0.6225349", "0.62203866" ]
0.6580768
37
/ Here the function tries to get the solution path. Since the Nodes are connected. We take the goal node and use the method getParent() until we arrive at the startNode. The path is printed to output.
private void solutionPath(Node n){ ArrayList<String> num = new ArrayList<>(); num.add(n.getDigit().getDigitString()); Node node = n.getParent(); while(true){ if(node == startNode){ num.add(node.getDigit().getDigitString()); break; }else{ num.add(node.getDigit().getDigitString()); } node = node.getParent(); } int size = num.size(); int index = size-1; for(int i=0; i<size; i++){ if(index == 0){ System.out.println(num.get(index)); break; } System.out.print(num.get(index)+","); index--; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public List<Node> findPath(Vector2i start, Vector2i goal) {\n\t\tList<Node> openList = new ArrayList<Node>(); //All possible Nodes(tiles) that could be shortest path\n\t\tList<Node> closedList = new ArrayList<Node>(); //All no longer considered Nodes(tiles)\n\t\tNode current = new Node(start,null, 0, getDistance(start, goal)); //Current Node that is being considered(first tile)\n\t\topenList.add(current);\n\t\twhile(openList.size() > 0) {\n\t\t\tCollections.sort(openList, nodeSorter); // will sort open list based on what's specified in the comparator\n\t\t\tcurrent = openList.get(0); // sets current Node to first possible element in openList\n\t\t\tif(current.tile.equals(goal)) {\n\t\t\t\tList<Node> path = new ArrayList<Node>(); //adds the nodes that make the path \n\t\t\t\twhile(current.parent != null) { //retraces steps from finish back to start\n\t\t\t\t\tpath.add(current); // add current node to list\n\t\t\t\t\tcurrent = current.parent; //sets current node to previous node to strace path back to start\n\t\t\t\t}\n\t\t\t\topenList.clear(); //erases from memory since algorithm is finished, ensures performance is not affected since garbage collection may not be called\n\t\t\t\tclosedList.clear();\n\t\t\t\treturn path; //returns the desired result shortest/quickest path\n\t\t\t}\n\t\t\topenList.remove(current); //if current Node is not part of path to goal remove\n\t\t\tclosedList.add(current); //and puts it in closedList, because it's not used\n\t\t\tfor(int i = 0; i < 9; i++ ) { //8-adjacent tile possibilities\n\t\t\t\tif(i == 4) continue; //index 4 is the middle tile (tile player currently stands on), no reason to check it\n\t\t\t\tint x = (int)current.tile.getX();\n\t\t\t\tint y = (int)current.tile.getY();\n\t\t\t\tint xi = (i % 3) - 1; //will be either -1, 0 or 1\n\t\t\t\tint yi = (i / 3) - 1; // sets up a coordinate position for Nodes (tiles)\n\t\t\t\tTile at = getTile(x + xi, y + yi); // at tile be all surrounding tiles when iteration is run\n\t\t\t\tif(at == null) continue; //if empty tile skip it\n\t\t\t\tif(at.solid()) continue; //if solid cant pass through so skip/ don't consider this tile\n\t\t\t\tVector2i a = new Vector2i(x + xi, y + yi); //Same thing as node(tile), but changed to a vector\n\t\t\t\tdouble gCost = current.gCost + (getDistance(current.tile, a) == 1 ? 1 : 0.95); //*calculates only adjacent nodes* current tile (initial start is 0) plus distance between current tile to tile being considered (a)\n\t\t\t\tdouble hCost = getDistance(a, goal);\t\t\t\t\t\t\t\t// conditional piece above for gCost makes a more realist chasing, because without it mob will NOT use diagonals because higher gCost\n\t\t\t\tNode node = new Node(a, current, gCost, hCost);\n\t\t\t\tif(vecInList(closedList, a) && gCost >= node.gCost) continue; //is node has already been checked \n\t\t\t\tif(!vecInList(openList, a) || gCost < node.gCost) openList.add(node);\n\t\t\t}\n\t\t}\n\t\tclosedList.clear(); //clear the list, openList will have already been clear if no path was found\n\t\treturn null; //a default return if no possible path was found\n\t}", "@Override\n List<NodeData> pathFind() throws NoPathException {\n System.out.println(\"Starting Scenic\");\n\n frontier.add(start);\n\n while(!frontier.isEmpty()) {\n StarNode current = frontier.getLast();\n frontier.removeLast(); // pop the priority queue\n if(current.getXCoord() == goal.getXCoord() && current.getYCoord() == goal.getYCoord()) {\n // If we are at the goal, we need to backtrack through the shortest path\n System.out.println(\"At target!\");\n finalList.add(current); // we have to add the goal to the path before we start backtracking\n while(!(current.getXCoord() == start.getXCoord() && current.getYCoord() == start.getYCoord())) {\n finalList.add(current.getPreviousNode());\n current = current.getPreviousNode();\n System.out.println(current.getNodeID());\n }\n return finalList;\n }\n else {\n // we need to get all the neighbor nodes, identify their costs, and put them into the queue\n LinkedList<StarNode> neighbors = current.getNeighbors();\n // we also need to remove the previous node from the list of neighbors because we do not want to backtrack\n neighbors.remove(current.getPreviousNode());\n\n for (StarNode newnode : neighbors) {\n int nodePlace = this.listContainsId(frontier, newnode);\n if(nodePlace > -1) {\n if (frontier.get(nodePlace).getF() > actionCost(newnode) + distanceToGo(newnode, goal)) {\n System.out.println(\"Here\");\n frontier.remove(frontier.get(nodePlace));\n newnode.setPreviousNode(current);\n frontier.add(newnode);\n newnode.setF(actionCost(newnode) + distanceToGo(newnode, goal));\n }\n }\n else {\n newnode.setPreviousNode(current);\n frontier.add(newnode);\n newnode.setF(actionCost(newnode) + distanceToGo(newnode, goal));\n }\n\n // This fixes the problem with infinitely looping elevators (I hope)\n if(current.getNodeType().equals(\"ELEV\") && newnode.getNodeType().equals(\"ELEV\")) {\n for (Iterator<StarNode> iterator = newnode.neighbors.iterator(); iterator.hasNext();) {\n StarNode newneighbor = iterator.next();\n if (newneighbor.getNodeType().equals(\"ELEV\")) {\n // Remove the current element from the iterator and the list.\n iterator.remove();\n }\n }\n }\n if(current.getNodeType().equals(\"STAI\") && newnode.getNodeType().equals(\"STAI\")) {\n for (Iterator<StarNode> iterator = newnode.neighbors.iterator(); iterator.hasNext();) {\n StarNode newneighbor = iterator.next();\n if (newneighbor.getNodeType().equals(\"STAI\")) {\n // Remove the current element from the iterator and the list.\n iterator.remove();\n }\n }\n }\n // this is where the node is put in the right place in the queue\n Collections.sort(frontier);\n }\n }\n }\n throw new NoPathException(start.getLongName(), goal.getLongName());\n }", "private void printPath() {\n // generate and print the shortest path.\n if (this == this.previous) {\n graphPathRef.add(this);\n } else if (this.previous == null) {\n System.out.print(\"\");\n } else {\n graphPathRef.add(this);\n this.previous.printPath();\n }\n }", "public Iterable<Board> solution() {\n\t\tif (goal == null)\n\t\t\treturn null;\n\t\telse {\n\t\t\tfinal Stack<Board> trace = new Stack<Board>();\n\t\t\tSearchNode iter = goal;\n\t\t\twhile (iter != null) {\n\t\t\t\ttrace.push(iter.getBoard());\n\t\t\t\titer = iter.getParent();\n\t\t\t}\n\t\t\treturn trace;\n\t\t}\n\t}", "public Stack<Node> findPath(Node initial_node, Node end_node) {\r\n\r\n // TODO: check for hardcoded value 3\r\n int size = 3;\r\n boolean is_start_node = true;\r\n\r\n PriorityList priority_list = new PriorityList();\r\n LinkedList linked_list = new LinkedList();\r\n\r\n // Initialise start node\r\n initial_node.total_path_cost = 0;\r\n initial_node.cost_estimated_to_goal_node = initial_node.pathCost(end_node);\r\n initial_node.parent_node_in_path = null;\r\n priority_list.add(initial_node);\r\n\r\n // Begin exploration of grid map\r\n while (!priority_list.isEmpty()) {\r\n\r\n // Get node from head of list\r\n Node node = (Node) priority_list.removeFirst();\r\n\r\n // Determine if node is Start node\r\n if (node == initial_node)\r\n is_start_node = true;\r\n else\r\n is_start_node = false;\r\n\r\n ((Node) node).setFacing();\r\n\r\n // Determine if node is goal node\r\n if (node == end_node) {\r\n return constructPath(end_node);\r\n }\r\n\r\n // Get list of node neighbours\r\n List neighbors_list = node.getNeighbors();\r\n\r\n // Iterate through list of node neighbours\r\n for (int i = 0; i < neighbors_list.size(); i++) {\r\n\r\n // Extract neighbour node information\r\n Node node_neighbour = (Node) neighbors_list.get(i);\r\n boolean isOpen = priority_list.contains(node_neighbour);\r\n boolean isClosed = linked_list.contains(node_neighbour);\r\n boolean isObs = (node_neighbour).isObs();\r\n int clearance = node_neighbour.getClearance();\r\n float total_path_cost = node.getCost(node_neighbour, end_node, is_start_node) + 1;\r\n\r\n // Check 1. if node neighbours have not been explored OR 2. if shorter path to\r\n // neighbour node exists\r\n if ((!isOpen && !isClosed) || total_path_cost < node_neighbour.total_path_cost) {\r\n node_neighbour.parent_node_in_path = node;\r\n node_neighbour.total_path_cost = total_path_cost;\r\n node_neighbour.cost_estimated_to_goal_node = node_neighbour.pathCost(end_node);\r\n\r\n // Add neighbour node to priority_list if 1. node not in\r\n // priority_list/linked_list AND 2.\r\n // robot can reach\r\n if (!isOpen && !isObs && size == clearance) {\r\n priority_list.add(node_neighbour);\r\n }\r\n }\r\n }\r\n linked_list.add(node);\r\n }\r\n\r\n // priority_list empty; no path found\r\n\r\n return new Stack<Node>();\r\n }", "@Override\n\tpublic void solve() {\n\t\tlong startTime = System.nanoTime();\n\n\t\twhile(!unvisitedPM.isEmpty()){\n\t\t\tProblemModel current = findCheapestNode();\n\t\n\t\t\tfor(ProblemModel pm : current.getSubNodes()){\n\t\t\n\t\t\t\tif(!visited.contains(pm) && !unvisitedPM.contains(pm)){\n\t\t\t\t\t\n\t\t\t\t\tunvisitedPM.add(pm);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif(current.getSideStart().isEmpty()){\n\t\t\t\tSystem.out.print( \"\\n\"+ \"StartSide Runners: \");\n\t\t\t\tfor(Integer r: current.getSideStart()){\n\t\t\t\t\tSystem.out.print( \" \" +r) ;\n\t\t\t\t}\n\t\t\t\tSystem.out.print( \"\\n\" + \"EndSide Runners: \");\n\t\t\t\tfor(Integer r: current.getSideEnd()){\n\t\t\t\t\tSystem.out.print( \" \" + r);\n\t\t\t\t}\n\n\t\t\t\tprintPathTaken(current);\n\t\t\t\tSystem.out.print( \"\\n\" + \"------------done--------------\");\n\t\t\t\tlong endTime = System.nanoTime();\n\t\t\t\tlong duration = ((endTime - startTime)/1000000);\n\t\t\t\tSystem.out.print( \"\\n\" + \"-AS1 Time taken: \" + duration + \"ms\");\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tvisited.add(current);\n\t\t\n\t\t}\n\t\t\n\n\t}", "private Stack<MapLocation> returnPath(MapLocation goal, MapLocation start) {\n\t\tStack<MapLocation> path = new Stack<MapLocation>();\n\n\t\tMapLocation iter = goal;\n\t\twhile (iter.cameFrom != null) {\n\t\t\tpath.add(iter.cameFrom);\n\t\t\titer = iter.cameFrom;\n\t\t}\n\t\t// to remove start\n\n\t\tif (path.isEmpty()) {\n\t\t\treturn path;\n\t\t}\n\n\t\tpath.pop();\n\n\t\treturn path;\n\t}", "private static ArrayList<Connection> pathFindDijkstra(Graph graph, int start, int goal) {\n\t\tNodeRecord startRecord = new NodeRecord();\r\n\t\tstartRecord.setNode(start);\r\n\t\tstartRecord.setConnection(null);\r\n\t\tstartRecord.setCostSoFar(0);\r\n\t\tstartRecord.setCategory(OPEN);\r\n\t\t\r\n\t\tArrayList<NodeRecord> open = new ArrayList<NodeRecord>();\r\n\t\tArrayList<NodeRecord> close = new ArrayList<NodeRecord>();\r\n\t\topen.add(startRecord);\r\n\t\tNodeRecord current = null;\r\n\t\tdouble endNodeCost = 0;\r\n\t\twhile(open.size() > 0){\r\n\t\t\tcurrent = getSmallestCSFElementFromList(open);\r\n\t\t\tif(current.getNode() == goal){\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tGraphNode node = graph.getNodeById(current.getNode());\r\n\t\t\tArrayList<Connection> connections = node.getConnection();\r\n\t\t\tfor( Connection connection :connections){\r\n\t\t\t\t// get the cost estimate for end node\r\n\t\t\t\tint endNode = connection.getToNode();\r\n\t\t\t\tendNodeCost = current.getCostSoFar() + connection.getCost();\r\n\t\t\t\tNodeRecord endNodeRecord = new NodeRecord();\r\n\t\t\t\t// if node is closed skip it\r\n\t\t\t\tif(listContains(close, endNode))\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t// or if the node is in open list\r\n\t\t\t\telse if (listContains(open,endNode)){\r\n\t\t\t\t\tendNodeRecord = findInList(open, endNode);\r\n\t\t\t\t\t// print\r\n\t\t\t\t\t// if we didn't get shorter route then skip\r\n\t\t\t\t\tif(endNodeRecord.getCostSoFar() <= endNodeCost) {\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// else node is not visited yet\r\n\t\t\t\telse {\r\n\t\t\t\t\tendNodeRecord = new NodeRecord();\r\n\t\t\t\t\tendNodeRecord.setNode(endNode);\r\n\t\t\t\t}\r\n\t\t\t\t//update the node\r\n\t\t\t\tendNodeRecord.setCostSoFar(endNodeCost);\r\n\t\t\t\tendNodeRecord.setConnection(connection);\r\n\t\t\t\t// add it to open list\r\n\t\t\t\tif(!listContains(open, endNode)){\r\n\t\t\t\t\topen.add(endNodeRecord);\r\n\t\t\t\t}\r\n\t\t\t}// end of for loop for connection\r\n\t\t\topen.remove(current);\r\n\t\t\tclose.add(current);\r\n\t\t}// end of while loop for open list\r\n\t\tif(current.getNode() != goal)\r\n\t\t\treturn null;\r\n\t\telse { //get the path\r\n\t\t\tArrayList<Connection> path = new ArrayList<>();\r\n\t\t\twhile(current.getNode() != start){\r\n\t\t\t\tpath.add(current.getConnection());\r\n\t\t\t\tint newNode = current.getConnection().getFromNode();\r\n\t\t\t\tcurrent = findInList(close, newNode);\r\n\t\t\t}\r\n\t\t\tCollections.reverse(path);\r\n\t\t\treturn path;\r\n\t\t}\r\n\t}", "private String solutionPath(State goal)\n\t{\n\t\t// TODO \n\t\t\n\t\treturn null; \n\t}", "public List<Pair<Integer, Integer>> preparePath(Pair<Integer, Integer> goal) {\n var path = new LinkedList<Pair<Integer, Integer>>();\n path.add(goal);\n var parent = goal.getParent();\n while(parent != null) {\n path.addFirst(parent);\n parent = parent.getParent();\n }\n path.removeLast();\n return path;\n }", "public Path getShortestPath() {\n\t\tNodeRecord startRecord = new NodeRecord(start, null, 0.0f, (float) heuristic.estimate(start), Category.OPEN);\n\n\t\t// Initialize the open list\n\t\tPathFindingList open = new PathFindingList();\n\t\topen.addRecordByEstimatedTotalCost(startRecord);\n\t\trecords.set(Integer.parseInt(startRecord.node.id), startRecord);\n\t\tNodeRecord current = null;\n\t\t\n\t\t// Iterate through processing each node\n\t\twhile (!open.isEmpty()) {\n\t\t\t// Find smallest element in the open list using estimatedTotalCost\n\t\t\tcurrent = open.getSmallestNodeRecordByEstimatedTotalCost();\n\n\t\t\t// If its the goal node, terminate\n\t\t\tif (current.node.equals(end)) break;\n\n\t\t\t// Otherwise get its outgoing connections\n\t\t\tArrayList<DefaultWeightedEdge> connections = g.getConnections(current.node);\n\t\t\t\n\t\t\t// Loop through each connection\n\t\t\tfor (DefaultWeightedEdge connection : connections) {\n\t\t\t\t// Get the cost and other information for end node\n\t\t\t Vertex endNode = g.graph.getEdgeTarget(connection);\n\t\t\t int endNodeRecordIndex = Integer.parseInt(endNode.id);\n NodeRecord endNodeRecord = records.get(endNodeRecordIndex); // this is potentially null but we handle it\n\t\t\t\tdouble newEndNodeCost = current.costSoFar + g.graph.getEdgeWeight(connection);\n\t\t\t\tdouble endNodeHeuristic = 0;\n\t\t\t\t\n\t\t\t\t// if node is closed we may have to skip, or remove it from closed list\t\n\t\t\t\tif( endNodeRecord != null && endNodeRecord.category == Category.CLOSED ){ \n\t\t\t\t\t// Find the record corresponding to the endNode\n\t\t\t\t\tendNodeRecord = records.get(endNodeRecordIndex);\n\n\t\t\t\t\t// If we didn't find a shorter route, skip\n\t\t\t\t\tif (endNodeRecord.costSoFar <= newEndNodeCost) continue;\n\n\t\t\t\t\t// Otherwise remove it from closed list\n\t\t\t\t\trecords.get(endNodeRecordIndex).category = Category.OPEN;\n\n\t\t\t\t\t// Use node's old cost values to calculate its heuristic to save computation\n\t\t\t\t\tendNodeHeuristic = endNodeRecord.estimatedTotalCost - endNodeRecord.costSoFar;\n\n\t\t\t\t// Skip if node is open and we've not found a better route\n\t\t\t\t} else if( endNodeRecord != null && endNodeRecord.category == Category.OPEN ){ \n\t\t\t\t\t// Here we find the record in the open list corresponding to the endNode\n\t\t\t\t\tendNodeRecord = records.get(endNodeRecordIndex);\n\n\t\t\t\t\t// If our route isn't better, skip\n\t\t\t\t\tif (endNodeRecord.costSoFar <= newEndNodeCost) continue;\n\n\t\t\t\t\t// Use the node's old cost values to calculate its heuristic to save computation\n\t\t\t\t\tendNodeHeuristic = endNodeRecord.estimatedTotalCost - endNodeRecord.costSoFar;\n\n\t\t\t\t// Otherwise we know we've got an unvisited node, so make a new record\n\t\t\t\t} else { // if endNodeRecord.category == Category.UNVISITED\n\t\t\t\t endNodeRecord = new NodeRecord();\n\t\t\t\t\tendNodeRecord.node = endNode;\n\t\t\t\t\trecords.set(endNodeRecordIndex, endNodeRecord);\n\n\t\t\t\t\t// Need to calculate heuristic since this is new\n\t\t\t\t\tendNodeHeuristic = heuristic.estimate(endNode);\n\t\t\t\t}\n\t\t\t\t\n\n\t\t\t\t// We're here if we need to update the node\n\t\t\t\t// update the cost, estimate, and connection\n\t\t\t\tendNodeRecord.costSoFar = newEndNodeCost;\n\t\t\t\tendNodeRecord.edge = connection;\n\t\t\t\tendNodeRecord.estimatedTotalCost = newEndNodeCost + endNodeHeuristic;\n\n\t\t\t\t// Add it to the open list\n\t\t\t\tif ( endNodeRecord.category != Category.OPEN ) {\n\t\t\t\t\topen.addRecordByEstimatedTotalCost(endNodeRecord);\n\t\t\t\t\tendNodeRecord.category = Category.OPEN;\n\t\t\t\t\trecords.set(endNodeRecordIndex, endNodeRecord);\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t\n\t\t\t// We’ve finished looking at the connections for\n\t\t\t// the current node, so add it to the closed list\n\t\t\t// and remove it from the open list\n\t\t\topen.removeRecord(current);\n\t\t\tcurrent.category = Category.CLOSED;\n\t\t\trecords.set(Integer.parseInt(current.node.id), current);\n\t\t}\n\t\t\n\t\t// We’re here if we’ve either found the goal, or\n\t\t// if we’ve no more nodes to search, find which.\n\t\tif (!current.node.equals(end)) {\n\t\t\t// Ran out of nodes without finding the goal, no solution\n\t\t\treturn null;\n\t\t} else {\n\t\t // Compile the list of connections in the path\n\t\t\tArrayList<DefaultWeightedEdge> path = new ArrayList<>();\n\n\t\t\twhile (!current.node.equals(start)) {\n\t\t\t\tpath.add(current.edge);\n\t\t\t\t// Set current (NodeRecord) to is source.\n\t\t\t\tcurrent = records.get( Integer.parseInt(g.graph.getEdgeSource(current.edge).id) );\n\t\t\t}\n\n\t\t\t// Reverse the path, and return it\n\t\t\tCollections.reverse(path);\n\t\t\treturn new Path(g, path);\n\t\t}\n\n\t}", "@Override\r\n public Set<List<String>> findAllPaths(int sourceId, int targetId, int reachability) {\r\n //all paths found\r\n Set<List<String>> allPaths = new HashSet<List<String>>();\r\n //collects path in one iteration\r\n Set<List<String>> newPathsCollector = new HashSet<List<String>>();\r\n //same as the solution but with inverted edges\r\n Set<List<String>> tmpPathsToTarget = new HashSet<List<String>>();\r\n //final solution\r\n Set<List<String>> pathsToTarget = new HashSet<List<String>>();\r\n \r\n String[] statementTokens = null; \r\n Set<Integer> allProcessedNodes = new HashSet<Integer>(); //to avoid duplicates\r\n List<String> statementsFound = new ArrayList<String>();\r\n \r\n for (int i = 0; i < reachability; i++) {\r\n if (i == 0) { \r\n Collection<String> inEdges = jungCompleteGraph.getInEdges(sourceId);\r\n for (String inEdge: inEdges) {\r\n \r\n statementsFound = new ArrayList<String>();\r\n statementTokens = inEdge.split(\"->\");\r\n int inNodeId = Integer.parseInt(statementTokens[0]);\r\n //allProcessedNodes.add(inNodeId); \r\n //Incoming nodes are reversed\r\n statementsFound.add(new StringBuilder(inEdge).reverse().toString());\r\n allPaths.add(statementsFound);\r\n if (inNodeId == targetId) tmpPathsToTarget.add(statementsFound);\r\n }\r\n \r\n Collection<String> outEdges = jungCompleteGraph.getOutEdges(sourceId);\r\n \r\n for (String outEdge: outEdges) {\r\n \r\n statementsFound = new ArrayList<String>();\r\n statementTokens = outEdge.split(\"->\");\r\n int outNodeId = Integer.parseInt(statementTokens[2]);\r\n statementsFound.add(outEdge);\r\n allPaths.add(statementsFound);\r\n if (outNodeId == targetId) tmpPathsToTarget.add(statementsFound);\r\n \r\n }\r\n \r\n } else {\r\n newPathsCollector = new HashSet<List<String>>();\r\n\r\n for (List<String> statements: allPaths) {\r\n allProcessedNodes = new HashSet<Integer>(); //to avoid duplicates\r\n int lastNodeInPath = 0;\r\n \r\n for (String predicate: statements) {\r\n if (predicate.contains(\">-\")) {\r\n statementTokens = predicate.split(\">-\");\r\n allProcessedNodes.add(Integer.parseInt(\r\n new StringBuilder(statementTokens[0]).reverse().toString()));\r\n allProcessedNodes.add(Integer.parseInt(\r\n new StringBuilder(statementTokens[2]).reverse().toString()));\r\n lastNodeInPath = Integer.parseInt(\r\n new StringBuilder(statementTokens[2]).reverse().toString());\r\n } else {\r\n statementTokens = predicate.split(\"->\"); \r\n allProcessedNodes.add(Integer.parseInt(statementTokens[0]));\r\n allProcessedNodes.add(Integer.parseInt(statementTokens[2]));\r\n lastNodeInPath = Integer.parseInt(statementTokens[2]);\r\n }\r\n }\r\n \r\n Collection<String> inEdges = jungCompleteGraph.getInEdges(lastNodeInPath);\r\n for (String inEdge: inEdges) {\r\n \r\n statementsFound = new ArrayList<String>();\r\n statementsFound.addAll(statements);\r\n statementTokens = inEdge.split(\"->\");\r\n int inNodeId = Integer.parseInt(statementTokens[0]);\r\n if (allProcessedNodes.contains(inNodeId)) continue;\r\n \r\n //Incoming nodes are reversed \r\n statementsFound.add(new StringBuilder(inEdge).reverse().toString());\r\n newPathsCollector.add(statementsFound);\r\n if (inNodeId == targetId) tmpPathsToTarget.add(statementsFound);\r\n \r\n }\r\n \r\n Collection<String> outEdges = jungCompleteGraph.getOutEdges(lastNodeInPath);\r\n for (String outEdge: outEdges) {\r\n \r\n statementsFound = new ArrayList<String>();\r\n statementsFound.addAll(statements);\r\n statementTokens = outEdge.split(\"->\");\r\n int outNodeId = Integer.parseInt(statementTokens[2]);\r\n if (allProcessedNodes.contains(outNodeId)) continue;\r\n \r\n //Incoming nodes are reversed \r\n statementsFound.add(outEdge);\r\n newPathsCollector.add(statementsFound);\r\n if (outNodeId == targetId) tmpPathsToTarget.add(statementsFound);\r\n }\r\n }\r\n allPaths.addAll(newPathsCollector);\r\n }\r\n \r\n //System.out.println(\"*****End of iteration \" + i);\r\n //System.out.println(\"#SIZE OF allPaths: \" + allPaths.size());\r\n int numItems = 0;\r\n for (List<String> currList: allPaths) {\r\n numItems = numItems + currList.size();\r\n }\r\n //System.out.println(\"#NUMBER OF ELEMS OF ALL LISTS: \" + numItems);\r\n //System.out.println(\"#SIZE OF tmpPathsToTarget : \" + tmpPathsToTarget.size());\r\n }\r\n \r\n //We need to reverse back all the predicates\r\n for (List<String> statements: tmpPathsToTarget) { \r\n List<String> fixedStatements = new ArrayList<String>(); \r\n for (int i = 0; i < statements.size(); i++) { \r\n String statement = statements.get(i); \r\n if (statement.contains(\">-\")) {\r\n fixedStatements.add(new StringBuilder(statement).reverse().toString());\r\n } else {\r\n fixedStatements.add(statement);\r\n } \r\n }\r\n pathsToTarget.add(fixedStatements);\r\n }\r\n return pathsToTarget;\r\n }", "private void printPath(int currentVertex, int[] parents) {\n // Base case : Source node has been processed \n if (currentVertex == NO_PARENT) {\n return;\n }\n printPath(parents[currentVertex], parents);\n System.out.print(currentVertex + \" \");\n }", "ArrayList<Node> DFSIter( Graph graph, final Node start, final Node end)\n {\n boolean visited[] = new boolean[graph.numNodes];\n Stack<Node> stack = new Stack<Node>();\n Map< Node,Node> parentPath = new HashMap< Node,Node>(); \n stack.push(start);\n\n while ( !stack.isEmpty() )\n {\n Node currNode = stack.pop();\n // end loop when goal node is found\n if ( currNode == end )\n break;\n // If node has already been visited, skip it\n if ( visited[currNode.id] )\n continue;\n else\n {\n visited[currNode.id] = true;\n int numEdges = currNode.connectedNodes.size();\n\n for ( int i = 0; i < numEdges; i++ )\n {\n Node edgeNode = currNode.connectedNodes.get(i);\n if ( !visited[edgeNode.id] )\n {\n stack.push( edgeNode );\n parentPath.put( edgeNode, currNode);\n }\n }\n \n }\n }\n\n ArrayList<Node> path = new ArrayList<Node>();\n Node currNode = end;\n while ( currNode != null )\n {\n path.add(0, currNode);\n currNode = parentPath.get(currNode);\n }\n\n return path;\n }", "private LinkedList<Node> backtraceFromGoal(Node Target, Node Start) {\n LinkedList<Node> pathList = new LinkedList<>();\n\n pathList.add(Target);\n Node currentNode = null;\n /*ЕСЛИ финишная ячейка помечена\n ТО\n перейти в финишную ячейку\n ЦИКЛ\n выбрать среди соседних ячейку, помеченную числом на 1 меньше числа в текущей ячейке\n перейти в выбранную ячейку и добавить её к пути\n ПОКА текущая ячейка — не стартовая\n ВОЗВРАТ путь найден\n ИНАЧЕ\n ВОЗВРАТ путь не найден*/\n\n\n return pathList;\n }", "public List<node_info> shortestPath(int src, int dest);", "public Stack<Point> shortestPath() {\n\t\tresetVisited();\n\t\tStack <Point> shortestPath = new Stack<Point>();\n\t\tprev = new HashMap<Point,Point>();\n\t\tCompass[] direction = Compass.values();\n\t\tQueue <Point> path = new LinkedList<Point>();\n\t\tpath.add(playerStart);\n\t\twhile(!path.isEmpty()) {\n\t\t\tPoint current = path.poll();\n\t\t\tfor (Compass pointing: direction) {\n\t\t\t\tif (current.equals(goal)) {\n\t\t\t\t\tshortestPath.push(current);\n\t\t\t\t\twhile (prev.containsKey(shortestPath.peek()) && !shortestPath.peek().equals(playerStart)){\n\t\t\t\t\t\tshortestPath.push(prev.get(shortestPath.peek()));\n\t\t\t\t\t}\n\t\t\t\t\treturn shortestPath;\n\t\t\t\t}\n\t\t\t\tint nextW = (int)current.getX() + pointing.mapX;\n\t\t\t\tint nextH = (int)current.getY() + pointing.mapY;\n\t\t\t\tPoint nextPoint = new Point(nextW, nextH);\n\t\t\t\tif (arrayBounds(nextW, width) && arrayBounds (nextH, height) && maze[nextW][nextH] == 0 && !visited.contains(nextPoint)) {\n\t\t\t\t\tpath.add(nextPoint);\n\t\t\t\t\tvisited.add(nextPoint);\n\t\t\t\t\tprev.put(nextPoint, current);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn shortestPath;\t\t\n\t}", "public void shortestPathList() {\n Cell cell = maze.getGrid()[r - 1][r - 1];\n\n parents.add(cell);\n\n while (cell.getParent() != null) {\n parents.add(cell.getParent());\n cell = cell.getParent();\n }\n\n Collections.reverse(parents);\n }", "private void printSolution(int startVertex, double[] distances, int[] parents) {\n int nVertices = distances.length;\n System.out.print(\"Vertex\\t Distance\\tPath\");\n\n for (int vertexIndex = 0; vertexIndex < nVertices; vertexIndex++) {\n if (vertexIndex != startVertex) {\n System.out.print(\"\\n\" + startVertex + \" -> \");\n System.out.print(vertexIndex + \" \\t\\t \");\n System.out.print(distances[vertexIndex] + \"\\t\\t\");\n printPath(vertexIndex, parents);\n }\n }\n }", "private List<Pair<Integer, Integer>> getBestPath(Pair<Integer, Integer> curLocation, Pair<Integer, Integer> dest) {\n\t\tList<Pair<Integer, Integer>> path = new LinkedList<Pair<Integer, Integer>>();\n\t\t\n\t\t\n\t\tNode current = new Node(curLocation.getX(), curLocation.getY(), getHitProbability(curLocation.getX(), curLocation.getY()));\n\t\tNode target = new Node(dest.getX(), dest.getY(), getHitProbability(dest.getX(), dest.getY()));\n\t\tList<Node> openSet = new ArrayList<>();\n List<Node> closedSet = new ArrayList<>();\n \n \n while (true) {\n openSet.remove(current);\n List<Node> adjacent = getAdjacentNodes(current, closedSet, target);\n\n // Find the adjacent node with the lowest heuristic cost.\n for (Node neighbor : adjacent) {\n \tboolean inOpenset = false;\n \tList<Node> openSetCopy = new ArrayList<>(openSet);\n \tfor (Node node : openSetCopy) {\n \t\tif (neighbor.equals(node)) {\n \t\t\tinOpenset = true;\n \t\t\tif (neighbor.getAccumulatedCost() < node.getAccumulatedCost()) {\n \t\t\t\topenSet.remove(node);\n \t\t\t\topenSet.add(neighbor);\n \t\t\t}\n \t\t}\n \t}\n \t\n \tif (!inOpenset) {\n \t\topenSet.add(neighbor);\n \t}\n }\n\n // Exit search if done.\n if (openSet.isEmpty()) {\n System.out.printf(\"Target (%d, %d) is unreachable from position (%d, %d).\\n\",\n target.getX(), target.getY(), curLocation.getX(), curLocation.getY());\n return null;\n } else if (/*isAdjacent(current, target)*/ current.equals(target)) {\n break;\n }\n\n // This node has been explored now.\n closedSet.add(current);\n\n // Find the next open node with the lowest cost.\n Node next = openSet.get(0);\n for (Node node : openSet) {\n if (node.getCost(target) < next.getCost(target)) {\n next = node;\n }\n }\n// System.out.println(\"Moving to node: \" + current);\n current = next;\n }\n \n // Rebuild the path using the node parents\n path.add(new Pair<Integer, Integer>(curLocation.getX(), curLocation.getY()));\n while(current.getParent() != null) {\n \tcurrent = current.getParent();\n \tpath.add(0, new Pair<Integer, Integer>(current.getX(), current.getY()));\n }\n \n if (path.size() > 1) {\n \tpath.remove(0);\n }\n \n\t\treturn path;\n\t}", "@Override\n public List<node_data> shortestPath(int src, int dest) {\n reset();\n for (node_data node : G.getV()) {\n node.setWeight(Double.POSITIVE_INFINITY);\n }\n\n DWGraph_DS.Node currentNode = (DWGraph_DS.Node) G.getNode(src);\n currentNode.setWeight(0);\n PriorityQueue<node_data> unvisitedNodes = new PriorityQueue(G.nodeSize(), weightComperator);\n unvisitedNodes.addAll(G.getV());\n HashMap<Integer, node_data> parent = new HashMap<>();\n parent.put(src, null);\n\n while (currentNode.getWeight() != Double.POSITIVE_INFINITY) {\n if (G.getNode(dest).getTag() == 1) {\n break;\n }\n for (edge_data edge : G.getE(currentNode.getKey())) {\n DWGraph_DS.Node neighbor = (DWGraph_DS.Node) G.getNode(edge.getDest());\n double tmpWeight = currentNode.getWeight() + edge.getWeight();\n if (tmpWeight < neighbor.getWeight()) {\n neighbor.setWeight(tmpWeight);\n unvisitedNodes.remove(neighbor);\n unvisitedNodes.add(neighbor);\n parent.put(neighbor.getKey(), currentNode);\n }\n }\n currentNode.setTag(1);\n if(currentNode.getKey()==dest) break;\n unvisitedNodes.remove(currentNode);\n currentNode = (DWGraph_DS.Node) unvisitedNodes.poll();\n }\n /*\n Rebuild the path list\n */\n if (!parent.keySet().contains(dest)) return null;\n List<node_data> pathList = new ArrayList<>();\n currentNode = (DWGraph_DS.Node) G.getNode(dest);\n while (parent.get(currentNode.getKey()) != null) {\n pathList.add(currentNode);\n currentNode = (DWGraph_DS.Node) parent.get(currentNode.getKey());\n }\n Collections.reverse(pathList);\n return pathList;\n }", "public List<Node> find(Node start, Node finish){\n reachable.add(start);\n this.finish = finish;\n\n while(!reachable.isEmpty()){\n // Select a node from the reachable list\n // If we've reached the end, return the list of nodes in our path\n \n Node node = selectNode(reachable);\n if(node.isEqual(finish)){\n return getPath(node);\n }\n\n // Otherwise, remove the new node from the reachable list, and add it to the \n // visited list so we don't look at a node more than necessary. Build a list of the\n // nodes that are adjacent to our current node.\n \n reachable.remove(node);\n visited.add(node);\n List<Node> adjacent = getAdjacent(node);\n\n // If the current node has adjacent nodes, and if we haven't looked at those nodes before,\n // add those nodes to the reachable list. If the node's cost is lower than 1+the cost to reach it,\n // make the node's parent the previous node and set the cost\n if(!adjacent.isEmpty()) {\n for (Node n : adjacent) {\n if (!reachable.contains(n)&&!visited.contains(n)) {\n reachable.add(n);\n }\n if (node.getCostEstimated() + 1 <= n.getCostEstimated()) {\n n.setParent(node);\n n.setCostEstimated(node.getCostEstimated() + 1);\n }\n }\n }\n }\n return null;\n }", "private void computePath(){\n LinkedStack<T> reversePath = new LinkedStack<T>();\n // adding end vertex to reversePath\n T current = end; // first node is the end one\n while (!current.equals(start)){\n reversePath.push(current); // adding current to path\n current = closestPredecessor[vertexIndex(current)]; // changing to closest predecessor to current\n }\n reversePath.push(current); // adding the start vertex\n \n while (!reversePath.isEmpty()){\n path.enqueue(reversePath.pop());\n }\n }", "public List<Node> findPath(Node start);", "public String getShortestPath(int goal) throws Throwable {\n if (goal < 0) {\n return \"There is no path\";\n }\n Queue<Integer> stack = new Queue<>(new Integer[10]); \n int previous = path[goal];\n if (previous == -1) {\n return \"There is no path\";\n }\n while (previous != 0) {\n stack.push(previous);\n previous = path[previous];\n }\n String ret = \"0 > \";\n while (!stack.isEmpty()) {\n ret = ret + (stack.poll() + \" > \");\n }\n return \"\" + ret + goal;\n }", "private void computeShortestPath(){\n T current = start;\n boolean atEnd = false;\n while (!unvisited.isEmpty()&& !atEnd){\n int currentIndex = vertexIndex(current);\n LinkedList<T> neighbors = getUnvisitedNeighbors(current); // getting unvisited neighbors\n \n //what is this doing here???\n if (neighbors.isEmpty()){\n \n }\n \n // looping through to find distances from start to neighbors\n for (T neighbor : neighbors){ \n int neighborIndex = vertexIndex(neighbor); \n int d = distances[currentIndex] + getEdgeWeight(current, neighbor);\n \n if (d < distances[neighborIndex]){ // if this distance is less than previous distance\n distances[neighborIndex] = d;\n closestPredecessor[neighborIndex] = current; // now closest predecessor is current\n }\n }\n \n if (current.equals(end)){\n atEnd = true;\n }\n else{\n // finding unvisited node that is closest to start node\n T min = getMinUnvisited();\n if (min != null){\n unvisited.remove(min); // remove minimum neighbor from unvisited\n visited.add(min); // add minimum neighbor to visited\n current = min;\n }\n }\n }\n computePath();\n totalDistance = distances[vertexIndex(end)];\n }", "void print_path(int[]parent,int[]dist,int s)\n {\n System.out.println(); \n \n //path from s to all other vertices\n \n for(int i=0;i<parent.length;i++)\n {\n System.out.println(\"From \"+s+\" to \"+i);\n System.out.print(\"path: \");\n print_node(parent,i);\n System.out.print(\"END\");\n if(dist[i]==INF)\n System.out.println(\" cost=INF\"); \n else\n System.out.println(\" cost=\"+dist[i]);\n\n }\n \n \n System.out.println();\n \n\n \n }", "public Iterable<Board> solution()\n {\n Stack<Board> solution = new Stack<Board>();\n \n // for case where initial board is goal board\n if (moves == 0) {\n solution.push(goalNode.board);\n return solution;\n }\n\n step = goalNode;\n \n // add chain of previous node from goal node \n while (step != null) {\n solution.push(step.board);\n step = step.prev;\n }\n \n return solution;\n }", "public Iterator<Node> findPath() throws GraphException{\n\t\t\n\t\t// create a start and end node\n\t\tNode begin = this.graph.getNode(this.start);\n\t\tNode finish = this.graph.getNode(this.end);\n\t\t// check to make sure a path exits between these nodes\n\t\tboolean test = findPath(begin, finish);\n\t\tif(test){\n\t\t\t// reset the variables of the map that were changed by invoking the findPath helper method\n\t\t\tthis.testLine = \"Luka<3<3\";\n\t\t\tthis.changeCount = -1;\n\t\t\t//return the iterator over the Stack of the Map that was modified by the findPath helper method\n\t\t\treturn this.S.iterator();\n\t\t}\n\t\t// return null if a path does not exist\n\t\treturn null;\n\t}", "public void printPath() {\n System.out.print(\"Path: \");\n for (int i = 0; i < parents.size(); i++) {\n Cell cell = parents.get(i);\n System.out.print(\" (\" + cell.x + \",\" + cell.y + \") \");\n }\n System.out.println(\"\\nVisited cells: \" + visitedCells);\n System.out.println(\"Length of Path: \" + parents.size());\n }", "public void shortestPathsNodes() {\n for (int sourceNode = 0; sourceNode < wordGraph.V(); sourceNode++) {\n BreadthFirstDirectedPaths bfs = new BreadthFirstDirectedPaths(wordGraph, sourceNode);\n\n for (int goalNode = 0; goalNode < wordGraph.V(); goalNode++) {\n Iterable<Integer> shortestPath = bfs.pathTo(goalNode);\n int pathLength = -1;\n if (shortestPath != null) {\n for (int edge : shortestPath) {\n pathLength++;\n }\n }\n if (pathLength != -1) {\n }\n System.out.println(pathLength);\n }\n }\n }", "public static List<CampusGraph.Edges<String, String>> findPath(CampusGraph<String, String> cg, String start, String destination) {\n if (cg == null || start == null || destination == null) {\n throw new IllegalArgumentException();\n }\n Queue<String> visitedNodes = new LinkedList<>();\n Map<String, List<CampusGraph.Edges<String, String>>> paths = new HashMap<>();\n visitedNodes.add(start); // Add start to Q\n paths.put(start, new LinkedList<>()); // Add start->[] to M (start mapped to an empty list)\n\n while (!visitedNodes.isEmpty()) {\n String currentNode = visitedNodes.remove();\n if (currentNode.equals(destination)) { // found the path\n return paths.get(currentNode);\n } else {\n List<CampusGraph.Edges<String, String>> neighbors = cg.getAllChildren(currentNode);\n neighbors.sort(new Comparator<CampusGraph.Edges<String, String>>() {\n @Override\n public int compare(CampusGraph.Edges<String, String> o1, CampusGraph.Edges<String, String> o2) {\n int cmpEndNode = o1.getEndTag().compareTo(o2.getEndTag());\n if (cmpEndNode == 0) {\n return o1.getEdgeLabel().compareTo(o2.getEdgeLabel());\n }\n return cmpEndNode;\n }\n }); // ascending list. Sort characters and books names all at once??\n\n for (CampusGraph.Edges<String, String> e: neighbors) {\n String neighbor = e.getEndTag();\n if (!paths.containsKey(neighbor)) { // i.e. if the neighbor is unvisited\n List<CampusGraph.Edges<String, String>> pathCopy = new LinkedList<>(paths.get(currentNode));\n pathCopy.add(e);\n paths.put(neighbor, pathCopy); // add the path exclusive to this neighbor\n visitedNodes.add(neighbor); // then, mark the neighbor as visited\n }\n }\n }\n }\n return null; // No destination found\n }", "protected LinkedList<IVertex<String>> getPath(IVertex<String> target) {\n\n LinkedList<IVertex<String>> path = new LinkedList<IVertex<String>>();\n\n IVertex<String> step = target;\n\n // check if a path exists\n if (predecessors.get(step) == null) {\n return null;\n }\n path.add(step);\n while (predecessors.get(step) != null) {\n step = predecessors.get(step);\n path.add(step);\n }\n // Put it into the correct order\n Collections.reverse(path);\n return path;\n }", "private Queue<Position> pathToClosest(MyAgentState state, Position start, int goal) {\n\t\tQueue<Position> frontier = new LinkedList<Position>();\n\t\tSet<String> enqueued = new HashSet<String>();\n\t\tMap<Position, Position> preceedes = new HashMap<Position, Position>();\n\t\tfrontier.add(start);\n\t\tenqueued.add(start.toString());\n\n\t\twhile (!frontier.isEmpty()) {\n\t\t\tPosition pos = frontier.remove();\n\t\t\tif (state.getTileData(pos) == goal) {\n\t\t\t\treturn toQueue(preceedes, pos, start);\n\t\t\t}\n\t\t\t\n\t\t\tfor (Position neighbour : pos.neighbours()) {\n\t\t\t\tif (!enqueued.contains(neighbour.toString()) && state.getTileData(neighbour) != state.WALL) {\n\t\t\t\t\tpreceedes.put(neighbour, pos);\n\t\t\t\t\tfrontier.add(neighbour);\n\t\t\t\t\tenqueued.add(neighbour.toString());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "@Nullable\n public VertexPath<V> findAnyVertexPath(@Nonnull DirectedGraph<V, A> graph,\n V start, V goal) {\n Deque<V> vertices = new ArrayDeque<>();\n BackLinkWithArrow<V, A> current = breadthFirstSearch(graph, start, goal);\n if (current == null) {\n return null;\n }\n for (BackLinkWithArrow<V, A> i = current; i != null; i = i.parent) {\n vertices.addFirst(i.vertex);\n }\n return new VertexPath<>(vertices);\n }", "private static boolean getPath(int startRow, int startColumn, String[][] Map, String outputFile, String inputFile) {\n\t\tQueue<Node> q = new LinkedList<Node>();\t\t\t\t\r\n\t\t\r\n\t\t//Sets the Start Node Row and Column values.\r\n\t\tNode Start = new Node(startRow + \" \" + startColumn);\r\n\t\tStart.column = startColumn;\r\n\t\tStart.row = startRow;\r\n\t\t\r\n\t\t//This is the up, left, right, and down coordinates for searching neighboring items.\r\n\t\tint[]dx = {0, 0, -1, 1};\r\n\t\tint[]dy = {-1, 1, 0, 0};\r\n\t\t\r\n\r\n\t\t//Adds the Start Node to the Queue.\r\n\t\tq.add(Start);\r\n\t\twhile(q.size() > 0)\r\n\t\t{\r\n\t\t\t//This takes the first item in the Queue for comparing and looking at its neighbors.\r\n\t\t\tNode x = q.poll();\r\n\t\t\t\r\n\t\t\tif(x.visited != 1)\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t//If the current node is the Goal, then it retraces it's steps (cameFrom) and prints out the path onto the 2d array named Map.\r\n\t\t\tif (Map[x.row][x.column].compareTo(\"G\") == 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\twhile (x.cameFrom != null)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif (Map[x.row][x.column].compareTo(\"G\") != 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\tMap[x.row][x.column] = \".\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tx = x.cameFrom;\r\n\t\t\t\t\t}\t\t\t\t\t\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\t//Here is where it writes the solution and maze to a text file.\r\n\t\t\t\t\t\tFile file = new File(outputFile);\r\n\r\n\t\t\t\t\t\tif (!file.exists()) {\r\n\t\t\t\t\t\t\tfile.createNewFile();\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tFileWriter fw = new FileWriter(file.getAbsoluteFile());\r\n\t\t\t\t\t\tBufferedWriter bw = new BufferedWriter(fw);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tFile text = new File(inputFile);\r\n\t\t\t\t\t\tScanner rowColumn;\r\n\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\trowColumn = new Scanner(text);\r\n\t\t\t\t\t\t\tString row = rowColumn.next();\r\n\t\t\t\t\t\t\tString row2 = rowColumn.next();\r\n\t\t\t\t\t\t\tbw.write(row + \" \" + row2 + \"\\n\");\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t} catch (FileNotFoundException e) {\r\n\t\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t\t\t}\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tfor(int i = 0; i < Map.length; i++)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tfor(int j = 0; j < Map[0].length; j++)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tbw.write(Map[i][j]);\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tbw.write(\"\\n\");\r\n\t\t\t\t\t\t}\t\t\t\t\t\t\r\n\t\t\t\t\t\tbw.close();\r\n\r\n\t\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\r\n\t\t\t//This checks the up, left, right, and down values of the current Node.\r\n\t\t\tfor(int i = 0; i < 4; i++)\r\n\t\t\t{\r\n\t\t\t\tint yy = x.row + dx[i];\r\n\t\t\t\tint xx = x.column + dy[i];\r\n\t\t\t\r\n\t\t\t\tif(xx >= 1 && yy >= 1)\r\n\t\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\t\tif(Map[yy][xx].compareTo(\" \") == 0 && Map[yy][xx].compareTo(\"X\") != 0 && (x.visited != 1) || Map[yy][xx].compareTo(\"G\") == 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tboolean on = true;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t//This checks the Queue and makes sure the current item isn't in there. \r\n\t\t\t\t\t\t//If it is, then it turns off the switch. \r\n\t\t\t\t\t\tfor(Node I: q)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\tif (I.column == xx && I.row == yy)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\ton = false;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (on == true)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t//If a node hasn't been looked at yet, it creates a node for it and adds it to the Queue. \r\n\t\t\t\t\t\tNode Neighbor = new Node(yy + \" \" + xx);\r\n\t\t\t\t\t\tNeighbor.column = xx;\r\n\t\t\t\t\t\tNeighbor.row = yy;\r\n\t\t\t\t\t\tNeighbor.cameFrom = x;\r\n\t\t\t\t\t\tq.add(Neighbor);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t//Turns the switch back on after the ForEach loop\r\n\t\t\t\t\t\ton = true;\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t\t\t\r\n\t\t\t//Here is where I'm trying to check if all the Nodes in the Queue have been visited,\r\n\t\t\t//If so, then it will return false because there is no path. Not currently working though. \r\n\t\t\tx.visited = 1;\r\n\t\t\tint counter = 0;\r\n\t\t\tfor(Node temp: q)\r\n\t\t\t{\r\n\t\t\t\tif (temp.visited == 1)\r\n\t\t\t\t\t{\r\n\t\t\t\t\tcounter++;\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\tif (q.size() == counter)\r\n\t\t\t\t\t{\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t\t}\r\n\t\t\t}\r\n\t}\t\t\r\n\t\treturn false;\r\n\t}", "private HashMap<String, Integer> getShortestPathBetweenDifferentNodes(Node start, Node end) {\n HashMap<Node, Node> parentChildMap = new HashMap<>();\n parentChildMap.put(start, null);\n\n // Shortest path between nodes\n HashMap<Node, Integer> shortestPathMap = new HashMap<>();\n\n for (Node node : getNodes()) {\n if (node == start)\n shortestPathMap.put(start, 0);\n else shortestPathMap.put(node, Integer.MAX_VALUE);\n }\n\n for (Edge edge : start.getEdges()) {\n shortestPathMap.put(edge.getDestination(), edge.getWeight());\n parentChildMap.put(edge.getDestination(), start);\n }\n\n while (true) {\n Node currentNode = closestUnvisitedNeighbour(shortestPathMap);\n\n if (currentNode == null) {\n return null;\n }\n\n // Save path to nearest unvisited node\n if (currentNode == end) {\n Node child = end;\n String path = end.getName();\n while (true) {\n Node parent = parentChildMap.get(child);\n if (parent == null) {\n break;\n }\n\n // Create path using previous(parent) and current(child) node\n path = parent.getName() + \"\" + path;\n child = parent;\n }\n HashMap<String,Integer> hm= new HashMap<>();\n hm.put(path, shortestPathMap.get(end));\n return hm;\n }\n currentNode.visit();\n\n // Go trough edges and find nearest\n for (Edge edge : currentNode.getEdges()) {\n if (edge.getDestination().isVisited())\n continue;\n\n if (shortestPathMap.get(currentNode) + edge.getWeight() < shortestPathMap.get(edge.getDestination())) {\n shortestPathMap.put(edge.getDestination(), shortestPathMap.get(currentNode) + edge.getWeight());\n parentChildMap.put(edge.getDestination(), currentNode);\n }\n }\n }\n }", "private void findPath(int current){\r\n // remove current from OPEN\r\n int index = insideArray(_openSet,current);\r\n if(index == -1){\r\n System.out.println(\"findPath method returns -1.\");\r\n }\r\n _openSet.remove(index);\r\n\r\n // add current to CLOSED\r\n _closedSet.add(current);\r\n\r\n // if current is the target node\r\n if(current == _endIndex){\r\n return;\r\n }\r\n\r\n int neighborNum = _map.get_grid(current).get_neighborNum();\r\n int[] neighbors = _map.get_grid(current).get_neighbors();\r\n\r\n //for each neighbor of the current node\r\n for(int i=0;i<neighborNum;i++){\r\n Grid neighborGrid = _map.get_grid(neighbors[i]);\r\n // if neighbor is not traversable or neighbor is in CLOSED\r\n // SKIP THIS NEIGHBOR\r\n if(!neighborGrid.get_type().equals(\"|\") && insideArray(_closedSet,neighbors[i]) == -1){\r\n int currentNeighborF = neighborGrid.get_Fnum();\r\n int neighborF = findF(neighbors[i]);\r\n if(neighborF < currentNeighborF || insideArray(_closedSet,neighbors[i]) == -1){\r\n neighborGrid.set_Fnum(neighborF);\r\n neighborGrid.set_parent(current);\r\n if(insideArray(_closedSet,neighbors[i]) == -1){\r\n _openSet.add(neighbors[i]);\r\n }\r\n }\r\n }\r\n }\r\n int currentIndex = smallestF();\r\n // RECURSIVE CALL\r\n findPath(_map.get_grid(_openSet.get(currentIndex)).get_index());\r\n }", "private List<Edge<T>> getPath(T target) {\n List<Edge<T>> path = new LinkedList<>();\n T step = target;\n // check if a path exists\n if (predecessors.get(step) == null) {\n return path;\n }\n while (predecessors.get(step) != null) {\n T endVertex = step;\n step = predecessors.get(step);\n T startVertex = step;\n path.add(getEdge(startVertex, endVertex));\n }\n // Put it into the correct order\n Collections.reverse(path);\n return path;\n }", "public LinkedList<GraphNode> getPath(GraphNode startNode, GraphNode goalNode, boolean useStairs) throws PathNotFoundException {\n return currentPathingAlgorithm.findPath(startNode, goalNode, useStairs);\n }", "public void printShortestPath() {\n Cell[][] grid = maze.getGrid();\n\n for (int i = 0; i <= r; i++) {\n // Rows: This loop needs to iterate r times since there are r rows\n for (int j = 0; j < r; j++) {\n Cell currentCell;\n if (i == r) { // If it is on the last row, print the bottom row of the cells\n currentCell = grid[i - 1][j];\n System.out.print(currentCell.bottomRow());\n } else { // If it's not on the last row, print the top row of the cells\n currentCell = grid[i][j];\n System.out.print(currentCell.topRow());\n }\n }\n System.out.print(\"+\");\n System.out.println();\n\n // This loop only needs to iterate r-1 times since there is only r-1 \"|\" rows\n if (i != r) {\n for (int k = 0; k < r; k++) {\n Cell currentCell = grid[i][k];\n if ((i == 0 && k == 0))\n System.out.print(currentCell.zeroDistanceColumn2());\n else if (parents.contains(currentCell))\n System.out.print(currentCell.zeroDistanceColumn2());\n else\n System.out.print(currentCell.distanceColumn2());\n }\n System.out.print(\"|\");\n System.out.println();\n }\n }\n }", "public List<Node> getShortestPathToDestination(Node destination) {\n List<Node> path = new ArrayList<Node>();\n\n\n\n for (Node node = destination; node != null; node = node.previous){\n Log.i(\"bbb\", \"get path \"+node._waypointName);\n path.add(node);\n }\n\n // reverse path to get correct order\n Collections.reverse(path);\n return path;\n }", "private void goForSolution(MinPQ<Node> hq) {\n\t\tNode current = hq.delMin();\n\t\tif (current.board.isGoal()) {\n\t\t\tif (hq == orig) {\n\t\t\t\tresult = new ArrayList<>();\n\t\t\t\twhile (current != null) {\n\t\t\t\t\tresult.add(0, current.board);\n\t\t\t\t\tcurrent = current.parent;\n\t\t\t\t}\n\t\t\t}\n\t\t\tsolved = true;\n\t\t\treturn;\n\t\t}\n\n\t\tfor (Board neighbour : current.board.neighbors()) {\n\t\t\tif (current.parent == null || !neighbour.equals(current.parent.board)) {\n\t\t\t\thq.insert(new Node(neighbour, current.moves + 1, current));\n\t\t\t}\n\t\t}\n\t}", "private static void findShortestPath(ArrayList<WeightedEdge> edges, int start, int dest, int nNodes) {\n int costs[] = new int[nNodes];\n int parents[] = new int[nNodes];\n boolean doneWithNode[] = new boolean[nNodes];\n\n // cost[i] has the cost of getting to node number i or is UNKNOWN if no cost figure out yet.\n // parent[i] contains the parent (or the way) we got to node i.\n // done[i] is true if we've already worked on all the children of node i.\n\n // Initialize the arrays.\n for (int i = 0; i<nNodes; i++) {\n costs[i] = UNKNOWN;\n parents[i] = UNKNOWN;\n doneWithNode[i] = false;\n }\n\n int node = start; // This is the node we are working on. Let's start with start node.\n costs[node] = 0; // The cost of getting to the start node is 0!\n\n // While not done processing all the nodes...\n\n // Loop through all the edges (edges array list).\n // Skip those edges whose source is doesn't match the node we're working on.\n\n // For edge (that has source of current node) figure out potential to\n // get it. (How much does it cost to get to node we're on? Add to\n // that the cost of the edge. That's the new price to set to dest of edge.\n\n // Is that a new low cost for that dest edge node?\n // Or is the dest edge node cost currently UNKNOWN? That means we have no cost.\n // If so, store the cost. Store the parent.\n\n // Once done with all the edges, mark the current node as\n // done being processed.\n doneWithNode[node] = true;\n\n // Get next node to work on.\n node = getLowestCostUnprocessedNode(costs, doneWithNode);\n\n // Done with while loop\n\n for (int i=0; i<parents.length; i++) {\n System.out.println(\"Node: \" + i + \" Cost: \" + costs[i] + \" Backtrace Parent: \" + parents[i]);\n }\n\n backtrace(dest, parents);\n }", "private PathCostFlow findCheapestPath(int start, int end, double max_flow) throws Exception {\n if (getNode(start) == null || getNode(end) == null\n || !getNode(start).isSource() || getNode(end).isSource()) {\n throw new IllegalArgumentException(\"start must be the index of a source and end must be the index of a sink\");\n }\n double amount = Math.min(Math.min(getNode(start).getResidualCapacity(),\n getNode(end).getResidualCapacity()), max_flow);\n\n boolean[] visited = new boolean[n];\n int[] parent = new int[n];\n for (int i = 0; i < n; i++) {\n parent[i] = -1;\n }\n double[] cost = new double[n];\n for (int i = 0; i < n; i++) {\n cost[i] = Integer.MAX_VALUE;\n }\n cost[start] = 0;\n\n PriorityQueue<IndexCostTuple> queue = new PriorityQueue<IndexCostTuple>();\n queue.add(new IndexCostTuple(start, 0));\n\n while (!queue.isEmpty()) {\n IndexCostTuple current = queue.poll();\n\n // we found the target node\n if (current.getIndex() == end) {\n ArrayList<Integer> path = new ArrayList<Integer>();\n path.add(new Integer(end));\n while (path.get(path.size() - 1) != start) {\n path.add(parent[path.get(path.size() - 1)]);\n }\n Collections.reverse(path);\n if ((path.get(0) != start) || (path.get(path.size() - 1) != end)) {\n throw new Exception(\"I fucked up coding Dijkstra's\");\n }\n return new PathCostFlow(path, cost[end], amount);\n }\n\n // iterate through all possible neighbors of the current node\n for (int i = 0; i < n; i++) {\n SingleEdge e = matrix[current.getIndex()][i];\n if ((!visited[i]) && (e != null)\n && (current.getCost() + e.getCost(amount) < cost[i])) {\n cost[i] = current.getCost() + e.getCost(amount);\n parent[i] = current.getIndex();\n\n // update the entry for this node in the queue\n IndexCostTuple newCost = new IndexCostTuple(i, cost[i]);\n queue.remove(newCost);\n queue.add(newCost);\n }\n }\n visited[current.getIndex()] = true;\n }\n\n return null; //the target node was unreachable\n }", "private List<Node> getIntermediatePath(final Node source, final Node target) {\n if (P[source.id][target.id] == null) {\n return new ArrayList<Node>();\n }\n final List<Node> path = new ArrayList<Node>();\n path.addAll(getIntermediatePath(source, P[source.id][target.id]));\n path.add(P[source.id][target.id]);\n path.addAll(getIntermediatePath(P[source.id][target.id], target));\n return path;\n }", "public Square[] buildPath(GameBoard board, Player player) {\n\n // flag to check if we hit a goal location\n boolean goalVertex = false;\n\n // Queue of vertices to be checked\n Queue<Vertex> q = new LinkedList<Vertex>();\n\n // set each vertex to have a distance of -1\n for ( int i = 0; i < graph.length; i++ )\n graph[i] = new Vertex(i,-1);\n\n // get the start location, i.e. the player's location\n Vertex start = \n squareToVertex(board.getPlayerLoc(player.getPlayerNo()));\n start.dist = 0;\n q.add(start);\n\n // while there are still vertices to check\n while ( !goalVertex ) {\n\n // get the vertex and remove it;\n // we don't want to look at it again\n Vertex v = q.remove();\n\n // check if this vertex is at a goal row\n switch ( player.getPlayerNo() ) {\n case 0: if ( v.graphLoc >= 72 ) \n goalVertex = true; break;\n case 1: if ( v.graphLoc <= 8 ) \n goalVertex = true; break;\n case 2: if ( (v.graphLoc+1) % GameBoard.COLUMNS == 0 )\n goalVertex = true; break;\n case 3: if ( v.graphLoc % GameBoard.COLUMNS == 0 )\n goalVertex = true; break;\n }\n\n // if we're at a goal vertex, we don't need to calculate\n // its neighboors\n if ( !goalVertex ) {\n\n // retrieve all reachable ajacencies\n Square[] adjacencies = reachableAdjacentSquares\n (board, vertexToSquare(v, board), player.getPlayerNo());\n\n // for each adjacency...\n for ( Square s : adjacencies ) {\n\n // convert to graph location\n Vertex adjacent = squareToVertex(s); \n\n // modify the vertex if it hasn't been modified\n if ( adjacent.dist < 0 ) {\n adjacent.dist = v.dist+1;\n adjacent.path = v;\n q.add(adjacent);\n }\n }\n\n }\n else\n return returnPath(v,board);\n \n }\n // should never get here\n return null;\n }", "private void identifySuccessors(T node, T goal, Set<T> goals, Queue<T> open, Set<T> closed, Map<T, T> parentMap,\n Map<T, Double> fMap, Map<T, Double> gMap, Map<T, Double> hMap) {\n // get all neighbors to the current node\n Collection<T> neighbors = findNeighbors(node, parentMap);\n\n double d;\n double ng;\n for (T neighbor : neighbors) {\n // jump in the direction of our neighbor\n T jumpNode = jump(neighbor, node, goals);\n\n // don't add a node we have already gotten to quicker\n if (jumpNode == null || closed.contains(jumpNode)) continue;\n\n // determine the jumpNode's distance from the start along the current path\n d = graph.getDistance(jumpNode, node);\n ng = gMap.getOrDefault(node, 0d) + d;\n\n // if the node has already been opened and this is a shorter path, update it\n // if it hasn't been opened, mark as open and update it\n if (!open.contains(jumpNode) || ng < gMap.getOrDefault(jumpNode, 0d)) {\n gMap.put(jumpNode, ng);\n hMap.put(jumpNode, graph.getHeuristicDistance(jumpNode, goal));\n fMap.put(jumpNode, gMap.getOrDefault(jumpNode, 0d) + hMap.getOrDefault(jumpNode, 0d));\n //System.out.println(\"jumpNode: \" + jumpNode.x + \",\" + jumpNode.y + \" f: \" + fMap.get(jumpNode));\n parentMap.put(jumpNode, node);\n\n if (!open.contains(jumpNode)) {\n open.offer(jumpNode);\n }\n }\n }\n }", "Path getPathFromNodeTo(Node destination);", "@Override\n public List dijkstrasShortestPath(T start, T end) {\n Vertex<T> origin = new Vertex<>(start);\n Vertex<T> destination = new Vertex<>(end);\n List<Vertex<T>> path;\n\n settledNodes = new HashSet<>();\n unSettledNodes = new HashSet<>();\n distancesBetweenNodes = new HashMap<>();\n predecessors = new HashMap<>();\n\n distancesBetweenNodes.put(origin,0);\n unSettledNodes.add(origin);\n\n while(unSettledNodes.size() > 0){\n Vertex<T> minimumWeightedVertex = getMinimum(unSettledNodes);\n settledNodes.add(minimumWeightedVertex);\n unSettledNodes.remove(minimumWeightedVertex);\n findMinimumDistance(minimumWeightedVertex);\n }\n path = getPath(destination);\n return path;\n\n }", "public ArrayList<Vertex> findPath() {\n \n //if we've already been through findPath, then just return it\n if (solutionCalculated) {\n return solution;\n }\n \n //instantiate path\n solution = new ArrayList<Vertex>();\n \n //create boolean array of visited nodes (default: false)\n boolean[] visited = new boolean[arrayOfVertices.length];\n \n //(for testing)\n NavigateMaze.drawMaze(getVertices());\n \n //call dfs\n dfs(visited, arrayOfVertices[0], \n arrayOfVertices[arrayOfVertices.length - 1]);\n \n //update solutionCalculated to true\n solutionCalculated = true;\n \n //return solution\n return solution;\n \n }", "public KnightNode getPathByBFS(KnightNode startNode,\n\t\t\tKnightNode finishNode) {\n\t\tif (startNode == null) {\n\t\t\tthrow new IllegalArgumentException(\"start node shouldn't be null!\");\n\t\t}\n\n\t\tif (finishNode == null) {\n\t\t\tthrow new IllegalArgumentException(\"finish node shouldn't be null!\");\n\t\t}\n\n\t\tQueue<KnightNode> queue = new LinkedList<KnightNode>();\n\n\t\t// step 0\n\t\tstartNode.isUsed = true;\n\t\tqueue.add(startNode);\n\t\n\t\twhile (!queue.isEmpty()) {\n\t\t\t// get next node from head of queue\n\t\t\tKnightNode tmpNode = queue.remove();\n\t\t\tSet<KnightNode> childNodes = tmpNode.availableMoves;\n\t\t\tfor (KnightNode tmpChild : childNodes) {\n\t\t\t\ttmpChild = findNode(tmpChild.x, tmpChild.y);\n\t\t\t\t// check if we have already been here\n\t\t\t\tif (!tmpChild.isUsed) {\n\t\t\t\t\ttmpChild.root = tmpNode;\n\t\t\t\t\ttmpChild.isUsed = true;\n\t\t\t\t\tqueue.add(tmpChild);\n\n\t\t\t\t\tif (tmpChild.equals(finishNode)) {\n\t\t\t\t\t\t// we have found our short path\n\t\t\t\t\t\treturn tmpChild;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\t// path is not exist\n\t\treturn null;\n\t}", "private LinkedList<Node> aStarPath() throws PathNotFoundException {\n\n // Set of nodes already evaluated\n List<Node> closedSet = new ArrayList<Node>();\n\n // Set of nodes visited, but not evaluated\n List<Node> openSet = new ArrayList<Node>();\n openSet.add(start);\n\n\n // Map of node with shortest path leading to it\n Map<Node, Node> cameFrom = new HashMap<>();\n\n // Map of cost of navigating from start to node\n Map<Node, Double> costFromStart = new HashMap<>();\n costFromStart.put(start, 0.0);\n\n // Map of cost of navigating path from start to end through node\n Map<Node, Double> costThrough = new HashMap<>();\n costThrough.put(start, heuristic(start, end));\n\n while (!openSet.isEmpty()){\n\n Node current = lowestCostThrough(openSet, costThrough);\n\n if(current.equals(end)){\n return reconstructPath(cameFrom, current);\n }\n\n openSet.remove(current);\n closedSet.add(current);\n\n for(Node neighbor: current.getNodes()) {\n if (closedSet.contains(neighbor)) {\n continue;\n }\n\n double tentativeCost = costFromStart.get(current) + distanceBetween(current, neighbor);\n\n if (!openSet.contains(neighbor)) { // found new neighbor\n openSet.add(neighbor);\n } else if (tentativeCost >= costFromStart.get(neighbor)) { // not a better path\n continue;\n }\n\n cameFrom.put(neighbor, current);\n costFromStart.put(neighbor, tentativeCost);\n costThrough.put(neighbor, tentativeCost + heuristic(neighbor, end));\n\n }\n }\n // no path\n throw pathNotFound;\n }", "public LinkedList<City> getPath(City target) {\r\n\r\n\t\tLinkedList<City> path = new LinkedList<City>();\r\n \t\tCity step = target;\r\n\t\t// check if a path exists\r\n\t\tif (predecessors.get(step) == null) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\tpath.add(step);\r\n\t\twhile (predecessors.get(step) != null) {\r\n\t\t\tstep = predecessors.get(step);\r\n\t\t\tpath.add(step);\r\n\t\t}\r\n\t\t// Put it into the correct order\r\n\t\tCollections.reverse(path);\r\n\t\treturn path;\r\n\t}", "public LinkedList<Vertex> getPath(Vertex target) {\n LinkedList<Vertex> path = new LinkedList<Vertex>();\n Vertex step = target;\n // check if a path exists\n if (predecessors.get(step) == null) {\n return null;\n }\n path.add(step);\n while (predecessors.get(step) != null) {\n step = predecessors.get(step);\n path.add(step);\n }\n // Put it into the correct order\n Collections.reverse(path);\n return path;\n }", "public static void main(String[] args) {\n Graph graph = new Graph();\n graph.addEdge(0, 1);\n graph.addEdge(0, 4);\n\n graph.addEdge(1,0);\n graph.addEdge(1,5);\n graph.addEdge(1,2);\n graph.addEdge(2,1);\n graph.addEdge(2,6);\n graph.addEdge(2,3);\n\n graph.addEdge(3,2);\n graph.addEdge(3,7);\n\n graph.addEdge(7,3);\n graph.addEdge(7,6);\n graph.addEdge(7,11);\n\n graph.addEdge(5,1);\n graph.addEdge(5,9);\n graph.addEdge(5,6);\n graph.addEdge(5,4);\n\n graph.addEdge(9,8);\n graph.addEdge(9,5);\n graph.addEdge(9,13);\n graph.addEdge(9,10);\n\n graph.addEdge(13,17);\n graph.addEdge(13,14);\n graph.addEdge(13,9);\n graph.addEdge(13,12);\n\n graph.addEdge(4,0);\n graph.addEdge(4,5);\n graph.addEdge(4,8);\n graph.addEdge(8,4);\n graph.addEdge(8,12);\n graph.addEdge(8,9);\n graph.addEdge(12,8);\n graph.addEdge(12,16);\n graph.addEdge(12,13);\n graph.addEdge(16,12);\n graph.addEdge(16,17);\n graph.addEdge(17,13);\n graph.addEdge(17,16);\n graph.addEdge(17,18);\n\n graph.addEdge(18,17);\n graph.addEdge(18,14);\n graph.addEdge(18,19);\n\n graph.addEdge(19,18);\n graph.addEdge(19,15);\n LinkedList<Integer> visited = new LinkedList();\n List<ArrayList<Integer>> paths = new ArrayList<ArrayList<Integer>>();\n int currentNode = START;\n visited.add(START);\n new searchEasy().findAllPaths(graph, visited, paths, currentNode);\n for(ArrayList<Integer> path : paths){\n for (Integer node : path) {\n System.out.print(node);\n System.out.print(\" \");\n }\n System.out.println();\n }\n }", "@Override\n public void solve(Problem p) {\n Queue queue = new LinkedList();\n queue.add(p);\n closeList.add(p);\n\n while (!queue.isEmpty()) {\n\n Problem node = (Problem) queue.remove();\n if (node.isAnswer()) {\n printPath(node);\n return;\n }\n// System.out.println(node);\n node.generateNodes();\n nodesExpanded++;\n for (Iterator<Problem> it = node.nodes.iterator(); it.hasNext();) {\n nodesSeen++;\n Problem problem = it.next();\n if (closeList.contains(problem)) {\n continue;\n }\n problem.visited = true;\n problem.distanceTraveled = node.distanceTraveled + 1;\n// System.out.println(problem.distanceTraveled);\n// System.out.println(problem);\n queue.add(problem);\n closeList.add(problem);\n }\n maxNodes = Math.max(maxNodes, queue.size());\n }\n \n }", "public static void getShortestPath()\r\n\t{\r\n\t\tScanner scan = new Scanner(System.in); //instance for input declared\r\n\t\tSystem.out.print(\"\\nPlease enter the Source node for shortest path: \");\r\n\t\tint src = scan.nextInt() - 1;\r\n\t\twhile(src < 0 || src > routers-1)\r\n {\r\n\t\t\tSystem.out.println(\"The entered source node is out of range, please enter again: \"); // Printing error\r\n\t\t\tsrc = scan.nextInt() - 1;\t//re-input source\r\n\t\t}\r\n\t\t\r\n\t\tSystem.out.print(\"Please enter the destination node for shortest path: \");\r\n\t\tint dest = scan.nextInt() - 1;\r\n\t\twhile(dest < 0 || dest > routers-1)\r\n {\r\n\t\t\tSystem.out.println(\"The entered destination node is out of range, please enter again: \"); // Printing error\r\n\t\t\tdest = scan.nextInt() - 1;\t//re-input destination\r\n\t\t}\r\n\t\t\r\n\t\tconnectNetwork(src, dest, true);\r\n\t}", "public Iterable<Board> solution() {\n if (!isSolvable())\n return null;\n Stack<Board> solution = new Stack<Board>();\n for (Node s = goal; s != null; s = s.previousNode)\n solution.push(s.board);\n return solution;\n }", "public List<Vertex> shortestPath(Vertex start, Vertex end) {\r\n\t\tMap<Vertex, Vertex> backRefs = new HashMap<Vertex, Vertex>();\r\n\r\n\t\t// Create a queue for BFS\r\n\t\tQueue<Vertex> queue = new LinkedList<Vertex>();\r\n\r\n\t\t// Mark the current node as visited and enqueue it. Use backRef as\r\n\t\t// visited set\r\n\t\tqueue.offer(start);\r\n\t\tbackRefs.put(start, null);\r\n\r\n\t\tVertex currentNode;\r\n\t\tSet<Vertex> neighbors;\r\n\r\n\t\twhile (queue.size() != 0) { // or !queue.isEmpty()\r\n\t\t\t// Dequeue a vertex from queue and print it\r\n\t\t\tcurrentNode = queue.poll();\r\n\r\n\t\t\tif (currentNode.equals(end)) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\t// Get all adjacent vertices of the dequeued vertex s\r\n\t\t\t// If a adjacent has not been visited, then mark it\r\n\t\t\t// visited and enqueue it\r\n\t\t\tneighbors = currentNode.getNeighbors();\r\n\r\n\t\t\tfor (Vertex n : neighbors) {\r\n\t\t\t\tif (!backRefs.containsKey(n)) {\r\n\t\t\t\t\tqueue.offer(n);\r\n\t\t\t\t\tbackRefs.put(n, currentNode);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (!backRefs.containsKey(end))\r\n\t\t\treturn null;\r\n\r\n\t\tList<Vertex> path = new ArrayList<Vertex>();\r\n\t\tcurrentNode = end;\r\n\r\n\t\twhile (currentNode != null) {\r\n\t\t\tpath.add(currentNode);\r\n\t\t\tcurrentNode = backRefs.get(currentNode);\r\n\t\t}\r\n\r\n\t\tCollections.reverse(path);\r\n\r\n\t\treturn path;\r\n\t}", "public void printSolution(Node solution_node)\n\t{\n\t\tArrayList<String> steps = new ArrayList<String>();\n\n\t\twhile (solution_node.parent != null) {\n\t\t\tsteps.add(\"Fill \" + solution_node.action.to + \" with water from \" + \n\t\t\t\t\tsolution_node.action.from + \" (ie. \" + solution_node.action.quantity + \" jugs)\" + \n\t\t\t\t\t\" New state: \" + solution_node.state [0] + \",\" + solution_node.state[1]);\n\n\t\t\tsolution_node = solution_node.parent;\n\t\t} \n\n\t\tSystem.out.println(\"Steps:\");\n\n\t\tsteps.add(\"4 gallon jug has \" + solution_node.state[0] + \" gallons and 3 gallon jug has \" + \n\t\t\t\t\tsolution_node.state[1] + \" gallons\");\n\n\t\twhile (steps.size() > 0) {\n\t\t\tString curr = steps.remove(steps.size() - 1);\n\t\t\tSystem.out.println(curr);\n\t\t}\n\t}", "public static List<Vec2i> solve(int[][] grid, Vec2i start, Vec2i goal, Heuristic h){\n if(h == null){ //if null replace with default heuristic\n h = new Heuristic() {\n @Override\n\n public double eval(Vec2i loc) {\n double dx = (loc.x - goal.x);\n double dy = (loc.y - goal.y);\n return Math.sqrt(dx*dx + dy*dy);\n }\n };\n }\n\n PriorityQueue<GridLocation> edge = new PriorityQueue<GridLocation>(10, AStarGrid::compareGridLocations);\n edge.add(new GridLocation(start,0));\n\n Map<Vec2i, Vec2i> cameFrom = new HashMap<Vec2i, Vec2i>();\n Map<Vec2i, Double> g = new HashMap<Vec2i, Double>(); //distance to node\n g.put(start,0.0);\n Map<Vec2i, Double> f = new HashMap<Vec2i, Double>(); //distance from start to goal through this node\n f.put(start,h.eval(start));\n //f = g + h\n\n while(!edge.isEmpty()){\n\n Vec2i current = edge.poll().loc;\n if(current.x == goal.x && current.y == goal.y){\n return reconstructPath(cameFrom, current);\n }\n\n LinkedList<Vec2i> neighbors = new LinkedList<Vec2i>();\n if(current.x != 0 && grid[current.x - 1][current.y] == 0)\n neighbors.add(new Vec2i(current.x - 1,current.y));\n if(current.x != grid.length-1 && grid[current.x + 1][current.y] == 0)\n neighbors.add(new Vec2i(current.x + 1,current.y));\n if(current.y != 0 && grid[current.x][current.y - 1] == 0)\n neighbors.add(new Vec2i(current.x,current.y - 1));\n if(current.y != grid[0].length-1 && grid[current.x][current.y + 1] == 0)\n neighbors.add(new Vec2i(current.x,current.y + 1));\n\n\n for(Vec2i neighbor: neighbors){\n double score = g.get(current) + 1;\n if(!g.containsKey(neighbor) || score < g.get(neighbor)){\n cameFrom.put(neighbor,current);\n g.put(neighbor, score);\n f.put(neighbor, score + h.eval(neighbor));\n if(!edge.contains(neighbor)){\n edge.add(new GridLocation(neighbor,score + h.eval(neighbor)));\n }\n }\n }\n }\n //No path was found\n return null;\n }", "private List<List<Edge>> walker(String sourceNode, String destNode, List<Edge> currentPath, List<List<Edge>> paths) {\n if (currentPath == null) {\n currentPath = new ArrayList<>();\n }\n if (paths == null) {\n paths = new ArrayList<>();\n }\n\n if (sourceNode.equals(destNode)) {\n return paths;\n }\n\n\n// List<Edge> edges = findByNodeA(sourceNode);\n List<Edge> edges = allEdges.stream().filter(edge -> edge.nodeA.equals(sourceNode)).collect(Collectors.toList());\n\n\n for (Edge edge : edges) {\n if (!currentPath.contains(edge)&&!containsBidirectionalRef(currentPath,edge)) {\n List<Edge> forkPath = (List<Edge>) ((ArrayList<Edge>) currentPath).clone();\n\n forkPath.add(edge);\n\n if (edge.getNodeB().equals(destNode)) {\n paths.add(forkPath);\n } else {\n walker(edge.getNodeB(), destNode,forkPath,paths);\n }\n }\n }\n\n return paths;\n }", "public Node getGoal(){\n return goal;\n }", "public KnightNode getPathByDFS(KnightNode startNode,\n\t\t\tKnightNode finishNode) {\n\t\tif (startNode == null) {\n\t\t\tthrow new IllegalArgumentException(\"start node shouldn't be null!\");\n\t\t}\n\n\t\tif (finishNode == null) {\n\t\t\tthrow new IllegalArgumentException(\"finish node shouldn't be null!\");\n\t\t}\n\n\t\tDeque<KnightNode> stack = new LinkedList<KnightNode>();\n\n\t\t// step 0\n\t\tstartNode.isUsed = true;\n\t\tstack.add(startNode);\n\n\t\tnodes.remove(startNode);\n\t\tnodes.add(startNode);\n\n\t\twhile (!stack.isEmpty()) {\n\t\t\t// get next node from head of queue\n\t\t\tKnightNode tmpNode = stack.getLast();\n\t\t\tSet<KnightNode> childNodes = tmpNode.availableMoves;\n\t\t\tfor (KnightNode tmpChild : childNodes) {\n\t\t\t\ttmpChild = findNode(tmpChild.x, tmpChild.y);\n\t\t\t\t// check if we have already been here\n\t\t\t\tif (!tmpChild.isUsed) {\n\t\t\t\t\ttmpChild.root = tmpNode;\n\t\t\t\t\ttmpChild.isUsed = true;\n\t\t\t\t\tstack.add(tmpChild);\n\n\t\t\t\t\tif (tmpChild.equals(finishNode)) {\n\t\t\t\t\t\t// we have found our short path\n\t\t\t\t\t\treturn tmpChild;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\t// path is not exist\n\t\treturn null;\n\t}", "public List<GeographicPoint> dijkstra(GeographicPoint start, \n\t\t\t\t\t\t\t\t\t\t GeographicPoint goal, Consumer<GeographicPoint> nodeSearched)\n\t{\n\t\t// TODO: Implement this method in WEEK 4\n\n\t\t// Hook for visualization. See writeup.\n\t\t//nodeSearched.accept(next.getLocation());\n\t\t\n\t\t//initialize distance of each MapNode from start to infinity\n\t\t\n\t\tSet<GeographicPoint> visited = new HashSet<GeographicPoint>();\n\t\tPriorityQueue<MapNode> queue = new PriorityQueue<MapNode>();\n\t\tHashMap<GeographicPoint, List<GeographicPoint>> path = new HashMap<GeographicPoint, List<GeographicPoint>>();\n\t\tint count = 0;\n\t\t\n\t\tif (!map.containsKey(start) || !map.containsKey(goal))\n\t\t\treturn null;\n\t\t\n\t\tfor (GeographicPoint temp : map.keySet())\n\t\t\tpath.put(temp, new ArrayList<GeographicPoint>());\n\t\t\n\t\tMapNode startNode = map.get(start);\n\t\tstartNode.setTimeToStart(0.0);\n\t\tstartNode.setDistanceToStart(0.0);\n\t\tqueue.add(startNode);\n\t\t\n\t\twhile (!queue.isEmpty()) {\n\t\t\tMapNode currNode = queue.poll();\n\t\t\tnodeSearched.accept(currNode.getLocation());\n\t\t\t\n\t\t\tif (!visited.contains(currNode.getLocation())) {\n\t\t\t\tvisited.add(currNode.getLocation());\n\t\t\t\tcount++;\n\t\t\t\t\n\t\t\t\tif (currNode.getLocation().equals(goal))\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\tHashMap<MapEdge, GeographicPoint> neighbours = currNode.getNeighbours();\n\t\t\t\tfor (MapEdge edge : neighbours.keySet()) {\n\t\t\t\t\t\n\t\t\t\t\tif (!visited.contains(edge.getEnd())) {\n\t\t\t\t\t\t\n\t\t\t\t\t\tMapNode addNode = map.get(neighbours.get(edge));\n\t\t\t\t\t\tdouble tempTime = currNode.getTimeToStart() + ((edge.getDistance())/(edge.getSpeedLimit()));\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (tempTime < addNode.getTimeToStart()) {\n\t\t\t\t\t\t\taddNode.setTimeToStart(tempTime);\n\t\t\t\t\t\t\tqueue.add(addNode);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tList<GeographicPoint> temp = path.get(neighbours.get(edge));\n\t\t\t\t\t\t\ttemp.add(currNode.getLocation());\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\tSystem.out.println(\"Dijkstra: \" + count);\n\t\treturn backTrack(path,goal);\n\t}", "public ArrayList<SearchNode> search(Problem p) {\n\tfrontier = new NodeQueue();\t// The frontier is a queue of expanded SearchNodes not processed yet\n\texplored = new HashSet<SearchNode>();\t/// The explored set is a set of nodes that have been processed \n\tGridPos startState = (GridPos) p.getInitialState();\t// The start state is given\n\tfrontier.addNodeToFront(new SearchNode(startState));\t// Initialize the frontier with the start state \n\n\t\n\tpath = new ArrayList<SearchNode>();\t// Path will be empty until we find the goal\n\t\t\n\n\n\twhile(!frontier.isEmpty()){\n\n\t SearchNode s = frontier.removeFirst(); \n\t GridPos g = s.getState(); \n\n\t if ( p.isGoalState(g) ) {\n\t\tpath = s.getPathFromRoot();\t\n\t\tbreak; \n\t }\n\t \n\t explored.add(s); \t \n\t ArrayList<GridPos> childStates = p.getReachableStatesFrom(g);\n\n\t while(!childStates.isEmpty()){\n\n\t\tSearchNode child = new SearchNode(childStates.get(0), s); \n\n\t\tif(!explored.contains(child) && !frontier.contains(child)){\n\n\t\t if ( p.isGoalState(child.getState()) ) {\n\t\t\n\t\t\tpath = child.getPathFromRoot();\t\n\t\t\treturn path; \n\t\t }\n\n\t\t if(insertFront) \n\t\t\tfrontier.addNodeToFront(child); \t\t \t\t\n\t\t else\t\n\t\t\tfrontier.addNodeToBack(child); \t \n\n\n\n\t\t}\n\n\t\tchildStates.remove(0);\n\t }\t \n\t}\n\n\n\treturn path;\n\n }", "public LinkedList<Move> search1() {\r\n\r\n while (!paths.isEmpty()) {\r\n\r\n if (logger.isDebugEnabled())\r\n logger.debug(printPathCosts());\r\n\r\n LinkedList<Move> path = paths.first();\r\n if (logger.isDebugEnabled())\r\n logger.debug(\"First path is \" + path);\r\n\r\n if (!paths.remove(path)) {\r\n throw new RuntimeException(\"Failed to remove path\");\r\n }\r\n\r\n Node currentNode = path.getLast().destination;\r\n if (logger.isDebugEnabled())\r\n logger.debug(\"Last site on path is \" + currentNode);\r\n\r\n if (closed.contains(currentNode)) {\r\n if (logger.isDebugEnabled())\r\n logger.debug(\"Site \" + currentNode + \" was closed.\");\r\n continue;\r\n }\r\n if (currentNode.isAtTarget(target)) {\r\n return path;\r\n }\r\n\r\n closed.add(currentNode);\r\n\r\n Move lastMove = path.getLast();\r\n if ( !(lastMove instanceof InitialMove) ) {\r\n currentNode = transformCurrentNode(lastMove);\r\n }\r\n\r\n Set<Move> successors = successors(currentNode);\r\n for (Move y : successors) {\r\n LinkedList<Move> successor = new LinkedList<Move>(path);\r\n y.pathCost = successor.getLast().pathCost + y.edgeCost;\r\n successor.add(y);\r\n paths.add(successor);\r\n if (logger.isDebugEnabled())\r\n logger.debug(\"Added successor \" + y);\r\n nodeExpansionCounter ++;\r\n }\r\n }\r\n\r\n return null;\r\n }", "@Override\n\tpublic List<node_data> shortestPath(int src, int dest) {\n\t\tList<node_data> ans = new ArrayList<>();\n\t\tthis.shortestPathDist(src, dest);\n\t\tif(this.GA.getNode(src).getWeight() == Integer.MAX_VALUE || this.GA.getNode(dest).getWeight() == Integer.MAX_VALUE){\n\t\t\tSystem.out.print(\"There is not a path between the nodes.\");\n\t\t\treturn null;\n\t\t}\n\t\tgraph copied = this.copy();\n\t\ttransPose(copied);\n\t\tnode_data first = copied.getNode(dest);\n\t\tans.add(first);\n\t\twhile (first.getKey() != src) {\n\t\t\tCollection<edge_data> temp = copied.getE(first.getKey());\n\t\t\tdouble check= first.getWeight();\n\t\t\tif(temp!=null) {\n\t\t\t\tfor (edge_data edge : temp) {\n\t\t\t\t\tif (copied.getNode(edge.getDest()).getWeight() + edge.getWeight() == check) {\n\t\t\t\t\t\tfirst = copied.getNode(edge.getDest());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tans.add(first);\n\t\t}\n\t\tList<node_data> ans2 = new ArrayList<>();\n\t\tfor (int i = ans.size()-1;i>=0;i--){\n\t\t\tans2.add(ans.get(i));\n\t\t}\n\t\treturn ans2;\n\t}", "public Iterable<Board> solution()\n {\n Iterable<Board> result = null;\n if (isSolvable()) {\n result = shortestPath;\n }\n return result;\n }", "public void printMST() {\n\t\t\n\t\tString mstPath = \"\";\n\t\t\n\t\t/**Stores the parent child hierarchy*/\n\t\tint distance[] = new int[this.vertices];\n\t\t\n\t\t/**Stores all the vertices with their distances from source vertex*/\n\t\tMap<Integer, Integer> map = new HashMap<Integer, Integer>();\n\t\tmap.put(0, 0);\n\t\t\n\t\tfor(int i = 1; i < vertices; i++){\n\t\t\tmap.put(i, Integer.MAX_VALUE);\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < vertices; i++){\n\t\t\t\n\t\t\tInteger minVertex = extractMin(map), minValue = map.get(minVertex);\n\t\t\tdistance[minVertex] = minValue;\n\t\t\t\n\t\t\tmstPath += minVertex + \" --> \";\n\t\t\t\n\t\t\t/**Removing min vertex from map*/\n\t\t\tmap.remove(minVertex);\n\t\t\t\n\t\t\t/**Exploring edges of min vertex*/\n\t\t\tArrayList<GraphEdge> edges = this.adjList[minVertex];\n\t\t\tfor(GraphEdge edge : edges){\n\t\t\t\tif(map.containsKey(edge.destination)){\n\t\t\t\t\tif(map.get(edge.destination) > distance[edge.source] + edge.weight){\n\t\t\t\t\t\tmap.put(edge.destination, distance[edge.source] + edge.weight);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(mstPath);\n\t}", "@Override\n public List<node_info> shortestPath(int src, int dest) {\n int counter=0;//counter for index of listPath\n List<node_info> listPath=new ArrayList<node_info>();//The reverse list that is returned\n List<node_info> listResult=new ArrayList<node_info>();//the returned list\n if(!DijkstraHelp(src,dest)) return null;//if there is no path from src to dest\n if(src==dest) {\n listPath.add(this.ga.getNode(src));\n return listPath;\n }\n //the other case:\n node_info d=this.ga.getNode(dest);\n listPath.add(counter,d);//insert the dest in order to go from destination to source\n //counter++;\n weighted_graph gCopy=copy();\n Iterator<node_info> it=gCopy.getV().iterator();//run on the whole graph\n while(it.hasNext()){\n if(listPath.get(counter).getKey()==src) break;//if we finished\n if(gCopy.getV(listPath.get(counter).getKey()).contains(it.next())) {//remove the nodes that we were already checked if\n //they need to be insert to listPath\n continue;\n }\n Iterator<node_info> currentIt=gCopy.getV(listPath.get(counter).getKey()).iterator();//iterator on the ni-list of the\n //last node were insert to the listPath\n if(currentIt!=null) {\n node_info min=null;\n while (currentIt.hasNext()){\n node_info currentLoop=currentIt.next();\n if(currentLoop.getTag()+gCopy.getEdge(listPath.get(counter).getKey(),currentLoop.getKey())==\n listPath.get(counter).getTag()){//check if this is the node that appropriate to the shortest path\n min=currentLoop;\n }\n }\n listPath.add(min);//insert to listPath\n counter++;\n }\n }\n for(int i=listPath.size()-1;i>=0;i--){\n listResult.add(listPath.size()-i-1,listPath.get(i));//reverse the list\n }\n return listResult;\n }", "public ArrayList<Vertex> getPath(Vertex target) {\n\t\tArrayList<Vertex> path = new ArrayList<Vertex>();\n\t\tVertex step = target;\n\t\t// check if a path exists\n\t\tif (predecessors.get(step) == null) {\n\t\t\treturn null;\n\t\t}\n\t\tpath.add(step);\n\t\twhile (predecessors.get(step) != null) {\n\t\t\tstep = predecessors.get(step);\n\t\t\tpath.add(step);\n\t\t}\n\t\t// Put it into the correct order\n\t\tCollections.reverse(path);\n\n\n\t\tVertex current=null;\n\t\tVertex next=null;\n\t\tint length = path.size();\n\t\tfor(int i=0;i<length-1;i++){\n current = path.get(i);\n\t\t\t next = path.get(i+1);\n\t\t\tif(!rapid && (nodeColor_map.get(current.getName()).equalsIgnoreCase(\"dB\")||\n\t\t\t\t\tnodeColor_map.get(next.getName()).equalsIgnoreCase(\"dB\")))\n\t\t\t\trapid = true;\n\t\t\troute_length+= edge_length_map.get(new Pair(current,next));\n\t\t}\n\n\t\treturn path;\n\t}", "@Override\r\n public List<T> breadthFirstPath(T start, T end) {\r\n\r\n Vertex<T> startV = vertices.get(start);\r\n Vertex<T> endV = vertices.get(end);\r\n\r\n LinkedList<Vertex<T>> vertexList = new LinkedList<>();\r\n //Set<Vertex<T>> visited = new HashSet<>();\r\n ArrayList<Vertex<T>> visited = new ArrayList<>();\r\n\r\n LinkedList<Vertex<T>> pred = new LinkedList<>();\r\n int currIndex = 0;\r\n\r\n pred.add(null);\r\n\r\n vertexList.add(startV);\r\n visited.add(startV);\r\n\r\n LinkedList<T> path = new LinkedList<>();\r\n\r\n if (breadthFirstSearch(start, end) == false) {\r\n path = new LinkedList<>();\r\n return path;\r\n } else {\r\n while (vertexList.size() > 0) {\r\n Vertex<T> next = vertexList.poll();\r\n if(next == null){\r\n continue;\r\n }\r\n if (next == endV) {\r\n path.add(endV.getValue());\r\n break;\r\n }\r\n for (Vertex<T> neighbor : next.getNeighbors()) {\r\n if (!visited.contains(neighbor)) {\r\n pred.add(next);\r\n visited.add(neighbor);\r\n vertexList.add(neighbor);\r\n }\r\n }\r\n currIndex++;\r\n //path.add(next.getValue());\r\n\r\n }\r\n while (currIndex != 0) {\r\n Vertex<T> parent = pred.get(currIndex);\r\n path.add(parent.getValue());\r\n currIndex = visited.indexOf(parent);\r\n }\r\n }\r\n Collections.reverse(path);\r\n return path;\r\n }", "public static void connectNetwork(int src, int dest, boolean printPath)\r\n\t{\r\n\t\tint v = routers;\r\n\t\t\r\n\t\tint parent[] = new int[v];//parent node array\r\n\t\tint dist[] = new int[v];// distance array\r\n\t\tboolean visited[] = new boolean[v];// visited will be either true or false\r\n\t\t\r\n\t\t// initialize parent, distance arrays\r\n\t\tfor (int i = 0; i < v; i++ ) { \r\n\t\t\tvisited[i] = false;\r\n\t\t\tparent[i] = -1;\r\n\t\t\tdist[i] = Integer.MAX_VALUE;\r\n\t\t}\r\n\t\t\r\n\t\t// initialize the source distance as zero\r\n\t\tdist[src] = 0;\r\n\t\t\r\n\t\t// get minimum edge from the unvisited nodes\r\n\t\tfor (int count = 0; count < v-1; count++) { // loop for all v nodes\r\n\t\t\t\r\n\t\t\tint start = -1;\r\n\t\t\tint min = Integer.MAX_VALUE;\r\n\t\t\t\r\n\t\t\tfor (int i = 0; i < v; i++) {\r\n\t\t\t\tif (visited[i] == false && dist[i] < min) {\r\n\t\t\t\t\tmin = dist[i];\r\n\t\t\t\t\tstart = i;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// minimum distance is computed for all connected edges\r\n\t\t\tif (start == -1) \r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\t// update the current node as visited\r\n\t\t\tvisited[start] = true;\r\n\t\t\t\r\n\t\t\t// update all adjacent nodes' distance array\r\n\t\t\tfor (int end = 0; end < v; end++) {\r\n\t\t\t\tif ((visited[end] != true) && (graph[start][end] != -1) &&\r\n\t\t\t\t\t\t(dist[start] != Integer.MAX_VALUE) &&\r\n\t\t\t\t\t\t(dist[start] + graph[start][end] < dist[end])) {\r\n\t\t\t\t\t\r\n\t\t\t\t\tdist[end] = dist[start] + graph[start][end];\r\n\t\t\t\t\t\r\n\t\t\t\t\t// start node is the parent node in BFS tree\r\n\t\t\t\t\tparent[end] = start;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\tSystem.out.println();\r\n\t\t\r\n\t\tif (dest != -1) {\r\n\t\t\t\r\n\t\t\t// Case#4: shortest path between source and destination nodes \r\n\t\t\tif (parent[dest] == -1) {\r\n\t\t\t\tSystem.out.println(\"There is no path from \" + (src+1) + \" to \" + (dest+1) + \" exists.\");\r\n\t\t\t} else {\r\n\t\t\t\tSystem.out.println(\"Shortest distance from \" + (src+1) + \" to \" + (dest+1) + \" is: \" + dist[dest]);\r\n\t\t\t\tSystem.out.print(\"Corresponding Shortest Path is: \");\r\n\t\t\t\tprintNodes(parent, parent[dest], src);\r\n\t\t\t\tSystem.out.println(dest+1);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t} else {\r\n\t\t\t\r\n System.out.println(\"The Shortest Distance from node you entered, \"+ (src+1) + \" are\\n\");\r\n //Printing shortest path length\r\n\t\t\tSystem.out.println(\"Destination\\tDistance\\n========================\");\r\n for (int i = 0; i < v; i++) {\r\n System.out.println(\"\\t\"+ (i+1) + \"\\t \"+ dist[i]); // Printing the node number and distance\r\n }\r\n \r\n\t\t\tif (printPath == true) {\r\n\t\t\t\t\r\n\t\t\t\t// case#2: Print all shortest paths from source node\r\n\t\t\t\tfor (int i = 0; i < v; i++) {\r\n\t\t\t\t\tif (i == src)\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\telse if (parent[i] == -1) {\r\n\t\t\t\t\t\tSystem.out.println(\"Shortest path from \" + (src+1) + \" to \" + (i+1) + \" doesn't exist.\");\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tSystem.out.print(\"Shortest Path from \" + (src+1) + \" to \" + (i+1) + \" is: \");\r\n\t\t\t\t\tprintNodes(parent, parent[i], src);\r\n\t\t\t\t\tSystem.out.println(i+1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t}", "private NodePath<T> collectPathNodes( WeightedGraph<T> graph, Object startNodeId, Object endNodeId ) {\n\t\tArrayDeque<Node<T>> deque = new ArrayDeque<>( searchNodes.size() );\n\t\tNode<T> startNode = graph.getNode( startNodeId );\n\t\tNode<T> endNode = graph.getNode( endNodeId );\n\t\tSearchNode<T> node = getSearchNode( endNode );\n\n\t\t//\tkeep this before we flush the maps\n\t\tfinal int finalDistance = node.getDistance();\n\n\t\t//\twalk backwards through the \"previous\" links\n\t\tdo {\n\t\t\tdeque.push( node.getNode() );\n\t\t}\n\t\twhile ( (node = getSearchNode( node.getPrevious() )) != null && ! node.equals( startNode ) );\n\t\tdeque.push( startNode );\n\n\t\tclearSearchNodes();\n\t\treturn new NodePath<>( new ArrayList<>( deque ), finalDistance );\n\t}", "private void findPath1(List<Coordinate> path) {\n\n // records the start coordinate in a specific sequence.\n ArrayList<Coordinate> starts = new ArrayList<>();\n // records the end coordinate in a specific sequence.\n ArrayList<Coordinate> ends = new ArrayList<>();\n // records the total cost of the path in a specific sequence.\n ArrayList<Integer> cost = new ArrayList<>();\n\n for (Coordinate o1 : originCells) {\n for (Coordinate d1 : destCells) {\n Graph graph = new Graph(getEdge(map));\n graph.dijkstra(o1);\n graph.printPath(d1);\n starts.add(o1);\n ends.add(d1);\n cost.add(graph.getPathCost(d1));\n }\n }\n int index = getMinIndex(cost);\n\n Graph graph = new Graph(getEdge(map));\n graph.dijkstra(starts.get(index));\n graph.printPath(ends.get(index));\n for (Graph.Node node : graph.getPathReference()) {\n path.add(node.coordinate);\n }\n setSuccess(path);\n }", "public void dfsPrint(Node start){\n Stack<Node> stack = new Stack<>();\n Set<Node> visited = new HashSet<>(); //we can use integer for better space\n\n stack.push(start);\n while (!stack.isEmpty()){\n Node curr = stack.pop();\n if(!visited.contains(curr)){\n visited.add(curr);\n //do something\n }\n for(Node n: curr.adj){\n if(!visited.contains(n)){\n stack.push(n);\n }\n }\n }\n }", "public void solve() {\n /** To solve the traveling salesman problem:\n * Set up the graph, choose a starting node, then call the recursive backtracking method and pass it the starting node.\n */\n\n // We need to pass a starting node to recursive backtracking method\n Node startNode = null;\n\n // Grab a node, any node...\n for( Node n : graph.nodes() ) {\n startNode = n;\n break;\n }\n\n // Visit the first node\n startNode.visit();\n\n // Add first node to the route\n this.route[0] = startNode;\n\n // Pass the number of choices made\n int nchoices = 1;\n\n // Recursive backtracking\n explore(startNode, nchoices );\n\n\n }", "ShortestPath(UndirectedWeightedGraph graph, String startNodeId, String endNodeId) throws NotFoundNodeException {\r\n\t\t\r\n\t\tif (!graph.containsNode(startNodeId)) {\r\n\t\t\tthrow new NotFoundNodeException(graph, startNodeId);\r\n\t\t}\t\t\r\n\t\tif (!graph.containsNode(endNodeId)) {\r\n\t\t\tthrow new NotFoundNodeException(graph, endNodeId);\r\n\t\t}\t\r\n\r\n\t\tsrc = startNodeId;\r\n\t\tdst = endNodeId;\r\n\t\t\r\n\t\tif (endNodeId.equals(startNodeId)) {\r\n\t\t\tlength = 0;\r\n\t\t\tnumOfPath = 1;\r\n\t\t\tArrayList<String> path = new ArrayList<String>();\r\n\t\t\tpath.add(startNodeId);\r\n\t\t\tpathList.add(path);\r\n\t\t}\r\n\t\telse {\r\n\t\t\t// create a HashMap of updated distance from the starting node to every node\r\n\t\t\t// initially it is 0, inf, inf, inf, ...\r\n\t\t\tHashMap<String, Double> distance = new HashMap<String, Double>();\t\r\n\t\t\tfor (String nodeId : graph.getNodeList().keySet()) {\r\n\t\t\t\tif (nodeId.equals(startNodeId)) {\r\n\t\t\t\t\t// the starting node will always have 0 distance from itself\r\n\t\t\t\t\tdistance.put(nodeId, 0.0);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\t// the others have initial distance is infinity\r\n\t\t\t\t\tdistance.put(nodeId, Double.MAX_VALUE);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// a HashMap of preceding node of each node\r\n\t\t\tHashMap<String, HashSet<String>> precedence = new HashMap<String, HashSet<String>>();\r\n\t\t\tfor (String nodeId : graph.getNodeList().keySet()) {\r\n\t\t\t\tif ( nodeId.equals(startNodeId) ) {\r\n\t\t\t\t\tprecedence.put(nodeId, null);\t// the start node will have no preceding node\r\n\t\t\t\t}\r\n\t\t\t\telse { \r\n\t\t\t\t\tprecedence.put(nodeId, new HashSet<String>());\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t//\r\n\t\t\tSet<String> unvisitedNode = new HashSet<String>();\r\n\t\t\tfor (String nodeId : graph.getNodeList().keySet()) {\r\n\t\t\t\tunvisitedNode.add(nodeId);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tdouble minUnvisitedLength;\r\n\t\t\tString minUnvisitedNode;\r\n\t\t\t// run loop while not all node is visited\r\n\t\t\twhile ( unvisitedNode.size() != 0 ) {\r\n\t\t\t\t// find the unvisited node with minimum current distance in distance list\r\n\t\t\t\tminUnvisitedLength = Double.MAX_VALUE;\r\n\t\t\t\tminUnvisitedNode = \"\";\r\n\t\t\t\tfor (String nodeId : unvisitedNode) {\r\n\t\t\t\t\tif (distance.get(nodeId) < minUnvisitedLength) {\r\n\t\t\t\t\t\tminUnvisitedNode = nodeId;\r\n\t\t\t\t\t\tminUnvisitedLength = distance.get(nodeId); \r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// if there are no node that can be visited from the unvisitedNode, break the loop \r\n\t\t\t\tif (minUnvisitedLength == Double.MAX_VALUE) {\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t// remove the node from unvisitedNode\r\n\t\t\t\tunvisitedNode.remove(minUnvisitedNode);\r\n\t\t\t\t\r\n\t\t\t\t// update the distance of its neighbors\r\n\t\t\t\tfor (Node neighborNode : graph.getNodeList().get(minUnvisitedNode).getNeighbors().keySet()) {\r\n\t\t\t\t\tdouble distanceFromTheMinNode = distance.get(minUnvisitedNode) + graph.getNodeList().get(minUnvisitedNode).getNeighbors().get(neighborNode).getWeight();\r\n\t\t\t\t\t// if the distance of the neighbor can be shorter from the current node, change \r\n\t\t\t\t\t// its details in distance and precedence\r\n\t\t\t\t\tif ( distanceFromTheMinNode < distance.get(neighborNode.getId()) ) {\r\n\t\t\t\t\t\tdistance.replace(neighborNode.getId(), distanceFromTheMinNode);\r\n\t\t\t\t\t\t// renew the precedence of the neighbor node\r\n\t\t\t\t\t\tprecedence.put(neighborNode.getId(), new HashSet<String>());\r\n\t\t\t\t\t\tprecedence.get(neighborNode.getId()).add(minUnvisitedNode);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if (distanceFromTheMinNode == distance.get(neighborNode.getId())) {\r\n\t\t\t\t\t\t// unlike dijkstra's algorithm, multiple path should be update into the precedence\r\n\t\t\t\t\t\t// if from another node the distance is the same, add it to the precedence\r\n\t\t\t\t\t\tprecedence.get(neighborNode.getId()).add(minUnvisitedNode);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t// if the current node in the process is the end node, we can stop the while loop here\r\n\t\t\t\tif (minUnvisitedNode == endNodeId) {\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\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 (distance.get(endNodeId) == Double.MAX_VALUE) {\r\n\t\t\t\t// in case there is no shortest path between the 2 nodes\r\n\t\t\t\tlength = 0;\r\n\t\t\t\tnumOfPath = 0;\r\n\t\t\t\tpathList = null;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t// other wise we have these information\r\n\t\t\t\tlength = distance.get(endNodeId);\r\n\t\t\t\t//numOfPath = this.getNumPath(precedence, startNodeId, endNodeId);\r\n\t\t\t\tpathList = this.findPathList(precedence, startNodeId, endNodeId);\r\n\t\t\t\tnumOfPath = pathList.size();\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\t// END ELSE\t\t\r\n\t}", "@Override\n\tpublic boolean findPath(PathfindingNode start, PathfindingNode end, ArrayList<PathfindingNode> path) \n\t{\n\t\tpath.clear();\n\t\t\n\t\t_visited.clear();\n\t\t_toVisit.clear();\n\t\t_parents.clear();\n\t\t_costsFromStart.clear();\n\t\t_totalCosts.clear();\n\n\t\t_costsFromStart.put(start, 0);\n\t\t_toVisit.add(start);\n\t\t_parents.put(start, null);\n\t\t\n\t\twhile (!_toVisit.isEmpty() && !_toVisit.contains(end))\n\t\t{\n\t\t\tPathfindingNode m = _toVisit.remove();\n\t\t\t\n\t\t\tint mCost = _costsFromStart.get(m);\n\t\t\t\n\t\t\tfor (int i = 0; i < m.getNeighbors().size(); ++i)\n\t\t\t{\n\t\t\t\tPathfindingNodeEdge n = m.getNeighbors().get(i);\n\t\t\t\tif (n.getNeighbor() != null && !_visited.contains(n.getNeighbor()))\n\t\t\t\t{\n\t\t\t\t\tint costFromSource = mCost + n.getCost();\n\t\t\t\t\tint totalCost = costFromSource + _estimator.estimate(n.getNeighbor(), end);\n\t\t\t\t\tif (!_toVisit.contains(n.getNeighbor()) || totalCost < _totalCosts.get(n.getNeighbor()))\n\t\t\t\t\t{\n\t\t\t\t\t\t_parents.put(n.getNeighbor(), m);\n\t\t\t\t\t\t_costsFromStart.put(n.getNeighbor(), costFromSource);\n\t\t\t\t\t\t_totalCosts.put(n.getNeighbor(), totalCost);\n\t\t\t\t\t\tif (_toVisit.contains(n.getNeighbor()))\n\t\t\t\t\t\t\t_toVisit.remove(n.getNeighbor());\n\t\t\t\t\t\t_toVisit.add(n.getNeighbor());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t_visited.add(m);\n\t\t}\n\t\t\n\t\tif (_toVisit.contains(end))\n\t\t{\n\t\t\t_reversePath.clear();\n\t\t\t\n\t\t\tPathfindingNode current = end;\n\t\t\twhile (current != null)\n\t\t\t{\n\t\t\t\t_reversePath.push(current);\n\t\t\t\tcurrent = _parents.get(current);\n\t\t\t}\n\t\t\t\n\t\t\twhile (!_reversePath.isEmpty())\n\t\t\t\tpath.add(_reversePath.pop());\n\t\t\t\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tpath.add(start);\n\t\t\treturn false;\n\t\t}\n\t}", "private Board DLS(Board start, Board goal, int depth) {\n Board found = null;\n // Paso base: Si start es la solucion y esta en el ultimo nivel, regresa\n if((depth == 0) && start.equals(goal)) {\n return start;\n }\n // Si el nivel aun no es el ultimo, se obtienen los nodos hijos\n // y se vuelve a llamar la funcion en ellos\n else if(depth > 0) {\n // Obtiene los nodos hijos\n // Todas las posibles configuraciones del tablero que se pueden\n // hacer a partir de la actual\n ArrayList<Board> children = start.expand();\n\n expandedNodes++;\n\n // Para cada hijo vuelve a hacer lo mismo\n for(Board child : children) {\n found = DLS(child, goal, depth - 1);\n if(found != null)\n return found;\n }\n }\n return null;\n }", "public String getParentNode()\r\n\t{\r\n\t\tif (roadBelongingType.equals(\"inbound\"))\r\n\t\t{\r\n\t\t\treturn endNode;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\treturn startNode;\r\n\t\t}\r\n\t}", "public Iterator trip() {\n\t\tStack path = new Stack();\n\t\ttry {\n\t\t\t// initializes path to the stack of nodes from starting point to end\n\t\t\t// point\n\t\t\tpath = path(BusLines, BusLines.getNode(start), BusLines.getNode(dest));\n\n\t\t\t// checks if there is a path, otherwise return null\n\t\t\tif (path == null) {\n\t\t\t\treturn null;\n\t\t\t} else {\n\t\t\t\treturn path.iterator();\n\t\t\t}\n\t\t} catch (GraphException e) {\n\t\t\tSystem.out.println(\"Error: the path does not exists.\");\n\t\t}\n\t\treturn null;\n\n\t}", "protected String printablePath(IVertex<String> target){\n\n String lineout = \"\";\n\n LinkedList<IVertex<String>> path = this.getPath(target);\n\n IVertex<String> previous = null;\n\n IVertex<String> next = null;\n\n if(path!=null) {\n Iterator<IVertex<String>> it = path.iterator();\n\n while (it.hasNext()) {\n\n previous = next;\n\n next = it.next();\n\n IWeightedEdge<String> prevedge = null;\n\n if(previous!=null && next!=null){\n prevedge = this.weightedGraph.getEdge(previous,next);\n }\n\n if(prevedge!=null)\n lineout+= \" \" +prevedge.getWeight() + \" \";\n\n lineout += \" \" + next.getValue() + \" \";\n }\n }\n return lineout;\n }", "@Override\n\tpublic boolean traverse(INode startNode, INode destinationNode) {\n\t\tif (isNeighbors(startNode, destinationNode) == true) {\n\t\t\tint zähler = 0;\n\t\t\tString result = \"\";\n\t\t\tMatrixNode startListNode = (MatrixNode) startNode;\n\t\t\tQueue<MatrixNode> queue = new ArrayDeque<>();\n\t\t\tqueue.add(startListNode);\n\t\t\tstartListNode.mark();\n\t\t\twhile (!queue.isEmpty()) { // solange queue nicht leer ist\n\t\t\t\t// erstes Element von der queue nehmen\n\t\t\t\tMatrixNode node = (MatrixNode) queue.poll();\n\t\t\t\tif (node.equals(destinationNode)) {\n\t\t\t\t\tSystem.out.println(\"Zähler: \" + zähler);\n\t\t\t\t\treturn true; // testen, ob Ziel-Knoten gefunden\n\t\t\t\t}\n\t\t\t\tfor (int i = 0; i < nodes.size(); i++) {\n\t\t\t\t\tif (isNeighbors(node, nodes.get(i))) {\n\t\t\t\t\t\tif (!((MatrixNode) nodes.get(i)).getMark()) {\n\t\t\t\t\t\t\tqueue.add((MatrixNode) nodes.get(i));\n\t\t\t\t\t\t\t((MatrixNode) nodes.get(i)).mark();\n\t\t\t\t\t\t\tresult += node.getName() + \"-\" + nodes.get(i).getName();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tzähler++;\n\t\t\t\tSystem.out.println(result + \"||\");\n\t\t\t}\n\t\t}\n\t\treturn false; // Knoten kann nicht erreicht werden\n\t}", "private List<Edge<String>> getPath(Vertex<String> end,\n Vertex<String> start) {\n if (graph.label(end) != null) {\n List<Edge<String>> path = new ArrayList<>();\n\n Vertex<String> cur = end;\n Edge<String> road;\n while (cur != start) {\n road = (Edge<String>) graph.label(cur); // unchecked cast ok\n path.add(road);\n cur = graph.from(road);\n }\n return path;\n }\n return null;\n }", "private void printPath(LinkedList<String> visited) {\r\n\r\n if (flag == false) {\r\n System.out.println(\"Yes there exists a path between \" + START + \" and \" + END);\r\n }\r\n for (String node : visited) { //creating for loop to print the nodes stored in visited array \r\n System.out.print(node);\r\n System.out.print(\" \");\r\n }\r\n System.out.println();\r\n }", "public String getOutput() {\n TopologicalOrderIterator<String, DefaultEdge> iterator =\n new TopologicalOrderIterator<>(steps, Comparator.comparing((String x) -> x));\n\n // Traverse the DAG and store each vertex to a StringBuilder\n // to output once traversal is completed\n StringBuilder sb = new StringBuilder();\n while (iterator.hasNext()) {\n sb.append(iterator.next());\n }\n\n return sb.toString();\n }", "private Queue<T> backtrace(T node, Map<T, T> parentMap) {\n LinkedList<T> path = new LinkedList<>();\n path.add(node);\n\n int previousX, previousY, currentX, currentY;\n int dx, dy;\n int steps;\n T temp;\n while (parentMap.containsKey(node)) {\n previousX = parentMap.get(node).x;\n previousY = parentMap.get(node).y;\n currentX = node.x;\n currentY = node.y;\n steps = Integer.max(Math.abs(previousX - currentX), Math.abs(previousY - currentY));\n dx = Integer.compare(previousX, currentX);\n dy = Integer.compare(previousY, currentY);\n\n temp = node;\n for (int i = 0; i < steps; i++) {\n temp = graph.getNode(temp.x + dx, temp.y + dy);\n path.addFirst(temp);\n }\n\n node = parentMap.get(node);\n }\n return path;\n }", "public static ArrayList<GraphNode> getPathTo(\n GraphNode startNode,\n GraphNode targetNode,\n int optimizeFor\n ) {\n PriorityQueue<GraphNodeWrapper> openList = new PriorityQueue<>(new GraphNodeWrapperComparator(targetNode));\n HashSet<GraphNode> closedSet = new HashSet<>();\n HashMap<GraphNode, Float> distanceToStart = new HashMap<>();\n distanceToStart.put(startNode, 0.f);\n\n GraphNodeWrapper startNodeWrapper = new GraphNodeWrapper(startNode);\n openList.add(startNodeWrapper);\n\n GraphNodeDistance graphNodeDistance = new GraphNodeDistance(optimizeFor);\n\n do {\n GraphNodeWrapper currentNode = openList.poll();\n assert currentNode != null;\n\n if (currentNode.graphNode.equals(targetNode)) {\n return currentNode.toList();\n }\n\n closedSet.add(currentNode.graphNode);\n\n expandNode(currentNode, openList, closedSet, distanceToStart, targetNode, graphNodeDistance);\n } while (!openList.isEmpty());\n\n return null;\n }", "private static LinkedList<Node> getRevesredPath(Node targetNode){\n LinkedList<Node> arr = new LinkedList<>();\n arr.add(targetNode);\n while(targetNode.pathFromSouce !=null){\n// System.out.println(targetNode);\n// System.out.println(targetNode.pathFromSouce);\n arr.add(targetNode.pathFromSouce);\n targetNode = targetNode.pathFromSouce;\n }\n return arr;\n }", "public LinkedList<Pair<DirType, Location>> getMove(int curX, int curY) {\n // find the shortest path to each coin from this current position (we don't actually care about\n // coins that we don't have a path to)\n // then, find the shortest path from each of those coins to each other coin\n\n // then, we want all Hamiltonian paths (and all subpaths?) Traveling Salesman Problem\n // i.e. we care about paths for as long as the number of steps it takes to complete\n // is less than or equal to the number of turns we have remaining\n\n // convert the Location[][] we have into David and Austin's LocationsToNode\n LocationsToNode graph = new LocationsToNode(maze);\n // knownCoins are ONLY the coins we have paths to. we will calculate the\n // shortest paths later. there are repeat calculations below.\n LinkedList<Node> coins = bfsFindCoins(graph, curX, curY);\n for (Node coinFrom : coins) {\n Location coinFromLoc = graph.getLocation(coinFrom);\n LinkedList<LinkedList<Location>> pathsToOthers = new LinkedList<LinkedList<Location>>();\n for (Node coinTo : coins) {\n Location coinToLoc = graph.getLocation(coinTo);\n LinkedList<Location> path = getShortestPath(coinFrom, coinTo, graph);\n pathsToOthers.add(path);\n }\n paths.put(coinFromLoc,pathsToOthers);\n }\n\n // calculating all possible Hamiltonian paths....\n // this is A LOT of paths we're talking about\n // i.e. we want every path that visits every single coin\n // so if we know 20 coins, starting at point 1, we have 19 choices\n // for the second point, 18 for the third, and so on (this is on the order of\n // n! total paths without dynamic programming, and might be too much brute force)\n // https://en.wikipedia.org/wiki/Hamiltonian_path#Properties\n // https://en.wikipedia.org/wiki/Travelling_salesman_problem#Heuristic_and_approximation_algorithms\n // https://stackoverflow.com/questions/16555978/example-of-a-factorial-time-algorithm-o-n\n // then, we will decide which Hamiltonian is the best for the number of\n // moves we have available to us\n\n // instead, i am going to try only calculating the paths we can actually make with our current number\n // of turns because we want the most coins in the fewest turns\n\n // WE ONLY CARE ABOUT THE LONGEST (COIN) PATH WITH THE SAME NUMBER OF TURNS\n\n return new LinkedList<Pair<DirType, Location>>();\n }", "private List<Path> expandExecution(Path input) {\n\t\tList<Path> childInputs = new ArrayList<>(); //store the paths generated from given path\n\t\t\n\t\t//search from the top node which have not been searched before\n\t\tfor(int j = input.bound; j < input.path.size() - 1; j++){\n\t\t\tdouble[] probabilityArray = cfg.getTransition_matrix().getRow(input.path.get(j));\n\t\t\tfor(int i = 0; i < probabilityArray.length; i++){\n\t\t\t\t//the node been visited before only have two situation:1.has been searched,2.the path contains it in the workList \n\t\t\t\tif(probabilityArray[i] > 0 && i != input.path.get(j + 1) && unvisited.contains(i)){\n\t\t\t\t\tList<Integer> tempPath = new ArrayList<>();\n\t\t\t\t\tfor(int index = 0; index < j + 1; index++)\n\t\t\t\t\t\ttempPath.add(input.path.get(index));\n\t\t\t\t\ttempPath.add(i);\n\t\t\t\t\t\n\t\t\t\t\tPath newInput = new Path(tempPath, j + 1);\n\t\t\t\t\tchildInputs.add(newInput);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\treturn childInputs;\n\t}", "public List<List<Integer>> allPathsSourceTarget(int[][] graph) {\n \n boolean[] visited = new boolean[graph.length];\n \n List<Integer> paths = new ArrayList();\n paths.add(0);\n \n List<List<Integer>> allPaths = new ArrayList();\n \n dfs(0,graph.length-1, paths,allPaths,visited,graph);\n \n return allPaths;\n }", "private void printPath( Vertex dest )\n {\n if( dest.prev != null )\n {\n printPath( dest.prev );\n // System.out.print( \" to \" );\n }\n System.out.print( dest.name +\" \" );\n }", "private void findBestPath(){\n\t\t// The method will try to find the best path for every starting point and will use the minimum\n\t\tfor(int start = 0; start < this.getDimension(); start++){\n\t\t\tfindBestPath(start);\t\n\t\t}\t\n\t}", "protected static void printPath(int[] thePath) {\r\n\t\t\r\n\t\tint[] orderedPath = new int[thePath.length];\r\n\t\r\n\t\tfor (int i = 0; i < thePath.length; i++)\r\n\t\t\torderedPath[i] = -1;\r\n\t\r\n\t\torderedPath[0] = myEndPole;\r\n\t\tint i = myEndPole;\r\n\t\tint j = 1;\r\n\t \r\n\t\twhile (true && j < orderedPath.length) {\t\r\n\t\t\tif (thePath[i] == -1 && i == START_POLE)\r\n\t\t\t\tbreak;\r\n\t\t\torderedPath[j] = thePath[i];\t\r\n\t\t\ti = thePath[i];\r\n\t\t\tj++;\r\n\t\t}\r\n\t\r\n\t\tSystem.out.print(\"The Shortest Path is \");\r\n\t\r\n\t\tfor (i = orderedPath.length - 1; i >= 0; i--) {\r\n\t\t\tif (orderedPath[i] == -1)\r\n\t\t\t\tcontinue;\r\n\t\t\tif (i == 0) {\r\n\t\t\t\tSystem.out.print((orderedPath[i] + 1));\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tSystem.out.print((orderedPath[i] + 1) + \" -> \");\r\n\t\t}\r\n\r\n\t\tSystem.out.println();\r\n\t\tSystem.out.println();\r\n\t}", "public static int p413ComputeShortestPathNumber(Vertex start, Vertex end){\n\t Queue<Vertex> queue=new LinkedList<Vertex>();\n\t Map<Vertex, Status> statusMap=new HashMap<Vertex, Status>();\n\t Map<Vertex, Integer> levelMap=new HashMap<Vertex, Integer>();\n\t List<List<Vertex>> allLevelList=new LinkedList<List<Vertex>>();\n\t \n\t queue.offer(start);\n\t statusMap.put(start, Status.Queued);\n\t levelMap.put(start, 0);\n\t \n\t Vertex vertex;\n\t int lastLevel=-1;\n\t List<Vertex> levelList = null;\n\t\twhile ((vertex = queue.poll()) != null) {\n\t\t\tint currentLevel = levelMap.get(vertex);\n\n\t\t\tif (currentLevel != lastLevel) {\n\t\t\t\tlastLevel = currentLevel;\n\t\t\t\tlevelList = new LinkedList<Vertex>();\n\n\t\t\t\tallLevelList.add(levelList);\n\t\t\t}\n\n\t\t\tlevelList.add(vertex);\n\n\t\t\tif (vertex.equals(end)) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tSet<Vertex> adjacentVertexes = vertex.getAdjacentVertexes();\n\t\t\tfor (Iterator iterator = adjacentVertexes.iterator(); iterator.hasNext();) {\n\t\t\t\tVertex adjacent = (Vertex) iterator.next();\n\n\t\t\t\tif (statusMap.get(adjacent) == null) {\n\t\t\t\t\tqueue.offer(adjacent);\n\t\t\t\t\tstatusMap.put(adjacent, Status.Queued);\n\t\t\t\t\tlevelMap.put(adjacent, currentLevel + 1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t \n\t int max=Integer.MIN_VALUE;\n\t List<Vertex> targetList=new LinkedList<Vertex>();\n\t targetList.add(end);\n\t for(int index=lastLevel-1;index>0;index--){\n\t\t List<Vertex> lastLevelList = allLevelList.get(index);\n\t\t List<Vertex> tmpList=new LinkedList<Vertex>();\n\n\t\t int count=0;\n\t\t for (Iterator iterator = lastLevelList.iterator(); iterator.hasNext();) {\n\t\t\t\tVertex lastLevelVertex = (Vertex) iterator.next();\n\t\t\t\tfor (Iterator iterator2 = targetList.iterator(); iterator2.hasNext();) {\n\t\t\t\t\tVertex vertex2 = (Vertex) iterator2.next();\n\t\t\t\t\tif(lastLevelVertex.getAdjacentVertexes().contains(vertex2)){\n\t\t\t\t\t count++;\n\t\t\t\t\t tmpList.add(lastLevelVertex);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t }\n\t\t \n\t\t targetList=tmpList;\n\t\t \n\t\t if(count>max){\n\t\t \tmax=count;\n\t\t }\n\t }\n\t \n\t return max;\n\t}", "@Nullable\n private NodeWithCost<V, A> findShortestPath(@Nonnull DirectedGraph<V, A> graph,\n V start, V goal, @Nonnull ToDoubleFunction<A> costf) {\n PriorityQueue< NodeWithCost<V, A>> frontier = new PriorityQueue<>(61);\n Map<V, NodeWithCost<V, A>> frontierMap = new HashMap<>(61);\n // Size of explored is the expected number of nextArrows that we need to explore.\n Set<V> explored = new HashSet<>(61);\n return doFindShortestPath(start, frontier, frontierMap, goal, explored, graph, costf);\n }" ]
[ "0.7252731", "0.68260264", "0.6671419", "0.66349065", "0.66123354", "0.6603679", "0.6580846", "0.65430224", "0.6503828", "0.6497051", "0.64705145", "0.6415798", "0.6354924", "0.6301623", "0.62661606", "0.6257092", "0.6247333", "0.6240979", "0.62342954", "0.6218692", "0.6201339", "0.61822736", "0.61638755", "0.6161555", "0.615784", "0.6138375", "0.6133091", "0.6125515", "0.60950845", "0.6085662", "0.60761076", "0.60759735", "0.60746396", "0.60578084", "0.6057716", "0.6049612", "0.60491455", "0.6041605", "0.60329497", "0.6028114", "0.60175735", "0.60131395", "0.59889805", "0.5967705", "0.59585255", "0.5923653", "0.59173286", "0.591711", "0.59079725", "0.5907154", "0.5892662", "0.5886021", "0.5880837", "0.5878566", "0.5874012", "0.5869622", "0.5866186", "0.5860932", "0.58500445", "0.5849529", "0.58494806", "0.58487463", "0.5843069", "0.58416235", "0.58367574", "0.5833183", "0.58330417", "0.58325326", "0.58245397", "0.5819622", "0.5815147", "0.5782093", "0.576774", "0.57615197", "0.5757075", "0.575676", "0.57487386", "0.5747141", "0.57447153", "0.573635", "0.5730695", "0.5728213", "0.5721447", "0.5717148", "0.5715856", "0.56990594", "0.56988406", "0.56945676", "0.5693827", "0.5693351", "0.56831473", "0.5678301", "0.56759375", "0.56749934", "0.56735426", "0.56707615", "0.56660664", "0.5662439", "0.565879", "0.5650343" ]
0.6826425
1
/ Here we take the expanded nodes and print it.
private void printExpanded(Queue<Node> expanded){ ArrayList<String> nodes = new ArrayList<>(); for(Node s : expanded){ if(s != null){ nodes.add(s.getDigit().getDigitString()); } } if (forbidden.size() == 0){ int size = nodes.size(); int index = 0; for(int m=0; m<size; m++){ if(index == size - 1){ System.out.print(nodes.get(index)); break; } System.out.print(nodes.get(index)+","); index++; } }else{ nodes.removeAll(forbidden); int size = nodes.size(); int index = 0; for(int m=0; m<size; m++){ if(index == size - 1){ System.out.print(nodes.get(index)); break; } System.out.print(nodes.get(index)+","); index++; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 }", "public void tree()\n\t{\n\t\tIterable<Position<FileElement>> toPrint = fileSystem.PreOrder();\n\t\tfor (Position<FileElement> p : toPrint)\n\t\t{\n\t\t\tint depth = fileSystem.getDepth(p);\n\t\t\tfor (int i = 0; i < depth; i++)\n\t\t\t{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t\tSystem.out.println(p.getValue());\n\t\t}\n\t}", "private void printFullTree()\r\n {\r\n System.out.println(fullXmlTree.toString());\r\n }", "private void printTree(Tree parse) {\n \t\tparse.pennPrint();\n \t}", "public void printNodes() {\n\t\tprintNodes(root);\n\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 printTree() {\n\t\tSystem.out.println(printHelp(root));\r\n\t\t\r\n\t}", "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 printTree(Tree parse) {\n\t\tparse.pennPrint();\n\t}", "public void printTree() {\n printTreeHelper(root);\n }", "public void displayNodes() {\n Node node = this.head;\n StringBuilder sb = new StringBuilder();\n while (node != null) {\n sb.append(node.data).append(\" \");\n node = node.next;\n };\n\n System.out.println(sb.toString());\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 }", "public void printOut() {\n\t\tif(root.left != null) {\n\t\t\tprintOut(root.left);\n\t\t}\n\t\t\n\t\tSystem.out.println(root.element);\n\t\t\n\t\tif(root.right != null) {\n\t\t\tprintOut(root.right);\n\t\t}\n\t}", "public static String printTree()\r\n {\r\n String result = \"\";\r\n for (String s: tree.toArrayList())\r\n result = result + \" \" + s;\r\n return result;\r\n }", "void Print() {\r\n\r\n AVLTreeNode node = root;\r\n\r\n printInorder(node);\r\n\r\n }", "void printNode() {\n\t\tint j;\n\t\tSystem.out.print(\"[\");\n\t\tfor (j = 0; j <= lastindex; j++) {\n\n\t\t\tif (j == 0)\n\t\t\t\tSystem.out.print (\" * \");\n\t\t\telse\n\t\t\t\tSystem.out.print(keys[j] + \" * \");\n\n\t\t\tif (j == lastindex)\n\t\t\t\tSystem.out.print (\"]\");\n\t\t}\n\t}", "public void printNode(Node n);", "public void print()\n {\n for (Node curr = first; curr != null; curr = curr.next)\n System.out.print(curr.val + \" \");\n System.out.println();\n }", "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 }", "public void printNodes(){\n for(int i =0; i<n;i++)\n System.out.print(key[i]+\" \");\n System.out.println(isLeaf);\n if (!isLeaf){\n for(int i =0; i<=n;i++){\n c[i].printNodes();\n }\n }\n }", "private static void PrintNode(Node n, String prefix, int depth) {\r\n\r\n\t\ttry {\r\n\t\t\tSystem.out.print(\"\\n\" + Pad(depth) + \"[\" + n.getNodeName());\r\n\t\t\tNamedNodeMap m = n.getAttributes();\r\n\t\t\tfor (int i = 0; m != null && i < m.getLength(); i++) {\r\n\t\t\t\tNode item = m.item(i);\r\n\t\t\t\tSystem.out.print(\" \" + item.getNodeName() + \"=\"\r\n\t\t\t\t\t\t+ item.getNodeValue());\r\n\t\t\t}\r\n\t\t\tSystem.out.print(\"] \");\r\n\r\n\t\t\tboolean has_text = false;\r\n\t\t\tif (n.getNodeType() == Node.TEXT_NODE) {\r\n\t\t\t\thas_text = true;\r\n\t\t\t\tString valn = n.getNodeValue().trim();\r\n\t\t\t\tif (valn.length() > 0)\r\n\t\t\t\t\tSystem.out.print(\"\\n\" + Pad(depth) + \" \\\"\" + valn + \"\\\"\");\r\n\t\t\t}\r\n\r\n\t\t\tNodeList cn = n.getChildNodes();\r\n\r\n\t\t\tfor (int i = 0; cn != null && i < cn.getLength(); i++) {\r\n\t\t\t\tNode item = cn.item(i);\r\n\t\t\t\tif (item.getNodeType() == Node.TEXT_NODE) {\r\n\t\t\t\t\tString val = item.getNodeValue().trim();\r\n\t\t\t\t\tif (val.length() > 0)\r\n\t\t\t\t\t\tSystem.out.print(\"\\n\" + Pad(depth) + val + \"\\\"\");\r\n\t\t\t\t} else\r\n\t\t\t\t\tPrintNode(item, prefix, depth + 2);\r\n\t\t\t}\r\n\t\t} catch (Exception e) {\r\n\t\t\tSystem.out.println(Pad(depth) + \"Exception e: \");\r\n\t\t}\r\n\t}", "public void printTree(){ \n System.out.format(\"The suffix tree for S = %s is: %n\",this.text); \n this.print(0, this.root); \n }", "public void print(){\n NodeD tmp = this.head;\n\n while(tmp!=null){\n System.out.println(tmp.getObject().asString());\n tmp = tmp.getNext();\n }\n }", "public void printAst(){\n explore(ctx);\n }", "public void printNodes() {\n\t\tNode currentNode = headNode;\n\t\tif(currentNode==null) {\n\t\t\tSystem.out.println(\" The Node is Null\");\n\t\t\treturn;\n\t\t} else {\n\t\t\tSystem.out.print(\" \"+ currentNode.getData());\n\t\t\twhile(currentNode.getNextNode()!=null) {\n\t\t\t\tcurrentNode = currentNode.getNextNode();\n\t\t\t\tSystem.out.print(\"=> \"+ currentNode.getData());\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t}", "private static void print(ArrayList<Node<BinaryTreeNode<Integer>>> n) {\n\t\tfor(int i=0; i<n.size(); i++) {\n\t\t\tNode<BinaryTreeNode<Integer>> head = n.get(i);\n\t\t\twhile(head != null) {\n\t\t\t\tSystem.out.print(head.data.data+\" \");\n\t\t\t\thead = head.next;\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t}\n\t}", "public void print()\n\t{\n\t\tDNode tem=first;\n\t\tSystem.out.print(tem.distance+\" \");\n\t\twhile(tem.nextDNode!=null)\n\t\t{\n\t\t\ttem=tem.nextDNode;\n\t\t\tSystem.out.print(tem.distance+\" \");\n\t\t}\n\t\tSystem.out.println();\n\t}", "public void printAllNodes() {\n\t\tNode current = head;\n\n\t\twhile( current != null ) {\n\t\t\tSystem.out.println(current.data);\n\t\t\tcurrent = current.next;\n\t\t}\n\t}", "public String printTree() {\n printSideways();\n return \"\";\n }", "public void print() {\n\t\tprint(root);\n\t}", "public void print(){\n inorderTraversal(this.root);\n }", "public void printSubNodes(int depth) {\r\n super.printSubNodes(depth);\r\n\r\n if (orderByList != null) {\r\n printLabel(depth, \"orderByList: \");\r\n orderByList.treePrint(depth + 1);\r\n }\r\n if (offset != null) {\r\n printLabel(depth, \"offset: \");\r\n offset.treePrint(depth + 1);\r\n }\r\n if (fetchFirst != null) {\r\n printLabel(depth, \"fetchFirst: \");\r\n fetchFirst.treePrint(depth + 1);\r\n }\r\n }", "public void summarize () {\n\n TreeNodeVisitor visitor = new TreeNodeVisitor();\n traversal (visitor);\n visitor.log();\n \n }", "public void print() {\n\t\ttraversePreOrder(root, 0);\n\t}", "public void printTree() {\r\n printTree(overallRoot, 0);\r\n }", "private static void printNode(@Nonnull Node<OWLClass> node) {\n DefaultPrefixManager pm = new DefaultPrefixManager(null, null, \"http://owl.man.ac.uk/2005/07/sssw/people#\");\n // Print out a node as a list of class names in curly brackets\n for (Iterator<OWLClass> it = node.getEntities().iterator(); it.hasNext();) {\n OWLClass cls = it.next();\n // User a prefix manager to provide a slightly nicer shorter name\n String shortForm = pm.getShortForm(cls);\n\n System.out.println(\"Short Name: \"+shortForm);\n //assertNotNull(shortForm);\n }\n }", "private void printNode() {\n System.out.println(\"value:\" + value + \" next:\" + nextNode);\n }", "static void postorderPrint(TreeNode node) {\n if (node == null)\n return;\n\n Iterator iter = node.getChildren().iterator();\n while (iter.hasNext()) {\n postorderPrint((TreeNode) iter.next());\n }\n System.out.print(\" \" + node.data);\n }", "public void PrintMe() {\n\t\t/* AST NODE TYPE = AST EXP NIL */\n\t\t/**********************************/\n\t\tSystem.out.print(\"AST NODE: EXP_EXP\\n\");\n\n\t\t/*****************************/\n\t\t/* RECURSIVELY PRINT exp ... */\n\t\t/*****************************/\n\t\tif (exp != null) exp.PrintMe();\n\n\t\t/*********************************/\n\t\t/* Print to AST GRAPHIZ DOT file */\n\t\t/*********************************/\n\t\tAST_GRAPHVIZ.getInstance().logNode(\n\t\t\tSerialNumber,\n \"(exp)\");\n \n\t\t/****************************************/\n\t\t/* PRINT Edges to AST GRAPHVIZ DOT file */\n\t\t/****************************************/\n\t\tAST_GRAPHVIZ.getInstance().logEdge(SerialNumber, exp.SerialNumber);\n\n\t}", "static void preorderPrint(TreeNode node) {\n if (node == null)\n return;\n\n System.out.print(\" \" + node.data);\n Iterator iter = node.getChildren().iterator();\n while (iter.hasNext()) {\n preorderPrint((TreeNode) iter.next());\n }\n }", "public void print()\r\n {\r\n print(root);\r\n }", "void print() {\t\r\n\t\tIterator<Elemento> e = t.iterator();\r\n\t\twhile(e.hasNext())\r\n\t\t\te.next().print();\r\n\t}", "@Override\n\tpublic void printNode() {\n\t\tSystem.out.println(\"------Args_list------\");\n\t\te.printNode();\n\t\tif(a!=null)\n\t\t\ta.printNode();\n\t\t\n\t}", "private void printTree(AvlNode<E> node){\n if(node != null){\n printTree(node.left);\n System.out.print(node.value);\n System.out.print(\" \");\n printTree(node.right);\n }\n }", "public void display() {\n ITree.Node root = this.createNode(0);\n TreePrinter.printNode(root);\n }", "public void prettyPrintTree() {\r\n\t\tSystem.out.print(\"prettyPrintTree starting\");\r\n\t\tfor (int i = 0; i <= this.getTreeDepth(); i++) {\r\n\t\t\tprettyPrintTree(root, 0, i);\r\n\t\t\tSystem.out.println();\r\n\t\t}\r\n\t}", "private void printTree( BinaryNode<AnyType> t )\r\n\t{\r\n\t\tif( t != null )\r\n\t\t{\t\t\t\r\n\t\t\tprintTree( t.left );\r\n\t\t\tSystem.out.print( t.element+\" \");\r\n\t\t\tprintTree( t.right );\r\n\t\t}\r\n\t}", "public void postOrderPrint() {\n\t\tpostOrderPrint(root);\n\t\tSystem.out.println();\n\t}", "private void printTree(BinaryNode<AnyType> t) {\r\n\t\tif (t != null) {\r\n\t\t\tprintTree(t.left);\r\n\t\t\tSystem.out.println(t.element);\r\n\t\t\tprintTree(t.right);\r\n\t\t}\r\n\t}", "public void print() {\n\t\tSystem.out.println(\"DECISION TREE\");\n\t\tString indent = \" \";\n\t\tprint(root, indent, \"\");\n\t}", "public void printInOrder() { // not to be changed\n\t\tprintInOrder(root);\n\t}", "public void print(){\n if (isLeaf){\n for(int i =0; i<n;i++)\n System.out.print(key[i]+\" \");\n System.out.println();\n }\n else{\n for(int i =0; i<n;i++){\n c[i].print();\n System.out.print(key[i]+\" \");\n }\n c[n].print();\n }\n }", "public void print() {\r\n\t\tif(isEmpty()) {\r\n\t\t\tSystem.out.printf(\"%s is Empty%n\", name);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tSystem.out.printf(\"%s: %n\", name);\r\n\t\tNode<E> current = first;//node to traverse the list\r\n\t\t\r\n\t\twhile(current != null) {\r\n\t\t\tSystem.out.printf(\"%d \", current.data);\r\n\t\t\tcurrent = current.next;\r\n\t\t}\r\n\t\tSystem.out.println();\r\n\t}", "public static void display(Node root){\r\n String str = \"[\"+root.data+\"] -> \";\r\n for(Node child : root.children){\r\n str += child.data + \", \";\r\n }\r\n System.out.println(str + \" . \");\r\n \r\n for(int i=0; i<root.children.size(); i++){\r\n Node child = root.children.get(i);\r\n display(child);\r\n }\r\n }", "public static String printTree()\n {\n \tString tree = \"\";\n ArrayList<String> letters = converter.toArrayList();\n for(int i = 0; i < letters.size(); i++)\n {\n tree += letters.get(i);\n if(i + 1 < letters.size())\n \t tree += \" \";\n }\n \n return tree;\n }", "protected void printTree(){\n if (this.leftNode != null){\n leftNode.printTree();\n }\n System.out.println(value);\n\n if (this.rightNode != null){\n rightNode.printTree();\n }\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 levelOrderPrint() {\n\t\tlevelOrderPrint(root);\n\t}", "public void displayNode() {\n\t\t\tSystem.out.println(\"{ \" + data + \" } \");\n\t\t}", "public void printLDR() {\n if(!empty()) {\n printLDRNodes(root);\n System.out.println();\n }\n }", "public void PrintMe(){\r\n\t\t/* AST NODE TYPE = AST SUBSCRIPT VAR */\r\n\t\t/*************************************/\r\n\t\tSystem.out.print(\"AST NODE PAREN EXP\\n\");\r\n \r\n\t\t\r\n\t\t/***************************************/\r\n\t\t/* PRINT Node to AST GRAPHVIZ DOT file */\r\n\t\t/***************************************/\r\n\t\tAST_GRAPHVIZ.getInstance().logNode(\r\n\t\t\tSerialNumber,\r\n\t\t\t\"(exp)\");\r\n\t\tif (e != null) AST_GRAPHVIZ.getInstance().logEdge(SerialNumber,e.SerialNumber);\r\n \r\n }", "public void printTopView() {\r\n\t\tfinal ArrayList<Integer> nodeDataList = new ArrayList<>();\r\n\r\n\t\tgetLeftChildren(rootNode.left, nodeDataList);\r\n\t\tnodeDataList.add(rootNode.data);\r\n\t\tgetRightChildren(rootNode.right, nodeDataList);\r\n\r\n\t\tSystem.out.println(\"Printing Top View\");\r\n\r\n\t\tnodeDataList.forEach(nodeData -> {\r\n\t\t\tSystem.out.print(nodeData + \" \");\r\n\t\t});\r\n\t}", "public void printInfo() {\n\t\tString nodeType = \"\";\n\t\tif (nextLayerNodes.size() == 0) {\n\t\t\tnodeType = \"Output Node\";\n\t\t} else if (prevLayerNodes.size() == 0) {\n\t\t\tnodeType = \"Input Node\";\n\t\t} else {\n\t\t\tnodeType = \"Hidden Node\";\n\t\t}\n\t\tSystem.out.printf(\"%n-----Node Values %s-----%n\", nodeType);\n\t\tSystem.out.printf(\"\tNumber of nodes in next layer: %d%n\", nextLayerNodes.size());\n\t\tSystem.out.printf(\"\tNumber of nodes in prev layer: %d%n\", prevLayerNodes.size());\n\t\tSystem.out.printf(\"\tNext Layer Node Weights:%n\");\n\t\tNode[] nextLayer = new Node[nextLayerNodes.keySet().toArray().length];\n\t\tfor (int i = 0; i < nextLayer.length; i++) {\n\t\t\tnextLayer[i] = (Node) nextLayerNodes.keySet().toArray()[i];\n\t\t}\n\t\tfor (int i = 0; i < nextLayerNodes.size(); i++) {\n\t\t\tSystem.out.printf(\"\t\t# %f%n\", nextLayerNodes.get(nextLayer[i]));\n\t\t}\n\t\tSystem.out.printf(\"%n\tPartial err partial out = %f%n%n\", getPartialErrPartialOut());\n\t}", "public void printAll() {\n Node node = head;\n\n while (node != null) {\n System.out.println(node.getStudent());\n node = node.getLink();\n }\n System.out.println();\n }", "public static void print()\r\n\t {\r\n\t\t Node n = head; \r\n\t\t\t\r\n\t\t\twhile(n!=null)\r\n\t\t\t{\r\n\t\t\t\tSystem.out.print(n.data+\" \");\r\n\t\t\t\r\n\t\t\t\tn=n.next;\r\n\t\t\t\t\r\n\t\t\t}\r\n\t }", "public void print(){\r\n\t\t\tNode temp = this.head;\r\n\t\t\twhile(temp!=null){\r\n\t\t\t\tSystem.out.print(\"| prev=\"+temp.prev+\", val=\"+temp.val+\", next=\"+temp.next+\" |\");\r\n\t\t\t\ttemp = temp.next;\r\n\t\t\t}\r\n\t\t\tSystem.out.println();\r\n\t\t}", "private void printInOrder(TreeNode N) {\n\t\tSystem.out.print(\"(\");\n\t\tif (N!=null) {\n\t\t\tprintInOrder(N.getLeftChild());\n\t\t\tSystem.out.print(N.getIsUsed());\n\t\t\tprintInOrder(N.getRightChild());\n\n\t\t}\n\t\tSystem.out.print(\")\");\n\t}", "void printNodesWithEdges()\n {\n for ( int i = 0; i < this.numNodes; i++ )\n {\n Node currNode = this.nodeList.get(i);\n System.out.println(\"Node id: \" + currNode.id );\n \n int numEdges = currNode.connectedNodes.size();\n for ( int j = 0; j < numEdges; j++ )\n {\n Node currEdge = currNode.connectedNodes.get(j);\n System.out.print(currEdge.id + \",\");\n }\n\n System.out.println();\n } \n\n \n }", "public void print(Node node) \n{\n PrintWriter w = new PrintWriter(new OutputStreamWriter(System.out), true);\n print(node, w);\n}", "public void printGraphStructure() {\n\t\tSystem.out.println(\"Vector size \" + nodes.size());\n\t\tSystem.out.println(\"Nodes: \"+ this.getSize());\n\t\tfor (int i=0; i<nodes.size(); i++) {\n\t\t\tSystem.out.print(\"pos \"+i+\": \");\n\t\t\tNode<T> node = nodes.get(i);\n\t\t\tSystem.out.print(node.data+\" -- \");\n\t\t\tIterator<EDEdge<W>> it = node.lEdges.listIterator();\n\t\t\twhile (it.hasNext()) {\n\t\t\t\tEDEdge<W> e = it.next();\n\t\t\t\tSystem.out.print(\"(\"+e.getSource()+\",\"+e.getTarget()+\", \"+e.getWeight()+\")->\" );\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t}\n\t}", "void printNodes(){\n\t\tfor(int i=0;i<Table.length;i++){\r\n\t\t\tfor(StockNode t=Table[i];t!=null;t=t.next){\r\n\t\t\t\tSystem.out.println(t.stockName+\":\"+t.stockValue+\" \"+t.transactions);\t\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private void print(Node x) {\n\t\tif (x == null) return;\n\t\tprint(x.getLeft());\n\t\tSystem.out.println(x);\n\t\tprint(x.getRight());\n\t}", "@Override\r\n public String toString() {\r\n Queue<List<Node>> queue = new LinkedList<List<Node>>();\r\n queue.add(Arrays.asList(root));\r\n StringBuilder sb = new StringBuilder();\r\n while (!queue.isEmpty()) {\r\n Queue<List<Node>> nextQueue = new LinkedList<List<Node>>();\r\n while (!queue.isEmpty()) {\r\n List<Node> nodes = queue.remove();\r\n sb.append('{');\r\n Iterator<Node> it = nodes.iterator();\r\n while (it.hasNext()) {\r\n Node node = it.next();\r\n sb.append(node.toString());\r\n if (it.hasNext())\r\n sb.append(\", \");\r\n if (node instanceof BPTree.InternalNode)\r\n nextQueue.add(((InternalNode) node).children);\r\n }\r\n sb.append('}');\r\n if (!queue.isEmpty())\r\n sb.append(\", \");\r\n else {\r\n sb.append('\\n');\r\n }\r\n }\r\n queue = nextQueue;\r\n }\r\n return sb.toString();\r\n }", "public void printTree(Node n) {\r\n\t\tif( !n.isNil ) {\r\n\t\t\tSystem.out.print(\"Key: \" + n.key + \" c: \" + n.color + \" p: \" + n.p + \" v: \"+ n.val + \" mv: \" + n.maxval + \"\\t\\tleft.key: \" + n.left.key + \"\\t\\tright.key: \" + n.right.key + \"\\n\");\r\n\t\t\tprintTree(n.left);\r\n\t\t\tprintTree(n.right);\r\n\t\t}\r\n\t}", "void print() {\n Node current = this;\n while (current != null) {\n System.out.format(\"%d \", current.value);\n current = current.next;\n }\n System.out.println();\n }", "@Override\n public String print() {\n ArrayList<K> inorderTraverse = inOrdorTraverseBST();\n \n System.out.print(\"In ascending order: \");\n for (int i=0; i<inorderTraverse.size(); i++) {\n System.out.print(inorderTraverse.get(i)+\" \");\n }\n System.out.println(\"\");\n return \"\";\n }", "public void printDLR() {\n if(!empty()) {\n printDLRNodes(root);\n System.out.println();\n }\n }", "@Override\n\t\tpublic String toString() {\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tpreOrderTraverse(expression.root, 1, sb);\n\t\t\treturn sb.toString();\n\t\t}", "public void print_list() {\n \t \n \t//define current node as\n \t node<Type> current_node = new node<>();\n \t \n \t //now keep for loop and print the answer\n \t current_node = head;\n \t \n \t //print first element\n \t System.out.println(current_node.show_element());\n \t \n \t //now run for loop\n \t for (int i = 1 ; i <= len - 1 ; i ++) {\n \t\t \n \t\t //change current node\n \t\t current_node = current_node.show_next();\n \t\t \n \t\t //just print the answer\n \t\t System.out.println(current_node.show_element());\n \t }\n }", "@Override\n public String toString() { // display subtree in order traversal\n String output = \"[\";\n LinkedList<Node<T>> q = new LinkedList<>();\n q.add(this);\n while(!q.isEmpty()) {\n Node<T> next = q.removeFirst();\n if(next.leftChild != null) q.add(next.leftChild);\n if(next.rightChild != null) q.add(next.rightChild);\n output += next.data.toString();\n if(!q.isEmpty()) output += \", \";\n }\n return output + \"]\";\n }", "void printLevelOrder() {\n TreeNode2 nextLevelRoot = this;\n while (nextLevelRoot != null) {\n TreeNode2 current = nextLevelRoot;\n nextLevelRoot = null;\n while (current != null) {\n System.out.print(current.val + \" \");\n if (nextLevelRoot == null) {\n if (current.left != null)\n nextLevelRoot = current.left;\n else if (current.right != null)\n nextLevelRoot = current.right;\n }\n current = current.next;\n }\n System.out.println();\n }\n }", "public void PrintMe()\r\n\t{\r\n\t\t/************************************/\r\n\t\t/* AST NODE TYPE = EXP NIL AST NODE */\r\n\t\t/************************************/\r\n\t\tSystem.out.print(\"AST NODE EXP NIL\\n\");\r\n\r\n\t\t\r\n\t\t/*********************************/\r\n\t\t/* Print to AST GRAPHIZ DOT file */\r\n\t\t/*********************************/\r\n\t\tAST_GRAPHVIZ.getInstance().logNode(\r\n\t\t\tSerialNumber,\r\n\t\t\t\"EXP\\nNIL\");\r\n\t\t\t\r\n\t}", "private static String printNode(Node node) {\n\t\tif (node instanceof TextNode) {\n\t\t\tTextNode textNode = (TextNode) node;\n\t\t\treturn addEscapes(\n\t\t\t\t\ttextNode.getText(),\n\t\t\t\t\tEscapableArrays.textEscapable(),\n\t\t\t\t\tParserDelimiters.ESCAPE_DELIMITER.getValue()\n\t\t\t);\n\t\t}\n\t\t\n\t\tif (node instanceof ForLoopNode) {\n\t\t\treturn printForLoopNode((ForLoopNode) node);\n\t\t}\n\t\t\n\t\tif (node instanceof EchoNode) {\n\t\t\treturn printEchoNode((EchoNode) node);\n\t\t}\n\t\t\n\t\treturn \"\";\n\t}", "public void print() {\n\t\tNode temp = head;\n\n\t\tif(temp == null) {\n\t\t\treturn;\n\t\t} \n\n\t\twhile(temp.next != null) {\n\t\t\tSystem.out.print(temp.data + \"->\");\n\t\t\ttemp = temp.next;\n\t\t}\n\t\tSystem.out.println(temp.data);\n\t}", "private void echo(Node n) {\n\t outputIndentation();\n\t int type = n.getNodeType();\n\n\t switch (type) {\n\t case Node.ATTRIBUTE_NODE:\n\t out.print(\"ATTR:\");\n\t printlnCommon(n);\n\t break;\n\n\t case Node.CDATA_SECTION_NODE:\n\t out.print(\"CDATA:\");\n\t printlnCommon(n);\n\t break;\n\n\t case Node.COMMENT_NODE:\n\t out.print(\"COMM:\");\n\t printlnCommon(n);\n\t break;\n\n\t case Node.DOCUMENT_FRAGMENT_NODE:\n\t out.print(\"DOC_FRAG:\");\n\t printlnCommon(n);\n\t break;\n\n\t case Node.DOCUMENT_NODE:\n\t out.print(\"DOC:\");\n\t printlnCommon(n);\n\t break;\n\n\t case Node.DOCUMENT_TYPE_NODE:\n\t out.print(\"DOC_TYPE:\");\n\t printlnCommon(n);\n\t NamedNodeMap nodeMap = ((DocumentType)n).getEntities();\n\t indent += 2;\n\t for (int i = 0; i < nodeMap.getLength(); i++) {\n\t Entity entity = (Entity)nodeMap.item(i);\n\t echo(entity);\n\t }\n\t indent -= 2;\n\t break;\n\n\t case Node.ELEMENT_NODE:\n\t out.print(\"ELEM:\");\n\t printlnCommon(n);\n\n\t NamedNodeMap atts = n.getAttributes();\n\t indent += 2;\n\t for (int i = 0; i < atts.getLength(); i++) {\n\t Node att = atts.item(i);\n\t echo(att);\n\t }\n\t indent -= 2;\n\t break;\n\n\t case Node.ENTITY_NODE:\n\t out.print(\"ENT:\");\n\t printlnCommon(n);\n\t break;\n\n\t case Node.ENTITY_REFERENCE_NODE:\n\t out.print(\"ENT_REF:\");\n\t printlnCommon(n);\n\t break;\n\n\t case Node.NOTATION_NODE:\n\t out.print(\"NOTATION:\");\n\t printlnCommon(n);\n\t break;\n\n\t case Node.PROCESSING_INSTRUCTION_NODE:\n\t out.print(\"PROC_INST:\");\n\t printlnCommon(n);\n\t break;\n\n\t case Node.TEXT_NODE:\n\t out.print(\"TEXT:\");\n\t printlnCommon(n);\n\t break;\n\n\t default:\n\t out.print(\"UNSUPPORTED NODE: \" + type);\n\t printlnCommon(n);\n\t break;\n\t }\n\n\t indent++;\n\t for (Node child = n.getFirstChild(); child != null;\n\t child = child.getNextSibling()) {\n\t echo(child);\n\t }\n\t indent--;\n\t}", "@Override\r\npublic void Display(int depth) {\n\tSystem.out.println(\"-\"+depth);\r\n children.forEach(com->com.Display(depth+2));\r\n }", "public void print() {\r\n\r\n Node currentNode = this.head;\r\n while (currentNode != null) {\r\n System.out.print(currentNode.data + \" \");\r\n currentNode = currentNode.next;\r\n }\r\n\r\n }", "public void displayNode() // display ourself\n\t{\n\t\tSystem.out.print('{');\n\t\tSystem.out.print(iData);\n\t\t\n\t\tSystem.out.print(\"} \");\n\t}", "String showAllNodes();", "public void print(){\n String res = \"\" + this.number;\n for(Edge edge: edges){\n res += \" \" + edge.toString() + \" \";\n }\n System.out.println(res.trim());\n }", "public void print() {\n\t\tIntNode curr;\n\t\tfor (curr = head; curr != null; curr = curr.next) {\n\t\t\tSystem.out.print(curr.key + \" \");\n\t\t}\n\t\tSystem.out.println();\n\t}", "public void printNode(){\r\n // make an appropriately lengthed array of formatting\r\n // to separate rows/space coordinates\r\n String[] separators = new String[puzzleSize + 2];\r\n separators[0] = \"\\n((\";\r\n for (int i=0; i<puzzleSize; i++)\r\n separators[i+1] = \") (\";\r\n separators[puzzleSize+1] = \"))\";\r\n // print the rows\r\n for (int i = 0; i<puzzleSize; i++){\r\n System.out.print(separators[i]);\r\n for (int j = 0; j<puzzleSize; j++){\r\n System.out.print(this.state[i][j]);\r\n if (j<puzzleSize-1)\r\n System.out.print(\" \");\r\n }\r\n }\r\n // print the space's coordinates\r\n int x = (int)this.space.getX();\r\n int y = (int)this.space.getY();\r\n System.out.print(separators[puzzleSize] + x + \" \" + y + separators[puzzleSize+1]);\r\n }", "public void printList() {\n\t\tNode tnode = head;\n\t\twhile (tnode != null) {\n\t\t\tSystem.out.print(tnode.data + \"->\");\n\t\t\ttnode = tnode.next;\n\t\t}\n\t}", "void printpopulateInorderSucc(Node t){\n\t\n\n}", "public abstract List<Node> expand();", "public void show() {\n\n\t\tNode n = head;\n\t\twhile (n.next != null) {\n\t\t\t//logger.info(n.data);\n\t\t\tn = n.next;\n\t\t}\n\t\t//logger.info(n.data);\n\n\t}", "void printPostorder() { \n\t\tprintPostorder(root);\n\t}", "public void print() {\n\t\tint i = 1;\n\t\tfor (String s: g.keySet()) {\n\t\t\tSystem.out.print(\"Element: \" + i++ + \" \" + s + \" --> \");\n\t\t\tfor (String k: g.get(s)) {\n\t\t\t\tSystem.out.print(k + \" ### \");\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t}\n\t}", "public void printGraph()\n {\n Iterator<T> nodeIterator = nodeList.keySet().iterator();\n \n while (nodeIterator.hasNext())\n {\n GraphNode curr = nodeList.get(nodeIterator.next());\n \n while (curr != null)\n {\n System.out.print(curr.nodeId+\"(\"+curr.parentDist+\")\"+\"->\");\n curr = curr.next;\n }\n System.out.print(\"Null\");\n System.out.println();\n }\n }", "public void print(Node node, PrintWriter w)\n{\n print(node, 0, w);\n}" ]
[ "0.75091845", "0.7240713", "0.71894604", "0.70823896", "0.7065136", "0.706287", "0.7039093", "0.6979379", "0.69171613", "0.6915615", "0.6894241", "0.6880421", "0.6855082", "0.6846921", "0.6829338", "0.6819054", "0.68090576", "0.67836213", "0.6773025", "0.67710125", "0.6757601", "0.674866", "0.6733039", "0.6723227", "0.6713387", "0.6659839", "0.66587305", "0.6650472", "0.66494155", "0.66379553", "0.6632483", "0.66287947", "0.6613763", "0.6612235", "0.65946496", "0.65937734", "0.6582802", "0.6575682", "0.6565965", "0.6561957", "0.6541086", "0.6527261", "0.6526091", "0.6521472", "0.64987785", "0.6489991", "0.6482849", "0.64769375", "0.6472585", "0.6466965", "0.6461414", "0.6456195", "0.6453549", "0.6451633", "0.64495826", "0.6442533", "0.6438339", "0.6431009", "0.6429392", "0.6428141", "0.6426455", "0.64216673", "0.6419693", "0.6418471", "0.6414064", "0.64101976", "0.6404691", "0.64043987", "0.6403127", "0.63773793", "0.6376441", "0.6362495", "0.6361775", "0.6360222", "0.63577706", "0.6357732", "0.6349285", "0.6348226", "0.6345307", "0.63434243", "0.6338806", "0.63349533", "0.63304853", "0.63279706", "0.63182604", "0.63103515", "0.6307593", "0.6290412", "0.6286285", "0.62795484", "0.6273416", "0.6269881", "0.626576", "0.6263821", "0.62551665", "0.6250373", "0.624927", "0.62434417", "0.62429106", "0.62410915" ]
0.7714829
0
/ Here we temporarily make the children. No parentchild connections are made here. This is a helper function to cycleCheck
private ArrayList<String> makeChildren(Node current) { ArrayList<String> current_children = new ArrayList<>(); if (current != null && current.getDigit().last_changed != 0) { //-1 child first digit if ((Integer.parseInt(current.getDigit().getFirst_digit()) - 1 >= 0)) { String child_node = current.getDigit().decreaseFirstDigit(); current_children.add(child_node); } //+1 child first digit if ((Integer.parseInt(current.getDigit().getFirst_digit()) + 1 <= 9)) { String child_node = current.getDigit().increaseFirstDigit(); current_children.add(child_node); } } if (current != null && current.getDigit().last_changed != 1) { //-1 child if ((Integer.parseInt(current.getDigit().getSecond_digit()) - 1 >= 0)) { String child_node = current.getDigit().decreaseSecondDigit(); current_children.add(child_node); } //+1 child if ((Integer.parseInt(current.getDigit().getSecond_digit()) + 1 <= 9)) { String child_node = current.getDigit().increaseSecondDigit(); current_children.add(child_node); } } if (current != null && current.getDigit().last_changed != 2) { //-1 child if ((Integer.parseInt(current.getDigit().getThird_digit()) - 1 >= 0)) { String child_node = current.getDigit().decreaseThirdDigit(); current_children.add(child_node); } //+1 child if ((Integer.parseInt(current.getDigit().getThird_digit()) + 1 <= 9)) { String child_node = current.getDigit().increaseThirdDigit(); current_children.add(child_node); } } return current_children; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void createChildren() {\n\t\t\n\t\tfor(int i=0;i<horizontal;i++) {\n\t\t\t\n\t\t\tAction a = new Action(i);\n\t\t\tif(!gameOver && actionIsValid(a)) {\n\t\t\t\t\n\t\t\t\tPlayer otherPlayer;\n\t\t\t\t\n\t\t\t\tif(player == Player.PLAYER_BLUE) {\n\t\t\t\t\totherPlayer = Player.PLAYER_RED;\n\t\t\t\t}else {\n\t\t\t\t\totherPlayer = Player.PLAYER_BLUE;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tPosition newPosition;\n\t\t\t\tnewPosition = new Position(a, ++moveCounter, otherPlayer, this);\n\t\t\t\tchildren.add(newPosition);\t\n\t\t\t}\n\t\t}\n\t}", "public static void computeChildren() {\n\t\tArrayList<BNNode> children = new ArrayList<BNNode>();\n\t\t// For each node, build an array of children by checking which nodes have it as a parent.\n\t\tfor (BNNode node : nodes) {\n\t\t\tchildren.clear();\n\t\t\tfor (BNNode node2 : nodes) {\n\t\t\t\tif (node == node2)\n\t\t\t\t\tcontinue;\n\t\t\t\tfor (BNNode node3 : node2.parents)\n\t\t\t\t\tif (node3 == node)\n\t\t\t\t\t\tchildren.add(node2);\n\t\t\t}\n\t\t\tnode.children = new BNNode[children.size()];\n\t\t\tnode.children = (BNNode[]) children.toArray(node.children);\n\t\t}\n\t}", "public void reloadChildren() {\n // clear children list. If later none get created, then there shouldn't be any\n clearChildren();\n // check if budgetAccount has sub budgets\n List<BudgetAccountBE> subBudgets = refAcc.getDirectSubBudgets();\n int childCount = subBudgets.size();\n // only act, if referenceAccount has sub budgets\n if (childCount > 0) {\n int newLevel = hierarchyLevel + 1;\n // differentiate isLast for children\n for (int index = 0; index < childCount; index++) {\n BudgetAccountTableRow newRow = BudgetAccountTableRow.getInstance(parentActivity);\n children.add(newRow);\n newRow.init(budgetListener, subBudgets.get(index), (index == childCount -1), newLevel);\n }\n }\n }", "public void growthCycle() {\n\t\tboolean doMore = true;\n\t\tdo {\n\t\t\tdoMore = false;\n\t\t\tgrower = planter;\n\t\t\tCollections.shuffle(grower, random);\n\t\t\tplanter = new ArrayList<Room>();\n\t\t\tfor(Room room : grower) {\n\t\t\t\tif(rooms.size() >= size.maxRooms) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif(room.plantChildren(this)) {\n\t\t\t\t\t//System.out.println(\"Added side room.\");\n\t\t\t\t\tdoMore = true;\n\t\t\t\t}\n\t\t\t} \n\t\t} while(doMore);\t\t\n\t\t//DoomlikeDungeons.profiler.endTask(\"Adding Rooms (growthCycle)\");\n\t}", "public void selectParents1() {\n // Create a new parent list for this reproductive cycle. Let the garbage\n // handler dispose of the old list, if there was one.\n switch (Defines.parentAlgo) {\n case Defines.PA_RANDOM:\n this.parents = this.selectParentsRandom();\n break;\n\n case Defines.PA_ROULETTE:\n this.parents = this.selectParentsRoulette();\n break;\n\n case Defines.PA_TOURNAMENT:\n this.parents = this.selectParentsTournament();\n break;\n }\n// this.howGoodAreParents();\n }", "@Override\r\n\tpublic void makeChildcare() {\n\t\t\r\n\t}", "public void init$Children() {\n }", "public void init$Children() {\n }", "public void init$Children() {\n }", "public static void checkCycleSample() {\n Node ll1_5 = new Node(1, new Node(2, new Node(3, new Node(4, new Node(5, null)))));\n\n Node ll1_2 = new Node(1, new Node(2, null));\n Node ll3_4 = new Node(3, new Node(4, null));\n Node ll5_6 = new Node(5, new Node(6, null));\n ll1_2.nextNode.nextNode = ll3_4;\n ll3_4.nextNode.nextNode = ll5_6;\n ll5_6.nextNode.nextNode = ll1_2;\n\n ll1_2.checkCycle();\n ll1_5.checkCycle();\n }", "protected void prepareToExecuteChildren()\n \t{\n \t\tcollectExecutableElements();\n \t}", "public void selectParents() {\n // Create a new parent list for this reproductive cycle. Let the garbage\n // handler dispose of the old list, if there was one.\n switch (Defines.parentAlgo) {\n case Defines.PA_RANDOM:\n this.parents = this.selectParentsRandom();\n break;\n\n case Defines.PA_ROULETTE:\n this.parents = this.selectParentsRoulette();\n break;\n\n case Defines.PA_TOURNAMENT:\n this.parents = this.selectParentsTournament();\n break;\n }\n// this.howGoodAreParents();\n }", "public void rebuild() {\n\t\tif (!divided) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tint totalChildren = 0;\n\t\tfor (QuadTreeNode<E> q : nodes) {\n\t\t\t// If there is a divided child then we cant do anything\n\t\t\tif (q.isDivided()) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\ttotalChildren += q.numPoints();\n\t\t}\n\t\t\n\t\t// If the sum of all the children contained in the sub nodes\n\t\t// is greater than allowed then we cant do anything\n\t\tif (totalChildren > QUADTREE_NODE_CAPACITY) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t// Add all the nodes from the children to this node then remvoe the nodes\n\t\tpoints = new HashMap<Point, E>();\n\t\tfor (QuadTreeNode<E> q : nodes) {\n\t\t\tpoints.putAll(q.points);\n\t\t}\n\t\t\n\t\tnodes.clear();\n\t\tdivided = false;\n\t}", "public DynamicModelPart buildChildrenUsingSeeds() {\n this.children.parallelStream().forEach(child -> {\n child.buildUsingSeeds();\n });\n return this;\n }", "public void testGetChildren() throws IOException {\n FileObject fobj = getFileObject(testFile);\n FileObject parent = fobj.getParent();\n parent = parent.createFolder(\"parent\");\n File pFile = getFile(parent);\n for (int i = 0; i < 10; i++) {\n assertTrue(new File(pFile, \"file\" + i).createNewFile());\n assertTrue(new File(pFile, \"fold\" + i).mkdir());\n }\n monitor.reset();\n FileObject[] children = parent.getChildren();\n //20 x children, 1 x File.listFiles \n monitor.getResults().assertResult(21, StatFiles.ALL);\n monitor.getResults().assertResult(21, StatFiles.READ);\n //second time\n monitor.reset();\n children = parent.getChildren();\n monitor.getResults().assertResult(0, StatFiles.ALL);\n }", "private Node constructInternal(List<Node> children){\r\n\r\n // Base case: root found\r\n if(children.size() == 1){\r\n return children.get(0);\r\n }\r\n\r\n // Generate parents\r\n boolean odd = children.size() % 2 != 0;\r\n for(int i = 1; i < children.size(); i += 2){\r\n Node left = children.get(i-1);\r\n Node right = children.get(i);\r\n Node parent = new Node(Utility.SHA512(left.hash + right.hash), left, right);\r\n children.add(parent);\r\n }\r\n\r\n // If the number of nodes is odd, \"inherit\" the remaining child node (no hash needed)\r\n if(odd){\r\n children.add(children.get(children.size() - 1));\r\n }\r\n return constructInternal(children);\r\n }", "private static ArrayList<MMT> generateChildren(Board currentBoard, String mPlayer, boolean ifChildMax, int depthToGo){\n\t\t//System.out.println(\"generate children! depth to go is \" + depthToGo);\n\t\tif (depthToGo == 0)\n\t\t\treturn null;\n\t\tArrayList<MMT> childLst = new ArrayList<MMT>();\n\t\tfor (int j = 0; j<Board.getNumCol(); j++){\n\t\t\tBoard childBoard = new Board(currentBoard);\n\t\t\tboolean success = childBoard.fillBoard(j, getCurrentNodePiece(mPlayer, ifChildMax));\n\t\t\t//Board.printBoard(childBoard);\n\t\t\t//System.out.println(\"score for this board: \" + Eval.evalBoard(childBoard, mPlayer));\n\t\t\t//if valid move, then add board\n\t\t\tif (success){\n\t\t\t\t//set depth to 0 (to stop) if someone wins or tie\n\t\t\t\tint depth;\n\t\t\t\tif (Eval.checkTie(childBoard) || Eval.ifHumanWon(childBoard) ||\n\t\t\t\t\t\tEval.ifPCWon(childBoard)){\n\t\t\t\t\tdepth = 0;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tdepth = depthToGo -1;\n\t\t\t\t\t//depth = depthToGo; //depth not reduced at constructor\n\t\t\t\tMMT child = new MMT(childBoard, depth, mPlayer, ifChildMax, j);\n\t\t\t\tchildLst.add(child);\n\t\t\t}\n\t\t}\n\t\tif (childLst.size() == 0)\n\t\t\treturn null;\n\t\treturn childLst;\n\t}", "public void resetParents() {\r\n }", "public void init$Children() {\n children = new ASTNode[1];\n }", "public void testGetChildrenCaches() throws IOException {\n FileObject fobj = getFileObject(testFile);\n FileObject parent = fobj.getParent();\n List<FileObject> l = new ArrayList<FileObject>();\n parent = parent.createFolder(\"parent\");\n for (int i = 0; i < 20; i++) {\n l.add(parent.createData(\"file\" + i + \".txt\"));\n }\n\n monitor.reset();\n //20 x FileObject + 1 File.listFiles\n FileObject[] children = parent.getChildren();\n monitor.getResults().assertResult(1, StatFiles.ALL);\n monitor.getResults().assertResult(1, StatFiles.READ);\n for (FileObject ch : children) {\n assertNull(\"No sibling\", FileUtil.findBrother(ch, \"exe\"));\n }\n monitor.getResults().assertResult(1, StatFiles.ALL);\n monitor.getResults().assertResult(1, StatFiles.READ);\n }", "public DynamicModelPart buildChildren() {\n this.children.parallelStream().forEach(child -> {\n child.build();\n });\n return this;\n }", "private void initSubNodes()\n {\n children = createSubNodes(false);\n attributes = createSubNodes(true);\n }", "void buildHeap() {\n for (int i = parent(size - 1); i >= 0; i--) {\n percolateDown(i);\n }\n }", "void buildHeap() {\n\tfor(int i=parent(size-1); i>=0; i--) {\n\t percolateDown(i);\n\t}\n }", "private void compose() {\n for(Group group : inputGroupList){\n if(group.getGroups().size() > 0){\n LinkedList<Integer> upperGroups = group.getGroups();\n for(int i = 0; i < upperGroups.size(); i++){\n int id = upperGroups.get(i);\n Group upper = findById(id);\n upper.addChild(group);\n }\n } else{\n root.addChild(group);\n }\n }\n for(Address adr : inputAddressList){\n if(adr.getGroups().size() > 0){\n LinkedList<Integer> upperGroups = adr.getGroups();\n for(int i = 0; i < upperGroups.size(); i++){\n int id = upperGroups.get(i);\n Group upper = findById(id);\n upper.addChild(adr);\n adr.addParent(upper);\n }\n } else{\n root.addChild(adr);\n }\n }\n\n assert(root.getChildren().size() > 0);\n }", "private void mapChildren(SortedSet<Integer> parents) {\n\n\t\tIterator<Integer> iterator = parents.iterator();\n\t\twhile (iterator.hasNext()) {\n\t\t\tint next = iterator.next();\n\t\t\tthis.children.put(next, new ArrayList<Integer>());\n\n\t\t}\n\t\t// save the parent of every id in par and check if they are contained in\n\t\t// parent list\n\n\t\tfor (int i : this.idMap.keySet()) {\n\n\t\t\tint par = Integer.parseInt(this.idMap.get(i).get(1));\n\t\t\tthis.children.get(par).add(i);\n\n\t\t}\n\n\t}", "public void finalizeChildren() {\n finalizeAllNestedChildren(this);\n }", "private boolean helperDFS(Node current){\n\n if(expandedNode.size() == 999){\n //limit has been reached. jump out of recursion.\n expandedNode.add(current);\n System.out.println(\"No solution found.\");\n printExpanded(expandedNode);\n System.exit(0);\n return false;\n }\n\n boolean b = cycleCheck(current,expandedNode);\n\n if(!b){\n expandedNode.add(current);\n }else{\n return false;\n }\n\n if(current.getDigit().getDigitString().equals(goalNode.getDigit().getDigitString())){\n //goal reached.\n //expandedNode.add(current);\n solutionPath(current);\n printExpanded(expandedNode);\n System.exit(0);\n }\n\n //Now make the children.\n\n if(!forbidden.contains(current.getDigit().getDigitString())){\n\n if(current.getDigit().last_changed != 0){\n\n if ((Integer.parseInt(current.getDigit().getFirst_digit()) - 1 >= 0)) {\n Node child_node = new Node(current.getDigit().decreaseFirstDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(0);\n if(!forbidden.contains(child_node.getDigit().getDigitString()) && helperDFS(child_node)){\n return true;\n }\n }\n\n //+1 child first digit\n if ((Integer.parseInt(current.getDigit().getFirst_digit()) + 1 <= 9)) {\n Node child_node = new Node(current.getDigit().increaseFirstDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(0);\n if(!forbidden.contains(child_node.getDigit().getDigitString()) && helperDFS(child_node)){\n return true;\n }\n }\n }\n\n if(current.getDigit().last_changed != 1){\n if ((Integer.parseInt(current.getDigit().getSecond_digit()) - 1 >= 0)) {\n Node child_node = new Node(current.getDigit().decreaseSecondDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(1);\n if(!forbidden.contains(child_node.getDigit().getDigitString()) && helperDFS(child_node)){\n return true;\n }\n }\n\n //+1 child\n if ((Integer.parseInt(current.getDigit().getSecond_digit()) + 1 <= 9)) {\n Node child_node = new Node(current.getDigit().increaseSecondDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(1);\n if(!forbidden.contains(child_node.getDigit().getDigitString()) && helperDFS(child_node)){\n return true;\n }\n }\n }\n\n if(current.getDigit().last_changed != 2){\n if ((Integer.parseInt(current.getDigit().getThird_digit()) - 1 >= 0)) {\n Node child_node = new Node(current.getDigit().decreaseThirdDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(2);\n if(!forbidden.contains(child_node.getDigit().getDigitString()) && helperDFS(child_node)){\n return true;\n }\n }\n //+1 child\n if ((Integer.parseInt(current.getDigit().getThird_digit()) + 1 <= 9)) {\n Node child_node = new Node(current.getDigit().increaseThirdDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(2);\n if(!forbidden.contains(child_node.getDigit().getDigitString()) && helperDFS(child_node)){\n return true;\n }\n }\n }\n }\n return false;\n }", "private boolean isAcyclic() {\n boolean visited[] = new boolean[getNumNodes()];\n boolean noCycle = true;\n int list[] = new int[getNumNodes() + 1];\n int index = 0;\n int lastIndex = 1;\n list[0] = randomParent;\n visited[randomParent] = true;\n while (index < lastIndex && noCycle) {\n int currentNode = list[index];\n int i = 1;\n\n // verify parents of current node\n while ((i < parentMatrix[currentNode][0]) && noCycle) {\n if (!visited[parentMatrix[currentNode][i]]) {\n if (parentMatrix[currentNode][i] != randomChild) {\n list[lastIndex] = parentMatrix[currentNode][i];\n lastIndex++;\n }\n else {\n noCycle = false;\n }\n visited[parentMatrix[currentNode][i]] = true;\n } // end of if(visited)\n i++;\n }\n index++;\n }\n //System.out.println(\"\\tnoCycle:\"+noCycle);\n return noCycle;\n }", "void updateAllParentsBelow();", "public void setChildren(Node[][] graph){\n if(inBounds(row+1, col+1)) {\n if (graph[row + 1][col + 1].getType() != '0')\n children.add(graph[row + 1][col + 1]);\n }\n if(inBounds(row, col+1)){\n if (graph[row][col + 1].getType() != '0')\n children.add(graph[row][col + 1]);\n }\n if(inBounds(row-1, col+1)) {\n if (graph[row - 1][col + 1].getType() != '0')\n children.add(graph[row - 1][col + 1]);\n }\n if(inBounds(row+1, col)) {\n if (graph[row + 1][col].getType() != '0')\n children.add(graph[row + 1][col]);\n }\n if(inBounds(row-1, col)) {\n if (graph[row - 1][col].getType() != '0')\n children.add(graph[row - 1][col]);\n }\n if(inBounds(row+1, col-1)) {\n if (graph[row + 1][col - 1].getType() != '0')\n children.add(graph[row + 1][col - 1]);\n }\n if(inBounds(row, col-1)) {\n if (graph[row][col - 1].getType() != '0')\n children.add(graph[row][col - 1]);\n }\n if(inBounds(row-1, col-1)) {\n if (graph[row - 1][col - 1].getType() != '0')\n children.add(graph[row - 1][col - 1]);\n }\n }", "protected int numChildren() {\r\n return 3;\r\n }", "public void init$Children() {\n children = new ASTNode[3];\n setChild(new List(), 1);\n setChild(new List(), 2);\n }", "private void MakeParentChildLink() {\n\n //Hier wordt de hoogte van elke rij opgeslagen\n heightList = new ArrayList<>();\n\n for(Slot slot: slots) {\n int slotCenterY = slot.getCenterY() / 10;\n int slotCenterX = slot.getCenterX() / 10;\n\n // Als de Z gelijk is aan nul weten we dat het slot zich op de grond bevindt\n if (slot.getZ() == 0) {\n //initialisatie (if grondslot get(slotcenterY) geen value heeft maak een value new Hashmap)\n grondSlots.computeIfAbsent(slotCenterY, s -> new HashMap<>());\n\n //Er zijn ook input en output slots dus enkel bij storage\n if (slot.getType().equals(Slot.SlotType.STORAGE)) {\n grondSlots.get(slotCenterY).put(slotCenterX, slot);\n\n }\n } else {\n Slot child = grondSlots.get(slotCenterY).get(slotCenterX);\n // we stijgen telkens tot op de hoogste z\n for (int i = 1; i < slot.getZ(); i++) {\n child = child.getParent();\n }\n //Als we de child gevonden hebben zetten we de link\n slot.setChild(child);\n child.setParent(slot);\n }\n\n //Wanneer het slot gevuld is in een hashmap steken\n if (slot.getItem() != null)\n itemSlotLocation.put(slot.getItem().getId(), slot);\n }\n\n for(HashMap<Integer, Slot> row : grondSlots.values()){\n heightList.add(GeneralMeasures.hoogteBezetting(new HashSet<>(row.values())));\n }\n }", "private void subdivide() {\n if (!hasChildren) {\n hasChildren = true;\n this.children = new QuadtreeNodeChildren(this);\n } else {\n return;\n }\n }", "private void shrinkComponents() {\n List<List<XGraph.XVertex>> components = getComponents();\n XGraph.XVertex componentVertices[] = new XGraph.XVertex[components.size()];\n\n int index = 0;\n //create or assign component\n for (List<XGraph.XVertex> component : components) {\n //if the size of the component is 1 then there is no need to create a new component group.\n componentVertices[index++] = component.size() == 1 ? component.get(0) :\n graph.getNewComponent();\n }\n index = 0;\n //Add edges\n for (XGraph.XVertex component : componentVertices) {\n //Disable vertex and edges of the children and get minimum edge\n Hashtable<Integer, XGraph.XEdge> minEdges = new Hashtable<>();\n //Process all child vertices only if this is a new component\n if (components.get(index).size() > 1) {\n for (XGraph.XVertex vertex : components.get(index++)) {\n getMinEdges(vertex, minEdges);\n vertex.disable();\n }\n } else {\n index++;\n getMinEdges(component, minEdges);\n }\n for (Map.Entry<Integer, XGraph.XEdge> edgeEntry : minEdges.entrySet()) {\n XGraph.XEdge minEdge = edgeEntry.getValue();\n XGraph.XVertex toVertex = componentVertices[scc.getComponentNo(minEdge.toVertex())];\n //Edge already there in original graph no need to add\n if (toVertex == minEdge.toVertex() && component == minEdge.fromVertex()) {\n continue;\n }\n //Need to create a new edge\n minEdge.disable();\n //Avoid loopback\n if (toVertex.isComponent() && toVertex != minEdge.toVertex()) {\n minEdge = new XGraph.XEdge(component, toVertex, minEdge.getWeight(), minEdge);\n } else {\n minEdge = new XGraph.XEdge(component, toVertex, minEdge.getWeight(), minEdge.getOriginal());\n }\n component.addEdge(minEdge);\n toVertex.addRevEdge(minEdge);\n }\n }\n }", "protected void createTree() {\n\n\t\tint nextPlayer = opponent;\n\n\t\tQueue<Node> treeQueue = new LinkedList<Node>();\n\t\tWinChecker winCheck = new WinChecker();\n\n\t\ttreeQueue.add(parent);\n\n\t\twhile (!treeQueue.isEmpty()) {\n\t\t\tNode currentNode = treeQueue.poll();\n\n\t\t\tif (currentNode.getMove().Row != -1\n\t\t\t\t\t&& currentNode.getMove().Col != -1) {\n\t\t\t\tgb.updateBoard(currentNode.getMove());\n\n\t\t\t\tif (winCheck.getWin(gb) >= 0) {\n\t\t\t\t\tgb.revertBoard(currentNode.getMove());\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tgb.revertBoard(currentNode.getMove());\n\t\t\t}\n\n\t\t\t// Restricting the depth to which we will create the tree\n\t\t\tif (currentNode.getPly() > 2) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tfor (List<Hexagon> tempList : this.gb.getBoard()) {\n\t\t\t\tfor (Hexagon tempHex : tempList) {\n\n\t\t\t\t\tif (tempHex == null) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (tempHex.getValue() == EMPTY) {\n\n\t\t\t\t\t\tif (currentNode.getPly() % 2 == 0) {\n\t\t\t\t\t\t\tnextPlayer = opponent;\n\t\t\t\t\t\t} else if (currentNode.getPly() % 2 == 1) {\n\t\t\t\t\t\t\tnextPlayer = player;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tMove nextMove = new Move(nextPlayer, false,\n\t\t\t\t\t\t\t\ttempHex.getRow(), tempHex.getColumn());\n\n\t\t\t\t\t\tNode newNode = new Node(currentNode.getPly() + 1,\n\t\t\t\t\t\t\t\tnextMove);\n\t\t\t\t\t\tnewNode.setParent(currentNode);\n\n\t\t\t\t\t\tcurrentNode.children.add(newNode);\n\n\t\t\t\t\t\ttreeQueue.add(newNode);\n\t\t\t\t\t\ttempHex.setValue(EMPTY);\n\t\t\t\t\t}// End of if statement\n\n\t\t\t\t}// End of inner ForLoop\n\t\t\t}// End of outer ForLoop\n\n\t\t\t// currentNode.printChildren();\n\n\t\t}// End of While Loop\n\n\t}", "public void setChildrenParent ()\r\n {\r\n if (logger.isFineEnabled()) {\r\n logger.fine(\"setChildrenParent of \" + this);\r\n }\r\n\r\n // Make all children point to this node as parent\r\n for (TreeNode node : children) {\r\n node.setParent(this);\r\n node.setChildrenParent(); // Recursively\r\n }\r\n }", "private void connectAll()\n {\n\t\tint i = 0;\n\t\tint j = 1;\n\t\twhile (i < getNodes().size()) {\n\t\t\twhile (j < getNodes().size()) {\n\t\t\t\tLineEdge l = new LineEdge(false);\n\t\t\t\tl.setStart(getNodes().get(i));\n\t\t\t\tl.setEnd(getNodes().get(j));\n\t\t\t\taddEdge(l);\n\t\t\t\tj++;\n\t\t\t}\n\t\t\ti++; j = i+1;\n\t\t}\n\n }", "private void freezeChildNavControl()\n\t{\n\t\t//freeze nav controls\n\t\tnavPanel.freezeNavControls();\n\t\tfor (TablePanel childPanel : SubTablePanels.values()) {\n\t\t\tchildPanel.freezeChildNavControl();\n\t\t}\n\t}", "public Node(int numberChildren){\n board = new Board();\n children = new Node[numberChildren];\n }", "protected void makeChild(FHeapNode y, FHeapNode x)\r\n { \r\n y.left.right = y.right;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// remove y from root list of heap\r\n y.right.left = y.left;\r\n \r\n y.parent = x;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// make y a child of x\r\n\r\n if (x.child == null)\r\n\t\t{\r\n x.child = y;\r\n y.right = y;\r\n y.left = y;\r\n } \r\n\t\telse\r\n\t\t{\r\n y.left = x.child;\r\n y.right = x.child.right;\r\n x.child.right = y;\r\n y.right.left = y;\r\n }\t\t\t\r\n x.degree++;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// increase degree[x] \r\n y.childCut = false;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// set childCut[y] to false\r\n }", "private void createChildrenNodes(ChessGameNode rootNode) {\r\n\t\tBoardState nextState;\r\n\t\tChessGameNode newNode;\r\n\t\tchar currentPlayer = rootNode.getPlayer();\r\n\r\n\t\tgenerateLegalMovesPlayer(currentPlayer);\r\n\t\trootNode.allocateSpaceForChildren(this.moveList.length);\r\n\r\n\t\tfor (int i = 0; i < this.moveList.length; i++) {\r\n\t\t\tif (this.moveList[i] != null) {\r\n\t\t\t\tnextState = makeMove(rootNode, this.moveList[i]);\r\n\t\t\t\tif (currentPlayer == 'w') {\r\n\t\t\t\t\tnewNode = new ChessGameNode(nextState, 'b', this.moveList[i]);\r\n\t\t\t\t\tnewNode.setValue();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tnewNode = new ChessGameNode(nextState, 'w', this.moveList[i]);\t\r\n\t\t\t\t\tnewNode.setValue();\r\n\t\t\t\t}\r\n\t\t\t\trootNode.setChildrenNode(i, newNode);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void init$Children() {\n children = new ASTNode[2];\n setChild(new List(), 1);\n }", "@Override\n protected void refreshChildren() {\n }", "public void createChild (GenericTreeNode<String> daddy)\r\n\t{\r\n\t\t\tList < GenericTreeNode<String> > child= daddy.getChildren();\r\n\t\t\r\n\t\tif (daddy.getData().equalsIgnoreCase(\"next.CommonProfile.Dashboard_SI\")){\r\n\t\t\tchild.add(new GenericTreeNode<String>(\"next.SupportFunctionality.VoiceRecogFunctionality\"));\r\n\t\t\tchild.add(new GenericTreeNode<String>(\"next.Admin.Admin_Principal\"));\r\n\t\t\tchild.add(new GenericTreeNode<String>(\"next.Client.Client_Principal\"));\t\r\n\t\t\tchild.add(new GenericTreeNode<String>(\"next.Member.Member_Principal\"));\t\r\n\t\t}\r\n\t\telse if (daddy.getData().equalsIgnoreCase(\"next.CommonProfile.Dashboard_SU\")){\r\n\t\t\tchild.add(new GenericTreeNode<String>(\"next.SupportFunctionality.VoiceRecogFunctionality\"));\r\n\t\t\t//child.add(new GenericTreeNode<String>(\"next.CommonProfile.DashboardPrincipal\"));\t\r\n\t\t}\r\n\t\telse if (daddy.getData().equalsIgnoreCase(\"next.Admin.Admin_Principal\")){\r\n\t\t\tchild.add(new GenericTreeNode<String>(\"next.CommonProfile.PersonalInfo\"));\r\n\t\t\tchild.add(new GenericTreeNode<String>(\"next.CommonProfile.Products\"));\r\n\t\t\tchild.add(new GenericTreeNode<String>(\"next.Admin.Business_Rules\"));\r\n\t\t\tchild.add(new GenericTreeNode<String>(\"next.view.support.CustomList\"));\r\n\t\t\tchild.add(new GenericTreeNode<String>(\"next.SupportFunctionality.VoiceRecogFunctionality\"));\r\n\t\t}\r\n\t\telse if (daddy.getData().equalsIgnoreCase(\"next.view.support.CustomList\")){\r\n\t\t\tchild.add(new GenericTreeNode<String>(\"next.SupportFunctionality.VoiceRecogFunctionality\"));\r\n\t\t\tchild.add(new GenericTreeNode<String>(\"next.SupportFunctionality.MapsFunctionality\"));\r\n\t\t\t\r\n\t\t}else if (daddy.getData().equalsIgnoreCase(\"next.SupportFunctionality.MapsFunctionality\")){\r\n\t\t\tchild.add(new GenericTreeNode<String>(\"next.SupportFunctionality.VoiceRecogFunctionality\"));\r\n\t\t\t\r\n\t\t\t\r\n\t\t}\r\n\r\n\t\tdaddy.setChildren(child);\r\n\t\t for (GenericTreeNode<String> node : daddy.getChildren()) {\r\n\t\t\t createChild (node);\r\n\t }\r\n\t}", "public void init$Children() {\n children = new ASTNode[3];\n setChild(new List(), 1);\n setChild(new Opt(), 2);\n }", "private void constructTree() {\r\n\t\tsortLeaves();\r\n\t\tNode currentNode;\r\n\t\tint index = 0;\r\n\t\t\tdo{\r\n\t\t\t\t// Create a new node with the next two least frequent nodes as its children\r\n\t\t\t\tcurrentNode = new Node(this.treeNodes[0], this.treeNodes[1]); \r\n\t\t\t\taddNewNode(currentNode);\r\n\t\t\t}\r\n\t\t\twhile (this.treeNodes.length > 1); // Until there is only one root node\r\n\t\t\tthis.rootNode = currentNode;\r\n\t\t\tindex++;\r\n\t}", "@Override\n public void prepare() {\n leftChild.prepare();\n rightChild.prepare();\n\n // Use the parent class' helper-function to prepare the schema.\n prepareSchemaStats();\n\n /** if the join is an anti or semi join, must change the schema to that of the left child*/\n if (joinType == JoinType.ANTIJOIN || joinType == JoinType.SEMIJOIN) {\n schema = leftChild.getSchema();\n sem_ant = true;\n outer = false;\n }\n /** If the join type is an outer, sets state variables and creates the null-pad tuple*/\n else if (joinType == JoinType.LEFT_OUTER || joinType == JoinType.RIGHT_OUTER) {\n outer = true;\n sem_ant = false;\n if (joinType == JoinType.LEFT_OUTER)\n nullPad = new TupleLiteral(rightChild.getSchema().numColumns());\n else {\n nullPad = new TupleLiteral(leftChild.getSchema().numColumns());\n }\n }\n /** if the join is an inner join*/\n else {\n sem_ant = false;\n outer = false;\n }\n \n // We obtain the cost of our children\n PlanCost lChildCost = leftChild.getCost();\n PlanCost rChildCost = rightChild.getCost();\n \n // Our base number of tuples is the two tuples multiplied together\n float totalTuples = lChildCost.numTuples * rChildCost.numTuples;\n \n // If we have a predicate, we multiply by this value\n if (predicate != null) {\n // We use a selectivity estimator if necessary\n float selValue = SelectivityEstimator.estimateSelectivity(\n predicate, \n schema, \n stats);\n \n // Anti-joins will have the opposite of our estimated selectivity\n if (joinType == JoinType.ANTIJOIN || \n joinType == JoinType.SEMIJOIN) {\n selValue = 1 - selValue;\n }\n totalTuples *= selValue;\n }\n // Outer joins require extra nodes for their bounds\n if (joinType == JoinType.LEFT_OUTER) {\n totalTuples += lChildCost.numTuples;\n }\n else if (joinType == JoinType.RIGHT_OUTER) {\n totalTuples += rChildCost.numTuples;\n }\n \n cost = new PlanCost(\n // We have our total number of tuples\n totalTuples,\n // Our overall tuple size is now the size of the two\n // tuples added together\n lChildCost.tupleSize + rChildCost.tupleSize,\n // Our CPU cost is the cost of going through every tuple\n // on the right child for every tuple on the left\n // and for computing both tables\n lChildCost.numTuples * rChildCost.numTuples + lChildCost.cpuCost + rChildCost.cpuCost,\n // Our block cost is the cost of going through the blocks\n // in the two children\n lChildCost.numBlockIOs + rChildCost.numBlockIOs);\n }", "protected abstract void childManager(ForkManager child_, double time_);", "public final void markChildrenLayoutNecessary() {\n setStatusBits(CHILDREN_LAYOUT_NECESSARY_BIT);\n }", "protected void addChildrenNodes(List<DFNode> fringe, DFNode parentNode, List<ActionStatePair> children) {\n Object[] childrenArray = children.toArray();\n\n for (int i = 0; i < childrenArray.length; i++) {\n ActionStatePair actionState = (ActionStatePair) childrenArray[i];\n CCAction action = (CCAction) actionState.action;\t\t\t\t\t\t\t//get the action component\n CCState childState = actionState.state;\t\t\t\t\t\t\t//get the state component\n DFNode childNode = new DFNode(childState, parentNode, action);\t//create new child node\n this.addChild(fringe, childNode);\t\t\t\t\t\t\t//add child node to end of fringe\n this.nodeVisited++;\n }\n }", "static void setupLCA() {\n maxDepth = 0;\n depth = new int[N]; // store the depth of each node\n firstParents = new int[N]; // the immediate parent\n firstParents[0] = 0;\n depth[0] = 0;\n dfs(0);\n int power = 1;\n // Increase the power higher until we go over the maxDepth\n // This will be one more than we need\n while (1 << power <= maxDepth) {\n power++;\n }\n parent = new int[power][N]; // go up 2^power from node i of N\n // Now, use that initial information acquired from the dfs to build\n // base cases of the sparse tables!\n for (int node = 0; node < N; node++) {\n parent[0][node] = firstParents[node];\n }\n // Necessary to set everything else to zero for now, so\n // that we never get confused if we are out of bounds\n\n // Must fill it up with -1's\n for (int p = 1; p < parent.length; p++) {\n for (int i = 0; i < N; i++) {\n parent[p][i] = -1;\n }\n }\n // p represents going up by 1 << p\n for (int p = 1; p < parent.length; p++) {\n for (int node = 0; node < N; node++) {\n if (parent[p - 1][node] != -1) {\n int myParent = parent[p - 1][node];\n parent[p][node] = parent[p-1][myParent];\n }\n }\n }\n }", "private void setParentBounds() {\n GraphRepresentation baseGraph = graphRepresentationFactory.getBaseGraph();\n\n Iterator<Task> iterator = tasks.iterator();\n while (iterator.hasNext()) {\n Task nextTask = iterator.next();\n List<Integer> nextTaskParents = baseGraph.getParents(nextTask.getIdentifier());\n nextTask.setParentBound(nextTaskParents.size());\n }\n }", "public LG(){\n\t\tchildren = new LinkedHashMap<Loop, LinkedHashSet<Loop>>();\n\t\tparent = new LinkedHashMap<Loop, Loop>();\n\t\tloops = new LinkedHashSet<Loop>();\n\t\tloopCounter = new LinkedHashMap<Loop, Integer>();\n\t}", "void expandChilds() {\n\t\t\tenumAndExpand(this.parentItem);\n\t\t}", "private void sink(int i) {\n if (2*i > N)\n return;\n int maxChild = 2*i;\n if (maxChild < N && compare(maxChild, maxChild+1) < 0)\n maxChild++;\n if (compare(maxChild, i) > 0) {\n swap(maxChild, i);\n sink(maxChild);\n }\n }", "private void initializeGraphAsEmpty() {\n int max = getNumNodes();\n\n parentMatrix = new int[getNumNodes()][max];\n childMatrix = new int[getNumNodes()][max];\n\n for (int i = 0; i < getNumNodes(); i++) {\n parentMatrix[i][0] = 1; //set first node\n childMatrix[i][0] = 1;\n }\n\n for (int i = 0; i < getNumNodes(); i++) {\n for (int j = 1; j < max; j++) {\n parentMatrix[i][j] = -5; //set first node\n childMatrix[i][j] = -5;\n }\n }\n }", "void depend(int parentID, int childID){\n check(parentID, childID);\n nodes_[childID].parent_ = parentID;\n nodes_[parentID].addChild(childID);\n }", "public void assignAllSiblings(){\n \n List<Informacion> pasos=ejemplo.getListaPasos();\n for(Informacion info:pasos){\n if(info.getElemento().split(\" \").length>1){\n assignSiblings(info.getElemento().split(\" \"));\n } \n }\n }", "public void setChildren(List<BTreeNode<E>> newChildren) {\n\t\t//not adding in order, but does not matter because list is empty, and you will only call this method when the children are in order\n\t\tchildren.addAll(newChildren);\n\t\tfor (BTreeNode<E> child: newChildren) {\n\t\t\tchild.parent = this;\n\t\t}\n\t}", "protected void childrenChanged() {\n proxyGroup.childrenChanged();\n }", "public void releaseChildren() {\n if (children != null) {\n unloadChildren();\n\n children.unload();\n children = null;\n }\n }", "void loadChilds() throws ApplicationException {\n\t\t\t// iterate over childs\n\t\t\tGenericIterator list = element.getChildren();\n\t\t\twhile (list.hasNext()) {\n\t\t\t\tnew Item(this.parentItem, (GenericObjectNode) list.next());\n\t\t\t}\n\t\t}", "private void recursiveCreateChildren(IFolder parentFolder, int depth) throws CoreException {\n \t\t//create TREE_WIDTH files\n \t\tfor (int i = 0; i < TREE_WIDTH; i++) {\n \t\t\tIFile file = parentFolder.getFile(createString(10));\n \t\t\tfile.create(new ByteArrayInputStream(createBytes(5000)), IResource.NONE, getMonitor());\n \t\t}\n \t\tif (depth <= 0)\n \t\t\treturn;\n \t\t//create TREE_WIDTH folders\n \t\tfor (int i = 0; i < TREE_WIDTH; i++) {\n \t\t\tIFolder folder = parentFolder.getFolder(createString(6));\n \t\t\tfolder.create(IResource.NONE, true, getMonitor());\n \t\t\trecursiveCreateChildren(folder, depth - 1);\n \t\t}\n \t}", "private void buildParentTransformAndSourceNode(TransformNode transformNode, Map<String, Object> parentsIdMap) {\n for (Map.Entry<String, Object> entry : parentsIdMap.entrySet()) {\n String tmpNodeId = entry.getKey();\n //heads shouldn't have self dependency id in it\n if (heads.contains(tmpNodeId)\n && this.sourceNodes.containsKey(tmpNodeId)) {\n transformNode.getParents().add(this.sourceNodes.get(tmpNodeId));\n } else if (heads.contains(tmpNodeId)\n && !this.sourceNodes.containsKey(tmpNodeId)\n && !this.staticTable.contains(tmpNodeId)) {\n Map<String, Object> sourceNodeConfMap = new HashMap<>();\n sourceNodeConfMap.put(\"id\", tmpNodeId);\n sourceNodeConfMap.put(\"name\", tmpNodeId);\n sourceNodeConfMap.put(\"schedule_time\", this.scheduleTime);\n SourceNode sourceNode = createHdfsSourceNode(tmpNodeId, sourceNodeConfMap);\n transformNode.getParents().add(sourceNode);\n this.sourceNodes.put(tmpNodeId, sourceNode);\n LOGGER.info(String.format(\"Added source node %s\", tmpNodeId));\n } else if (!heads.contains(tmpNodeId)\n && !this.tmpTransformNodesMap.containsKey(tmpNodeId)\n && !this.staticTable.contains(tmpNodeId)) {\n transformNode.getParents().add(this.traverseBuildNodes(tmpNodeId));\n } else if (!heads.contains(tmpNodeId)\n && this.tmpTransformNodesMap.containsKey(tmpNodeId)\n && !this.staticTable.contains(tmpNodeId)) {\n transformNode.getParents().add(this.tmpTransformNodesMap.get(tmpNodeId));\n }\n\n }\n }", "private void connectToParent(RevCommit m) throws Exception\n\t{\n\t\tGraphDatabaseService service = DBConnection.getService();\n\t\ttry (Transaction tx = service.beginTx())\n\t\t{\n\t\t\tResult result = service.execute( \"match (n {\"+CommitNode._hash+\": '\"+getCommitId(m)+\"'}) return n\" );\n\t\t\tIterator<Node> nodes = result.columnAs( \"n\" );\n\n\t\t\tfor(Node commit_node : IteratorUtil.asIterable(nodes))\n\t\t\t{\n\t\t\t\tList<String> parent_ids = commit_parents_list.get(getCommitId(m));\n\t\t\t\tfor(String s : parent_ids)\n\t\t\t\t{\n\t\t\t\t\tif(!commit_parents_list.keySet().contains(s))\n\t\t\t\t\t{\t//unknown parent, the node is not going to exist. If we attempt to create the rel, the transaction will be aborted. Let's ignore this.\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tResult candidate_parents_results = service.execute( \"match (n {\"+CommitNode._hash+\" : '\"+s+\"'}) return n\" );\n\t\t\t\t\tIterator<Node> candidate_parent_nodes = candidate_parents_results.columnAs( \"n\" );\n\n\t\t\t\t\tfor(Node p : IteratorUtil.asIterable(candidate_parent_nodes))\n\t\t\t\t\t{\n\t\t\t\t\t\ttry\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tRelationship new_rel = p.createRelationshipTo(commit_node,CommitNode.Relationships.NEXT);\n\t\t\t\t\t\t\tif(new_rel == null)\n\t\t\t\t\t\t\t\tSystem.err.println(\"Couldn't connect commit \" + getCommitId(m) + \" with \" +s);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch(Exception e)\n\t\t\t\t\t\t{\t//shut up\n\t\t\t\t\t\t\tSystem.err.println(\"Failted to connect commit node to parent - silently continuing : \\nCommits (child) : \"+getCommitId(m) + \" with (parent) : \" +s);\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\tresult.close();\n\t\t\ttx.success();\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\tSystem.err.println(\"failed to create relationship between commits and their parents.\" + e.getMessage());\n\t\t}\n\t}", "protected void initializeChild() {\n\t}", "public void clickTravellersChildrenDec() {\n\t\ttravellersChildDec.click();\n\t}", "public void makeComplete() {\n\t\t// A complete graph has N(N-1)/2 edges. Create an ArrayList for those\n\t\t// for performance.\n\t\tint n = nodeArray.size();\n\t\tthis.edges = new ArrayList<Edge>(n * (n - 1) / 2);\n\n\t\t// Connect every node to the others\n\t\tfor (int i = 0; i < nodeArray.size(); i++) {\n\t\t\tfor (int k = i + 1; k < nodeArray.size(); k++) {\n\n\t\t\t\tEdge edge = new Edge(nodeArray.get(i), nodeArray.get(k));\n\t\t\t\tedges.add(edge);\n\t\t\t}\n\t\t}\n\t}", "private void makeContextsRecursive(ContextTreeNode contextNode) {\n \n TaxonomyContext context = contextNode.getContext();\n Node contextRootNode = context.getRootNode();\n int i = 0;\n \n Transaction tx = beginTx();\n if (contextRootNode.getProperty(\"name\").equals(LIFE_NODE_NAME) == false) {\n \n System.out.println(\"making indices for \" + contextRootNode.getProperty(\"name\"));\n \n for (Node n : PREFTAXCHILDOF_TRAVERSAL.traverse(contextRootNode).nodes()) {\n addToPreferredIndexes(n, context);\n \n i++;\n if (i % 100000 == 0)\n System.out.println(i);\n }\n }\n tx.success();\n tx.finish();\n \n // now move on to all children\n for (ContextTreeNode childNode : contextNode.getChildren())\n makeContextsRecursive(childNode);\n \n }", "private void GreedySearch(){\n\n Queue<Node> expanded = new LinkedList<>();\n ArrayList<Node> fringe = new ArrayList<>();\n ArrayList<Node> fringeTemp = new ArrayList<>();\n\n\n Node current = startNode;\n\n while(expanded.size() < 1000){\n\n if(current.getDigit().getDigitString().equals(goalNode.getDigit().getDigitString())){\n //goal is reached.\n solutionPath(current);\n expanded.add(current);\n printExpanded(expanded);\n System.exit(0);\n }\n\n\n boolean b = cycleCheck(current,expanded);\n\n if(!b) {\n expanded.add(current);\n }\n\n if(!b){\n\n if(current.getDigit().last_changed != 0){\n\n if ((Integer.parseInt(current.getDigit().getFirst_digit()) - 1 >= 0)) {\n Node child_node = new Node(current.getDigit().decreaseFirstDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(0);\n\n if(!forbidden.contains(child_node.getDigit().getDigitString())){\n fringe.add(child_node);\n }\n }\n\n //+1 child first digit\n if ((Integer.parseInt(current.getDigit().getFirst_digit()) + 1 <= 9)) {\n Node child_node = new Node(current.getDigit().increaseFirstDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(0);\n if(!forbidden.contains(child_node.getDigit().getDigitString())){\n fringe.add(child_node);\n }\n\n }\n }\n\n if(current.getDigit().last_changed != 1){\n\n if ((Integer.parseInt(current.getDigit().getSecond_digit()) - 1 >= 0)) {\n Node child_node = new Node(current.getDigit().decreaseSecondDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(1);\n if(!forbidden.contains(child_node.getDigit().getDigitString())){\n fringe.add(child_node);\n }\n }\n\n //+1 child\n if ((Integer.parseInt(current.getDigit().getSecond_digit()) + 1 <= 9)) {\n Node child_node = new Node(current.getDigit().increaseSecondDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(1);\n if(!forbidden.contains(child_node.getDigit().getDigitString())){\n fringe.add(child_node);\n }\n }\n }\n\n if(current.getDigit().last_changed != 2){\n if ((Integer.parseInt(current.getDigit().getThird_digit()) - 1 >= 0)) {\n Node child_node = new Node(current.getDigit().decreaseThirdDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(2);\n if(!forbidden.contains(child_node.getDigit().getDigitString())){\n fringe.add(child_node);\n }\n }\n //+1 child\n if ((Integer.parseInt(current.getDigit().getThird_digit()) + 1 <= 9)) {\n Node child_node = new Node(current.getDigit().increaseThirdDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(2);\n if(!forbidden.contains(child_node.getDigit().getDigitString())){\n fringe.add(child_node);\n }\n }\n }\n\n }\n\n\n\n for(Node n : fringe){\n heuristicSetter(n);\n\n }\n\n fringeTemp.addAll(fringe);\n //now all the nodes in fringe have the heuristic value.\n //We can get the last added minm\n Node minm;\n if(fringeTemp.size() != 0){\n minm = fringeTemp.get(0);\n }else{\n break;\n }\n for(int i = 1; i<fringeTemp.size(); i++){\n if(fringeTemp.get(i).getHeuristic() <= minm.getHeuristic()){\n minm = fringeTemp.get(i);\n }\n }\n\n //now we have the minm for the next stage.\n current = minm;\n fringeTemp.remove(minm);\n fringe.clear();\n }\n\n //While loop ends\n System.out.println(\"No solution found.\");\n printExpanded(expanded);\n\n\n\n }", "public void crossover(){\n \t\n \t//int cut2 = ((NODELENGTH * 3 + 1) / 3) + cut;\n \tfor (int g = 0; g < (wallpapers.size() - 1); g += 2){\n \t\tint cut = getCutPoint();\n \t\tint[] parent1 = wallpapers.get(g);\n \t\tint[] parent2 = wallpapers.get(g + 1);\n \t\t\n \t\tint[] child1 = new int[parent1.length];\n \t\tint[] child2 = new int[parent2.length];\n \t\tfor (int i = 0; i < (cut); i++){\n \t\t\tchild1[i] = parent1[i];\n \t\t\tchild2[i] = parent2[i];\n \t\t}\n \t\tfor (int j = cut; j < parent1.length; j++){\n \t\t\tchild1[j] = parent2[j];\n \t\t\tchild2[j] = parent1[j];\n \t\t}\n \t\t\n \t\t\n \t\twallpapers.set(g, child1);\n \t\twallpapers.set(g + 1, child2);\n \t}\n \tfor (int d = 0; d < (wallpapers.size() * 2); d++){\n \t\tif (d < wallpapers.size()){\n \t\t\ttemp_wallpapers.add(wallpapers.get(d));\n \t\t}\n \t\telse {\n \t\t\ttemp_wallpapers.add(node());\n \t\t}\n \t}\n \twallpapers.clear();\n \tfor (int u = 0; u < temp_wallpapers.size(); u++){\n\t\t\twallpapers.add(u, temp_wallpapers.get(u));\n\t\t}\n \ttemp_wallpapers.clear();\n }", "private void performCreates()\n {\n // Create entities. We have to loop possibly many times to create the entities\n // because we have to set the FKs. It's\n // possible that the source for a FK is a FK from yet another EI. We don't\n // want to copy a FK until we know that the source for a FK has been\n // properly set. We also want to make sure we set the FK's for the EIs that\n // have been excluded/deleted before we copy FKs for the included/created.\n int debugCnt = 0; // We'll keep a counter in case we get an infinite loop.\n\n // creatingEntities will be true for as long as we think we need to create more entities.\n boolean creatingEntities = true;\n while ( creatingEntities )\n {\n // We'll hope that we're done creating entities after this iteration. If we\n // find we need to create more then we'll turn it back on.\n creatingEntities = false;\n\n if ( debugCnt++ > 100 )\n throw new ZeidonException(\"Internal error: too many times creating entities.\");\n\n for ( ViewImpl view : viewList )\n {\n ObjectInstance oi = view.getObjectInstance();\n\n for ( final EntityInstanceImpl ei : oi.getEntities() )\n {\n if ( ! requiresCreate( ei ) )\n continue;\n\n assert ! ei.getEntityDef().isDerivedPath();\n\n if ( ! createInstance( view, ei ) )\n creatingEntities = true; // We weren't able to create ei. Try again later.\n }\n }\n } // while creatingEntities...\n }", "public void updateChildNodes() {\n\t\tList<FTNonLeafNode> nodesToRemove = new ArrayList<FTNonLeafNode>();\n\t\tfor (FTNonLeafNode intermediateNode : intermediateNodes.values()) {\n\t\t\tList<FTNode> childNodesToRemove = new ArrayList<FTNode>();\n\t\t\tfor (String childName : intermediateNode.childNodes.keySet()) {\n\t\t\t\tif (intermediateNodes.containsKey(childName)) {\n\t\t\t\t\t// update child node if it has child node\n\t\t\t\t\tFTNonLeafNode childNode = intermediateNodes.get(childName);\n\t\t\t\t\tif ((childNode instanceof FTOrNode) || (childNode instanceof FTAndNode)) {\n\t\t\t\t\t\tintermediateNode.addChildNode(childName, intermediateNodes.get(childName));\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t// if parent node is an OR node\n\t\t\t\t\t\t// remove this child\n\t\t\t\t\t\tif (intermediateNode instanceof FTOrNode) {\n\t\t\t\t\t\t\tchildNodesToRemove.add(childNode);\n\t\t\t\t\t\t\tnodesToRemove.add(childNode);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// if parent node is an AND node\n\t\t\t\t\t\t// remove the parent node and child node\n\t\t\t\t\t\t// and set their values to false in case they are referenced by other nodes\n\t\t\t\t\t\telse if (intermediateNode instanceof FTAndNode) {\n\t\t\t\t\t\t\tnodesToRemove.add(intermediateNode);\n\t\t\t\t\t\t\tnodesToRemove.add(childNode);\n\t\t\t\t\t\t\t// mark the nodes as they are not getting removed till after the loop\n\t\t\t\t\t\t\tintermediateNode.resolved = true;\n\t\t\t\t\t\t\tintermediateNode.nodeValue = false;\n\t\t\t\t\t\t\tchildNode.resolved = true;\n\t\t\t\t\t\t\tchildNode.nodeValue = false;\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\tintermediateNode.removeChildNodes(childNodesToRemove);\n\t\t\t// if no child node left for this intermediate node,\n\t\t\t// then its parent node should remove this intermediate node as well\n\t\t}\n\t\t// remove the no child nodes\n\t\tfor (FTNonLeafNode node : nodesToRemove) {\n\t\t\tintermediateNodes.remove(node.nodeName);\n\t\t}\n\t}", "private void recreateWorkerTree(TransactionalClient transaction) throws Exception {\n String workerPath = paths.worker(workerId);\n if (curatorFramework.checkExists().forPath(workerPath) != null) {\n transaction.deletePathWithChildrenIfNeeded(workerPath);\n }\n\n // create availability and assignments directories\n transaction.createPath(paths.worker(workerId));\n transaction.createPath(paths.availableJobs(workerId));\n transaction.createPath(paths.assignedJobs(workerId));\n\n // register work pooled jobs\n for (DistributedJob job : availableJobs) {\n transaction.createPath(paths.availableJob(workerId, job.getJobId()));\n }\n }", "public void resetVisited() {\r\n\t\tvisited = false;\r\n\t\tfor (ASTNode child : getChildren()) {\r\n\t\t\tif (!visited)\r\n\t\t\t\tcontinue;\r\n\t\t\tchild.resetVisited();\r\n\t\t}\r\n\t}", "private boolean cycleCheck(Node current, Queue<Node> expanded){\n\n if( expanded.size() == 0){\n return false; //Because current is root\n }\n\n for(Node nodeInExpanded : expanded){\n\n if(current!=null && current.getDigit().getDigitString().equals(nodeInExpanded.getDigit().getDigitString())){\n //the digits are same so we check children.\n\n ArrayList<String> currentChildren = makeChildren(current);\n ArrayList<String> childrenOfExpanded = makeChildren(nodeInExpanded);\n\n int size;\n\n if(currentChildren.size() > childrenOfExpanded.size() ){\n size = childrenOfExpanded.size();\n }else if(currentChildren.size() < childrenOfExpanded.size()){\n size = currentChildren.size();\n }else{\n size = childrenOfExpanded.size();\n }\n /*\n I use the modulus operator so that I dont get a ArrayIndexOut of Bounds\n */\n\n if( currentChildren.size() == childrenOfExpanded.size()\n && currentChildren.get(0%size).equals(childrenOfExpanded.get(0%size))\n && currentChildren.get(1%size).equals(childrenOfExpanded.get(1%size))\n && currentChildren.get(2%size).equals(childrenOfExpanded.get(2%size))\n && currentChildren.get(3%size).equals(childrenOfExpanded.get(3%size))\n ){\n return true;\n }\n }\n }\n\n return false;\n }", "private void addEdge() {\n childMatrix[randomParent][childMatrix[randomParent][0]] = randomChild;\n childMatrix[randomParent][0]++;\n parentMatrix[randomChild][parentMatrix[randomChild][0]] = randomParent;\n parentMatrix[randomChild][0]++;\n }", "public void ignoreChildren() {\r\n this.isIgnoreChildren = true;\r\n }", "private void connectToAll() {\n for (AStarNode node : getNodes()) {\n node.resetConnection();\n for (AStarNode connect : getNodes()) {\n if (isValid(node, connect)) {\n node.connect(connect);\n }\n }\n }\n }", "private static Parent[] makeParents() {\n\t\treturn null;\n\t}", "private ParentEntityNode cToCOwnerCheckLeveOneHavingParentOrChildren(String entityId, LosConfigDetails owner, // NOSONAR\n\t\t\tLosConfigDetails affilated, String commercialSuffix, List<String> iterationChildIds, List<String> entityIds, // NOSONAR\n\t\t\tList<ParentEntityNode> treeData, List<String> levelTwoChildIds) {// NOSONAR\n\t\tList<ParentEntityNode> levelOneData = getParentDataReverseOrder(entityIds);\n\t\tlevelOneData.stream().forEach(removeExisting -> cToCOwnerIfOwnedIsPresentChangeToOwner(entityId, owner,\n\t\t\t\ttreeData, levelTwoChildIds, removeExisting));\n\t\tif (!levelTwoChildIds.isEmpty()) {\n\t\t\tlevelTwoCToCOwnerGetComEntitySetAsAffiliated(entityId, owner, affilated, commercialSuffix, // NOSONAR\n\t\t\t\t\titerationChildIds, entityIds, treeData, levelTwoChildIds);// NOSONAR\n\t\t}\n\t\treturn entityRelationshipTreeServiceImpl.createTreeFromParent(treeData, entityId);\n\t}", "protected void constructLevelRelations( Callback c, int parent, int child ){\n String childID = getPartitionID( child );\n String parentID = getPartitionID( parent );\n List parents = new ArrayList(1);\n parents.add( parentID );\n c.cbParents( childID, parents );\n\n }", "private void initChildList() {\n if (childList == null) {\n childList = new ArrayList<>();\n }\n }", "private void reEstablishConnections() {\n// System.out.println(\"Impossible to create overlay, starting over...\");\n for (NodeRecord node : registeredNodes.values()) {\n node.getNodesToConnectToList().clear();\n node.resetNumberOfConnections();\n }\n createOverlay();\n }", "protected void siftDown() {\r\n\t\tint parent = 0, child = (parent << 1) + 1;// preguntar porque 0 y no 1\r\n\t\t\r\n\t\twhile (child < theHeap.size()) {\r\n\t\t\tif (child < theHeap.size() - 1\r\n\t\t\t\t\t&& compare(theHeap.get(child), theHeap.get(child + 1)) > 0)\r\n\t\t\t\tchild++; // child is the right child (child = (2 * parent) + 2)\r\n\t\t\tif (compare(theHeap.get(child), theHeap.get(parent)) >= 0)\r\n\t\t\t\tbreak;\r\n\t\t\tswap(parent, child);\r\n\t\t\tparent = child;\r\n\t\t\tchild = (parent << 1) + 1; // => child = (2 * parent) + 1\r\n\t\t}\r\n\t}", "protected void makeTheTree(){\n\n structure.getRootNode().branchList.add(structure.getNode11());\n structure.getRootNode().branchList.add(structure.getNode12());\n structure.getRootNode().branchList.add(structure.getNode13());\n\n structure.getNode11().branchList.add(structure.getNode111());\n structure.getNode11().branchList.add(structure.getNode112());\n structure.getNode11().branchList.add(structure.getNode113());\n\n structure.getNode13().branchList.add(structure.getNode131());\n\n structure.getNode112().branchList.add(structure.getNode1121());\n\n }", "ArrayList<Cell> getChildren(Integer[][] level){\n int[][] values={{0,1},{0,-1},{1,0},{-1,0}};\n ArrayList<Cell> children = new ArrayList<>();\n for (int i = 0; i < values.length; i++){\n if (isLegalMove(this.getI()+values[i][0], this.getJ()+values[i][1],level)){\n children.add(new Cell(this.getI()+values[i][0], this.getJ()+values[i][1]));\n }\n }\n //the code below achieves the same goal; still here for clarity\n\n// if (isLegalMove(this.getI(), this.getJ()+1, level)) {\n// children.add(new Cell(this.getI(), this.getJ()+1));\n// }\n// if (isLegalMove(this.getI(), this.getJ()-1, level)) {\n// children.add(new Cell(this.getI(), this.getJ()-1));\n// }\n// if (isLegalMove(this.getI()+1, this.getJ(), level)) {\n// children.add(new Cell(this.getI()+1, this.getJ()));\n// }\n// if (isLegalMove(this.getI()-1, this.getJ(), level)) {\n// children.add(new Cell(this.getI()-1, this.getJ()));\n// }\n return children;\n }", "public void checkConnections() {\n Boolean updateCanvas = false;\n\n // Find new connections set within a node and creates them\n for (DrawableNode node : nodes) {\n if (node instanceof LogicNode) {\n String src = ((LogicNode) node).getLogic().getLogic();\n\n for (DrawableNode endNode : getNodes()) {\n int nodeConnectionType = NodeConnection.NO_CONNECTION;\n\n // Here we are checked to see if any connections are linked from this LogicNode\n if (src.contains(\"run(\\\"\" + endNode.getContainedText() + \"\\\"\") ||\n src.contains(\"runAndWait(\\\"\" + endNode.getContainedText() + \"\\\"\") ||\n src.contains(\"runAndJoin(\\\"\" + endNode.getContainedText() + \"\\\"\")) {\n nodeConnectionType = NodeConnection.DYNAMIC_CONNECTION;\n } else if (src.contains(\"getNode(\\\"\" + endNode.getContainedText() + \"\\\"\")) {\n nodeConnectionType = NodeConnection.GET_NODE_CONNECTION;\n }\n\n // If we find a possible connection and it doesn't already exist, we create that connection with the correct type\n if (!connectionExists(node, endNode) && nodeConnectionType != -1) {\n NodeConnection newConnection = new NodeConnection(node, endNode, nodeConnectionType);\n connections.add(newConnection);\n updateCanvas = true;\n }\n }\n } else if (node instanceof TestCaseNode) {\n String src = ((TestCaseNode) node).getLogic().getLogic();\n\n for (DrawableNode endNode : getNodes()) {\n int nodeConnectionType = NodeConnection.NO_CONNECTION;\n\n // Here we are checked to see if any connections are linked from this TestCaseNode\n if (src.contains(\"run(\\\"\" + endNode.getContainedText() + \"\\\"\") ||\n src.contains(\"runAndWait(\\\"\" + endNode.getContainedText() + \"\\\"\") ||\n src.contains(\"runAndJoin(\\\"\" + endNode.getContainedText() + \"\\\"\")) {\n nodeConnectionType = NodeConnection.DYNAMIC_CONNECTION;\n } else if (src.contains(\"getNode(\\\"\" + endNode.getContainedText() + \"\\\"\")) {\n nodeConnectionType = NodeConnection.GET_NODE_CONNECTION;\n }\n\n // If we find a possible connection and it doesn't already exist, we create that connection with the correct type\n if (!connectionExists(node, endNode) && nodeConnectionType != -1) {\n NodeConnection newConnection = new NodeConnection(node, endNode, nodeConnectionType);\n connections.add(newConnection);\n updateCanvas = true;\n }\n }\n } else if (node instanceof SwitchNode) {\n List<Switch> aSwitches = ((SwitchNode) node).getSwitches();\n\n for (DrawableNode endNode : getNodes()) {\n Boolean createConnection = false;\n Boolean enabledConnection = false;\n\n for (Switch aSwitch : aSwitches) {\n if ((aSwitch.getTarget().equals(endNode.getContainedText()))) {\n enabledConnection = aSwitch.isEnabled();\n createConnection = true;\n }\n }\n\n if (createConnection && !connectionExists(node, endNode)) {\n Integer connectionType = NodeConnection.DYNAMIC_CONNECTION;\n if (!enabledConnection) {\n connectionType = NodeConnection.DISABLED_CONNECTION;\n }\n\n NodeConnection newConnection = new NodeConnection(node, endNode, connectionType);\n connections.add(newConnection);\n updateCanvas = true;\n }\n }\n } else if (node instanceof TriggerNode) {\n List<Trigger> triggers = ((TriggerNode) node).getTriggers();\n\n for (Trigger trigger : triggers) {\n String watchName = trigger.getWatch();\n\n for (DrawableNode endNode : getNodes()) {\n Boolean createConnection = false;\n\n if (watchName.equals(endNode.getContainedText())) {\n createConnection = true;\n }\n\n // This connection has the start and end the other way around, the target is specified in the trigger but\n // we want it to look like the watched node is connecting to the trigger as that is the order that they are run\n if (createConnection && !connectionExists(endNode, node)) {\n NodeConnection newConnection = new NodeConnection(endNode, node, NodeConnection.TRIGGER_CONNECTION);\n connections.add(newConnection);\n updateCanvas = true;\n }\n }\n }\n }\n\n // Find connection that are set using the Next node input box\n if (node != null && !node.getNextNodeToRun().isEmpty()) {\n for (DrawableNode endNode : getNodes()) {\n if (node.getNextNodeToRun().equals(endNode.getContainedText())) {\n if (!connectionExists(node, endNode)) {\n NodeConnection newConnection = new NodeConnection(node, endNode, NodeConnection.MAIN_CONNECTION);\n connections.add(newConnection);\n updateCanvas = true;\n }\n }\n }\n }\n }\n\n // Checks old connections and removes ones that don't exist\n List<NodeConnection> listToRemove = new ArrayList<>();\n List<NodeConnection> connectionsLoopTemp = new ArrayList<>(); // We make a copy the list here so that we can the original while iterating over this one\n connectionsLoopTemp.addAll(connections);\n for (NodeConnection nodeConnection : connectionsLoopTemp) {\n if (nodeConnection.getConnectionType().equals(NodeConnection.DYNAMIC_CONNECTION)) {\n if (nodeConnection.getConnectionStart() instanceof LogicNode) {\n if (!((LogicNode) nodeConnection.getConnectionStart()).getLogic().getLogic().contains(\"run(\\\"\" + nodeConnection.getConnectionEnd().getContainedText() + \"\\\"\")) {\n if (!((LogicNode) nodeConnection.getConnectionStart()).getLogic().getLogic().contains(\"runAndWait(\\\"\" + nodeConnection.getConnectionEnd().getContainedText() + \"\\\"\")) {\n if (!((LogicNode) nodeConnection.getConnectionStart()).getLogic().getLogic().contains(\"runAndJoin(\\\"\" + nodeConnection.getConnectionEnd().getContainedText() + \"\\\"\")) {\n if (!((LogicNode) nodeConnection.getConnectionStart()).getLogic().getLogic().contains(\"getNode(\\\"\" + nodeConnection.getConnectionEnd().getContainedText() + \"\\\"\")) {\n listToRemove.add(nodeConnection);\n updateCanvas = true;\n }\n }\n }\n }\n } else if (nodeConnection.getConnectionStart() instanceof TestCaseNode) {\n if (!((TestCaseNode) nodeConnection.getConnectionStart()).getLogic().getLogic().contains(\"run(\\\"\" + nodeConnection.getConnectionEnd().getContainedText() + \"\\\"\")) {\n if (!((TestCaseNode) nodeConnection.getConnectionStart()).getLogic().getLogic().contains(\"runAndWait(\\\"\" + nodeConnection.getConnectionEnd().getContainedText() + \"\\\"\")) {\n if (!((TestCaseNode) nodeConnection.getConnectionStart()).getLogic().getLogic().contains(\"runAndJoin(\\\"\" + nodeConnection.getConnectionEnd().getContainedText() + \"\\\"\")) {\n if (!((TestCaseNode) nodeConnection.getConnectionStart()).getLogic().getLogic().contains(\"getNode(\\\"\" + nodeConnection.getConnectionEnd().getContainedText() + \"\\\"\")) {\n listToRemove.add(nodeConnection);\n updateCanvas = true;\n }\n }\n }\n }\n } else if (nodeConnection.getConnectionStart() instanceof SwitchNode) {\n List<Switch> aSwitches = ((SwitchNode) nodeConnection.getConnectionStart()).getSwitches();\n String endContainedText = nodeConnection.getConnectionEnd().getContainedText();\n Integer removeCount = 0;\n for (Switch aSwitch : aSwitches) {\n if ((!aSwitch.getTarget().equals(endContainedText) || !aSwitch.isEnabled())) {\n removeCount++;\n }\n }\n\n if (removeCount.equals(aSwitches.size())) {\n // Create a disabled connection between these two nodes to give appearance of toggling\n NodeConnection newConnection = new NodeConnection(nodeConnection.getConnectionStart(), nodeConnection.getConnectionEnd(), NodeConnection.DISABLED_CONNECTION);\n connections.add(newConnection);\n\n listToRemove.add(nodeConnection);\n updateCanvas = true;\n }\n }\n } else if (nodeConnection.getConnectionType().equals(NodeConnection.TRIGGER_CONNECTION)) {\n if (nodeConnection.getConnectionEnd() instanceof TriggerNode) { // Here the start and end connections are reversed\n List<Trigger> triggers = ((TriggerNode) nodeConnection.getConnectionEnd()).getTriggers();\n String endContainedText = nodeConnection.getConnectionStart().getContainedText();\n Integer removeCount = 0;\n for (Trigger trigger : triggers) {\n if ((!trigger.getWatch().equals(endContainedText))) {\n removeCount++;\n }\n }\n\n if (removeCount.equals(triggers.size())) {\n listToRemove.add(nodeConnection);\n updateCanvas = true;\n }\n }\n } else if (nodeConnection.getConnectionType().equals(NodeConnection.GET_NODE_CONNECTION)) {\n if (nodeConnection.getConnectionStart() instanceof LogicNode) {\n if (!((LogicNode) nodeConnection.getConnectionStart()).getLogic().getLogic().contains(\"getNode(\\\"\" + nodeConnection.getConnectionEnd().getContainedText() + \"\\\"\")) {\n listToRemove.add(nodeConnection);\n updateCanvas = true;\n }\n } else if (nodeConnection.getConnectionStart() instanceof TestCaseNode) {\n if (!((TestCaseNode) nodeConnection.getConnectionStart()).getLogic().getLogic().contains(\"getNode(\\\"\" + nodeConnection.getConnectionEnd().getContainedText() + \"\\\"\")) {\n listToRemove.add(nodeConnection);\n updateCanvas = true;\n }\n }\n } else if (nodeConnection.getConnectionType().equals(NodeConnection.DISABLED_CONNECTION)) {\n if (nodeConnection.getConnectionStart() instanceof SwitchNode) {\n List<Switch> aSwitches = ((SwitchNode) nodeConnection.getConnectionStart()).getSwitches();\n String endContainedText = nodeConnection.getConnectionEnd().getContainedText();\n Integer removeCount = 0;\n for (Switch aSwitch : aSwitches) {\n if ((!aSwitch.getTarget().equals(endContainedText) || aSwitch.isEnabled())) {\n removeCount++;\n }\n }\n\n if (removeCount.equals(aSwitches.size())) {\n // Create an enabled connection between these two nodes to give appearance of toggling\n NodeConnection newConnection = new NodeConnection(nodeConnection.getConnectionStart(), nodeConnection.getConnectionEnd(), NodeConnection.DYNAMIC_CONNECTION);\n connections.add(newConnection);\n\n listToRemove.add(nodeConnection);\n updateCanvas = true;\n }\n }\n }\n\n if (nodeConnection.getConnectionType().equals(NodeConnection.MAIN_CONNECTION)) {\n if (!nodeConnection.getConnectionStart().getNextNodeToRun().equals(nodeConnection.getConnectionEnd().getContainedText())) {\n listToRemove.add(nodeConnection);\n updateCanvas = true;\n }\n }\n }\n\n connections.removeAll(listToRemove);\n if (updateCanvas) {\n Controller.getInstance().updateCanvasControllerLater();\n }\n }", "public void removeChildren() {\r\n this.children.clear();\r\n childNum = 0;\r\n }", "public void RecursiveExpansion() throws TreeTooBigException {\r\n int transIndex; //Index to count transitions\r\n int[] newMarkup; //markup used to create new node\r\n boolean aTransitionIsEnabled = false; //To check for deadlock\r\n //Attribute used for assessing whether a node has occured before\r\n boolean repeatedNode = false; \r\n \r\n boolean allOmegas = false;\r\n \r\n boolean[] enabledTransitions = \r\n tree.dataLayer.getTransitionEnabledStatusArray(markup);\r\n\r\n //For each transition\r\n for (int i = 0; i < enabledTransitions.length; i++) {\r\n if (enabledTransitions[i] == true) {\r\n //Set transArray of to true for this index\r\n transArray[i] = true;\r\n \r\n //System.out.println(\"\\n Transition \" + i + \" Enabled\" );\r\n aTransitionIsEnabled = true;\r\n \r\n //print (\"\\n Old Markup is :\", markup);//debug\r\n \r\n //Fire transition to produce new markup vector\r\n newMarkup = fire(i);\r\n \r\n //print (\"\\n New Markup is :\", newMarkup);//debug\r\n \r\n //Check for safeness. If any of places have > 1 token set variable.\r\n for (int j = 0; j < newMarkup.length; j++) {\r\n if (newMarkup[j] > 1 || newMarkup[j] == -1) {\r\n tree.moreThanOneToken = true;\r\n break;\r\n }\r\n } \r\n \r\n //Create a new node using the new markup vector and attach it to\r\n //the current node as a child.\r\n children[i] = \r\n new myNode(newMarkup, this, tree, depth + 1);\r\n \r\n /* Now need to (a) check if any omegas (represented by -1) need to \r\n * be inserted in the markup vector of the new node, and (b) if the \r\n * resulting markup vector has appeared anywhere else in the tree. \r\n * We must do (a) before (b) as we need to know if the new node \r\n * contains any omegas to be able to compare it with existing nodes. \r\n */ \r\n allOmegas = children[i].InsertOmegas();\r\n \r\n //check if the resulting markup vector has occured anywhere else in the tree\r\n repeatedNode = (tree.root).FindMarkup(children[i]);\r\n \r\n if (tree.nodeCount >= Pipe.MAX_NODES && !tree.tooBig) {\r\n tree.tooBig = true;\r\n throw new TreeTooBigException();\r\n }\r\n \r\n if (!repeatedNode && !allOmegas) {\r\n children[i].RecursiveExpansion();\r\n }\r\n }\r\n }\r\n \r\n if (!aTransitionIsEnabled) {\r\n System.err.println(\"No transition enabled\");\r\n if (!tree.noEnabledTransitions || tree.pathToDeadlock.length < depth-1) {\r\n RecordDeadlockPath();\r\n tree.noEnabledTransitions = true;\r\n } else {\r\n System.err.println(\"Deadlocked node found, but path is not shorter\"\r\n + \" than current path.\");\r\n }\r\n } else {\r\n //System.out.println(\"Transitions enabled.\");\r\n }\r\n }", "public void makeCircular() {\n\t\t// write your code for makeCircular using the specification above\n\t\tNode noderef = head; \n\t\tif (this.size()==1){\n\t\t\tnoderef.next = head;\n\t\t\treturn;\n\t\t}\n\t\tif(this.size()==0){\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tfor(int counter=0; counter < this.size()-1; counter++){\n\t\t\tnoderef = noderef.next;\n\t\t}\n\t\tnoderef.next = head; \n\t}", "public static void Execute ()\n\t{\n\t\tReceiveCollection (SpawnCrawler (target));\n\t\t\n\t\tList<String> initialCollection = overCollection;\n\t\t\n\t\tif ( ! initialCollection.isEmpty ())\n\t\t{\n\t\t\n\t\t\tfor (String collected : initialCollection)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tif (collected.contains (\"http\"))\n\t\t\t\t\tReceiveCollection (SpawnCrawler (collected));\n\t\t\t\telse\n\t\t\t\t\tReceiveCollection (SpawnCrawler (target + collected));\n\t\t\t\t\n\t\t\t}\n\t\t\n\t\t}\n\t\t\n\t\t/*\n\t\t * Several loops should commence here where the system reiteratively goes over all the newly acquired URLs\n\t\t * so it may extend itself beyond the first and second depth.\n\t\t * However this process should be halted once it reaches a certain configurable depth.\n\t\t */\n\t\tint depth = 0;\n\t\tint newFoundings = 0;\n\t\t\n\t\tdepthLoop: while (depth <= MAX_DEPTH)\n\t\t{\n\t\t\t\n\t\t\tfor (String collected : overCollection)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tif (collected.contains (\"http\"))\n\t\t\t\t\tSpawnCrawler (collected);\n\t\t\t\telse\n\t\t\t\t\tSpawnCrawler (target + collected);\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif (newFoundings <= 0)\n\t\t\t\tbreak depthLoop;\n\t\t\t\n\t\t\tdepth++;\n\t\t\t\t\t\t\n\t\t}\n\t\t\n\t}", "public abstract Graph getChildren(String parentHash);", "protected void startChildStateReflector() {\n\t\tif (!destroy) {\n\t\t\tlogger().debug(\"Starting Child State Reflector.\");\n\t\t\tchildStateReflector.start();\n\t\t}\n\t}", "private static void finalizeAllNestedChildren(SapODataColumnMetadata children) {\n if (children.containsChild()) {\n children.getChildList().forEach(SapODataColumnMetadata::finalizeAllNestedChildren);\n }\n\n children.isChildListComplete = true;\n }", "public void testGetCachedChild() {\n FileObject fobj = getFileObject(testFile);\n FileObject parent = fobj.getParent();\n monitor.reset();\n FileObject[] childs = parent.getChildren();\n monitor.getResults().assertResult(1, StatFiles.ALL);\n monitor.getResults().assertResult(1, StatFiles.READ);\n //second time\n monitor.reset();\n childs = parent.getChildren();\n monitor.getResults().assertResult(0, StatFiles.ALL);\n }", "public void determinePartitions( Callback c ){\n mCurrentDepth = 0;\n GraphNode node;\n GraphNode child;\n int depth = 0;\n List levelList = new java.util.LinkedList();\n int i = 0;\n //they contain those nodes whose parents have not been traversed as yet\n //but the BFS did it.\n List orphans = new java.util.LinkedList();\n\n\n //set the depth of the dummy root as 0\n mRoot.setDepth( mCurrentDepth );\n\n mQueue.addLast( mRoot );\n\n while( !mQueue.isEmpty() ){\n node = (GraphNode)mQueue.getFirst();\n depth = node.getDepth();\n if( mCurrentDepth < depth ){\n\n if( mCurrentDepth > 0 ){\n //we are done with one level!\n constructPartitions( c, levelList, mCurrentDepth );\n }\n\n\n //a new level starts\n mCurrentDepth++;\n levelList.clear();\n }\n mLogger.log( \"Adding to level \" + mCurrentDepth + \" \" + node.getID(),\n LogManager.DEBUG_MESSAGE_LEVEL);\n levelList.add( node );\n\n //look at the orphans first to see if any\n //of the dependency has changed or not.\n /*it = orphans.iterator();\n while(it.hasNext()){\n child = (GraphNode)it.next();\n if(child.parentsBlack()){\n child.setDepth(depth + 1);\n System.out.println(\"Set depth of \" + child.getID() + \" to \" + child.getDepth());\n\n child.traversed();\n mQueue.addLast(child);\n }\n\n //remove the child from the orphan\n it.remove();\n }*/\n\n\n node.setColor( GraphNode.BLACK_COLOR );\n for( Iterator it = node.getChildren().iterator(); it.hasNext(); ){\n child = (GraphNode)it.next();\n if(!child.isColor( GraphNode.GRAY_COLOR ) &&\n child.parentsColored( GraphNode.BLACK_COLOR )){\n mLogger.log( \"Adding to queue \" + child.getID(),\n LogManager.DEBUG_MESSAGE_LEVEL );\n child.setDepth( depth + 1 );\n child.setColor( GraphNode.GRAY_COLOR );\n mQueue.addLast( child );\n }\n /*else if(!child.isTraversed() && !child.parentsBlack()){\n //we have to do the bumping effect\n System.out.println(\"Bumping child \" + child);\n orphans.add(child);\n }*/\n }\n node = (GraphNode)mQueue.removeFirst();\n mLogger.log( \"Removed \" + node.getID(),\n LogManager.DEBUG_MESSAGE_LEVEL);\n }\n\n //handle the last level of the BFS\n constructPartitions( c, levelList, mCurrentDepth );\n\n\n //all the partitions are dependant sequentially\n for( i = mCurrentDepth; i > 1; i-- ){\n constructLevelRelations( c, i - 1, i );\n\n }\n\n done( c );\n }", "protected void populateChildren() throws MessagingException\n {\n connect();\n \n Folder[] sub = store.getDefaultFolder().list();\n addChildren(sub, 0);\n }" ]
[ "0.6246335", "0.6222769", "0.6081489", "0.56986165", "0.5600083", "0.5569997", "0.55359197", "0.55359197", "0.55359197", "0.5526154", "0.55173075", "0.55170625", "0.55154157", "0.5506944", "0.55060697", "0.5481505", "0.5470102", "0.543657", "0.54289436", "0.53934395", "0.53933096", "0.5366557", "0.5366008", "0.53643256", "0.53536147", "0.5346488", "0.5328569", "0.5309447", "0.53080904", "0.5304909", "0.53013253", "0.52967966", "0.52753943", "0.52657396", "0.5260304", "0.5259068", "0.5243762", "0.5242207", "0.52374077", "0.5222034", "0.52163166", "0.52129674", "0.5197791", "0.5188824", "0.51777154", "0.51700985", "0.51670736", "0.5146432", "0.5146313", "0.51380324", "0.5137737", "0.51323605", "0.51252514", "0.510822", "0.50934494", "0.50908244", "0.50832343", "0.5076913", "0.5066503", "0.503239", "0.5026901", "0.50194544", "0.501518", "0.5002765", "0.5000687", "0.49993864", "0.49956444", "0.49927035", "0.499181", "0.49880955", "0.4987924", "0.49877083", "0.4984614", "0.49758604", "0.4972971", "0.49716043", "0.497156", "0.49680758", "0.4967079", "0.49670643", "0.49641535", "0.4963071", "0.4959312", "0.49503493", "0.4943218", "0.49389863", "0.49327952", "0.49299666", "0.4922729", "0.49199775", "0.49197388", "0.49195832", "0.49061808", "0.49024254", "0.48972064", "0.48934314", "0.4888498", "0.4884109", "0.4884084", "0.48834738" ]
0.5201133
42
/ Here I check for cycles.
private boolean cycleCheck(Node current, Queue<Node> expanded){ if( expanded.size() == 0){ return false; //Because current is root } for(Node nodeInExpanded : expanded){ if(current!=null && current.getDigit().getDigitString().equals(nodeInExpanded.getDigit().getDigitString())){ //the digits are same so we check children. ArrayList<String> currentChildren = makeChildren(current); ArrayList<String> childrenOfExpanded = makeChildren(nodeInExpanded); int size; if(currentChildren.size() > childrenOfExpanded.size() ){ size = childrenOfExpanded.size(); }else if(currentChildren.size() < childrenOfExpanded.size()){ size = currentChildren.size(); }else{ size = childrenOfExpanded.size(); } /* I use the modulus operator so that I dont get a ArrayIndexOut of Bounds */ if( currentChildren.size() == childrenOfExpanded.size() && currentChildren.get(0%size).equals(childrenOfExpanded.get(0%size)) && currentChildren.get(1%size).equals(childrenOfExpanded.get(1%size)) && currentChildren.get(2%size).equals(childrenOfExpanded.get(2%size)) && currentChildren.get(3%size).equals(childrenOfExpanded.get(3%size)) ){ return true; } } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private Boolean checkCycle() {\n Node slow = this;\n Node fast = this;\n while (fast.nextNode != null && fast.nextNode.nextNode != null) {\n fast = fast.nextNode.nextNode;\n slow = slow.nextNode;\n if (fast == slow) {\n System.out.println(\"contains cycle\");\n return true;\n }\n }\n System.out.println(\"non-cycle\");\n return false;\n }", "public static void checkCycleSample() {\n Node ll1_5 = new Node(1, new Node(2, new Node(3, new Node(4, new Node(5, null)))));\n\n Node ll1_2 = new Node(1, new Node(2, null));\n Node ll3_4 = new Node(3, new Node(4, null));\n Node ll5_6 = new Node(5, new Node(6, null));\n ll1_2.nextNode.nextNode = ll3_4;\n ll3_4.nextNode.nextNode = ll5_6;\n ll5_6.nextNode.nextNode = ll1_2;\n\n ll1_2.checkCycle();\n ll1_5.checkCycle();\n }", "@SuppressWarnings(\"unchecked\")\r\n private static void cycleTests() throws CALExecutorException {\r\n \r\n final ImmutableDirectedGraph<Integer> noCycles = ImmutableDirectedGraph\r\n .makeGraph(\r\n Collections.<Integer>emptyList(),\r\n Arrays.asList(Pair.make(1, 2), Pair.make(2, 3), Pair.make(1, 3)),\r\n executionContext);\r\n \r\n final ImmutableDirectedGraph<Integer> lengthOneCycle = ImmutableDirectedGraph\r\n .makeGraph(\r\n Collections.<Integer>emptyList(),\r\n Arrays.asList(Pair.make(1, 1)),\r\n executionContext);\r\n \r\n final ImmutableDirectedGraph<Integer> lengthTwoCycle = ImmutableDirectedGraph\r\n .makeGraph(\r\n Collections.<Integer>emptyList(),\r\n Arrays.asList(Pair.make(1, 2), Pair.make(2, 1)),\r\n executionContext);\r\n \r\n System.out.println(\"noCycle.findCycle(): \" + noCycles.findCycle());\r\n System.out.println(\"oneCycle.findCycle(): \" + lengthOneCycle.findCycle());\r\n System.out.println(\"twoCycle.findCycle(): \" + lengthTwoCycle.findCycle());\r\n }", "private boolean checkCycle() {\n for (int i = 0; i < 26; i++) {\n color[i] = 0;\n }\n for (int i = 0; i < 26; i++) {\n if (color[i] != -1 && BFS(i)) return true;\n }\n return false;\n }", "public boolean detectCycles()\n {\n try {\n execute(null, null);\n } catch (CycleDetectedException ex) {\n return true;\n }\n\n return false;\n }", "private static boolean isCycle(Graph graph) {\n for (int i = 0; i < graph.edges.length; ++i) {\n int x = graph.find(graph.edges[i][0]);\n int y = graph.find(graph.edges[i][1]);\n\n // if both subsets are same, then there is cycle in graph.\n if (x == y) {\n // for edge 2-0 : parent of 0 is 2 == 2 and so we detected a cycle\n return true;\n }\n // keep doing union/merge of sets\n graph.union(x, y);\n }\n return false;\n }", "int isCycle( Graph graph){\n int parent[] = new int[graph.V]; \n \n // Initialize all subsets as single element sets \n for (int i=0; i<graph.V; ++i) \n parent[i]=-1; \n \n // Iterate through all edges of graph, find subset of both vertices of every edge, if both subsets are same, then there is cycle in graph. \n for (int i = 0; i < graph.E; ++i){ \n int x = graph.find(parent, graph.edge[i].src); \n int y = graph.find(parent, graph.edge[i].dest); \n \n if (x == y) \n return 1; \n \n graph.Union(parent, x, y); \n } \n return 0; \n }", "private boolean hasCycle()\r\n {\r\n boolean passed = false;\r\n for(Field.RadioData dst=radioList; dst!=null; dst=dst.next)\r\n {\r\n if(dst==radioList && passed) return true;\r\n passed = true;\r\n }\r\n return false;\r\n }", "private boolean hasCycle1() {\n\t\tNode slow = head;\n\t\tNode fast = head;\n\t\t\n\t\twhile (fast != null && fast.next != null) {\n\t\t\tslow = slow.next;\n\t\t\tfast = fast.next.next;\n\t\t\tif(slow == fast) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "private boolean hasCycle() {\n\t\tNode n = head;\n\t\tSet<Node> nodeSeen = new HashSet<>();\n\t\twhile (nodeSeen != null) {\n\t\t\tif (nodeSeen.contains(n)) {\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\tnodeSeen.add(n);\n\t\t\t}\n\t\t\tn = n.next;\n\t\t}\n\t\treturn false;\n\t}", "boolean cycle() {\n int j;\t\t\t\t\t\t// If cycle detected report as negative edge weight cycle.\n for (j = 0; j < e; ++j)\n if (d[edges.get(j).u] + edges.get(j).w < d[edges.get(j).v])\n return false;\n return true;\n }", "boolean detectCycleUndirected(ArrayList<Integer> G[]) {\n\t\tint[] vis = new int[G.length];\n\t\tfor (int i = 0; i < G.length; i++) {\n\t\t\tif (vis[i] == 0) {\n\t\t\t\tif (detectCycleUtil(G, i, vis, -1))\n\t\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "boolean hasCycle() {\n if (head == null){\n return false;\n }\n Node slow = head;\n Node fast = head;\n while (slow != null && fast != null && fast.next != null){\n slow = slow.next;\n fast = fast.next.next;\n if (slow == fast){\n return true;\n }\n }\n return false;\n }", "private void treatCycles(SDFGraph graph) throws InvalidExpressionException {\r\n\t\tList<Set<SDFAbstractVertex>> cycles = new ArrayList<Set<SDFAbstractVertex>>();\r\n\t\tCycleDetector<SDFAbstractVertex, SDFEdge> detector = new CycleDetector<SDFAbstractVertex, SDFEdge>(\r\n\t\t\t\tgraph);\r\n\t\tList<SDFAbstractVertex> vertices = new ArrayList<SDFAbstractVertex>(\r\n\t\t\t\tgraph.vertexSet());\r\n\t\twhile (vertices.size() > 0) {\r\n\t\t\tSDFAbstractVertex vertex = vertices.get(0);\r\n\t\t\tSet<SDFAbstractVertex> cycle = detector\r\n\t\t\t\t\t.findCyclesContainingVertex(vertex);\r\n\t\t\tif (cycle.size() > 0) {\r\n\t\t\t\tvertices.removeAll(cycle);\r\n\t\t\t\tcycles.add(cycle);\r\n\t\t\t}\r\n\t\t\tvertices.remove(vertex);\r\n\t\t}\r\n\r\n\t\tfor (Set<SDFAbstractVertex> cycle : cycles) {\r\n\t\t\tint gcd = gcdOfVerticesVrb(cycle);\r\n\t\t\tif (gcd > 1 && !(graph instanceof PSDFGraph)) {\r\n\t\t\t\tcopyCycle(graph, cycle, gcd);\r\n\t\t\t} else if (!(graph instanceof PSDFGraph)) {\r\n\t\t\t\ttreatPSDFCycles(graph, cycle);\r\n\t\t\t}\r\n\t\t}\r\n\t\t// SDFIterator sdfIterator = new SDFIterator(graph);\r\n\t\t// List<SDFAbstractVertex> orderedList = new\r\n\t\t// ArrayList<SDFAbstractVertex>();\r\n\t\t// while (sdfIterator.hasNext()) {\r\n\t\t// SDFAbstractVertex current = sdfIterator.next();\r\n\t\t// orderedList.add(current);\r\n\t\t// if (current instanceof SDFRoundBufferVertex) {\r\n\t\t// int nbTokens = 0;\r\n\t\t// for (SDFEdge edgeData : graph.outgoingEdgesOf(current)) {\r\n\t\t// nbTokens = edgeData.getProd().intValue();\r\n\t\t// }\r\n\t\t// for (int i = orderedList.size() - 1; i >= 0; i--) {\r\n\t\t// if (graph.getAllEdges(orderedList.get(i), current).size() == 1) {\r\n\t\t// if (nbTokens <= 0) {\r\n\t\t// graph.removeAllEdges(orderedList.get(i), current);\r\n\t\t// } else {\r\n\t\t// for (SDFEdge thisEdge : graph.getAllEdges(\r\n\t\t// orderedList.get(i), current)) {\r\n\t\t// nbTokens = nbTokens\r\n\t\t// - thisEdge.getProd().intValue();\r\n\t\t// }\r\n\t\t// }\r\n\t\t// }\r\n\t\t// }\r\n\t\t// // traiter le roundBuffer pour le supprimer\r\n\t\t// if (graph.incomingEdgesOf(current).size() == 1\r\n\t\t// && graph.outgoingEdgesOf(current).size() == 1) {\r\n\t\t// SDFAbstractVertex source = ((SDFEdge) graph\r\n\t\t// .incomingEdgesOf(current).toArray()[0]).getSource();\r\n\t\t// SDFEdge oldEdge = ((SDFEdge) graph.incomingEdgesOf(current)\r\n\t\t// .toArray()[0]);\r\n\t\t// SDFAbstractVertex target = ((SDFEdge) graph\r\n\t\t// .outgoingEdgesOf(current).toArray()[0]).getTarget();\r\n\t\t// SDFEdge refEdge = ((SDFEdge) graph.outgoingEdgesOf(current)\r\n\t\t// .toArray()[0]);\r\n\t\t// SDFEdge newEdge = graph.addEdge(source, target);\r\n\t\t// newEdge.copyProperties(refEdge);\r\n\t\t// graph.removeEdge(refEdge);\r\n\t\t// graph.removeEdge(oldEdge);\r\n\t\t// graph.removeVertex(current);\r\n\t\t// orderedList.remove(current);\r\n\t\t// } else if (graph.incomingEdgesOf(current).size() == 1\r\n\t\t// && graph.outgoingEdgesOf(current).size() > 1) {\r\n\t\t//\r\n\t\t// } else if (graph.incomingEdgesOf(current).size() > 1\r\n\t\t// && graph.outgoingEdgesOf(current).size() == 1) {\r\n\t\t//\r\n\t\t// }\r\n\t\t// }\r\n\t\t// }\r\n\t\t/*\r\n\t\t * { CycleDetector<SDFAbstractVertex, SDFEdge> detect = new\r\n\t\t * CycleDetector<SDFAbstractVertex, SDFEdge>( graph);\r\n\t\t * List<SDFAbstractVertex> vert = new ArrayList<SDFAbstractVertex>(\r\n\t\t * graph.vertexSet()); while (vert.size() > 0) { SDFAbstractVertex\r\n\t\t * vertex = vert.get(0); Set<SDFAbstractVertex> cycle = detect\r\n\t\t * .findCyclesContainingVertex(vertex); if (cycle.size() > 0) {\r\n\t\t * vert.removeAll(cycle); cycles.add(cycle); } vert.remove(vertex); } }\r\n\t\t */\r\n\r\n\t\treturn;\r\n\t}", "public static boolean hasCycle( IntNode head ) {\r\n\t\r\n\t\tfor( IntNode cursor = head; cursor != null; cursor = cursor.link ) {\r\n\t\t\t// otherwise should return false if the list is acyclic\r\n\t\t\tif( cursor.link == null )\r\n\t\t\t\treturn false;\r\n\t\t}\r\n\t\t// should return true if it is cyclic\r\n\t\treturn true;\r\n\t\t\r\n\t}", "public ListNode detectCycle(ListNode head) {\n if (null == head || null == head.next) return null;\n ListNode cur = head.next, runner = head.next.next;\n while (null != runner && null != runner.next & cur != runner) {\n cur = cur.next;\n runner = runner.next.next;\n }\n if (cur == runner) {\n cur = head;\n while (runner != cur) {\n cur = cur.next;\n runner = runner.next;\n }\n return cur;\n }\n return null;\n }", "public ListNode detectCycle(ListNode head) {\n ListNode walker = head;\n ListNode runner = head;\n \n while(runner != null && runner.next != null) {\n runner = runner.next.next;\n walker = walker.next;\n \n if (runner == walker) {\n while(walker != head) {\n head = head.next;\n walker = walker.next;\n }\n \n return head;\n }\n }\n \n return null;\n }", "public boolean hasCycle() {\r\n\t\tSet<Vertex> visited = new HashSet<Vertex>();\r\n\t\tSet<Vertex> path = new HashSet<Vertex>();\r\n\r\n\t\t// Call the helper function to detect cycle for all vertices one by one\r\n\t\tfor (int i = 0; i < N; ++i)\r\n\t\t\tif (detectCycle(this.vertices[i], visited, path))\r\n\t\t\t\treturn true;\r\n\r\n\t\treturn false;\r\n\t}", "public void DFS2() {\n boolean[] visited = new boolean[numVertices];\n int[] predecessors = new int[numVertices];\n for (int i = 0; i < numVertices; i++) {\n if (visited[i] == false && hasCycle(0, visited, predecessors)) {\n System.out.println(\"Cycle has found\");\n return;\n }\n }\n System.out.println(\"No cycle found in the graph\");\n }", "@Test\n public void TestIfNoCycle() {\n final int NUMBER_OF_ELEMENTS = 100;\n TripleList<Integer> tripleList = new TripleList<>();\n for (int i = 0; i < NUMBER_OF_ELEMENTS; ++i) {\n tripleList.add(i);\n }\n /**\n * Created 2 TripleLists, first jumps every single element, another\n * every two elements, in out case every two elements means every\n * NextElement*\n */\n TripleList<Integer> tripleListEverySingleNode = tripleList;\n TripleList<Integer> tripleListEveryTwoNodes = tripleList.getNext();\n for (int i = 0; i < NUMBER_OF_ELEMENTS * NUMBER_OF_ELEMENTS; ++i) {\n Assert.assertNotSame(tripleListEverySingleNode, tripleListEveryTwoNodes);\n //JumpToNextElement(ref tripleListEverySingleNode);\n if (null == tripleListEveryTwoNodes.getNext()) {\n // if list has end means there are no cycles\n break;\n } else {\n tripleListEveryTwoNodes = tripleListEveryTwoNodes.getNext();\n }\n }\n }", "public static void main(String args[])\n {\n LinkedList list = new LinkedList();\n\n list.add(1);\n list.add(2);\n list.add(3);\n list.add(4);\n list.add(5);\n\n // loop\n list.head.next.next.next = list.head;\n\n System.out.println(list.hasCycle());\n }", "static boolean hasCycle(Node head) {\n\t\t\n\t\tif(head == null) return false;\n\t\t\n\t\t//Using the concept of one pointer moving faster than another, since at some point both will meet \n\t\t//at the same point and close a cycle (if any).\n\t\tNode slowPointerNode = head;\n\t\tNode fastPointerNode = head.getNext();\n\t\t\n\t\twhile(fastPointerNode != null && fastPointerNode.getNext() != null) {\n\t\t\tif(slowPointerNode == fastPointerNode) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tslowPointerNode = slowPointerNode.getNext();\n\t\t\tfastPointerNode = fastPointerNode.getNext().getNext();\n\t\t}\n\t\t\n\t\treturn false;\n\t}", "@Test\n void findCycle() {\n Map<String, Set<String>> nonCyclicGraph = Map.of(\n \"0\", Set.of(\"a\", \"b\", \"c\"),\n \"a\", Set.of(\"0\", \"a2\", \"a3\"),\n \"a2\", Set.of(\"a\"),\n \"a3\", Set.of(\"a\"),\n \"b\", Set.of(\"0\", \"b2\"),\n \"b2\", Set.of(\"b\"),\n \"c\", Set.of(\"0\")\n );\n assertThat(solution.findCycle(nonCyclicGraph)).isFalse();\n\n // 0\n // / | \\\n // a b c\n // /\\ | /\n // a2 a3 b2\n Map<String, Set<String>> cyclicGraph = Map.of(\n \"0\", Set.of(\"a\", \"b\", \"c\"),\n \"a\", Set.of(\"0\", \"a2\", \"a3\"),\n \"a2\", Set.of(\"a\"),\n \"a3\", Set.of(\"a\"),\n \"b\", Set.of(\"0\", \"b2\"),\n \"b2\", Set.of(\"b\"),\n \"c\", Set.of(\"0\", \"b2\")\n );\n assertThat(solution.findCycle(cyclicGraph)).isTrue();\n }", "public static boolean hasCycle(ListNode node) {\n\t\treturn true;\n\t}", "boolean isCycle(SimpleVertex simpleVertex, int length) {\n\n\t\twhile (count != length) {\n\t\t\tif (simpleVertex.isVisited == false) {\n\t\t\t\tsimpleVertex.isVisited = true;\n\t\t\t\tcount++;\n\t\t\t\tSystem.out.print(simpleVertex.Vertexname + \" \");\n\t\t\t\tfor (int i = 0; i < simpleVertex.neighborhood.size(); i++) {\n\n\t\t\t\t\tSimpleEdge node = simpleVertex.neighborhood.get(i);\n\t\t\t\t\tif (node.one.Vertexname == node.two.Vertexname) {\n\n\t\t\t\t\t\tSystem.out.println(\"here ---------------\");\n\t\t\t\t\t\tflag = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tisCycle(node.two, length);\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\treturn true;\n\n\t\t\t}\n\t\t}\n\t\treturn flag;\n\n\t}", "private void findCycles(ClassDecl decl, String className, int numClasses){\n\t //base case: our decl is null, return and break out of this method\n if (decl == null) {\n return;\n }\n //base case: if numClasses is 0 and we see the name, its a cycle, throw error\n else if(numClasses == 0 || decl.name.equals(className)) {\n errorMsg.error(decl.pos, \"Circular reference found: \" + decl.name);\n }\n else { //recursive case, call findCycles on the remaining links\n findCycles(decl.superLink, className, numClasses - 1);\n }\n }", "public void findLoop(NodeLoop first){\n ArrayList<String> ids = new ArrayList<String>();\n NodeLoop cur = first;\n\n //Finds Loop, if cur.next=null there was no loop\n while(cur.next!=null){\n\n //Found Cycle\n if(ids.contains(cur.id)){\n System.out.println(\"Cycle Found, Begins at \" + cur.id);\n break;\n }\n\n //Add current id to list of id's\n ids.add(cur.id);\n cur = cur.next;\n }\n\n //If no cycle found\n if(cur.next==null){\n System.out.println(\"No Cycle's Found\");\n }\n\n }", "public boolean hasCycle(ListNode head) {\n if(head == null || head.next == null){\n return false;\n }\n\n ListNode p1 = head.next;\n ListNode p2 = head.next.next;\n while(p1 != null && p2 != null){\n if(p1 == p2){\n return true;\n }\n p1 = p1.next;\n p2 = p2.next;\n if(p2 != null){\n p2 = p2.next;\n }\n }\n return false;\n }", "@Test\n public void testVerifyLoopTerminatesWhenCycleFound() throws Exception {\n // Add more mocking detail to our dependencies first.\n // ----------------------------------------------------\n\n DepChaser sut = createSut();\n\n // First mock our dependencyMap to know about variables a thru f\n when(_dependencyMap.keySet()).thenReturn(new HashSet<>(Arrays.asList(\"a\", \"b\", \"c\", \"d\", \"e\", \"f\")));\n\n // ----------------------------------------------------------------------------------\n // we're going to make it so it takes 2 iterations in DepChaser to handle a thru f\n // ----------------------------------------------------------------------------------\n\n // The 1st time, our mocked checker is going to checkout no cycles in a, b, c variables\n ChildrenDependencyChecker checker1 = mock(ChildrenDependencyChecker.class);\n Exception exception = new Exception(\"fake exception\");\n when(checker1.run()).thenThrow(exception);\n\n when(_dependencyCheckerFactory.create(\"a\", _dependencyMap, new HashSet<>())).thenReturn(checker1);\n\n Assert.assertFalse(sut.validateNoDependencyCycles());\n verify(checker1, times(1)).run();\n\n // Verify no variables were verified\n Assert.assertEquals(new HashSet<>(), sut.getVerifiedVariables());\n // Verify the _dependencyCheckerFactory was only called once.\n verify(_dependencyCheckerFactory, times(1)).create(\"a\", _dependencyMap, new HashSet<>());\n verifyNoMoreInteractions(_dependencyCheckerFactory);\n }", "static\tListNode listCycle(ListNode a){\n if(a==null || a.next==null || a.next.next==null){\r\n return null;\r\n }\r\n boolean cycleExists = false;\r\n ListNode fast = a.next.next;\r\n ListNode slow = a;\r\n while(slow.next!=null && fast.next !=null && fast.next.next!=null){\r\n if(fast==slow){\r\n //return cycleSize;\r\n //cycleExists = true;\r\n //break;\r\n return fast;\r\n }else{\r\n \r\n fast = fast.next.next;\r\n slow = slow.next;\r\n }\r\n\r\n }\r\n \r\n return null;\r\n\t}", "boolean isCyclic() {\n\n // if we are processing the course currently that is a cyclic graph and we can't\n // do all the courses\n if (processed) {\n return false;\n }\n\n // if we already visited the course and no cycle was found then we can return\n if (visited) {\n return true;\n }\n //else we set the course and visited\n visited = true;\n\n //we then loop through all the prerequisites performing the same check\n for (Course preCourse : pre) {\n if (preCourse.isCyclic()) {\n return true;\n }\n }\n\n //if we arrive here then we have gone through all the combinations and there is no cyclic graph\n visited = false;\n processed = true;\n return false;\n }", "public static void main(String[] args) {\n\t\tLinkedListCycle obj = new LinkedListCycle();\n\t\tListNode node1 = obj.new ListNode(1);\n\t\tListNode node2 = obj.new ListNode(2);\n\t\tListNode node3 = obj.new ListNode(3);\n\t\tListNode node4 = obj.new ListNode(4);\n\t\tListNode node5 = obj.new ListNode(5);\n\t\tListNode node6 = obj.new ListNode(6);\n\t\tListNode node7 = obj.new ListNode(7);\n\t\tnode1.next = node2;\n\t\tnode2.next = node3;\n\t\tnode3.next = node4;\n\t\tnode4.next = node5;\n\t\tnode5.next = node6;\n\t\tnode6.next = node7;\n\t\tnode7.next = node2;\n\t\tSystem.out.println(obj.hasCycle(node1));\n\t}", "public boolean checkCyclesRecursive(Integer blockID, LinkedList<Integer> visited){\n System.out.println(\"cc: (block \" + blockID + \") visited: \" + visited);\n if(visited.contains(blockID)){\n return false;\n }\n visited.add(blockID);\n\n /*for (Con connection : this.connections) {\n if(connection.src == blockID){\n LinkedList<Integer> new_visited = new LinkedList(visited);\n if(checkCyclesRecursive(connection.dst, new_visited) == false){\n return false;\n }\n }\n }*/\n\n for(Type output : this.getBlockByID(blockID).outputs)\n {\n /*if(output.getFirstDstID() != -1) {\n LinkedList<Integer> new_visited = new LinkedList(visited);\n if(checkCyclesRecursive(output.getFirstDstID(), new_visited) == false){\n return false;\n }\n }*/\n for (Integer id : output.getAllDstID()) {\n LinkedList<Integer> new_visited = new LinkedList(visited);\n if(checkCyclesRecursive(id, new_visited) == false){\n return false;\n } \n }\n }\n return true;\n }", "public static void main(String[] args) {\n ArrayList<Integer> input = new ArrayList<>(Arrays.asList(1, 2, -1, 2, 2));\n System.out.println(\"has Cycle : \" + CycleCircularArray.hasCycle(input));\n input = new ArrayList<>(Arrays.asList(2, 2, -1, 2));\n System.out.println(\"has Cycle : \" + CycleCircularArray.hasCycle(input));\n input = new ArrayList<>(Arrays.asList(2, 1, -1, -2));\n System.out.println(\"has Cycle : \" + CycleCircularArray.hasCycle(input));\n }", "public boolean hasCycle(Node<T> first) {\n Iterator itOne = this.iterator();\n Iterator itTwo = this.iterator();\n try {\n while (true) {\n T one = (T) itOne.next();\n itTwo.next();\n T two = (T) itTwo.next();\n if (one.equals(two)) {\n return true;\n }\n }\n } catch (NullPointerException ex) {\n ex.printStackTrace();\n }\n return false;\n }", "private boolean containsCycle(TransactionId tid) {\n HashSet<TransactionId> visited = new HashSet<TransactionId>();\n LinkedList<TransactionId> queue = new LinkedList<TransactionId>();\n\n queue.add(tid);\n\n while (!(queue.isEmpty())) {\n TransactionId cur = queue.remove();\n if (visited.contains(cur)) {\n return true;\n }\n\n visited.add(cur);\n\n if (this.dependencyMap.containsKey(cur) && !(this.dependencyMap.get(cur).isEmpty())) {\n Iterator<TransactionId> it = this.dependencyMap.get(cur).iterator();\n while (it.hasNext()) {\n queue.add(it.next());\n }\n }\n }\n\n return false;\n }", "public Set<V> findCycles()\n {\n // ProbeIterator can't be used to handle this case,\n // so use StrongConnectivityAlgorithm instead.\n StrongConnectivityAlgorithm<V, E> inspector =\n new KosarajuStrongConnectivityInspector<>(graph);\n List<Set<V>> components = inspector.stronglyConnectedSets();\n\n // A vertex participates in a cycle if either of the following is\n // true: (a) it is in a component whose size is greater than 1\n // or (b) it is a self-loop\n\n Set<V> set = new LinkedHashSet<>();\n for (Set<V> component : components) {\n if (component.size() > 1) {\n // cycle\n set.addAll(component);\n } else {\n V v = component.iterator().next();\n if (graph.containsEdge(v, v)) {\n // self-loop\n set.add(v);\n }\n }\n }\n\n return set;\n }", "private static boolean checkEulerCicleGraph() {// es cycle o es tour\r\n\t\tfor (int i = 0; i < V; i++) {\r\n\t\t\tif (outdeg[i] % 2 == 1) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "public boolean hasCycle(ListNode head) {\n ListNode p1 = head;\n ListNode p2 = head;\n while (p2 != null && p2.next != null) {\n \tp1 = p1.next;\n \tif (p2.next != null) {\n \t\tp2 = p2.next.next;\n \t}\n \tif (p1 == p2) {\n \t\treturn true;\n \t}\n }\n return false;\n }", "public void logicCycles()throws Exception\r\n\t{\r\n\t\t\r\n\t\twhile(isSolved() == false)\r\n\t\t{\r\n\t\t\tint changesMade = 0;\r\n\t\t\tdo\r\n\t\t\t{\r\n\t\t\t\tchangesMade = 0;\r\n\t\t\t\tchangesMade += logic1();\r\n\t\t\t\tchangesMade += logic2();\r\n\t\t\t\tchangesMade += logic3();\r\n\t\t\t\tchangesMade += logic4();\r\n\t\t\t\tif(errorFound())\r\n\t\t\t\t\tbreak;\r\n\t\t\t}while(changesMade != 0);\r\n\t\r\n\t\t}\t\t\t\r\n\t\t\r\n\t}", "boolean findCycleUtil(int i, boolean[] visited, boolean[] recStack, LinkedList<Integer>[] g) {\n if (recStack[i]) {\n return true;\n }\n if (visited[i]) {\n return false;\n }\n visited[i] = true;\n recStack[i] = true;\n for (int c : g[i]) {\n if (findCycleUtil(c, visited, recStack, g)) {\n return true;\n }\n }\n recStack[i] = false;\n return false;\n }", "public boolean isCycle(int V, ArrayList<ArrayList<Integer>> adj)\n {\n boolean visited[] = new boolean[V];\n Arrays.fill(visited, false);\n \n for(int i = 0;i<V;i++)\n {\n if(!visited[i] && isCyclicU(i, V, visited, adj))\n return true;\n }\n \n return false;\n \n }", "public boolean hasCycle(int g) {\n\t\t//TODO\n\t}", "public ListNode detectCycle(ListNode head) {\n\t\tListNode fast,slow;\n\t\tfast=slow=head;\n\t\twhile(fast!=null & fast.next()!=null) {\n\t\t\tfast=fast.next().next();\n\t\t\tslow=slow.next();\t\t\n\t\t\t//First meet\n\t\t\tif (fast==slow) {\t\t\t\t\t\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t//Put slow at head ,they meet after k-m steps\n\t\tslow=head;\n\t\twhile(slow!=fast) {\n\t\t\tfast=fast.next();\n\t\t\tslow=slow.next();\n\t\t}\n\t\treturn slow;\n\t}", "public ListNode detectCycle(ListNode head) {\n if (head == null || head.next == null) return null;\n ListNode slow = head;\n ListNode fast = head;\n while (fast != null && fast.next != null) {\n slow = slow.next;\n fast = fast.next.next;\n if (fast == slow) {\n ListNode slow2 = head;\n while (slow != slow2) {\n slow = slow.next;\n slow2 = slow2.next;\n }\n return slow;\n }\n }\n return null;\n }", "public boolean hasCycle(ListNode head) {\n if(head == null || head.next == null){\n return false;\n }\n Set<ListNode> nodes = new HashSet<ListNode>();\n ListNode cur = head;\n while(cur != null){\n if(nodes.contains(cur)){\n return true;\n }\n nodes.add(cur);\n cur = cur.next;\n }\n return false;\n }", "public boolean isFirstCycle() {\n return cycle == 0;\n }", "public static boolean hasCycle1(ListNode head) {\n Set<ListNode> visited = new HashSet<>();\n\n while (head != null) {\n if (visited.contains(head)) {\n return true;\n }\n visited.add(head);\n head = head.next;\n }\n\n return false;\n }", "int hasCycle(Node head) {\n\t// If list is null\n\tif(head == null) {\n\t\t// No cycle\n\t\treturn 0;\n\t}\n\n\tSet<Node> visitedNodes = new HashSet<Node>();\n\t\n\tNode current = head;\n\n\t// Loop through the list\n\twhile(current != null) {\n\t\t// If we have seen this node befor\n\t\tif(visitedNodes.contains(current)) {\n\t\t\treturn 1;\n\t\t}\n\n\t\t// Add it to the set\n\t\tvisitedNodes.add(current);\n\n\t\t// Update current\n\t\tcurrent = current.next;\n\t}\n\n\t// If we get here, there are no cycles\n\treturn 0;\n}", "boolean hasCycle(Node head) {\n node = head;\n //h.add(node.data);//just add the first one //node = node.next; //get to the next one where we, at 2nd best case, will Find Cycle\n while (node.next != null){\n if ( h.contains(node.data) ){\n return true;\n }else {\n h.add(node.data);\n }\n node = node.next;\n }\n return false;\n }", "@Test public void testPublic13() {\n Graph<Integer> graph= TestGraphs.testGraph4();\n int i;\n\n for (i= 0; i < 4; i++)\n assertTrue(graph.isInCycle(i));\n\n assertFalse(graph.isInCycle(4));\n }", "public ListNode detectCycle(ListNode head) {\n\n\t\tListNode fast = head;\n\t\tListNode slow = head;\n\n\t\twhile (fast != null && fast.next != null) {\n\t\t\tfast = fast.next.next;\n\t\t\tslow = slow.next;\n\t\t\tif (slow == fast) {\n\t\t\t\tListNode slow2 = head;\n\t\t\t\twhile (slow2 != slow) {\n\t\t\t\t\tslow2 = slow2.next;\n\t\t\t\t\tslow = slow.next;\n\t\t\t\t}\n\t\t\t\treturn slow;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "public boolean hasCycle2(ListNode head) {\n if (head == null || head.next == null) {\n return false;\n }\n\n ListNode p1 = head;\n ListNode p2 = head.next.next;\n\n while (p2 != null && p2.next != null) {\n p1 = p1.next;\n p2 = p2.next.next;\n\n if (p1 == p2) {\n return true;\n }\n }\n\n return false;\n }", "public static boolean cycleInGraph(int[][] edges) {\n int numberOfNodes = edges.length;\n int[] colors = new int[numberOfNodes]; // By default, 0 (WHITE)\n\n for (int i = 0; i < numberOfNodes; i++) {\n\n if (colors[i] != WHITE) // If already visited/finished.\n continue;\n\n boolean isCycle = traverseAndMarkColor(edges, i, colors);\n\n if (isCycle)\n return true;\n }\n return false;\n }", "private static boolean findCyclesInSCC(\n ARGState pStartState,\n ARGState pCurrentState,\n Set<ARGState> pBlockedSet,\n SetMultimap<ARGState, ARGState> pBlockedMap,\n Deque<ARGState> pStack,\n List<List<ARGState>> pAllCycles,\n Set<ARGState> pExcludeSet) {\n\n if (pExcludeSet.contains(pCurrentState)) {\n // Do not regard nodes which were deliberately put into a set of excluded states\n return false;\n }\n\n boolean foundCycle = false;\n pStack.push(pCurrentState);\n pBlockedSet.add(pCurrentState);\n\n for (ARGState successor : pCurrentState.getChildren()) {\n // If the successor is equal to the startState, a cycle has been found.\n // Store contents of stack in the final result.\n if (successor.equals(pStartState)) {\n List<ARGState> cycle = new ArrayList<>();\n pStack.push(pStartState);\n cycle.addAll(pStack);\n Collections.reverse(cycle);\n pStack.pop();\n pAllCycles.add(cycle);\n foundCycle = true;\n } else if (!pBlockedSet.contains(successor)) {\n // Explore this successor only if it is not already in the blocked set.\n boolean gotCycle =\n findCyclesInSCC(\n pStartState, successor, pBlockedSet, pBlockedMap, pStack, pAllCycles, pExcludeSet);\n foundCycle = foundCycle || gotCycle;\n }\n }\n\n if (foundCycle) {\n unblock(pCurrentState, pBlockedSet, pBlockedMap);\n } else {\n for (ARGState s : pCurrentState.getChildren()) {\n pBlockedMap.put(s, pCurrentState);\n }\n }\n pStack.pop();\n\n return foundCycle;\n }", "boolean isCycleUndirected(SimpleVertex simpleVertex, SimpleVertex parent) {\n\t\tsimpleVertex.parent = parent;\n\n\t\twhile (true) {\n\t\t\tif (simpleVertex.isVisited == false) {\n\t\t\t\tsimpleVertex.isVisited = true;\n\t\t\t\tSystem.out.print(simpleVertex.Vertexname + \" \");\n\t\t\t\tfor (int i = 0; i < simpleVertex.neighborhood.size(); i++) {\n\n\t\t\t\t\tSimpleEdge node = simpleVertex.neighborhood.get(i);\n\t\t\t\t\tnode.EdgeVisited = true;\n\t\t\t\t\t/*\n\t\t\t\t\t * if(simpleVertex.isVisited==node.two.isVisited){\n\t\t\t\t\t * System.out.println(\"cycle present\"); flagUndirected=true; return\n\t\t\t\t\t * flagUndirected; }\n\t\t\t\t\t */\n\n\t\t\t\t\tif (simpleVertex.parent != null && node.two.Vertexname == simpleVertex.parent.Vertexname)\n\t\t\t\t\t\tSystem.out.println(\"skip\");\n\t\t\t\t\telse if (node.two.isVisited == true) {\n\t\t\t\t\t\tSystem.out.println(\"Graph contains a cycle\");\n\t\t\t\t\t\tflagUndirected = true;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tisCycleUndirected(node.two, simpleVertex);\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tbreak;\n\t\t}\n\t\treturn flagUndirected;\n\n\t}", "@Test\n public void shouldThrowCyclicDependencyExceptionIfACycleIsDetected_DownstreamOfCurrentWasUpstreamOfCurrentAtSomePoint() {\n String grandParent = \"grandParent\";\n String parent = \"parent\";\n String child = \"child\";\n String currentPipeline = \"current\";\n ValueStreamMap graph = new ValueStreamMap(currentPipeline, null);\n graph.addDownstreamNode(new PipelineDependencyNode(child, child), currentPipeline);\n graph.addDownstreamNode(new PipelineDependencyNode(grandParent, grandParent), child);\n graph.addUpstreamNode(new PipelineDependencyNode(parent, parent), null, currentPipeline);\n graph.addUpstreamNode(new PipelineDependencyNode(grandParent, grandParent), null, parent);\n graph.addUpstreamMaterialNode(new SCMDependencyNode(\"g\",\"g\",\"git\") , null, grandParent, new MaterialRevision(null));\n graph.addUpstreamMaterialNode(new SCMDependencyNode(\"g\",\"g\",\"git\") , null, parent, new MaterialRevision(null));\n\n assertThat(graph.hasCycle(), is(true));\n }", "@Test\n public void cyclicalGraphs1Test() throws Exception {\n // NOTE: we can't use the parser to create a circular graph because\n // vector clocks are partially ordered and do not admit cycles. So we\n // have to create circular graphs manually.\n ChainsTraceGraph g1 = new ChainsTraceGraph();\n List<EventNode> g1Nodes = addNodesToGraph(g1, new String[] { \"a\", \"a\",\n \"a\" });\n // Create a loop in g1, with 3 nodes\n g1Nodes.get(0).addTransition(g1Nodes.get(1), Event.defTimeRelationStr);\n g1Nodes.get(1).addTransition(g1Nodes.get(2), Event.defTimeRelationStr);\n g1Nodes.get(2).addTransition(g1Nodes.get(0), Event.defTimeRelationStr);\n exportTestGraph(g1, 0);\n\n ChainsTraceGraph g2 = new ChainsTraceGraph();\n List<EventNode> g2Nodes = addNodesToGraph(g2, new String[] { \"a\", \"a\" });\n // Create a loop in g2, with 2 nodes\n g2Nodes.get(0).addTransition(g2Nodes.get(1), Event.defTimeRelationStr);\n g2Nodes.get(1).addTransition(g2Nodes.get(0), Event.defTimeRelationStr);\n exportTestGraph(g2, 1);\n\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), 1);\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), 2);\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), 3);\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), 4);\n\n ChainsTraceGraph g3 = new ChainsTraceGraph();\n List<EventNode> g3Nodes = addNodesToGraph(g2, new String[] { \"a\" });\n // Create a loop in g3, from a to itself\n g3Nodes.get(0).addTransition(g3Nodes.get(0), Event.defTimeRelationStr);\n exportTestGraph(g3, 2);\n\n testKEqual(g3Nodes.get(0), g2Nodes.get(0), 1);\n testKEqual(g3Nodes.get(0), g2Nodes.get(0), 2);\n testKEqual(g3Nodes.get(0), g2Nodes.get(0), 3);\n\n ChainsTraceGraph g4 = new ChainsTraceGraph();\n List<EventNode> g4Nodes = addNodesToGraph(g2, new String[] { \"a\" });\n exportTestGraph(g4, 2);\n\n testKEqual(g4Nodes.get(0), g2Nodes.get(0), 1);\n testNotKEqual(g4Nodes.get(0), g2Nodes.get(0), 2);\n testNotKEqual(g4Nodes.get(0), g2Nodes.get(0), 3);\n testNotKEqual(g4Nodes.get(0), g2Nodes.get(0), 4);\n }", "public boolean hasCycle(ListNode head) {\n\t\tListNode fast,slow;\n\t\tfast=slow=head;\n\t\twhile(fast!=null & fast.next()!=null) {\n\t\t\tfast=fast.next().next();\n\t\t\tslow=slow.next();\n\t\t\t//Meet at a point\n\t\t\tif (fast==slow) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t\t\n\t}", "public boolean hasCycle(ListNode head) {\n if (head == null) {\n return false;\n }\n ListNode slow = head;\n ListNode fast = head;\n \n while (slow != null) {\n slow = slow.next;\n if (fast != null && fast.next != null) {\n fast = fast.next.next;\n } else {\n return false;\n }\n if (slow == fast)\n return true;\n }\n return false;\n }", "static boolean isCorrectCycle(Vertex v, LinkedList<Vertex> cycle, int print) {\r\n\r\n boolean ret = true;\r\n\r\n if (print > 1)\r\n System.out.println(\"Checking cycle with vertex \" + v + \": \" + cycle);\r\n\r\n // check for invalid parameters\r\n if (v == null || cycle == null || cycle.isEmpty()) {\r\n if (print > 0)\r\n System.out.println(\"null or empty parameter, no check\");\r\n return false;\r\n }\r\n\r\n // check for too short cycles, 4 is minimum (v-x-y-v)\r\n if (cycle.size() < 4) {\r\n if (print > 0)\r\n System.out.println(\"too short cycle: \" + cycle.size());\r\n ret = false;\r\n }\r\n\r\n // check for correct first and last in cycle\r\n if (cycle.getFirst() != v) {\r\n if (print > 0)\r\n System.out.println(\"Wrong first vertex \" + cycle.getFirst());\r\n ret = false;\r\n }\r\n if (cycle.getLast() != v) {\r\n if (print > 0)\r\n System.out.println(\"Wrong last vertex \" + cycle.getLast());\r\n ret = false;\r\n }\r\n\r\n // extra: check if first and last are different (other than v)\r\n\r\n // check that all successive vertices in list are adjacent in graph\r\n\r\n ListIterator<Vertex> li = cycle.listIterator();\r\n Vertex prev = null;\r\n while (li.hasNext()) {\r\n Vertex w = li.next();\r\n if (prev != null && ! prev.isAdjacent(w)) {\r\n if (print > 0)\r\n System.out.println(\"No edge between \" + prev + \" and \" + w);\r\n ret = false;\r\n }\r\n // check that v is not in the middle of cycle\r\n if (prev != null && li.hasNext() && w == v) {\r\n if (print > 0)\r\n System.out.println(\"Required vertex \" + v + \" in the middle of cycle\");\r\n ret = false;\r\n }\r\n\r\n prev = w;\r\n } // while\r\n\r\n if (print > 1 && ret)\r\n System.out.println(\"Valid cycle\");\r\n\r\n return ret;\r\n\r\n }", "public boolean hasSelfLoops();", "public boolean hasCycle(ListNode head) {\r\n\t\tListNode fast = head;\r\n\t\tListNode slow = head;\r\n\r\n\t\twhile (fast != null && fast.next != null) {\r\n\t\t\tslow = slow.next;\r\n\t\t\tfast = fast.next.next;\r\n\r\n\t\t\tif (slow == fast) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "public boolean reducible() {\n if (dfsTree.back.isEmpty()) {\n return true;\n }\n int size = controlFlow.transitions.length;\n boolean[] loopEnters = dfsTree.loopEnters;\n TIntHashSet[] cycleIncomings = new TIntHashSet[size];\n // really this may be array, since dfs already ensures no duplicates\n TIntArrayList[] nonCycleIncomings = new TIntArrayList[size];\n int[] collapsedTo = new int[size];\n int[] queue = new int[size];\n int top;\n for (int i = 0; i < size; i++) {\n if (loopEnters[i]) {\n cycleIncomings[i] = new TIntHashSet();\n }\n nonCycleIncomings[i] = new TIntArrayList();\n collapsedTo[i] = i;\n }\n\n // from whom back connections\n for (Edge edge : dfsTree.back) {\n cycleIncomings[edge.to].add(edge.from);\n }\n // from whom ordinary connections\n for (Edge edge : dfsTree.nonBack) {\n nonCycleIncomings[edge.to].add(edge.from);\n }\n\n for (int w = size - 1; w >= 0 ; w--) {\n top = 0;\n // NB - it is modified later!\n TIntHashSet p = cycleIncomings[w];\n if (p == null) {\n continue;\n }\n TIntIterator iter = p.iterator();\n while (iter.hasNext()) {\n queue[top++] = iter.next();\n }\n\n while (top > 0) {\n int x = queue[--top];\n TIntArrayList incoming = nonCycleIncomings[x];\n for (int i = 0; i < incoming.size(); i++) {\n int y1 = collapsedTo[incoming.getQuick(i)];\n if (!dfsTree.isDescendant(y1, w)) {\n return false;\n }\n if (y1 != w && p.add(y1)) {\n queue[top++] = y1;\n }\n }\n }\n\n iter = p.iterator();\n while (iter.hasNext()) {\n collapsedTo[iter.next()] = w;\n }\n }\n\n return true;\n }", "private boolean findCycles(int v, int s, Vector<Integer>[] adjList)\n {\n boolean f = false;\n this.stack.add(v);\n this.blocked[v] = true;\n\n for (int i = 0; i < adjList[v].size(); i++) {\n int w = adjList[v].get(i);\n // found cycle\n if (w == s) {\n Vector cycle = new Vector();\n for (int j = 0; j < this.stack.size(); j++) {\n int index = this.stack.get(j).intValue();\n cycle.add(this.graphNodes[index]);\n }\n this.cycles.add(cycle);\n\n\n // we hard-limit the cycle number to 10k!!\n if (this.cycles.size() > 10000) {\n break;\n }\n\n f = true;\n }\n else if (!this.blocked[w]) {\n if (this.findCycles(w, s, adjList)) {\n f = true;\n }\n }\n }\n\n if (f) {\n this.unblock(v);\n }\n else {\n for (int i = 0; i < adjList[v].size(); i++) {\n int w = ((Integer) adjList[v].get(i)).intValue();\n if (!this.B[w].contains(new Integer(v))) {\n this.B[w].add(new Integer(v));\n }\n }\n }\n\n this.stack.remove(new Integer(v));\n return f;\n }", "boolean detectCycledirected(ArrayList<Integer> G[]) {\n\t\tint[] vis = new int[G.length];\n\t\tint[] ancestor = new int[G.length];\n\t\tfor (int i = 0; i < G.length; i++) {\n\t\t\tif (vis[i] == 0) {\n\t\t\t\tif (detectCycleUtil(G, i, vis, ancestor))\n\t\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "public ListNode detectCycle(ListNode head){\n if(head == null) return null;\n\n Set<ListNode> visitedNodes = new HashSet<>();\n ListNode currNode = head;\n while(currNode != null) {\n if(visitedNodes.contains(currNode)){\n return currNode;\n }\n visitedNodes.add(currNode);\n currNode = currNode.next;\n }\n return null;\n }", "public DirectedCycle(Digraph G) {\n onStack = new boolean[G.V()];\n marked = new boolean[G.V()];\n edgeTo = new int[G.V()];\n\n //Cycle through each vertex to see if it is in a cycle\n for (int v = 0; v < G.V(); v++) {\n if (marked[v] == false) {\n dfs(G, v);\n }\n }\n }", "protected boolean hasCycle(Map<Object, Object> data) {\n return Boolean.TRUE == data.get(DATA_CLOSURE_CYCLIC); \n }", "private boolean hasNoCycle(int node, int[] color, int[][] graph) {\n if (color[node] > 0)\n return color[node] == 2;\n\n color[node] = 1;\n for (int nei : graph[node]) {\n if (color[nei] == 2)\n continue;\n if (color[nei] == 1 || !hasNoCycle(nei, color, graph))\n return false;\n }\n\n color[node] = 2;\n return true;\n }", "private void runLoopCheck(HashMap<IconMain, Set<IconMain>> connections, IconMain iconFrom) {\n visited.add(iconFrom);\n if (connections.containsKey(iconFrom)) {\n Set<IconMain> set = connections.get(iconFrom);\n\n for (IconMain iconTo : set) {\n while (!iconTo.iconType.equals(\")\")) {\n if (visited.contains(iconTo)) {\n break;\n }\n runLoopCheck(connections, iconTo);\n }\n visited.add(iconTo);\n }\n }\n }", "@Override\n public void cycle(long cycle) {\n\n boolean previousState = state();\n\n manageDIV();\n\n incTIMAIfChange(previousState);\n }", "public static ListNode detectCycle2(ListNode head){\n if(head == null) return null;\n\n ListNode intersectNode = getIntersection(head);\n if(intersectNode == null) return null;\n\n ListNode currNode = head;\n while(currNode != intersectNode) {\n currNode = currNode.next;\n intersectNode = intersectNode.next;\n }\n return intersectNode;\n }", "public int getCycles();", "void find_negative_cycle(){\n \t\n \tfor(int j = 0; j<E ; j++)\n\t\t{\n\t\t\trelax(edge[j].src, edge[j].destination, edge[j].weight);\n\t\t}\n \tfor(int i = 0; i<V ; i++)\n\t\t{\n \t\tif(x[i] != dist[i])\n\t\t\t{\n \t\t\tNegCycle = true;\n\t\t\t\tSystem.out.println(\"Negative Cycle Found \");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n }", "@Test public void testPublic11() {\n Graph<Character> graph= TestGraphs.testGraph3();\n\n for (Character ch : graph.getVertices())\n assertFalse(graph.isInCycle(ch));\n }", "private boolean isAcyclic() {\n boolean visited[] = new boolean[getNumNodes()];\n boolean noCycle = true;\n int list[] = new int[getNumNodes() + 1];\n int index = 0;\n int lastIndex = 1;\n list[0] = randomParent;\n visited[randomParent] = true;\n while (index < lastIndex && noCycle) {\n int currentNode = list[index];\n int i = 1;\n\n // verify parents of current node\n while ((i < parentMatrix[currentNode][0]) && noCycle) {\n if (!visited[parentMatrix[currentNode][i]]) {\n if (parentMatrix[currentNode][i] != randomChild) {\n list[lastIndex] = parentMatrix[currentNode][i];\n lastIndex++;\n }\n else {\n noCycle = false;\n }\n visited[parentMatrix[currentNode][i]] = true;\n } // end of if(visited)\n i++;\n }\n index++;\n }\n //System.out.println(\"\\tnoCycle:\"+noCycle);\n return noCycle;\n }", "private static FunctionCycle findCycleWithBrentsInternal(IntUnaryOperator func, int x0) {\n\n int power = 1;\n int lam = 1;\n\n int t = x0;\n int h = func.applyAsInt(x0);\n\n // 'lam' will be equal to cycle length at the end of iteration\n while (t != h) {\n if (power == lam) {\n t = h;\n power *= 2;\n lam = 0;\n }\n\n h = func.applyAsInt(h);\n ++lam;\n }\n\n final int cycleLength = lam;\n\n t = x0;\n h = x0;\n\n // find star point for cycle\n for (int i = 0; i < lam; ++i) {\n h = func.applyAsInt(h);\n }\n\n while (t != h) {\n t = func.applyAsInt(t);\n h = func.applyAsInt(h);\n }\n\n return new FunctionCycle(t, cycleLength);\n }", "private static Boolean detectLoop(Node head2) {\n\t\tHashSet<Node> s = new HashSet<Node>();\n\t\twhile (head2 != null) {\n\t\t\tif (s.contains(head2))\n\t\t\t\treturn true;\n\t\t\ts.add(head2);\n\t\t\thead2 = head2.next;\n\t\t}\n\t\treturn false;\n\t}", "public Iterable<Integer> cycle(){\n return cycle;\n }", "public static boolean hasCycle2(ListNode head) {\n if (head == null) return false;\n ListNode slow = head;\n ListNode fast = head;\n\n while ((fast.next != null) && (fast.next.next != null)) {\n fast = fast.next.next;\n slow = slow.next;\n if (fast == slow) { //Meet point\n return true;\n }\n }\n return false;\n }", "public boolean detect_cycle_directed_util(int v,boolean visited[], boolean curr_visited[]) {\n\t\t\n\t\tvisited[v]=true;\n\t\tcurr_visited[v]=true;\n\t\t\n\t\t\n\t\tfor(int neighbour:adj[v]) {\n\t\t\t\n\t\t\tif(curr_visited[neighbour]) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\telse if(!visited[neighbour]&&detect_cycle_directed_util(neighbour,visited,curr_visited)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tcurr_visited[v]=false;\n\t\t\n\t\treturn false;\n\t\t\n\t}", "public void removeGraphCycles() {\n\t\tMap<Integer, MovingFObject> map = sc.getInitPos();\r\n\t\tint[] cycleCount = new int[map.size()];\r\n\t\tforComplexMotion = new boolean[map.size()];\r\n\t\t//count cycles\r\n\t\tfor(int i = 0; i < map.size(); i++) {\r\n\t\t\tfor(int j = 0; j < map.size(); j++) {\r\n\t\t\t\tif(i != j) {\r\n\t\t\t\t\tif(graph[i][j] && graph[j][i]) {\r\n\t\t\t\t\t\tcycleCount[i]++;\r\n\t\t\t\t\t\tcycleCount[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\t//remove fobjects from linear motion planning\r\n\t\tboolean hasCycles = true;\r\n\t\twhile(hasCycles) {\r\n\t\t\tint max = 0;\r\n\t\t\tint maxIndex = -1;\r\n\t\t\tfor(int i = 0; i < cycleCount.length; i++) {\r\n\t\t\t\tif(cycleCount[i] > max) {\r\n\t\t\t\t\tmax = cycleCount[i];\r\n\t\t\t\t\tmaxIndex = i;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(maxIndex == -1) {\r\n\t\t\t\thasCycles = false;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tcycleCount[maxIndex] = 0;\r\n\t\t\t\tforComplexMotion[maxIndex] = true;\r\n\t\t\t\tfor(int i = 0; i < cycleCount.length; i++) {\r\n\t\t\t\t\tgraph[maxIndex][i] = false;\r\n\t\t\t\t\tgraph[i][maxIndex] = false;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t}", "@Test\n public void shouldThrowCyclicDependencyExceptionIfACycleIsDetected_CycleDetectedInUpstreamNodes() {\n\n String a = \"A\";\n String b = \"B\";\n String c = \"C\";\n ValueStreamMap graph = new ValueStreamMap(b, null);\n graph.addUpstreamNode(new PipelineDependencyNode(a, a), null, b);\n graph.addUpstreamMaterialNode(new SCMDependencyNode(\"g\",\"g\",\"git\"), null, a, new MaterialRevision(null));\n graph.addDownstreamNode(new PipelineDependencyNode(a, a), b);\n graph.addDownstreamNode(new PipelineDependencyNode(c, c), a);\n\n assertThat(graph.hasCycle(), is(true));\n }", "private void checkNoCycles(List<JpsModule> component) {\n if (component.size() > 1) {\n StringBuilder message = new StringBuilder();\n message.append(\"Found circular module dependency: \")\n .append(component.size())\n .append(\" modules\");\n for (JpsModule module : component) {\n message.append(\" \").append(module.getName());\n }\n logger.error(message.toString());\n }\n }", "static long GetCycleCount() {\n\t\treturn System.currentTimeMillis();\n\t}", "public static void main(String[] args) { \n \tA016_DetectAndRemoveLoopLinkedList list = new A016_DetectAndRemoveLoopLinkedList(); \n \tNode head = new Node(50); \n head.next = new Node(20); \n head.next.next = new Node(15); \n head.next.next.next = new Node(4); \n head.next.next.next.next = new Node(10); \n \n // Creating a loop for testing \n head.next.next.next.next.next = head.next.next; \n list.detectAndRemoveLoop(head); \n while (head != null) { \n System.out.print(head.data + \" \"); \n head = head.next; \n }\n \n// \n// ListNode head1 = new ListNode(50); \n// head1.next = new ListNode(20); \n// head1.next.next = new ListNode(15); \n// head1.next.next.next = new ListNode(4); \n// head1.next.next.next.next = new ListNode(10); \n// \n// // Creating a loop for testing \n// head1.next.next.next.next.next = head1.next.next; \n// System.out.println(detectCycle(head1));\n \n \n ListNode head1 = new ListNode(1);\n ListNode second = new ListNode(2);\n ListNode third = new ListNode(3);\n ListNode fourth = new ListNode(4);\n\t\thead1.next = second;\n\t\tsecond.next = third;\n\t\tthird.next = fourth;\n\t\tfourth.next = second;\n\t\tListNode aaa = detectCycle(head1);\n\t\twhile (head1 != null) {\n\t\t\tSystem.out.print(head1.val + \" \");\n\t\t\thead1 = head1.next;\n\t\t}\n\t}", "@Test public void testPublic12() {\n Graph<Integer> graph= new Graph<Integer>();\n int i;\n\n // note this adds the adjacent vertices in the process\n for (i= 0; i < 10; i++)\n graph.addEdge(i, i + 1, 1);\n graph.addEdge(10, 0, 1);\n\n for (Integer vertex : graph.getVertices())\n assertTrue(graph.isInCycle(vertex));\n }", "@Test\n public void cyclicalGraphs3Test() throws Exception {\n // Test graphs with multiple loops. g1 has two different loops, which\n // have to be correctly matched to g2 -- which is build in a different\n // order but is topologically identical to g1.\n\n ChainsTraceGraph g1 = new ChainsTraceGraph();\n List<EventNode> g1Nodes = addNodesToGraph(g1, new String[] { \"a\", \"b\",\n \"c\", \"d\", \"b\", \"c\" });\n\n // Create loop1 in g1, with the first 4 nodes.\n g1Nodes.get(0).addTransition(g1Nodes.get(1), Event.defTimeRelationStr);\n g1Nodes.get(1).addTransition(g1Nodes.get(2), Event.defTimeRelationStr);\n g1Nodes.get(2).addTransition(g1Nodes.get(3), Event.defTimeRelationStr);\n g1Nodes.get(3).addTransition(g1Nodes.get(0), Event.defTimeRelationStr);\n\n // Create loop2 in g1, with the last 2 nodes, plus the initial node.\n g1Nodes.get(0).addTransition(g1Nodes.get(4), Event.defTimeRelationStr);\n g1Nodes.get(4).addTransition(g1Nodes.get(5), Event.defTimeRelationStr);\n g1Nodes.get(5).addTransition(g1Nodes.get(0), Event.defTimeRelationStr);\n\n exportTestGraph(g1, 0);\n\n // //////////////////\n // Now create g2, by generating the two identical loops in the reverse\n // order.\n\n ChainsTraceGraph g2 = new ChainsTraceGraph();\n List<EventNode> g2Nodes = addNodesToGraph(g2, new String[] { \"a\", \"b\",\n \"c\", \"d\", \"b\", \"c\" });\n\n // Create loop2 in g2, with the last 2 nodes, plus the initial node.\n g2Nodes.get(0).addTransition(g2Nodes.get(4), Event.defTimeRelationStr);\n g2Nodes.get(4).addTransition(g2Nodes.get(5), Event.defTimeRelationStr);\n g2Nodes.get(5).addTransition(g2Nodes.get(0), Event.defTimeRelationStr);\n\n // Create loop1 in g2, with the first 4 nodes.\n g2Nodes.get(0).addTransition(g2Nodes.get(1), Event.defTimeRelationStr);\n g2Nodes.get(1).addTransition(g2Nodes.get(2), Event.defTimeRelationStr);\n g2Nodes.get(2).addTransition(g2Nodes.get(3), Event.defTimeRelationStr);\n g2Nodes.get(3).addTransition(g2Nodes.get(0), Event.defTimeRelationStr);\n\n exportTestGraph(g2, 1);\n\n // //////////////////\n // Now test that the two graphs are identical for all k starting at the\n // initial node.\n\n for (int k = 1; k < 7; k++) {\n testKEqual(g1Nodes.get(0), g2Nodes.get(0), k);\n }\n }", "public boolean IsCyclic() {\r\n\t\tHashMap<String, Boolean> processed = new HashMap<>();\r\n\t\tLinkedList<Pair> queue = new LinkedList<>();\r\n\r\n\t\tArrayList<String> vnames = new ArrayList<>(vces.keySet());\r\n\t\tfor (String vname : vnames) {\r\n\t\t\tif (processed.containsKey(vname)) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tPair rootpair = new Pair(vname, vname);\r\n\t\t\tqueue.addLast(rootpair);\r\n\t\t\twhile (queue.size() != 0) {\r\n\t\t\t\t// 1. removeFirst\r\n\t\t\t\tPair rp = queue.removeFirst();\r\n\r\n\t\t\t\t// 2. check if processed, mark if not\r\n\t\t\t\tif (processed.containsKey(rp.vname)) {\r\n\t\t\t\t\tSystem.out.println(rp.vname + \" via \" + rp.psf);\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t\tprocessed.put(rp.vname, true);\r\n\r\n\t\t\t\t// 3. Check, if an edge is found\r\n\t\t\t\tSystem.out.println(rp.vname + \" via \" + rp.psf);\r\n\r\n\t\t\t\t// 4. Add the unprocessed nbrs back\r\n\t\t\t\tArrayList<String> nbrnames = new ArrayList<>(rp.vtx.nbrs.keySet());\r\n\t\t\t\tfor (String nbrname : nbrnames) {\r\n\t\t\t\t\tif (!processed.containsKey(nbrname)) {\r\n\t\t\t\t\t\tPair np = new Pair(nbrname, rp.psf + nbrname);\r\n\t\t\t\t\t\tqueue.addLast(np);\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\treturn false;\r\n\t}", "@Test\n public void testVerifyLoopInvokesDependenciesProperlyWhenNoCycles() throws Exception {\n // ----------------------------------------------------\n // Add more mocking detail to our dependencies first.\n // ----------------------------------------------------\n\n DepChaser sut = createSut();\n\n // First mock our dependencyMap to know about variables a thru f\n when(_dependencyMap.keySet()).thenReturn(new HashSet<>(Arrays.asList(\"a\", \"b\", \"c\", \"d\", \"e\", \"f\")));\n\n // ----------------------------------------------------------------------------------\n // we're going to make it so it takes 2 iterations in DepChaser to handle a thru f\n // ----------------------------------------------------------------------------------\n\n // The 1st time, our mocked checker is going to checkout no cycles in a, b, c variables\n ChildrenDependencyChecker checker1 = mockChildrenDependencyChecker(Arrays.asList(\"a\", \"b\", \"c\"));\n // The 2nd time, our mocked checker is going to checkout no cycles in d, e, f variables\n ChildrenDependencyChecker checker2 = mockChildrenDependencyChecker(Arrays.asList(\"d\", \"e\", \"f\"));\n\n when(_dependencyCheckerFactory.create(\"a\", _dependencyMap, new HashSet<>())).thenReturn(checker1);\n when(_dependencyCheckerFactory.create(\"d\", _dependencyMap, new HashSet<>(Arrays.asList(\"a\", \"b\", \"c\")))).thenReturn(checker2);\n\n Assert.assertTrue(sut.validateNoDependencyCycles());\n verify(checker1, times(1)).run();\n verify(checker2, times(1)).run();\n\n // Verify all variables were verified\n Assert.assertEquals(_dependencyMap.keySet(), sut.getVerifiedVariables());\n }", "public boolean detectCyclesContainingVertex(V v)\n {\n try {\n execute(null, v);\n } catch (CycleDetectedException ex) {\n return true;\n }\n\n return false;\n }", "public boolean hasCycle(int nodeIndex, int[][] graph, boolean[] visited, boolean[] onStack,\n boolean[] onCycle) {\n\n if (onCycle[nodeIndex]) {\n return true;\n }\n visited[nodeIndex] = true;\n onStack[nodeIndex] = true;\n boolean cycle = false;\n for (int neighbor : graph[nodeIndex]) {\n if (onCycle[neighbor]) {\n cycle = true;\n continue;\n }\n if (!visited[neighbor]) {\n if (hasCycle(neighbor, graph, visited, onStack, onCycle)) {\n onCycle[neighbor] = true;\n cycle = true;\n }\n } else {\n if (onStack[neighbor]) {\n onCycle[neighbor] = true;\n cycle = true;\n }\n }\n }\n onStack[nodeIndex] = false;\n return cycle;\n }", "public static void main(String[] args) {\n\t\tNode test = new Node(1);\n\t\t\n\t\tlogger.info(String.valueOf(hasCycle(test)));\n\t\t\n\t\t//Test second list - 1 -> 2 -> 3 -> 2 -> 3 [...]\n\t\tNode head = new Node(1);\n\t\tNode next = new Node(2);\n\t head.setNext(next); \n\t head.getNext().setNext(new Node(3));\n\t head.getNext().getNext().setNext(next);\n\t \n\t logger.info(String.valueOf(hasCycle(head)));\n\t}", "static Boolean detectloop(Node Header){\n Node slow_pointer = Header;\n Node fast_pointer = Header;\n while(slow_pointer!=null && fast_pointer!=null && fast_pointer.link!=null){\n slow_pointer=slow_pointer.link;\n fast_pointer=fast_pointer.link.link;\n if(slow_pointer==fast_pointer){\n return true;\n }\n }\n return false;\n }", "public static Node findCycle(Node head) {\n if (head == null) return head;\n\n Node slow = head;\n Node fast = head.next;\n while (fast != null && fast.next != null) {\n if (fast == slow) break;\n slow = slow.next;\n fast = fast.next.next;\n }\n\n if (fast == slow) {\n slow = head;\n while (slow != fast.next) {\n slow = slow.next;\n fast = fast.next;\n }\n return fast.next;\n } else {\n return null;\n }\n }", "public boolean\n checkCycle(int nd, ArrayList<ArrayList<Integer>> adj,\n cycleHelper cyHlp) {\n // insert into stack\n cyHlp.isStack[nd] = true;\n for (int it : adj.get(nd)) {\n // if next node is visited\n if (cyHlp.visited[it] == true) {\n // if the node is in stack then cycle is found\n if (cyHlp.isStack[it] == true) return true;\n continue;\n }\n cyHlp.visited[it] = true;\n if (checkCycle(it, adj, cyHlp)) return true;\n }\n // removing from stack\n cyHlp.isStack[nd] = false;\n return false;\n }", "public int getCycle() {\n return cycle;\n }", "private static boolean checkAndAddDependency(int trans_id, int independent_trans_id) {\n List<Integer> txnsInCycle = new ArrayList<Integer>();\n txnsInCycle.add(trans_id);\n if (DeadlockHandler.isThereACycleInGraph(trans_id, independent_trans_id, txnsInCycle)) {\n // System.out.println(\"List contents are\" + txnsInCycle.toString());\n long youngestTxnTime = transactions.get(txnsInCycle.get(0)).getStartTime();\n Integer youngestTxnId = txnsInCycle.get(0);\n for (Integer t : txnsInCycle) {\n if (youngestTxnTime < transactions.get(t).getStartTime()) {\n youngestTxnTime = transactions.get(t).getStartTime();\n youngestTxnId = t;\n }\n }\n\n\n\n System.out.println(\"Cycle in graph. DEADLOCK\");\n System.out.println(\"Aborted : T\" + youngestTxnId);\n releaseResources(youngestTxnId);\n clearWaitingOperations();\n if (youngestTxnId != trans_id && youngestTxnId != independent_trans_id) {\n DeadlockHandler.addDependencyEdge(independent_trans_id, trans_id);\n return true;\n }\n\n\n\n return false;\n\n }\n\n else {\n\n // if edge exists we don't need to do anything\n if (!DeadlockHandler.ifThereIsAnEdgeFromT1toT2(trans_id, independent_trans_id)) {\n\n // System.out.println(\"checkAndAddDependency::Edge is not present\");\n // System.out.println(\"checkAndAddDependency::Add dependency edge\");\n // no deadlock hence we can add the edge\n DeadlockHandler.addDependencyEdge(independent_trans_id, trans_id);\n }\n }\n\n return true;\n }", "private boolean cyclicUpdate() {\n if (cyclicUpdate_EM()) {\n mUpdate = 0;\n return true;\n }\n return false;\n }" ]
[ "0.8022661", "0.7582115", "0.7467581", "0.7309301", "0.6859185", "0.68320376", "0.683162", "0.6827226", "0.6763716", "0.6718021", "0.67077047", "0.6691687", "0.6690034", "0.66510946", "0.6608548", "0.6603222", "0.65824634", "0.6558572", "0.65290487", "0.65054256", "0.65023834", "0.6500697", "0.6500684", "0.64944255", "0.6486089", "0.6445302", "0.6427609", "0.64174277", "0.6416923", "0.6395746", "0.639233", "0.6375804", "0.6359081", "0.6348536", "0.6321289", "0.63179356", "0.63144106", "0.63083905", "0.6257694", "0.622836", "0.62242967", "0.6222032", "0.62157273", "0.6206252", "0.6205957", "0.61885244", "0.61714894", "0.6166482", "0.6165543", "0.6146918", "0.61438555", "0.6142055", "0.61392045", "0.61090255", "0.61029917", "0.6095814", "0.60957247", "0.6085907", "0.6076359", "0.60628957", "0.6057711", "0.6052785", "0.60459083", "0.6035189", "0.6035187", "0.6030533", "0.603052", "0.6024488", "0.60010093", "0.5995891", "0.59947646", "0.5981797", "0.597952", "0.59698707", "0.59671175", "0.5966458", "0.5961987", "0.5945979", "0.59356195", "0.59205526", "0.5917618", "0.5916112", "0.59108174", "0.5906424", "0.590178", "0.58617556", "0.585161", "0.58499044", "0.5819596", "0.5775902", "0.57723796", "0.5766202", "0.575949", "0.5756602", "0.5752004", "0.57468534", "0.57373345", "0.5735446", "0.5721357", "0.57019126" ]
0.58040166
89
/ This function performs the main functionality for the DFS.
private boolean helperDFS(Node current){ if(expandedNode.size() == 999){ //limit has been reached. jump out of recursion. expandedNode.add(current); System.out.println("No solution found."); printExpanded(expandedNode); System.exit(0); return false; } boolean b = cycleCheck(current,expandedNode); if(!b){ expandedNode.add(current); }else{ return false; } if(current.getDigit().getDigitString().equals(goalNode.getDigit().getDigitString())){ //goal reached. //expandedNode.add(current); solutionPath(current); printExpanded(expandedNode); System.exit(0); } //Now make the children. if(!forbidden.contains(current.getDigit().getDigitString())){ if(current.getDigit().last_changed != 0){ if ((Integer.parseInt(current.getDigit().getFirst_digit()) - 1 >= 0)) { Node child_node = new Node(current.getDigit().decreaseFirstDigit()); child_node.setParent(current); child_node.getDigit().setLastChanged(0); if(!forbidden.contains(child_node.getDigit().getDigitString()) && helperDFS(child_node)){ return true; } } //+1 child first digit if ((Integer.parseInt(current.getDigit().getFirst_digit()) + 1 <= 9)) { Node child_node = new Node(current.getDigit().increaseFirstDigit()); child_node.setParent(current); child_node.getDigit().setLastChanged(0); if(!forbidden.contains(child_node.getDigit().getDigitString()) && helperDFS(child_node)){ return true; } } } if(current.getDigit().last_changed != 1){ if ((Integer.parseInt(current.getDigit().getSecond_digit()) - 1 >= 0)) { Node child_node = new Node(current.getDigit().decreaseSecondDigit()); child_node.setParent(current); child_node.getDigit().setLastChanged(1); if(!forbidden.contains(child_node.getDigit().getDigitString()) && helperDFS(child_node)){ return true; } } //+1 child if ((Integer.parseInt(current.getDigit().getSecond_digit()) + 1 <= 9)) { Node child_node = new Node(current.getDigit().increaseSecondDigit()); child_node.setParent(current); child_node.getDigit().setLastChanged(1); if(!forbidden.contains(child_node.getDigit().getDigitString()) && helperDFS(child_node)){ return true; } } } if(current.getDigit().last_changed != 2){ if ((Integer.parseInt(current.getDigit().getThird_digit()) - 1 >= 0)) { Node child_node = new Node(current.getDigit().decreaseThirdDigit()); child_node.setParent(current); child_node.getDigit().setLastChanged(2); if(!forbidden.contains(child_node.getDigit().getDigitString()) && helperDFS(child_node)){ return true; } } //+1 child if ((Integer.parseInt(current.getDigit().getThird_digit()) + 1 <= 9)) { Node child_node = new Node(current.getDigit().increaseThirdDigit()); child_node.setParent(current); child_node.getDigit().setLastChanged(2); if(!forbidden.contains(child_node.getDigit().getDigitString()) && helperDFS(child_node)){ return true; } } } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void DFS() {\n \t\n \t// Mark all the vertices as not visited(set as false by default in java) \n \tboolean visited[] = new boolean[V];\n \t\n \t// Call the recursive helper function to print DFS traversal \n // starting from all vertices one by one \n \tfor (int i=0; i<V; i++) { \n \t\t if (visited[i] == false)\n \t\t\t DFSUtil(i, visited);\n \t}\n }", "private void DFS() {\n\t\tfor(Node node: nodeList) {\r\n\t\t\tif(!node.isVisited())\r\n\t\t\t\tdfsVisit(node);\r\n\t\t}\r\n\t}", "public void DFS() {\r\n for (int i = 0; i < vertexNum; i++) {\r\n DFS(i);\r\n }\r\n }", "void dfs(){\n // start from the index 0\n for (int vertex=0; vertex<v; vertex++){\n // check visited or not\n if (visited[vertex]==false){\n Explore(vertex);\n }\n }\n }", "public void DFS() {\r\n\t\tSet<Vertex> visited = new HashSet<Vertex>();\r\n\r\n\t\t// Create a stack for DFS\r\n\t\tStack<Vertex> stack = new Stack<Vertex>();\r\n\r\n\t\tDFS(this.vertices[3], visited, stack); // DFS starting with 40\r\n\r\n\t\t// Call the helper function to print DFS traversal\r\n\t\t// starting from all vertices one by one\r\n\t\tfor (int i = 0; i < N; ++i)\r\n\t\t\tif (!visited.contains(this.vertices[i]))\r\n\t\t\t\tDFS(this.vertices[i], visited, stack);\r\n\t}", "@Override\n public void dfs() {\n\n }", "public void dfs() {\n int currentVertexIndex = 0;\r\n dfsStack.push(0);\r\n vertexList[0].wasVisited = true;\r\n System.out.println(vertexList[dfsStack.peek()]);\r\n while (dfsStack.top != -1) {\r\n\r\n\r\n currentVertexIndex = this.getAdjUnvisitedVert(dfsStack.peek());\r\n if (currentVertexIndex != -1) {\r\n dfsStack.push(currentVertexIndex);\r\n vertexList[currentVertexIndex].wasVisited = true;\r\n System.out.println(vertexList[dfsStack.peek()]);\r\n\r\n\r\n } else {\r\n currentVertexIndex = dfsStack.pop();\r\n\r\n }\r\n }\r\n// reset wasVisted\r\n for (Vertex x : vertexList) {\r\n x.wasVisited = false;\r\n }\r\n }", "public static void main(String[] args){\n GraphDFS graphDFS = new GraphDFS(20);\n graphDFS.addNode('A');\n graphDFS.addNode('B');\n graphDFS.addNode('D');\n graphDFS.addNode('C');\n graphDFS.addNode('E');\n graphDFS.addNode('F');\n\n graphDFS.addEdge(0, 1);\n graphDFS.addEdge(1, 2);\n graphDFS.addEdge(0, 3);\n graphDFS.addEdge(3, 4);\n graphDFS.addEdge(4, 5);\n graphDFS.addEdge(1, 5);\n\n graphDFS.dfsTraversal();\n }", "public void dfs (String input)\r\n\t {\r\n\t\t \tNode root_dfs = new Node (input);\r\n\t\t \tNode current = new Node(root_dfs.getState());\r\n\t\t \t\r\n\t\t\tArrayList<String> visited = new ArrayList<String>();\r\n\t\t\tArrayList<String> children = new ArrayList<String>();\r\n\t\t\tStack<Node> stack_dfs = new Stack<Node>();\r\n\t\t\t\r\n\t\t\tint nodes_popped = 0;\r\n\t\t\tint stack_max_size = 0;\r\n\t\t\tint stack_size = 0;\r\n\t\t\tcurrent.cost = 0;\r\n\t\t\t\r\n\t\t\tgoal_dfs = isGoal(current.getState());\r\n\t\t\t\r\n\t\t\twhile(!goal_dfs)\r\n\t\t\t{\r\n\t\t\t\tvisited.add(current.getState());\r\n\t\t\t\tchildren = Successor.findChildren(current.getState());\r\n\t\t\t\t\r\n\t\t\t\tfor (String a : children)\r\n\t\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (visited.contains(a))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tNode nino = new Node(a);\r\n\t\t\t\t\t\tcurrent.children_nodes.add(nino);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tint cost = isCost(current.getState(), nino.getState());\r\n\t\t\t\t\t\tnino.cost = cost;\r\n\t\t\t\t\t\tnino.parent = current;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// Repeated state check\r\n\t\t\t\t\t\tif (!stack_dfs.contains(nino))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tstack_dfs.add(nino);\r\n\t\t\t\t\t\t\tstack_size++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// Popping off the stack. LIFO architecture\r\n\t\t\t\tcurrent = stack_dfs.pop();\r\n\t\t\t\tnodes_popped++;\r\n\t\t\t\t\r\n\t\t\t\tif (stack_size > stack_max_size)\r\n\t\t\t\t{\r\n\t\t\t\t\tstack_max_size = stack_size;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tstack_size--;\r\n\t\t\t\tgoal_dfs = isGoal(current.getState());\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tgoal_dfs = false;\r\n\t\t\tSystem.out.println(\"DFS Solved!!\");\r\n\t\t\tSolution.performSolution(current, root_dfs, nodes_popped, stack_max_size);\r\n\t }", "public static void main(String[] args) {\n\n /*\n * Given below directed graph, show the DFS and BFS traversal and print the paths\n * it took throughout the traversal of the graph\n *\n * (D)--(F)\n * /\n * (B)--(E)\n * /\n * (A)\n * \\\n * (C)--(G)\n *\n * Do Breadth First Search and Depth First Search, conclude on the trade offs\n * between the two traversal\n */\n\n // Initialize the graph here and its edges\n Graphs graph = new Graphs();\n graph.addNode('A', new Node('A'));\n graph.addNode('B', new Node('B'));\n graph.addNode('C', new Node('C'));\n graph.addNode('D', new Node('D'));\n graph.addNode('E', new Node('E'));\n graph.addNode('F', new Node('F'));\n graph.addNode('G', new Node('G'));\n\n graph.addEdge('A','B');\n graph.addEdge('B','D');\n graph.addEdge('D','F');\n graph.addEdge('B','E');\n graph.addEdge('A','C');\n graph.addEdge('C','G');\n\n // Initialize the list of paths\n ArrayList<String> traversedNodes;\n // Do a DFS on the graph\n traversedNodes = graph.depthFirstSearch('A','G');\n System.out.println(\"Traversal in DFS:\");\n // Print all of the paths\n for(String path : traversedNodes) {\n System.out.println(path);\n }\n\n // Do a BFS on the graph\n traversedNodes = graph.breadthFirstSearch('A','G');\n System.out.println(\"\\nTraversal in BFS:\");\n // Print all of the paths\n for(String path : traversedNodes) {\n System.out.println(path);\n }\n\n }", "public static void main(String[] args) {\n\t\tDeepFirstSearchGraph main = new DeepFirstSearchGraph();\n\t\tGraph g = main.new Graph(4);\n\t\tg.addEdge(0, 1);\n\t\tg.addEdge(0, 2);\n\t\tg.addEdge(1, 2);\n\t\tg.addEdge(2, 0);\n\t\tg.addEdge(2, 3);\n\t\tg.addEdge(3, 3);\n\t\t\n\t\tint vertexToBegin = 2;\n\t\tSystem.out.println(\"Doing DFS starting from vertex: \"+vertexToBegin);\n\t\tg.DFS(vertexToBegin);\n\t}", "public DFS()\n {\n\n\n writeLock = lock.writeLock();\n readLock = lock.readLock();\n\n recoverINodes();\n\n createDir(\"/\"); // add a root if it does not exist .\n\n }", "public void dfs() {\n\t\tfor (Vertice v : vertices) {\n\t\t\tv.setVisited(false);\n\t\t}\n\t\tfor (Vertice v : vertices) {\n\t\t\tif (!v.getVisited()) {\n\t\t\t\tVisitar(v, -1);\n\t\t\t}\n\t\t}\n\t}", "private static void iddfs(State curr, int depth) {\n for(int i = 0; i <= depth; i++) {\r\n\r\n if(curr.isGoalState()) \r\n System.out.println(i+\":\"+curr.getOrderedPair()+\" Goal\");//initial is goal state\r\n else\r\n System.out.println(i+\":\"+curr.getOrderedPair());//initial\r\n\r\n curr.close.add(curr);\r\n State currState = curr;\r\n while(!currState.isGoalState()) {\r\n if(currState.depth < i)\r\n curr.buildStack(currState.getSuccessors(currState));\r\n System.out.print(i+\":\");\r\n curr.printHelp(currState, 5);\r\n if(!curr.open.isEmpty()) {\r\n currState = curr.open.get(curr.open.size()-1);\r\n curr.close.add(curr.open.remove(curr.open.size()-1));\r\n } else {\r\n break;\r\n }\r\n }\r\n\r\n if(currState.isGoalState()) {\r\n System.out.println(i+\":\"+currState.getOrderedPair() + \" Goal\");\r\n curr.printPath(currState);\r\n return;\r\n }\r\n curr.open.clear(); curr.close.clear();\r\n }\r\n }", "public static void main(String[] args) {\n Graph graph = new Graph(16);\n graph.addEdge(0,1);\n graph.addEdge(1,2);\n graph.addEdge(2,3);\n graph.addEdge(3,4);\n graph.addEdge(4,5);\n graph.addEdge(5,6);\n graph.addEdge(6,7);\n graph.addEdge(8,9);\n graph.addEdge(9,10);\n graph.addEdge(10,11);\n graph.addEdge(11,12);\n graph.addEdge(13,14);\n graph.addEdge(14,15);\n graph.addEdge(15,0);\n graph.addEdge(0,8);\n graph.addEdge(1,10);\n graph.addEdge(2,9);\n graph.addEdge(3,11);\n graph.addEdge(3,14);\n graph.addEdge(4,7);\n graph.addEdge(4,13);\n graph.addEdge(5,8);\n graph.addEdge(5,15);\n graph.printGraph();\n System.out.println(\"DFS Traversal\");\n graph.DFS(3);\n System.out.println();\n System.out.println(\"BFS Traversal\");\n graph.BFS(3);\n// System.out.println();\n// for (int i=0; i<graph.vertices; i++)\n// {\n// if(graph.visited[i]!=true)\n// {\n// graph.DFS(i);\n// }\n// }\n\n }", "private static void dfsComponents() {\r\n\t\tprintThis(\"Standard DFS Demo (the input graph must be UNDIRECTED)\");\r\n\t\tfor (int i = 0; i < V; i++) { // for each vertex i in [0..V-1]\r\n\t\t\tif (dfs_num[i] == DFS_WHITE) { // if that vertex is not visited yet\r\n\t\t\t\tSystem.out.printf(\"Component %d:\", ++numComp);\r\n\t\t\t\tdfs(i);\r\n\t\t\t\tSystem.out.printf(\"\\n\");\r\n\t\t\t}\r\n\t\t}\r\n\t\tSystem.out.printf(\"There are %d connected components\\n\", numComp);\r\n\t}", "public void Main(){\n\t\t\n\t\tfillSFG();\n\t\tboolean[] visited = new boolean[AdjMatrix.length];\n\t\tLinkedList<Integer> pathdump = new LinkedList<Integer>();\n\t\textractForwardPaths(startNode, endNode, startNode, visited, pathdump);\n\t\textractLoops();\n\t\tgetForwardGains();\n\t\tgetLoopGains();\n\t\tprintForwardPaths();\n\t\tSystem.out.println(\"----------------------------------------------\");\n\t\tprintLoops();\n\t\t\n\t\t\n\t\tcalculateDeltas();\n\t\tcalculateTotalGain();\n\t\tprintDeltasAndTotalGain();\n\t\t\n\t\tfor (int i = 1; i < nonTouching.length; i++) {\n\t\t\tSystem.out.println(\"Level = \"+i);\n\t\t\tfor (int j = 0; j < nonTouching[i].size(); j++) {\n\t\t\t\tLinkedList<Integer> dump = new LinkedList<Integer>();\n\t\t\t\tdump = nonTouching[i].get(j);\n\t\t\t\tfor (int k = 0; k < dump.size(); k++) {\n\t\t\t\t\tSystem.out.print(dump.get(k)+\" \");\n\t\t\t\t}\n\t\t\t\tSystem.out.println();\n\t\t\t}\n\t\t\tSystem.out.println(\"************************************************\");\n\t\t}\n\t\t\n\t\tProgramWindow.getInstance().showResults(forwardPaths,forwardGains,loops,loopGains,deltas,TotalGain,nonTouching);\n\t}", "public void depthFirstSearch() {\n List<Vertex> visited = new ArrayList<Vertex>();\r\n // start the recursive depth first search on the current vertex\r\n this.dfs(visited);\r\n }", "public static void main(String[] args) \n\t throws IOException {\n\t Scanner sc = new Scanner(System.in);\n\t System.out.print(\"Enter graph input file name: \");\n\t String file = sc.nextLine();\n\t DFS graph = new DFS(file);\n\t System.out.println(\"The Graph Information is\");\n\t graph.print();\n\t System.out.println(\"The DFS Algorithm\");\n\t graph.dfs();\n\t graph.path(\"A\",\"N\");\n\t }", "public static void main(String[] args) {\r\n \r\n Graph X=new Graph();\r\n \r\n X.GenerateGraph();\r\n \r\n \r\n X.DisplayGraph();\r\n // System.out.println(\"Printing Stack\");\r\n // X.DFS();\r\n \r\n // System.out.println(X.AdjList.get(3).neighbours);\r\n \r\n // ArrayList<Vertex> A=new ArrayList();\r\n \r\n X.BFS();\r\n \r\n X.TraceBack();\r\n }", "@Override\n public void traverse()\n {\n System.out.print(\"DFS Tree: \");\n DFSHelper(root);\n System.out.println();\n }", "public static void main(String[] args){\n Graph g = new Graph(13);\n //add vortexes and edges to construct the graph\n g.addEdge(0,1);\n g.addEdge(0,2);\n g.addEdge(0,6);\n g.addEdge(0,5);\n g.addEdge(6,4);\n g.addEdge(4,3);\n g.addEdge(4,5);\n g.addEdge(3,5);\n g.addEdge(7,8);\n g.addEdge(9,10);\n g.addEdge(9,11);\n g.addEdge(9,12);\n g.addEdge(11,12);\n\n //create a DepthFirstSearch object\n BreadthFirstSearch DFS = new BreadthFirstSearch(g,0);\n\n System.out.println(\"7 and 0 is connected: \"+ DFS.marked(7));\n System.out.println(\"10 and 0 is connected: \"+ DFS.marked(10));\n System.out.println(\"6 and 0 is connected: \"+ DFS.marked(6));\n System.out.println(\"4 and 0 is connected: \"+ DFS.marked(0));\n System.out.println(\"12 and 0 is connected: \"+ DFS.marked(12));\n\n System.out.println(DFS.count()+\" vortexes connect with the vortex 0.\");\n\n }", "public static void main(String[] args) {\n\n Main tree = new Main();\n tree.node = new Node(1);\n tree.node.lt = new Node(2);\n tree.node.lt.lt = new Node(4);\n tree.node.lt.rt = new Node(5);\n\n tree.node.rt = new Node(3);\n tree.node.rt.lt = new Node(6);\n tree.node.rt.rt = new Node(7);\n\n tree.DFS(tree.node);\n }", "public static void main(String[] args) {\n\n BDNode a = new BDNode(\"A\");\n BDNode b = new BDNode(\"B\");\n BDNode c = new BDNode(\"C\");\n BDNode d = new BDNode(\"D\");\n BDNode e = new BDNode(\"E\");\n\n a.link(b);\n a.link(d);\n b.link(a);\n b.link(c);\n b.link(e);\n c.link(b);\n c.link(d);\n d.link(a);\n d.link(c);\n d.link(e);\n e.link(b);\n e.link(d);\n\n BDNode target = e;\n\n/*\n // BFS\n Queue<BDNode> queue = new LinkedList<>();\n queue.offer(a);\n\n while(!queue.isEmpty()) {\n BDNode n = queue.poll();\n n.visit();\n System.out.println(n); // 찾는 여정 출력\n\n if(n.equals(target)) {\n System.out.println(\"BFS Found! \" + n);\n break;\n }\n\n for (BDNode l : n.links) {\n if(l.isVisited()) continue;\n if (queue.contains(l)) continue;\n queue.offer(l);\n }\n\n // 위랑 같은 표현\n// n.links.stream()\n// .filter(l -> !queue.contains(l))\n// .forEach(queue::offer);\n }\n*/\n\n // DFS\n Stack<BDNode> stack = new Stack<>();\n stack.push(a);\n\n while(!stack.isEmpty()) {\n BDNode n = stack.pop();\n n.visit();\n System.out.println(n); // 찾는 여정 출력\n\n if (n.equals(target)) {\n System.out.println(\"DFS Found! \" + n);\n break;\n }\n\n for (BDNode l : n.links) {\n if (l.isVisited()) continue;\n if (stack.contains(l)) continue;\n\n stack.push(l);\n }\n }\n\n\n }", "public static void main(String[] args)\r\n {\n PontoArticulacaoDFS graph = new PontoArticulacaoDFS();\r\n\r\n // Run DFS to find any articulation points (and biconnected components).\r\n graph.doArticulationPointDFS();\r\n\r\n // Display the results of the DFS.\r\n graph.showResults();\r\n }", "private static void dfs(State curr) {\n curr.buildStack(curr.getSuccessors(curr));\r\n \r\n if(curr.isGoalState()) \r\n System.out.println(curr.getOrderedPair()+\" Goal\");//initial is goal state\r\n else\r\n System.out.println(curr.getOrderedPair());//initial\r\n \r\n curr.close.add(curr);\r\n while(!curr.open.isEmpty()&&!curr.isGoalState()) {\r\n curr.buildStack(curr.getSuccessors(curr));\r\n curr.printHelp(curr, 4);\r\n curr = curr.open.get(curr.open.size()-1);\r\n curr.close.add(curr.open.remove(curr.open.size()-1));\r\n }\r\n \r\n if(curr.isGoalState()) {\r\n System.out.println(curr.getOrderedPair() + \" Goal\");\r\n curr.printPath(curr);\r\n }\r\n }", "void DFS(int v) {\n // Mark all the vertices as not visited(set as\n // false by default in java)\n boolean visited[] = new boolean[V];\n\n // Call the recursive helper function to print DFS traversal\n DFSUtil(v, visited);\n }", "public static void run(State curr_state, int option, int depth) {\n switch(option) {\r\n case 3:\r\n bfs(curr_state);\r\n break;\r\n case 4:\r\n dfs(curr_state);\r\n break;\r\n case 5:\r\n iddfs(curr_state, depth);\r\n break;\r\n default:\r\n }\r\n }", "public static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint V = sc.nextInt();\n\t\tint E = sc.nextInt();\n\n\t\tList<Integer>[]adjList = new ArrayList[10010];\n\t\tList<Integer>[]reverseAdjList = new ArrayList[10010];\n\n\t\tList<List<Integer>>scc = new ArrayList<List<Integer>>();\n\t\tint visited[] = new int[10010];\n\n\t\tfor(int i = 1 ; i <= V ; i++){\n\t\t\tadjList[i] = new ArrayList<Integer>();\n\t\t\treverseAdjList[i] = new ArrayList<Integer>();\n\t\t}\n\n\t\tfor(int i = 1 ; i <= E ; i++){\n\n\t\t\tint start = sc.nextInt();\n\t\t\tint end = sc.nextInt();\n\t\t\tadjList[start].add(end);\n\t\t\treverseAdjList[end].add(start);\n\t\t}\n\n\n\t\t//선작업 DFS 스택에 담음.\n\t\tStack <Integer>stack = new Stack<Integer>();\n\t\tfor(int i = 1 ; i <= V ; i++){\n\t\t\tif(visited[i] == 0){\n\t\t\t\tdfs(i,visited,stack,adjList);\n\t\t\t}\n\t\t}\n\n\n\t\t//후작업 역 DFS\n\t\tvisited = new int[10010];\n\n\t\tint r = 0;\n\t\twhile(!stack.isEmpty()){\n\n\t\t\tint here = stack.peek();\n\t\t\tstack.pop();\n\t\t\tif(visited[here] == 1){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tscc.add(new ArrayList<Integer>());\n\t\t\t++r;\n\t\t\treverseDFS(here, r-1, visited, scc, reverseAdjList);\n\n\t\t}\n\n\t\tSystem.out.println(r);\n\t\tfor(int i = 0 ; i < r ; i++){\n\t\t\tList <Integer>temp = scc.get(i);\n\t\t\tCollections.sort(temp);\n\t\t}\n\n\t\tscc.sort(new Comparator<List<Integer>>() {\n\t\t\t@Override\n\t\t\tpublic int compare(List<Integer> o1, List<Integer> o2) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tif(o1.get(0)< o2.get(0)){\n\t\t\t\t\treturn -1;\n\t\t\t\t}else if(o1.get(0) > o2.get(0)){\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t});\n\n\t\t\tfor(List <Integer>list : scc){\n\t\t\t\tfor(int i = 0 ; i < list.size() ; i++){\n\t\t\t\t\tSystem.out.print(list.get(i) + \" \");\n\t\t\t\t}\n\t\t\t\tSystem.out.println(\"-1\");\n\t\t\t}\n\n\t}", "@Override\r\n\tpublic void DFS() {\r\n\t\tvertices.forEach((E e, Vertex<E> u) -> {\r\n\t\t\tu.setColor(Color.WHITE);\r\n\t\t\tu.setPredecessor(null);\r\n\t\t});\r\n\t\tDFStime = 0;\r\n\t\tvertices.forEach((E e, Vertex<E> u) -> {\r\n\t\t\tif(u.getColor() == Color.WHITE) {\r\n\t\t\t\tDFSVisit(u);\r\n\t\t\t}\r\n\t\t});\r\n\t}", "public static void main(String[] args) {\n\t\tVector<Edge> edges = GraphReader.readFromFile(\"/tmp/tinyG.txt\",2);\r\n\t\tGraph G = new Graph(edges);\r\n int s = Integer.parseInt(\"1\");\r\n DepthFirstSearch search = new DepthFirstSearch(G.getNodeNum());\r\n Path res = search.dfs(G, s);\r\n res.packetToJson();\r\n //System.out.print(\"success!\");\r\n }", "static void dfs(int u) { // DFS for normal usage: as graph traversal\r\n\t\t\t\t\t\t\t\t// algorithm\r\n\t\tSystem.out.printf(\" %d\", u); // this vertex is visited\r\n\t\tdfs_num[u] = DFS_BLACK; // important step: we mark this vertex as\r\n\t\t\t\t\t\t\t\t// visited\r\n\t\tfor (int j = 0; j < AdjList[u].size(); j++) {\r\n\t\t\tEdge v = AdjList[u].get(j); // v is a (neighbor,\r\n\t\t\t\t\t\t\t\t\t\t// weight) pair\r\n\t\t\tif (dfs_num[v.to] == DFS_WHITE) // important check to avoid\r\n\t\t\t\t\t\t\t\t\t\t\t// cycle\r\n\t\t\t\tdfs(v.to); // recursively visits unvisited neighbors v of\r\n\t\t\t\t\t\t\t// vertex u\r\n\t\t}\r\n\t}", "private void DepthFirstSearch(Node current){\n helperDFS( current );\n }", "@Override\r\n\tpublic void DFS(E src) {\r\n\t\tif(containsVertex(src)) {\r\n\t\t\tvertices.forEach((E e, Vertex<E> u) -> {\r\n\t\t\t\tu.setDiscovered(0);\r\n\t\t\t\tu.setFinished(0);\r\n\t\t\t\tu.setColor(Color.WHITE);\r\n\t\t\t\tu.setPredecessor(null);\r\n\t\t\t});\r\n\t\t\tDFStime = 1;\r\n\t\t\tVertex<E> s = vertices.get(src);\r\n\t\t\ts.setColor(Color.GRAY);\r\n\t\t\ts.setDiscovered(DFStime);\r\n\t\t\t//s.predecessor is already null so skip that step\r\n\t\t\tStack<Vertex<E>> stack = new Stack<>();\r\n\t\t\tstack.push(s);\r\n\t\t\twhile(!stack.isEmpty()) {\r\n\t\t\t\tVertex<E> u = stack.pop();\r\n\t\t\t\tArrayList<Edge<E>> adj = adjacencyLists.get(u.getElement());\r\n\t\t\t\tfor(Edge<E> ale: adj) {\r\n\t\t\t\t\tVertex<E> v = vertices.get(ale.getDst());\r\n\t\t\t\t\tif(v.getColor() == Color.WHITE) {\r\n\t\t\t\t\t\tDFStime++;\r\n\t\t\t\t\t\tv.setColor(Color.GRAY);\r\n\t\t\t\t\t\tv.setDiscovered(DFStime);\r\n\t\t\t\t\t\tv.setPredecessor(u);\r\n\t\t\t\t\t\tstack.push(v);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tu.setColor(Color.BLACK);\r\n\t\t\t\tDFStime++;\r\n\t\t\t\tu.setFinished(DFStime);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private void dfs(String source) {\n visited.add(source);\n\n System.out.println(source);\n\n for (Object vertex : graph.get(source)) {\n if (!visited.contains(vertex))\n dfs((String) vertex);\n }\n }", "void DFS(Node root) {\n\t\tStack<Node> s = new Stack<Node>();\n\t\ts.add(root);\n\n\t\twhile(!s.isEmpty()) {\n\t\t\tNode n = s.pop();\n\t\t\tif (n != null) {\n\t\t\t\tSystem.out.print(n.data + \",\");\n\t\t\t\ts.push(n.right);\n\t\t\t\ts.push(n.left);\n\t\t\t}\n\t\t}\n\t}", "public static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tBufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tN = Integer.parseInt(st.nextToken());\n\t\t\n\t\tint size = 1;\n\t\twhile(max_node > size) {\n\t\t\tsize *= 2;\n\t\t\tmax_level++;\n\t\t}\n\t\t\n\t\tfor(int i=0; i<= N; i++)\n\t\t{\n\t\t\tadj.add(new ArrayList<>());\n\t\t}\n\t\t\n\t\tint dx=0, dy=0, dz = 0;\n\t\tfor(int i=1; i<= N-1; i++)\n\t\t{\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\tdx = Integer.parseInt(st.nextToken());\n\t\t\tdy = Integer.parseInt(st.nextToken());\n\t\t\tadj.get(dx).add(dy);\n\t\t\tadj.get(dy).add(dx);\n\t\t}\n\t\t\n\t\tdepth[0] = -1;\n\t\tdfs(1,0);\n\t\t\n\t\tst = new StringTokenizer(br.readLine());\n\t\tM = Integer.parseInt(st.nextToken());\n\t\tfor(int i=1; i<= M; i++)\n\t\t{\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\tdx = Integer.parseInt(st.nextToken());\n\t\t\tdy = Integer.parseInt(st.nextToken());\n\t\t\tdz = Integer.parseInt(st.nextToken());\n\t\t\tcurDepth = -1; result = -1;\n\t\t\t\n\t\t\tquery(dx, dy);\n\t\t\tquery(dx, dz);\n\t\t\tquery(dy, dz);\n\t\t\t\n\t\t\tbw.write(result+\"\\n\");\n\t\t}\n\t\tbw.flush();\n\t}", "public static void main(String[] args) {\n\n\n TreeNode mainTree = new TreeNode(50);\n TreeNode node2 = new TreeNode(17);\n TreeNode node3 = new TreeNode(12);\n TreeNode node4 = new TreeNode(23);\n TreeNode node5 = new TreeNode(14);\n TreeNode node6 = new TreeNode(54);\n TreeNode node7 = new TreeNode(72);\n TreeNode node8 = new TreeNode(67);\n TreeNode node9 = new TreeNode(19);\n TreeNode node10= new TreeNode(24);\n TreeNode node11 = new TreeNode(76);\n TreeNode node13 = new TreeNode(9);\n mainTree.left = node2;\n mainTree.right = node7;\n node2.left = node3;\n node2.right = node4;\n node4.left = node9;\n node4.right = node10;\n node3.left = node13;\n node3.right = node5;\n node7.left = node6;\n node7.right = node11;\n node6.right = node8;\n\n DepthFirstSearch.DFS(mainTree);\n }", "public static void main(String[] args) {\n Graph graph = new Graph();\n graph.addEdge(0, 1);\n graph.addEdge(0, 4);\n\n graph.addEdge(1,0);\n graph.addEdge(1,5);\n graph.addEdge(1,2);\n graph.addEdge(2,1);\n graph.addEdge(2,6);\n graph.addEdge(2,3);\n\n graph.addEdge(3,2);\n graph.addEdge(3,7);\n\n graph.addEdge(7,3);\n graph.addEdge(7,6);\n graph.addEdge(7,11);\n\n graph.addEdge(5,1);\n graph.addEdge(5,9);\n graph.addEdge(5,6);\n graph.addEdge(5,4);\n\n graph.addEdge(9,8);\n graph.addEdge(9,5);\n graph.addEdge(9,13);\n graph.addEdge(9,10);\n\n graph.addEdge(13,17);\n graph.addEdge(13,14);\n graph.addEdge(13,9);\n graph.addEdge(13,12);\n\n graph.addEdge(4,0);\n graph.addEdge(4,5);\n graph.addEdge(4,8);\n graph.addEdge(8,4);\n graph.addEdge(8,12);\n graph.addEdge(8,9);\n graph.addEdge(12,8);\n graph.addEdge(12,16);\n graph.addEdge(12,13);\n graph.addEdge(16,12);\n graph.addEdge(16,17);\n graph.addEdge(17,13);\n graph.addEdge(17,16);\n graph.addEdge(17,18);\n\n graph.addEdge(18,17);\n graph.addEdge(18,14);\n graph.addEdge(18,19);\n\n graph.addEdge(19,18);\n graph.addEdge(19,15);\n LinkedList<Integer> visited = new LinkedList();\n List<ArrayList<Integer>> paths = new ArrayList<ArrayList<Integer>>();\n int currentNode = START;\n visited.add(START);\n new searchEasy().findAllPaths(graph, visited, paths, currentNode);\n for(ArrayList<Integer> path : paths){\n for (Integer node : path) {\n System.out.print(node);\n System.out.print(\" \");\n }\n System.out.println();\n }\n }", "void DFSUtil(int v, boolean visited[]) {\n\t\t\tvisited[v] = true;\n\t\t\tSystem.out.println(v +\" \");\n\t\t\t\n\t\t\t//Recur all the vertices adjacents to this vertex\n\t\t\tIterator<Integer> i = adj[v].listIterator();\n\t\t\twhile(i.hasNext()) {\n\t\t\t\tint node = i.next();\n\t\t\t\tif(!visited[node]) {\n\t\t\t\t\tDFSUtil(node, visited);\n\t\t\t\t}\n\t\t\t}\n\t\t}", "static void DFS(int Node)\n {\n\n visit[Node] = true;\n for (int i = 1; i < ver+1; i++) {\n\n\n if (map[Node][i] == 1 && visit[i] == false) {\n DFS(i);\n }\n\n }\n\n\n }", "public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n \n\t\tint n=sc.nextInt();\n \n for(int i=0;i<=n;i++)\n adj.add(new ArrayList<Integer>());\n\n for(int i=1;i<n;i++){\n int a=sc.nextInt();\n int b=sc.nextInt();\n adj.get(a).add(b);\n adj.get(b).add(a);\n }\n \n maxD=-1;\n dfs(1,0);\n \n //Arrays.fill(vis,0);\n for(int i=0;i<=n;i++) vis[i]=0;\n maxD=-1;\n dfs(maxNode,0);\n \n System.out.println(maxD);\n sc.close();\n\n\t}", "public void topologicalSort() {\n\t\tboolean[] visited = new boolean[edges.length];\n\n\t\tfor (int i = 0; i < visited.length; i++) {\n\t\t\tif (visited[i] == false) {\n\t\t\t\tdfs(i, visited);\n\t\t\t}\n\t\t}\n\n\t}", "public String DFS(int g) {\n\t\t//TODO\n\t}", "public void solve() throws IOException {\n int n = ni(); \n int ax = ni(), ay = ni(), bx = ni(), by = ni(), cx = ni(), cy = ni(); \n boolean[][] visited = new boolean[n + 1][n + 1];\n if (dfs(n,ax,ay,bx,by,cx,cy,visited))\n System.out.println(\"YES\");\n else\n System.out.println(\"NO\");\n }", "private static void dfs(int idx, boolean[] visited, boolean[] isbreak) {\n\t\tif(idx==N) {\n\t\t\t//System.out.println(\"����������\");\n\t\t\tint cnt=0;\n\t\t\tfor(int i=0; i<N; i++) {\n\t\t\t\tif(isbreak[i]) cnt++; \n\t\t\t}\n\t\t\tans=Math.max(ans, cnt);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif(isbreak[idx]) {\n\t\t\tdfs(idx+1, visited, isbreak); return;\n\t\t}\n\t\t\n\t\tboolean flag = false;\n\t\tfor(int i=0; i<N; i++) {\n\t\t\t//System.out.println(\"i:\"+i);\n\t\t\tif(i==idx) continue;\n\t\t\t\n\t\t\tif(!isbreak[i]) {\n\t\t\t\tflag=true;\n\t\t\t\t/*System.out.println(i+\"�� ģ��\");\n\t\t\t\tSystem.out.println(\"ġ����\");\n\t\t\t\tSystem.out.println(list.get(idx).inner+\" \"+list.get(idx).weight);\n\t\t\t\tSystem.out.println(list.get(i).inner+\" \"+list.get(i).weight);*/\n\t\t\t\tlist.get(idx).inner-=list.get(i).weight;\n\t\t\t\tlist.get(i).inner-=list.get(idx).weight;\n\t\t\t\t/*System.out.println(\"ġ����\");\n\t\t\t\tSystem.out.println(list.get(idx).inner+\" \"+list.get(idx).weight);\n\t\t\t\tSystem.out.println(list.get(i).inner+\" \"+list.get(i).weight);*/\n\t\t\t\tif(list.get(i).inner <= 0) isbreak[i]=true;\n\t\t\t\tif(list.get(idx).inner <= 0) isbreak[idx]=true;\n\t\t\t\t\n\n\t\t\t\tdfs(idx+1,visited,isbreak);\n\t\t\t\t\n\t\t\t\tlist.get(idx).inner+=list.get(i).weight;\n\t\t\t\tlist.get(i).inner+=list.get(idx).weight;\n\t\t\t\tif(list.get(i).inner > 0) isbreak[i]=false;\n\t\t\t\tif(list.get(idx).inner > 0) isbreak[idx]=false;\n\t\t\t}\n\t\t}\n\t\tif(!flag) {\n\t\t\tint cnt=0;\n\t\t\tfor(int i=0; i<N; i++) {\n\t\t\t\tif(isbreak[i]) cnt++; \n\t\t\t}\n\t\t\tans=Math.max(ans, cnt);\n\t\t\treturn;\n\t\t}\n\t\t\n\t}", "public MyArrayList<MyArrayList<Node>> DFS() {\n t = 0;\n for (int i = 0; i < nodes.size(); i++) {\n Node node = nodes.get(i);\n // reset all nodes in the graph to the initial DFS state\n node.setColor(Color.WHITE);\n node.setD(0);\n node.setF(0);\n node.setParent(null);\n }\n MyArrayList<MyArrayList<Node>> components = new MyArrayList<>();\n for (int i = 0; i < nodes.size(); i++) {\n Node node = nodes.get(i);\n if (node.getColor() == Color.WHITE) {\n // each time we start from a vertex here we are starting a new DFS component\n MyArrayList<Node> component = new MyArrayList<>();\n dfsVisit(node, component);\n components.add(component);\n }\n }\n return components;\n }", "public static void main(String[] args) {\n ArrayList<Integer> arr = new ArrayList<Integer>(); //각 영역의 넓이를 저장할 ArrayList 생성\n AdjMatrics_DFS b = new AdjMatrics_DFS();\n int[][] map = {{1,1,1,0,1},\n {1,1,0,0,1},\n {1,0,1,1,0},\n {0,0,1,1,1},\n {0,0,1,1,1}};\n boolean[][] check = new boolean[map.length][map[0].length]; //방문한 곳을 체크하기 위한 배열 행렬 생성\n\n for(int i=0; i<map.length; i++) {\n //System.out.println(\"다음 찾기 시작\");\n //(0,0) 부터 탐색 시작 후 1을 만나면 넓이 구하기 시작\n for(int j=0; j<map[i].length; j++) {\n if(map[i][j] == 1) {\n b.dfs(i,j,check,map);\n arr.add(cnt);\n cnt = 1;\n }\n // 아닌경우 continue\n else\n continue;\n }\n }\n //\tSystem.out.println(\"프로그램 종료\");\n System.out.println(\"arr : \"+ arr);\n }", "public static void main(String[] args) {\n\t\tint answer = 0;\r\n\t\t\t\t\r\n\t\tScanner sc = new Scanner(System.in);\r\n\t\tint t = sc.nextInt();\r\n\t\t\r\n\t\t\r\n\t\twhile (t>0) {\r\n\t\t\tint n = sc.nextInt();\r\n\t\t\tint[] arr = new int[n+1];\r\n\t\t\tboolean[] visited = new boolean[n+1]; \r\n\t\t\tt--;\r\n\t\t\tfor(int i=1;i<=n;i++) {\r\n\t\t\t\tarr[i] = sc.nextInt();\r\n\t\t\t\tvisited[i] = false;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tfor(int i=1;i<=n;i++) {\r\n\t\t\t\tif (visited[i]==false) {\r\n\t\t\t\t\tdfs(arr,visited,i);\r\n\t\t\t\t\tanswer ++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tSystem.out.println(answer);\r\n\t\t\tanswer = 0;\r\n\t\t}\r\n\t\t\r\n\t}", "void dfs(SimpleVertex simpleVertex) {\n\n\t\twhile (true) {\n\t\t\tif (simpleVertex.isVisited == false) {\n\t\t\t\tsimpleVertex.isVisited = true;\n\t\t\t\tSystem.out.print(simpleVertex.Vertexname + \" \");\n\t\t\t\tfor (int i = 0; i < simpleVertex.neighborhood.size(); i++) {\n\t\t\t\t\tSimpleEdge node = simpleVertex.neighborhood.get(i);\n\n\t\t\t\t\tdfs(node.two);\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t}", "void DFS(int v) {\n\t\t\tboolean visited[] = new boolean[number_of_vertices];\n\t\t\t\n\t\t\t//in case that the vertex are not connected, I need to make DFS for all\n\t\t\t//available vertex and checking before if they are not visited\n\t\t\tfor(int i = 0 ; i < number_of_vertices; i++) {\n\t\t\t\tif(visited[i] == false)\n\t\t\t\t\tDFSUtil(v, visited);\n\t\t\t}\n\t\t}", "public void dfs (int start) {\n vertexList[start].wasVisited = true; // mark it\n print(start); stack.push(start);\n while (!stack.isEmpty()) {\n int b = getNextUnvisitedNeighbor(stack.peek());\n if (b==-1) stack.pop(); // no unvisited neighbor;\n else {\n vertexList[b].wasVisited = true;\n print(b); stack.push(b);\n }\n }\n // clear wasVisited marks\n }", "private void DFS(Vertex x) {\r\n\t\tseen[vertices.indexOf(x)] = true;\r\n\t\tSystem.out.print(x.label + \" \");\r\n\t\tfor (int i = 0; i < x.outList.size(); i++) {\r\n\t\t\tif (!seen[vertices.indexOf(x.outList.get(i).vertex)]) {\r\n\t\t\t\tDFS(x);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public static void main(String[] args) {\n\t\tint[][] edges = {{0,1},{1,2},{1,3},{4,5}};\n\t\tGraph graph = createAdjacencyList(edges, true);\n\t\tSystem.out.println(\"Number of connected graphs(Adjacency List) unDirected : \"+getNumberOfConnectedComponents(graph));\n\t\tSystem.out.println(\"Number of connected graphs(Adjacency List) Directed: \"+getNumberOfConnectedComponents(createAdjacencyList(edges, false)));\n\t\t\n\t\t//Shortest Distance & path\n\t\tint[][] edgesW = {{0,1,1},{1,2,4},{2,3,1},{0,3,3},{0,4,1},{4,3,1}};\n\t\tgraph = createAdjacencyList(edgesW, true);\n\t\tSystem.out.println(\"Shortest distance : \"+ getShortestDistance(graph, 0, 3));\n\t\t\n\t\t//Graph represented in Adjacency Matrix\n\t\tint[][] adjacencyMatrix = {{0,1,0,0,1,0},{1,0,1,1,0,0},{0,1,0,1,0,0},{0,1,0,0,0,0},{0,0,0,0,0,0},{0,0,0,0,0,0}};\n\t\t\n\t\t// Connected components or Friends circle\n\t\tSystem.out.println(\"Number of connected graphs(Adjacency Matrix) unDirected Recursive: \"+getNumberOfConnectedComponents(adjacencyMatrix));\n\t\tSystem.out.println(\"Number of connected graphs(Adjacency Matrix) unDirected Iterative: \"+getNumberOfConnectedComponents(adjacencyMatrix));\n\n\t\tSystem.out.println(\"Shortest distance : \"+ getShortestDistance(adjacencyMatrix, 0, 3));\n\t\t\n\t\t// Number of Islands\n\t\tint[][] islandGrid = {{1,1,0,1},{0,1,0,0},{0,0,1,1},{0,1,1,0}};\n\t\tSystem.out.println(\"Number of islands Recursive: \"+ getNumberOfIslands(islandGrid));\n\t\t// re-initialize\n\t\tint[][] islandGridIterative = {{1,1,0,0},{0,1,0,0},{0,0,1,1},{0,1,1,0}};\n\t\tSystem.out.println(\"Number of islands Iterative: \"+ getNumberOfIslandsIterative(islandGridIterative));\n\n\n\t}", "void DFSUtil(int v, boolean visited[]) {\n \t// Mark the current node as visited and print it \n visited[v] = true; \n System.out.print(v + \" \"); \n \n for(int w: adj[v]) \n \tif (!visited[w]) { \n \t\tDFSUtil(w, visited);\n \t}\n }", "public void dfs(Vertex<T> start) {\n\t\t\t// DFS uses Stack data structure\n\t\t\tStack<Vertex<T>> stack = new Stack<Vertex<T>>();\n\t\t\tstart.visited = true;\n\t\t\tstack.push(start);\n\t\t\tprintNode(start);\n\t\t\twhile (!stack.isEmpty()) {\n\t\t\t\tVertex<T> n = stack.peek();\n\t\t\t\tVertex<T> child = getUnvisitedChildren(n);\n\t\t\t\tif (child != null) {\n\t\t\t\t\tchild.visited = true;\n\t\t\t\t\tstack.push(child);\n\t\t\t\t\tprintNode(child);\n\t\t\t\t} else {\n\t\t\t\t\tstack.pop();\n\t\t\t\t}\n\t\t\t}\n\t\t}", "public void dfs()\n{\n Stack s=new Stack();\n s.push(this.rootNode);\n rootNode.visited=true;\n printNode(rootNode);\n while(!s.isEmpty())\n {\n Node n=(Node)s.peek();\n Node child=getUnvisitedChildNode(n);\n if(child!=null)\n {\n child.visited=true;\n printNode(child);\n s.push(child);\n }\n else\n {\n s.pop();\n }\n }\n //Clear visited property of nodes\n clearNodes();\n}", "static void graphCheck(int u) {\n\t\tdfs_num[u] = DFS_GRAY; // color this as DFS_GRAY (temp)\r\n\t\tfor (int j = 0; j < (int) AdjList[u].size(); j++) {\r\n\t\t\tEdge v = AdjList[u].get(j);\r\n\t\t\tif (dfs_num[v.to] == DFS_WHITE) { // Tree Edge, DFS_GRAY to\r\n\t\t\t\t\t\t\t\t\t\t\t\t// DFS_WHITE\r\n\t\t\t\tdfs_parent[v.to] = u; // parent of this children is me\r\n\t\t\t\tgraphCheck(v.to);\r\n\t\t\t} else if (dfs_num[v.to] == DFS_GRAY) { // DFS_GRAY to DFS_GRAY\r\n\t\t\t\tif (v.to == dfs_parent[u]) // to differentiate these two\r\n\t\t\t\t\t\t\t\t\t\t\t// cases\r\n\t\t\t\t\tSystem.out.printf(\" Bidirectional (%d, %d) - (%d, %d)\\n\",\r\n\t\t\t\t\t\t\tu, v.to, v.to, u);\r\n\t\t\t\telse\r\n\t\t\t\t\t// la mas usada pillar si tiene un ciclo\r\n\t\t\t\t\tSystem.out.printf(\" Back Edge (%d, %d) (Cycle)\\n\", u, v.to);\r\n\t\t\t} else if (dfs_num[v.to] == DFS_BLACK) // DFS_GRAY to DFS_BLACK\r\n\t\t\t\tSystem.out.printf(\" Forward/Cross Edge (%d, %d)\\n\", u, v.to);\r\n\t\t}\r\n\t\tdfs_num[u] = DFS_BLACK; // despues de la recursion DFS_BLACK (DONE)\r\n\t}", "private static void dfsRecursive(Node node) {\n\t\t//if the node state isn't undiscovered it has already been accounted for\n\t\tif(node == null || node.state != Node.State.UNDISCOVERED) {\n\t\t\treturn;\n\t\t}\n\t\tnode.state = Node.State.DISCOVERED;\n\n\t\t//process node\n\t\tSystem.out.print(node.name + \" -> \");\n\t\t\n\t\tfor(Edge e : node.edges) {\n\t\t\tdfsRecursive(e.getNeighbor(node));\n\t\t}\n\t\t\t\n\t\t//finished with this node\n\t\tnode.state = Node.State.COMPLETE;\n\t}", "public void depthFirstSearch(Node vertex){\n vertex.visited = true;\n if(vertex.row == row_size-1 && vertex.col == col_size-1){\n while(!dfs_stack.isEmpty()){\n exitPath +=dfs_stack.peek(); \n dfs_stack.pop();\n } \n }\n if(vertex.north!=null && vertex.north.visited==false){\n dfs_stack.push(\"N\");\n vertex.depthFirstSearch(vertex.north);\n }\n if(vertex.south!=null && vertex.south.visited==false){\n dfs_stack.push(\"S\");\n vertex.depthFirstSearch(vertex.south);\n }\n if(vertex.west !=null && vertex.west.visited ==false){\n dfs_stack.push(\"W\");\n vertex.depthFirstSearch(vertex.west);\n }\n if(vertex.east !=null && vertex.east.visited==false){\n dfs_stack.push(\"E\");\n vertex.depthFirstSearch(vertex.east);\n }\n if (!dfs_stack.isEmpty()){\n dfs_stack.pop();\n }\n return;\n }", "static void dfs(Node current, Set<Node> visited) {\n System.out.print(\"Node \" + current.val + \", \");\n\n // adds the current node to the set of already visited nodes\n visited.add(current);\n\n // loops over the neighbours of the current node\n for (Node neighbour: current.neighbours) {\n\n // if the neighbour has not been already visited\n if (! visited.contains(neighbour)) {\n\n // recursively processes the neighbour\n dfs(neighbour, visited);\n }\n }\n }", "public static void main(String[] args) {\n\n G g = new G(6, true, new int[][] { {0, 1}, {1, 2}, {2, 3}, {3, 4}, {4, 0}, {3, 5} });\n\n g.print();\n g.dfs();\n g.bfs();\n\n System.out.println();\n System.out.println();\n\n // 1 -> 2\n // 0 / \\/\n // \\ 4 -> 3 -> 5\n\n G gDirected = new G(6, false, new int[][] { {0, 1}, {1, 2}, {2, 3}, {3, 5}, {0, 4}, {4, 3} });\n\n gDirected.print();\n gDirected.dfs();\n gDirected.bfs();\n gDirected.topoSort();\n }", "static void floodfill() {\r\n\t\tprintThis(\"Flood Fill Demo (the input graph must be UNDIRECTED)\");\r\n\t\tnumComp = 0;\r\n\t\tdfs_num = new int[V];\r\n\t\tArrays.fill(dfs_num, DFS_WHITE);\r\n\t\tfor (int i = 0; i < V; i++)\r\n\t\t\tif (dfs_num[i] == DFS_WHITE)\r\n\t\t\t\tfloodfill(i, ++numComp);\r\n\t\tfor (int i = 0; i < V; i++)\r\n\t\t\tSystem.out.printf(\"Vertex %d has color %d\\n\", i, dfs_num[i]);\r\n\t}", "public static void depthFirstSearchIterative(ArrayList<Node> graph) {\n\t\tSystem.out.println(\"DFS Iterative:\");\n\t\tif(graph.size() == 0) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tGraphUtils.cleanGraph(graph);\n\n\t\tDeque<Node> stack = new ArrayDeque<Node>();\n\t\tfor(Node node : graph) {\n\t\t\tif(node.state != Node.State.UNDISCOVERED) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tnode.state = Node.State.DISCOVERED;\n\t\t\tstack.push(node);\n\t\t\twhile(!stack.isEmpty()) {\n\t\t\t\tnode = stack.pop();\n\t\t\t\t\n\t\t\t\t//process node\n\t\t\t\tSystem.out.print(node.name + \" -> \");\n\t\t\t\t\n\t\t\t\tfor(Edge e : node.edges) {\n\t\t\t\t\t//process edge\n\t\t\t\t\tNode neighbor = e.getNeighbor(node);\n\t\t\t\t\t\n\t\t\t\t\t//first time we see this node it gets added to the stack for later processing\n\t\t\t\t\tif(neighbor.state == Node.State.UNDISCOVERED) {\n\t\t\t\t\t\tneighbor.state = Node.State.DISCOVERED;\n\t\t\t\t\t\tstack.push(neighbor);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//finished with this node\n\t\t\t\tnode.state = Node.State.COMPLETE;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\tGraphUtils.cleanGraph(graph);\n\t}", "private void doDFSRecursive(int vertex) {\n markVisited(vertex);\n\n for (Integer adjacentVertex : graph.getAdjacentVertices(vertex)) {\n if (!isVisitedNode(adjacentVertex)) {\n System.out.print(adjacentVertex + \" \");\n doDFSRecursive(adjacentVertex);\n }\n }\n }", "public static void main(String[] args) {\n\t\tBFS breadFirstSearch = new BFS();\n\n\t\t// creating an object of class DFS\n\t\tDFS depthFirstSearch = new DFS();\n\n\t\tchar choice, opt;\n\t\tScanner in = new Scanner(System.in);\n\n\t\tdo {\n\t\t\tSystem.out.println(\"Enter your choice of search\");\n\t\t\tSystem.out.println(\"Press 'b' for breadth first search\");\n\t\t\tSystem.out.println(\"Press 'd' for depth first search\");\n\t\t\tchoice = Character.toLowerCase(in.next().charAt(0));\n\n\t\t\t// creating a set of vertices\n\t\t\tVertex vertex1 = new Vertex(1);\n\t\t\tVertex vertex2 = new Vertex(2);\n\t\t\tVertex vertex3 = new Vertex(3);\n\t\t\tVertex vertex4 = new Vertex(4);\n\t\t\tVertex vertex5 = new Vertex(5);\n\n\t\t\t// connecting the vertices to each other to make the graph\n\t\t\tvertex1.addNeighbourVertex(vertex2);\n\t\t\tvertex1.addNeighbourVertex(vertex4);\n\t\t\tvertex4.addNeighbourVertex(vertex5);\n\t\t\tvertex2.addNeighbourVertex(vertex3);\n\n\n\t\t\tswitch (choice) {\n\t\t\tcase 'd' : \n\t\t\t\t// start the depth first search starting from vertex1\n\t\t\t\tdepthFirstSearch.iterativeDFS(vertex1); break;\n\n\t\t\tcase 'b':\n\t\t\t\t// start the breadth first search starting from vertex1\n\t\t\t\tbreadFirstSearch.bfs(vertex1); break;\n\n\t\t\tdefault: System.out.println(\"wrong input\");\n\t\t\t}\n\n\t\t\tSystem.out.println(\"Want to continue (y/n)\");\n\t\t\topt = Character.toLowerCase(in.next().charAt(0));\n\t\t} while (opt == 'y');\n\t\tin.close();\n\t}", "private void dfsVisit(Node node) {\n\t\tStack<Node>stack = new Stack<>();\r\n\t\tstack.push(node); //add source node to queue\r\n\t\twhile(!stack.isEmpty()) {\r\n\t\t\tNode presentNode = stack.pop();\r\n\t\t\tpresentNode.setVisited(true);\r\n\t\t\tSystem.out.print(presentNode.getName()+\" \");\r\n\t\t\tfor(Node neighbor: presentNode.getNeighbors()) { //for each neighbor of present node\r\n\t\t\t\tif(!neighbor.isVisited()) { //if neighbor is not visited then add it to queue\r\n\t\t\t\t\tstack.push(neighbor);\r\n\t\t\t\t\tneighbor.setVisited(true);\r\n\t\t\t\t}\r\n\t\t\t}//end of for loop\r\n\t\t}//end of while loop\r\n\t\t\r\n\t}", "public static void main(String[] args) {\n\t\tGraph graph = new Graph();\n\t\tgraph.addEdge(1, 2);\n\t\tgraph.addEdge(1, 3);\n\t\tgraph.addEdge(1, 3);\n\t\tgraph.addEdge(2, 5);\n\t\tgraph.addEdge(2, 6);\n\t\tgraph.addEdge(5, 9);\n\t\tgraph.addEdge(5, 10);\n\t\tgraph.addEdge(4, 7);\n\t\tgraph.addEdge(4, 8);\n\t\tgraph.addEdge(7, 11);\n\t\tgraph.addEdge(7, 12);\n\t\tgraph.addVertex(0);\n\t\tgraph.addVertex(13);\n\t\tgraph.addVertex(14);\n\n\t\t// vertex 0, 13 and 14 are single nodes\n\n\t\tTraversalBfsDfs bfs = new TraversalBfsDfs();\n\t\tbfs.runBFS(graph);\n\t\tbfs.runDFS(graph);\n\n\t}", "void DFS(int v, boolean visited[]) {\n visited[v] = true;\n connected++;\n //LinkedList Iterator to Recursively traverse all adjacent nodes of v\n Iterator<Integer> itr = adj[v].listIterator();\n\n while(itr.hasNext()) {\n int x = itr.next();\n if(visited[x] == false)\n DFS(x,visited);\n }\n }", "public static void main(String args[]) {\n int V = 4;\n Graph g = new Graph(V);\n g.addEdge(0, 1);\n g.addEdge(0, 2);\n g.addEdge(1, 2);\n g.addEdge(2, 0);\n g.addEdge(2, 3);\n g.addEdge(3, 3);\n\n int src = 1;\n int dest = 3;\n boolean[] visited = new boolean[V];\n\n // To store the complete path between source and destination\n Stack<Integer> path1 = new Stack<>();\n\n if (hasPathDFS(g, src, dest, visited, path1)) {\n System.out.println(\"There is a path from \" + src + \" to \" + dest);\n System.out.println(\"The complete path is \" + path1);\n } else System.out.println(\"There is no path from \" + src + \" to \" + dest);\n\n src = 3;\n dest = 1;\n // To store the complete path between source and destination\n Stack<Integer> path2 = new Stack<>();\n\n if (hasPathDFS(g, src, dest, visited, path2)) System.out.println(\"There is a path from \" + src + \" to \" + dest);\n else System.out.println(\"There is no path from \" + src + \" to \" + dest);\n\n // total number of nodes in the graph (labeled from 0 to 7)\n int n = 8;\n\n // List of graph edges as per the above diagram\n Graph g2 = new Graph(n);\n /**\n * There is a path from 1 to 3\n * The complete path is [1, 2, 3]\n * There is no path from 3 to 1\n * There is a path from 0 to 7\n * The complete path is [0, 3, 4, 6, 7]\n */\n\n g2.addEdge(0, 3);\n g2.addEdge(1, 0);\n g2.addEdge(1, 2);\n g2.addEdge(1, 4);\n g2.addEdge(2, 7);\n g2.addEdge(3, 4);\n g2.addEdge(3, 5);\n g2.addEdge(4, 3);\n g2.addEdge(4, 6);\n g2.addEdge(5, 6);\n g2.addEdge(6, 7);\n\n // source and destination vertex\n src = 0;\n dest = 7;\n\n // To store the complete path between source and destination\n Stack<Integer> path = new Stack<>();\n boolean[] visited2 = new boolean[n];\n\n if (hasPathDFS(g2, src, dest, visited2, path)) {\n System.out.println(\"There is a path from \" + src + \" to \" + dest);\n System.out.println(\"The complete path is \" + path);\n } else System.out.println(\"There is no path from \" + src + \" to \" + dest);\n\n\n }", "public static void main(String[] args) {\n\t\tlong start=System.currentTimeMillis();\r\n\r\n\t\tGraph g = new Graph(9);\r\n\t\tg.addEdge(0, 1);\r\n\t\tg.addEdge(1, 2);\r\n\t\tg.addEdge(1, 3);\r\n\t\tg.addEdge(2, 4);\r\n\t\tg.addEdge(2, 3);\r\n\t\tg.addEdge(3, 4);\r\n\t\tg.addEdge(3, 5);\r\n\t\tg.addEdge(5, 6);\r\n\t\tg.addEdge(5, 7);\r\n\t\tg.addEdge(6, 8);\r\n\t\t//g.dfs();\r\n\t\t//0 1 3 5 7 6 8 4 2 0.004초\r\n\t\t//g.bfs();\r\n\t\t//0 1 2 3 4 5 6 7 8 0.006초\r\n\t\tg.dfsR(); \r\n\t\t//0 1 2 3 4 5 6 7 8 0.004초 \r\n\t\t\r\n\t\t\r\n\t\tlong end = System.currentTimeMillis();\r\n\t\tSystem.out.println(\" 실행 시간 : \" + (end - start)/1000.0 + \"초\");\r\n\t\t\r\n\t\r\n\t}", "void DFS(int head) {\n //visited boolean array maintained to keep track of visited nodes and to avoid infinite looping\n boolean visited[] = new boolean[V+1];\n if(visited[head] == false)\n DFS(head,visited);\n\n System.out.println(V-connected);\n }", "public void dfs(DSAGraphVertex vx, DSAStack visited, DSAQueue queue)\n\t{\n\t\ttry {\n\t\t\tif(vx != null) //base case if it's null end recursion\n\t\t\t{\n\t\t\t\tvisited.push(vx); //push onto visited stack\n\n\t\t\t\tIterator<DSAGraphVertex> itr = vx.getAdjacent().iterator();\n\n\t\t\t\tdo{\n\t\t\t\t\twhile (itr.hasNext())\n\t\t\t\t\t{\n\t\t\t\t\t\tvx = itr.next();\n\t\t\t\t\t\tif(!vx.getVisited()) //if not visited traverse here\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tqueue.enqueue(vx); //adds to output queue\n\t\t\t\t\t\t\tvx.setVisited(); //sets to visited\n\t\t\t\t\t\t\tdfs(vx, visited, queue);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tvisited.pop();\n\n\t\t\t\t} while(!visited.isEmpty());\n\t\t\t}\n\t\t}\n\t\tcatch (IllegalArgumentException e) //catches empty stack exceptions\n\t\t{\n\t\t\t//System.out.println(e.getMessage());\n\t\t}\n\n\t}", "public void run() {\n BFS();\n printBFS();\n shortestPathList();\n printShortestPath();\n printPath();\n }", "private void dfs(Node s, HashSet<Integer> visited) {\n\t\tif(visited.contains(s.id)) {\n\t\t\treturn;\n\t\t}\n\t\tSystem.out.println(s.id);\n\t\tvisited.add(s.id);\n\t\tfor(Node n :s.adj) {\n\t\t\tdfs(n,visited);\n\t\t}\n\t}", "@Override\n\tpublic void run() {\n\t\tMap<Integer, Location> possibleStartLocations = possibleStartLocations();\n\n\t\tfor(Entry<Integer, Location> startLocation : possibleStartLocations.entrySet()) {\n\t\t\t// Add startLocation to visited locations\n\t\t\tMap<Integer, Location> visitedLocations = new HashMap<Integer, Location>();\n\t\t\tvisitedLocations.put(startLocation.getKey(), startLocation.getValue());\n\t\t\t\n\t\t\t// Add startLocation to visited order\n\t\t\tList<Location> visitedOrder = new LinkedList<Location>();\n\t\t\tvisitedOrder.add(startLocation.getValue());\n\t\t\t\n\t\t\t// Start the recursion for the following start node\n\t\t\tfindSolution(startLocation, startLocation, visitedLocations, visitedOrder, 0);\n\t\t}\n\t}", "private void propagateFeatures () {\n Logger.log(\"Propagating invocations through the Call Graph - DFS\");\n Set<SootMethod> calculated = new HashSet<SootMethod>();\n Chain<SootClass> classes = Scene.v().getApplicationClasses();\n SootClass c = null;\n SootMethod m = null;\n try {\n for (SootClass sclass : classes) {\n c = sclass;\n List<SootMethod> methods = sclass.getMethods();\n for (SootMethod method : methods) {\n m = method;\n if (!calculated.contains(method)) {\n propagateFeatures(method, calculated);\n }\n }\n }\n } catch (Exception e) {\n // handling\n }\n }", "static void dfs(int[][] G){\n\t\tStack<Integer> s = new Stack<Integer>();\n\t\tfor (int ver_start=0; ver_start<N; ver_start++){\n\t\t\tif (visited[ver_start]) continue;\n\t\t\ts.push(ver_start);\n\t\t\tvisited[ver_start] = true;\n\n\t\t\twhile(!s.isEmpty()){\n\t\t\t\tint vertex = s.pop();\n\t\t\t\tSystem.out.print((vertex+1) + \" \");\n\t\t\t\tfor (int i=0; i<N; i++){\n\t\t\t\t\tif (G[vertex][i] == 1 && !visited[i]){\n\t\t\t\t\t\t// find neigbor of current vertex and not visited\n\t\t\t\t\t\t// add into the stack\n\t\t\t\t\t\ts.push(i);\n\t\t\t\t\t\tvisited[i] = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tSystem.out.println();\n\t\t}\n\t}", "void DFSUtil(int v, boolean visited[]) {\n // Mark the current node as visited and print it\n visited [v] = true;\n System.out.print(v + \" \");\n\n // Recur for all the vertices adjacent to this vertex\n Iterator<Integer> i = adj [v].listIterator();\n while (i.hasNext()) {\n int n = i.next();\n if (!visited [n])\n DFSUtil(n, visited);\n }\n }", "public void dft() {\r\n\t\tHashMap<String, Boolean> processed = new HashMap<>();\r\n\t\tLinkedList<Pair> stack = new LinkedList<>();\r\n\r\n\t\tArrayList<String> vnames = new ArrayList<>(vces.keySet());\r\n\t\tfor (String vname : vnames) {\r\n\t\t\tif (processed.containsKey(vname)) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tPair rootpair = new Pair(vname, vname);\r\n\t\t\tstack.addFirst(rootpair);\r\n\t\t\twhile (stack.size() != 0) {\r\n\t\t\t\t// 1. removeFirst\r\n\t\t\t\tPair rp = stack.removeFirst();\r\n\r\n\t\t\t\t// 2. check if processed, mark if not\r\n\t\t\t\tif (processed.containsKey(rp.vname)) {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\tprocessed.put(rp.vname, true);\r\n\r\n\t\t\t\t// 3. Check, if an edge is found\r\n\t\t\t\tSystem.out.println(rp.vname + \" via \" + rp.psf);\r\n\r\n\t\t\t\t// 4. Add the unprocessed nbrs back\r\n\t\t\t\tArrayList<String> nbrnames = new ArrayList<>(rp.vtx.nbrs.keySet());\r\n\t\t\t\tfor (String nbrname : nbrnames) {\r\n\t\t\t\t\tif (!processed.containsKey(nbrname)) {\r\n\t\t\t\t\t\tPair np = new Pair(nbrname, rp.psf + nbrname);\r\n\t\t\t\t\t\tstack.addFirst(np);\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 dfs (Node node) {\r\n\t\t\r\n\t\tSystem.out.print(node.data+\" \");\r\n\t\tList<Node> adding = node.getPartners();\r\n\t\tnode.visited = true;\r\n\t\t\tfor(int loop=0; loop<adding.size(); loop++) {\r\n\t\t\t\tNode n = adding.get(loop);\r\n\t\t\t\t\tif (n!=null && !n.visited) {\r\n\t\t\t\t\t\tdfs(n);\r\n\t\t\t\t\t} // if loop ends here\r\n\t\t\t\t\t\r\n\t\t\t} // for loop ends here\r\n\t\t\r\n\t}", "void DFSearch(BFSNode n){\n\t\tn.discovered=true;\r\n\t\tSystem.out.print(\" discovered\");\r\n\t\tn.preProcessNode();\r\n\t\tfor( Integer edg: n.edges){\r\n\t\t\tn.processEdge(edg);\r\n\t\t\tif(!nodes[edg].discovered){\r\n\t\t\t\tnodes[edg].parent = n; \r\n\t\t\t\tnodes[edg].depth = n.depth +1;\r\n\t\t\t\t\r\n\t\t\t\tSystem.out.print(\"{new track with parent [\"+ nodes[edg].parent.value+\"] }\");\r\n\t\t\t\tDFSearch(nodes[edg]);\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tif(nodes[edg] != n.parent){\r\n\t\t\t\t\tSystem.out.print(\"{LOOP}\");\r\n\t\t\t\t\tif(nodes[edg].depth < n.reachableLimit.depth){\r\n\t\t\t\t\t\tn.reachableLimit = nodes[edg];\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\tSystem.out.print(\"{second visit}\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tSystem.out.println(\"back from node [ \"+n.value +\" ]\");\r\n\t\tn.postProcessNode();\r\n\t\tn.processed = true;\r\n\t\t\r\n\t}", "private void DFS(Vertex start, Set<Vertex> visited, Stack<Vertex> stack) {\r\n\t\t// if(visited.contains(start)) return;\r\n\r\n\t\t// Mark the current node as visited and push it\r\n\t\tvisited.add(start);\r\n\t\tstack.push(start);\r\n\r\n\t\tVertex currentNode;\r\n\t\tSet<Vertex> neighbors;\r\n\r\n\t\twhile (stack.size() > 0) {\r\n\t\t\t// Pop a vertex from stack and print it\r\n\t\t\tcurrentNode = stack.pop();\r\n\r\n\t\t\tSystem.out.print(currentNode + \" \");\r\n\r\n\t\t\t// Get all adjacent vertices of the dequeued vertex s\r\n\t\t\t// If a adjacent has not been visited, then mark it\r\n\t\t\t// visited and enqueue it\r\n\t\t\tneighbors = currentNode.getNeighbors();\r\n\r\n\t\t\tfor (Vertex n : neighbors) {\r\n\t\t\t\tif (!visited.contains(n)) {\r\n\t\t\t\t\tvisited.add(n);\r\n\t\t\t\t\tstack.push(n);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private static void DFS(int v, int CC, UndirectedGraphAPI graph) {\n\t\tcolor[v] = GRAY;\n\t\tidArray[v] = CC;\n\t\tArrayList<Edge> list = graph.getAdj()[v];\n\t\tfor(Edge edge : list){\n\t\t\tint w = edge.getOtherVertex(v);\n\t\t\tif(color[w] == WHITE){\n\t\t\t\tcount++;\n\t\t\t\tDFS(w, CC, graph);\n\t\t\t}\n\t\t}\n\t\tcolor[v] = BLACK;\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 static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint tc = sc.nextInt();\n\t\tfor (int T = 0; T < tc; T++) {\n\t\t\tint V = sc.nextInt();\n\t\t\tint E = sc.nextInt();\n\t\t\tint[][] graph = new int[V][V];\n\t\t\tfor (int i = 0; i < E; i++) {\n\t\t\t\tint start = sc.nextInt();\n\t\t\t\tint end = sc.nextInt();\n\t\t\t\tgraph[start][end] = 1;\n\t\t\t\t// graph[end][start] = 1;\n\t\t\t}\n\n\t\t\tfront = 0;\n\t\t\tstack = new int[V];\n\t\t\tjava.util.Arrays.fill(stack, -1);\n\t\t\tvisited = new int[V];\n\t\t\tfound = false;\n\t\t\tint src = 0;\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tfor (int i = 0; i < V; i++) {\n\t\t\t\t\n\t\t\t\tif(found == false && visited[i] ==0){\n\t\t\t\t\tstack[front++] = i;\n\t\t\t\t\tDFS(graph,i);\n\t\t\t\t}\n\t\t\t\tif(found == true)\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tif(found == true){\n\t\t\t\tSystem.out.println(\"Found\");\n\t\t\t\tfor (int j = 0; j < front; j++) {\n\t\t\t\t\tSystem.out.println(stack[j]);\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tSystem.out.println(\"Not Found\");\n\t\t\t}\n\t\t}\n\t}", "public void doDfsIterative(Graph g, int s) {\n boolean[] myVisited = new boolean[8];\n Stack<Integer> stack = new Stack<>();\n stack.push(s);\n myVisited[s] = true;\n while (!stack.isEmpty()) {\n int top = stack.pop();\n System.out.print(\"[\" + top + \"] \");\n for (int e : g.adj[top]) {\n if (!myVisited[e]) {\n stack.push(e);\n myVisited[e] = true;\n }\n }\n }\n\n }", "public static void main(String[] args) {\n SearchTree search = new SearchTree(new Node(INITIAL_STATE), GOAL_STATE);\n long startTime = System.currentTimeMillis();\n\n search.breadthFirstSearch();\n// search.depthFirstSearch();\n// search.iterativeDeepening(10);\n\n long finishTime = System.currentTimeMillis();\n long totalTime = finishTime - startTime;\n System.out.println(\"\\n[Elapsed time: \" + totalTime + \" milliseconds]\");\n System.out.println(\"========================================================\");\n }", "static void iterativeDfs(Node startingNode) {\n Set<Node> markedAsVisited = new HashSet<>();\n\n // creates a stack for piling up the nodes to visit\n ArrayDeque<Node> toBeVisited = new ArrayDeque<>();\n\n // sets the starting node as to be visited\n toBeVisited.push(startingNode);\n\n // adds the starting node to the set of marked as visited nodes\n markedAsVisited.add(startingNode);\n\n // while there nodes to visit\n while (!toBeVisited.isEmpty()) {\n\n // gets the current node\n Node current = toBeVisited.pop();\n\n // processes the node\n System.out.print(\"Node \" + current.val + \", \");\n\n // loops over the neighbours of the current node\n for (Node neighbour: current.neighbours) {\n\n // if the neighbour has not been already visited\n if (! markedAsVisited.contains(neighbour)) {\n\n // adds the neighbour to the ones to be visited\n toBeVisited.push(neighbour);\n\n // adds the neighbour to the set of marked as visited nodes\n markedAsVisited.add(neighbour);\n }\n }\n }\n }", "public static void main(String[]args) throws Exception{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n\t\tint n = Integer.parseInt(br.readLine());\r\n\t\tint m = Integer.parseInt(br.readLine());\r\n\t\tarr = new int[n+1][n+1];\r\n\t\tvisited = new boolean[n+1];\r\n\t\t\r\n\t\tStringTokenizer st;\r\n\t\tfor(int i=0; i<m; i++) {\r\n\t\t\tst = new StringTokenizer(br.readLine());\r\n\t\t\tint f = Integer.parseInt(st.nextToken());\r\n\t\t\tint b = Integer.parseInt(st.nextToken());\r\n\t\t\tarr[f][b] = 1;\r\n\t\t\tarr[b][f] = 1;\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\tdfs(1);\r\n\t\tSystem.out.println(result);\r\n\t}", "public static void main(String[] args) {\nDGraph g=new DGraph();\r\nDirectedDFS d=new DirectedDFS(g);\r\nfor(Iterator<Integer> i=d.preorder.iterator();i.hasNext();)\r\n{\r\n\tSystem.out.print(i.next()+\" \");\r\n}\r\nSystem.out.println();\r\nfor(Iterator<Integer> i=d.postorder.iterator();i.hasNext();)\r\n{\r\n\tSystem.out.print(i.next()+\" \");\r\n}\r\nSystem.out.println();\r\n\r\n/*for(Iterator i=d.topologicalorder.iterator();i.hasNext();)\r\n{\r\n\tSystem.out.print(i.next()+\" \");\r\n}\r\nSystem.out.println();*/\r\n\r\n\r\n\tfor(int w:d.reversepost())\r\n\t\tSystem.out.print(w+\" \");\r\n\t//System.out.println(d.topologicalorder.pop());\r\n\t}", "@Test\n public void dfsRecursiveTest() {\n Map<String, List<String>> graph = new HashMap<>();\n graph.put(\"A\", Lists.newArrayList(\"B\", \"S\"));\n graph.put(\"B\", Lists.newArrayList(\"A\"));\n graph.put(\"C\", Lists.newArrayList(\"D\", \"E\", \"F\", \"S\"));\n graph.put(\"D\", Lists.newArrayList(\"C\"));\n graph.put(\"E\", Lists.newArrayList(\"C\", \"H\"));\n graph.put(\"F\", Lists.newArrayList(\"C\", \"G\"));\n graph.put(\"G\", Lists.newArrayList(\"F\", \"H\", \"S\"));\n graph.put(\"H\", Lists.newArrayList(\"E\", \"G\"));\n graph.put(\"S\", Lists.newArrayList(\"A\", \"C\", \"G\"));\n\n List<String> traversal = new DFSRecursive().runDFS(\"A\", graph);\n\n Assert.assertEquals(Lists.newArrayList(\"A\", \"B\", \"S\", \"C\", \"D\", \"E\", \"H\", \"G\", \"F\"), traversal);\n }", "private void visitDFS(Dot node, Set< Dot > visited ) {\n\n board.getNeighbors( node ).forEach( nbr -> {\n if ( !visited.contains( nbr ) ) {\n visited.add( nbr );\n visitDFS( nbr, visited );\n }\n } );\n }", "private static void dfs(int x, int y) {\n arr[x][y] = 1;\n area++;\n \n for(int i=0; i<4; i++) {\n int nx = x + dx[i];\n int ny = y + dy[i];\n \n if(0 <= nx && nx < m && 0 <= ny && ny < n) {\n if(arr[nx][ny] == 0)\n dfs(nx, ny);\n }\n }\n\t\t\n\t}", "private static void initTopologicalSortDFS(int V) {\r\n\t\t// // make sure that the given graph is DAG\r\n\t\tprintThis(\"Topological Sort (the input graph must be DAG)\");\r\n\t\ttopoSort = new ArrayList<Integer>();\r\n\t\ttopoSort.clear();\r\n\t\tdfs_num = new int[V];\r\n\t\tArrays.fill(dfs_num, DFS_WHITE);\r\n\r\n\t\tfor (int i = 0; i < V; i++)\r\n\t\t\t// this part is the same as finding CCs\r\n\t\t\tif (dfs_num[i] == DFS_WHITE)\r\n\t\t\t\t// asi se hace todo el topological\r\n\t\t\t\ttopologicalSortDFS(i);\r\n\t\tCollections.reverse(topoSort);\r\n\t\t// reverse topoSort\r\n\t\tfor (int i = 0; i < topoSort.size(); i++)\r\n\t\t\t// or you can simply read\r\n\t\t\tSystem.out.printf(\" %d\", topoSort.get(i));\r\n\t\t// the content of `topoSort' backwards\r\n\t\tSystem.out.printf(\"\\n\");\r\n\t}", "private void dfs(int y, int x, boolean[][] visited, Set<String> results, BoggleBoard board,\n\t\t\tTST.BacktrackTraverser<Integer> bt) {\n\t\tif (bt.hasValue()) {\n\t\t\tString word = appendU(bt.getWord());\n\t\t\tif (bt.getValue() > 0) {\n\t\t\t\tresults.add(word);\n\t\t\t}\n\t\t}\n\n\t\t// Check every unused nearby grid.\n\t\t// Only continue on grid if there's some word down the TST.\n\t\tfor (int[] dir : directions) {\n\t\t\tint[] moved = move(y, x, dir);\n\t\t\tif (!inBound(moved, board)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (visited[moved[0]][moved[1]]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tchar singleLetter = board.getLetter(moved[0], moved[1]);\n\t\t\tif (!bt.hasDown(singleLetter)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tvisited[moved[0]][moved[1]] = true;\n\t\t\tbt.down(singleLetter);\n\t\t\tdfs(moved[0], moved[1], visited, results, board, bt);\n\t\t\tbt.up();\n\t\t\tvisited[moved[0]][moved[1]] = false;\n\t\t}\n\t}", "private void dfs(DigrafoAristaPonderada G, int v) {\n enPila[v] = true;\n marcado[v] = true;\n for (AristaDirigida a : G.ady(v)) {\n int w = a.hacia();\n\n // short circuit if directed ciclo found\n if (ciclo != null) return;\n\n //found new vertex, so recur\n else if (!marcado[w]) {\n aristaHacia[w] = a;\n dfs(G, w);\n }\n\n // trace back directed ciclo\n else if (enPila[w]) {\n ciclo = new Pila<AristaDirigida>();\n while (a.desde() != w) {\n ciclo.push(a);\n a = aristaHacia[a.desde()];\n }\n ciclo.push(a);\n return;\n }\n }\n\n enPila[v] = false;\n }", "public DepthFirstSearch(Graph graph) throws Exception {\n\n this.graph = graph;\n int n = graph.getNumV();\n\n parent = new int[n];\n Arrays.fill( parent , -1);\n\n visited = new boolean[n];\n Arrays.fill( visited , false );\n\n discoveryOrder = new int[n];\n finishOrder = new int[n];\n\n for (int i = 0; i < n; i++) {\n if (!visited[i])\n depthFirstSearch(i);\n }\n\n }", "public void DFS(int current) {\r\n if (vertexList.get(current).isVisited) {\r\n return;\r\n }\r\n visit(current);\r\n int next = nextNeighbour(current);\r\n while (next != -1) {\r\n DFS(next);\r\n next = nextNeighbour(current);\r\n }\r\n }", "public List<Graph> search() {\n\n long start = System.currentTimeMillis();\n TetradLogger.getInstance().log(\"info\", \"Starting ION Search.\");\n logGraphs(\"\\nInitial Pags: \", this.input);\n TetradLogger.getInstance().log(\"info\", \"Transfering local information.\");\n long steps = System.currentTimeMillis();\n\n /*\n * Step 1 - Create the empty graph\n */\n List<Node> varNodes = new ArrayList<>();\n for (String varName : variables) {\n varNodes.add(new GraphNode(varName));\n }\n Graph graph = new EdgeListGraph(varNodes);\n\n /*\n * Step 2 - Transfer local information from the PAGs (adjacencies\n * and edge orientations)\n */\n // transfers edges from each graph and finds definite noncolliders\n transferLocal(graph);\n // adds edges for variables never jointly measured\n for (NodePair pair : nonIntersection(graph)) {\n graph.addEdge(new Edge(pair.getFirst(), pair.getSecond(), Endpoint.CIRCLE, Endpoint.CIRCLE));\n }\n TetradLogger.getInstance().log(\"info\", \"Steps 1-2: \" + (System.currentTimeMillis() - steps) / 1000. + \"s\");\n System.out.println(\"step2\");\n System.out.println(graph);\n\n /*\n * Step 3\n *\n * Branch and prune step that blocks problematic undirectedPaths, possibly d-connecting undirectedPaths\n */\n steps = System.currentTimeMillis();\n Queue<Graph> searchPags = new LinkedList<>();\n // place graph constructed in step 2 into the queue\n searchPags.offer(graph);\n // get d-separations and d-connections\n List<Set<IonIndependenceFacts>> sepAndAssoc = findSepAndAssoc(graph);\n this.separations = sepAndAssoc.get(0);\n this.associations = sepAndAssoc.get(1);\n Map<Collection<Node>, List<PossibleDConnectingPath>> paths;\n// Queue<Graph> step3PagsSet = new LinkedList<Graph>();\n HashSet<Graph> step3PagsSet = new HashSet<>();\n Set<Graph> reject = new HashSet<>();\n // if no d-separations, nothing left to search\n if (separations.isEmpty()) {\n // makes orientations preventing definite noncolliders from becoming colliders\n // do final orientations\n// doFinalOrientation(graph);\n step3PagsSet.add(graph);\n }\n // sets length to iterate once if search over path lengths not enabled, otherwise set to 2\n int numNodes = graph.getNumNodes();\n int pl = numNodes - 1;\n if (pathLengthSearch) {\n pl = 2;\n }\n // iterates over path length, then adjacencies\n for (int l = pl; l < numNodes; l++) {\n if (pathLengthSearch) {\n TetradLogger.getInstance().log(\"info\", \"Braching over path lengths: \" + l + \" of \" + (numNodes - 1));\n }\n int seps = separations.size();\n int currentSep = 1;\n int numAdjacencies = separations.size();\n for (IonIndependenceFacts fact : separations) {\n if (adjacencySearch) {\n TetradLogger.getInstance().log(\"info\", \"Braching over path nonadjacencies: \" + currentSep + \" of \" + numAdjacencies);\n }\n seps--;\n // uses two queues to keep up with which PAGs are being iterated and which have been\n // accepted to be iterated over in the next iteration of the above for loop\n searchPags.addAll(step3PagsSet);\n recGraphs.add(searchPags.size());\n step3PagsSet.clear();\n while (!searchPags.isEmpty()) {\n System.out.println(\"ION Step 3 size: \" + searchPags.size());\n double currentUsage = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();\n if (currentUsage > maxMemory) maxMemory = currentUsage;\n // deques first PAG from searchPags\n Graph pag = searchPags.poll();\n // Part 3.a - finds possibly d-connecting undirectedPaths between each pair of nodes\n // known to be d-separated\n List<PossibleDConnectingPath> dConnections = new ArrayList<>();\n // checks to see if looping over adjacencies\n if (adjacencySearch) {\n for (Collection<Node> conditions : fact.getZ()) {\n // checks to see if looping over path lengths\n if (pathLengthSearch) {\n dConnections.addAll(PossibleDConnectingPath.findDConnectingPathsOfLength\n (pag, fact.getX(), fact.getY(), conditions, l));\n } else {\n dConnections.addAll(PossibleDConnectingPath.findDConnectingPaths\n (pag, fact.getX(), fact.getY(), conditions));\n }\n }\n } else {\n for (IonIndependenceFacts allfact : separations) {\n for (Collection<Node> conditions : allfact.getZ()) {\n // checks to see if looping over path lengths\n if (pathLengthSearch) {\n dConnections.addAll(PossibleDConnectingPath.findDConnectingPathsOfLength\n (pag, allfact.getX(), allfact.getY(), conditions, l));\n } else {\n dConnections.addAll(PossibleDConnectingPath.findDConnectingPaths\n (pag, allfact.getX(), allfact.getY(), conditions));\n }\n }\n }\n }\n // accept PAG go to next PAG if no possibly d-connecting undirectedPaths\n if (dConnections.isEmpty()) {\n// doFinalOrientation(pag);\n// Graph p = screenForKnowledge(pag);\n// if (p != null) step3PagsSet.add(p);\n step3PagsSet.add(pag);\n continue;\n }\n // maps conditioning sets to list of possibly d-connecting undirectedPaths\n paths = new HashMap<>();\n for (PossibleDConnectingPath path : dConnections) {\n List<PossibleDConnectingPath> p = paths.get(path.getConditions());\n if (p == null) {\n p = new LinkedList<>();\n }\n p.add(path);\n paths.put(path.getConditions(), p);\n }\n // Part 3.b - finds minimal graphical changes to block possibly d-connecting undirectedPaths\n List<Set<GraphChange>> possibleChanges = new ArrayList<>();\n for (Set<GraphChange> changes : findChanges(paths)) {\n Set<GraphChange> newChanges = new HashSet<>();\n for (GraphChange gc : changes) {\n boolean okay = true;\n for (Triple collider : gc.getColliders()) {\n\n if (pag.isUnderlineTriple(collider.getX(), collider.getY(), collider.getZ())) {\n okay = false;\n break;\n }\n\n }\n if (!okay) {\n continue;\n }\n for (Triple collider : gc.getNoncolliders()) {\n if (pag.isDefCollider(collider.getX(), collider.getY(), collider.getZ())) {\n okay = false;\n break;\n }\n }\n if (okay) {\n newChanges.add(gc);\n }\n }\n if (!newChanges.isEmpty()) {\n possibleChanges.add(newChanges);\n } else {\n possibleChanges.clear();\n break;\n }\n }\n float starthitset = System.currentTimeMillis();\n Collection<GraphChange> hittingSets = IonHittingSet.findHittingSet(possibleChanges);\n recHitTimes.add((System.currentTimeMillis() - starthitset) / 1000.);\n // Part 3.c - checks the newly constructed graphs from 3.b and rejects those that\n // cycles or produce independencies known not to occur from the input PAGs or\n // include undirectedPaths from definite nonancestors\n for (GraphChange gc : hittingSets) {\n boolean badhittingset = false;\n for (Edge edge : gc.getRemoves()) {\n Node node1 = edge.getNode1();\n Node node2 = edge.getNode2();\n Set<Triple> triples = new HashSet<>();\n triples.addAll(gc.getColliders());\n triples.addAll(gc.getNoncolliders());\n if (triples.size() != (gc.getColliders().size() + gc.getNoncolliders().size())) {\n badhittingset = true;\n break;\n }\n for (Triple triple : triples) {\n if (node1.equals(triple.getY())) {\n if (node2.equals(triple.getX()) ||\n node2.equals(triple.getZ())) {\n badhittingset = true;\n break;\n }\n }\n if (node2.equals(triple.getY())) {\n if (node1.equals(triple.getX()) ||\n node1.equals(triple.getZ())) {\n badhittingset = true;\n break;\n }\n }\n }\n if (badhittingset) {\n break;\n }\n for (NodePair pair : gc.getOrients()) {\n if ((node1.equals(pair.getFirst()) && node2.equals(pair.getSecond())) ||\n (node2.equals(pair.getFirst()) && node1.equals(pair.getSecond()))) {\n badhittingset = true;\n break;\n }\n }\n if (badhittingset) {\n break;\n }\n }\n if (!badhittingset) {\n for (NodePair pair : gc.getOrients()) {\n for (Triple triple : gc.getNoncolliders()) {\n if (pair.getSecond().equals(triple.getY())) {\n if (pair.getFirst().equals(triple.getX()) &&\n pag.getEndpoint(triple.getZ(), triple.getY()).equals(Endpoint.ARROW)) {\n badhittingset = true;\n break;\n\n }\n if (pair.getFirst().equals(triple.getZ()) &&\n pag.getEndpoint(triple.getX(), triple.getY()).equals(Endpoint.ARROW)) {\n badhittingset = true;\n break;\n }\n }\n if (badhittingset) {\n break;\n }\n }\n if (badhittingset) {\n break;\n }\n }\n }\n if (badhittingset) {\n continue;\n }\n Graph changed = gc.applyTo(pag);\n // if graph change has already been rejected move on to next graph\n if (reject.contains(changed)) {\n continue;\n }\n // if graph change has already been accepted move on to next graph\n if (step3PagsSet.contains(changed)) {\n continue;\n }\n // reject if null, predicts false independencies or has cycle\n if (predictsFalseIndependence(associations, changed)\n || changed.existsDirectedCycle()) {\n reject.add(changed);\n }\n // makes orientations preventing definite noncolliders from becoming colliders\n // do final orientations\n// doFinalOrientation(changed);\n // now add graph to queue\n\n// Graph p = screenForKnowledge(changed);\n// if (p != null) step3PagsSet.add(p);\n step3PagsSet.add(changed);\n }\n }\n // exits loop if not looping over adjacencies\n if (!adjacencySearch) {\n break;\n }\n }\n }\n TetradLogger.getInstance().log(\"info\", \"Step 3: \" + (System.currentTimeMillis() - steps) / 1000. + \"s\");\n Queue<Graph> step3Pags = new LinkedList<>(step3PagsSet);\n\n /*\n * Step 4\n *\n * Finds redundant undirectedPaths and uses this information to expand the list\n * of possible graphs\n */\n steps = System.currentTimeMillis();\n Map<Edge, Boolean> necEdges;\n Set<Graph> outputPags = new HashSet<>();\n\n while (!step3Pags.isEmpty()) {\n Graph pag = step3Pags.poll();\n necEdges = new HashMap<>();\n // Step 4.a - if x and y are known to be unconditionally associated and there is\n // exactly one trek between them, mark each edge on that trek as necessary and\n // make the tiples on the trek definite noncolliders\n // initially mark each edge as not necessary\n for (Edge edge : pag.getEdges()) {\n necEdges.put(edge, false);\n }\n // look for unconditional associations\n for (IonIndependenceFacts fact : associations) {\n for (List<Node> nodes : fact.getZ()) {\n if (nodes.isEmpty()) {\n List<List<Node>> treks = treks(pag, fact.x, fact.y);\n if (treks.size() == 1) {\n List<Node> trek = treks.get(0);\n List<Triple> triples = new ArrayList<>();\n for (int i = 1; i < trek.size(); i++) {\n // marks each edge in trek as necessary\n necEdges.put(pag.getEdge(trek.get(i - 1), trek.get(i)), true);\n if (i == 1) {\n continue;\n }\n // makes each triple a noncollider\n pag.addUnderlineTriple(trek.get(i - 2), trek.get(i - 1), trek.get(i));\n }\n }\n // stop looping once the empty set is found\n break;\n }\n }\n }\n // Part 4.b - branches by generating graphs for every combination of removing\n // redundant undirectedPaths\n boolean elimTreks;\n // checks to see if removing redundant undirectedPaths eliminates every trek between\n // two variables known to be nconditionally assoicated\n List<Graph> possRemovePags = possRemove(pag, necEdges);\n double currentUsage = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();\n if (currentUsage > maxMemory) maxMemory = currentUsage;\n for (Graph newPag : possRemovePags) {\n elimTreks = false;\n // looks for unconditional associations\n for (IonIndependenceFacts fact : associations) {\n for (List<Node> nodes : fact.getZ()) {\n if (nodes.isEmpty()) {\n if (treks(newPag, fact.x, fact.y).isEmpty()) {\n elimTreks = true;\n }\n // stop looping once the empty set is found\n break;\n }\n }\n }\n // add new PAG to output unless a necessary trek has been eliminated\n if (!elimTreks) {\n outputPags.add(newPag);\n }\n }\n }\n outputPags = removeMoreSpecific(outputPags);\n// outputPags = applyKnowledge(outputPags);\n\n TetradLogger.getInstance().log(\"info\", \"Step 4: \" + (System.currentTimeMillis() - steps) / 1000. + \"s\");\n\n /*\n * Step 5\n *\n * Generate the Markov equivalence classes for graphs and accept only\n * those that do not predict false d-separations\n */\n steps = System.currentTimeMillis();\n Set<Graph> outputSet = new HashSet<>();\n for (Graph pag : outputPags) {\n Set<Triple> unshieldedPossibleColliders = new HashSet<>();\n for (Triple triple : getPossibleTriples(pag)) {\n if (!pag.isAdjacentTo(triple.getX(), triple.getZ())) {\n unshieldedPossibleColliders.add(triple);\n }\n }\n\n PowerSet<Triple> pset = new PowerSet<>(unshieldedPossibleColliders);\n for (Set<Triple> set : pset) {\n Graph newGraph = new EdgeListGraph(pag);\n for (Triple triple : set) {\n newGraph.setEndpoint(triple.getX(), triple.getY(), Endpoint.ARROW);\n newGraph.setEndpoint(triple.getZ(), triple.getY(), Endpoint.ARROW);\n }\n doFinalOrientation(newGraph);\n }\n for (Graph outputPag : finalResult) {\n if (!predictsFalseIndependence(associations, outputPag)) {\n Set<Triple> underlineTriples = new HashSet<>(outputPag.getUnderLines());\n for (Triple triple : underlineTriples) {\n outputPag.removeUnderlineTriple(triple.getX(), triple.getY(), triple.getZ());\n }\n outputSet.add(outputPag);\n }\n }\n }\n\n// outputSet = applyKnowledge(outputSet);\n outputSet = checkPaths(outputSet);\n\n output.addAll(outputSet);\n TetradLogger.getInstance().log(\"info\", \"Step 5: \" + (System.currentTimeMillis() - steps) / 1000. + \"s\");\n runtime = ((System.currentTimeMillis() - start) / 1000.);\n logGraphs(\"\\nReturning output (\" + output.size() + \" Graphs):\", output);\n double currentUsage = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();\n if (currentUsage > maxMemory) maxMemory = currentUsage;\n return output;\n }", "private void DFSUtil(graph copy,node_data n) {\n\t\tn.setTag(1);\n\t\tCollection<edge_data> temp = copy.getE(n.getKey());\n\t\tif (temp != null) {\n\t\t\tfor (edge_data edge : temp) {\n\t\t\t\tif (copy.getNode(edge.getDest()) != null && copy.getE(edge.getDest()) != null && copy.getNode(edge.getDest()).getTag() == 0) {\n\t\t\t\t\tDFSUtil(copy,copy.getNode(edge.getDest()));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}" ]
[ "0.76480645", "0.75557256", "0.7514414", "0.75062317", "0.7277212", "0.722608", "0.71571517", "0.7138194", "0.70538133", "0.70303774", "0.70216507", "0.69316167", "0.6903866", "0.6777672", "0.6751997", "0.666118", "0.6642507", "0.66257745", "0.66136944", "0.6573592", "0.6553742", "0.6490299", "0.6486661", "0.64843905", "0.6421139", "0.64176893", "0.6415082", "0.6414339", "0.6409833", "0.6392282", "0.63917553", "0.63909006", "0.63859344", "0.6368357", "0.6365523", "0.63288003", "0.63187116", "0.63016355", "0.629122", "0.626981", "0.6264088", "0.6243234", "0.6242771", "0.6225692", "0.6222645", "0.6218422", "0.6213417", "0.62085396", "0.620829", "0.6206026", "0.620104", "0.61991847", "0.619887", "0.61966085", "0.619219", "0.6186088", "0.6184306", "0.6177821", "0.6161032", "0.61573994", "0.61543983", "0.6148236", "0.6147814", "0.61474466", "0.61404324", "0.61388874", "0.6126991", "0.6126839", "0.6119121", "0.6112212", "0.610974", "0.61091924", "0.6103688", "0.6097381", "0.609469", "0.608696", "0.60832524", "0.6070563", "0.6066946", "0.6034068", "0.60292995", "0.6028764", "0.59892863", "0.598253", "0.5975264", "0.59737855", "0.59701514", "0.5964948", "0.59642196", "0.59608155", "0.5945742", "0.5942332", "0.593592", "0.59311056", "0.5930674", "0.5907694", "0.5904561", "0.5897388", "0.5894465", "0.58826244", "0.5875073" ]
0.0
-1
need a function that returns. So that some states can cancel out and thus no stackoverflow.
private void DepthFirstSearch(Node current){ helperDFS( current ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public Boolean call() throws Exception {\n return this.state22();\n }", "protected abstract List breakOutOfStateStack();", "private Object getState() {\n\treturn null;\r\n}", "private static int runStateOf(int c) { return c & ~CAPACITY; }", "public E pollBack();", "@Override\n\tpublic void returncode(int statecode) {\n\n\t}", "CalculationResult goInfinite();", "@Override\r\n public FlowState call() {\r\n // TODO: We should not need? to pass the flowState because this flow is already known (reapplying same values???)\r\n FlowState flowState = getFlowState();\r\n if ( flowState == null ) {\r\n throw new FlowException(\"No flowState with id:\", getExistingFlowStateLookupKey());\r\n } else {\r\n return getFlowManagementWithCheck().continueFlowState(getExistingFlowStateLookupKey(), true, this.getInitialFlowState());\r\n }\r\n }", "OperationalState operationalState();", "OperationalState operationalState();", "public boolean get_return(){\n return local_return;\n }", "private void cancelHeavyLifting()\n {\n }", "public boolean c()\r\n/* 36: */ {\r\n/* 37:51 */ return false;\r\n/* 38: */ }", "State getState();", "State getState();", "State getState();", "State getState();", "void checkReturnSt (int ln) {\r\n if (!return_type.isVoid ())\r\n OzcError.needReturnSt (ln);\r\n else \r\n need_return = true;\r\n }", "boolean test() {\n return false; // REPLACE WITH SOLUTION\n }", "void mo15871a(StateT statet);", "public void cancel() {\n/* 170 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "@Override\n\tpublic void stateMachineAbort() {\n\t}", "@Override\n\tpublic void stateMachineAbort() {\n\n\t}", "@Override\n\tpublic void stateMachineAbort() {\n\n\t}", "@Override\n\tpublic void stateMachineAbort() {\n\n\t}", "@Override\n\tpublic void stateMachineAbort() {\n\n\t}", "Object getState();", "void markReturning();", "private static <TResult> TResult m832b(C0741g<TResult> gVar) {\n if (gVar.mo9481b()) {\n return gVar.mo9483d();\n }\n if (gVar.mo9482c()) {\n throw new CancellationException(\"Task is already canceled\");\n }\n throw new ExecutionException(gVar.mo9484e());\n }", "@FunctionalInterface\npublic interface HasBeenCancelledFactory extends Function<WebContext, Boolean> {\n}", "public void cancelMethod1(){\n return;\n\n }", "static void ret() {\n\t\tcurColor = callStack[--size];\n\t}", "public void returningToTrue(){\n Closure enclosingFunction = findEnclosingFunction();\n if (enclosingFunction != null){\n Closure currentClosure = this;\n while (currentClosure != enclosingFunction){\n if (!currentClosure.isReturning()){\n currentClosure.returning = true;\n }\n currentClosure = currentClosure.getParent();\n }\n enclosingFunction.returning = true;\n }\n }", "StateT getState();", "public boolean isLegOut()\n{\n if (jumpState == 1)\n return true;\n return false;\n}", "public boolean isInterruptible() {\n/* 31 */ return true;\n/* */ }", "public boolean c()\r\n/* 56: */ {\r\n/* 57: 77 */ return false;\r\n/* 58: */ }", "int remains();", "int getStateValue2();", "private static Map popFromStack(SessionState state)\n\t{\n\t\tMap current_stack_frame = null;\n\t\tStack operations_stack = (Stack) state.getAttribute(STATE_SUSPENDED_OPERATIONS_STACK);\n\t\tif(operations_stack == null)\n\t\t{\n\t\t\toperations_stack = new Stack();\n\t\t\tstate.setAttribute(STATE_SUSPENDED_OPERATIONS_STACK, operations_stack);\n\t\t}\n\t\tif(! operations_stack.isEmpty())\n\t\t{\n\t\t\tcurrent_stack_frame = (Map) operations_stack.pop();\n\t\t\tif(operations_stack.isEmpty())\n\t\t\t{\n\t\t\t\tString canceled = (String) current_stack_frame.get(STATE_HELPER_CANCELED_BY_USER);\n\t\t\t\tif(canceled != null)\n\t\t\t\t{\n\t\t\t\t\tstate.setAttribute(STATE_HELPER_CANCELED_BY_USER, canceled);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn current_stack_frame;\n\n\t}", "public void popState();", "abstract public boolean RequestToExit(Object fromHere);", "public void noReturnOnVoid() {\n\t\treturn;\n\t}", "public void excavate();", "protected int handlePrevious(int position) {\n/* 289 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "@SuppressWarnings(\"resource\")\n\tpublic synchronized void advance() {\n\t\t/*\n\t\t * Do not advance the state machine if it is still valid. This is a convenience to application code\n\t\t * that can now try to advance the state machine redundantly without it getting costly.\n\t\t * \n\t\t * Here we have to be careful. We cannot just read valid() flag as that would create reactive dependency\n\t\t * that would be invalidated a few lines below when the valid() flag is set to true.\n\t\t * Such immediate invalidation would force another controlling (outer) reactive computation to run immediately after the current one ends.\n\t\t * While such overhead is common in reactive code and it is usually acceptable, it can be very wasteful here in some important use cases,\n\t\t * for example in ReactiveLazy where it would double compute cost of all reactive computations that read new/changed ReactiveLazy.\n\t\t *\n\t\t * We cannot just check for non-null trigger either as that would make the check completely non-reactive.\n\t\t * The controlling (outer) computation wouldn't run again when the state is invalidated and advancement would stop forever.\n\t\t *\n\t\t * Instead of creating dependency on the full valid() flag, we will reactively depend only on trigger state.\n\t\t * The difference is that trigger state only tracks validity of the last controlled (inner) computation\n\t\t * while the valid() flag tracks all current and future state of the whole reactive state machine.\n\t\t * Trigger state can change only in one direction from not fired to fired while valid() changes both ways.\n\t\t * This reduction in the scope of the dependency is sufficient to avoid redundant reactive computations\n\t\t * while keeping the dependency wide enough to ensure the state machine appears to be fully reactive.\n\t\t * \n\t\t * Trigger itself is of course non-reactive, because it is a low-level reactive primitive.\n\t\t * So how do we depend on its state? We will read valid() flag but only after we have already set it to true.\n\t\t * This breaks the basic principle of reactive programming that dependencies are recorded before reads,\n\t\t * but it is safe here, because it is equivalent to a scenario, in which another thread advances the state machine\n\t\t * and the current thread executed shortly afterwards, reads the valid() flag (which is true), and returns without advancing.\n\t\t * \n\t\t * This solution is so efficient that a lot of code can just blindly advance all the time without ever checking valid().\n\t\t * This may be actually more performant thanks to the reduced dependency optimization.\n\t\t */\n\t\tif (trigger != null) {\n\t\t\t/*\n\t\t\t * If the trigger is non-null, then valid() is true and we can just return without advancing.\n\t\t\t * We will record dependency on valid() to ensure that the controlling (outer) computation\n\t\t\t * tries to advance the state machine again when valid() becomes false.\n\t\t\t */\n\t\t\tvalid.get();\n\t\t\treturn;\n\t\t}\n\t\tReactiveScope scope = OwnerTrace.of(new ReactiveScope())\n\t\t\t.parent(this)\n\t\t\t.target();\n\t\tif (pins != null)\n\t\t\tscope.pins(pins);\n\t\tpins = null;\n\t\ttry (CloseableScope computation = scope.enter()) {\n\t\t\tReactiveValue<T> value = ReactiveValue.capture(supplier);\n\t\t\t/*\n\t\t\t * We will be sending two invalidations to the controlling reactive computation.\n\t\t\t * We will first discourage redundant advancement by setting valid() to true.\n\t\t\t * Only then we set the output. This prevents unnecessary attempts to advance the state machine.\n\t\t\t */\n\t\t\tvalid.set(true);\n\t\t\toutput.value(value);\n\t\t}\n\t\t/*\n\t\t * As mentioned above, we will create dependency on valid() to ensure the controlling (outer) computation\n\t\t * tries to advance again when the current state is invalidated, i.e. when valid() is set to false.\n\t\t * We have to do this after setting valid() to true above to avoid immediately invalidating current computation.\n\t\t * We also have to do it before arming the trigger, because trigger could fire immediately (inline)\n\t\t * and such firing involves setting valid() to false, by which time the dependency on valid() must already exist.\n\t\t * We have to be additionally careful not to create the dependency inside the controlled (inner) computation.\n\t\t */\n\t\tvalid.get();\n\t\tif (scope.blocked())\n\t\t\tpins = scope.pins();\n\t\ttrigger = OwnerTrace\n\t\t\t.of(new ReactiveTrigger()\n\t\t\t\t.callback(this::invalidate))\n\t\t\t.parent(this)\n\t\t\t.target();\n\t\t/*\n\t\t * Arming the trigger can cause it to fire immediately.\n\t\t * We don't worry about that, because our invalidation callback is very fast and non-conflicting.\n\t\t */\n\t\ttrigger.arm(scope.versions());\n\t}", "public boolean eliminateLoop(){ return false; }", "int getState();", "int getState();", "int getState();", "int getState();", "int getState();", "int getState();", "public boolean checkExplosiveState () { return isExploding;}", "@Override\n\tprotected Object run() {\n\t\treturn null;\n\t}", "public State state();", "public void doSomething(){\n return;\n }", "void nextState();", "public boolean willNotBeResurrected() {\n return state == State.FRESH || state == State.ERROR;\n }", "@Override\n public TurnState getNextState() { return new Finalize(); }", "@Override\n protected BDDState handleFunctionReturnEdge(\n CFunctionReturnEdge cfaEdge, CFunctionCall summaryExpr, String outerFunctionName) {\n BDDState newState = state;\n\n // set result of function equal to variable on left side\n final Partition partition = varClass.getPartitionForEdge(cfaEdge);\n\n // handle assignments like \"y = f(x);\"\n if (summaryExpr instanceof CFunctionCallAssignmentStatement) {\n final String returnVar =\n cfaEdge.getFunctionEntry().getReturnVariable().orElseThrow().getQualifiedName();\n CFunctionCallAssignmentStatement cAssignment = (CFunctionCallAssignmentStatement) summaryExpr;\n CExpression lhs = cAssignment.getLeftHandSide();\n final int size = bvComputer.getBitsize(partition, lhs.getExpressionType());\n\n // make variable (predicate) for LEFT SIDE of assignment,\n // delete variable, if it was used before, this is done with an existential operator\n final Region[] var =\n predmgr.createPredicate(\n scopeVar(lhs), lhs.getExpressionType(), cfaEdge.getSuccessor(), size, precision);\n newState = newState.forget(var);\n\n // make region (predicate) for RIGHT SIDE\n final Region[] retVar =\n predmgr.createPredicate(\n returnVar,\n summaryExpr.getFunctionCallExpression().getExpressionType(),\n cfaEdge.getSuccessor(),\n size,\n precision);\n newState = newState.addAssignment(var, retVar);\n\n // remove returnVar from state,\n // all other function-variables were removed earlier (see handleReturnStatementEdge()).\n // --> now the state does not contain any variable from scope of called function.\n if (predmgr.getTrackedVars().contains(returnVar)) {\n newState = newState.forget(predmgr.createPredicateWithoutPrecisionCheck(returnVar));\n }\n\n } else {\n assert summaryExpr instanceof CFunctionCallStatement; // no assignment, nothing to do\n }\n\n return newState;\n }", "public boolean finish() {\n/* 465 */ return finish(false);\n/* */ }", "public Object call() throws Exception{\n return null;\n }", "public abstract MachineState getInitialState();", "protected S state() {\n return state;\n }", "State takeAction(State state);", "public boolean isCancellable()\r\n/* 64: */ {\r\n/* 65:101 */ return this.result == null;\r\n/* 66: */ }", "void cancel();", "void cancel();", "void cancel();", "void cancel();", "void cancel();", "@Override\n // TODO implement call() for expert mode using minimax\n public Integer call() throws Exception {\n Integer val = 0;\n Thread.sleep(150);\n return val;\n }", "S getInitialState();", "public abstract boolean esComestible();", "public int get_return(){\r\n return local_return;\r\n }", "public boolean isVoid()\r\n/* 146: */ {\r\n/* 147:177 */ return false;\r\n/* 148: */ }", "@Override\n public AbstractState getWrappedState() {\n return null;\n }", "void cancelProduction();", "PowerState getState();", "public void onRestorePendingState() {\n }", "@Override\n\tpublic void comeBackToWork() {\n\t\t\n\t}", "Object completeExternalFunctionEvaluation() {\n\t\tRTObject returnedObj = null;\r\n\t\twhile (evaluationStack.size() > originalEvaluationStackHeight) {\r\n\t\t\tRTObject poppedObj = popEvaluationStack();\r\n\t\t\tif (returnedObj == null)\r\n\t\t\t\treturnedObj = poppedObj;\r\n\t\t}\r\n\r\n\t\t// Restore our own state\r\n\t\tcallStack = originalCallstack;\r\n\t\toriginalCallstack = null;\r\n\t\toriginalEvaluationStackHeight = 0;\r\n\t\t\r\n\t\t// Restore the callstack that the variablesState uses\r\n\t\tvariablesState.setCallStack(callStack);\r\n\r\n\t\t// What did we get back?\r\n\t\tif (returnedObj != null) {\r\n\t\t\tif (returnedObj instanceof Void)\r\n\t\t\t\treturn null;\r\n\r\n\t\t\t// Some kind of value, if not void\r\n\t\t\tValue<?> returnVal = null;\r\n\r\n\t\t\tif (returnedObj instanceof Value)\r\n\t\t\t\treturnVal = (Value<?>) returnedObj;\r\n\r\n\t\t\t// DivertTargets get returned as the string of components\r\n\t\t\t// (rather than a Path, which isn't public)\r\n\t\t\tif (returnVal.getValueType() == ValueType.DivertTarget) {\r\n\t\t\t\treturn returnVal.getValueObject().toString();\r\n\t\t\t}\r\n\r\n\t\t\t// Other types can just have their exact object type:\r\n\t\t\t// int, float, string. VariablePointers get returned as strings.\r\n\t\t\treturn returnVal.getValueObject();\r\n\t\t}\r\n\r\n\t\treturn null;\r\n\t}", "long getStateChange();", "final boolean init_stacks()\r\n{\r\n stateptr = -1;\r\n val_init();\r\n return true;\r\n}", "public boolean isJumping(){\n if (jumpState == 2)\n return true;\n return false;\n\n}", "void beforeState();", "private static boolean isDone0(Object result)\r\n/* 74: */ {\r\n/* 75:110 */ return (result != null) && (result != UNCANCELLABLE);\r\n/* 76: */ }", "public abstract boolean cancel();", "@Override\n\tpublic <R> R traceExit(R result) {\n\t\treturn null;\n\t}", "protected String doVerifyState() {\n\t\treturn null;\n\t}", "public boolean b()\r\n {\r\n return false;\r\n }", "int getStateValue1();", "@Override\r\n\tpublic boolean voidIt() {\n\t\treturn false;\r\n\t}", "int getStateValue();", "int getStateValue();", "int getStateValue();", "public abstract boolean cancelable();", "LabState state();", "public boolean nextState() {\n\t\treturn false;\n\t}", "@Override\r\n public Serializable createStaticState() {\r\n return this.m_func.createStaticState();\r\n }" ]
[ "0.6374901", "0.6343056", "0.6179897", "0.59843194", "0.5812559", "0.5794001", "0.57540935", "0.5715684", "0.57061565", "0.57061565", "0.5623487", "0.5617053", "0.5574859", "0.5499765", "0.5499765", "0.5499765", "0.5499765", "0.548147", "0.5471886", "0.5469918", "0.5456608", "0.5456435", "0.5452493", "0.5452493", "0.5452493", "0.5452493", "0.5426839", "0.54211867", "0.5417564", "0.54173183", "0.54099387", "0.54043025", "0.53974193", "0.5385345", "0.53843915", "0.5383661", "0.53828746", "0.5382659", "0.53611183", "0.5358387", "0.53503025", "0.5339883", "0.5330812", "0.5327506", "0.5327442", "0.5327405", "0.532634", "0.53196543", "0.53196543", "0.53196543", "0.53196543", "0.53196543", "0.53196543", "0.53192544", "0.5316764", "0.5316175", "0.53070676", "0.5300255", "0.52991897", "0.5258898", "0.52541596", "0.5240589", "0.5235181", "0.52327085", "0.52290654", "0.5223655", "0.52172345", "0.52150244", "0.52150244", "0.52150244", "0.52150244", "0.52150244", "0.5213765", "0.52117455", "0.5200029", "0.5195332", "0.5195095", "0.51913697", "0.518827", "0.5186323", "0.5180747", "0.5179844", "0.5177969", "0.5176007", "0.5166894", "0.5157766", "0.51562643", "0.5155228", "0.5146983", "0.5144682", "0.5134074", "0.5132542", "0.5127287", "0.51227856", "0.5122682", "0.5122682", "0.5122682", "0.51208115", "0.5117033", "0.5115688", "0.5113211" ]
0.0
-1
sets the heuristic of the node passed.
private void heuristicSetter(Node node){ int goalNodeFirstDigit = Integer.parseInt(goalNode.getDigit().getFirst_digit()); int goalNodeSecondDigit = Integer.parseInt(goalNode.getDigit().getSecond_digit()); int goalNodeThirdDigit = Integer.parseInt(goalNode.getDigit().getThird_digit()); int nodeFirstDigit = Integer.parseInt(node.getDigit().getFirst_digit()); int nodeSecondDigit = Integer.parseInt(node.getDigit().getSecond_digit()); int nodeThirdDigit = Integer.parseInt(node.getDigit().getThird_digit()); int heuristic = Math.abs(goalNodeFirstDigit - nodeFirstDigit)+ Math.abs(goalNodeSecondDigit - nodeSecondDigit)+ Math.abs(goalNodeThirdDigit - nodeThirdDigit); node.setHeuristic(heuristic); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setHeuristic(int heuristic) {\n\t\tthis.heuristic = heuristic;\n\t}", "public void setAStarHeuristic(AStarHeuristic heuristic)\n\t{\n\t\t_estimator = heuristic;\n\t}", "public void setHeuristic(int h) {\n\t\t\tthis.heuristique = h;\n\t\t}", "public void setHeuristics(Heuristic h,Heuristic totalFunction){\n\t\t_h = h;\n\t\t_totalFunction = totalFunction;\n\t}", "void setNode(String path, Node node)\n throws ProcessingException;", "public void setH(Node destination){\n\t\t\n\t\th=calculateH(destination);\n\t}", "public Node(Coordinate coordinate, int heuristic) {\n\t\tthis.coordinate = coordinate;\n\t\tthis.heuristic = heuristic;\n\t\tthis.next = null;\n\t}", "@PortedFrom(file = \"Taxonomy.h\", name = \"setVisited\")\n public void setVisited(TaxonomyVertex node) {\n node.setChecked(visitedLabel);\n }", "void setNode(int nodeId, double lat, double lon);", "public abstract void setNodes();", "private void setNode(DefaultMutableTreeNode node){\n\t\t\n\t\tthis.node = node;\n\t\t\n\t}", "void setNode(int nodeId, double lat, double lon, double ele);", "public void changingNeighbor() {\n }", "public boolean setHeauristics(String s) {\n if (s.equals(\"error\")) {\n JOptionPane.showMessageDialog(this, \"Select heuristic!\", \"error\", JOptionPane.ERROR_MESSAGE);\n return false;\n }\n Square finish = getStartOrFinish('f');\n Vertex finishVertex = new Vertex(finish.getXcoor(), finish.getYcoor());\n finish.setV(finishVertex);\n for (Square[] square : squares) {\n for (Square square1 : square) {\n if (square1 != finish) {\n square1.setV(new Vertex(square1.getXcoor(), square1.getYcoor(), s, finishVertex));\n }\n }\n }\n return true;\n }", "public void setNeighbor(Directions dir, Field neighbor){\n neighbors[dir.ordinal()] = neighbor;\n }", "public void setCorrespondingNode(MinesNode node) {\r\n\t\tcorrespondingNode = node;\r\n\t}", "private final void setShortestDistance(_Node node, int distance)\r\n {\r\n unsettledNodes.remove(node);\r\n shortestDistances.put(node, distance);\r\n\t\tunsettledNodes.add(node); \r\n }", "void setMaze(IMaze maze);", "public void sethVal(Node goal, int heuristic){\n switch (heuristic){\n case 0: //Euclidean distance\n case 4:\n System.out.println(\"Euclidean distance\");\n euclidean(goal, heuristic);\n break;\n case 1: //Manhattan\n System.out.println(\"Manhattan distance\");\n manhattan(goal);\n break;\n case 2:\n case 3:\n diagonal(goal, heuristic);\n break;\n }\n }", "public void setNode(ResidentNode node) {\r\n\t\tthis.node = node;\r\n//\t\tif (this.node != null && this.node.getMFrag() != null) {\r\n//\t\t\tthis.mebn = this.node.getMFrag().getMultiEntityBayesianNetwork();\r\n//\t\t}\r\n\t}", "public void setGT(TreeNode node)\r\n\t\t{\r\n\t\t\tthis.gThan = node;\r\n\t\t}", "void setBestIncoming(E edge);", "public Node setTopNode(Node node);", "public boolean setWeightsAndHeuristics(String s) {\n if (s.equals(\"error\")) {\n JOptionPane.showMessageDialog(this, \"Select heuristic!\", \"error\", JOptionPane.ERROR_MESSAGE);\n return false;\n }\n Square finish = getStartOrFinish('f');\n Vertex finishVertex = new Vertex(finish.getXcoor(), finish.getYcoor(), 0, s, finish.getV());\n finish.setV(finishVertex);\n for (Square[] square : squares) {\n for (Square q : square) {\n int i = 1;\n try {\n i = Integer.parseInt(q.getText());\n } catch (NumberFormatException e) {\n }\n if (q != finish) {\n q.setV(new Vertex(q.getXcoor(), q.getYcoor(), i, s, finishVertex));\n }\n }\n }\n return true;\n }", "public void reset()\n {\n reset(this.map, this.heuristic, this.neighborSelector);\n }", "public void setFirstNode(byte[] hash)\n {\n if (!this.isInitialized)\n {\n this.initialize();\n }\n this.firstNode = hash;\n this.firstNodeHeight = this.maxHeight;\n this.isFinished = true;\n }", "public void setGraphicsNode(GraphicsNode node) {\n/* 94 */ if (node == null) {\n/* 95 */ throw new IllegalArgumentException();\n/* */ }\n/* */ \n/* 98 */ this.node = node;\n/* */ }", "protected abstract void setTile( int tile, int x, int y );", "private void astarSetup(AStarNode end){\n\tfor(AStarNode node : getNodes()){\n node.setVisited(false);\n node.setFound(false);\n node.updateDist(Float.POSITIVE_INFINITY);\n\t}\n }", "public synchronized void setNode(String path, Node node)\n throws ProcessingException {\n if ( path == null || path.equals(\"/\")) {\n data = DOMUtil.createDocument();\n data.appendChild(data.createElementNS(null, \"context\"));\n data.getFirstChild().appendChild(data.importNode(node, true));\n } else {\n path = this.createPath(path); \n Node removeNode = DOMUtil.selectSingleNode(data, path, this.xpathProcessor);\n removeNode.getParentNode().replaceChild(data.importNode(node, true), removeNode);\n }\n }", "public void setGoal(Point point) {\n mGoal = point;\n }", "public void setG(Node parent, int moveCost){\n\t\tg=calculateG(parent, moveCost);\n\t}", "public Heuristic() {\n this(HeuristicUtils.defaultValues);\n }", "protected void setFitness(float fit)\t{\tfitness = fit;\t\t}", "void setValueOfNode(String path, String value)\n throws ProcessingException;", "@AbstractCustomGlobal.GlobalMethod(menuText=\"Set Threshold Probability\")\n public void setThreshold() {\n if(Tools.getGlobalTime()!=0){\n JOptionPane.showMessageDialog(null, \"You can change this probability only when the simulation start\",\"Alert\", JOptionPane.INFORMATION_MESSAGE);\n return;\n }\n String answer = JOptionPane.showInputDialog(null, \"Set the probability that a node can be selected to run.\");\n // Show an information message\n try{\n double k = Double.parseDouble(answer);\n Iterator<Node> it = Tools.getNodeList().iterator();\n while(it.hasNext()){\n Node n = it.next();\n if(n.getClass() == MSNode.class){\n MSNode n1 = (MSNode)n;\n n1.setThresholdProbability(k);\n }\n if(n.getClass() == MS2Node.class){\n MS2Node n1 = (MS2Node)n;\n n1.setThresholdProbability(k);\n }\n }\n JOptionPane.showMessageDialog(null, \"Well done you have set this value:\"+k,\"Notice\", JOptionPane.INFORMATION_MESSAGE);\n }catch(NumberFormatException e){\n JOptionPane.showMessageDialog(null, \"You must insert a valid double \", \"Alert\", JOptionPane.INFORMATION_MESSAGE);\n }\n }", "public void initialize() {\n for (Location apu : this.locations) {\n Node next = new Node(apu.toString());\n this.cells.add(next);\n }\n \n for (Node helper : this.cells) {\n Location next = (Location)this.locations.searchWithString(helper.toString()).getOlio();\n LinkedList<Target> targets = next.getTargets();\n for (Target finder : targets) {\n Node added = this.path.search(finder.getName());\n added.setCoords(finder.getX(), finder.getY());\n helper.addEdge(new Edge(added, finder.getDistance()));\n }\n }\n \n this.startCell = this.path.search(this.source);\n this.goalCell = this.path.search(this.destination);\n \n /**\n * Kun lähtö ja maali on asetettu, voidaan laskea jokaiselle solmulle arvio etäisyydestä maaliin.\n */\n this.setHeuristics();\n }", "public void setNodeA(int x){\n this.nodeA = x;\n }", "public abstract void setSelectedNode(String n);", "public void setToOriginals(){\n\t\t//set all occupied nodes as empty\n\t\tif(nodeStatus == Status.occupied){\n\t\t\tsetAsEmpty();\n\t\t}\n\t\t//if the node had a unit end on it, reset that value\n\t\tif(ended == true){\n\t\t\tended=false;\n\t\t}\n\t\tf=0;\n\t\tg=0;\n\t\th=0;\n\t}", "public void makeSet(T e){\n\t\tnodes.put(e, new Node<T>(e));\r\n\t}", "public void setNode(String node)\n {\n this.node = node;\n }", "public void setp(Node n) {\n\t\tp = n;\n\t}", "public void setEdge(int start, int target){\n\t\tthis.graph.elementAt(start).insert(target);\n\t}", "public void setHijoIzq (nodeTree pHIzq){\n this._hIzq=pHIzq;\n }", "public void testSetGoalLocation() {\n test = new Location(9, 9);\n assertEquals(test, maze1.getGoalLocation());\n \n test = new Location(1, 1);\n maze1.setGoalLocation(test);\n assertEquals(test, maze1.getGoalLocation());\n \n test = new Location(2, 2);\n maze1.setCell(test, MazeCell.WALL);\n maze1.setGoalLocation(test);\n assertEquals(test, maze1.getGoalLocation());\n \n \n }", "void setFirst(Node node) {\n this.first = node;\n }", "public final void setFirst(Node n) {\n set(n);\n }", "public void setCurrentNode(int node) {\n\t\tthis.currentNode = node;\n\t}", "void setLowNode(Node n){\n low = n;\n }", "public void setNode_1(String node_1);", "@Override\n\tpublic void setNodeInfo(String path, Object obj) {\n\t\treentrantReadWriteLock.readLock().lock();\n\t\ttry {\n\t\t\tzookeeper.setData(path, SomeUtil.getByte(obj),\n\t\t\t\t\t-1);\n\t\t} catch (Exception e) {\n\t\t\tlog.error(\"更新跟节点数据异常!\", e);\n\t\t} finally {\n\t\t\treentrantReadWriteLock.readLock().unlock();\n\t\t}\n\t}", "public void setTreeSearch(Player tree){\n t = tree;\n\n // e = new EvaluationFunction1(t);\n }", "public void setGoal(int sx, int sy) {\n mGoal = new Point(sx, sy);\n }", "private void _setPoint(int index, DataPoint point) {\n ntree.set(index, point);\n ensureDistances();\n }", "@Override\n public void set(int i, Node<T> e)\n {\n super.set(i, e);\n if(i == 0) \n {\n lastNode.setNext(firstNode);\n updateFirstNode();\n }\n else if(i == size - 1) lastNode = e;\n }", "public void setHijoDer (nodeTree pHDer){\n this._hDer=pHDer;\n }", "public abstract void setPoint(Point p);", "public void setNode(String node) {\n this.node = node;\n }", "private void setCellVisited(Cell cell) {\n\n\t\tif (!isIn(cell))\n\t\t\treturn;\n\n\t\tint r = cell.r;\n\t\tint c = cell.c;\n\t\tif (maze.type == HEX) {\n\t\t\tc = c - (r + 1) / 2;\n\t\t}\n\t\ttry {\n\t\t\tvisited[r][c] = true;\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void setNeighborSelector(NeighborSelector neighborSelector)\n {\n this.neighborSelector = neighborSelector;\n }", "public KadNode setNode(Node node) {\r\n\t\tthis.node = node;\r\n\t\treturn this;\r\n\t}", "public void setNode_5(String node_5);", "public void setPathway(PathwayHolder p)\r\n\t{\n\t}", "void setCost(double cost);", "@Override\r\n public void execute() {\r\n if (newSource != null) {\r\n edge.setSource(newSource);\r\n } else if (newTarget != null) {\r\n edge.setTarget(newTarget);\r\n }\r\n }", "public void setHomeScore(int h);", "void setRoadway(org.landxml.schema.landXML11.RoadwayDocument.Roadway roadway);", "public abstract Piece setLocation(int row, int column);", "public void settInn(T element){\n Node temp = new Node(element);\n temp.neste = hode.neste;\n temp.neste.forrige = temp;\n temp.forrige = hode;\n hode.neste = temp;\n elementer++;\n\n\n }", "public abstract void setInternal(int head, int ct, int t, int arm, int leg);", "public void setPath(Path inputPath) {\n path = inputPath;\n node = path.getNodes().getFirst();\n }", "public void setLink( IntNode _node ) {\r\n\t\t\tlink = _node;\r\n\t\t}", "public void setVisited()\n {\n visited = true;\n }", "public void setNewGraph() {\n\tresetHints();\r\n Random random = new Random();\r\n if (graphMode == 1) {\r\n if (selectedSize == 1) {\r\n currentGraph = chromaticManager.calculate(random.nextInt(myInformation.smallGraph) + 1, -1);\r\n }\r\n if (selectedSize == 2) {\r\n currentGraph = chromaticManager.calculate(random.nextInt(myInformation.middleGraph - myInformation.smallGraph) + myInformation.smallGraph + 1, -1);\r\n }\r\n if (selectedSize == 3) {\r\n currentGraph = chromaticManager.calculate(random.nextInt(myInformation.bigGraph - myInformation.middleGraph) + myInformation.middleGraph + 1, -1);\r\n }\r\n }\r\n if (graphMode == 2) {\r\n currentGraph = chromaticManager.calculate(myGraph);\r\n }\r\n if (graphMode == 3) {\r\n try {\r\n stackPane.getChildren().removeAll(textFieldHBox, backPane);\r\n myVertices = Integer.parseInt(textFieldVertices.getText());\r\n myEdges = Integer.parseInt(textFieldEdges.getText());\r\n currentGraph = chromaticManager.calculate(myVertices, myEdges);\r\n setDisplay(currentGraph);\r\n } catch (NumberFormatException e) {\r\n\r\n }\r\n }\r\n threadPoolExecutor.execute(() -> {\r\n NewForce newForce = new NewForce();\r\n currentGraph.setCNumer(newForce.doNewForce(currentGraph,currentGraph.getUpperBound(),currentGraph.getLowerBound()));\r\n });\r\n }", "public void setPriorNode(Node<T> prior) {\n\t\t\titsPrior = prior;\n }", "public void setAsStartingPoint() {\n\t\tnodeStatus = Status.occupied;\n\t}", "void setLeader(Genome leader);", "public void setEdge(Student curr, Student neighbor, Integer price) {\n curr.setNeighborAndPrice(neighbor, price);\n }", "void setFitnessScore(double score){\n fitnessScore = score;\n }", "public void setVisited(int v) {\n visited.set(v, true);\n nodeEnum.add(v);\n }", "public void setEdgeCost(int from, int to, double newCost) {\n //make sure the nodes given are valid\n assert (from < nodeVector.size()) && (to < nodeVector.size()) :\n \"<SparseGraph::SetEdgeCost>: invalid index\";\n\n //visit each neighbour and erase any edges leading to this node\n ListIterator<edge_type> it = edgeListVector.get(from).listIterator();\n while (it.hasNext()) {\n edge_type curEdge = it.next();\n if (curEdge.getTo() == to) {\n curEdge.setCost(newCost);\n break;\n }\n }\n }", "double setCost(double cost);", "public void setLT(TreeNode node)\r\n\t\t{\r\n\t\t\tthis.lThan = node;\r\n\t\t}", "private void setNeighbors() {\n\t\tfor (int i = 0; i < getNumRows(); i++) {\n\t\t\tfor (int j = 0; j < getNumCols(); j++) {\n\t\t\t\tCell c = getCurrentGrid()[i][j];\n\t\t\t\tsetNeighborsForCell(c);\n\t\t\t}\n\t\t}\n\t}", "public void setFitness(int newFitness) {\n fitness = newFitness;\n }", "void setRoute(Shape route);", "public void setTreeNode(TreeNode treeNode) {\n this.treeNode = treeNode;\n }", "public void setNodeVistied(boolean nodeVisit){\r\n\t \tthis.nodeVisited = nodeVisit;\r\n\t }", "public void setFirst(Node first)\n {\n this.first = first;\n }", "public void setParent(IAVLNode node);", "public void setParent(IAVLNode node);", "private void setHighScore(int hs) {\n setStat(hs, highScore);\n }", "public void setProblem(AbstractSearchProblem<S> p) {\n problem = p;\n }", "public void setX(int node, int x) {\n if (x != xs[node])\n invalid[node] = true;\n xs[node] = x;\n }", "void setTile(Tile tile) {\n _tile = tile;\n }", "public void setAdj(Tile adjTile, int sideIndex){\r\n adjTiles[sideIndex] = adjTile;\r\n }", "public void setVisited(final Profile profile){\n\t\tpartnerboerseVerwaltung.visit(profile, new AsyncCallback<Void>() {\n\t\t\t@Override\n\t\t\tpublic void onFailure(Throwable caught) {\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic void onSuccess(Void result) {\n\t\t\t}\n\t\t});\n\t}", "public void setVisited(Boolean b){\n visited = b;\n }", "public void setDest(Point dest){\n System.out.println(\"hit\");\n this.dest = dest;\n }" ]
[ "0.7458475", "0.7067843", "0.66975325", "0.6607452", "0.6063322", "0.58320844", "0.5741439", "0.5738452", "0.5724705", "0.5718298", "0.5676771", "0.56604266", "0.55995935", "0.5574674", "0.5560622", "0.5529921", "0.5517654", "0.55060416", "0.54573745", "0.53933114", "0.53358066", "0.53084284", "0.5296653", "0.5296443", "0.5281675", "0.52657956", "0.52499175", "0.52437276", "0.5235059", "0.5228803", "0.51869357", "0.51782393", "0.5174365", "0.5168021", "0.5154193", "0.51541793", "0.5142971", "0.51409644", "0.51378775", "0.51270044", "0.51116127", "0.51052463", "0.509228", "0.50794864", "0.50717276", "0.50693715", "0.5062966", "0.5059167", "0.50581133", "0.50299776", "0.5015193", "0.501399", "0.498863", "0.4981454", "0.49635163", "0.49518982", "0.49443293", "0.4924532", "0.4923531", "0.49218363", "0.49217978", "0.4920544", "0.4917906", "0.49127105", "0.4911888", "0.4909737", "0.4904745", "0.49039128", "0.4897353", "0.48967218", "0.48892924", "0.48818845", "0.48801035", "0.4879112", "0.48765406", "0.48525268", "0.4852214", "0.48503125", "0.48436043", "0.48430243", "0.4840206", "0.48334792", "0.4830706", "0.48289815", "0.4819435", "0.48150557", "0.48139805", "0.4813929", "0.48132262", "0.48035368", "0.47847104", "0.47847104", "0.47753716", "0.47725523", "0.47647387", "0.4758961", "0.4754411", "0.47421765", "0.47398677", "0.4736391" ]
0.77933234
0
/ The greedy algorithm selects the best out of the children. There should be a loop. During each iteration, take the node make its children. Perfrom goal check, cycle check
private void GreedySearch(){ Queue<Node> expanded = new LinkedList<>(); ArrayList<Node> fringe = new ArrayList<>(); ArrayList<Node> fringeTemp = new ArrayList<>(); Node current = startNode; while(expanded.size() < 1000){ if(current.getDigit().getDigitString().equals(goalNode.getDigit().getDigitString())){ //goal is reached. solutionPath(current); expanded.add(current); printExpanded(expanded); System.exit(0); } boolean b = cycleCheck(current,expanded); if(!b) { expanded.add(current); } if(!b){ if(current.getDigit().last_changed != 0){ if ((Integer.parseInt(current.getDigit().getFirst_digit()) - 1 >= 0)) { Node child_node = new Node(current.getDigit().decreaseFirstDigit()); child_node.setParent(current); child_node.getDigit().setLastChanged(0); if(!forbidden.contains(child_node.getDigit().getDigitString())){ fringe.add(child_node); } } //+1 child first digit if ((Integer.parseInt(current.getDigit().getFirst_digit()) + 1 <= 9)) { Node child_node = new Node(current.getDigit().increaseFirstDigit()); child_node.setParent(current); child_node.getDigit().setLastChanged(0); if(!forbidden.contains(child_node.getDigit().getDigitString())){ fringe.add(child_node); } } } if(current.getDigit().last_changed != 1){ if ((Integer.parseInt(current.getDigit().getSecond_digit()) - 1 >= 0)) { Node child_node = new Node(current.getDigit().decreaseSecondDigit()); child_node.setParent(current); child_node.getDigit().setLastChanged(1); if(!forbidden.contains(child_node.getDigit().getDigitString())){ fringe.add(child_node); } } //+1 child if ((Integer.parseInt(current.getDigit().getSecond_digit()) + 1 <= 9)) { Node child_node = new Node(current.getDigit().increaseSecondDigit()); child_node.setParent(current); child_node.getDigit().setLastChanged(1); if(!forbidden.contains(child_node.getDigit().getDigitString())){ fringe.add(child_node); } } } if(current.getDigit().last_changed != 2){ if ((Integer.parseInt(current.getDigit().getThird_digit()) - 1 >= 0)) { Node child_node = new Node(current.getDigit().decreaseThirdDigit()); child_node.setParent(current); child_node.getDigit().setLastChanged(2); if(!forbidden.contains(child_node.getDigit().getDigitString())){ fringe.add(child_node); } } //+1 child if ((Integer.parseInt(current.getDigit().getThird_digit()) + 1 <= 9)) { Node child_node = new Node(current.getDigit().increaseThirdDigit()); child_node.setParent(current); child_node.getDigit().setLastChanged(2); if(!forbidden.contains(child_node.getDigit().getDigitString())){ fringe.add(child_node); } } } } for(Node n : fringe){ heuristicSetter(n); } fringeTemp.addAll(fringe); //now all the nodes in fringe have the heuristic value. //We can get the last added minm Node minm; if(fringeTemp.size() != 0){ minm = fringeTemp.get(0); }else{ break; } for(int i = 1; i<fringeTemp.size(); i++){ if(fringeTemp.get(i).getHeuristic() <= minm.getHeuristic()){ minm = fringeTemp.get(i); } } //now we have the minm for the next stage. current = minm; fringeTemp.remove(minm); fringe.clear(); } //While loop ends System.out.println("No solution found."); printExpanded(expanded); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void greedyBFS(String input)\r\n\t{\r\n\t\tNode root_gbfs = new Node (input);\r\n\t\tNode current = new Node(root_gbfs.getState());\r\n\t\t\r\n\t\tNodeComparator gbfs_comparator = new NodeComparator();\r\n\t\tPriorityQueue<Node> queue_gbfs = new PriorityQueue<Node>(12, gbfs_comparator);\r\n\t\tArrayList<String> visited = new ArrayList<String>();\r\n\t\tArrayList<String> children = new ArrayList<String>();\r\n\t\t\r\n\t\tint nodes_popped = 0;\r\n\t\tint pqueue_max_size = 0;\r\n\t\tint pq_size = 0;\r\n\t\t\r\n\t\tcurrent.cost = 0;\r\n\t\tcurrent.total_cost = 0;\r\n\t\t\r\n\t\twhile(!goal_gbfs)\r\n\t\t{\r\n\t\t\tvisited.add(current.getState());\r\n\t\t\tchildren = Successor.findChildren(current.getState());\r\n\t\t\t\r\n\t\t\tfor (String a : children)\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\tif (visited.contains(a))\r\n\t\t\t\t{\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\tNode nino = new Node(a);\r\n\t\t\t\t\tcurrent.children_nodes.add(nino);\r\n\t\t\t\t\tvisited.add(nino.getState());\r\n\t\t\t\t\t\r\n\t\t\t\t\tint cost = isCost(current.getState(), nino.getState());\r\n\t\t\t\t\tnino.cost = cost;\r\n\t\t\t\t\tnino.parent = current;\r\n\t\t\t\t\tint greedy_cost = greedybfsCost(nino.getState(), root_gbfs.getState());\r\n\t\t\t\t\tnino.setTotalCost(greedy_cost);\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (!queue_gbfs.contains(nino))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tqueue_gbfs.add(nino);\r\n\t\t\t\t\t\tpq_size++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Repeated State checking. Removing the same node from PQ if the path cost is less then the current one \r\n\t\t\t\t\telse if (queue_gbfs.contains(nino))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tfor (Node original : queue_gbfs)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif (original.equals(nino))\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tNode copy = original;\r\n\t\t\t\t\t\t\t\tif (nino.getTotalCost() < copy.getTotalCost())\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tqueue_gbfs.remove(copy);\r\n\t\t\t\t\t\t\t\t\tqueue_gbfs.add(nino);\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}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tcurrent = queue_gbfs.poll();\r\n\t\t\tnodes_popped++;\r\n\t\t\t\r\n\t\t\tif (pq_size > pqueue_max_size)\r\n\t\t\t{\r\n\t\t\t\tpqueue_max_size = pq_size;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tpq_size--;\r\n\t\t\tgoal_gbfs = isGoal(current.getState());\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\tgoal_gbfs = false;\r\n\t\tSystem.out.println(\"GBFS Solved!!\");\r\n\t\tSolution.performSolution(current, root_gbfs, nodes_popped, pqueue_max_size);\r\n\t}", "private boolean helperDFS(Node current){\n\n if(expandedNode.size() == 999){\n //limit has been reached. jump out of recursion.\n expandedNode.add(current);\n System.out.println(\"No solution found.\");\n printExpanded(expandedNode);\n System.exit(0);\n return false;\n }\n\n boolean b = cycleCheck(current,expandedNode);\n\n if(!b){\n expandedNode.add(current);\n }else{\n return false;\n }\n\n if(current.getDigit().getDigitString().equals(goalNode.getDigit().getDigitString())){\n //goal reached.\n //expandedNode.add(current);\n solutionPath(current);\n printExpanded(expandedNode);\n System.exit(0);\n }\n\n //Now make the children.\n\n if(!forbidden.contains(current.getDigit().getDigitString())){\n\n if(current.getDigit().last_changed != 0){\n\n if ((Integer.parseInt(current.getDigit().getFirst_digit()) - 1 >= 0)) {\n Node child_node = new Node(current.getDigit().decreaseFirstDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(0);\n if(!forbidden.contains(child_node.getDigit().getDigitString()) && helperDFS(child_node)){\n return true;\n }\n }\n\n //+1 child first digit\n if ((Integer.parseInt(current.getDigit().getFirst_digit()) + 1 <= 9)) {\n Node child_node = new Node(current.getDigit().increaseFirstDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(0);\n if(!forbidden.contains(child_node.getDigit().getDigitString()) && helperDFS(child_node)){\n return true;\n }\n }\n }\n\n if(current.getDigit().last_changed != 1){\n if ((Integer.parseInt(current.getDigit().getSecond_digit()) - 1 >= 0)) {\n Node child_node = new Node(current.getDigit().decreaseSecondDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(1);\n if(!forbidden.contains(child_node.getDigit().getDigitString()) && helperDFS(child_node)){\n return true;\n }\n }\n\n //+1 child\n if ((Integer.parseInt(current.getDigit().getSecond_digit()) + 1 <= 9)) {\n Node child_node = new Node(current.getDigit().increaseSecondDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(1);\n if(!forbidden.contains(child_node.getDigit().getDigitString()) && helperDFS(child_node)){\n return true;\n }\n }\n }\n\n if(current.getDigit().last_changed != 2){\n if ((Integer.parseInt(current.getDigit().getThird_digit()) - 1 >= 0)) {\n Node child_node = new Node(current.getDigit().decreaseThirdDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(2);\n if(!forbidden.contains(child_node.getDigit().getDigitString()) && helperDFS(child_node)){\n return true;\n }\n }\n //+1 child\n if ((Integer.parseInt(current.getDigit().getThird_digit()) + 1 <= 9)) {\n Node child_node = new Node(current.getDigit().increaseThirdDigit());\n child_node.setParent(current);\n child_node.getDigit().setLastChanged(2);\n if(!forbidden.contains(child_node.getDigit().getDigitString()) && helperDFS(child_node)){\n return true;\n }\n }\n }\n }\n return false;\n }", "int solve(int p, int current) {\n int id = getId(p, current);\n if (p >= 0 && memo.containsKey(id)) {\n return memo.get(id);\n }\n List<Integer> adjList = adj.get(current);\n int n = adjList.size();\n if (n == 0) {\n throw new RuntimeException();\n }\n if ((n == 2 && p >= 0) || (n == 1 && p < 0)) {\n // should cut the nodes under current\n int ans = getDepth(p, current) - 1;\n // System.out.println(\"ans(\" + p + \",\" + current + \")=\" + ans);\n memo.put(id, ans);\n return ans;\n }\n if (n == 1) {\n // System.out.println(\"ans(\" + p + \",\" + current + \")=nochild\");\n return 0;\n }\n int ans = Integer.MAX_VALUE;\n\n for (int i = 0; i < n; i++) {\n int a = adjList.get(i);\n if (a == p) {\n continue;\n }\n for (int j = i + 1; j < n; j++) {\n int b = adjList.get(j);\n if (b == p) {\n continue;\n }\n // try a & b combo\n int tmp = solve(current, a);\n tmp += solve(current, b);\n for (int k = 0; k < n; k++) {\n int c = adjList.get(k);\n if (c != a && c != b && c != p) {\n tmp += getDepth(current, c);\n }\n }\n ans = Math.min(ans, tmp);\n }\n }\n memo.put(id, ans);\n // System.out.println(\"ans(\" + p + \",\" + current + \")=\" + ans);\n return ans;\n }", "private void gameTree(MinimaxNode<GameState> currentNode, int depth, int oIndex){\n currentNode.setNodeIndex(oIndex); \n if (depth == 0) {\n return;\n }\n else{\n if (currentNode.getState().isDead(oIndex)){ //checks to see if current player is dead, if so, just skips their moves\n int newIndex = (oIndex + 1) % currentNode.getState().getNrPlayers();\n/* if(oIndex == 3){\n newIndex = 0;\n }\n else{\n newIndex = oIndex + 1;\n }*/\n gameTree(currentNode, depth-1, newIndex);\n }\n else{\n //this if statement sets up chance nodes, if the target has been met it will create 5 children nodes with randomly generated new target postitions \n if(!currentNode.getState().hasTarget()){\n currentNode.setChanceNode();\n for(int i = 1; i <= 5; i++){\n try{\n GameState newState = (GameState)currentNode.getState().clone();\n newState.chooseNextTarget();\n MinimaxNode<GameState> childNode = new MinimaxNode(newState);\n childNode.setProbability(0.2);\n currentNode.addChild(childNode); \n }\n catch (CloneNotSupportedException e){\n System.out.println(\"Clone not excepted\");\n }\n \n }\n for (int i = 0; i < currentNode.getNumberOfChildren(); i++){\n gameTree(currentNode.getChildren().get(i), depth, oIndex);\n }\n\n }\n else{\n List<Integer> options = new ArrayList();\n for (int i = 1; i <= 4; i++) {\n if (currentNode.getState().isLegalMove(oIndex, i)){\n options.add(i);\n }\n }\n for (int i = 0; i < options.size(); i++){\n try{\n GameState newState = (GameState)currentNode.getState().clone();\n newState.setOrientation(oIndex, options.get(i));\n newState.updatePlayerPosition(oIndex);\n MinimaxNode<GameState> childNode = new MinimaxNode(newState);\n currentNode.addChild(childNode);\n }\n catch (CloneNotSupportedException e){\n System.out.println(\"Clone not excepted\");\n }\n }\n int newIndex = (oIndex + 1) % currentNode.getState().getNrPlayers();\n /* if(oIndex == 3){\n newIndex = 0;\n }\n else{\n newIndex = oIndex + 1;\n }*/\n for (int i = 0; i < currentNode.getNumberOfChildren(); i++){\n gameTree(currentNode.getChildren().get(i), depth-1, newIndex);\n }\n } \n } \n }\n }", "private void treeBreadthFirstTraversal() {\n Node currNode = root;\n java.util.LinkedList<Node> queue = new java.util.LinkedList<Node>();\n\n // Highlights the first Node.\n queueNodeSelectAnimation(currNode, \"Exploring \" + currNode.key,\n AnimationParameters.ANIM_TIME);\n\n // Explores Nodes until the queue is empty.\n while (true) {\n\n // Marks that this Node's children should be explored.\n for (int i = 0; i < getNumChildren(); ++i) {\n if (currNode.children[i] != null) {\n queue.addLast(currNode.children[i]);\n queueQueueAddAnimation(currNode.children[i],\n \"Queueing \" + currNode.children[i].key,\n AnimationParameters.ANIM_TIME);\n\n }\n }\n\n // Pops the next Node from the queue.\n if (!queue.isEmpty()) {\n currNode = queue.pop();\n queueListPopAnimation(\"Popped \" + currNode.key,\n AnimationParameters.ANIM_TIME);\n queueNodeSelectAnimation(currNode, \"Exploring \" + currNode.key,\n AnimationParameters.ANIM_TIME);\n\n }\n // If the queue is empty, breaks.\n else break;\n\n }\n }", "private static ArrayList<MMT> generateChildren(Board currentBoard, String mPlayer, boolean ifChildMax, int depthToGo){\n\t\t//System.out.println(\"generate children! depth to go is \" + depthToGo);\n\t\tif (depthToGo == 0)\n\t\t\treturn null;\n\t\tArrayList<MMT> childLst = new ArrayList<MMT>();\n\t\tfor (int j = 0; j<Board.getNumCol(); j++){\n\t\t\tBoard childBoard = new Board(currentBoard);\n\t\t\tboolean success = childBoard.fillBoard(j, getCurrentNodePiece(mPlayer, ifChildMax));\n\t\t\t//Board.printBoard(childBoard);\n\t\t\t//System.out.println(\"score for this board: \" + Eval.evalBoard(childBoard, mPlayer));\n\t\t\t//if valid move, then add board\n\t\t\tif (success){\n\t\t\t\t//set depth to 0 (to stop) if someone wins or tie\n\t\t\t\tint depth;\n\t\t\t\tif (Eval.checkTie(childBoard) || Eval.ifHumanWon(childBoard) ||\n\t\t\t\t\t\tEval.ifPCWon(childBoard)){\n\t\t\t\t\tdepth = 0;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tdepth = depthToGo -1;\n\t\t\t\t\t//depth = depthToGo; //depth not reduced at constructor\n\t\t\t\tMMT child = new MMT(childBoard, depth, mPlayer, ifChildMax, j);\n\t\t\t\tchildLst.add(child);\n\t\t\t}\n\t\t}\n\t\tif (childLst.size() == 0)\n\t\t\treturn null;\n\t\treturn childLst;\n\t}", "public void aEstrella2 (String input)\r\n\t{\r\n\t\tNode root_aEstrella2 = new Node (input);\r\n\t\tNode current = new Node(root_aEstrella2.getState());\r\n\t\t\r\n\t\tHeuristicComparator aEstrella_comparator = new HeuristicComparator();\r\n\t\tPriorityQueue<Node> queue_gbfs = new PriorityQueue<Node>(12, aEstrella_comparator);\r\n\t\tArrayList<String> visited = new ArrayList<String>();\r\n\t\tArrayList<String> children = new ArrayList<String>();\r\n\t\t\r\n\t\tint nodes_popped = 0;\r\n\t\tint pqueue_max_size = 0;\r\n\t\tint pq_size = 0;\r\n\t\t\r\n\t\tcurrent.cost = 0;\r\n\t\t\r\n\t\twhile(!goal_aEstrella2)\r\n\t\t{\r\n\t\t\tvisited.add(current.getState());\r\n\t\t\tchildren = Successor.findChildren(current.getState());\r\n\t\t\t\r\n\t\t\tfor (String a : children)\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\tif (visited.contains(a))\r\n\t\t\t\t{\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\tNode nino = new Node(a);\r\n\t\t\t\t\tcurrent.children_nodes.add(nino);\r\n\t\t\t\t\tvisited.add(nino.getState());\r\n\t\t\t\t\t\r\n\t\t\t\t\tint cost = isCost(current.getState(), nino.getState());\r\n\t\t\t\t\tnino.cost = cost;\r\n\t\t\t\t\tnino.parent = current;\r\n\t\t\t\t\tint manhattanD = manhattanDistance(nino.getState(), root_aEstrella2.getState());\r\n\t\t\t\t\tnino.setTotalCost(nino.parent.getTotalCost() + nino.cost);\r\n\t\t\t\t\t\r\n\t\t\t\t\t// f(n) = g(n) + h(n)\r\n\t\t\t\t\tnino.setHeuristicCost(nino.getTotalCost() + manhattanD);\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (!queue_gbfs.contains(nino))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tqueue_gbfs.add(nino);\r\n\t\t\t\t\t\tpq_size++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Repeated State checking. Removing the same node from PQ if the path cost is less then the current one \r\n\t\t\t\t\telse if (queue_gbfs.contains(nino))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tfor (Node original : queue_gbfs)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif (original.equals(nino))\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tNode copy = original;\r\n\t\t\t\t\t\t\t\tif (nino.getHeuristicCost() < copy.getHeuristicCost())\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tqueue_gbfs.remove(copy);\r\n\t\t\t\t\t\t\t\t\tqueue_gbfs.add(nino);\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}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tcurrent = queue_gbfs.poll();\r\n\t\t\tnodes_popped++;\r\n\t\t\t\r\n\t\t\tif (pq_size > pqueue_max_size)\r\n\t\t\t{\r\n\t\t\t\tpqueue_max_size = pq_size;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tpq_size--;\r\n\t\t\tgoal_aEstrella2 = isGoal(current.getState());\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\tgoal_aEstrella2 = false;\r\n\t\tSystem.out.println(\"A*2 Solved!!\");\r\n\t\tSolution.performSolution(current, root_aEstrella2, nodes_popped, pqueue_max_size);\r\n\t}", "private ProblemModel findCheapestNode(){\n\t\tProblemModel ret = unvisitedPM.peek();\n\t\t\n\t\tfor(ProblemModel p : unvisitedPM){ \n\t\t\t//f(s) = depth + cost to make this move\n\t\t\tif(p.getCost() + p.getDepth() <= ret.getCost() + ret.getDepth()) ret = p;\n\t\t}\n\t\tunvisitedPM.remove(ret);\n\t\treturn ret;\n\t}", "public static Tree solve() {\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n\n int[] arrayNode = new int[n + 1];\n for (int i = 1; i <= n; i++) {\n arrayNode[i] = scan.nextInt();\n }\n\n Color[] arrayColor = new Color[n + 1];\n for (int i = 1; i <= n; i++) {\n if (scan.nextInt() == 0) {\n arrayColor[i] = Color.RED;\n } else {\n arrayColor[i] = Color.GREEN;\n }\n }\n\n List<Integer>[] adjacentsList = new List[n + 1];\n for (int i = 1; i <= n; i++) {\n adjacentsList[i] = new ArrayList<Integer>();\n }\n\n for (int i = 0; i < n - 1; i++) {\n int x = scan.nextInt();\n int y = scan.nextInt();\n\n adjacentsList[x].add(y);\n adjacentsList[y].add(x);\n }\n\n scan.close();\n\n List<Integer>[] childrenList = new List[n + 1];\n for (int i = 1; i <= n; i++) {\n childrenList[i] = new ArrayList<Integer>();\n }\n\n int[] depths = new int[n + 1];\n boolean[] visited = new boolean[n + 1];\n\n Queue<Integer> queue = new LinkedList<Integer>();\n depths[1] = 0;\n queue.offer(1);\n while (!queue.isEmpty()) {\n int head = queue.poll();\n\n if (visited[head]) {\n continue;\n }\n visited[head] = true;\n\n for (int adjacent : adjacentsList[head]) {\n if (!visited[adjacent]) {\n childrenList[head].add(adjacent);\n depths[adjacent] = depths[head] + 1;\n queue.offer(adjacent);\n }\n }\n }\n\n Tree[] nodes = new Tree[n + 1];\n for (int i = 1; i <= n; i++) {\n if (childrenList[i].isEmpty()) {\n nodes[i] = new TreeLeaf(arrayNode[i], arrayColor[i], depths[i]);\n } else {\n nodes[i] = new TreeNode(arrayNode[i], arrayColor[i], depths[i]);\n }\n }\n for (int i = 1; i <= n; i++) {\n for (int child : childrenList[i]) {\n ((TreeNode) nodes[i]).addChild(nodes[child]);\n }\n }\n return nodes[1];\n }", "public void ids (String input, int limit)\r\n\t\t{\r\n\t\t\tNode root_ids= new Node (input);\r\n\t\t\tNode current = new Node(root_ids.getState());\r\n\t\t\t\r\n\t\t\tArrayList<String> visited = new ArrayList<String>();\r\n\t\t\tArrayList<String> children = new ArrayList<String>();\r\n\t\t\tStack<Node> stack_dfs = new Stack<Node>();\r\n\t\t\t\r\n\t\t\tint nodes_popped = 0;\r\n\t\t\tint stack_max_size = 0;\r\n\t\t\tint stack_max_total = 0;\r\n\t\t\tint depth = 0;\r\n\t\t\t\r\n\t\t\tcurrent.cost = 0;\r\n\t\t\tcurrent.depth = 0;\r\n\t\t\t\r\n\t\t\tgoal_ids = isGoal(current.getState());\r\n\t\t\t\r\n\t\t\twhile(depth <= limit)\r\n\t\t\t{\r\n\t\t\t\tif (goal_ids == true)\r\n\t\t\t\t{\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// Clear the visited array for backtracking purposes\r\n\t\t\t\tvisited.clear();\r\n\t\t\t\t\r\n\t\t\t\twhile(!goal_ids)\r\n\t\t\t\t{\r\n\t\t\t\t\tvisited.add(current.getState());\r\n\t\t\t\t\tchildren = Successor.findChildren(current.getState());\r\n\t\t\t\t\r\n\t\t\t\t\t// Depth limit check. This loop never runs if the node depth is greater then the limit\r\n\t\t\t\t\tif (current.getDepth() < limit)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tfor (String a : children)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif (visited.contains(a))\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tNode nino = new Node(a);\r\n\t\t\t\t\t\t\tcurrent.children_nodes.add(nino);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tint cost = isCost(current.getState(), nino.getState());\r\n\t\t\t\t\t\t\tnino.cost = cost;\r\n\t\t\t\t\t\t\tnino.parent = current;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// Repeated state check\r\n\t\t\t\t\t\t\tif (!stack_dfs.contains(nino))\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tstack_dfs.add(nino);\r\n\t\t\t\t\t\t\t\tstack_max_size++;\r\n\t\t\t\t\t\t\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}\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (current.getDepth() >= limit - 1)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tint copy = stack_max_size;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif (copy > stack_max_total)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tstack_max_total = copy;\r\n\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\r\n\t\t\t\t\tdepth++;\r\n\t\t\t\t\t\r\n\t\t\t\t\t// If there is no solution found at the depth limit, return no solution\r\n\t\t\t\t\tif (stack_dfs.empty() == true)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tSolution.noSolution(limit);\t\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\tcurrent = stack_dfs.pop();\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Set depth of node so it can be checked in next iteration\r\n\t\t\t\t\tcurrent.setDepth(current.parent.getDepth() + 1);\r\n\t\t\t\t\tnodes_popped++;\r\n\t\t\t\t\tstack_max_size--;\r\n\t\t\t\t\tgoal_ids = isGoal(current.getState());\r\n\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tgoal_ids = false;\r\n\t\t\tSystem.out.println(\"IDS Solved!!\");\r\n\t\t\t\r\n\t\t\tif (stack_max_total > stack_max_size)\r\n\t\t\t{\r\n\t\t\t\tstack_max_size = stack_max_total;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tSolution.performSolution(current, root_ids, nodes_popped, stack_max_size);\r\n\t\t}", "public void aEstrella (String input)\r\n\t{\r\n\t\tNode root_aEstrella = new Node (input);\r\n\t\tNode current = new Node(root_aEstrella.getState());\r\n\t\t\r\n\t\tHeuristicComparator aEstrella_comparator = new HeuristicComparator();\r\n\t\tPriorityQueue<Node> queue_gbfs = new PriorityQueue<Node>(12, aEstrella_comparator);\r\n\t\tArrayList<String> visited = new ArrayList<String>();\r\n\t\tArrayList<String> children = new ArrayList<String>();\r\n\t\t\r\n\t\tint nodes_popped = 0;\r\n\t\tint pqueue_max_size = 0;\r\n\t\tint pq_size = 0;\r\n\t\t\r\n\t\tcurrent.cost = 0;\r\n\t\tcurrent.setTotalCost(0);\r\n\t\t\r\n\t\twhile(!goal_aEstrella)\r\n\t\t{\r\n\t\t\tvisited.add(current.getState());\r\n\t\t\tchildren = Successor.findChildren(current.getState());\r\n\t\t\t\r\n\t\t\tfor (String a : children)\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\tif (visited.contains(a))\r\n\t\t\t\t{\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\tNode nino = new Node(a);\r\n\t\t\t\t\tcurrent.children_nodes.add(nino);\r\n\t\t\t\t\tvisited.add(nino.getState());\r\n\t\t\t\t\t\r\n\t\t\t\t\tint cost = isCost(current.getState(), nino.getState());\r\n\t\t\t\t\tnino.cost = cost;\r\n\t\t\t\t\tnino.parent = current;\r\n\t\t\t\t\tint greedy_cost = greedybfsCost(nino.getState(), root_aEstrella.getState());\r\n\t\t\t\t\tnino.setTotalCost(nino.parent.getTotalCost() + nino.cost);\r\n\t\t\t\t\t\r\n\t\t\t\t\t// f(n) = g(n) + h(n)\r\n\t\t\t\t\tnino.setHeuristicCost(nino.getTotalCost() + greedy_cost);\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (!queue_gbfs.contains(nino))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tqueue_gbfs.add(nino);\r\n\t\t\t\t\t\tpq_size++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Repeated State checking. Removing the same node from PQ if the path cost is less then the current one \r\n\t\t\t\t\telse if (queue_gbfs.contains(nino))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tfor (Node original : queue_gbfs)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif (original.equals(nino))\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tNode copy = original;\r\n\t\t\t\t\t\t\t\tif (nino.getHeuristicCost() < copy.getHeuristicCost())\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tqueue_gbfs.remove(copy);\r\n\t\t\t\t\t\t\t\t\tqueue_gbfs.add(nino);\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}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tcurrent = queue_gbfs.poll();\r\n\t\t\tnodes_popped++;\r\n\t\t\t\r\n\t\t\tif (pq_size > pqueue_max_size)\r\n\t\t\t{\r\n\t\t\t\tpqueue_max_size = pq_size;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tpq_size--;\r\n\t\t\tgoal_aEstrella = isGoal(current.getState());\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\tgoal_aEstrella = false;\r\n\t\tSystem.out.println(\"A* Solved!!\");\r\n\t\tSolution.performSolution(current, root_aEstrella, nodes_popped, pqueue_max_size);\r\n\t}", "public static void computeChildren() {\n\t\tArrayList<BNNode> children = new ArrayList<BNNode>();\n\t\t// For each node, build an array of children by checking which nodes have it as a parent.\n\t\tfor (BNNode node : nodes) {\n\t\t\tchildren.clear();\n\t\t\tfor (BNNode node2 : nodes) {\n\t\t\t\tif (node == node2)\n\t\t\t\t\tcontinue;\n\t\t\t\tfor (BNNode node3 : node2.parents)\n\t\t\t\t\tif (node3 == node)\n\t\t\t\t\t\tchildren.add(node2);\n\t\t\t}\n\t\t\tnode.children = new BNNode[children.size()];\n\t\t\tnode.children = (BNNode[]) children.toArray(node.children);\n\t\t}\n\t}", "@Override\n\tpublic void run() {\n\t\tMap<Integer, Integer> roots = new TreeMap<Integer, Integer>();\n\t\t\n\t\tEdge[] edges = new Edge[this.edges.length];\n\t\tint n, weight, relevantEdges, root, lowerBound = 0;\n\t\n\t\t// Sort edges by weight.\n\t\tquickSort(0, this.edges.length - 1);\n\t\n\t\t// Compute initial lower bound (best k - 1 edges).\n\t\t// Choosing the cheapest k - 1 edges is not very intelligent. There is no guarantee\n\t\t// that this subset of edges even induces a subgraph over the initial graph.\n\t\t// TODO: Find a better initial lower bound.\n\t\tfor (int i = 0; i < solution.length; i++) {\n\t\t\tlowerBound += this.edges[i].weight;\n\t\t}\n\t\n\t\t// Iterate over all nodes in the graph and run Prim's algorithm\n\t\t// until k - 1 edges are fixed.\n\t\t// As all induced subgraphs have k nodes and are connected according to Prim, they\n\t\t// are candidate solutions and thus submitted.\n\t\tfor (root = 0; root < taken.length; root++) {\n\t\t\ttaken = new boolean[taken.length];\n\t\t\tSystem.arraycopy(this.edges, 0, edges, 0, this.edges.length);\n\n\t\t\ttaken[root] = true;\n\t\t\tn = 0;\n\t\t\tweight = 0;\n\t\t\trelevantEdges = this.edges.length;\n\n\t\t\twhile (n < solution.length) { \n\t\t\t\tfor (int i = 0; i < relevantEdges; i++) {\n\t\t\t\t\t// XOR to check if connected and no circle.\n\t\t\t\t\tif (taken[edges[i].node1] ^ taken[edges[i].node2]) {\n\t\t\t\t\t\ttaken[taken[edges[i].node1] ? edges[i].node2 : edges[i].node1] = true;\n\t\t\t\t\t\tsolution[n++] = edges[i];\n\t\t\t\t\t\tweight += edges[i].weight;\n\t\t\t\t\t\tSystem.arraycopy(edges, i + 1, edges, i, --relevantEdges - i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t// Check for circle.\n\t\t\t\t\telse if (taken[edges[i].node1]) {\n\t\t\t\t\t\tSystem.arraycopy(edges, i + 1, edges, i, --relevantEdges - i);\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\t// Sum up what we've just collected and submit this\n\t\t\t// solution to the framework.\n\t\t\tHashSet<Edge> set = new HashSet<Edge>(solution.length);\n\t\t\tfor (int i = 0; i < solution.length; i++) {\n\t\t\t\tset.add(solution[i]);\n\t\t\t}\n\t\t\tsetSolution(weight, set);\n\t\t\troots.put(weight, root);\n\t\t}\n\n\t\t// Now for the real business, let's do some Branch-and-Bound. Roots of \"k Prim Spanning Trees\"\n\t\t// are enumerated by weight to increase our chances to obtain the kMST earlier.\n\t\tfor (int item : roots.values()) {\n\t\t\ttaken = new boolean[taken.length];\n\t\t\tSystem.arraycopy(this.edges, 0, edges, 0, this.edges.length);\n\t\t\ttaken[item] = true;\n\t\t\tbranchAndBound(edges, solution.length, 0, lowerBound);\n\t\t}\n\t}", "@Override\n List<NodeData> pathFind() throws NoPathException {\n System.out.println(\"Starting Scenic\");\n\n frontier.add(start);\n\n while(!frontier.isEmpty()) {\n StarNode current = frontier.getLast();\n frontier.removeLast(); // pop the priority queue\n if(current.getXCoord() == goal.getXCoord() && current.getYCoord() == goal.getYCoord()) {\n // If we are at the goal, we need to backtrack through the shortest path\n System.out.println(\"At target!\");\n finalList.add(current); // we have to add the goal to the path before we start backtracking\n while(!(current.getXCoord() == start.getXCoord() && current.getYCoord() == start.getYCoord())) {\n finalList.add(current.getPreviousNode());\n current = current.getPreviousNode();\n System.out.println(current.getNodeID());\n }\n return finalList;\n }\n else {\n // we need to get all the neighbor nodes, identify their costs, and put them into the queue\n LinkedList<StarNode> neighbors = current.getNeighbors();\n // we also need to remove the previous node from the list of neighbors because we do not want to backtrack\n neighbors.remove(current.getPreviousNode());\n\n for (StarNode newnode : neighbors) {\n int nodePlace = this.listContainsId(frontier, newnode);\n if(nodePlace > -1) {\n if (frontier.get(nodePlace).getF() > actionCost(newnode) + distanceToGo(newnode, goal)) {\n System.out.println(\"Here\");\n frontier.remove(frontier.get(nodePlace));\n newnode.setPreviousNode(current);\n frontier.add(newnode);\n newnode.setF(actionCost(newnode) + distanceToGo(newnode, goal));\n }\n }\n else {\n newnode.setPreviousNode(current);\n frontier.add(newnode);\n newnode.setF(actionCost(newnode) + distanceToGo(newnode, goal));\n }\n\n // This fixes the problem with infinitely looping elevators (I hope)\n if(current.getNodeType().equals(\"ELEV\") && newnode.getNodeType().equals(\"ELEV\")) {\n for (Iterator<StarNode> iterator = newnode.neighbors.iterator(); iterator.hasNext();) {\n StarNode newneighbor = iterator.next();\n if (newneighbor.getNodeType().equals(\"ELEV\")) {\n // Remove the current element from the iterator and the list.\n iterator.remove();\n }\n }\n }\n if(current.getNodeType().equals(\"STAI\") && newnode.getNodeType().equals(\"STAI\")) {\n for (Iterator<StarNode> iterator = newnode.neighbors.iterator(); iterator.hasNext();) {\n StarNode newneighbor = iterator.next();\n if (newneighbor.getNodeType().equals(\"STAI\")) {\n // Remove the current element from the iterator and the list.\n iterator.remove();\n }\n }\n }\n // this is where the node is put in the right place in the queue\n Collections.sort(frontier);\n }\n }\n }\n throw new NoPathException(start.getLongName(), goal.getLongName());\n }", "protected void createTree() {\n\n\t\tint nextPlayer = opponent;\n\n\t\tQueue<Node> treeQueue = new LinkedList<Node>();\n\t\tWinChecker winCheck = new WinChecker();\n\n\t\ttreeQueue.add(parent);\n\n\t\twhile (!treeQueue.isEmpty()) {\n\t\t\tNode currentNode = treeQueue.poll();\n\n\t\t\tif (currentNode.getMove().Row != -1\n\t\t\t\t\t&& currentNode.getMove().Col != -1) {\n\t\t\t\tgb.updateBoard(currentNode.getMove());\n\n\t\t\t\tif (winCheck.getWin(gb) >= 0) {\n\t\t\t\t\tgb.revertBoard(currentNode.getMove());\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tgb.revertBoard(currentNode.getMove());\n\t\t\t}\n\n\t\t\t// Restricting the depth to which we will create the tree\n\t\t\tif (currentNode.getPly() > 2) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tfor (List<Hexagon> tempList : this.gb.getBoard()) {\n\t\t\t\tfor (Hexagon tempHex : tempList) {\n\n\t\t\t\t\tif (tempHex == null) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (tempHex.getValue() == EMPTY) {\n\n\t\t\t\t\t\tif (currentNode.getPly() % 2 == 0) {\n\t\t\t\t\t\t\tnextPlayer = opponent;\n\t\t\t\t\t\t} else if (currentNode.getPly() % 2 == 1) {\n\t\t\t\t\t\t\tnextPlayer = player;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tMove nextMove = new Move(nextPlayer, false,\n\t\t\t\t\t\t\t\ttempHex.getRow(), tempHex.getColumn());\n\n\t\t\t\t\t\tNode newNode = new Node(currentNode.getPly() + 1,\n\t\t\t\t\t\t\t\tnextMove);\n\t\t\t\t\t\tnewNode.setParent(currentNode);\n\n\t\t\t\t\t\tcurrentNode.children.add(newNode);\n\n\t\t\t\t\t\ttreeQueue.add(newNode);\n\t\t\t\t\t\ttempHex.setValue(EMPTY);\n\t\t\t\t\t}// End of if statement\n\n\t\t\t\t}// End of inner ForLoop\n\t\t\t}// End of outer ForLoop\n\n\t\t\t// currentNode.printChildren();\n\n\t\t}// End of While Loop\n\n\t}", "public void RecursiveExpansion() throws TreeTooBigException {\r\n int transIndex; //Index to count transitions\r\n int[] newMarkup; //markup used to create new node\r\n boolean aTransitionIsEnabled = false; //To check for deadlock\r\n //Attribute used for assessing whether a node has occured before\r\n boolean repeatedNode = false; \r\n \r\n boolean allOmegas = false;\r\n \r\n boolean[] enabledTransitions = \r\n tree.dataLayer.getTransitionEnabledStatusArray(markup);\r\n\r\n //For each transition\r\n for (int i = 0; i < enabledTransitions.length; i++) {\r\n if (enabledTransitions[i] == true) {\r\n //Set transArray of to true for this index\r\n transArray[i] = true;\r\n \r\n //System.out.println(\"\\n Transition \" + i + \" Enabled\" );\r\n aTransitionIsEnabled = true;\r\n \r\n //print (\"\\n Old Markup is :\", markup);//debug\r\n \r\n //Fire transition to produce new markup vector\r\n newMarkup = fire(i);\r\n \r\n //print (\"\\n New Markup is :\", newMarkup);//debug\r\n \r\n //Check for safeness. If any of places have > 1 token set variable.\r\n for (int j = 0; j < newMarkup.length; j++) {\r\n if (newMarkup[j] > 1 || newMarkup[j] == -1) {\r\n tree.moreThanOneToken = true;\r\n break;\r\n }\r\n } \r\n \r\n //Create a new node using the new markup vector and attach it to\r\n //the current node as a child.\r\n children[i] = \r\n new myNode(newMarkup, this, tree, depth + 1);\r\n \r\n /* Now need to (a) check if any omegas (represented by -1) need to \r\n * be inserted in the markup vector of the new node, and (b) if the \r\n * resulting markup vector has appeared anywhere else in the tree. \r\n * We must do (a) before (b) as we need to know if the new node \r\n * contains any omegas to be able to compare it with existing nodes. \r\n */ \r\n allOmegas = children[i].InsertOmegas();\r\n \r\n //check if the resulting markup vector has occured anywhere else in the tree\r\n repeatedNode = (tree.root).FindMarkup(children[i]);\r\n \r\n if (tree.nodeCount >= Pipe.MAX_NODES && !tree.tooBig) {\r\n tree.tooBig = true;\r\n throw new TreeTooBigException();\r\n }\r\n \r\n if (!repeatedNode && !allOmegas) {\r\n children[i].RecursiveExpansion();\r\n }\r\n }\r\n }\r\n \r\n if (!aTransitionIsEnabled) {\r\n System.err.println(\"No transition enabled\");\r\n if (!tree.noEnabledTransitions || tree.pathToDeadlock.length < depth-1) {\r\n RecordDeadlockPath();\r\n tree.noEnabledTransitions = true;\r\n } else {\r\n System.err.println(\"Deadlocked node found, but path is not shorter\"\r\n + \" than current path.\");\r\n }\r\n } else {\r\n //System.out.println(\"Transitions enabled.\");\r\n }\r\n }", "public Node solve()\n\t{\n\t\t// Initial problem state\n\t\tint[] initial_state = {0, 0};\n\n\t\t// Current node under consideration\n\t\tNode curr_node = new Node(initial_state, null, null);\n\n\t\t// List of frontier nodes at each iteration\n\t\t// Manipulated as a queue\n\t\tthis.frontier = new ArrayList<Node>();\n\n\t\t// List of nodes already explored\n\t\t// They are excluded from expanded frontier nodes at each iteration\n\t\tthis.explored = new ArrayList<int[]>();\n\n\t\tfrontier.add(curr_node);\n\n\t\twhile (true) {\n\t\t\t// If we have exhausted our frontier \n\t\t\t// we have no solution\n\t\t\tif (frontier.size() == 0) {\n\t\t\t\treturn null;\n\t\t\t}\n \n // Pop new node from frontier to consider\n\t\t\tcurr_node = frontier.remove(0);\n \n\t\t // Add chosen node to explored list if not already there\n\t\t\tif(!this.inExplored(curr_node.state)) {\n\t\t\t\texplored.add(curr_node.state);\t\t\t\t\n\t\t\t}\n\n // List of actions that can be applied based on the state\n // and the description of the problem\n\t\t\tAction[] actions = this.getFeasibleActions(curr_node.state);\n\n // Apply our transition model to generate child nodes \n // from current node\n\t\t\tfor (Action action : actions) {\n\t\t\t\tNode child = this.getChildNode(curr_node, action);\t\t\n\t\t\t\t\n\t\t\t\tif (!this.inFrontier(child) && !this.inExplored(child.state)) {\n\t\t\t\t\tif (this.isGoal(child.state)) {\n\t\t\t\t\t\treturn child;\n\t\t\t\t\t}\n\t\t\t\t\tfrontier.add(child);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public boolean bestFirstSearch() {\n\t\twhile(!soloution){\n\t\t\tif(open.isEmpty()){\n\t\t\t\tSystem.out.println(\"No more choices to explore\");\n\t\t\t\tSystem.out.println(\"SolutionId: \" + solutionId);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t//chooses the most optimal X\n\t\t\tNode x = popNode();\n\t\t\tclosed.add(x);\n\t\t\tSystem.out.println(\"X:\\t\\t\" + x.state + \" \" + x.h + \" + \" + x.g + \" = \" + x.f);\n\t\t\t//checks if it is a soulution\n\t\t\tif(solution(x)){\n\t\t\t\tSystem.out.println(\"SOLUTION:\\t\" + x.state);\n\t\t\t\tSystem.out.println(\"nodes created: \" + open.size() + closed.size());\n\t\t\t\tprintSolution(x);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t//handles the possible moves from the state x\n\t\t\tsucc = generateAllSuccesors(x);\n\t\t\tfor (Node s : succ) {\n\t\t\t\t//if this state already exist, we will use the node keeping it instead\n\t\t\t\tNode old = findOld(s);\n\t\t\t\tif(old != null)\n\t\t\t\t\ts = old;\n\t\t\t\t//makes the new node a child of x\n\t\t\t\tx.kids.add(s);\n\t\t\t\t//if its a new state it will be inserted to open after evaluation\n\t\t\t\tif(!open.contains(s) && !closed.contains(s)){\n\t\t\t\t\tattachAndEval(s,x);\n\t\t\t\t\tinsert(s);\n\t\t\t\t}\n\t\t\t\t//if its an old node and x is a better parent it will be evalueted again.\n\t\t\t\telse if(x.g + arcCost(x, s) < s.g){\n\t\t\t\t\tattachAndEval(s, x);\n\t\t\t\t\tif(closed.contains(s)){\n\t\t\t\t\t\t//if its closed all children will be evaluated with the new score of \"s\"\n\t\t\t\t\t\tpropagatePathImprovements(s);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "private List<Path> expandExecution(Path input) {\n\t\tList<Path> childInputs = new ArrayList<>(); //store the paths generated from given path\n\t\t\n\t\t//search from the top node which have not been searched before\n\t\tfor(int j = input.bound; j < input.path.size() - 1; j++){\n\t\t\tdouble[] probabilityArray = cfg.getTransition_matrix().getRow(input.path.get(j));\n\t\t\tfor(int i = 0; i < probabilityArray.length; i++){\n\t\t\t\t//the node been visited before only have two situation:1.has been searched,2.the path contains it in the workList \n\t\t\t\tif(probabilityArray[i] > 0 && i != input.path.get(j + 1) && unvisited.contains(i)){\n\t\t\t\t\tList<Integer> tempPath = new ArrayList<>();\n\t\t\t\t\tfor(int index = 0; index < j + 1; index++)\n\t\t\t\t\t\ttempPath.add(input.path.get(index));\n\t\t\t\t\ttempPath.add(i);\n\t\t\t\t\t\n\t\t\t\t\tPath newInput = new Path(tempPath, j + 1);\n\t\t\t\t\tchildInputs.add(newInput);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\treturn childInputs;\n\t}", "private int evaluateChildren() {\n if (PRINT_PROGRESS) {\n System.out.println(\"Evaled:\"+boardsEvaluated);\n }\n if (this.children == null || this.children.isEmpty()) { // Exit case: Node is a leaf\n return evaluateBoard(this.board);\n }\n \n int bestEval = Integer.MIN_VALUE;\n for (final BoardTree child : this.children) {\n child.evaluation = child.evaluateChildren();\n if (child.evaluation > bestEval) {\n bestEval = child.evaluation;\n }\n }\n return bestEval;\n }", "public static void bfs (String input)\r\n\t{\r\n\t\tNode root_bfs = new Node (input);\r\n\t\tNode current = new Node(root_bfs.getState());\r\n\t\t\r\n\t\tArrayList<String> visited = new ArrayList<String>();\r\n\t\tArrayList<String> children = new ArrayList<String>();\r\n\t\tQueue<Node> queue_bfs = new LinkedList<Node>();\r\n\t\t\r\n\t\tint nodes_popped = 0;\r\n\t\tint queue_max_size = 0;\r\n\t\tint queue_size = 0;\r\n\t\tcurrent.cost = 0;\r\n\t\t\r\n\t\t// Initial check for goal state\r\n\t\tgoal_bfs = isGoal(current.getState());\r\n\t\t\r\n\t\twhile(!goal_bfs)\r\n\t\t{\r\n\t\t\t// Add the current node to the visited array\r\n\t\t\tvisited.add(current.getState());\r\n\t\t\t// Get the nodes children from the successor function\r\n\t\t\tchildren = Successor.findChildren(current.getState());\r\n\t\t\t\r\n\t\t\tfor (String a : children)\r\n\t\t\t{\r\n\t\t\t\t// State checking, don't add already visited nodes to the queue\r\n\t\t\t\tif (visited.contains(a))\r\n\t\t\t\t{\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t\t// Create child node from the children array and add it to the current node\r\n\t\t\t\t\tNode nino = new Node(a);\r\n\t\t\t\t\tcurrent.children_nodes.add(nino);\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Obtaining the path cost\r\n\t\t\t\t\tint cost = isCost(current.getState(), nino.getState());\r\n\t\t\t\t\tnino.cost = cost;\r\n\t\t\t\t\tnino.parent = current;\r\n\t\t\t\t\t\r\n\t\t\t\t\t// State check and adding the child to the queue. Increasing size counter\r\n\t\t\t\t\tif (!queue_bfs.contains(nino))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tqueue_bfs.add(nino);\r\n\t\t\t\t\t\tqueue_size++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Pop a node off the queue\r\n\t\t\tcurrent = queue_bfs.poll();\r\n\t\t\tnodes_popped++;\r\n\t\t\t\r\n\t\t\t// Added this because my queue size variable was always one off based on where my goal check is\r\n\t\t\tif (queue_size > queue_max_size)\r\n\t\t\t{\r\n\t\t\t\tqueue_max_size = queue_size;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Decrease queue size because a node has been popped and check for goal state\r\n\t\t\tqueue_size--;\r\n\t\t\tgoal_bfs = isGoal(current.getState());\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\t// Now that a solution has been found, set the boolean back to false for another run\r\n\t\tgoal_bfs = false;\r\n\t\tSystem.out.println(\"BFS Solved!!\");\r\n\t\t\r\n\t\t// Send metrics to be printed to the console\r\n\t\tSolution.performSolution(current, root_bfs, nodes_popped, queue_max_size);\r\n\t\t\t\r\n\t}", "public void dfs (String input)\r\n\t {\r\n\t\t \tNode root_dfs = new Node (input);\r\n\t\t \tNode current = new Node(root_dfs.getState());\r\n\t\t \t\r\n\t\t\tArrayList<String> visited = new ArrayList<String>();\r\n\t\t\tArrayList<String> children = new ArrayList<String>();\r\n\t\t\tStack<Node> stack_dfs = new Stack<Node>();\r\n\t\t\t\r\n\t\t\tint nodes_popped = 0;\r\n\t\t\tint stack_max_size = 0;\r\n\t\t\tint stack_size = 0;\r\n\t\t\tcurrent.cost = 0;\r\n\t\t\t\r\n\t\t\tgoal_dfs = isGoal(current.getState());\r\n\t\t\t\r\n\t\t\twhile(!goal_dfs)\r\n\t\t\t{\r\n\t\t\t\tvisited.add(current.getState());\r\n\t\t\t\tchildren = Successor.findChildren(current.getState());\r\n\t\t\t\t\r\n\t\t\t\tfor (String a : children)\r\n\t\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (visited.contains(a))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tNode nino = new Node(a);\r\n\t\t\t\t\t\tcurrent.children_nodes.add(nino);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tint cost = isCost(current.getState(), nino.getState());\r\n\t\t\t\t\t\tnino.cost = cost;\r\n\t\t\t\t\t\tnino.parent = current;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// Repeated state check\r\n\t\t\t\t\t\tif (!stack_dfs.contains(nino))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tstack_dfs.add(nino);\r\n\t\t\t\t\t\t\tstack_size++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// Popping off the stack. LIFO architecture\r\n\t\t\t\tcurrent = stack_dfs.pop();\r\n\t\t\t\tnodes_popped++;\r\n\t\t\t\t\r\n\t\t\t\tif (stack_size > stack_max_size)\r\n\t\t\t\t{\r\n\t\t\t\t\tstack_max_size = stack_size;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tstack_size--;\r\n\t\t\t\tgoal_dfs = isGoal(current.getState());\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tgoal_dfs = false;\r\n\t\t\tSystem.out.println(\"DFS Solved!!\");\r\n\t\t\tSolution.performSolution(current, root_dfs, nodes_popped, stack_max_size);\r\n\t }", "private static BoardNode startGreedyDepthFirst(int steps, BoardNode node){\n count = 1;\n return greedyDepthFirst(steps, node);\n }", "public ReturnClass astar_algo(){\n long start=System.nanoTime();\n TreeStar node=new TreeStar(variables,0);\n openList.push(node);\n\n while (!openList.isEmpty())\n {\n\n TreeStar temp= openList.pollLast(); //pop the highest scoring node in openList\n refreshUsage(temp.variables); //uses the current node variables to update usageArray\n\n if((System.nanoTime()-start)/1000000000>=maxTime){\n System.out.println(\"time limit reached\");\n ReturnClass returnClass= new ReturnClass(temp.variables,temp.score,false);\n return returnClass;\n }\n\n if(temp.score==nbC){\n System.out.println(\"solution trouvée !\");\n printArray(temp.variables);\n ReturnClass returnClass= new ReturnClass(temp.variables,temp.score,true);\n return returnClass;\n }\n\n int bestVar=0;\n if(heuristic.equals(\"TD Heuristic\")){\n bestVar= chooseVTD(); //get the highest scoring unused var to use it in children\n }\n else if(heuristic.equals(\"TD-long heuristic\")){\n bestVar=chooseVTD();\n }\n else if(heuristic.equals(\"Partial-diff Heuristic\")){\n bestVar= chooseVDiff(temp.variables); //get the highest scoring unused var to use it in children\n }\n else {\n bestVar= chooseVDiff(temp.variables);\n }\n\n\n TreeStar node1= nextVar(temp.variables, 0,bestVar,temp.profondeur+1);\n TreeStar node2= nextVar(temp.variables, 1,bestVar,temp.profondeur+1);\n\n if(node1!=null){\n addToOpenList(node1);\n addToOpenList(node2);\n }\n }\n\n System.out.println(\"solution non trouvée\");\n return null;\n }", "private int heuristic(Node node, int currentDepth) {\n\n int ef, w1 = 1, w2 = 1, w3 = 0, w4 = 10, w5 = 1, w6 = 35, e1 = 0, e2 = 0, e3 = 0, e4 = 0, e5 = 0, e6 = 0;\n\n int ourSeedsInStore = node.getBoard().getSeedsInStore(ourSide);\n int oppSeedsInStore = node.getBoard().getSeedsInStore(ourSide.opposite());\n\n\n // hardcode fix.\n int parentOurSeedsInStore = 0;\n int parentOppSeedsInStore = 0;\n int parentMove = 0;\n int parentOurSeedsInHouse = 0;\n int parentOppSeedsInHouse = 0;\n\n if (currentDepth != 1) {\n parentOurSeedsInStore = node.getParent().getBoard().getSeedsInStore(ourSide);\n parentOppSeedsInStore = node.getParent().getBoard().getSeedsInStore(ourSide.opposite());\n parentMove = node.getName();\n parentOurSeedsInHouse = node.getParent().getBoard().getSeeds(ourSide, parentMove);\n parentOppSeedsInHouse = node.getParent().getBoard().getSeeds(ourSide.opposite(), parentMove);\n }\n\n int ourFreeHouse = 0;\n int oppFreeHouse = 0;\n int ourSeeds = ourSeedsInStore;\n int oppSeeds = oppSeedsInStore;\n\n int asdf1 = ourSeedsInStore - parentOurSeedsInStore;\n int asdf2 = oppSeedsInStore - parentOppSeedsInStore;\n\n e6 = asdf1 - asdf2;\n\n for (int i = 1; i <= 7; i++) {\n ourSeeds += node.getBoard().getSeeds(ourSide, i);\n oppSeeds += node.getBoard().getSeeds(ourSide.opposite(), i);\n }\n\n for (int i = 1; i <= 7; i++) {\n if (node.getBoard().getSeeds(ourSide, i) == 0)\n ourFreeHouse++;\n if (node.getBoard().getSeeds(ourSide.opposite(), i) == 0)\n oppFreeHouse++;\n }\n\n e1 = ourSeeds - oppSeeds;\n e2 = ourFreeHouse - oppFreeHouse;\n\n // hardcode fix.\n if (currentDepth != 1) {\n if (node.getParent().getPlayerSide() == this.getOurSide()) {\n // if last move puts seed into store\n if ((parentMove + parentOurSeedsInHouse) % 8 == 0) {\n e4 = 1;\n e3 = (parentMove + parentOurSeedsInHouse) / 8;\n } else if (parentMove + parentOurSeedsInStore > 8) {\n e4 = 0;\n e3 = (parentMove + parentOurSeedsInStore) / 8;\n }\n\n for (int i = 1; i <= 7; i++) {\n int parentOurSeedsInCurrentHouse = node.getParent().getBoard().getSeeds(ourSide, i);\n int parentOppSeedsInFrontHouse = node.getParent().getBoard().getSeeds(ourSide.opposite(), 8 - i);\n int oppSeedsInFrontHouse = node.getBoard().getSeeds(ourSide.opposite(), 8 - i);\n // if there's no seed in current house && there is seed right in front of us\n if ((parentOurSeedsInCurrentHouse == 0 || parentOurSeedsInCurrentHouse == 15) && parentOppSeedsInFrontHouse != 0 && oppSeedsInFrontHouse == 0) {\n if (currentDepth != 2) {\n if (node.getParent().getParent().getPlayerSide() == this.getOurSide()) {\n w5 = 5;\n e5 = parentOppSeedsInFrontHouse;\n break;\n }\n }\n e5 = parentOppSeedsInFrontHouse;\n break;\n }\n\n }\n } else if (node.getParent().getPlayerSide() == this.getOurSide().opposite()) {\n\n if (parentMove + parentOppSeedsInHouse == 8) {\n e4 = -1;\n e3 = -1 * (parentMove + parentOppSeedsInHouse) / 8;\n } else if (parentMove + parentOppSeedsInStore > 8) {\n e4 = 0;\n e3 = -(parentMove + parentOppSeedsInStore) / 8;\n }\n\n\n for (int i = 1; i <= 7; i++) {\n int parentOppSeedsInCurrentHouse = node.getParent().getBoard().getSeeds(ourSide.opposite(), i);\n int parentOurSeedsInFrontHouse = node.getParent().getBoard().getSeeds(ourSide, 8 - i);\n int oppSeedsInCurrentHouse = node.getBoard().getSeeds(ourSide, 8 - i);\n\n if ((parentOppSeedsInCurrentHouse == 0 || parentOppSeedsInCurrentHouse == 15) && parentOurSeedsInFrontHouse != 0 && oppSeedsInCurrentHouse == 0) {\n if (currentDepth != 2) {\n if (node.getParent().getParent().getPlayerSide() == this.getOurSide()) {\n w5 = 5;\n e5 = -parentOurSeedsInFrontHouse;\n break;\n }\n }\n w5 = 5;\n e5 = -parentOurSeedsInFrontHouse;\n break;\n }\n }\n }\n }\n ef = w1 * e1 + w2 * e2 + w3 * e3 + w4 * e4 + w5 * e5 + w6 * e6;\n return ef;\n }", "public static ArrayList<Node> getChildren(Node current) {\r\n\r\n ArrayList<Node> OpChild = new ArrayList<Node>();\r\n if (current.getParentMove() == null) current.setParentMove(\"\");\r\n if (current.getDirection()==null) current.setDirection(\"\");\r\n int i_Zero = 0, j_Zero = 0;\r\n int[][] CurrState = current.mat;\r\n /*\r\n explain for the fucntions\r\n the function get node and the list. check the border and the parent.\r\n swap the state matrix and then create Node with state mat.\r\n set to the node the cost the direction iterazit and it to the list.\r\n after that add it to the list.\r\n */\r\n\r\n DobleLeft(current, OpChild);\r\n DoubleUp(current, OpChild);\r\n\r\n DoubleRight(current, OpChild);\r\n DoubleDown(current, CurrState, OpChild);\r\n// for the first zero\r\n leftMove(current, current.zero1[0], current.zero1[1], OpChild);\r\n upMove(current, current.zero1[0], current.zero1[1], OpChild);\r\n rightMove(current, current.zero1[0], current.zero1[1], OpChild);\r\n downMove(current, current.zero1[0], current.zero1[1], OpChild);\r\n // check if has 2 zeros\r\n if (current.zero2[0]!=-1) {\r\n leftMove(current, current.zero2[0], current.zero2[1], OpChild);\r\n upMove(current, current.zero2[0], current.zero2[1], OpChild);\r\n rightMove(current, current.zero2[0], current.zero2[1], OpChild);\r\n downMove(current, current.zero2[0], current.zero2[1], OpChild);\r\n\r\n }\r\n return OpChild;\r\n }", "private MoveTree generateTree() {\n\n\t\tArrayList<MoveTree> leaves = new ArrayList<>();\n\n\t\tMoveTree tree = new MoveTree(Main.getSWController().getGame().getCurrentGameState());\n\t\tleaves.add(tree);\n\n\t\tfinal Flag flag = new Flag(), finished = new Flag();\n\n\t\tTimer timer = new Timer(true);\n\t\ttimer.schedule(new TimerTask() {\n\t\t\t@Override\n\t\t\tpublic void run() {\n\t\t\t\tsynchronized (flag) {\n\t\t\t\t\tif (!finished.value)\n\t\t\t\t\t\tflag.value = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}, 9000);\n\n\t\twhile (true) {\n\t\t\tArrayList<MoveTree> newLeaves = new ArrayList<>();\n\t\t\tfor (MoveTree leaf : leaves) {\n\t\t\t\tGameState state = leaf.getState();\n\t\t\t\tPlayer currentPlayer = state.getPlayer();\n\n\t\t\t\tfor (Card handcard : currentPlayer.getHand()) {\n\t\t\t\t\tBuildCapability capability = Main.getSWController().getPlayerController().canBuild(currentPlayer, handcard, state);\n\t\t\t\t\tswitch (capability) {\n\t\t\t\t\tcase FREE:\n\t\t\t\t\tcase OWN_RESOURCE:\n\t\t\t\t\t\tMove move = new Move(handcard, Action.BUILD);\n\t\t\t\t\t\tMoveTree newTree = new MoveTree(move, doMove(move, currentPlayer, state));\n\t\t\t\t\t\tnewLeaves.add(newTree);\n\t\t\t\t\t\tleaf.addChild(newTree);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase TRADE:\n\t\t\t\t\t\tTradeOption trade = Main.getSWController().getPlayerController().getTradeOptions(currentPlayer, handcard.getRequired(), state).get(0);\n\t\t\t\t\t\tMove tradeMove = new Move(handcard, Action.BUILD);\n\t\t\t\t\t\ttradeMove.setTradeOption(trade);\n\t\t\t\t\t\tMoveTree newTree2 = new MoveTree(tradeMove, doMove(tradeMove, currentPlayer, state));\n\t\t\t\t\t\tnewLeaves.add(newTree2);\n\t\t\t\t\t\tleaf.addChild(newTree2);\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\tif (currentPlayer.getBoard().nextSlot() != -1) {\n\t\t\t\t\t\tArrayList<Resource> slotRequirements = new ArrayList<>(Arrays.asList(currentPlayer.getBoard().getNextSlotRequirement()));\n\t\t\t\t\t\tcapability = Main.getSWController().getPlayerController().hasResources(currentPlayer, slotRequirements, state);\n\t\t\t\t\t\tswitch (capability) {\n\t\t\t\t\t\tcase OWN_RESOURCE:\n\t\t\t\t\t\t\tMove move = new Move(handcard, Action.PLACE_SLOT);\n\t\t\t\t\t\t\tMoveTree newTree = new MoveTree(move, doMove(move, currentPlayer, state));\n\t\t\t\t\t\t\tnewLeaves.add(newTree);\n\t\t\t\t\t\t\tleaf.addChild(newTree);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase TRADE:\n\t\t\t\t\t\t\tTradeOption trade = Main.getSWController().getPlayerController().getTradeOptions(currentPlayer, slotRequirements, state).get(0);\n\t\t\t\t\t\t\tMove tradeMove = new Move(handcard, Action.PLACE_SLOT);\n\t\t\t\t\t\t\ttradeMove.setTradeOption(trade);\n\t\t\t\t\t\t\tMoveTree newTree2 = new MoveTree(tradeMove, doMove(tradeMove, currentPlayer, state));\n\t\t\t\t\t\t\tnewLeaves.add(newTree2);\n\t\t\t\t\t\t\tleaf.addChild(newTree2);\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}\n\n\t\t\t\t\tMove sellmove = new Move(handcard, Action.SELL);\n\t\t\t\t\tMoveTree selltree = new MoveTree(sellmove, doMove(sellmove, currentPlayer, state));\n\t\t\t\t\tnewLeaves.add(selltree);\n\t\t\t\t\tleaf.addChild(selltree);\n \n\t\t\t\t\tif (!currentPlayer.isOlympiaUsed() && !Main.getSWController().getCardController().hasCard(currentPlayer, handcard.getInternalName())) {\n\t\t\t\t\t\tMove olympiamove = new Move(handcard, Action.OLYMPIA);\n\t\t\t\t\t\tMoveTree olympiatree = new MoveTree(olympiamove, doMove(olympiamove, currentPlayer, state));\n\t\t\t\t\t\tnewLeaves.add(olympiatree);\n\t\t\t\t\t\tleaf.addChild(olympiatree);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tsynchronized (flag) {\n\t\t\t\t\tif (flag.value) {\n\t\t\t\t\t\tfor (MoveTree child : leaves)\n\t\t\t\t\t\t\tchild.getChildren().clear();\n\t\t\t\t\t\treturn tree;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tboolean breakAfterwards = false;\n\n\t\t\tfor (MoveTree newLeaf : newLeaves) {\n\t\t\t\tfor (Player player : newLeaf.getState().getPlayers()) {\n\t\t\t\t\tif (player.isMausoleum()) {\n\t\t\t\t\t\tCard card = getHalikarnassusCard(player, newLeaf.getState().getTrash(), newLeaf.getState());\n\t\t\t\t\t\tif (card == null)\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tnewLeaf.getState().getTrash().remove(card);\n\t\t\t\t\t\tplayer.getBoard().addCard(card);\n\t\t\t\t\t\tif (card.getEffects() != null)\n\t\t\t\t\t\t\tfor (Effect effect : card.getEffects())\n\t\t\t\t\t\t\t\tif (effect.getType() == EffectType.WHEN_PLAYED)\n\t\t\t\t\t\t\t\t\teffect.run(player, Main.getSWController().getGame());\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tnewLeaf.getState().setCurrentPlayer((newLeaf.getState().getCurrentPlayer() + 1) % newLeaf.getState().getPlayers().size());\n\n\t\t\t\tif (newLeaf.getState().getCurrentPlayer() == newLeaf.getState().getFirstPlayer()) {\n\t\t\t\t\tif (newLeaf.getState().getRound() < GameController.NUM_ROUNDS)\n\t\t\t\t\t\tMain.getSWController().getGameController().nextRound(Main.getSWController().getGame(), newLeaf.getState());\n\t\t\t\t\telse // stop look-ahead at the end of age\n\t\t\t\t\t\tbreakAfterwards = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tleaves.clear();\n\t\t\tleaves.addAll(newLeaves);\n\n\t\t\tif (breakAfterwards)\n\t\t\t\tbreak;\n\t\t}\n\n\t\tfinished.value = true;\n\n\t\treturn tree;\n\t}", "public static void generateTree(Node root){\n\n // If we hit the winning position or a draw, stop generating (Exit condition)\n if(defaultEvaluator.evaluate(root.getBoard()) != 0 || root.getBoard().getTurnNumber() == 9)\n return;\n\n // Else, keep generating recursively\n\n // Step0-Determine the turn player.\n GamePiece turnPlayer;\n if (root.getBoard().isXTurn()) {\n turnPlayer = GamePiece.X;\n }\n else {\n turnPlayer = GamePiece.O;\n }\n\n // Step1-generate a new board for every child of root\n int parentalBranches = root.getChildren().length;\n int childrenBranches = parentalBranches - 1;\n for(int i=0; i<parentalBranches; ++i){\n\n root.getChildren()[i] = new Node(childrenBranches);\n root.getChildren()[i].setBoard((Board)(root.getBoard().clone()));\n\n }\n\n // Step2-Place the pieces\n int childIndex=0;\n int placement = 0;\n while(childIndex<parentalBranches){\n\n try{\n\n root.getChildren()[childIndex].getBoard().set(placement %3, placement /3, turnPlayer);\n childIndex++;\n\n }catch(GridAlreadyChosenException ex){}\n placement++;\n\n }\n\n // Step3-Let the recursive madness begin. Call generateTree() on each child\n for (int i=0; i<parentalBranches; ++i)\n generateTree(root.getChildren()[i]);\n\n\n }", "private boolean cycleCheck(Node current, Queue<Node> expanded){\n\n if( expanded.size() == 0){\n return false; //Because current is root\n }\n\n for(Node nodeInExpanded : expanded){\n\n if(current!=null && current.getDigit().getDigitString().equals(nodeInExpanded.getDigit().getDigitString())){\n //the digits are same so we check children.\n\n ArrayList<String> currentChildren = makeChildren(current);\n ArrayList<String> childrenOfExpanded = makeChildren(nodeInExpanded);\n\n int size;\n\n if(currentChildren.size() > childrenOfExpanded.size() ){\n size = childrenOfExpanded.size();\n }else if(currentChildren.size() < childrenOfExpanded.size()){\n size = currentChildren.size();\n }else{\n size = childrenOfExpanded.size();\n }\n /*\n I use the modulus operator so that I dont get a ArrayIndexOut of Bounds\n */\n\n if( currentChildren.size() == childrenOfExpanded.size()\n && currentChildren.get(0%size).equals(childrenOfExpanded.get(0%size))\n && currentChildren.get(1%size).equals(childrenOfExpanded.get(1%size))\n && currentChildren.get(2%size).equals(childrenOfExpanded.get(2%size))\n && currentChildren.get(3%size).equals(childrenOfExpanded.get(3%size))\n ){\n return true;\n }\n }\n }\n\n return false;\n }", "public MoveNode ab(PentagoBoardState pbs,int myscore, int alpha, int beta,int amimaxplayer, int depth,int requireddepth){\n\n int bestmovescore;\n PentagoMove bestmove;\n\n ArrayList<PentagoMove> legalmoves = pbs.getAllLegalMoves();\n Collections.shuffle(legalmoves); //helps avoid worst run time if all good moves are at the end of array list\n\n MoveNode moveNode =new MoveNode(new PentagoMove(0,0,0,0,0),0);\n\n if (depth==requireddepth){\n bestmovescore= evaluate(pbs);\n moveNode.MyMove = null;\n moveNode.value = evaluate(pbs);\n return moveNode;\n\n }\n else if (pbs.getWinner() != Board.NOBODY){ //check win since we are at leafnode\n bestmovescore= evaluate(pbs);\n moveNode.MyMove = null;\n int movescore = evaluate(pbs);\n if (movescore<-1200000){\n moveNode.value = -999999999; //assign loss value\n } //Losing Move\n else if (movescore>1200000){\n moveNode.value = 999999999; //assign win value\n } // Winning Move\n return moveNode;\n\n }\n //do max player\n if (amimaxplayer ==1){\n int currentvalue = -999999999;\n PentagoMove currentmove =legalmoves.get(0);\n MoveNode currentmovenode = new MoveNode(currentmove,currentvalue);\n for (int i = 0; i < legalmoves.size(); i++) {\n PentagoBoardState newboard = (PentagoBoardState) pbs.clone();\n PentagoMove movetoprocess = legalmoves.get(i);\n newboard.processMove(movetoprocess);\n\n\n MoveNode scoreAfterMove = ab(newboard, currentvalue, alpha, beta, 0, depth + 1, requireddepth); // run recursion till leaf node or depth reached\n if (scoreAfterMove.value > currentvalue) { //see if current best value is lower than the new value if so replace\n currentvalue = scoreAfterMove.value;\n currentmove = movetoprocess;\n currentmovenode.value = currentvalue;\n currentmovenode.MyMove = currentmove;\n\n //System.out.println(\"I am max plyaer at depth:\" + depth + \"\\n current move is: \" + currentmove + \"\\ncurrentvalue is: \" + currentvalue);\n\n }\n\n alpha = Math.max(alpha,currentvalue);\n if (alpha>=beta){ // break loop if alpha more than beta\n //System.out.println(\"Get pruned my alpha is \" + alpha + \" my beta is \" + beta );\n break;\n }\n }\n //System.out.println(\"I am max plyaer at depth:\" + depth + \"\\n current move is: \" + currentmove + \"\\ncurrentvalue is: \" + currentvalue+\" my alpha is \" + alpha + \" my beta is \" + beta);\n\n return currentmovenode;\n }\n //do min player\n else if (amimaxplayer==0){\n int currentvalue = 999999999;\n PentagoMove currentmove =legalmoves.get(0);\n MoveNode currentmovenode = new MoveNode(currentmove,currentvalue);\n for (int i = 0; i < legalmoves.size(); i++) {\n PentagoBoardState newboard = (PentagoBoardState) pbs.clone();\n PentagoMove movetoprocess = legalmoves.get(i);\n newboard.processMove(movetoprocess);\n\n MoveNode scoreAfterMove = ab(newboard, currentvalue, alpha, beta, 1, depth + 1, requireddepth);\n if (scoreAfterMove.value < currentvalue) {\n currentvalue = scoreAfterMove.value;\n currentmove = movetoprocess;\n currentmovenode.value = currentvalue;\n currentmovenode.MyMove = currentmove;\n //System.out.println(\"I am min plyaer at depth:\" + depth + \"\\n current move is: \" + currentmove + \"\\ncurrentvalue is: \" + currentvalue);\n }\n beta = Math.min(beta,currentvalue);\n if (alpha>=beta){\n //System.out.println(\"Get pruned my alpha is \" + alpha + \" my beta is \" + beta );\n break;\n }\n }\n return currentmovenode;\n }\n //System.out.println(\"move val \" + moveNode.value);\n return moveNode;\n }", "private void getAllNodesBreadthFirstSearch(List<Expression> nodesList)\n/* */ {\n/* 156 */ int indx = 0;\n/* 157 */ nodesList.add(this);\n/* */ \n/* 159 */ while (indx < nodesList.size()) {\n/* 160 */ Expression node = (Expression)nodesList.get(indx++);\n/* 161 */ for (Expression child : node.childs) {\n/* 162 */ nodesList.add(child);\n/* */ }\n/* */ }\n/* */ }", "public static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\n\t\tn=sc.nextInt();\n\t\t\n\t\tint [][]arr=new int[n][n];\n\t\tint xShark=0;\n\t\tint yShark=0;\n\t\tint size=2;\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tfor(int j=0;j<n;j++) {\n\t\t\t\tarr[i][j]=sc.nextInt();\n\t\t\t\tif(arr[i][j]==9) {\n\t\t\t\t\txShark=i;\n\t\t\t\t\tyShark=j;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint go=0;\n\t\tint eat=0;\n\t\twhile(true) {\n\t\t\tList<Node> list=new ArrayList<>();\n\t\t\tnarr=new int[n][n];\n\t\t\tint min=Integer.MAX_VALUE;\n\t\t\t\n\t\t\tcanGo(arr, xShark, yShark, size);\n\t\t\tSystem.out.println();\n\t\t\tfor(int i=0;i<n;i++) {\n\t\t\t\tfor(int j=0;j<n;j++)System.out.print(narr[i][j]);\n\t\t\t\tSystem.out.println();\n\t\t\t}\n\t\t\tfor(int i=0;i<n;i++) {\n\t\t\t\tfor(int j=0;j<n;j++) {\n\t\t\t\t\tif(narr[i][j]>0) {\n\t\t\t\t\t\tlist.add(new Node(i,j,narr[i][j]));\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//System.out.println(\"s\"+list.size());\n\t\t\t\n\t\t\t\n\t\t\tif(list.isEmpty())break;\n\t\t\tCollections.sort(list);\n\t\t\tNode N=list.get(0);\n\t\t\t//System.out.println(xShark+\" \"+yShark+\" \"+go);\n\t\t\tarr[xShark][yShark]=0;\n\t\t\txShark=N.x;\n\t\t\tyShark=N.y;\n\t\t\tarr[xShark][yShark]=9;\n\t\t\tgo+=N.distance;\n\t\t\teat++;\n\t\t\tif(eat==size) {\n\t\t\t\teat=0;\n\t\t\t\tsize++;\n\t\t\t}\n\t\t\t/*System.out.println(xShark+\" \"+yShark+\" \"+go);\n\t\t\tfor(int i=0;i<n;i++) {\n\t\t\t\tfor(int j=0;j<n;j++)System.out.print(arr[i][j]);\n\t\t\t\tSystem.out.println();\n\t\t\t}\n\t\t\tfor(int i=0;i<list.size();i++)System.out.println(list.get(i).toString());*/\n\t\t\t//System.out.println();\n\t\t}\n\t\tSystem.out.println(go);\n\t\t\n\t\t\n\t\t\n\t\t\n\t}", "private void makeTree(HashMap<Instance, Bag> instanceBags,\n ArrayList<Instance> all, boolean stopOnFirstPositiveLeaf) {\n\n Random r = new Random(getSeed());\n\n AlgorithmConfiguration settings = getSettings();\n\n ArrayList<TreeNode> toSplit = new ArrayList<TreeNode>();\n\n root = new TreeNode(null, all);\n toSplit.add(root);\n numLeaves = 0;\n\n while (toSplit.size() > 0) {\n\n // The next two lines are here solely to reproduce the results from the\n // paper\n // (i.e. so that the same random number sequence is used.\n int nextIndex = Math.min(1, toSplit.size());\n nextIndex = r.nextInt(nextIndex);\n\n TreeNode next = toSplit.remove(nextIndex);\n if (next == null) {\n continue;\n }\n\n if (next.isPurePositive(instanceBags)) {\n next.makeLeafNode(true);\n ArrayList<String> deactivated = new ArrayList<String>();\n next.deactivateRelatedInstances(instanceBags, deactivated);\n\n if (m_Debug && deactivated.size() > 0) {\n Bag.printDeactivatedInstances(deactivated);\n }\n\n // Need to re-calculate scores if positive leaf has been\n // created\n for (TreeNode n : toSplit) {\n n.removeDeactivatedInstances(instanceBags);\n n.calculateNodeScore(instanceBags, m_unbiasedEstimate,\n m_kBEPPConstant, m_useBagCount, m_bagInstanceMultiplier);\n }\n\n if (stopOnFirstPositiveLeaf && deactivated.size() > 0) {\n return;\n }\n\n } else if (next.isPureNegative(instanceBags)) {\n next.makeLeafNode(false);\n } else {\n next.splitInstances(instanceBags, settings, r, m_Debug);\n if (!next.isLeafNode()) {\n if (next.split.isNominal) {\n TreeNode[] nominals = next.nominals();\n for (TreeNode nominal : nominals) {\n nominal.calculateNodeScore(instanceBags, m_unbiasedEstimate,\n m_kBEPPConstant, m_useBagCount, m_bagInstanceMultiplier);\n toSplit.add(nominal);\n }\n } else {\n next.left().calculateNodeScore(instanceBags, m_unbiasedEstimate,\n m_kBEPPConstant, m_useBagCount, m_bagInstanceMultiplier);\n toSplit.add(next.left());\n next.right().calculateNodeScore(instanceBags, m_unbiasedEstimate,\n m_kBEPPConstant, m_useBagCount, m_bagInstanceMultiplier);\n toSplit.add(next.right());\n }\n } else {\n // Need to re-calculate scores if positive leaf has been\n // created\n if (next.isPositiveLeaf()) {\n for (TreeNode n : toSplit) {\n n.removeDeactivatedInstances(instanceBags);\n n.calculateNodeScore(instanceBags, m_unbiasedEstimate,\n m_kBEPPConstant, m_useBagCount, m_bagInstanceMultiplier);\n }\n\n if (stopOnFirstPositiveLeaf) {\n return;\n }\n }\n }\n }\n\n // Increment number of leaves if necessary\n if (next.isLeafNode()) {\n numLeaves++;\n }\n\n // Re-evaluate the best next node, because we've most likely\n // added new nodes or disabled bags\n Comparator<TreeNode> sh = Collections\n .reverseOrder(new NextSplitHeuristic());\n Collections.sort(toSplit, sh);\n }\n\n if (m_Debug) {\n System.out.println(root.render(1, instanceBags));\n }\n }", "public Node newAlphaBeta(Node node, boolean isMaximizing, Node[][] gameBoard,int playerID,int depth,boolean searchOnce) throws InterruptedException {\n\t\tif(depth==0) //node equals terminal node origin ***************************\n\t\t{\n\n\t\t\t\n\t\t\treturn node; //return heuristic value accumulated Score\n\t\t}\n\t\t\n\t\tif(isMaximizing == true)//max\n\t\t{\n\t\t\t\n\t\t\tNode[][] copyOne = new Node[gameBoard.length][gameBoard.length];\n\t\t\tint enescore=0;\n\t\t\tint nodesRx = 0;\n\t\t\tint nodesRy = 0;\n\t\t\tNode temNode = node;\n\t\t\t//opponent score\n\t\t\tif(node!=null)\n\t\t\t{\tenescore = node.enemy;\n\t\t\tnodesRx = node.maxrecordSearchedX;\n\t\t\tnodesRy = node.maxrecordSearchedY;}\n\t\t\t\n\t\t for (int i = 0; i < gameBoard.length; i++) {\n\t\t \tfor(int j =0;j<gameBoard.length;j++)\n\t\t \t{\t\n\t\t \t\tNode temp = new Node(gameBoard[i][j].getScore(),gameBoard[i][j].getX(),gameBoard[i][j].getY(),gameBoard[i][j].getOwnership());\n\t\t \t\tcopyOne[i][j]=temp;\n\t\t \t}\n\t\t }\n\t\t \n\t\t \n\t\t\tPriorityQueue<Node> playerOneChildrenList = new PriorityQueue<Node>(Collections.reverseOrder()); //use priorityQueue,acsending or disacsending.\n\t\t\tQueue<Node> waitList = new LinkedList<Node>();\n\t\t\tboolean walkable = false;\n\t\t\t\n\t\t\t\tfor(int i = 0;i<gameBoard.length;i++)\n\t\t\t\t{\n\t\t\t\t\tfor(int j =0;j<gameBoard.length;j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(copyOne[i][j].getOwnership()==0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\twaitList.add(new Node(copyOne[i][j].getScore(),i,j,playerID));//everyPosition through the 2D array\n\t\t\t\t\t\twalkable = true;\n\t\t\t\t//\t\tcounter++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\n\t\t\tif(walkable == false)\n\t\t\t{\n\t\t\t\treturn node;\n\t\t\t}\n\t\t\t\n\t\t\tint waitSize = waitList.size();\n\t\t\t\n\t\t\t\n\t\t\tfor(int l = 0;l<waitSize;l++)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tNode[][] newCopy = new Node[gameBoard.length][gameBoard.length];\n\t\t\t\tNode temT = temNode;\n\t\t\t for (int i = 0; i < gameBoard.length; i++) {\n\t\t\t \tfor(int j =0;j<gameBoard.length;j++)\n\t\t\t \t{\t\n\t\t\t \t\tNode temp = new Node(copyOne[i][j].getScore(),copyOne[i][j].getX(),copyOne[i][j].getY(),copyOne[i][j].getOwnership());\n\t\t\t \t\tnewCopy[i][j]=temp;\n\t\t\t \t}\n\t\t\t }\n\t\t\t \n\t\t\t\tNode takenNode =waitList.poll();\n\t\t\t\tcounter++;\n\t\t\t\ttakenNode.setAccumulated(newCopy[takenNode.getX()][takenNode.getY()].getScore());\n\t\t\t\ttakenNode.enemy = 0;\n\t\t\t\tnewCopy[takenNode.getX()][takenNode.getY()].setOwnership(playerID);\n\t\t\t\tboolean connected = false;\n\t\t\t\tfor(int i = 0;i<dx.length;i++)\n\t\t\t\t{\n\t\t\t\t\t\tint newX = takenNode.getX()+dx[i];\n\t\t\t\t\t\tint newY = takenNode.getY()+dy[i];\n\t\t\t\t\t\tif((newX>=0&&newX<gameBoard.length)&&(newY>=0&&newY<gameBoard.length))\n\t\t\t\t\t\t{\n\t\t\t\t\t\tif(newCopy[newX][newY].getOwnership()==playerID)\n\t\t\t\t\t\t{\n\t\t\n\t\t\t\t\t\t\tconnected = true;\n\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\tif(connected == true)\n\t\t\t\t{\n\n\t\t\t\t\tfor(int i = 0;i<dx.length;i++)\n\t\t\t\t\t{\n\t\t\n\t\t\t\t\t\t\tint newX = takenNode.getX()+dx[i];\n\t\t\t\t\t\t\tint newY = takenNode.getY()+dy[i];\n\t\t\t\t\t\t\tif((newX>=0&&newX<gameBoard.length)&&(newY>=0&&newY<gameBoard.length))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(newCopy[newX][newY].getOwnership()!=playerID&&newCopy[newX][newY].getOwnership()!=0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tthis.eatOpponent(newCopy, playerID, newX, newY);\n\t\t\n\t\t\t\t\t\t\t\ttakenNode.setAccumulated(takenNode.getAccumulated()+newCopy[newX][newY].getScore());\n\t\t\t\t\t\t\t\tenescore-=newCopy[newX][newY].getScore();\n\t\t\t\t\t\t\t\ttakenNode.enemy = enescore;\n\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\n\t\t\t\tif(depth==1)\n\t\t\t\t{\n\t\n\t\t\t\t\ttakenNode.setAccumulated(node.getAccumulated()+takenNode.getAccumulated());\n\n\t\t\t\t}\n\t\n\n\t\t\t\tint opponentID = 0;\n\t\t\t\tif(playerID == 1)\n\t\t\t\t{\n\t\t\t\t\topponentID = 2;\n\t\t\t\t}else if(playerID == 2)\n\t\t\t\t{\n\t\t\t\t\topponentID = 1;\n\t\t\t\t}\n\t\t\t\tif(playerOneChildrenList.isEmpty()==false)\n\t\t\t\t{\n\t\t\t\t\t//\tSystem.out.println(\"asdas\");\n\t\t\t//\t\tSystem.out.println(\"A depth: \"+depth);\n\t\t\t\t//\tThread.sleep(300);\n\t\t\t\t\t\tNode minValueNode = newAlphaBeta(takenNode,false,newCopy, opponentID, depth-1,true);\n\t\t\t\t\t\tcounter++;\n\t\t\t\t\t\n\t\t\t\t\t\t\n\n\n\t\t\t\t\t\t\tif(node!=null)\n\t\t\t\t\t\t\t{\tminValueNode.parentNode = new Node(node.getAccumulated(),node.getX(),node.getY(),node.getOwnership());\n\t\t\t\t\t\t\tif(this.beta!=null)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(minValueNode.getAccumulated()<this.alpha.getAccumulated())\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t//\tSystem.out.println(\"break l should be \"+waitSize+\" now: \"+l);\n\t\t\t\t\t\t\t\tplayerOneChildrenList.add(minValueNode);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t//node.noPoll = true;\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}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tplayerOneChildrenList.add(minValueNode);\n\t\t\t\t\t\t\tcontinue;\n\t\n\t\t\t\t\t//\t}\n\t\t\t\t\t\n\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\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t//\tSystem.out.println(\"B depth: \"+depth);\n\t\t\t\t\t//Thread.sleep(300);\n\t\t\t\t\trecordDepth = depth;\n\t\t\t\t\tNode minValueNode = newAlphaBeta(takenNode,false,newCopy, opponentID, depth-1,false);\n\t\t\t\t\t//this.alpha = minValueNode;\n\t\t\t\t\t\n\t\t\t\t\tcounter++;\n\t\t\t\t\t//playeroneNode++;\n\t\t\t\t\tif(node!=null)\n\t\t\t\t\t{\tminValueNode.parentNode = new Node(node.getAccumulated(),node.getX(),node.getY(),node.getOwnership());\n\t\t\t\t\tif(this.beta!=null)\n\t\t\t\t\t{\n\t\t\t\t\tif(minValueNode.getAccumulated()>this.beta.getAccumulated())\n\t\t\t\t\t{\n\t\t\t\t\t//\tSystem.out.println(\"break l should be \"+waitSize+\" now: \"+l);\n\t\t\t\t\t\tplayerOneChildrenList.add(minValueNode);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t//node.noPoll = true;\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\tplayerOneChildrenList.add(minValueNode);\n\t\t\n\t\t\t\t\t\tif(depth == recordDepth)\n\t\t\t\t\t\t{\n\t\t\t//\t\t\t\tSystem.out.println(\"setting alpha\");\n\t\t\t\t\t\t\t//Thread.sleep(300);\n\t\t\t\t\n\t\t\t\t\t\t\t\tthis.alpha = minValueNode;\n\t\t\t//\t\t\tSystem.out.println(\"alpha once: \"+this.alpha.getAccumulated());\n\t\t\t\t\t//\tThread.sleep(5000);\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\n\t\t\tif(playerOneChildrenList.peek().parentNode!=null||node!=null)\n\t\t\t{\n\t\t\t//\tSystem.out.println(\"returning: \"+playerOneChildrenList.peek().getAccumulated());\n\t\t\t//\tSystem.out.println(500);\n\t\t\tplayerOneChildrenList.peek().parentNode.setAccumulated(playerOneChildrenList.peek().getAccumulated());\n\t\t\tplayerOneChildrenList.peek().parentNode.noPoll = playerOneChildrenList.peek().noPoll;\n\n\t\t\treturn playerOneChildrenList.poll().parentNode;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tplayerOneChildrenList.peek().nodeExpanded = counter;\n\t\t\t\treturn playerOneChildrenList.poll();\n\t\t\t}\n\t\t\n\t\t}else\n\t\tif(isMaximizing == false)//min\n\t\t{\n\t\t\tNode[][] copyOne = new Node[gameBoard.length][gameBoard.length];\n\t\t\tint currentEnescore = node.enemy;\n\t\t\tint nodesRx = node.maxrecordSearchedX;\n\t\t\tint nodesRy = node.maxrecordSearchedY;\n\t\t\tNode temNode = node;\n\t\t for (int i = 0; i < gameBoard.length; i++) {\n\t\t \tfor(int j =0;j<gameBoard.length;j++)\n\t\t \t{\t\n\t\t \t\tNode temp = new Node(gameBoard[i][j].getScore(),gameBoard[i][j].getX(),gameBoard[i][j].getY(),gameBoard[i][j].getOwnership());\n\t\t \t copyOne[i][j]=temp;\n\t\t \t}\n\t\t }\n\t\t\tPriorityQueue<Node> playerTwoChildrenList = new PriorityQueue<Node>(); \n\t\t\tQueue<Node> waitList = new LinkedList<Node>();\n\t\t\tboolean walkable = false;\n\t\n\t\t\t\tfor(int i = 0;i<gameBoard.length;i++)\n\t\t\t\t{\n\t\t\t\t\tfor(int j =0;j<gameBoard.length;j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(copyOne[i][j].getOwnership()==0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\twaitList.add(new Node(copyOne[i][j].getScore(),i,j,playerID));//everyPosition through the 2D array\n\t\t\t\t\t\twalkable = true;\n\t\t\t\t//\t\tcounter++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\tif(walkable == false)\n\t\t\t{\n\t\t\t\treturn node;\n\t\t\t}\n\t\t\t\n\t\t\tint waitSize = waitList.size();\n\n\t\t\tfor(int l = 0;l<waitSize;l++)\n\t\t\t{\n\n\t\t\t\tNode[][] newCopy = new Node[gameBoard.length][gameBoard.length];\n\t\t\t\tNode temT = temNode;\n\t\t\t for (int i = 0; i < gameBoard.length; i++) {\n\t\t\t \tfor(int j =0;j<gameBoard.length;j++)\n\t\t\t \t{\t\n\t\t\t \t\tNode temp = new Node(copyOne[i][j].getScore(),copyOne[i][j].getX(),copyOne[i][j].getY(),copyOne[i][j].getOwnership());\n\t\t\t \t\tnewCopy[i][j]=temp;\n\t\t\t \t}\n\t\t\t }\n\n\t\t\t\tNode takenNode = waitList.poll();\n\t\t\t\tcounter++;\n\t\t\t\tnewCopy[takenNode.getX()][takenNode.getY()].setOwnership(playerID);\n\t\t\n\t\t\t\ttakenNode.setAccumulated(node.getAccumulated());\n\n\t\t\t\ttakenNode.enemy= currentEnescore+newCopy[takenNode.getX()][takenNode.getY()].getScore();\n\t\t\t\t\n\t\t\t\tboolean connected = false;\n\t\t\t\tfor(int i = 0;i<dx.length;i++)\n\t\t\t\t{\n\t\n\t\t\t\t\t\tint newX = takenNode.getX()+dx[i];\n\t\t\t\t\t\tint newY = takenNode.getY()+dy[i];\n\t\t\t\t\t\tif((newX>=0&&newX<gameBoard.length)&&(newY>=0&&newY<gameBoard.length))\n\t\t\t\t\t\t{\n\t\t\t\t\t\tif(newCopy[newX][newY].getOwnership()==playerID)\n\t\t\t\t\t\t{\n\t\t\t\t\n\t\t\t\t\t\t\tconnected = true;\n\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\tif(connected == true)\n\t\t\t\t{\n\t\t\t\n\t\t\t\t\tfor(int i = 0;i<dx.length;i++)\n\t\t\t\t\t{\n\t\t\n\t\t\t\t\t\t\tint newX = takenNode.getX()+dx[i];\n\t\t\t\t\t\t\tint newY = takenNode.getY()+dy[i];\n\t\t\t\t\t\t\tif((newX>=0&&newX<gameBoard.length)&&(newY>=0&&newY<gameBoard.length))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(newCopy[newX][newY].getOwnership()!=playerID&&newCopy[newX][newY].getOwnership()!=0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tthis.eatOpponent(newCopy, playerID, newX, newY);\n\t\t\t\t\t\t\t\ttakenNode.setAccumulated(takenNode.getAccumulated()-newCopy[newX][newY].getScore());\t\n\t\t\t\t\t\t\t\ttakenNode.enemy+=newCopy[newX][newY].getScore();\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}\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tint opponentID = 0;\n\t\t\t\tif(playerID == 1)\n\t\t\t\t{\n\t\t\t\t\topponentID = 2;\n\t\t\t\t}else if(playerID == 2)\n\t\t\t\t{\n\t\t\t\t\topponentID = 1;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(playerTwoChildrenList.isEmpty()==false)\n\t\t\t\t{\n\t\t\t//\t\tSystem.out.println(\" C depth: \"+depth);\n\t\t\t\t//\tThread.sleep(300);\n\t\t\t\t\t\tNode maxValueNode = newAlphaBeta(takenNode,true,newCopy, opponentID, depth-1,true);\n\t\t\t\t\t\tcounter++;\n\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t//playeroneNode++;\n\t\t\t\t\t\tmaxValueNode.parentNode = new Node(node.getAccumulated(),node.getX(),node.getY(),node.getOwnership());\n\t\t\t\t\t\tif(this.alpha!=null)\n\t\t\t\t\t\t{\n\t\t\t\t//\t\tSystem.out.println(maxValueNode.getAccumulated()+\" \"+this.alpha.getAccumulated());\n\t\t\t\t\t//\tThread.sleep(5000);\n\t\t\t\t\t\tif(maxValueNode.getAccumulated()<this.alpha.getAccumulated())\n\t\t\t\t\t\t{\n\t\t\t\t\t//\t\tSystem.out.println(\"break l should be \"+waitSize+\" now: \"+l);\n\t\t\t\t\t\t\tplayerTwoChildrenList.add(maxValueNode);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t//node.noPoll = true;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tplayerTwoChildrenList.add(maxValueNode);\n\t\t\t\t\t//\tif(maxValueNode.noPoll == true)\n\t\t\t\t\t//\t{\n\t\t\t\t\t//\t\tSystem.out.println(\"the discard value: \"+maxValueNode.getAccumulated()+\" compareTo: \"+this.alpha.getAccumulated());\n\t\t\t\t\t//\t\tbreak;\n\t\t\t\t\t//\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\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\telse\n\t\t\t\t{\n\t\t\t\t//\tSystem.out.println(\" D depth: \"+depth);\n\t\t\t\t//\tThread.sleep(300);\n\t\t\t\t\tNode maxValueNode = newAlphaBeta(takenNode,true,newCopy, opponentID, depth-1,false);\n\t\t\t\t\tcounter++;\n\t\t\t\t\t\n\t\t\t\t\tmaxValueNode.parentNode = new Node(node.getAccumulated(),node.getX(),node.getY(),node.getOwnership());\n\t\t\t\t\tif(this.alpha!=null)\n\t\t\t\t\t{\n\t\t\t\t\tif(maxValueNode.getAccumulated()<this.alpha.getAccumulated())\n\t\t\t\t\t{\n\t\t\t\t\t//\tSystem.out.println(\"break l should be \"+waitSize+\" now: \"+l);\n\t\t\t\t\t\tplayerTwoChildrenList.add(maxValueNode);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t//node.noPoll = true;\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(depth == recordDepth-1)\n\t\t\t\t\t{\n\t\t//\t\t\t\tSystem.out.println(\"setting alpha\");\n\t\t\t\t\t\t//Thread.sleep(300);\n\t\t\t\n\t\t\t\t\t\t\tthis.beta = maxValueNode;\n\t\t\t\t\t\t\tSystem.out.println(\"beta: \"+this.beta.getAccumulated());\n\t\t\t\t\t\t\t//Thread.sleep(5000);\n\t\t//\t\t\tSystem.out.println(\"alpha once: \"+this.alpha.getAccumulated());\n\t\t\t\t//\tThread.sleep(5000);\n\t\t\t\t\t}\n\t\t\t\t\tplayerTwoChildrenList.add(maxValueNode);\n\t\t\t\t//\tif(maxValueNode.noPoll == true)\n\t\t\t\t//\t{\n\t\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\t}\n\t\t\tplayerTwoChildrenList.peek().parentNode.setAccumulated(playerTwoChildrenList.peek().getAccumulated());\n\n\t\t\treturn playerTwoChildrenList.poll().parentNode;\n\t\t}\n\t\treturn null;\n\t\n\t}", "private List<Double> MinimaxAlgorithm(MinimaxNode<GameState> node, int dataCount){\n if(node.getNumberOfChildren() == 0){ //checks to see if terminal node\n List<Double> heuristics = new ArrayList();\n heuristics.addAll(calculateHeuristic(node.getState()));\n return heuristics;\n }\n else{ //will maximise all the scores for each player.\n double value = Double.NEGATIVE_INFINITY;\n double checkValue;\n int bestMove;\n List<Double> heuristics = new ArrayList();\n if(node.getIfChanceNode()){ //checks if current node is a chance node, if so, times \n for (int i = 0; i < node.getChildren().size(); i++){\n List<Double> tempHeuristics = new ArrayList();\n tempHeuristics.addAll(MinimaxAlgorithm(node.getChildren().get(i),dataCount+1));\n checkValue = node.getChildren().get(i).getProbability() * tempHeuristics.get(node.getNodeIndex());\n value = Math.max(value, checkValue);//maximises the score.\n if(checkValue == value){\n heuristics.addAll(tempHeuristics); \n }\n if(dataCount == 0){//checks if this is the root node\n if(checkValue == value){\n MinimaxPlayer.optimalMoves = node.getChildren().get(i).getState().getOrientation(node.getNodeIndex()); \n }\n } \n }\n }\n else{\n for (int i = 0; i < node.getChildren().size(); i++){\n List<Double> tempHeuristics = new ArrayList();\n tempHeuristics.addAll(MinimaxAlgorithm(node.getChildren().get(i),dataCount+1));\n checkValue = tempHeuristics.get(node.getNodeIndex());\n value = Math.max(value, checkValue);//maximises the score.\n if(checkValue == value){\n heuristics.addAll(tempHeuristics); \n }\n if(dataCount == 0){//checks if this is the root node\n if(checkValue == value){\n MinimaxPlayer.optimalMoves = node.getChildren().get(i).getState().getOrientation(node.getNodeIndex()); \n }\n } \n } \n }\n return heuristics;\n } \n }", "public static void main(String[] args) {\n\n BDNode a = new BDNode(\"A\");\n BDNode b = new BDNode(\"B\");\n BDNode c = new BDNode(\"C\");\n BDNode d = new BDNode(\"D\");\n BDNode e = new BDNode(\"E\");\n\n a.link(b);\n a.link(d);\n b.link(a);\n b.link(c);\n b.link(e);\n c.link(b);\n c.link(d);\n d.link(a);\n d.link(c);\n d.link(e);\n e.link(b);\n e.link(d);\n\n BDNode target = e;\n\n/*\n // BFS\n Queue<BDNode> queue = new LinkedList<>();\n queue.offer(a);\n\n while(!queue.isEmpty()) {\n BDNode n = queue.poll();\n n.visit();\n System.out.println(n); // 찾는 여정 출력\n\n if(n.equals(target)) {\n System.out.println(\"BFS Found! \" + n);\n break;\n }\n\n for (BDNode l : n.links) {\n if(l.isVisited()) continue;\n if (queue.contains(l)) continue;\n queue.offer(l);\n }\n\n // 위랑 같은 표현\n// n.links.stream()\n// .filter(l -> !queue.contains(l))\n// .forEach(queue::offer);\n }\n*/\n\n // DFS\n Stack<BDNode> stack = new Stack<>();\n stack.push(a);\n\n while(!stack.isEmpty()) {\n BDNode n = stack.pop();\n n.visit();\n System.out.println(n); // 찾는 여정 출력\n\n if (n.equals(target)) {\n System.out.println(\"DFS Found! \" + n);\n break;\n }\n\n for (BDNode l : n.links) {\n if (l.isVisited()) continue;\n if (stack.contains(l)) continue;\n\n stack.push(l);\n }\n }\n\n\n }", "private void depthFirstSearch(Slot start, ArrayList<Pair<Slot, Slot>> moves, HashMap<Slot, Slot> parents) {\n boolean[][] visitedSlots = new boolean[Board.MAX_ROW][Board.MAX_COLUMN];\n\n setSlotsAsNotVisited(visitedSlots);\n\n Stack<Slot> dfsStack = new Stack<>();\n int color = start.getColor();\n\n dfsStack.push(start);\n Slot previous = start;\n\n boardObject.setSlotColor(boardObject.getSlot(start.getRow(), start.getColumn()), Slot.EMPTY);\n\n while (!dfsStack.empty()) {\n Pair<Slot, Slot> next;\n Slot current = dfsStack.pop();\n\n if (!visitedSlots[current.getRow()][current.getColumn()] && !current.equals(previous)) {\n if (!current.equals(start)) {\n visitedSlots[current.getRow()][current.getColumn()] = true;\n }\n\n next = new Pair<>(start, current);\n\n moves.add(next);\n }\n\n Slot up = getUp(current);\n Slot down = getDown(current);\n Slot left = getLeft(current);\n Slot right = getRight(current);\n\n if (left != null && !visitedSlots[left.getRow()][left.getColumn()]) {\n if (!isChild(current, left, parents)) {\n dfsStack.push(left);\n parents.put(left, current);\n }\n }\n\n if (down != null && !visitedSlots[down.getRow()][down.getColumn()]) {\n if (!isChild(current, down, parents)) {\n dfsStack.push(down);\n parents.put(down, current);\n }\n }\n\n if (right != null && !visitedSlots[right.getRow()][right.getColumn()]) {\n if (!isChild(current, right, parents)) {\n dfsStack.push(right);\n parents.put(right, current);\n }\n }\n\n if (up != null && !visitedSlots[up.getRow()][up.getColumn()]) {\n if (!isChild(current, up, parents)) {\n dfsStack.push(up);\n parents.put(up, current);\n }\n }\n\n previous = current;\n }\n\n boardObject.setSlotColor(boardObject.getSlot(start.getRow(), start.getColumn()), color);\n }", "private ArrayList<String> makeChildren(Node current) {\n\n ArrayList<String> current_children = new ArrayList<>();\n\n if (current != null && current.getDigit().last_changed != 0) {\n //-1 child first digit\n if ((Integer.parseInt(current.getDigit().getFirst_digit()) - 1 >= 0)) {\n String child_node = current.getDigit().decreaseFirstDigit();\n current_children.add(child_node);\n }\n\n //+1 child first digit\n if ((Integer.parseInt(current.getDigit().getFirst_digit()) + 1 <= 9)) {\n String child_node = current.getDigit().increaseFirstDigit();\n current_children.add(child_node);\n }\n }\n\n if (current != null && current.getDigit().last_changed != 1) {\n //-1 child\n if ((Integer.parseInt(current.getDigit().getSecond_digit()) - 1 >= 0)) {\n String child_node = current.getDigit().decreaseSecondDigit();\n current_children.add(child_node);\n }\n\n //+1 child\n if ((Integer.parseInt(current.getDigit().getSecond_digit()) + 1 <= 9)) {\n String child_node = current.getDigit().increaseSecondDigit();\n current_children.add(child_node);\n }\n }\n\n if (current != null && current.getDigit().last_changed != 2) {\n //-1 child\n if ((Integer.parseInt(current.getDigit().getThird_digit()) - 1 >= 0)) {\n String child_node = current.getDigit().decreaseThirdDigit();\n current_children.add(child_node);\n }\n //+1 child\n if ((Integer.parseInt(current.getDigit().getThird_digit()) + 1 <= 9)) {\n String child_node = current.getDigit().increaseThirdDigit();\n current_children.add(child_node);\n }\n }\n return current_children;\n }", "private void expandTree(TreeNode tn,Set<Condition> conds)\n{\n List<RuleInstance> rules = tn.getRules();\n double tot = rules.size();\n if (tot <= 1) return;\n if (conds == null || conds.isEmpty()) return;\n\n Condition best = null;\n List<RuleInstance> bestp = null;\n List<RuleInstance> bestf = null;\n double bestv = 0;\n\n for (Condition c : conds) {\n List<RuleInstance> pr = new ArrayList<RuleInstance>();\n List<RuleInstance> fr = new ArrayList<RuleInstance>();\n for (RuleInstance ri : rules) {\n\t if (c.match(ri)) pr.add(ri);\n\t else fr.add(ri);\n }\n if (pr.size() == 0 || fr.size() == 0) continue;\n double vp = pr.size() / tot;\n double vf = fr.size() / tot;\n double e = - vp * Math.log(vp) - vf * Math.log(vf);\n if (e > bestv) {\n\t best = c;\n\t bestp = pr;\n\t bestf = fr;\n }\n }\n\n if (best == null) return;\n\n tn.setCondition(best,bestp,bestf);\n expandTree(tn.getPassTree(),conds);\n expandTree(tn.getFailTree(),conds);\n}", "static boolean bfs(TreeNode root) {\n Queue<TreeNode> queue = new LinkedList<TreeNode>();\n queue.add(root);\n while (!queue.isEmpty()) {\n TreeNode node = (TreeNode) queue.remove();\n if (node == null)\n continue;\n System.out.println(\"Checking node \" + node.data);\n if (isGoal(node)) {\n System.out.println(\"\\nFound goal node \" + node.data);\n return true;\n }\n queue.addAll(node.getChildren());\n // dump(queue);\n }\n return false;\n }", "private void bfs() {\n\t\tQueue<Node> q = new ArrayDeque<>();\n\t\tq.add(treeNodes.get(0));\n\t\twhile (!q.isEmpty()) {\n\t\t\tint size = q.size();\n\t\t\tfor (int i = 0; i < size; i++) {\n\t\t\t\tNode curr = q.poll();\n\t\t\t\ttime += curr.informTime;\n\t\t\t\tSet<Node> nextNodes = curr.nextNodes;\n\t\t\t\tif (nextNodes == null || curr.id == treeNodes.get(0).id)\n\t\t\t\t\tcontinue;\n\t\t\t\tfor (Node node : nextNodes) {\n\t\t\t\t\tq.add(node);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}", "public List<T> wantedNodesIterative(Predicate<T> p) {\n //PART 4 \n if(root == null){\n return null;\n }\n LinkedList<TreeNode<T>> stack = new LinkedList<>();\n stack.add(root);\n \n List<T> wantedNodes =new LinkedList<>();\n TreeNode<T> current;\n \n while(!stack.isEmpty()){\n current = stack.pop();\n if(p.check(current.data)){\n wantedNodes.add(current.data);\n }\n if(current.right != null){\n stack.addFirst(current.right);\n }\n if(current.left != null){\n stack.addFirst(current.left);\n }\n }\n return wantedNodes;\n }", "private static void greedyTime(Person curPerson, Map<String, Person> persons) throws FileNotFoundException {\n\t\tclass DisComparator implements Comparator<Person> {\n\t\t\tpublic int compare(Person a, Person b) {\n\t\t\t\treturn a.getEstDistTime() - b.getEstDistTime();\n\t\t\t} \n\t\t}\n\t\t\n\t\tPriorityQueue<Person> pqueue = new PriorityQueue<Person>(persons.size(), new DisComparator());\t\t\n\t\tpqueue.add(curPerson);\n\t\t\n\t\touterloop:\n\t\twhile(!pqueue.isEmpty()) {\n\t\t\tcurPerson = pqueue.poll();\n\t\t\t\n\t\t\tArrayList<Person> children = curPerson.getConnected();\n\t\t\tPerson child;\n\t\t\tfor(int i = 0; i < children.size(); i++) {\n\t\t\t\tchild = children.get(i);\n\t\t\t\tif(!child.getMarked()) {\n\t\t\t\t\tchild.setRoute(curPerson);\n\t\t\t\t\tchild.setMarked();\n\t\t\t\t\tif(child.getName().equals(\"Noah\")) {\t//check when generated\n\t\t\t\t\t\tcurPerson = child;\n\t\t\t\t\t\tbreak outerloop;\n\t\t\t\t\t}\n\t\t\t\t\tpqueue.add(child);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\toutputResult(curPerson, \"Greedy.time.result.txt\");\n\t}", "static int downToZero(Node root) {\n /*\n * Write your code here.\n */\n Queue<Node> queue = new PriorityQueue<>();\n queue.add(root);\n int min = 100001;\n while (!queue.isEmpty()){\n Node current = queue.poll();\n if(current.value <= 4){\n if (current.value == 4){\n min = current.depth + 3;\n return min;\n }\n min = current.depth+current.value;\n return min;\n }\n Node toAdd1 = new Node(current.value-1, current.depth+1);\n queue.add(toAdd1);\n for(int i = 2; i<=Math.sqrt(current.value); i++){\n if(current.value%i==0){\n Node toAdd = new Node(current.value/i, current.depth+1);\n queue.add(toAdd);\n }\n }\n }\n return min;\n }", "private int optimize() {\n\t\t// items: Items sorted by value-to-weight ratio for linear relaxation\n\t\t// t: the decision vector being tested at each node\n\t\t// ws, vs, is, bs: stacks of weight, value, item id, whether bring item\n\t\t// p: stack pointer; i, b, weight, value: loop caches; best: max search\n\t\t// ss: stack size: Always <=2 children on stack for <=n-1 parents\n\t\tItem[] items = new Item[n];\n\t\tint ss = 2 * n;\n\t\tint[] itemsSorted = new int[n], t = new int[n], ws = new int[ss],\n\t\t\tvs = new int[ss], is = new int[ss], bs = new int[ss];\n\t\tint i, b, weight, value, best = 0, p = 0;\n\n\t\tfor (int j = 0; j < n; j++)\n\t\t\titems[j] = new Item(j);\n\t\tArrays.sort(items);\n\t\tfor (int j = 0; j < n; j++)\n\t\t\titemsSorted[j] = items[j].i();\n\t\titems = null; // For garbage collection.\n\n\t\t// Push item 0 onto the stack with and without bringing it.\n\t\tws[p] = 0; vs[p] = 0; is[p] = 0; bs[p] = 1; p++;\n\t\tws[p] = 0; vs[p] = 0; is[p] = 0; bs[p] = 0; p++;\n\n\t\twhile (p > 0) {\n\t\t\tp--; // Pop the latest item off the stack\n\t\t\ti = is[p]; b = bs[p];\n\t\t\tweight = ws[p] + w[i] * b;\n\t\t\tif (weight > k)\n\t\t\t\tcontinue;\n\t\t\tvalue = vs[p] + v[i] * b;\n\t\t\tif (bound(i, weight, value, itemsSorted) < best)\n\t\t\t\tcontinue;\n\t\t\tbest = Math.max(value, best);\n\t\t\tt[i] = b;\n\t\t\tif (i < n - 1) { // Push children onto stack w/ & w/o bringing item\n\t\t\t\tws[p] = weight; vs[p] = value; is[p] = i + 1; bs[p] = 1; p++;\n\t\t\t\tws[p] = weight; vs[p] = value; is[p] = i + 1; bs[p] = 0; p++;\n\t\t\t}\n\t\t\telse if (value >= best)\n\t\t\t\tSystem.arraycopy(t, 0, x, 0, n);\n\t\t}\n\t\treturn best;\n\t}", "private void sink(int i) {\n if (2*i > N)\n return;\n int maxChild = 2*i;\n if (maxChild < N && compare(maxChild, maxChild+1) < 0)\n maxChild++;\n if (compare(maxChild, i) > 0) {\n swap(maxChild, i);\n sink(maxChild);\n }\n }", "private static void dfsBribe(int n, List<Integer>[] ch, long[] w) {\n if (ch[n].size() == 0){\n In[n] = w[n];\n OutD[n] = Long.MAX_VALUE;\n OutU[n] = 0;\n }\n //recurrance case: non.leaf, do dfs for all subordinates then calculate In, OutUp & OutDown.\n else{\n for (int c:ch[n])\n dfsBribe(c, ch, w); //running once for each child thereby O(N)\n In[n] = w[n];\n for (int c:ch[n]){ //O(N) running time\n In[n] += OutU[c];\n OutU[n] += Math.min(In[c], OutD[c]);\n OutD[n] += Math.min(In[c], OutD[c]);\n }\n OutD[n] += delta(n, ch); //add delta for no in Children\n }\n\n }", "private Node selectAndExpandNewNode() {\n // Start at the root\n Node node = root;\n\n // Iterate down the tree until reaching a goal state\n while (node.getState().getPos() < problemSpec.getN()) {\n // Get the best action from the current node using UCT\n Action action = selectBestAction(node);\n\n // Simulate a single action\n FromStateSimulator FSS = new FromStateSimulator(problemSpec);\n FSS.setStartState(node.getState(), stepsDone + node.getStepsFromRoot());\n FSS.step(action);\n State newState = FSS.getCurrentState();\n\n // Get the node representing the outcome of the transition\n Node child = node.childWithStateAction(newState, action);\n\n // If this outcome node has not been added to the tree, add it\n if (child == null) {\n Node newNode = new Node(newState, FSS.getSteps());\n newNode.setParentNodeAndAction(node, action);\n node.addChildNode(newNode);\n\n // Return this new node\n return newNode;\n }\n\n // Now repeat the process using this child node\n node = child;\n }\n\n return node;\n }", "public AttackTreeNode buildNextChild(AttackTreeNode activeChild) {\n \n AttackTreeNode nextNode = null;\n \n // AttackParameter has no children...\n \n return nextNode;\n }", "public NCRPNode select() {\n\t\t\t\n\t\t\t//dim number of children + 1 (unallocated mass) \n\t\t\tdouble[] weights = new double[children.size() + 1];\n\t \n\t\t\t//weight of unallocated probability mass\n\t\t\tweights[0] = gamma / (gamma + customers);\n\t\t\t\n\t\t\t//calc weight for each child based on the number of customers on them\n\t\t\tint i = 1;\n\t\t\tfor (NCRPNode child: children) {\n\t\t\t\tweights[i] = (double) child.customers / (gamma + customers);\n\t\t\t\ti++;\n\t\t\t}\n\n\t\t\t//sample a child with higher weight\n\t\t\tint choice = random.nextDiscrete(weights);\n\t\t\t//if unallocated mass is sampled, create a new child\n\t\t\tif (choice == 0) {\n\t\t\t\treturn(addChild());\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn children.get(choice - 1);\n\t\t\t}\n\t\t}", "@Override\n\tpublic void solve() {\n\t\tlong startTime = System.nanoTime();\n\n\t\twhile(!unvisitedPM.isEmpty()){\n\t\t\tProblemModel current = findCheapestNode();\n\t\n\t\t\tfor(ProblemModel pm : current.getSubNodes()){\n\t\t\n\t\t\t\tif(!visited.contains(pm) && !unvisitedPM.contains(pm)){\n\t\t\t\t\t\n\t\t\t\t\tunvisitedPM.add(pm);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif(current.getSideStart().isEmpty()){\n\t\t\t\tSystem.out.print( \"\\n\"+ \"StartSide Runners: \");\n\t\t\t\tfor(Integer r: current.getSideStart()){\n\t\t\t\t\tSystem.out.print( \" \" +r) ;\n\t\t\t\t}\n\t\t\t\tSystem.out.print( \"\\n\" + \"EndSide Runners: \");\n\t\t\t\tfor(Integer r: current.getSideEnd()){\n\t\t\t\t\tSystem.out.print( \" \" + r);\n\t\t\t\t}\n\n\t\t\t\tprintPathTaken(current);\n\t\t\t\tSystem.out.print( \"\\n\" + \"------------done--------------\");\n\t\t\t\tlong endTime = System.nanoTime();\n\t\t\t\tlong duration = ((endTime - startTime)/1000000);\n\t\t\t\tSystem.out.print( \"\\n\" + \"-AS1 Time taken: \" + duration + \"ms\");\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tvisited.add(current);\n\t\t\n\t\t}\n\t\t\n\n\t}", "public static LinkedList<LinkedList<String>> getNextLevel(Graph G, LinkedList<LinkedList<String>> Parents, boolean sharon) {\r\n\t\tLinkedList<LinkedList<String>> Children = new LinkedList<LinkedList<String>>();\r\n\t\tLinkedList<String> Pi, Pj, u;\r\n\t\tfor (int i=0; i<Parents.size(); i++) {\r\n\t\t\tPi = Parents.get(i);\r\n\t\t\tfor (int j=i+1; j<Parents.size(); j++) {\r\n\t\t\t\tPj = Parents.get(j);\r\n\t\t\t\t\r\n\t\t\t\tboolean generateChild = true;\r\n\t\t\t\t\r\n\t\t\t\tif (Pj.size()>1) {\r\n\t\t\t\t\tfor (int k = 0; k<Pj.size()-1; k++) {\r\n\t\t\t\t\t\tif (Pi.get(k)!=Pj.get(k)) {\r\n\t\t\t\t\t\t\tgenerateChild = false;\r\n\t\t\t\t\t\t\tbreak;\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\r\n\t\t\t\tif (generateChild && sharon && G.hasEdge(Pi.get(Pi.size()-1), Pj.get(Pj.size()-1))) {\r\n\t\t\t\t\tgenerateChild = false;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif (generateChild) {\r\n\t\t\t\t\tu = new LinkedList<String>();\r\n\t\t\t\t\tfor (int n=0; n<Pi.size(); n++) {\r\n\t\t\t\t\t\tu.add(Pi.get(n));\r\n\t\t\t\t\t}\r\n\t\t\t\t\tu.add(Pj.get(Pj.size()-1));\r\n\t\t\t\t\t//System.err.println(\"added \" + u);\r\n\t\t\t\t\tChildren.add(u);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn Children;\r\n\t}", "static boolean dfs(TreeNode root) {\n Stack<TreeNode> stack = new Stack<TreeNode>();\n stack.push(root);\n while (!stack.isEmpty()) {\n TreeNode node = (TreeNode) stack.pop();\n if (node == null)\n continue;\n\n System.out.println(\"Checking node \" + node.data);\n if (isGoal(node)) {\n System.out.println(\"\\nFound goal node \" + node.data);\n return true;\n }\n stack.addAll(node.getChildren());\n // dump(stack);\n }\n return false;\n }", "private void expandNode() {\r\n\t\t\t// Dijkstra's algorithm to handle separately\r\n\t\t\tif (dijkstra.isSelected()) {\r\n\t\t\t\tCell u;\r\n\t\t\t\t// 11: while Q is not empty:\r\n\t\t\t\tif (graph.isEmpty()) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\t// 12: u := vertex in Q (graph) with smallest distance in dist[]\r\n\t\t\t\t// ;\r\n\t\t\t\t// 13: remove u from Q (graph);\r\n\t\t\t\tu = graph.remove(0);\r\n\t\t\t\t// Add vertex u in closed set\r\n\t\t\t\tclosedSet.add(u);\r\n\t\t\t\t// If target has been found ...\r\n\t\t\t\tif (u.row == targetPos.row && u.col == targetPos.col) {\r\n\t\t\t\t\tfound = true;\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\t// Counts nodes that have expanded.\r\n\t\t\t\texpanded++;\r\n\t\t\t\t// Update the color of the cell\r\n\t\t\t\tgrid[u.row][u.col] = CLOSED;\r\n\t\t\t\t// 14: if dist[u] = infinity:\r\n\t\t\t\tif (u.dist == INFINITY) {\r\n\t\t\t\t\t// ... then there is no solution.\r\n\t\t\t\t\t// 15: break;\r\n\t\t\t\t\treturn;\r\n\t\t\t\t\t// 16: end if\r\n\t\t\t\t}\r\n\t\t\t\t// Create the neighbors of u\r\n\t\t\t\tArrayList<Cell> neighbors = createSuccesors(u, false);\r\n\t\t\t\t// 18: for each neighbor v of u:\r\n\t\t\t\tfor (Cell v : neighbors) {\r\n\t\t\t\t\t// 20: alt := dist[u] + dist_between(u, v) ;\r\n\t\t\t\t\tint alt = u.dist + distBetween(u, v);\r\n\t\t\t\t\t// 21: if alt < dist[v]:\r\n\t\t\t\t\tif (alt < v.dist) {\r\n\t\t\t\t\t\t// 22: dist[v] := alt ;\r\n\t\t\t\t\t\tv.dist = alt;\r\n\t\t\t\t\t\t// 23: previous[v] := u ;\r\n\t\t\t\t\t\tv.prev = u;\r\n\t\t\t\t\t\t// Update the color of the cell\r\n\t\t\t\t\t\tgrid[v.row][v.col] = FRONTIER;\r\n\t\t\t\t\t\t// 24: decrease-key v in Q;\r\n\t\t\t\t\t\t// (sort list of nodes with respect to dist)\r\n\t\t\t\t\t\tCollections.sort(graph, new CellComparatorByDist());\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// The handling of the other four algorithms\r\n\t\t\t} else {\r\n\t\t\t\tCell current;\r\n\t\t\t\tif (dfs.isSelected() || bfs.isSelected()) {\r\n\t\t\t\t\t// Here is the 3rd step of the algorithms DFS and BFS\r\n\t\t\t\t\t// 3. Remove the first state, Si, from OPEN SET ...\r\n\t\t\t\t\tcurrent = openSet.remove(0);\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// Here is the 3rd step of the algorithms A* and Greedy\r\n\t\t\t\t\t// 3. Remove the first state, Si, from OPEN SET,\r\n\t\t\t\t\t// for which f(Si) ≤ f(Sj) for all other\r\n\t\t\t\t\t// open states Sj ...\r\n\t\t\t\t\t// (sort first OPEN SET list with respect to 'f')\r\n\t\t\t\t\tCollections.sort(openSet, new CellComparatorByF());\r\n\t\t\t\t\tcurrent = openSet.remove(0);\r\n\t\t\t\t}\r\n\t\t\t\t// ... and add it to CLOSED SET.\r\n\t\t\t\tclosedSet.add(0, current);\r\n\t\t\t\t// Update the color of the cell\r\n\t\t\t\tgrid[current.row][current.col] = CLOSED;\r\n\t\t\t\t// If the selected node is the target ...\r\n\t\t\t\tif (current.row == targetPos.row && current.col == targetPos.col) {\r\n\t\t\t\t\t// ... then terminate etc\r\n\t\t\t\t\tCell last = targetPos;\r\n\t\t\t\t\tlast.prev = current.prev;\r\n\t\t\t\t\tclosedSet.add(last);\r\n\t\t\t\t\tfound = true;\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\t// Count nodes that have been expanded.\r\n\t\t\t\texpanded++;\r\n\t\t\t\t// Here is the 4rd step of the algorithms\r\n\t\t\t\t// 4. Create the successors of Si, based on actions\r\n\t\t\t\t// that can be implemented on Si.\r\n\t\t\t\t// Each successor has a pointer to the Si, as its predecessor.\r\n\t\t\t\t// In the case of DFS and BFS algorithms, successors should not\r\n\t\t\t\t// belong neither to the OPEN SET nor the CLOSED SET.\r\n\t\t\t\tArrayList<Cell> succesors;\r\n\t\t\t\tsuccesors = createSuccesors(current, false);\r\n\t\t\t\t// Here is the 5th step of the algorithms\r\n\t\t\t\t// 5. For each successor of Si, ...\r\n\t\t\t\tfor (Cell cell : succesors) {\r\n\t\t\t\t\t// ... if we are running DFS ...\r\n\t\t\t\t\tif (dfs.isSelected()) {\r\n\t\t\t\t\t\t// ... add the successor at the beginning of the list\r\n\t\t\t\t\t\t// OPEN SET\r\n\t\t\t\t\t\topenSet.add(0, cell);\r\n\t\t\t\t\t\t// Update the color of the cell\r\n\t\t\t\t\t\tgrid[cell.row][cell.col] = FRONTIER;\r\n\t\t\t\t\t\t// ... if we are runnig BFS ...\r\n\t\t\t\t\t} else if (bfs.isSelected()) {\r\n\t\t\t\t\t\t// ... add the successor at the end of the list OPEN SET\r\n\t\t\t\t\t\topenSet.add(cell);\r\n\t\t\t\t\t\t// Update the color of the cell\r\n\t\t\t\t\t\tgrid[cell.row][cell.col] = FRONTIER;\r\n\t\t\t\t\t\t// ... if we are running A* or Greedy algorithms (step 5\r\n\t\t\t\t\t\t// of A* algorithm) ...\r\n\t\t\t\t\t} else if (aStar.isSelected() || guloso.isSelected()) {\r\n\t\t\t\t\t\t// ... calculate the value f(Sj) ...\r\n\t\t\t\t\t\tint dxg = current.col - cell.col;\r\n\t\t\t\t\t\tint dyg = current.row - cell.row;\r\n\t\t\t\t\t\tint dxh = targetPos.col - cell.col;\r\n\t\t\t\t\t\tint dyh = targetPos.row - cell.row;\r\n\t\t\t\t\t\tif (diagonal.isSelected()) {\r\n\t\t\t\t\t\t\t// with diagonal movements\r\n\t\t\t\t\t\t\t// calculate 1000 times the Euclidean distance\r\n\t\t\t\t\t\t\tif (guloso.isSelected()) {\r\n\t\t\t\t\t\t\t\t// especially for the Greedy ...\r\n\t\t\t\t\t\t\t\tcell.g = 0;\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tcell.g = current.g + (int) ((double) 1000 * Math.sqrt(dxg * dxg + dyg * dyg));\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tcell.h = (int) ((double) 1000 * Math.sqrt(dxh * dxh + dyh * dyh));\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t// without diagonal movements\r\n\t\t\t\t\t\t\t// calculate Manhattan distances\r\n\t\t\t\t\t\t\tif (guloso.isSelected()) {\r\n\t\t\t\t\t\t\t\t// especially for the Greedy ...\r\n\t\t\t\t\t\t\t\tcell.g = 0;\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tcell.g = current.g + Math.abs(dxg) + Math.abs(dyg);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tcell.h = Math.abs(dxh) + Math.abs(dyh);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tcell.f = cell.g + cell.h;\r\n\t\t\t\t\t\t// ... If Sj is neither in the OPEN SET nor in the\r\n\t\t\t\t\t\t// CLOSED SET states ...\r\n\t\t\t\t\t\tint openIndex = isInList(openSet, cell);\r\n\t\t\t\t\t\tint closedIndex = isInList(closedSet, cell);\r\n\t\t\t\t\t\tif (openIndex == -1 && closedIndex == -1) {\r\n\t\t\t\t\t\t\t// ... then add Sj in the OPEN SET ...\r\n\t\t\t\t\t\t\t// ... evaluated as f(Sj)\r\n\t\t\t\t\t\t\topenSet.add(cell);\r\n\t\t\t\t\t\t\t// Update the color of the cell\r\n\t\t\t\t\t\t\tgrid[cell.row][cell.col] = FRONTIER;\r\n\t\t\t\t\t\t\t// Else ...\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t// ... if already belongs to the OPEN SET, then ...\r\n\t\t\t\t\t\t\tif (openIndex > -1) {\r\n\t\t\t\t\t\t\t\t// ... compare the new value assessment with the\r\n\t\t\t\t\t\t\t\t// old one.\r\n\t\t\t\t\t\t\t\t// If old <= new ...\r\n\t\t\t\t\t\t\t\tif (openSet.get(openIndex).f <= cell.f) {\r\n\t\t\t\t\t\t\t\t\t// ... then eject the new node with state\r\n\t\t\t\t\t\t\t\t\t// Sj.\r\n\t\t\t\t\t\t\t\t\t// (ie do nothing for this node).\r\n\t\t\t\t\t\t\t\t\t// Else, ...\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t// ... remove the element (Sj, old) from the\r\n\t\t\t\t\t\t\t\t\t// list\r\n\t\t\t\t\t\t\t\t\t// to which it belongs ...\r\n\t\t\t\t\t\t\t\t\topenSet.remove(openIndex);\r\n\t\t\t\t\t\t\t\t\t// ... and add the item (Sj, new) to the\r\n\t\t\t\t\t\t\t\t\t// OPEN SET.\r\n\t\t\t\t\t\t\t\t\topenSet.add(cell);\r\n\t\t\t\t\t\t\t\t\t// Update the color of the cell\r\n\t\t\t\t\t\t\t\t\tgrid[cell.row][cell.col] = FRONTIER;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t// ... if already belongs to the CLOSED SET,\r\n\t\t\t\t\t\t\t\t// then ...\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t// ... compare the new value assessment with the\r\n\t\t\t\t\t\t\t\t// old one.\r\n\t\t\t\t\t\t\t\t// If old <= new ...\r\n\t\t\t\t\t\t\t\tif (closedSet.get(closedIndex).f <= cell.f) {\r\n\t\t\t\t\t\t\t\t\t// ... then eject the new node with state\r\n\t\t\t\t\t\t\t\t\t// Sj.\r\n\t\t\t\t\t\t\t\t\t// (ie do nothing for this node).\r\n\t\t\t\t\t\t\t\t\t// Else, ...\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t// ... remove the element (Sj, old) from the\r\n\t\t\t\t\t\t\t\t\t// list\r\n\t\t\t\t\t\t\t\t\t// to which it belongs ...\r\n\t\t\t\t\t\t\t\t\tclosedSet.remove(closedIndex);\r\n\t\t\t\t\t\t\t\t\t// ... and add the item (Sj, new) to the\r\n\t\t\t\t\t\t\t\t\t// OPEN SET.\r\n\t\t\t\t\t\t\t\t\topenSet.add(cell);\r\n\t\t\t\t\t\t\t\t\t// Update the color of the cell\r\n\t\t\t\t\t\t\t\t\tgrid[cell.row][cell.col] = FRONTIER;\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}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}", "public void selectParents1() {\n // Create a new parent list for this reproductive cycle. Let the garbage\n // handler dispose of the old list, if there was one.\n switch (Defines.parentAlgo) {\n case Defines.PA_RANDOM:\n this.parents = this.selectParentsRandom();\n break;\n\n case Defines.PA_ROULETTE:\n this.parents = this.selectParentsRoulette();\n break;\n\n case Defines.PA_TOURNAMENT:\n this.parents = this.selectParentsTournament();\n break;\n }\n// this.howGoodAreParents();\n }", "public void growthCycle() {\n\t\tboolean doMore = true;\n\t\tdo {\n\t\t\tdoMore = false;\n\t\t\tgrower = planter;\n\t\t\tCollections.shuffle(grower, random);\n\t\t\tplanter = new ArrayList<Room>();\n\t\t\tfor(Room room : grower) {\n\t\t\t\tif(rooms.size() >= size.maxRooms) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif(room.plantChildren(this)) {\n\t\t\t\t\t//System.out.println(\"Added side room.\");\n\t\t\t\t\tdoMore = true;\n\t\t\t\t}\n\t\t\t} \n\t\t} while(doMore);\t\t\n\t\t//DoomlikeDungeons.profiler.endTask(\"Adding Rooms (growthCycle)\");\n\t}", "public void selectParents() {\n // Create a new parent list for this reproductive cycle. Let the garbage\n // handler dispose of the old list, if there was one.\n switch (Defines.parentAlgo) {\n case Defines.PA_RANDOM:\n this.parents = this.selectParentsRandom();\n break;\n\n case Defines.PA_ROULETTE:\n this.parents = this.selectParentsRoulette();\n break;\n\n case Defines.PA_TOURNAMENT:\n this.parents = this.selectParentsTournament();\n break;\n }\n// this.howGoodAreParents();\n }", "protected void siftDown() {\r\n\t\tint parent = 0, child = (parent << 1) + 1;// preguntar porque 0 y no 1\r\n\t\t\r\n\t\twhile (child < theHeap.size()) {\r\n\t\t\tif (child < theHeap.size() - 1\r\n\t\t\t\t\t&& compare(theHeap.get(child), theHeap.get(child + 1)) > 0)\r\n\t\t\t\tchild++; // child is the right child (child = (2 * parent) + 2)\r\n\t\t\tif (compare(theHeap.get(child), theHeap.get(parent)) >= 0)\r\n\t\t\t\tbreak;\r\n\t\t\tswap(parent, child);\r\n\t\t\tparent = child;\r\n\t\t\tchild = (parent << 1) + 1; // => child = (2 * parent) + 1\r\n\t\t}\r\n\t}", "ArrayList<Cell> getChildren(Integer[][] level){\n int[][] values={{0,1},{0,-1},{1,0},{-1,0}};\n ArrayList<Cell> children = new ArrayList<>();\n for (int i = 0; i < values.length; i++){\n if (isLegalMove(this.getI()+values[i][0], this.getJ()+values[i][1],level)){\n children.add(new Cell(this.getI()+values[i][0], this.getJ()+values[i][1]));\n }\n }\n //the code below achieves the same goal; still here for clarity\n\n// if (isLegalMove(this.getI(), this.getJ()+1, level)) {\n// children.add(new Cell(this.getI(), this.getJ()+1));\n// }\n// if (isLegalMove(this.getI(), this.getJ()-1, level)) {\n// children.add(new Cell(this.getI(), this.getJ()-1));\n// }\n// if (isLegalMove(this.getI()+1, this.getJ(), level)) {\n// children.add(new Cell(this.getI()+1, this.getJ()));\n// }\n// if (isLegalMove(this.getI()-1, this.getJ(), level)) {\n// children.add(new Cell(this.getI()-1, this.getJ()));\n// }\n return children;\n }", "public static void breedAll() {\n int a, b; //Pointers to select parents\n\n //While loop to ensure full carrying capacity of population\n while (Population.size() <= maxPop) {\n //Sorts by Fitness level first\n sortByFitlvl();\n\n //Selects Two Random Parents\n a = (int) (Math.abs(Utilities.sharpGauss(4)) * Population.size());\n b = (int) (Math.abs(Utilities.sharpGauss(4)) * Population.size());\n //System.out.println(a+\"\\t\"+b+\"\\t\"+Population.size());\n\n // Between 1-2 children\n int children = rand.nextInt(2)+1;\n for (int i = 0; i < children; i++) {\n Population.add(Breeder.breed(Population.get(a), Population.get(b), 0.1));\n }\n\n //sortByFitlvl();\n }\n\n if (debug)\n printPopulation(true);\n }", "private Board DLS(Board start, Board goal, int depth) {\n Board found = null;\n // Paso base: Si start es la solucion y esta en el ultimo nivel, regresa\n if((depth == 0) && start.equals(goal)) {\n return start;\n }\n // Si el nivel aun no es el ultimo, se obtienen los nodos hijos\n // y se vuelve a llamar la funcion en ellos\n else if(depth > 0) {\n // Obtiene los nodos hijos\n // Todas las posibles configuraciones del tablero que se pueden\n // hacer a partir de la actual\n ArrayList<Board> children = start.expand();\n\n expandedNodes++;\n\n // Para cada hijo vuelve a hacer lo mismo\n for(Board child : children) {\n found = DLS(child, goal, depth - 1);\n if(found != null)\n return found;\n }\n }\n return null;\n }", "private void doRecurse(String destNodeType, List<List<EdgeType>> keepPaths,\r\n\t\t\t List<List<EdgeType>> testPaths, int maxLength)\r\n {\r\n\tfor (final List<EdgeType> path : testPaths)\r\n\t{\r\n\t // If the last element in this path has a matching\r\n\t // destNodeType, then we found a suitable path. Add it to\r\n\t // the \"keep\" list.\r\n\t if (path.get(path.size()-1).getDestType().equals(destNodeType))\r\n\t\tkeepPaths.add(path);\r\n\t else if (maxLength > 0)\r\n\t\t// We don't have a match. If we haven't reached our\r\n\t\t// maximum length, recurse one level and keep looking.\r\n\t\tdoRecurse(destNodeType, keepPaths,\r\n\t\t\t buildLongerPaths(path), maxLength-1);\r\n\t}\r\n }", "private static void findOptimalTree(int i, int j, int[][] nodeMatrix) {\n\t\tif(i!=j){\n\t\t\tint root = nodeMatrix[i][j];\n\t\t\tSystem.out.println(\" root for \"+i+\" to \"+j+\" elements would be \"+root);\n\t\t\tfindOptimalTree(i, root-1, nodeMatrix);\n\t\t\tfindOptimalTree(root+1, j, nodeMatrix);\n\t\t}\n\t}", "public void bfs(Pair<Integer, Integer> current, Pair<Integer, Integer> goal) {\n var visited = new HashSet<Pair<Integer, Integer>>(300);\n var queue = new LinkedList<Pair<Integer, Integer>>();\n \n visited.add(current);\n queue.add(current);\n \n while (!queue.isEmpty()) {\n var toVisit = queue.poll();\n if (goal.equals(toVisit)) {\n goal.setParent(toVisit);\n toVisit.setChild(goal);\n break;\n }\n var neighbors = Utils.getNeighbors(toVisit);\n neighbors.forEach(p -> {\n // only move through SAFE tiles!\n // unless the neighbor is goal node!\n if (p.equals(goal) ||\n (!visited.contains(p) &&\n grid[p.getA()][p.getB()].getTileTypes().contains(Tile.SAFE)))\n {\n visited.add(p);\n p.setParent(toVisit);\n toVisit.setChild(p);\n queue.add(p);\n }\n });\n }\n }", "public boolean reducible() {\n if (dfsTree.back.isEmpty()) {\n return true;\n }\n int size = controlFlow.transitions.length;\n boolean[] loopEnters = dfsTree.loopEnters;\n TIntHashSet[] cycleIncomings = new TIntHashSet[size];\n // really this may be array, since dfs already ensures no duplicates\n TIntArrayList[] nonCycleIncomings = new TIntArrayList[size];\n int[] collapsedTo = new int[size];\n int[] queue = new int[size];\n int top;\n for (int i = 0; i < size; i++) {\n if (loopEnters[i]) {\n cycleIncomings[i] = new TIntHashSet();\n }\n nonCycleIncomings[i] = new TIntArrayList();\n collapsedTo[i] = i;\n }\n\n // from whom back connections\n for (Edge edge : dfsTree.back) {\n cycleIncomings[edge.to].add(edge.from);\n }\n // from whom ordinary connections\n for (Edge edge : dfsTree.nonBack) {\n nonCycleIncomings[edge.to].add(edge.from);\n }\n\n for (int w = size - 1; w >= 0 ; w--) {\n top = 0;\n // NB - it is modified later!\n TIntHashSet p = cycleIncomings[w];\n if (p == null) {\n continue;\n }\n TIntIterator iter = p.iterator();\n while (iter.hasNext()) {\n queue[top++] = iter.next();\n }\n\n while (top > 0) {\n int x = queue[--top];\n TIntArrayList incoming = nonCycleIncomings[x];\n for (int i = 0; i < incoming.size(); i++) {\n int y1 = collapsedTo[incoming.getQuick(i)];\n if (!dfsTree.isDescendant(y1, w)) {\n return false;\n }\n if (y1 != w && p.add(y1)) {\n queue[top++] = y1;\n }\n }\n }\n\n iter = p.iterator();\n while (iter.hasNext()) {\n collapsedTo[iter.next()] = w;\n }\n }\n\n return true;\n }", "public static void main(String[] args) {\n\t\tArrayList<Robot> robots = new ArrayList<>();\n\t\tArrayList<Node> nodes = new ArrayList<>();\n\t\t//This allows for different home and feeder locations\n\t\tNode redFeeder = new Node(0, 10, 4, true);\n\t\tNode yelFeeder = new Node(0, 5, 10, false);\n\t\tNode home = new Node(0, 0, 0, true);\n\n\t\t//Insert the nodes listed from the homework\n\t\tnodes.add(new Node(1, 2, 2, true));\n\t\tnodes.add(new Node(2, 1, 5, false));\n\t\tnodes.add(new Node(3, 3, 7, true));\n\t\tnodes.add(new Node(4, 5, 9, false));\n\t\tnodes.add(new Node(5, 7, 3, true));\n\t\tnodes.add(new Node(6, 8, 1, true));\n\t\tnodes.add(new Node(7, 8, 5, true));\n\t\tnodes.add(new Node(8, 4, 6, false));\n\t\tnodes.add(new Node(9, 6, 8, false));\n\t\tnodes.add(new Node(10, 9, 7, false));\n\n\t\t//Set counter for while loop later\n\t\tint counter = 1;\n\n\t\t//Create initial 10 parents\n\t\tfor (int i = 0; i < 10; i++) {\n\t\t\trobots.add(new Robot());\n\n\t\t\t//Set the home and feeders\n\t\t\trobots.get(i).setHome(home.getX(), home.getY());\n\t\t\trobots.get(i).setRedFeeder(redFeeder.getX(), redFeeder.getY());\n\t\t\trobots.get(i).setYellowFeeder(yelFeeder.getX(), yelFeeder.getY());\n\n\t\t\t//Create a temp node list to shuffle\n\t\t\tArrayList<Node> tempNodes = nodes;\n\t\t\tCollections.shuffle(tempNodes);\n\n\t\t\t//Iterate through and add the nodes based on the value not the reference (caused lots of issues before\n\t\t\t//I figured that out\n\t\t\tfor (int j = 0; j < 10; j++)\n\t\t\t\trobots.get(i).in(new Node(tempNodes.get(j).getE(), tempNodes.get(j).getX(),\n\t\t\t\t\t\ttempNodes.get(j).getY(), tempNodes.get(j).isRed()));\n\t\t}\n\n\t\t//Go for 300k iterations, can be changed on a whim\n\t\twhile (counter <= 300000) {\n\n\t\t\t//Output every 10k iterations, can be changed\n\t\t\tif (counter % 10000 == 0) {\n\t\t\t\tSystem.out.println(\"Loop \" + (counter));\n\t\t\t\tfor (Robot r : robots) {\n\t\t\t\t\tr.printNodes();\n\t\t\t\t\tSystem.out.println(\" - \" + r.calcTotalDist());\n\t\t\t\t}\n\n\t\t\t\tSystem.out.println();\n\t\t\t}\n\n\t\t\tint size = robots.size();\n\t\t\t//Create children based on two parents and add them to the robots list\n\t\t\tfor (int i = 0; i < size; i += 2) {\n\t\t\t\tint x = ThreadLocalRandom.current().nextInt(1, 8);\n\t\t\t\tRobot temp = robots.get(i).getFirstHalf(x);\n\t\t\t\ttemp.addSecondHalf(robots.get(i + 1), x);\n\n\t\t\t\ttemp.setHome(home.getX(), home.getY());\n\t\t\t\ttemp.setRedFeeder(redFeeder.getX(), redFeeder.getY());\n\t\t\t\ttemp.setYellowFeeder(yelFeeder.getX(), yelFeeder.getY());\n\n\t\t\t\trobots.add(temp);\n\t\t\t}\n\n\t\t\t//Sort the list of robots based on the Comparator that uses the totalDistance\n\t\t\tCollections.sort(robots);\n\n\t\t\t//Remove the last 5 (largest) items from the list\n\t\t\tfor (int i = robots.size() - 1; i > 9; i--) {\n\t\t\t\trobots.remove(i);\n\t\t\t}\n\n\t\t\t//Shuffle the list again to hope for totally random stuff\n\t\t\tCollections.shuffle(robots);\n\t\t\tcounter++;\n\t\t}\n\n\t\t//Irrelevant but useful in testing\n\t\treturn;\n\t}", "private void percolateDown(int index) {\n int childLevel = NUM_CHILDREN * index + 1;\r\n if (childLevel < length) {\r\n int smallestChild = childLevel;\r\n for (int n = 0; n < NUM_CHILDREN; n++) {\r\n int childIndex = childLevel + n;\r\n if (childIndex < length && heap[smallestChild].compareTo(heap[childIndex]) > 0) {\r\n smallestChild = childIndex;\r\n }\r\n }\r\n // now we have the smallest child, swap it with root and recurse4, 5\r\n if (heap[smallestChild].compareTo(heap[index]) < 0) {\r\n swap(smallestChild, index);\r\n percolateDown(smallestChild);\r\n }\r\n }\r\n }", "private PersistentLinkedList<T> pop() {\n //the latest element won't become empty\n int index = this.treeSize - 1;\n Node<T> newRoot = new Node<>(branchingFactor);\n\n Node<T> currentNode = this.root;\n Node<T> currentNewNode = newRoot;\n\n ArrayList<Node<T>> newNodes = new ArrayList<>();\n newNodes.add(newRoot);\n ArrayList<Integer> newNodesIndices = new ArrayList<>();\n\n for (int b = base; b > 1; b = b / branchingFactor) {\n TraverseData traverseData = traverseOneLevel(\n new TraverseData(currentNode, currentNewNode, newRoot, index, b));\n currentNode = traverseData.currentNode;\n currentNewNode = traverseData.currentNewNode;\n newNodes.add(currentNewNode);\n newNodesIndices.add(index / b);\n index = traverseData.index;\n }\n newNodesIndices.add(index);\n\n for (int i = 0; i < branchingFactor && i < index; i++) {\n currentNewNode.set(i, currentNode.get(i));\n }\n currentNewNode.set(index, null);\n\n if (index == 0) {\n int latestIndex = newNodes.size() - 2;\n newNodes.get(latestIndex).set(newNodesIndices.get(latestIndex), null);\n\n for (int i = latestIndex; i > 0; i--) {\n if (newNodesIndices.get(i) == 0) {\n newNodes.get(i - 1).set(newNodesIndices.get(i - 1), null);\n } else {\n break;\n }\n }\n }\n\n if (newNodes.size() > 1) {\n int nonNullChildren = 0;\n for (Node<T> child : newRoot.children) {\n if (child != null) {\n nonNullChildren++;\n }\n }\n if (nonNullChildren == 1) { //need new root\n newRoot = newRoot.get(0);\n return new PersistentLinkedList<>(newRoot, this.branchingFactor, this.depth - 1,\n this.base / branchingFactor, this.treeSize - 1, unusedTreeIndices,\n indexCorrespondingToTheFirstElement, indexCorrespondingToTheLatestElement);\n }\n }\n return new PersistentLinkedList<>(newRoot, this.branchingFactor, this.depth, this.base,\n this.treeSize - 1, unusedTreeIndices, indexCorrespondingToTheFirstElement,\n indexCorrespondingToTheLatestElement);\n }", "private int alphaBetaMinimax (GameTreeNode node, int alpha, int beta, boolean isMax, Map<GameTreeNode, Integer> visited) {\n\n if(node.remaining == 0) {\n //System.out.println(\"Terminal State: Up : Score \" + node.score);\n return node.score;\n }\n if(visited.containsKey(node)) {\n //System.out.println(\"Memoized State: Up : Score \" + visited.get(node));\n return visited.get(node);\n }\n \n \n if(isMax) {\n int minimaxScore = Integer.MIN_VALUE;\n for(int i = 0; i < MAX_REMOVAL; i++) {\n \n GameTreeNode expandingChild = node.generateChild(1 + i);\n \n if(expandingChild == null) {\n break;\n }\n \n //System.out.println(\"Remaining \" + node.remaining + \" Down\");\n //\n minimaxScore = Math.max(minimaxScore, alphaBetaMinimax(expandingChild, alpha, beta, false, visited));\n alpha = Math.max(alpha, minimaxScore);\n //\n //System.out.println(\"Remaining \" + node.remaining + \" Up : Score: \" + minimaxScore);\n //\n if(beta <= alpha) {\n //System.out.println(\"Pruning: \" + node.remaining + \" child index \" + i+1);\n break;\n }\n }\n visited.put(node, minimaxScore);\n node.score = minimaxScore;\n return minimaxScore;\n }\n else {\n int minimaxScore = Integer.MAX_VALUE;\n for(int i = 0; i < MAX_REMOVAL; i++) {\n \n GameTreeNode expandingChild = node.generateChild(1 + i);\n if(expandingChild == null) {\n break;\n }\n //\n \n //\n //System.out.println(\"Remaining \" + node.remaining + \" Down\");\n //\n minimaxScore = Math.min(minimaxScore, alphaBetaMinimax(expandingChild, alpha, beta, true, visited));\n beta = Math.min(beta, minimaxScore);\n //\n //System.out.println(\"Remaining \" + node.remaining + \" Up : Score: \" + minimaxScore);\n //\n if(beta <= alpha) {\n //System.out.println(\"Pruning: \" + node.remaining + \" child index \" + i+1);\n break;\n }\n }\n visited.put(node, minimaxScore);\n node.score = minimaxScore;\n return minimaxScore;\n }\n }", "public static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tBufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tN = Integer.parseInt(st.nextToken());\n\t\t\n\t\tint size = 1;\n\t\twhile(max_node > size) {\n\t\t\tsize *= 2;\n\t\t\tmax_level++;\n\t\t}\n\t\t\n\t\tfor(int i=0; i<= N; i++)\n\t\t{\n\t\t\tadj.add(new ArrayList<>());\n\t\t}\n\t\t\n\t\tint dx=0, dy=0, dz = 0;\n\t\tfor(int i=1; i<= N-1; i++)\n\t\t{\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\tdx = Integer.parseInt(st.nextToken());\n\t\t\tdy = Integer.parseInt(st.nextToken());\n\t\t\tadj.get(dx).add(dy);\n\t\t\tadj.get(dy).add(dx);\n\t\t}\n\t\t\n\t\tdepth[0] = -1;\n\t\tdfs(1,0);\n\t\t\n\t\tst = new StringTokenizer(br.readLine());\n\t\tM = Integer.parseInt(st.nextToken());\n\t\tfor(int i=1; i<= M; i++)\n\t\t{\n\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\tdx = Integer.parseInt(st.nextToken());\n\t\t\tdy = Integer.parseInt(st.nextToken());\n\t\t\tdz = Integer.parseInt(st.nextToken());\n\t\t\tcurDepth = -1; result = -1;\n\t\t\t\n\t\t\tquery(dx, dy);\n\t\t\tquery(dx, dz);\n\t\t\tquery(dy, dz);\n\t\t\t\n\t\t\tbw.write(result+\"\\n\");\n\t\t}\n\t\tbw.flush();\n\t}", "GameTreeNode (int remaining, int action, boolean isMax) {\n this.remaining = remaining; //Stones Left\n this.action = action; //Actions Taken\n this.isMax = isMax; \n children = new ArrayList<>(); //Children\n score = -1; //Utility Score\n \n if(this.remaining == 0 && isMax) {\n score = 0;\n }\n else {\n score = 1;\n }\n }", "public ArrayList<PentagoGame> nextPossibleMoves() {\n ArrayList<PentagoGame> children = new ArrayList<>();\n for(int i = 0; i < 6; i++) { // for each row I can place a piece\n for(int j = 0; j < 6; j++) { // for each column\n for(int k = 0; k < 4; k++ ) { // for each board to rotate\n for(int d = 0; d < 2; d ++) {// for each direction to rotate\n boolean leftRotate = false;\n if(d == 0) {\n leftRotate = true;\n }\n Move move = new Move(i, j, k, leftRotate);\n if(validMove(whosTurn(), move)) {\n PentagoGame tempGame = new PentagoGame(this);\n tempGame.playPiece(whosTurn(), move);\n tempGame.rotateBoard(whosTurn(), move);\n tempGame.turnOver();\n move.setGameState(tempGame);\n move.setUtility(calulateUtility(move));\n // todo\n children.add(tempGame);\n }\n }\n }\n }\n }\n\n return children;\n }", "node GrowthTreeGen(int maxdepth){\n\t\tint i;\n\t\tbyte a;\n\t\tnode t, p;\n\t\tif(maxdepth == 0) // to the limit then choose a terminal\n\t\t{\n\t\t\ti = IRandom(0, gltcard - 1);\n\t\t\tt = new node(glterminal[i].name, VOIDVALUE);\n\t\t\treturn t;\n\t\t} \n\t\telse // choosing from function and terminal\n\t\t {\n\t\t\ti = IRandom(0, gltermcard - 1);\n\t\t\tt = new node(glterm[i].name, VOIDVALUE);\n\t\t\tif(glterm[i].arity > 0) // if it is function\n\t\t\t{\n\t\t\t\tt.children = GrowthTreeGen(maxdepth - 1);\n\t\t\t\tp = t.children;\n\t\t\t\tfor(a = 1; a < glterm[i].arity; a++) {\n\t\t\t\t\tp.sibling = GrowthTreeGen(maxdepth - 1);\n\t\t\t\t\tp = p.sibling;\n\t\t\t\t}\n\t\t\t\tp.sibling = null;\n\t\t\t}\n\t\t\treturn t;\n\t\t}\n\t}", "public abstract int getMaxChildren();", "@Override\n \tpublic Solution solve() {\n \t\tfor (int i = 0; i < n; i++) {\n \t\t\tnest[i] = generator.getSolution();\n \t\t}\n \n \t\tfor (int t = 0; t < maxGeneration; t++) { // While (t<MaxGeneration) or\n \t\t\t\t\t\t\t\t\t\t\t\t\t// (stop criterion)\n \t\t\t// Get a cuckoo randomly (say, i) and replace its solution by\n \t\t\t// performing random operations;\n \t\t\tint i = r.nextInt(n);\n \t\t\tSolution randomNest = nest[i];\n \t\t\t//FIXME: randomNest = solutionModifier.modify(nest[i]);\n \n \t\t\t// Evaluate its quality/fitness\n \t\t\tint fi = randomNest.f();\n \n \t\t\t// Choose a nest among n (say, j) randomly;\n \t\t\tint j = r.nextInt(n);\n \t\t\tint fj = f[j];\n \n \t\t\tif (fi > fj) {\n \t\t\t\tnest[i] = randomNest;\n \t\t\t\tf[i] = fi;\n \t\t\t}\n \n \t\t\tsort();\n \t\t\t// A fraction (pa) of the worse nests are abandoned and new ones are built;\n\t\t\tfor(i = n-toAbandon; i<n; i++) {\n \t\t\t\tnest[i] = generator.getSolution();\n \t\t\t}\n \t\t\t\n \t\t\t// Rank the solutions/nests and find the current best;\n \t\t\tsort();\n \t\t}\n \n \t\treturn nest[0];\n \t}", "void buildHeap() {\n\tfor(int i=parent(size-1); i>=0; i--) {\n\t percolateDown(i);\n\t}\n }", "public static Goal[] createEverythingGoals() {\n\t\t// [ & ] <--- rootGoal1\n\t\t// / / \\ \\\n\t\t// P T E M\n\t\t//\n\t\tCompositeGoal rootGoal1 = new CompositeGoal(CompositeGoal.and);\n\t\trootGoal1.addChild(new PuzzleGoal());\n\t\trootGoal1.addChild(new TreasureGoal());\n\t\trootGoal1.addChild(new EnemiesGoal());\n\t\trootGoal1.addChild(new MazeGoal());\n\t\t\n\t\t\n\t\tCompositeGoal subGoal1 = new CompositeGoal(CompositeGoal.and);\n\t\tsubGoal1.addChild(new EnemiesGoal());\n\t\tsubGoal1.addChild(new TreasureGoal());\n\t\tsubGoal1.addChild(new MazeGoal());\n\t\t\n\t\tCompositeGoal subGoal2 = new CompositeGoal(CompositeGoal.and);\n\t\tsubGoal2.addChild(new PuzzleGoal());\n\t\tsubGoal2.addChild(new TreasureGoal());\n\t\tsubGoal2.addChild(subGoal1);\n\t\t\n\t\t// [ | ] <--- rootGoal2\n\t\t// / \\\n\t\t// I [ & ] <---- subGoal2\n\t\t// / | \\\n\t\t// P T [ & ] <---- subGoal1\n\t\t// /|\\\n\t\t// E T M\n\t\tCompositeGoal rootGoal2 = new CompositeGoal(CompositeGoal.or);\n\t\trootGoal2.addChild(new ImpossibleGoal());\n\t\trootGoal2.addChild(subGoal2);\n\n\t\t\n\t\tString goalString = \"\"\n\t\t\t+ \" { \\\"goal\\\": \\\"AND\\\", \\\"subgoals\\\":\\n\"\n\t\t\t+ \" [ { \\\"goal\\\": \\\"exit\\\" },\\n\"\n\t\t\t+ \" { \\\"goal\\\": \\\"AND\\\", \\\"subgoals\\\":\\n\"\n\t\t\t+ \" [ {\\\"goal\\\": \\\"treasure\\\" },\\n\"\n\t\t\t+ \" { \\\"goal\\\": \\\"AND\\\", \\\"subgoals\\\":\\n\"\n\t\t\t+ \" [ {\\\"goal\\\": \\\"enemies\\\" },\\n\"\n\t\t\t+ \" {\\\"goal\\\": \\\"boulders\\\" }\\n\"\n\t\t\t+ \" ]\\n\"\n\t\t\t+ \" }\\n\"\n\t\t\t+ \" ]\\n\"\n\t\t\t+ \" }\\n\"\n\t\t\t+ \" ]\\n\"\n\t\t\t+ \" }\\n\";\n\t\t\n\t\tJSONObject json = new JSONObject(new JSONTokener(goalString));\n\t\tGoal goal3 = Goal.createGoal(json);\n\t\t\n\t\treturn new Goal[]{ rootGoal1, rootGoal2, goal3 };\n\t}", "private static void greedyRisk(Person curPerson, Map<String, Person> persons) throws FileNotFoundException {\n\t\tclass DisComparator implements Comparator<Person> {\n\t\t\tpublic int compare(Person a, Person b) {\n\t\t\t\treturn a.getEstDistRisk() - b.getEstDistRisk();\n\t\t\t} \n\t\t}\n\t\t\n\t\tPriorityQueue<Person> pqueue = new PriorityQueue<Person>(persons.size(), new DisComparator());\t\t\n\t\tpqueue.add(curPerson);\n\t\t\n\t\touterloop:\n\t\twhile(!pqueue.isEmpty()) {\n\t\t\tcurPerson = pqueue.poll();\t\n\t\t\t\n\t\t\tArrayList<Person> children = curPerson.getConnected();\n\t\t\tPerson child;\n\t\t\tfor(int i = 0; i < children.size(); i++) {\n\t\t\t\tchild = children.get(i);\n\t\t\t\tif(!child.getMarked()) {\n\t\t\t\t\tchild.setRoute(curPerson);\n\t\t\t\t\tchild.setMarked();\n\t\t\t\t\tif(child.getName().equals(\"Noah\")) {\t//check when generated\n\t\t\t\t\t\tcurPerson = child;\n\t\t\t\t\t\tbreak outerloop;\n\t\t\t\t\t}\n\t\t\t\t\tpqueue.add(child);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\toutputResult(curPerson, \"Greedy.risk.result.txt\");\n\t}", "private void phaseOne(){\r\n\r\n\t\twhile (allNodes.size() < endSize){\r\n\r\n\t\t\ttry (Transaction tx = graphDb.beginTx()){\r\n\t\t\t\t//Pick a random node from allNodes\r\n\t\t\t\tint idx = random.nextInt(allNodes.size());\r\n\t\t\t\tNode node = allNodes.get(idx);\r\n\r\n\t\t\t\t//Get all relationships of node\t\t\t\t\r\n\t\t\t\tIterable<Relationship> ite = node.getRelationships(Direction.BOTH);\r\n\t\t\t\tList<Relationship> tempRels = new ArrayList<Relationship>();\r\n\r\n\t\t\t\t//Pick one of the relationships uniformly at random.\r\n\t\t\t\tfor (Relationship rel : ite){\r\n\t\t\t\t\ttempRels.add(rel);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tidx = random.nextInt(tempRels.size());\r\n\t\t\t\tRelationship rel = tempRels.get(idx);\r\n\t\t\t\tNode neighbour = rel.getOtherNode(node);\r\n\r\n\t\t\t\t//Add the neighbour to allNodes\r\n\t\t\t\tif (!allNodes.contains(neighbour)){\r\n\t\t\t\t\tallNodes.add(neighbour);\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttx.success();\r\n\r\n\t\t\t}\r\n\t\t}\r\n\t\t//If reached here, then phase one completed successfully.\r\n\t\treturn;\r\n\t}", "public void determinePartitions( Callback c ){\n mCurrentDepth = 0;\n GraphNode node;\n GraphNode child;\n int depth = 0;\n List levelList = new java.util.LinkedList();\n int i = 0;\n //they contain those nodes whose parents have not been traversed as yet\n //but the BFS did it.\n List orphans = new java.util.LinkedList();\n\n\n //set the depth of the dummy root as 0\n mRoot.setDepth( mCurrentDepth );\n\n mQueue.addLast( mRoot );\n\n while( !mQueue.isEmpty() ){\n node = (GraphNode)mQueue.getFirst();\n depth = node.getDepth();\n if( mCurrentDepth < depth ){\n\n if( mCurrentDepth > 0 ){\n //we are done with one level!\n constructPartitions( c, levelList, mCurrentDepth );\n }\n\n\n //a new level starts\n mCurrentDepth++;\n levelList.clear();\n }\n mLogger.log( \"Adding to level \" + mCurrentDepth + \" \" + node.getID(),\n LogManager.DEBUG_MESSAGE_LEVEL);\n levelList.add( node );\n\n //look at the orphans first to see if any\n //of the dependency has changed or not.\n /*it = orphans.iterator();\n while(it.hasNext()){\n child = (GraphNode)it.next();\n if(child.parentsBlack()){\n child.setDepth(depth + 1);\n System.out.println(\"Set depth of \" + child.getID() + \" to \" + child.getDepth());\n\n child.traversed();\n mQueue.addLast(child);\n }\n\n //remove the child from the orphan\n it.remove();\n }*/\n\n\n node.setColor( GraphNode.BLACK_COLOR );\n for( Iterator it = node.getChildren().iterator(); it.hasNext(); ){\n child = (GraphNode)it.next();\n if(!child.isColor( GraphNode.GRAY_COLOR ) &&\n child.parentsColored( GraphNode.BLACK_COLOR )){\n mLogger.log( \"Adding to queue \" + child.getID(),\n LogManager.DEBUG_MESSAGE_LEVEL );\n child.setDepth( depth + 1 );\n child.setColor( GraphNode.GRAY_COLOR );\n mQueue.addLast( child );\n }\n /*else if(!child.isTraversed() && !child.parentsBlack()){\n //we have to do the bumping effect\n System.out.println(\"Bumping child \" + child);\n orphans.add(child);\n }*/\n }\n node = (GraphNode)mQueue.removeFirst();\n mLogger.log( \"Removed \" + node.getID(),\n LogManager.DEBUG_MESSAGE_LEVEL);\n }\n\n //handle the last level of the BFS\n constructPartitions( c, levelList, mCurrentDepth );\n\n\n //all the partitions are dependant sequentially\n for( i = mCurrentDepth; i > 1; i-- ){\n constructLevelRelations( c, i - 1, i );\n\n }\n\n done( c );\n }", "public ArrayList<UUSearchNode> getSuccessors() {\n\n ArrayList<UUSearchNode> successors = new ArrayList<UUSearchNode>();//this will be returned\n ArrayList<CannibalNode> helper = new ArrayList<CannibalNode>();\n\n if (this.state[2]==1){ //if the boat is on the starting shore\n helper.add(new CannibalNode(this.state[0] - 2, this.state[1],\n this.state[2] - 1, this.depth + 1)); //subtracting <201>\n helper.add(new CannibalNode(this.state[0], this.state[1] - 2,\n this.state[2] - 1, this.depth + 1)); //subtracting <021>\n helper.add(new CannibalNode(this.state[0] - 1, this.state[1] - 1,\n this.state[2] - 1, this.depth + 1)); //subtracting <111>\n helper.add(new CannibalNode(this.state[0] - 1, this.state[1],\n this.state[2] - 1, this.depth + 1)); //subtracting <101>\n helper.add(new CannibalNode(this.state[0], this.state[1] - 1,\n this.state[2] - 1, this.depth + 1)); //subtracting <011>\n }else{ //if the boat is on the opposite shore\n helper.add(new CannibalNode(this.state[0] + 2, this.state[1],\n this.state[2] + 1, this.depth + 1)); //adding <201>\n helper.add(new CannibalNode(this.state[0], this.state[1] + 2,\n this.state[2] + 1, this.depth + 1)); //adding <021>\n helper.add(new CannibalNode(this.state[0] + 1, this.state[1] + 1,\n this.state[2] + 1, this.depth + 1)); //adding <111>\n helper.add(new CannibalNode(this.state[0] + 1, this.state[1],\n this.state[2] + 1, this.depth + 1)); //adding <101>\n helper.add(new CannibalNode(this.state[0], this.state[1] + 1,\n this.state[2] + 1, this.depth + 1)); //adding <011>\n }\n\n //now we check for feasibility and legality\n for(CannibalNode n : helper){\n if(isFeasibleState(n.state) && isLegalState(n.state)){\n successors.add(n);\n }\n }\n return successors;\n }", "private TakTree<TakPiece> treeBuilder(TakTree<TakPiece> tree, Point startingPoint, ArrayList<Point> visited){\n if(containsWinningPath(visited)){\n // Did white or black win?\n if(getTop(startingPoint).isWhite()){\n whiteWins = true;\n } else {\n blackWins = true;\n }\n\n // return our tree because this is certainly a leaf node\n return tree;\n }\n\n Point right = new Point(startingPoint.x + 1, startingPoint.y);\n Point left = new Point(startingPoint.x - 1, startingPoint.y);\n Point up = new Point(startingPoint.x, startingPoint.y - 1);\n Point down = new Point(startingPoint.x, startingPoint.y + 1);\n\n\n // Check for backtracking right\n if(isValidAndSimilar(right, startingPoint) && !visitedContains(visited, right)){\n // Create new subtree with our right as root\n TakTree<TakPiece> treeToAttach = new TakTree<>();\n treeToAttach.addRoot(getTop(right));\n //Add this position to the visited array\n visited.add(right);\n // Attach subtree to right position\n tree.attachRight(treeBuilder(treeToAttach, right, visited));\n }\n\n // Try to build left subtree\n if(isValidAndSimilar(left, startingPoint) && !visitedContains(visited, left)){\n // Create new subtree with our right as root\n TakTree<TakPiece> treeToAttach = new TakTree<>();\n treeToAttach.addRoot(getTop(left));\n //Add this position to the visited array\n visited.add(left);\n // Attach subtree to right position\n tree.attachLeft(treeBuilder(treeToAttach, left, visited));\n }\n\n // Try to build up subtree\n if(isValidAndSimilar(up, startingPoint) && !visitedContains(visited, up)){\n // Create new subtree with our right as root\n TakTree<TakPiece> treeToAttach = new TakTree<>();\n treeToAttach.addRoot(getTop(up));\n //Add this position to the visited array\n visited.add(up);\n // Attach subtree to right position\n tree.attachUp(treeBuilder(treeToAttach, up, visited));\n }\n\n // Try to build down subtree\n if(isValidAndSimilar(down, startingPoint) && !visitedContains(visited, down)){\n\n // Create new subtree with our right as root\n TakTree<TakPiece> treeToAttach = new TakTree<>();\n treeToAttach.addRoot(getTop(down));\n //Add this position to the visited array\n visited.add(down);\n // Attach subtree to right position\n tree.attachDown(treeBuilder(treeToAttach, down, visited));\n }\n\n return tree;\n }", "public ArrayList<Edge> Prim (String s){\n Node Start = nodeMap.get(s);\n mst = new ArrayList<>();\n HashMap<String, String> inserted = new HashMap<String, String>();\n ArrayList<Edge> failed = new ArrayList<Edge>();\n PriorityQueue<Edge> pq = new PriorityQueue<Edge>();\n ArrayList<Edge> ed = new ArrayList<Edge>(edgeMap.values());\n Edge first = ed.get(0);\n mst.add(first);\n inserted.put(first.w, first.w);\n inserted.put(first.v, first.v);\n\n priorityEdgeInsert(pq, first);\n\n while (inserted.size() <= edges() && pq.size() != 0){ //O(E log(V))\n //runs for E checking the possible V, where the number of V is devided each time, or log(V), giving ELog(V)\n Edge e = pq.poll();\n String w = inserted.get(e.w);\n String v = inserted.get(e.v);\n\n if ((w == null) ^ (v == null)){\n priorityEdgeInsert(pq, e);\n for(Edge f : failed){\n if(f.v == e.v || f.v == e.w || f.w == e.v || f.w == e.w){\n\n }\n else{\n pq.add(f);\n }\n }\n failed.clear();\n mst.add(e);\n inserted.put(e.w, e.w); //only puts one, the null one is hashed to a meaningless spot\n inserted.put(e.v, e.v);\n }\n else if ((w == null) && (v == null) ){\n failed.add(e);\n }\n else if (!(w == null) && !(v == null) ){\n failed.remove(e);\n pq.remove(e);\n }\n else if (e == null){\n System.out.println(\"HOW?\"); //should never happen.\n }\n }\n return mst;\n }", "public static void main(String[] args) {\n\t\tint array[]={2,3,4,6};\n\t\tint n=array.length;\n\t\tint maximum=Integer.MIN_VALUE;\n\t\tint minimum=Integer.MAX_VALUE;\n\t\tfor(int i:array)\n\t\t{\n\t\t\tif(i>maximum)\n\t\t\t\tmaximum=i;\n\t\t\tif(i<minimum)\n\t\t\t\tminimum=i;\n\t\t}\n\t\t\n\t\tint mark[]=new int[maximum+2];\n\t\tint value[]=new int[maximum+2];\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tmark[array[i]]=1; // marking ki exist karta hai no need to search in the array.\n\t\t\tvalue[array[i]]=1; //har value se ek fbt to banega hi (1 node ka)\n\t\t}\n\t\tint ans=0;\n\t\tfor(int i=minimum;i<=maximum;i++){\n\t\t\tif(mark[i]==1) // element is present in the array.// we have found the first factor now find 2nd factor.\n\t\t\t{\n\t\t// find the multiples of arr[i] which are less than max value and also less than its square\n\t\t\tfor(int j=i+i ;j<=maximum && j/i<=i;j=j+i)\n\t\t\t{\n\t\t\t\tif(mark[j]==1 && mark[j/i]==1) // i is the first factor and j/i is the 2nd factor.j is the product that serves as root.\n\t\t\t\t{\n\t\t\t\t\t// value =all combination of left child with right child.\n\t\t\t\t\tvalue[j]=value[j] + (value[i] * value[j/i]);\n\t\t\t\t\t\n\t\t\t\t\t// if the 2 child are not same then one more orientation.\n\t\t\t\t\tif(i!=(j/i))\n\t\t\t\t\t\tvalue[j]=value[j] + (value[i] * value[j/i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t}\n\t\t\tans=ans+value[i];\n\t\t}\n\t\tSystem.out.println(ans);\n\t}", "public void breadthFirstTraversal() {\n beginAnimation();\n treeBreadthFirstTraversal();\n stopAnimation();\n\n }", "public ArrayList<SearchNode> search(Problem p) {\n\tfrontier = new NodeQueue();\t// The frontier is a queue of expanded SearchNodes not processed yet\n\texplored = new HashSet<SearchNode>();\t/// The explored set is a set of nodes that have been processed \n\tGridPos startState = (GridPos) p.getInitialState();\t// The start state is given\n\tfrontier.addNodeToFront(new SearchNode(startState));\t// Initialize the frontier with the start state \n\n\t\n\tpath = new ArrayList<SearchNode>();\t// Path will be empty until we find the goal\n\t\t\n\n\n\twhile(!frontier.isEmpty()){\n\n\t SearchNode s = frontier.removeFirst(); \n\t GridPos g = s.getState(); \n\n\t if ( p.isGoalState(g) ) {\n\t\tpath = s.getPathFromRoot();\t\n\t\tbreak; \n\t }\n\t \n\t explored.add(s); \t \n\t ArrayList<GridPos> childStates = p.getReachableStatesFrom(g);\n\n\t while(!childStates.isEmpty()){\n\n\t\tSearchNode child = new SearchNode(childStates.get(0), s); \n\n\t\tif(!explored.contains(child) && !frontier.contains(child)){\n\n\t\t if ( p.isGoalState(child.getState()) ) {\n\t\t\n\t\t\tpath = child.getPathFromRoot();\t\n\t\t\treturn path; \n\t\t }\n\n\t\t if(insertFront) \n\t\t\tfrontier.addNodeToFront(child); \t\t \t\t\n\t\t else\t\n\t\t\tfrontier.addNodeToBack(child); \t \n\n\n\n\t\t}\n\n\t\tchildStates.remove(0);\n\t }\t \n\t}\n\n\n\treturn path;\n\n }", "public void bfs()\n{\n Queue q=new LinkedList();\n q.add(this.rootNode);\n printNode(this.rootNode);\n rootNode.visited=true;\n while(!q.isEmpty())\n {\n Node n=(Node)q.remove();\n Node child=null;\n while((child=getUnvisitedChildNode(n))!=null)\n {\n child.visited=true;\n printNode(child);\n q.add(child);\n }\n }\n //Clear visited property of nodes\n clearNodes();\n}", "public List<Node> findPath(Vector2i start, Vector2i goal) {\n\t\tList<Node> openList = new ArrayList<Node>(); //All possible Nodes(tiles) that could be shortest path\n\t\tList<Node> closedList = new ArrayList<Node>(); //All no longer considered Nodes(tiles)\n\t\tNode current = new Node(start,null, 0, getDistance(start, goal)); //Current Node that is being considered(first tile)\n\t\topenList.add(current);\n\t\twhile(openList.size() > 0) {\n\t\t\tCollections.sort(openList, nodeSorter); // will sort open list based on what's specified in the comparator\n\t\t\tcurrent = openList.get(0); // sets current Node to first possible element in openList\n\t\t\tif(current.tile.equals(goal)) {\n\t\t\t\tList<Node> path = new ArrayList<Node>(); //adds the nodes that make the path \n\t\t\t\twhile(current.parent != null) { //retraces steps from finish back to start\n\t\t\t\t\tpath.add(current); // add current node to list\n\t\t\t\t\tcurrent = current.parent; //sets current node to previous node to strace path back to start\n\t\t\t\t}\n\t\t\t\topenList.clear(); //erases from memory since algorithm is finished, ensures performance is not affected since garbage collection may not be called\n\t\t\t\tclosedList.clear();\n\t\t\t\treturn path; //returns the desired result shortest/quickest path\n\t\t\t}\n\t\t\topenList.remove(current); //if current Node is not part of path to goal remove\n\t\t\tclosedList.add(current); //and puts it in closedList, because it's not used\n\t\t\tfor(int i = 0; i < 9; i++ ) { //8-adjacent tile possibilities\n\t\t\t\tif(i == 4) continue; //index 4 is the middle tile (tile player currently stands on), no reason to check it\n\t\t\t\tint x = (int)current.tile.getX();\n\t\t\t\tint y = (int)current.tile.getY();\n\t\t\t\tint xi = (i % 3) - 1; //will be either -1, 0 or 1\n\t\t\t\tint yi = (i / 3) - 1; // sets up a coordinate position for Nodes (tiles)\n\t\t\t\tTile at = getTile(x + xi, y + yi); // at tile be all surrounding tiles when iteration is run\n\t\t\t\tif(at == null) continue; //if empty tile skip it\n\t\t\t\tif(at.solid()) continue; //if solid cant pass through so skip/ don't consider this tile\n\t\t\t\tVector2i a = new Vector2i(x + xi, y + yi); //Same thing as node(tile), but changed to a vector\n\t\t\t\tdouble gCost = current.gCost + (getDistance(current.tile, a) == 1 ? 1 : 0.95); //*calculates only adjacent nodes* current tile (initial start is 0) plus distance between current tile to tile being considered (a)\n\t\t\t\tdouble hCost = getDistance(a, goal);\t\t\t\t\t\t\t\t// conditional piece above for gCost makes a more realist chasing, because without it mob will NOT use diagonals because higher gCost\n\t\t\t\tNode node = new Node(a, current, gCost, hCost);\n\t\t\t\tif(vecInList(closedList, a) && gCost >= node.gCost) continue; //is node has already been checked \n\t\t\t\tif(!vecInList(openList, a) || gCost < node.gCost) openList.add(node);\n\t\t\t}\n\t\t}\n\t\tclosedList.clear(); //clear the list, openList will have already been clear if no path was found\n\t\treturn null; //a default return if no possible path was found\n\t}", "public List<Integer> findMinHeightTrees(int n, int[][] edges) {\n List<Integer> ans = new ArrayList<>();\n if (n == 0) return ans;\n if (n == 1) {\n ans.add(0);\n return ans;\n }\n if (n == 2) {\n ans.add(0);\n ans.add(1);\n return ans;\n }\n\n //build graph\n List<Integer>[] graph = new ArrayList[n];\n for (int i = 0; i < n; i++) {\n graph[i] = new ArrayList<>();\n }\n for (int i = 0; i < edges.length; i++) {\n int v1 = edges[i][0];\n int v2 = edges[i][1];\n\n graph[v1].add(v2);\n graph[v2].add(v1);\n }\n\n //initial leaves\n List<Integer> leaves = new ArrayList<>();\n for (int i = 0; i < n; i++) {\n if (graph[i].size() == 1) {\n leaves.add(i);\n }\n }\n\n int count = n;\n\n while (count > 2) {\n int leasize = leaves.size();\n count -= leasize;\n List<Integer> newleaves = new ArrayList<Integer>();\n for (int i = 0; i < leasize; i++) {\n int leavenode = leaves.get(i);\n int verToleave = graph[leavenode].get(0);\n graph[verToleave].remove(Integer.valueOf(leavenode));\n if (graph[verToleave].size() == 1) {\n newleaves.add(verToleave);\n }\n }\n\n leaves = newleaves;\n }\n return leaves;\n\n\n }", "public int findSpanningTree(List<Graph.Edge> edges) {\n while (!isSpanningTree()) {\n toZeroWeightGraph();\n shrinkComponents();\n }\n return populateEdges(edges);\n }", "private Node constructInternal(List<Node> children){\r\n\r\n // Base case: root found\r\n if(children.size() == 1){\r\n return children.get(0);\r\n }\r\n\r\n // Generate parents\r\n boolean odd = children.size() % 2 != 0;\r\n for(int i = 1; i < children.size(); i += 2){\r\n Node left = children.get(i-1);\r\n Node right = children.get(i);\r\n Node parent = new Node(Utility.SHA512(left.hash + right.hash), left, right);\r\n children.add(parent);\r\n }\r\n\r\n // If the number of nodes is odd, \"inherit\" the remaining child node (no hash needed)\r\n if(odd){\r\n children.add(children.get(children.size() - 1));\r\n }\r\n return constructInternal(children);\r\n }", "void buildHeap() {\n for (int i = parent(size - 1); i >= 0; i--) {\n percolateDown(i);\n }\n }", "private List<Pair<Integer, Integer>> getBestPath(Pair<Integer, Integer> curLocation, Pair<Integer, Integer> dest) {\n\t\tList<Pair<Integer, Integer>> path = new LinkedList<Pair<Integer, Integer>>();\n\t\t\n\t\t\n\t\tNode current = new Node(curLocation.getX(), curLocation.getY(), getHitProbability(curLocation.getX(), curLocation.getY()));\n\t\tNode target = new Node(dest.getX(), dest.getY(), getHitProbability(dest.getX(), dest.getY()));\n\t\tList<Node> openSet = new ArrayList<>();\n List<Node> closedSet = new ArrayList<>();\n \n \n while (true) {\n openSet.remove(current);\n List<Node> adjacent = getAdjacentNodes(current, closedSet, target);\n\n // Find the adjacent node with the lowest heuristic cost.\n for (Node neighbor : adjacent) {\n \tboolean inOpenset = false;\n \tList<Node> openSetCopy = new ArrayList<>(openSet);\n \tfor (Node node : openSetCopy) {\n \t\tif (neighbor.equals(node)) {\n \t\t\tinOpenset = true;\n \t\t\tif (neighbor.getAccumulatedCost() < node.getAccumulatedCost()) {\n \t\t\t\topenSet.remove(node);\n \t\t\t\topenSet.add(neighbor);\n \t\t\t}\n \t\t}\n \t}\n \t\n \tif (!inOpenset) {\n \t\topenSet.add(neighbor);\n \t}\n }\n\n // Exit search if done.\n if (openSet.isEmpty()) {\n System.out.printf(\"Target (%d, %d) is unreachable from position (%d, %d).\\n\",\n target.getX(), target.getY(), curLocation.getX(), curLocation.getY());\n return null;\n } else if (/*isAdjacent(current, target)*/ current.equals(target)) {\n break;\n }\n\n // This node has been explored now.\n closedSet.add(current);\n\n // Find the next open node with the lowest cost.\n Node next = openSet.get(0);\n for (Node node : openSet) {\n if (node.getCost(target) < next.getCost(target)) {\n next = node;\n }\n }\n// System.out.println(\"Moving to node: \" + current);\n current = next;\n }\n \n // Rebuild the path using the node parents\n path.add(new Pair<Integer, Integer>(curLocation.getX(), curLocation.getY()));\n while(current.getParent() != null) {\n \tcurrent = current.getParent();\n \tpath.add(0, new Pair<Integer, Integer>(current.getX(), current.getY()));\n }\n \n if (path.size() > 1) {\n \tpath.remove(0);\n }\n \n\t\treturn path;\n\t}", "public List<Integer> findMinHeightTrees(int n, int[][] edges) {\n\n // edge list\n // Create adjacency list\n // find nodes with edge degree\n // fill a queue with edge degree one\n // do the bfs and keep marking their heights in the path\n // as we go along and find a node with lesser possible heights, update heights\n // of that node and keep updating in consequent nodes\n\n // edge case - disconnected tree\n\n List<List<Integer>> adjList = new ArrayList<>();\n\n createAdjList(n, edges, adjList);\n\n // Revise - How to print a list?\n System.out.println(Arrays.toString(adjList.toArray()));\n\n int[] edgeDegree = new int[n];\n int[] heights = new int[n];\n for (int[] edge:\n edges) {\n edgeDegree[edge[0]]++;\n edgeDegree[edge[1]]++;\n }\n\n System.out.println(\"edgeDegree\");\n System.out.println(Arrays.toString(edgeDegree));\n\n Queue<Integer> bfsQ = new LinkedList<>();\n boolean[] visited = new boolean[n];\n for (int i = 0; i < edgeDegree.length; i++) {\n if (edgeDegree[i] == 1) {\n bfsQ.add(i);\n heights[i] = 1;\n break;\n }\n }\n\n int maxHeight = Integer.MIN_VALUE;\n while (!bfsQ.isEmpty()) {\n Integer vertex = bfsQ.poll();\n visited[vertex] = true;\n System.out.println(\"Out from queue\");\n int heightParentVertex = heights[vertex];\n maxHeight = Math.max(maxHeight, heightParentVertex);\n List<Integer> adjNodes = adjList.get(vertex);\n for (Integer adjNode:\n adjNodes) {\n if (!visited[adjNode]) {\n heights[adjNode] = heightParentVertex+1;\n bfsQ.add(adjNode);\n }\n }\n }\n\n List<Integer> ans = new ArrayList<>();\n System.out.println(\"maxHeight\");\n System.out.println(maxHeight);\n\n // if even\n for (int i = 0; i < n; i++) {\n if ( heights[i] == ((maxHeight / 2) + 1)) {\n ans.add(i);\n } else if (maxHeight % 2 == 0 && heights[i] == maxHeight / 2) {\n ans.add(i);\n }\n }\n\n return ans;\n }", "private BinaryTree<Character> constructTree(){\n if(pq.size() == 1) return pq.poll().data;\n if(pq.size() == 0) return null;\n // Poll the lowest two trees, combine them, then stick them back in the queue.\n Helper<BinaryTree<Character>> temp0 = pq.poll(), temp1 = pq.poll(),\n result = new Helper<>(temp0.priority + temp1.priority, new BinaryTree<>(temp0.data, null , temp1.data));\n pq.add(result);\n // Call again to keep constructing.\n return constructTree();\n }", "public ArrayList<State> childStates(){\n boolean hasExpanded = false;\n this.childStates = new ArrayList<>();\n Successor successor = new Successor(); //for calling the successors functions\n //cases for this\n for (int i = 0; i < boardRows ; i++) {\n for (int j = 0; j < boardColumns; j++) {\n if(!hasExpanded){\n if(currentBoardState[i][j] == 0){\n\n if( i - 1 >= 0){\n //call moveDown()\n //System.out.println(i + \" \" + j);\n //System.out.println(\"calling moveDown()\");\n State newState = successor.moveDown(i, j, this.getCurrentBoardState(), this.getGoalBoardState());\n\n //newState.printBoard();\n childStates.add(newState);\n }\n\n if( i + 1 <= boardRows-1){\n //call moveUp()\n //System.out.println(i + \" \" + j);\n //System.out.println(\"calling moveUp()\");\n //this.printBoard();\n State newState = successor.moveUp(i, j, this.getCurrentBoardState(), this.getGoalBoardState());\n //newState.printBoard();\n childStates.add(newState);\n }\n\n if(j - 1 >= 0){\n //System.out.println(i + \" \" + j);\n //System.out.println(\"calling moveRight()\");\n //this.printBoard();\n State newState = successor.moveRIght(i, j, this.getCurrentBoardState(), this.getGoalBoardState());\n //newState.printBoard();\n childStates.add(newState);\n }\n\n if( j + 1 <= boardColumns - 1){\n //System.out.println(i + \" \" + j);\n //System.out.println(\"calling moveLeft()\");\n //this.printBoard();\n State newState = successor.moveLeft(i,j,this.getCurrentBoardState(), this.getGoalBoardState());\n //newState.printBoard();\n childStates.add(newState);\n }\n hasExpanded = true;\n }\n }\n }\n }\n return childStates;\n }", "public void addToNextMoves(GameTile[][] visibleMap) {\r\n\t\t\r\n\t\t//Breadth First Search Code\r\n//\t\tWumpusState state = new WumpusState(visibleMap, playerX, playerY, wumpusX, wumpusY);\r\n\r\n\t\tQueue<WumpusState> queue = new LinkedList<WumpusState>();\t\t\t\t//use the queue in the same way\t\r\n\t\tHashMap<String, Boolean> visitedStates = new HashMap<String, Boolean>();\t//add all children to the queue, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//add all the children to the hash and set values to true.\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//once all the children have been visited, generate children sequentially for the children that already been added \r\n\t\tWumpusState state = new WumpusState(visibleMap, playerX, playerY);\r\n\t\tlong nodesExpanded = 0;\r\n\t\t\r\n\t\tqueue.add(state);\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\tif(currentState.getPlayerX() == 4 && currentState.getPlayerY() == 1) {\r\n\t\t\t\tnodesExpanded = visitedStates.size();\r\n\t\t\t\tSystem.out.println(\"Nodes Expanded: \"+nodesExpanded);\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(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\tnextMoves.add(AgentAction.declareVictory);\r\n\t\t\t\treturn;\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}\t\r\n\t}", "private void maximize(Node node) {\n // maximize:\n double max = Tree.MININT;\n List<Node> children = node.getChildren();\n \n// if(children.isEmpty()){\n// return;\n// }\n \n //String values = \"\";\n for (Node child : children) {\n if (child.getMove().getRating() > max) {\n max = child.getMove().getRating();\n }\n // values += \"\" + child.getMove().getRating() + \", \";\n }\n // set value\n // System.out.println(\"setting value for next parent (maximize): \" + max + \" (all values: \" + values + \")\");\n\n node.getMove().setRating(max);\n }", "private void constructTree() {\r\n\t\tsortLeaves();\r\n\t\tNode currentNode;\r\n\t\tint index = 0;\r\n\t\t\tdo{\r\n\t\t\t\t// Create a new node with the next two least frequent nodes as its children\r\n\t\t\t\tcurrentNode = new Node(this.treeNodes[0], this.treeNodes[1]); \r\n\t\t\t\taddNewNode(currentNode);\r\n\t\t\t}\r\n\t\t\twhile (this.treeNodes.length > 1); // Until there is only one root node\r\n\t\t\tthis.rootNode = currentNode;\r\n\t\t\tindex++;\r\n\t}", "public AttackTreeNode buildNextChild(AttackTreeNode activeChild) {\n \n return null;\n }" ]
[ "0.68561", "0.66838115", "0.64369076", "0.62570703", "0.6249718", "0.6213673", "0.6053108", "0.60517704", "0.6046425", "0.60363895", "0.60311365", "0.5989149", "0.59789205", "0.5899618", "0.5888914", "0.58667064", "0.5839533", "0.58271617", "0.5823444", "0.5815419", "0.57463825", "0.57324743", "0.5727203", "0.57262874", "0.5698704", "0.5668818", "0.5661886", "0.56463116", "0.56235296", "0.56102055", "0.55988246", "0.5597657", "0.55958915", "0.5591335", "0.55842024", "0.5580522", "0.55758554", "0.5567347", "0.5565173", "0.55507797", "0.55374867", "0.552076", "0.55180764", "0.5494779", "0.54756457", "0.54753053", "0.5473173", "0.5469236", "0.5458522", "0.54495424", "0.5447358", "0.5435036", "0.5433914", "0.54331565", "0.54306847", "0.54304236", "0.5421675", "0.5419478", "0.54039943", "0.53994036", "0.5392353", "0.539223", "0.53783303", "0.537403", "0.5373771", "0.5371963", "0.5369919", "0.53690666", "0.53583944", "0.5355651", "0.53501785", "0.5349088", "0.5344868", "0.53429306", "0.5334368", "0.53293234", "0.53264743", "0.5308435", "0.5306574", "0.5284507", "0.5280632", "0.5275806", "0.5267481", "0.526677", "0.5264777", "0.52637535", "0.52629566", "0.526179", "0.5260129", "0.5259739", "0.5256556", "0.5247091", "0.52452886", "0.5244668", "0.52390134", "0.523247", "0.52294", "0.5225302", "0.5223841", "0.52211374" ]
0.7819133
0
read the file and take information about start,goal and forbidden
public static void main(String[] args) throws FileNotFoundException { ThreeDigits threeDigits = new ThreeDigits(); String filename = args[1]; File myFile = new File(filename); Scanner reader = new Scanner(myFile); threeDigits.startNode = new Node(reader.nextLine()); threeDigits.goalNode = new Node(reader.nextLine()); if (reader.hasNextLine()) { String num = reader.nextLine(); threeDigits.forbidden.addAll(Arrays.asList(num.split(","))); } if(threeDigits.startNode.getDigit().getDigitString().equals(threeDigits.goalNode.getDigit().getDigitString())){ System.out.println("No solution found"); System.out.print(threeDigits.startNode.getDigit().getDigitString()); System.exit(0); } ArrayList<String> childrenOfStart = new ArrayList<>(); childrenOfStart = threeDigits.makeChildren(threeDigits.startNode); childrenOfStart.removeAll(threeDigits.forbidden); if(childrenOfStart.size() == 0){ System.out.println("No solution found."); System.out.println(threeDigits.startNode.getDigit().getDigitString()); System.exit(0); }else{ threeDigits.performSearch(args[0]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void extractFile() {\n try (BufferedReader buffered_reader = new BufferedReader(new FileReader(source_file))) {\n String line;\n while((line = buffered_reader.readLine()) != null) {\n String spaceEscaped = line.replace(\" \", \"\");\n //file was read, each line is one of the elements of the file_read_lines list\n //line 0 is keyword \"TELL\"\n //line 1 is the knowledge base\n //line 2 is the keyword \"ASK\"\n //line 3 is the query\n file_read_lines.add(spaceEscaped);\n }\n\n //generate list of Horn clauses (raw) from the KB raw sentence\n //replace \\/ by |\n String kbLine = file_read_lines.get(1).replace(\"\\\\/\", \"|\");\n rawClauses = Arrays.asList(kbLine.split(\";\"));\n //query - a propositional symbol\n query = file_read_lines.get(3);\n } catch (IOException e) {\n //Return error if file cannot be opened\n error = true;\n System.out.println(source_file.toString() + \" is not found!\");\n }\n }", "public void readPairs(String fileName) {\n BufferedReader r = null;\n try {\n r = new BufferedReader(new InputStreamReader(new FileInputStream(fileName)));\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n while (true) {\n String line = null;\n try {\n line = r.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n if (line == null) {\n break;\n }\n assert line.length() == 11; // indatakoll, om man kör med assertions på\n String start = line.substring(0, 5);\n String goal = line.substring(6, 11);\n\n int s = words.indexOf(start);\n int v = words.indexOf(goal);\n\n shortestPathPairs(s, v);\n }\n\n }", "public AnalysePSRFile(File file) throws IOException {\n ReadFileToString str = new ReadFileToString();\n str.read(file);\n StringTokenizer tok = new StringTokenizer(str.outputString,\"\\n\");\n boolean notfound = true;\n int count = 4;\n while(notfound && tok.hasMoreTokens()) {\n String line = tok.nextToken();\n if(line.indexOf(startKeyword) >= 0) \n count--;\n if(count == 0)\n notfound = false;\n }\n if(!notfound) {\n Temperature = getTemperature(tok);\n getMoleFractionHeader(tok);\n getMoleFractions(tok);\n int n = namesV.size();\n namesS = new String[n];\n molefractionsD = new Double[n];\n for(int i=0;i<n;i++) {\n namesS[i] = (String) namesV.elementAt(i);\n molefractionsD[i] = (Double) molefractionsV.elementAt(i);\n }\n } else {\n throw new IOException(\"PSR file incomplete: Begin not found in \\n \" + file.toString() );\n }\n \n }", "public void readTheFile() {\n \t\terrorMap.clear();\n \n \t\tBufferedReader br;\n \t\tString nextLine;\n \t\tString[] header = null;\n \t\tArrayList<String> lines = new ArrayList<String>();\n \t\ttry {\n \t\t\tlogger.debug(\"{} loading file: {} \", getName(), RobotNX100Controller.class.getResource(\"motoman_error_code.txt\").getPath());\n \n \t\t\tbr = new BufferedReader(new FileReader(RobotNX100Controller.class.getResource(\"motoman_error_code.txt\").getPath()));\n \t\t\twhile (((nextLine = br.readLine()) != null) && (nextLine.length() > 0)) {\n \t\t\t\tif (nextLine.startsWith(\"Code\")) {\n \t\t\t\t\theader = nextLine.split(\"[, \\t][, \\t]*\");\n \t\t\t\t} else if (!nextLine.startsWith(\"#\"))\n \t\t\t\t\tlines.add(nextLine);\n \t\t\t}\n \t\t\tbr.close();\n \t\t} catch (FileNotFoundException fnfe) {\n \t\t\t// we do not want to interrupt processing because error map file not set.\n \t\t\tlogger.warn(\"Can not find the Error Message file {} for {}. Only Error code will be reported.\",\n \t\t\t\t\tgetErrorCodeFilename(), getName());\n \t\t\tlogger.warn(\"caused by \" + fnfe.getMessage(), fnfe);\n \t\t\tbr = null;\n \t\t\treturn;\n \t\t} catch (IOException ioe) {\n \t\t\t// we do not want to interrupt processing because error map file not set.\n \t\t\tlogger.warn(\"Can not find the Error Message file {} for {}. Only Error code will be reported.\",\n \t\t\t\t\tgetErrorCodeFilename(), getName());\n \t\t\tlogger.error(\"caused by \" + ioe.getMessage(), ioe);\n \t\t\tbr = null;\n \t\t\treturn;\n \t\t}\n \n \t\tnumberOfRows = lines.size();\n \t\tlogger.debug(\"the file contained \" + numberOfRows + \" lines\");\n \t\tint nColumns = new StringTokenizer(lines.get(0), \"\\t\").countTokens();\n \t\tlogger.debug(\"each line should contain \" + nColumns + \" numbers\");\n \t\tkeys = new ArrayList<String>();\n \t\tif (header != null) {\n \t\t\tfor (int i = 1; i < nColumns; i++) {\n \t\t\t\terrorMap.put(header[0], header[i]);\n \t\t\t}\n \t\t\tkeys.add(header[0]);\n \t\t}\n \n \t\tfor (int i = 0; i < numberOfRows; i++) {\n \t\t\tnextLine = lines.get(i);\n \t\t\tString[] thisLine = nextLine.split(\"[\\t][\\t]*\");\n \t\t\tfor (int j = 0; j < thisLine.length; j++)\n \t\t\t\terrorMap.put(thisLine[0], thisLine[j]);\n \t\t\tkeys.add(thisLine[0]);\n \t\t}\n \t}", "private void posRead() throws IOException {\n\t\tFile file = new File(fullFileName());\n\t\tString line;\n\t\tBufferedReader reader = new BufferedReader(new FileReader(file));\n\t\tStringBuffer fileText = new StringBuffer();\n\t\twhile((line = reader.readLine()) != null) {\n\t\t\tStringTokenizer st = new StringTokenizer(line);\n\t\t\twhile (st.hasMoreTokens()) {\n \t\tString tokenAndPos = st.nextToken();\n \t\tint slashIndex = tokenAndPos.lastIndexOf('/');\n \t\tif (slashIndex <= 0) throw new IOException(\"invalid data\");\n \t\tString token = tokenAndPos.substring(0,slashIndex);\n \t\tString pos = tokenAndPos.substring(1+slashIndex).intern();\n \t\tint start = this.length();\n \t\tthis.append(token);\n \t\tif (st.hasMoreTokens())\n \t\t\tthis.append(\" \");\n \t\telse\n \t\t\tthis.append(\" \\n\");\n \t\tint end = this.length();\n \t\tSpan span = new Span(start,end);\n \t\tthis.annotate(\"token\", span, new FeatureSet());\n \t\tthis.annotate(\"constit\", span, new FeatureSet(\"cat\", pos));\n \t}\n\t\t}\n\t}", "public String parseSrc() throws Exception{\n\t\tr = new FileReader(userArg); \r\n\t\tst = new StreamTokenizer(r);\r\n\t\t st.eolIsSignificant(true);\r\n\t\t st.commentChar(46);\r\n\t\t st.whitespaceChars(9, 9);\r\n\t\t st.whitespaceChars(32, 32);\r\n\t\t st.wordChars(39, 39);\r\n\t\t st.wordChars(44, 44);\r\n\t\t \r\n\t\t //first we check for a specified start address\r\n\t\t while (InstructionsRead < 2) {\r\n\t\t \tif (st.sval != null) {\r\n\t\t \t\tInstructionsRead++;\r\n\t\t \t\tif (st.sval.equals(\"START\")) {\r\n\t\t \t\twhile(st.ttype != StreamTokenizer.TT_NUMBER) {\r\n\t\t \t\t\tst.nextToken();\r\n\t\t \t\t}\r\n\t\t \t\tDDnval = st.nval;\r\n\t\t \t\tstartAddress = Integer.parseInt(\"\" + DDnval.intValue(), 16);\r\n\t\t \t\tlocctr = startAddress;\r\n\t\t \t\tsLocctr = Integer.toHexString(locctr.intValue());\r\n\t\t \t\tif (sLocctr.length() == 1) {\r\n\t\t \t\t\tSystem.out.println(\"locctr: 000\" + Integer.toHexString(locctr.intValue()));\r\n\t\t \t\t}\r\n\t\t \t\telse if (sLocctr.length() == 2) {\r\n\t\t \t\t\tSystem.out.println(\"locctr: 00\" + Integer.toHexString(locctr.intValue()));\r\n\t\t \t\t}\r\n\t\t \t\telse if (sLocctr.length() == 3 ) {\r\n\t\t \t\t\tSystem.out.println(\"locctr: 0\" + Integer.toHexString(locctr.intValue()));\r\n\t\t \t\t}\r\n\t\t \t\telse {\r\n\t\t \t\t\tSystem.out.println(\"locctr: \" + Integer.toHexString(locctr.intValue()));\r\n\t\t \t\t}\r\n\t\t \t\t//writer.write(\"\" + locctr); //should write to IF, not working yet 2/15/2011\r\n\t\t \t\tstartSpecified = true;\r\n\t\t \t\t}\r\n\t\t \t\telse if (!st.sval.equals(\"START\") && InstructionsRead < 2) { //this should be the program name, also could allow for label here potentially...\r\n\t\t \t\t\t//this is the name of the program\r\n\t\t \t\t\t//search SYMTAB for label etc. \r\n\t\t \t\t\tname = st.sval;\r\n\t\t \t\t}\r\n\t\t \t}\r\n\t\t st.nextToken();\r\n\t\t }\r\n\t\t if (!startSpecified) {\r\n\t\t \tstartAddress = 0;\r\n\t\t \tlocctr = startAddress;\r\n\t\t }\r\n\t\t startAddress2 = startAddress;\r\n\t\t /*\r\n\t\t ATW = Integer.toHexString(startAddress2.intValue());\r\n\t\t \r\n\t\t for (int i = 0; i<(6-ATW.length()); i++){\r\n\t\t \tmyWriter.write(\"0\");\r\n\t\t }\r\n\t\t myWriter.write(ATW);\r\n\t\t myWriter.newLine();//end of line for now; in ReadIF when this line is read and translated to object code, the program length will be tacked on the end\r\n\t\t */\r\n\t\t \r\n\t\t //Now that startAddress has been established, we move on to the main parsing loop\r\n\t\t while (st.ttype != StreamTokenizer.TT_EOF) { //starts parsing to end of file\r\n\t\t \t//System.out.println(\"Stuck in eof\");\r\n\t\t \t//iLocctr = locctr.intValue();\r\n\t\t \tinstFound = false;\r\n\t\t \topcodeDone = false;\r\n\t\t \tlabelDone = false;\r\n\t\t \tmoveOn = true;\r\n\t\t \t//constantCaseW = false;\r\n\t\t \tconstantCaseB = false;\r\n\t\t \txfound = false;\r\n\t\t \tcfound = false;\r\n\t\t \t\r\n\t\t \tInstructionsRead = 0; //init InsRead to 0 at the start of each line\r\n\t\t \tSystem.out.println(\"new line\");\r\n\t\t \tSystem.out.println(\"Ins read: \" + InstructionsRead);\r\n\t\t \tsLocctr = Integer.toHexString(locctr.intValue());\r\n\t \t\tif (sLocctr.length() == 1) {\r\n\t \t\t\tSystem.out.println(\"locctr: 000\" + Integer.toHexString(locctr.intValue()));\r\n\t \t\t}\r\n\t \t\telse if (sLocctr.length() == 2) {\r\n\t \t\t\tSystem.out.println(\"locctr: 00\" + Integer.toHexString(locctr.intValue()));\r\n\t \t\t}\r\n\t \t\telse if (sLocctr.length() == 3 ) {\r\n\t \t\t\tSystem.out.println(\"locctr: 0\" + Integer.toHexString(locctr.intValue()));\r\n\t \t\t}\r\n\t \t\telse {\r\n\t \t\t\tSystem.out.println(\"locctr: \" + Integer.toHexString(locctr.intValue()));\r\n\t \t\t}\r\n\t\t \tif (foundEnd()) {\r\n\t\t \t\tbreak;\r\n\t\t \t}\r\n\t\t \twhile (st.ttype != StreamTokenizer.TT_EOL) {//breaks up parsing by lines so that InstructionsRead will be a useful count\r\n\t\t \t\t\r\n\t\t \t\tmoveOn = true;\r\n\t\t \t\tif (st.ttype == StreamTokenizer.TT_WORD) { \r\n\t\t \t\t\tInstructionsRead++;\r\n\t\t \t\t\tSystem.out.println(st.sval);\r\n\t\t \t\t\tSystem.out.println(\"Instructions Read: \" + InstructionsRead);\r\n\t\t \t\t\tif (foundEnd()) {\r\n\t\t \t\t\t\tbreak;\r\n\t\t \t\t\t}\r\n\t\t \t\t\t/*\r\n\t\t \t\t\t * The whole instructinsread control architecture doesn't quite work, because\r\n\t\t \t\t\t * the ST doesn't count the whitespace it reads in. This is by design because\r\n\t\t \t\t\t * the prof specified that whitespace is non-regulated and thus we cannot\r\n\t\t \t\t\t * predict exactly how many instances of char dec value 32 (space) will appear\r\n\t\t \t\t\t * before and/or between the label/instruction/operand 'fields'. \r\n\t\t \t\t\t * \r\n\t\t \t\t\t * What we could try alternatively is to structure the control around'\r\n\t\t \t\t\t * the optab, since it it static and populated pre-runtime. The schema might\r\n\t\t \t\t\t * go something like this: first convert whatever the sval or nval is to string.\r\n\t\t \t\t\t * Then call the optab.searchOpcode method with the resultant string as the input\r\n\t\t \t\t\t * parameter. If the string is in optab then it is an instruction and the ST is in the\r\n\t\t \t\t\t * instruction 'field' and boolean foundInst is set to true. If it is not in optab AND a boolean variable foundInst which resets to\r\n\t\t \t\t\t * false at the beginning of each new line is still false, then it is a label being declared in the label 'field'\r\n\t\t \t\t\t * If it is not in the optab AND foundInst is true, then the ST is at the operand 'field'.\r\n\t\t \t\t\t * This should work even if the prof has a crappy line with just a label declaration and no instruction or operand, because there\r\n\t\t \t\t\t * definitely cannot be an operand without an instruction...\r\n\t\t \t\t\t */\r\n\t\t \t\t\tif (instFound){\r\n\t\t \t\t\t\tprocessOperand(st);\r\n\t\t \t\t\t}\r\n\t\t \t\t\tif (!instFound) {//this is either label or instruction field\r\n\t\t \t\t\t\t//before anything, search optab to see if this might be the opcode\r\n\t\t \t\t\t\t//if it is an opcode, send it to the opcode processing function\r\n\t\t \t\t\t\tif (st.sval.equals(\"WORD\") || st.sval.equals(\"BYTE\")){//these are the directives... not technically instructions, but they go in the instruction field\r\n\t\t \t\t\t\t\tresCount = 0;\r\n\t\t \t\t\t\t\tif (st.sval.equals(\"WORD\")){\r\n\t\t \t\t\t\t\t\tif (hexDigitCount >= 55){\r\n\t\t \t\t\t\t\t\t\tnewTHandle();\r\n\t\t \t\t\t\t\t\t}\r\n\t\t \t\t\t\t\t\thexDigitCount += 6;\r\n\t\t \t\t\t\t\t}\r\n\t\t \t\t\t\t\tif (st.sval.equals(\"BYTE\")){\r\n\t\t \t\t\t\t\t\tconstantCaseB = true;\r\n\t\t \t\t\t\t\t}\r\n\t\t \t\t\t\t\tinstFound = true;\r\n\t\t \t\t\t\t\tprocessOpcode(st);\r\n\t\t \t\t\t\t}\r\n\t\t \t\t\t\telse if (st.sval.equals(\"RESW\") || st.sval.equals(\"RESB\")){//these are the directives... not technically instructions, but they go in the instruction field\r\n\t\t \t\t\t\t\tresCount++;\r\n\t\t \t\t\t\t\tnewTHandle();\r\n\t\t \t\t\t\t\tinstFound = true;\r\n\t\t \t\t\t\t\tprocessOpcode(st);\r\n\t\t \t\t\t\t}\r\n\t\t \t\t\t\telse if (optab.searchOpcode(st.sval)) {//if true this is the instruction\r\n\t\t \t\t\t\t\tresCount = 0;\r\n\t\t \t\t\t\t\tif (hexDigitCount >= 55){\r\n\t \t\t\t\t\t\t\tnewTHandle();\r\n\t \t\t\t\t\t\t}\r\n\t\t \t\t\t\t\thexDigitCount += 6;\r\n\t\t \t\t\t\t\tinstFound = true;\r\n\t\t \t\t\t\t\tprocessOpcode(st);\r\n\t\t \t\t\t\t\t//InstructionsRead++;\r\n\t\t \t\t\t\t}\r\n\t\t \t\t\t\telse {//otherwise this is the label\r\n\t\t \t\t\t\t\tprocessLabel(st);\r\n\t\t \t\t\t\t}\r\n\t\t \t\t\t\t\r\n\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//else{ //if instFound is true, this must be the operand field\r\n\t\t \t\t\t\t\r\n\t\t \t\t\t\t//processOperand(st);\r\n\t\t \t\t\t//}\r\n\t\t \t\t\t//if (InstructionsRead == 3) {//this is the operand field\r\n\t\t \t\t\t\t//processOperand();\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\r\n\t\t \t\tif (st.ttype == StreamTokenizer.TT_NUMBER) {\r\n\t\t \t\t\tInstructionsRead++;\r\n\t\t \t\t\tif (!instFound) {//this is either label or instruction field\r\n\t\t \t\t\t\t//before anything, search optab to see if this might be the opcode\r\n\t\t \t\t\t\t//if it is an opcode, send it to the opcode processing function\r\n\t\t \t\t\t\tif (NtoString(st.nval).equals(\"WORD\") || NtoString(st.nval).equals(\"BYTE\")){//these are the directives... not technically instructions, but they go in the instruction field\r\n\t\t \t\t\t\t\tresCount = 0;\r\n\t\t \t\t\t\t\tif (NtoString(st.nval).equals(\"WORD\")){\r\n\t\t \t\t\t\t\t\tif (hexDigitCount >= 55){\r\n\t\t \t\t\t\t\t\t\tnewTHandle();\r\n\t\t \t\t\t\t\t\t}\r\n\t\t \t\t\t\t\t\thexDigitCount += 6;\r\n\t\t \t\t\t\t\t}\r\n\t\t \t\t\t\t\tif (NtoString(st.nval).equals(\"BYTE\")){\r\n\t\t \t\t\t\t\t\tconstantCaseB = true;\r\n\t\t \t\t\t\t\t}\r\n\t\t \t\t\t\t\tinstFound = true;\r\n\t\t \t\t\t\t\tprocessOpcodeN(st);\r\n\t\t \t\t\t\t}\r\n\t\t \t\t\t\tif (NtoString(st.nval).equals(\"RESW\") || NtoString(st.nval).equals(\"RESB\")){//these are the directives... not technically instructions, but they go in the instruction field\r\n\t\t \t\t\t\t\tresCount++;\r\n\t\t \t\t\t\t\tnewTHandle();\r\n\t\t \t\t\t\t\tinstFound = true;\r\n\t\t \t\t\t\t\tprocessOpcodeN(st);\r\n\t\t \t\t\t\t}\r\n\t\t \t\t\t\telse if (optab.searchOpcode(\"\" + st.nval)) {\r\n\t\t \t\t\t\t\tresCount = 0;\r\n\t\t \t\t\t\t\tif (hexDigitCount >= 55){\r\n\t \t\t\t\t\t\t\tnewTHandle();\r\n\t \t\t\t\t\t\t}\r\n\t\t \t\t\t\t\thexDigitCount += 6;\r\n\t\t \t\t\t\t\tinstFound = true;\r\n\t\t \t\t\t\t\tprocessOpcodeN(st);\r\n\t\t \t\t\t\t\t//InstructionsRead++;\r\n\t\t \t\t\t\t}\r\n\t\t \t\t\t\telse {\r\n\t\t \t\t\t\t\tprocessLabelN(st);\r\n\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\telse{ //this is the operand field\r\n\t\t \t\t\t\tprocessOperandN(st);\r\n\t\t \t\t\t}\r\n\t\t \t\t}\r\n\t\t \t\t\r\n\t\t \tif (moveOn){\r\n\t\t \tst.nextToken(); //read next token in current line\r\n\t\t \t}\r\n\t\t \t}\r\n\t\t \t////write line just finished to IF eventually\r\n\t\t if (moveOn){\r\n\t\t st.nextToken(); //read first token of next line\t\r\n\t\t }\r\n\t\t }\r\n\t\t programLength = (locctr - startAddress); \r\n\t\t programLength2 = programLength;\r\n\t\t System.out.println(\" !!prgmlngth2:\" + Integer.toHexString(programLength2.intValue()));\r\n\t\t /*\r\n\t\t sProgramLength = Integer.toHexString(programLength2.intValue());\r\n\t\t for (int i = 0; i<(6-sProgramLength.length()); i++){\r\n\t\t \tmyWriter.write(\"0\");\r\n\t\t }\r\n\t\t myWriter.write(sProgramLength);\r\n\t\t myWriter.close();\r\n\t\t ////myWriter.close();\r\n\t\t \r\n\t\t */\r\n\t\t r.close();\r\n\t\t System.out.println(\"?????!?!?!?!?ALPHA?!?!?!?!?!??!?!?!\");\r\n\t\t if (hexDigitCount/2 < 16){\r\n\t\t \tlineLength.add(\"0\" + Integer.toHexString(hexDigitCount/2));\r\n\t\t }\r\n\t\t else{\r\n\t\t lineLength.add(Integer.toHexString(hexDigitCount/2));\r\n\t\t }\r\n\t\t for (int i = 0; i<lineLength.size(); i++){\r\n\t\t System.out.println(lineLength.get(i));\r\n\t\t }\r\n\t\t // System.out.println(hexDigitCount);\r\n\t\t ReadIF pass2 = new ReadIF(this.optab,this.symtab,this.startAddress2,this.programLength2,this.name,this.lineLength,this.userArg);\r\n\t\t return st.sval;\r\n\t\t \r\n\t\t\r\n\r\n\t}", "public void readFromFile() {\n\n\t}", "private void checkFile() {\n \ttry {\n \t\tdata = new BufferedReader(\n \t\t\t\t new FileReader(textFile));\n \t\t\n \t}\n \tcatch(FileNotFoundException e)\n \t{\n \t\tSystem.out.println(\"The mentioned File is not found.\");\n System.out.println(\"\");\n\t\t\tSystem.exit(1);\n\t\t} catch (Exception ex) {\n\t\t\tSystem.out.println(\"The following error occured while reading the file.\");\n\t\t\tex.printStackTrace();\n\t\t\tSystem.exit(2);\n\t\t}\n }", "public List<CorruptionIndex> readFromFile(String filePath){\n return null;\n }", "public void read() {\n String line = \"\";\n int counter = 0;\n try {\n input = new BufferedReader(new FileReader(file));\n while (line != null) {\n if (!(line.equals(\"arglebargle\"))) {//not a default\n names.add(line);\n }\n }\n input.close();\n }\n catch (IOException e) {\n }\n }", "public void parseFile() {\n File file = new File(inputFile);\n try {\n Scanner scan = new Scanner(file);\n\n while (scan.hasNextLine()) {\n String line = scan.nextLine();\n line = line.replaceAll(\"\\\\s+\", \" \").trim();\n\n if (line.isEmpty()) {\n continue;\n }\n // System.out.println(line);\n String cmd = line.split(\" \")[0];\n String lineWithoutCmd = line.replaceFirst(cmd, \"\").trim();\n // System.out.println(lineWithoutCmd);\n\n // The fields following each command\n String[] fields;\n\n switch (cmd) {\n case (\"add\"):\n fields = lineWithoutCmd.split(\"<SEP>\");\n fields[0] = fields[0].trim();\n fields[1] = fields[1].trim();\n fields[2] = fields[2].trim();\n add(fields);\n break;\n case (\"delete\"):\n\n fields = split(lineWithoutCmd);\n delete(fields[0], fields[1]);\n break;\n case (\"print\"):\n if (lineWithoutCmd.equals(\"ratings\")) {\n printRatings();\n break;\n }\n fields = split(lineWithoutCmd);\n\n print(fields[0], fields[1]);\n\n break;\n case (\"list\"):\n // need to check if it is the movie or reviewer\n fields = split(lineWithoutCmd);\n list(fields[0], fields[1]);\n break;\n case (\"similar\"):\n // need to check if it is the movie or reviewer\n fields = split(lineWithoutCmd);\n similar(fields[0], fields[1]);\n break;\n default:\n break;\n }\n\n }\n\n }\n catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n }", "public void readInput(String fileName){\n\n BufferedReader reader;\n try {\n reader = new BufferedReader(new FileReader(fileName));\n String line = reader.readLine(); //read first line\n int numLine =1; //keep track the number of line\n while (line != null) {\n String[] tokens = line.trim().split(\"\\\\s+\"); //split line into token\n if(numLine==1){ //for the first line\n intersection = Integer.parseInt(tokens[0]); //set the number of intersection\n roadways = Integer.parseInt(tokens[1]); // set the number of roadways\n coor = new Coordinates[intersection];\n g = new Graph(intersection);//create a graph\n line = reader.readLine();\n numLine++;\n }\n else if(numLine>1&&numLine<intersection+2){ //for all intersection\n while(numLine>1&&numLine<intersection+2){\n tokens = line.trim().split(\"\\\\s+\");\n coor[Integer.parseInt(tokens[0])] = new Coordinates(Integer.parseInt(tokens[1]),Integer.parseInt(tokens[2])); //add into coor array to keep track the coor of intersection\n line = reader.readLine();\n numLine++;\n }\n }\n else if(numLine ==intersection+2){ //skip the space line\n line = reader.readLine();\n numLine++;\n while(numLine<roadways+intersection+3){ // for all the roadways, only include the number of roadways mention in the first line\n tokens = line.trim().split(\"\\\\s+\");\n int fst = Integer.parseInt(tokens[0]);\n int snd = Integer.parseInt(tokens[1]);\n g.addEgde(fst,snd,coor[fst].distTo(coor[snd]));\n line = reader.readLine();\n numLine++;\n }\n }\n else if(numLine >= roadways+intersection+3)\n break;\n }\n reader.close();\n } catch (FileNotFoundException e){\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "private void readFromFile(){\n\t\t\n\t\ttry {\n\t\t\tFile file=new File(\"controller.txt\");\n\t\t\tFileInputStream fin;\n\t\t\tfin = new FileInputStream(file);\n\t\t\tDataInputStream din=new DataInputStream(fin);\n\t\t\tBufferedReader br=new BufferedReader(new InputStreamReader(din));\n\t\t\t\n\t\t\tfor(int i=0; i<2; i++){\n\t\t\t\tif(i==0)\n\t\t\t\t\tcodedUserName=br.readLine();\n\t\t\t\telse \n\t\t\t\t\tcodedPassword=br.readLine();\n\t\t\t}\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}", "public int[] readBasicInfo() throws IOException\n\t{\n\t\t//Creates a FileReader and BufferedReader to read from the file that you pass it\n\t\tFileReader fr = new FileReader(path);\n\t\tBufferedReader textReader = new BufferedReader(fr);\n\t\t\n\t\t//Creates a new array to read the first line of data to (is an array because need to convert to int list)\n\t\tString textData;\n\t\t\n\t\t//Reads the first line of the text file into the array\n\t\ttextData = textReader.readLine();\n\t\t\n\t\tint[] data = new int[5];\n\t\t//Create a holding variable that will help to convert the String list over to an int list\n\t\tString[] tempList = new String[6];\n\t\t//List of deliminations that will be parsed out of the read strings in the string list that the function is passed\n\t\tString delims = \"[,()]+\";\n\t\t//Splits the strings from the file by the parenthesis and the commas\n\t\ttempList = textData.split(delims);\n\t\tfor (int i = 1; i < tempList.length; i++)\n\t\t\tdata[i-1] = Integer.parseInt(tempList[i]);\n\t\t\n\t\t//Returns the array containing the first line of the text file\n\t\treturn data;\n\t}", "TraceList read(File file) throws IOException;", "private boolean readFile(String fileName) {\n Message msg = new Message();\n FileInputStream fis;\n InputStreamReader isr;\n BufferedReader br;\n int depCount = 0;\n int depIndex = 0;\n float xIndex = 0;\n float yIndex = 0;\n int dist = 0;\n int capacity = 0;\n File file = new File(fileName);\n\n try {\n //open the requested file\n fis = new FileInputStream(file);\n isr = new InputStreamReader(fis);\n br = new BufferedReader(isr);\n } catch (Exception e) {\n System.err.println(\"File is not present \" + file);\n\n return false;\n }\n\n String line;\n StringTokenizer st = null;\n\n try {\n br.readLine(); // skip text labels\n line = br.readLine(); // depot constraints\n st = new StringTokenizer(line);\n\n // skip text labels\n br.readLine();\n } catch (IOException ex) {\n System.err.println(\"Error reading depot file: \" + fileName + \": \" +\n ex);\n }\n\n try {\n depCount = Integer.parseInt(st.nextToken().trim());\n dist = Integer.parseInt(st.nextToken().trim());\n capacity = Integer.parseInt(st.nextToken().trim());\n } catch (NumberFormatException ex) {\n System.err.println(\"Error processing depot constraint info: \" + ex);\n }\n\n //process depots\n for (int i = 0; i < depCount; i++) {\n try {\n line = br.readLine();\n st = new StringTokenizer(line);\n } catch (IOException ex) {\n System.err.println(\"Error reading depot file: \" + fileName +\n \": \" + ex);\n }\n\n //read the depot information\n try {\n depIndex = Integer.parseInt(st.nextToken().trim());\n xIndex = Float.parseFloat(st.nextToken().trim());\n yIndex = Float.parseFloat(st.nextToken().trim());\n } catch (NumberFormatException ex) {\n System.err.println(\"Error processing depot coordinate info: \" +\n ex);\n }\n\n // build the message\n msg.addArgument(IndexTag, \"\" + depIndex);\n msg.addArgument(XCoordTag, \"\" + xIndex);\n msg.addArgument(YCoordTag, \"\" + yIndex);\n }\n\n //save max distance and capacity\n if (dist == 0) { //if no max distance, set to a large number...\n dist = 999999999;\n }\n\n if (capacity == 0) { //if there is no maximum capacity, set it to a very large number\n capacity = 999999999;\n }\n\n // build the message\n msg.addArgument(NumberOfDepotsTag, \"\" + depCount);\n msg.addArgument(MaxCapacityTag, \"\" + capacity);\n msg.addArgument(MaxDistanceTag, \"\" + dist);\n msg.addArgument(FileNameTag, fileName);\n\n zAdapt.setProblemConstraints(msg);\n\n return true;\n }", "public void fileRead() {\n\t\tString a, b;\n\t\t\n\t\twhile (input.hasNext()) {\n\t\t\ta = input.next();\n\t\t\tb = input.next();\n\t\t\tSystem.out.printf(\"%s %s\\n\", a, b);\n\t\t}\n\t}", "Points(String filepath){\n readPointsFile(filepath); //dengan file points.txt\n }", "private static void fileRead(String file) {\n\t\ttry {\n\t\t\tBufferedReader br = new BufferedReader(new FileReader(file));\n\t\t\tString line = \"\";\n\t\t\twhile((line=br.readLine())!=null) {\n\t\t\t\tString data[] = line.split(\"\\\\t\");\n\t\t\t\tint id = Integer.parseInt(data[0]);\n\t\t\t\tint groundTruth = Integer.parseInt(data[1]);\n\t\t\t\tactualClusters.put(id, groundTruth);\n\t\t\t\tArrayList<Double> temp = new ArrayList<>();\n\t\t\t\tfor(int i=2;i<data.length;i++) {\n\t\t\t\t\ttemp.add(Double.parseDouble(data[i]));\n\t\t\t\t}\n\t\t\t\tcols = data.length-2;\n\t\t\t\tgeneAttributes.put(id, temp);\n\t\t\t\tallClusters.add(id+\"\");\n\t\t\t\ttotalGenes++;\n\t\t\t}\n\t\t\ttotalCluster = totalGenes;\n\t\t\tbr.close();\n\t\t} catch(Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public static void main(String[] args) throws IOException {\n\t\t\n\t\tString folder = \"/Users/haopeng/Dropbox/research/2nd/Usecase/Yanlei/\";\n\t\tString fileName = \"P0_2324.txt\";\n\t\t\n\t\tFileReader reader = new FileReader(folder + fileName, 20000000);\n\t\treader.parseFile();\n\t\t\n\t\t//reader.printValues(reader.getServerName(), \"ServerName\");\n\t\t//reader.printValues(reader.getCommand(), \"Command\");\n\t\t//reader.printValues(reader.getTimestamp(), \"Timestamp\"); \n\t\t//reader.printValues(reader.getPath(), \"Path\");\n\t\treader.printValues(reader.getMethod(), \"Method\");\n\t}", "public static void main(String[] args) throws FileNotFoundException {\n\t\tSkipList<String, Rectangle> list = new SkipList<String, Rectangle>();\n\t\tString file = args[0];\n\t\tScanner scan = new Scanner(new File(file));\n\t\t// FileProcessor fp = new FileProcessor();\n\t\t// fp.fileParser(line);\n\t\ttry {\n\t\t\tString lineReader = \"\";\n\t\t\twhile (scan.hasNextLine()) {\n\t\t\t\tlineReader = scan.nextLine();\n\t\t\t\t// regex string delimeter we need to figure out to get rid of excess whitespace\n\t\t\t\t// between parameters in text file\n\t\t\t\tString CMD = lineReader.trim();\n\t\t\t\tString[] lineCMD = CMD.split(\"\\\\s+\");\n\t\t\t\t// switch statement for all situations\n\t\t\t\tswitch (lineCMD[0]) {\n\t\t\t\tcase \"insert\":\n\t\t\t\t\tString name = lineCMD[1];\n\t\t\t\t\tint xCord = Integer.parseInt(lineCMD[2]);\n\t\t\t\t\tint yCord = Integer.parseInt(lineCMD[3]);\n\t\t\t\t\tint width = Integer.parseInt(lineCMD[4]);\n\t\t\t\t\tint height = Integer.parseInt(lineCMD[5]);\n\t\t\t\t\tRectangle rect = new Rectangle(name, xCord, yCord, width, height);\n\t\t\t\t\tKVPair<String, Rectangle> item = new KVPair<String, Rectangle>(name, rect);\n\t\t\t\t\tif (width <= 0 || height <= 0 || (xCord + width > 1024) || (xCord + width < 0)\n\t\t\t\t\t\t\t|| (yCord + height > 1024) || (yCord + height < 0) || (xCord < 0) || (yCord < 0)) {\n\t\t\t\t\t\tSystem.out.println(\"Rectangle rejected: (\" + name + \", \" + xCord + \", \" + yCord + \", \" + width\n\t\t\t\t\t\t\t\t+ \", \" + height + \")\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlist.insert(name, rect);\n\t\t\t\t\t\tSystem.out.println(\"Rectangle Inserted: (\" + name + \", \" + xCord + \", \" + yCord + \", \" + width\n\t\t\t\t\t\t\t\t+ \", \" + height + \")\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"remove\":\n\t\t\t\t\t// System.out.println(scan.nextLine());\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"regionsearch\":\n\t\t\t\t\t// System.out.println(scan.nextLine());\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"intersections\":\n\t\t\t\t\t// System.out.println(scan.nextLine());\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"search\":\n\t\t\t\t\t// System.out.println(scan.nextLine());\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"dump\":\n\t\t\t\t\tSystem.out.println(\"SkipList dump: \");\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\t\t\t\tSystem.out.println(lineCMD[0]);\n\t\t\t}\n\t\t}\n\t\t// line = scan.nextLine();\n\t\tcatch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\t// String line = scan.nextLine();\n\t\t// System.out.println(line);\n\t\t// System.out.println(file);\n\t\t// fileParser(file);\n\t\t// Rectangle1 rect = new Rectangle1();\n\n\t}", "private ArrayList<String> parseFile(String file_name){ // extract each line from file AS string (stopList)\r\n ArrayList<String> list = new ArrayList<>();\r\n Scanner scanner = null;\r\n try{\r\n scanner = new Scanner(new BufferedReader(new FileReader(file_name)));\r\n while (scanner.hasNextLine())\r\n {\r\n list.add(scanner.nextLine());\r\n }\r\n }\r\n catch (Exception e ){ System.out.println(\"Error reading file -> \"+e.getMessage()); }\r\n finally {\r\n if(scanner != null ){scanner.close();} // close the file\r\n }\r\n return list;\r\n }", "private void loadInformation(){\n\t\ttry{\n\t\t\tFileReader fr = new FileReader(\"SpaceProgramGaussDistribution.txt\");\n\t\t\tBufferedReader br = new BufferedReader(fr);\n\t\t\tScanner sc = new Scanner(br);\n\t\t\t\n\t\t\tString info = \"\";\n\t\t\t\n\t\t\twhile(sc.hasNextLine()){\n\t\t\t\tinfo += sc.nextLine();\n\t\t\t}\n\t\t\t\n\t\t\tString split[] = info.split(\"#\");\n\t\t\t\n\t\t\tfor(int i = 0; i < split.length; i++){\n\t\t\t\tpopulationInfo += split[i]+\"\\n\";\n\t\t\t}\n\t\t\tsc.close();\n\t\t\tbr.close();\n\t\t\tfr.close();\n\t\t\t\n\t\t}catch(Exception e){\n\t\t\tSystem.out.println(\"File not found: SpaceProgramGaussDistribution.txt\");\n\t\t}\n\t}", "private void readFile() {\r\n\t\tScanner sc = null; \r\n\t\ttry {\r\n\t\t\tsc = new Scanner(inputFile);\t\r\n\t\t\twhile(sc.hasNextLine()){\r\n\t\t\t\tgrade.add(sc.nextLine());\r\n\t } \r\n\t\t}\r\n\t\tcatch (FileNotFoundException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\tfinally {\r\n\t\t\tsc.close();\r\n\t\t}\t\t\r\n\t}", "@SuppressWarnings(\"AccessingNonPublicFieldOfAnotherObject\")\n\t// Accessing final fields of a private inner class that is not exported\n\tprivate void processFile(boolean initial)\n\t{\n\t\tlog(Level.INFO, \"Processing MOTD file \" + f.getPath());\n\t\tBufferedReader in = null;\n\t\tMessage curr = null;\n\t\tfinal LinkedList<Message> stack = new LinkedList<Message>();\n\n\t\ttry\n\t\t{\n\t\t\tin = new BufferedReader(new FileReader(f));\n\n\t\t\twhile (in.ready())\n\t\t\t{\n\t\t\t\tString line = in.readLine().trim();\n\n\t\t\t\tif (line.charAt(0) == '#') continue;\n\t\t\t\tif (line.equals(\"[Message]\"))\n\t\t\t\t{\n\t\t\t\t\tif (curr != null) stack.push(curr);\n\t\t\t\t\tcurr = new Message();\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (curr == null) continue;\n\t\t\t\tint div = line.indexOf('=');\n\t\t\t\tif (div == -1) continue;\n\n\t\t\t\tString field = line.substring(0,div).toLowerCase();\n\t\t\t\tString value = line.substring(div+1);\n\n\t\t\t\tif (field.equals(\"id\"))\n\t\t\t\t{\n\t\t\t\t\tcurr.id = Integer.parseInt(value);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (initial) continue; // We only care for ids in initial pass\n\t\t\t\tif (field.equals(\"active\"))\n\t\t\t\t{\n\t\t\t\t\tcurr.active = Boolean.valueOf(value);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (field.equals(\"title\"))\n\t\t\t\t{\n\t\t\t\t\tcurr.title = value;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (field.equals(\"short\"))\n\t\t\t\t{\n\t\t\t\t\tcurr.mshort = value;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (field.equals(\"long\"))\n\t\t\t\t{\n\t\t\t\t\tcurr.mlong = value;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (field.equals(\"from\"))\n\t\t\t\t{\n//\t\t\t\t\tcurr.from = new Date(value).getTime();\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (field.equals(\"to\"))\n\t\t\t\t{\n//\t\t\t\t\tcurr.to = new Date(value).getTime();\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (field.equals(\"posterid\"))\n\t\t\t\t{\n\t\t\t\t\tcurr.poster_uid = value;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (field.equals(\"postername\"))\n\t\t\t\t{\n\t\t\t\t\tcurr.poster_name = value;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (field.equals(\"showunix\")) continue;\n\n\t\t\t\tlog(Level.WARNING, \"Unknown Field '\" + field + \"'\");\n\t\t\t}\n\t\t}\n\t\tcatch (IOException ex)\n\t\t{\n\t\t\tlog(Level.WARNING, ex);\n\t\t}\n\t\tcatch (Throwable ex)\n\t\t{\n\t\t\tlog(Level.SEVERE, ex.getMessage());\n\t\t}\n\t\tfinally\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tin.close();\n\t\t\t}\n\t\t\tcatch (IOException ex)\n\t\t\t{\n\t\t\t}\n\t\t}\n\n\t\tif (curr != null) stack.push(curr);\n\t\tlastModified = f.lastModified();\n\n\t\tif (initial)\n\t\t{\n\t\t\tif (stack.size() > 0) lastId = stack.getLast().id;\n\t\t\treturn;\n\t\t}\n\t\tfor (Message m : stack)\n\t\t{\n\t\t\tif (m.id > lastId)\n\t\t\t{\n\t\t\t\tlog(Level.INFO, \"Sending MOTD Notice #\" + m.id);\n\t\t\t\tgetInstance().message(channel, m.toString());\n\t\t\t\tlastId = m.id;\n\t\t\t}\n\t\t}\n\t}", "public void readFile()\r\n\t{\r\n\t\t\r\n\t\ttry\r\n\t\t{\r\n\t\t\tx = new Scanner(new File(\"clean vipr measles results.txt\"));\r\n\t\t\t\r\n\t\t\twhile (x.hasNext())\r\n\t\t\t{\r\n\t\t\t\tString a = x.next();\r\n\t\t\t\tString b = x.next();\r\n\t\t\t\tString c = x.next();\r\n\t\t\t\t\r\n\t\t\t\tSystem.out.printf(\"%s %s %s \\n\\n\", a,b,c);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tx.close();\r\n\t\t}\r\n\t\tcatch (Exception e)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"file not found\");\r\n\t\t}\r\n\t\r\n\t}", "public String read(String user, String action) throws FileNotFoundException, IOException {\r\n\t\tString filename = user + \".txt\";\r\n \tString absoluteFilePath = \"\";\r\n\t\tString workingDirectory = System.getProperty(\"user.dir\");\r\n\t\tArrayList<String> create = new ArrayList<String>();\r\n\t\tArrayList<String> logged = new ArrayList<String>();\r\n\t\tArrayList<String> updated = new ArrayList<String>();\r\n\t\tArrayList<String> removed = new ArrayList<String>();\r\n\t\t\r\n\t\t\r\n\t\t//absoluteFilePath = workingDirectory + System.getProperty(\"file.separator\") + filename;\r\n\t\tabsoluteFilePath = workingDirectory + File.separator + filename;\r\n\t\ttry(BufferedReader br = new BufferedReader(new FileReader(absoluteFilePath))) {\r\n\t\t StringBuilder sb = new StringBuilder();\r\n\t\t String line = br.readLine();\r\n\t\t \r\n\t\t while (line != null) {\r\n\t\t \t\r\n\t\t \t\r\n\t\t \tString arr[] = line.split(\" \");\r\n\t\t \tString firstWord = arr[0];\r\n\t\t \tif(firstWord.equals(\"'Created\"))\r\n\t\t {\r\n\t\t \t\r\n\t\t \tcreate.add(line);\r\n\t\t \t\r\n\t\t }\r\n\t\t \t\r\n\t\t \telse if(firstWord.equals(\"'Logged\"))\r\n\t\t {\r\n\t\t \t\r\n\t\t \tlogged.add(line);\r\n\t\t \t\r\n\t\t }\r\n\t\t \t\r\n\t\t \telse if(firstWord.equals(\"'Updated\"))\r\n\t\t {\r\n\t\t \t\r\n\t\t \tupdated.add(line);\r\n\t\t \t\r\n\t\t }\r\n\t\t \t\r\n\t\t \telse if(firstWord.equals(\"'Removed\"))\r\n\t\t {\r\n\t\t \t\r\n\t\t \tremoved.add(line);\r\n\t\t \t\r\n\t\t }\r\n\t\t \t\r\n\t\t \r\n\t\t line = br.readLine();\r\n \r\n\t\t }\r\n\t\t \r\n\t\t \r\n\t\t if(action==\"logged\")\r\n\t\t {\r\n\t\t for(String d : logged)\r\n\t\t {\r\n\t\t \tsb.append(\"<p style='font-size: 80%'>\");\r\n\t\t\t sb.append(d);\r\n\t\t\t sb.append(\"</p>\");\r\n\t\t }\r\n\t\t }\r\n\t\t \r\n\t\t \r\n\t\t else if(action==\"create\")\r\n\t {\r\n\t\t for(String d : create)\r\n\t\t {\r\n\t\t \tsb.append(\"<p style='font-size: 80%'>\");\r\n\t\t\t sb.append(d);\r\n\t\t\t sb.append(\"</p>\");\r\n\t\t \t\r\n\t\t }\r\n\t } \r\n\t\t \r\n\t\r\n\t\t else if(action==\"update\")\r\n\t {\r\n\t\t for(String d : updated)\r\n\t\t {\r\n\t\t \tsb.append(\"<p style='font-size: 80%'>\");\r\n\t\t\t sb.append(d);\r\n\t\t\t sb.append(\"</p>\");\r\n\t\r\n\t\t }\r\n\t }\r\n\t\t \r\n\t\t \r\n\t\t \r\n\t\t else if(action==\"remove\") \r\n\t\t {\r\n\t\t for(String d : removed)\r\n\t\t {\r\n\t\t \tsb.append(\"<p style='font-size: 80%'>\");\r\n\t\t\t sb.append(d);\r\n\t\t\t sb.append(\"</p>\");\r\n\t\r\n\t\t }\r\n\t\t }\r\n\t\t \r\n\t\t \r\n\t\t String everything = sb.toString();\r\n\t\t return everything;\r\n\t\t} \r\n\t}", "public void readFile();", "public Set<ContextualActivity> read() {\n Set<ContextualActivity> defaultActivities = new HashSet<ContextualActivity>();\n try {\n\n Scanner s = new Scanner(input);\n while (s.hasNextLine()) {\n // verb, noun, locations, times, duration\n String infos[] = (s.nextLine()).split(\",\");\n\n Set<String> locations = new HashSet<String>();\n Collections.addAll(locations, infos[2].split(Cons.ENTRY_SEPARATOR_REG));\n\n Set<TimeOfDay> times = new HashSet<TimeOfDay>();\n for (String tm : infos[3].split(Cons.ENTRY_SEPARATOR_REG)) {\n try {\n times.add(TimeOfDay.valueOf(tm.toUpperCase()));\n }\n catch (Exception e){\n }\n }\n\n defaultActivities.add(new DefaultActivity(infos[0], infos[1], locations, times, infos[4]));\n }\n\n return defaultActivities;\n } catch (Exception e) {\n e.printStackTrace();\n }\n return defaultActivities;\n }", "private void checkMaze(File inputFile) throws FileNotFoundException\r\n ,IllegalStateException {\r\n boolean hasStart=false,hasGoal=false;\r\n Scanner readFile= new Scanner(inputFile);\r\n String line;\r\n char c;\r\n while(readFile.hasNextLine()){\r\n line= readFile.nextLine();\r\n for(int i=0;i<line.length();i++){\r\n c=line.charAt(i);\r\n\r\n if (c!='S'&&c!='G'&&c!='*'&&c!=' ')\r\n throw new IllegalStateException(\r\n \"File holds invalid symbols\");\r\n if(c==START)\r\n hasStart=true;\r\n if(c==GOAL)\r\n hasGoal=true;\r\n }\r\n }\r\n\r\n if(!hasStart||!hasGoal)\r\n throw new IllegalStateException(\"Maze missing necessary values\");\r\n\r\n readFile.close();\r\n }", "boolean input(String filename){\n\t\tScanner in = null;\n\t\tString word;\n\t\ttry {\t\t\t\n\t\t\tin=new Scanner(new BufferedReader(new FileReader(filename)));\n\t\t\t//in=new Scanner(new FileReader(filename));\n\t\t\tif(in.hasNext())\n\t\t\t\tword=in.next();\n\t\t\telse return false;\n\t\t\tif(word.equals(\"//tokens\")){\n\t\t\t\tif(in.hasNext())\n\t\t\t\t\tword=in.next();\n\t\t\t\twhile(!word.equals(\"//reserved\")){\t\t\t\t\t\n\t\t\t\t\tString token_name= word;\n\t\t\t\t\tif(in.hasNext())\n\t\t\t\t\t\tword=in.next();\n\t\t\t\t\telse return false;\n\t\t\t\t\tString token_RE=word;\n\t\t\t\t\tRegexPattern ptn=new RegexPattern(token_name,token_RE);\t\t//to be modified\n\t\t\t\t\ttable_pt.add(ptn);\n\t\t\t\t\tif(in.hasNext())\n\t\t\t\t\t\tword=in.next();\n\t\t\t\t\telse return false;\n\t\t\t\t}\n\t\t\t\tif(in.hasNext())\n\t\t\t\t\tword=in.next();\n\t\t\t\twhile(!word.equals(\"//operator\")){\t\t\t\t\t\n\t\t\t\t\tString name= word;\n\t\t\t\t\tif(in.hasNext())\n\t\t\t\t\t\tword=in.next();\n\t\t\t\t\telse return false;\n\t\t\t\t\tString value=word;\n\t\t\t\t\tReservedWord res=new ReservedWord(name,value);\t\t\n\t\t\t\t\ttable_res.add(res);\n\t\t\t\t\tif(in.hasNext())\n\t\t\t\t\t\tword=in.next();\n\t\t\t\t\telse return false;\n\t\t\t\t}\n\t\t\t\tif(in.hasNext())\n\t\t\t\t\tword=in.next();\n\t\t\t\twhile(!word.equals(\"//end\")){\t\t\t\t\t\n\t\t\t\t\tString name= word;\n\t\t\t\t\tif(in.hasNext())\n\t\t\t\t\t\tword=in.next();\n\t\t\t\t\telse return false;\n\t\t\t\t\tString value=word;\n\t\t\t\t\tReservedWord rsv=new ReservedWord(name,value);\t\t\n\t\t\t\t\ttable_res.add(rsv);\n\t\t\t\t\ttable_op.add(rsv);\n\t\t\t\t\tif(in.hasNext())\n\t\t\t\t\t\tword=in.next();\n\t\t\t\t\telse return false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\telse return false;\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\t\t\t\n\t\t}finally{\n\t\t\tin.close();\n\t\t}\n\t\treturn true;\t\t\n\t}", "public static void main(String[] args) throws IOException {\n\n fileReader(\"endpoints1.txt\", \"endpoints2.txt\");\n\n /* First Test Case Completed with Correct Files */\n\n /*===============================================/*\n\n /* Second Test Case With Valid and Invalid Files */\n\n// fileReader(\"endpoints1.txt\", \"invalidpoints.txt\");\n\n /* Second Test Case Completed with one Invalid File */\n\n /*===============================================/*\n\n /* Third Test Case With Invalid Files */\n\n// fileReader(\"invalidpoints.txt\", \"endpoints2.txt\");\n\n /* Third Test Case Completed with Invalid File */\n\n }", "public static void readLocations() throws ProgressionException\n\t{\n\t\t//File file = GeoDis_GUI.inputfile;\n\t\t//infilename = file.getPath();\n\t\t//System.err.println(file.getPath());\n\t\t//infile = new TextInputStream(file.getPath());\n\t\tlogfile.print(\"\\nReading geographical locations ...\");\n\t\tinfile = new TextInputStream(GeoDis.infilename);\n\t\t\n\t\tdataName = infile.readLine(); \n\t\t//System.err.println (dataName);\n \t\n\t\tnumLocations = infile.readInt(); \n\t\t//System.err.println(numLocations);\n\t\n\t\n\t\tlocationName = new String[numLocations]; \n\t\tsampleSize = new int[numLocations]; \n\t\tLatitude = new double[numLocations]; \n\t\tLongitude = new double[numLocations]; \n\t\t\n\t\tfor(j = 0; j < numLocations; j++)\n\t\t{\n\t\t\t//trash = infile.readLine(); // read the \\n character in PC's\n\t\t\t\n\t\t\tlocationName[j] = infile.readLine(); \n\n\t\t\tif (locationName[j].length() == 0)\t\t\t\n\t\t\t\tlocationName[j] = infile.readLine(); \n\t\t\t\n\t\t\tsampleSize[j] = infile.readInt();\n\n\n\t\t\tif (usingDecimalDegrees) \n\t\t\t{\n\t\t\t\tLatitude[j] = infile.readFloat();\n\t\t\t\tLongitude[j] = infile.readFloat();\n\t\t\t}\t\n\n\t\t\telse\n\t\t\t{\n\t\t\t\tlat_deg = infile.readInt();\n\t\t\t\tlat_min = infile.readInt();\n\t\t\t\tlat_sec = infile.readInt();\n\t\t\t\tlat_coor = infile.readWord();\n\t\t\t\tlon_deg = infile.readInt();\n\t\t\t\tlon_min = infile.readInt();\t\t\t\t\n\t\t\t\tlon_sec = infile.readInt();\n\t\t\t\tlon_coor = infile.readWord();\n\t\t\t\n\t\t\t\t//System.err.println (sampleSize[j] + \" \" + lat_deg + \" \" + lat_min + \" \" + lat_sec + \" \" + lat_coor + \" \" + \n\t\t\t\t //lon_deg + \" \" + lon_min + \" \" + lon_sec + \" \" + lon_coor);\n\t\t\t\t\n\t\t\t\tdec_lat = (double)lat_deg + ((double)lat_min/60.0) + ((double)lat_sec/3600.0);\n\t\t\t\tdec_lon = (double)lon_deg + ((double)lon_min/60.0) + ((double)lon_sec/3600.0);\n\t\t\t\t\n\n\t\t\t\tif (lat_coor.equalsIgnoreCase(\"N\"))\n\t\t\t\t\tLatitude[j] = dec_lat;\n\t\t\t\telse if (lat_coor.equalsIgnoreCase(\"S\"))\n\t\t\t\t\tLatitude[j] = -1.0 * dec_lat; \n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tStringBuffer str = new StringBuffer();\n\t\t\t\t\tstr.append(\"The letter for the latitude is neither N nor S.\");\n\t\t\t\t\tstr.append(\"\\nNote that latitude should come before longitude.\");\n\t\t\t\t\tif(!Mediator.isCommandLineApp()){\n\t\t\t\t\t\tJOptionPane.showMessageDialog(frame,\"The letter for the latitude is neither N nor S.\" + \n\t\t \t\t\t\"\\n Note that latitude should come before longitude\",\n \t\t\t\"GeoDis warning\", JOptionPane.WARNING_MESSAGE);\n\t\t\t\t \t\t//frame.dispose();\t\t\t\t\n\t\t\t\t\t\t//System.exit(0);\n\t\t\t\t\t\tthrow new ProgressionException(str.toString());\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstr.append(\"[GeoDis]\\n\");\n\t\t\t\t\t\tMediator.writeError(str.toString());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\n\t\t\t\tif (lon_coor.equalsIgnoreCase(\"E\"))\n\t\t\t\t\tLongitude[j] = dec_lon;\n\t\t\t\telse if (lon_coor.equalsIgnoreCase(\"W\"))\n\t\t\t\t\tLongitude[j] = -1.0 * dec_lon;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tStringBuffer str = new StringBuffer();\n\t\t\t\t\tstr.append(\"The letter for the longitude is neither E nor W.\");\n\t\t\t\t\tstr.append(\"\\nNote that latitude should come before longitude.\");\n\t\t\t\t\tif(!Mediator.isCommandLineApp()){\n\t\t\t\t\t\tJOptionPane.showMessageDialog(frame,\"The letter for the longitude is neither E nor W.\" + \n\t\t \t\t\t\"\\n See that latitude come first than longitude\",\n \t\t\t\"GeoDis warning\", JOptionPane.WARNING_MESSAGE);\n\t\t\t\t \t\t//frame.dispose();\t\t\t\t\n\t\t\t\t\t\t//System.exit(0);\n\t\t\t\t\t\tthrow new ProgressionException(str.toString());\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstr.append(\"[GeoDis]\\n\");\n\t\t\t\t\t\tMediator.writeError(str.toString());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (locationName[i] == null || sampleSize[i] <= 0 || Latitude[j] > 90 || Latitude[j]< -90 || Longitude[j] < -180 || Longitude[j] > 180) \n\t\t\t{\n\t\t\t\t\n\t\t\t\tif (locationName[i] == null)\n\t\t\t\t\tif(!Mediator.isCommandLineApp()){\n\t\t\t\t\t\tSystem.err.println (\"\\nlocationName [i] == null\");\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (sampleSize[i] <= 0)\n\t\t\t\t\tif(!Mediator.isCommandLineApp()){\n\t\t\t\t\t\tSystem.err.println (\"\\nsampleSize[i] <= 0\");\n\t\t\t\t\t}\n\n\t\t\t\tif (Latitude[j] > 90)\n\t\t\t\t\tif(!Mediator.isCommandLineApp()){\n\t\t\t\t\t\tSystem.err.println (\"\\nLatitude[j] > 90\");\n\t\t\t\t\t}\n\n\t\t\t\tif (Latitude[j]< -90)\n\t\t\t\t\tif(!Mediator.isCommandLineApp()){\n\t\t\t\t\t\tSystem.err.println (\"\\nLatitude[j]< -90\");\n\t\t\t\t\t}\n\n\t\t\t\tif (Longitude[j] < -180)\n\t\t\t\t\tif(!Mediator.isCommandLineApp()){\n\t\t\t\t\t\tSystem.err.println (\"\\nLongitude[j] < -180\");\n\t\t\t\t\t}\n\n\t\t\t\tif (Longitude[j] > 180)\n\t\t\t\t\tif(!Mediator.isCommandLineApp()){\n\t\t\t\t\t\tSystem.err.println (\"\\nLongitude[j] > 180\");\n\t\t\t\t\t}\n\n\t\t\t\tStringBuffer str = new StringBuffer();\n\t\t\t\tstr.append(\"There was an error reading the population description\");\n\t\t\t\tstr.append(\"\\nor its coordinates. If your coordinates are in decimal degrees, have you checked that box?\");\n\t\t\t\tif(!Mediator.isCommandLineApp()){\n\t\t\t\t\tJOptionPane.showMessageDialog(frame,\"There was an error reading the population description\" +\n\t\t\t\t\t\t\"\\nor its coordinates. If your coordinates are in decimal degrees, have you checked that box?\",\n \"GeoDis warning\", JOptionPane.WARNING_MESSAGE);\n\t\t\t\t\t//frame.dispose();\t\t\t\t\n\t\t\t\t\t//System.exit(0);\n\t\t\t\t\tthrow new ProgressionException(str.toString());\n\t\t\t\t} else {\n\t\t\t\t\tstr.append(\"[GeoDis]\\n\");\n\t\t\t\t\tMediator.writeError(str.toString());\n\t\t\t\t}\n\t\t\t}\n\t\t\tlogfile.print(\"\\nreading \" + locationName[j] + \" \" + sampleSize[j] + \" \");\n\t\t\tlogfile.printf(\" %6.4f\",Latitude[j]);\n\t\t\tlogfile.printf(\" %6.4f\",Longitude[j]);\n\t\t\t//System.err.println (locationName[j]);\n\t\t\t//System.err.println(sampleSize[j] + \" \" + Latitude[j] + \" \" + Longitude[j]);\t\t\t\n\t\t}\n\n\t \t/* TRANSFORM DEGREES TO RADIANS */\n\t\tfor(j = 0; j < numLocations; j++)\n\t\t{\n\t\t\tLatitude[j] *= D2R;\n\t\t\tLongitude[j] *= D2R;\n\t\t} \n\t\tlogfile.println(\"\\nOK\");\n\n \t}", "public static void main(String[] args) {\n String timestamp;\n TrafficSnapshotHolder counter = new TrafficSnapshotHolder();\n try (FileReader fr = new FileReader(\"data/traffic1.txt\");\n BufferedReader br = new BufferedReader(fr)) {\n while ((timestamp = br.readLine()) != null) {\n counter.add(extractInfo(timestamp));\n }\n }\n catch (FileNotFoundException e) {\n e.printStackTrace();\n }\n catch (IOException e) {\n e.printStackTrace();\n }\n if(counter.isEmpty()){\n System.out.println(\"File at location is empty, please check file\");\n System.exit(0);\n }\n counter.processSnapshots();\n }", "public void fileInformation(String filePath){\n File myFile = new File(filePath);\n if (myFile.exists()) {\n System.out.println(\"File name: \"+myFile.getName());\n System.out.println(\"Absolute path: \"+ myFile.getAbsolutePath());\n System.out.println(\"Writeable: \"+myFile.canWrite());\n System.out.println(\"Readable: \"+myFile.canRead());\n System.out.println(\"File size in bytes: \"+myFile.length());\n } else {\n System.out.println(\"File does not exists\");\n }\n }", "public static void ReadAchievements()\n {\n try\n {\n BufferedReader file = new BufferedReader(new FileReader(achievements_file_name));\n int actualLine = 0, nb_achievements_done = 0;\n while(actualLine<Achievement.NB_ACHIEVEMENTS)\n {\n boolean currentValue = Utilities.IntToBool(Integer.parseInt(file.readLine()));\n Achievement.achievements_done[actualLine] = currentValue;\n if(currentValue)\n nb_achievements_done++;\n actualLine++;\n }\n file.close();\n Achievement.nb_achievements_done = nb_achievements_done;\n Achievement.CheckAllAchievements();\n } \n catch (Exception e) { SaveAchievements(); }\n }", "public String check_loginFile(){\n String text=\"\";\n try{\n FileInputStream fileInputStream=context.openFileInput(Constant.LOGIN_FILE);\n Scanner obj=new Scanner(fileInputStream);\n obj.useDelimiter(\",\");\n while(obj.hasNext())\n text=obj.next();\n obj.close();\n fileInputStream.close();\n }\n catch (FileNotFoundException e){\n //Constant.IS_CREATE_DATABASE=false;\n //Message.logMessages(\"FILE: \",String.valueOf(Constant.IS_CREATE_DATABASE));\n return \"not logged in\";\n }\n catch (Exception e){\n Message.logMessages(\"ERROR: \",e.toString());\n }\n return text;\n }", "private static void info ( File f ) {\n\tString nume = f . getName () ;\n\tif( f.isFile () )\n\tSystem.out.println ( \" Fisier : \" + nume ) ;\n\telse\n\tif( f.isDirectory () )\n\tSystem.out.println ( \" Director : \" + nume ) ;\n\tSystem.out.println (\n\t\" Cale absoluta : \" + f.getAbsolutePath () +\n\t\" \\n Poate citi : \" + f.canRead () +\n\t\" \\n Poate scrie : \" + f.canWrite () +\n\t\" \\n Parinte : \" + f.getParent () +\n\t\" \\n Cale : \" + f.getPath () +\n\t\" \\n Lungime : \" + f.length () +\n\t\" \\n Data ultimei modificari : \" +\n\tnew Date ( f.lastModified () ) ) ;\n\tSystem.out.println ( \" --------------\" ) ;\n\t}", "public void readFile(File file){\n try{\n scan = new Scanner(file);\n while(scan.hasNextLine()){\n String line = scan.nextLine();\n if(line.startsWith(\"//\")){\n continue;\n }\n process(line);\n }\n }catch(IOException e){\n Alert alert = new Alert(AlertType.INFORMATION);\n alert.setTitle(\"\");\n alert.setHeaderText(null);\n alert.setContentText(\"Oops the input was not read properly\");\n alert.showAndWait();\n e.printStackTrace();\n }catch(NullPointerException e){\n Alert alert = new Alert(AlertType.INFORMATION);\n alert.setTitle(\"\");\n alert.setHeaderText(null);\n alert.setContentText(\"Oops the input was not read properly\");\n alert.showAndWait();\n e.printStackTrace();\n \n }\n }", "private void parse() throws IOException {\n\n\t\tStats statsObject = new Stats();\n\n\t\tstatsObject.setProcessName(process);\n\n\t\tList<String> lines = Files.readAllLines(Paths.get(filename), Charset.defaultCharset());\n\n\t\tPattern timePattern = Pattern.compile(\"((\\\\d+)-)*(\\\\d+)\\\\W((\\\\d+):)*(\\\\d+)\\\\.(\\\\d+)\");\n\n\t\tSystem.out.println(filename+\" \"+lines.get(0));\n\t\tMatcher matcher = timePattern.matcher(lines.get(0));\n\t\twhile (matcher.find()) {\n\t\t\tstatsObject.setStartTime(matcher.group(0));\n\t\t\tbreak;\n\t\t}\n\n\t\tmatcher = timePattern.matcher(lines.get(lines.size() - 1));\n\t\twhile (matcher.find()) {\n\t\t\tstatsObject.setEndTime(matcher.group(0));\n\t\t\tbreak;\n\t\t}\n\t\tString error = new String();\n\t\tfor (String line : lines) {\n\n\t\t\tif (line.startsWith(\"[\")) {\n\t\t\t\tif (!error.isEmpty()) {\n\t\t\t\t\tstatsObject.addError(error);\n\t\t\t\t\terror = \"\";\n\t\t\t\t}\n\n\t\t\t\tif (line.contains(\"Number of records processed: \")) {\n\n\t\t\t\t\tPattern numberPattern = Pattern.compile(\"\\\\d+\");\n\t\t\t\t\tmatcher = numberPattern.matcher(line);\n\t\t\t\t\t\n\t\t\t\t\tString numberOfRecordsProcessed = \"N/A\";\n\t\t\t\t\t\n\t\t\t\t\twhile (matcher.find()) {\n\t\t\t\t\t\tnumberOfRecordsProcessed = matcher.group();\n\t\t\t\t\t}\n\t\t\t\t\tstatsObject.setRecordsProcessed(numberOfRecordsProcessed);\n\n\t\t\t\t}\n\n\t\t\t\telse if (line.contains(\"WARNING\")) {\n\t\t\t\t\tif (line.contains(\"MISSING Property\")) {\n\t\t\t\t\t\tstatsObject.incrementErrorCounter();\n\t\t\t\t\t\tstatsObject.addError(line);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstatsObject.incrementWarningCounter();\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t} else if (line.contains(\"Exception\") || (line.contains(\"Error\"))) {\n\t\t\t\tif (!error.isEmpty()) {\n\t\t\t\t\tstatsObject.addError(error);\n\t\t\t\t\terror = \"\";\n\t\t\t\t}\n\t\t\t\tstatsObject.incrementErrorCounter();\n\t\t\t\terror = error + line;\n\t\t\t} else {\n\t\t\t\terror = error + line ;\n\t\t\t}\n\n\t\t}\n\t\t// reader.close();\n\t\tif (statsObject.getErrorCounter() > 0) {\n\t\t\tstatsObject.setStatus(\"Failure\");\n\t\t}\n\n\t\tPattern pattern = Pattern.compile(\"\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\");\n\t\tmatcher = pattern.matcher(filename);\n\t\tString date = null;\n\t\twhile (matcher.find()) {\n\t\t\tdate = matcher.group(0);\n\t\t\tbreak;\n\t\t}\n\t\tboolean saveSuccessful = OutputManipulator.addToStatFile(username, process, date, statsObject);\n\n\t\tif (saveSuccessful) {\n\t\t\tFileParseScheduler.addSuccessfulParsedFileName(username, process, filename);\n\t\t}\n\n\t\tFileParseScheduler.removeLatestKilledThreads(process + filename);\n\t}", "public List<List<String>> read () {\n List<List<String>> information = new ArrayList<>();\n try (BufferedReader br = new BufferedReader(new FileReader(path))) {\n int aux = 0;\n while ((line = br.readLine()) != null) {\n String[] data = line.split(split_on);\n List<String> helper = new ArrayList<>();\n helper.add(data[0]);\n helper.add(data[1]);\n information.add(helper);\n }\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n } finally {\n if (br != null) {\n try {\n br.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n return information;\n }", "public void readFile(File file) {\n\ttry (BufferedReader br = new BufferedReader(new FileReader(file)))\n\t{\n\n\t\tString sCurrentLine;\n\t\tString [] lineElements;\n\t\t\n\t\t// read the headlines\n\t\tsCurrentLine = br.readLine();\n\t\tlineElements = sCurrentLine.split(\"\\\\s+\");\n\t\tnumVertices = Integer.parseInt(lineElements[1]);\n\t\tsCurrentLine = br.readLine();\n\t\tlineElements = sCurrentLine.split(\"\\\\s+\");\n\t\tnumPaths = Integer.parseInt(lineElements[1]);\n\t\tsCurrentLine = br.readLine();\n\t\tlineElements = sCurrentLine.split(\"\\\\s+\");\n\t\ttmax = Double.parseDouble(lineElements[1]);\n\t\t\n//\t\tSystem.out.println(numVertices + \", \" + numPaths + \", \" + tmax);\n\n\t\t/* read benefits1 */\n\t\tint index = 0;\n\t\twhile ((sCurrentLine = br.readLine()) != null) {\n//\t\t\t\tSystem.out.println(sCurrentLine);\n\t\t\tlineElements = sCurrentLine.split(\"\\\\s+\");\n\t\t\tdouble x = Double.parseDouble(lineElements[0]);\n\t\t\tdouble y = Double.parseDouble(lineElements[1]);\n\t\t\tList<Double> scores = new ArrayList<Double>();\n\t\t\tfor (int i = 2; i < lineElements.length; i++) {\n\t\t\t\tdouble score = Double.parseDouble(lineElements[i]);\n\t\t\t\tscores.add(new Double(score));\n\t\t\t}\n\t\t\tPOI POI = new POI(index, x, y, scores);\n\t\t\t//POI.printMe();\n\t\t\t\n\t\t\tvertices.add(POI);\n\t\t\tindex ++;\n\t\t}\n\t\t\n\t\t// create the arcs and the graph\n\t\tfor (int i = 0; i < vertices.size(); i++) {\n\t\t\tfor (int j = 0; j < vertices.size(); j++) {\n\t\t\t\tArc arc = new Arc(vertices.get(i), vertices.get(j));\n\t\t\t\tarcs.add(arc);\n\t\t\t\tgraph.put(new Tuple2<POI, POI>(vertices.get(i), vertices.get(j)), arc);\n\t\t\t}\n\t\t}\n\t} catch (IOException e) {\n\t\te.printStackTrace();\n\t}\n}", "private static String readParseOutput(String fileName, int mode) throws IOException {\n\t\tStringBuffer stringBuffer = new StringBuffer();\n\t\tStringBuffer errorBuffer = new StringBuffer();\n\t\tFileReader fileReader = new FileReader(fileName);\n\t\tBufferedReader bufferedReader = new BufferedReader(fileReader);\n\t\tScanner fileScanner = new Scanner(bufferedReader);\n\t\tint fileStage = 0;\n\n\t\twhile (fileScanner.hasNextLine()) {\n\t\t\tString s = fileScanner.nextLine();\n\n\t\t\tif (s.equals(\"** Basic block: 0 **\")) {\n\t\t\t\tfileStage = 0;\n\t\t\t}\n\t\t\t// Beginning of Live Range info\n\t\t\telse if (s.startsWith(\"<<---- Live Ranges ---->>\")) {\n\t\t\t\tfileStage = 1;\n\t\t\t}\n\t\t\t// uninitialized variable warning\n\t\t\telse if (s.startsWith(\"WARNING: possible uninitialized local variable index\")) {\n\t\t\t\tfileStage = 2;\n\t\t\t}\n\t\t\telse if (s.startsWith(\"<<---- Optimized code ---->>\")) {\n\t\t\t\tfileStage = 3;\n\t\t\t}\n\n\t\t\t// store instruction, ignoring instruction number\n\t\t\tif (fileStage == 0) {\t\t// CFG, only look at pred/succ info\n\t\t\t\tif (mode == 0 && s.contains(\"Successors\")) {\n\t\t\t\t\tstringBuffer.append(s + \"\\n\");\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (fileStage == 1) {\t\t// Live range, ignore instruction\n\t\t\t\tif (mode > 0) {\n\t\t\t\t\tint idx = s.indexOf(\":\");\n\t\t\t\t\tif (idx > 3)\n\t\t\t\t\t\tstringBuffer.append(s.substring(0, idx-3));\n\t\t\t\t\telse\n\t\t\t\t\t\tstringBuffer.append(s);\n\t\t\t\t\tstringBuffer.append(\"\\n\");\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (fileStage == 2) {\t\t// Look at all warnings\n\t\t\t\tif (mode == 2 && s.contains(\"uninitialized\")) {\n\t\t\t\t\tstringBuffer.append(s + \"\\n\");\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (fileStage == 3) {\t\t\t// Opt code, ignore instruction #\n\t\t\t\tif (mode == 3) {\n\t\t\t\t\tint idx = s.indexOf(\":\");\n\t\t\t\t\tstringBuffer.append(s.substring(idx+1));\n\t\t\t\t\tstringBuffer.append(\"\\n\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfileScanner.close();\n\t\tString result;\n\t\tresult = stringBuffer.toString() + \"\\n\";\n\t\treturn result;\n\t}", "public void checkFile() {\n\t\tFile file = new File(\"src/Project11Problem1Alternative/names.txt\");\n\t\tSystem.out.println(file.exists() ? \"Exists!\" : \"Doesn't exist!\");\n\t\tSystem.out.println(file.canRead() ? \"Can read!\" : \"Can't read!\");\n\t\tSystem.out.println(file.canWrite() ? \"Can write!\" : \"Can't write!\");\n\t\tSystem.out.println(\"Name: \" + file.getName());\n\t\tSystem.out.println(\"Path: \" + file.getPath());\n\t\tSystem.out.println(\"Size: \" + file.length() + \" bytes\");\n\t}", "public int readTrials() throws Exception\n {\n return fileHandler.readInt(file);\n }", "public NexusReaderDistances(String filePath) throws IOException, NexusFormatException {\n\n BufferedReader bufferedReader = null;\n FileReader fileReader = null;\n try {\n fileReader = new FileReader(filePath);\n bufferedReader = new BufferedReader(fileReader);\n\n int state = 0; //0=start of file, 1=after #NEXUS. 2=inside block\n boolean commentMode = false;\n TreeMap<Integer, String> blockLines = null;\n String blockName = null;\n Matcher beginBlockMatcher = Pattern.compile(\"^(?i)BEGIN ([A-Z]+);\").matcher(\"\");\n String line = bufferedReader.readLine();\n int lineNumber = 0;\n while (line != null) {\n lineNumber++;\n line = line.trim();\n //end multiline comments\n if (commentMode) {\n int endIndex = line.indexOf(\"]\");\n if (endIndex == -1) {\n line = bufferedReader.readLine();\n continue;\n } else {\n line = line.substring(endIndex);\n commentMode = false;\n }\n }\n //remove one line comments\n line = line.replaceAll(\"\\\\[.*]\", \"\");\n //remove multi line comments\n int startIndex = line.indexOf(\"[\");\n if (startIndex != -1) {\n line = line.substring(0, startIndex);\n commentMode = true;\n }\n //skip emtpy lines\n if (line.isEmpty()) {\n line = bufferedReader.readLine();\n continue;\n }\n\n //===read lines===\n switch (state) { //0=start of file, 1=after #NEXUS. 2=inside block\n case 0:\n if (!line.equalsIgnoreCase(\"#NEXUS\")) {\n throw new NexusFormatException(\"File must start with #NEXUS. Line: \" + lineNumber);\n } else {\n state++;\n }\n break;\n case 1:\n beginBlockMatcher.reset(line);\n if (beginBlockMatcher.matches()) {\n blockLines = new TreeMap<Integer, String>();\n blockName = beginBlockMatcher.group(1);\n state++;\n } else {\n throw new NexusFormatException(\"Error parsing BEGIN statement. Line \" + lineNumber);\n }\n break;\n case 2:\n if (line.equalsIgnoreCase(\"END;\")) {\n makeBlock(blockName, blockLines);\n state--;\n } else {\n blockLines.put(lineNumber, line);\n }\n break;\n default:\n throw new RuntimeException(\"NexusReader reached illegal state: \" + state);\n }\n\n line = bufferedReader.readLine();\n }\n if (state == 2) {\n throw new NexusFormatException(\"Didn't close block at end of file.\");\n }\n if (state == 0) {\n throw new NexusFormatException(\"File seems empty.\");\n }\n\n bufferedReader.close();\n\n } catch (IOException e) {\n if (bufferedReader != null) {\n bufferedReader.close();\n }\n if (fileReader != null) {\n fileReader.close();\n }\n throw e;\n } catch (NexusFormatException e) {\n if (bufferedReader != null) {\n bufferedReader.close();\n }\n if (fileReader != null) {\n fileReader.close();\n }\n throw e;\n }\n }", "public static void main(String[] args) {\n Path file = Paths.get (\"courses.txt\");\n// line n1\n /* Assume the courses.txt is accessible.\n Which code fragment can be inserted at line n1 to enable the code to print the content of the*/\n //courses.txt file?\n /* A. List<String> fc = Files.list(file);\n fc.stream().forEach (s - > System.out.println(s));\n B. Stream<String> fc = Files.readAllLines (file);\n fc.forEach (s - > System.out.println(s));\n // C. List<String> fc = readAllLines(file);\n //fc.stream().forEach (s - > System.out.println(s));\n D. Stream<String> fc = Files.lines (file);///answer\n fc.forEach (s - > System.out.println(s));*/\n }", "static void read()\n\t\t{\n\n\n\t\t\tString content=new String();\n\t\t\ttry {\n\t\t\t\tFile file=new File(\"Dic.txt\");\n\t\t\t\tScanner scan=new Scanner(file);\n\t\t\t\twhile(scan.hasNextLine()) {\n\t\t\t\t\tcontent=scan.nextLine();\n\t\t\t\t//\tSystem.out.println(content);\n\n\t\t\t\t//\tString [] array=content.split(\" \");\n\t\t\t\t\tlist.add(content.trim());\n\n\t\t\t\t}\n\t\t\t\tscan.close(); \n\t\t\t}\n\t\t\tcatch (Exception e) {\n\t\t\t\tSystem.out.println(e);\n\t\t\t}\n\n\n\t\t}", "private void ReadFile(String filePath) throws IOException{\n File file = new File(filePath);\n BufferedReader b = new BufferedReader(new FileReader(file));\n int lineNumber = 1;\n String line = \"\";\n line = b.readLine();\n while (line != null) {\n // analyze the line only when it is not empty and it is not a comment\n String trimLine = line.toString().trim();\n if(trimLine.length() != 0 && !trimLine.substring(0, 1).equals(\"/\") && !trimLine.substring(0, 1).equals(\"#\")){\n // line.toString().trim(): eliminate heading and tailing whitespaces\n // but add one whitespace to the end of the string to facilitate token manipulation\n // under the circumstances that there is only one token on one line, e.g. main\n AnalyzeByLine(line.toString().trim() + \" \", lineNumber);\n }\n lineNumber++;\n line = b.readLine();\n }\n arrL.add(new Token(\"end of file\", 255, lineNumber));\n// for(int i = 0; i < arrL.size(); i++){\n// System.out.println(arrL.get(i).getCharacters() + \" \" + arrL.get(i).getValue() + \" \" + arrL.get(i).getLineNum());\n// }\n }", "public static void main(String[] args) throws FileNotFoundException, IOException {\n FileInputStream fis=new FileInputStream(\"g:/data/info.txt\");\r\n //step-2 (read the data from stream)\r\n int n=fis.available(); //it gives you no of bytes available for reading in stream\r\n System.out.println(\"Total Bytes Available : \"+n);\r\n byte b[]=new byte[n];\r\n fis.read(b); //will take 1st byte from stream and store to b[0], 2nd to b[1], 3rd to b[2]\r\n //converting bytes to String\r\n String st=new String(b);\r\n System.out.println(st);\r\n //step-3 (close the stream)\r\n fis.close();\r\n }", "public MapMessage processFile(File file) {\r\n\t\ttry {\r\n\r\n\t\t\tScanner input = new Scanner(file);\r\n\r\n\t\t\twhile (input.hasNext()) {\r\n\t\t\t\tString line = input.nextLine();\r\n\t\t\t\tif (!line.isEmpty()) {\r\n\t\t\t\t\tfileContent.append(line).append(\"\\n\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tinput.close();\r\n\r\n\t\t} catch (FileNotFoundException ex) {\r\n\t\t\tex.printStackTrace();\r\n\t\t}\r\n\t\tMapMessage mapMessage = validateMap(fileContent.toString());\r\n\t\treturn mapMessage;\r\n\t}", "private void readWeaponsFromFile(File file) throws IllegalStateException {\n\t\ttry {\n\t\t\tScanner fileScanner = new Scanner(file);\n\t\t\tboolean rangeMinB = false, rangeMaxB = false;\n\t\t\twhile (fileScanner.hasNext() && !(rangeMaxB && rangeMinB)) {\n\t\t\t\tString line = fileScanner.nextLine();\n\t\t\t\tif (line.equals(CHANCE_RANGE_MIN)) {\n\t\t\t\t\trangeMin = Integer.parseInt(fileScanner.nextLine());\n\t\t\t\t\trangeMinB = true;\n\t\t\t\t}\n\t\t\t\telse if (line.equals(CHANCE_RANGE_MAX)) {\n\t\t\t\t\trangeMax = Integer.parseInt(fileScanner.nextLine());\n\t\t\t\t\trangeMaxB = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (fileScanner.hasNext()) {\n\t\t\t\tString line = fileScanner.nextLine();\n\t\t\t\tif (line.equals(START_WEAPON)) {\n\t\t\t\t\treadWeapon(fileScanner);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfileScanner.close();\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\tint bottomRange = rangeMin;\n\t\twhile (bottomRange != rangeMax) {\n\t\t\tint tempBottomRange = bottomRange;\n\t\t\tfor (Weapon weapon: weapons) {\n\t\t\t\tif (weapon.spawnRangeMin == bottomRange) {\n\t\t\t\t\tbottomRange = weapon.spawnRangeMax;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (tempBottomRange == bottomRange) {\n\t\t\t\tthrow new IllegalStateException(\"There is a gap in the ranges of the weapons loaded from \" + file.getAbsolutePath());\n\t\t\t}\n\t\t}\n\t}", "public static void processFile(File f) throws Exception {\n\t\ttry {\r\n\t\t\tBufferedReader bufRead = new BufferedReader(new InputStreamReader(\r\n\t\t\t\t\tnew FileInputStream(f)));\r\n\t\t\tString S1 = \"\";\r\n\t\t\twhile ((S1 = bufRead.readLine()) != null) {\r\n\t\t\t\t//System.out.println(S1);\r\n\t\t\t\tgetPubTypes(S1);\r\n\t\t\t\t//System.out.println();\r\n\t\t\t}\r\n\t\t\tbufRead.close();\r\n\t\t} catch (IOException ioe) {\r\n\t\t\tSystem.out.println(\"Something is wrong with reading file! \"\r\n\t\t\t\t\t+ \"Can't find the appropriate file!\");\r\n\t\t}\r\n\r\n\t\t// return allDiseases;\r\n\r\n\t}", "public ScanReplace(String file, String startDir)\n {\n confFileName = file;\n startPath = Paths.get(startDir);\n fileSpec = \"*.*\";\n\n ReadConfig();\n\n System.out.println(\"Directory,Filename,Line Number, Sub Line Number, Matching Line\");\n FindFiles(startPath.toAbsolutePath());\n\n SummaryReport();\n }", "public static Map<String, Integer> getStartingPositions(File file)\n\t\t\tthrows IOException, FileNotFoundException {\n\t\tMap<String, Integer> startPositions = new HashMap<String, Integer>();\n\t\ttry {\n\t\t\tString line;\n\t\t\tBufferedReader in;\n\t\t\tString extension = PdbHelper.getFileExtension(file);\n\t\t\tif (extension.equals(\"gz\")) {\n\t\t\t\tin = new BufferedReader(new InputStreamReader(\n\t\t\t\t\t\tnew GZIPInputStream(new FileInputStream(file))));\n\t\t\t} else {\n\t\t\t\tin = new BufferedReader(new FileReader(file));\n\t\t\t}\n\n\t\t\twhile ((line = in.readLine()) != null) {\n\t\t\t\tif (line.startsWith(\"DBREF \") || line.startsWith(\"DBREF1\")) {\n\t\t\t\t\tString chainLabel = line.substring(13 - 1, 13);\n\t\t\t\t\tint seqBegin = Integer.parseInt(line.substring(15 - 1, 18)\n\t\t\t\t\t\t\t.trim());\n\t\t\t\t\tstartPositions.put(chainLabel, seqBegin);\n\t\t\t\t\tif (line.startsWith(\"SEQADV \")) {\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\tin.close();\n\t\t} catch (IOException e) {\n\t\t\tSystem.out.println(e);\n\t\t}\n\t\treturn startPositions;\n\t}", "public static void load(Context context) throws IOException {\n // read the file\n String raw = File.readFile(\"vaccine.txt\", context);\n\n // clear the map and load contents of file into the map\n map.clear();\n for (String line : raw.split(\"\\n\")) {\n if (line.equals(\"\")) {\n continue;\n }\n String[] data = line.split(\",\");\n if (data[0].equals(\"\") || data.length != 3) {\n continue;\n }\n map.put(data[0], Boolean.getBoolean(data[1]));\n dateMap.put(data[0], data[2]);\n }\n }", "public void readFile(String file)\n\t{\t\n\t\tfindPieces(file);\n\t}", "public String readConquestFile(String filePath) {\n try {\n File inputMap = new File(filePath);\n String returnString;\n inputReader = new BufferedReader(new FileReader(inputMap));\n returnString=this.getGuiParameters(inputReader);\n if(!returnString.equals(\"SUCCESS\")) {\n return returnString;\n }\n String inputLine;\n int lineCounter = 6;\n while ((inputLine = inputReader.readLine()) != null) {\n if (lineCounter == 6) {\n if (inputLine.equals(\"[Continents]\")) {\n returnString= this.readContinentList(inputReader);\n if (!returnString.equals(\"SUCCESS\")) {\n return \"ONE OR MORE DUPLICATE CONTINENTS ENCOUNTERED\";\n }\n } else {\n return \"THE MAP FORMAT IS WRONG\";\n }\n lineCounter++;\n }\n returnString = this.readCountryList(inputReader);\n if (!returnString.equals(\"SUCCESS\")) {\n return returnString;\n }\n lineCounter++;\n }\n if(validator.isFullyLinked()) {\n returnString = \"SUCCESS\";\n } else {\n returnString = \"The Countries are not properly linked to each other\";\n }\n return returnString;\n }catch (FileNotFoundException e) {\n return \"THE FILE NOT FOUND\";\n }catch (IOException e) {\n return \"ERROR IN READING THE SPECIFIED FILE\";\n }\n }", "public boolean readFile(){\n\t\tboolean counter=false;\n\t\t\ttry {\n\t FileReader reader = new FileReader(readFile);\n\t BufferedReader bufferedReader = new BufferedReader(reader);\n\t \n\t String line;\n\t \n\t while ((line = bufferedReader.readLine()) != null) {\n\t \tStringTokenizer st = new StringTokenizer(line,SEPARATOR);\n\t\t if (st.nextToken().equals(user) && st.nextToken().equals(password)) {\n\t\t \tcounter=true;\n\t\t \treturn counter;\n\t\t }\n\t\t else break;\n\t }\n\t reader.close();\n\t \n\t } catch (IOException e) {\n\t e.printStackTrace();\n\t }\n\t\t return counter;\n\t}", "public boolean ParseExcellon(String fileName, DrillList drillList, DrillToolMap drillToolMap)\n {\n ILogWriter log= new ConsoleLogWriter();\n f=new FileOpration();\n f.Open(fileName);\n String s;\n s=SkipComments();\n if (s.compareTo(\"M48\")!=0)\n {\n log.Writeln(\"begin of header not found\");\n return false;\n }\n log.Writeln(s+\"\\t//header found at \"+f.getIndex());\n s=f.Readln();\n while (s.lastIndexOf(\";FILE_FORMAT=\")==-1)\n {\n s=f.Readln();\n if (s==null) return false;\n }\n log.Writeln(s+\"\\t//found decimal point position declaration at \"+ f.getIndex());\n try {\n digBeforePoint = Integer.parseInt(s.substring(s.lastIndexOf('=')+1,s.lastIndexOf(':')));\n log.Writeln(\"\\tamount of digts before point is setted to \"+digBeforePoint);\n int digAfterPointStartPosition=s.lastIndexOf(':')+1;\n digAfterPoint= Integer.parseInt(s.substring(digAfterPointStartPosition,s.indexOf(' ',digAfterPointStartPosition)));\n log.Writeln(\"\\tamount of digts after point is setted to \"+digAfterPoint);\n }\n catch (NumberFormatException | IndexOutOfBoundsException exc)\n {\n log.Writeln(\"invalid decimal point position declaration\");\n f.Close();\n return false;\n }\n /*catch (IndexOutOfBoundsException exc)\n {\n log.Writeln(\"invalid decimal point position declaration\");\n f.Close();\n return false;\n }*/\n s=SkipComments();\n switch (s.toUpperCase())\n {\n case \"METRIC\":\n metric=true;\n break;\n case \"INCH\":\n metric=false;\n break;\n default:\n log.Writeln(\"the type of measurement system not found\");\n return false;\n }\n log.Writeln(s+\"\\t//the type of measurement system found at \"+f.getIndex());\n log.Writeln(\"\\t the type of measurement system is setted to \"+ (metric?\"METRIC\":\"INCH\"));\n do\n {\n s=SkipComments();\n log.Writeln(s);\n if (s.charAt(0)=='%') break;\n try\n {\n String toolName = s.substring(0, s.indexOf('C'));\n double toolDiam=Double.parseDouble(s.substring(s.indexOf('C')+1));\n drillToolMap.AddTool(toolName,toolDiam);\n log.Writeln(\"\\t\"+toolName+\" with diameter \"+toolDiam+\" found at \"+f.getIndex());\n\n }\n catch (NumberFormatException | IndexOutOfBoundsException exc)\n {\n log.Writeln(\"invalid tool declaration at \"+f.getIndex());\n f.Close();\n return false;\n }\n\n } while (s.charAt(0)!='%');\n log.Writeln(\"end of header found at \"+f.getIndex());\n s = SkipComments();\n do {\n if (s==null)\n {\n log.Writeln(\"parsing completed without footer at \"+f.getIndex());\n f.Close();\n return false;\n }\n if (s.compareTo(\"T00\")==0)\n {\n log.Writeln(\"\\tFooter found at \"+f.getIndex());\n s = SkipComments();\n log.Writeln(s);\n if (s.compareTo(\"M30\")==0)\n {\n log.Writeln(\"\\tEnd of file found at \"+f.getIndex());\n f.Close();\n log.Writeln(\"\\tPARSING COMPLETED\");\n return true;\n }\n log.Writeln(\"parsing completed without footer at \"+f.getIndex());\n f.Close();\n return false;\n }\n log.Writeln(s);\n if (drillToolMap.GetToolDiam(s) == -1) {\n log.Writeln(\"invalid tool name found at \" + f.getIndex());\n f.Close();\n return false;\n }\n DrillFrame df=new DrillFrame();\n df.setDrillDiam(drillToolMap.GetToolDiam(s));\n log.Writeln(\"\\ttool \"+s+\" frame with tool diameter \"+ df.getDrillDiam()+\" found at \"+f.getIndex());\n double x=0,y=0;\n do\n {\n s=SkipComments();\n log.Writeln(s);\n try\n {\n String tempX=\"\",tempY=\"\";\n if (s.indexOf('X')!=-1)\n {\n if (s.indexOf('Y')!=-1)\n {\n tempX = s.substring(s.indexOf('X') + 1, s.indexOf('Y'));\n tempY = s.substring(s.indexOf('Y') + 1);\n }\n else\n {\n tempX = s.substring(s.indexOf('X') + 1);\n }\n }\n else\n {\n if (s.indexOf('Y')!=-1)\n {\n tempY = s.substring(s.indexOf('Y') + 1);\n }\n else\n {\n drillList.Add(df);\n break;\n }\n\n }\n if (tempX!=\"\")\n x=Double.parseDouble(tempX)/Math.pow(10,digAfterPoint);\n if (tempY!=\"\")\n y=Double.parseDouble(tempY)/Math.pow(10,digAfterPoint);\n df.addPoint(x,y);\n log.Writeln(\"\\tpoint (\"+Double.toString(x)+\",\"+Double.toString(y)+\") found at \"+f.getIndex());\n }\n catch (NumberFormatException | IndexOutOfBoundsException exc)\n {\n log.Writeln(\"invalid coordinate at \"+f.getIndex());\n f.Close();\n return false;\n }\n\n }while(true);\n }while (true);\n\n\n //f.Close();\n //return true;\n }", "boolean hasCompleteFile();", "private void readMetaData() throws AreaFileException {\r\n \r\n int i;\r\n// hasReadData = false;\r\n\r\n// if (! fileok) {\r\n// throw new AreaFileException(\"Error reading AreaFile directory\");\r\n// }\r\n\r\n dir = new int[AD_DIRSIZE];\r\n\r\n for (i=0; i < AD_DIRSIZE; i++) {\r\n try { dir[i] = af.readInt();\r\n } catch (IOException e) {\r\n status = -1;\r\n throw new AreaFileException(\"Error reading AreaFile directory:\" + e);\r\n }\r\n }\r\n position += AD_DIRSIZE * 4;\r\n\r\n // see if the directory needs to be byte-flipped\r\n\r\n if (dir[AD_VERSION] != VERSION_NUMBER) {\r\n McIDASUtil.flip(dir,0,19);\r\n // check again\r\n if (dir[AD_VERSION] != VERSION_NUMBER)\r\n throw new AreaFileException(\r\n \"Invalid version number - probably not an AREA file\");\r\n // word 20 may contain characters -- if small integer, flip it...\r\n if ( (dir[20] & 0xffff) == 0) McIDASUtil.flip(dir,20,20);\r\n McIDASUtil.flip(dir,21,23);\r\n // words 24-31 contain memo field\r\n McIDASUtil.flip(dir,32,50);\r\n // words 51-2 contain cal info\r\n McIDASUtil.flip(dir,53,55);\r\n // word 56 contains original source type (ascii)\r\n McIDASUtil.flip(dir,57,63);\r\n flipwords = true;\r\n }\r\n\r\n areaDirectory = new AreaDirectory(dir);\r\n\r\n // pull together some values needed by other methods\r\n navLoc = dir[AD_NAVOFFSET];\r\n calLoc = dir[AD_CALOFFSET];\r\n auxLoc = dir[AD_AUXOFFSET];\r\n datLoc = dir[AD_DATAOFFSET];\r\n numBands = dir[AD_NUMBANDS];\r\n linePrefixLength = \r\n dir[AD_DOCLENGTH] + dir[AD_CALLENGTH] + dir[AD_LEVLENGTH];\r\n if (dir[AD_VALCODE] != 0) linePrefixLength = linePrefixLength + 4;\r\n if (linePrefixLength != dir[AD_PFXSIZE]) \r\n throw new AreaFileException(\"Invalid line prefix length in AREA file.\");\r\n lineDataLength = numBands * dir[AD_NUMELEMS] * dir[AD_DATAWIDTH];\r\n lineLength = linePrefixLength + lineDataLength;\r\n numberLines = dir[AD_NUMLINES];\r\n\r\n if (datLoc > 0 && datLoc != McIDASUtil.MCMISSING) {\r\n navbytes = datLoc - navLoc;\r\n calbytes = datLoc - calLoc;\r\n auxbytes = datLoc - auxLoc;\r\n }\r\n if (auxLoc > 0 && auxLoc != McIDASUtil.MCMISSING) {\r\n navbytes = auxLoc - navLoc;\r\n calbytes = auxLoc - calLoc;\r\n }\r\n\r\n if (calLoc > 0 && calLoc != McIDASUtil.MCMISSING ) {\r\n navbytes = calLoc - navLoc;\r\n }\r\n\r\n\r\n // Read in nav block\r\n if (navLoc > 0 && navbytes > 0) {\r\n nav = new int[navbytes/4];\r\n newPosition = (long) navLoc;\r\n skipByteCount = (int) (newPosition - position);\r\n try {\r\n af.skipBytes(skipByteCount);\r\n } catch (IOException e) {\r\n status = -1;\r\n throw new AreaFileException(\"Error skipping AreaFile bytes: \" + e);\r\n }\r\n for (i=0; i<navbytes/4; i++) {\r\n try {\r\n nav[i] = af.readInt();\r\n } catch (IOException e) {\r\n status = -1;\r\n throw new AreaFileException(\"Error reading AreaFile navigation:\"+e);\r\n }\r\n }\r\n if (flipwords){\r\n flipnav(nav);\r\n }\r\n position = navLoc + navbytes;\r\n }\r\n\r\n // Read in cal block\r\n if (calLoc > 0 && calbytes > 0) {\r\n cal = new int[calbytes/4];\r\n newPosition = (long)calLoc;\r\n skipByteCount = (int) (newPosition - position);\r\n try {\r\n af.skipBytes(skipByteCount);\r\n } catch (IOException e) {\r\n status = -1;\r\n throw new AreaFileException(\"Error skipping AreaFile bytes: \" + e);\r\n }\r\n for (i=0; i<calbytes/4; i++) {\r\n try { \r\n cal[i] = af.readInt();\r\n } catch (IOException e) {\r\n status = -1;\r\n throw new AreaFileException(\"Error reading AreaFile calibration:\"+e);\r\n }\r\n }\r\n // if (flipwords) flipcal(cal);\r\n position = calLoc + calbytes;\r\n }\r\n\r\n // Read in aux block\r\n if (auxLoc > 0 && auxbytes > 0){\r\n aux = new int[auxbytes/4];\r\n newPosition = (long) auxLoc;\r\n skipByteCount = (int) (newPosition - position);\r\n try{\r\n af.skipBytes(skipByteCount);\r\n }catch (IOException e){\r\n status = -1;\r\n throw new AreaFileException(\"Error skipping AreaFile bytes: \" + e);\r\n }\r\n for (i = 0; i < auxbytes/4; i++){\r\n try{\r\n aux[i] = af.readInt();\r\n }catch (IOException e){\r\n status = -1;\r\n throw new AreaFileException(\"Error reading AreaFile aux block:\" + e);\r\n }\r\n }\r\n position = auxLoc + auxbytes;\r\n }\r\n\r\n // now return the Dir, as requested...\r\n status = 1;\r\n return;\r\n }", "void readMap()\n {\n try {\n FileReader\t\tmapFile = new FileReader(file);\n StringBuffer\tbuf = new StringBuffer();\n int\t\t\t\tread;\n boolean\t\t\tdone = false;\n \n while (!done)\n {\n read = mapFile.read();\n if (read == -1)\n done = true;\n else\n buf.append((char) read);\n }\n \n mapFile.close();\n \n parseMap(buf.toString());\n \n } catch (Exception e) {\n ErrorHandler.displayError(\"Could not read the map file data.\", ErrorHandler.ERR_OPEN_FAIL);\n }\n }", "private boolean canRead() {\n\t\treturn fileStatus;\n\t}", "public Index[] readIndexes(File file){\t\t\n\t\ttry{\n\t\t\tFileReader reader = new FileReader(file);\n\t\t\tBufferedReader buff = new BufferedReader(reader);\n\n\t\t\tboolean eof = false;\t\t//stores if the end of the file (eof) has been reached\n\t\t\tint numberOfRecords = 0;\n\n\t\t\t/**\n\t\t\t * @mastery achieves SL mastery factor 6 with the while loop\n\t\t\t */\n\t\t\twhile(!eof){\n\t\t\t\tString line = buff.readLine();\n\n\t\t\t\t/**\n\t\t\t\t * @mastery achieves SL mastery factor 4 with the if/else selection block\n\t\t\t\t */\n\t\t\t\tif(line == null){\n\t\t\t\t\teof = true;\t\t//the end of the file has been reached\n\t\t\t\t} else {\n\t\t\t\t\tnumberOfRecords++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbuff.close();\n\n\t\t\tIndex[] indexes = new Index[numberOfRecords];\n\n\t\t\tFileReader reader2 = new FileReader(file);\n\t\t\tBufferedReader buff2 = new BufferedReader(reader2);\n\n\t\t\tfor(int i=0;i<numberOfRecords;i++){\n\t\t\t\tString line = buff2.readLine();\n\t\t\t\tindexes[i] = new Index(line);\n\t\t\t}\n\n\t\t\tArrays.sort(indexes);\n\t\t\tbuff.close();\n\t\t\treader.close();\n\t\t\tbuff2.close();\n\t\t\treader2.close();\n\t\t\t\n\t\t\treturn indexes;\n\n\t\t} catch (Exception e){\n\t\t\treturn null;\n\t\t}\n\t}", "public abstract void readFromFile( ) throws Exception;", "public static void main(String[] args) throws IOException {\n\t\tPath filePath = Paths.get(\"/home/SLKTECHLABS/tarun.patel/git/DemoSlk/countline.txt\");\n\t\t \n\t\tmakeHiddenFile();\n\t\t\n\t}", "private void parseFile(String fileName) {\n\t\ttry {\n\t\t\tBufferedReader bufferedReader = new BufferedReader(new FileReader(fileName));\n\t\t\tString line;\n\t\t\tint counter = 0;\n\t\t\tString lastMethod = null;\n\t\t\t\n\t\t\twhile ((line = bufferedReader.readLine()) != null) {\n\t\t\t\t\n\t\t\t\t// Logic for method consolidation\n\t\t\t\tif (line.contains(\"Method Call\")) {\n\t\t\t\t\tlastMethod = line.substring(line.indexOf(\"target=\")+7);\n\t\t\t\t\tlastMethod = lastMethod.substring(lastMethod.indexOf('#')+1).replace(\"\\\"\",\"\").trim();\n\t\t\t\t\tlastMethod = lastMethod + \":\" + counter++;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\tif (line.contains(\"Field Write\")) {\n\t\t\t\t\tString[] tokens = line.split(\",\");\n\t\t\t\t\t\n\t\t\t\t\tString object = tokens[4].substring(tokens[4].indexOf(\"=\") + 1).replace(\"\\\"\", \"\").trim();\n\t\t\t\t\tString field = tokens[5].substring(0, tokens[5].indexOf(\"=\")).replace(\"\\\"\", \"\").trim();\n\t\t\t\t\tString value = tokens[5].substring(tokens[5].indexOf(\"=\") + 1).replace(\"\\\"\", \"\").trim();\n\t\t\t\t\tString fld = object.replace(\"/\", \".\") + \".\" + field;\n\t\t\t\t\tevents.add(new Event(fld, value, lastMethod));\n\t\t\t\t\t\n\t\t\t\t\tallFields.add(fld);\n\t\t\t\t}\n//\t\t\t\tif (line.contains(\"Method Returned\")) {\n//\t\t\t\t\t//operations for this method ended\n//\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\tbufferedReader.close();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void readtabs(File f) {\r\n \tString str = new String();\r\n try{\r\n BufferedReader br = new BufferedReader(new FileReader(f.getAbsolutePath()));\r\n str = br.readLine();\r\n \r\n while((str = br.readLine()) != null){\r\n //str = str.replaceAll(\";\", \"\");\r\n String info[] = str.split(\";\");\r\n if(f.getName().equals(\"mdl_chat_messages.txt\")){\r\n \t//chat message id; chatid; userid; groupid; system; message; timestamp;\r\n \tmobileact ma = new mobileact(info[2].trim(), info[6].trim(), \"Chat Message\", info[5]);\r\n \tmobact.add(ma);\r\n }else if(f.getName().equals(\"mdl_forum_posts.txt\")){\r\n \t//id; discussion; parent; userid; created; modified; mailed; subject; message; \r\n \t//messageformat; messagetrust; attachment; totalscore; mailnow; \r\n \tmobileact ma = new mobileact(info[3].trim(), info[5].trim(), \"Forum Posts\", info[8].trim());\r\n \tmobact.add(ma);\r\n }else if(f.getName().equals(\"mdl_quiz_attempts.txt\")){\r\n \t//id; quiz; userid; attempt; uniqueid; layout; currentpage; \r\n \t//preview; state; timestart; timefinish; timemodified; timecheckstate; \r\n \t//sumgrades; needsupgradetonewqe; \r\n \tmobileact ma = new mobileact(info[2].trim(), info[11].trim(), \"Attempt Quiz\", info[8].trim());\r\n \tmobact.add(ma);\r\n }\r\n }\r\n br.close();\r\n }catch(Exception e){\r\n JOptionPane.showMessageDialog(null, \"read moodle log file failed.\", \"System Message\", JOptionPane.ERROR_MESSAGE);\r\n }\r\n }", "public void getUserData()\n\t{\n\t\tint count; //Loop counter\n\t\tString pathname = filename;\n\t\t\n\t\tString div = \",\"; //Used to divide info.\n\t\tString [] userArray; //To hold divided info.\n\t\t\n\t\ttry {\n FileReader reader = new FileReader(pathname);\n BufferedReader bufferedReader = new BufferedReader(reader);\n \n String line;\n \n //While getting each line of the data file, BUT stops when USER data found.\n //Loop through each line and determine which user data to choose.\n while ((line = bufferedReader.readLine()) != null) {\n // System.out.println(\"User Data in file: \" + line);\n \n System.out.println(\"Checking User name in line of data ...\");\n \n //This divides the info in the data file into an array.\n userArray = line.split(div); \n \n \n if (User.equals(userArray[0]))\n \t{\n \t\tSystem.out.println(\"User Found: \" + User);\n \t\tuser_line = line;\n \t\t//Assigning data to class variables.\n \t\tUserPassword = userArray[1].trim(); //Assigning the password.\n \t\tDevice_ID = Integer.parseInt(userArray[2].trim()); //Assigning device ID.\n \t\tisLost = (Integer.parseInt(userArray[3].trim()) == 0) ? false : true;\n \t\t\n \t\t//This reads out information.\n \t\tfor (count = 0; count < userArray.length; count++)\n {\n \t\t\tSystem.out.println(\"INFO: \" + userArray[count]);\n }\n \t\tbreak;\n \t}\n System.out.println(\"========================================\");\n }\n reader.close();\n \n } catch (IOException e) {\n e.printStackTrace();\n }\n\t}", "UploadInfo advancedUpload(AdvanceFile file);", "public void readCategoryFile(File file) {\n\ttry (BufferedReader br = new BufferedReader(new FileReader(file)))\n\t{\n\t\tString sCurrentLine;\n\t\tString [] lineElements;\n\t\t\n\t\tint row = 0;\n\t\twhile ((sCurrentLine = br.readLine()) != null) {\n\t\t\t//System.out.println(sCurrentLine);\n\t\t\t\n\t\t\tlineElements = sCurrentLine.split(\"\\\\s+\");\n\t\t\t//System.out.println(lineElements.length);\n\t\t\tfor (int column = 0; column < lineElements.length; column++) {\t\t\n\t\t\t\t//System.out.println(column);\n\t\t\t\tint category = Integer.parseInt(lineElements[column]);\n\t\t\t\t//System.out.println(vertices.size());\n\t\t\t\tPOI v1 = vertices.get(row);\n\t\t\t\tPOI v2 = vertices.get(column);\n\t\t\t\t\n\t\t\t\tArc arc = getArc(v1, v2);\n\t\t\t\tif (!distMtx) {\n\t\t\t\t\tdouble distance = v1.distanceTo(v2);\n\t\t\t\t\tif (data == Dataset.VERBEECK) {\n\t\t\t\t\t\tdistance = distance / 5.0;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tdistance = distance / 10.0;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tarc.setLength(distance);\n\t\t\t\t}\n\t\t\t\tarc.setCategory(category);\n\t\t\t\tif (distConstraint) {\n\t\t\t\t\tarc.setSpeedTable(allOneSpeedTable);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tarc.setSpeedTable(speedTables.get(category));\n\t\t\t\t}\t\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\trow ++;\n\t\t}\n\t} catch (IOException e) {\n\t\te.printStackTrace();\n\t}\n}", "private void ReadTextFile(String FilePath) {\n\t\t\n\t\t\n\t}", "private List<String> findAnts(String inputFileName) {\n\nList<String> lines = new ArrayList<>();\ntry {\nBufferedReader br = new BufferedReader(new FileReader(inputFileName));\nString line = br.readLine();\nwhile (line != null) {\nlines.add(line);\nline = br.readLine();\n}\n} catch (Exception e) {\n\n}\n\nchar[] splitLineByLetterOrDigit;\nList<String> saveAnts = new ArrayList<>();\n\nfor (int k = 0; k < lines.size(); k++) {\nString singleLine = lines.get(k);\nsplitLineByLetterOrDigit = singleLine.toCharArray();\nfor (int i = 0; i < splitLineByLetterOrDigit.length; i++) {\nif (Character.isLetter(splitLineByLetterOrDigit[i])) {\n// first is row\nsaveAnts.add(String.format(\"%d %d %s\", k, i, splitLineByLetterOrDigit[i]));\n}\n}\n}\n\nreturn saveAnts;\n}", "public static void main(String[] args) {\n\t\tFile f= new File(\"E://workplace/BigFileRead/src/data/itcont.txt\");\r\n\t\ttry {\r\n\t\t\tBufferedReader b=new BufferedReader(new FileReader(f));\r\n\t\t\tString readLine=\"\";\r\n\t\t\t\r\n\t\t\t//得到总行数\r\n\t\t\tInstant lineCountStart=Instant.now();//当前时间\r\n\t\t\tint lines=0;\r\n\t\t\tInstant nameStart=Instant.now();\r\n\t\t\tArrayList<String> names=new ArrayList<String>();\r\n\t\t\t//得到第432个和第43243个名字\r\n\t\t\tArrayList<Integer> indexs=new ArrayList<>();\r\n\t\t\t\r\n\t\t\tindexs.add(1);\r\n\t\t\tindexs.add(433);\r\n\t\t\tindexs.add(43244);\r\n\t\t\t//计算每个月的捐赠量\r\n\t\t\tInstant donationsStart=Instant.now();\r\n\t\t\tArrayList<String> dates=new ArrayList<String>();\r\n\t\t\t//计算每一个名字的出现次数\r\n\t\t\tInstant commonNamesStart=Instant.now();\r\n\t\t\tArrayList<String> firstNames=new ArrayList<String>();\r\n\t\t\tSystem.out.println(\"start read file using input stream!\");\r\n\t\t\ttry {\r\n\t\t\t\twhile((readLine=b.readLine())!=null){\r\n\t\t\t\tlines++;\r\n\t\t\t\t//得到所有的名字\r\n\t\t\t\tString array1[]=readLine.split(\"\\\\s*\\\\|s*\");\r\n\t\t\t\tString name=array1[7];\r\n\t\t\t\tnames.add(name);\r\n\t\t\t\tif(indexs.contains(lines)){\r\n\t\t\t\t\tSystem.out.println(\"names:\"+names.get(lines-1)+\"at index: \"+(lines-1));\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\tif (name.contains(\", \")){\r\n\t\t\t\t\tString array2[]=(name.split(\",\"));\r\n\t\t\t\t\tString firstHalfOfName=array2[1].trim();\r\n\t\t\t\t\tif(firstHalfOfName!=\"undefined\"||!firstHalfOfName.isEmpty()){\r\n\t\t\t\t\t\tif(firstHalfOfName.contains(\" \")){\r\n\t\t\t\t\t\t\tString array3[]=(name.split(\" \"));\r\n\t\t\t\t\t\t\tString firstName=array3[0].trim();\r\n\t\t\t\t\t\t\tfirstNames.add(firstName);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse{\r\n\t\t\t\t\t\t\tfirstNames.add(firstHalfOfName);\r\n\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}\r\n\t\t\t\tString rawDate=array1[4];\r\n\t\t\t\tString year=rawDate.substring(0,4);\r\n\t\t\t\tString month=rawDate.substring(4,6);\r\n\t\t\t\tString formatDate=month+\"-\"+year;\r\n\t\t\t\tdates.add(formatDate);\r\n\t\t\t\t}\r\n\t\t\t} catch (IOException 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\t\r\n\t\t\tInstant namesEnd=Instant.now();\r\n\t\t\tlong timeElapseNames=Duration.between(nameStart, namesEnd).toMillis();\r\n\t\t\tSystem.out.println(\"names time :\"+timeElapseNames+\"ms\");\r\n\t\t\tSystem.out.println(\"total lines :\"+lines);\r\n\t\t\t\r\n\t\t\tInstant lineCountsEnd=Instant.now();\r\n\t\t\tlong timeElapselineCounts=Duration.between(lineCountStart, lineCountsEnd).toMillis();\r\n\t\t\tSystem.out.println(\"lines time :\"+timeElapseNames+\"ms\");\r\n\t\t\t\r\n\t\t\tHashMap<String, Integer> dateMap=new HashMap<String, Integer>();\r\n\t\t\tfor(String date:dates){\r\n\t\t\t\tInteger count =dateMap.get(date);\r\n\t\t\t\tif(count==null){\r\n\t\t\t\t\tdateMap.put(date, 1);\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\tdateMap.put(date, count+1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tfor (Map.Entry<String, Integer> entry :dateMap.entrySet()){\r\n\t\t\t\tString key=entry.getKey();\r\n\t\t\t\tInteger value=entry.getValue();\r\n\t\t\t\tSystem.out.println(\"Donations per month and year: \"+key+\" and donation count: \"+value);\r\n\t\t\t}\r\n\t\t\tInstant donationEnd=Instant.now();\r\n\t\t\tlong timeElapsedDonations=Duration.between(donationsStart, donationEnd).toMillis();\r\n\t\t\tSystem.out.println(\"Donation time: \"+timeElapsedDonations+\" ms\");\r\n\t\t\t\t\r\n\t\t\tHashMap<String, Integer> map=new HashMap<String, Integer>();\r\n\t\t\tfor(String name : firstNames){\r\n\t\t\t\tInteger count =dateMap.get(name);\r\n\t\t\t\tif(count==null){\r\n\t\t\t\t\tmap.put(name, 1);\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\tmap.put(name, count+1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tLinkedList<Entry<String, Integer>> list =new LinkedList<>(map.entrySet());\r\n\t\t\t\r\n\t\t\tCollections.sort(list,new Comparator<Map.Entry<String, Integer>>() {\r\n\t\t\t\t@Override\r\n\t\t\t\tpublic int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {\r\n\t\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\t\treturn (o2.getValue()).compareTo(o1.getValue());\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\t\r\n\t\t\tSystem.out.println(\"The most Common first name is: \"+list.get(0).getKey()+\" and it occurs: \"+list.get(0).getValue()+\" time.\");\r\n\t\t\tInstant commonNameEnd=Instant.now();\r\n\t\t\tlong timeElapseCommonName =Duration.between(commonNamesStart, commonNameEnd).toMillis();\r\n\t\t\tSystem.out.println(\"most common name time: \"+timeElapseCommonName+\" ms\");\r\n\t\t} catch (FileNotFoundException e) { \r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "String[] getActivities(String filepath) throws ParserConfigurationException, SAXException, IOException;", "protected abstract void readFile();", "private void readFromFile() {\n\t\tPath filePath = Paths.get(inputFile);\n\n\t\ttry (BufferedReader reader = Files.newBufferedReader(filePath,\n\t\t\t\tCharset.forName(\"UTF-8\"));) {\n\t\t\tString line = null;\n\n\t\t\twhile ((line = reader.readLine()) != null) {\n\t\t\t\tString[] splitLine = line.split(\",\");\n\t\t\t\tcurrentGen.setValue(Integer.parseInt(splitLine[0]),\n\t\t\t\t\t\tInteger.parseInt(splitLine[1]), true);\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\tSystem.out.println(\"Could not find file provided.\");\n\t\t}\n\t}", "public int importOnlyFnaBitSequences(String filename, int start, int end) {\n int currentKID = 0;\n int result = 0;\n// String currName = null;\n boolean store = false;\n SuperString seq = new SuperString();\n try (BufferedReader br = new BufferedReader(new FileReader(filename))) {\n\n for (String line; (line = br.readLine()) != null; ) {\n if (line.charAt(0) == '>'){\n if (currentKID >= start) {\n if (seq.length() > 0) {\n// System.err.print(\"KID\\t\"+currentKID+\"\\thas length\\t\"+seq.length());\n storeOnlyBitSequence(currentKID, seq);\n } else {\n sequenceLength.add(0);\n exceptionsArr.add(new HashMap<Integer,Character>());\n }\n result++;\n seq = new SuperString();\n// currName = line.trim().substring(1);\n store = true;\n }\n currentKID++;\n } else if (store) {\n seq.addAndTrim(line);\n }\n if (currentKID >= end) break;\n }\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n return result;\n }", "public void parseFile(){\n try{\n BufferedReader br = new BufferedReader(new FileReader(\"ElevatorConfig.txt\"));\n \n String fileRead;\n \n totalSimulatedTime = 1000;\n Integer.parseInt(br.readLine());\n simulatedSecondRate = 30;\n Integer.parseInt(br.readLine());\n \n for (int onFloor = 0; onFloor< 5; onFloor++){\n \n fileRead = br.readLine(); \n String[] tokenize = fileRead.split(\";\");\n for (int i = 0; i < tokenize.length; i++){\n String[] floorArrayContent = tokenize[i].split(\" \");\n \n int destinationFloor = Integer.parseInt(floorArrayContent[1]);\n int numPassengers = Integer.parseInt(floorArrayContent[0]);\n int timePeriod = Integer.parseInt(floorArrayContent[2]);\n passengerArrivals.get(onFloor).add(new PassengerArrival(numPassengers, destinationFloor, timePeriod));\n }\n }\n \n br.close();\n \n } catch(FileNotFoundException e){ \n System.out.println(e);\n } catch(IOException ioe){\n ioe.printStackTrace();\n }\n\n }", "public static void startup() {\n\t\tString thisLine;\n\t\tString currentName = \"\";\n\t\tboolean next = true;\n\n\t\t// DEBUG\n\t\t// System.out.println(\"entered here\");\n\n\t\t// Loop across the arguments\n\n\t\t// Open the file for reading\n\t\ttry {\n\t\t\tBufferedReader br = new BufferedReader(new FileReader(GIGA_WORD));\n\t\t\twhile ((thisLine = br.readLine()) != null) {\n\t\t\t\tString str = thisLine.trim();// .replaceAll(\"(\\\\r|\\\\n)\", \"\");\n\t\t\t\tString[] wordNumber = str.split(\"[ ]{2,}\");\n\t\t\t\tString word = wordNumber[0].toLowerCase();\n\t\t\t\tint cnt = Integer.parseInt(wordNumber[1]);\n\t\t\t\tgigaMap.put(word, cnt);\n\t\t\t}\n\t\t\tbr.close();\n\t\t\tbr = null;\n\t\t\tbr = new BufferedReader(new FileReader(FILE_NAME));\n\t\t\twhile ((thisLine = br.readLine()) != null) {\n\t\t\t\tString str = thisLine.trim();// replaceAll(\"(\\\\r|\\\\n)\", \"\");\n\t\t\t\tif (str.equals(\"[Term]\")) {\n\t\t\t\t\tnext = true;\n\t\t\t\t}\n\t\t\t\tif (str.startsWith(\"name:\")) {\n\t\t\t\t\tif (next) {\n\t\t\t\t\t\tcurrentName = str.replaceAll(\"name: \", \"\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (str.startsWith(\"synonym:\")) {\n\t\t\t\t\tif (str.contains(\"EXACT\") || str.contains(\"NARROW\")) {\n\t\t\t\t\t\t// synonym..\n\t\t\t\t\t\tPattern pattern = Pattern\n\t\t\t\t\t\t\t\t.compile(\"synonym:.*\\\"(.*)\\\".*\");\n\t\t\t\t\t\tMatcher matcher = pattern.matcher(str);\n\t\t\t\t\t\t// DEBUG\n\t\t\t\t\t\t// System.err.println(str);\n\t\t\t\t\t\tif (matcher.find()) {\n\t\t\t\t\t\t\tString syno = matcher.group(1);\n\t\t\t\t\t\t\tif (!currentName.equals(\"\")) {\n\t\t\t\t\t\t\t\t// System.err.format(\"%s:%s.\\n\", currentName,\n\t\t\t\t\t\t\t\t// syno);\n\n\t\t\t\t\t\t\t\tadd(currentName, syno);\n\t\t\t\t\t\t\t\tadd(syno, currentName);\n\t\t\t\t\t\t\t\trecursiveAddSyno(currentName, syno);\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}\n\t\t\tbr.close();\n\t\t\tbr = null;\n\t\t} catch (IOException e) {\n\t\t\tSystem.err.println(\"Error: \" + e);\n\t\t}\n\t}", "public static void processInput() throws IOException {\r\n\t\t\r\n\t\t//Out statement let user know the input file is being read\t\r\n\t\tScanner scnr;\r\n\t\tString[] splitString;\r\n\t\t\r\n\t\tFile file = new File(\"Project_04_Input01.txt\");\r\n\t\tscnr = new Scanner(file);\r\n\t\t\r\n\t\tSystem.out.println(\"Reading data from \" + file + \"...\");\r\n\t\t\r\n\t\twhile(scnr.hasNextLine()) {\r\n\t\t\tString line = scnr.nextLine();\r\n\t\t\tsplitString = line.split(\",\");\r\n\r\n\t\t\tif (splitString[0].contains(\"STUDENT\")) {\r\n\t\t\t\t\r\n\t\t\t\t// Call processStudentData\r\n\t\t\t\tprocessStudentData(splitString);\r\n\t\t\t\tSystem.out.println(\"'STUDENT' has been found in the file.\");\r\n\r\n\t\t\t} // End if\r\n\t\t\t\r\n\t\t\telse if (splitString[0].contains(\"GRADEITEM\") ) {\r\n\t\t\t\t\r\n\t\t\t\t// Call processGradeItemData\r\n\t\t\t\tprocessGradeItemData(splitString);\r\n\t\t\t\tSystem.out.println(\"'GRADEITEM' has been found in the file.\");\r\n\t\t\t\t\r\n\t\t\t} // End if\r\n\t\t} // End while\r\n\t\t\r\n\t\t// Close the file\r\n\t\tscnr.close();\r\n\t\t\t\r\n\t}", "public void service_psy (Personne p) throws FileNotFoundException\r\n\t{\r\n\t\r\n\t\t\r\n\t\t \t\tString [] info_psy=null ;\r\n\t\t \t\tString [] cle_valeur=null;\r\n\t\t \t\tboolean spec,adr;\r\n\t\t \t\tFileInputStream f=new FileInputStream(\"C://Users/Azaiez Hamed/Desktop/workspace/Projet de programmation/src/Medecin.txt\");\r\n\t\t \t\ttry {\r\n\t\t \t\t\tBufferedReader reader =new BufferedReader (new InputStreamReader(f,\"UTF-8\"));\r\n\t\t \t\t\tString line=reader.readLine();\r\n\t\t \t\t\twhile(line!=null){\r\n\t\t \t\t\t\tinfo_psy=line.split(\"\\t\\t\\t\");\r\n\t\t \t\t\t\tspec=false;adr=false;\r\n\t\t \t\t\t\tfor(int i=0;i<info_psy.length;i++)\r\n\t\t \t\t\t\t{\r\n\t\t \t\t\t\t\t cle_valeur=info_psy[i].split(\":\");\r\n\t\t\t\t\t\t if ((cle_valeur[0].equals(\"specialite\"))&& (cle_valeur[1].equals(\"psy\")))\r\n\t\t\t\t\t\t \t spec=true;\r\n\t\t\t\t\t\t if ((cle_valeur[0].equals(\"gouvernerat\"))&&(cle_valeur[1].equals(p.getGouvernerat())))\r\n\t\t \t\t\t\t\t \tadr=true;\r\n\t\t\t\t\t\t}\r\n\t\t \t\t\t\tif (spec && adr) {\r\n\t\t \t\t\t\t\t System.out.println(\"voilà toutes les informations du psy, veuillez lui contacter immédiatement **\");\r\n\t\t \t\t\t\t\t System.out.println(line);return;}\r\n\t\t \t\t\t\telse\r\n\t\t \t\t\t\t line=reader.readLine();\r\n\t\t \t\t\t\t }\r\n\t\t \t\t }\r\n\t\t \t\t \tcatch(IOException e){e.printStackTrace();}\r\n\t\t \t\t System.out.println(\"Pas de psy trouvé dans votre gouvernerat\");\r\n\t}", "private void readFile (String file, Visitor visitor) throws Exception {\n\t\tFileReader fr = new FileReader (file);\n\t\tBufferedReader reader = new BufferedReader (fr);\n\n\t\tSystem.out.println (\"Reading file \" + file);\n\n\t\tint count = 0;\n\t\tfor (String line; (line = reader.readLine()) != null;) {\n\t\t\tif (count++ % 10000 == 0) System.out.println (line);\n\t\t\tvisitor.visit (line);\n\n\t\t\tif (count >= LIMIT) break;\n\t\t}\n\n\t\tSystem.out.println (\"Done\");\n\n\t\treader.close();\n\t\tfr.close();\n\t}", "public static void main(String[] args){\n\t\ttry{\n\t\t\tFileReader fr=new FileReader(\"C:\\\\Users\\\\bharathi\\\\Desktop\\\\Hello\\\\new.txt\");\n\t\t\tbr = new BufferedReader(fr);\n\t\t\tSystem.out.println(\"reading lins from the file.... \"+br.readLine());\n\t\t}catch(Exception e){}\n\t}", "private void logLineFromTasksFile(File cgf) {\n String str;\n if (LOG.isDebugEnabled()) {\n try (BufferedReader inl =\n new BufferedReader(new InputStreamReader(new FileInputStream(cgf\n + \"/tasks\"), \"UTF-8\"))) {\n str = inl.readLine();\n if (str != null) {\n LOG.debug(\"First line in cgroup tasks file: {} {}\", cgf, str);\n }\n } catch (IOException e) {\n LOG.warn(\"Failed to read cgroup tasks file. \", e);\n }\n }\n }", "public boolean readDataFile();", "void findCogs(File input, int mode, Mappings map){\n int lineNum=0;\n\n BufferedReader reader;\n try {\n Path path =Paths.get(input.getAbsolutePath());\n System.out.println(\"Path: \"+input.getAbsolutePath());\n reader = Files.newBufferedReader(path,ENCODING);\n String line = null;\n while ((line = reader.readLine()) != null) {\n lineNum++;\n \n if(lineNum==1){\n String[] gensize=line.split(\" \");\n String c=gensize[gensize.length-1];\n System.out.println(\"String c COG: \"+c);\n String [] coord=c.split(\"\\\\.\\\\.\");\n System.out.println(\"coord size: \"+coord.length);\n minCoordinate=Integer.parseInt(coord[0]);\n maxCoordinate=Integer.parseInt(coord[1]);\n }\n \n if(lineNum>3){\n String[] st=line.split(\"\\t\");\n String[] coord=st[0].split(\"\\\\..\");\n int x=Integer.parseInt(coord[0]), y=Integer.parseInt(coord[1]);\n\n String cogName=\"\";\n if(mode==0){\n String pattern = \"(^COG)(\\\\d+)(\\\\D+)\";\n \n if(st[7].contains(\",\"))\n st[7]=st[7].split(\",\")[0];\n cogName=st[7].replaceAll(pattern, \"$1$2\");\n }\n else{\n cogName=st[3];\n }\n\n Triplet<Integer,Integer,String> t=new Triplet<Integer,Integer,String>(x,y,cogName);\n cogs.add(t);\n\n if(map.geneOgMapping.containsKey(cogName))\n ancogs.add(t);\n }\n }\n reader.close();\n }catch(IOException ioe)\n {\n System.err.println(\"IOException: \" + ioe.getMessage());\n }\n }", "public static void loadProgramData() {\n\r\n try {\r\n File f = new File(\"DetailsOfVaccination.txt.txt\"); //Accessing the file\r\n Scanner read = new Scanner(f);\r\n while (read.hasNextLine()) { //Print data in the file line by line\r\n String data = read.nextLine();\r\n System.out.println(data);\r\n }\r\n read.close();\r\n }\r\n catch (FileNotFoundException e) { //Runs if there was an error\r\n System.out.println(\"An error occurred while reading data from the file.\");\r\n e.printStackTrace();\r\n }\r\n }", "public static void main(String[] args) {\n\t\t\ttry(FileReader fr = new FileReader(\"Numbers2.txt\");\n\t\t\t\tBufferedReader br= new BufferedReader(fr); )\n\t\t\t{\n\t\t\t\t\n\t\t\t\tint index=0;\n//\t\t\t\tThis is one way to read code from txt file\n\t\t\t\twhile(br.ready()) {\n\t\t\t\t\tSystem.out.print(++index+\":\");\n\t\t\t\t\tSystem.out.println(br.readLine());\t\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch(FileNotFoundException e){\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\t\n\t\t\tcatch(IOException e){\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\t\t\n\t\t\tfinally {\n\t\t\tSystem.out.println(\"Ended..\");\n\t\t\t\t\n\t\t\t}\n\t\t}", "@Override\n public FileStatus getFileStatus(File file) {\n\treturn null;\n }", "public long getFileIndex(){\n \tString fileName=file.getName();\n// \tSystem.out.println(\"fileName:\"+fileName);\n \tfinal long start = Long.parseLong(fileName.substring(0,\n\t\t\t\tfileName.length() - FILE_SUFFIX.length()));\n// \tSystem.out.println(\"start:\"+start);\n \treturn start;\n }", "private void read() {\n\n\t\t\t\tString road=getActivity().getFilesDir().getAbsolutePath()+\"product\"+\".txt\";\n\n\t\t\t\ttry {\n\t\t\t\t\tFile file = new File(road); \n\t\t\t\t\tFileInputStream fis = new FileInputStream(file); \n\t\t\t\t\tint length = fis.available(); \n\t\t\t\t\tbyte [] buffer = new byte[length]; \n\t\t\t\t\tfis.read(buffer); \n\t\t\t\t\tString res1 = EncodingUtils.getString(buffer, \"UTF-8\"); \n\t\t\t\t\tfis.close(); \n\t\t\t\t\tjson(res1.toString());\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\t}", "private void processInput()\n{\n File f1 = input_file;\n\n try (BufferedReader br = new BufferedReader(new FileReader(f1))) {\n List<DylockLockEntry> ents = new ArrayList<DylockLockEntry>();\n List<DylockLockEntry> lents = new ArrayList<DylockLockEntry>();\n double ltime = 0;\n double ntime = 0;\n for ( ; ; ) {\n\t String ln = br.readLine(); \n\t if (ln == null) break;\n\t if (ln.startsWith(\"ENDBLOCK\")) {\n\t processBlock(lents);\n\t List<DylockLockEntry> xents = lents;\n\t lents = ents;\n\t ents = xents;\n\t ltime = ntime;\n\t ntime = 0;\n\t }\n\t else {\n\t DylockLockEntry ent = new DylockLockEntry(this,ln);\n\t double t0 = ent.getTime();\n\t if (t0 <= ltime) lents.add(ent);\n\t else {\n\t if (t0 > ntime) ntime = t0;\n\t ents.add(ent);\n\t }\n\t }\n }\n processBlock(ents);\n }\n catch (IOException e) {\n System.err.println(\"DYLOCK: Problem reading input file: \" + e);\n }\n}", "public void getInformation() throws IOException {\n\t\tList<Fire> listFeux = new ArrayList<Fire>();\n\t listFeux = this.collectData();\n\t \n\t if(this.previousIntensity > this.real_intensity) {\n\t \tthis.previousIntensity = this.real_intensity;\n\t }\n\t\t\n\t\tthis.alerte.resetIntensity();\t//on reset l'intensite\n\t\tthis.real_intensity = 0;\n\t\t\n\t for (Fire feu: listFeux) {\t\t//on recalcul l'intensite\n\t \tfor (CoordEntity coord: feu.getLocation()) {\n\t\t \tif ( (Math.abs(coord.getX() - this.localisation.x) < this.range) &&\n\t\t \t\t\t(Math.abs(coord.getY() - this.localisation.y) < this.range) ) {\n\t\t \t\tint intensity = this.getIntensityFromFire(feu);\n\t\t \t\tthis.addRealIntensity(intensity);\n\t\t \t\tif (this.isDetectable(feu) == true) {\n\t\t \t\t\tSystem.out.println(\"Detectable\");\n\t\t\t \t\tif (this.applyErrors() == true) {\n\t\t\t \t\t\tthis.alerte.setIntensity(intensity);\t\n\t\t\t \t\t}\n\t\t \t\t}\n\t }\t\t\n\t }\n\t }\n\t System.err.println(previousIntensity + \"/\" + this.real_intensity + \"/\" + this.alerte.getIntensity() );\n\t\t if (this.alerte.getIntensity() > previousIntensity) {\n\t\t \tthis.previousIntensity = this.real_intensity;\t//on recupere l'intensite mesuree precedement\n\t\t \tSystem.err.println(\"Alarme\");\n\t\t \tthis.triggerAlarm();\t//si il y a eu aggravation de l'etat du feu\n\t\t }\n\t}", "void visitFile(File file);", "public static void getInputFileData(){\n\t\t\t\n\t\t\t// editable fields\n\t\t\t\n\t\t\tString directDistanceFile = \"../data/direct_distance_1.txt\";\n\t\t\tString graphInputFile = \"../data/graph_input_1.txt\";\n\t\t\t\n\t\t\t\n\t\t\t// end of editable fields\n\t\t\t\n\t\t\t\n\t\t\tFile file1 = new File(directDistanceFile);\n\t\t\tFile file2 = new File(graphInputFile);\n\t\t\tfiles.add(file1);\n\t\t\tfiles.add(file2);\n\t\t\t\n\t\t\t/*// Directory where data files are\n\t\t\tPath dataPath = Paths.get(\"../data\");\n\t\t\t\n\t\t\tString path = dataPath.toAbsolutePath().toString();\n\t\t\t\n\t\t\tFile dir = new File (path);\n\t\t\t\t\t\n\t\t\tif (dir.listFiles() == null){\n\t\t\t\t\n\t\t\t\tSystem.out.println(\"WARNING: No files found.\");\n\n\t\t\t} else if (dir.listFiles() != null && dir.listFiles().length == 2) {\n\t\t\n\t\t\t\tfor (File file : dir.listFiles()){\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfiles.add(file.getName());\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}\n\t\t\t\n\t\t\t} else {\n\t\t\t\t\n\t\t\t\tSystem.out.println(\"WARNING: Data folder may only contain two files: direct_distance and\"\n\t\t\t\t\t\t+ \" graph_input. Please modify contents accordingly before proceeding for alorithm to execute.\");\n\t\t\t\t\n\t\t\t}\n\t\t\t*/\n\t\t\t\n\t\t\tfor (File file: files){\n\t\t\t\ttry {\n\t\t\t\t\t\n\t\t\t\t\t// store direct distances in a hashmap\n\t\t\t\t\tif (file.toString().contains(\"distance\")){\n\t\t\t\t\t\t\n\t\t\t\t\t\t//FileReader fileReader = new FileReader(dataPath.toString() + \"/\" + file);\n\t\t\t\t\t\tFileReader fileReader = new FileReader(file);\n\t\t\t\t BufferedReader reader = new BufferedReader(fileReader);\n\t\t\t\t String line = null;\n\t\t\t\t \n\t\t\t\t while ((line = reader.readLine()) != null) {\n\t\t\t\t \t\n\t\t\t\t \tStringBuilder num = new StringBuilder();\n\t\t\t\t \tStringBuilder str = new StringBuilder();\n\t\t\t\t \n\t\t\t\t \tfor(char c : line.toCharArray()){\n\t\t\t\t \t\t//find the distance\n\t\t\t\t if(Character.isDigit(c)){\n\t\t\t\t num.append(c);\n\t\t\t\t } \n\t\t\t\t //find the associated letter\n\t\t\t\t else if(Character.isLetter(c)){\n\t\t\t\t str.append(c); \n\t\t\t\t }\n\t\t\t\t \t}\n\t\t\t\t \t\n\t\t\t\t \t// add values into hashmap\n\t\t\t\t \tdistance.put(str.toString(), Integer.parseInt(num.toString()));\n\t\t\t\t \t\n\t\t\t\t }\n\t\t\t\t \n\t\t\t\t reader.close(); // close the reader\n\t\t\t\t\t\t\n\t\t\t\t\t\t//System.out.println(distance);\n\t\t\t\t \n\t\t\t\t } \n\t\t\t\t\t\n\t\t\t\t\t// store inputs in a \n\t\t\t\t\telse if (file.toString().contains(\"input\")){\n\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t//FileReader fileReader = new FileReader(dataPath.toString() + \"/\" + file);\n\t\t\t\t\t\tFileReader fileReader = new FileReader(file);\n\t\t\t\t BufferedReader reader = new BufferedReader(fileReader);\n\t\t\t\t \n\t\t\t\t String line = null;\n\t\t\t\t \n\t\t\t\t int x=0; // keeps track of line to add\n\t\t\t\t \n\t\t\t\t \n\t\t\t\t while ((line = reader.readLine()) != null) {\n\t\t\t\t \tString[] values = line.split(\"\\\\s+\");\n\t\t\t\t \t\n\t\t\t\t \t\n\t\t\t\t \t if (matrix == null) {\n\t\t\t\t \t\t //instantiate matrix\n\t\t\t\t matrix = new String[widthOfArray = values.length]\n\t\t\t\t \t\t \t\t\t[lenghtOfArray = values.length];\n\t\t\t\t }\n\t\t\t\t \t\n\t\t\t\t \t\n\t\t\t\t \t// add values into the matrix\n\t\t\t\t \tfor (int i=0; i < values.length; i++){\n\t\t\t\t \t\t\n\t\t\t\t \t\tmatrix[i][x] = values[i];\n\t\t\t\t \t\t\n\t\t\t\t \t}\n\t\t\t\t \t\n\t\t\t\t \tx++; // next line\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 reader.close(); // close the reader\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t// Store input combinations in a hashmap\n\t\t\t\t\tint y=1; \n\t\t\t\t\twhile (y < lenghtOfArray){\n\t\t\t\t\t\t\n\t\t\t\t\t\tinputNodes.add(matrix[0][y]);\n\t\t\t\t\t\t\n\t\t\t\t\t\tfor (int i=1; i < widthOfArray; i++){\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tStringBuilder str = new StringBuilder();\n\t\t\t\t\t\t\tstr.append(matrix[0][y]);\n\t\t\t\t\t\t\tstr.append(matrix[i][0]);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tint inputValue = Integer.parseInt(matrix[i][y]);\n\n\t\t\t\t\t\t\tif (inputValue > 0){\n\t\t\t\t\t\t\t\tinputMap.put(str.toString(), inputValue);\n\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\t\n\t\t\t\t\t\ty++;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tSystem.out.println(\"WARNING: Please check: \"+ file.toString() + \". It was not found.\");\n\t\t\t\t} \n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}", "public HashMap readFile(String filePath, HashMap source){\n\t\tArrayList<String> temp1 = new ArrayList<String>();\n\t\tArrayList<String> temp2 = new ArrayList<String>();\n\t\tBufferedReader br = null;\n\t\t\n\t\ttry {\n\t\t\tString sCurrentLine;\n\t\t\t\n\t\t\t// \"Users/Jasmine/Documents/Eclipse/CacheDictionary/src/english.txt\"\n\t\t\tbr = new BufferedReader(new FileReader(filePath)); \n\t\t\t\n\t\t\t//str.matches(\".*\\\\d+.*\"); ==> string that contains numbers\n\t\t\t//.matches(\"[a-zA-Z]+\"); ==> string that only contains letter\n\t\t\twhile ((sCurrentLine = br.readLine()) != null) {\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\t * if the source file itself is not one word per line, we need to split the string\n\t\t\t\t * only letter(not single) will be stored in the array\n\t\t\t\t */\n\t\t\t\t//\n\t\t\t\tif(sCurrentLine.matches(\".*([ \\t]).*\")){ //check if the current line is a single word or not\n\t\t\t\t\ttemp1.add(sCurrentLine);\n\t\t\t\t}\n\t\t\t\telse if(sCurrentLine.matches(\"[a-zA-Z]+\") && sCurrentLine.length()>1){\n\t\t\t\t\ttemp2.add(sCurrentLine);\n\t\t\t\t}\n\t\t\t}// end of while loop\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tif (br != null)br.close();\n\t\t\t} catch (IOException ex) {\n\t\t\t\tex.printStackTrace();\n\t\t\t}\n\t\t}\n\n\t\tif(!temp1.isEmpty()){\n\t\t\tfor(int i = 0; i< temp1.size(); i++){\n\t\t\t\tString thisLine[] = temp1.get(i).split(\" \");\n\t\t\t\t//for each word in this line\n\t\t\t\tfor(int j = 0; j < thisLine.length; j++){\n\t\t\t\t\t//if it is a valid word\n\t\t\t\t\tif(thisLine[j].matches(\"[a-zA-Z]+\") && thisLine[j].length()>1 ){\n\t\t\t\t\t\tif( source.get(thisLine[j]) == null){\n\t\t\t\t\t\t\tsource.put(thisLine[j].toLowerCase(),thisLine[j].toLowerCase());\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t} // end of if current word i valid\t\n\t\t\t\t}\n\t\t\t}\t\n\t\t} // end of temp1\n\t\t\n\t\tif(!temp2.isEmpty()){\n\t\t\tfor(int i = 0; i< temp2.size(); i++){\n\t\t\t\tif(temp2.get(i).matches(\"[a-zA-Z]+\") && temp2.get(i).length()>1){\n\t\t\t\t\tif(source.get(temp2.get(i)) == null){\n\t\t\t\t\t\tsource.put(temp2.get(i).toLowerCase(),temp2.get(i).toLowerCase());\n\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t} \n\t\t\t}\n\t\t\t\n\t\t}\n\t\treturn source;\n\t}", "@Override\n\tpublic boolean readData(File file) {\n return file.exists();\n\t}", "public static void getProblem(String filename){\r\n String line = \"\";\r\n try {\r\n //Get the problem instance\r\n reader = new BufferedReader(new FileReader(filename));\r\n line = reader.readLine();\r\n\r\n //Assume the first line contains the Universe\r\n inString = line.split(\",\");\r\n\r\n for (int i = 0; i < inString.length; i++) {\r\n universe.add(Integer.parseInt(inString[i]));\r\n }\r\n Collections.sort(universe);\r\n System.out.println(\"Universe:\" + universe);\r\n\r\n //Gather in the sets\r\n line = reader.readLine();\r\n while (line != null){\r\n inString = line.split(\",\");\r\n for (int i = 0; i < inString.length; i++) {\r\n set.add(Integer.parseInt(inString[i]));\r\n }\r\n //System.out.println(\"Set: \" + set);\r\n sets.add(set);\r\n set = new ArrayList<Integer>();\r\n line = reader.readLine();\r\n\r\n //Create a blank pheromone\r\n pheremones.add(0);\r\n visited.add(0);\r\n }\r\n System.out.println(\"Sets: \" + sets);\r\n\r\n //Create the pheremones\r\n //System.out.println(\"PheremoneSize: \" + pheremones.size());\r\n\r\n //Set the degradation\r\n //degrade = generationSize/2;\r\n\r\n }catch(FileNotFoundException e){System.out.println(\"File Not Found : \" + filename);}\r\n catch(Exception e){\r\n System.out.println(\"ERROR in getProblem\");\r\n System.out.println(\"File Name: \" + filename);\r\n System.out.println(\"Universe: \" + universe);\r\n System.out.println(\"Line: \" + line);\r\n System.out.println(\"InString: \" + inString.toString());\r\n System.out.println();\r\n System.out.println(e.toString());\r\n }\r\n }", "protected abstract void parseFile(File f) throws IOException;" ]
[ "0.5580772", "0.5543112", "0.54212064", "0.54078823", "0.5372267", "0.5369949", "0.5281969", "0.5267081", "0.5252606", "0.52332395", "0.52244395", "0.52021086", "0.5095645", "0.50758034", "0.504734", "0.5046121", "0.5032622", "0.5024921", "0.49841657", "0.4968902", "0.49462947", "0.49412695", "0.49406514", "0.4934994", "0.49316248", "0.49251842", "0.49171263", "0.49166185", "0.49131998", "0.49087882", "0.48844603", "0.48844185", "0.48639613", "0.48612502", "0.48607317", "0.48575708", "0.4852044", "0.48463884", "0.4838917", "0.48316303", "0.4823876", "0.48165536", "0.48159692", "0.48036125", "0.48007125", "0.4783051", "0.47748205", "0.4764675", "0.4755972", "0.4754935", "0.47496253", "0.47471243", "0.4741252", "0.4727775", "0.47249174", "0.47208646", "0.4720562", "0.4719158", "0.47174776", "0.47137776", "0.47136134", "0.47107384", "0.47094902", "0.4709392", "0.47037894", "0.47036004", "0.47012866", "0.46933153", "0.46931544", "0.46880865", "0.4686868", "0.4686737", "0.46847472", "0.4681092", "0.46721983", "0.46708474", "0.4653625", "0.4653141", "0.46530074", "0.46494687", "0.46469542", "0.46441355", "0.46438685", "0.46420863", "0.46396264", "0.46380225", "0.4636802", "0.463658", "0.46340996", "0.46244523", "0.46228918", "0.46224517", "0.46127766", "0.46109208", "0.46037295", "0.46022475", "0.45983526", "0.4594904", "0.4594127", "0.45921662", "0.45900863" ]
0.0
-1
Created by Timothy Foster on 25 Jul 2016.
public interface IGuessingGamePlayer { int nextGuess() throws NumberFormatException; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void perish() {\n \n }", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "private stendhal() {\n\t}", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\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\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\n public int describeContents() { return 0; }", "public void gored() {\n\t\t\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "public void mo38117a() {\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\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 init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "private void poetries() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n public void func_104112_b() {\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 }", "@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}", "private Rekenhulp()\n\t{\n\t}", "@Override\n\tpublic void jugar() {\n\t\t\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo4359a() {\n }", "@Override\n\tpublic void einkaufen() {\n\t}", "private void m50366E() {\n }", "@Override\n public void init() {\n }", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "protected boolean func_70814_o() { return true; }", "@Override\n public void init() {}", "@Override\r\n\tprotected void doF4() {\n\t\t\r\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override public int describeContents() { return 0; }", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "@Override\n void init() {\n }", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void init() {}", "private static void cajas() {\n\t\t\n\t}", "@Override\n protected void getExras() {\n }", "@Override\n protected void init() {\n }", "protected MetadataUGWD() {/* intentionally empty block */}", "@Override\n\tpublic int mettreAJour() {\n\t\treturn 0;\n\t}", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n public int getOrder() {\n return 0;\n }", "@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() {\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 public void memoria() {\n \n }", "@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}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n public void init() {\n\n }", "@Override\n public void init() {\n\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\tprotected void initialize() {\n\t}", "@Override\n\tprotected void initialize() {\n\t}", "@Override\n public int getSize() {\n return 1;\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n public int getOrder() {\n return 4;\n }", "@Override\n public void initialize() { \n }", "@Override\n\tpublic void init() {\n\t}", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "Petunia() {\r\n\t\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\n\tpublic void init()\n\t{\n\n\t}", "private TMCourse() {\n\t}" ]
[ "0.60571116", "0.6012129", "0.59049565", "0.58367926", "0.58117336", "0.57942146", "0.57780886", "0.57780886", "0.57749665", "0.5743262", "0.5688063", "0.5628502", "0.5624226", "0.56157595", "0.55905956", "0.5589926", "0.5585916", "0.5560103", "0.5544365", "0.5535738", "0.5528637", "0.55191684", "0.55076665", "0.55076665", "0.550035", "0.550035", "0.550035", "0.550035", "0.550035", "0.5498052", "0.54837674", "0.5483236", "0.54812634", "0.5475228", "0.5463963", "0.54618615", "0.54618615", "0.54618615", "0.54618615", "0.54618615", "0.54618615", "0.54607546", "0.54607546", "0.54605293", "0.5452121", "0.5448632", "0.5438972", "0.54376584", "0.5428451", "0.54254264", "0.54191715", "0.54111433", "0.54085004", "0.5406602", "0.53947973", "0.53865296", "0.5384798", "0.5380517", "0.53744256", "0.5371086", "0.53686184", "0.536737", "0.53613603", "0.5359872", "0.5357869", "0.5349262", "0.5344098", "0.534282", "0.5337908", "0.53352636", "0.53352636", "0.53352636", "0.5330325", "0.5330325", "0.5330325", "0.53297865", "0.5313178", "0.5313178", "0.5313178", "0.53127", "0.53109735", "0.53109735", "0.5310777", "0.5310777", "0.5310777", "0.5310777", "0.5310777", "0.5310777", "0.5310777", "0.5302257", "0.5302257", "0.529833", "0.52971154", "0.5296888", "0.52913606", "0.5282039", "0.5271197", "0.526911", "0.5268466", "0.5259177", "0.5255089" ]
0.0
-1
creates a new wizard
public NewReviewWizard() { super(); setNeedsProgressMonitor(true); setWindowTitle("New Review"); setHelpAvailable(false); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected abstract AbstractPerfCakeEditWizard createWizard(IStructuredSelection selection);", "static public Wizard createWizard (){\n System.out.println(\"Enter the name of your wizard : \");\n Scanner sc = new Scanner(System.in);\n String nameCharacter = sc.next();\n\n // enter and get the HP value of the character\n System.out.println(\"Enter the healpoint of your wizard : \");\n Scanner scan = new Scanner(System.in);\n String healPointCharacter = scan.next();\n int hpCharacter = Integer.parseInt(healPointCharacter);\n\n // get the power value\n System.out.println(\"Enter the power of your wizard : \");\n Scanner sca = new Scanner(System.in);\n String powerCharacter = sca.next();\n int pcCharacter = Integer.parseInt(powerCharacter);\n\n\n // get the initiative (turn order)\n System.out.println(\"Enter the initiative of your wizard : \");\n Scanner scann = new Scanner(System.in);\n String initiativeCharacter = scann.next();\n int iniCharacter = Integer.parseInt(initiativeCharacter);\n\n System.out.println(\"Enter the wizard damage value of your wizard : \");\n Scanner scanS = new Scanner(System.in);\n String wizardDamage = scann.next();\n int wiz = Integer.parseInt(wizardDamage);\n\n Wizard createWizard = new Wizard(nameCharacter, pcCharacter, hpCharacter, iniCharacter, wiz);\n System.out.println(\"Your wizard has been created with success!\");\n\n return createWizard;\n }", "public void testWizards() {\n // open new file wizard\n NewFileWizardOperator nfwo = NewFileWizardOperator.invoke();\n nfwo.selectProject(\"SampleProject\");\n nfwo.selectCategory(\"Java\");\n nfwo.selectFileType(\"Java Class\");\n // go to next page\n nfwo.next();\n // create operator for the next page\n NewJavaFileNameLocationStepOperator nfnlso = new NewJavaFileNameLocationStepOperator();\n nfnlso.txtObjectName().typeText(\"MyNewClass\");\n // finish wizard\n //nfnlso.finish();\n // cancel wizard\n nfnlso.cancel();\n }", "@Override\n\tpublic void create(IWizardEntity entity, WizardRunner runner) {\n\t\t\n\t}", "private void createWizard(String persoName, String persoImage, int persoLife, int attack) {\n\t\tpersoList.add(new Wizard(persoName, persoImage, persoLife, attack));\n\t}", "public void addPages() {\n\t\t\n\t\tProjectUtils projectUtils = new ProjectUtils();\n\t\tIProject proj = projectUtils.getProject(selection);\n\t\t\n\t\t\n\t\t\n\t\tDb db = loadDBParams();\n\t\tDBConnection dbConn = new DBConnection();\n\t\tConnection connection = null;\n\t\t\n\t\t\n\t\ttry {\n\t\t\tconnection = dbConn.loadDriver(proj.getLocation()+\"/\"+db.getDriverClassPath(), db.getDriverClass(), db.getDatabaseURL(), db.getUserName(), db.getPassWord());\n\t\t} catch (MalformedURLException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (InstantiationException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IllegalAccessException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (ClassNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (SQLException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\t\n\t\tpage = new SmartNewWizardPage(selection, connection, proj.getLocation().toString());\n\t\taddPage(page);\n\n\t}", "public IWizard getWizard();", "public void testGenericWizards() {\n // open new project wizard\n NewProjectWizardOperator npwo = NewProjectWizardOperator.invoke();\n npwo.selectCategory(\"Java Web\");\n npwo.selectProject(\"Web Application\");\n npwo.next();\n // create operator for next page\n WizardOperator wo = new WizardOperator(\"Web Application\");\n JTextFieldOperator txtName = new JTextFieldOperator((JTextField) new JLabelOperator(wo, \"Project Name:\").getLabelFor());\n txtName.clearText();\n txtName.typeText(\"MyApp\");\n wo.cancel();\n }", "public void addPages() {\n\t\twizardPage = new WizardNewProjectCreationPage(\n\t\t\"NewExampleComSiteProject\");\n\t\twizardPage.setDescription(\"Create a new Example.com Site Project.\");\n\t\twizardPage.setTitle(\"New Example.com Site Project\");\n\t\taddPage(wizardPage);\n\t}", "public void setWizard(IWizard newWizard);", "public NewPageWizard(IXWikiSpace sapce)\n {\n super();\n setWindowTitle(\"Add New Page...\");\n setNeedsProgressMonitor(false);\n this.space = sapce;\n }", "@Override\r\n\tpublic void addPages() {\n\t\tprojectPage = new NewProjectWizardPage();\r\n\t\taddPage(projectPage);\r\n\t}", "protected IFlowControl createWizard( InputStream in ){\r\n\t\tXMLWizardBuilder<T> builder = new XMLWizardBuilder<T>( in );\r\n\t\ttry{\r\n\t\t\tbuilder.build( this);\r\n\t\t}\r\n\t\tcatch( Exception ex ){\r\n\t\t\tex.printStackTrace();\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\tflow = new FlowControl(); \r\n\t\tsuper.setFlow(flow);\r\n\t\treturn flow;\r\n\t}", "public NewTestWizardPage() {\n\t\tsuper(true, \"New Groovy Test Settings\");\n\n\t\tsetTitle(\"Groovy Test Class\");\n\t\tsetDescription(\"Create a new Groovy unit test class\");\n\t}", "public void addPages() {\n //super.addPages(); //<--- notice we're overriding here\n mainPage = new NewTargetWizardPage(\"newFilePage1\", getSelection());//$NON-NLS-1$\n mainPage.setTitle(TITLE);\n mainPage.setDescription(DESCRIPTION); \n addPage(mainPage);\n }", "public NewTargetFileWizard() {\n super();\n }", "public void addPages() {\n\t\tpage = new NewTotoriWizardPage(selection);\n\t\taddPage(page);\n\t}", "public void testRegisterWizardPanel() {\n System.out.println(\"registerWizardPanel\");\n Object id = null;\n WizardPanelDescriptor panel = null;\n Wizard instance = new Wizard();\n instance.registerWizardPanel(id, panel);\n }", "public WizardModel(){ \n wp = new HashMap<Object,WizardPanelDescriptor>();\n step = 1;\n }", "public AddValidatorWizard() {\n super();\n initPages();\n setWindowTitle(Messages.title_newValidator);\n }", "Page createPage();", "public AbstractWizardPage()\n {\n super(true);\n }", "public NewEntryWizard()\n {\n setNeedsProgressMonitor( true );\n }", "@Override\n\tpublic void addPages() {\n\t\t_fileWizard = new NewPlotFilenameWizardPage(selection);\n\t\t_scaleWizard = new ScaleWizardPage(selection);\n\t\t_coastWizard = new CoastWizardPage(selection);\n\t\t_gridWizard = new GridWizardPage(selection);\n\n\t\t// check there's ETOPO data before we add the page\n\t\t_etopoWizard = new ETOPOWizardPage(selection);\n\n\t\taddPage(_fileWizard);\n\t\taddPage(_scaleWizard);\n\t\taddPage(_coastWizard);\n\t\taddPage(_gridWizard);\n\t\tif (_etopoWizard.isAvailable())\n\t\t\taddPage(_etopoWizard);\n\t}", "public CartogramWizard ()\n\t{\n\t\n\t\t// Set the window parameters.\n\t\tthis.setTitle(AppContext.shortProgramName + \" _ Cartogram Wizard\");\n\t\tthis.setSize(640, 480);\n\t\tthis.setLocation(30, 40);\n\t\tthis.setResizable(false);\n\t\tthis.setLayout(null);\n\t\t//this.setModal(true);\n\t\tthis.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);\n\t\tthis.addWindowListener(new CartogramWizardWindowListener());\n\t\t\n\t\t\n\t\t// Adding the cartogram wizard to the app context.\n\t\tAppContext.cartogramWizard = this;\n\t\t\n\t\t\n\t\t// Add icon panel at the left of the wizard window.\n\t\t// This panel contains the ScapeToad icon.\n\t\tif (mScapeToadIconPanel == null)\n\t\t{\n\t\t\tmScapeToadIconPanel = new ScapeToadIconPanel(this);\n\t\t}\n\t\t\n\t\tmScapeToadIconPanel.setLocation(30, 90);\n\t\tthis.add(mScapeToadIconPanel);\n\t\t\n\t\t\n\t\t\n\t\t// Add title panel.\n\t\tCartogramWizardTitlePanel titlePanel =\n\t\t\tnew CartogramWizardTitlePanel(this);\n\t\t\n\t\ttitlePanel.setLocation(30, 20);\n\t\tthis.add(titlePanel);\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t// Add icon panel at the left of the wizard window.\n\t\t// This panel contains the ScapeToad icon.\n\t\tmWizardStepIconPanel = new WizardStepIconPanel(this);\n\t\tmWizardStepIconPanel.setLocation(380, 20);\n\t\tthis.add(mWizardStepIconPanel);\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t// Ajouter l'introduction au wizard.\n\t\t// Explication des étapes à suivre :\n\t\t// 1. Sélectionner la couche des polygones (master layer).\n\t\t// 2. Sélectionner l'information statistique.\n\t\t// 3. Sélection des couches à transformer simultanément.\n\t\t\n\t\tmPanelZero = new CartogramWizardPanelZero(this);\n\t\tthis.getContentPane().add(mPanelZero);\n\t\t\n\t\tmCurrentStep = 0;\n\t\t\n\t\t\n\t\t\n\t\t// Add the running panel which is already created.\n\t\tmRunningPanel.setVisible(false);\n\t\tthis.add(mRunningPanel);\n\t\t\n\t\t\n\t\t// Add the finished panel which is already created.\n\t\tmFinishedPanel.setVisible(false);\n\t\tthis.add(mFinishedPanel);\n\t\t\n\t\t\t\t\n\t\t// Add the Cancel button.\n\t\tmCancelButton = new JButton(\"Cancel\");\n\t\tmCancelButton.setLocation(30, 404);\n\t\tmCancelButton.setSize(100, 26);\n\t\tmCancelButton.addActionListener(new CartogramWizardCloseAction());\n\t\tthis.getContentPane().add(mCancelButton);\n\t\t\n\t\t\n\t}", "@Override\n public void addPages() {\n super.addPages();\n page1 = new NewReviewWizardPage();\n addPage(page1);\n }", "@Override\r\n\t\tpublic void create() {\n\t\t\tsuper.create();\r\n\t\t\tsuper.getOKButton().setEnabled(false);\r\n\t\t\tsuper.setTitle(Messages.MoveUnitsWizardPage1_Topolog__2);\r\n\t\t\tsuper.setMessage(Messages.MoveUnitsWizardPage1_Select_a_name_source_folder_and_a_);\r\n\t\t\tsuper.getShell().setText(Messages.MoveUnitsWizardPage1_Topolog__2);\r\n\t\t}", "public Reqif10ModelWizardInitialObjectCreationPage(String pageId) {\r\n \t\t\tsuper(pageId);\r\n \t\t}", "private Wizard(final FXFinder javafxFinder) {\n this.javafxFinder = javafxFinder;\n wizard = new JFrame(\"Apache SIS setup\");\n final Container content = wizard.getContentPane();\n content.setLayout(new BorderLayout());\n /*\n * Back, Next, Cancel button.\n */\n { // For keeping variables in a local scope.\n final Box buttons = Box.createHorizontalBox();\n buttons.setBorder(new EmptyBorder(9, 12, 9, 15)); // Top, left, bottom, right.\n backButton = createButton(buttons, BACK); buttons.add(Box.createHorizontalStrut(10));\n nextButton = createButton(buttons, NEXT); buttons.add(Box.createHorizontalStrut(30));\n cancelButton = createButton(buttons, CANCEL);\n backButton.setEnabled(false);\n\n final JPanel bottom = new JPanel(new BorderLayout());\n bottom.add(new JSeparator(), BorderLayout.NORTH);\n bottom.add(buttons, java.awt.BorderLayout.EAST);\n content.add(bottom, BorderLayout.SOUTH);\n }\n /*\n * Navigation panel on the left side with the following titles\n * (currently shown page is highlighted):\n *\n * - Introduction\n * - Download\n * - Set directory\n * - Summary\n */\n final WizardPage[] pages = WizardPage.values();\n {\n titles = new JLabel[pages.length];\n final EmptyBorder padding = new EmptyBorder(3, 0, 3, 0);\n final Box summary = Box.createVerticalBox();\n for (int i=0; i<pages.length; i++) {\n final String title = (i == 0 ? SELECTED_TITLE_BULLET : TITLE_BULLET) + pages[i].title;\n final JLabel label = new JLabel(title, JLabel.LEFT);\n label.setForeground(i == 0 ? SELECTED_TITLE_COLOR : TITLE_COLOR);\n label.setBorder(padding);\n summary.add(titles[i] = label);\n }\n final JPanel pane = new JPanel();\n pane.setBackground(new Color(169, 204, 227));\n pane.setBorder(new EmptyBorder(40, 15, 9, 24)); // Top, left, bottom, right.\n pane.add(summary);\n content.add(pane, BorderLayout.WEST);\n }\n /*\n * The main content where text is shown, together with download button, directory chooser, etc.\n * The content of each page is created by `createPage(…)`. They all have in common to start with\n * a description text formatted in HTML.\n */\n {\n final Font font = new Font(Font.SERIF, Font.PLAIN, 14);\n javafxPath = new JLabel();\n javafxPath.setBorder(JAVAFX_PATH_BORDER);\n javafxPathError = new JLabel();\n javafxPathError.setForeground(Color.RED);\n javafxPathError.setFont(font);\n inflateProgress = new JProgressBar();\n cardPanel = new JPanel(new CardLayout());\n cardPanel.setBorder(new EmptyBorder(30, 30, 9, 30)); // Top, left, bottom, right.\n cardPanel.setBackground(Color.WHITE);\n for (final WizardPage page : pages) {\n cardPanel.add(createPage(page, font), page.name());\n // The initially visible component is the first added.\n }\n currentPage = pages[0];\n content.add(cardPanel, BorderLayout.CENTER);\n }\n wizard.setSize(WIDTH, 500); // Must be before `setLocationRelativeTo(…)`.\n wizard.setResizable(false);\n wizard.setLocationRelativeTo(null);\n wizard.addWindowListener(new WindowAdapter() {\n @Override public void windowClosing(WindowEvent event) {\n javafxFinder.cancel();\n }\n });\n }", "public void addPages() {\t\t\n\t\tpage1 = new Opera2ActionsTransformationWizardPage1(selection, operaModel);\n\t\taddPage(page1);\t\n\t}", "@Override\n\tpublic void createControl(Composite parent) {\n\t\tComposite container = new Composite(parent, SWT.NULL);\n\n\t\tsetControl(container);\n\n\t\tString username = \"\";\n\t\tString password = \"\";\n\t\ttry {\n\t\t\tString[] array = window.ds.getURI().getUserInfo().split(\":\");\n\t\t\tusername = array[0];\n\t\t\tpassword = array[1];\n\t\t} catch (Exception e) {\n\t\t}\n\n\t\tLabel lblUsername = new Label(container, SWT.NONE);\n\t\tlblUsername.setBounds(10, 52, 75, 13);\n\t\tlblUsername.setText(\"Username\");\n\n\t\tusernameText = new Text(container, SWT.BORDER);\n\t\tusernameText.setText(username);\n\t\tusernameText.addModifyListener(new ModifyListener() {\n\t\t\t@Override\n\t\t\tpublic void modifyText(ModifyEvent arg0) {\n\t\t\t\tgetWizard().getContainer().updateButtons();\n\t\t\t}\n\t\t});\n\n\t\tusernameText.setBounds(10, 71, 187, 19);\n\t\tusernameText.setFocus();\n\n\t\tLabel lblPassword = new Label(container, SWT.NONE);\n\t\tlblPassword.setBounds(10, 96, 75, 13);\n\t\tlblPassword.setText(\"Password\");\n\n\t\tpasswordText = new Text(container, SWT.BORDER | SWT.PASSWORD);\n\t\tpasswordText.setText(password);\n\t\tpasswordText.addModifyListener(new ModifyListener() {\n\t\t\t@Override\n\t\t\tpublic void modifyText(ModifyEvent arg0) {\n\t\t\t\tgetWizard().getContainer().updateButtons();\n\t\t\t}\n\t\t});\n\n\t\tpasswordText.setBounds(10, 115, 187, 19);\n\t\tControl[] list = null;\n\t\t\n\t\tif (window.ds.usesComponent(IUserCreation.class)) {\n\t\t\tbtnCreateAnNew = new Button(container, SWT.NONE);\n\t\t\tbtnCreateAnNew.addSelectionListener(new SelectionAdapter() {\n\t\t\t\t@Override\n\t\t\t\tpublic void widgetSelected(SelectionEvent e) {\n\t\t\t\t\tLOG.info(\"Create an account\");\n\t\t\t\t\tSignInWithAuthenticationWizard wizard = (SignInWithAuthenticationWizard) getWizard();\n\t\t\t\t\twizard.getWizardDialog().close();\n\t\t\t\t\twindow.newUserAction.run();\n\t\t\t\t\tLOG.info(\"Create an account 2\");\n\t\t\t\t}\n\t\t\t});\n\t\t\tbtnCreateAnNew.setBounds(10, 10, 152, 25);\n\t\t\tbtnCreateAnNew.setText(\"Create a new account\");\n\t\t\tlist = new Control[] { btnCreateAnNew, usernameText,\n\t\t\t\t\tpasswordText };\n\t\t\tcontainer.setTabList(list);\n\t\t} else {\n\t\t\tlist = new Control[] { usernameText,\n\t\t\t\t\tpasswordText };\n\t\t\tcontainer.setTabList(list);\n\t\t}\n\n\t\t\n\t\t\n\t}", "public void createProbleemWizard() throws InstantiationException,\n\t\t\tIllegalAccessException {\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} 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\t\t}\n\t\tgetMelding().setProbleem(probleem);\n\t}", "public TutorialStep1() {\n\n }", "private void convert(IProject project, AcceleoProjectWizard wizard, IProgressMonitor monitor) {\n \t\tString projectName = wizard.newProjectPage.getProjectName();\n \t\tString generatorName = this.computeGeneratorName(projectName);\n \n \t\tAcceleoProject acceleoProject = AcceleowizardmodelFactory.eINSTANCE.createAcceleoProject();\n \t\tacceleoProject.setName(projectName);\n \t\tacceleoProject.setGeneratorName(generatorName);\n \n \t\tList<AcceleoModule> allModules = this.newAcceleoModulesCreationPage.getAllModules();\n \t\tfor (AcceleoModule acceleoModule : allModules) {\n \t\t\tString parentFolder = acceleoModule.getParentFolder();\n \n \t\t\tIProject moduleProject = ResourcesPlugin.getWorkspace().getRoot().getProject(\n \t\t\t\t\tacceleoModule.getProjectName());\n \t\t\tif (moduleProject.exists() && moduleProject.isAccessible()\n \t\t\t\t\t&& acceleoModule.getModuleElement() != null\n \t\t\t\t\t&& acceleoModule.getModuleElement().isIsMain()) {\n \t\t\t\tIPath parentFolderPath = new Path(parentFolder);\n \t\t\t\tIFolder folder = moduleProject.getFolder(parentFolderPath.removeFirstSegments(1));\n \t\t\t\tacceleoProject.getExportedPackages().add(\n \t\t\t\t\t\tfolder.getProjectRelativePath().removeFirstSegments(1).toString().replaceAll(\"/\", //$NON-NLS-1$\n \t\t\t\t\t\t\t\t\"\\\\.\")); //$NON-NLS-1$\n \t\t\t}\n \t\t}\n \t\t// Prepare Ant folder\n \t\tIFolder antTasksFolder = project.getFolder(\"tasks\"); //$NON-NLS-1$\n \t\tif (!antTasksFolder.exists()) {\n \t\t\ttry {\n \t\t\t\tantTasksFolder.create(true, false, monitor);\n \t\t\t} catch (CoreException e) {\n \t\t\t\tAcceleoUIActivator.log(e, true);\n \t\t\t}\n \t\t}\n \n \t\t// Generate files\n \t\ttry {\n \t\t\tIProjectDescription description = project.getDescription();\n \t\t\tString[] natureIds = new String[] {IAcceleoConstants.ACCELEO_NATURE_ID,\n \t\t\t\t\tIAcceleoConstants.PLUGIN_NATURE_ID, IAcceleoConstants.JAVA_NATURE_ID, };\n \t\t\tdescription.setNatureIds(natureIds);\n \t\t\tproject.setDescription(description, monitor);\n \t\t} catch (CoreException e) {\n \t\t\tAcceleoUIActivator.log(e, true);\n \t\t}\n \t\tmonitor.beginTask(AcceleoUIMessages.getString(\"AcceleoNewProjectWizard.Monitor\"), 100); //$NON-NLS-1$\n \t\tmonitor.worked(10);\n \t\tAcceleoUIGenerator.getDefault().generateProjectSettings(acceleoProject, project);\n \t\tmonitor.worked(10);\n \t\tAcceleoUIGenerator.getDefault().generateProjectClasspath(acceleoProject, project);\n \t\tmonitor.worked(10);\n \t\tAcceleoUIGenerator.getDefault().generateProjectManifest(acceleoProject, project);\n \t\tmonitor.worked(10);\n \t\tAcceleoUIGenerator.getDefault().generateBuildProperties(acceleoProject, project);\n \t\tmonitor.worked(10);\n \t\tAcceleoUIGenerator.getDefault().generateActivator(acceleoProject, project);\n \n \t\tfor (AcceleoModule acceleoModule : allModules) {\n \t\t\tmonitor.worked(10);\n \t\t\tString parentFolder = acceleoModule.getParentFolder();\n \n \t\t\tIProject moduleProject = ResourcesPlugin.getWorkspace().getRoot().getProject(\n \t\t\t\t\tacceleoModule.getProjectName());\n \t\t\tif (moduleProject.exists() && moduleProject.isAccessible()) {\n \t\t\t\tIPath parentFolderPath = new Path(parentFolder);\n \t\t\t\tIFolder folder = moduleProject.getFolder(parentFolderPath.removeFirstSegments(1));\n \t\t\t\tAcceleoUIGenerator.getDefault().generateAcceleoModule(acceleoModule, folder);\n \n \t\t\t\tif (acceleoModule.isIsInitialized()) {\n \t\t\t\t\tString initializationKind = acceleoModule.getInitializationKind();\n \t\t\t\t\tIAcceleoInitializationStrategy strategy = null;\n \t\t\t\t\tList<IAcceleoInitializationStrategy> initializationStrategy = AcceleoInitializationStrategyUtils\n \t\t\t\t\t\t\t.getInitializationStrategy();\n \t\t\t\t\tfor (IAcceleoInitializationStrategy iAcceleoInitializationStrategy : initializationStrategy) {\n \t\t\t\t\t\tif (iAcceleoInitializationStrategy.getDescription() != null\n \t\t\t\t\t\t\t\t&& iAcceleoInitializationStrategy.getDescription().equals(initializationKind)) {\n \t\t\t\t\t\t\tstrategy = iAcceleoInitializationStrategy;\n \t\t\t\t\t\t\tbreak;\n \t\t\t\t\t\t}\n \t\t\t\t\t}\n \n \t\t\t\t\tIFile file = folder.getFile(acceleoModule.getName()\n \t\t\t\t\t\t\t+ \".\" + IAcceleoConstants.MTL_FILE_EXTENSION); //$NON-NLS-1$\n \t\t\t\t\tIFile exampleFile = ResourcesPlugin.getWorkspace().getRoot().getFile(\n \t\t\t\t\t\t\tnew Path(acceleoModule.getInitializationPath()));\n \n \t\t\t\t\tString moduleElementKind = IAcceleoInitializationStrategy.TEMPLATE_KIND;\n \t\t\t\t\tif (acceleoModule.getModuleElement().getKind().equals(ModuleElementKind.QUERY)) {\n \t\t\t\t\t\tmoduleElementKind = IAcceleoInitializationStrategy.QUERY_KIND;\n \t\t\t\t\t}\n \n \t\t\t\t\tif (strategy != null && file.exists()) {\n \t\t\t\t\t\ttry {\n \t\t\t\t\t\t\tstrategy.configure(moduleElementKind, acceleoModule.getModuleElement()\n \t\t\t\t\t\t\t\t\t.isGenerateFile(), acceleoModule.getModuleElement().isIsMain(),\n \t\t\t\t\t\t\t\t\tacceleoModule.isGenerateDocumentation());\n \t\t\t\t\t\t\tString content = strategy.getContent(exampleFile, acceleoModule.getName(),\n \t\t\t\t\t\t\t\t\tacceleoModule.getMetamodelURIs(), acceleoModule.getModuleElement()\n \t\t\t\t\t\t\t\t\t\t\t.getParameterType());\n \t\t\t\t\t\t\tByteArrayInputStream javaStream = new ByteArrayInputStream(content\n \t\t\t\t\t\t\t\t\t.getBytes(\"UTF8\")); //$NON-NLS-1$\n \t\t\t\t\t\t\tfile.setContents(javaStream, true, false, new NullProgressMonitor());\n \t\t\t\t\t\t} catch (CoreException e) {\n \t\t\t\t\t\t\tAcceleoUIActivator.log(e, true);\n \t\t\t\t\t\t} catch (UnsupportedEncodingException e) {\n \t\t\t\t\t\t\tAcceleoUIActivator.log(e, true);\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}\n \n \t}", "protected DummyWizardPage()\n {\n super( \"\" ); //$NON-NLS-1$\n setTitle( Messages.getString( \"NewEntryWizard.NoConnectonSelected\" ) ); //$NON-NLS-1$\n setDescription( Messages.getString( \"NewEntryWizard.NoConnectonSelectedDescription\" ) ); //$NON-NLS-1$\n setImageDescriptor( BrowserCommonActivator.getDefault().getImageDescriptor(\n BrowserCommonConstants.IMG_ENTRY_WIZARD ) );\n setPageComplete( true );\n }", "public TableEditorWizard(Table table) {\t\n\t\tcreateDialog(table);\n\t}", "public ButtonWizard(DialogueSystem system) {\n this.system = system;\n currentAction = new JLabel();\n currentJoint = new JLabel();\n }", "public void clickCreate() {\n\t\tbtnCreate.click();\n\t}", "private void addNewConnection() {\n\t\t IWizard wizard = new NewJmxConnectionWizard();\n\t\t WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);\n\t\t dialog.open();\n\t\t\n\t}", "private void newProject()\n\t{\n\t\tnew FenetreCreationProjet();\n\t}", "@Override\n\tpublic void create() {\n\t\tAssets.load();\n\t\t\n\t\t//creo pantallas y cargo por defecto menuPrincipal\n\t\tscreenJuego = new JuegoScreen(this);\n\t\tmenuPrincipal = new MenuPrincipal(this);\n\t\tsetScreen(menuPrincipal);\n\t}", "public WizardsTest(String testName) {\n super(testName);\n }", "public GuidedWizardPanel()\r\n\t{\t\r\n\t\tVerticalPanel panel = new VerticalPanel();\r\n\t\t\r\n\t\twizardPanel = new WizardPanel(panelList, groupLabels);\r\n\t\twizardPanel.addSaveListener(this);\r\n\t\tpanel.add(wizardPanel);\r\n\r\n\t\t// set up listener relationships\r\n\t\tsolvingForPanel.addSolvingForListener(powerPanel);\r\n\t\tsolvingForPanel.addSolvingForListener(perGroupSampleSizePanel);\r\n\t\tsolvingForPanel.addSolvingForListener(resultsPanel);\r\n\t\t// listeners for outcome measures\r\n\t\toutcomesPanel.addOutcomesListener(hypothesisIndependentPanel);\r\n\t\toutcomesPanel.addOutcomesListener(hypothesisRepeatedPanel);\r\n\t\toutcomesPanel.addOutcomesListener(meanDifferencesIndependentPanel);\r\n\t\toutcomesPanel.addOutcomesListener(meanDifferencesPanel);\r\n\t\toutcomesPanel.addOutcomesListener(variabilityIndependentPanel);\r\n\t\toutcomesPanel.addOutcomesListener(variabilityRepeatedPanel);\r\n\t\toutcomesPanel.addOutcomesListener(variabilityCovariateOutcomePanel);\r\n\t\t// listeners for predictor information\r\n\t\tcatPredictorsPanel.addPredictorsListener(relativeGroupSizePanel);\r\n\t\tcatPredictorsPanel.addPredictorsListener(hypothesisIndependentPanel);\r\n\t\tcatPredictorsPanel.addPredictorsListener(hypothesisRepeatedPanel);\r\n\t\tcatPredictorsPanel.addPredictorsListener(meanDifferencesIndependentPanel);\r\n\t\tcatPredictorsPanel.addPredictorsListener(meanDifferencesPanel);\r\n\t\t// listeners for relative group sizes\r\n\t\trelativeGroupSizePanel.addRelativeGroupSizeListener(hypothesisIndependentPanel);\r\n\t\trelativeGroupSizePanel.addRelativeGroupSizeListener(hypothesisRepeatedPanel);\r\n\t\t// listeners for baseline covariates\r\n\t\tcovariatePanel.addCovariateListener(meanDifferencesIndependentPanel);\r\n\t\tcovariatePanel.addCovariateListener(meanDifferencesPanel);\r\n\t\t// TODO: covariatePanel.addCovariateListener(meanDifferencesRepeatedPanel);\r\n\t\tcovariatePanel.addCovariateListener(hypothesisIndependentPanel);\r\n\t\tcovariatePanel.addCovariateListener(hypothesisRepeatedPanel);\r\n\t\tcovariatePanel.addCovariateListener(variabilityIndependentPanel);\r\n\t\t// TODO: covariatePanel.addCovariateListener(variabilityRepeatedPanel);\r\n\t\tcovariatePanel.addCovariateListener(variabilityCovariatePanel);\r\n\t\tcovariatePanel.addCovariateListener(variabilityCovariateOutcomePanel);\r\n\t\tcovariatePanel.addCovariateListener(optionsTestsPanel);\r\n\t\tcovariatePanel.addCovariateListener(optionsPowerMethodsPanel);\r\n\t\t// listeners for repeated measures \r\n\t\trepeatedMeasuresPanel.addRepeatedMeasuresListener(hypothesisIndependentPanel);\r\n\t\trepeatedMeasuresPanel.addRepeatedMeasuresListener(hypothesisRepeatedPanel);\r\n\t\t// listeners for hypotheses\r\n\t\thypothesisIndependentPanel.addHypothesisListener(meanDifferencesIndependentPanel);\r\n\t\thypothesisRepeatedPanel.addHypothesisListener(meanDifferencesRepeatedPanel);\r\n\t\t// group size listeners\r\n\t\trelativeGroupSizePanel.addRelativeGroupSizeListener(hypothesisIndependentPanel);\r\n\t\t// variability listeners\r\n\t\tvariabilityIndependentPanel.addVariabilityListener(variabilityCovariateOutcomePanel);\r\n\t\tvariabilityCovariatePanel.addVariabilityListener(variabilityCovariateOutcomePanel);\r\n\t\toptionsDisplayPanel.addChartOptionsListener(resultsPanel);\r\n\t\t// callbacks to fill in the power curve options screen\r\n\t\talphaPanel.addAlphaListener(optionsDisplayPanel);\r\n\t\toptionsTestsPanel.addTestListener(optionsDisplayPanel);\r\n\t\toptionsPowerMethodsPanel.addPowerMethodListener(optionsDisplayPanel);\r\n\t\toptionsPowerMethodsPanel.addQuantileListener(optionsDisplayPanel);\r\n\t\toptionsPowerMethodsPanel.addQuantileCheckboxListener(optionsDisplayPanel);\r\n\t\toptionsPowerMethodsPanel.addPowerCheckboxListener(optionsDisplayPanel);\r\n\t\tmeanDifferencesScalePanel.addBetaScaleListener(optionsDisplayPanel);\r\n\t\tperGroupSampleSizePanel.addPerGroupSampleSizeListener(optionsDisplayPanel);\r\n\t\trelativeGroupSizePanel.addRelativeGroupSizeListener(optionsDisplayPanel);\r\n\t\tvariabilityScalePanel.addSigmaScaleListener(optionsDisplayPanel);\r\n\t\t// initialize\r\n\t\tinitWidget(panel);\r\n\t}", "private void challengeStartNew() {\n FragmentManager fm = getSupportFragmentManager();\n FragmentNewChallenge newChallenge = FragmentNewChallenge.newInstance(\"Titel\");\n newChallenge.show(fm, \"fragment_start_new_challenge\");\n }", "public SelectProjectWizardPage build() {\r\n return new SelectProjectWizardPage(this);\r\n }", "public String create() {\n\n if (log.isDebugEnabled()) {\n log.debug(\"create()\");\n }\n FacesContext context = FacesContext.getCurrentInstance();\n StringBuffer sb = registration(context);\n sb.append(\"?action=Create\");\n forward(context, sb.toString());\n return (null);\n\n }", "public CreateAccount() {\n initComponents();\n selectionall();\n }", "NewAccountPage openNewAccountPage();", "public static AddNewScheduleDialog createInstance(int quantity){\n AddNewScheduleDialog frag = new AddNewScheduleDialog();\n frag.quantity = quantity;\n return frag;\n }", "@Override\n public List<UpdatableItem> createPopup() {\n final List<UpdatableItem> items = new ArrayList<UpdatableItem>();\n \n /* host wizard */\n final MyMenuItem newHostWizardItem =\n new MyMenuItem(Tools.getString(\"EmptyBrowser.NewHostWizard\"),\n HOST_ICON,\n null,\n new AccessMode(ConfigData.AccessType.RO, false),\n new AccessMode(ConfigData.AccessType.RO, false)) {\n private static final long serialVersionUID = 1L;\n \n @Override\n public String enablePredicate() {\n return null;\n }\n \n @Override\n public void action() {\n final AddHostDialog dialog = new AddHostDialog(new Host());\n dialog.showDialogs();\n }\n };\n items.add(newHostWizardItem);\n Tools.getGUIData().registerAddHostButton(newHostWizardItem);\n return items;\n }", "@Test(groups=\"smokesuits\",retryAnalyzer =com.crm.autodesk.GenericUtility.RetryAnalyzer.class )\n\tpublic void CreateLeadTest() throws Throwable {\n\t\tHomePage homepage = new HomePage(driver);\n\t\thomepage.clickOnLead();\n\t\t// navigate to create lead\n\t\tLeadPage leadp = new LeadPage(driver);\n\t\t// click on create lead\n\t\tleadp.clickCreateLeadImg();\n\t\tleadp.clickCancel();\n\t\t\n\t}", "@Override\n public Step createStep(int position) {\n switch (position) {\n case 0:\n // FIRST FRAGMENT OF STEPPER: DETAILS //\n final StepperDetails step1 = new StepperDetails();\n Bundle b1 = new Bundle();\n b1.putInt(CURRENT_STEP_POSITION_KEY, position);\n step1.setArguments(b1);\n return step1;\n case 1:\n // SECOND FRAGMENT OF STEPPER: MOUNT DEVICE //\n final StepperMountDevice step2 = new StepperMountDevice();\n Bundle b2 = new Bundle();\n b2.putInt(CURRENT_STEP_POSITION_KEY, position);\n step2.setArguments(b2);\n return step2;\n case 2:\n // THIRD FRAGMENT OF STEPPER: CALIBRATION INFO //\n final StepperCalibration step3 = new StepperCalibration();\n Bundle b3 = new Bundle();\n b3.putInt(CURRENT_STEP_POSITION_KEY, position);\n step3.setArguments(b3);\n return step3;\n }\n return null;\n }", "public CreateProjectPanel() {\n isFinished = true;\n }", "private void createFirstPage() {\n BooleanSupplier showWelcomePage = () -> !FirstRunStatus.shouldSkipWelcomePage();\n mPages.add(new FirstRunPage<>(SigninFirstRunFragment.class, showWelcomePage));\n mFreProgressStates.add(MobileFreProgress.WELCOME_SHOWN);\n mPagerAdapter = new FirstRunPagerAdapter(FirstRunActivity.this, mPages);\n mPager.setAdapter(mPagerAdapter);\n // Other pages will be created by createPostNativeAndPoliciesPageSequence() after\n // native and policy service have been initialized.\n }", "public String actionCreateNew() {\r\n \t\tsetBook(new Book());\r\n \t\treturn \"new\";\r\n \t}", "public Reqif10ModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) {\r\n \t\t\tsuper(pageId, selection);\r\n \t\t}", "public ProjectWizardModel(WizardDescriptor wiz, String wizType) {\n super(wiz,wizType);\n }", "public interface IWizardPage extends IDialogPage {\r\n\t/**\r\n\t * Returns whether the next page could be displayed.\r\n\t *\r\n\t * @return <code>true</code> if the next page could be displayed,\r\n\t * and <code>false</code> otherwise\r\n\t */\r\n\tpublic boolean canFlipToNextPage();\r\n\r\n\t/**\r\n\t * Returns this page's name.\r\n\t *\r\n\t * @return the name of this page\r\n\t */\r\n\tpublic String getName();\r\n\r\n\t/**\r\n\t * Returns the wizard page that would to be shown if the user was to\r\n\t * press the Next button.\r\n\t *\r\n\t * @return the next wizard page, or <code>null</code> if none\r\n\t */\r\n\tpublic IWizardPage getNextPage();\r\n\r\n\t/**\r\n\t * Returns the wizard page that would to be shown if the user was to\r\n\t * press the Back button.\r\n\t *\r\n\t * @return the previous wizard page, or <code>null</code> if none\r\n\t */\r\n\tpublic IWizardPage getPreviousPage();\r\n\r\n\t/**\r\n\t * Returns the wizard that hosts this wizard page.\r\n\t *\r\n\t * @return the wizard, or <code>null</code> if this page has not been\r\n\t * added to any wizard\r\n\t * @see #setWizard\r\n\t */\r\n\tpublic IWizard getWizard();\r\n\r\n\t/**\r\n\t * Returns whether this page is complete or not.\r\n\t * <p>\r\n\t * This information is typically used by the wizard to decide\r\n\t * when it is okay to finish.\r\n\t * </p>\r\n\t *\r\n\t * @return <code>true</code> if this page is complete, and\r\n\t * <code>false</code> otherwise\r\n\t */\r\n\tpublic boolean isPageComplete();\r\n\r\n\t/**\r\n\t * Sets the wizard page that would typically be shown\r\n\t * if the user was to press the Back button.\r\n\t * <p>\r\n\t * This method is called by the container.\r\n\t * </p>\r\n\t *\r\n\t * @param page the previous wizard page\r\n\t */\r\n\tpublic void setPreviousPage(IWizardPage page);\r\n\r\n\t/**\r\n\t * Sets the wizard that hosts this wizard page.\r\n\t * Once established, a page's wizard cannot be changed\r\n\t * to a different wizard.\r\n\t *\r\n\t * @param newWizard the wizard\r\n\t * @see #getWizard\r\n\t */\r\n\tpublic void setWizard(IWizard newWizard);\r\n}", "public String createQuiz() {\n quiz = quizEJB.createQuiz(quiz);\n quizList = quizEJB.listQuiz();\n FacesContext.getCurrentInstance().addMessage(\"successForm:successInput\", new FacesMessage(FacesMessage.SEVERITY_INFO, \"Success\", \"New record added successfully\"));\n return \"quiz-list.xhtml\";\n }", "CdapCreateAppStep createCdapCreateAppStep();", "public NewReactionAcquisitionWizardPage() {\n\t\tsuper(\"SpectrumWizardPage\");\n\t\tsetTitle(\"Predicted from MEDEA wizard\");\n\t\tsetDescription(\"This wizard specifies he name of the file of the\" +\n\t\t\t\t\"predicted reaction. It is need to have into this folder other \" +\n\t\t\t\t\"folder with the name: -\");\n\t}", "@Override\r\n\tpublic void createControl(Composite parent) {\n\t\t\r\n\t\tComposite container = new Composite(parent, SWT.NONE);\r\n\t\tGridData gd = new GridData(GridData.FILL_HORIZONTAL);\r\n\t\tcontainer.setLayout(new GridLayout(2, false));\r\n\t\t\r\n\t\tLabel nameLabel = new Label(container, SWT.NULL);\r\n\t\tnameText = new Text(container, SWT.BORDER | SWT.SINGLE);\r\n\t\tnameLabel.setText(BundleInternationalization.getString(\"NameLabel\")+\":\");\r\n\t\tnameText.setLayoutData(gd);\r\n\t\t// Listener to validate the project name when user finishes writing\r\n\t\tnameText.addModifyListener(new ModifyListener() {\r\n\t\t\tpublic void modifyText(ModifyEvent e) {\r\n\t\t\t\twizardChanged();\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t\tLabel descriptionLabel = new Label(container, SWT.NULL);\r\n\t\tdescriptionText = new Text(container, SWT.BORDER | SWT.SINGLE);\r\n\t\tdescriptionLabel.setText(BundleInternationalization.getString(\"DescriptionLabel\")+\":\");\r\n\t\tdescriptionText.setLayoutData(gd);\r\n\t\t// Listener to validate the project description when user finishes writing\r\n\t\tdescriptionText.addModifyListener(new ModifyListener() {\r\n\t\t\tpublic void modifyText(ModifyEvent e) {\r\n\t\t\t\twizardChanged();\r\n\t\t\t}\r\n\t\t});\t\t\r\n\t\t\r\n\t\tLabel startDateLabel = new Label(container, SWT.NULL);\r\n\t\tstartDateText = new DateTime(container, SWT.DATE | SWT.BORDER | SWT.SINGLE);\r\n\t\tstartDateLabel.setText(BundleInternationalization.getString(\"StartDateLabel\")+\":\");\t\r\n\t\tstartDateText.setLayoutData(gd);\r\n\t\t\r\n\r\n\t\tLabel endDateLabel = new Label(container, SWT.NULL);\r\n\t\tendDateText = new DateTime(container, SWT.DATE | SWT.BORDER | SWT.SINGLE);\r\n\t\tendDateLabel.setText(BundleInternationalization.getString(\"EndDateLabel\")+\":\");\t\r\n\t\tendDateText.setLayoutData(gd);\r\n\t\t\r\n\t\tLabel budgetLabel = new Label(container, SWT.NULL);\r\n\t\tbudgetText = new Text(container, SWT.BORDER | SWT.SINGLE);\r\n\t\tbudgetLabel.setText(BundleInternationalization.getString(\"BudgetLabel\")+\":\");\r\n\t\tbudgetText.setLayoutData(gd);\r\n\t\tbudgetText.addListener (SWT.Verify, new Listener () {\r\n public void handleEvent (Event event) {\r\n \tvalidateDouble(event);\r\n }\r\n\t\t}); \r\n\t\tbudgetText.addModifyListener(new ModifyListener() {\r\n\t\t\tpublic void modifyText(ModifyEvent e) {\r\n\t\t\t\twizardChanged();\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t\tLabel quantityLinesLabel = new Label(container, SWT.NULL);\r\n\t\tquantityLinesText = new Text(container, SWT.BORDER | SWT.SINGLE);\r\n\t\tquantityLinesLabel.setText(BundleInternationalization.getString(\"NumberCodeLinesLabel\")+\":\");\r\n\t\tquantityLinesText.setLayoutData(gd);\r\n\t\tquantityLinesText.addListener (SWT.Verify, new Listener () {\r\n public void handleEvent (Event event) {\r\n \tvalidateInt(event);\r\n }\r\n\r\n\t\t});\r\n\t\tquantityLinesText.addModifyListener(new ModifyListener() {\r\n\t\t\tpublic void modifyText(ModifyEvent e) {\r\n\t\t\t\twizardChanged();\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t\tLabel domainLabel = new Label(container, SWT.NULL);\r\n\t\tdomainText = new Text(container, SWT.BORDER | SWT.SINGLE);\r\n\t\tdomainLabel.setText(BundleInternationalization.getString(\"DomainLabel\")+\":\");\r\n\t\tdomainText.setLayoutData(gd);\r\n\t\t// Listener to validate the domain text when user finishes writing\r\n\t\tdomainText.addModifyListener(new ModifyListener() {\r\n\t\t\tpublic void modifyText(ModifyEvent e) {\r\n\t\t\t\twizardChanged();\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t\tLabel progLanguageLabel = new Label(container, SWT.NULL);\r\n\t\tprogLanguageCombo = new Combo(container, SWT.DROP_DOWN | SWT.READ_ONLY);\r\n\t\tprogLanguageLabel.setText(BundleInternationalization.getString(\"ProgrammingLanguageLabel\")+\":\");\r\n\t\t// progLanguageCombo.setLayoutData(gd);\t\r\n\t\tprogLanguageCombo.setItems (new String [] {\"Java\", \"Ada\", \"C++\", \"C#\", \"Cobol\", \"ASP\", \"JSP\"});\r\n\t\tprogLanguageCombo.addSelectionListener(new SelectionAdapter() {\r\n\t\t\t@Override\r\n\t\t\tpublic void widgetSelected(SelectionEvent e) {\r\n\t\t\t\twizardChanged();\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t\tLabel estimatedHoursLabel = new Label(container, SWT.NULL);\r\n\t\testimatedHoursText = new Text(container, SWT.BORDER | SWT.SINGLE);\r\n\t\testimatedHoursLabel.setText(BundleInternationalization.getString(\"EstimatedHoursLabel\")+\":\");\r\n\t\testimatedHoursText.setLayoutData(gd);\r\n\t\testimatedHoursText.addListener (SWT.Verify, new Listener () {\r\n public void handleEvent (Event event) {\r\n \tvalidateInt(event);\r\n }\r\n\r\n\t\t});\r\n\t\testimatedHoursText.addModifyListener(new ModifyListener() {\r\n\t\t\tpublic void modifyText(ModifyEvent e) {\r\n\t\t\t\twizardChanged();\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t\twizardChanged();\r\n\t\tsetControl(container);\r\n\r\n\t}", "public ProjectWizardModel(WizardDescriptor wiz) {\n this(wiz, PROJECT_WIZARD_TYPE );\n }", "public void initialize(TemplateWizard wiz) {\n this.wizard = wiz;\n }", "public WizardPanel(String wizardTitle, String wizardDescription, Icon wizardIcon, Icon welcomeIcon, Dimension wizarddimensions,\n\t\t\tJLabel welcomeLabel) {\n\t\tthis.wizardIcon = wizardIcon;\n\t\tthis.welcomeTitle = wizardTitle;\n\t\tthis.welcomeDescription = wizardDescription;\n\t\twelcomePage = new WizardWelcomePanel(welcomeTitle, welcomeDescription, welcomeIcon, welcomeLabel);\n\t\tthis.finishedPage = new WizardFinishPanel();\n\t\tfinishedPage.setIcon(welcomeIcon);\n\t\ttry {\n\t\t\tjbInit();\n\t\t} catch (Exception ex) {\n\t\t\tex.printStackTrace();\n\t\t}\n\t}", "private void createRoutine() {\n String s = (String) JOptionPane.showInputDialog(\n this,\n \"Name the new routine:\",\n \"Create new\",\n JOptionPane.PLAIN_MESSAGE,\n null, null, null);\n\n if (s != null) {\n Routine r = new Routine(s);\n collection.add(r);\n listModel.addElement(r);\n list.setSelectedValue(r, true);\n new WorkoutsFrame(r);\n }\n }", "public void create(){}", "public StepsFragment() {\n }", "public void saveAndCreateNew() throws Exception {\n\t\topenPrimaryButtonDropdown();\n\t\tgetControl(\"saveAndCreateNewButton\").click();\n\t}", "public void goToCreate(View view) {\n Intent intent = new Intent(this, CreateAccountActivity.class);\n startActivity(intent);\n }", "public WizardEngine(GameOptions go) {\r\n\t\tsuper();\r\n\t\tthis.go = go;\r\n\t\tcardFinder = new WizardCardFinder();\r\n\t\t//cardFinder = new PokerCardFinder();\r\n\t}", "public CreateAccountPanel() {\n initComponents();\n initializeDateChooser();\n }", "public LandingPage registerNewAccount(){\n\t\taction.WaitForWebElement(linkRegisterNewAccount)\n\t\t\t .Click(linkRegisterNewAccount);\n\t\treturn this;\n\t}", "@Override\n public String createRecord(String creatingPage) {\n return creatingPage;\n }", "protected void creaPagine() {\n Pagina pag;\n Pannello pan;\n\n try { // prova ad eseguire il codice\n\n /* crea la pagina e aggiunge campi e pannelli */\n pag = this.addPagina(\"generale\");\n\n pan = PannelloFactory.orizzontale(this);\n pan.add(Cam.data);\n pan.add(Cam.importo.get());\n pan.add(Cam.note.get());\n pag.add(pan);\n\n } catch (Exception unErrore) { // intercetta l'errore\n Errore.crea(unErrore);\n }// fine del blocco try-catch\n\n }", "private void setupCreateCourse() {\n\t\tmakeButton(\"Create Course\", (ActionEvent e) -> {\n\t\t\ttry {\n\t\t\t\tString[] inputs = getInputs(new String[] { \"Name:\", \"Number:\" });\n\t\t\t\tif (inputs == null)\n\t\t\t\t\treturn;\n\n\t\t\t\tint num = Integer.parseInt(inputs[1]);\n\t\t\t\tadCon.createCourse(inputs[0], num);\n\t\t\t\tupdateCourses();\n\t\t\t} catch (NumberFormatException ex) {\n\t\t\t\tJOptionPane.showMessageDialog(getRootPane(), \"Course number must be a number\", \"Error\",\n\t\t\t\t\t\tJOptionPane.OK_OPTION);\n\t\t\t}\n\t\t});\n\t}", "public ElegirTipoBienWizard(String locale)\r\n {\r\n \t this.locale=locale;\r\n try{\r\n initComponents();\r\n renombrarComponentes();\r\n \r\n } catch (Exception e){\r\n logger.error(\"Error al importar actividades economicas\",e);\r\n }\r\n }", "@Override\n public void storeSettings(WizardDescriptor wiz) {\n wiz.putProperty(NewDetectorWizardAction.PROP_NAME_CREATE_VIA_TEMPLATE, getComponent().getViaDetectorTemplate().isSelected());\n wiz.putProperty(PROP_NAME_DETECTOR_NAME, getComponent().getDetectorName().getText());\n wiz.putProperty(PROP_NAME_DETECTOR_DESCRIPTION, getComponent().getDetectorDescription().getText());\n wiz.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, null);\n }", "private void doCreateNewPartner() {\n Scanner sc = new Scanner(System.in);\n System.out.println(\"***Hors Management System:: System Administration:: Create new partner\");\n Partner partner = new Partner();\n System.out.print(\"Enter partner username:\");\n partner.setName(sc.nextLine().trim());\n System.out.print(\"Enter partner password;\");\n partner.setPassword(sc.nextLine().trim());\n\n Set<ConstraintViolation<Partner>> constraintViolations = validator.validate(partner);\n\n if (constraintViolations.isEmpty()) {\n partner = partnerControllerRemote.createNewPartner(partner);\n System.out.println(\"New partner created successfully\");\n } else {\n showInputDataValidationErrorsForPartner(constraintViolations);\n }\n\n }", "@FXML\n private void goToCreateProgram(ActionEvent event) throws IOException {\n\n CreateProgramController createProgramController = new CreateProgramController();\n Program programEntity = createProgramController.openView(event);\n createProgram.setSelected(false);\n if (programEntity != null && programListController != null)\n {\n if (programListController.listOfPrograms != null)\n {\n programListController.listOfPrograms.add(programEntity);\n programListController.updateProgramList();\n UsermanagementUtilities.setFeedback(event,\"The program was created\",true);\n }\n } else {\n UsermanagementUtilities.setFeedback(event,\"The program was not created\",false);\n }\n }", "public BJADWizard<T> getWizard()\n {\n return this.wizard;\n }", "private void AddNewScenario(HttpServletRequest request, HttpServletResponse response) {\n XMLTree.getInstance().AddNewScenario();\n }", "public void testGetDialog() {\n System.out.println(\"getDialog\");\n Wizard instance = new Wizard();\n JDialog result = instance.getDialog();\n assertNotNull(result);\n }", "Dashboard createDashboard();", "public void switchToCreateAccount() {\r\n\t\tlayout.show(this, \"createPane\");\r\n\t\trevalidate();\r\n\t\trepaint();\r\n\t}", "protected void createPages() {\n\t\tcreateIntroEditor();\n\t\tcreatePageMainEditor();\n\t\tcreatePageController();\n\t\tcreateCssEditor();\n\t\tcreatePageTextEditor();\n\t\trefreshPageMainEditor();\n\t\trefreshPageControllerEditor();\n\t\trefreshCssEditor();\n\t\tsetDirty(false);\n\t}", "public boolean createLesson() {\n\t\treturn false;\n\t}", "protected void setWizard(BJADWizard<T> wizard)\n {\n this.wizard = wizard;\n }", "public JaxWsClientCreator(Project project, WizardDescriptor wiz) {\n this.project = project;\n this.wiz = wiz;\n }", "public void create() {\n\t\t\n\t}", "public WizardPanel(String wizardTitle, String wizardDescription, Icon wizardIcon, Icon welcomeIcon,\n\t\t\tDimension wizarddimensions) {\n\t\tthis(wizardTitle, wizardDescription, wizardIcon, welcomeIcon, wizarddimensions, null);\n\t}", "public SlingHttpResponse createPage(String pageLabel, String pageTitle, String parentPath, String templatePath, int... expectedStatus)\n throws ClientException {\n FormEntityBuilder feb = FormEntityBuilder.create()\n .addParameter(\"cmd\", CMD_CREATE_PAGE)\n .addParameter(\"parentPath\", parentPath)\n .addParameter(\"label\", pageLabel)\n .addParameter(\"title\", pageTitle)\n .addParameter(\"template\", templatePath);\n\n return executeWCMCommand(CMD_CREATE_PAGE, feb, expectedStatus);\n }", "public void widgetSelected(SelectionEvent arg0) {\n\t\t\t\tIWorkbenchWizard wizard = new BasicNewProjectResourceWizard();\r\n\t\t\t\twizard.init(PlatformUI.getWorkbench(), new TreeSelection());\r\n\t\t\t\tWizardDialog dialog = new WizardDialog(getShell(), wizard);\r\n\t\t\t\tdialog.open();\r\n\t\t\t\tif (outputChooserTreeViewer.getTree().getItemCount() == 1) {\t\t\t\t\t\r\n\t\t\t\t\tvalidatePage();\r\n\t\t\t\t}\r\n\t\t\t}", "@Command\n public void nuevaMateria() {\n\t\t\n\t\tWindow window = (Window)Executions.createComponents(\n \"/WEB-INF/include/Mantenimiento/Materias/vtnMaterias.zul\", null, null);\n window.doModal();\n }", "FORM createFORM();", "public boolean[] showLinearWizard(List<Admin> admins, AdminService adminService) {\n\n // define pages to show\n Wizard wizard = new Wizard();\n wizard.setTitle(\"System Setup Configuration\");\n\n // --- page 1\n int row = 0;\n\n GridPane page1Grid = new GridPane();\n page1Grid.setVgap(10);\n page1Grid.setHgap(10);\n\n ObservableList<String> adminNames = FXCollections.observableArrayList();\n ChoiceBox<String> allAdmins = new ChoiceBox<>(adminNames);\n\n if (!admins.isEmpty()) {\n page1Grid.add(new Label(\"All Admins :\"), 0, row);\n for (Admin a : admins) {\n adminNames.add(a.getAdminName());\n }\n page1Grid.add(allAdmins, 1, row++);\n }\n\n page1Grid.add(new Label(\"Admin :\"), 0, row);\n final TextField userTF = createTextField(\"adminName\");\n page1Grid.add(userTF, 1, row++);\n\n page1Grid.add(new Label(\"Password :\"), 0, row);\n final TextField passTF = createTextField(\"password\");\n // Set initial state\n passTF.setManaged(false);\n passTF.setVisible(false);\n page1Grid.add(passTF, 1, row);\n\n final PasswordField passPF = new PasswordField();\n passPF.setId(\"password\");\n GridPane.setHgrow(passPF, Priority.ALWAYS);\n page1Grid.add(passPF, 1, row);\n\n CheckBox checkBox = new CheckBox(\"Show/Hide password\");\n page1Grid.add(checkBox, 1, ++row);\n\n // Bind properties. Toggle textField and passwordField\n // visibility and manageability properties mutually when checkbox's state is changed.\n // Because we want to display only one component (textField or passwordField)\n // on the scene at a time.\n passTF.managedProperty().bind(checkBox.selectedProperty());\n passTF.visibleProperty().bind(checkBox.selectedProperty());\n\n passPF.managedProperty().bind(checkBox.selectedProperty().not());\n passPF.visibleProperty().bind(checkBox.selectedProperty().not());\n\n // Bind the textField and passwordField text values bidirectionally.\n passTF.textProperty().bindBidirectional(passPF.textProperty());\n\n WizardPane page1 = new WizardPane() {\n\n @Override\n public void onEnteringPage(Wizard wizard) {\n if (!admins.isEmpty()) {\n System.out.println(\"Skipped!\");\n } else {\n for (ButtonType type : getButtonTypes()) {\n if (type.getButtonData().equals(ButtonBar.ButtonData.NEXT_FORWARD)) {\n Node next = lookupButton(type);\n Platform.runLater(() -> next.setDisable(true));\n userTF.textProperty().addListener((observable, oldValue, newValue) -> next.setDisable(newValue.trim().isEmpty() || passPF.getText().isEmpty()));\n passPF.textProperty().addListener((observable, oldValue, newValue) -> next.setDisable(newValue.trim().isEmpty() || userTF.getText().isEmpty()));\n } else if (type.getButtonData().equals(ButtonBar.ButtonData.CANCEL_CLOSE)) {\n Node cancel = lookupButton(type);\n Platform.runLater(() -> cancel.setVisible(false));\n } else if (type.getButtonData().equals(ButtonBar.ButtonData.BACK_PREVIOUS)) {\n Node previous = lookupButton(type);\n Platform.runLater(() -> previous.setVisible(false));\n }\n }\n }\n }\n\n @Override\n public void onExitingPage(Wizard wizard) {\n\n String adminName = (String) wizard.getSettings().get(\"adminName\");\n String pass = (String) wizard.getSettings().get(\"password\");\n\n Validation validation = new Validation();\n if (!admins.isEmpty() && adminName.isEmpty() && pass.isEmpty()) {\n System.out.println(\"Skipped!\");\n } else {\n if (validation.emptyValidation(userTF, \"Admin\", adminName.isEmpty()) &&\n validation.emptyValidation(passTF, \"Password\", pass.isEmpty())) {\n //save\n if (adminNames.isEmpty()) {\n Admin admin = new Admin();\n admin.setAdminName(adminName);\n admin.setPassword(pass);\n\n adminService.save(admin);\n\n adminNames.add(adminName);\n admins.add(admin);\n } else {\n for (Admin existingAdmin : admins) {\n //update\n if (!existingAdmin.getAdminName().equals(adminName) || !existingAdmin.getPassword().equals(pass)) {\n boolean yesIdo = CommonUtils.confirmMessage(\"Are you Sure?\", \"Warning: Admin Credentials Changed! \", \"Do you really want to update Admin Details?\");\n if (yesIdo) {\n existingAdmin.setAdminName(adminName);\n existingAdmin.setPassword(pass);\n adminService.update(existingAdmin);\n } else {\n userTF.setText(existingAdmin.getAdminName());\n passTF.setText(existingAdmin.getPassword());\n }\n break;\n }\n }\n }\n } else {\n wizard.getSettings().put(\"adminName\", \"\");\n }\n }\n }\n };\n String adminHeaderTest;\n if (admins.isEmpty()) {\n adminHeaderTest = \"No Admin Found. \\nPlease add new Admin Details.\";\n } else {\n adminHeaderTest = \"Admin Details!\";\n }\n page1.setHeaderText(adminHeaderTest);\n page1.setContent(page1Grid);\n\n allAdmins.getSelectionModel().\n\n selectedIndexProperty().\n\n addListener((observableValue, oldIndex, newIndex) ->\n\n {\n if (newIndex != null) {\n Admin existingAdmin = adminService.findByAdminName(allAdmins.getItems().get((Integer) newIndex));\n userTF.setText(existingAdmin.getAdminName());\n passTF.setText(existingAdmin.getPassword());\n }\n });\n\n GridPane page3Grid = new GridPane();\n page3Grid.setVgap(10);\n page3Grid.setHgap(10);\n\n ImageView imageView = new ImageView();\n imageView.setFitHeight(100);\n imageView.setPreserveRatio(true);\n imageView.setImage(CommonUtils.getLogoImage());\n imageView.setSmooth(true);\n\n page3Grid.add(imageView, 0, 0, 1, 3);\n\n page3Grid.add(new\n\n Label(\"Name :\"), 1, 0);\n page3Grid.add(new\n\n Label(\"Address:\"), 1, 1);\n page3Grid.add(new\n\n Label(\"Contact:\"), 1, 2);\n\n\n ChoiceBox<String> systemNameCB = new ChoiceBox<>(systemNames);\n systemNameCB.setId(\"churchName\");\n GridPane.setHgrow(systemNameCB, Priority.ALWAYS);\n systemNameCB.getSelectionModel().select(ConfigReader.getSystemIndex());\n page3Grid.add(systemNameCB, 2, 0);\n\n TextField systemAddress = createTextField(\"churchAddress\");\n systemAddress.setPromptText(\"Eg. Kalanki, Kathmandu\");\n systemAddress.setText(ConfigReader.getSystemAddress());\n page3Grid.add(systemAddress, 2, 1);\n\n TextField systemContact = createTextField(\"churchContact\");\n systemContact.setPromptText(\"Eg. 01-4XXXXXX\");\n systemContact.setText(ConfigReader.getSystemContact());\n page3Grid.add(systemContact, 2, 2);\n\n // --- page 3\n WizardPane page3 = new WizardPane();\n page3.setHeaderText(\"Church Details!\");\n\n page3.setContentText(\"Please provide Church Name and photo!\\nNote: Changes will be active after Restart only.\");\n page3.setContent(page3Grid);\n\n ButtonType photoDialogButton = new ButtonType(\"Change Logo\", ButtonBar.ButtonData.HELP_2);\n page3.getButtonTypes().\n\n add(photoDialogButton);\n\n Button photoButton = (Button) page3.lookupButton(photoDialogButton);\n photoButton.setStyle(\"-fx-background-color: DODGERBLUE;\");\n photoButton.setTextFill(Color.WHITE);\n photoButton.addEventFilter(ActionEvent.ACTION, actionEvent ->\n\n {\n actionEvent.consume(); // stop hello.dialog from closing\n getImage();\n imageView.setImage(CommonUtils.getLogoImage());\n });\n\n // create wizard\n wizard.setFlow(new Wizard.LinearFlow(page1, page3));\n\n // show wizard and wait for response\n wizard.showAndWait().\n\n ifPresent(result ->\n\n {\n if (result == ButtonType.FINISH) {\n try {\n String[] currentChurchDetails = new String[]{String.valueOf(ConfigReader.getSystemIndex()), ConfigReader.getSystemAddress(), ConfigReader.getSystemContact()};\n String[] newChurchDetails = new String[]{String.valueOf(systemNameCB.getSelectionModel().getSelectedIndex()), systemAddress.getText(), systemContact.getText()};\n if (!Arrays.equals(currentChurchDetails, newChurchDetails)) {\n ConfigReader.setSystemDetails(newChurchDetails);\n churchDetailsChanged[1] = true;\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n });\n\n return churchDetailsChanged;\n }", "private void toCreateAcc() {\n Intent intent = new Intent(this, WelcomeActivity.class);\n startActivity(intent);\n }", "public static void createNewLeague()\n\t{\n\t\t//put code to get input from end-user here.\n\t\t//generateFixtures(leagueName, teamAmount, homeAndAway, winPoints, drawPoints, lossPoints, teamNames);\n\t}", "public Create_Course() {\n initComponents();\n comboBoxLec();\n comboBoxDep();\n }", "private void actionNewProject ()\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tDataController.scenarioNewProject();\r\n\r\n\t\t\thelperDisplayProjectFiles();\r\n\r\n\t\t\t//---- Change button icon\r\n\t\t\tImageIcon iconButton = FormUtils.getIconResource(FormStyle.RESOURCE_PATH_ICO_VIEW_SAMPLES);\r\n\r\n\t\t\tmainFormLink.getComponentToolbar().getComponentButtonViewSamples().setIcon(iconButton);\r\n\t\t\tmainFormLink.getComponentToolbar().getComponentButtonViewSamples().setActionCommand(FormMainHandlerCommands.AC_VIEW_SAMPLES_ON);\r\n\t\t\tmainFormLink.getComponentToolbar().getComponentButtonViewSamples().setToolTipText(\"View detected samples\");\r\n\r\n\t\t\tmainFormLink.reset();\r\n\t\t}\r\n\t\tcatch (ExceptionMessage e)\r\n\t\t{\r\n\t\t\tExceptionHandler.processException(e);\r\n\t\t}\r\n\t}" ]
[ "0.6949543", "0.68756926", "0.6706814", "0.6687967", "0.6602528", "0.6525941", "0.6505783", "0.645814", "0.6402296", "0.62814623", "0.6261516", "0.6247386", "0.62305826", "0.6167935", "0.6166846", "0.6135973", "0.6132156", "0.61190283", "0.611149", "0.60869133", "0.60696", "0.6061443", "0.5999429", "0.59338415", "0.5880532", "0.58769375", "0.58588564", "0.58473915", "0.5818905", "0.5818328", "0.57426006", "0.57400197", "0.57328486", "0.5695062", "0.5672288", "0.56336725", "0.5590503", "0.5571821", "0.5566422", "0.5491026", "0.5482755", "0.54712784", "0.54570866", "0.5448823", "0.544873", "0.54255635", "0.54191685", "0.5410261", "0.5395943", "0.5387732", "0.5372938", "0.5319536", "0.53187114", "0.5316841", "0.52979934", "0.5294797", "0.5287357", "0.5239968", "0.5239596", "0.5218207", "0.52171844", "0.5208878", "0.52059007", "0.5205245", "0.52035123", "0.52018607", "0.5198844", "0.51899177", "0.51846343", "0.518289", "0.51817673", "0.5179425", "0.516515", "0.5155294", "0.51476884", "0.51469195", "0.51465", "0.5137089", "0.51297665", "0.5127288", "0.5121544", "0.5109006", "0.51088345", "0.51069236", "0.510632", "0.51024514", "0.5101751", "0.5097638", "0.5087167", "0.5075351", "0.5074651", "0.5074078", "0.5072502", "0.5071247", "0.5068944", "0.50678194", "0.50527173", "0.5047814", "0.5045599", "0.50400597" ]
0.60789233
20