target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test (expected = IllegalArgumentException.class) public void testParseInvalidInvalidAlg () { MIC.parse ("VGVzdA==, blub"); } | @Nullable public static MIC parse (@Nullable final String sMIC) { if (StringHelper.hasNoText (sMIC)) return null; final StringTokenizer st = new StringTokenizer (sMIC, ", \t\r\n"); final String sMICBytes = st.nextToken (); final byte [] aMICBytes = Base64.safeDecode (sMICBytes); if (aMICBytes == null) throw new Illegal... | MIC implements Serializable { @Nullable public static MIC parse (@Nullable final String sMIC) { if (StringHelper.hasNoText (sMIC)) return null; final StringTokenizer st = new StringTokenizer (sMIC, ", \t\r\n"); final String sMICBytes = st.nextToken (); final byte [] aMICBytes = Base64.safeDecode (sMICBytes); if (aMICBy... | MIC implements Serializable { @Nullable public static MIC parse (@Nullable final String sMIC) { if (StringHelper.hasNoText (sMIC)) return null; final StringTokenizer st = new StringTokenizer (sMIC, ", \t\r\n"); final String sMICBytes = st.nextToken (); final byte [] aMICBytes = Base64.safeDecode (sMICBytes); if (aMICBy... | MIC implements Serializable { @Nullable public static MIC parse (@Nullable final String sMIC) { if (StringHelper.hasNoText (sMIC)) return null; final StringTokenizer st = new StringTokenizer (sMIC, ", \t\r\n"); final String sMICBytes = st.nextToken (); final byte [] aMICBytes = Base64.safeDecode (sMICBytes); if (aMICBy... | MIC implements Serializable { @Nullable public static MIC parse (@Nullable final String sMIC) { if (StringHelper.hasNoText (sMIC)) return null; final StringTokenizer st = new StringTokenizer (sMIC, ", \t\r\n"); final String sMICBytes = st.nextToken (); final byte [] aMICBytes = Base64.safeDecode (sMICBytes); if (aMICBy... |
@Test (expected = EOFException.class) public void testReadChunkLenEOS () throws Exception { final InputStream noNewLine = new StringInputStream ("1", StandardCharsets.UTF_8); HTTPHelper.readChunkLen (noNewLine); fail ("An EOFException should have been thrown"); } | public static int readChunkLen (@Nonnull @WillNotClose final InputStream aIS) throws IOException { int nRes = 0; boolean bHeadersStarted = false; for (;;) { int ch = aIS.read (); if (ch < 0) throw new EOFException (); if (ch == '\n') break; if (ch >= 'a' && ch <= 'f') ch -= ('a' - 10); else if (ch >= 'A' && ch <= 'F') ... | HTTPHelper { public static int readChunkLen (@Nonnull @WillNotClose final InputStream aIS) throws IOException { int nRes = 0; boolean bHeadersStarted = false; for (;;) { int ch = aIS.read (); if (ch < 0) throw new EOFException (); if (ch == '\n') break; if (ch >= 'a' && ch <= 'f') ch -= ('a' - 10); else if (ch >= 'A' &... | HTTPHelper { public static int readChunkLen (@Nonnull @WillNotClose final InputStream aIS) throws IOException { int nRes = 0; boolean bHeadersStarted = false; for (;;) { int ch = aIS.read (); if (ch < 0) throw new EOFException (); if (ch == '\n') break; if (ch >= 'a' && ch <= 'f') ch -= ('a' - 10); else if (ch >= 'A' &... | HTTPHelper { public static int readChunkLen (@Nonnull @WillNotClose final InputStream aIS) throws IOException { int nRes = 0; boolean bHeadersStarted = false; for (;;) { int ch = aIS.read (); if (ch < 0) throw new EOFException (); if (ch == '\n') break; if (ch >= 'a' && ch <= 'f') ch -= ('a' - 10); else if (ch >= 'A' &... | HTTPHelper { public static int readChunkLen (@Nonnull @WillNotClose final InputStream aIS) throws IOException { int nRes = 0; boolean bHeadersStarted = false; for (;;) { int ch = aIS.read (); if (ch < 0) throw new EOFException (); if (ch == '\n') break; if (ch >= 'a' && ch <= 'f') ch -= ('a' - 10); else if (ch >= 'A' &... |
@Test public void testReadChunkLenWithHeader () throws Exception { final NonBlockingByteArrayInputStream noNewLine = new NonBlockingByteArrayInputStream ("1A;name=value\r\n".getBytes (StandardCharsets.UTF_8)); final int res = HTTPHelper.readChunkLen (noNewLine); assertEquals ("Chunk size with header", 26, res); } | public static int readChunkLen (@Nonnull @WillNotClose final InputStream aIS) throws IOException { int nRes = 0; boolean bHeadersStarted = false; for (;;) { int ch = aIS.read (); if (ch < 0) throw new EOFException (); if (ch == '\n') break; if (ch >= 'a' && ch <= 'f') ch -= ('a' - 10); else if (ch >= 'A' && ch <= 'F') ... | HTTPHelper { public static int readChunkLen (@Nonnull @WillNotClose final InputStream aIS) throws IOException { int nRes = 0; boolean bHeadersStarted = false; for (;;) { int ch = aIS.read (); if (ch < 0) throw new EOFException (); if (ch == '\n') break; if (ch >= 'a' && ch <= 'f') ch -= ('a' - 10); else if (ch >= 'A' &... | HTTPHelper { public static int readChunkLen (@Nonnull @WillNotClose final InputStream aIS) throws IOException { int nRes = 0; boolean bHeadersStarted = false; for (;;) { int ch = aIS.read (); if (ch < 0) throw new EOFException (); if (ch == '\n') break; if (ch >= 'a' && ch <= 'f') ch -= ('a' - 10); else if (ch >= 'A' &... | HTTPHelper { public static int readChunkLen (@Nonnull @WillNotClose final InputStream aIS) throws IOException { int nRes = 0; boolean bHeadersStarted = false; for (;;) { int ch = aIS.read (); if (ch < 0) throw new EOFException (); if (ch == '\n') break; if (ch >= 'a' && ch <= 'f') ch -= ('a' - 10); else if (ch >= 'A' &... | HTTPHelper { public static int readChunkLen (@Nonnull @WillNotClose final InputStream aIS) throws IOException { int nRes = 0; boolean bHeadersStarted = false; for (;;) { int ch = aIS.read (); if (ch < 0) throw new EOFException (); if (ch == '\n') break; if (ch >= 'a' && ch <= 'f') ch -= ('a' - 10); else if (ch >= 'A' &... |
@Test public void testReadChunkLenNoHeader () throws Exception { final NonBlockingByteArrayInputStream noNewLine = new NonBlockingByteArrayInputStream ("1f\n".getBytes (StandardCharsets.UTF_8)); final int res = HTTPHelper.readChunkLen (noNewLine); assertEquals ("Chunk size with header", 31, res); } | public static int readChunkLen (@Nonnull @WillNotClose final InputStream aIS) throws IOException { int nRes = 0; boolean bHeadersStarted = false; for (;;) { int ch = aIS.read (); if (ch < 0) throw new EOFException (); if (ch == '\n') break; if (ch >= 'a' && ch <= 'f') ch -= ('a' - 10); else if (ch >= 'A' && ch <= 'F') ... | HTTPHelper { public static int readChunkLen (@Nonnull @WillNotClose final InputStream aIS) throws IOException { int nRes = 0; boolean bHeadersStarted = false; for (;;) { int ch = aIS.read (); if (ch < 0) throw new EOFException (); if (ch == '\n') break; if (ch >= 'a' && ch <= 'f') ch -= ('a' - 10); else if (ch >= 'A' &... | HTTPHelper { public static int readChunkLen (@Nonnull @WillNotClose final InputStream aIS) throws IOException { int nRes = 0; boolean bHeadersStarted = false; for (;;) { int ch = aIS.read (); if (ch < 0) throw new EOFException (); if (ch == '\n') break; if (ch >= 'a' && ch <= 'f') ch -= ('a' - 10); else if (ch >= 'A' &... | HTTPHelper { public static int readChunkLen (@Nonnull @WillNotClose final InputStream aIS) throws IOException { int nRes = 0; boolean bHeadersStarted = false; for (;;) { int ch = aIS.read (); if (ch < 0) throw new EOFException (); if (ch == '\n') break; if (ch >= 'a' && ch <= 'f') ch -= ('a' - 10); else if (ch >= 'A' &... | HTTPHelper { public static int readChunkLen (@Nonnull @WillNotClose final InputStream aIS) throws IOException { int nRes = 0; boolean bHeadersStarted = false; for (;;) { int ch = aIS.read (); if (ch < 0) throw new EOFException (); if (ch == '\n') break; if (ch >= 'a' && ch <= 'f') ch -= ('a' - 10); else if (ch >= 'A' &... |
@Test public void testReadChunkLenEmpty () throws Exception { final NonBlockingByteArrayInputStream noNewLine = new NonBlockingByteArrayInputStream ("\n".getBytes (StandardCharsets.UTF_8)); final int res = HTTPHelper.readChunkLen (noNewLine); assertEquals ("Chunk size with header", 0, res); } | public static int readChunkLen (@Nonnull @WillNotClose final InputStream aIS) throws IOException { int nRes = 0; boolean bHeadersStarted = false; for (;;) { int ch = aIS.read (); if (ch < 0) throw new EOFException (); if (ch == '\n') break; if (ch >= 'a' && ch <= 'f') ch -= ('a' - 10); else if (ch >= 'A' && ch <= 'F') ... | HTTPHelper { public static int readChunkLen (@Nonnull @WillNotClose final InputStream aIS) throws IOException { int nRes = 0; boolean bHeadersStarted = false; for (;;) { int ch = aIS.read (); if (ch < 0) throw new EOFException (); if (ch == '\n') break; if (ch >= 'a' && ch <= 'f') ch -= ('a' - 10); else if (ch >= 'A' &... | HTTPHelper { public static int readChunkLen (@Nonnull @WillNotClose final InputStream aIS) throws IOException { int nRes = 0; boolean bHeadersStarted = false; for (;;) { int ch = aIS.read (); if (ch < 0) throw new EOFException (); if (ch == '\n') break; if (ch >= 'a' && ch <= 'f') ch -= ('a' - 10); else if (ch >= 'A' &... | HTTPHelper { public static int readChunkLen (@Nonnull @WillNotClose final InputStream aIS) throws IOException { int nRes = 0; boolean bHeadersStarted = false; for (;;) { int ch = aIS.read (); if (ch < 0) throw new EOFException (); if (ch == '\n') break; if (ch >= 'a' && ch <= 'f') ch -= ('a' - 10); else if (ch >= 'A' &... | HTTPHelper { public static int readChunkLen (@Nonnull @WillNotClose final InputStream aIS) throws IOException { int nRes = 0; boolean bHeadersStarted = false; for (;;) { int ch = aIS.read (); if (ch < 0) throw new EOFException (); if (ch == '\n') break; if (ch >= 'a' && ch <= 'f') ch -= ('a' - 10); else if (ch >= 'A' &... |
@Test public void testReadHttpRequestRegularMessage () throws Exception { NonBlockingByteArrayInputStream is = new NonBlockingByteArrayInputStream (m_sRegularMessage.getBytes (StandardCharsets.UTF_8)); AS2Message aMsg = new AS2Message (); IAS2InputStreamProvider mockStreamProvider = new MockAS2InputStreamProvider (is);... | @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.getInputStream... | HTTPHelper { @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.g... | HTTPHelper { @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.g... | HTTPHelper { @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.g... | HTTPHelper { @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.g... |
@SuppressWarnings ("deprecation") @Test public void testSignWithAllAlgorithms () throws Exception { final MimeBodyPart aPart = new MimeBodyPart (); aPart.setText ("Hello world"); for (int nIncludeCert = 0; nIncludeCert < 2; ++nIncludeCert) for (final ECryptoAlgorithmSign eAlgo : ECryptoAlgorithmSign.values ()) if (eAlg... | @Nonnull public MimeBodyPart sign (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final PrivateKey aPrivateKey, @Nonnull final ECryptoAlgorithmSign eAlgorithm, final boolean bIncludeCertificateInSignedContent, final boolean bUseOldRFC3851MicAlgs, @Nonnull final EContentTransferEnc... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart sign (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final PrivateKey aPrivateKey, @Nonnull final ECryptoAlgorithmSign eAlgorithm, final boolean bIncludeCertificateInSignedContent, final boolean bUseOldRFC3851M... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart sign (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final PrivateKey aPrivateKey, @Nonnull final ECryptoAlgorithmSign eAlgorithm, final boolean bIncludeCertificateInSignedContent, final boolean bUseOldRFC3851M... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart sign (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final PrivateKey aPrivateKey, @Nonnull final ECryptoAlgorithmSign eAlgorithm, final boolean bIncludeCertificateInSignedContent, final boolean bUseOldRFC3851M... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart sign (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final PrivateKey aPrivateKey, @Nonnull final ECryptoAlgorithmSign eAlgorithm, final boolean bIncludeCertificateInSignedContent, final boolean bUseOldRFC3851M... |
@Test public void testReadHttpRequestStreamMessage () throws Exception { NonBlockingByteArrayInputStream is = new NonBlockingByteArrayInputStream (m_sChunkedMessage.getBytes (StandardCharsets.UTF_8)); AS2Message aMsg = new AS2Message (); IAS2InputStreamProvider mockStreamProvider = new MockAS2InputStreamProvider (is); ... | @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.getInputStream... | HTTPHelper { @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.g... | HTTPHelper { @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.g... | HTTPHelper { @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.g... | HTTPHelper { @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.g... |
@Test (expected = IOException.class) public void testNoLengthMessageRegular () throws Exception { final NonBlockingByteArrayInputStream is = new NonBlockingByteArrayInputStream (m_sNoLengthMessage.getBytes (StandardCharsets.UTF_8)); final AS2Message aMsg = new AS2Message (); final IAS2InputStreamProvider mockStreamProv... | @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.getInputStream... | HTTPHelper { @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.g... | HTTPHelper { @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.g... | HTTPHelper { @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.g... | HTTPHelper { @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.g... |
@Test (expected = IOException.class) public void testNoLengthMessageStream () throws Exception { final NonBlockingByteArrayInputStream is = new NonBlockingByteArrayInputStream (m_sNoLengthMessage.getBytes (StandardCharsets.UTF_8)); final AS2Message aMsg = new AS2Message (); final IAS2InputStreamProvider mockStreamProvi... | @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.getInputStream... | HTTPHelper { @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.g... | HTTPHelper { @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.g... | HTTPHelper { @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.g... | HTTPHelper { @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.g... |
@Test (expected = IOException.class) public void testBadTRansferEncodingMessageRegular () throws Exception { final NonBlockingByteArrayInputStream is = new NonBlockingByteArrayInputStream (m_sBadTransferEncodingMessage.getBytes (StandardCharsets.UTF_8)); final AS2Message aMsg = new AS2Message (); final IAS2InputStreamP... | @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.getInputStream... | HTTPHelper { @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.g... | HTTPHelper { @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.g... | HTTPHelper { @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.g... | HTTPHelper { @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.g... |
@Test (expected = IOException.class) public void testBadTRansferEncodingMessageStream () throws Exception { final NonBlockingByteArrayInputStream is = new NonBlockingByteArrayInputStream (m_sBadTransferEncodingMessage.getBytes (StandardCharsets.UTF_8)); final AS2Message aMsg = new AS2Message (); final IAS2InputStreamPr... | @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.getInputStream... | HTTPHelper { @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.g... | HTTPHelper { @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.g... | HTTPHelper { @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.g... | HTTPHelper { @Nonnull public static DataSource readHttpRequest (@Nonnull final IAS2InputStreamProvider aISP, @Nonnull final IAS2HttpResponseHandler aResponseHandler, @Nonnull final IMessage aMsg, @Nullable final IHTTPIncomingDumper aIncomingDumper) throws IOException, MessagingException { final InputStream aIS = aISP.g... |
@Test (expected = EOFException.class) @SuppressFBWarnings ("RR_NOT_CHECKED") public void readBufferFromEmpty () throws Exception { final InputStream empty = new NonBlockingByteArrayInputStream ("".getBytes ()); final byte [] buf = new byte [17]; try (final ChunkedInputStream cIS = new ChunkedInputStream (empty)) { cIS.... | @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Read chunk size: " + m_nLeft... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... |
@Test public void readPastEOS () throws Exception { try (final InputStream empty = new NonBlockingByteArrayInputStream ("3\n123\r\n0\r\n".getBytes ()); final ChunkedInputStream cIS = new ChunkedInputStream (empty)) { final byte [] buf = new byte [17]; int ret = cIS.read (buf, 0, buf.length); assertEquals ("read correct... | @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Read chunk size: " + m_nLeft... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... |
@Test (expected = EOFException.class) public void readByteFromEmpty () throws Exception { try (final InputStream empty = new NonBlockingByteArrayInputStream (ArrayHelper.EMPTY_BYTE_ARRAY); final ChunkedInputStream cIS = new ChunkedInputStream (empty)) { cIS.read (); fail ("An EOFException should have been thrown"); } } | @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Read chunk size: " + m_nLeft... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... |
@Test public void readOneChunkBuffer () throws Exception { try (final InputStream empty = new NonBlockingByteArrayInputStream ("3\n123".getBytes ()); final ChunkedInputStream cIS = new ChunkedInputStream (empty)) { final byte [] buf = new byte [3]; final int ret = cIS.read (buf, 0, buf.length); assertEquals ("Read one ... | @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Read chunk size: " + m_nLeft... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... |
@Test public void readOneChunkBytes () throws Exception { try (final InputStream empty = new NonBlockingByteArrayInputStream ("3\n123".getBytes ()); final ChunkedInputStream cIS = new ChunkedInputStream (empty)) { int ret = cIS.read (); assertEquals ("Read first char", '1', ret); ret = cIS.read (); assertEquals ("Read ... | @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Read chunk size: " + m_nLeft... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... |
@Test public void testSignWithAllCTEs () throws Exception { final MimeBodyPart aPart = new MimeBodyPart (); aPart.setText ("Hello world"); for (final EContentTransferEncoding eCTE : EContentTransferEncoding.values ()) { final MimeBodyPart aSigned = AS2Helper.getCryptoHelper () .sign (aPart, (X509Certificate) PKE.getCer... | @Nonnull public MimeBodyPart sign (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final PrivateKey aPrivateKey, @Nonnull final ECryptoAlgorithmSign eAlgorithm, final boolean bIncludeCertificateInSignedContent, final boolean bUseOldRFC3851MicAlgs, @Nonnull final EContentTransferEnc... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart sign (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final PrivateKey aPrivateKey, @Nonnull final ECryptoAlgorithmSign eAlgorithm, final boolean bIncludeCertificateInSignedContent, final boolean bUseOldRFC3851M... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart sign (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final PrivateKey aPrivateKey, @Nonnull final ECryptoAlgorithmSign eAlgorithm, final boolean bIncludeCertificateInSignedContent, final boolean bUseOldRFC3851M... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart sign (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final PrivateKey aPrivateKey, @Nonnull final ECryptoAlgorithmSign eAlgorithm, final boolean bIncludeCertificateInSignedContent, final boolean bUseOldRFC3851M... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart sign (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final PrivateKey aPrivateKey, @Nonnull final ECryptoAlgorithmSign eAlgorithm, final boolean bIncludeCertificateInSignedContent, final boolean bUseOldRFC3851M... |
@Test public void readTwoChunkBuffer () throws Exception { try (final InputStream empty = new NonBlockingByteArrayInputStream ("2\r\n12\r\n1\na\r\n0\r\n".getBytes ()); final ChunkedInputStream cIS = new ChunkedInputStream (empty)) { final byte [] buf = new byte [3]; final int ret = cIS.read (buf, 0, buf.length); assert... | @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Read chunk size: " + m_nLeft... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... |
@Test public void readTwoChunkBufferMultipleReads () throws Exception { try (final InputStream empty = new NonBlockingByteArrayInputStream ("2\r\n12\r\n1\na\r\n0\r\n".getBytes ()); final ChunkedInputStream cIS = new ChunkedInputStream (empty)) { final byte [] buf = new byte [3]; int ret = cIS.read (buf, 0, 1); assertEq... | @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Read chunk size: " + m_nLeft... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... |
@Test public void readTwoChunkByteMultipleReads () throws Exception { try (final InputStream empty = new NonBlockingByteArrayInputStream ("2\r\n12\r\n1\na\r\n0\r\n".getBytes ()); final ChunkedInputStream cIS = new ChunkedInputStream (empty)) { int ret = cIS.read (); assertEquals ("Read one Chunk-1: correct data returne... | @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Read chunk size: " + m_nLeft... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... | ChunkedInputStream extends FilterInputStream { @Override public final int read () throws IOException { if (m_nLeft < 0) return -1; if (m_nLeft == 0) { if (m_bAfterFirstChunk) { HTTPHelper.readTillNexLine (m_aIS); } else { m_bAfterFirstChunk = true; } m_nLeft = HTTPHelper.readChunkLen (m_aIS); if (LOGGER.isDebugEnabled ... |
@Test public void testGetTempSharedFileInputStream () throws Exception { final String inData = "123456"; try (final InputStream is = new NonBlockingByteArrayInputStream (inData.getBytes ()); final SharedFileInputStream sis = TempSharedFileInputStream.getTempSharedFileInputStream (is, "myName"); final NonBlockingByteArr... | @Nonnull public static TempSharedFileInputStream getTempSharedFileInputStream (@Nonnull @WillClose final InputStream aIS, @Nonnull final String sName) throws IOException { final File aDest = storeContentToTempFile (aIS, sName); return new TempSharedFileInputStream (aDest); } | TempSharedFileInputStream extends SharedFileInputStream { @Nonnull public static TempSharedFileInputStream getTempSharedFileInputStream (@Nonnull @WillClose final InputStream aIS, @Nonnull final String sName) throws IOException { final File aDest = storeContentToTempFile (aIS, sName); return new TempSharedFileInputStre... | TempSharedFileInputStream extends SharedFileInputStream { @Nonnull public static TempSharedFileInputStream getTempSharedFileInputStream (@Nonnull @WillClose final InputStream aIS, @Nonnull final String sName) throws IOException { final File aDest = storeContentToTempFile (aIS, sName); return new TempSharedFileInputStre... | TempSharedFileInputStream extends SharedFileInputStream { @Nonnull public static TempSharedFileInputStream getTempSharedFileInputStream (@Nonnull @WillClose final InputStream aIS, @Nonnull final String sName) throws IOException { final File aDest = storeContentToTempFile (aIS, sName); return new TempSharedFileInputStre... | TempSharedFileInputStream extends SharedFileInputStream { @Nonnull public static TempSharedFileInputStream getTempSharedFileInputStream (@Nonnull @WillClose final InputStream aIS, @Nonnull final String sName) throws IOException { final File aDest = storeContentToTempFile (aIS, sName); return new TempSharedFileInputStre... |
@Test public void testStoreContentToTempFile () throws Exception { final String inData = "123456"; final String name = "xxy"; try (final InputStream is = new NonBlockingByteArrayInputStream (inData.getBytes (StandardCharsets.ISO_8859_1))) { final File file = TempSharedFileInputStream.storeContentToTempFile (is, name); ... | @Nonnull protected static File storeContentToTempFile (@Nonnull @WillClose final InputStream aIS, @Nonnull final String sName) throws IOException { final String sSuffix = FilenameHelper.getAsSecureValidASCIIFilename (StringHelper.hasText (sName) ? sName : "tmp"); final File aDestFile = File.createTempFile ("AS2TempShar... | TempSharedFileInputStream extends SharedFileInputStream { @Nonnull protected static File storeContentToTempFile (@Nonnull @WillClose final InputStream aIS, @Nonnull final String sName) throws IOException { final String sSuffix = FilenameHelper.getAsSecureValidASCIIFilename (StringHelper.hasText (sName) ? sName : "tmp")... | TempSharedFileInputStream extends SharedFileInputStream { @Nonnull protected static File storeContentToTempFile (@Nonnull @WillClose final InputStream aIS, @Nonnull final String sName) throws IOException { final String sSuffix = FilenameHelper.getAsSecureValidASCIIFilename (StringHelper.hasText (sName) ? sName : "tmp")... | TempSharedFileInputStream extends SharedFileInputStream { @Nonnull protected static File storeContentToTempFile (@Nonnull @WillClose final InputStream aIS, @Nonnull final String sName) throws IOException { final String sSuffix = FilenameHelper.getAsSecureValidASCIIFilename (StringHelper.hasText (sName) ? sName : "tmp")... | TempSharedFileInputStream extends SharedFileInputStream { @Nonnull protected static File storeContentToTempFile (@Nonnull @WillClose final InputStream aIS, @Nonnull final String sName) throws IOException { final String sSuffix = FilenameHelper.getAsSecureValidASCIIFilename (StringHelper.hasText (sName) ? sName : "tmp")... |
@Test public void testFinalize () throws Exception { for (int i = 0; i < 10000; i++) { final String sSrcData = "123456"; try (final InputStream is = new NonBlockingByteArrayInputStream (sSrcData.getBytes (StandardCharsets.ISO_8859_1)); final TempSharedFileInputStream aSharedIS = TempSharedFileInputStream.getTempSharedF... | @Override protected void finalize () throws Throwable { try { closeAll (); } catch (final Exception ex) { LOGGER.error ("Exception in finalize()", ex); } super.finalize (); } | TempSharedFileInputStream extends SharedFileInputStream { @Override protected void finalize () throws Throwable { try { closeAll (); } catch (final Exception ex) { LOGGER.error ("Exception in finalize()", ex); } super.finalize (); } } | TempSharedFileInputStream extends SharedFileInputStream { @Override protected void finalize () throws Throwable { try { closeAll (); } catch (final Exception ex) { LOGGER.error ("Exception in finalize()", ex); } super.finalize (); } private TempSharedFileInputStream(@Nonnull final File aFile); } | TempSharedFileInputStream extends SharedFileInputStream { @Override protected void finalize () throws Throwable { try { closeAll (); } catch (final Exception ex) { LOGGER.error ("Exception in finalize()", ex); } super.finalize (); } private TempSharedFileInputStream(@Nonnull final File aFile); @Override void close(); ... | TempSharedFileInputStream extends SharedFileInputStream { @Override protected void finalize () throws Throwable { try { closeAll (); } catch (final Exception ex) { LOGGER.error ("Exception in finalize()", ex); } super.finalize (); } private TempSharedFileInputStream(@Nonnull final File aFile); @Override void close(); ... |
@Test public void testGetFilenameFromMessageID () { assertNull (AS2IOHelper.getFilenameFromMessageID ("")); assertNull (AS2IOHelper.getFilenameFromMessageID ("<<<<>>>>")); assertEquals ("a", AS2IOHelper.getFilenameFromMessageID ("a")); assertEquals ("a", AS2IOHelper.getFilenameFromMessageID ("<a>")); assertEquals ("a",... | @Nullable public static String getFilenameFromMessageID (@Nonnull final String sMessageID) { String s = StringHelper.removeAll (sMessageID, '<'); s = StringHelper.removeAll (s, '>'); return FilenameHelper.getAsSecureValidASCIIFilename (s); } | AS2IOHelper { @Nullable public static String getFilenameFromMessageID (@Nonnull final String sMessageID) { String s = StringHelper.removeAll (sMessageID, '<'); s = StringHelper.removeAll (s, '>'); return FilenameHelper.getAsSecureValidASCIIFilename (s); } } | AS2IOHelper { @Nullable public static String getFilenameFromMessageID (@Nonnull final String sMessageID) { String s = StringHelper.removeAll (sMessageID, '<'); s = StringHelper.removeAll (s, '>'); return FilenameHelper.getAsSecureValidASCIIFilename (s); } private AS2IOHelper(); } | AS2IOHelper { @Nullable public static String getFilenameFromMessageID (@Nonnull final String sMessageID) { String s = StringHelper.removeAll (sMessageID, '<'); s = StringHelper.removeAll (s, '>'); return FilenameHelper.getAsSecureValidASCIIFilename (s); } private AS2IOHelper(); @Nonnull static FileOperationManager get... | AS2IOHelper { @Nullable public static String getFilenameFromMessageID (@Nonnull final String sMessageID) { String s = StringHelper.removeAll (sMessageID, '<'); s = StringHelper.removeAll (s, '>'); return FilenameHelper.getAsSecureValidASCIIFilename (s); } private AS2IOHelper(); @Nonnull static FileOperationManager get... |
@Test public void testgetSafeFileAndFolderName () { assertNull (AS2IOHelper.getSafeFileAndFolderName (null)); assertEquals ("", AS2IOHelper.getSafeFileAndFolderName ("")); assertEquals ("abc", AS2IOHelper.getSafeFileAndFolderName ("abc")); assertEquals ("abc/def", AS2IOHelper.getSafeFileAndFolderName ("abc/def")); asse... | @Nullable public static String getSafeFileAndFolderName (@Nullable final String s) { if (StringHelper.hasNoText (s)) return s; final File aBase = new File (FilenameHelper.getPathUsingUnixSeparator (s)); final StringBuilder aSB = new StringBuilder (); File f = aBase; while (f != null) { final String sName = f.getName ()... | AS2IOHelper { @Nullable public static String getSafeFileAndFolderName (@Nullable final String s) { if (StringHelper.hasNoText (s)) return s; final File aBase = new File (FilenameHelper.getPathUsingUnixSeparator (s)); final StringBuilder aSB = new StringBuilder (); File f = aBase; while (f != null) { final String sName ... | AS2IOHelper { @Nullable public static String getSafeFileAndFolderName (@Nullable final String s) { if (StringHelper.hasNoText (s)) return s; final File aBase = new File (FilenameHelper.getPathUsingUnixSeparator (s)); final StringBuilder aSB = new StringBuilder (); File f = aBase; while (f != null) { final String sName ... | AS2IOHelper { @Nullable public static String getSafeFileAndFolderName (@Nullable final String s) { if (StringHelper.hasNoText (s)) return s; final File aBase = new File (FilenameHelper.getPathUsingUnixSeparator (s)); final StringBuilder aSB = new StringBuilder (); File f = aBase; while (f != null) { final String sName ... | AS2IOHelper { @Nullable public static String getSafeFileAndFolderName (@Nullable final String s) { if (StringHelper.hasNoText (s)) return s; final File aBase = new File (FilenameHelper.getPathUsingUnixSeparator (s)); final StringBuilder aSB = new StringBuilder (); File f = aBase; while (f != null) { final String sName ... |
@Test public void testParseContentType () { assertNull (AS2HttpHelper.parseContentType (null)); assertNull (AS2HttpHelper.parseContentType ("")); assertNull (AS2HttpHelper.parseContentType (" ")); assertNull (AS2HttpHelper.parseContentType ("abc")); assertNull (AS2HttpHelper.parseContentType ("abc/")); assertNotNull (A... | @Nullable public static ContentType parseContentType (@Nullable final String sContentType) { if (StringHelper.hasText (sContentType)) { final String sRealContentType = RFC2616Codec.isMaybeEncoded (sContentType) ? new RFC2616Codec ().getDecodedAsString (sContentType) : sContentType; try { return new ContentType (sRealCo... | AS2HttpHelper { @Nullable public static ContentType parseContentType (@Nullable final String sContentType) { if (StringHelper.hasText (sContentType)) { final String sRealContentType = RFC2616Codec.isMaybeEncoded (sContentType) ? new RFC2616Codec ().getDecodedAsString (sContentType) : sContentType; try { return new Cont... | AS2HttpHelper { @Nullable public static ContentType parseContentType (@Nullable final String sContentType) { if (StringHelper.hasText (sContentType)) { final String sRealContentType = RFC2616Codec.isMaybeEncoded (sContentType) ? new RFC2616Codec ().getDecodedAsString (sContentType) : sContentType; try { return new Cont... | AS2HttpHelper { @Nullable public static ContentType parseContentType (@Nullable final String sContentType) { if (StringHelper.hasText (sContentType)) { final String sRealContentType = RFC2616Codec.isMaybeEncoded (sContentType) ? new RFC2616Codec ().getDecodedAsString (sContentType) : sContentType; try { return new Cont... | AS2HttpHelper { @Nullable public static ContentType parseContentType (@Nullable final String sContentType) { if (StringHelper.hasText (sContentType)) { final String sRealContentType = RFC2616Codec.isMaybeEncoded (sContentType) ? new RFC2616Codec ().getDecodedAsString (sContentType) : sContentType; try { return new Cont... |
@Test public void testGetCleanContentType () { assertNull (AS2HttpHelper.getCleanContentType (null)); assertNull (AS2HttpHelper.getCleanContentType ("")); assertNull (AS2HttpHelper.getCleanContentType (" ")); assertNull (AS2HttpHelper.getCleanContentType ("abc")); assertNull (AS2HttpHelper.getCleanContentType ("abc/"))... | @Nullable public static String getCleanContentType (@Nullable final String sContentType) { final ContentType aCT = parseContentType (sContentType); return aCT != null ? aCT.toString () : null; } | AS2HttpHelper { @Nullable public static String getCleanContentType (@Nullable final String sContentType) { final ContentType aCT = parseContentType (sContentType); return aCT != null ? aCT.toString () : null; } } | AS2HttpHelper { @Nullable public static String getCleanContentType (@Nullable final String sContentType) { final ContentType aCT = parseContentType (sContentType); return aCT != null ? aCT.toString () : null; } private AS2HttpHelper(); } | AS2HttpHelper { @Nullable public static String getCleanContentType (@Nullable final String sContentType) { final ContentType aCT = parseContentType (sContentType); return aCT != null ? aCT.toString () : null; } private AS2HttpHelper(); @Nullable static ContentType parseContentType(@Nullable final String sContentType);... | AS2HttpHelper { @Nullable public static String getCleanContentType (@Nullable final String sContentType) { final ContentType aCT = parseContentType (sContentType); return aCT != null ? aCT.toString () : null; } private AS2HttpHelper(); @Nullable static ContentType parseContentType(@Nullable final String sContentType);... |
@Test public void testSign_Base64 () throws Exception { final MimeBodyPart aPart = new MimeBodyPart (); aPart.setText ("Hello world", StandardCharsets.ISO_8859_1.name ()); final MimeBodyPart aSigned = AS2Helper.getCryptoHelper () .sign (aPart, (X509Certificate) PKE.getCertificate (), PKE.getPrivateKey (), ECryptoAlgori... | @Nonnull public MimeBodyPart sign (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final PrivateKey aPrivateKey, @Nonnull final ECryptoAlgorithmSign eAlgorithm, final boolean bIncludeCertificateInSignedContent, final boolean bUseOldRFC3851MicAlgs, @Nonnull final EContentTransferEnc... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart sign (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final PrivateKey aPrivateKey, @Nonnull final ECryptoAlgorithmSign eAlgorithm, final boolean bIncludeCertificateInSignedContent, final boolean bUseOldRFC3851M... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart sign (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final PrivateKey aPrivateKey, @Nonnull final ECryptoAlgorithmSign eAlgorithm, final boolean bIncludeCertificateInSignedContent, final boolean bUseOldRFC3851M... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart sign (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final PrivateKey aPrivateKey, @Nonnull final ECryptoAlgorithmSign eAlgorithm, final boolean bIncludeCertificateInSignedContent, final boolean bUseOldRFC3851M... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart sign (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final PrivateKey aPrivateKey, @Nonnull final ECryptoAlgorithmSign eAlgorithm, final boolean bIncludeCertificateInSignedContent, final boolean bUseOldRFC3851M... |
@Test public void testBasic () throws AS2InvalidParameterException { final AS2Message aMsg = new AS2Message (); aMsg.headers ().addHeader ("message-id", "12345"); aMsg.partnership ().setSenderAS2ID ("s1"); aMsg.partnership ().setReceiverAS2ID ("r1"); final ZonedDateTime aTestDT = PDTFactory.getCurrentZonedDateTime (); ... | @Nonnull public CompositeParameters add (final String sKey, final AbstractParameterParser aParam) { getParameterParsers ().put (sKey, aParam); return this; } | CompositeParameters extends AbstractParameterParser { @Nonnull public CompositeParameters add (final String sKey, final AbstractParameterParser aParam) { getParameterParsers ().put (sKey, aParam); return this; } } | CompositeParameters extends AbstractParameterParser { @Nonnull public CompositeParameters add (final String sKey, final AbstractParameterParser aParam) { getParameterParsers ().put (sKey, aParam); return this; } CompositeParameters(final boolean bIgnoreMissingParsers); CompositeParameters(final boolean bIgnoreMissingP... | CompositeParameters extends AbstractParameterParser { @Nonnull public CompositeParameters add (final String sKey, final AbstractParameterParser aParam) { getParameterParsers ().put (sKey, aParam); return this; } CompositeParameters(final boolean bIgnoreMissingParsers); CompositeParameters(final boolean bIgnoreMissingP... | CompositeParameters extends AbstractParameterParser { @Nonnull public CompositeParameters add (final String sKey, final AbstractParameterParser aParam) { getParameterParsers ().put (sKey, aParam); return this; } CompositeParameters(final boolean bIgnoreMissingParsers); CompositeParameters(final boolean bIgnoreMissingP... |
@Test public void testIgnore () throws AS2InvalidParameterException { final AS2Message aMsg = new AS2Message (); aMsg.headers ().addHeader ("message-id", "12345"); aMsg.partnership ().setSenderAS2ID ("s1"); aMsg.partnership ().setReceiverAS2ID ("r1"); final CompositeParameters aParams = new CompositeParameters (true).a... | @Nonnull public CompositeParameters add (final String sKey, final AbstractParameterParser aParam) { getParameterParsers ().put (sKey, aParam); return this; } | CompositeParameters extends AbstractParameterParser { @Nonnull public CompositeParameters add (final String sKey, final AbstractParameterParser aParam) { getParameterParsers ().put (sKey, aParam); return this; } } | CompositeParameters extends AbstractParameterParser { @Nonnull public CompositeParameters add (final String sKey, final AbstractParameterParser aParam) { getParameterParsers ().put (sKey, aParam); return this; } CompositeParameters(final boolean bIgnoreMissingParsers); CompositeParameters(final boolean bIgnoreMissingP... | CompositeParameters extends AbstractParameterParser { @Nonnull public CompositeParameters add (final String sKey, final AbstractParameterParser aParam) { getParameterParsers ().put (sKey, aParam); return this; } CompositeParameters(final boolean bIgnoreMissingParsers); CompositeParameters(final boolean bIgnoreMissingP... | CompositeParameters extends AbstractParameterParser { @Nonnull public CompositeParameters add (final String sKey, final AbstractParameterParser aParam) { getParameterParsers ().put (sKey, aParam); return this; } CompositeParameters(final boolean bIgnoreMissingParsers); CompositeParameters(final boolean bIgnoreMissingP... |
@Test public void testAddPartnership () throws AS2Exception { final Partnership partnership = new Partnership ("Test partnership"); assertTrue (mongoDBPartnershipFactory.addPartnership (partnership).isChanged ()); assertEquals (1, collection.countDocuments ()); assertNotNull (mongoDBPartnershipFactory.getPartnershipByN... | @Override public EChange addPartnership (final Partnership aPartnership) throws AS2Exception { m_aPartnerships.insertOne (_toDocument (aPartnership)); return EChange.CHANGED; } | MongoDBPartnershipFactory extends AbstractDynamicComponent implements IPartnershipFactory { @Override public EChange addPartnership (final Partnership aPartnership) throws AS2Exception { m_aPartnerships.insertOne (_toDocument (aPartnership)); return EChange.CHANGED; } } | MongoDBPartnershipFactory extends AbstractDynamicComponent implements IPartnershipFactory { @Override public EChange addPartnership (final Partnership aPartnership) throws AS2Exception { m_aPartnerships.insertOne (_toDocument (aPartnership)); return EChange.CHANGED; } MongoDBPartnershipFactory(final MongoCollection <Do... | MongoDBPartnershipFactory extends AbstractDynamicComponent implements IPartnershipFactory { @Override public EChange addPartnership (final Partnership aPartnership) throws AS2Exception { m_aPartnerships.insertOne (_toDocument (aPartnership)); return EChange.CHANGED; } MongoDBPartnershipFactory(final MongoCollection <Do... | MongoDBPartnershipFactory extends AbstractDynamicComponent implements IPartnershipFactory { @Override public EChange addPartnership (final Partnership aPartnership) throws AS2Exception { m_aPartnerships.insertOne (_toDocument (aPartnership)); return EChange.CHANGED; } MongoDBPartnershipFactory(final MongoCollection <Do... |
@Test public void testSign_Binary () throws Exception { final MimeBodyPart aPart = new MimeBodyPart (); aPart.setText ("Hello world", StandardCharsets.ISO_8859_1.name ()); final MimeBodyPart aSigned = AS2Helper.getCryptoHelper () .sign (aPart, (X509Certificate) PKE.getCertificate (), PKE.getPrivateKey (), ECryptoAlgori... | @Nonnull public MimeBodyPart sign (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final PrivateKey aPrivateKey, @Nonnull final ECryptoAlgorithmSign eAlgorithm, final boolean bIncludeCertificateInSignedContent, final boolean bUseOldRFC3851MicAlgs, @Nonnull final EContentTransferEnc... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart sign (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final PrivateKey aPrivateKey, @Nonnull final ECryptoAlgorithmSign eAlgorithm, final boolean bIncludeCertificateInSignedContent, final boolean bUseOldRFC3851M... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart sign (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final PrivateKey aPrivateKey, @Nonnull final ECryptoAlgorithmSign eAlgorithm, final boolean bIncludeCertificateInSignedContent, final boolean bUseOldRFC3851M... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart sign (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final PrivateKey aPrivateKey, @Nonnull final ECryptoAlgorithmSign eAlgorithm, final boolean bIncludeCertificateInSignedContent, final boolean bUseOldRFC3851M... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart sign (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final PrivateKey aPrivateKey, @Nonnull final ECryptoAlgorithmSign eAlgorithm, final boolean bIncludeCertificateInSignedContent, final boolean bUseOldRFC3851M... |
@Test public void testSign_QuotedPrintable () throws Exception { final MimeBodyPart aPart = new MimeBodyPart (); aPart.setText ("Hello world", StandardCharsets.ISO_8859_1.name ()); final MimeBodyPart aSigned = AS2Helper.getCryptoHelper () .sign (aPart, (X509Certificate) PKE.getCertificate (), PKE.getPrivateKey (), ECry... | @Nonnull public MimeBodyPart sign (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final PrivateKey aPrivateKey, @Nonnull final ECryptoAlgorithmSign eAlgorithm, final boolean bIncludeCertificateInSignedContent, final boolean bUseOldRFC3851MicAlgs, @Nonnull final EContentTransferEnc... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart sign (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final PrivateKey aPrivateKey, @Nonnull final ECryptoAlgorithmSign eAlgorithm, final boolean bIncludeCertificateInSignedContent, final boolean bUseOldRFC3851M... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart sign (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final PrivateKey aPrivateKey, @Nonnull final ECryptoAlgorithmSign eAlgorithm, final boolean bIncludeCertificateInSignedContent, final boolean bUseOldRFC3851M... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart sign (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final PrivateKey aPrivateKey, @Nonnull final ECryptoAlgorithmSign eAlgorithm, final boolean bIncludeCertificateInSignedContent, final boolean bUseOldRFC3851M... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart sign (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final PrivateKey aPrivateKey, @Nonnull final ECryptoAlgorithmSign eAlgorithm, final boolean bIncludeCertificateInSignedContent, final boolean bUseOldRFC3851M... |
@Test public void testEncryptWithAllAlgorithms () throws Exception { final MimeBodyPart aPart = new MimeBodyPart (); aPart.setText ("Hello world"); for (final ECryptoAlgorithmCrypt eAlgo : ECryptoAlgorithmCrypt.values ()) { final MimeBodyPart aEncrypted = AS2Helper.getCryptoHelper ().encrypt (aPart, CERT_ENCRYPT, eAlgo... | @Nonnull public MimeBodyPart encrypt (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final ECryptoAlgorithmCrypt eAlgorithm, @Nonnull final EContentTransferEncoding eCTE) throws GeneralSecurityException, SMIMEException, CMSException { ValueEnforcer.notNull (aPart, "MimeBodyPart");... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart encrypt (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final ECryptoAlgorithmCrypt eAlgorithm, @Nonnull final EContentTransferEncoding eCTE) throws GeneralSecurityException, SMIMEException, CMSException { Valu... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart encrypt (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final ECryptoAlgorithmCrypt eAlgorithm, @Nonnull final EContentTransferEncoding eCTE) throws GeneralSecurityException, SMIMEException, CMSException { Valu... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart encrypt (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final ECryptoAlgorithmCrypt eAlgorithm, @Nonnull final EContentTransferEncoding eCTE) throws GeneralSecurityException, SMIMEException, CMSException { Valu... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart encrypt (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final ECryptoAlgorithmCrypt eAlgorithm, @Nonnull final EContentTransferEncoding eCTE) throws GeneralSecurityException, SMIMEException, CMSException { Valu... |
@Test public void testEncryptWithAllCTEs () throws Exception { final MimeBodyPart aPart = new MimeBodyPart (); aPart.setText ("Hello world"); for (final EContentTransferEncoding eCTE : EContentTransferEncoding.values ()) { final MimeBodyPart aEncrypted = AS2Helper.getCryptoHelper () .encrypt (aPart, CERT_ENCRYPT, ECryp... | @Nonnull public MimeBodyPart encrypt (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final ECryptoAlgorithmCrypt eAlgorithm, @Nonnull final EContentTransferEncoding eCTE) throws GeneralSecurityException, SMIMEException, CMSException { ValueEnforcer.notNull (aPart, "MimeBodyPart");... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart encrypt (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final ECryptoAlgorithmCrypt eAlgorithm, @Nonnull final EContentTransferEncoding eCTE) throws GeneralSecurityException, SMIMEException, CMSException { Valu... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart encrypt (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final ECryptoAlgorithmCrypt eAlgorithm, @Nonnull final EContentTransferEncoding eCTE) throws GeneralSecurityException, SMIMEException, CMSException { Valu... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart encrypt (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final ECryptoAlgorithmCrypt eAlgorithm, @Nonnull final EContentTransferEncoding eCTE) throws GeneralSecurityException, SMIMEException, CMSException { Valu... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart encrypt (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final ECryptoAlgorithmCrypt eAlgorithm, @Nonnull final EContentTransferEncoding eCTE) throws GeneralSecurityException, SMIMEException, CMSException { Valu... |
@Test public void testEncryptCTE_Base64 () throws Exception { final MimeBodyPart aPart = new MimeBodyPart (); aPart.setText ("Hello world"); final MimeBodyPart aEncrypted = AS2Helper.getCryptoHelper () .encrypt (aPart, CERT_ENCRYPT, ECryptoAlgorithmCrypt.CRYPT_3DES, EContentTransferEncoding.BASE64); final NonBlockingBy... | @Nonnull public MimeBodyPart encrypt (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final ECryptoAlgorithmCrypt eAlgorithm, @Nonnull final EContentTransferEncoding eCTE) throws GeneralSecurityException, SMIMEException, CMSException { ValueEnforcer.notNull (aPart, "MimeBodyPart");... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart encrypt (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final ECryptoAlgorithmCrypt eAlgorithm, @Nonnull final EContentTransferEncoding eCTE) throws GeneralSecurityException, SMIMEException, CMSException { Valu... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart encrypt (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final ECryptoAlgorithmCrypt eAlgorithm, @Nonnull final EContentTransferEncoding eCTE) throws GeneralSecurityException, SMIMEException, CMSException { Valu... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart encrypt (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final ECryptoAlgorithmCrypt eAlgorithm, @Nonnull final EContentTransferEncoding eCTE) throws GeneralSecurityException, SMIMEException, CMSException { Valu... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart encrypt (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final ECryptoAlgorithmCrypt eAlgorithm, @Nonnull final EContentTransferEncoding eCTE) throws GeneralSecurityException, SMIMEException, CMSException { Valu... |
@Test public void testEncryptCTE_Binary () throws Exception { final MimeBodyPart aPart = new MimeBodyPart (); aPart.setText ("Hello world"); final MimeBodyPart aEncrypted = AS2Helper.getCryptoHelper () .encrypt (aPart, CERT_ENCRYPT, ECryptoAlgorithmCrypt.CRYPT_3DES, EContentTransferEncoding.BINARY); final NonBlockingBy... | @Nonnull public MimeBodyPart encrypt (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final ECryptoAlgorithmCrypt eAlgorithm, @Nonnull final EContentTransferEncoding eCTE) throws GeneralSecurityException, SMIMEException, CMSException { ValueEnforcer.notNull (aPart, "MimeBodyPart");... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart encrypt (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final ECryptoAlgorithmCrypt eAlgorithm, @Nonnull final EContentTransferEncoding eCTE) throws GeneralSecurityException, SMIMEException, CMSException { Valu... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart encrypt (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final ECryptoAlgorithmCrypt eAlgorithm, @Nonnull final EContentTransferEncoding eCTE) throws GeneralSecurityException, SMIMEException, CMSException { Valu... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart encrypt (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final ECryptoAlgorithmCrypt eAlgorithm, @Nonnull final EContentTransferEncoding eCTE) throws GeneralSecurityException, SMIMEException, CMSException { Valu... | BCCryptoHelper implements ICryptoHelper { @Nonnull public MimeBodyPart encrypt (@Nonnull final MimeBodyPart aPart, @Nonnull final X509Certificate aX509Cert, @Nonnull final ECryptoAlgorithmCrypt eAlgorithm, @Nonnull final EContentTransferEncoding eCTE) throws GeneralSecurityException, SMIMEException, CMSException { Valu... |
@Test public void testStatus() { final DiscreteAnnealSubclass anneal = new DiscreteAnnealSubclass(1000, 4000, 1); assertEquals("k=0,kMax=1000,t=0.0,prob=0.0", anneal.getStatus()); } | public String getStatus() { final StringBuilder result = new StringBuilder(); result.append("k="); result.append(this.k); result.append(",kMax="); result.append(this.kMax); result.append(",t="); result.append(this.currentTemperature); result.append(",prob="); result.append(this.lastProbability); return result.toString(... | DiscreteAnneal { public String getStatus() { final StringBuilder result = new StringBuilder(); result.append("k="); result.append(this.k); result.append(",kMax="); result.append(this.kMax); result.append(",t="); result.append(this.currentTemperature); result.append(",prob="); result.append(this.lastProbability); return... | DiscreteAnneal { public String getStatus() { final StringBuilder result = new StringBuilder(); result.append("k="); result.append(this.k); result.append(",kMax="); result.append(this.kMax); result.append(",t="); result.append(this.currentTemperature); result.append(",prob="); result.append(this.lastProbability); return... | DiscreteAnneal { public String getStatus() { final StringBuilder result = new StringBuilder(); result.append("k="); result.append(this.k); result.append(",kMax="); result.append(this.kMax); result.append(",t="); result.append(this.currentTemperature); result.append(",prob="); result.append(this.lastProbability); return... | DiscreteAnneal { public String getStatus() { final StringBuilder result = new StringBuilder(); result.append("k="); result.append(this.k); result.append(",kMax="); result.append(this.kMax); result.append(",t="); result.append(this.currentTemperature); result.append(",prob="); result.append(this.lastProbability); return... |
@Test(expected = AIFHError.class) public void testNoObservations() { final List<BasicData> list = new ArrayList<BasicData>(); final KMeans kmeans = new KMeans(3); kmeans.initForgy(list); } | public void initForgy(final List<BasicData> theObservations) { final int dimensions = findDimensions(theObservations); this.clusters.clear(); final Set<Integer> usedObservations = new HashSet<Integer>(); for (int i = 0; i < this.k; i++) { final Cluster cluster = new Cluster(dimensions); this.clusters.add(cluster); int ... | KMeans { public void initForgy(final List<BasicData> theObservations) { final int dimensions = findDimensions(theObservations); this.clusters.clear(); final Set<Integer> usedObservations = new HashSet<Integer>(); for (int i = 0; i < this.k; i++) { final Cluster cluster = new Cluster(dimensions); this.clusters.add(clust... | KMeans { public void initForgy(final List<BasicData> theObservations) { final int dimensions = findDimensions(theObservations); this.clusters.clear(); final Set<Integer> usedObservations = new HashSet<Integer>(); for (int i = 0; i < this.k; i++) { final Cluster cluster = new Cluster(dimensions); this.clusters.add(clust... | KMeans { public void initForgy(final List<BasicData> theObservations) { final int dimensions = findDimensions(theObservations); this.clusters.clear(); final Set<Integer> usedObservations = new HashSet<Integer>(); for (int i = 0; i < this.k; i++) { final Cluster cluster = new Cluster(dimensions); this.clusters.add(clust... | KMeans { public void initForgy(final List<BasicData> theObservations) { final int dimensions = findDimensions(theObservations); this.clusters.clear(); final Set<Integer> usedObservations = new HashSet<Integer>(); for (int i = 0; i < this.k; i++) { final Cluster cluster = new Cluster(dimensions); this.clusters.add(clust... |
@Test(expected = AIFHError.class) public void testNoDimension() { final List<BasicData> list = new ArrayList<BasicData>(); list.add(new BasicData(0)); final KMeans kmeans = new KMeans(3); kmeans.initForgy(list); } | public void initForgy(final List<BasicData> theObservations) { final int dimensions = findDimensions(theObservations); this.clusters.clear(); final Set<Integer> usedObservations = new HashSet<Integer>(); for (int i = 0; i < this.k; i++) { final Cluster cluster = new Cluster(dimensions); this.clusters.add(cluster); int ... | KMeans { public void initForgy(final List<BasicData> theObservations) { final int dimensions = findDimensions(theObservations); this.clusters.clear(); final Set<Integer> usedObservations = new HashSet<Integer>(); for (int i = 0; i < this.k; i++) { final Cluster cluster = new Cluster(dimensions); this.clusters.add(clust... | KMeans { public void initForgy(final List<BasicData> theObservations) { final int dimensions = findDimensions(theObservations); this.clusters.clear(); final Set<Integer> usedObservations = new HashSet<Integer>(); for (int i = 0; i < this.k; i++) { final Cluster cluster = new Cluster(dimensions); this.clusters.add(clust... | KMeans { public void initForgy(final List<BasicData> theObservations) { final int dimensions = findDimensions(theObservations); this.clusters.clear(); final Set<Integer> usedObservations = new HashSet<Integer>(); for (int i = 0; i < this.k; i++) { final Cluster cluster = new Cluster(dimensions); this.clusters.add(clust... | KMeans { public void initForgy(final List<BasicData> theObservations) { final int dimensions = findDimensions(theObservations); this.clusters.clear(); final Set<Integer> usedObservations = new HashSet<Integer>(); for (int i = 0; i < this.k; i++) { final Cluster cluster = new Cluster(dimensions); this.clusters.add(clust... |
@Test public void testToString() { final BasicData data = new BasicData(2); assertEquals("[BasicData: input:[0.0, 0.0], ideal:[], label:null]", data.toString()); } | public String toString() { final StringBuilder result = new StringBuilder(); result.append("[BasicData: input:"); result.append(Arrays.toString(this.input)); result.append(", ideal:"); result.append(Arrays.toString(this.ideal)); result.append(", label:"); result.append(this.label); result.append("]"); return result.toS... | BasicData { public String toString() { final StringBuilder result = new StringBuilder(); result.append("[BasicData: input:"); result.append(Arrays.toString(this.input)); result.append(", ideal:"); result.append(Arrays.toString(this.ideal)); result.append(", label:"); result.append(this.label); result.append("]"); retur... | BasicData { public String toString() { final StringBuilder result = new StringBuilder(); result.append("[BasicData: input:"); result.append(Arrays.toString(this.input)); result.append(", ideal:"); result.append(Arrays.toString(this.ideal)); result.append(", label:"); result.append(this.label); result.append("]"); retur... | BasicData { public String toString() { final StringBuilder result = new StringBuilder(); result.append("[BasicData: input:"); result.append(Arrays.toString(this.input)); result.append(", ideal:"); result.append(Arrays.toString(this.ideal)); result.append(", label:"); result.append(this.label); result.append("]"); retur... | BasicData { public String toString() { final StringBuilder result = new StringBuilder(); result.append("[BasicData: input:"); result.append(Arrays.toString(this.input)); result.append(", ideal:"); result.append(Arrays.toString(this.ideal)); result.append(", label:"); result.append(this.label); result.append("]"); retur... |
@Test public void testMaxIndex() { final double[] a = {2, 4, 10, 8}; assertEquals(2, VectorUtil.maxIndex(a), AIFH.DEFAULT_PRECISION); } | public static int maxIndex(final double[] a) { int result = -1; double max = Double.NEGATIVE_INFINITY; for (int i = 0; i < a.length; i++) { if (a[i] > max) { max = a[i]; result = i; } } return result; } | VectorUtil { public static int maxIndex(final double[] a) { int result = -1; double max = Double.NEGATIVE_INFINITY; for (int i = 0; i < a.length; i++) { if (a[i] > max) { max = a[i]; result = i; } } return result; } } | VectorUtil { public static int maxIndex(final double[] a) { int result = -1; double max = Double.NEGATIVE_INFINITY; for (int i = 0; i < a.length; i++) { if (a[i] > max) { max = a[i]; result = i; } } return result; } private VectorUtil(); } | VectorUtil { public static int maxIndex(final double[] a) { int result = -1; double max = Double.NEGATIVE_INFINITY; for (int i = 0; i < a.length; i++) { if (a[i] > max) { max = a[i]; result = i; } } return result; } private VectorUtil(); static int maxIndex(final double[] a); } | VectorUtil { public static int maxIndex(final double[] a) { int result = -1; double max = Double.NEGATIVE_INFINITY; for (int i = 0; i < a.length; i++) { if (a[i] > max) { max = a[i]; result = i; } } return result; } private VectorUtil(); static int maxIndex(final double[] a); } |
@Test public void testEvaluate() { final LogLinkFunction fn = new LogLinkFunction(); final double[] x = {2}; final double y = fn.evaluate(x); assertEquals(0.6931471805599453, y, AIFH.DEFAULT_PRECISION); } | @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The logistic link function can only accept one parameter."); } return Math.log(x[0]); } | LogLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The logistic link function can only accept one parameter."); } return Math.log(x[0]); } } | LogLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The logistic link function can only accept one parameter."); } return Math.log(x[0]); } } | LogLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The logistic link function can only accept one parameter."); } return Math.log(x[0]); } @Override double evaluate(final double[] x); } | LogLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The logistic link function can only accept one parameter."); } return Math.log(x[0]); } @Override double evaluate(final double[] x); } |
@Test(expected = AIFHError.class) public void testException() { final LogLinkFunction fn = new LogLinkFunction(); final double[] x = {1, 2}; fn.evaluate(x); } | @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The logistic link function can only accept one parameter."); } return Math.log(x[0]); } | LogLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The logistic link function can only accept one parameter."); } return Math.log(x[0]); } } | LogLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The logistic link function can only accept one parameter."); } return Math.log(x[0]); } } | LogLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The logistic link function can only accept one parameter."); } return Math.log(x[0]); } @Override double evaluate(final double[] x); } | LogLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The logistic link function can only accept one parameter."); } return Math.log(x[0]); } @Override double evaluate(final double[] x); } |
@Test public void testEvaluate() { final IdentityLinkFunction fn = new IdentityLinkFunction(); final double[] x = {2}; final double y = fn.evaluate(x); assertEquals(2, y, AIFH.DEFAULT_PRECISION); } | @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The linear link function can only accept one parameter."); } return x[0]; } | IdentityLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The linear link function can only accept one parameter."); } return x[0]; } } | IdentityLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The linear link function can only accept one parameter."); } return x[0]; } } | IdentityLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The linear link function can only accept one parameter."); } return x[0]; } @Override double evaluate(final double[] x); } | IdentityLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The linear link function can only accept one parameter."); } return x[0]; } @Override double evaluate(final double[] x); } |
@Test(expected = AIFHError.class) public void testException() { final IdentityLinkFunction fn = new IdentityLinkFunction(); final double[] x = {1, 2}; fn.evaluate(x); } | @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The linear link function can only accept one parameter."); } return x[0]; } | IdentityLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The linear link function can only accept one parameter."); } return x[0]; } } | IdentityLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The linear link function can only accept one parameter."); } return x[0]; } } | IdentityLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The linear link function can only accept one parameter."); } return x[0]; } @Override double evaluate(final double[] x); } | IdentityLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The linear link function can only accept one parameter."); } return x[0]; } @Override double evaluate(final double[] x); } |
@Test public void testEvaluate() { final InverseLinkFunction fn = new InverseLinkFunction(); final double[] x = {2}; final double y = fn.evaluate(x); assertEquals(-0.5, y, AIFH.DEFAULT_PRECISION); } | @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The inverse link function can only accept one parameter."); } return -Math.pow(x[0], -1); } | InverseLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The inverse link function can only accept one parameter."); } return -Math.pow(x[0], -1); } } | InverseLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The inverse link function can only accept one parameter."); } return -Math.pow(x[0], -1); } } | InverseLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The inverse link function can only accept one parameter."); } return -Math.pow(x[0], -1); } @Override double evaluate(final double[] x); } | InverseLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The inverse link function can only accept one parameter."); } return -Math.pow(x[0], -1); } @Override double evaluate(final double[] x); } |
@Test(expected = AIFHError.class) public void testException() { final InverseLinkFunction fn = new InverseLinkFunction(); final double[] x = {1, 2}; fn.evaluate(x); } | @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The inverse link function can only accept one parameter."); } return -Math.pow(x[0], -1); } | InverseLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The inverse link function can only accept one parameter."); } return -Math.pow(x[0], -1); } } | InverseLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The inverse link function can only accept one parameter."); } return -Math.pow(x[0], -1); } } | InverseLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The inverse link function can only accept one parameter."); } return -Math.pow(x[0], -1); } @Override double evaluate(final double[] x); } | InverseLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The inverse link function can only accept one parameter."); } return -Math.pow(x[0], -1); } @Override double evaluate(final double[] x); } |
@Test public void testCoolingSchedule() { final DiscreteAnnealSubclass anneal = new DiscreteAnnealSubclass(1000, 400, 1); assertEquals(400, anneal.coolingSchedule(), AIFH.DEFAULT_PRECISION); anneal.iteration(); assertEquals(397.61057939346017, anneal.coolingSchedule(), AIFH.DEFAULT_PRECISION); } | public double coolingSchedule() { final double ex = (double) k / (double) kMax; return this.startingTemperature * Math.pow(this.endingTemperature / this.startingTemperature, ex); } | DiscreteAnneal { public double coolingSchedule() { final double ex = (double) k / (double) kMax; return this.startingTemperature * Math.pow(this.endingTemperature / this.startingTemperature, ex); } } | DiscreteAnneal { public double coolingSchedule() { final double ex = (double) k / (double) kMax; return this.startingTemperature * Math.pow(this.endingTemperature / this.startingTemperature, ex); } DiscreteAnneal(final int theKMax, final double theStartingTemperature, final double theEndingTemperature); } | DiscreteAnneal { public double coolingSchedule() { final double ex = (double) k / (double) kMax; return this.startingTemperature * Math.pow(this.endingTemperature / this.startingTemperature, ex); } DiscreteAnneal(final int theKMax, final double theStartingTemperature, final double theEndingTemperature); double coolingS... | DiscreteAnneal { public double coolingSchedule() { final double ex = (double) k / (double) kMax; return this.startingTemperature * Math.pow(this.endingTemperature / this.startingTemperature, ex); } DiscreteAnneal(final int theKMax, final double theStartingTemperature, final double theEndingTemperature); double coolingS... |
@Test public void testEvaluate() { final LogitLinkFunction fn = new LogitLinkFunction(); final double[] x = {2}; final double y = fn.evaluate(x); assertEquals(0.8807970779778823, y, AIFH.DEFAULT_PRECISION); } | @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The logistic link function can only accept one parameter."); } return 1.0 / (1.0 + Math.exp(-x[0])); } | LogitLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The logistic link function can only accept one parameter."); } return 1.0 / (1.0 + Math.exp(-x[0])); } } | LogitLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The logistic link function can only accept one parameter."); } return 1.0 / (1.0 + Math.exp(-x[0])); } } | LogitLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The logistic link function can only accept one parameter."); } return 1.0 / (1.0 + Math.exp(-x[0])); } @Override double evaluate(final double[] x); } | LogitLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The logistic link function can only accept one parameter."); } return 1.0 / (1.0 + Math.exp(-x[0])); } @Override double evaluate(final double[] x); } |
@Test(expected = AIFHError.class) public void testException() { final LogitLinkFunction fn = new LogitLinkFunction(); final double[] x = {1, 2}; fn.evaluate(x); } | @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The logistic link function can only accept one parameter."); } return 1.0 / (1.0 + Math.exp(-x[0])); } | LogitLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The logistic link function can only accept one parameter."); } return 1.0 / (1.0 + Math.exp(-x[0])); } } | LogitLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The logistic link function can only accept one parameter."); } return 1.0 / (1.0 + Math.exp(-x[0])); } } | LogitLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The logistic link function can only accept one parameter."); } return 1.0 / (1.0 + Math.exp(-x[0])); } @Override double evaluate(final double[] x); } | LogitLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The logistic link function can only accept one parameter."); } return 1.0 / (1.0 + Math.exp(-x[0])); } @Override double evaluate(final double[] x); } |
@Test public void testEvaluate() { final InverseSquaredLinkFunction fn = new InverseSquaredLinkFunction(); final double[] x = {2}; final double y = fn.evaluate(x); assertEquals(-0.25, y, AIFH.DEFAULT_PRECISION); } | @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The inverse squared link function can only accept one parameter."); } return -Math.pow(x[0], -2); } | InverseSquaredLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The inverse squared link function can only accept one parameter."); } return -Math.pow(x[0], -2); } } | InverseSquaredLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The inverse squared link function can only accept one parameter."); } return -Math.pow(x[0], -2); } } | InverseSquaredLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The inverse squared link function can only accept one parameter."); } return -Math.pow(x[0], -2); } @Override double evaluate(final double[] x); } | InverseSquaredLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The inverse squared link function can only accept one parameter."); } return -Math.pow(x[0], -2); } @Override double evaluate(final double[] x); } |
@Test(expected = AIFHError.class) public void testException() { final InverseSquaredLinkFunction fn = new InverseSquaredLinkFunction(); final double[] x = {1, 2}; fn.evaluate(x); } | @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The inverse squared link function can only accept one parameter."); } return -Math.pow(x[0], -2); } | InverseSquaredLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The inverse squared link function can only accept one parameter."); } return -Math.pow(x[0], -2); } } | InverseSquaredLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The inverse squared link function can only accept one parameter."); } return -Math.pow(x[0], -2); } } | InverseSquaredLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The inverse squared link function can only accept one parameter."); } return -Math.pow(x[0], -2); } @Override double evaluate(final double[] x); } | InverseSquaredLinkFunction implements Fn { @Override public double evaluate(final double[] x) { if (x.length > 1) { throw new AIFHError("The inverse squared link function can only accept one parameter."); } return -Math.pow(x[0], -2); } @Override double evaluate(final double[] x); } |
@Test public void testEvaluate() { final double[] params = {5, 0, 0, 0}; final GaussianFunction funct = new GaussianFunction(3, params, 0); final double[] x = {-1, 0, 1}; final double y = funct.evaluate(x); assertEquals(0.9607894391523232, y, AIFH.DEFAULT_PRECISION); } | @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = this.getCenter(i); value += Math.pow(x[i] - center, 2) / (2.0 * width * width); } return Math.exp(-value); } | GaussianFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = this.getCenter(i); value += Math.pow(x[i] - center, 2) / (2.0 * width * width); } return Math.exp(-value); } } | GaussianFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = this.getCenter(i); value += Math.pow(x[i] - center, 2) / (2.0 * width * width); } return Math.exp(-value); } Ga... | GaussianFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = this.getCenter(i); value += Math.pow(x[i] - center, 2) / (2.0 * width * width); } return Math.exp(-value); } Ga... | GaussianFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = this.getCenter(i); value += Math.pow(x[i] - center, 2) / (2.0 * width * width); } return Math.exp(-value); } Ga... |
@Test public void testToString() { final double[] params = {5, 0, 0, 0}; final GaussianFunction funct = new GaussianFunction(3, params, 0); final double[] x = {-1, 0, 1}; funct.evaluate(x); assertEquals("[GaussianFunction:width=5.00,center=0.00,0.00,0.00]", funct.toString()); } | @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = this.getCenter(i); value += Math.pow(x[i] - center, 2) / (2.0 * width * width); } return Math.exp(-value); } | GaussianFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = this.getCenter(i); value += Math.pow(x[i] - center, 2) / (2.0 * width * width); } return Math.exp(-value); } } | GaussianFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = this.getCenter(i); value += Math.pow(x[i] - center, 2) / (2.0 * width * width); } return Math.exp(-value); } Ga... | GaussianFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = this.getCenter(i); value += Math.pow(x[i] - center, 2) / (2.0 * width * width); } return Math.exp(-value); } Ga... | GaussianFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = this.getCenter(i); value += Math.pow(x[i] - center, 2) / (2.0 * width * width); } return Math.exp(-value); } Ga... |
@Test public void testEvaluate() { final double[] params = {5, 0, 0, 0}; final MultiquadricFunction funct = new MultiquadricFunction(3, params, 0); final double[] x = {-1, 0, 1}; final double y = funct.evaluate(x); assertEquals(8.774964387392123, y, AIFH.DEFAULT_PRECISION); } | @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = getCenter(i); value += Math.pow(x[i] - center, 2) + (width * width); } return Math.sqrt(value); } | MultiquadricFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = getCenter(i); value += Math.pow(x[i] - center, 2) + (width * width); } return Math.sqrt(value); } } | MultiquadricFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = getCenter(i); value += Math.pow(x[i] - center, 2) + (width * width); } return Math.sqrt(value); } Multiquad... | MultiquadricFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = getCenter(i); value += Math.pow(x[i] - center, 2) + (width * width); } return Math.sqrt(value); } Multiquad... | MultiquadricFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = getCenter(i); value += Math.pow(x[i] - center, 2) + (width * width); } return Math.sqrt(value); } Multiquad... |
@Test public void testToString() { final double[] params = {5, 0, 0, 0}; final MultiquadricFunction funct = new MultiquadricFunction(3, params, 0); final double[] x = {-1, 0, 1}; funct.evaluate(x); assertEquals("[MultiquadricFunction:width=5.00,center=0.00,0.00,0.00]", funct.toString()); } | @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = getCenter(i); value += Math.pow(x[i] - center, 2) + (width * width); } return Math.sqrt(value); } | MultiquadricFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = getCenter(i); value += Math.pow(x[i] - center, 2) + (width * width); } return Math.sqrt(value); } } | MultiquadricFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = getCenter(i); value += Math.pow(x[i] - center, 2) + (width * width); } return Math.sqrt(value); } Multiquad... | MultiquadricFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = getCenter(i); value += Math.pow(x[i] - center, 2) + (width * width); } return Math.sqrt(value); } Multiquad... | MultiquadricFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = getCenter(i); value += Math.pow(x[i] - center, 2) + (width * width); } return Math.sqrt(value); } Multiquad... |
@Test public void testEvaluate() { final double[] params = {5, 0, 0, 0}; final InverseMultiquadricFunction funct = new InverseMultiquadricFunction(3, params, 0); final double[] x = {-1, 0, 1}; final double y = funct.evaluate(x); assertEquals(0.11396057645963795, y, AIFH.DEFAULT_PRECISION); } | @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = getCenter(i); value += Math.pow(x[i] - center, 2) + (width * width); } return 1 / Math.sqrt(value); } | InverseMultiquadricFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = getCenter(i); value += Math.pow(x[i] - center, 2) + (width * width); } return 1 / Math.sqrt(value); ... | InverseMultiquadricFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = getCenter(i); value += Math.pow(x[i] - center, 2) + (width * width); } return 1 / Math.sqrt(value); ... | InverseMultiquadricFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = getCenter(i); value += Math.pow(x[i] - center, 2) + (width * width); } return 1 / Math.sqrt(value); ... | InverseMultiquadricFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = getCenter(i); value += Math.pow(x[i] - center, 2) + (width * width); } return 1 / Math.sqrt(value); ... |
@Test public void testToString() { final double[] params = {5, 0, 0, 0}; final InverseMultiquadricFunction funct = new InverseMultiquadricFunction(3, params, 0); final double[] x = {-1, 0, 1}; funct.evaluate(x); assertEquals("[InverseMultiquadricFunction:width=5.00,center=0.00,0.00,0.00]", funct.toString()); } | @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = getCenter(i); value += Math.pow(x[i] - center, 2) + (width * width); } return 1 / Math.sqrt(value); } | InverseMultiquadricFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = getCenter(i); value += Math.pow(x[i] - center, 2) + (width * width); } return 1 / Math.sqrt(value); ... | InverseMultiquadricFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = getCenter(i); value += Math.pow(x[i] - center, 2) + (width * width); } return 1 / Math.sqrt(value); ... | InverseMultiquadricFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = getCenter(i); value += Math.pow(x[i] - center, 2) + (width * width); } return 1 / Math.sqrt(value); ... | InverseMultiquadricFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double value = 0; final double width = getWidth(); for (int i = 0; i < getDimensions(); i++) { final double center = getCenter(i); value += Math.pow(x[i] - center, 2) + (width * width); } return 1 / Math.sqrt(value); ... |
@Test public void testClassification() { final double[] ACTUAL = {0.0, 1.0, 0.0, 0.0}; final List<BasicData> training = BasicData.convertArrays(TEST_INPUT, TEST_IDEAL); final ScoreClassificationData score = new ScoreClassificationData(training); final SimpleAlgo simple = new SimpleAlgo(ACTUAL); final double s = score.c... | @Override public double calculateScore(final MachineLearningAlgorithm algo) { int incorrectCount = 0; int totalCount = 0; final ClassificationAlgorithm ralgo = (ClassificationAlgorithm) algo; for (final BasicData aTrainingData : this.trainingData) { totalCount++; final int output = ralgo.computeClassification(aTraining... | ScoreClassificationData implements ScoreFunction { @Override public double calculateScore(final MachineLearningAlgorithm algo) { int incorrectCount = 0; int totalCount = 0; final ClassificationAlgorithm ralgo = (ClassificationAlgorithm) algo; for (final BasicData aTrainingData : this.trainingData) { totalCount++; final... | ScoreClassificationData implements ScoreFunction { @Override public double calculateScore(final MachineLearningAlgorithm algo) { int incorrectCount = 0; int totalCount = 0; final ClassificationAlgorithm ralgo = (ClassificationAlgorithm) algo; for (final BasicData aTrainingData : this.trainingData) { totalCount++; final... | ScoreClassificationData implements ScoreFunction { @Override public double calculateScore(final MachineLearningAlgorithm algo) { int incorrectCount = 0; int totalCount = 0; final ClassificationAlgorithm ralgo = (ClassificationAlgorithm) algo; for (final BasicData aTrainingData : this.trainingData) { totalCount++; final... | ScoreClassificationData implements ScoreFunction { @Override public double calculateScore(final MachineLearningAlgorithm algo) { int incorrectCount = 0; int totalCount = 0; final ClassificationAlgorithm ralgo = (ClassificationAlgorithm) algo; for (final BasicData aTrainingData : this.trainingData) { totalCount++; final... |
@Test public void testEvaluate() { final double[] params = {5, 0, 0, 0}; final MexicanHatFunction funct = new MexicanHatFunction(3, params, 0); final double[] x = {-1, 0, 1}; final double y = funct.evaluate(x); assertEquals(-0.36787944117144233, y, AIFH.DEFAULT_PRECISION); } | @Override public double evaluate(final double[] x) { double norm = 0; for (int i = 0; i < getDimensions(); i++) { final double center = this.getCenter(i); norm += Math.pow(x[i] - center, 2); } return (1 - norm) * Math.exp(-norm / 2); } | MexicanHatFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double norm = 0; for (int i = 0; i < getDimensions(); i++) { final double center = this.getCenter(i); norm += Math.pow(x[i] - center, 2); } return (1 - norm) * Math.exp(-norm / 2); } } | MexicanHatFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double norm = 0; for (int i = 0; i < getDimensions(); i++) { final double center = this.getCenter(i); norm += Math.pow(x[i] - center, 2); } return (1 - norm) * Math.exp(-norm / 2); } MexicanHatFunction(final int theDimensions,... | MexicanHatFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double norm = 0; for (int i = 0; i < getDimensions(); i++) { final double center = this.getCenter(i); norm += Math.pow(x[i] - center, 2); } return (1 - norm) * Math.exp(-norm / 2); } MexicanHatFunction(final int theDimensions,... | MexicanHatFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double norm = 0; for (int i = 0; i < getDimensions(); i++) { final double center = this.getCenter(i); norm += Math.pow(x[i] - center, 2); } return (1 - norm) * Math.exp(-norm / 2); } MexicanHatFunction(final int theDimensions,... |
@Test public void testToString() { final double[] params = {5, 0, 0, 0}; final MexicanHatFunction funct = new MexicanHatFunction(3, params, 0); final double[] x = {-1, 0, 1}; funct.evaluate(x); assertEquals("[MexicanHatFunction:width=5.00,center=0.00,0.00,0.00]", funct.toString()); } | @Override public double evaluate(final double[] x) { double norm = 0; for (int i = 0; i < getDimensions(); i++) { final double center = this.getCenter(i); norm += Math.pow(x[i] - center, 2); } return (1 - norm) * Math.exp(-norm / 2); } | MexicanHatFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double norm = 0; for (int i = 0; i < getDimensions(); i++) { final double center = this.getCenter(i); norm += Math.pow(x[i] - center, 2); } return (1 - norm) * Math.exp(-norm / 2); } } | MexicanHatFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double norm = 0; for (int i = 0; i < getDimensions(); i++) { final double center = this.getCenter(i); norm += Math.pow(x[i] - center, 2); } return (1 - norm) * Math.exp(-norm / 2); } MexicanHatFunction(final int theDimensions,... | MexicanHatFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double norm = 0; for (int i = 0; i < getDimensions(); i++) { final double center = this.getCenter(i); norm += Math.pow(x[i] - center, 2); } return (1 - norm) * Math.exp(-norm / 2); } MexicanHatFunction(final int theDimensions,... | MexicanHatFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double norm = 0; for (int i = 0; i < getDimensions(); i++) { final double center = this.getCenter(i); norm += Math.pow(x[i] - center, 2); } return (1 - norm) * Math.exp(-norm / 2); } MexicanHatFunction(final int theDimensions,... |
@Test public void testEqual() { final DataSet ds1 = generateTestData(); final DataSet ds2 = generateTestData(); assertTrue(ds1.equals(ds2)); } | @Override public boolean equals(final Object other) { if (!(other instanceof DataSet)) { return false; } final DataSet otherSet = (DataSet) other; if (getHeaderCount() != otherSet.getHeaderCount()) { return false; } if (size() != otherSet.size()) { return false; } for (int i = 0; i < getHeaderCount(); i++) { if (!this.... | DataSet { @Override public boolean equals(final Object other) { if (!(other instanceof DataSet)) { return false; } final DataSet otherSet = (DataSet) other; if (getHeaderCount() != otherSet.getHeaderCount()) { return false; } if (size() != otherSet.size()) { return false; } for (int i = 0; i < getHeaderCount(); i++) { ... | DataSet { @Override public boolean equals(final Object other) { if (!(other instanceof DataSet)) { return false; } final DataSet otherSet = (DataSet) other; if (getHeaderCount() != otherSet.getHeaderCount()) { return false; } if (size() != otherSet.size()) { return false; } for (int i = 0; i < getHeaderCount(); i++) { ... | DataSet { @Override public boolean equals(final Object other) { if (!(other instanceof DataSet)) { return false; } final DataSet otherSet = (DataSet) other; if (getHeaderCount() != otherSet.getHeaderCount()) { return false; } if (size() != otherSet.size()) { return false; } for (int i = 0; i < getHeaderCount(); i++) { ... | DataSet { @Override public boolean equals(final Object other) { if (!(other instanceof DataSet)) { return false; } final DataSet otherSet = (DataSet) other; if (getHeaderCount() != otherSet.getHeaderCount()) { return false; } if (size() != otherSet.size()) { return false; } for (int i = 0; i < getHeaderCount(); i++) { ... |
@Test public void testNotEqualOtherObject() { final DataSet ds1 = generateTestData(); assertFalse(ds1.equals("")); } | @Override public boolean equals(final Object other) { if (!(other instanceof DataSet)) { return false; } final DataSet otherSet = (DataSet) other; if (getHeaderCount() != otherSet.getHeaderCount()) { return false; } if (size() != otherSet.size()) { return false; } for (int i = 0; i < getHeaderCount(); i++) { if (!this.... | DataSet { @Override public boolean equals(final Object other) { if (!(other instanceof DataSet)) { return false; } final DataSet otherSet = (DataSet) other; if (getHeaderCount() != otherSet.getHeaderCount()) { return false; } if (size() != otherSet.size()) { return false; } for (int i = 0; i < getHeaderCount(); i++) { ... | DataSet { @Override public boolean equals(final Object other) { if (!(other instanceof DataSet)) { return false; } final DataSet otherSet = (DataSet) other; if (getHeaderCount() != otherSet.getHeaderCount()) { return false; } if (size() != otherSet.size()) { return false; } for (int i = 0; i < getHeaderCount(); i++) { ... | DataSet { @Override public boolean equals(final Object other) { if (!(other instanceof DataSet)) { return false; } final DataSet otherSet = (DataSet) other; if (getHeaderCount() != otherSet.getHeaderCount()) { return false; } if (size() != otherSet.size()) { return false; } for (int i = 0; i < getHeaderCount(); i++) { ... | DataSet { @Override public boolean equals(final Object other) { if (!(other instanceof DataSet)) { return false; } final DataSet otherSet = (DataSet) other; if (getHeaderCount() != otherSet.getHeaderCount()) { return false; } if (size() != otherSet.size()) { return false; } for (int i = 0; i < getHeaderCount(); i++) { ... |
@Test public void testMin() { final DataSet ds1 = generateTestData(); assertEquals(1.0, ds1.getMin(1), AIFH.DEFAULT_PRECISION); assertEquals(1.0, ds1.getMin(1), AIFH.DEFAULT_PRECISION); } | public double getMin(final int column) { double result = Double.POSITIVE_INFINITY; for (final Object[] obj : this.data) { result = Math.min(result, convertNumeric(obj, column)); } return result; } | DataSet { public double getMin(final int column) { double result = Double.POSITIVE_INFINITY; for (final Object[] obj : this.data) { result = Math.min(result, convertNumeric(obj, column)); } return result; } } | DataSet { public double getMin(final int column) { double result = Double.POSITIVE_INFINITY; for (final Object[] obj : this.data) { result = Math.min(result, convertNumeric(obj, column)); } return result; } DataSet(final String[] theHeaders); } | DataSet { public double getMin(final int column) { double result = Double.POSITIVE_INFINITY; for (final Object[] obj : this.data) { result = Math.min(result, convertNumeric(obj, column)); } return result; } DataSet(final String[] theHeaders); static DataSet load(final File filename); static DataSet load(final InputStre... | DataSet { public double getMin(final int column) { double result = Double.POSITIVE_INFINITY; for (final Object[] obj : this.data) { result = Math.min(result, convertNumeric(obj, column)); } return result; } DataSet(final String[] theHeaders); static DataSet load(final File filename); static DataSet load(final InputStre... |
@Test public void testMax() { final DataSet ds1 = generateTestData(); assertEquals(3.0, ds1.getMax(1), AIFH.DEFAULT_PRECISION); assertEquals(3.0, ds1.getMax(1), AIFH.DEFAULT_PRECISION); } | public double getMax(final int column) { double result = Double.NEGATIVE_INFINITY; for (final Object[] obj : this.data) { result = Math.max(result, convertNumeric(obj, column)); } return result; } | DataSet { public double getMax(final int column) { double result = Double.NEGATIVE_INFINITY; for (final Object[] obj : this.data) { result = Math.max(result, convertNumeric(obj, column)); } return result; } } | DataSet { public double getMax(final int column) { double result = Double.NEGATIVE_INFINITY; for (final Object[] obj : this.data) { result = Math.max(result, convertNumeric(obj, column)); } return result; } DataSet(final String[] theHeaders); } | DataSet { public double getMax(final int column) { double result = Double.NEGATIVE_INFINITY; for (final Object[] obj : this.data) { result = Math.max(result, convertNumeric(obj, column)); } return result; } DataSet(final String[] theHeaders); static DataSet load(final File filename); static DataSet load(final InputStre... | DataSet { public double getMax(final int column) { double result = Double.NEGATIVE_INFINITY; for (final Object[] obj : this.data) { result = Math.max(result, convertNumeric(obj, column)); } return result; } DataSet(final String[] theHeaders); static DataSet load(final File filename); static DataSet load(final InputStre... |
@Test public void testNormalizeRange() { final DataSet ds1 = generateTestData(); ds1.normalizeRange(1, -1, 1); assertEquals(-1.0, Double.parseDouble(ds1.getData().get(0)[1].toString()) , AIFH.DEFAULT_PRECISION); } | public void normalizeRange(final int column, final double dataLow, final double dataHigh, final double normalizedLow, final double normalizedHigh) { for (final Object[] obj : this.data) { final double x = convertNumeric(obj, column); obj[column] = ((x - dataLow) / (dataHigh - dataLow)) * (normalizedHigh - normalizedLow... | DataSet { public void normalizeRange(final int column, final double dataLow, final double dataHigh, final double normalizedLow, final double normalizedHigh) { for (final Object[] obj : this.data) { final double x = convertNumeric(obj, column); obj[column] = ((x - dataLow) / (dataHigh - dataLow)) * (normalizedHigh - nor... | DataSet { public void normalizeRange(final int column, final double dataLow, final double dataHigh, final double normalizedLow, final double normalizedHigh) { for (final Object[] obj : this.data) { final double x = convertNumeric(obj, column); obj[column] = ((x - dataLow) / (dataHigh - dataLow)) * (normalizedHigh - nor... | DataSet { public void normalizeRange(final int column, final double dataLow, final double dataHigh, final double normalizedLow, final double normalizedHigh) { for (final Object[] obj : this.data) { final double x = convertNumeric(obj, column); obj[column] = ((x - dataLow) / (dataHigh - dataLow)) * (normalizedHigh - nor... | DataSet { public void normalizeRange(final int column, final double dataLow, final double dataHigh, final double normalizedLow, final double normalizedHigh) { for (final Object[] obj : this.data) { final double x = convertNumeric(obj, column); obj[column] = ((x - dataLow) / (dataHigh - dataLow)) * (normalizedHigh - nor... |
@Test public void testDeNormalizeRange() { final DataSet ds1 = generateTestData(); final double min = ds1.getMin(2); final double max = ds1.getMax(2); ds1.normalizeRange(2, min, max, -1, 1); assertEquals(-1.0, Double.parseDouble(ds1.getData().get(0)[2].toString()) , AIFH.DEFAULT_PRECISION); ds1.deNormalizeRange(2, min,... | public void deNormalizeRange(final int column, final double dataLow, final double dataHigh, final double normalizedLow, final double normalizedHigh) { for (final Object[] obj : this.data) { final double x = convertNumeric(obj, column); obj[column] = ((dataLow - dataHigh) * x - normalizedHigh * dataLow + dataHigh * norm... | DataSet { public void deNormalizeRange(final int column, final double dataLow, final double dataHigh, final double normalizedLow, final double normalizedHigh) { for (final Object[] obj : this.data) { final double x = convertNumeric(obj, column); obj[column] = ((dataLow - dataHigh) * x - normalizedHigh * dataLow + dataH... | DataSet { public void deNormalizeRange(final int column, final double dataLow, final double dataHigh, final double normalizedLow, final double normalizedHigh) { for (final Object[] obj : this.data) { final double x = convertNumeric(obj, column); obj[column] = ((dataLow - dataHigh) * x - normalizedHigh * dataLow + dataH... | DataSet { public void deNormalizeRange(final int column, final double dataLow, final double dataHigh, final double normalizedLow, final double normalizedHigh) { for (final Object[] obj : this.data) { final double x = convertNumeric(obj, column); obj[column] = ((dataLow - dataHigh) * x - normalizedHigh * dataLow + dataH... | DataSet { public void deNormalizeRange(final int column, final double dataLow, final double dataHigh, final double normalizedLow, final double normalizedHigh) { for (final Object[] obj : this.data) { final double x = convertNumeric(obj, column); obj[column] = ((dataLow - dataHigh) * x - normalizedHigh * dataLow + dataH... |
@Test public void testNormalizeReciprocal() { final DataSet ds1 = generateTestData(); ds1.normalizeReciprocal(1); assertEquals(0.5, Double.parseDouble(ds1.getData().get(1)[1].toString()) , AIFH.DEFAULT_PRECISION); ds1.deNormalizeReciprocal(1); assertEquals(2.0, Double.parseDouble(ds1.getData().get(1)[1].toString()) , A... | public void normalizeReciprocal(final int column) { for (final Object[] obj : this.data) { final double x = convertNumeric(obj, column); obj[column] = 1 / x; } } | DataSet { public void normalizeReciprocal(final int column) { for (final Object[] obj : this.data) { final double x = convertNumeric(obj, column); obj[column] = 1 / x; } } } | DataSet { public void normalizeReciprocal(final int column) { for (final Object[] obj : this.data) { final double x = convertNumeric(obj, column); obj[column] = 1 / x; } } DataSet(final String[] theHeaders); } | DataSet { public void normalizeReciprocal(final int column) { for (final Object[] obj : this.data) { final double x = convertNumeric(obj, column); obj[column] = 1 / x; } } DataSet(final String[] theHeaders); static DataSet load(final File filename); static DataSet load(final InputStream is); static void save(final File... | DataSet { public void normalizeReciprocal(final int column) { for (final Object[] obj : this.data) { final double x = convertNumeric(obj, column); obj[column] = 1 / x; } } DataSet(final String[] theHeaders); static DataSet load(final File filename); static DataSet load(final InputStream is); static void save(final File... |
@Test public void testEncodeNumeric() { final DataSet ds1 = generateTestData(); ds1.encodeNumeric(0); } | public Map<String, Integer> encodeNumeric(final int column) { final Map<String, Integer> classes = enumerateClasses(column); for (final Object[] obj : this.data) { final int index = classes.get(obj[column].toString()); obj[column] = index; } return classes; } | DataSet { public Map<String, Integer> encodeNumeric(final int column) { final Map<String, Integer> classes = enumerateClasses(column); for (final Object[] obj : this.data) { final int index = classes.get(obj[column].toString()); obj[column] = index; } return classes; } } | DataSet { public Map<String, Integer> encodeNumeric(final int column) { final Map<String, Integer> classes = enumerateClasses(column); for (final Object[] obj : this.data) { final int index = classes.get(obj[column].toString()); obj[column] = index; } return classes; } DataSet(final String[] theHeaders); } | DataSet { public Map<String, Integer> encodeNumeric(final int column) { final Map<String, Integer> classes = enumerateClasses(column); for (final Object[] obj : this.data) { final int index = classes.get(obj[column].toString()); obj[column] = index; } return classes; } DataSet(final String[] theHeaders); static DataSet... | DataSet { public Map<String, Integer> encodeNumeric(final int column) { final Map<String, Integer> classes = enumerateClasses(column); for (final Object[] obj : this.data) { final int index = classes.get(obj[column].toString()); obj[column] = index; } return classes; } DataSet(final String[] theHeaders); static DataSet... |
@Test public void testComputeRegression() { final RBFNetwork network = new RBFNetwork(2, 1, 1); final double[] ltm = { 2.0, 2.0, 5.0, 2.0, 4.0, 3.0, 4.0}; System.arraycopy(ltm, 0, network.getLongTermMemory(), 0, ltm.length); final double[] x = {1, 2}; final double y = network.computeRegression(x)[0]; assertEquals(7, y,... | @Override public double[] computeRegression(final double[] input) { final double[] rbfOutput = new double[rbf.length + 1]; rbfOutput[rbfOutput.length - 1] = 1; for (int rbfIndex = 0; rbfIndex < rbf.length; rbfIndex++) { final double[] weightedInput = new double[input.length]; for (int inputIndex = 0; inputIndex < input... | RBFNetwork implements RegressionAlgorithm, ClassificationAlgorithm { @Override public double[] computeRegression(final double[] input) { final double[] rbfOutput = new double[rbf.length + 1]; rbfOutput[rbfOutput.length - 1] = 1; for (int rbfIndex = 0; rbfIndex < rbf.length; rbfIndex++) { final double[] weightedInput = ... | RBFNetwork implements RegressionAlgorithm, ClassificationAlgorithm { @Override public double[] computeRegression(final double[] input) { final double[] rbfOutput = new double[rbf.length + 1]; rbfOutput[rbfOutput.length - 1] = 1; for (int rbfIndex = 0; rbfIndex < rbf.length; rbfIndex++) { final double[] weightedInput = ... | RBFNetwork implements RegressionAlgorithm, ClassificationAlgorithm { @Override public double[] computeRegression(final double[] input) { final double[] rbfOutput = new double[rbf.length + 1]; rbfOutput[rbfOutput.length - 1] = 1; for (int rbfIndex = 0; rbfIndex < rbf.length; rbfIndex++) { final double[] weightedInput = ... | RBFNetwork implements RegressionAlgorithm, ClassificationAlgorithm { @Override public double[] computeRegression(final double[] input) { final double[] rbfOutput = new double[rbf.length + 1]; rbfOutput[rbfOutput.length - 1] = 1; for (int rbfIndex = 0; rbfIndex < rbf.length; rbfIndex++) { final double[] weightedInput = ... |
@Test public void testEncodeOneOfN() { final DataSet ds1 = generateTestData(); ds1.encodeOneOfN(0); } | public Map<String, Integer> encodeOneOfN(final int column) { return encodeOneOfN(column, 0, 1); } | DataSet { public Map<String, Integer> encodeOneOfN(final int column) { return encodeOneOfN(column, 0, 1); } } | DataSet { public Map<String, Integer> encodeOneOfN(final int column) { return encodeOneOfN(column, 0, 1); } DataSet(final String[] theHeaders); } | DataSet { public Map<String, Integer> encodeOneOfN(final int column) { return encodeOneOfN(column, 0, 1); } DataSet(final String[] theHeaders); static DataSet load(final File filename); static DataSet load(final InputStream is); static void save(final File filename, final DataSet ds); static void save(final OutputStrea... | DataSet { public Map<String, Integer> encodeOneOfN(final int column) { return encodeOneOfN(column, 0, 1); } DataSet(final String[] theHeaders); static DataSet load(final File filename); static DataSet load(final InputStream is); static void save(final File filename, final DataSet ds); static void save(final OutputStrea... |
@Test public void testEncodeEquilateral() { final DataSet ds1 = generateTestData(); ds1.encodeEquilateral(0,-1,1); assertEquals(4,ds1.getHeaderCount()); Set<Double> col1=new HashSet<>(); Set<Double> col2=new HashSet<>(); for (Object[] row:ds1.getData()){ col1.add(round((Double)row[0])); col2.add(round((Double)row[1]));... | public Map<String, Integer> encodeEquilateral(final int column) { return encodeEquilateral(column, 0, 1); } | DataSet { public Map<String, Integer> encodeEquilateral(final int column) { return encodeEquilateral(column, 0, 1); } } | DataSet { public Map<String, Integer> encodeEquilateral(final int column) { return encodeEquilateral(column, 0, 1); } DataSet(final String[] theHeaders); } | DataSet { public Map<String, Integer> encodeEquilateral(final int column) { return encodeEquilateral(column, 0, 1); } DataSet(final String[] theHeaders); static DataSet load(final File filename); static DataSet load(final InputStream is); static void save(final File filename, final DataSet ds); static void save(final O... | DataSet { public Map<String, Integer> encodeEquilateral(final int column) { return encodeEquilateral(column, 0, 1); } DataSet(final String[] theHeaders); static DataSet load(final File filename); static DataSet load(final InputStream is); static void save(final File filename, final DataSet ds); static void save(final O... |
@Test public void testDeleteColumn() { final DataSet ds1 = generateTestData(); ds1.deleteColumn(0); assertEquals(2, ds1.getHeaderCount()); assertTrue(ds1.getHeaders()[0].equals("numeric")); assertTrue(ds1.getHeaders()[1].equals("dec")); } | public void deleteColumn(final int col) { final String[] headers2 = new String[headers.length - 1]; int h2Index = 0; for (int i = 0; i < headers.length; i++) { if (i != col) { headers2[h2Index++] = headers[i]; } } this.headers = headers2; int rowIndex = 0; for (final Object[] row : this.data) { final Object[] row2 = ne... | DataSet { public void deleteColumn(final int col) { final String[] headers2 = new String[headers.length - 1]; int h2Index = 0; for (int i = 0; i < headers.length; i++) { if (i != col) { headers2[h2Index++] = headers[i]; } } this.headers = headers2; int rowIndex = 0; for (final Object[] row : this.data) { final Object[]... | DataSet { public void deleteColumn(final int col) { final String[] headers2 = new String[headers.length - 1]; int h2Index = 0; for (int i = 0; i < headers.length; i++) { if (i != col) { headers2[h2Index++] = headers[i]; } } this.headers = headers2; int rowIndex = 0; for (final Object[] row : this.data) { final Object[]... | DataSet { public void deleteColumn(final int col) { final String[] headers2 = new String[headers.length - 1]; int h2Index = 0; for (int i = 0; i < headers.length; i++) { if (i != col) { headers2[h2Index++] = headers[i]; } } this.headers = headers2; int rowIndex = 0; for (final Object[] row : this.data) { final Object[]... | DataSet { public void deleteColumn(final int col) { final String[] headers2 = new String[headers.length - 1]; int h2Index = 0; for (int i = 0; i < headers.length; i++) { if (i != col) { headers2[h2Index++] = headers[i]; } } this.headers = headers2; int rowIndex = 0; for (final Object[] row : this.data) { final Object[]... |
@Test public void testExtractUnsupervisedLabeled() { final DataSet ds1 = generateTestData(); final List<BasicData> result = ds1.extractUnsupervisedLabeled(0); assertEquals(3, result.size()); assertTrue(result.get(0).getLabel().equals("One")); } | public List<BasicData> extractUnsupervisedLabeled(final int labelIndex) { final List<BasicData> result = new ArrayList<BasicData>(); final int dimensions = getHeaderCount() - 1; for (int rowIndex = 0; rowIndex < size(); rowIndex++) { final Object[] raw = this.data.get(rowIndex); final BasicData row = new BasicData(dime... | DataSet { public List<BasicData> extractUnsupervisedLabeled(final int labelIndex) { final List<BasicData> result = new ArrayList<BasicData>(); final int dimensions = getHeaderCount() - 1; for (int rowIndex = 0; rowIndex < size(); rowIndex++) { final Object[] raw = this.data.get(rowIndex); final BasicData row = new Basi... | DataSet { public List<BasicData> extractUnsupervisedLabeled(final int labelIndex) { final List<BasicData> result = new ArrayList<BasicData>(); final int dimensions = getHeaderCount() - 1; for (int rowIndex = 0; rowIndex < size(); rowIndex++) { final Object[] raw = this.data.get(rowIndex); final BasicData row = new Basi... | DataSet { public List<BasicData> extractUnsupervisedLabeled(final int labelIndex) { final List<BasicData> result = new ArrayList<BasicData>(); final int dimensions = getHeaderCount() - 1; for (int rowIndex = 0; rowIndex < size(); rowIndex++) { final Object[] raw = this.data.get(rowIndex); final BasicData row = new Basi... | DataSet { public List<BasicData> extractUnsupervisedLabeled(final int labelIndex) { final List<BasicData> result = new ArrayList<BasicData>(); final int dimensions = getHeaderCount() - 1; for (int rowIndex = 0; rowIndex < size(); rowIndex++) { final Object[] raw = this.data.get(rowIndex); final BasicData row = new Basi... |
@Test public void testExtractSupervised() { final DataSet ds1 = generateTestData(); final List<BasicData> result = ds1.extractSupervised(1, 1, 2, 1); assertEquals(3, result.size()); } | public List<BasicData> extractSupervised(final int inputBegin, final int inputCount, final int idealBegin, final int idealCount) { final List<BasicData> result = new ArrayList<BasicData>(); for (int rowIndex = 0; rowIndex < size(); rowIndex++) { final Object[] raw = this.data.get(rowIndex); final BasicData row = new Ba... | DataSet { public List<BasicData> extractSupervised(final int inputBegin, final int inputCount, final int idealBegin, final int idealCount) { final List<BasicData> result = new ArrayList<BasicData>(); for (int rowIndex = 0; rowIndex < size(); rowIndex++) { final Object[] raw = this.data.get(rowIndex); final BasicData ro... | DataSet { public List<BasicData> extractSupervised(final int inputBegin, final int inputCount, final int idealBegin, final int idealCount) { final List<BasicData> result = new ArrayList<BasicData>(); for (int rowIndex = 0; rowIndex < size(); rowIndex++) { final Object[] raw = this.data.get(rowIndex); final BasicData ro... | DataSet { public List<BasicData> extractSupervised(final int inputBegin, final int inputCount, final int idealBegin, final int idealCount) { final List<BasicData> result = new ArrayList<BasicData>(); for (int rowIndex = 0; rowIndex < size(); rowIndex++) { final Object[] raw = this.data.get(rowIndex); final BasicData ro... | DataSet { public List<BasicData> extractSupervised(final int inputBegin, final int inputCount, final int idealBegin, final int idealCount) { final List<BasicData> result = new ArrayList<BasicData>(); for (int rowIndex = 0; rowIndex < size(); rowIndex++) { final Object[] raw = this.data.get(rowIndex); final BasicData ro... |
@Test public void testReplaceColumn() { final DataSet ds1 = generateTestData(); ds1.replaceColumn(1, 2, 1, 0); final List<BasicData> result = ds1.extractSupervised(1, 1, 2, 1); assertEquals(0.0, result.get(0).getInput()[0], AIFH.DEFAULT_PRECISION); assertEquals(1.0, result.get(1).getInput()[0], AIFH.DEFAULT_PRECISION);... | public void replaceColumn(final int columnIndex, final double searchFor, final double replaceWith, final double others) { for (final Object[] row : this.data) { final double d = convertNumeric(row, columnIndex); if (Math.abs(d - searchFor) < 0.0001) { row[columnIndex] = replaceWith; } else { row[columnIndex] = others; ... | DataSet { public void replaceColumn(final int columnIndex, final double searchFor, final double replaceWith, final double others) { for (final Object[] row : this.data) { final double d = convertNumeric(row, columnIndex); if (Math.abs(d - searchFor) < 0.0001) { row[columnIndex] = replaceWith; } else { row[columnIndex] ... | DataSet { public void replaceColumn(final int columnIndex, final double searchFor, final double replaceWith, final double others) { for (final Object[] row : this.data) { final double d = convertNumeric(row, columnIndex); if (Math.abs(d - searchFor) < 0.0001) { row[columnIndex] = replaceWith; } else { row[columnIndex] ... | DataSet { public void replaceColumn(final int columnIndex, final double searchFor, final double replaceWith, final double others) { for (final Object[] row : this.data) { final double d = convertNumeric(row, columnIndex); if (Math.abs(d - searchFor) < 0.0001) { row[columnIndex] = replaceWith; } else { row[columnIndex] ... | DataSet { public void replaceColumn(final int columnIndex, final double searchFor, final double replaceWith, final double others) { for (final Object[] row : this.data) { final double d = convertNumeric(row, columnIndex); if (Math.abs(d - searchFor) < 0.0001) { row[columnIndex] = replaceWith; } else { row[columnIndex] ... |
@Test public void testDeleteUnknowns() { final DataSet ds1 = generateTestData(); ds1.getData().get(1)[2] = "?"; ds1.deleteUnknowns(); assertEquals(2, ds1.getData().size()); } | public void deleteUnknowns() { int rowIndex = 0; while (rowIndex < this.data.size()) { final Object[] row = data.get(rowIndex); boolean remove = false; for (final Object aRow : row) { if (aRow.toString().equals("?")) { remove = true; break; } } if (remove) { data.remove(rowIndex); } else { rowIndex++; } } } | DataSet { public void deleteUnknowns() { int rowIndex = 0; while (rowIndex < this.data.size()) { final Object[] row = data.get(rowIndex); boolean remove = false; for (final Object aRow : row) { if (aRow.toString().equals("?")) { remove = true; break; } } if (remove) { data.remove(rowIndex); } else { rowIndex++; } } } } | DataSet { public void deleteUnknowns() { int rowIndex = 0; while (rowIndex < this.data.size()) { final Object[] row = data.get(rowIndex); boolean remove = false; for (final Object aRow : row) { if (aRow.toString().equals("?")) { remove = true; break; } } if (remove) { data.remove(rowIndex); } else { rowIndex++; } } } D... | DataSet { public void deleteUnknowns() { int rowIndex = 0; while (rowIndex < this.data.size()) { final Object[] row = data.get(rowIndex); boolean remove = false; for (final Object aRow : row) { if (aRow.toString().equals("?")) { remove = true; break; } } if (remove) { data.remove(rowIndex); } else { rowIndex++; } } } D... | DataSet { public void deleteUnknowns() { int rowIndex = 0; while (rowIndex < this.data.size()) { final Object[] row = data.get(rowIndex); boolean remove = false; for (final Object aRow : row) { if (aRow.toString().equals("?")) { remove = true; break; } } if (remove) { data.remove(rowIndex); } else { rowIndex++; } } } D... |
@Test public void testEncode() { final Equilateral eq = new Equilateral(3, -1, 1); final double[] d = eq.encode(1); assertEquals(0.8660254037844386, d[0], AIFH.DEFAULT_PRECISION); assertEquals(-0.5, d[1], AIFH.DEFAULT_PRECISION); } | public final double[] encode(final int set) { if (set < 0 || set > this.matrix.length) { throw new AIFHError("Class out of range for equilateral: " + set); } return this.matrix[set]; } | Equilateral implements Serializable { public final double[] encode(final int set) { if (set < 0 || set > this.matrix.length) { throw new AIFHError("Class out of range for equilateral: " + set); } return this.matrix[set]; } } | Equilateral implements Serializable { public final double[] encode(final int set) { if (set < 0 || set > this.matrix.length) { throw new AIFHError("Class out of range for equilateral: " + set); } return this.matrix[set]; } Equilateral(final int count, final double low, final double high); } | Equilateral implements Serializable { public final double[] encode(final int set) { if (set < 0 || set > this.matrix.length) { throw new AIFHError("Class out of range for equilateral: " + set); } return this.matrix[set]; } Equilateral(final int count, final double low, final double high); final int decode(final double[... | Equilateral implements Serializable { public final double[] encode(final int set) { if (set < 0 || set > this.matrix.length) { throw new AIFHError("Class out of range for equilateral: " + set); } return this.matrix[set]; } Equilateral(final int count, final double low, final double high); final int decode(final double[... |
@Test public void testDecode() { final Equilateral eq = new Equilateral(3, -1, 1); final double[] d0 = {0.866, 0.5}; final double[] d1 = {-0.866, 0.5}; final double[] d2 = {0, -1}; assertEquals(2, eq.decode(d0)); assertEquals(2, eq.decode(d1)); assertEquals(0, eq.decode(d2)); } | public final int decode(final double[] activations) { double minValue = Double.POSITIVE_INFINITY; int minSet = -1; for (int i = 0; i < this.matrix.length; i++) { final double dist = getDistance(activations, i); if (dist < minValue) { minValue = dist; minSet = i; } } return minSet; } | Equilateral implements Serializable { public final int decode(final double[] activations) { double minValue = Double.POSITIVE_INFINITY; int minSet = -1; for (int i = 0; i < this.matrix.length; i++) { final double dist = getDistance(activations, i); if (dist < minValue) { minValue = dist; minSet = i; } } return minSet; ... | Equilateral implements Serializable { public final int decode(final double[] activations) { double minValue = Double.POSITIVE_INFINITY; int minSet = -1; for (int i = 0; i < this.matrix.length; i++) { final double dist = getDistance(activations, i); if (dist < minValue) { minValue = dist; minSet = i; } } return minSet; ... | Equilateral implements Serializable { public final int decode(final double[] activations) { double minValue = Double.POSITIVE_INFINITY; int minSet = -1; for (int i = 0; i < this.matrix.length; i++) { final double dist = getDistance(activations, i); if (dist < minValue) { minValue = dist; minSet = i; } } return minSet; ... | Equilateral implements Serializable { public final int decode(final double[] activations) { double minValue = Double.POSITIVE_INFINITY; int minSet = -1; for (int i = 0; i < this.matrix.length; i++) { final double dist = getDistance(activations, i); if (dist < minValue) { minValue = dist; minSet = i; } } return minSet; ... |
@Test(expected = AIFHError.class) public void testError() { final Equilateral eq = new Equilateral(3, -1, 1); eq.encode(10); } | public final double[] encode(final int set) { if (set < 0 || set > this.matrix.length) { throw new AIFHError("Class out of range for equilateral: " + set); } return this.matrix[set]; } | Equilateral implements Serializable { public final double[] encode(final int set) { if (set < 0 || set > this.matrix.length) { throw new AIFHError("Class out of range for equilateral: " + set); } return this.matrix[set]; } } | Equilateral implements Serializable { public final double[] encode(final int set) { if (set < 0 || set > this.matrix.length) { throw new AIFHError("Class out of range for equilateral: " + set); } return this.matrix[set]; } Equilateral(final int count, final double low, final double high); } | Equilateral implements Serializable { public final double[] encode(final int set) { if (set < 0 || set > this.matrix.length) { throw new AIFHError("Class out of range for equilateral: " + set); } return this.matrix[set]; } Equilateral(final int count, final double low, final double high); final int decode(final double[... | Equilateral implements Serializable { public final double[] encode(final int set) { if (set < 0 || set > this.matrix.length) { throw new AIFHError("Class out of range for equilateral: " + set); } return this.matrix[set]; } Equilateral(final int count, final double low, final double high); final int decode(final double[... |
@Test public void testComputeClassification() { final RBFNetwork network = new RBFNetwork(2, 1, 2); final double[] ltm = { 2.0, 2.0, 5.0, 2.0, 4.0, 3.0, 4.0, 5.0, 6.0}; System.arraycopy(ltm, 0, network.getLongTermMemory(), 0, ltm.length); final double[] x = {1, 2}; final double[] y = network.computeRegression(x); asser... | @Override public int computeClassification(final double[] input) { final double[] output = computeRegression(input); return VectorUtil.maxIndex(output); } | RBFNetwork implements RegressionAlgorithm, ClassificationAlgorithm { @Override public int computeClassification(final double[] input) { final double[] output = computeRegression(input); return VectorUtil.maxIndex(output); } } | RBFNetwork implements RegressionAlgorithm, ClassificationAlgorithm { @Override public int computeClassification(final double[] input) { final double[] output = computeRegression(input); return VectorUtil.maxIndex(output); } RBFNetwork(final int theInputCount, final int rbfCount, final int theOutputCount); } | RBFNetwork implements RegressionAlgorithm, ClassificationAlgorithm { @Override public int computeClassification(final double[] input) { final double[] output = computeRegression(input); return VectorUtil.maxIndex(output); } RBFNetwork(final int theInputCount, final int rbfCount, final int theOutputCount); @Override dou... | RBFNetwork implements RegressionAlgorithm, ClassificationAlgorithm { @Override public int computeClassification(final double[] input) { final double[] output = computeRegression(input); return VectorUtil.maxIndex(output); } RBFNetwork(final int theInputCount, final int rbfCount, final int theOutputCount); @Override dou... |
@Test public void testAllEqual() { final Equilateral eq = new Equilateral(10, -1, 1); final CalculateDistance dc = new EuclideanDistance(); double compareDist = 0; for (int x = 0; x < 10; x++) { double[] baseClass = eq.encode(x); for (int y = 0; y < 10; y++) { if (x != y) { double[] otherClass = eq.encode(y); double di... | public final double[] encode(final int set) { if (set < 0 || set > this.matrix.length) { throw new AIFHError("Class out of range for equilateral: " + set); } return this.matrix[set]; } | Equilateral implements Serializable { public final double[] encode(final int set) { if (set < 0 || set > this.matrix.length) { throw new AIFHError("Class out of range for equilateral: " + set); } return this.matrix[set]; } } | Equilateral implements Serializable { public final double[] encode(final int set) { if (set < 0 || set > this.matrix.length) { throw new AIFHError("Class out of range for equilateral: " + set); } return this.matrix[set]; } Equilateral(final int count, final double low, final double high); } | Equilateral implements Serializable { public final double[] encode(final int set) { if (set < 0 || set > this.matrix.length) { throw new AIFHError("Class out of range for equilateral: " + set); } return this.matrix[set]; } Equilateral(final int count, final double low, final double high); final int decode(final double[... | Equilateral implements Serializable { public final double[] encode(final int set) { if (set < 0 || set > this.matrix.length) { throw new AIFHError("Class out of range for equilateral: " + set); } return this.matrix[set]; } Equilateral(final int count, final double low, final double high); final int decode(final double[... |
@Test public void testGenerateBoolean() { final BasicGenerateRandom rnd = new BasicGenerateRandom(1); for (final boolean aBOOLEAN_TEST : BOOLEAN_TEST) { final boolean g = rnd.nextBoolean(); assertEquals(g, aBOOLEAN_TEST); } } | @Override public boolean nextBoolean() { return this.rand.nextBoolean(); } | BasicGenerateRandom extends AbstractGenerateRandom { @Override public boolean nextBoolean() { return this.rand.nextBoolean(); } } | BasicGenerateRandom extends AbstractGenerateRandom { @Override public boolean nextBoolean() { return this.rand.nextBoolean(); } BasicGenerateRandom(final long seed); BasicGenerateRandom(); } | BasicGenerateRandom extends AbstractGenerateRandom { @Override public boolean nextBoolean() { return this.rand.nextBoolean(); } BasicGenerateRandom(final long seed); BasicGenerateRandom(); @Override int nextInt(); @Override double nextDouble(); @Override float nextFloat(); @Override long nextLong(); @Override boolean ... | BasicGenerateRandom extends AbstractGenerateRandom { @Override public boolean nextBoolean() { return this.rand.nextBoolean(); } BasicGenerateRandom(final long seed); BasicGenerateRandom(); @Override int nextInt(); @Override double nextDouble(); @Override float nextFloat(); @Override long nextLong(); @Override boolean ... |
@Test public void testDoubleRange() { final BasicGenerateRandom rnd = new BasicGenerateRandom(1); for (final double aDOUBLE_RANGE_TEST : DOUBLE_RANGE_TEST) { final double g = rnd.nextDouble(-1, 1); assertEquals(g, aDOUBLE_RANGE_TEST, AIFH.DEFAULT_PRECISION); } } | @Override public double nextDouble() { return this.rand.nextDouble(); } | BasicGenerateRandom extends AbstractGenerateRandom { @Override public double nextDouble() { return this.rand.nextDouble(); } } | BasicGenerateRandom extends AbstractGenerateRandom { @Override public double nextDouble() { return this.rand.nextDouble(); } BasicGenerateRandom(final long seed); BasicGenerateRandom(); } | BasicGenerateRandom extends AbstractGenerateRandom { @Override public double nextDouble() { return this.rand.nextDouble(); } BasicGenerateRandom(final long seed); BasicGenerateRandom(); @Override int nextInt(); @Override double nextDouble(); @Override float nextFloat(); @Override long nextLong(); @Override boolean nex... | BasicGenerateRandom extends AbstractGenerateRandom { @Override public double nextDouble() { return this.rand.nextDouble(); } BasicGenerateRandom(final long seed); BasicGenerateRandom(); @Override int nextInt(); @Override double nextDouble(); @Override float nextFloat(); @Override long nextLong(); @Override boolean nex... |
@Test public void testDouble() { final BasicGenerateRandom rnd = new BasicGenerateRandom(1); for (final double aDOUBLE_TEST : DOUBLE_TEST) { final double g = rnd.nextDouble(); assertEquals(g, aDOUBLE_TEST, AIFH.DEFAULT_PRECISION); } } | @Override public double nextDouble() { return this.rand.nextDouble(); } | BasicGenerateRandom extends AbstractGenerateRandom { @Override public double nextDouble() { return this.rand.nextDouble(); } } | BasicGenerateRandom extends AbstractGenerateRandom { @Override public double nextDouble() { return this.rand.nextDouble(); } BasicGenerateRandom(final long seed); BasicGenerateRandom(); } | BasicGenerateRandom extends AbstractGenerateRandom { @Override public double nextDouble() { return this.rand.nextDouble(); } BasicGenerateRandom(final long seed); BasicGenerateRandom(); @Override int nextInt(); @Override double nextDouble(); @Override float nextFloat(); @Override long nextLong(); @Override boolean nex... | BasicGenerateRandom extends AbstractGenerateRandom { @Override public double nextDouble() { return this.rand.nextDouble(); } BasicGenerateRandom(final long seed); BasicGenerateRandom(); @Override int nextInt(); @Override double nextDouble(); @Override float nextFloat(); @Override long nextLong(); @Override boolean nex... |
@Test public void testLong() { final BasicGenerateRandom rnd = new BasicGenerateRandom(1); for (final long aLONG_TEST : LONG_TEST) { final long l = rnd.nextLong(); assertEquals(l, aLONG_TEST, AIFH.DEFAULT_PRECISION); } } | @Override public long nextLong() { return this.rand.nextLong(); } | BasicGenerateRandom extends AbstractGenerateRandom { @Override public long nextLong() { return this.rand.nextLong(); } } | BasicGenerateRandom extends AbstractGenerateRandom { @Override public long nextLong() { return this.rand.nextLong(); } BasicGenerateRandom(final long seed); BasicGenerateRandom(); } | BasicGenerateRandom extends AbstractGenerateRandom { @Override public long nextLong() { return this.rand.nextLong(); } BasicGenerateRandom(final long seed); BasicGenerateRandom(); @Override int nextInt(); @Override double nextDouble(); @Override float nextFloat(); @Override long nextLong(); @Override boolean nextBoole... | BasicGenerateRandom extends AbstractGenerateRandom { @Override public long nextLong() { return this.rand.nextLong(); } BasicGenerateRandom(final long seed); BasicGenerateRandom(); @Override int nextInt(); @Override double nextDouble(); @Override float nextFloat(); @Override long nextLong(); @Override boolean nextBoole... |
@Test public void testFloat() { final BasicGenerateRandom rnd = new BasicGenerateRandom(1); for (final float aFLOAT_TEST : FLOAT_TEST) { final float l = (float) rnd.nextFloat(); assertEquals(l, aFLOAT_TEST, AIFH.DEFAULT_PRECISION); } } | @Override public float nextFloat() { return this.rand.nextFloat(); } | BasicGenerateRandom extends AbstractGenerateRandom { @Override public float nextFloat() { return this.rand.nextFloat(); } } | BasicGenerateRandom extends AbstractGenerateRandom { @Override public float nextFloat() { return this.rand.nextFloat(); } BasicGenerateRandom(final long seed); BasicGenerateRandom(); } | BasicGenerateRandom extends AbstractGenerateRandom { @Override public float nextFloat() { return this.rand.nextFloat(); } BasicGenerateRandom(final long seed); BasicGenerateRandom(); @Override int nextInt(); @Override double nextDouble(); @Override float nextFloat(); @Override long nextLong(); @Override boolean nextBo... | BasicGenerateRandom extends AbstractGenerateRandom { @Override public float nextFloat() { return this.rand.nextFloat(); } BasicGenerateRandom(final long seed); BasicGenerateRandom(); @Override int nextInt(); @Override double nextDouble(); @Override float nextFloat(); @Override long nextLong(); @Override boolean nextBo... |
@Test public void testGaussianFloat() { final BasicGenerateRandom rnd = new BasicGenerateRandom(1); for (final double aGAUSSIAN_TEST : GAUSSIAN_TEST) { final double g = rnd.nextGaussian(); assertEquals(g, aGAUSSIAN_TEST, AIFH.DEFAULT_PRECISION); } } | @Override public double nextGaussian() { return this.rand.nextGaussian(); } | BasicGenerateRandom extends AbstractGenerateRandom { @Override public double nextGaussian() { return this.rand.nextGaussian(); } } | BasicGenerateRandom extends AbstractGenerateRandom { @Override public double nextGaussian() { return this.rand.nextGaussian(); } BasicGenerateRandom(final long seed); BasicGenerateRandom(); } | BasicGenerateRandom extends AbstractGenerateRandom { @Override public double nextGaussian() { return this.rand.nextGaussian(); } BasicGenerateRandom(final long seed); BasicGenerateRandom(); @Override int nextInt(); @Override double nextDouble(); @Override float nextFloat(); @Override long nextLong(); @Override boolean... | BasicGenerateRandom extends AbstractGenerateRandom { @Override public double nextGaussian() { return this.rand.nextGaussian(); } BasicGenerateRandom(final long seed); BasicGenerateRandom(); @Override int nextInt(); @Override double nextDouble(); @Override float nextFloat(); @Override long nextLong(); @Override boolean... |
@Test public void testInt() { final BasicGenerateRandom rnd = new BasicGenerateRandom(1); for (final int aINT_TEST : INT_TEST) { final int g = rnd.nextInt(); assertEquals(g, aINT_TEST, AIFH.DEFAULT_PRECISION); } } | @Override public int nextInt() { return this.rand.nextInt(); } | BasicGenerateRandom extends AbstractGenerateRandom { @Override public int nextInt() { return this.rand.nextInt(); } } | BasicGenerateRandom extends AbstractGenerateRandom { @Override public int nextInt() { return this.rand.nextInt(); } BasicGenerateRandom(final long seed); BasicGenerateRandom(); } | BasicGenerateRandom extends AbstractGenerateRandom { @Override public int nextInt() { return this.rand.nextInt(); } BasicGenerateRandom(final long seed); BasicGenerateRandom(); @Override int nextInt(); @Override double nextDouble(); @Override float nextFloat(); @Override long nextLong(); @Override boolean nextBoolean(... | BasicGenerateRandom extends AbstractGenerateRandom { @Override public int nextInt() { return this.rand.nextInt(); } BasicGenerateRandom(final long seed); BasicGenerateRandom(); @Override int nextInt(); @Override double nextDouble(); @Override float nextFloat(); @Override long nextLong(); @Override boolean nextBoolean(... |
@Test public void testIntRange() { final BasicGenerateRandom rnd = new BasicGenerateRandom(1); for (final int aINT_RANGE_TEST : INT_RANGE_TEST) { final int g = rnd.nextInt(0, 10); assertEquals(g, aINT_RANGE_TEST); } } | @Override public int nextInt() { return this.rand.nextInt(); } | BasicGenerateRandom extends AbstractGenerateRandom { @Override public int nextInt() { return this.rand.nextInt(); } } | BasicGenerateRandom extends AbstractGenerateRandom { @Override public int nextInt() { return this.rand.nextInt(); } BasicGenerateRandom(final long seed); BasicGenerateRandom(); } | BasicGenerateRandom extends AbstractGenerateRandom { @Override public int nextInt() { return this.rand.nextInt(); } BasicGenerateRandom(final long seed); BasicGenerateRandom(); @Override int nextInt(); @Override double nextDouble(); @Override float nextFloat(); @Override long nextLong(); @Override boolean nextBoolean(... | BasicGenerateRandom extends AbstractGenerateRandom { @Override public int nextInt() { return this.rand.nextInt(); } BasicGenerateRandom(final long seed); BasicGenerateRandom(); @Override int nextInt(); @Override double nextDouble(); @Override float nextFloat(); @Override long nextLong(); @Override boolean nextBoolean(... |
@Test public void testGenerateBoolean() { final MultiplyWithCarryGenerateRandom rnd = new MultiplyWithCarryGenerateRandom(1); for (final boolean aBOOLEAN_TEST : BOOLEAN_TEST) { final boolean g = rnd.nextBoolean(); assertEquals(g, aBOOLEAN_TEST); } } | @Override public boolean nextBoolean() { return nextDouble() > 0.5; } | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public boolean nextBoolean() { return nextDouble() > 0.5; } } | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public boolean nextBoolean() { return nextDouble() > 0.5; } MultiplyWithCarryGenerateRandom(final long seed); MultiplyWithCarryGenerateRandom(); MultiplyWithCarryGenerateRandom(long[] seeds, final long carry, final int r, final long multiplier); } | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public boolean nextBoolean() { return nextDouble() > 0.5; } MultiplyWithCarryGenerateRandom(final long seed); MultiplyWithCarryGenerateRandom(); MultiplyWithCarryGenerateRandom(long[] seeds, final long carry, final int r, final long multiplier); @O... | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public boolean nextBoolean() { return nextDouble() > 0.5; } MultiplyWithCarryGenerateRandom(final long seed); MultiplyWithCarryGenerateRandom(); MultiplyWithCarryGenerateRandom(long[] seeds, final long carry, final int r, final long multiplier); @O... |
@Test public void testDistanceCalc() { final CalculateDistance calc = new ChebyshevDistance(); final double[] pos1 = {0.5, 1.0, 2.5,}; final double[] pos2 = {0.1, 2.0, -2.5,}; assertEquals(5.0, calc.calculate(pos1, pos2), 0.001); } | @Override public double calculate(final double[] position1, final int pos1, final double[] position2, final int pos2, final int length) { double result = 0; for (int i = 0; i < length; i++) { final double d = Math.abs(position1[pos1 + i] - position2[pos2 + i]); result = Math.max(d, result); } return result; } | ChebyshevDistance extends AbstractDistance { @Override public double calculate(final double[] position1, final int pos1, final double[] position2, final int pos2, final int length) { double result = 0; for (int i = 0; i < length; i++) { final double d = Math.abs(position1[pos1 + i] - position2[pos2 + i]); result = Math... | ChebyshevDistance extends AbstractDistance { @Override public double calculate(final double[] position1, final int pos1, final double[] position2, final int pos2, final int length) { double result = 0; for (int i = 0; i < length; i++) { final double d = Math.abs(position1[pos1 + i] - position2[pos2 + i]); result = Math... | ChebyshevDistance extends AbstractDistance { @Override public double calculate(final double[] position1, final int pos1, final double[] position2, final int pos2, final int length) { double result = 0; for (int i = 0; i < length; i++) { final double d = Math.abs(position1[pos1 + i] - position2[pos2 + i]); result = Math... | ChebyshevDistance extends AbstractDistance { @Override public double calculate(final double[] position1, final int pos1, final double[] position2, final int pos2, final int length) { double result = 0; for (int i = 0; i < length; i++) { final double d = Math.abs(position1[pos1 + i] - position2[pos2 + i]); result = Math... |
@Test public void testDoubleRange() { final MultiplyWithCarryGenerateRandom rnd = new MultiplyWithCarryGenerateRandom(1); for (final double aDOUBLE_RANGE_TEST : DOUBLE_RANGE_TEST) { final double g = rnd.nextDouble(-1, 1); assertEquals(g, aDOUBLE_RANGE_TEST, AIFH.DEFAULT_PRECISION); } } | @Override public double nextDouble() { return (((long) next(26) << 27) + next(27)) / (double) (1L << 53); } | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public double nextDouble() { return (((long) next(26) << 27) + next(27)) / (double) (1L << 53); } } | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public double nextDouble() { return (((long) next(26) << 27) + next(27)) / (double) (1L << 53); } MultiplyWithCarryGenerateRandom(final long seed); MultiplyWithCarryGenerateRandom(); MultiplyWithCarryGenerateRandom(long[] seeds, final long carry, f... | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public double nextDouble() { return (((long) next(26) << 27) + next(27)) / (double) (1L << 53); } MultiplyWithCarryGenerateRandom(final long seed); MultiplyWithCarryGenerateRandom(); MultiplyWithCarryGenerateRandom(long[] seeds, final long carry, f... | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public double nextDouble() { return (((long) next(26) << 27) + next(27)) / (double) (1L << 53); } MultiplyWithCarryGenerateRandom(final long seed); MultiplyWithCarryGenerateRandom(); MultiplyWithCarryGenerateRandom(long[] seeds, final long carry, f... |
@Test public void testDouble() { final MultiplyWithCarryGenerateRandom rnd = new MultiplyWithCarryGenerateRandom(1); for (final double aDOUBLE_TEST : DOUBLE_TEST) { final double g = rnd.nextDouble(); assertEquals(g, aDOUBLE_TEST, AIFH.DEFAULT_PRECISION); } } | @Override public double nextDouble() { return (((long) next(26) << 27) + next(27)) / (double) (1L << 53); } | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public double nextDouble() { return (((long) next(26) << 27) + next(27)) / (double) (1L << 53); } } | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public double nextDouble() { return (((long) next(26) << 27) + next(27)) / (double) (1L << 53); } MultiplyWithCarryGenerateRandom(final long seed); MultiplyWithCarryGenerateRandom(); MultiplyWithCarryGenerateRandom(long[] seeds, final long carry, f... | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public double nextDouble() { return (((long) next(26) << 27) + next(27)) / (double) (1L << 53); } MultiplyWithCarryGenerateRandom(final long seed); MultiplyWithCarryGenerateRandom(); MultiplyWithCarryGenerateRandom(long[] seeds, final long carry, f... | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public double nextDouble() { return (((long) next(26) << 27) + next(27)) / (double) (1L << 53); } MultiplyWithCarryGenerateRandom(final long seed); MultiplyWithCarryGenerateRandom(); MultiplyWithCarryGenerateRandom(long[] seeds, final long carry, f... |
@Test public void testLong() { final MultiplyWithCarryGenerateRandom rnd = new MultiplyWithCarryGenerateRandom(1); for (final long aLONG_TEST : LONG_TEST) { final long l = rnd.nextLong(); assertEquals(l, aLONG_TEST); } } | @Override public long nextLong() { return ((long) next(32) << 32) + next(32); } | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public long nextLong() { return ((long) next(32) << 32) + next(32); } } | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public long nextLong() { return ((long) next(32) << 32) + next(32); } MultiplyWithCarryGenerateRandom(final long seed); MultiplyWithCarryGenerateRandom(); MultiplyWithCarryGenerateRandom(long[] seeds, final long carry, final int r, final long multi... | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public long nextLong() { return ((long) next(32) << 32) + next(32); } MultiplyWithCarryGenerateRandom(final long seed); MultiplyWithCarryGenerateRandom(); MultiplyWithCarryGenerateRandom(long[] seeds, final long carry, final int r, final long multi... | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public long nextLong() { return ((long) next(32) << 32) + next(32); } MultiplyWithCarryGenerateRandom(final long seed); MultiplyWithCarryGenerateRandom(); MultiplyWithCarryGenerateRandom(long[] seeds, final long carry, final int r, final long multi... |
@Test public void testFloat() { final MultiplyWithCarryGenerateRandom rnd = new MultiplyWithCarryGenerateRandom(1); for (final float aFLOAT_TEST : FLOAT_TEST) { final float l = (float) rnd.nextFloat(); assertEquals(l, aFLOAT_TEST, AIFH.DEFAULT_PRECISION); } } | @Override public float nextFloat() { return (float) nextDouble(); } | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public float nextFloat() { return (float) nextDouble(); } } | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public float nextFloat() { return (float) nextDouble(); } MultiplyWithCarryGenerateRandom(final long seed); MultiplyWithCarryGenerateRandom(); MultiplyWithCarryGenerateRandom(long[] seeds, final long carry, final int r, final long multiplier); } | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public float nextFloat() { return (float) nextDouble(); } MultiplyWithCarryGenerateRandom(final long seed); MultiplyWithCarryGenerateRandom(); MultiplyWithCarryGenerateRandom(long[] seeds, final long carry, final int r, final long multiplier); @Ove... | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public float nextFloat() { return (float) nextDouble(); } MultiplyWithCarryGenerateRandom(final long seed); MultiplyWithCarryGenerateRandom(); MultiplyWithCarryGenerateRandom(long[] seeds, final long carry, final int r, final long multiplier); @Ove... |
@Test public void testInt() { final MultiplyWithCarryGenerateRandom rnd = new MultiplyWithCarryGenerateRandom(1); for (final int aINT_TEST : INT_TEST) { final int g = rnd.nextInt(); assertEquals(g, aINT_TEST); } } | @Override public int nextInt() { return (int) nextLong(); } | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public int nextInt() { return (int) nextLong(); } } | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public int nextInt() { return (int) nextLong(); } MultiplyWithCarryGenerateRandom(final long seed); MultiplyWithCarryGenerateRandom(); MultiplyWithCarryGenerateRandom(long[] seeds, final long carry, final int r, final long multiplier); } | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public int nextInt() { return (int) nextLong(); } MultiplyWithCarryGenerateRandom(final long seed); MultiplyWithCarryGenerateRandom(); MultiplyWithCarryGenerateRandom(long[] seeds, final long carry, final int r, final long multiplier); @Override do... | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public int nextInt() { return (int) nextLong(); } MultiplyWithCarryGenerateRandom(final long seed); MultiplyWithCarryGenerateRandom(); MultiplyWithCarryGenerateRandom(long[] seeds, final long carry, final int r, final long multiplier); @Override do... |
@Test public void testIntRange() { final MultiplyWithCarryGenerateRandom rnd = new MultiplyWithCarryGenerateRandom(1); for (final int aINT_RANGE_TEST : INT_RANGE_TEST) { final int g = rnd.nextInt(0, 10); assertEquals(g, aINT_RANGE_TEST); } } | @Override public int nextInt() { return (int) nextLong(); } | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public int nextInt() { return (int) nextLong(); } } | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public int nextInt() { return (int) nextLong(); } MultiplyWithCarryGenerateRandom(final long seed); MultiplyWithCarryGenerateRandom(); MultiplyWithCarryGenerateRandom(long[] seeds, final long carry, final int r, final long multiplier); } | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public int nextInt() { return (int) nextLong(); } MultiplyWithCarryGenerateRandom(final long seed); MultiplyWithCarryGenerateRandom(); MultiplyWithCarryGenerateRandom(long[] seeds, final long carry, final int r, final long multiplier); @Override do... | MultiplyWithCarryGenerateRandom extends AbstractBoxMuller { @Override public int nextInt() { return (int) nextLong(); } MultiplyWithCarryGenerateRandom(final long seed); MultiplyWithCarryGenerateRandom(); MultiplyWithCarryGenerateRandom(long[] seeds, final long carry, final int r, final long multiplier); @Override do... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.