id
int64
22
34.9k
original_code
stringlengths
31
107k
code_wo_comment
stringlengths
29
77.3k
cleancode
stringlengths
25
62.1k
repo
stringlengths
6
65
label
sequencelengths
4
4
16,577
public void dumpIncrements(Statement stmt, Block block, ListIterator<Statement> stmtIt, RCTracker increments) { for (RefCountType rcType: RefcountPass.RC_TYPES) { for (Entry<AliasKey, Long> e: increments.rcIter(rcType, RCDir.INCR)) { // TODO: can we guarantee that the refcount var is available in the // current scope? Var var = increments.getRefCountVar(e.getKey()); assert(var != null); Long incr = e.getValue(); assert(incr >= 0); if (incr > 0 && RefCounting.trackRefCount(var, rcType)) { boolean varInit = stmt != null && stmt.type() == StatementType.INSTRUCTION && stmt.instruction().isInitialized(var); // TODO: what if not initialized in a conditional? Should insert before if (stmt != null && (stmt.type() == StatementType.INSTRUCTION && !(var.storage() == Alloc.ALIAS && varInit))) { insertIncrBefore(block, stmtIt, var, incr, rcType); } else { insertIncrAfter(block, stmtIt, var, incr, rcType); } } } } // Clear out all increments increments.resetAll(RCDir.INCR); }
public void dumpIncrements(Statement stmt, Block block, ListIterator<Statement> stmtIt, RCTracker increments) { for (RefCountType rcType: RefcountPass.RC_TYPES) { for (Entry<AliasKey, Long> e: increments.rcIter(rcType, RCDir.INCR)) { Var var = increments.getRefCountVar(e.getKey()); assert(var != null); Long incr = e.getValue(); assert(incr >= 0); if (incr > 0 && RefCounting.trackRefCount(var, rcType)) { boolean varInit = stmt != null && stmt.type() == StatementType.INSTRUCTION && stmt.instruction().isInitialized(var); if (stmt != null && (stmt.type() == StatementType.INSTRUCTION && !(var.storage() == Alloc.ALIAS && varInit))) { insertIncrBefore(block, stmtIt, var, incr, rcType); } else { insertIncrAfter(block, stmtIt, var, incr, rcType); } } } } increments.resetAll(RCDir.INCR); }
public void dumpincrements(statement stmt, block block, listiterator<statement> stmtit, rctracker increments) { for (refcounttype rctype: refcountpass.rc_types) { for (entry<aliaskey, long> e: increments.rciter(rctype, rcdir.incr)) { var var = increments.getrefcountvar(e.getkey()); assert(var != null); long incr = e.getvalue(); assert(incr >= 0); if (incr > 0 && refcounting.trackrefcount(var, rctype)) { boolean varinit = stmt != null && stmt.type() == statementtype.instruction && stmt.instruction().isinitialized(var); if (stmt != null && (stmt.type() == statementtype.instruction && !(var.storage() == alloc.alias && varinit))) { insertincrbefore(block, stmtit, var, incr, rctype); } else { insertincrafter(block, stmtit, var, incr, rctype); } } } } increments.resetall(rcdir.incr); }
hsphcdm/swift-t
[ 1, 0, 0, 0 ]
24,810
public static void main(String args[]) throws FileNotFoundException { // TODO: use sane arg parsing if (args.length != 2) { throw new RuntimeException("usage: AnalyzeMethodEntry trace-in trace-out"); } String inFileName = args[0]; String outFileName = args[1]; Deserializer<TraceEvent> d = Deserializer.getDeserializer(new FileInputStream(inFileName), TraceEvent.class); Serializer<TraceEvent> s = Serializer.getSerializer(new FileOutputStream(outFileName)); new AnalyzeMethodEntry(d, s).analyze(); }
public static void main(String args[]) throws FileNotFoundException { if (args.length != 2) { throw new RuntimeException("usage: AnalyzeMethodEntry trace-in trace-out"); } String inFileName = args[0]; String outFileName = args[1]; Deserializer<TraceEvent> d = Deserializer.getDeserializer(new FileInputStream(inFileName), TraceEvent.class); Serializer<TraceEvent> s = Serializer.getSerializer(new FileOutputStream(outFileName)); new AnalyzeMethodEntry(d, s).analyze(); }
public static void main(string args[]) throws filenotfoundexception { if (args.length != 2) { throw new runtimeexception("usage: analyzemethodentry trace-in trace-out"); } string infilename = args[0]; string outfilename = args[1]; deserializer<traceevent> d = deserializer.getdeserializer(new fileinputstream(infilename), traceevent.class); serializer<traceevent> s = serializer.getserializer(new fileoutputstream(outfilename)); new analyzemethodentry(d, s).analyze(); }
glasser/amock
[ 0, 1, 0, 0 ]
24,886
@Test public void testAuthRequest() throws IOException, MessageException, DiscoveryException, ConsumerException { DiscoveryInformation info = createMockInfo(); HttpSession session = createMockSession(info, false, false, true); HttpServletRequest req = createMockRequest(session); HttpServletResponse resp = createMockResponse(); AuthRequest authRequest = createMockAuthRequest(); //TODO this should return a list of what? expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList()); expect(mockManager.associate(anyObject(List.class))).andReturn(info); expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest); replay(mockManager); consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority); assertFalse(consumer.authRequest("discover", req, resp)); }
@Test public void testAuthRequest() throws IOException, MessageException, DiscoveryException, ConsumerException { DiscoveryInformation info = createMockInfo(); HttpSession session = createMockSession(info, false, false, true); HttpServletRequest req = createMockRequest(session); HttpServletResponse resp = createMockResponse(); AuthRequest authRequest = createMockAuthRequest(); expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList()); expect(mockManager.associate(anyObject(List.class))).andReturn(info); expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest); replay(mockManager); consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority); assertFalse(consumer.authRequest("discover", req, resp)); }
@test public void testauthrequest() throws ioexception, messageexception, discoveryexception, consumerexception { discoveryinformation info = createmockinfo(); httpsession session = createmocksession(info, false, false, true); httpservletrequest req = createmockrequest(session); httpservletresponse resp = createmockresponse(); authrequest authrequest = createmockauthrequest(); expect(mockmanager.discover(eq("discover"))).andreturn(lists.newarraylist()); expect(mockmanager.associate(anyobject(list.class))).andreturn(info); expect(mockmanager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andreturn(authrequest); replay(mockmanager); consumer = new openidconsumer("%origin%/openid/openidcallback", mockmanager, "mockcontextroot", mockauthority); assertfalse(consumer.authrequest("discover", req, resp)); }
isabella232/explorer-2
[ 1, 0, 0, 0 ]
24,887
@Test(expected = RuntimeException.class) public void testAuthRequestIOException() throws IOException, MessageException, DiscoveryException, ConsumerException { DiscoveryInformation info = createMockInfo(); HttpSession session = createMockSession(info, false, false, true); HttpServletRequest req = createMockRequest(session); HttpServletResponse resp = createMockResponse(); AuthRequest authRequest = createMockAuthRequest(); //TODO this should return a list of what? expect(mockManager.discover(eq("discover"))).andThrow(new IOException()); expect(mockManager.associate(anyObject(List.class))).andReturn(info); expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest); replay(mockManager); consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority); assertFalse(consumer.authRequest("discover", req, resp)); }
@Test(expected = RuntimeException.class) public void testAuthRequestIOException() throws IOException, MessageException, DiscoveryException, ConsumerException { DiscoveryInformation info = createMockInfo(); HttpSession session = createMockSession(info, false, false, true); HttpServletRequest req = createMockRequest(session); HttpServletResponse resp = createMockResponse(); AuthRequest authRequest = createMockAuthRequest(); expect(mockManager.discover(eq("discover"))).andThrow(new IOException()); expect(mockManager.associate(anyObject(List.class))).andReturn(info); expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest); replay(mockManager); consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority); assertFalse(consumer.authRequest("discover", req, resp)); }
@test(expected = runtimeexception.class) public void testauthrequestioexception() throws ioexception, messageexception, discoveryexception, consumerexception { discoveryinformation info = createmockinfo(); httpsession session = createmocksession(info, false, false, true); httpservletrequest req = createmockrequest(session); httpservletresponse resp = createmockresponse(); authrequest authrequest = createmockauthrequest(); expect(mockmanager.discover(eq("discover"))).andthrow(new ioexception()); expect(mockmanager.associate(anyobject(list.class))).andreturn(info); expect(mockmanager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andreturn(authrequest); replay(mockmanager); consumer = new openidconsumer("%origin%/openid/openidcallback", mockmanager, "mockcontextroot", mockauthority); assertfalse(consumer.authrequest("discover", req, resp)); }
isabella232/explorer-2
[ 1, 0, 0, 0 ]
24,888
@Test public void testVerifyResponse() throws IOException, MessageException, DiscoveryException, ConsumerException, AssociationException { DiscoveryInformation info = createMockInfo(); HttpSession session = createMockSession(info, true, true, true); HttpServletRequest req = createMockRequest(session); AuthRequest authRequest = createMockAuthRequest(); AuthSuccess authSuccess = createMockAuthSuccess(createMockFetchResponse(), createRegResponse(), true, true); Identifier id = createMockIdentifier(); VerificationResult result = createMockVerificationResult(id, authSuccess); //TODO this should return a list of what? expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList()); expect(mockManager.associate(anyObject(List.class))).andReturn(info); expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest); expect(mockManager.verify(eq("http://example.com/request?query"), anyObject(ParameterList.class), anyObject(DiscoveryInformation.class))).andReturn(result); replay(mockManager); consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority); assertEquals(id, consumer.verifyResponse(req)); }
@Test public void testVerifyResponse() throws IOException, MessageException, DiscoveryException, ConsumerException, AssociationException { DiscoveryInformation info = createMockInfo(); HttpSession session = createMockSession(info, true, true, true); HttpServletRequest req = createMockRequest(session); AuthRequest authRequest = createMockAuthRequest(); AuthSuccess authSuccess = createMockAuthSuccess(createMockFetchResponse(), createRegResponse(), true, true); Identifier id = createMockIdentifier(); VerificationResult result = createMockVerificationResult(id, authSuccess); expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList()); expect(mockManager.associate(anyObject(List.class))).andReturn(info); expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest); expect(mockManager.verify(eq("http://example.com/request?query"), anyObject(ParameterList.class), anyObject(DiscoveryInformation.class))).andReturn(result); replay(mockManager); consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority); assertEquals(id, consumer.verifyResponse(req)); }
@test public void testverifyresponse() throws ioexception, messageexception, discoveryexception, consumerexception, associationexception { discoveryinformation info = createmockinfo(); httpsession session = createmocksession(info, true, true, true); httpservletrequest req = createmockrequest(session); authrequest authrequest = createmockauthrequest(); authsuccess authsuccess = createmockauthsuccess(createmockfetchresponse(), createregresponse(), true, true); identifier id = createmockidentifier(); verificationresult result = createmockverificationresult(id, authsuccess); expect(mockmanager.discover(eq("discover"))).andreturn(lists.newarraylist()); expect(mockmanager.associate(anyobject(list.class))).andreturn(info); expect(mockmanager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andreturn(authrequest); expect(mockmanager.verify(eq("http://example.com/request?query"), anyobject(parameterlist.class), anyobject(discoveryinformation.class))).andreturn(result); replay(mockmanager); consumer = new openidconsumer("%origin%/openid/openidcallback", mockmanager, "mockcontextroot", mockauthority); assertequals(id, consumer.verifyresponse(req)); }
isabella232/explorer-2
[ 1, 0, 0, 0 ]
24,889
@Test public void testVerifyResponseNullIdentifier() throws IOException, MessageException, DiscoveryException, ConsumerException, AssociationException { DiscoveryInformation info = createMockInfo(); HttpSession session = createMockSession(info, false, false, true); HttpServletRequest req = createMockRequest(session); AuthRequest authRequest = createMockAuthRequest(); AuthSuccess authSuccess = createMockAuthSuccess(createMockFetchResponse(), createRegResponse(), true, true); VerificationResult result = createMockVerificationResult(null, authSuccess); //TODO this should return a list of what? expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList()); expect(mockManager.associate(anyObject(List.class))).andReturn(info); expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest); expect(mockManager.verify(eq("http://example.com/request?query"), anyObject(ParameterList.class), anyObject(DiscoveryInformation.class))).andReturn(result); replay(mockManager); consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority); assertNull(consumer.verifyResponse(req)); }
@Test public void testVerifyResponseNullIdentifier() throws IOException, MessageException, DiscoveryException, ConsumerException, AssociationException { DiscoveryInformation info = createMockInfo(); HttpSession session = createMockSession(info, false, false, true); HttpServletRequest req = createMockRequest(session); AuthRequest authRequest = createMockAuthRequest(); AuthSuccess authSuccess = createMockAuthSuccess(createMockFetchResponse(), createRegResponse(), true, true); VerificationResult result = createMockVerificationResult(null, authSuccess); expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList()); expect(mockManager.associate(anyObject(List.class))).andReturn(info); expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest); expect(mockManager.verify(eq("http://example.com/request?query"), anyObject(ParameterList.class), anyObject(DiscoveryInformation.class))).andReturn(result); replay(mockManager); consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority); assertNull(consumer.verifyResponse(req)); }
@test public void testverifyresponsenullidentifier() throws ioexception, messageexception, discoveryexception, consumerexception, associationexception { discoveryinformation info = createmockinfo(); httpsession session = createmocksession(info, false, false, true); httpservletrequest req = createmockrequest(session); authrequest authrequest = createmockauthrequest(); authsuccess authsuccess = createmockauthsuccess(createmockfetchresponse(), createregresponse(), true, true); verificationresult result = createmockverificationresult(null, authsuccess); expect(mockmanager.discover(eq("discover"))).andreturn(lists.newarraylist()); expect(mockmanager.associate(anyobject(list.class))).andreturn(info); expect(mockmanager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andreturn(authrequest); expect(mockmanager.verify(eq("http://example.com/request?query"), anyobject(parameterlist.class), anyobject(discoveryinformation.class))).andreturn(result); replay(mockmanager); consumer = new openidconsumer("%origin%/openid/openidcallback", mockmanager, "mockcontextroot", mockauthority); assertnull(consumer.verifyresponse(req)); }
isabella232/explorer-2
[ 1, 0, 0, 0 ]
24,890
@Test public void testVerifyResponseNoEmail() throws IOException, MessageException, DiscoveryException, ConsumerException, AssociationException { DiscoveryInformation info = createMockInfo(); HttpSession session = createMockSession(info, false, false, false); HttpServletRequest req = createMockRequest(session); AuthRequest authRequest = createMockAuthRequest(); AuthSuccess authSuccess = createMockAuthSuccess(createMockFetchResponse(), createRegResponse(), false, false); Identifier id = createMockIdentifier(); VerificationResult result = createMockVerificationResult(id, authSuccess); //TODO this should return a list of what? expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList()); expect(mockManager.associate(anyObject(List.class))).andReturn(info); expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest); expect(mockManager.verify(eq("http://example.com/request?query"), anyObject(ParameterList.class), anyObject(DiscoveryInformation.class))).andReturn(result); replay(mockManager); consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority); assertEquals(id, consumer.verifyResponse(req)); verify(authSuccess); verify(session); }
@Test public void testVerifyResponseNoEmail() throws IOException, MessageException, DiscoveryException, ConsumerException, AssociationException { DiscoveryInformation info = createMockInfo(); HttpSession session = createMockSession(info, false, false, false); HttpServletRequest req = createMockRequest(session); AuthRequest authRequest = createMockAuthRequest(); AuthSuccess authSuccess = createMockAuthSuccess(createMockFetchResponse(), createRegResponse(), false, false); Identifier id = createMockIdentifier(); VerificationResult result = createMockVerificationResult(id, authSuccess); expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList()); expect(mockManager.associate(anyObject(List.class))).andReturn(info); expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest); expect(mockManager.verify(eq("http://example.com/request?query"), anyObject(ParameterList.class), anyObject(DiscoveryInformation.class))).andReturn(result); replay(mockManager); consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority); assertEquals(id, consumer.verifyResponse(req)); verify(authSuccess); verify(session); }
@test public void testverifyresponsenoemail() throws ioexception, messageexception, discoveryexception, consumerexception, associationexception { discoveryinformation info = createmockinfo(); httpsession session = createmocksession(info, false, false, false); httpservletrequest req = createmockrequest(session); authrequest authrequest = createmockauthrequest(); authsuccess authsuccess = createmockauthsuccess(createmockfetchresponse(), createregresponse(), false, false); identifier id = createmockidentifier(); verificationresult result = createmockverificationresult(id, authsuccess); expect(mockmanager.discover(eq("discover"))).andreturn(lists.newarraylist()); expect(mockmanager.associate(anyobject(list.class))).andreturn(info); expect(mockmanager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andreturn(authrequest); expect(mockmanager.verify(eq("http://example.com/request?query"), anyobject(parameterlist.class), anyobject(discoveryinformation.class))).andreturn(result); replay(mockmanager); consumer = new openidconsumer("%origin%/openid/openidcallback", mockmanager, "mockcontextroot", mockauthority); assertequals(id, consumer.verifyresponse(req)); verify(authsuccess); verify(session); }
isabella232/explorer-2
[ 1, 0, 0, 0 ]
8,549
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <U, R> Observable<R> zipWith(ObservableSource<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper) { ObjectHelper.requireNonNull(other, "other is null"); return zip(this, other, zipper); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <U, R> Observable<R> zipWith(ObservableSource<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper) { ObjectHelper.requireNonNull(other, "other is null"); return zip(this, other, zipper); }
@checkreturnvalue @schedulersupport(schedulersupport.none) public final <u, r> observable<r> zipwith(observablesource<? extends u> other, bifunction<? super t, ? super u, ? extends r> zipper) { objecthelper.requirenonnull(other, "other is null"); return zip(this, other, zipper); }
jaysooong/RxJava
[ 0, 0, 0, 0 ]
8,550
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <U, R> Observable<R> zipWith(ObservableSource<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper, boolean delayError) { return zip(this, other, zipper, delayError); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <U, R> Observable<R> zipWith(ObservableSource<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper, boolean delayError) { return zip(this, other, zipper, delayError); }
@checkreturnvalue @schedulersupport(schedulersupport.none) public final <u, r> observable<r> zipwith(observablesource<? extends u> other, bifunction<? super t, ? super u, ? extends r> zipper, boolean delayerror) { return zip(this, other, zipper, delayerror); }
jaysooong/RxJava
[ 0, 0, 0, 0 ]
8,551
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <U, R> Observable<R> zipWith(ObservableSource<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper, boolean delayError, int bufferSize) { return zip(this, other, zipper, delayError, bufferSize); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <U, R> Observable<R> zipWith(ObservableSource<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper, boolean delayError, int bufferSize) { return zip(this, other, zipper, delayError, bufferSize); }
@checkreturnvalue @schedulersupport(schedulersupport.none) public final <u, r> observable<r> zipwith(observablesource<? extends u> other, bifunction<? super t, ? super u, ? extends r> zipper, boolean delayerror, int buffersize) { return zip(this, other, zipper, delayerror, buffersize); }
jaysooong/RxJava
[ 0, 0, 0, 0 ]
25,117
private void cleanProxy(SdlDisconnectedReason disconnectedReason) throws SdlException { try { // ALM Specific Cleanup if (_advancedLifecycleManagementEnabled) { _sdlConnectionState = SdlConnectionState.SDL_DISCONNECTED; firstTimeFull = true; // Should we wait for the interface to be unregistered? Boolean waitForInterfaceUnregistered = false; // Unregister app interface synchronized(CONNECTION_REFERENCE_LOCK) { if (sdlSession != null && sdlSession.getIsConnected() && getAppInterfaceRegistered()) { waitForInterfaceUnregistered = true; unregisterAppInterfacePrivate(UNREGISTER_APP_INTERFACE_CORRELATION_ID); } } // Wait for the app interface to be unregistered if (waitForInterfaceUnregistered) { synchronized(APP_INTERFACE_REGISTERED_LOCK) { try { APP_INTERFACE_REGISTERED_LOCK.wait(3000); } catch (InterruptedException e) { // Do nothing } } } } if(rpcResponseListeners != null){ rpcResponseListeners.clear(); } if(rpcNotificationListeners != null){ rpcNotificationListeners.clear(); //TODO make sure we want to clear this } // Clean up SDL Connection synchronized(CONNECTION_REFERENCE_LOCK) { if (sdlSession != null) sdlSession.close(); } } catch (SdlException e) { throw e; } finally { SdlTrace.logProxyEvent("SdlProxy cleaned.", SDL_LIB_TRACE_KEY); } }
private void cleanProxy(SdlDisconnectedReason disconnectedReason) throws SdlException { try { if (_advancedLifecycleManagementEnabled) { _sdlConnectionState = SdlConnectionState.SDL_DISCONNECTED; firstTimeFull = true; Boolean waitForInterfaceUnregistered = false; synchronized(CONNECTION_REFERENCE_LOCK) { if (sdlSession != null && sdlSession.getIsConnected() && getAppInterfaceRegistered()) { waitForInterfaceUnregistered = true; unregisterAppInterfacePrivate(UNREGISTER_APP_INTERFACE_CORRELATION_ID); } } if (waitForInterfaceUnregistered) { synchronized(APP_INTERFACE_REGISTERED_LOCK) { try { APP_INTERFACE_REGISTERED_LOCK.wait(3000); } catch (InterruptedException e) { } } } } if(rpcResponseListeners != null){ rpcResponseListeners.clear(); } if(rpcNotificationListeners != null){ rpcNotificationListeners.clear(); } synchronized(CONNECTION_REFERENCE_LOCK) { if (sdlSession != null) sdlSession.close(); } } catch (SdlException e) { throw e; } finally { SdlTrace.logProxyEvent("SdlProxy cleaned.", SDL_LIB_TRACE_KEY); } }
private void cleanproxy(sdldisconnectedreason disconnectedreason) throws sdlexception { try { if (_advancedlifecyclemanagementenabled) { _sdlconnectionstate = sdlconnectionstate.sdl_disconnected; firsttimefull = true; boolean waitforinterfaceunregistered = false; synchronized(connection_reference_lock) { if (sdlsession != null && sdlsession.getisconnected() && getappinterfaceregistered()) { waitforinterfaceunregistered = true; unregisterappinterfaceprivate(unregister_app_interface_correlation_id); } } if (waitforinterfaceunregistered) { synchronized(app_interface_registered_lock) { try { app_interface_registered_lock.wait(3000); } catch (interruptedexception e) { } } } } if(rpcresponselisteners != null){ rpcresponselisteners.clear(); } if(rpcnotificationlisteners != null){ rpcnotificationlisteners.clear(); } synchronized(connection_reference_lock) { if (sdlsession != null) sdlsession.close(); } } catch (sdlexception e) { throw e; } finally { sdltrace.logproxyevent("sdlproxy cleaned.", sdl_lib_trace_key); } }
iconcells/healthydrive
[ 1, 0, 0, 0 ]
16,985
@Test public void testQuayGithubPublishAlternateStructure() { systemExit.expectSystemExitWithStatus(Client.API_ERROR); Client.main(new String[] { "--config", ResourceHelpers.resourceFilePath("config_file.txt"), "tool", "publish", "--entry", "quay.io/dockstoretestuser/quayandgithubalternate", "--script" }); // TODO: change the tag tag locations of Dockerfile and Dockstore.cwl, now should be able to publish }
@Test public void testQuayGithubPublishAlternateStructure() { systemExit.expectSystemExitWithStatus(Client.API_ERROR); Client.main(new String[] { "--config", ResourceHelpers.resourceFilePath("config_file.txt"), "tool", "publish", "--entry", "quay.io/dockstoretestuser/quayandgithubalternate", "--script" }); }
@test public void testquaygithubpublishalternatestructure() { systemexit.expectsystemexitwithstatus(client.api_error); client.main(new string[] { "--config", resourcehelpers.resourcefilepath("config_file.txt"), "tool", "publish", "--entry", "quay.io/dockstoretestuser/quayandgithubalternate", "--script" }); }
garyluu/dockstore-cli
[ 0, 1, 0, 0 ]
16,986
@Test public void testQuayBitbucketPublishAlternateStructure() { systemExit.expectSystemExitWithStatus(Client.API_ERROR); Client.main(new String[] { "--config", ResourceHelpers.resourceFilePath("config_file.txt"), "tool", "publish", "--entry", "quay.io/dockstoretestuser/quayandbitbucketalternate", "--script" }); // TODO: change the tag tag locations of Dockerfile and Dockstore.cwl, now should be able to publish }
@Test public void testQuayBitbucketPublishAlternateStructure() { systemExit.expectSystemExitWithStatus(Client.API_ERROR); Client.main(new String[] { "--config", ResourceHelpers.resourceFilePath("config_file.txt"), "tool", "publish", "--entry", "quay.io/dockstoretestuser/quayandbitbucketalternate", "--script" }); }
@test public void testquaybitbucketpublishalternatestructure() { systemexit.expectsystemexitwithstatus(client.api_error); client.main(new string[] { "--config", resourcehelpers.resourcefilepath("config_file.txt"), "tool", "publish", "--entry", "quay.io/dockstoretestuser/quayandbitbucketalternate", "--script" }); }
garyluu/dockstore-cli
[ 0, 1, 0, 0 ]
16,991
@Test public void testRefreshingUserMetadata() { // Setup database // Refresh a tool Client.main(new String[] { "--config", ResourceHelpers.resourceFilePath("config_file.txt"), "tool", "refresh", "--entry", "quay.io/dockstoretestuser/quayandbitbucket", "--script" }); // Check that user has been updated // TODO: bizarrely, the new GitHub Java API library doesn't seem to handle bio //final long count = testingPostgres.runSelectStatement("select count(*) from enduser where location='Toronto' and bio='I am a test user'", long.class); final long count = testingPostgres.runSelectStatement("select count(*) from user_profile where location='Toronto'", long.class); Assert.assertEquals("One user should have this info now, there are " + count, 1, count); }
@Test public void testRefreshingUserMetadata() { Client.main(new String[] { "--config", ResourceHelpers.resourceFilePath("config_file.txt"), "tool", "refresh", "--entry", "quay.io/dockstoretestuser/quayandbitbucket", "--script" }); final long count = testingPostgres.runSelectStatement("select count(*) from user_profile where location='Toronto'", long.class); Assert.assertEquals("One user should have this info now, there are " + count, 1, count); }
@test public void testrefreshingusermetadata() { client.main(new string[] { "--config", resourcehelpers.resourcefilepath("config_file.txt"), "tool", "refresh", "--entry", "quay.io/dockstoretestuser/quayandbitbucket", "--script" }); final long count = testingpostgres.runselectstatement("select count(*) from user_profile where location='toronto'", long.class); assert.assertequals("one user should have this info now, there are " + count, 1, count); }
garyluu/dockstore-cli
[ 0, 0, 1, 0 ]
654
public void promptForOperatorCard(String message) throws IOException { framebuffer.draw((Graphics2D graphics) -> baseScreenLayout(graphics,"Insert Operator Card", message, Color.white) ); // TODO: Wait on the Operator Card instead framebuffer.pressEnter(); }
public void promptForOperatorCard(String message) throws IOException { framebuffer.draw((Graphics2D graphics) -> baseScreenLayout(graphics,"Insert Operator Card", message, Color.white) ); framebuffer.pressEnter(); }
public void promptforoperatorcard(string message) throws ioexception { framebuffer.draw((graphics2d graphics) -> basescreenlayout(graphics,"insert operator card", message, color.white) ); framebuffer.pressenter(); }
isabella232/subzero
[ 0, 1, 0, 0 ]
656
public void removeOperatorCard(String message) throws IOException { framebuffer.draw((Graphics2D graphics) -> baseScreenLayout(graphics,"Remove Operator Card", message, Color.white) ); // TODO: Wait on the Operator Card to be removed framebuffer.pressEnter(); renderLoading(); }
public void removeOperatorCard(String message) throws IOException { framebuffer.draw((Graphics2D graphics) -> baseScreenLayout(graphics,"Remove Operator Card", message, Color.white) ); framebuffer.pressEnter(); renderLoading(); }
public void removeoperatorcard(string message) throws ioexception { framebuffer.draw((graphics2d graphics) -> basescreenlayout(graphics,"remove operator card", message, color.white) ); framebuffer.pressenter(); renderloading(); }
isabella232/subzero
[ 0, 1, 0, 0 ]
33,435
@SuppressWarnings("unchecked") public static Map<String, Object> getElasticMapping(SearchableClassMapping scm) { Map<String, Object> elasticTypeMappingProperties = new LinkedHashMap<String, Object>(); String parentType = null; if (!scm.isAll()) { // "_all" : {"enabled" : true} elasticTypeMappingProperties.put("_all", Collections.singletonMap("enabled", false)); } // Map each domain properties in supported format, or object for complex type for(SearchableClassPropertyMapping scpm : scm.getPropertiesMapping()) { // Does it have custom mapping? GrailsDomainClassProperty property = scpm.getGrailsProperty(); String propType = property.getTypePropertyName(); Map<String, Object> propOptions = new LinkedHashMap<String, Object>(); // Add the custom mapping (searchable static property in domain model) propOptions.putAll(scpm.getAttributes()); if (!(SUPPORTED_FORMAT.contains(propType))) { LOG.debug("propType not supported: " + propType + " name: " + property.getName()); if (scpm.isGeoPoint()) { propType = "geo_point"; } else if (property.isBasicCollectionType()) { // Handle embedded persistent collections, ie List<String> listOfThings String basicType = ClassUtils.getShortName(property.getReferencedPropertyType()).toLowerCase(Locale.ENGLISH); if (SUPPORTED_FORMAT.contains(basicType)) { propType = basicType; } // Handle arrays } else if (property.getReferencedPropertyType().isArray()) { String basicType = ClassUtils.getShortName(property.getReferencedPropertyType().getComponentType()).toLowerCase(Locale.ENGLISH); if (SUPPORTED_FORMAT.contains(basicType)) { propType = basicType; } } else if (isDateType(property.getReferencedPropertyType())) { propType = "date"; } else if (GrailsClassUtils.isJdk5Enum(property.getReferencedPropertyType())) { propType = "string"; } else if (scpm.getConverter() != null) { // Use 'string' type for properties with custom converter. // Arrays are automatically resolved by ElasticSearch, so no worries. propType = "string"; } else if (java.math.BigDecimal.class.isAssignableFrom(property.getReferencedPropertyType())) { propType = "double"; } else { // todo should this be string?? propType = "object"; } if (scpm.getReference() != null) { propType = "object"; // fixme: think about composite ids. } else if (scpm.isComponent()) { // Proceed with nested mapping. // todo limit depth to avoid endless recursion? propType = "object"; //noinspection unchecked propOptions.putAll((Map<String, Object>) (getElasticMapping(scpm.getComponentPropertyMapping()).values().iterator().next())); } // Once it is an object, we need to add id & class mappings, otherwise // ES will fail with NullPointer. if (scpm.isComponent() || scpm.getReference() != null) { Map<String, Object> props = (Map<String, Object>) propOptions.get("properties"); if (props == null) { props = new LinkedHashMap<String, Object>(); propOptions.put("properties", props); } props.put("id", defaultDescriptor("long", "not_analyzed", true)); props.put("class", defaultDescriptor("string", "no", true)); props.put("ref", defaultDescriptor("string", "no", true)); } if (scpm.isParentKey()) { parentType = property.getTypePropertyName(); scm.setParent(scpm); } } else if (scpm.isGeoPoint()) { propType = "geo_point"; } propOptions.put("type", propType); // See http://www.elasticsearch.com/docs/elasticsearch/mapping/all_field/ if (!propType.equals("object") && scm.isAll()) { // does it make sense to include objects into _all? if (scpm.shouldExcludeFromAll()) { propOptions.put("include_in_all", false); } else { propOptions.put("include_in_all", true); } } // todo only enable this through configuration... if (propType.equals("string") && scpm.isAnalyzed()) { propOptions.put("term_vector", "with_positions_offsets"); } elasticTypeMappingProperties.put(scpm.getPropertyName(), propOptions); } Map<String, Object> mapping = new LinkedHashMap<String, Object>(); Map<String, Object> objectMapping = new LinkedHashMap<String, Object>(); if (parentType != null) { objectMapping.put("_parent", Collections.singletonMap("type", parentType)); } objectMapping.put("properties", elasticTypeMappingProperties); mapping.put(scm.getElasticTypeName(), objectMapping); return mapping; }
@SuppressWarnings("unchecked") public static Map<String, Object> getElasticMapping(SearchableClassMapping scm) { Map<String, Object> elasticTypeMappingProperties = new LinkedHashMap<String, Object>(); String parentType = null; if (!scm.isAll()) { elasticTypeMappingProperties.put("_all", Collections.singletonMap("enabled", false)); } for(SearchableClassPropertyMapping scpm : scm.getPropertiesMapping()) { GrailsDomainClassProperty property = scpm.getGrailsProperty(); String propType = property.getTypePropertyName(); Map<String, Object> propOptions = new LinkedHashMap<String, Object>(); propOptions.putAll(scpm.getAttributes()); if (!(SUPPORTED_FORMAT.contains(propType))) { LOG.debug("propType not supported: " + propType + " name: " + property.getName()); if (scpm.isGeoPoint()) { propType = "geo_point"; } else if (property.isBasicCollectionType()) { String basicType = ClassUtils.getShortName(property.getReferencedPropertyType()).toLowerCase(Locale.ENGLISH); if (SUPPORTED_FORMAT.contains(basicType)) { propType = basicType; } } else if (property.getReferencedPropertyType().isArray()) { String basicType = ClassUtils.getShortName(property.getReferencedPropertyType().getComponentType()).toLowerCase(Locale.ENGLISH); if (SUPPORTED_FORMAT.contains(basicType)) { propType = basicType; } } else if (isDateType(property.getReferencedPropertyType())) { propType = "date"; } else if (GrailsClassUtils.isJdk5Enum(property.getReferencedPropertyType())) { propType = "string"; } else if (scpm.getConverter() != null) { propType = "string"; } else if (java.math.BigDecimal.class.isAssignableFrom(property.getReferencedPropertyType())) { propType = "double"; } else { propType = "object"; } if (scpm.getReference() != null) { propType = "object"; } else if (scpm.isComponent()) { propType = "object"; propOptions.putAll((Map<String, Object>) (getElasticMapping(scpm.getComponentPropertyMapping()).values().iterator().next())); } if (scpm.isComponent() || scpm.getReference() != null) { Map<String, Object> props = (Map<String, Object>) propOptions.get("properties"); if (props == null) { props = new LinkedHashMap<String, Object>(); propOptions.put("properties", props); } props.put("id", defaultDescriptor("long", "not_analyzed", true)); props.put("class", defaultDescriptor("string", "no", true)); props.put("ref", defaultDescriptor("string", "no", true)); } if (scpm.isParentKey()) { parentType = property.getTypePropertyName(); scm.setParent(scpm); } } else if (scpm.isGeoPoint()) { propType = "geo_point"; } propOptions.put("type", propType); if (!propType.equals("object") && scm.isAll()) { if (scpm.shouldExcludeFromAll()) { propOptions.put("include_in_all", false); } else { propOptions.put("include_in_all", true); } } if (propType.equals("string") && scpm.isAnalyzed()) { propOptions.put("term_vector", "with_positions_offsets"); } elasticTypeMappingProperties.put(scpm.getPropertyName(), propOptions); } Map<String, Object> mapping = new LinkedHashMap<String, Object>(); Map<String, Object> objectMapping = new LinkedHashMap<String, Object>(); if (parentType != null) { objectMapping.put("_parent", Collections.singletonMap("type", parentType)); } objectMapping.put("properties", elasticTypeMappingProperties); mapping.put(scm.getElasticTypeName(), objectMapping); return mapping; }
@suppresswarnings("unchecked") public static map<string, object> getelasticmapping(searchableclassmapping scm) { map<string, object> elastictypemappingproperties = new linkedhashmap<string, object>(); string parenttype = null; if (!scm.isall()) { elastictypemappingproperties.put("_all", collections.singletonmap("enabled", false)); } for(searchableclasspropertymapping scpm : scm.getpropertiesmapping()) { grailsdomainclassproperty property = scpm.getgrailsproperty(); string proptype = property.gettypepropertyname(); map<string, object> propoptions = new linkedhashmap<string, object>(); propoptions.putall(scpm.getattributes()); if (!(supported_format.contains(proptype))) { log.debug("proptype not supported: " + proptype + " name: " + property.getname()); if (scpm.isgeopoint()) { proptype = "geo_point"; } else if (property.isbasiccollectiontype()) { string basictype = classutils.getshortname(property.getreferencedpropertytype()).tolowercase(locale.english); if (supported_format.contains(basictype)) { proptype = basictype; } } else if (property.getreferencedpropertytype().isarray()) { string basictype = classutils.getshortname(property.getreferencedpropertytype().getcomponenttype()).tolowercase(locale.english); if (supported_format.contains(basictype)) { proptype = basictype; } } else if (isdatetype(property.getreferencedpropertytype())) { proptype = "date"; } else if (grailsclassutils.isjdk5enum(property.getreferencedpropertytype())) { proptype = "string"; } else if (scpm.getconverter() != null) { proptype = "string"; } else if (java.math.bigdecimal.class.isassignablefrom(property.getreferencedpropertytype())) { proptype = "double"; } else { proptype = "object"; } if (scpm.getreference() != null) { proptype = "object"; } else if (scpm.iscomponent()) { proptype = "object"; propoptions.putall((map<string, object>) (getelasticmapping(scpm.getcomponentpropertymapping()).values().iterator().next())); } if (scpm.iscomponent() || scpm.getreference() != null) { map<string, object> props = (map<string, object>) propoptions.get("properties"); if (props == null) { props = new linkedhashmap<string, object>(); propoptions.put("properties", props); } props.put("id", defaultdescriptor("long", "not_analyzed", true)); props.put("class", defaultdescriptor("string", "no", true)); props.put("ref", defaultdescriptor("string", "no", true)); } if (scpm.isparentkey()) { parenttype = property.gettypepropertyname(); scm.setparent(scpm); } } else if (scpm.isgeopoint()) { proptype = "geo_point"; } propoptions.put("type", proptype); if (!proptype.equals("object") && scm.isall()) { if (scpm.shouldexcludefromall()) { propoptions.put("include_in_all", false); } else { propoptions.put("include_in_all", true); } } if (proptype.equals("string") && scpm.isanalyzed()) { propoptions.put("term_vector", "with_positions_offsets"); } elastictypemappingproperties.put(scpm.getpropertyname(), propoptions); } map<string, object> mapping = new linkedhashmap<string, object>(); map<string, object> objectmapping = new linkedhashmap<string, object>(); if (parenttype != null) { objectmapping.put("_parent", collections.singletonmap("type", parenttype)); } objectmapping.put("properties", elastictypemappingproperties); mapping.put(scm.getelastictypename(), objectmapping); return mapping; }
iGivefirst/elasticsearch-grails-plugin
[ 1, 1, 0, 1 ]
25,248
public static HistogramChart fromData(Iterable<? extends Vector> data, int numBuckets) { // Do a pass to compute range double min = Double.MAX_VALUE, max = Double.MIN_VALUE; ArrayList<Double> copy = new ArrayList(); for (Vector datum : data) { double x = datum.get(0); copy.add(x); min = Math.min(min, x); max = Math.max(max, x); } // TODO: Check min and max are sensible? double[] array = MathUtils.toArray(copy); // TODO: Allow the num of buckets to be specified HistogramData dist = new HistogramData(new GridInfo(min, max, numBuckets)); for (int i = 0; i < array.length; i++) { dist.count(array[i]); } return new HistogramChart(dist); }
public static HistogramChart fromData(Iterable<? extends Vector> data, int numBuckets) { double min = Double.MAX_VALUE, max = Double.MIN_VALUE; ArrayList<Double> copy = new ArrayList(); for (Vector datum : data) { double x = datum.get(0); copy.add(x); min = Math.min(min, x); max = Math.max(max, x); } double[] array = MathUtils.toArray(copy); HistogramData dist = new HistogramData(new GridInfo(min, max, numBuckets)); for (int i = 0; i < array.length; i++) { dist.count(array[i]); } return new HistogramChart(dist); }
public static histogramchart fromdata(iterable<? extends vector> data, int numbuckets) { double min = double.max_value, max = double.min_value; arraylist<double> copy = new arraylist(); for (vector datum : data) { double x = datum.get(0); copy.add(x); min = math.min(min, x); max = math.max(max, x); } double[] array = mathutils.toarray(copy); histogramdata dist = new histogramdata(new gridinfo(min, max, numbuckets)); for (int i = 0; i < array.length; i++) { dist.count(array[i]); } return new histogramchart(dist); }
good-loop/open-code
[ 0, 1, 0, 0 ]
17,078
public int getActualMaximum(int field) { final int fieldsForFixedMax = ERA_MASK|DAY_OF_WEEK_MASK|HOUR_MASK|AM_PM_MASK| HOUR_OF_DAY_MASK|MINUTE_MASK|SECOND_MASK|MILLISECOND_MASK| ZONE_OFFSET_MASK|DST_OFFSET_MASK; if ((fieldsForFixedMax & (1<<field)) != 0) { return getMaximum(field); } JapaneseImperialCalendar jc = getNormalizedCalendar(); LocalGregorianCalendar.Date date = jc.jdate; int normalizedYear = date.getNormalizedYear(); int value = -1; switch (field) { case MONTH: { value = DECEMBER; if (isTransitionYear(date.getNormalizedYear())) { // TODO: there may be multiple transitions in a year. int eraIndex = getEraIndex(date); if (date.getYear() != 1) { eraIndex++; assert eraIndex < eras.length; } long transition = sinceFixedDates[eraIndex]; long fd = jc.cachedFixedDate; if (fd < transition) { LocalGregorianCalendar.Date ldate = (LocalGregorianCalendar.Date) date.clone(); jcal.getCalendarDateFromFixedDate(ldate, transition - 1); value = ldate.getMonth() - 1; } } else { LocalGregorianCalendar.Date d = jcal.getCalendarDate(Long.MAX_VALUE, getZone()); if (date.getEra() == d.getEra() && date.getYear() == d.getYear()) { value = d.getMonth() - 1; } } } break; case DAY_OF_MONTH: value = jcal.getMonthLength(date); break; case DAY_OF_YEAR: { if (isTransitionYear(date.getNormalizedYear())) { // Handle transition year. // TODO: there may be multiple transitions in a year. int eraIndex = getEraIndex(date); if (date.getYear() != 1) { eraIndex++; assert eraIndex < eras.length; } long transition = sinceFixedDates[eraIndex]; long fd = jc.cachedFixedDate; CalendarDate d = gcal.newCalendarDate(TimeZone.NO_TIMEZONE); d.setDate(date.getNormalizedYear(), BaseCalendar.JANUARY, 1); if (fd < transition) { value = (int)(transition - gcal.getFixedDate(d)); } else { d.addYear(+1); value = (int)(gcal.getFixedDate(d) - transition); } } else { LocalGregorianCalendar.Date d = jcal.getCalendarDate(Long.MAX_VALUE, getZone()); if (date.getEra() == d.getEra() && date.getYear() == d.getYear()) { long fd = jcal.getFixedDate(d); long jan1 = getFixedDateJan1(d, fd); value = (int)(fd - jan1) + 1; } else if (date.getYear() == getMinimum(YEAR)) { CalendarDate d1 = jcal.getCalendarDate(Long.MIN_VALUE, getZone()); long fd1 = jcal.getFixedDate(d1); d1.addYear(1); d1.setMonth(BaseCalendar.JANUARY).setDayOfMonth(1); jcal.normalize(d1); long fd2 = jcal.getFixedDate(d1); value = (int)(fd2 - fd1); } else { value = jcal.getYearLength(date); } } } break; case WEEK_OF_YEAR: { if (!isTransitionYear(date.getNormalizedYear())) { LocalGregorianCalendar.Date jd = jcal.getCalendarDate(Long.MAX_VALUE, getZone()); if (date.getEra() == jd.getEra() && date.getYear() == jd.getYear()) { long fd = jcal.getFixedDate(jd); long jan1 = getFixedDateJan1(jd, fd); value = getWeekNumber(jan1, fd); } else if (date.getEra() == null && date.getYear() == getMinimum(YEAR)) { CalendarDate d = jcal.getCalendarDate(Long.MIN_VALUE, getZone()); // shift 400 years to avoid underflow d.addYear(+400); jcal.normalize(d); jd.setEra(d.getEra()); jd.setDate(d.getYear() + 1, BaseCalendar.JANUARY, 1); jcal.normalize(jd); long jan1 = jcal.getFixedDate(d); long nextJan1 = jcal.getFixedDate(jd); long nextJan1st = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(nextJan1 + 6, getFirstDayOfWeek()); int ndays = (int)(nextJan1st - nextJan1); if (ndays >= getMinimalDaysInFirstWeek()) { nextJan1st -= 7; } value = getWeekNumber(jan1, nextJan1st); } else { // Get the day of week of January 1 of the year CalendarDate d = gcal.newCalendarDate(TimeZone.NO_TIMEZONE); d.setDate(date.getNormalizedYear(), BaseCalendar.JANUARY, 1); int dayOfWeek = gcal.getDayOfWeek(d); // Normalize the day of week with the firstDayOfWeek value dayOfWeek -= getFirstDayOfWeek(); if (dayOfWeek < 0) { dayOfWeek += 7; } value = 52; int magic = dayOfWeek + getMinimalDaysInFirstWeek() - 1; if ((magic == 6) || (date.isLeapYear() && (magic == 5 || magic == 12))) { value++; } } break; } if (jc == this) { jc = (JapaneseImperialCalendar) jc.clone(); } int max = getActualMaximum(DAY_OF_YEAR); jc.set(DAY_OF_YEAR, max); value = jc.get(WEEK_OF_YEAR); if (value == 1 && max > 7) { jc.add(WEEK_OF_YEAR, -1); value = jc.get(WEEK_OF_YEAR); } } break; case WEEK_OF_MONTH: { LocalGregorianCalendar.Date jd = jcal.getCalendarDate(Long.MAX_VALUE, getZone()); if (!(date.getEra() == jd.getEra() && date.getYear() == jd.getYear())) { CalendarDate d = gcal.newCalendarDate(TimeZone.NO_TIMEZONE); d.setDate(date.getNormalizedYear(), date.getMonth(), 1); int dayOfWeek = gcal.getDayOfWeek(d); int monthLength = gcal.getMonthLength(d); dayOfWeek -= getFirstDayOfWeek(); if (dayOfWeek < 0) { dayOfWeek += 7; } int nDaysFirstWeek = 7 - dayOfWeek; // # of days in the first week value = 3; if (nDaysFirstWeek >= getMinimalDaysInFirstWeek()) { value++; } monthLength -= nDaysFirstWeek + 7 * 3; if (monthLength > 0) { value++; if (monthLength > 7) { value++; } } } else { long fd = jcal.getFixedDate(jd); long month1 = fd - jd.getDayOfMonth() + 1; value = getWeekNumber(month1, fd); } } break; case DAY_OF_WEEK_IN_MONTH: { int ndays, dow1; int dow = date.getDayOfWeek(); BaseCalendar.Date d = (BaseCalendar.Date) date.clone(); ndays = jcal.getMonthLength(d); d.setDayOfMonth(1); jcal.normalize(d); dow1 = d.getDayOfWeek(); int x = dow - dow1; if (x < 0) { x += 7; } ndays -= x; value = (ndays + 6) / 7; } break; case YEAR: { CalendarDate jd = jcal.getCalendarDate(jc.getTimeInMillis(), getZone()); CalendarDate d; int eraIndex = getEraIndex(date); if (eraIndex == eras.length - 1) { d = jcal.getCalendarDate(Long.MAX_VALUE, getZone()); value = d.getYear(); // Use an equivalent year for the // getYearOffsetInMillis call to avoid overflow. if (value > 400) { jd.setYear(value - 400); } } else { d = jcal.getCalendarDate(eras[eraIndex + 1].getSince(getZone()) - 1, getZone()); value = d.getYear(); // Use the same year as d.getYear() to be // consistent with leap and common years. jd.setYear(value); } jcal.normalize(jd); if (getYearOffsetInMillis(jd) > getYearOffsetInMillis(d)) { value--; } } break; default: throw new ArrayIndexOutOfBoundsException(field); } return value; }
public int getActualMaximum(int field) { final int fieldsForFixedMax = ERA_MASK|DAY_OF_WEEK_MASK|HOUR_MASK|AM_PM_MASK| HOUR_OF_DAY_MASK|MINUTE_MASK|SECOND_MASK|MILLISECOND_MASK| ZONE_OFFSET_MASK|DST_OFFSET_MASK; if ((fieldsForFixedMax & (1<<field)) != 0) { return getMaximum(field); } JapaneseImperialCalendar jc = getNormalizedCalendar(); LocalGregorianCalendar.Date date = jc.jdate; int normalizedYear = date.getNormalizedYear(); int value = -1; switch (field) { case MONTH: { value = DECEMBER; if (isTransitionYear(date.getNormalizedYear())) { int eraIndex = getEraIndex(date); if (date.getYear() != 1) { eraIndex++; assert eraIndex < eras.length; } long transition = sinceFixedDates[eraIndex]; long fd = jc.cachedFixedDate; if (fd < transition) { LocalGregorianCalendar.Date ldate = (LocalGregorianCalendar.Date) date.clone(); jcal.getCalendarDateFromFixedDate(ldate, transition - 1); value = ldate.getMonth() - 1; } } else { LocalGregorianCalendar.Date d = jcal.getCalendarDate(Long.MAX_VALUE, getZone()); if (date.getEra() == d.getEra() && date.getYear() == d.getYear()) { value = d.getMonth() - 1; } } } break; case DAY_OF_MONTH: value = jcal.getMonthLength(date); break; case DAY_OF_YEAR: { if (isTransitionYear(date.getNormalizedYear())) { int eraIndex = getEraIndex(date); if (date.getYear() != 1) { eraIndex++; assert eraIndex < eras.length; } long transition = sinceFixedDates[eraIndex]; long fd = jc.cachedFixedDate; CalendarDate d = gcal.newCalendarDate(TimeZone.NO_TIMEZONE); d.setDate(date.getNormalizedYear(), BaseCalendar.JANUARY, 1); if (fd < transition) { value = (int)(transition - gcal.getFixedDate(d)); } else { d.addYear(+1); value = (int)(gcal.getFixedDate(d) - transition); } } else { LocalGregorianCalendar.Date d = jcal.getCalendarDate(Long.MAX_VALUE, getZone()); if (date.getEra() == d.getEra() && date.getYear() == d.getYear()) { long fd = jcal.getFixedDate(d); long jan1 = getFixedDateJan1(d, fd); value = (int)(fd - jan1) + 1; } else if (date.getYear() == getMinimum(YEAR)) { CalendarDate d1 = jcal.getCalendarDate(Long.MIN_VALUE, getZone()); long fd1 = jcal.getFixedDate(d1); d1.addYear(1); d1.setMonth(BaseCalendar.JANUARY).setDayOfMonth(1); jcal.normalize(d1); long fd2 = jcal.getFixedDate(d1); value = (int)(fd2 - fd1); } else { value = jcal.getYearLength(date); } } } break; case WEEK_OF_YEAR: { if (!isTransitionYear(date.getNormalizedYear())) { LocalGregorianCalendar.Date jd = jcal.getCalendarDate(Long.MAX_VALUE, getZone()); if (date.getEra() == jd.getEra() && date.getYear() == jd.getYear()) { long fd = jcal.getFixedDate(jd); long jan1 = getFixedDateJan1(jd, fd); value = getWeekNumber(jan1, fd); } else if (date.getEra() == null && date.getYear() == getMinimum(YEAR)) { CalendarDate d = jcal.getCalendarDate(Long.MIN_VALUE, getZone()); d.addYear(+400); jcal.normalize(d); jd.setEra(d.getEra()); jd.setDate(d.getYear() + 1, BaseCalendar.JANUARY, 1); jcal.normalize(jd); long jan1 = jcal.getFixedDate(d); long nextJan1 = jcal.getFixedDate(jd); long nextJan1st = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(nextJan1 + 6, getFirstDayOfWeek()); int ndays = (int)(nextJan1st - nextJan1); if (ndays >= getMinimalDaysInFirstWeek()) { nextJan1st -= 7; } value = getWeekNumber(jan1, nextJan1st); } else { CalendarDate d = gcal.newCalendarDate(TimeZone.NO_TIMEZONE); d.setDate(date.getNormalizedYear(), BaseCalendar.JANUARY, 1); int dayOfWeek = gcal.getDayOfWeek(d); dayOfWeek -= getFirstDayOfWeek(); if (dayOfWeek < 0) { dayOfWeek += 7; } value = 52; int magic = dayOfWeek + getMinimalDaysInFirstWeek() - 1; if ((magic == 6) || (date.isLeapYear() && (magic == 5 || magic == 12))) { value++; } } break; } if (jc == this) { jc = (JapaneseImperialCalendar) jc.clone(); } int max = getActualMaximum(DAY_OF_YEAR); jc.set(DAY_OF_YEAR, max); value = jc.get(WEEK_OF_YEAR); if (value == 1 && max > 7) { jc.add(WEEK_OF_YEAR, -1); value = jc.get(WEEK_OF_YEAR); } } break; case WEEK_OF_MONTH: { LocalGregorianCalendar.Date jd = jcal.getCalendarDate(Long.MAX_VALUE, getZone()); if (!(date.getEra() == jd.getEra() && date.getYear() == jd.getYear())) { CalendarDate d = gcal.newCalendarDate(TimeZone.NO_TIMEZONE); d.setDate(date.getNormalizedYear(), date.getMonth(), 1); int dayOfWeek = gcal.getDayOfWeek(d); int monthLength = gcal.getMonthLength(d); dayOfWeek -= getFirstDayOfWeek(); if (dayOfWeek < 0) { dayOfWeek += 7; } int nDaysFirstWeek = 7 - dayOfWeek; value = 3; if (nDaysFirstWeek >= getMinimalDaysInFirstWeek()) { value++; } monthLength -= nDaysFirstWeek + 7 * 3; if (monthLength > 0) { value++; if (monthLength > 7) { value++; } } } else { long fd = jcal.getFixedDate(jd); long month1 = fd - jd.getDayOfMonth() + 1; value = getWeekNumber(month1, fd); } } break; case DAY_OF_WEEK_IN_MONTH: { int ndays, dow1; int dow = date.getDayOfWeek(); BaseCalendar.Date d = (BaseCalendar.Date) date.clone(); ndays = jcal.getMonthLength(d); d.setDayOfMonth(1); jcal.normalize(d); dow1 = d.getDayOfWeek(); int x = dow - dow1; if (x < 0) { x += 7; } ndays -= x; value = (ndays + 6) / 7; } break; case YEAR: { CalendarDate jd = jcal.getCalendarDate(jc.getTimeInMillis(), getZone()); CalendarDate d; int eraIndex = getEraIndex(date); if (eraIndex == eras.length - 1) { d = jcal.getCalendarDate(Long.MAX_VALUE, getZone()); value = d.getYear(); if (value > 400) { jd.setYear(value - 400); } } else { d = jcal.getCalendarDate(eras[eraIndex + 1].getSince(getZone()) - 1, getZone()); value = d.getYear(); jd.setYear(value); } jcal.normalize(jd); if (getYearOffsetInMillis(jd) > getYearOffsetInMillis(d)) { value--; } } break; default: throw new ArrayIndexOutOfBoundsException(field); } return value; }
public int getactualmaximum(int field) { final int fieldsforfixedmax = era_mask|day_of_week_mask|hour_mask|am_pm_mask| hour_of_day_mask|minute_mask|second_mask|millisecond_mask| zone_offset_mask|dst_offset_mask; if ((fieldsforfixedmax & (1<<field)) != 0) { return getmaximum(field); } japaneseimperialcalendar jc = getnormalizedcalendar(); localgregoriancalendar.date date = jc.jdate; int normalizedyear = date.getnormalizedyear(); int value = -1; switch (field) { case month: { value = december; if (istransitionyear(date.getnormalizedyear())) { int eraindex = geteraindex(date); if (date.getyear() != 1) { eraindex++; assert eraindex < eras.length; } long transition = sincefixeddates[eraindex]; long fd = jc.cachedfixeddate; if (fd < transition) { localgregoriancalendar.date ldate = (localgregoriancalendar.date) date.clone(); jcal.getcalendardatefromfixeddate(ldate, transition - 1); value = ldate.getmonth() - 1; } } else { localgregoriancalendar.date d = jcal.getcalendardate(long.max_value, getzone()); if (date.getera() == d.getera() && date.getyear() == d.getyear()) { value = d.getmonth() - 1; } } } break; case day_of_month: value = jcal.getmonthlength(date); break; case day_of_year: { if (istransitionyear(date.getnormalizedyear())) { int eraindex = geteraindex(date); if (date.getyear() != 1) { eraindex++; assert eraindex < eras.length; } long transition = sincefixeddates[eraindex]; long fd = jc.cachedfixeddate; calendardate d = gcal.newcalendardate(timezone.no_timezone); d.setdate(date.getnormalizedyear(), basecalendar.january, 1); if (fd < transition) { value = (int)(transition - gcal.getfixeddate(d)); } else { d.addyear(+1); value = (int)(gcal.getfixeddate(d) - transition); } } else { localgregoriancalendar.date d = jcal.getcalendardate(long.max_value, getzone()); if (date.getera() == d.getera() && date.getyear() == d.getyear()) { long fd = jcal.getfixeddate(d); long jan1 = getfixeddatejan1(d, fd); value = (int)(fd - jan1) + 1; } else if (date.getyear() == getminimum(year)) { calendardate d1 = jcal.getcalendardate(long.min_value, getzone()); long fd1 = jcal.getfixeddate(d1); d1.addyear(1); d1.setmonth(basecalendar.january).setdayofmonth(1); jcal.normalize(d1); long fd2 = jcal.getfixeddate(d1); value = (int)(fd2 - fd1); } else { value = jcal.getyearlength(date); } } } break; case week_of_year: { if (!istransitionyear(date.getnormalizedyear())) { localgregoriancalendar.date jd = jcal.getcalendardate(long.max_value, getzone()); if (date.getera() == jd.getera() && date.getyear() == jd.getyear()) { long fd = jcal.getfixeddate(jd); long jan1 = getfixeddatejan1(jd, fd); value = getweeknumber(jan1, fd); } else if (date.getera() == null && date.getyear() == getminimum(year)) { calendardate d = jcal.getcalendardate(long.min_value, getzone()); d.addyear(+400); jcal.normalize(d); jd.setera(d.getera()); jd.setdate(d.getyear() + 1, basecalendar.january, 1); jcal.normalize(jd); long jan1 = jcal.getfixeddate(d); long nextjan1 = jcal.getfixeddate(jd); long nextjan1st = localgregoriancalendar.getdayofweekdateonorbefore(nextjan1 + 6, getfirstdayofweek()); int ndays = (int)(nextjan1st - nextjan1); if (ndays >= getminimaldaysinfirstweek()) { nextjan1st -= 7; } value = getweeknumber(jan1, nextjan1st); } else { calendardate d = gcal.newcalendardate(timezone.no_timezone); d.setdate(date.getnormalizedyear(), basecalendar.january, 1); int dayofweek = gcal.getdayofweek(d); dayofweek -= getfirstdayofweek(); if (dayofweek < 0) { dayofweek += 7; } value = 52; int magic = dayofweek + getminimaldaysinfirstweek() - 1; if ((magic == 6) || (date.isleapyear() && (magic == 5 || magic == 12))) { value++; } } break; } if (jc == this) { jc = (japaneseimperialcalendar) jc.clone(); } int max = getactualmaximum(day_of_year); jc.set(day_of_year, max); value = jc.get(week_of_year); if (value == 1 && max > 7) { jc.add(week_of_year, -1); value = jc.get(week_of_year); } } break; case week_of_month: { localgregoriancalendar.date jd = jcal.getcalendardate(long.max_value, getzone()); if (!(date.getera() == jd.getera() && date.getyear() == jd.getyear())) { calendardate d = gcal.newcalendardate(timezone.no_timezone); d.setdate(date.getnormalizedyear(), date.getmonth(), 1); int dayofweek = gcal.getdayofweek(d); int monthlength = gcal.getmonthlength(d); dayofweek -= getfirstdayofweek(); if (dayofweek < 0) { dayofweek += 7; } int ndaysfirstweek = 7 - dayofweek; value = 3; if (ndaysfirstweek >= getminimaldaysinfirstweek()) { value++; } monthlength -= ndaysfirstweek + 7 * 3; if (monthlength > 0) { value++; if (monthlength > 7) { value++; } } } else { long fd = jcal.getfixeddate(jd); long month1 = fd - jd.getdayofmonth() + 1; value = getweeknumber(month1, fd); } } break; case day_of_week_in_month: { int ndays, dow1; int dow = date.getdayofweek(); basecalendar.date d = (basecalendar.date) date.clone(); ndays = jcal.getmonthlength(d); d.setdayofmonth(1); jcal.normalize(d); dow1 = d.getdayofweek(); int x = dow - dow1; if (x < 0) { x += 7; } ndays -= x; value = (ndays + 6) / 7; } break; case year: { calendardate jd = jcal.getcalendardate(jc.gettimeinmillis(), getzone()); calendardate d; int eraindex = geteraindex(date); if (eraindex == eras.length - 1) { d = jcal.getcalendardate(long.max_value, getzone()); value = d.getyear(); if (value > 400) { jd.setyear(value - 400); } } else { d = jcal.getcalendardate(eras[eraindex + 1].getsince(getzone()) - 1, getzone()); value = d.getyear(); jd.setyear(value); } jcal.normalize(jd); if (getyearoffsetinmillis(jd) > getyearoffsetinmillis(d)) { value--; } } break; default: throw new arrayindexoutofboundsexception(field); } return value; }
joeriddles/doclitify
[ 0, 1, 0, 0 ]
752
public JobState getJobStatus(MonitorID monitorID) throws SSHApiException { String jobID = monitorID.getJobID(); //todo so currently we execute the qstat for each job but we can use user based monitoring //todo or we should concatenate all the commands and execute them in one go and parse the response return getStatusFromString(cluster.getJobStatus(jobID).toString()); }
public JobState getJobStatus(MonitorID monitorID) throws SSHApiException { String jobID = monitorID.getJobID(); return getStatusFromString(cluster.getJobStatus(jobID).toString()); }
public jobstate getjobstatus(monitorid monitorid) throws sshapiexception { string jobid = monitorid.getjobid(); return getstatusfromstring(cluster.getjobstatus(jobid).tostring()); }
glahiru/airavata-1
[ 1, 0, 0, 0 ]
17,350
@Override protected void removeFSWindowListener(Window w) { realFSWindow.removeWindowListener(fsWindowListener); fsWindowListener = null; /** * Bug 4933099: There is some funny-business to deal with when this * method is called with a Window instead of a Frame. See 4836744 * for more information on this. One side-effect of our workaround * for the problem is that the owning Frame of a Window may end * up getting resized during the fullscreen process. When we * return from fullscreen mode, we should resize the Frame to * its original size (just like the Window is being resized * to its original size in GraphicsDevice). */ final WWindowPeer wpeer = AWTAccessor.getComponentAccessor() .getPeer(realFSWindow); if (wpeer != null) { if (ownerOrigBounds != null) { // if the window went into fs mode before it was realized it // could have (0,0) dimensions if (ownerOrigBounds.width == 0) ownerOrigBounds.width = 1; if (ownerOrigBounds.height == 0) ownerOrigBounds.height = 1; wpeer.reshape(ownerOrigBounds.x, ownerOrigBounds.y, ownerOrigBounds.width, ownerOrigBounds.height); if (!ownerWasVisible) { wpeer.setVisible(false); } ownerOrigBounds = null; } if (!fsWindowWasAlwaysOnTop) { wpeer.setAlwaysOnTop(false); } } realFSWindow = null; }
@Override protected void removeFSWindowListener(Window w) { realFSWindow.removeWindowListener(fsWindowListener); fsWindowListener = null; final WWindowPeer wpeer = AWTAccessor.getComponentAccessor() .getPeer(realFSWindow); if (wpeer != null) { if (ownerOrigBounds != null) { if (ownerOrigBounds.width == 0) ownerOrigBounds.width = 1; if (ownerOrigBounds.height == 0) ownerOrigBounds.height = 1; wpeer.reshape(ownerOrigBounds.x, ownerOrigBounds.y, ownerOrigBounds.width, ownerOrigBounds.height); if (!ownerWasVisible) { wpeer.setVisible(false); } ownerOrigBounds = null; } if (!fsWindowWasAlwaysOnTop) { wpeer.setAlwaysOnTop(false); } } realFSWindow = null; }
@override protected void removefswindowlistener(window w) { realfswindow.removewindowlistener(fswindowlistener); fswindowlistener = null; final wwindowpeer wpeer = awtaccessor.getcomponentaccessor() .getpeer(realfswindow); if (wpeer != null) { if (ownerorigbounds != null) { if (ownerorigbounds.width == 0) ownerorigbounds.width = 1; if (ownerorigbounds.height == 0) ownerorigbounds.height = 1; wpeer.reshape(ownerorigbounds.x, ownerorigbounds.y, ownerorigbounds.width, ownerorigbounds.height); if (!ownerwasvisible) { wpeer.setvisible(false); } ownerorigbounds = null; } if (!fswindowwasalwaysontop) { wpeer.setalwaysontop(false); } } realfswindow = null; }
jaylinhong/jdk14-learn
[ 0, 0, 1, 0 ]
991
private Node initRaftNode() throws IOException { NodeOptions nodeOptions = this.context.nodeOptions(); nodeOptions.setFsm(this.stateMachine); // TODO: When support sharding, groupId needs to be bound to shard Id String groupId = this.context.group(); PeerId endpoint = this.context.endpoint(); /* * Start raft node with shared rpc server: * return new RaftGroupService(groupId, endpoint, nodeOptions, * this.context.rpcServer(), true) * .start(false) */ return RaftServiceFactory.createAndInitRaftNode(groupId, endpoint, nodeOptions); }
private Node initRaftNode() throws IOException { NodeOptions nodeOptions = this.context.nodeOptions(); nodeOptions.setFsm(this.stateMachine); String groupId = this.context.group(); PeerId endpoint = this.context.endpoint(); return RaftServiceFactory.createAndInitRaftNode(groupId, endpoint, nodeOptions); }
private node initraftnode() throws ioexception { nodeoptions nodeoptions = this.context.nodeoptions(); nodeoptions.setfsm(this.statemachine); string groupid = this.context.group(); peerid endpoint = this.context.endpoint(); return raftservicefactory.createandinitraftnode(groupid, endpoint, nodeoptions); }
hhxx2015/hugegraph
[ 1, 0, 0, 0 ]
1,032
public static void pvpDamageBalance(AbstractDealDamageHandler.AttackInfo attack, MapleCharacter player) { matk = player.getTotalMagic(); luk = player.getTotalLuk(); watk = player.getTotalWatk(); switch (attack.skill) { case 0: // normal attack multi = 1; maxHeight = 35; isAoe = false; break; case 1001004: // Power Strike skil = SkillFactory.getSkill(1001004); multi = skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0; maxHeight = 35; isAoe = false; break; case 1001005: // Slash Blast skil = SkillFactory.getSkill(1001005); multi = skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0; maxHeight = 35; isAoe = false; break; case 2001004: // Energy Bolt skil = SkillFactory.getSkill(2001004); multi = skil.getEffect(player.getSkillLevel(skil)).getMatk(); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 200; maxHeight = 35; isAoe = false; magic = true; break; case 2001005: // Magic Claw skil = SkillFactory.getSkill(2001005); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxHeight = 35; isAoe = false; magic = true; break; case 3001004: // Arrow Blow skil = SkillFactory.getSkill(3001004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 3001005: // Double Shot skil = SkillFactory.getSkill(3001005); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 4001334: // Double Stab skil = SkillFactory.getSkill(4001334); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 4001344: // Lucky Seven skil = SkillFactory.getSkill(4001344); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); pvpDamage = (int) (5 * luk / 100 * watk * multi); min = (int) (2.5 * luk / 100 * watk * multi); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxHeight = 35; isAoe = false; ignore = true; break; case 2101004: // Fire Arrow skil = SkillFactory.getSkill(4101004); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 400; maxHeight = 35; isAoe = false; magic = true; break; case 2101005: // Poison Brace skil = SkillFactory.getSkill(2101005); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 400; maxHeight = 35; isAoe = false; magic = true; break; case 2201004: // Cold Beam skil = SkillFactory.getSkill(2201004); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 300; maxHeight = 35; isAoe = false; magic = true; break; case 2301005: // Holy Arrow skil = SkillFactory.getSkill(2301005); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 300; maxHeight = 35; isAoe = false; magic = true; break; case 4101005: // Drain skil = SkillFactory.getSkill(4101005); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 4201005: // Savage Blow skil = SkillFactory.getSkill(4201005); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 1111004: // Panic: Axe skil = SkillFactory.getSkill(1111004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 1111003: // Panic: Sword skil = SkillFactory.getSkill(1111003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 1311004: // Dragon Fury: Pole Arm skil = SkillFactory.getSkill(1311004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 1311003: // Dragon Fury: Spear skil = SkillFactory.getSkill(1311003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 1311002: // Pole Arm Crusher skil = SkillFactory.getSkill(1311002); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 1311005: // Sacrifice skil = SkillFactory.getSkill(1311005); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 1311001: // Spear Crusher skil = SkillFactory.getSkill(1311001); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 2211002: // Ice Strike skil = SkillFactory.getSkill(2211002); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 250; maxHeight = 35; isAoe = false; magic = true; break; case 2211003: // Thunder Spear skil = SkillFactory.getSkill(2211003); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 300; maxHeight = 35; isAoe = false; magic = true; break; case 3111006: // Strafe skil = SkillFactory.getSkill(3111006); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 1000.0); maxHeight = 35; isAoe = false; break; case 3211006: // Strafe skil = SkillFactory.getSkill(3211006); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 1000.0); maxHeight = 35; isAoe = false; break; case 4111005: // Avenger skil = SkillFactory.getSkill(4111005); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 4211002: // Assaulter skil = SkillFactory.getSkill(4211002); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxDis = 200; maxHeight = 35; isAoe = false; break; case 1121008: // Brandish skil = SkillFactory.getSkill(1121008); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 1121006: // Rush skil = SkillFactory.getSkill(1121006); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 1221009: // Blast skil = SkillFactory.getSkill(1221009); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 1221007: // Rush skil = SkillFactory.getSkill(1221007); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 1321003: // Rush skil = SkillFactory.getSkill(1321003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 2121003: // Fire Demon skil = SkillFactory.getSkill(2121003); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 400; maxHeight = 35; isAoe = false; magic = true; break; case 2221006: // Chain Lightning skil = SkillFactory.getSkill(2221006); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 400; maxHeight = 35; isAoe = false; magic = true; break; case 2221003: // Ice Demon skil = SkillFactory.getSkill(2221003); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 400; maxHeight = 35; isAoe = false; magic = true; break; case 2321007: // Angel's Ray skil = SkillFactory.getSkill(2321007); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 400; maxHeight = 35; isAoe = false; magic = true; break; case 3121003: // Dragon Pulse skil = SkillFactory.getSkill(3121003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 3121004: // Hurricane skil = SkillFactory.getSkill(3121004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 3221003: // Dragon Pulse skil = SkillFactory.getSkill(3221003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 3221001: // Piercing skil = SkillFactory.getSkill(3221003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 3221007: // Sniping pvpDamage = (int) (player.calculateMaxBaseDamage(watk) * 3); min = (int) (player.calculateMinBaseDamage(player) * 3); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxHeight = 35; isAoe = false; ignore = true; break; case 4121003: // Showdown taunt skil = SkillFactory.getSkill(4121003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 4121007: // Triple Throw skil = SkillFactory.getSkill(4121007); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 4221007: // Boomerang Step skil = SkillFactory.getSkill(4221007); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 4221003: // Showdown taunt skil = SkillFactory.getSkill(4221003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; //aoe case 2201005: // Thunderbolt skil = SkillFactory.getSkill(2201005); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 250; maxHeight = 250; isAoe = true; magic = true; break; case 3101005: // Arrow Bomb : Bow skil = SkillFactory.getSkill(3101005); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 250; isAoe = true; break; case 3201005: // Iron Arrow : Crossbow skil = SkillFactory.getSkill(3201005); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = true; break; case 1111006: // Coma: Axe skil = SkillFactory.getSkill(1111006); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 250; isAoe = true; break; case 1111005: // Coma: Sword skil = SkillFactory.getSkill(1111005); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 250; isAoe = true; break; case 1211002: // Charged Blow - skill doesn't work skil = SkillFactory.getSkill(1211002); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 250; isAoe = true; break; case 1311006: // Dragon Roar skil = SkillFactory.getSkill(1311006); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxDis = 600; maxHeight = 450; isAoe = true; break; case 2111002: // Explosion skil = SkillFactory.getSkill(2111002); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 350; maxHeight = 350; isAoe = true; magic = true; break; case 2111003: // Poison Mist skil = SkillFactory.getSkill(2111003); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 350; maxHeight = 350; isAoe = true; magic = true; break; case 2311004: // Shining Ray skil = SkillFactory.getSkill(2311004); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 350; maxHeight = 350; isAoe = true; magic = true; break; case 3111004: // Arrow Rain skil = SkillFactory.getSkill(3111004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxDis = 350; maxHeight = 350; isAoe = true; break; case 3111003: // Inferno skil = SkillFactory.getSkill(3111003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxDis = 350; maxHeight = 350; isAoe = true; break; case 3211004: // Arrow Eruption skil = SkillFactory.getSkill(3211004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxDis = 350; maxHeight = 350; isAoe = true; break; case 3211003: // Blizzard (Sniper) skil = SkillFactory.getSkill(3211003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxDis = 350; maxHeight = 350; isAoe = true; break; case 4211004: // Band of Thieves Skill doesn't work so i don't know skil = SkillFactory.getSkill(4211004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 350; isAoe = true; break; case 1221011: // Sanctuary Skill doesn't work so i don't know skil = SkillFactory.getSkill(1221011); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxDis = 350; maxHeight = 350; isAoe = true; break; case 2121001: // Big Bang skil = SkillFactory.getSkill(2121001); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 175; maxHeight = 175; isAoe = true; magic = true; break; case 2121007: // Meteo skil = SkillFactory.getSkill(2121007); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 600; maxHeight = 600; isAoe = true; magic = true; break; case 2121006: // Paralyze skil = SkillFactory.getSkill(2121006); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 250; maxHeight = 250; isAoe = true; magic = true; break; case 2221001: // Big Bang skil = SkillFactory.getSkill(2221001); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 175; maxHeight = 175; isAoe = true; magic = true; break; case 2221007: // Blizzard skil = SkillFactory.getSkill(2221007); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 600; maxHeight = 600; isAoe = true; magic = true; break; case 2321008: // Genesis skil = SkillFactory.getSkill(2321008); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 600; maxHeight = 600; isAoe = true; magic = true; break; case 2321001: // bishop Big Bang skil = SkillFactory.getSkill(2321001); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 175; maxHeight = 175; isAoe = true; magic = true; break; case 4121004: // Ninja Ambush pvpDamage = (int) Math.floor(Math.random() * (180 - 150) + 150); maxDis = 150; maxHeight = 300; isAoe = true; ignore = true; break; case 4121008: // Ninja Storm knockback skil = SkillFactory.getSkill(4121008); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); pvpDamage = (int) Math.floor(Math.random() * (player.calculateMaxBaseDamage(watk) * multi)); maxDis = 150; maxHeight = 35; isAoe = true; ignore = true; break; case 4221001: // Assassinate skil = SkillFactory.getSkill(4221001); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = true; break; case 4221004: // Ninja Ambush pvpDamage = (int) Math.floor(Math.random() * (180 - 150) + 150); maxDis = 150; maxHeight = 150; isAoe = true; ignore = true; break; case 9001001: // SUPER dragon ROAR pvpDamage = MAX_PVP_DAMAGE; maxDis = 150; maxHeight = 150; isAoe = true; ignore = true; break; /** *@author Supiangel * */ case 5001001: // First Strike skil = SkillFactory.getSkill(5001001); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5001002: // Back-flip kick skil = SkillFactory.getSkill(5001002); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5101002: // Backward Blow skil = SkillFactory.getSkill(5101002); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5101003: // Uppercut skil = SkillFactory.getSkill(5101003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5101004: // Spinning Punch skil = SkillFactory.getSkill(5101004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5111002: // Final Punch skil = SkillFactory.getSkill(5111002); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5111004: // Absorb skil = SkillFactory.getSkill(5111004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5111006: // Smash skil = SkillFactory.getSkill(5111006); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5001003: // Double Shot skil = SkillFactory.getSkill(5001003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); pvpDamage = (int) (5 * player.getStr() / 100 * watk * multi); min = (int) (2.5 * player.getStr() / 100 * watk * multi); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxHeight = 35; isAoe = false; ignore = true; break; case 5201001: // Fatal Bullet skil = SkillFactory.getSkill(5201001); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5201004: // Decoy skil = SkillFactory.getSkill(5201004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5201006: // Withdraw skil = SkillFactory.getSkill(5201006); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5210000: // Triple Shot skil = SkillFactory.getSkill(5210000); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; ignore = true; break; case 5211004: // Fire Shot skil = SkillFactory.getSkill(5211004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5211005: // Ice Shot skil = SkillFactory.getSkill(5211005); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5121001: // Dragon Strike skil = SkillFactory.getSkill(5121001); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = true; break; case 5121007: // Fist skil = SkillFactory.getSkill(5121007); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5121002: // Energy Orb skil = SkillFactory.getSkill(5121002); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; ignore = true; break; case 5121004: // Demolition skil = SkillFactory.getSkill(5121004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5121005: // Snatch skil = SkillFactory.getSkill(5121005); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; ignore = true; break; case 5221004: // Rapid Fire skil = SkillFactory.getSkill(5221004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5221003: // Air Strike skil = SkillFactory.getSkill(5221003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5221007: // Battleship Cannon skil = SkillFactory.getSkill(5221007); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; ignore = true; break; case 5221008: // Battleship Torpedo skil = SkillFactory.getSkill(5221008); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; ignore = true; break; default: break; } if (!magic || !ignore) { maxDis = player.getMaxDis(player); } }
public static void pvpDamageBalance(AbstractDealDamageHandler.AttackInfo attack, MapleCharacter player) { matk = player.getTotalMagic(); luk = player.getTotalLuk(); watk = player.getTotalWatk(); switch (attack.skill) { case 0: multi = 1; maxHeight = 35; isAoe = false; break; case 1001004: skil = SkillFactory.getSkill(1001004); multi = skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0; maxHeight = 35; isAoe = false; break; case 1001005: skil = SkillFactory.getSkill(1001005); multi = skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0; maxHeight = 35; isAoe = false; break; case 2001004: skil = SkillFactory.getSkill(2001004); multi = skil.getEffect(player.getSkillLevel(skil)).getMatk(); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 200; maxHeight = 35; isAoe = false; magic = true; break; case 2001005: skil = SkillFactory.getSkill(2001005); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxHeight = 35; isAoe = false; magic = true; break; case 3001004: skil = SkillFactory.getSkill(3001004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 3001005: skil = SkillFactory.getSkill(3001005); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 4001334: skil = SkillFactory.getSkill(4001334); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 4001344: skil = SkillFactory.getSkill(4001344); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); pvpDamage = (int) (5 * luk / 100 * watk * multi); min = (int) (2.5 * luk / 100 * watk * multi); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxHeight = 35; isAoe = false; ignore = true; break; case 2101004: skil = SkillFactory.getSkill(4101004); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 400; maxHeight = 35; isAoe = false; magic = true; break; case 2101005: skil = SkillFactory.getSkill(2101005); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 400; maxHeight = 35; isAoe = false; magic = true; break; case 2201004: skil = SkillFactory.getSkill(2201004); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 300; maxHeight = 35; isAoe = false; magic = true; break; case 2301005: skil = SkillFactory.getSkill(2301005); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 300; maxHeight = 35; isAoe = false; magic = true; break; case 4101005: skil = SkillFactory.getSkill(4101005); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 4201005: skil = SkillFactory.getSkill(4201005); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 1111004: skil = SkillFactory.getSkill(1111004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 1111003: skil = SkillFactory.getSkill(1111003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 1311004: skil = SkillFactory.getSkill(1311004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 1311003: skil = SkillFactory.getSkill(1311003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 1311002: skil = SkillFactory.getSkill(1311002); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 1311005: skil = SkillFactory.getSkill(1311005); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 1311001: skil = SkillFactory.getSkill(1311001); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 2211002: skil = SkillFactory.getSkill(2211002); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 250; maxHeight = 35; isAoe = false; magic = true; break; case 2211003: skil = SkillFactory.getSkill(2211003); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 300; maxHeight = 35; isAoe = false; magic = true; break; case 3111006: skil = SkillFactory.getSkill(3111006); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 1000.0); maxHeight = 35; isAoe = false; break; case 3211006: skil = SkillFactory.getSkill(3211006); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 1000.0); maxHeight = 35; isAoe = false; break; case 4111005: skil = SkillFactory.getSkill(4111005); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 4211002: skil = SkillFactory.getSkill(4211002); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxDis = 200; maxHeight = 35; isAoe = false; break; case 1121008: skil = SkillFactory.getSkill(1121008); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 1121006: skil = SkillFactory.getSkill(1121006); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 1221009: skil = SkillFactory.getSkill(1221009); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 1221007: skil = SkillFactory.getSkill(1221007); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 1321003: skil = SkillFactory.getSkill(1321003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 2121003: skil = SkillFactory.getSkill(2121003); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 400; maxHeight = 35; isAoe = false; magic = true; break; case 2221006: skil = SkillFactory.getSkill(2221006); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 400; maxHeight = 35; isAoe = false; magic = true; break; case 2221003: skil = SkillFactory.getSkill(2221003); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 400; maxHeight = 35; isAoe = false; magic = true; break; case 2321007: skil = SkillFactory.getSkill(2321007); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 400; maxHeight = 35; isAoe = false; magic = true; break; case 3121003: skil = SkillFactory.getSkill(3121003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 3121004: skil = SkillFactory.getSkill(3121004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 3221003: skil = SkillFactory.getSkill(3221003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 3221001: skil = SkillFactory.getSkill(3221003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 3221007: pvpDamage = (int) (player.calculateMaxBaseDamage(watk) * 3); min = (int) (player.calculateMinBaseDamage(player) * 3); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxHeight = 35; isAoe = false; ignore = true; break; case 4121003: skil = SkillFactory.getSkill(4121003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 4121007: skil = SkillFactory.getSkill(4121007); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 4221007: skil = SkillFactory.getSkill(4221007); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 4221003: skil = SkillFactory.getSkill(4221003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 2201005: skil = SkillFactory.getSkill(2201005); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 250; maxHeight = 250; isAoe = true; magic = true; break; case 3101005: skil = SkillFactory.getSkill(3101005); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 250; isAoe = true; break; case 3201005: skil = SkillFactory.getSkill(3201005); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = true; break; case 1111006: skil = SkillFactory.getSkill(1111006); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 250; isAoe = true; break; case 1111005: skil = SkillFactory.getSkill(1111005); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 250; isAoe = true; break; case 1211002: skil = SkillFactory.getSkill(1211002); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 250; isAoe = true; break; case 1311006: skil = SkillFactory.getSkill(1311006); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxDis = 600; maxHeight = 450; isAoe = true; break; case 2111002: skil = SkillFactory.getSkill(2111002); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 350; maxHeight = 350; isAoe = true; magic = true; break; case 2111003: skil = SkillFactory.getSkill(2111003); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 350; maxHeight = 350; isAoe = true; magic = true; break; case 2311004: skil = SkillFactory.getSkill(2311004); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 350; maxHeight = 350; isAoe = true; magic = true; break; case 3111004: skil = SkillFactory.getSkill(3111004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxDis = 350; maxHeight = 350; isAoe = true; break; case 3111003: skil = SkillFactory.getSkill(3111003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxDis = 350; maxHeight = 350; isAoe = true; break; case 3211004: skil = SkillFactory.getSkill(3211004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxDis = 350; maxHeight = 350; isAoe = true; break; case 3211003: skil = SkillFactory.getSkill(3211003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxDis = 350; maxHeight = 350; isAoe = true; break; case 4211004: skil = SkillFactory.getSkill(4211004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 350; isAoe = true; break; case 1221011: skil = SkillFactory.getSkill(1221011); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxDis = 350; maxHeight = 350; isAoe = true; break; case 2121001: skil = SkillFactory.getSkill(2121001); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 175; maxHeight = 175; isAoe = true; magic = true; break; case 2121007: skil = SkillFactory.getSkill(2121007); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 600; maxHeight = 600; isAoe = true; magic = true; break; case 2121006: skil = SkillFactory.getSkill(2121006); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 250; maxHeight = 250; isAoe = true; magic = true; break; case 2221001: skil = SkillFactory.getSkill(2221001); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 175; maxHeight = 175; isAoe = true; magic = true; break; case 2221007: skil = SkillFactory.getSkill(2221007); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 600; maxHeight = 600; isAoe = true; magic = true; break; case 2321008: skil = SkillFactory.getSkill(2321008); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 600; maxHeight = 600; isAoe = true; magic = true; break; case 2321001: skil = SkillFactory.getSkill(2321001); multi = (skil.getEffect(player.getSkillLevel(skil)).getMatk()); mastery = skil.getEffect(player.getSkillLevel(skil)).getMastery() * 5 + 10 / 100; pvpDamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxDis = 175; maxHeight = 175; isAoe = true; magic = true; break; case 4121004: pvpDamage = (int) Math.floor(Math.random() * (180 - 150) + 150); maxDis = 150; maxHeight = 300; isAoe = true; ignore = true; break; case 4121008: skil = SkillFactory.getSkill(4121008); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); pvpDamage = (int) Math.floor(Math.random() * (player.calculateMaxBaseDamage(watk) * multi)); maxDis = 150; maxHeight = 35; isAoe = true; ignore = true; break; case 4221001: skil = SkillFactory.getSkill(4221001); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = true; break; case 4221004: pvpDamage = (int) Math.floor(Math.random() * (180 - 150) + 150); maxDis = 150; maxHeight = 150; isAoe = true; ignore = true; break; case 9001001: pvpDamage = MAX_PVP_DAMAGE; maxDis = 150; maxHeight = 150; isAoe = true; ignore = true; break; case 5001001: skil = SkillFactory.getSkill(5001001); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5001002: skil = SkillFactory.getSkill(5001002); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5101002: skil = SkillFactory.getSkill(5101002); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5101003: skil = SkillFactory.getSkill(5101003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5101004: skil = SkillFactory.getSkill(5101004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5111002: skil = SkillFactory.getSkill(5111002); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5111004: skil = SkillFactory.getSkill(5111004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5111006: skil = SkillFactory.getSkill(5111006); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5001003: skil = SkillFactory.getSkill(5001003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); pvpDamage = (int) (5 * player.getStr() / 100 * watk * multi); min = (int) (2.5 * player.getStr() / 100 * watk * multi); pvpDamage = MapleCharacter.rand(min, pvpDamage); maxHeight = 35; isAoe = false; ignore = true; break; case 5201001: skil = SkillFactory.getSkill(5201001); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5201004: skil = SkillFactory.getSkill(5201004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5201006: skil = SkillFactory.getSkill(5201006); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5210000: skil = SkillFactory.getSkill(5210000); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; ignore = true; break; case 5211004: skil = SkillFactory.getSkill(5211004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5211005: skil = SkillFactory.getSkill(5211005); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5121001: skil = SkillFactory.getSkill(5121001); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = true; break; case 5121007: skil = SkillFactory.getSkill(5121007); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5121002: skil = SkillFactory.getSkill(5121002); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; ignore = true; break; case 5121004: skil = SkillFactory.getSkill(5121004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5121005: skil = SkillFactory.getSkill(5121005); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; ignore = true; break; case 5221004: skil = SkillFactory.getSkill(5221004); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5221003: skil = SkillFactory.getSkill(5221003); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; break; case 5221007: skil = SkillFactory.getSkill(5221007); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; ignore = true; break; case 5221008: skil = SkillFactory.getSkill(5221008); multi = (skil.getEffect(player.getSkillLevel(skil)).getDamage() / 100.0); maxHeight = 35; isAoe = false; ignore = true; break; default: break; } if (!magic || !ignore) { maxDis = player.getMaxDis(player); } }
public static void pvpdamagebalance(abstractdealdamagehandler.attackinfo attack, maplecharacter player) { matk = player.gettotalmagic(); luk = player.gettotalluk(); watk = player.gettotalwatk(); switch (attack.skill) { case 0: multi = 1; maxheight = 35; isaoe = false; break; case 1001004: skil = skillfactory.getskill(1001004); multi = skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0; maxheight = 35; isaoe = false; break; case 1001005: skil = skillfactory.getskill(1001005); multi = skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0; maxheight = 35; isaoe = false; break; case 2001004: skil = skillfactory.getskill(2001004); multi = skil.geteffect(player.getskilllevel(skil)).getmatk(); mastery = skil.geteffect(player.getskilllevel(skil)).getmastery() * 5 + 10 / 100; pvpdamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpdamage = maplecharacter.rand(min, pvpdamage); maxdis = 200; maxheight = 35; isaoe = false; magic = true; break; case 2001005: skil = skillfactory.getskill(2001005); multi = (skil.geteffect(player.getskilllevel(skil)).getmatk()); mastery = skil.geteffect(player.getskilllevel(skil)).getmastery() * 5 + 10 / 100; pvpdamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpdamage = maplecharacter.rand(min, pvpdamage); maxheight = 35; isaoe = false; magic = true; break; case 3001004: skil = skillfactory.getskill(3001004); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 3001005: skil = skillfactory.getskill(3001005); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 4001334: skil = skillfactory.getskill(4001334); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 4001344: skil = skillfactory.getskill(4001344); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); pvpdamage = (int) (5 * luk / 100 * watk * multi); min = (int) (2.5 * luk / 100 * watk * multi); pvpdamage = maplecharacter.rand(min, pvpdamage); maxheight = 35; isaoe = false; ignore = true; break; case 2101004: skil = skillfactory.getskill(4101004); multi = (skil.geteffect(player.getskilllevel(skil)).getmatk()); mastery = skil.geteffect(player.getskilllevel(skil)).getmastery() * 5 + 10 / 100; pvpdamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpdamage = maplecharacter.rand(min, pvpdamage); maxdis = 400; maxheight = 35; isaoe = false; magic = true; break; case 2101005: skil = skillfactory.getskill(2101005); multi = (skil.geteffect(player.getskilllevel(skil)).getmatk()); mastery = skil.geteffect(player.getskilllevel(skil)).getmastery() * 5 + 10 / 100; pvpdamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpdamage = maplecharacter.rand(min, pvpdamage); maxdis = 400; maxheight = 35; isaoe = false; magic = true; break; case 2201004: skil = skillfactory.getskill(2201004); multi = (skil.geteffect(player.getskilllevel(skil)).getmatk()); mastery = skil.geteffect(player.getskilllevel(skil)).getmastery() * 5 + 10 / 100; pvpdamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpdamage = maplecharacter.rand(min, pvpdamage); maxdis = 300; maxheight = 35; isaoe = false; magic = true; break; case 2301005: skil = skillfactory.getskill(2301005); multi = (skil.geteffect(player.getskilllevel(skil)).getmatk()); mastery = skil.geteffect(player.getskilllevel(skil)).getmastery() * 5 + 10 / 100; pvpdamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpdamage = maplecharacter.rand(min, pvpdamage); maxdis = 300; maxheight = 35; isaoe = false; magic = true; break; case 4101005: skil = skillfactory.getskill(4101005); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 4201005: skil = skillfactory.getskill(4201005); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 1111004: skil = skillfactory.getskill(1111004); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 1111003: skil = skillfactory.getskill(1111003); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 1311004: skil = skillfactory.getskill(1311004); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 1311003: skil = skillfactory.getskill(1311003); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 1311002: skil = skillfactory.getskill(1311002); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 1311005: skil = skillfactory.getskill(1311005); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 1311001: skil = skillfactory.getskill(1311001); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 2211002: skil = skillfactory.getskill(2211002); multi = (skil.geteffect(player.getskilllevel(skil)).getmatk()); mastery = skil.geteffect(player.getskilllevel(skil)).getmastery() * 5 + 10 / 100; pvpdamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpdamage = maplecharacter.rand(min, pvpdamage); maxdis = 250; maxheight = 35; isaoe = false; magic = true; break; case 2211003: skil = skillfactory.getskill(2211003); multi = (skil.geteffect(player.getskilllevel(skil)).getmatk()); mastery = skil.geteffect(player.getskilllevel(skil)).getmastery() * 5 + 10 / 100; pvpdamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpdamage = maplecharacter.rand(min, pvpdamage); maxdis = 300; maxheight = 35; isaoe = false; magic = true; break; case 3111006: skil = skillfactory.getskill(3111006); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 1000.0); maxheight = 35; isaoe = false; break; case 3211006: skil = skillfactory.getskill(3211006); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 1000.0); maxheight = 35; isaoe = false; break; case 4111005: skil = skillfactory.getskill(4111005); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 4211002: skil = skillfactory.getskill(4211002); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxdis = 200; maxheight = 35; isaoe = false; break; case 1121008: skil = skillfactory.getskill(1121008); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 1121006: skil = skillfactory.getskill(1121006); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 1221009: skil = skillfactory.getskill(1221009); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 1221007: skil = skillfactory.getskill(1221007); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 1321003: skil = skillfactory.getskill(1321003); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 2121003: skil = skillfactory.getskill(2121003); multi = (skil.geteffect(player.getskilllevel(skil)).getmatk()); mastery = skil.geteffect(player.getskilllevel(skil)).getmastery() * 5 + 10 / 100; pvpdamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpdamage = maplecharacter.rand(min, pvpdamage); maxdis = 400; maxheight = 35; isaoe = false; magic = true; break; case 2221006: skil = skillfactory.getskill(2221006); multi = (skil.geteffect(player.getskilllevel(skil)).getmatk()); mastery = skil.geteffect(player.getskilllevel(skil)).getmastery() * 5 + 10 / 100; pvpdamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpdamage = maplecharacter.rand(min, pvpdamage); maxdis = 400; maxheight = 35; isaoe = false; magic = true; break; case 2221003: skil = skillfactory.getskill(2221003); multi = (skil.geteffect(player.getskilllevel(skil)).getmatk()); mastery = skil.geteffect(player.getskilllevel(skil)).getmastery() * 5 + 10 / 100; pvpdamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpdamage = maplecharacter.rand(min, pvpdamage); maxdis = 400; maxheight = 35; isaoe = false; magic = true; break; case 2321007: skil = skillfactory.getskill(2321007); multi = (skil.geteffect(player.getskilllevel(skil)).getmatk()); mastery = skil.geteffect(player.getskilllevel(skil)).getmastery() * 5 + 10 / 100; pvpdamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpdamage = maplecharacter.rand(min, pvpdamage); maxdis = 400; maxheight = 35; isaoe = false; magic = true; break; case 3121003: skil = skillfactory.getskill(3121003); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 3121004: skil = skillfactory.getskill(3121004); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 3221003: skil = skillfactory.getskill(3221003); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 3221001: skil = skillfactory.getskill(3221003); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 3221007: pvpdamage = (int) (player.calculatemaxbasedamage(watk) * 3); min = (int) (player.calculateminbasedamage(player) * 3); pvpdamage = maplecharacter.rand(min, pvpdamage); maxheight = 35; isaoe = false; ignore = true; break; case 4121003: skil = skillfactory.getskill(4121003); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 4121007: skil = skillfactory.getskill(4121007); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 4221007: skil = skillfactory.getskill(4221007); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 4221003: skil = skillfactory.getskill(4221003); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 2201005: skil = skillfactory.getskill(2201005); multi = (skil.geteffect(player.getskilllevel(skil)).getmatk()); mastery = skil.geteffect(player.getskilllevel(skil)).getmastery() * 5 + 10 / 100; pvpdamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpdamage = maplecharacter.rand(min, pvpdamage); maxdis = 250; maxheight = 250; isaoe = true; magic = true; break; case 3101005: skil = skillfactory.getskill(3101005); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 250; isaoe = true; break; case 3201005: skil = skillfactory.getskill(3201005); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = true; break; case 1111006: skil = skillfactory.getskill(1111006); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 250; isaoe = true; break; case 1111005: skil = skillfactory.getskill(1111005); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 250; isaoe = true; break; case 1211002: skil = skillfactory.getskill(1211002); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 250; isaoe = true; break; case 1311006: skil = skillfactory.getskill(1311006); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxdis = 600; maxheight = 450; isaoe = true; break; case 2111002: skil = skillfactory.getskill(2111002); multi = (skil.geteffect(player.getskilllevel(skil)).getmatk()); mastery = skil.geteffect(player.getskilllevel(skil)).getmastery() * 5 + 10 / 100; pvpdamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpdamage = maplecharacter.rand(min, pvpdamage); maxdis = 350; maxheight = 350; isaoe = true; magic = true; break; case 2111003: skil = skillfactory.getskill(2111003); multi = (skil.geteffect(player.getskilllevel(skil)).getmatk()); mastery = skil.geteffect(player.getskilllevel(skil)).getmastery() * 5 + 10 / 100; pvpdamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpdamage = maplecharacter.rand(min, pvpdamage); maxdis = 350; maxheight = 350; isaoe = true; magic = true; break; case 2311004: skil = skillfactory.getskill(2311004); multi = (skil.geteffect(player.getskilllevel(skil)).getmatk()); mastery = skil.geteffect(player.getskilllevel(skil)).getmastery() * 5 + 10 / 100; pvpdamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpdamage = maplecharacter.rand(min, pvpdamage); maxdis = 350; maxheight = 350; isaoe = true; magic = true; break; case 3111004: skil = skillfactory.getskill(3111004); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxdis = 350; maxheight = 350; isaoe = true; break; case 3111003: skil = skillfactory.getskill(3111003); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxdis = 350; maxheight = 350; isaoe = true; break; case 3211004: skil = skillfactory.getskill(3211004); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxdis = 350; maxheight = 350; isaoe = true; break; case 3211003: skil = skillfactory.getskill(3211003); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxdis = 350; maxheight = 350; isaoe = true; break; case 4211004: skil = skillfactory.getskill(4211004); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 350; isaoe = true; break; case 1221011: skil = skillfactory.getskill(1221011); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxdis = 350; maxheight = 350; isaoe = true; break; case 2121001: skil = skillfactory.getskill(2121001); multi = (skil.geteffect(player.getskilllevel(skil)).getmatk()); mastery = skil.geteffect(player.getskilllevel(skil)).getmastery() * 5 + 10 / 100; pvpdamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpdamage = maplecharacter.rand(min, pvpdamage); maxdis = 175; maxheight = 175; isaoe = true; magic = true; break; case 2121007: skil = skillfactory.getskill(2121007); multi = (skil.geteffect(player.getskilllevel(skil)).getmatk()); mastery = skil.geteffect(player.getskilllevel(skil)).getmastery() * 5 + 10 / 100; pvpdamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpdamage = maplecharacter.rand(min, pvpdamage); maxdis = 600; maxheight = 600; isaoe = true; magic = true; break; case 2121006: skil = skillfactory.getskill(2121006); multi = (skil.geteffect(player.getskilllevel(skil)).getmatk()); mastery = skil.geteffect(player.getskilllevel(skil)).getmastery() * 5 + 10 / 100; pvpdamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpdamage = maplecharacter.rand(min, pvpdamage); maxdis = 250; maxheight = 250; isaoe = true; magic = true; break; case 2221001: skil = skillfactory.getskill(2221001); multi = (skil.geteffect(player.getskilllevel(skil)).getmatk()); mastery = skil.geteffect(player.getskilllevel(skil)).getmastery() * 5 + 10 / 100; pvpdamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpdamage = maplecharacter.rand(min, pvpdamage); maxdis = 175; maxheight = 175; isaoe = true; magic = true; break; case 2221007: skil = skillfactory.getskill(2221007); multi = (skil.geteffect(player.getskilllevel(skil)).getmatk()); mastery = skil.geteffect(player.getskilllevel(skil)).getmastery() * 5 + 10 / 100; pvpdamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpdamage = maplecharacter.rand(min, pvpdamage); maxdis = 600; maxheight = 600; isaoe = true; magic = true; break; case 2321008: skil = skillfactory.getskill(2321008); multi = (skil.geteffect(player.getskilllevel(skil)).getmatk()); mastery = skil.geteffect(player.getskilllevel(skil)).getmastery() * 5 + 10 / 100; pvpdamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpdamage = maplecharacter.rand(min, pvpdamage); maxdis = 600; maxheight = 600; isaoe = true; magic = true; break; case 2321001: skil = skillfactory.getskill(2321001); multi = (skil.geteffect(player.getskilllevel(skil)).getmatk()); mastery = skil.geteffect(player.getskilllevel(skil)).getmastery() * 5 + 10 / 100; pvpdamage = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8); min = (int) ((matk * 0.8) + (luk / 4) / 18 * multi * 0.8 * mastery); pvpdamage = maplecharacter.rand(min, pvpdamage); maxdis = 175; maxheight = 175; isaoe = true; magic = true; break; case 4121004: pvpdamage = (int) math.floor(math.random() * (180 - 150) + 150); maxdis = 150; maxheight = 300; isaoe = true; ignore = true; break; case 4121008: skil = skillfactory.getskill(4121008); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); pvpdamage = (int) math.floor(math.random() * (player.calculatemaxbasedamage(watk) * multi)); maxdis = 150; maxheight = 35; isaoe = true; ignore = true; break; case 4221001: skil = skillfactory.getskill(4221001); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = true; break; case 4221004: pvpdamage = (int) math.floor(math.random() * (180 - 150) + 150); maxdis = 150; maxheight = 150; isaoe = true; ignore = true; break; case 9001001: pvpdamage = max_pvp_damage; maxdis = 150; maxheight = 150; isaoe = true; ignore = true; break; case 5001001: skil = skillfactory.getskill(5001001); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 5001002: skil = skillfactory.getskill(5001002); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 5101002: skil = skillfactory.getskill(5101002); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 5101003: skil = skillfactory.getskill(5101003); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 5101004: skil = skillfactory.getskill(5101004); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 5111002: skil = skillfactory.getskill(5111002); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 5111004: skil = skillfactory.getskill(5111004); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 5111006: skil = skillfactory.getskill(5111006); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 5001003: skil = skillfactory.getskill(5001003); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); pvpdamage = (int) (5 * player.getstr() / 100 * watk * multi); min = (int) (2.5 * player.getstr() / 100 * watk * multi); pvpdamage = maplecharacter.rand(min, pvpdamage); maxheight = 35; isaoe = false; ignore = true; break; case 5201001: skil = skillfactory.getskill(5201001); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 5201004: skil = skillfactory.getskill(5201004); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 5201006: skil = skillfactory.getskill(5201006); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 5210000: skil = skillfactory.getskill(5210000); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; ignore = true; break; case 5211004: skil = skillfactory.getskill(5211004); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 5211005: skil = skillfactory.getskill(5211005); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 5121001: skil = skillfactory.getskill(5121001); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = true; break; case 5121007: skil = skillfactory.getskill(5121007); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 5121002: skil = skillfactory.getskill(5121002); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; ignore = true; break; case 5121004: skil = skillfactory.getskill(5121004); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 5121005: skil = skillfactory.getskill(5121005); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; ignore = true; break; case 5221004: skil = skillfactory.getskill(5221004); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 5221003: skil = skillfactory.getskill(5221003); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; break; case 5221007: skil = skillfactory.getskill(5221007); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; ignore = true; break; case 5221008: skil = skillfactory.getskill(5221008); multi = (skil.geteffect(player.getskilllevel(skil)).getdamage() / 100.0); maxheight = 35; isaoe = false; ignore = true; break; default: break; } if (!magic || !ignore) { maxdis = player.getmaxdis(player); } }
hugogrochau/VoidMS
[ 0, 0, 1, 0 ]
17,449
public ImmutableMap<Name, Long> snapshotModifiedTimes(JimfsPath path) throws IOException { ImmutableMap.Builder<Name, Long> modifiedTimes = ImmutableMap.builder(); store.readLock().lock(); try { Directory dir = (Directory) lookUp(path, Options.FOLLOW_LINKS).requireDirectory(path).file(); // TODO(cgdecker): Investigate whether WatchServices should keep a reference to the actual // directory when SecureDirectoryStream is supported rather than looking up the directory // each time the WatchService polls for (DirectoryEntry entry : dir) { if (!entry.name().equals(Name.SELF) && !entry.name().equals(Name.PARENT)) { modifiedTimes.put(entry.name(), entry.file().getLastModifiedTime()); } } return modifiedTimes.build(); } finally { store.readLock().unlock(); } }
public ImmutableMap<Name, Long> snapshotModifiedTimes(JimfsPath path) throws IOException { ImmutableMap.Builder<Name, Long> modifiedTimes = ImmutableMap.builder(); store.readLock().lock(); try { Directory dir = (Directory) lookUp(path, Options.FOLLOW_LINKS).requireDirectory(path).file(); for (DirectoryEntry entry : dir) { if (!entry.name().equals(Name.SELF) && !entry.name().equals(Name.PARENT)) { modifiedTimes.put(entry.name(), entry.file().getLastModifiedTime()); } } return modifiedTimes.build(); } finally { store.readLock().unlock(); } }
public immutablemap<name, long> snapshotmodifiedtimes(jimfspath path) throws ioexception { immutablemap.builder<name, long> modifiedtimes = immutablemap.builder(); store.readlock().lock(); try { directory dir = (directory) lookup(path, options.follow_links).requiredirectory(path).file(); for (directoryentry entry : dir) { if (!entry.name().equals(name.self) && !entry.name().equals(name.parent)) { modifiedtimes.put(entry.name(), entry.file().getlastmodifiedtime()); } } return modifiedtimes.build(); } finally { store.readlock().unlock(); } }
hlemorvan/jimfs
[ 1, 0, 0, 0 ]
33,843
private static String createDocument(Docs service) throws IOException { // TODO: Create a new Google Document in the authorized account. }
private static String createDocument(Docs service) throws IOException { }
private static string createdocument(docs service) throws ioexception { }
googleworkspace/docs-transcripts
[ 0, 1, 0, 0 ]
33,850
private void detectTitle() { Document doc = this.contentView.getDocument(); if (doc instanceof HTMLDocument) { HTMLDocument hdoc = (HTMLDocument)doc; System.out.println("Document Property:" + hdoc.getProperty(Document.TitleProperty)); // the following stuff did not work and I don't know why! Element element = hdoc.getElement(hdoc.getDefaultRootElement(), StyleConstants.NameAttribute, HTML.Tag.TITLE); if (element != null && element.getStartOffset() >= 0) { try { System.out.println("Element-based NameAttribute search: " + doc.getText(element.getStartOffset(), element.getEndOffset() - element.getStartOffset())); } catch (BadLocationException ex) { // TODO Auto-generated catch block ex.printStackTrace(); } } else { System.out.println("Element with NameAttribute TITLE not found: "+element); } dumpTags(hdoc, HTML.Tag.HEAD); dumpTags(hdoc, HTML.Tag.BODY); dumpTags(hdoc, HTML.Tag.TITLE); dumpTags(hdoc, HTML.Tag.H1); HTMLDocument.Iterator iterator = hdoc.getIterator(HTML.Tag.TITLE); if (iterator != null && iterator.isValid()) { int startOffset = iterator.getStartOffset(); if (startOffset >= 0) { try { System.out.println("HTMLDocument.Iterator for tags TITLE: " + doc.getText(startOffset, iterator.getEndOffset() - startOffset)); } catch (BadLocationException ex) { // TODO Auto-generated catch block ex.printStackTrace(); } } } else { System.out.println("No valid iterator for tag TITLE found: "+iterator); } } }
private void detectTitle() { Document doc = this.contentView.getDocument(); if (doc instanceof HTMLDocument) { HTMLDocument hdoc = (HTMLDocument)doc; System.out.println("Document Property:" + hdoc.getProperty(Document.TitleProperty)); Element element = hdoc.getElement(hdoc.getDefaultRootElement(), StyleConstants.NameAttribute, HTML.Tag.TITLE); if (element != null && element.getStartOffset() >= 0) { try { System.out.println("Element-based NameAttribute search: " + doc.getText(element.getStartOffset(), element.getEndOffset() - element.getStartOffset())); } catch (BadLocationException ex) { ex.printStackTrace(); } } else { System.out.println("Element with NameAttribute TITLE not found: "+element); } dumpTags(hdoc, HTML.Tag.HEAD); dumpTags(hdoc, HTML.Tag.BODY); dumpTags(hdoc, HTML.Tag.TITLE); dumpTags(hdoc, HTML.Tag.H1); HTMLDocument.Iterator iterator = hdoc.getIterator(HTML.Tag.TITLE); if (iterator != null && iterator.isValid()) { int startOffset = iterator.getStartOffset(); if (startOffset >= 0) { try { System.out.println("HTMLDocument.Iterator for tags TITLE: " + doc.getText(startOffset, iterator.getEndOffset() - startOffset)); } catch (BadLocationException ex) { ex.printStackTrace(); } } } else { System.out.println("No valid iterator for tag TITLE found: "+iterator); } } }
private void detecttitle() { document doc = this.contentview.getdocument(); if (doc instanceof htmldocument) { htmldocument hdoc = (htmldocument)doc; system.out.println("document property:" + hdoc.getproperty(document.titleproperty)); element element = hdoc.getelement(hdoc.getdefaultrootelement(), styleconstants.nameattribute, html.tag.title); if (element != null && element.getstartoffset() >= 0) { try { system.out.println("element-based nameattribute search: " + doc.gettext(element.getstartoffset(), element.getendoffset() - element.getstartoffset())); } catch (badlocationexception ex) { ex.printstacktrace(); } } else { system.out.println("element with nameattribute title not found: "+element); } dumptags(hdoc, html.tag.head); dumptags(hdoc, html.tag.body); dumptags(hdoc, html.tag.title); dumptags(hdoc, html.tag.h1); htmldocument.iterator iterator = hdoc.getiterator(html.tag.title); if (iterator != null && iterator.isvalid()) { int startoffset = iterator.getstartoffset(); if (startoffset >= 0) { try { system.out.println("htmldocument.iterator for tags title: " + doc.gettext(startoffset, iterator.getendoffset() - startoffset)); } catch (badlocationexception ex) { ex.printstacktrace(); } } } else { system.out.println("no valid iterator for tag title found: "+iterator); } } }
hubersn/SwingHelpViewer
[ 0, 1, 1, 0 ]
17,467
public void testMissing() { MissingNode n = MissingNode.getInstance(); assertTrue(n.isMissingNode()); assertEquals(JsonToken.NOT_AVAILABLE, n.asToken()); assertEquals("", n.asText()); assertStandardEquals(n); // 10-Dec-2018, tatu: With 2.10, should serialize same as via ObjectMapper/ObjectWriter // 10-Dec-2019, tatu: Surprise! No, this is not how it worked in 2.9, nor does it make // sense... see [databind#2566] for details assertEquals("", n.toString()); assertNodeNumbersForNonNumeric(n); assertTrue(n.asBoolean(true)); assertEquals(4, n.asInt(4)); assertEquals(5L, n.asLong(5)); assertEquals(0.25, n.asDouble(0.25)); assertEquals("foo", n.asText("foo")); }
public void testMissing() { MissingNode n = MissingNode.getInstance(); assertTrue(n.isMissingNode()); assertEquals(JsonToken.NOT_AVAILABLE, n.asToken()); assertEquals("", n.asText()); assertStandardEquals(n); assertEquals("", n.toString()); assertNodeNumbersForNonNumeric(n); assertTrue(n.asBoolean(true)); assertEquals(4, n.asInt(4)); assertEquals(5L, n.asLong(5)); assertEquals(0.25, n.asDouble(0.25)); assertEquals("foo", n.asText("foo")); }
public void testmissing() { missingnode n = missingnode.getinstance(); asserttrue(n.ismissingnode()); assertequals(jsontoken.not_available, n.astoken()); assertequals("", n.astext()); assertstandardequals(n); assertequals("", n.tostring()); assertnodenumbersfornonnumeric(n); asserttrue(n.asboolean(true)); assertequals(4, n.asint(4)); assertequals(5l, n.aslong(5)); assertequals(0.25, n.asdouble(0.25)); assertequals("foo", n.astext("foo")); }
jebbench/jackson-dataformat-velocypack
[ 0, 0, 1, 0 ]
25,662
public static String removerAcento(String palavra){ return Normalizer.normalize(palavra, Normalizer.Form.NFD).replaceAll("[^\\p{ASCII}]", ""); }
public static String removerAcento(String palavra){ return Normalizer.normalize(palavra, Normalizer.Form.NFD).replaceAll("[^\\p{ASCII}]", ""); }
public static string removeracento(string palavra){ return normalizer.normalize(palavra, normalizer.form.nfd).replaceall("[^\\p{ascii}]", ""); }
guilhermejulio/PAA-IndiceInvertido
[ 0, 0, 0, 0 ]
1,238
public void handler() { PORT_START(); /* DSW0 */ /* According to the manual, 0x04, 0x08 and 0x10 should always be off, but... */ PORT_DIPNAME( 0x07, 0x00, "Rank" ); PORT_DIPSETTING( 0x00, "A" ); PORT_DIPSETTING( 0x01, "B" ); PORT_DIPSETTING( 0x02, "C" ); PORT_DIPSETTING( 0x03, "D" ); PORT_DIPSETTING( 0x04, "E" ); PORT_DIPSETTING( 0x05, "F" ); PORT_DIPSETTING( 0x06, "G" ); PORT_DIPSETTING( 0x07, "H" ); PORT_DIPNAME( 0x18, 0x00, DEF_STR( "Coin_B") ); PORT_DIPSETTING( 0x18, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x00, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0x08, DEF_STR( "1C_5C")); PORT_DIPSETTING( 0x10, DEF_STR( "1C_7C") ); PORT_DIPNAME( 0x20, 0x00, DEF_STR( "Demo_Sounds") ); PORT_DIPSETTING( 0x20, DEF_STR( "Off") ); PORT_DIPSETTING( 0x00, DEF_STR( "On") ); PORT_BITX( 0x40, 0x00, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Rack Test", KEYCODE_F1, IP_JOY_NONE ); PORT_DIPSETTING( 0x00, DEF_STR( "Off") ); PORT_DIPSETTING( 0x40, DEF_STR( "On") ); PORT_DIPNAME( 0x80, 0x00, "Freeze" ); PORT_DIPSETTING( 0x00, DEF_STR( "Off") ); PORT_DIPSETTING( 0x80, DEF_STR( "On") ); PORT_START(); /* DSW1 */ PORT_DIPNAME( 0x07, 0x00, DEF_STR( "Coin_A") ); PORT_DIPSETTING( 0x06, DEF_STR( "3C_1C") ); PORT_DIPSETTING( 0x04, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x07, DEF_STR( "3C_2C") ); PORT_DIPSETTING( 0x00, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0x05, DEF_STR( "2C_3C") ); PORT_DIPSETTING( 0x01, DEF_STR( "1C_2C") ); PORT_DIPSETTING( 0x02, DEF_STR( "1C_3C") ); PORT_DIPSETTING( 0x03, DEF_STR( "1C_6C") ); /* TODO: bonus scores are different for 5 lives */ PORT_DIPNAME( 0x38, 0x00, DEF_STR( "Bonus_Life") ); PORT_DIPSETTING( 0x28, "20k 70k and every 70k" ); PORT_DIPSETTING( 0x30, "20k 80k and every 80k" ); PORT_DIPSETTING( 0x08, "20k 60k" ); PORT_DIPSETTING( 0x00, "20k 70k" ); PORT_DIPSETTING( 0x10, "20k 80k" ); PORT_DIPSETTING( 0x18, "30k 100k" ); PORT_DIPSETTING( 0x20, "20k" ); PORT_DIPSETTING( 0x38, "None" );/* those are the bonus with 5 lives PORT_DIPNAME( 0x38, 0x00, DEF_STR( "Bonus_Life") ); PORT_DIPSETTING( 0x28, "30k 100k and every 100k" ); PORT_DIPSETTING( 0x30, "40k 120k and every 120k" ); PORT_DIPSETTING( 0x00, "30k 80k" ); PORT_DIPSETTING( 0x08, "30k 100k" ); PORT_DIPSETTING( 0x10, "30k 120k" ); PORT_DIPSETTING( 0x18, "30k" ); PORT_DIPSETTING( 0x20, "40k" ); PORT_DIPSETTING( 0x38, "None" );*/ PORT_DIPNAME( 0xc0, 0x00, DEF_STR( "Lives") ); PORT_DIPSETTING( 0x80, "1" ); PORT_DIPSETTING( 0xc0, "2" ); PORT_DIPSETTING( 0x00, "3" ); PORT_DIPSETTING( 0x40, "5" ); PORT_START(); /* DSW2 */ PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_UNUSED ); PORT_DIPNAME( 0x04, 0x00, DEF_STR( "Cabinet") ); PORT_DIPSETTING( 0x00, DEF_STR( "Upright") ); PORT_DIPSETTING( 0x04, DEF_STR( "Cocktail") ); PORT_SERVICE( 0x08, IP_ACTIVE_HIGH ); PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED ); PORT_START(); /* FAKE */ /* The player inputs are not memory mapped, they are handled by an I/O chip. */ /* These fake input ports are read by mappy_customio_data_r() */ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ); PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_2WAY ); PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ); PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_2WAY ); PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1, 1 ); PORT_BITX(0x20, IP_ACTIVE_HIGH, IPT_BUTTON1, null, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS ); PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED ); PORT_START(); /* FAKE */ PORT_BIT_IMPULSE( 0x01, IP_ACTIVE_HIGH, IPT_COIN1, 1 );/* Coin 2 is not working */ PORT_BIT_IMPULSE( 0x02, IP_ACTIVE_HIGH, IPT_COIN2, 1 ); PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ); PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_HIGH, IPT_START1, 1 ); PORT_BIT_IMPULSE( 0x20, IP_ACTIVE_HIGH, IPT_START2, 1 ); PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED ); PORT_START(); /* FAKE */ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_COCKTAIL ); PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_COCKTAIL ); PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL, 1 ); PORT_BITX(0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL, null, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS ); INPUT_PORTS_END(); }
public void handler() { PORT_START(); PORT_DIPNAME( 0x07, 0x00, "Rank" ); PORT_DIPSETTING( 0x00, "A" ); PORT_DIPSETTING( 0x01, "B" ); PORT_DIPSETTING( 0x02, "C" ); PORT_DIPSETTING( 0x03, "D" ); PORT_DIPSETTING( 0x04, "E" ); PORT_DIPSETTING( 0x05, "F" ); PORT_DIPSETTING( 0x06, "G" ); PORT_DIPSETTING( 0x07, "H" ); PORT_DIPNAME( 0x18, 0x00, DEF_STR( "Coin_B") ); PORT_DIPSETTING( 0x18, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x00, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0x08, DEF_STR( "1C_5C")); PORT_DIPSETTING( 0x10, DEF_STR( "1C_7C") ); PORT_DIPNAME( 0x20, 0x00, DEF_STR( "Demo_Sounds") ); PORT_DIPSETTING( 0x20, DEF_STR( "Off") ); PORT_DIPSETTING( 0x00, DEF_STR( "On") ); PORT_BITX( 0x40, 0x00, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Rack Test", KEYCODE_F1, IP_JOY_NONE ); PORT_DIPSETTING( 0x00, DEF_STR( "Off") ); PORT_DIPSETTING( 0x40, DEF_STR( "On") ); PORT_DIPNAME( 0x80, 0x00, "Freeze" ); PORT_DIPSETTING( 0x00, DEF_STR( "Off") ); PORT_DIPSETTING( 0x80, DEF_STR( "On") ); PORT_START(); PORT_DIPNAME( 0x07, 0x00, DEF_STR( "Coin_A") ); PORT_DIPSETTING( 0x06, DEF_STR( "3C_1C") ); PORT_DIPSETTING( 0x04, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x07, DEF_STR( "3C_2C") ); PORT_DIPSETTING( 0x00, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0x05, DEF_STR( "2C_3C") ); PORT_DIPSETTING( 0x01, DEF_STR( "1C_2C") ); PORT_DIPSETTING( 0x02, DEF_STR( "1C_3C") ); PORT_DIPSETTING( 0x03, DEF_STR( "1C_6C") ); PORT_DIPNAME( 0x38, 0x00, DEF_STR( "Bonus_Life") ); PORT_DIPSETTING( 0x28, "20k 70k and every 70k" ); PORT_DIPSETTING( 0x30, "20k 80k and every 80k" ); PORT_DIPSETTING( 0x08, "20k 60k" ); PORT_DIPSETTING( 0x00, "20k 70k" ); PORT_DIPSETTING( 0x10, "20k 80k" ); PORT_DIPSETTING( 0x18, "30k 100k" ); PORT_DIPSETTING( 0x20, "20k" ); PORT_DIPSETTING( 0x38, "None" ) PORT_DIPNAME( 0xc0, 0x00, DEF_STR( "Lives") ); PORT_DIPSETTING( 0x80, "1" ); PORT_DIPSETTING( 0xc0, "2" ); PORT_DIPSETTING( 0x00, "3" ); PORT_DIPSETTING( 0x40, "5" ); PORT_START(); PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_UNUSED ); PORT_DIPNAME( 0x04, 0x00, DEF_STR( "Cabinet") ); PORT_DIPSETTING( 0x00, DEF_STR( "Upright") ); PORT_DIPSETTING( 0x04, DEF_STR( "Cocktail") ); PORT_SERVICE( 0x08, IP_ACTIVE_HIGH ); PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED ); PORT_START(); PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ); PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_2WAY ); PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ); PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_2WAY ); PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1, 1 ); PORT_BITX(0x20, IP_ACTIVE_HIGH, IPT_BUTTON1, null, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS ); PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED ); PORT_START(); PORT_BIT_IMPULSE( 0x01, IP_ACTIVE_HIGH, IPT_COIN1, 1 ) PORT_BIT_IMPULSE( 0x02, IP_ACTIVE_HIGH, IPT_COIN2, 1 ); PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ); PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_HIGH, IPT_START1, 1 ); PORT_BIT_IMPULSE( 0x20, IP_ACTIVE_HIGH, IPT_START2, 1 ); PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED ); PORT_START(); PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_COCKTAIL ); PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_COCKTAIL ); PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL, 1 ); PORT_BITX(0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL, null, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS ); INPUT_PORTS_END(); }
public void handler() { port_start(); port_dipname( 0x07, 0x00, "rank" ); port_dipsetting( 0x00, "a" ); port_dipsetting( 0x01, "b" ); port_dipsetting( 0x02, "c" ); port_dipsetting( 0x03, "d" ); port_dipsetting( 0x04, "e" ); port_dipsetting( 0x05, "f" ); port_dipsetting( 0x06, "g" ); port_dipsetting( 0x07, "h" ); port_dipname( 0x18, 0x00, def_str( "coin_b") ); port_dipsetting( 0x18, def_str( "2c_1c") ); port_dipsetting( 0x00, def_str( "1c_1c") ); port_dipsetting( 0x08, def_str( "1c_5c")); port_dipsetting( 0x10, def_str( "1c_7c") ); port_dipname( 0x20, 0x00, def_str( "demo_sounds") ); port_dipsetting( 0x20, def_str( "off") ); port_dipsetting( 0x00, def_str( "on") ); port_bitx( 0x40, 0x00, ipt_dipswitch_name | ipf_cheat, "rack test", keycode_f1, ip_joy_none ); port_dipsetting( 0x00, def_str( "off") ); port_dipsetting( 0x40, def_str( "on") ); port_dipname( 0x80, 0x00, "freeze" ); port_dipsetting( 0x00, def_str( "off") ); port_dipsetting( 0x80, def_str( "on") ); port_start(); port_dipname( 0x07, 0x00, def_str( "coin_a") ); port_dipsetting( 0x06, def_str( "3c_1c") ); port_dipsetting( 0x04, def_str( "2c_1c") ); port_dipsetting( 0x07, def_str( "3c_2c") ); port_dipsetting( 0x00, def_str( "1c_1c") ); port_dipsetting( 0x05, def_str( "2c_3c") ); port_dipsetting( 0x01, def_str( "1c_2c") ); port_dipsetting( 0x02, def_str( "1c_3c") ); port_dipsetting( 0x03, def_str( "1c_6c") ); port_dipname( 0x38, 0x00, def_str( "bonus_life") ); port_dipsetting( 0x28, "20k 70k and every 70k" ); port_dipsetting( 0x30, "20k 80k and every 80k" ); port_dipsetting( 0x08, "20k 60k" ); port_dipsetting( 0x00, "20k 70k" ); port_dipsetting( 0x10, "20k 80k" ); port_dipsetting( 0x18, "30k 100k" ); port_dipsetting( 0x20, "20k" ); port_dipsetting( 0x38, "none" ) port_dipname( 0xc0, 0x00, def_str( "lives") ); port_dipsetting( 0x80, "1" ); port_dipsetting( 0xc0, "2" ); port_dipsetting( 0x00, "3" ); port_dipsetting( 0x40, "5" ); port_start(); port_bit( 0x03, ip_active_high, ipt_unused ); port_dipname( 0x04, 0x00, def_str( "cabinet") ); port_dipsetting( 0x00, def_str( "upright") ); port_dipsetting( 0x04, def_str( "cocktail") ); port_service( 0x08, ip_active_high ); port_bit( 0xf0, ip_active_high, ipt_unused ); port_start(); port_bit( 0x01, ip_active_high, ipt_unused ); port_bit( 0x02, ip_active_high, ipt_joystick_right | ipf_2way ); port_bit( 0x04, ip_active_high, ipt_unused ); port_bit( 0x08, ip_active_high, ipt_joystick_left | ipf_2way ); port_bit_impulse( 0x10, ip_active_high, ipt_button1, 1 ); port_bitx(0x20, ip_active_high, ipt_button1, null, ip_key_previous, ip_joy_previous ); port_bit( 0xc0, ip_active_high, ipt_unused ); port_start(); port_bit_impulse( 0x01, ip_active_high, ipt_coin1, 1 ) port_bit_impulse( 0x02, ip_active_high, ipt_coin2, 1 ); port_bit( 0x0c, ip_active_high, ipt_unused ); port_bit_impulse( 0x10, ip_active_high, ipt_start1, 1 ); port_bit_impulse( 0x20, ip_active_high, ipt_start2, 1 ); port_bit( 0xc0, ip_active_high, ipt_unused ); port_start(); port_bit( 0x02, ip_active_high, ipt_joystick_right | ipf_2way | ipf_cocktail ); port_bit( 0x08, ip_active_high, ipt_joystick_left | ipf_2way | ipf_cocktail ); port_bit_impulse( 0x10, ip_active_high, ipt_button1 | ipf_cocktail, 1 ); port_bitx(0x20, ip_active_high, ipt_button1 | ipf_cocktail, null, ip_key_previous, ip_joy_previous ); input_ports_end(); }
javaemus/ArcoFlexDroid
[ 0, 1, 0, 0 ]
25,814
private void updateProcessorsContexts(Map<Long, Map<String, Object>> allContexts) { // this code used to be smart about which validator was used at which java-path, and provide only the contexts for that particular // java-path to the processor; but that doesn't work in SEER*DMS where some edits are persisted but not registered to the engine! for (ValidatingProcessor p : _processors.values()) p.setContexts(allContexts); }
private void updateProcessorsContexts(Map<Long, Map<String, Object>> allContexts) { for (ValidatingProcessor p : _processors.values()) p.setContexts(allContexts); }
private void updateprocessorscontexts(map<long, map<string, object>> allcontexts) { for (validatingprocessor p : _processors.values()) p.setcontexts(allcontexts); }
imsweb/validation
[ 1, 0, 0, 0 ]
9,444
public void dealWithEvent(WatchEvent<?> event) { // could expand more processes here LOG.info("{}:\t {} event.", event.context(), event.kind()); }
public void dealWithEvent(WatchEvent<?> event) { LOG.info("{}:\t {} event.", event.context(), event.kind()); }
public void dealwithevent(watchevent<?> event) { log.info("{}:\t {} event.", event.context(), event.kind()); }
huangzhanqiao/yuzhouwan
[ 0, 1, 0, 0 ]
25,930
@Override // TODO: copy header file inclusion public AFunction cloneOnFileImpl(String newName, AFile file) { // if (!function.hasBody()) { // /*add the clone to the original place in order to be included where needed */ // return makeCloneAndInsert(newName, function, true); // } /* if this is a definition, add the clone to the correct file */ // App app = getRootImpl().getNode(); // // Optional<TranslationUnit> file = app.getFile(fileName); // // if (!file.isPresent()) { // // TranslationUnit tu = getFactory().translationUnit(new File(fileName), Collections.emptyList()); // // app.addFile(tu); // // file = Optional.of(tu); // } var tu = (TranslationUnit) file.getNode(); var cloneFunction = makeCloneAndInsert(newName, tu, true); /* copy headers from the current file to the file with the clone */ TranslationUnit originalFile = function.getAncestorTry(TranslationUnit.class).orElse(null); if (originalFile != null) { var includesCopy = TreeNodeUtils.copy(originalFile.getIncludes().getIncludes()); // List<IncludeDecl> allIncludes = getIncludesCopyFromFile(originalFile); File baseIncludePath = null; // Add as many ../ as folders in the relative folder var relativeFolderDepth = tu.getRelativeFolderpath().map(folder -> SpecsIo.getDepth(new File(folder))) .orElse(0); for (int i = 0; i < relativeFolderDepth; i++) { baseIncludePath = new File(baseIncludePath, "../"); } // Add relative folder of original file var relativeDepth = baseIncludePath; baseIncludePath = originalFile.getRelativeFolderpath() .map(relativeFolder -> new File(relativeDepth, relativeFolder)) .orElse(baseIncludePath); // System.out.println("BASE: " + baseIncludePath); // System.out.println("DEPTH: " + relativeFolderDepth); // Adapt includes for (var includeDecl : includesCopy) { var include = includeDecl.getInclude(); // If angled, ignore if (include.isAngled()) { continue; } // System.out.println("INCLUDE BEFORE: " + includeDecl.getCode()); var newInclude = include.setInclude(new File(baseIncludePath, include.getInclude()).toString()); includeDecl.set(IncludeDecl.INCLUDE, newInclude); // System.out.println("INCLUDE AFTER: " + includeDecl.getCode()); } // Add includes includesCopy.stream().forEach(tu::addInclude); } return cloneFunction; }
@Override public AFunction cloneOnFileImpl(String newName, AFile file) { var tu = (TranslationUnit) file.getNode(); var cloneFunction = makeCloneAndInsert(newName, tu, true); TranslationUnit originalFile = function.getAncestorTry(TranslationUnit.class).orElse(null); if (originalFile != null) { var includesCopy = TreeNodeUtils.copy(originalFile.getIncludes().getIncludes()); File baseIncludePath = null; var relativeFolderDepth = tu.getRelativeFolderpath().map(folder -> SpecsIo.getDepth(new File(folder))) .orElse(0); for (int i = 0; i < relativeFolderDepth; i++) { baseIncludePath = new File(baseIncludePath, "../"); } var relativeDepth = baseIncludePath; baseIncludePath = originalFile.getRelativeFolderpath() .map(relativeFolder -> new File(relativeDepth, relativeFolder)) .orElse(baseIncludePath); for (var includeDecl : includesCopy) { var include = includeDecl.getInclude(); if (include.isAngled()) { continue; } var newInclude = include.setInclude(new File(baseIncludePath, include.getInclude()).toString()); includeDecl.set(IncludeDecl.INCLUDE, newInclude); } includesCopy.stream().forEach(tu::addInclude); } return cloneFunction; }
@override public afunction cloneonfileimpl(string newname, afile file) { var tu = (translationunit) file.getnode(); var clonefunction = makecloneandinsert(newname, tu, true); translationunit originalfile = function.getancestortry(translationunit.class).orelse(null); if (originalfile != null) { var includescopy = treenodeutils.copy(originalfile.getincludes().getincludes()); file baseincludepath = null; var relativefolderdepth = tu.getrelativefolderpath().map(folder -> specsio.getdepth(new file(folder))) .orelse(0); for (int i = 0; i < relativefolderdepth; i++) { baseincludepath = new file(baseincludepath, "../"); } var relativedepth = baseincludepath; baseincludepath = originalfile.getrelativefolderpath() .map(relativefolder -> new file(relativedepth, relativefolder)) .orelse(baseincludepath); for (var includedecl : includescopy) { var include = includedecl.getinclude(); if (include.isangled()) { continue; } var newinclude = include.setinclude(new file(baseincludepath, include.getinclude()).tostring()); includedecl.set(includedecl.include, newinclude); } includescopy.stream().foreach(tu::addinclude); } return clonefunction; }
joaonmatos/clava
[ 0, 1, 0, 0 ]
1,452
public ServerWebExchangeLimiterBuilder partitionByPathInfo( Function<String, String> pathToGroup) { return partitionResolver(exchange -> { // TODO: pathWithinApplication? String path = exchange.getRequest().getPath().contextPath().value(); return Optional.ofNullable(path).map(pathToGroup).orElse(null); }); }
public ServerWebExchangeLimiterBuilder partitionByPathInfo( Function<String, String> pathToGroup) { return partitionResolver(exchange -> { String path = exchange.getRequest().getPath().contextPath().value(); return Optional.ofNullable(path).map(pathToGroup).orElse(null); }); }
public serverwebexchangelimiterbuilder partitionbypathinfo( function<string, string> pathtogroup) { return partitionresolver(exchange -> { string path = exchange.getrequest().getpath().contextpath().value(); return optional.ofnullable(path).map(pathtogroup).orelse(null); }); }
gujiedmc/spring-cloud-netflix
[ 1, 0, 0, 0 ]
18,082
@Override public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) { URI requestUrl = exchange.getRequiredAttribute(GATEWAY_REQUEST_URL_ATTR); String scheme = requestUrl.getScheme(); if (isAlreadyRouted(exchange) || !"forward".equals(scheme)) { return chain.filter(exchange); } // TODO: translate url? if (log.isTraceEnabled()) { log.trace("Forwarding to URI: " + requestUrl); } /** * 匹配并转发到当前网关实例本地接口。 * 注意:需要通过 PrefixPathGatewayFilterFactory 将请求重写路径,以匹配本地 API ,否则 DispatcherHandler 转发会失败。 */ return this.getDispatcherHandler().handle(exchange); }
@Override public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) { URI requestUrl = exchange.getRequiredAttribute(GATEWAY_REQUEST_URL_ATTR); String scheme = requestUrl.getScheme(); if (isAlreadyRouted(exchange) || !"forward".equals(scheme)) { return chain.filter(exchange); } if (log.isTraceEnabled()) { log.trace("Forwarding to URI: " + requestUrl); } return this.getDispatcherHandler().handle(exchange); }
@override public mono<void> filter(serverwebexchange exchange, gatewayfilterchain chain) { uri requesturl = exchange.getrequiredattribute(gateway_request_url_attr); string scheme = requesturl.getscheme(); if (isalreadyrouted(exchange) || !"forward".equals(scheme)) { return chain.filter(exchange); } if (log.istraceenabled()) { log.trace("forwarding to uri: " + requesturl); } return this.getdispatcherhandler().handle(exchange); }
godblessthequeen/spring-cloud-gateway
[ 0, 1, 0, 0 ]
1,759
protected void doInjection(InjectElement injectElement, Screen<?> controller) { String name = getInjectionName(injectElement); Class<?> type = getInjectionType(injectElement); Object instance = getInjectedInstance(type, name, injectElement, controller); if (instance != null) { assignValue(injectElement.getElement(), instance, controller); } else { // TODO: gg, implement? } }
protected void doInjection(InjectElement injectElement, Screen<?> controller) { String name = getInjectionName(injectElement); Class<?> type = getInjectionType(injectElement); Object instance = getInjectedInstance(type, name, injectElement, controller); if (instance != null) { assignValue(injectElement.getElement(), instance, controller); } else { } }
protected void doinjection(injectelement injectelement, screen<?> controller) { string name = getinjectionname(injectelement); class<?> type = getinjectiontype(injectelement); object instance = getinjectedinstance(type, name, injectelement, controller); if (instance != null) { assignvalue(injectelement.getelement(), instance, controller); } else { } }
jmix-framework/jmix
[ 0, 1, 0, 0 ]
9,974
@Override public void testCreateTableWithColumnComment() { // TODO https://github.com/trinodb/trino/issues/12469 Support column comment when creating tables String tableName = "test_create_" + randomTableSuffix(); assertQueryFails( "CREATE TABLE " + tableName + "(" + "id INT WITH (primary_key=true)," + "a VARCHAR COMMENT 'test comment')" + "WITH (partition_by_hash_columns = ARRAY['id'], partition_by_hash_buckets = 2)", "This connector does not support creating tables with column comment"); assertUpdate("DROP TABLE IF EXISTS " + tableName); }
@Override public void testCreateTableWithColumnComment() { String tableName = "test_create_" + randomTableSuffix(); assertQueryFails( "CREATE TABLE " + tableName + "(" + "id INT WITH (primary_key=true)," + "a VARCHAR COMMENT 'test comment')" + "WITH (partition_by_hash_columns = ARRAY['id'], partition_by_hash_buckets = 2)", "This connector does not support creating tables with column comment"); assertUpdate("DROP TABLE IF EXISTS " + tableName); }
@override public void testcreatetablewithcolumncomment() { string tablename = "test_create_" + randomtablesuffix(); assertqueryfails( "create table " + tablename + "(" + "id int with (primary_key=true)," + "a varchar comment 'test comment')" + "with (partition_by_hash_columns = array['id'], partition_by_hash_buckets = 2)", "this connector does not support creating tables with column comment"); assertupdate("drop table if exists " + tablename); }
hitjl/trino
[ 1, 0, 0, 0 ]
26,362
public void checkOrUpdateToken() { // TODO check token is valid or refresh token from server? }
public void checkOrUpdateToken() { }
public void checkorupdatetoken() { }
hujianhong/DesignPattern
[ 0, 1, 0, 0 ]
2,038
@Override public Context start(String spanName, Context context) { Objects.requireNonNull(spanName, "'spanName' cannot be null."); Objects.requireNonNull(context, "'context' cannot be null."); Builder spanBuilder = getSpanBuilder(spanName, context); Span span = spanBuilder.startSpan(); if (span.isRecording()) { // TODO (savaity): replace with the AZ_TRACING_NAMESPACE_KEY String tracingNamespace = getOrDefault(context, "az.tracing.namespace", null, String.class); if (tracingNamespace != null) { span.setAttribute(AZ_NAMESPACE_KEY, AttributeValue.stringAttributeValue(tracingNamespace)); } } return context.addData(PARENT_SPAN_KEY, span); }
@Override public Context start(String spanName, Context context) { Objects.requireNonNull(spanName, "'spanName' cannot be null."); Objects.requireNonNull(context, "'context' cannot be null."); Builder spanBuilder = getSpanBuilder(spanName, context); Span span = spanBuilder.startSpan(); if (span.isRecording()) { String tracingNamespace = getOrDefault(context, "az.tracing.namespace", null, String.class); if (tracingNamespace != null) { span.setAttribute(AZ_NAMESPACE_KEY, AttributeValue.stringAttributeValue(tracingNamespace)); } } return context.addData(PARENT_SPAN_KEY, span); }
@override public context start(string spanname, context context) { objects.requirenonnull(spanname, "'spanname' cannot be null."); objects.requirenonnull(context, "'context' cannot be null."); builder spanbuilder = getspanbuilder(spanname, context); span span = spanbuilder.startspan(); if (span.isrecording()) { string tracingnamespace = getordefault(context, "az.tracing.namespace", null, string.class); if (tracingnamespace != null) { span.setattribute(az_namespace_key, attributevalue.stringattributevalue(tracingnamespace)); } } return context.adddata(parent_span_key, span); }
janjaali/azure-sdk-for-java
[ 1, 0, 0, 0 ]
2,046
@Test void testExampleWithSettingsReader() { // This way is not so good, once you cannot test for different values // to see how your application will behave. SettingsReader originalReader = new SettingsReader(); String v = originalReader.get(Settings.Home.address); Assertions.assertEquals("This is my house", v); }
@Test void testExampleWithSettingsReader() { SettingsReader originalReader = new SettingsReader(); String v = originalReader.get(Settings.Home.address); Assertions.assertEquals("This is my house", v); }
@test void testexamplewithsettingsreader() { settingsreader originalreader = new settingsreader(); string v = originalreader.get(settings.home.address); assertions.assertequals("this is my house", v); }
gabrsar/DynamicSettingsExample
[ 1, 0, 0, 0 ]
18,450
@Override protected void doSomeWork(long positionUs, long elapsedRealtimeUs) throws ExoPlaybackException { if (outputStreamEnded) { return; } sourceIsReady = source.continueBuffering(trackIndex, positionUs); checkForDiscontinuity(positionUs); // Try and read a format if we don't have one already. if (format == null && !readFormat(positionUs)) { // We can't make progress without one. return; } // If we don't have a decoder yet, we need to instantiate one. // TODO: Add support for dynamic switching between one type of surface to another. if (decoder == null) { decoder = new VpxDecoderWrapper(outputRgb); decoder.start(); } // Rendering loop. try { processOutputBuffer(positionUs, elapsedRealtimeUs); while (feedInputBuffer(positionUs)) {} } catch (VpxDecoderException e) { notifyDecoderError(e); throw new ExoPlaybackException(e); } }
@Override protected void doSomeWork(long positionUs, long elapsedRealtimeUs) throws ExoPlaybackException { if (outputStreamEnded) { return; } sourceIsReady = source.continueBuffering(trackIndex, positionUs); checkForDiscontinuity(positionUs); if (format == null && !readFormat(positionUs)) { return; } if (decoder == null) { decoder = new VpxDecoderWrapper(outputRgb); decoder.start(); } try { processOutputBuffer(positionUs, elapsedRealtimeUs); while (feedInputBuffer(positionUs)) {} } catch (VpxDecoderException e) { notifyDecoderError(e); throw new ExoPlaybackException(e); } }
@override protected void dosomework(long positionus, long elapsedrealtimeus) throws exoplaybackexception { if (outputstreamended) { return; } sourceisready = source.continuebuffering(trackindex, positionus); checkfordiscontinuity(positionus); if (format == null && !readformat(positionus)) { return; } if (decoder == null) { decoder = new vpxdecoderwrapper(outputrgb); decoder.start(); } try { processoutputbuffer(positionus, elapsedrealtimeus); while (feedinputbuffer(positionus)) {} } catch (vpxdecoderexception e) { notifydecodererror(e); throw new exoplaybackexception(e); } }
hori-ryota/ExoPlayer
[ 0, 1, 0, 0 ]
18,486
public void initialize(short[] normalizedCounts, int maxSymbol, int tableLog) { int tableSize = 1 << tableLog; // tableSize = 1 << 3 = 8 in my case byte[] table = new byte[tableSize]; // TODO: allocate in workspace // store the symbol which is spread int highThreshold = tableSize - 1; // highThreshold = 8 - 1 = 7 in my case // TODO: make sure FseCompressionTable has enough size log2Size = tableLog; // For explanations on how to distribute symbol values over the table: // http://fastcompression.blogspot.fr/2014/02/fse-distributing-symbol-values.html // symbol start positions int[] cumulative = new int[MAX_SYMBOL + 2]; // TODO: allocate in workspace // cumulative = [0,3,6,8,9] in my case // store the start position of every symbol cumulative[0] = 0; for (int i = 1; i <= maxSymbol + 1; i++) { if (normalizedCounts[i - 1] == -1) { // Low probability symbol cumulative[i] = cumulative[i - 1] + 1; table[highThreshold--] = (byte) (i - 1); } else { cumulative[i] = cumulative[i - 1] + normalizedCounts[i - 1]; } } cumulative[maxSymbol + 1] = tableSize + 1; // cumulative[3+1] = 8+1 = 9 // Spread symbols int position = spreadSymbols(normalizedCounts, maxSymbol, tableSize, highThreshold, table); // make sure the symbols are successfully spread if (position != 0) { throw new AssertionError("Spread symbols failed"); } // Build table // fill in CTable1 for (int i = 0; i < tableSize; i++) { byte symbol = table[i]; nextState[cumulative[symbol]++] = (short) (tableSize + i); /* TableU16 : sorted by symbol order; gives next state value */ } // Build symbol transformation table // fill in SymbolTT int total = 0; for (int symbol = 0; symbol <= maxSymbol; symbol++) { switch (normalizedCounts[symbol]) { case 0: deltaNumberOfBits[symbol] = ((tableLog + 1) << 16) - tableSize; break; case -1: case 1: deltaNumberOfBits[symbol] = (tableLog << 16) - tableSize; deltaFindState[symbol] = total - 1; total++; break; default: int maxBitsOut = tableLog - Util.highestBit(normalizedCounts[symbol] - 1); int minStatePlus = normalizedCounts[symbol] << maxBitsOut; deltaNumberOfBits[symbol] = (maxBitsOut << 16) - minStatePlus; deltaFindState[symbol] = total - normalizedCounts[symbol]; total += normalizedCounts[symbol]; break; } } }
public void initialize(short[] normalizedCounts, int maxSymbol, int tableLog) { int tableSize = 1 << tableLog; byte[] table = new byte[tableSize]; int highThreshold = tableSize - 1; log2Size = tableLog; int[] cumulative = new int[MAX_SYMBOL + 2]; cumulative[0] = 0; for (int i = 1; i <= maxSymbol + 1; i++) { if (normalizedCounts[i - 1] == -1) { cumulative[i] = cumulative[i - 1] + 1; table[highThreshold--] = (byte) (i - 1); } else { cumulative[i] = cumulative[i - 1] + normalizedCounts[i - 1]; } } cumulative[maxSymbol + 1] = tableSize + 1; int position = spreadSymbols(normalizedCounts, maxSymbol, tableSize, highThreshold, table); if (position != 0) { throw new AssertionError("Spread symbols failed"); } for (int i = 0; i < tableSize; i++) { byte symbol = table[i]; nextState[cumulative[symbol]++] = (short) (tableSize + i); } int total = 0; for (int symbol = 0; symbol <= maxSymbol; symbol++) { switch (normalizedCounts[symbol]) { case 0: deltaNumberOfBits[symbol] = ((tableLog + 1) << 16) - tableSize; break; case -1: case 1: deltaNumberOfBits[symbol] = (tableLog << 16) - tableSize; deltaFindState[symbol] = total - 1; total++; break; default: int maxBitsOut = tableLog - Util.highestBit(normalizedCounts[symbol] - 1); int minStatePlus = normalizedCounts[symbol] << maxBitsOut; deltaNumberOfBits[symbol] = (maxBitsOut << 16) - minStatePlus; deltaFindState[symbol] = total - normalizedCounts[symbol]; total += normalizedCounts[symbol]; break; } } }
public void initialize(short[] normalizedcounts, int maxsymbol, int tablelog) { int tablesize = 1 << tablelog; byte[] table = new byte[tablesize]; int highthreshold = tablesize - 1; log2size = tablelog; int[] cumulative = new int[max_symbol + 2]; cumulative[0] = 0; for (int i = 1; i <= maxsymbol + 1; i++) { if (normalizedcounts[i - 1] == -1) { cumulative[i] = cumulative[i - 1] + 1; table[highthreshold--] = (byte) (i - 1); } else { cumulative[i] = cumulative[i - 1] + normalizedcounts[i - 1]; } } cumulative[maxsymbol + 1] = tablesize + 1; int position = spreadsymbols(normalizedcounts, maxsymbol, tablesize, highthreshold, table); if (position != 0) { throw new assertionerror("spread symbols failed"); } for (int i = 0; i < tablesize; i++) { byte symbol = table[i]; nextstate[cumulative[symbol]++] = (short) (tablesize + i); } int total = 0; for (int symbol = 0; symbol <= maxsymbol; symbol++) { switch (normalizedcounts[symbol]) { case 0: deltanumberofbits[symbol] = ((tablelog + 1) << 16) - tablesize; break; case -1: case 1: deltanumberofbits[symbol] = (tablelog << 16) - tablesize; deltafindstate[symbol] = total - 1; total++; break; default: int maxbitsout = tablelog - util.highestbit(normalizedcounts[symbol] - 1); int minstateplus = normalizedcounts[symbol] << maxbitsout; deltanumberofbits[symbol] = (maxbitsout << 16) - minstateplus; deltafindstate[symbol] = total - normalizedcounts[symbol]; total += normalizedcounts[symbol]; break; } } }
ibelee/aircompressor
[ 0, 1, 0, 0 ]
10,317
public DmnModelInstance convert(InputStream inputStream) { SpreadsheetMLPackage spreadSheetPackage = null; try { spreadSheetPackage = SpreadsheetMLPackage.load(inputStream); } catch (Docx4JException e) { // TODO: checked exception throw new RuntimeException("cannot load document", e); } WorkbookPart workbookPart = spreadSheetPackage.getWorkbookPart(); // TODO: exception when no worksheet present // TODO: make worksheet number configurable/import all worksheets? XlsxWorksheetContext worksheetContext = null; WorksheetPart worksheetPart; try { String worksheetName; DocPropsExtendedPart docPropsExtendedPart = spreadSheetPackage.getDocPropsExtendedPart(); if(docPropsExtendedPart!= null && docPropsExtendedPart.getContents().getTitlesOfParts() != null) { worksheetName = (String) docPropsExtendedPart.getContents().getTitlesOfParts().getVector().getVariantOrI1OrI2().get(0).getValue(); } else { worksheetName = "default"; } worksheetPart = workbookPart.getWorksheet(0); SharedStrings sharedStrings = workbookPart.getSharedStrings(); worksheetContext = new XlsxWorksheetContext(sharedStrings.getContents(), worksheetPart.getContents(), worksheetName); } catch (Exception e) { throw new RuntimeException("Could not determine worksheet", e); } return new XlsxWorksheetConverter(worksheetContext, ioDetectionStrategy).convert(); }
public DmnModelInstance convert(InputStream inputStream) { SpreadsheetMLPackage spreadSheetPackage = null; try { spreadSheetPackage = SpreadsheetMLPackage.load(inputStream); } catch (Docx4JException e) { throw new RuntimeException("cannot load document", e); } WorkbookPart workbookPart = spreadSheetPackage.getWorkbookPart(); XlsxWorksheetContext worksheetContext = null; WorksheetPart worksheetPart; try { String worksheetName; DocPropsExtendedPart docPropsExtendedPart = spreadSheetPackage.getDocPropsExtendedPart(); if(docPropsExtendedPart!= null && docPropsExtendedPart.getContents().getTitlesOfParts() != null) { worksheetName = (String) docPropsExtendedPart.getContents().getTitlesOfParts().getVector().getVariantOrI1OrI2().get(0).getValue(); } else { worksheetName = "default"; } worksheetPart = workbookPart.getWorksheet(0); SharedStrings sharedStrings = workbookPart.getSharedStrings(); worksheetContext = new XlsxWorksheetContext(sharedStrings.getContents(), worksheetPart.getContents(), worksheetName); } catch (Exception e) { throw new RuntimeException("Could not determine worksheet", e); } return new XlsxWorksheetConverter(worksheetContext, ioDetectionStrategy).convert(); }
public dmnmodelinstance convert(inputstream inputstream) { spreadsheetmlpackage spreadsheetpackage = null; try { spreadsheetpackage = spreadsheetmlpackage.load(inputstream); } catch (docx4jexception e) { throw new runtimeexception("cannot load document", e); } workbookpart workbookpart = spreadsheetpackage.getworkbookpart(); xlsxworksheetcontext worksheetcontext = null; worksheetpart worksheetpart; try { string worksheetname; docpropsextendedpart docpropsextendedpart = spreadsheetpackage.getdocpropsextendedpart(); if(docpropsextendedpart!= null && docpropsextendedpart.getcontents().gettitlesofparts() != null) { worksheetname = (string) docpropsextendedpart.getcontents().gettitlesofparts().getvector().getvariantori1ori2().get(0).getvalue(); } else { worksheetname = "default"; } worksheetpart = workbookpart.getworksheet(0); sharedstrings sharedstrings = workbookpart.getsharedstrings(); worksheetcontext = new xlsxworksheetcontext(sharedstrings.getcontents(), worksheetpart.getcontents(), worksheetname); } catch (exception e) { throw new runtimeexception("could not determine worksheet", e); } return new xlsxworksheetconverter(worksheetcontext, iodetectionstrategy).convert(); }
gerdreiss/camunda-dmn-xlsx
[ 1, 1, 0, 0 ]
18,768
@Test public void testLast() { // TODO: Test with file that has BOM // TODO: Test with file that has multiple bytes for the last codepoint // TODO: Test with file that requires a surrogate pair for the last codepoint assertThat(utf8It.last()).isEqualTo('g'); }
@Test public void testLast() { assertThat(utf8It.last()).isEqualTo('g'); }
@test public void testlast() { assertthat(utf8it.last()).isequalto('g'); }
hatfieldlibrary/solr-ocrhighlighting
[ 0, 0, 0, 1 ]
18,959
@Test public void testCascadeMergeWithNewEntity() { setUp(); EntityMasterCascade master = new EntityMasterCascade(); master.setDescription("Master version 1"); entityManager.persist(master); Integer masterId = master.getPersistenceId(); EntityDetailCascade detail = new EntityDetailCascade(); detail.setMaster(master); detail.setDescription("Detail version 1"); entityManager.persist(detail); Integer detailId = detail.getPersistenceId(); tearDown(); // retrieve persistence versions Integer masterVersion = master.getPersistenceVersion(); Integer detailVersion = detail.getPersistenceVersion(); // modify detached entity: add a new master assertEquals(master, detail.getMaster()); detail.setDescription("Detail version 2"); EntityMasterCascade newMaster = new EntityMasterCascade(); newMaster.setDescription("New Master version 1"); detail.setMaster(newMaster); setUp(); // MUDO: this persist is only needed because cascading is not working // for a new entity when merge is used entityManager.persist(newMaster); // get a managed copy from the merge operation detail = entityManager.merge(detail); Integer newMasterId = detail.getMaster().getPersistenceId(); tearDown(); // verification setUp(); master = entityManager.find(EntityMasterCascade.class, masterId); detail = entityManager.find(EntityDetailCascade.class, detailId); newMaster = entityManager.find(EntityMasterCascade.class, newMasterId); assertTrue(masterVersion.compareTo(master.getPersistenceVersion())==0); assertTrue(detailVersion.compareTo(detail.getPersistenceVersion())<0); assertEquals(newMaster, detail.getMaster()); assertEquals(1, newMaster.getDetails().size()); assertEquals(0, master.getDetails().size()); for (EntityDetailCascade d : newMaster.getDetails()) { assertEquals(detail, d); } tearDown(); }
@Test public void testCascadeMergeWithNewEntity() { setUp(); EntityMasterCascade master = new EntityMasterCascade(); master.setDescription("Master version 1"); entityManager.persist(master); Integer masterId = master.getPersistenceId(); EntityDetailCascade detail = new EntityDetailCascade(); detail.setMaster(master); detail.setDescription("Detail version 1"); entityManager.persist(detail); Integer detailId = detail.getPersistenceId(); tearDown(); Integer masterVersion = master.getPersistenceVersion(); Integer detailVersion = detail.getPersistenceVersion(); assertEquals(master, detail.getMaster()); detail.setDescription("Detail version 2"); EntityMasterCascade newMaster = new EntityMasterCascade(); newMaster.setDescription("New Master version 1"); detail.setMaster(newMaster); setUp(); entityManager.persist(newMaster); detail = entityManager.merge(detail); Integer newMasterId = detail.getMaster().getPersistenceId(); tearDown(); setUp(); master = entityManager.find(EntityMasterCascade.class, masterId); detail = entityManager.find(EntityDetailCascade.class, detailId); newMaster = entityManager.find(EntityMasterCascade.class, newMasterId); assertTrue(masterVersion.compareTo(master.getPersistenceVersion())==0); assertTrue(detailVersion.compareTo(detail.getPersistenceVersion())<0); assertEquals(newMaster, detail.getMaster()); assertEquals(1, newMaster.getDetails().size()); assertEquals(0, master.getDetails().size()); for (EntityDetailCascade d : newMaster.getDetails()) { assertEquals(detail, d); } tearDown(); }
@test public void testcascademergewithnewentity() { setup(); entitymastercascade master = new entitymastercascade(); master.setdescription("master version 1"); entitymanager.persist(master); integer masterid = master.getpersistenceid(); entitydetailcascade detail = new entitydetailcascade(); detail.setmaster(master); detail.setdescription("detail version 1"); entitymanager.persist(detail); integer detailid = detail.getpersistenceid(); teardown(); integer masterversion = master.getpersistenceversion(); integer detailversion = detail.getpersistenceversion(); assertequals(master, detail.getmaster()); detail.setdescription("detail version 2"); entitymastercascade newmaster = new entitymastercascade(); newmaster.setdescription("new master version 1"); detail.setmaster(newmaster); setup(); entitymanager.persist(newmaster); detail = entitymanager.merge(detail); integer newmasterid = detail.getmaster().getpersistenceid(); teardown(); setup(); master = entitymanager.find(entitymastercascade.class, masterid); detail = entitymanager.find(entitydetailcascade.class, detailid); newmaster = entitymanager.find(entitymastercascade.class, newmasterid); asserttrue(masterversion.compareto(master.getpersistenceversion())==0); asserttrue(detailversion.compareto(detail.getpersistenceversion())<0); assertequals(newmaster, detail.getmaster()); assertequals(1, newmaster.getdetails().size()); assertequals(0, master.getdetails().size()); for (entitydetailcascade d : newmaster.getdetails()) { assertequals(detail, d); } teardown(); }
jandppw/ppwcode
[ 1, 0, 0, 0 ]
10,979
@Override public int choosePartition(Message msg, TopicMetadata metadata) { // if key is specified, we should use key as routing; // if key is not specified and no sequence id is provided, not an effectively-once publish, use the default // round-robin routing. if (msg.hasKey() || msg.getSequenceId() < 0) { // TODO: the message key routing is problematic at this moment. // https://github.com/apache/incubator-pulsar/pull/1029 is fixing that. return super.choosePartition(msg, metadata); } // if there is no key and sequence id is provided, it is an effectively-once publish, we need to ensure // for a given message it always go to one partition, so we use sequence id to do a deterministic routing. return (int) (msg.getSequenceId() % metadata.numPartitions()); }
@Override public int choosePartition(Message msg, TopicMetadata metadata) { if (msg.hasKey() || msg.getSequenceId() < 0) { return super.choosePartition(msg, metadata); } return (int) (msg.getSequenceId() % metadata.numPartitions()); }
@override public int choosepartition(message msg, topicmetadata metadata) { if (msg.haskey() || msg.getsequenceid() < 0) { return super.choosepartition(msg, metadata); } return (int) (msg.getsequenceid() % metadata.numpartitions()); }
ialvarez79/pulsar
[ 0, 0, 1, 0 ]
11,039
@RequestMapping(value = "/logs", method = RequestMethod.POST) @ResponseBody public String logs(@RequestBody String body) throws IOException { // "application/logplex-1" does not conform to RFC5424. // It leaves out STRUCTURED-DATA but does not replace it with // a NILVALUE. To workaround this, we inject empty STRUCTURED-DATA. String[] parts = body.split("router - "); String log = parts[0] + "router - [] " + (parts.length > 1 ? parts[1] : ""); RFC6587SyslogDeserializer parser = new RFC6587SyslogDeserializer(); InputStream is = new ByteArrayInputStream(log.getBytes()); Map<String, ?> messages = parser.deserialize(is); ObjectMapper mapper = new ObjectMapper(); MessageChannel toKafka = context.getBean("toKafka", MessageChannel.class); String json = mapper.writeValueAsString(messages); toKafka.send(new GenericMessage<>(json)); return "ok"; }
@RequestMapping(value = "/logs", method = RequestMethod.POST) @ResponseBody public String logs(@RequestBody String body) throws IOException { String[] parts = body.split("router - "); String log = parts[0] + "router - [] " + (parts.length > 1 ? parts[1] : ""); RFC6587SyslogDeserializer parser = new RFC6587SyslogDeserializer(); InputStream is = new ByteArrayInputStream(log.getBytes()); Map<String, ?> messages = parser.deserialize(is); ObjectMapper mapper = new ObjectMapper(); MessageChannel toKafka = context.getBean("toKafka", MessageChannel.class); String json = mapper.writeValueAsString(messages); toKafka.send(new GenericMessage<>(json)); return "ok"; }
@requestmapping(value = "/logs", method = requestmethod.post) @responsebody public string logs(@requestbody string body) throws ioexception { string[] parts = body.split("router - "); string log = parts[0] + "router - [] " + (parts.length > 1 ? parts[1] : ""); rfc6587syslogdeserializer parser = new rfc6587syslogdeserializer(); inputstream is = new bytearrayinputstream(log.getbytes()); map<string, ?> messages = parser.deserialize(is); objectmapper mapper = new objectmapper(); messagechannel tokafka = context.getbean("tokafka", messagechannel.class); string json = mapper.writevalueasstring(messages); tokafka.send(new genericmessage<>(json)); return "ok"; }
jkutner/heroku-replay-spring
[ 1, 0, 0, 0 ]
19,239
public void drawFrameInThread() { if (frameBuffer == null) { return; // Framebuffer is not up yet } // Select gpuToVram PBO an read pixels from GPU to VRAM glBindBuffer(GL_PIXEL_PACK_BUFFER, gpuToVram); glReadPixels(0, 0, frameBuffer.getWidth(), frameBuffer.getHeight(), GL_BGRA, GL_UNSIGNED_BYTE, 0); // Select vramToSys PBO, bind it to systemRam and copy the data over glBindBuffer(GL_PIXEL_PACK_BUFFER, vramToSys); ByteBuffer byteBuf = glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY, null); // Swap indices int previousGpuToVram = gpuToVram; gpuToVram = vramToSys; vramToSys = previousGpuToVram; if (byteBuf == null) { return; } convertScreenShot2(byteBuf.asIntBuffer(), bufferedImage); // Unmap buffer glUnmapBuffer(GL_PIXEL_PACK_BUFFER); // Unbind PBO glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); synchronized (lock) { // All operations on strategy should be synchronized (?) if (strategy == null) { try { createBufferStrategy(1, new BufferCapabilities(new ImageCapabilities(true), new ImageCapabilities(true), BufferCapabilities.FlipContents.UNDEFINED)); } catch (AWTException ex) { ex.printStackTrace(); } strategy = getBufferStrategy(); printIfDebug(getClass().getSimpleName() + ": Visible. Create strategy."); } // Draw screenshot. do { do { Graphics2D g2d = (Graphics2D) strategy.getDrawGraphics(); if (g2d == null) { printIfDebug(getClass().getSimpleName() + ": DrawGraphics was null."); return; } g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED); // g2d.drawImage(img, transformOp, 0, 0); g2d.drawImage(bufferedImage, 0, 0, null); g2d.dispose(); strategy.show(); } while (strategy.contentsRestored()); } while (strategy.contentsLost()); } }
public void drawFrameInThread() { if (frameBuffer == null) { return; } glBindBuffer(GL_PIXEL_PACK_BUFFER, gpuToVram); glReadPixels(0, 0, frameBuffer.getWidth(), frameBuffer.getHeight(), GL_BGRA, GL_UNSIGNED_BYTE, 0); glBindBuffer(GL_PIXEL_PACK_BUFFER, vramToSys); ByteBuffer byteBuf = glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY, null); int previousGpuToVram = gpuToVram; gpuToVram = vramToSys; vramToSys = previousGpuToVram; if (byteBuf == null) { return; } convertScreenShot2(byteBuf.asIntBuffer(), bufferedImage); glUnmapBuffer(GL_PIXEL_PACK_BUFFER); glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); synchronized (lock) { if (strategy == null) { try { createBufferStrategy(1, new BufferCapabilities(new ImageCapabilities(true), new ImageCapabilities(true), BufferCapabilities.FlipContents.UNDEFINED)); } catch (AWTException ex) { ex.printStackTrace(); } strategy = getBufferStrategy(); printIfDebug(getClass().getSimpleName() + ": Visible. Create strategy."); } do { do { Graphics2D g2d = (Graphics2D) strategy.getDrawGraphics(); if (g2d == null) { printIfDebug(getClass().getSimpleName() + ": DrawGraphics was null."); return; } g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED); g2d.drawImage(bufferedImage, 0, 0, null); g2d.dispose(); strategy.show(); } while (strategy.contentsRestored()); } while (strategy.contentsLost()); } }
public void drawframeinthread() { if (framebuffer == null) { return; } glbindbuffer(gl_pixel_pack_buffer, gputovram); glreadpixels(0, 0, framebuffer.getwidth(), framebuffer.getheight(), gl_bgra, gl_unsigned_byte, 0); glbindbuffer(gl_pixel_pack_buffer, vramtosys); bytebuffer bytebuf = glmapbuffer(gl_pixel_pack_buffer, gl_read_only, null); int previousgputovram = gputovram; gputovram = vramtosys; vramtosys = previousgputovram; if (bytebuf == null) { return; } convertscreenshot2(bytebuf.asintbuffer(), bufferedimage); glunmapbuffer(gl_pixel_pack_buffer); glbindbuffer(gl_pixel_pack_buffer, 0); synchronized (lock) { if (strategy == null) { try { createbufferstrategy(1, new buffercapabilities(new imagecapabilities(true), new imagecapabilities(true), buffercapabilities.flipcontents.undefined)); } catch (awtexception ex) { ex.printstacktrace(); } strategy = getbufferstrategy(); printifdebug(getclass().getsimplename() + ": visible. create strategy."); } do { do { graphics2d g2d = (graphics2d) strategy.getdrawgraphics(); if (g2d == null) { printifdebug(getclass().getsimplename() + ": drawgraphics was null."); return; } g2d.setrenderinghint(renderinghints.key_rendering, renderinghints.value_render_speed); g2d.drawimage(bufferedimage, 0, 0, null); g2d.dispose(); strategy.show(); } while (strategy.contentsrestored()); } while (strategy.contentslost()); } }
ihmcrobotics/ihmc-jmonkey-engine-toolkit
[ 1, 0, 0, 0 ]
11,207
@NonNull @Override public final ListenableFuture<InitialResult<T>> loadInitial( @NonNull final ListenablePositionalDataSource.LoadInitialParams params) { final ResolvableFuture<InitialResult<T>> future = ResolvableFuture.create(); getExecutor().execute(new Runnable() { @Override public void run() { final LoadInitialParams newParams = new LoadInitialParams( params.requestedStartPosition, params.requestedLoadSize, params.pageSize, params.placeholdersEnabled); LoadInitialCallback<T> callback = new LoadInitialCallback<T>() { @Override public void onResult(@NonNull List<T> data, int position, int totalCount) { if (isInvalid()) { // NOTE: this isInvalid() check works around // https://issuetracker.google.com/issues/124511903 future.set(new InitialResult<>(Collections.<T>emptyList(), 0, 0)); } else { setFuture(newParams, new InitialResult<>(data, position, totalCount)); } } @Override public void onResult(@NonNull List<T> data, int position) { if (isInvalid()) { // NOTE: this isInvalid() check works around // https://issuetracker.google.com/issues/124511903 future.set(new InitialResult<>(Collections.<T>emptyList(), 0)); } else { setFuture(newParams, new InitialResult<>(data, position)); } } private void setFuture( @NonNull ListenablePositionalDataSource.LoadInitialParams params, @NonNull InitialResult<T> result) { if (params.placeholdersEnabled) { result.validateForInitialTiling(params.pageSize); } future.set(result); } @Override public void onError(@NonNull Throwable error) { future.setException(error); } }; loadInitial(newParams, callback); } }); return future; }
@NonNull @Override public final ListenableFuture<InitialResult<T>> loadInitial( @NonNull final ListenablePositionalDataSource.LoadInitialParams params) { final ResolvableFuture<InitialResult<T>> future = ResolvableFuture.create(); getExecutor().execute(new Runnable() { @Override public void run() { final LoadInitialParams newParams = new LoadInitialParams( params.requestedStartPosition, params.requestedLoadSize, params.pageSize, params.placeholdersEnabled); LoadInitialCallback<T> callback = new LoadInitialCallback<T>() { @Override public void onResult(@NonNull List<T> data, int position, int totalCount) { if (isInvalid()) { future.set(new InitialResult<>(Collections.<T>emptyList(), 0, 0)); } else { setFuture(newParams, new InitialResult<>(data, position, totalCount)); } } @Override public void onResult(@NonNull List<T> data, int position) { if (isInvalid()) { future.set(new InitialResult<>(Collections.<T>emptyList(), 0)); } else { setFuture(newParams, new InitialResult<>(data, position)); } } private void setFuture( @NonNull ListenablePositionalDataSource.LoadInitialParams params, @NonNull InitialResult<T> result) { if (params.placeholdersEnabled) { result.validateForInitialTiling(params.pageSize); } future.set(result); } @Override public void onError(@NonNull Throwable error) { future.setException(error); } }; loadInitial(newParams, callback); } }); return future; }
@nonnull @override public final listenablefuture<initialresult<t>> loadinitial( @nonnull final listenablepositionaldatasource.loadinitialparams params) { final resolvablefuture<initialresult<t>> future = resolvablefuture.create(); getexecutor().execute(new runnable() { @override public void run() { final loadinitialparams newparams = new loadinitialparams( params.requestedstartposition, params.requestedloadsize, params.pagesize, params.placeholdersenabled); loadinitialcallback<t> callback = new loadinitialcallback<t>() { @override public void onresult(@nonnull list<t> data, int position, int totalcount) { if (isinvalid()) { future.set(new initialresult<>(collections.<t>emptylist(), 0, 0)); } else { setfuture(newparams, new initialresult<>(data, position, totalcount)); } } @override public void onresult(@nonnull list<t> data, int position) { if (isinvalid()) { future.set(new initialresult<>(collections.<t>emptylist(), 0)); } else { setfuture(newparams, new initialresult<>(data, position)); } } private void setfuture( @nonnull listenablepositionaldatasource.loadinitialparams params, @nonnull initialresult<t> result) { if (params.placeholdersenabled) { result.validateforinitialtiling(params.pagesize); } future.set(result); } @override public void onerror(@nonnull throwable error) { future.setexception(error); } }; loadinitial(newparams, callback); } }); return future; }
j420247/platform_frameworks_support
[ 1, 0, 0, 0 ]
19,457
private void leave(String reason, EntityBareJid alternateAddress) { OperationSetBasicTelephonyJabberImpl basicTelephony = (OperationSetBasicTelephonyJabberImpl) provider .getOperationSet(OperationSetBasicTelephony.class); if(basicTelephony != null && this.publishedConference != null) { ActiveCallsRepositoryJabberImpl activeRepository = basicTelephony.getActiveCallsRepository(); String callid = publishedConference.getCallId(); if (callid != null) { CallJabberImpl call = activeRepository.findCallId(callid); for(CallPeerJabberImpl peer : call.getCallPeerList()) { try { peer.hangup(false, null, null); } catch (NotConnectedException | InterruptedException e) { logger.error("Could not hangup peer " + peer.getAddress(), e); } } } } List<CallJabberImpl> tmpConferenceCalls; synchronized (chatRoomConferenceCalls) { tmpConferenceCalls = new ArrayList<CallJabberImpl>(chatRoomConferenceCalls); chatRoomConferenceCalls.clear(); } for(CallJabberImpl call : tmpConferenceCalls) { for(CallPeerJabberImpl peer : call.getCallPeerList()) { try { peer.hangup(false, null, null); } catch (NotConnectedException | InterruptedException e) { logger.error("Could not hangup peer " + peer.getAddress(), e); } } } clearCachedConferenceDescriptionList(); XMPPConnection connection = this.provider.getConnection(); try { // if we are already disconnected // leave maybe called from gui when closing chat window if(connection != null) multiUserChat.leave(); } catch(Throwable e) { logger.warn("Error occured while leaving, maybe just " + "disconnected before leaving", e); } // FIXME Do we have to do the following when we leave the room? Hashtable<Resourcepart, ChatRoomMemberJabberImpl> membersCopy; synchronized (members) { membersCopy = new Hashtable<>(members); // Delete the list of members members.clear(); } for (ChatRoomMember member : membersCopy.values()) fireMemberPresenceEvent( member, ChatRoomMemberPresenceChangeEvent.MEMBER_LEFT, "Local user has left the chat room."); // connection can be null if we are leaving cause connection failed if(connection != null) { connection.removeAsyncStanzaListener(invitationRejectionListeners); if(presenceListener != null) { connection.removeAsyncStanzaListener(presenceListener); presenceListener = null; } } opSetMuc.fireLocalUserPresenceEvent( this, LocalUserChatRoomPresenceChangeEvent.LOCAL_USER_LEFT, reason, alternateAddress != null ? alternateAddress.toString() : null); }
private void leave(String reason, EntityBareJid alternateAddress) { OperationSetBasicTelephonyJabberImpl basicTelephony = (OperationSetBasicTelephonyJabberImpl) provider .getOperationSet(OperationSetBasicTelephony.class); if(basicTelephony != null && this.publishedConference != null) { ActiveCallsRepositoryJabberImpl activeRepository = basicTelephony.getActiveCallsRepository(); String callid = publishedConference.getCallId(); if (callid != null) { CallJabberImpl call = activeRepository.findCallId(callid); for(CallPeerJabberImpl peer : call.getCallPeerList()) { try { peer.hangup(false, null, null); } catch (NotConnectedException | InterruptedException e) { logger.error("Could not hangup peer " + peer.getAddress(), e); } } } } List<CallJabberImpl> tmpConferenceCalls; synchronized (chatRoomConferenceCalls) { tmpConferenceCalls = new ArrayList<CallJabberImpl>(chatRoomConferenceCalls); chatRoomConferenceCalls.clear(); } for(CallJabberImpl call : tmpConferenceCalls) { for(CallPeerJabberImpl peer : call.getCallPeerList()) { try { peer.hangup(false, null, null); } catch (NotConnectedException | InterruptedException e) { logger.error("Could not hangup peer " + peer.getAddress(), e); } } } clearCachedConferenceDescriptionList(); XMPPConnection connection = this.provider.getConnection(); try { if(connection != null) multiUserChat.leave(); } catch(Throwable e) { logger.warn("Error occured while leaving, maybe just " + "disconnected before leaving", e); } Hashtable<Resourcepart, ChatRoomMemberJabberImpl> membersCopy; synchronized (members) { membersCopy = new Hashtable<>(members); members.clear(); } for (ChatRoomMember member : membersCopy.values()) fireMemberPresenceEvent( member, ChatRoomMemberPresenceChangeEvent.MEMBER_LEFT, "Local user has left the chat room."); if(connection != null) { connection.removeAsyncStanzaListener(invitationRejectionListeners); if(presenceListener != null) { connection.removeAsyncStanzaListener(presenceListener); presenceListener = null; } } opSetMuc.fireLocalUserPresenceEvent( this, LocalUserChatRoomPresenceChangeEvent.LOCAL_USER_LEFT, reason, alternateAddress != null ? alternateAddress.toString() : null); }
private void leave(string reason, entitybarejid alternateaddress) { operationsetbasictelephonyjabberimpl basictelephony = (operationsetbasictelephonyjabberimpl) provider .getoperationset(operationsetbasictelephony.class); if(basictelephony != null && this.publishedconference != null) { activecallsrepositoryjabberimpl activerepository = basictelephony.getactivecallsrepository(); string callid = publishedconference.getcallid(); if (callid != null) { calljabberimpl call = activerepository.findcallid(callid); for(callpeerjabberimpl peer : call.getcallpeerlist()) { try { peer.hangup(false, null, null); } catch (notconnectedexception | interruptedexception e) { logger.error("could not hangup peer " + peer.getaddress(), e); } } } } list<calljabberimpl> tmpconferencecalls; synchronized (chatroomconferencecalls) { tmpconferencecalls = new arraylist<calljabberimpl>(chatroomconferencecalls); chatroomconferencecalls.clear(); } for(calljabberimpl call : tmpconferencecalls) { for(callpeerjabberimpl peer : call.getcallpeerlist()) { try { peer.hangup(false, null, null); } catch (notconnectedexception | interruptedexception e) { logger.error("could not hangup peer " + peer.getaddress(), e); } } } clearcachedconferencedescriptionlist(); xmppconnection connection = this.provider.getconnection(); try { if(connection != null) multiuserchat.leave(); } catch(throwable e) { logger.warn("error occured while leaving, maybe just " + "disconnected before leaving", e); } hashtable<resourcepart, chatroommemberjabberimpl> memberscopy; synchronized (members) { memberscopy = new hashtable<>(members); members.clear(); } for (chatroommember member : memberscopy.values()) firememberpresenceevent( member, chatroommemberpresencechangeevent.member_left, "local user has left the chat room."); if(connection != null) { connection.removeasyncstanzalistener(invitationrejectionlisteners); if(presencelistener != null) { connection.removeasyncstanzalistener(presencelistener); presencelistener = null; } } opsetmuc.firelocaluserpresenceevent( this, localuserchatroompresencechangeevent.local_user_left, reason, alternateaddress != null ? alternateaddress.tostring() : null); }
hamilton467/jitsi
[ 1, 0, 0, 0 ]
3,213
protected abstract Object[] significantAttributes();
protected abstract Object[] significantAttributes();
protected abstract object[] significantattributes();
grimwm/flatcode
[ 1, 0, 0, 0 ]
11,466
@JsonGetter("x-apiheader_cc") public String getXApiheaderCc ( ) { return this.xApiheaderCc; }
@JsonGetter("x-apiheader_cc") public String getXApiheaderCc ( ) { return this.xApiheaderCc; }
@jsongetter("x-apiheader_cc") public string getxapiheadercc ( ) { return this.xapiheadercc; }
geniusdibya/pepipost-sdk-java
[ 0, 0, 0, 0 ]
11,467
@JsonSetter("x-apiheader_cc") public void setXApiheaderCc (String value) { this.xApiheaderCc = value; }
@JsonSetter("x-apiheader_cc") public void setXApiheaderCc (String value) { this.xApiheaderCc = value; }
@jsonsetter("x-apiheader_cc") public void setxapiheadercc (string value) { this.xapiheadercc = value; }
geniusdibya/pepipost-sdk-java
[ 0, 0, 0, 0 ]
11,468
@JsonGetter("x-apiheader") public String getXApiheader ( ) { return this.xApiheader; }
@JsonGetter("x-apiheader") public String getXApiheader ( ) { return this.xApiheader; }
@jsongetter("x-apiheader") public string getxapiheader ( ) { return this.xapiheader; }
geniusdibya/pepipost-sdk-java
[ 0, 0, 0, 0 ]
11,469
@JsonSetter("x-apiheader") public void setXApiheader (String value) { this.xApiheader = value; }
@JsonSetter("x-apiheader") public void setXApiheader (String value) { this.xApiheader = value; }
@jsonsetter("x-apiheader") public void setxapiheader (string value) { this.xapiheader = value; }
geniusdibya/pepipost-sdk-java
[ 0, 0, 0, 0 ]
11,470
@JsonGetter("attributes") public Object getAttributes ( ) { return this.attributes; }
@JsonGetter("attributes") public Object getAttributes ( ) { return this.attributes; }
@jsongetter("attributes") public object getattributes ( ) { return this.attributes; }
geniusdibya/pepipost-sdk-java
[ 0, 0, 0, 0 ]
11,471
@JsonSetter("attributes") public void setAttributes (Object value) { this.attributes = value; }
@JsonSetter("attributes") public void setAttributes (Object value) { this.attributes = value; }
@jsonsetter("attributes") public void setattributes (object value) { this.attributes = value; }
geniusdibya/pepipost-sdk-java
[ 0, 0, 0, 0 ]
11,472
@JsonGetter("attachments") public List<Attachments> getAttachments ( ) { return this.attachments; }
@JsonGetter("attachments") public List<Attachments> getAttachments ( ) { return this.attachments; }
@jsongetter("attachments") public list<attachments> getattachments ( ) { return this.attachments; }
geniusdibya/pepipost-sdk-java
[ 0, 0, 0, 0 ]
11,473
@JsonSetter("attachments") public void setAttachments (List<Attachments> value) { this.attachments = value; }
@JsonSetter("attachments") public void setAttachments (List<Attachments> value) { this.attachments = value; }
@jsonsetter("attachments") public void setattachments (list<attachments> value) { this.attachments = value; }
geniusdibya/pepipost-sdk-java
[ 0, 0, 0, 0 ]
11,474
@JsonGetter("recipient_cc") public List<String> getRecipientCc ( ) { return this.recipientCc; }
@JsonGetter("recipient_cc") public List<String> getRecipientCc ( ) { return this.recipientCc; }
@jsongetter("recipient_cc") public list<string> getrecipientcc ( ) { return this.recipientcc; }
geniusdibya/pepipost-sdk-java
[ 0, 0, 0, 0 ]
11,475
@JsonSetter("recipient_cc") public void setRecipientCc (List<String> value) { this.recipientCc = value; }
@JsonSetter("recipient_cc") public void setRecipientCc (List<String> value) { this.recipientCc = value; }
@jsonsetter("recipient_cc") public void setrecipientcc (list<string> value) { this.recipientcc = value; }
geniusdibya/pepipost-sdk-java
[ 0, 0, 0, 0 ]
3,347
private Charge createDisputedCharge(int chargeValueCents, RequestOptions options) throws AuthenticationException, InvalidRequestException, APIConnectionException, CardException, APIException, InterruptedException { Map<String, Object> chargeParams = new HashMap<String, Object>(); chargeParams.putAll(defaultChargeParams); chargeParams.put("amount", chargeValueCents); chargeParams.put("source", "tok_createDispute"); Charge charge = Charge.create(chargeParams, options); // This test relies on the server asynchronously marking the charge as disputed. // TODO: find a more reliable way to do this instead of sleeping Thread.sleep(10000); Map<String, Object> retrieveParams = new HashMap<String, Object>(); retrieveParams.put("expand[]", "dispute"); return Charge.retrieve(charge.getId(), retrieveParams, options); }
private Charge createDisputedCharge(int chargeValueCents, RequestOptions options) throws AuthenticationException, InvalidRequestException, APIConnectionException, CardException, APIException, InterruptedException { Map<String, Object> chargeParams = new HashMap<String, Object>(); chargeParams.putAll(defaultChargeParams); chargeParams.put("amount", chargeValueCents); chargeParams.put("source", "tok_createDispute"); Charge charge = Charge.create(chargeParams, options); Thread.sleep(10000); Map<String, Object> retrieveParams = new HashMap<String, Object>(); retrieveParams.put("expand[]", "dispute"); return Charge.retrieve(charge.getId(), retrieveParams, options); }
private charge createdisputedcharge(int chargevaluecents, requestoptions options) throws authenticationexception, invalidrequestexception, apiconnectionexception, cardexception, apiexception, interruptedexception { map<string, object> chargeparams = new hashmap<string, object>(); chargeparams.putall(defaultchargeparams); chargeparams.put("amount", chargevaluecents); chargeparams.put("source", "tok_createdispute"); charge charge = charge.create(chargeparams, options); thread.sleep(10000); map<string, object> retrieveparams = new hashmap<string, object>(); retrieveparams.put("expand[]", "dispute"); return charge.retrieve(charge.getid(), retrieveparams, options); }
hardeepnagi/stripe-java
[ 1, 0, 0, 0 ]
3,349
@Override public void onInitialize() { super.onInitialize(); // unpack model final Map<String, Object> modelData = this.model.getObject(); final String eid = (String) modelData.get("eid"); final String firstName = (String) modelData.get("firstName"); final String lastName = (String) modelData.get("lastName"); final String displayName = (String) modelData.get("displayName"); final GbStudentNameSortOrder nameSortOrder = (GbStudentNameSortOrder) modelData.get("nameSortOrder"); // link final GbAjaxLink<String> link = new GbAjaxLink<String>("link") { private static final long serialVersionUID = 1L; @Override public void onClick(final AjaxRequestTarget target) { final GradebookPage gradebookPage = (GradebookPage) getPage(); final GbModalWindow window = gradebookPage.getStudentGradeSummaryWindow(); final GradebookUiSettings settings = gradebookPage.getUiSettings(); final Map<String, Object> windowModel = new HashMap<>(StudentNameCellPanel.this.model.getObject()); windowModel.put("groupedByCategoryByDefault", settings.isCategoriesEnabled()); final Component content = new StudentGradeSummaryPanel(window.getContentId(), Model.ofMap(windowModel), window); if (window.isShown() && window.isVisible()) { window.replace(content); content.setVisible(true); target.add(content); } else { window.setContent(content); window.setComponentToReturnFocusTo(this); window.show(target); } content.setOutputMarkupId(true); final String modalTitle = (new StringResourceModel("heading.studentsummary", null, new Object[] { displayName, eid })).getString(); target.appendJavaScript(String.format( "new GradebookGradeSummary($(\"#%s\"), false, \"%s\");", content.getMarkupId(), modalTitle)); } }; link.setOutputMarkupId(true); // name label link.add(new Label("name", getFormattedStudentName(firstName, lastName, nameSortOrder))); // eid label, configurable link.add(new Label("eid", eid) { private static final long serialVersionUID = 1L; @Override public boolean isVisible() { return true; // TODO use config, will need to be passed in the model map } }); add(link); }
@Override public void onInitialize() { super.onInitialize(); final Map<String, Object> modelData = this.model.getObject(); final String eid = (String) modelData.get("eid"); final String firstName = (String) modelData.get("firstName"); final String lastName = (String) modelData.get("lastName"); final String displayName = (String) modelData.get("displayName"); final GbStudentNameSortOrder nameSortOrder = (GbStudentNameSortOrder) modelData.get("nameSortOrder"); final GbAjaxLink<String> link = new GbAjaxLink<String>("link") { private static final long serialVersionUID = 1L; @Override public void onClick(final AjaxRequestTarget target) { final GradebookPage gradebookPage = (GradebookPage) getPage(); final GbModalWindow window = gradebookPage.getStudentGradeSummaryWindow(); final GradebookUiSettings settings = gradebookPage.getUiSettings(); final Map<String, Object> windowModel = new HashMap<>(StudentNameCellPanel.this.model.getObject()); windowModel.put("groupedByCategoryByDefault", settings.isCategoriesEnabled()); final Component content = new StudentGradeSummaryPanel(window.getContentId(), Model.ofMap(windowModel), window); if (window.isShown() && window.isVisible()) { window.replace(content); content.setVisible(true); target.add(content); } else { window.setContent(content); window.setComponentToReturnFocusTo(this); window.show(target); } content.setOutputMarkupId(true); final String modalTitle = (new StringResourceModel("heading.studentsummary", null, new Object[] { displayName, eid })).getString(); target.appendJavaScript(String.format( "new GradebookGradeSummary($(\"#%s\"), false, \"%s\");", content.getMarkupId(), modalTitle)); } }; link.setOutputMarkupId(true); link.add(new Label("name", getFormattedStudentName(firstName, lastName, nameSortOrder))); link.add(new Label("eid", eid) { private static final long serialVersionUID = 1L; @Override public boolean isVisible() { return true; } }); add(link); }
@override public void oninitialize() { super.oninitialize(); final map<string, object> modeldata = this.model.getobject(); final string eid = (string) modeldata.get("eid"); final string firstname = (string) modeldata.get("firstname"); final string lastname = (string) modeldata.get("lastname"); final string displayname = (string) modeldata.get("displayname"); final gbstudentnamesortorder namesortorder = (gbstudentnamesortorder) modeldata.get("namesortorder"); final gbajaxlink<string> link = new gbajaxlink<string>("link") { private static final long serialversionuid = 1l; @override public void onclick(final ajaxrequesttarget target) { final gradebookpage gradebookpage = (gradebookpage) getpage(); final gbmodalwindow window = gradebookpage.getstudentgradesummarywindow(); final gradebookuisettings settings = gradebookpage.getuisettings(); final map<string, object> windowmodel = new hashmap<>(studentnamecellpanel.this.model.getobject()); windowmodel.put("groupedbycategorybydefault", settings.iscategoriesenabled()); final component content = new studentgradesummarypanel(window.getcontentid(), model.ofmap(windowmodel), window); if (window.isshown() && window.isvisible()) { window.replace(content); content.setvisible(true); target.add(content); } else { window.setcontent(content); window.setcomponenttoreturnfocusto(this); window.show(target); } content.setoutputmarkupid(true); final string modaltitle = (new stringresourcemodel("heading.studentsummary", null, new object[] { displayname, eid })).getstring(); target.appendjavascript(string.format( "new gradebookgradesummary($(\"#%s\"), false, \"%s\");", content.getmarkupid(), modaltitle)); } }; link.setoutputmarkupid(true); link.add(new label("name", getformattedstudentname(firstname, lastname, namesortorder))); link.add(new label("eid", eid) { private static final long serialversionuid = 1l; @override public boolean isvisible() { return true; } }); add(link); }
jd3538/Marist-Sakai-11.x
[ 0, 1, 0, 0 ]
11,653
private void configureComponents() { //Associate the data with the formLayout columns and load the data. try { //1 - Set properties of the form this.formLayout.addClassName("fichier-form"); this.formLayout.setSizeFull(); //sets the form size to fill the screen. //2 - Define the Fields instances to use - We don't use .setLabel since we will use addFormItem instead of add to add items to the form - addFormItem allows us to set SuperTextField with on a FormaLayout when add doesn't this.txtCodeDomaineActivite.setWidth(100, Unit.PIXELS); this.txtCodeDomaineActivite.setRequired(true); this.txtCodeDomaineActivite.setRequiredIndicatorVisible(true); this.txtCodeDomaineActivite.addClassName(TEXTFIELD_LEFT_LABEL); this.txtLibelleDomaineActivite.setWidth(400, Unit.PIXELS); this.txtLibelleDomaineActivite.addClassName(TEXTFIELD_LEFT_LABEL); this.txtLibelleCourtDomaineActivite.setWidth(400, Unit.PIXELS); this.txtLibelleCourtDomaineActivite.addClassName(TEXTFIELD_LEFT_LABEL); this.cboCodeSecteurActivite.setWidth(400, Unit.PIXELS); this.cboCodeSecteurActivite.addClassName(COMBOBOX_LEFT_LABEL); // Choose which property from SecteurActivite is the presentation value this.cboCodeSecteurActivite.setItemLabelGenerator(SecteurActivite::getLibelleSecteurActivite); this.cboCodeSecteurActivite.setRequired(true); this.cboCodeSecteurActivite.setRequiredIndicatorVisible(true); //???this.cboCodeSecteurActivite.setLabel("SecteurActivite"); //???this.cboCodeSecteurActivite.setId("person"); this.cboCodeSecteurActivite.setClearButtonVisible(true); //Add Filtering this.cboCodeSecteurActivite.setAllowCustomValue(true); this.cboCodeSecteurActivite.setPreventInvalidInput(true); this.cboCodeSecteurActivite.addValueChangeListener(event -> { if (event.getValue() != null) { //BeforeUpdate CodeSecteurActivite (CIF): Contrôle de Inactif if (event.getValue().isInactif() == true) { MessageDialogHelper.showWarningDialog("Erreur de Saisie", "Le Secteur d'Activité choisi est actuellement désactivé. Veuillez en saisir un autre."); //Cancel this.cboCodeSecteurActivite.setValue(event.getOldValue()); } //if (event.getValue() != null) { } }); /** * Allow users to enter a value which doesn't exist in the data set, and * set it as the value of the ComboBox. */ this.cboCodeSecteurActivite.addCustomValueSetListener(event -> { this.cboCodeSecteurActivite_NotInList(event.getDetail(), 50); }); this.chkInactif.setAutofocus(false); //Sepecific for isInactif //3 - Bind Fields instances to use (Manual Data Binding) // Easily bind forms to beans and manage validation and buffering //To bind a component to read-only data, use a null value for the setter. Label lblCodeDomaineActiviteValidationStatus = new Label(); this.binder.forField(this.txtCodeDomaineActivite) .asRequired("La Saisie du Code Domaine d'Activité est Obligatoire. Veuillez saisir le Code Domaine d'Activité.") .withValidator(text -> text != null && text.length() <= 10, "Code Domaine d'Activité ne peut contenir au plus 10 caractères") .withValidationStatusHandler(status -> {lblCodeDomaineActiviteValidationStatus.setText(status.getMessage().orElse("")); lblCodeDomaineActiviteValidationStatus.setVisible(status.isError());}) .bind(DomaineActivite::getCodeDomaineActivite, DomaineActivite::setCodeDomaineActivite); Label lblLibelleDomaineActiviteValidationStatus = new Label(); this.binder.forField(this.txtLibelleDomaineActivite) .withValidator(text -> text.length() <= 50, "Libellé Domaine d'Activité ne peut contenir au plus 50 caractères.") .withValidationStatusHandler(status -> {lblLibelleDomaineActiviteValidationStatus.setText(status.getMessage().orElse("")); lblLibelleDomaineActiviteValidationStatus.setVisible(status.isError());}) .bind(DomaineActivite::getLibelleDomaineActivite, DomaineActivite::setLibelleDomaineActivite); Label lblLibelleCourtDomaineActiviteValidationStatus = new Label(); this.binder.forField(this.txtLibelleCourtDomaineActivite) .withValidator(text -> text.length() <= 20, "Libellé Abrégé Domaine d'Activité ne peut contenir au plus 20 caractères.") .withValidationStatusHandler(status -> {lblLibelleCourtDomaineActiviteValidationStatus.setText(status.getMessage().orElse("")); lblLibelleCourtDomaineActiviteValidationStatus.setVisible(status.isError());}) .bind(DomaineActivite::getLibelleCourtDomaineActivite, DomaineActivite::setLibelleCourtDomaineActivite); Label lblSecteurActiviteValidationStatus = new Label(); this.binder.forField(this.cboCodeSecteurActivite) .asRequired("La Saisie du Secteur d'Activité est requise. Veuillez sélectionner un Secteur d'Activité") .bind(DomaineActivite::getSecteurActivite, DomaineActivite::setSecteurActivite); this.binder.forField(this.chkInactif) .bind(DomaineActivite::isInactif, DomaineActivite::setInactif); /* 3 - Alternative : Bind Fields instances that need validators manually and then bind all remaining fields using the bindInstanceFields method this.binder.bindInstanceFields(this.formLayout); //Automatic Data Binding //bindInstanceFields matches fields in DomaineActivite and DomaineActiviteView based on their names. */ //4 - Add input fields to formLayout - We don't use .setLabel since we will use addFormItem instead of add to add items to the form - addFormItem allows us to set SuperTextField with on a FormaLayout when add doesn't //this.formLayout.add(this.txtCodeDomaineActivite, this.txtLibelleDomaineActivite, this.txtLibelleCourtDomaineActivite, this.chkInactif); //4 - Alternative this.formLayout.addFormItem(this.txtCodeDomaineActivite, "Code Domaine d'Activité :").getStyle().set("--vaadin-form-item-label-width", FORM_ITEM_LABEL_WIDTH250); this.formLayout.addFormItem(this.txtLibelleDomaineActivite, "Libellé Domaine d'Activité :").getStyle().set("--vaadin-form-item-label-width", FORM_ITEM_LABEL_WIDTH250); this.formLayout.addFormItem(this.txtLibelleCourtDomaineActivite, "Libellé Abrégé Domaine d'Activité :").getStyle().set("--vaadin-form-item-label-width", FORM_ITEM_LABEL_WIDTH250); this.formLayout.addFormItem(this.cboCodeSecteurActivite, "Secteur d'Activité :").getStyle().set("--vaadin-form-item-label-width", FORM_ITEM_LABEL_WIDTH250); this.formLayout.addFormItem(this.chkInactif, "Inactif :").getStyle().set("--vaadin-form-item-label-width", FORM_ITEM_LABEL_WIDTH250); //5 - Making the Layout Responsive : Custom responsive layouting //breakpoint at 600px, with the label to the side. At resolutions lower than 600px, the label will be at the top. In both cases there is only 1 column. this.formLayout.setResponsiveSteps(new FormLayout.ResponsiveStep("0", 1, FormLayout.ResponsiveStep.LabelsPosition.TOP), new FormLayout.ResponsiveStep(PANEL_FLEX_BASIS, 1, FormLayout.ResponsiveStep.LabelsPosition.ASIDE)); } catch (Exception e) { MessageDialogHelper.showAlertDialog("EditerDomaineActiviteDialog.configureComponents", e.toString()); e.printStackTrace(); } }
private void configureComponents() { try { this.formLayout.addClassName("fichier-form"); this.formLayout.setSizeFull(); this.txtCodeDomaineActivite.setWidth(100, Unit.PIXELS); this.txtCodeDomaineActivite.setRequired(true); this.txtCodeDomaineActivite.setRequiredIndicatorVisible(true); this.txtCodeDomaineActivite.addClassName(TEXTFIELD_LEFT_LABEL); this.txtLibelleDomaineActivite.setWidth(400, Unit.PIXELS); this.txtLibelleDomaineActivite.addClassName(TEXTFIELD_LEFT_LABEL); this.txtLibelleCourtDomaineActivite.setWidth(400, Unit.PIXELS); this.txtLibelleCourtDomaineActivite.addClassName(TEXTFIELD_LEFT_LABEL); this.cboCodeSecteurActivite.setWidth(400, Unit.PIXELS); this.cboCodeSecteurActivite.addClassName(COMBOBOX_LEFT_LABEL); this.cboCodeSecteurActivite.setItemLabelGenerator(SecteurActivite::getLibelleSecteurActivite); this.cboCodeSecteurActivite.setRequired(true); this.cboCodeSecteurActivite.setRequiredIndicatorVisible(true); this.cboCodeSecteurActivite.setClearButtonVisible(true); this.cboCodeSecteurActivite.setAllowCustomValue(true); this.cboCodeSecteurActivite.setPreventInvalidInput(true); this.cboCodeSecteurActivite.addValueChangeListener(event -> { if (event.getValue() != null) { if (event.getValue().isInactif() == true) { MessageDialogHelper.showWarningDialog("Erreur de Saisie", "Le Secteur d'Activité choisi est actuellement désactivé. Veuillez en saisir un autre."); this.cboCodeSecteurActivite.setValue(event.getOldValue()); } } }); this.cboCodeSecteurActivite.addCustomValueSetListener(event -> { this.cboCodeSecteurActivite_NotInList(event.getDetail(), 50); }); this.chkInactif.setAutofocus(false); Label lblCodeDomaineActiviteValidationStatus = new Label(); this.binder.forField(this.txtCodeDomaineActivite) .asRequired("La Saisie du Code Domaine d'Activité est Obligatoire. Veuillez saisir le Code Domaine d'Activité.") .withValidator(text -> text != null && text.length() <= 10, "Code Domaine d'Activité ne peut contenir au plus 10 caractères") .withValidationStatusHandler(status -> {lblCodeDomaineActiviteValidationStatus.setText(status.getMessage().orElse("")); lblCodeDomaineActiviteValidationStatus.setVisible(status.isError());}) .bind(DomaineActivite::getCodeDomaineActivite, DomaineActivite::setCodeDomaineActivite); Label lblLibelleDomaineActiviteValidationStatus = new Label(); this.binder.forField(this.txtLibelleDomaineActivite) .withValidator(text -> text.length() <= 50, "Libellé Domaine d'Activité ne peut contenir au plus 50 caractères.") .withValidationStatusHandler(status -> {lblLibelleDomaineActiviteValidationStatus.setText(status.getMessage().orElse("")); lblLibelleDomaineActiviteValidationStatus.setVisible(status.isError());}) .bind(DomaineActivite::getLibelleDomaineActivite, DomaineActivite::setLibelleDomaineActivite); Label lblLibelleCourtDomaineActiviteValidationStatus = new Label(); this.binder.forField(this.txtLibelleCourtDomaineActivite) .withValidator(text -> text.length() <= 20, "Libellé Abrégé Domaine d'Activité ne peut contenir au plus 20 caractères.") .withValidationStatusHandler(status -> {lblLibelleCourtDomaineActiviteValidationStatus.setText(status.getMessage().orElse("")); lblLibelleCourtDomaineActiviteValidationStatus.setVisible(status.isError());}) .bind(DomaineActivite::getLibelleCourtDomaineActivite, DomaineActivite::setLibelleCourtDomaineActivite); Label lblSecteurActiviteValidationStatus = new Label(); this.binder.forField(this.cboCodeSecteurActivite) .asRequired("La Saisie du Secteur d'Activité est requise. Veuillez sélectionner un Secteur d'Activité") .bind(DomaineActivite::getSecteurActivite, DomaineActivite::setSecteurActivite); this.binder.forField(this.chkInactif) .bind(DomaineActivite::isInactif, DomaineActivite::setInactif); this.formLayout.addFormItem(this.txtCodeDomaineActivite, "Code Domaine d'Activité :").getStyle().set("--vaadin-form-item-label-width", FORM_ITEM_LABEL_WIDTH250); this.formLayout.addFormItem(this.txtLibelleDomaineActivite, "Libellé Domaine d'Activité :").getStyle().set("--vaadin-form-item-label-width", FORM_ITEM_LABEL_WIDTH250); this.formLayout.addFormItem(this.txtLibelleCourtDomaineActivite, "Libellé Abrégé Domaine d'Activité :").getStyle().set("--vaadin-form-item-label-width", FORM_ITEM_LABEL_WIDTH250); this.formLayout.addFormItem(this.cboCodeSecteurActivite, "Secteur d'Activité :").getStyle().set("--vaadin-form-item-label-width", FORM_ITEM_LABEL_WIDTH250); this.formLayout.addFormItem(this.chkInactif, "Inactif :").getStyle().set("--vaadin-form-item-label-width", FORM_ITEM_LABEL_WIDTH250); this.formLayout.setResponsiveSteps(new FormLayout.ResponsiveStep("0", 1, FormLayout.ResponsiveStep.LabelsPosition.TOP), new FormLayout.ResponsiveStep(PANEL_FLEX_BASIS, 1, FormLayout.ResponsiveStep.LabelsPosition.ASIDE)); } catch (Exception e) { MessageDialogHelper.showAlertDialog("EditerDomaineActiviteDialog.configureComponents", e.toString()); e.printStackTrace(); } }
private void configurecomponents() { try { this.formlayout.addclassname("fichier-form"); this.formlayout.setsizefull(); this.txtcodedomaineactivite.setwidth(100, unit.pixels); this.txtcodedomaineactivite.setrequired(true); this.txtcodedomaineactivite.setrequiredindicatorvisible(true); this.txtcodedomaineactivite.addclassname(textfield_left_label); this.txtlibelledomaineactivite.setwidth(400, unit.pixels); this.txtlibelledomaineactivite.addclassname(textfield_left_label); this.txtlibellecourtdomaineactivite.setwidth(400, unit.pixels); this.txtlibellecourtdomaineactivite.addclassname(textfield_left_label); this.cbocodesecteuractivite.setwidth(400, unit.pixels); this.cbocodesecteuractivite.addclassname(combobox_left_label); this.cbocodesecteuractivite.setitemlabelgenerator(secteuractivite::getlibellesecteuractivite); this.cbocodesecteuractivite.setrequired(true); this.cbocodesecteuractivite.setrequiredindicatorvisible(true); this.cbocodesecteuractivite.setclearbuttonvisible(true); this.cbocodesecteuractivite.setallowcustomvalue(true); this.cbocodesecteuractivite.setpreventinvalidinput(true); this.cbocodesecteuractivite.addvaluechangelistener(event -> { if (event.getvalue() != null) { if (event.getvalue().isinactif() == true) { messagedialoghelper.showwarningdialog("erreur de saisie", "le secteur d'activité choisi est actuellement désactivé. veuillez en saisir un autre."); this.cbocodesecteuractivite.setvalue(event.getoldvalue()); } } }); this.cbocodesecteuractivite.addcustomvaluesetlistener(event -> { this.cbocodesecteuractivite_notinlist(event.getdetail(), 50); }); this.chkinactif.setautofocus(false); label lblcodedomaineactivitevalidationstatus = new label(); this.binder.forfield(this.txtcodedomaineactivite) .asrequired("la saisie du code domaine d'activité est obligatoire. veuillez saisir le code domaine d'activité.") .withvalidator(text -> text != null && text.length() <= 10, "code domaine d'activité ne peut contenir au plus 10 caractères") .withvalidationstatushandler(status -> {lblcodedomaineactivitevalidationstatus.settext(status.getmessage().orelse("")); lblcodedomaineactivitevalidationstatus.setvisible(status.iserror());}) .bind(domaineactivite::getcodedomaineactivite, domaineactivite::setcodedomaineactivite); label lbllibelledomaineactivitevalidationstatus = new label(); this.binder.forfield(this.txtlibelledomaineactivite) .withvalidator(text -> text.length() <= 50, "libellé domaine d'activité ne peut contenir au plus 50 caractères.") .withvalidationstatushandler(status -> {lbllibelledomaineactivitevalidationstatus.settext(status.getmessage().orelse("")); lbllibelledomaineactivitevalidationstatus.setvisible(status.iserror());}) .bind(domaineactivite::getlibelledomaineactivite, domaineactivite::setlibelledomaineactivite); label lbllibellecourtdomaineactivitevalidationstatus = new label(); this.binder.forfield(this.txtlibellecourtdomaineactivite) .withvalidator(text -> text.length() <= 20, "libellé abrégé domaine d'activité ne peut contenir au plus 20 caractères.") .withvalidationstatushandler(status -> {lbllibellecourtdomaineactivitevalidationstatus.settext(status.getmessage().orelse("")); lbllibellecourtdomaineactivitevalidationstatus.setvisible(status.iserror());}) .bind(domaineactivite::getlibellecourtdomaineactivite, domaineactivite::setlibellecourtdomaineactivite); label lblsecteuractivitevalidationstatus = new label(); this.binder.forfield(this.cbocodesecteuractivite) .asrequired("la saisie du secteur d'activité est requise. veuillez sélectionner un secteur d'activité") .bind(domaineactivite::getsecteuractivite, domaineactivite::setsecteuractivite); this.binder.forfield(this.chkinactif) .bind(domaineactivite::isinactif, domaineactivite::setinactif); this.formlayout.addformitem(this.txtcodedomaineactivite, "code domaine d'activité :").getstyle().set("--vaadin-form-item-label-width", form_item_label_width250); this.formlayout.addformitem(this.txtlibelledomaineactivite, "libellé domaine d'activité :").getstyle().set("--vaadin-form-item-label-width", form_item_label_width250); this.formlayout.addformitem(this.txtlibellecourtdomaineactivite, "libellé abrégé domaine d'activité :").getstyle().set("--vaadin-form-item-label-width", form_item_label_width250); this.formlayout.addformitem(this.cbocodesecteuractivite, "secteur d'activité :").getstyle().set("--vaadin-form-item-label-width", form_item_label_width250); this.formlayout.addformitem(this.chkinactif, "inactif :").getstyle().set("--vaadin-form-item-label-width", form_item_label_width250); this.formlayout.setresponsivesteps(new formlayout.responsivestep("0", 1, formlayout.responsivestep.labelsposition.top), new formlayout.responsivestep(panel_flex_basis, 1, formlayout.responsivestep.labelsposition.aside)); } catch (exception e) { messagedialoghelper.showalertdialog("editerdomaineactivitedialog.configurecomponents", e.tostring()); e.printstacktrace(); } }
jdissou/sigdep01_01
[ 1, 0, 0, 0 ]
3,516
public int read(ByteBuffer buffer) { if (disconnected) return -1; int startPos = readBuffer.position(); int bufferRemaining = buffer.remaining(); int readBufferRemaining = readBuffer.remaining(); if (bufferRemaining >= readBufferRemaining) buffer.put(readBuffer); else { // TODO this could be optimized for (int i = 0; i < bufferRemaining; i++) buffer.put(readBuffer.get()); } return readBuffer.position() - startPos; }
public int read(ByteBuffer buffer) { if (disconnected) return -1; int startPos = readBuffer.position(); int bufferRemaining = buffer.remaining(); int readBufferRemaining = readBuffer.remaining(); if (bufferRemaining >= readBufferRemaining) buffer.put(readBuffer); else { for (int i = 0; i < bufferRemaining; i++) buffer.put(readBuffer.get()); } return readBuffer.position() - startPos; }
public int read(bytebuffer buffer) { if (disconnected) return -1; int startpos = readbuffer.position(); int bufferremaining = buffer.remaining(); int readbufferremaining = readbuffer.remaining(); if (bufferremaining >= readbufferremaining) buffer.put(readbuffer); else { for (int i = 0; i < bufferremaining; i++) buffer.put(readbuffer.get()); } return readbuffer.position() - startpos; }
george-mcintyre/epics-core-java-backport-1.5
[ 1, 0, 0, 0 ]
3,517
public int write(ByteBuffer buffer) throws IOException { if (disconnected) return -1; // TODO: not by the JavaDoc API spec if (throwExceptionOnSend) throw new IOException("text IO exception"); // we could write remaining bytes, but for test this is enough if (buffer.remaining() > writeBuffer.remaining()) return 0; int startPos = buffer.position(); writeBuffer.put(buffer); return buffer.position() - startPos; }
public int write(ByteBuffer buffer) throws IOException { if (disconnected) return -1; if (throwExceptionOnSend) throw new IOException("text IO exception"); if (buffer.remaining() > writeBuffer.remaining()) return 0; int startPos = buffer.position(); writeBuffer.put(buffer); return buffer.position() - startPos; }
public int write(bytebuffer buffer) throws ioexception { if (disconnected) return -1; if (throwexceptiononsend) throw new ioexception("text io exception"); if (buffer.remaining() > writebuffer.remaining()) return 0; int startpos = buffer.position(); writebuffer.put(buffer); return buffer.position() - startpos; }
george-mcintyre/epics-core-java-backport-1.5
[ 1, 0, 0, 0 ]
3,520
private KeyAttributes getDefaultKeyAttributes() { KeyAttributes keyAttributes = new KeyAttributes(); keyAttributes.setAlgorithm("RSA"); keyAttributes.setMode("ECB"); keyAttributes.setDigestAlgorithm("SHA-384"); // keyAttributes.id; keyAttributes.setKeyLength(3072); // keyAttributes.name; keyAttributes.setPaddingMode("OAEPWithSHA-384AndMGF1Padding"); keyAttributes.setRole("keyEncryption"); // keyAttributes.transferPolicy; // no transfer policy because this key is not transferable; maybe this should be a urn with "private" at the end. return keyAttributes; }
private KeyAttributes getDefaultKeyAttributes() { KeyAttributes keyAttributes = new KeyAttributes(); keyAttributes.setAlgorithm("RSA"); keyAttributes.setMode("ECB"); keyAttributes.setDigestAlgorithm("SHA-384"); keyAttributes.setKeyLength(3072); keyAttributes.setPaddingMode("OAEPWithSHA-384AndMGF1Padding"); keyAttributes.setRole("keyEncryption"); return keyAttributes; }
private keyattributes getdefaultkeyattributes() { keyattributes keyattributes = new keyattributes(); keyattributes.setalgorithm("rsa"); keyattributes.setmode("ecb"); keyattributes.setdigestalgorithm("sha-384"); keyattributes.setkeylength(3072); keyattributes.setpaddingmode("oaepwithsha-384andmgf1padding"); keyattributes.setrole("keyencryption"); return keyattributes; }
intel-secl/key-broker-service
[ 0, 0, 1, 0 ]
11,748
@Test public void testAddressCreateAsBtcOnTestnet() { Network network = Network.findBuiltin("bitcoin-testnet").get(); Optional<Address> ob1 = Address.create("mm7DDqVkFd35XcWecFipfTYM5dByBzn7nq", network); assertTrue(ob1.isPresent()); Address b1 = ob1.get(); assertEquals("mm7DDqVkFd35XcWecFipfTYM5dByBzn7nq", b1.toString()); // TODO: Expand coverage }
@Test public void testAddressCreateAsBtcOnTestnet() { Network network = Network.findBuiltin("bitcoin-testnet").get(); Optional<Address> ob1 = Address.create("mm7DDqVkFd35XcWecFipfTYM5dByBzn7nq", network); assertTrue(ob1.isPresent()); Address b1 = ob1.get(); assertEquals("mm7DDqVkFd35XcWecFipfTYM5dByBzn7nq", b1.toString()); }
@test public void testaddresscreateasbtcontestnet() { network network = network.findbuiltin("bitcoin-testnet").get(); optional<address> ob1 = address.create("mm7ddqvkfd35xcwecfipftym5dbybzn7nq", network); asserttrue(ob1.ispresent()); address b1 = ob1.get(); assertequals("mm7ddqvkfd35xcwecfipftym5dbybzn7nq", b1.tostring()); }
globalid/walletkit
[ 0, 0, 0, 1 ]
3,563
protected final char[] readLine() throws IOException { boolean foundLine = false; char[] returnLine = null; char[] partialLine = null; while (!foundLine) { // System.out.println("readline " + positionInBuffer + " " + new // String(buffer)); if (positionInBuffer < 0 || !buffer.hasRemaining()) { // read more data charactersRead = read(); totalCharactersRead += charactersRead; positionInBuffer = 0; } int[] lineBoundaries = getNextLineBoundaries(positionInBuffer, charactersRead, buffer); int lengthOfLine; if (lineBoundaries[0] < 0 && lineBoundaries[1] < 0) { // We reached the end of the buffer and did not find a new line. // reset positionInBuffer // Continue and read in more data if (charactersRead < 0) { return partialLine; } positionInBuffer = -1; continue; } else if (lineBoundaries[1] >= 0) { // Newline found lengthOfLine = lineBoundaries[1] - Math.max(0, lineBoundaries[0]) + 1; } else { lengthOfLine = charactersRead - lineBoundaries[0]; } /************************************************************************************************ * TODO I think this is broken because lineBounardaries[0] is not * taken into account when populating the buffer like it was in * System.arrayCopy *************************************************************************************************/ if (charactersRead < 0) { // We've reached the end of the file return partialLine; } else if (lineBoundaries[0] >= 0) { if (lineBoundaries[1] < 0) { // If partialLine is already created, just add to it. // TODO this is found below. Break it out as a function or // change the if statement? if (partialLine == null) { partialLine = new char[lengthOfLine]; buffer.position(lineBoundaries[0]); buffer.get(partialLine, 0, lengthOfLine); // System.arraycopy(buffer, lineBoundaries[0], // partialLine, 0, lengthOfLine); } else { char[] newPartialLine = new char[lengthOfLine + partialLine.length]; // TODO do we need two copies? System.arraycopy(partialLine, 0, newPartialLine, 0, partialLine.length); // TODO this does not look right buffer.position(lineBoundaries[0]); buffer.get(newPartialLine, partialLine.length, lengthOfLine); // System.arraycopy(buffer, lineBoundaries[0], // newPartialLine, partialLine.length, lengthOfLine); partialLine = newPartialLine; } positionInBuffer = -1; } else if (lineBoundaries[0] == lineBoundaries[1] && (buffer.get(lineBoundaries[0]) == '\n' || buffer .get(lineBoundaries[0]) == '\r')) { // Found a new line. If there is a partial line, return it // otherwise keep looking. // Todo put a better check than this positionInBuffer = lineBoundaries[1] + 2; if (partialLine != null) { return partialLine; } } else { if (partialLine == null) { returnLine = new char[lengthOfLine]; buffer.position(lineBoundaries[0]); buffer.get(returnLine, 0, lengthOfLine); // System.arraycopy(buffer, lineBoundaries[0], // returnLine, 0, lengthOfLine); } else { returnLine = new char[lengthOfLine + partialLine.length]; // TODO is this right? System.arraycopy(partialLine, 0, returnLine, 0, partialLine.length); buffer.position(lineBoundaries[0]); buffer.get(returnLine, partialLine.length, lengthOfLine); // System.arraycopy(buffer, lineBoundaries[0], // returnLine, partialLine.length, lengthOfLine); partialLine = null; } positionInBuffer = lineBoundaries[1] + 2; return returnLine; } } else { // Keep looping. The only case where I can think of that this // would happen is if // the buffer is full of new line characters. Hopefully that // will never happen. } } return returnLine; }
protected final char[] readLine() throws IOException { boolean foundLine = false; char[] returnLine = null; char[] partialLine = null; while (!foundLine) { if (positionInBuffer < 0 || !buffer.hasRemaining()) { charactersRead = read(); totalCharactersRead += charactersRead; positionInBuffer = 0; } int[] lineBoundaries = getNextLineBoundaries(positionInBuffer, charactersRead, buffer); int lengthOfLine; if (lineBoundaries[0] < 0 && lineBoundaries[1] < 0) { if (charactersRead < 0) { return partialLine; } positionInBuffer = -1; continue; } else if (lineBoundaries[1] >= 0) { lengthOfLine = lineBoundaries[1] - Math.max(0, lineBoundaries[0]) + 1; } else { lengthOfLine = charactersRead - lineBoundaries[0]; } if (charactersRead < 0) { return partialLine; } else if (lineBoundaries[0] >= 0) { if (lineBoundaries[1] < 0) { if (partialLine == null) { partialLine = new char[lengthOfLine]; buffer.position(lineBoundaries[0]); buffer.get(partialLine, 0, lengthOfLine); } else { char[] newPartialLine = new char[lengthOfLine + partialLine.length]; System.arraycopy(partialLine, 0, newPartialLine, 0, partialLine.length); buffer.position(lineBoundaries[0]); buffer.get(newPartialLine, partialLine.length, lengthOfLine); partialLine = newPartialLine; } positionInBuffer = -1; } else if (lineBoundaries[0] == lineBoundaries[1] && (buffer.get(lineBoundaries[0]) == '\n' || buffer .get(lineBoundaries[0]) == '\r')) { positionInBuffer = lineBoundaries[1] + 2; if (partialLine != null) { return partialLine; } } else { if (partialLine == null) { returnLine = new char[lengthOfLine]; buffer.position(lineBoundaries[0]); buffer.get(returnLine, 0, lengthOfLine); } else { returnLine = new char[lengthOfLine + partialLine.length]; System.arraycopy(partialLine, 0, returnLine, 0, partialLine.length); buffer.position(lineBoundaries[0]); buffer.get(returnLine, partialLine.length, lengthOfLine); partialLine = null; } positionInBuffer = lineBoundaries[1] + 2; return returnLine; } } else { } } return returnLine; }
protected final char[] readline() throws ioexception { boolean foundline = false; char[] returnline = null; char[] partialline = null; while (!foundline) { if (positioninbuffer < 0 || !buffer.hasremaining()) { charactersread = read(); totalcharactersread += charactersread; positioninbuffer = 0; } int[] lineboundaries = getnextlineboundaries(positioninbuffer, charactersread, buffer); int lengthofline; if (lineboundaries[0] < 0 && lineboundaries[1] < 0) { if (charactersread < 0) { return partialline; } positioninbuffer = -1; continue; } else if (lineboundaries[1] >= 0) { lengthofline = lineboundaries[1] - math.max(0, lineboundaries[0]) + 1; } else { lengthofline = charactersread - lineboundaries[0]; } if (charactersread < 0) { return partialline; } else if (lineboundaries[0] >= 0) { if (lineboundaries[1] < 0) { if (partialline == null) { partialline = new char[lengthofline]; buffer.position(lineboundaries[0]); buffer.get(partialline, 0, lengthofline); } else { char[] newpartialline = new char[lengthofline + partialline.length]; system.arraycopy(partialline, 0, newpartialline, 0, partialline.length); buffer.position(lineboundaries[0]); buffer.get(newpartialline, partialline.length, lengthofline); partialline = newpartialline; } positioninbuffer = -1; } else if (lineboundaries[0] == lineboundaries[1] && (buffer.get(lineboundaries[0]) == '\n' || buffer .get(lineboundaries[0]) == '\r')) { positioninbuffer = lineboundaries[1] + 2; if (partialline != null) { return partialline; } } else { if (partialline == null) { returnline = new char[lengthofline]; buffer.position(lineboundaries[0]); buffer.get(returnline, 0, lengthofline); } else { returnline = new char[lengthofline + partialline.length]; system.arraycopy(partialline, 0, returnline, 0, partialline.length); buffer.position(lineboundaries[0]); buffer.get(returnline, partialline.length, lengthofline); partialline = null; } positioninbuffer = lineboundaries[1] + 2; return returnline; } } else { } } return returnline; }
jayaskren/FastOpencsv
[ 1, 0, 1, 0 ]
20,113
public int getCurrentIdentifier() { // TODO stop casting documents to ints return (int) (offset + current); }
public int getCurrentIdentifier() { return (int) (offset + current); }
public int getcurrentidentifier() { return (int) (offset + current); }
hao44le/CS473HW4-Galago-3.10
[ 1, 0, 0, 0 ]
11,952
public double compare(String v1, String v2) { // FIXME: it should be possible here to say that, actually, we // didn't learn anything from comparing these two values, so that // probability is set to 0.5. if (comparator == null) return 0.5; // we ignore properties with no comparator double sim = comparator.compare(v1, v2); if (sim >= 0.5) return ((high - 0.5) * (sim * sim)) + 0.5; else return low; }
public double compare(String v1, String v2) { if (comparator == null) return 0.5; double sim = comparator.compare(v1, v2); if (sim >= 0.5) return ((high - 0.5) * (sim * sim)) + 0.5; else return low; }
public double compare(string v1, string v2) { if (comparator == null) return 0.5; double sim = comparator.compare(v1, v2); if (sim >= 0.5) return ((high - 0.5) * (sim * sim)) + 0.5; else return low; }
haoyuan/Duke
[ 0, 0, 1, 0 ]
12,056
@Override public synchronized void connected(final Mesos mesos) { System.out.println("Connected"); state = State.CONNECTED; retryTimer = new Timer(); retryTimer.schedule(new TimerTask() { @Override public void run() { doReliableRegistration(mesos); } }, 0, 1000); // Repeat every 1 second }
@Override public synchronized void connected(final Mesos mesos) { System.out.println("Connected"); state = State.CONNECTED; retryTimer = new Timer(); retryTimer.schedule(new TimerTask() { @Override public void run() { doReliableRegistration(mesos); } }, 0, 1000); }
@override public synchronized void connected(final mesos mesos) { system.out.println("connected"); state = state.connected; retrytimer = new timer(); retrytimer.schedule(new timertask() { @override public void run() { doreliableregistration(mesos); } }, 0, 1000); }
j143/mesos
[ 1, 0, 0, 0 ]
12,180
private static boolean isCacheContainsAllEntryAttributes(WSResourceConfig targetConfig, List<RNSEntryResponseType> entries) { String targetContainerId = targetConfig.getContainerId(); if (targetContainerId == null) return true; boolean attributesMissingFromResourcesOfSameContainer = false; for (RNSEntryResponseType entry : entries) { URI entryWSIndentifier = CacheUtils.getEPI(entry.getEndpoint()); WSResourceConfig entryConfig = (WSResourceConfig) CacheManager.getItemFromCache(entryWSIndentifier, WSResourceConfig.class); if (entryConfig == null) continue; String entryContainerId = entryConfig.getContainerId(); if (targetContainerId.equals(entryContainerId)) { // A checking on permissions-string attribute has been made because it is applicable // for both RNS and ByteIO. A thorough testing on all attributes will be an overkill. Object permissionProperty = CacheManager.getItemFromCache(entryConfig.getWsIdentifier(), GenesisIIBaseRP.PERMISSIONS_STRING_QNAME, MessageElement.class); if (permissionProperty == null) { attributesMissingFromResourcesOfSameContainer = true; break; } } } return !attributesMissingFromResourcesOfSameContainer; }
private static boolean isCacheContainsAllEntryAttributes(WSResourceConfig targetConfig, List<RNSEntryResponseType> entries) { String targetContainerId = targetConfig.getContainerId(); if (targetContainerId == null) return true; boolean attributesMissingFromResourcesOfSameContainer = false; for (RNSEntryResponseType entry : entries) { URI entryWSIndentifier = CacheUtils.getEPI(entry.getEndpoint()); WSResourceConfig entryConfig = (WSResourceConfig) CacheManager.getItemFromCache(entryWSIndentifier, WSResourceConfig.class); if (entryConfig == null) continue; String entryContainerId = entryConfig.getContainerId(); if (targetContainerId.equals(entryContainerId)) { Object permissionProperty = CacheManager.getItemFromCache(entryConfig.getWsIdentifier(), GenesisIIBaseRP.PERMISSIONS_STRING_QNAME, MessageElement.class); if (permissionProperty == null) { attributesMissingFromResourcesOfSameContainer = true; break; } } } return !attributesMissingFromResourcesOfSameContainer; }
private static boolean iscachecontainsallentryattributes(wsresourceconfig targetconfig, list<rnsentryresponsetype> entries) { string targetcontainerid = targetconfig.getcontainerid(); if (targetcontainerid == null) return true; boolean attributesmissingfromresourcesofsamecontainer = false; for (rnsentryresponsetype entry : entries) { uri entrywsindentifier = cacheutils.getepi(entry.getendpoint()); wsresourceconfig entryconfig = (wsresourceconfig) cachemanager.getitemfromcache(entrywsindentifier, wsresourceconfig.class); if (entryconfig == null) continue; string entrycontainerid = entryconfig.getcontainerid(); if (targetcontainerid.equals(entrycontainerid)) { object permissionproperty = cachemanager.getitemfromcache(entryconfig.getwsidentifier(), genesisiibaserp.permissions_string_qname, messageelement.class); if (permissionproperty == null) { attributesmissingfromresourcesofsamecontainer = true; break; } } } return !attributesmissingfromresourcesofsamecontainer; }
genesis-2/trunk
[ 1, 0, 0, 0 ]
20,495
@Override public void onNotificationPosted(StatusBarNotification sbn) { Prefs prefs = GBApplication.getPrefs(); if (GBApplication.isRunningLollipopOrLater()) { if ("call".equals(sbn.getNotification().category) && prefs.getBoolean("notification_support_voip_calls", false)) { handleCallNotification(sbn); return; } } if (shouldIgnore(sbn)) { LOG.info("Ignore notification"); return; } switch (GBApplication.getGrantedInterruptionFilter()) { case NotificationManager.INTERRUPTION_FILTER_ALL: break; case NotificationManager.INTERRUPTION_FILTER_ALARMS: case NotificationManager.INTERRUPTION_FILTER_NONE: return; case NotificationManager.INTERRUPTION_FILTER_PRIORITY: // FIXME: Handle Reminders and Events if they are enabled in Do Not Disturb return; } String source = sbn.getPackageName().toLowerCase(); Notification notification = sbn.getNotification(); if (notificationOldRepeatPrevention.containsKey(source)) { if (notification.when <= notificationOldRepeatPrevention.get(source)) { LOG.info("NOT processing notification, already sent newer notifications from this source."); return; } } // Ignore too frequent notifications, according to user preference long min_timeout = (long)prefs.getInt("notifications_timeout", 0) * 1000L; long cur_time = System.currentTimeMillis(); if (notificationBurstPrevention.containsKey(source)) { long last_time = notificationBurstPrevention.get(source); if (cur_time - last_time < min_timeout) { LOG.info("Ignoring frequent notification, last one was " + (cur_time - last_time) + "ms ago"); return; } } NotificationSpec notificationSpec = new NotificationSpec(); // determinate Source App Name ("Label") String name = getAppName(source); if (name != null) { notificationSpec.sourceName = name; } boolean preferBigText = false; // Get the app ID that generated this notification. For now only used by pebble color, but may be more useful later. notificationSpec.sourceAppId = source; notificationSpec.type = AppNotificationType.getInstance().get(source); //FIXME: some quirks lookup table would be the minor evil here if (source.startsWith("com.fsck.k9")) { if (NotificationCompat.isGroupSummary(notification)) { LOG.info("ignore K9 group summary"); return; } preferBigText = true; } if (notificationSpec.type == null) { notificationSpec.type = NotificationType.UNKNOWN; } // Get color notificationSpec.pebbleColor = getPebbleColorForNotification(notificationSpec); LOG.info("Processing notification " + notificationSpec.getId() + " age: " + (System.currentTimeMillis() - notification.when) + " from source " + source + " with flags: " + notification.flags); dissectNotificationTo(notification, notificationSpec, preferBigText); if (!checkNotificationContentForWhiteAndBlackList(sbn.getPackageName().toLowerCase(), notificationSpec.body)) { return; } // ignore Gadgetbridge's very own notifications, except for those from the debug screen if (getApplicationContext().getPackageName().equals(source)) { if (!getApplicationContext().getString(R.string.test_notification).equals(notificationSpec.title)) { return; } } NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender(notification); List<NotificationCompat.Action> actions = wearableExtender.getActions(); if (actions.size() == 0 && NotificationCompat.isGroupSummary(notification)) { //this could cause #395 to come back LOG.info("Not forwarding notification, FLAG_GROUP_SUMMARY is set and no wearable action present. Notification flags: " + notification.flags); return; } notificationSpec.attachedActions = new ArrayList<>(); // DISMISS action NotificationSpec.Action dismissAction = new NotificationSpec.Action(); dismissAction.title = "Dismiss"; dismissAction.type = NotificationSpec.Action.TYPE_SYNTECTIC_DISMISS; notificationSpec.attachedActions.add(dismissAction); for (NotificationCompat.Action act : actions) { if (act != null) { NotificationSpec.Action wearableAction = new NotificationSpec.Action(); wearableAction.title = act.getTitle().toString(); if(act.getRemoteInputs()!=null) { wearableAction.type = NotificationSpec.Action.TYPE_WEARABLE_REPLY; } else { wearableAction.type = NotificationSpec.Action.TYPE_WEARABLE_SIMPLE; } notificationSpec.attachedActions.add(wearableAction); mActionLookup.add((notificationSpec.getId()<<4) + notificationSpec.attachedActions.size(), act); LOG.info("found wearable action: " + notificationSpec.attachedActions.size() + " - "+ act.getTitle() + " " + sbn.getTag()); } } // OPEN action NotificationSpec.Action openAction = new NotificationSpec.Action(); openAction.title = getString(R.string._pebble_watch_open_on_phone); openAction.type = NotificationSpec.Action.TYPE_SYNTECTIC_OPEN; notificationSpec.attachedActions.add(openAction); // MUTE action NotificationSpec.Action muteAction = new NotificationSpec.Action(); muteAction.title = getString(R.string._pebble_watch_mute); muteAction.type = NotificationSpec.Action.TYPE_SYNTECTIC_MUTE; notificationSpec.attachedActions.add(muteAction); mNotificationHandleLookup.add(notificationSpec.getId(), sbn.getPostTime()); // for both DISMISS and OPEN mPackageLookup.add(notificationSpec.getId(), sbn.getPackageName()); // for MUTE notificationBurstPrevention.put(source, cur_time); if(0 != notification.when) { notificationOldRepeatPrevention.put(source, notification.when); }else { LOG.info("This app might show old/duplicate notifications. notification.when is 0 for " + source); } GBApplication.deviceService().onNotification(notificationSpec); }
@Override public void onNotificationPosted(StatusBarNotification sbn) { Prefs prefs = GBApplication.getPrefs(); if (GBApplication.isRunningLollipopOrLater()) { if ("call".equals(sbn.getNotification().category) && prefs.getBoolean("notification_support_voip_calls", false)) { handleCallNotification(sbn); return; } } if (shouldIgnore(sbn)) { LOG.info("Ignore notification"); return; } switch (GBApplication.getGrantedInterruptionFilter()) { case NotificationManager.INTERRUPTION_FILTER_ALL: break; case NotificationManager.INTERRUPTION_FILTER_ALARMS: case NotificationManager.INTERRUPTION_FILTER_NONE: return; case NotificationManager.INTERRUPTION_FILTER_PRIORITY: return; } String source = sbn.getPackageName().toLowerCase(); Notification notification = sbn.getNotification(); if (notificationOldRepeatPrevention.containsKey(source)) { if (notification.when <= notificationOldRepeatPrevention.get(source)) { LOG.info("NOT processing notification, already sent newer notifications from this source."); return; } } long min_timeout = (long)prefs.getInt("notifications_timeout", 0) * 1000L; long cur_time = System.currentTimeMillis(); if (notificationBurstPrevention.containsKey(source)) { long last_time = notificationBurstPrevention.get(source); if (cur_time - last_time < min_timeout) { LOG.info("Ignoring frequent notification, last one was " + (cur_time - last_time) + "ms ago"); return; } } NotificationSpec notificationSpec = new NotificationSpec(); String name = getAppName(source); if (name != null) { notificationSpec.sourceName = name; } boolean preferBigText = false; notificationSpec.sourceAppId = source; notificationSpec.type = AppNotificationType.getInstance().get(source); if (source.startsWith("com.fsck.k9")) { if (NotificationCompat.isGroupSummary(notification)) { LOG.info("ignore K9 group summary"); return; } preferBigText = true; } if (notificationSpec.type == null) { notificationSpec.type = NotificationType.UNKNOWN; } notificationSpec.pebbleColor = getPebbleColorForNotification(notificationSpec); LOG.info("Processing notification " + notificationSpec.getId() + " age: " + (System.currentTimeMillis() - notification.when) + " from source " + source + " with flags: " + notification.flags); dissectNotificationTo(notification, notificationSpec, preferBigText); if (!checkNotificationContentForWhiteAndBlackList(sbn.getPackageName().toLowerCase(), notificationSpec.body)) { return; } if (getApplicationContext().getPackageName().equals(source)) { if (!getApplicationContext().getString(R.string.test_notification).equals(notificationSpec.title)) { return; } } NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender(notification); List<NotificationCompat.Action> actions = wearableExtender.getActions(); if (actions.size() == 0 && NotificationCompat.isGroupSummary(notification)) { LOG.info("Not forwarding notification, FLAG_GROUP_SUMMARY is set and no wearable action present. Notification flags: " + notification.flags); return; } notificationSpec.attachedActions = new ArrayList<>(); NotificationSpec.Action dismissAction = new NotificationSpec.Action(); dismissAction.title = "Dismiss"; dismissAction.type = NotificationSpec.Action.TYPE_SYNTECTIC_DISMISS; notificationSpec.attachedActions.add(dismissAction); for (NotificationCompat.Action act : actions) { if (act != null) { NotificationSpec.Action wearableAction = new NotificationSpec.Action(); wearableAction.title = act.getTitle().toString(); if(act.getRemoteInputs()!=null) { wearableAction.type = NotificationSpec.Action.TYPE_WEARABLE_REPLY; } else { wearableAction.type = NotificationSpec.Action.TYPE_WEARABLE_SIMPLE; } notificationSpec.attachedActions.add(wearableAction); mActionLookup.add((notificationSpec.getId()<<4) + notificationSpec.attachedActions.size(), act); LOG.info("found wearable action: " + notificationSpec.attachedActions.size() + " - "+ act.getTitle() + " " + sbn.getTag()); } } NotificationSpec.Action openAction = new NotificationSpec.Action(); openAction.title = getString(R.string._pebble_watch_open_on_phone); openAction.type = NotificationSpec.Action.TYPE_SYNTECTIC_OPEN; notificationSpec.attachedActions.add(openAction); NotificationSpec.Action muteAction = new NotificationSpec.Action(); muteAction.title = getString(R.string._pebble_watch_mute); muteAction.type = NotificationSpec.Action.TYPE_SYNTECTIC_MUTE; notificationSpec.attachedActions.add(muteAction); mNotificationHandleLookup.add(notificationSpec.getId(), sbn.getPostTime()); mPackageLookup.add(notificationSpec.getId(), sbn.getPackageName()); notificationBurstPrevention.put(source, cur_time); if(0 != notification.when) { notificationOldRepeatPrevention.put(source, notification.when); }else { LOG.info("This app might show old/duplicate notifications. notification.when is 0 for " + source); } GBApplication.deviceService().onNotification(notificationSpec); }
@override public void onnotificationposted(statusbarnotification sbn) { prefs prefs = gbapplication.getprefs(); if (gbapplication.isrunninglollipoporlater()) { if ("call".equals(sbn.getnotification().category) && prefs.getboolean("notification_support_voip_calls", false)) { handlecallnotification(sbn); return; } } if (shouldignore(sbn)) { log.info("ignore notification"); return; } switch (gbapplication.getgrantedinterruptionfilter()) { case notificationmanager.interruption_filter_all: break; case notificationmanager.interruption_filter_alarms: case notificationmanager.interruption_filter_none: return; case notificationmanager.interruption_filter_priority: return; } string source = sbn.getpackagename().tolowercase(); notification notification = sbn.getnotification(); if (notificationoldrepeatprevention.containskey(source)) { if (notification.when <= notificationoldrepeatprevention.get(source)) { log.info("not processing notification, already sent newer notifications from this source."); return; } } long min_timeout = (long)prefs.getint("notifications_timeout", 0) * 1000l; long cur_time = system.currenttimemillis(); if (notificationburstprevention.containskey(source)) { long last_time = notificationburstprevention.get(source); if (cur_time - last_time < min_timeout) { log.info("ignoring frequent notification, last one was " + (cur_time - last_time) + "ms ago"); return; } } notificationspec notificationspec = new notificationspec(); string name = getappname(source); if (name != null) { notificationspec.sourcename = name; } boolean preferbigtext = false; notificationspec.sourceappid = source; notificationspec.type = appnotificationtype.getinstance().get(source); if (source.startswith("com.fsck.k9")) { if (notificationcompat.isgroupsummary(notification)) { log.info("ignore k9 group summary"); return; } preferbigtext = true; } if (notificationspec.type == null) { notificationspec.type = notificationtype.unknown; } notificationspec.pebblecolor = getpebblecolorfornotification(notificationspec); log.info("processing notification " + notificationspec.getid() + " age: " + (system.currenttimemillis() - notification.when) + " from source " + source + " with flags: " + notification.flags); dissectnotificationto(notification, notificationspec, preferbigtext); if (!checknotificationcontentforwhiteandblacklist(sbn.getpackagename().tolowercase(), notificationspec.body)) { return; } if (getapplicationcontext().getpackagename().equals(source)) { if (!getapplicationcontext().getstring(r.string.test_notification).equals(notificationspec.title)) { return; } } notificationcompat.wearableextender wearableextender = new notificationcompat.wearableextender(notification); list<notificationcompat.action> actions = wearableextender.getactions(); if (actions.size() == 0 && notificationcompat.isgroupsummary(notification)) { log.info("not forwarding notification, flag_group_summary is set and no wearable action present. notification flags: " + notification.flags); return; } notificationspec.attachedactions = new arraylist<>(); notificationspec.action dismissaction = new notificationspec.action(); dismissaction.title = "dismiss"; dismissaction.type = notificationspec.action.type_syntectic_dismiss; notificationspec.attachedactions.add(dismissaction); for (notificationcompat.action act : actions) { if (act != null) { notificationspec.action wearableaction = new notificationspec.action(); wearableaction.title = act.gettitle().tostring(); if(act.getremoteinputs()!=null) { wearableaction.type = notificationspec.action.type_wearable_reply; } else { wearableaction.type = notificationspec.action.type_wearable_simple; } notificationspec.attachedactions.add(wearableaction); mactionlookup.add((notificationspec.getid()<<4) + notificationspec.attachedactions.size(), act); log.info("found wearable action: " + notificationspec.attachedactions.size() + " - "+ act.gettitle() + " " + sbn.gettag()); } } notificationspec.action openaction = new notificationspec.action(); openaction.title = getstring(r.string._pebble_watch_open_on_phone); openaction.type = notificationspec.action.type_syntectic_open; notificationspec.attachedactions.add(openaction); notificationspec.action muteaction = new notificationspec.action(); muteaction.title = getstring(r.string._pebble_watch_mute); muteaction.type = notificationspec.action.type_syntectic_mute; notificationspec.attachedactions.add(muteaction); mnotificationhandlelookup.add(notificationspec.getid(), sbn.getposttime()); mpackagelookup.add(notificationspec.getid(), sbn.getpackagename()); notificationburstprevention.put(source, cur_time); if(0 != notification.when) { notificationoldrepeatprevention.put(source, notification.when); }else { log.info("this app might show old/duplicate notifications. notification.when is 0 for " + source); } gbapplication.deviceservice().onnotification(notificationspec); }
hurjeesic/YourSleeping
[ 1, 0, 1, 0 ]
20,579
public List<PlayItem> queryForPlayableItems (final String query1, final String query2, final int maxResults) throws MorriganException { List<PlayItem> ret = new LinkedList<PlayItem>(); List<MediaListReference> items = new LinkedList<MediaListReference>(); List<MediaListReference> matches = new LinkedList<MediaListReference>(); items.addAll(this.mediaFactory.getAllLocalMixedMediaDbs()); items.addAll(RemoteMixedMediaDbHelper.getAllRemoteMmdb(Config.DEFAULT)); // First search exact. for (MediaListReference i : items) { if (i.getTitle().equals(query1)) matches.add(i); } // Second search case-insensitive, but still exact. if (matches.size() < 1) { for (MediaListReference i : items) { if (i.getTitle().equalsIgnoreCase(query1)) matches.add(i); } } // Third search sub-string. if (matches.size() < 1) { for (MediaListReference i : items) { if (i.getTitle().contains(query1)) matches.add(i); } } // Fourth search sub-string and case-insensitive. if (matches.size() < 1) { for (MediaListReference i : items) { if (i.getTitle().toLowerCase().contains(query1.toLowerCase())) matches.add(i); } } for (MediaListReference explorerItem : matches) { if (ret.size() >= maxResults) break; /* * FIXME this will load the DB (if its not already loaded), which is excessive if we are * just going to show some search results. */ IMediaTrackDb<?, ? extends IMediaTrack> db = mediaListReferenceToReadTrackDb(explorerItem); if (query2 == null) { ret.add(new PlayItem(db, null)); } else { List<? extends IMediaTrack> results; try { results = db.simpleSearch(query2, maxResults); } catch (DbException e) { throw new MorriganException(e); } for (IMediaTrack result : results) { if (ret.size() >= maxResults) break; ret.add(new PlayItem(db, result)); } } } return ret; }
public List<PlayItem> queryForPlayableItems (final String query1, final String query2, final int maxResults) throws MorriganException { List<PlayItem> ret = new LinkedList<PlayItem>(); List<MediaListReference> items = new LinkedList<MediaListReference>(); List<MediaListReference> matches = new LinkedList<MediaListReference>(); items.addAll(this.mediaFactory.getAllLocalMixedMediaDbs()); items.addAll(RemoteMixedMediaDbHelper.getAllRemoteMmdb(Config.DEFAULT)); for (MediaListReference i : items) { if (i.getTitle().equals(query1)) matches.add(i); } if (matches.size() < 1) { for (MediaListReference i : items) { if (i.getTitle().equalsIgnoreCase(query1)) matches.add(i); } } if (matches.size() < 1) { for (MediaListReference i : items) { if (i.getTitle().contains(query1)) matches.add(i); } } if (matches.size() < 1) { for (MediaListReference i : items) { if (i.getTitle().toLowerCase().contains(query1.toLowerCase())) matches.add(i); } } for (MediaListReference explorerItem : matches) { if (ret.size() >= maxResults) break; IMediaTrackDb<?, ? extends IMediaTrack> db = mediaListReferenceToReadTrackDb(explorerItem); if (query2 == null) { ret.add(new PlayItem(db, null)); } else { List<? extends IMediaTrack> results; try { results = db.simpleSearch(query2, maxResults); } catch (DbException e) { throw new MorriganException(e); } for (IMediaTrack result : results) { if (ret.size() >= maxResults) break; ret.add(new PlayItem(db, result)); } } } return ret; }
public list<playitem> queryforplayableitems (final string query1, final string query2, final int maxresults) throws morriganexception { list<playitem> ret = new linkedlist<playitem>(); list<medialistreference> items = new linkedlist<medialistreference>(); list<medialistreference> matches = new linkedlist<medialistreference>(); items.addall(this.mediafactory.getalllocalmixedmediadbs()); items.addall(remotemixedmediadbhelper.getallremotemmdb(config.default)); for (medialistreference i : items) { if (i.gettitle().equals(query1)) matches.add(i); } if (matches.size() < 1) { for (medialistreference i : items) { if (i.gettitle().equalsignorecase(query1)) matches.add(i); } } if (matches.size() < 1) { for (medialistreference i : items) { if (i.gettitle().contains(query1)) matches.add(i); } } if (matches.size() < 1) { for (medialistreference i : items) { if (i.gettitle().tolowercase().contains(query1.tolowercase())) matches.add(i); } } for (medialistreference exploreritem : matches) { if (ret.size() >= maxresults) break; imediatrackdb<?, ? extends imediatrack> db = medialistreferencetoreadtrackdb(exploreritem); if (query2 == null) { ret.add(new playitem(db, null)); } else { list<? extends imediatrack> results; try { results = db.simplesearch(query2, maxresults); } catch (dbexception e) { throw new morriganexception(e); } for (imediatrack result : results) { if (ret.size() >= maxresults) break; ret.add(new playitem(db, result)); } } } return ret; }
haku/Morrigan
[ 1, 0, 1, 0 ]
12,405
public static /*@Real*/ double blackFormulaImpliedStdDevApproximation( final PlainVanillaPayoff payoff, @Real final double strike, @Real final double forward, @Real final double blackPrice) { // TODO : complete return blackFormulaImpliedStdDevApproximation(payoff, strike, forward, blackPrice, 1.0, 0.0); }
public static double blackFormulaImpliedStdDevApproximation( final PlainVanillaPayoff payoff, @Real final double strike, @Real final double forward, @Real final double blackPrice) { return blackFormulaImpliedStdDevApproximation(payoff, strike, forward, blackPrice, 1.0, 0.0); }
public static double blackformulaimpliedstddevapproximation( final plainvanillapayoff payoff, @real final double strike, @real final double forward, @real final double blackprice) { return blackformulaimpliedstddevapproximation(payoff, strike, forward, blackprice, 1.0, 0.0); }
imperialft/jquantlib
[ 0, 1, 0, 0 ]
12,406
public static /*@Real*/ double blackFormulaImpliedStdDevApproximation( final PlainVanillaPayoff payoff, @Real final double strike, @Real final double forward, @Real final double blackPrice, @DiscountFactor final double discount) { // TODO : complete return blackFormulaImpliedStdDevApproximation(payoff, strike, forward, blackPrice, discount, 0.0); }
public static double blackFormulaImpliedStdDevApproximation( final PlainVanillaPayoff payoff, @Real final double strike, @Real final double forward, @Real final double blackPrice, @DiscountFactor final double discount) { return blackFormulaImpliedStdDevApproximation(payoff, strike, forward, blackPrice, discount, 0.0); }
public static double blackformulaimpliedstddevapproximation( final plainvanillapayoff payoff, @real final double strike, @real final double forward, @real final double blackprice, @discountfactor final double discount) { return blackformulaimpliedstddevapproximation(payoff, strike, forward, blackprice, discount, 0.0); }
imperialft/jquantlib
[ 0, 1, 0, 0 ]
12,417
@Override protected String doInBackground(Object[] par) { // do above Server call here Rule mRule = (Rule) par[0]; String user = (String) par[1]; HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(urlRulesApi); List<NameValuePair> params = new ArrayList<NameValuePair>(); //Parameters params.add(new BasicNameValuePair("rule_title", mRule.getRuleName())); params.add(new BasicNameValuePair("rule_description", mRule.getDescription())); params.add(new BasicNameValuePair("rule_channel_one", mRule.getIfElement())); params.add(new BasicNameValuePair("rule_channel_two", mRule.getDoElement())); params.add(new BasicNameValuePair("rule_event_title", mRule.getIfAction())); params.add(new BasicNameValuePair("rule_action_title",mRule.getDoAction())); params.add(new BasicNameValuePair("rule_place", mRule.getPlace())); params.add(new BasicNameValuePair("rule_creator", user)); params.add(new BasicNameValuePair("rule", mRule.getEyeRule()));//EYE rule with prefix params.add(new BasicNameValuePair("command", "createRule")); Log.i("RULE","My ruleee"+ mRule.getEyeRule()); String response = ""; try { post.setEntity(new UrlEncodedFormEntity(params)); HttpResponse resp = null; resp = client.execute(post); HttpEntity ent = resp.getEntity(); response = EntityUtils.toString(ent); } catch (IOException e) { e.printStackTrace(); } return response; }
@Override protected String doInBackground(Object[] par) { Rule mRule = (Rule) par[0]; String user = (String) par[1]; HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(urlRulesApi); List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("rule_title", mRule.getRuleName())); params.add(new BasicNameValuePair("rule_description", mRule.getDescription())); params.add(new BasicNameValuePair("rule_channel_one", mRule.getIfElement())); params.add(new BasicNameValuePair("rule_channel_two", mRule.getDoElement())); params.add(new BasicNameValuePair("rule_event_title", mRule.getIfAction())); params.add(new BasicNameValuePair("rule_action_title",mRule.getDoAction())); params.add(new BasicNameValuePair("rule_place", mRule.getPlace())); params.add(new BasicNameValuePair("rule_creator", user)); params.add(new BasicNameValuePair("rule", mRule.getEyeRule())) params.add(new BasicNameValuePair("command", "createRule")); Log.i("RULE","My ruleee"+ mRule.getEyeRule()); String response = ""; try { post.setEntity(new UrlEncodedFormEntity(params)); HttpResponse resp = null; resp = client.execute(post); HttpEntity ent = resp.getEntity(); response = EntityUtils.toString(ent); } catch (IOException e) { e.printStackTrace(); } return response; }
@override protected string doinbackground(object[] par) { rule mrule = (rule) par[0]; string user = (string) par[1]; httpclient client = new defaulthttpclient(); httppost post = new httppost(urlrulesapi); list<namevaluepair> params = new arraylist<namevaluepair>(); params.add(new basicnamevaluepair("rule_title", mrule.getrulename())); params.add(new basicnamevaluepair("rule_description", mrule.getdescription())); params.add(new basicnamevaluepair("rule_channel_one", mrule.getifelement())); params.add(new basicnamevaluepair("rule_channel_two", mrule.getdoelement())); params.add(new basicnamevaluepair("rule_event_title", mrule.getifaction())); params.add(new basicnamevaluepair("rule_action_title",mrule.getdoaction())); params.add(new basicnamevaluepair("rule_place", mrule.getplace())); params.add(new basicnamevaluepair("rule_creator", user)); params.add(new basicnamevaluepair("rule", mrule.geteyerule())) params.add(new basicnamevaluepair("command", "createrule")); log.i("rule","my ruleee"+ mrule.geteyerule()); string response = ""; try { post.setentity(new urlencodedformentity(params)); httpresponse resp = null; resp = client.execute(post); httpentity ent = resp.getentity(); response = entityutils.tostring(ent); } catch (ioexception e) { e.printstacktrace(); } return response; }
gsi-upm/ewe-tasker-android
[ 0, 1, 0, 0 ]
12,418
@Override protected String doInBackground(String[] par) { // do above Server call here HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(urlInputApi); List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("inputEvent", par[0])); params.add(new BasicNameValuePair("user", par[1])); params.add(new BasicNameValuePair("command", "insertinput")); String response = ""; try { post.setEntity(new UrlEncodedFormEntity(params)); HttpResponse resp = null; resp = client.execute(post); HttpEntity ent = resp.getEntity(); response = EntityUtils.toString(ent); } catch (IOException e) { e.printStackTrace(); } return response; }
@Override protected String doInBackground(String[] par) { HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(urlInputApi); List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("inputEvent", par[0])); params.add(new BasicNameValuePair("user", par[1])); params.add(new BasicNameValuePair("command", "insertinput")); String response = ""; try { post.setEntity(new UrlEncodedFormEntity(params)); HttpResponse resp = null; resp = client.execute(post); HttpEntity ent = resp.getEntity(); response = EntityUtils.toString(ent); } catch (IOException e) { e.printStackTrace(); } return response; }
@override protected string doinbackground(string[] par) { httpclient client = new defaulthttpclient(); httppost post = new httppost(urlinputapi); list<namevaluepair> params = new arraylist<namevaluepair>(); params.add(new basicnamevaluepair("inputevent", par[0])); params.add(new basicnamevaluepair("user", par[1])); params.add(new basicnamevaluepair("command", "insertinput")); string response = ""; try { post.setentity(new urlencodedformentity(params)); httpresponse resp = null; resp = client.execute(post); httpentity ent = resp.getentity(); response = entityutils.tostring(ent); } catch (ioexception e) { e.printstacktrace(); } return response; }
gsi-upm/ewe-tasker-android
[ 0, 1, 0, 0 ]
12,580
@Bean public MongoClient mongoClient() { MongoClientOptions.Builder options = MongoClientOptions.builder() //TODO: make connection options configurable .connectionsPerHost(4) .maxConnectionIdleTime(60000) .maxConnectionLifeTime(120000); ServerAddress serverAddress = new ServerAddress(mongoConfiguration.getHost(), mongoConfiguration.getPort()); MongoCredential credential = getCredentials(mongoConfiguration.getAuth()); if (credential == null) { LOG.info("Connecting to mongo without auth"); } else { LOG.info("Mongo credential: user: '{}', password: '***', authenticationDatabase: '{}'", mongoConfiguration.getAuth().getUser(), mongoConfiguration.getAuth().getAuthBase()); } return credential == null ? new MongoClient(serverAddress) : new MongoClient(serverAddress, Collections.singletonList(credential), options.build()); }
@Bean public MongoClient mongoClient() { MongoClientOptions.Builder options = MongoClientOptions.builder() .connectionsPerHost(4) .maxConnectionIdleTime(60000) .maxConnectionLifeTime(120000); ServerAddress serverAddress = new ServerAddress(mongoConfiguration.getHost(), mongoConfiguration.getPort()); MongoCredential credential = getCredentials(mongoConfiguration.getAuth()); if (credential == null) { LOG.info("Connecting to mongo without auth"); } else { LOG.info("Mongo credential: user: '{}', password: '***', authenticationDatabase: '{}'", mongoConfiguration.getAuth().getUser(), mongoConfiguration.getAuth().getAuthBase()); } return credential == null ? new MongoClient(serverAddress) : new MongoClient(serverAddress, Collections.singletonList(credential), options.build()); }
@bean public mongoclient mongoclient() { mongoclientoptions.builder options = mongoclientoptions.builder() .connectionsperhost(4) .maxconnectionidletime(60000) .maxconnectionlifetime(120000); serveraddress serveraddress = new serveraddress(mongoconfiguration.gethost(), mongoconfiguration.getport()); mongocredential credential = getcredentials(mongoconfiguration.getauth()); if (credential == null) { log.info("connecting to mongo without auth"); } else { log.info("mongo credential: user: '{}', password: '***', authenticationdatabase: '{}'", mongoconfiguration.getauth().getuser(), mongoconfiguration.getauth().getauthbase()); } return credential == null ? new mongoclient(serveraddress) : new mongoclient(serveraddress, collections.singletonlist(credential), options.build()); }
hutoroff/jagpb
[ 1, 0, 0, 0 ]
20,776
public CompoundBitVectorInterval binaryXor( CompoundBitVectorInterval pState, boolean pAllowSignedWrapAround, final OverflowEventHandler pOverflowEventHandler) { checkBitVectorCompatibilityWith(pState.info); if (isBottom() || pState.isBottom()) { return bottom(info); } if (isSingleton() && pState.isSingleton()) { return of( BitVectorInterval.cast( info, getValue().xor(pState.getValue()), pAllowSignedWrapAround, pOverflowEventHandler)); } if (pState.isSingleton() && pState.containsZero()) { return this; } if (isSingleton() && containsZero()) { return pState; } // [0,1] ^ 1 = [0,1] if (pState.isSingleton() && pState.contains(1) && equals(getZeroToOne(info))) { return this; } // 1 ^ [0,1] = [0,1] if (isSingleton() && contains(1) && pState.equals(getZeroToOne(info))) { return getZeroToOne(info); } if (pState.isSingleton()) { CompoundBitVectorInterval result = bottom(info); for (BitVectorInterval interval : intervals) { if (!interval.isSingleton()) { return getInternal(info.getRange()); } result = result.unionWith( BitVectorInterval.cast( info, interval.getLowerBound().xor(pState.getValue()), pAllowSignedWrapAround, pOverflowEventHandler)); } return result; } else if (isSingleton()) { return pState.binaryXor(this, pAllowSignedWrapAround, pOverflowEventHandler); } // TODO maybe a more exact implementation is possible? return getInternal(info.getRange()); }
public CompoundBitVectorInterval binaryXor( CompoundBitVectorInterval pState, boolean pAllowSignedWrapAround, final OverflowEventHandler pOverflowEventHandler) { checkBitVectorCompatibilityWith(pState.info); if (isBottom() || pState.isBottom()) { return bottom(info); } if (isSingleton() && pState.isSingleton()) { return of( BitVectorInterval.cast( info, getValue().xor(pState.getValue()), pAllowSignedWrapAround, pOverflowEventHandler)); } if (pState.isSingleton() && pState.containsZero()) { return this; } if (isSingleton() && containsZero()) { return pState; } if (pState.isSingleton() && pState.contains(1) && equals(getZeroToOne(info))) { return this; } if (isSingleton() && contains(1) && pState.equals(getZeroToOne(info))) { return getZeroToOne(info); } if (pState.isSingleton()) { CompoundBitVectorInterval result = bottom(info); for (BitVectorInterval interval : intervals) { if (!interval.isSingleton()) { return getInternal(info.getRange()); } result = result.unionWith( BitVectorInterval.cast( info, interval.getLowerBound().xor(pState.getValue()), pAllowSignedWrapAround, pOverflowEventHandler)); } return result; } else if (isSingleton()) { return pState.binaryXor(this, pAllowSignedWrapAround, pOverflowEventHandler); } return getInternal(info.getRange()); }
public compoundbitvectorinterval binaryxor( compoundbitvectorinterval pstate, boolean pallowsignedwraparound, final overfloweventhandler poverfloweventhandler) { checkbitvectorcompatibilitywith(pstate.info); if (isbottom() || pstate.isbottom()) { return bottom(info); } if (issingleton() && pstate.issingleton()) { return of( bitvectorinterval.cast( info, getvalue().xor(pstate.getvalue()), pallowsignedwraparound, poverfloweventhandler)); } if (pstate.issingleton() && pstate.containszero()) { return this; } if (issingleton() && containszero()) { return pstate; } if (pstate.issingleton() && pstate.contains(1) && equals(getzerotoone(info))) { return this; } if (issingleton() && contains(1) && pstate.equals(getzerotoone(info))) { return getzerotoone(info); } if (pstate.issingleton()) { compoundbitvectorinterval result = bottom(info); for (bitvectorinterval interval : intervals) { if (!interval.issingleton()) { return getinternal(info.getrange()); } result = result.unionwith( bitvectorinterval.cast( info, interval.getlowerbound().xor(pstate.getvalue()), pallowsignedwraparound, poverfloweventhandler)); } return result; } else if (issingleton()) { return pstate.binaryxor(this, pallowsignedwraparound, poverfloweventhandler); } return getinternal(info.getrange()); }
jcdubois/cpachecker
[ 1, 0, 0, 0 ]
20,777
public CompoundBitVectorInterval binaryNot( boolean pAllowSignedWrapAround, final OverflowEventHandler pOverflowEventHandler) { if (isBottom()) { return bottom(info); } CompoundBitVectorInterval result = bottom(info); for (BitVectorInterval interval : intervals) { if (!interval.isSingleton()) { // TODO maybe a more exact implementation is possible? return getInternal(info.getRange()); } final BitVectorInterval partialResult; if (info.isSigned()) { partialResult = BitVectorInterval.cast( info, interval.getLowerBound().not(), pAllowSignedWrapAround, pOverflowEventHandler); } else { partialResult = BitVectorInterval.cast( info, new BigInteger(1, interval.getLowerBound().not().toByteArray()), pAllowSignedWrapAround, pOverflowEventHandler); } result = result.unionWith(partialResult); } return result; }
public CompoundBitVectorInterval binaryNot( boolean pAllowSignedWrapAround, final OverflowEventHandler pOverflowEventHandler) { if (isBottom()) { return bottom(info); } CompoundBitVectorInterval result = bottom(info); for (BitVectorInterval interval : intervals) { if (!interval.isSingleton()) { return getInternal(info.getRange()); } final BitVectorInterval partialResult; if (info.isSigned()) { partialResult = BitVectorInterval.cast( info, interval.getLowerBound().not(), pAllowSignedWrapAround, pOverflowEventHandler); } else { partialResult = BitVectorInterval.cast( info, new BigInteger(1, interval.getLowerBound().not().toByteArray()), pAllowSignedWrapAround, pOverflowEventHandler); } result = result.unionWith(partialResult); } return result; }
public compoundbitvectorinterval binarynot( boolean pallowsignedwraparound, final overfloweventhandler poverfloweventhandler) { if (isbottom()) { return bottom(info); } compoundbitvectorinterval result = bottom(info); for (bitvectorinterval interval : intervals) { if (!interval.issingleton()) { return getinternal(info.getrange()); } final bitvectorinterval partialresult; if (info.issigned()) { partialresult = bitvectorinterval.cast( info, interval.getlowerbound().not(), pallowsignedwraparound, poverfloweventhandler); } else { partialresult = bitvectorinterval.cast( info, new biginteger(1, interval.getlowerbound().not().tobytearray()), pallowsignedwraparound, poverfloweventhandler); } result = result.unionwith(partialresult); } return result; }
jcdubois/cpachecker
[ 1, 0, 0, 0 ]
20,778
public CompoundBitVectorInterval binaryOr( CompoundBitVectorInterval pState, boolean pAllowSignedWrapAround, final OverflowEventHandler pOverflowEventHandler) { checkBitVectorCompatibilityWith(pState.info); if (isBottom() || pState.isBottom()) { return bottom(info); } if (isSingleton() && containsZero()) { return pState; } if (pState.isSingleton() && pState.containsZero()) { return this; } if (pState.isSingleton()) { CompoundBitVectorInterval result = bottom(info); for (BitVectorInterval interval : intervals) { if (!interval.isSingleton()) { return getInternal(info.getRange()); } result = result.unionWith( BitVectorInterval.cast( info, interval.getLowerBound().or(pState.getValue()), pAllowSignedWrapAround, pOverflowEventHandler)); } return result; } else if (isSingleton()) { return pState.binaryOr(this, pAllowSignedWrapAround, pOverflowEventHandler); } // TODO maybe a more exact implementation is possible? return getInternal(info.getRange()); }
public CompoundBitVectorInterval binaryOr( CompoundBitVectorInterval pState, boolean pAllowSignedWrapAround, final OverflowEventHandler pOverflowEventHandler) { checkBitVectorCompatibilityWith(pState.info); if (isBottom() || pState.isBottom()) { return bottom(info); } if (isSingleton() && containsZero()) { return pState; } if (pState.isSingleton() && pState.containsZero()) { return this; } if (pState.isSingleton()) { CompoundBitVectorInterval result = bottom(info); for (BitVectorInterval interval : intervals) { if (!interval.isSingleton()) { return getInternal(info.getRange()); } result = result.unionWith( BitVectorInterval.cast( info, interval.getLowerBound().or(pState.getValue()), pAllowSignedWrapAround, pOverflowEventHandler)); } return result; } else if (isSingleton()) { return pState.binaryOr(this, pAllowSignedWrapAround, pOverflowEventHandler); } return getInternal(info.getRange()); }
public compoundbitvectorinterval binaryor( compoundbitvectorinterval pstate, boolean pallowsignedwraparound, final overfloweventhandler poverfloweventhandler) { checkbitvectorcompatibilitywith(pstate.info); if (isbottom() || pstate.isbottom()) { return bottom(info); } if (issingleton() && containszero()) { return pstate; } if (pstate.issingleton() && pstate.containszero()) { return this; } if (pstate.issingleton()) { compoundbitvectorinterval result = bottom(info); for (bitvectorinterval interval : intervals) { if (!interval.issingleton()) { return getinternal(info.getrange()); } result = result.unionwith( bitvectorinterval.cast( info, interval.getlowerbound().or(pstate.getvalue()), pallowsignedwraparound, poverfloweventhandler)); } return result; } else if (issingleton()) { return pstate.binaryor(this, pallowsignedwraparound, poverfloweventhandler); } return getinternal(info.getrange()); }
jcdubois/cpachecker
[ 1, 0, 0, 0 ]
12,631
private boolean isEmailValid(String email) { //TODO: Replace this with your own logic return email.contains("@"); }
private boolean isEmailValid(String email) { return email.contains("@"); }
private boolean isemailvalid(string email) { return email.contains("@"); }
herbertkip/Web-App
[ 1, 0, 0, 0 ]
12,632
private boolean isPasswordValid(String password) { //TODO: Replace this with your own logic return password.length() > 4; }
private boolean isPasswordValid(String password) { return password.length() > 4; }
private boolean ispasswordvalid(string password) { return password.length() > 4; }
herbertkip/Web-App
[ 1, 0, 0, 0 ]
20,863
public void runOpMode() { initRobot(); gyro.calibrate(); while (!isStopRequested() && gyro.isCalibrating()) { sleep(50); } waitForStart(); //startRobot(); //sleep(1000); //Give motors time to ramp up to speed long minLoopInterval = Long.MAX_VALUE; long maxLoopInterval = Long.MIN_VALUE; long loopCount = 0; long prevLoopTime; long minSampleInterval = Long.MAX_VALUE; long maxSampleInterval = Long.MIN_VALUE; long sampleCount = 0; long prevSampleTime; long totalSampleTime = 0; long startTime = System.nanoTime(); prevSampleTime = startTime; prevLoopTime = startTime; int prevSample = getSensorValue(); ElapsedTime spdTimer = new ElapsedTime(); double spdTimout = 2.0; double curSpd = 0.3; long stoppedSleepTime = 0; //TODO: SBH - Figure out how to register/deregister if timing shows its needed //colorSensor.getI2cController().deregisterForPortReadyCallback(colorSensor.getPort()); while (opModeIsActive() && curSpd <= 0.35) { Log.i(TAG, String.format(Locale.US, "TESTING AT SPEED = %5.2f", curSpd)); startRobot(curSpd); while (spdTimer.seconds() < spdTimout) { long currTime = System.nanoTime(); int currSample = getSensorValue(); long loopInterval = currTime - prevLoopTime; long sampleTime = 0; boolean sampleIsNew = false; if (currSample != prevSample) { sampleIsNew = true; sampleTime = currTime - prevSampleTime; sampleCount++; prevSample = currSample; totalSampleTime += sampleTime; prevSampleTime = currTime; if (sampleTime < minSampleInterval) minSampleInterval = sampleTime; else if (sampleTime > maxSampleInterval) maxSampleInterval = sampleTime; } if (loopInterval < minLoopInterval) { minLoopInterval = loopInterval; } else if (loopInterval > maxLoopInterval) { maxLoopInterval = loopInterval; } if (sampleIsNew) { logRobot(String.format(Locale.US, "NEW SAMPLE - sampleTime %7.3f", sampleTime / MS2NS)); } logRobot(String.format(Locale.US, "[%4d:%7.3f] LoopInterval=%7.3f, ", loopCount, (currTime - startTime) / MS2NS, loopInterval / MS2NS)); prevLoopTime = currTime; if (useSleep) { long startSleepTime = System.nanoTime(); waitForTick(sleepMs); long endSleepTime = System.nanoTime(); totalSampleTime -= (endSleepTime - startSleepTime); } loopCount++; } stopRobot(); long startStopSleepTime = System.nanoTime(); waitForTick(500); stoppedSleepTime += (System.nanoTime() - startStopSleepTime); spdTimer.reset(); if(curSpd < 0.15) curSpd += 0.01; else curSpd += 0.05; //TODO: SBH - Figure out how to register/deregister if timing shows its needed //colorSensor.getI2cController() // .registerForI2cPortReadyCallback(colorSensor, colorSensor.getPort()); } stopRobot(); long endTime = System.nanoTime() - stoppedSleepTime; Log.i(TAG, String.format( "Loop: MinInterval=%7.3f, MaxInterval=%7.3f, AvgInterval=%7.3f", minLoopInterval/MS2NS, maxLoopInterval/MS2NS, (endTime - startTime)/MS2NS/loopCount)); Log.i(TAG, String.format( "Sensor: MinSampleInterval=%7.3f, MaxSampleInterval=%7.3f, AvgSampleInterval=%7.3f %7.3f", minSampleInterval/MS2NS, maxSampleInterval/MS2NS, (endTime - startTime)/MS2NS/sampleCount, (double)totalSampleTime/MS2NS/sampleCount)); }
public void runOpMode() { initRobot(); gyro.calibrate(); while (!isStopRequested() && gyro.isCalibrating()) { sleep(50); } waitForStart(); long minLoopInterval = Long.MAX_VALUE; long maxLoopInterval = Long.MIN_VALUE; long loopCount = 0; long prevLoopTime; long minSampleInterval = Long.MAX_VALUE; long maxSampleInterval = Long.MIN_VALUE; long sampleCount = 0; long prevSampleTime; long totalSampleTime = 0; long startTime = System.nanoTime(); prevSampleTime = startTime; prevLoopTime = startTime; int prevSample = getSensorValue(); ElapsedTime spdTimer = new ElapsedTime(); double spdTimout = 2.0; double curSpd = 0.3; long stoppedSleepTime = 0; while (opModeIsActive() && curSpd <= 0.35) { Log.i(TAG, String.format(Locale.US, "TESTING AT SPEED = %5.2f", curSpd)); startRobot(curSpd); while (spdTimer.seconds() < spdTimout) { long currTime = System.nanoTime(); int currSample = getSensorValue(); long loopInterval = currTime - prevLoopTime; long sampleTime = 0; boolean sampleIsNew = false; if (currSample != prevSample) { sampleIsNew = true; sampleTime = currTime - prevSampleTime; sampleCount++; prevSample = currSample; totalSampleTime += sampleTime; prevSampleTime = currTime; if (sampleTime < minSampleInterval) minSampleInterval = sampleTime; else if (sampleTime > maxSampleInterval) maxSampleInterval = sampleTime; } if (loopInterval < minLoopInterval) { minLoopInterval = loopInterval; } else if (loopInterval > maxLoopInterval) { maxLoopInterval = loopInterval; } if (sampleIsNew) { logRobot(String.format(Locale.US, "NEW SAMPLE - sampleTime %7.3f", sampleTime / MS2NS)); } logRobot(String.format(Locale.US, "[%4d:%7.3f] LoopInterval=%7.3f, ", loopCount, (currTime - startTime) / MS2NS, loopInterval / MS2NS)); prevLoopTime = currTime; if (useSleep) { long startSleepTime = System.nanoTime(); waitForTick(sleepMs); long endSleepTime = System.nanoTime(); totalSampleTime -= (endSleepTime - startSleepTime); } loopCount++; } stopRobot(); long startStopSleepTime = System.nanoTime(); waitForTick(500); stoppedSleepTime += (System.nanoTime() - startStopSleepTime); spdTimer.reset(); if(curSpd < 0.15) curSpd += 0.01; else curSpd += 0.05; } stopRobot(); long endTime = System.nanoTime() - stoppedSleepTime; Log.i(TAG, String.format( "Loop: MinInterval=%7.3f, MaxInterval=%7.3f, AvgInterval=%7.3f", minLoopInterval/MS2NS, maxLoopInterval/MS2NS, (endTime - startTime)/MS2NS/loopCount)); Log.i(TAG, String.format( "Sensor: MinSampleInterval=%7.3f, MaxSampleInterval=%7.3f, AvgSampleInterval=%7.3f %7.3f", minSampleInterval/MS2NS, maxSampleInterval/MS2NS, (endTime - startTime)/MS2NS/sampleCount, (double)totalSampleTime/MS2NS/sampleCount)); }
public void runopmode() { initrobot(); gyro.calibrate(); while (!isstoprequested() && gyro.iscalibrating()) { sleep(50); } waitforstart(); long minloopinterval = long.max_value; long maxloopinterval = long.min_value; long loopcount = 0; long prevlooptime; long minsampleinterval = long.max_value; long maxsampleinterval = long.min_value; long samplecount = 0; long prevsampletime; long totalsampletime = 0; long starttime = system.nanotime(); prevsampletime = starttime; prevlooptime = starttime; int prevsample = getsensorvalue(); elapsedtime spdtimer = new elapsedtime(); double spdtimout = 2.0; double curspd = 0.3; long stoppedsleeptime = 0; while (opmodeisactive() && curspd <= 0.35) { log.i(tag, string.format(locale.us, "testing at speed = %5.2f", curspd)); startrobot(curspd); while (spdtimer.seconds() < spdtimout) { long currtime = system.nanotime(); int currsample = getsensorvalue(); long loopinterval = currtime - prevlooptime; long sampletime = 0; boolean sampleisnew = false; if (currsample != prevsample) { sampleisnew = true; sampletime = currtime - prevsampletime; samplecount++; prevsample = currsample; totalsampletime += sampletime; prevsampletime = currtime; if (sampletime < minsampleinterval) minsampleinterval = sampletime; else if (sampletime > maxsampleinterval) maxsampleinterval = sampletime; } if (loopinterval < minloopinterval) { minloopinterval = loopinterval; } else if (loopinterval > maxloopinterval) { maxloopinterval = loopinterval; } if (sampleisnew) { logrobot(string.format(locale.us, "new sample - sampletime %7.3f", sampletime / ms2ns)); } logrobot(string.format(locale.us, "[%4d:%7.3f] loopinterval=%7.3f, ", loopcount, (currtime - starttime) / ms2ns, loopinterval / ms2ns)); prevlooptime = currtime; if (usesleep) { long startsleeptime = system.nanotime(); waitfortick(sleepms); long endsleeptime = system.nanotime(); totalsampletime -= (endsleeptime - startsleeptime); } loopcount++; } stoprobot(); long startstopsleeptime = system.nanotime(); waitfortick(500); stoppedsleeptime += (system.nanotime() - startstopsleeptime); spdtimer.reset(); if(curspd < 0.15) curspd += 0.01; else curspd += 0.05; } stoprobot(); long endtime = system.nanotime() - stoppedsleeptime; log.i(tag, string.format( "loop: mininterval=%7.3f, maxinterval=%7.3f, avginterval=%7.3f", minloopinterval/ms2ns, maxloopinterval/ms2ns, (endtime - starttime)/ms2ns/loopcount)); log.i(tag, string.format( "sensor: minsampleinterval=%7.3f, maxsampleinterval=%7.3f, avgsampleinterval=%7.3f %7.3f", minsampleinterval/ms2ns, maxsampleinterval/ms2ns, (endtime - starttime)/ms2ns/samplecount, (double)totalsampletime/ms2ns/samplecount)); }
goncalvesm1/Robot_Project
[ 0, 1, 0, 0 ]
12,744
@PostMapping(value = "/{id}/msg", consumes = "text/plain", produces = "text/plain") public String receiveOrderAndReturnResult(@PathVariable int id, @RequestBody String command) { command = command.toLowerCase().trim(); logger.debug("User (" + id + ") sent command: " + command); // TODO: replace with login if ("start".equals(command)) { return gameService.pickClass(id); } try { var result = gameService.execute(id, command); logger.trace("Adding color to Result with message:"); logger.debug(result.getMessage()); return addColor(result); } catch (InvalidCommandException e) { logger.debug("Parsing user provided command failed.", e); return e.getMessage(); } }
@PostMapping(value = "/{id}/msg", consumes = "text/plain", produces = "text/plain") public String receiveOrderAndReturnResult(@PathVariable int id, @RequestBody String command) { command = command.toLowerCase().trim(); logger.debug("User (" + id + ") sent command: " + command); if ("start".equals(command)) { return gameService.pickClass(id); } try { var result = gameService.execute(id, command); logger.trace("Adding color to Result with message:"); logger.debug(result.getMessage()); return addColor(result); } catch (InvalidCommandException e) { logger.debug("Parsing user provided command failed.", e); return e.getMessage(); } }
@postmapping(value = "/{id}/msg", consumes = "text/plain", produces = "text/plain") public string receiveorderandreturnresult(@pathvariable int id, @requestbody string command) { command = command.tolowercase().trim(); logger.debug("user (" + id + ") sent command: " + command); if ("start".equals(command)) { return gameservice.pickclass(id); } try { var result = gameservice.execute(id, command); logger.trace("adding color to result with message:"); logger.debug(result.getmessage()); return addcolor(result); } catch (invalidcommandexception e) { logger.debug("parsing user provided command failed.", e); return e.getmessage(); } }
hjaremko/cute-animals
[ 1, 0, 0, 0 ]
20,968
public synchronized List<PlayerInput> findInputsByPlayerNumberAndSimTick(final int playerNumber, final long simTick) { List<PlayerInput> playerInputs = new ArrayList<PlayerInput>(); // TODO Do not use linear search? for (PlayerInput playerInput : this.playerInputs) { if (playerInput.getPlayerNumber() == playerNumber && playerInput.getSimTick() == simTick) { playerInputs.add(playerInput); } } return playerInputs; }
public synchronized List<PlayerInput> findInputsByPlayerNumberAndSimTick(final int playerNumber, final long simTick) { List<PlayerInput> playerInputs = new ArrayList<PlayerInput>(); for (PlayerInput playerInput : this.playerInputs) { if (playerInput.getPlayerNumber() == playerNumber && playerInput.getSimTick() == simTick) { playerInputs.add(playerInput); } } return playerInputs; }
public synchronized list<playerinput> findinputsbyplayernumberandsimtick(final int playernumber, final long simtick) { list<playerinput> playerinputs = new arraylist<playerinput>(); for (playerinput playerinput : this.playerinputs) { if (playerinput.getplayernumber() == playernumber && playerinput.getsimtick() == simtick) { playerinputs.add(playerinput); } } return playerinputs; }
guxuede/gm
[ 1, 0, 0, 0 ]
12,982
@Override public BaseURL toBaseURL(FacesContext facesContext) throws MalformedURLException { BaseURL baseURL; String uri = bridgeURI.toString(); // If the URL is opaque, meaning it starts with something like "portlet:" or "mailto:" and // doesn't have the double-forward-slash like "http://" does, then if (bridgeURI.isOpaque()) { // If the URI starts with "portlet:", then return a BaseURL that contains the modified // parameters. This will be a URL that represents navigation to a different viewId. if (bridgeURI.isPortletScheme()) { // TCK: modeViewIDTest // TCK: requestRenderIgnoresScopeViaCreateViewTest // TCK: requestRenderRedisplayTest // TCK: requestRedisplayOutOfScopeTest // TCK: renderRedirectTest // TCK: ignoreCurrentViewIdModeChangeTest // TCK: exceptionThrownWhenNoDefaultViewIdTest String portletMode = getParameter(Bridge.PORTLET_MODE_PARAMETER); boolean modeChanged = ((portletMode != null) && (portletMode.length() > 0)); Bridge.PortletPhase urlPortletPhase = bridgeURI.getPortletPhase(); if (urlPortletPhase == Bridge.PortletPhase.ACTION_PHASE) { baseURL = createActionURL(facesContext, modeChanged); } else if (urlPortletPhase == Bridge.PortletPhase.RENDER_PHASE) { baseURL = createRenderURL(facesContext, modeChanged); } else { baseURL = createResourceURL(facesContext, modeChanged); } // If the URI is self-referencing, meaning, it targets the current Faces view, then copy the render // parameters from the current PortletRequest to the BaseURL. NOTE: This has the added benefit of // copying the bridgeRequestScopeId render parameter, which will preserve the BridgeRequestScope if the // user clicks on the link (invokes the BaseURL). if (selfReferencing) { ExternalContext externalContext = facesContext.getExternalContext(); PortletRequest portletRequest = (PortletRequest) externalContext.getRequest(); copyRenderParameters(portletRequest, baseURL); } // If the portlet container created a PortletURL, then apply the PortletMode and WindowState to the // PortletURL. if (baseURL instanceof PortletURL) { PortletURL portletURL = (PortletURL) baseURL; ExternalContext externalContext = facesContext.getExternalContext(); PortletRequest portletRequest = (PortletRequest) externalContext.getRequest(); PortletURLHelper.setPortletMode(portletURL, portletMode, portletRequest); String windowState = getParameter(Bridge.PORTLET_WINDOWSTATE_PARAMETER); PortletURLHelper.setWindowState(portletURL, windowState, portletRequest); } // Apply the security. String secure = getParameter(Bridge.PORTLET_SECURE_PARAMETER); PortletURLHelper.setSecure(baseURL, secure); // According to the Bridge Spec, the "javax.portlet.faces.Secure" parameter must not be "carried // forward to the generated reference." According to a clarification in the Portlet 3.0 JavaDoc for // BaseURL#setProperty(String,String), setting the parameter to null will remove it. baseURL.setParameter(Bridge.PORTLET_SECURE_PARAMETER, (String) null); } // Otherwise, return the a BaseURL string representation (unmodified value) as required by the Bridge Spec. else { // TCK: encodeResourceURLOpaqueTest baseURL = new BaseURLNonEncodedImpl(bridgeURI, encoding); } } // Otherwise, if the URL is a JSF2 portlet resource URL, then else if (PortletResourceUtilCompat.isPortletResourceURL(uri)) { // FACES-63 Return the URI unmodified to prevent double-encoding of resource URLs. baseURL = new BaseURLBridgeURIAdapterImpl(bridgeURI); } // Otherwise, if the URL is not a JSF2 portlet resource URL, but still contains the "javax.faces.resource" // resource URL identifier, then return a ResourceURL that can retrieve the JSF2 resource. else if ((uri != null) && uri.contains("javax.faces.resource")) { baseURL = createResourceURL(facesContext, bridgeURI.getParameterMap()); } // Otherwise, if the URL is relative, in that it starts with "../", then return a BaseURL string representation // of the URL that contains the context-path. else if (bridgeURI.isPathRelative()) { // TCK: encodeResourceURLRelativeURLTest // TCK: encodeResourceURLRelativeURLBackLinkTest ExternalContext externalContext = facesContext.getExternalContext(); String contextPath = externalContext.getRequestContextPath(); baseURL = new BaseURLRelativeImpl(bridgeURI, contextPath); } // Otherwise, if the URL is external, then return an encoded BaseURL string representation of the URL. else if (bridgeURI.isExternal(contextPath)) { // TCK: encodeResourceURLForeignExternalURLBackLinkTest ExternalContext externalContext = facesContext.getExternalContext(); PortletResponse portletResponse = (PortletResponse) externalContext.getResponse(); baseURL = new BaseURLPortletResponseEncodedImpl(bridgeURI, portletResponse); } // Otherwise, if the URL originally contained the "javax.portlet.faces.ViewLink" which represents navigation // to a different Faces view, then else if (viewLink) { String portletMode = getParameter(Bridge.PORTLET_MODE_PARAMETER); String windowState = getParameter(Bridge.PORTLET_WINDOWSTATE_PARAMETER); boolean secure = BooleanHelper.toBoolean(getParameter(Bridge.PORTLET_SECURE_PARAMETER)); // If the URL targets a Faces viewId, then return a PortletURL (Action URL) that targets the view with the // appropriate PortletMode, WindowState, and Security settings built into the URL. For more info, see // JavaDoc comments for {@link Bridge#VIEW_LINK}. if (getViewId() != null) { // TCK: encodeResourceURLViewLinkTest // TCK: encodeResourceURLViewLinkWithBackLinkTest ExternalContext externalContext = facesContext.getExternalContext(); PortletRequest portletRequest = (PortletRequest) externalContext.getRequest(); PortletURL actionURL = createActionURL(facesContext, PortletURLHelper.EXCLUDED_PARAMETER_NAMES); PortletURLHelper.setPortletMode(actionURL, portletMode, portletRequest); PortletURLHelper.setWindowState(actionURL, windowState, portletRequest); PortletURLHelper.setSecure(actionURL, secure); // According to the Bridge Spec, the "javax.portlet.faces.Secure" parameter must not be "carried // forward to the generated reference." According to a clarification in the Portlet 3.0 JavaDoc for // BaseURL#setProperty(String,String), setting the parameter to null will remove it. actionURL.setParameter(Bridge.PORTLET_SECURE_PARAMETER, (String) null); baseURL = actionURL; } // Otherwise, return a PortletURL (Render URL) that contains the "_jsfBridgeNonFacesView" render parameter, // which is a signal to the GenericFacesPortlet to dispatch to this non-Faces target when the URL is // requested. Note that this seems to be a use-case that is contradictory with the JavaDoc for // Brige#VIEW_LINK which claims navigation to a different view. But there are a number of tests in the TCK // that utilize this (see below). else { Bridge.PortletPhase portletRequestPhase = BridgeUtil.getPortletRequestPhase(facesContext); if (isHeaderOrRenderOrResourcePhase(portletRequestPhase)) { // TCK: encodeActionURLNonJSFViewRenderTest // TCK: encodeActionURLNonJSFViewWithParamRenderTest // TCK: encodeActionURLNonJSFViewWithModeRenderTest // TCK: encodeActionURLNonJSFViewWithInvalidModeRenderTest // TCK: encodeActionURLNonJSFViewWithWindowStateRenderTest // TCK: encodeActionURLNonJSFViewWithInvalidWindowStateRenderTest // TCK: encodeActionURLNonJSFViewResourceTest // TCK: encodeActionURLNonJSFViewWithParamResourceTest // TCK: encodeActionURLNonJSFViewWithModeResourceTest // TCK: encodeActionURLNonJSFViewWithInvalidModeResourceTest // TCK: encodeActionURLNonJSFViewWithWindowStateResourceTest // TCK: encodeActionURLNonJSFViewWithInvalidWindowStateResourceTest ExternalContext externalContext = facesContext.getExternalContext(); PortletRequest portletRequest = (PortletRequest) externalContext.getRequest(); PortletURL renderURL = createRenderURL(facesContext, PortletURLHelper.EXCLUDED_PARAMETER_NAMES); renderURL.setParameter(Bridge.NONFACES_TARGET_PATH_PARAMETER, bridgeURI.getPath()); PortletURLHelper.setPortletMode(renderURL, portletMode, portletRequest); PortletURLHelper.setWindowState(renderURL, windowState, portletRequest); PortletURLHelper.setSecure(renderURL, secure); // According to the Bridge Spec, the "javax.portlet.faces.Secure" parameter must not be "carried // forward to the generated reference." According to a clarification in the Portlet 3.0 JavaDoc for // BaseURL#setProperty(String,String), setting the parameter to null will remove it. renderURL.setParameter(Bridge.PORTLET_SECURE_PARAMETER, (String) null); baseURL = renderURL; } else { throw new IllegalStateException("Unable to encode a URL for a non-Faces view in the " + portletRequestPhase + " of the portlet lifecycle."); } } } // Otherwise, if the URL targets a Faces viewId, then return a ResourceURL that targets the view. else if (getViewId() != null) { // TCK: resourceAttrRetainedAfterRedisplayPPRTest // TCK: encodeActionURLJSFViewResourceTest // TCK: encodeActionURLWithParamResourceTest // TCK: encodeActionURLWithModeResourceTest // TCK: encodeActionURLWithInvalidModeResourceTest // TCK: encodeActionURLWithWindowStateResourceTest // TCK: encodeActionURLWithInvalidWindowStateResourceTest // TCK: encodeURLEscapingTest // TCK: encodeResourceURLWithModeTest baseURL = createResourceURL(facesContext, PortletURLHelper.EXCLUDED_PARAMETER_NAMES); } // Otherwise, if the bridge must encode the URL to satisfy "in-protocol" resource serving, then return a // an appropriate ResourceURL. else if (inProtocol) { // TCK: nonFacesResourceTest ResourceURL resourceURL = createResourceURL(facesContext); resourceURL.setResourceID(bridgeURI.getContextRelativePath(contextPath)); baseURL = resourceURL; } // Otherwise, assume that the URL is for an resource external to the portlet context like // "/portalcontext/resources/foo.png" and return a BaseURL string representation of it. else { // TCK: encodeResourceURLTest // TCK: encodeResourceURLBackLinkTest baseURL = new BaseURLBridgeURIAdapterImpl(bridgeURI); } return baseURL; }
@Override public BaseURL toBaseURL(FacesContext facesContext) throws MalformedURLException { BaseURL baseURL; String uri = bridgeURI.toString(); if (bridgeURI.isOpaque()) { if (bridgeURI.isPortletScheme()) { String portletMode = getParameter(Bridge.PORTLET_MODE_PARAMETER); boolean modeChanged = ((portletMode != null) && (portletMode.length() > 0)); Bridge.PortletPhase urlPortletPhase = bridgeURI.getPortletPhase(); if (urlPortletPhase == Bridge.PortletPhase.ACTION_PHASE) { baseURL = createActionURL(facesContext, modeChanged); } else if (urlPortletPhase == Bridge.PortletPhase.RENDER_PHASE) { baseURL = createRenderURL(facesContext, modeChanged); } else { baseURL = createResourceURL(facesContext, modeChanged); } if (selfReferencing) { ExternalContext externalContext = facesContext.getExternalContext(); PortletRequest portletRequest = (PortletRequest) externalContext.getRequest(); copyRenderParameters(portletRequest, baseURL); } if (baseURL instanceof PortletURL) { PortletURL portletURL = (PortletURL) baseURL; ExternalContext externalContext = facesContext.getExternalContext(); PortletRequest portletRequest = (PortletRequest) externalContext.getRequest(); PortletURLHelper.setPortletMode(portletURL, portletMode, portletRequest); String windowState = getParameter(Bridge.PORTLET_WINDOWSTATE_PARAMETER); PortletURLHelper.setWindowState(portletURL, windowState, portletRequest); } String secure = getParameter(Bridge.PORTLET_SECURE_PARAMETER); PortletURLHelper.setSecure(baseURL, secure); baseURL.setParameter(Bridge.PORTLET_SECURE_PARAMETER, (String) null); } else { baseURL = new BaseURLNonEncodedImpl(bridgeURI, encoding); } } else if (PortletResourceUtilCompat.isPortletResourceURL(uri)) { baseURL = new BaseURLBridgeURIAdapterImpl(bridgeURI); } else if ((uri != null) && uri.contains("javax.faces.resource")) { baseURL = createResourceURL(facesContext, bridgeURI.getParameterMap()); } else if (bridgeURI.isPathRelative()) { ExternalContext externalContext = facesContext.getExternalContext(); String contextPath = externalContext.getRequestContextPath(); baseURL = new BaseURLRelativeImpl(bridgeURI, contextPath); } else if (bridgeURI.isExternal(contextPath)) { ExternalContext externalContext = facesContext.getExternalContext(); PortletResponse portletResponse = (PortletResponse) externalContext.getResponse(); baseURL = new BaseURLPortletResponseEncodedImpl(bridgeURI, portletResponse); } else if (viewLink) { String portletMode = getParameter(Bridge.PORTLET_MODE_PARAMETER); String windowState = getParameter(Bridge.PORTLET_WINDOWSTATE_PARAMETER); boolean secure = BooleanHelper.toBoolean(getParameter(Bridge.PORTLET_SECURE_PARAMETER)); if (getViewId() != null) { ExternalContext externalContext = facesContext.getExternalContext(); PortletRequest portletRequest = (PortletRequest) externalContext.getRequest(); PortletURL actionURL = createActionURL(facesContext, PortletURLHelper.EXCLUDED_PARAMETER_NAMES); PortletURLHelper.setPortletMode(actionURL, portletMode, portletRequest); PortletURLHelper.setWindowState(actionURL, windowState, portletRequest); PortletURLHelper.setSecure(actionURL, secure); actionURL.setParameter(Bridge.PORTLET_SECURE_PARAMETER, (String) null); baseURL = actionURL; } else { Bridge.PortletPhase portletRequestPhase = BridgeUtil.getPortletRequestPhase(facesContext); if (isHeaderOrRenderOrResourcePhase(portletRequestPhase)) { ExternalContext externalContext = facesContext.getExternalContext(); PortletRequest portletRequest = (PortletRequest) externalContext.getRequest(); PortletURL renderURL = createRenderURL(facesContext, PortletURLHelper.EXCLUDED_PARAMETER_NAMES); renderURL.setParameter(Bridge.NONFACES_TARGET_PATH_PARAMETER, bridgeURI.getPath()); PortletURLHelper.setPortletMode(renderURL, portletMode, portletRequest); PortletURLHelper.setWindowState(renderURL, windowState, portletRequest); PortletURLHelper.setSecure(renderURL, secure); renderURL.setParameter(Bridge.PORTLET_SECURE_PARAMETER, (String) null); baseURL = renderURL; } else { throw new IllegalStateException("Unable to encode a URL for a non-Faces view in the " + portletRequestPhase + " of the portlet lifecycle."); } } } else if (getViewId() != null) { baseURL = createResourceURL(facesContext, PortletURLHelper.EXCLUDED_PARAMETER_NAMES); } else if (inProtocol) { ResourceURL resourceURL = createResourceURL(facesContext); resourceURL.setResourceID(bridgeURI.getContextRelativePath(contextPath)); baseURL = resourceURL; } else { baseURL = new BaseURLBridgeURIAdapterImpl(bridgeURI); } return baseURL; }
@override public baseurl tobaseurl(facescontext facescontext) throws malformedurlexception { baseurl baseurl; string uri = bridgeuri.tostring(); if (bridgeuri.isopaque()) { if (bridgeuri.isportletscheme()) { string portletmode = getparameter(bridge.portlet_mode_parameter); boolean modechanged = ((portletmode != null) && (portletmode.length() > 0)); bridge.portletphase urlportletphase = bridgeuri.getportletphase(); if (urlportletphase == bridge.portletphase.action_phase) { baseurl = createactionurl(facescontext, modechanged); } else if (urlportletphase == bridge.portletphase.render_phase) { baseurl = createrenderurl(facescontext, modechanged); } else { baseurl = createresourceurl(facescontext, modechanged); } if (selfreferencing) { externalcontext externalcontext = facescontext.getexternalcontext(); portletrequest portletrequest = (portletrequest) externalcontext.getrequest(); copyrenderparameters(portletrequest, baseurl); } if (baseurl instanceof portleturl) { portleturl portleturl = (portleturl) baseurl; externalcontext externalcontext = facescontext.getexternalcontext(); portletrequest portletrequest = (portletrequest) externalcontext.getrequest(); portleturlhelper.setportletmode(portleturl, portletmode, portletrequest); string windowstate = getparameter(bridge.portlet_windowstate_parameter); portleturlhelper.setwindowstate(portleturl, windowstate, portletrequest); } string secure = getparameter(bridge.portlet_secure_parameter); portleturlhelper.setsecure(baseurl, secure); baseurl.setparameter(bridge.portlet_secure_parameter, (string) null); } else { baseurl = new baseurlnonencodedimpl(bridgeuri, encoding); } } else if (portletresourceutilcompat.isportletresourceurl(uri)) { baseurl = new baseurlbridgeuriadapterimpl(bridgeuri); } else if ((uri != null) && uri.contains("javax.faces.resource")) { baseurl = createresourceurl(facescontext, bridgeuri.getparametermap()); } else if (bridgeuri.ispathrelative()) { externalcontext externalcontext = facescontext.getexternalcontext(); string contextpath = externalcontext.getrequestcontextpath(); baseurl = new baseurlrelativeimpl(bridgeuri, contextpath); } else if (bridgeuri.isexternal(contextpath)) { externalcontext externalcontext = facescontext.getexternalcontext(); portletresponse portletresponse = (portletresponse) externalcontext.getresponse(); baseurl = new baseurlportletresponseencodedimpl(bridgeuri, portletresponse); } else if (viewlink) { string portletmode = getparameter(bridge.portlet_mode_parameter); string windowstate = getparameter(bridge.portlet_windowstate_parameter); boolean secure = booleanhelper.toboolean(getparameter(bridge.portlet_secure_parameter)); if (getviewid() != null) { externalcontext externalcontext = facescontext.getexternalcontext(); portletrequest portletrequest = (portletrequest) externalcontext.getrequest(); portleturl actionurl = createactionurl(facescontext, portleturlhelper.excluded_parameter_names); portleturlhelper.setportletmode(actionurl, portletmode, portletrequest); portleturlhelper.setwindowstate(actionurl, windowstate, portletrequest); portleturlhelper.setsecure(actionurl, secure); actionurl.setparameter(bridge.portlet_secure_parameter, (string) null); baseurl = actionurl; } else { bridge.portletphase portletrequestphase = bridgeutil.getportletrequestphase(facescontext); if (isheaderorrenderorresourcephase(portletrequestphase)) { externalcontext externalcontext = facescontext.getexternalcontext(); portletrequest portletrequest = (portletrequest) externalcontext.getrequest(); portleturl renderurl = createrenderurl(facescontext, portleturlhelper.excluded_parameter_names); renderurl.setparameter(bridge.nonfaces_target_path_parameter, bridgeuri.getpath()); portleturlhelper.setportletmode(renderurl, portletmode, portletrequest); portleturlhelper.setwindowstate(renderurl, windowstate, portletrequest); portleturlhelper.setsecure(renderurl, secure); renderurl.setparameter(bridge.portlet_secure_parameter, (string) null); baseurl = renderurl; } else { throw new illegalstateexception("unable to encode a url for a non-faces view in the " + portletrequestphase + " of the portlet lifecycle."); } } } else if (getviewid() != null) { baseurl = createresourceurl(facescontext, portleturlhelper.excluded_parameter_names); } else if (inprotocol) { resourceurl resourceurl = createresourceurl(facescontext); resourceurl.setresourceid(bridgeuri.getcontextrelativepath(contextpath)); baseurl = resourceurl; } else { baseurl = new baseurlbridgeuriadapterimpl(bridgeuri); } return baseurl; }
jgorny/liferay-faces-bridge-impl
[ 0, 1, 0, 0 ]
13,218
public static <N, T extends N> int getItemSize(ReadableWDocument<N, ?, T> doc, N node) { // Short circuit if it's a text node, implementation is simpler T textNode = doc.asText(node); if (textNode != null) { return doc.getLength(textNode); } // Otherwise, calculate two locations and subtract N parent = doc.getParentElement(node); if (parent == null) { // Requesting size of the document root. // TODO(danilatos/anorth) This would change if we have multiple roots. noteCodeThatWillBreakWithMultipleRoots(); return doc.size(); } N next = doc.getNextSibling(node); int locationAfter = next != null ? doc.getLocation(next) : doc.getLocation(Point.end(parent)); return locationAfter - doc.getLocation(node); }
public static <N, T extends N> int getItemSize(ReadableWDocument<N, ?, T> doc, N node) { T textNode = doc.asText(node); if (textNode != null) { return doc.getLength(textNode); } N parent = doc.getParentElement(node); if (parent == null) { noteCodeThatWillBreakWithMultipleRoots(); return doc.size(); } N next = doc.getNextSibling(node); int locationAfter = next != null ? doc.getLocation(next) : doc.getLocation(Point.end(parent)); return locationAfter - doc.getLocation(node); }
public static <n, t extends n> int getitemsize(readablewdocument<n, ?, t> doc, n node) { t textnode = doc.astext(node); if (textnode != null) { return doc.getlength(textnode); } n parent = doc.getparentelement(node); if (parent == null) { notecodethatwillbreakwithmultipleroots(); return doc.size(); } n next = doc.getnextsibling(node); int locationafter = next != null ? doc.getlocation(next) : doc.getlocation(point.end(parent)); return locationafter - doc.getlocation(node); }
gburd/wave
[ 1, 0, 0, 0 ]
13,290
private void resolveAllProperties(Properties props, IXMLElement xmlProp, File file) throws CompilerException { variableSubstitutor.setBracesRequired(true); for (Enumeration e = props.keys(); e.hasMoreElements();) { String name = (String) e.nextElement(); String value = props.getProperty(name); int mods = -1; do { StringReader read = new StringReader(value); StringWriter write = new StringWriter(); try { try { mods = variableSubstitutor.substitute(read, write, SubstitutionType.TYPE_AT); } catch (Exception e1) { throw new IOException(e1.getMessage()); } // TODO: check for circular references. We need to know // which // variables were substituted to do that props.put(name, value); } catch (IOException ex) { assertionHelper.parseError(xmlProp, "Faild to load file: " + file.getAbsolutePath(), ex); } } while (mods != 0); } }
private void resolveAllProperties(Properties props, IXMLElement xmlProp, File file) throws CompilerException { variableSubstitutor.setBracesRequired(true); for (Enumeration e = props.keys(); e.hasMoreElements();) { String name = (String) e.nextElement(); String value = props.getProperty(name); int mods = -1; do { StringReader read = new StringReader(value); StringWriter write = new StringWriter(); try { try { mods = variableSubstitutor.substitute(read, write, SubstitutionType.TYPE_AT); } catch (Exception e1) { throw new IOException(e1.getMessage()); } props.put(name, value); } catch (IOException ex) { assertionHelper.parseError(xmlProp, "Faild to load file: " + file.getAbsolutePath(), ex); } } while (mods != 0); } }
private void resolveallproperties(properties props, ixmlelement xmlprop, file file) throws compilerexception { variablesubstitutor.setbracesrequired(true); for (enumeration e = props.keys(); e.hasmoreelements();) { string name = (string) e.nextelement(); string value = props.getproperty(name); int mods = -1; do { stringreader read = new stringreader(value); stringwriter write = new stringwriter(); try { try { mods = variablesubstitutor.substitute(read, write, substitutiontype.type_at); } catch (exception e1) { throw new ioexception(e1.getmessage()); } props.put(name, value); } catch (ioexception ex) { assertionhelper.parseerror(xmlprop, "faild to load file: " + file.getabsolutepath(), ex); } } while (mods != 0); } }
guilhermemota/izpack
[ 1, 0, 0, 0 ]
13,571
public PeRatio computePeRatio(final TickerPrice price) { /* * TODO: Need to verify the denominator to be used in this formula. I was not able to understand this from the * document */ return PeRatio.compute(price, computeDividendYield(price)); }
public PeRatio computePeRatio(final TickerPrice price) { return PeRatio.compute(price, computeDividendYield(price)); }
public peratio computeperatio(final tickerprice price) { return peratio.compute(price, computedividendyield(price)); }
javacreed/super-simple-stocks
[ 0, 1, 0, 0 ]
29,973
@Override public MultiSelect<T> build() { final MultiSelectListBox<ITEM> component = getComponent(); // check DataProvider if (!new ExceptionSwallowingSupplier<>(() -> component.getDataProvider()).get().isPresent()) { // default data provider component.setDataProvider(DataProvider.ofCollection(Collections.emptySet())); } // configure captions if (!customItemCaptionGenerator && !itemCaptions.isEmpty()) { component.setRenderer(new TextRenderer<>( new DeferrableItemLabelGenerator<>(itemCaptions, component, isDeferredLocalizationEnabled()))); } // items if (!items.isEmpty()) { component.setItems(items); } final Input<Set<ITEM>> itemInput = Input.builder(component).requiredPropertyHandler((f, c) -> { return false; // TODO not supported by web component at time of writing // return f.isRequiredIndicatorVisible(); }, (f, c, v) -> { // TODO not supported by web component at time of writing // f.setRequiredIndicatorVisible(v); }).isEmptySupplier(f -> f.getValue() == null || f.getValue().isEmpty()).build(); final MultiSelectInputAdapter<T, ITEM, MultiSelectListBox<ITEM>> multiSelect = new MultiSelectInputAdapter<>( itemInput, new MultiSelectListBoxItemConverterAdapter<>(component, itemConverter), ms -> component.getDataProvider().refreshAll(), () -> { if (component.getDataProvider() != null) { return component.getDataProvider().fetch(new Query<>()).collect(Collectors.toSet()); } return null; }); selectionListeners.forEach(listener -> multiSelect.addSelectionListener(listener)); getValueChangeListeners().forEach(listener -> multiSelect.addValueChangeListener(listener)); getReadonlyChangeListeners().forEach(listener -> multiSelect.addReadonlyChangeListener(listener)); getAdapters().getAdapters().forEach((t, a) -> multiSelect.setAdapter(t, a)); return multiSelect; }
@Override public MultiSelect<T> build() { final MultiSelectListBox<ITEM> component = getComponent(); if (!new ExceptionSwallowingSupplier<>(() -> component.getDataProvider()).get().isPresent()) { component.setDataProvider(DataProvider.ofCollection(Collections.emptySet())); } if (!customItemCaptionGenerator && !itemCaptions.isEmpty()) { component.setRenderer(new TextRenderer<>( new DeferrableItemLabelGenerator<>(itemCaptions, component, isDeferredLocalizationEnabled()))); } if (!items.isEmpty()) { component.setItems(items); } final Input<Set<ITEM>> itemInput = Input.builder(component).requiredPropertyHandler((f, c) -> { return false; }, (f, c, v) -> { }).isEmptySupplier(f -> f.getValue() == null || f.getValue().isEmpty()).build(); final MultiSelectInputAdapter<T, ITEM, MultiSelectListBox<ITEM>> multiSelect = new MultiSelectInputAdapter<>( itemInput, new MultiSelectListBoxItemConverterAdapter<>(component, itemConverter), ms -> component.getDataProvider().refreshAll(), () -> { if (component.getDataProvider() != null) { return component.getDataProvider().fetch(new Query<>()).collect(Collectors.toSet()); } return null; }); selectionListeners.forEach(listener -> multiSelect.addSelectionListener(listener)); getValueChangeListeners().forEach(listener -> multiSelect.addValueChangeListener(listener)); getReadonlyChangeListeners().forEach(listener -> multiSelect.addReadonlyChangeListener(listener)); getAdapters().getAdapters().forEach((t, a) -> multiSelect.setAdapter(t, a)); return multiSelect; }
@override public multiselect<t> build() { final multiselectlistbox<item> component = getcomponent(); if (!new exceptionswallowingsupplier<>(() -> component.getdataprovider()).get().ispresent()) { component.setdataprovider(dataprovider.ofcollection(collections.emptyset())); } if (!customitemcaptiongenerator && !itemcaptions.isempty()) { component.setrenderer(new textrenderer<>( new deferrableitemlabelgenerator<>(itemcaptions, component, isdeferredlocalizationenabled()))); } if (!items.isempty()) { component.setitems(items); } final input<set<item>> iteminput = input.builder(component).requiredpropertyhandler((f, c) -> { return false; }, (f, c, v) -> { }).isemptysupplier(f -> f.getvalue() == null || f.getvalue().isempty()).build(); final multiselectinputadapter<t, item, multiselectlistbox<item>> multiselect = new multiselectinputadapter<>( iteminput, new multiselectlistboxitemconverteradapter<>(component, itemconverter), ms -> component.getdataprovider().refreshall(), () -> { if (component.getdataprovider() != null) { return component.getdataprovider().fetch(new query<>()).collect(collectors.toset()); } return null; }); selectionlisteners.foreach(listener -> multiselect.addselectionlistener(listener)); getvaluechangelisteners().foreach(listener -> multiselect.addvaluechangelistener(listener)); getreadonlychangelisteners().foreach(listener -> multiselect.addreadonlychangelistener(listener)); getadapters().getadapters().foreach((t, a) -> multiselect.setadapter(t, a)); return multiselect; }
holon-platform/holon-vaadin-flow
[ 0, 0, 1, 0 ]
29,974
@Override public ListMultiSelectInputBuilder<T, ITEM> required(boolean required) { // TODO not supported at time of writing // getComponent().setRequiredIndicatorVisible(required); return getConfigurator(); }
@Override public ListMultiSelectInputBuilder<T, ITEM> required(boolean required) { return getConfigurator(); }
@override public listmultiselectinputbuilder<t, item> required(boolean required) { return getconfigurator(); }
holon-platform/holon-vaadin-flow
[ 0, 1, 0, 0 ]
13,607
public void generateMethods(FhirToHapiTypeConverter converter, List<Method> methods) { List<HapiType> types = converter.getHapiTypes(); System.out.println("Attribute path:" + converter.getFullAttributePath()); if ("Immunization.doseQuantity".equals(converter.getFullAttributePath())) { System.out.println("Start Debugging"); } if (types == null || types.isEmpty() || converter.getCardinality() == Cardinality.CONSTRAINED_OUT) { return; } else { if(converter.isMultiType()) { // Method method = Method.constructNoArgMethod(Method.buildGetterName(converter.parseAttributeName()), "org.hl7.fhir.dstu3.model.Type"); // method.setBody(getTemplate().getAdapterGetMethodDelegationWithTryCatchBody(converter.parseAttributeName())); // addMethod(methods, method); buildGetterMethod(methods, converter.parseAttributeName(), "org.hl7.fhir.dstu3.model.Type", null, false, null); // method = constructSetMethodSignature(converter.parseAttributeName(), "org.hl7.fhir.dstu3.model.Type", getParentType()); // method.setBody(getTemplate().getAdapterSetMethodDelegationBody(converter.parseAttributeName())); // method.addImport("org.hl7.fhir.dstu3.model.Type"); // addMethod(methods, method); buildSetterMethod(methods, converter.parseAttributeName(), "org.hl7.fhir.dstu3.model.Type", getParentType()); } if(converter.isReferenceMultiType() && !converter.isMultipleCardinality() && !converter.isMultiType()) { // Method method = Method.constructNoArgMethod(Method.buildGetterName(converter.parseAttributeName()), "org.hl7.fhir.dstu3.model.Reference"); // method.setBody(getTemplate().getAdapterGetMethodDelegationWithTryCatchBody(converter.parseAttributeName())); // addMethod(methods, method); buildGetterMethod(methods, converter.parseAttributeName(), "org.hl7.fhir.dstu3.model.Reference", null, false, null); // method = Method.constructNoArgMethod(Method.buildGetterName(converter.parseAttributeName() + "Target"), "org.hl7.fhir.dstu3.model.Resource"); // method.setBody(getTemplate().getAdapterGetMethodDelegationWithTryCatchBody(converter.parseAttributeName() + "Target")); // addMethod(methods, method); buildGetterMethod(methods, converter.parseAttributeName() + "Target", "org.hl7.fhir.dstu3.model.Resource", null, false, null); } for (HapiType type : types) { if (type.getDatatype() == null && type.getGeneratedType() == null) { System.out.println("Investigate : " + converter.getFullAttributePath()); //TODO Currently not handled: text, meta, references continue; } if (type.isReference()) { handleReferenceTypes(converter, type, methods); } else if (!type.isResource() && type.getGeneratedType() != null) { handleExtendedDatatypes(converter, type, methods); } else if (type.isBackboneElement()) { handleDatatypeMethods(converter, type, methods); } else if (type.isEnumerationType()) { handleEnumTypeMethods(converter, type, methods); } else { FhirDatatypeEnum datatype = FhirDatatypeEnum.getEnumeratedDatatype(type.getFhirType()); if (datatype != null && datatype.isPrimitiveDatatype()) { handlePrimitiveTypeMethods(converter, type, methods); //TODO Create methods that return the equivalent java type } else { handleDatatypeMethods(converter, type, methods); } } } if (converter.isMultiType()) { //TODO Add org.hl7.fhir.dstu3.model.Type method } } }
public void generateMethods(FhirToHapiTypeConverter converter, List<Method> methods) { List<HapiType> types = converter.getHapiTypes(); System.out.println("Attribute path:" + converter.getFullAttributePath()); if ("Immunization.doseQuantity".equals(converter.getFullAttributePath())) { System.out.println("Start Debugging"); } if (types == null || types.isEmpty() || converter.getCardinality() == Cardinality.CONSTRAINED_OUT) { return; } else { if(converter.isMultiType()) { buildGetterMethod(methods, converter.parseAttributeName(), "org.hl7.fhir.dstu3.model.Type", null, false, null); buildSetterMethod(methods, converter.parseAttributeName(), "org.hl7.fhir.dstu3.model.Type", getParentType()); } if(converter.isReferenceMultiType() && !converter.isMultipleCardinality() && !converter.isMultiType()) { buildGetterMethod(methods, converter.parseAttributeName(), "org.hl7.fhir.dstu3.model.Reference", null, false, null); buildGetterMethod(methods, converter.parseAttributeName() + "Target", "org.hl7.fhir.dstu3.model.Resource", null, false, null); } for (HapiType type : types) { if (type.getDatatype() == null && type.getGeneratedType() == null) { System.out.println("Investigate : " + converter.getFullAttributePath()); continue; } if (type.isReference()) { handleReferenceTypes(converter, type, methods); } else if (!type.isResource() && type.getGeneratedType() != null) { handleExtendedDatatypes(converter, type, methods); } else if (type.isBackboneElement()) { handleDatatypeMethods(converter, type, methods); } else if (type.isEnumerationType()) { handleEnumTypeMethods(converter, type, methods); } else { FhirDatatypeEnum datatype = FhirDatatypeEnum.getEnumeratedDatatype(type.getFhirType()); if (datatype != null && datatype.isPrimitiveDatatype()) { handlePrimitiveTypeMethods(converter, type, methods); } else { handleDatatypeMethods(converter, type, methods); } } } if (converter.isMultiType()) { } } }
public void generatemethods(fhirtohapitypeconverter converter, list<method> methods) { list<hapitype> types = converter.gethapitypes(); system.out.println("attribute path:" + converter.getfullattributepath()); if ("immunization.dosequantity".equals(converter.getfullattributepath())) { system.out.println("start debugging"); } if (types == null || types.isempty() || converter.getcardinality() == cardinality.constrained_out) { return; } else { if(converter.ismultitype()) { buildgettermethod(methods, converter.parseattributename(), "org.hl7.fhir.dstu3.model.type", null, false, null); buildsettermethod(methods, converter.parseattributename(), "org.hl7.fhir.dstu3.model.type", getparenttype()); } if(converter.isreferencemultitype() && !converter.ismultiplecardinality() && !converter.ismultitype()) { buildgettermethod(methods, converter.parseattributename(), "org.hl7.fhir.dstu3.model.reference", null, false, null); buildgettermethod(methods, converter.parseattributename() + "target", "org.hl7.fhir.dstu3.model.resource", null, false, null); } for (hapitype type : types) { if (type.getdatatype() == null && type.getgeneratedtype() == null) { system.out.println("investigate : " + converter.getfullattributepath()); continue; } if (type.isreference()) { handlereferencetypes(converter, type, methods); } else if (!type.isresource() && type.getgeneratedtype() != null) { handleextendeddatatypes(converter, type, methods); } else if (type.isbackboneelement()) { handledatatypemethods(converter, type, methods); } else if (type.isenumerationtype()) { handleenumtypemethods(converter, type, methods); } else { fhirdatatypeenum datatype = fhirdatatypeenum.getenumerateddatatype(type.getfhirtype()); if (datatype != null && datatype.isprimitivedatatype()) { handleprimitivetypemethods(converter, type, methods); } else { handledatatypemethods(converter, type, methods); } } } if (converter.ismultitype()) { } } }
hapifhir/hapi-profile-code-generator
[ 0, 1, 0, 0 ]
13,608
public void handlePrimitiveTypeMethods(FhirToHapiTypeConverter converter, HapiType type, List<Method> methods) { String attributeName = converter.parseAttributeName(); if (converter.isMultiType()) { handlePrimitiveMultiType(converter, type, methods, attributeName);//TODO Path never appears to be visited. Consider removing. } else { if(converter.isMultipleCardinality()) { handlePrimitiveListType(converter, type, methods, attributeName); } else { handlePrimitiveType(converter, type, methods, attributeName); } } }
public void handlePrimitiveTypeMethods(FhirToHapiTypeConverter converter, HapiType type, List<Method> methods) { String attributeName = converter.parseAttributeName(); if (converter.isMultiType()) { handlePrimitiveMultiType(converter, type, methods, attributeName) } else { if(converter.isMultipleCardinality()) { handlePrimitiveListType(converter, type, methods, attributeName); } else { handlePrimitiveType(converter, type, methods, attributeName); } } }
public void handleprimitivetypemethods(fhirtohapitypeconverter converter, hapitype type, list<method> methods) { string attributename = converter.parseattributename(); if (converter.ismultitype()) { handleprimitivemultitype(converter, type, methods, attributename) } else { if(converter.ismultiplecardinality()) { handleprimitivelisttype(converter, type, methods, attributename); } else { handleprimitivetype(converter, type, methods, attributename); } } }
hapifhir/hapi-profile-code-generator
[ 1, 0, 0, 0 ]
30,286
private Algorithm configIntermedAlgo(final boolean hasBeenPreviouslySorted) { AbstractMultiStepAlgo algorithm = null; Map<StepIOKeys, AlgoIOKeys> stepToAlgoKeysMapping = new StepAlgoKeyMapBuilder() .add(INTERMEDIATE_DISTINCT_VALUES_HOLDER, DISTINCT_VALUES_HOLDER) .add(INTERMEDIATE_SERIALIZED_FILE, INTERMEDIATE_OUTPUT_FILE) .build(); if(hasBeenPreviouslySorted){ algorithm = new MultipleSortedFilesInputAlgo("Intermediate Algorithm", stepToAlgoKeysMapping); }else{ algorithm = new LoopThroughTableInputAlgo("Intermediate Algorithm", stepToAlgoKeysMapping); } // initial steps // algorithm.addInitStep(new ConfigIntermedColsInitStep()); algorithm.addInitStep(new ConstrIntermedDataColsInitStep()); algorithm.addInitStep(new ConstrIntermedGrpColsInitStep()); // if(!needsProgramaticSorting){ // algorithm.addInitStep(new ConfigIntermedIOInitStep()); // }else{ // algorithm.addInitStep(new // ConfigMultiExternalFilesInputForIntermReportInitStep()); // } algorithm.addInitStep(new ConfigIntermedReportOutputInitStep()); algorithm.addInitStep(stepInput -> { ((IntermediateCrosstabOutput) stepInput.getContextParam(INTERMEDIATE_CROSSTAB_OUTPUT)).open(); return NO_RESULT; }); // TODO: only when totals add the step below algorithm.addInitStep(new IntermedReportExtractTotalsDataInitStep()); // only for debug // algorithm.addInitStep(new ColumnHeaderOutputInitStep("Intermediate report")); // main steps algorithm.addMainStep(new DistinctValuesDetectorStep()); algorithm.addMainStep(new IntermedGroupLevelDetectorStep()); // only for debug // if( getShowTotals() || getShowGrandTotal()){ // algorithm.addMainStep(new FlatReportTotalsOutputStep()); // } algorithm.addMainStep(new IntermedRowMangerStep()); if (getShowTotals() || getShowGrandTotal()) { algorithm.addMainStep(new IntermedTotalsCalculatorStep()); } // only for debug // algorithm.addMainStep(new DataRowsOutputStep()); // if( intermediateGroupCols.size() > 0){ algorithm.addMainStep(new IntermedPreviousRowManagerStep()); // } algorithm.addExitStep(stepInput -> { ((IntermediateCrosstabOutput) stepInput.getContextParam(INTERMEDIATE_CROSSTAB_OUTPUT)).close(); return NO_RESULT; }); algorithm.addExitStep(new IntermedSetResultsExitStep()); return algorithm; }
private Algorithm configIntermedAlgo(final boolean hasBeenPreviouslySorted) { AbstractMultiStepAlgo algorithm = null; Map<StepIOKeys, AlgoIOKeys> stepToAlgoKeysMapping = new StepAlgoKeyMapBuilder() .add(INTERMEDIATE_DISTINCT_VALUES_HOLDER, DISTINCT_VALUES_HOLDER) .add(INTERMEDIATE_SERIALIZED_FILE, INTERMEDIATE_OUTPUT_FILE) .build(); if(hasBeenPreviouslySorted){ algorithm = new MultipleSortedFilesInputAlgo("Intermediate Algorithm", stepToAlgoKeysMapping); }else{ algorithm = new LoopThroughTableInputAlgo("Intermediate Algorithm", stepToAlgoKeysMapping); } algorithm.addInitStep(new ConstrIntermedDataColsInitStep()); algorithm.addInitStep(new ConstrIntermedGrpColsInitStep()); algorithm.addInitStep(new ConfigIntermedReportOutputInitStep()); algorithm.addInitStep(stepInput -> { ((IntermediateCrosstabOutput) stepInput.getContextParam(INTERMEDIATE_CROSSTAB_OUTPUT)).open(); return NO_RESULT; }); algorithm.addInitStep(new IntermedReportExtractTotalsDataInitStep()); algorithm.addMainStep(new DistinctValuesDetectorStep()); algorithm.addMainStep(new IntermedGroupLevelDetectorStep()); algorithm.addMainStep(new IntermedRowMangerStep()); if (getShowTotals() || getShowGrandTotal()) { algorithm.addMainStep(new IntermedTotalsCalculatorStep()); } algorithm.addMainStep(new IntermedPreviousRowManagerStep()); algorithm.addExitStep(stepInput -> { ((IntermediateCrosstabOutput) stepInput.getContextParam(INTERMEDIATE_CROSSTAB_OUTPUT)).close(); return NO_RESULT; }); algorithm.addExitStep(new IntermedSetResultsExitStep()); return algorithm; }
private algorithm configintermedalgo(final boolean hasbeenpreviouslysorted) { abstractmultistepalgo algorithm = null; map<stepiokeys, algoiokeys> steptoalgokeysmapping = new stepalgokeymapbuilder() .add(intermediate_distinct_values_holder, distinct_values_holder) .add(intermediate_serialized_file, intermediate_output_file) .build(); if(hasbeenpreviouslysorted){ algorithm = new multiplesortedfilesinputalgo("intermediate algorithm", steptoalgokeysmapping); }else{ algorithm = new loopthroughtableinputalgo("intermediate algorithm", steptoalgokeysmapping); } algorithm.addinitstep(new constrintermeddatacolsinitstep()); algorithm.addinitstep(new constrintermedgrpcolsinitstep()); algorithm.addinitstep(new configintermedreportoutputinitstep()); algorithm.addinitstep(stepinput -> { ((intermediatecrosstaboutput) stepinput.getcontextparam(intermediate_crosstab_output)).open(); return no_result; }); algorithm.addinitstep(new intermedreportextracttotalsdatainitstep()); algorithm.addmainstep(new distinctvaluesdetectorstep()); algorithm.addmainstep(new intermedgroupleveldetectorstep()); algorithm.addmainstep(new intermedrowmangerstep()); if (getshowtotals() || getshowgrandtotal()) { algorithm.addmainstep(new intermedtotalscalculatorstep()); } algorithm.addmainstep(new intermedpreviousrowmanagerstep()); algorithm.addexitstep(stepinput -> { ((intermediatecrosstaboutput) stepinput.getcontextparam(intermediate_crosstab_output)).close(); return no_result; }); algorithm.addexitstep(new intermedsetresultsexitstep()); return algorithm; }
humbletrader/katechaki
[ 1, 0, 0, 0 ]
30,517
private static void findIntersection(Map<String, LineString> linesByName) { for (Entry<String, LineString> entryA : linesByName.entrySet()) { for (Entry<String, LineString> entryB : linesByName.entrySet()) { System.out.println("Checking " + entryA.getKey() + " against " + entryB.getKey()); if (entryA.equals(entryB)) continue; // TODO: Introduce PreparedGeometry if (entryA.getValue().intersects(entryB.getValue())) { System.out.println(entryA.getKey() + " intersects " + entryB.getKey()); lineStringToJSON(entryA); lineStringToJSON(entryB); System.out .println("Intersection is " + entryA.getValue().intersection( entryB.getValue())); System.exit(0); } } } }
private static void findIntersection(Map<String, LineString> linesByName) { for (Entry<String, LineString> entryA : linesByName.entrySet()) { for (Entry<String, LineString> entryB : linesByName.entrySet()) { System.out.println("Checking " + entryA.getKey() + " against " + entryB.getKey()); if (entryA.equals(entryB)) continue; if (entryA.getValue().intersects(entryB.getValue())) { System.out.println(entryA.getKey() + " intersects " + entryB.getKey()); lineStringToJSON(entryA); lineStringToJSON(entryB); System.out .println("Intersection is " + entryA.getValue().intersection( entryB.getValue())); System.exit(0); } } } }
private static void findintersection(map<string, linestring> linesbyname) { for (entry<string, linestring> entrya : linesbyname.entryset()) { for (entry<string, linestring> entryb : linesbyname.entryset()) { system.out.println("checking " + entrya.getkey() + " against " + entryb.getkey()); if (entrya.equals(entryb)) continue; if (entrya.getvalue().intersects(entryb.getvalue())) { system.out.println(entrya.getkey() + " intersects " + entryb.getkey()); linestringtojson(entrya); linestringtojson(entryb); system.out .println("intersection is " + entrya.getvalue().intersection( entryb.getvalue())); system.exit(0); } } } }
jettmarks/clueRide-angular
[ 1, 0, 0, 0 ]
30,631
public static double TotalHashCapacity(double bytes, double fpp) { double word_bits = 32; double bucket_words = 8; double hash_bits = 32; double result = 1; // TODO: unify this exponential + binary search with the bytes needed function above while (Fpp(result, bytes) < fpp) { result *= 2; } if (result == 1) return 0; double lo = 0; while (lo + 1 < result) { double mid = lo + (result - lo) / 2; double test = Fpp(mid, bytes); if (test < fpp) lo = mid; else if (test == fpp) return mid; else result = mid; } return lo; }
public static double TotalHashCapacity(double bytes, double fpp) { double word_bits = 32; double bucket_words = 8; double hash_bits = 32; double result = 1; while (Fpp(result, bytes) < fpp) { result *= 2; } if (result == 1) return 0; double lo = 0; while (lo + 1 < result) { double mid = lo + (result - lo) / 2; double test = Fpp(mid, bytes); if (test < fpp) lo = mid; else if (test == fpp) return mid; else result = mid; } return lo; }
public static double totalhashcapacity(double bytes, double fpp) { double word_bits = 32; double bucket_words = 8; double hash_bits = 32; double result = 1; while (fpp(result, bytes) < fpp) { result *= 2; } if (result == 1) return 0; double lo = 0; while (lo + 1 < result) { double mid = lo + (result - lo) / 2; double test = fpp(mid, bytes); if (test < fpp) lo = mid; else if (test == fpp) return mid; else result = mid; } return lo; }
jbapple/libfilter
[ 1, 0, 0, 0 ]
14,341
@Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); // add MQTT listener MqttService.add_mqttListener(this); // need to bind the UI activity and the background service Intent intent=new Intent(getActivity(),MqttService.class); // change the current msg-->different page has different topic // TODO: may use '#' to receive all msg, and different listener to select the topic they need MqttService.setCur_topic("pic_data"); // TODO: this function is only used for >=API 8.0, so may be need to support other version's API startForegroundService(getActivity(),intent); }
@Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); MqttService.add_mqttListener(this); Intent intent=new Intent(getActivity(),MqttService.class); MqttService.setCur_topic("pic_data"); startForegroundService(getActivity(),intent); }
@override public void oncreate(@nullable bundle savedinstancestate) { super.oncreate(savedinstancestate); mqttservice.add_mqttlistener(this); intent intent=new intent(getactivity(),mqttservice.class); mqttservice.setcur_topic("pic_data"); startforegroundservice(getactivity(),intent); }
gjbang/graduation-design
[ 1, 1, 0, 0 ]
22,629
public synchronized void stop() { task = null; // set the flag and while loop in the run() will exit i = 0; notify(); // try to wake up the thread which associate this object }
public synchronized void stop() { task = null; i = 0; notify(); }
public synchronized void stop() { task = null; i = 0; notify(); }
jmwhite999/_multithreaded_greyscaling
[ 1, 0, 0, 0 ]