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 public void testIsCountryValid() throws Exception { final PhoneNumber validPhoneNumber = new PhoneNumber("", PhoneTestConstants.US_ISO2, PhoneTestConstants.US_COUNTRY_CODE); assertTrue(PhoneNumber.isCountryValid(validPhoneNumber)); } | public static boolean isCountryValid(PhoneNumber phoneNumber) { return phoneNumber != null && !EMPTY_PHONE_NUMBER.equals(phoneNumber) && !TextUtils .isEmpty(phoneNumber.getCountryCode()) && !TextUtils.isEmpty(phoneNumber .getCountryIso()); } | PhoneNumber { public static boolean isCountryValid(PhoneNumber phoneNumber) { return phoneNumber != null && !EMPTY_PHONE_NUMBER.equals(phoneNumber) && !TextUtils .isEmpty(phoneNumber.getCountryCode()) && !TextUtils.isEmpty(phoneNumber .getCountryIso()); } } | PhoneNumber { public static boolean isCountryValid(PhoneNumber phoneNumber) { return phoneNumber != null && !EMPTY_PHONE_NUMBER.equals(phoneNumber) && !TextUtils .isEmpty(phoneNumber.getCountryCode()) && !TextUtils.isEmpty(phoneNumber .getCountryIso()); } PhoneNumber(String phoneNumber, String countryIso, String countr... | PhoneNumber { public static boolean isCountryValid(PhoneNumber phoneNumber) { return phoneNumber != null && !EMPTY_PHONE_NUMBER.equals(phoneNumber) && !TextUtils .isEmpty(phoneNumber.getCountryCode()) && !TextUtils.isEmpty(phoneNumber .getCountryIso()); } PhoneNumber(String phoneNumber, String countryIso, String countr... | PhoneNumber { public static boolean isCountryValid(PhoneNumber phoneNumber) { return phoneNumber != null && !EMPTY_PHONE_NUMBER.equals(phoneNumber) && !TextUtils .isEmpty(phoneNumber.getCountryCode()) && !TextUtils.isEmpty(phoneNumber .getCountryIso()); } PhoneNumber(String phoneNumber, String countryIso, String countr... |
@Test public void testTextChange_empty() { textChangeListener.onTextChanged("------", anyInt, anyInt, anyInt); testListener(editText, "------", 0, false); } | @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Math.min(numericContents.length(), expectedContentLeng... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... |
@Test public void testTextChange_atIndex0() { textChangeListener.onTextChanged("1------", anyInt, anyInt, anyInt); testListener(editText, "1-----", 1, false); } | @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Math.min(numericContents.length(), expectedContentLeng... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... |
@Test public void testTextChange_atIndex1() { textChangeListener.onTextChanged("12-----", anyInt, anyInt, anyInt); testListener(editText, "12----", 2, false); } | @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Math.min(numericContents.length(), expectedContentLeng... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... |
@Test public void testTextChange_atIndex5() { textChangeListener.onTextChanged("123456-", anyInt, anyInt, anyInt); testListener(editText, "123456", 6, true); } | @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Math.min(numericContents.length(), expectedContentLeng... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... |
@Test @Config(shadows = {BaseHelperShadow.class, ActivityHelperShadow.class}) public void testSignUpButton_successfulRegistrationShouldContinueToSaveCredentials() { new BaseHelperShadow(); reset(BaseHelperShadow.sSaveSmartLock); TestHelper.initializeApp(RuntimeEnvironment.application); RegisterEmailActivity registerEma... | @Override public void onNewUser(User user) { TextInputLayout emailLayout = (TextInputLayout) findViewById(R.id.email_layout); if (mActivityHelper.getFlowParams().allowNewEmailAccounts) { RegisterEmailFragment fragment = RegisterEmailFragment.newInstance( mActivityHelper.getFlowParams(), user); FragmentTransaction ft = ... | RegisterEmailActivity extends AppCompatBase implements
CheckEmailFragment.CheckEmailListener { @Override public void onNewUser(User user) { TextInputLayout emailLayout = (TextInputLayout) findViewById(R.id.email_layout); if (mActivityHelper.getFlowParams().allowNewEmailAccounts) { RegisterEmailFragment fragment... | RegisterEmailActivity extends AppCompatBase implements
CheckEmailFragment.CheckEmailListener { @Override public void onNewUser(User user) { TextInputLayout emailLayout = (TextInputLayout) findViewById(R.id.email_layout); if (mActivityHelper.getFlowParams().allowNewEmailAccounts) { RegisterEmailFragment fragment... | RegisterEmailActivity extends AppCompatBase implements
CheckEmailFragment.CheckEmailListener { @Override public void onNewUser(User user) { TextInputLayout emailLayout = (TextInputLayout) findViewById(R.id.email_layout); if (mActivityHelper.getFlowParams().allowNewEmailAccounts) { RegisterEmailFragment fragment... | RegisterEmailActivity extends AppCompatBase implements
CheckEmailFragment.CheckEmailListener { @Override public void onNewUser(User user) { TextInputLayout emailLayout = (TextInputLayout) findViewById(R.id.email_layout); if (mActivityHelper.getFlowParams().allowNewEmailAccounts) { RegisterEmailFragment fragment... |
@Test public void testTextChange_exceedingMaxLength() { textChangeListener.onTextChanged("1234567", anyInt, anyInt, anyInt); testListener(editText, "123456", 6, true); } | @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Math.min(numericContents.length(), expectedContentLeng... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... |
@Test public void testTextChange_onClear() { textChangeListener.onTextChanged("", anyInt, anyInt, anyInt); testListener(editText, "------", 0, false); } | @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Math.min(numericContents.length(), expectedContentLeng... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... |
@Test public void testTextChange_onPartialClear() { textChangeListener.onTextChanged("123", anyInt, anyInt, anyInt); testListener(editText, "123---", 3, false); } | @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Math.min(numericContents.length(), expectedContentLeng... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... |
@Test public void testTextChange_onIncorrectInsertion() { textChangeListener.onTextChanged("1--3--", anyInt, anyInt, anyInt); testListener(editText, "13----", 2, false); } | @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Math.min(numericContents.length(), expectedContentLeng... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... | BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredContentLength = Ma... |
@Test public void testSpacedEditText_setTextEmpty() throws Exception { spacedEditText.setText(""); testSpacing("", "", spacedEditText); } | @Override public void setText(CharSequence text, BufferType type) { originalText = new SpannableStringBuilder(text); final SpannableStringBuilder spacedOutString = getSpacedOutString(text); super.setText(spacedOutString, BufferType.SPANNABLE); } | SpacedEditText extends AppCompatEditText { @Override public void setText(CharSequence text, BufferType type) { originalText = new SpannableStringBuilder(text); final SpannableStringBuilder spacedOutString = getSpacedOutString(text); super.setText(spacedOutString, BufferType.SPANNABLE); } } | SpacedEditText extends AppCompatEditText { @Override public void setText(CharSequence text, BufferType type) { originalText = new SpannableStringBuilder(text); final SpannableStringBuilder spacedOutString = getSpacedOutString(text); super.setText(spacedOutString, BufferType.SPANNABLE); } SpacedEditText(Context context)... | SpacedEditText extends AppCompatEditText { @Override public void setText(CharSequence text, BufferType type) { originalText = new SpannableStringBuilder(text); final SpannableStringBuilder spacedOutString = getSpacedOutString(text); super.setText(spacedOutString, BufferType.SPANNABLE); } SpacedEditText(Context context)... | SpacedEditText extends AppCompatEditText { @Override public void setText(CharSequence text, BufferType type) { originalText = new SpannableStringBuilder(text); final SpannableStringBuilder spacedOutString = getSpacedOutString(text); super.setText(spacedOutString, BufferType.SPANNABLE); } SpacedEditText(Context context)... |
@Test public void testSpacedEditText_setTextNonEmpty() throws Exception { spacedEditText.setText("123456"); testSpacing("1 2 3 4 5 6", "123456", spacedEditText); } | @Override public void setText(CharSequence text, BufferType type) { originalText = new SpannableStringBuilder(text); final SpannableStringBuilder spacedOutString = getSpacedOutString(text); super.setText(spacedOutString, BufferType.SPANNABLE); } | SpacedEditText extends AppCompatEditText { @Override public void setText(CharSequence text, BufferType type) { originalText = new SpannableStringBuilder(text); final SpannableStringBuilder spacedOutString = getSpacedOutString(text); super.setText(spacedOutString, BufferType.SPANNABLE); } } | SpacedEditText extends AppCompatEditText { @Override public void setText(CharSequence text, BufferType type) { originalText = new SpannableStringBuilder(text); final SpannableStringBuilder spacedOutString = getSpacedOutString(text); super.setText(spacedOutString, BufferType.SPANNABLE); } SpacedEditText(Context context)... | SpacedEditText extends AppCompatEditText { @Override public void setText(CharSequence text, BufferType type) { originalText = new SpannableStringBuilder(text); final SpannableStringBuilder spacedOutString = getSpacedOutString(text); super.setText(spacedOutString, BufferType.SPANNABLE); } SpacedEditText(Context context)... | SpacedEditText extends AppCompatEditText { @Override public void setText(CharSequence text, BufferType type) { originalText = new SpannableStringBuilder(text); final SpannableStringBuilder spacedOutString = getSpacedOutString(text); super.setText(spacedOutString, BufferType.SPANNABLE); } SpacedEditText(Context context)... |
@Test public void testSpacedEditText_setTextWithOneCharacter() throws Exception { spacedEditText.setText("1"); testSpacing("1", "1", spacedEditText); } | @Override public void setText(CharSequence text, BufferType type) { originalText = new SpannableStringBuilder(text); final SpannableStringBuilder spacedOutString = getSpacedOutString(text); super.setText(spacedOutString, BufferType.SPANNABLE); } | SpacedEditText extends AppCompatEditText { @Override public void setText(CharSequence text, BufferType type) { originalText = new SpannableStringBuilder(text); final SpannableStringBuilder spacedOutString = getSpacedOutString(text); super.setText(spacedOutString, BufferType.SPANNABLE); } } | SpacedEditText extends AppCompatEditText { @Override public void setText(CharSequence text, BufferType type) { originalText = new SpannableStringBuilder(text); final SpannableStringBuilder spacedOutString = getSpacedOutString(text); super.setText(spacedOutString, BufferType.SPANNABLE); } SpacedEditText(Context context)... | SpacedEditText extends AppCompatEditText { @Override public void setText(CharSequence text, BufferType type) { originalText = new SpannableStringBuilder(text); final SpannableStringBuilder spacedOutString = getSpacedOutString(text); super.setText(spacedOutString, BufferType.SPANNABLE); } SpacedEditText(Context context)... | SpacedEditText extends AppCompatEditText { @Override public void setText(CharSequence text, BufferType type) { originalText = new SpannableStringBuilder(text); final SpannableStringBuilder spacedOutString = getSpacedOutString(text); super.setText(spacedOutString, BufferType.SPANNABLE); } SpacedEditText(Context context)... |
@Test public void testSpacedEditText_setTextWithExistingSpaces() throws Exception { spacedEditText.setText("1 2 3"); testSpacing("1 2 3", "1 2 3", spacedEditText); } | @Override public void setText(CharSequence text, BufferType type) { originalText = new SpannableStringBuilder(text); final SpannableStringBuilder spacedOutString = getSpacedOutString(text); super.setText(spacedOutString, BufferType.SPANNABLE); } | SpacedEditText extends AppCompatEditText { @Override public void setText(CharSequence text, BufferType type) { originalText = new SpannableStringBuilder(text); final SpannableStringBuilder spacedOutString = getSpacedOutString(text); super.setText(spacedOutString, BufferType.SPANNABLE); } } | SpacedEditText extends AppCompatEditText { @Override public void setText(CharSequence text, BufferType type) { originalText = new SpannableStringBuilder(text); final SpannableStringBuilder spacedOutString = getSpacedOutString(text); super.setText(spacedOutString, BufferType.SPANNABLE); } SpacedEditText(Context context)... | SpacedEditText extends AppCompatEditText { @Override public void setText(CharSequence text, BufferType type) { originalText = new SpannableStringBuilder(text); final SpannableStringBuilder spacedOutString = getSpacedOutString(text); super.setText(spacedOutString, BufferType.SPANNABLE); } SpacedEditText(Context context)... | SpacedEditText extends AppCompatEditText { @Override public void setText(CharSequence text, BufferType type) { originalText = new SpannableStringBuilder(text); final SpannableStringBuilder spacedOutString = getSpacedOutString(text); super.setText(spacedOutString, BufferType.SPANNABLE); } SpacedEditText(Context context)... |
@Test public void testPhoneNumberFromSmartlock_prePopulatesPhoneNumberInBundle() { Intent startIntent = PhoneVerificationActivity.createIntent(RuntimeEnvironment .application, TestHelper.getFlowParameters(Collections.singletonList(AuthUI .PHONE_VERIFICATION_PROVIDER)), YE_RAW_PHONE); mActivity = Robolectric.buildActivi... | public static Intent createIntent(Context context, FlowParameters flowParams, String phone) { return BaseHelper.createBaseIntent(context, PhoneVerificationActivity.class, flowParams) .putExtra(ExtraConstants.EXTRA_PHONE, phone); } | PhoneVerificationActivity extends AppCompatBase { public static Intent createIntent(Context context, FlowParameters flowParams, String phone) { return BaseHelper.createBaseIntent(context, PhoneVerificationActivity.class, flowParams) .putExtra(ExtraConstants.EXTRA_PHONE, phone); } } | PhoneVerificationActivity extends AppCompatBase { public static Intent createIntent(Context context, FlowParameters flowParams, String phone) { return BaseHelper.createBaseIntent(context, PhoneVerificationActivity.class, flowParams) .putExtra(ExtraConstants.EXTRA_PHONE, phone); } } | PhoneVerificationActivity extends AppCompatBase { public static Intent createIntent(Context context, FlowParameters flowParams, String phone) { return BaseHelper.createBaseIntent(context, PhoneVerificationActivity.class, flowParams) .putExtra(ExtraConstants.EXTRA_PHONE, phone); } static Intent createIntent(Context con... | PhoneVerificationActivity extends AppCompatBase { public static Intent createIntent(Context context, FlowParameters flowParams, String phone) { return BaseHelper.createBaseIntent(context, PhoneVerificationActivity.class, flowParams) .putExtra(ExtraConstants.EXTRA_PHONE, phone); } static Intent createIntent(Context con... |
@Test @Config(shadows = {BaseHelperShadow.class, ActivityHelperShadow.class}) public void testSubmitCode_badCodeShowsAlertDialog() { reset(BaseHelperShadow.sPhoneAuthProvider); when(ActivityHelperShadow.sFirebaseAuth.signInWithCredential(any(AuthCredential.class))) .thenReturn(new AutoCompleteTask<AuthResult>(null, tru... | @VisibleForTesting(otherwise = VisibleForTesting.NONE) protected AlertDialog getAlertDialog() { return mAlertDialog; } | PhoneVerificationActivity extends AppCompatBase { @VisibleForTesting(otherwise = VisibleForTesting.NONE) protected AlertDialog getAlertDialog() { return mAlertDialog; } } | PhoneVerificationActivity extends AppCompatBase { @VisibleForTesting(otherwise = VisibleForTesting.NONE) protected AlertDialog getAlertDialog() { return mAlertDialog; } } | PhoneVerificationActivity extends AppCompatBase { @VisibleForTesting(otherwise = VisibleForTesting.NONE) protected AlertDialog getAlertDialog() { return mAlertDialog; } static Intent createIntent(Context context, FlowParameters flowParams, String phone); @Override void onBackPressed(); void submitConfirmationCode(Stri... | PhoneVerificationActivity extends AppCompatBase { @VisibleForTesting(otherwise = VisibleForTesting.NONE) protected AlertDialog getAlertDialog() { return mAlertDialog; } static Intent createIntent(Context context, FlowParameters flowParams, String phone); @Override void onBackPressed(); void submitConfirmationCode(Stri... |
@Test @Config(shadows = {BaseHelperShadow.class}) public void testSignInSucceeded() { AppCompatBase mockActivity = mock(AppCompatBase.class); ActivityHelper mockActivityHelper = mock(ActivityHelper.class); IdpResponse idpResponse = new IdpResponse.Builder(GoogleAuthProvider.PROVIDER_ID, TestConstants.EMAIL) .setToken(T... | @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { FirebaseUser firebaseUser = task.getResult().getUser(); mHelper.saveCredentialsOrFinish( mSmartLock, mActivity, firebaseUser, null, mResponse); } else { if (task.getException() instanceof FirebaseAuthUserCollisionException) { ... | CredentialSignInHandler implements OnCompleteListener<AuthResult> { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { FirebaseUser firebaseUser = task.getResult().getUser(); mHelper.saveCredentialsOrFinish( mSmartLock, mActivity, firebaseUser, null, mResponse); } else { if (t... | CredentialSignInHandler implements OnCompleteListener<AuthResult> { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { FirebaseUser firebaseUser = task.getResult().getUser(); mHelper.saveCredentialsOrFinish( mSmartLock, mActivity, firebaseUser, null, mResponse); } else { if (t... | CredentialSignInHandler implements OnCompleteListener<AuthResult> { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { FirebaseUser firebaseUser = task.getResult().getUser(); mHelper.saveCredentialsOrFinish( mSmartLock, mActivity, firebaseUser, null, mResponse); } else { if (t... | CredentialSignInHandler implements OnCompleteListener<AuthResult> { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { FirebaseUser firebaseUser = task.getResult().getUser(); mHelper.saveCredentialsOrFinish( mSmartLock, mActivity, firebaseUser, null, mResponse); } else { if (t... |
@Test @Config(shadows = {BaseHelperShadow.class, ActivityHelperShadow.class}) public void testresendCode_invokesUpstream() { reset(BaseHelperShadow.sPhoneAuthProvider); testSendConfirmationCode(); TextView r = (TextView) mActivity.findViewById(R.id.resend_code); assertEquals(View.GONE, r.getVisibility()); SubmitConfirm... | void verifyPhoneNumber(String phoneNumber, boolean forceResend) { sendCode(phoneNumber, forceResend); if (forceResend) { showLoadingDialog(getString(R.string.resending)); } else { showLoadingDialog(getString(R.string.verifying)); } } | PhoneVerificationActivity extends AppCompatBase { void verifyPhoneNumber(String phoneNumber, boolean forceResend) { sendCode(phoneNumber, forceResend); if (forceResend) { showLoadingDialog(getString(R.string.resending)); } else { showLoadingDialog(getString(R.string.verifying)); } } } | PhoneVerificationActivity extends AppCompatBase { void verifyPhoneNumber(String phoneNumber, boolean forceResend) { sendCode(phoneNumber, forceResend); if (forceResend) { showLoadingDialog(getString(R.string.resending)); } else { showLoadingDialog(getString(R.string.verifying)); } } } | PhoneVerificationActivity extends AppCompatBase { void verifyPhoneNumber(String phoneNumber, boolean forceResend) { sendCode(phoneNumber, forceResend); if (forceResend) { showLoadingDialog(getString(R.string.resending)); } else { showLoadingDialog(getString(R.string.verifying)); } } static Intent createIntent(Context ... | PhoneVerificationActivity extends AppCompatBase { void verifyPhoneNumber(String phoneNumber, boolean forceResend) { sendCode(phoneNumber, forceResend); if (forceResend) { showLoadingDialog(getString(R.string.resending)); } else { showLoadingDialog(getString(R.string.verifying)); } } static Intent createIntent(Context ... |
@Test @Config(shadows = {BaseHelperShadow.class, ActivityHelperShadow.class}) public void testAutoVerify() { reset(BaseHelperShadow.sPhoneAuthProvider); reset(BaseHelperShadow.sSaveSmartLock); reset(BaseHelperShadow.sFirebaseAuth); when(BaseHelperShadow.sFirebaseUser.getPhoneNumber()).thenReturn(PHONE); when(BaseHelper... | void verifyPhoneNumber(String phoneNumber, boolean forceResend) { sendCode(phoneNumber, forceResend); if (forceResend) { showLoadingDialog(getString(R.string.resending)); } else { showLoadingDialog(getString(R.string.verifying)); } } | PhoneVerificationActivity extends AppCompatBase { void verifyPhoneNumber(String phoneNumber, boolean forceResend) { sendCode(phoneNumber, forceResend); if (forceResend) { showLoadingDialog(getString(R.string.resending)); } else { showLoadingDialog(getString(R.string.verifying)); } } } | PhoneVerificationActivity extends AppCompatBase { void verifyPhoneNumber(String phoneNumber, boolean forceResend) { sendCode(phoneNumber, forceResend); if (forceResend) { showLoadingDialog(getString(R.string.resending)); } else { showLoadingDialog(getString(R.string.verifying)); } } } | PhoneVerificationActivity extends AppCompatBase { void verifyPhoneNumber(String phoneNumber, boolean forceResend) { sendCode(phoneNumber, forceResend); if (forceResend) { showLoadingDialog(getString(R.string.resending)); } else { showLoadingDialog(getString(R.string.verifying)); } } static Intent createIntent(Context ... | PhoneVerificationActivity extends AppCompatBase { void verifyPhoneNumber(String phoneNumber, boolean forceResend) { sendCode(phoneNumber, forceResend); if (forceResend) { showLoadingDialog(getString(R.string.resending)); } else { showLoadingDialog(getString(R.string.verifying)); } } static Intent createIntent(Context ... |
@Test public void testSignInFailed_withFacebookAlreadyLinked() { AppCompatBase mockActivity = mock(AppCompatBase.class); ActivityHelper mockActivityHelper = mock(ActivityHelper.class); FirebaseAuth mockFirebaseAuth = mock(FirebaseAuth.class); IdpResponse idpResponse = new IdpResponse.Builder(GoogleAuthProvider.PROVIDER... | @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { FirebaseUser firebaseUser = task.getResult().getUser(); mHelper.saveCredentialsOrFinish( mSmartLock, mActivity, firebaseUser, null, mResponse); } else { if (task.getException() instanceof FirebaseAuthUserCollisionException) { ... | CredentialSignInHandler implements OnCompleteListener<AuthResult> { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { FirebaseUser firebaseUser = task.getResult().getUser(); mHelper.saveCredentialsOrFinish( mSmartLock, mActivity, firebaseUser, null, mResponse); } else { if (t... | CredentialSignInHandler implements OnCompleteListener<AuthResult> { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { FirebaseUser firebaseUser = task.getResult().getUser(); mHelper.saveCredentialsOrFinish( mSmartLock, mActivity, firebaseUser, null, mResponse); } else { if (t... | CredentialSignInHandler implements OnCompleteListener<AuthResult> { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { FirebaseUser firebaseUser = task.getResult().getUser(); mHelper.saveCredentialsOrFinish( mSmartLock, mActivity, firebaseUser, null, mResponse); } else { if (t... | CredentialSignInHandler implements OnCompleteListener<AuthResult> { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { FirebaseUser firebaseUser = task.getResult().getUser(); mHelper.saveCredentialsOrFinish( mSmartLock, mActivity, firebaseUser, null, mResponse); } else { if (t... |
@Test public void testSignInFailed_withPasswordAccountAlreadyLinked() { AppCompatBase mockActivity = mock(AppCompatBase.class); ActivityHelper mockActivityHelper = mock(ActivityHelper.class); FirebaseAuth mockFirebaseAuth = mock(FirebaseAuth.class); IdpResponse idpResponse = new IdpResponse.Builder(GoogleAuthProvider.P... | @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { FirebaseUser firebaseUser = task.getResult().getUser(); mHelper.saveCredentialsOrFinish( mSmartLock, mActivity, firebaseUser, null, mResponse); } else { if (task.getException() instanceof FirebaseAuthUserCollisionException) { ... | CredentialSignInHandler implements OnCompleteListener<AuthResult> { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { FirebaseUser firebaseUser = task.getResult().getUser(); mHelper.saveCredentialsOrFinish( mSmartLock, mActivity, firebaseUser, null, mResponse); } else { if (t... | CredentialSignInHandler implements OnCompleteListener<AuthResult> { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { FirebaseUser firebaseUser = task.getResult().getUser(); mHelper.saveCredentialsOrFinish( mSmartLock, mActivity, firebaseUser, null, mResponse); } else { if (t... | CredentialSignInHandler implements OnCompleteListener<AuthResult> { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { FirebaseUser firebaseUser = task.getResult().getUser(); mHelper.saveCredentialsOrFinish( mSmartLock, mActivity, firebaseUser, null, mResponse); } else { if (t... | CredentialSignInHandler implements OnCompleteListener<AuthResult> { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { FirebaseUser firebaseUser = task.getResult().getUser(); mHelper.saveCredentialsOrFinish( mSmartLock, mActivity, firebaseUser, null, mResponse); } else { if (t... |
@Test public void testGetPhoneNumber() throws Exception { final PhoneNumber number = getPhoneNumber(RAW_PHONE); assertEquals(PhoneTestConstants.PHONE_NO_COUNTRY_CODE, number.getPhoneNumber()); assertEquals(PhoneTestConstants.US_COUNTRY_CODE, number.getCountryCode()); assertEquals(PhoneTestConstants.US_ISO2, number.getC... | protected static PhoneNumber getPhoneNumber(@NonNull String providedPhoneNumber) { String countryCode = DEFAULT_COUNTRY_CODE; String countryIso = DEFAULT_LOCALE.getCountry(); String phoneNumber = providedPhoneNumber; if (providedPhoneNumber.startsWith("+")) { countryCode = countryCodeForPhoneNumber(providedPhoneNumber)... | PhoneNumberUtils { protected static PhoneNumber getPhoneNumber(@NonNull String providedPhoneNumber) { String countryCode = DEFAULT_COUNTRY_CODE; String countryIso = DEFAULT_LOCALE.getCountry(); String phoneNumber = providedPhoneNumber; if (providedPhoneNumber.startsWith("+")) { countryCode = countryCodeForPhoneNumber(p... | PhoneNumberUtils { protected static PhoneNumber getPhoneNumber(@NonNull String providedPhoneNumber) { String countryCode = DEFAULT_COUNTRY_CODE; String countryIso = DEFAULT_LOCALE.getCountry(); String phoneNumber = providedPhoneNumber; if (providedPhoneNumber.startsWith("+")) { countryCode = countryCodeForPhoneNumber(p... | PhoneNumberUtils { protected static PhoneNumber getPhoneNumber(@NonNull String providedPhoneNumber) { String countryCode = DEFAULT_COUNTRY_CODE; String countryIso = DEFAULT_LOCALE.getCountry(); String phoneNumber = providedPhoneNumber; if (providedPhoneNumber.startsWith("+")) { countryCode = countryCodeForPhoneNumber(p... | PhoneNumberUtils { protected static PhoneNumber getPhoneNumber(@NonNull String providedPhoneNumber) { String countryCode = DEFAULT_COUNTRY_CODE; String countryIso = DEFAULT_LOCALE.getCountry(); String phoneNumber = providedPhoneNumber; if (providedPhoneNumber.startsWith("+")) { countryCode = countryCodeForPhoneNumber(p... |
@Test public void testGetCountryCode() throws Exception { assertEquals(new Integer(86), getCountryCode(Locale.CHINA.getCountry())); assertEquals(null, getCountryCode(null)); assertEquals(null, getCountryCode(new Locale("", "DJJZ").getCountry())); } | @Nullable public static Integer getCountryCode(String countryIso) { return countryIso == null ? null : CountryCodeByIsoMap.get(countryIso.toUpperCase(Locale.getDefault())); } | PhoneNumberUtils { @Nullable public static Integer getCountryCode(String countryIso) { return countryIso == null ? null : CountryCodeByIsoMap.get(countryIso.toUpperCase(Locale.getDefault())); } } | PhoneNumberUtils { @Nullable public static Integer getCountryCode(String countryIso) { return countryIso == null ? null : CountryCodeByIsoMap.get(countryIso.toUpperCase(Locale.getDefault())); } } | PhoneNumberUtils { @Nullable public static Integer getCountryCode(String countryIso) { return countryIso == null ? null : CountryCodeByIsoMap.get(countryIso.toUpperCase(Locale.getDefault())); } @Nullable static Integer getCountryCode(String countryIso); } | PhoneNumberUtils { @Nullable public static Integer getCountryCode(String countryIso) { return countryIso == null ? null : CountryCodeByIsoMap.get(countryIso.toUpperCase(Locale.getDefault())); } @Nullable static Integer getCountryCode(String countryIso); } |
@Test @Config(constants = BuildConfig.class, sdk = 21) public void testFormatNumberToE164_aboveApi21() { String validPhoneNumber = "+919994947354"; CountryInfo indiaCountryInfo = new CountryInfo(new Locale("", "IN"), 91); assertEquals(validPhoneNumber, formatPhoneNumber("9994947354", indiaCountryInfo)); assertEquals(va... | @Nullable static String formatPhoneNumber(@NonNull String phoneNumber, @NonNull CountryInfo countryInfo) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return android.telephony.PhoneNumberUtils .formatNumberToE164(phoneNumber, countryInfo.locale.getCountry()); } return phoneNumber.startsWith("+") ? phon... | PhoneNumberUtils { @Nullable static String formatPhoneNumber(@NonNull String phoneNumber, @NonNull CountryInfo countryInfo) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return android.telephony.PhoneNumberUtils .formatNumberToE164(phoneNumber, countryInfo.locale.getCountry()); } return phoneNumber.sta... | PhoneNumberUtils { @Nullable static String formatPhoneNumber(@NonNull String phoneNumber, @NonNull CountryInfo countryInfo) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return android.telephony.PhoneNumberUtils .formatNumberToE164(phoneNumber, countryInfo.locale.getCountry()); } return phoneNumber.sta... | PhoneNumberUtils { @Nullable static String formatPhoneNumber(@NonNull String phoneNumber, @NonNull CountryInfo countryInfo) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return android.telephony.PhoneNumberUtils .formatNumberToE164(phoneNumber, countryInfo.locale.getCountry()); } return phoneNumber.sta... | PhoneNumberUtils { @Nullable static String formatPhoneNumber(@NonNull String phoneNumber, @NonNull CountryInfo countryInfo) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return android.telephony.PhoneNumberUtils .formatNumberToE164(phoneNumber, countryInfo.locale.getCountry()); } return phoneNumber.sta... |
@Test @Config(constants = BuildConfig.class, sdk = 16) public void testFormatNumberToE164_belowApi21() { String validPhoneNumber = "+919994947354"; CountryInfo indiaCountryInfo = new CountryInfo(new Locale("", "IN"), 91); assertEquals(validPhoneNumber, formatPhoneNumber("9994947354", indiaCountryInfo)); assertEquals(va... | @Nullable static String formatPhoneNumber(@NonNull String phoneNumber, @NonNull CountryInfo countryInfo) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return android.telephony.PhoneNumberUtils .formatNumberToE164(phoneNumber, countryInfo.locale.getCountry()); } return phoneNumber.startsWith("+") ? phon... | PhoneNumberUtils { @Nullable static String formatPhoneNumber(@NonNull String phoneNumber, @NonNull CountryInfo countryInfo) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return android.telephony.PhoneNumberUtils .formatNumberToE164(phoneNumber, countryInfo.locale.getCountry()); } return phoneNumber.sta... | PhoneNumberUtils { @Nullable static String formatPhoneNumber(@NonNull String phoneNumber, @NonNull CountryInfo countryInfo) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return android.telephony.PhoneNumberUtils .formatNumberToE164(phoneNumber, countryInfo.locale.getCountry()); } return phoneNumber.sta... | PhoneNumberUtils { @Nullable static String formatPhoneNumber(@NonNull String phoneNumber, @NonNull CountryInfo countryInfo) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return android.telephony.PhoneNumberUtils .formatNumberToE164(phoneNumber, countryInfo.locale.getCountry()); } return phoneNumber.sta... | PhoneNumberUtils { @Nullable static String formatPhoneNumber(@NonNull String phoneNumber, @NonNull CountryInfo countryInfo) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return android.telephony.PhoneNumberUtils .formatNumberToE164(phoneNumber, countryInfo.locale.getCountry()); } return phoneNumber.sta... |
@Test public void testGetCurrentCountryInfo_fromSim() { Context context = mock(Context.class); TelephonyManager telephonyManager = mock(TelephonyManager.class); when(context.getSystemService(Context.TELEPHONY_SERVICE)).thenReturn(telephonyManager); when(telephonyManager.getSimCountryIso()).thenReturn("IN"); assertEqual... | @NonNull static CountryInfo getCurrentCountryInfo(@NonNull Context context) { Locale locale = getSimBasedLocale(context); if (locale == null) { locale = getOSLocale(); } if (locale == null) { return DEFAULT_COUNTRY; } Integer countryCode = PhoneNumberUtils.getCountryCode(locale.getCountry()); return countryCode == null... | PhoneNumberUtils { @NonNull static CountryInfo getCurrentCountryInfo(@NonNull Context context) { Locale locale = getSimBasedLocale(context); if (locale == null) { locale = getOSLocale(); } if (locale == null) { return DEFAULT_COUNTRY; } Integer countryCode = PhoneNumberUtils.getCountryCode(locale.getCountry()); return ... | PhoneNumberUtils { @NonNull static CountryInfo getCurrentCountryInfo(@NonNull Context context) { Locale locale = getSimBasedLocale(context); if (locale == null) { locale = getOSLocale(); } if (locale == null) { return DEFAULT_COUNTRY; } Integer countryCode = PhoneNumberUtils.getCountryCode(locale.getCountry()); return ... | PhoneNumberUtils { @NonNull static CountryInfo getCurrentCountryInfo(@NonNull Context context) { Locale locale = getSimBasedLocale(context); if (locale == null) { locale = getOSLocale(); } if (locale == null) { return DEFAULT_COUNTRY; } Integer countryCode = PhoneNumberUtils.getCountryCode(locale.getCountry()); return ... | PhoneNumberUtils { @NonNull static CountryInfo getCurrentCountryInfo(@NonNull Context context) { Locale locale = getSimBasedLocale(context); if (locale == null) { locale = getOSLocale(); } if (locale == null) { return DEFAULT_COUNTRY; } Integer countryCode = PhoneNumberUtils.getCountryCode(locale.getCountry()); return ... |
@Test public void loadTasks() { List<Task> tasks = fileTaskLoader.loadTasks(); Assert.assertEquals(1, tasks.size()); } | @Override public List<Task> loadTasks() { List<Task> tasks = new ArrayList<>(); File[] taskFiles = FileAccessSupport.getTaskFiles(DEFAULT_TASK_PATH); for (File taskFile : taskFiles) { Task task = FileParser.parseTask(taskFile, false); tasks.add(task); } return tasks; } | FileTaskAccessor implements TaskAccessor { @Override public List<Task> loadTasks() { List<Task> tasks = new ArrayList<>(); File[] taskFiles = FileAccessSupport.getTaskFiles(DEFAULT_TASK_PATH); for (File taskFile : taskFiles) { Task task = FileParser.parseTask(taskFile, false); tasks.add(task); } return tasks; } } | FileTaskAccessor implements TaskAccessor { @Override public List<Task> loadTasks() { List<Task> tasks = new ArrayList<>(); File[] taskFiles = FileAccessSupport.getTaskFiles(DEFAULT_TASK_PATH); for (File taskFile : taskFiles) { Task task = FileParser.parseTask(taskFile, false); tasks.add(task); } return tasks; } } | FileTaskAccessor implements TaskAccessor { @Override public List<Task> loadTasks() { List<Task> tasks = new ArrayList<>(); File[] taskFiles = FileAccessSupport.getTaskFiles(DEFAULT_TASK_PATH); for (File taskFile : taskFiles) { Task task = FileParser.parseTask(taskFile, false); tasks.add(task); } return tasks; } @Overr... | FileTaskAccessor implements TaskAccessor { @Override public List<Task> loadTasks() { List<Task> tasks = new ArrayList<>(); File[] taskFiles = FileAccessSupport.getTaskFiles(DEFAULT_TASK_PATH); for (File taskFile : taskFiles) { Task task = FileParser.parseTask(taskFile, false); tasks.add(task); } return tasks; } @Overr... |
@Test public void should_extract_request_field_descriptors() { RequestFieldsSnippet snippet = requestFields( fieldWithPath("object.field").description("Is documented!") ); List<FieldDescriptor> descriptors = extract(snippet); then(descriptors).hasSize(1); then(descriptors.get(0).getPath()).isEqualTo("object.field"); th... | public static List<FieldDescriptor> extract(AbstractFieldsSnippet snippet) { try { Method getFieldDescriptors = AbstractFieldsSnippet.class.getDeclaredMethod("getFieldDescriptors"); getFieldDescriptors.setAccessible(true); return (List<FieldDescriptor>) getFieldDescriptors.invoke(snippet); } catch (NoSuchMethodExceptio... | DescriptorExtractor { public static List<FieldDescriptor> extract(AbstractFieldsSnippet snippet) { try { Method getFieldDescriptors = AbstractFieldsSnippet.class.getDeclaredMethod("getFieldDescriptors"); getFieldDescriptors.setAccessible(true); return (List<FieldDescriptor>) getFieldDescriptors.invoke(snippet); } catch... | DescriptorExtractor { public static List<FieldDescriptor> extract(AbstractFieldsSnippet snippet) { try { Method getFieldDescriptors = AbstractFieldsSnippet.class.getDeclaredMethod("getFieldDescriptors"); getFieldDescriptors.setAccessible(true); return (List<FieldDescriptor>) getFieldDescriptors.invoke(snippet); } catch... | DescriptorExtractor { public static List<FieldDescriptor> extract(AbstractFieldsSnippet snippet) { try { Method getFieldDescriptors = AbstractFieldsSnippet.class.getDeclaredMethod("getFieldDescriptors"); getFieldDescriptors.setAccessible(true); return (List<FieldDescriptor>) getFieldDescriptors.invoke(snippet); } catch... | DescriptorExtractor { public static List<FieldDescriptor> extract(AbstractFieldsSnippet snippet) { try { Method getFieldDescriptors = AbstractFieldsSnippet.class.getDeclaredMethod("getFieldDescriptors"); getFieldDescriptors.setAccessible(true); return (List<FieldDescriptor>) getFieldDescriptors.invoke(snippet); } catch... |
@Test public void should_extract_response_field_descriptors() { ResponseFieldsSnippet snippet = responseFields( fieldWithPath("object.field").description("Is documented!"), fieldWithPath("object.anotherField").description("Is documented, too!") ); List<FieldDescriptor> descriptors = extract(snippet); then(descriptors).... | public static List<FieldDescriptor> extract(AbstractFieldsSnippet snippet) { try { Method getFieldDescriptors = AbstractFieldsSnippet.class.getDeclaredMethod("getFieldDescriptors"); getFieldDescriptors.setAccessible(true); return (List<FieldDescriptor>) getFieldDescriptors.invoke(snippet); } catch (NoSuchMethodExceptio... | DescriptorExtractor { public static List<FieldDescriptor> extract(AbstractFieldsSnippet snippet) { try { Method getFieldDescriptors = AbstractFieldsSnippet.class.getDeclaredMethod("getFieldDescriptors"); getFieldDescriptors.setAccessible(true); return (List<FieldDescriptor>) getFieldDescriptors.invoke(snippet); } catch... | DescriptorExtractor { public static List<FieldDescriptor> extract(AbstractFieldsSnippet snippet) { try { Method getFieldDescriptors = AbstractFieldsSnippet.class.getDeclaredMethod("getFieldDescriptors"); getFieldDescriptors.setAccessible(true); return (List<FieldDescriptor>) getFieldDescriptors.invoke(snippet); } catch... | DescriptorExtractor { public static List<FieldDescriptor> extract(AbstractFieldsSnippet snippet) { try { Method getFieldDescriptors = AbstractFieldsSnippet.class.getDeclaredMethod("getFieldDescriptors"); getFieldDescriptors.setAccessible(true); return (List<FieldDescriptor>) getFieldDescriptors.invoke(snippet); } catch... | DescriptorExtractor { public static List<FieldDescriptor> extract(AbstractFieldsSnippet snippet) { try { Method getFieldDescriptors = AbstractFieldsSnippet.class.getDeclaredMethod("getFieldDescriptors"); getFieldDescriptors.setAccessible(true); return (List<FieldDescriptor>) getFieldDescriptors.invoke(snippet); } catch... |
@Test public void should_extract_link_descriptors() { LinksSnippet snippet = links( linkWithRel("self").description("Is documented!") ); List<LinkDescriptor> descriptors = extract(snippet); then(descriptors).hasSize(1); then(descriptors.get(0).getRel()).isEqualTo("self"); then(descriptors.get(0).getDescription()).isEqu... | public static List<FieldDescriptor> extract(AbstractFieldsSnippet snippet) { try { Method getFieldDescriptors = AbstractFieldsSnippet.class.getDeclaredMethod("getFieldDescriptors"); getFieldDescriptors.setAccessible(true); return (List<FieldDescriptor>) getFieldDescriptors.invoke(snippet); } catch (NoSuchMethodExceptio... | DescriptorExtractor { public static List<FieldDescriptor> extract(AbstractFieldsSnippet snippet) { try { Method getFieldDescriptors = AbstractFieldsSnippet.class.getDeclaredMethod("getFieldDescriptors"); getFieldDescriptors.setAccessible(true); return (List<FieldDescriptor>) getFieldDescriptors.invoke(snippet); } catch... | DescriptorExtractor { public static List<FieldDescriptor> extract(AbstractFieldsSnippet snippet) { try { Method getFieldDescriptors = AbstractFieldsSnippet.class.getDeclaredMethod("getFieldDescriptors"); getFieldDescriptors.setAccessible(true); return (List<FieldDescriptor>) getFieldDescriptors.invoke(snippet); } catch... | DescriptorExtractor { public static List<FieldDescriptor> extract(AbstractFieldsSnippet snippet) { try { Method getFieldDescriptors = AbstractFieldsSnippet.class.getDeclaredMethod("getFieldDescriptors"); getFieldDescriptors.setAccessible(true); return (List<FieldDescriptor>) getFieldDescriptors.invoke(snippet); } catch... | DescriptorExtractor { public static List<FieldDescriptor> extract(AbstractFieldsSnippet snippet) { try { Method getFieldDescriptors = AbstractFieldsSnippet.class.getDeclaredMethod("getFieldDescriptors"); getFieldDescriptors.setAccessible(true); return (List<FieldDescriptor>) getFieldDescriptors.invoke(snippet); } catch... |
@Test public void should_extract_request_parameter_descriptors() { RequestParametersSnippet snippet = requestParameters( parameterWithName("page").description("Is documented!"), parameterWithName("elementsPerPage").description("Is documented!") ); List<ParameterDescriptor> descriptors = extract(snippet); then(descripto... | public static List<FieldDescriptor> extract(AbstractFieldsSnippet snippet) { try { Method getFieldDescriptors = AbstractFieldsSnippet.class.getDeclaredMethod("getFieldDescriptors"); getFieldDescriptors.setAccessible(true); return (List<FieldDescriptor>) getFieldDescriptors.invoke(snippet); } catch (NoSuchMethodExceptio... | DescriptorExtractor { public static List<FieldDescriptor> extract(AbstractFieldsSnippet snippet) { try { Method getFieldDescriptors = AbstractFieldsSnippet.class.getDeclaredMethod("getFieldDescriptors"); getFieldDescriptors.setAccessible(true); return (List<FieldDescriptor>) getFieldDescriptors.invoke(snippet); } catch... | DescriptorExtractor { public static List<FieldDescriptor> extract(AbstractFieldsSnippet snippet) { try { Method getFieldDescriptors = AbstractFieldsSnippet.class.getDeclaredMethod("getFieldDescriptors"); getFieldDescriptors.setAccessible(true); return (List<FieldDescriptor>) getFieldDescriptors.invoke(snippet); } catch... | DescriptorExtractor { public static List<FieldDescriptor> extract(AbstractFieldsSnippet snippet) { try { Method getFieldDescriptors = AbstractFieldsSnippet.class.getDeclaredMethod("getFieldDescriptors"); getFieldDescriptors.setAccessible(true); return (List<FieldDescriptor>) getFieldDescriptors.invoke(snippet); } catch... | DescriptorExtractor { public static List<FieldDescriptor> extract(AbstractFieldsSnippet snippet) { try { Method getFieldDescriptors = AbstractFieldsSnippet.class.getDeclaredMethod("getFieldDescriptors"); getFieldDescriptors.setAccessible(true); return (List<FieldDescriptor>) getFieldDescriptors.invoke(snippet); } catch... |
@Test public void should_combine_descriptors() { fieldDescriptors = givenFieldDescriptors(); then(fieldDescriptors.and(fieldWithPath("c")).getFieldDescriptors()) .extracting(FieldDescriptor::getPath).contains("a", "b", "c"); } | public FieldDescriptors and(FieldDescriptor... additionalDescriptors) { return andWithPrefix("", additionalDescriptors); } | FieldDescriptors { public FieldDescriptors and(FieldDescriptor... additionalDescriptors) { return andWithPrefix("", additionalDescriptors); } } | FieldDescriptors { public FieldDescriptors and(FieldDescriptor... additionalDescriptors) { return andWithPrefix("", additionalDescriptors); } FieldDescriptors(FieldDescriptor... fieldDescriptors); } | FieldDescriptors { public FieldDescriptors and(FieldDescriptor... additionalDescriptors) { return andWithPrefix("", additionalDescriptors); } FieldDescriptors(FieldDescriptor... fieldDescriptors); FieldDescriptors and(FieldDescriptor... additionalDescriptors); FieldDescriptors andWithPrefix(String pathPrefix, FieldDesc... | FieldDescriptors { public FieldDescriptors and(FieldDescriptor... additionalDescriptors) { return andWithPrefix("", additionalDescriptors); } FieldDescriptors(FieldDescriptor... fieldDescriptors); FieldDescriptors and(FieldDescriptor... additionalDescriptors); FieldDescriptors andWithPrefix(String pathPrefix, FieldDesc... |
@Test public void should_combine_descriptors_with_prefix() { fieldDescriptors = givenFieldDescriptors(); then(fieldDescriptors.andWithPrefix("d.", fieldWithPath("c")).getFieldDescriptors()) .extracting(FieldDescriptor::getPath).contains("a", "b", "d.c"); } | public FieldDescriptors andWithPrefix(String pathPrefix, FieldDescriptor... additionalDescriptors) { List<FieldDescriptor> combinedDescriptors = new ArrayList<>(fieldDescriptors); combinedDescriptors.addAll(applyPathPrefix(pathPrefix, Arrays.asList(additionalDescriptors))); return new FieldDescriptors(combinedDescripto... | FieldDescriptors { public FieldDescriptors andWithPrefix(String pathPrefix, FieldDescriptor... additionalDescriptors) { List<FieldDescriptor> combinedDescriptors = new ArrayList<>(fieldDescriptors); combinedDescriptors.addAll(applyPathPrefix(pathPrefix, Arrays.asList(additionalDescriptors))); return new FieldDescriptor... | FieldDescriptors { public FieldDescriptors andWithPrefix(String pathPrefix, FieldDescriptor... additionalDescriptors) { List<FieldDescriptor> combinedDescriptors = new ArrayList<>(fieldDescriptors); combinedDescriptors.addAll(applyPathPrefix(pathPrefix, Arrays.asList(additionalDescriptors))); return new FieldDescriptor... | FieldDescriptors { public FieldDescriptors andWithPrefix(String pathPrefix, FieldDescriptor... additionalDescriptors) { List<FieldDescriptor> combinedDescriptors = new ArrayList<>(fieldDescriptors); combinedDescriptors.addAll(applyPathPrefix(pathPrefix, Arrays.asList(additionalDescriptors))); return new FieldDescriptor... | FieldDescriptors { public FieldDescriptors andWithPrefix(String pathPrefix, FieldDescriptor... additionalDescriptors) { List<FieldDescriptor> combinedDescriptors = new ArrayList<>(fieldDescriptors); combinedDescriptors.addAll(applyPathPrefix(pathPrefix, Arrays.asList(additionalDescriptors))); return new FieldDescriptor... |
@Test public void testNowTimeImageUrl() throws Exception { BujintMojo target = new BujintMojo(); String result = target.nowTimeImageUrl(); System.out.println(result); } | String nowTimeImageUrl() throws Exception { String time = DateFormatUtils.format(new Date(), "hhmm"); DefaultHttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = buildDefaultHttpMessage(new HttpGet("http: httpget.setHeader("Referer", "http: HttpResponse response = httpclient.execute(httpget); if (response... | BujintMojo extends AbstractMojo { String nowTimeImageUrl() throws Exception { String time = DateFormatUtils.format(new Date(), "hhmm"); DefaultHttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = buildDefaultHttpMessage(new HttpGet("http: httpget.setHeader("Referer", "http: HttpResponse response = httpcli... | BujintMojo extends AbstractMojo { String nowTimeImageUrl() throws Exception { String time = DateFormatUtils.format(new Date(), "hhmm"); DefaultHttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = buildDefaultHttpMessage(new HttpGet("http: httpget.setHeader("Referer", "http: HttpResponse response = httpcli... | BujintMojo extends AbstractMojo { String nowTimeImageUrl() throws Exception { String time = DateFormatUtils.format(new Date(), "hhmm"); DefaultHttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = buildDefaultHttpMessage(new HttpGet("http: httpget.setHeader("Referer", "http: HttpResponse response = httpcli... | BujintMojo extends AbstractMojo { String nowTimeImageUrl() throws Exception { String time = DateFormatUtils.format(new Date(), "hhmm"); DefaultHttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = buildDefaultHttpMessage(new HttpGet("http: httpget.setHeader("Referer", "http: HttpResponse response = httpcli... |
@Test public void testGetImagePath() throws Exception { InputStream is = getClass().getClassLoader().getResourceAsStream( "test.html"); String str = IOUtils.toString(is, "UTF-8"); BujintMojo target = new BujintMojo(); assertEquals("結果が不正です", "/jp/img/clk/6976221_31.jpg", target .getImagePath(str)); } | String getImagePath(String str) throws Exception { DOMParser parser = new DOMParser(); parser.parse(new InputSource(new StringReader(str))); NodeList nodeList = XPathAPI.selectNodeList(parser.getDocument(), "/HTML/BODY/TABLE/TR/TH[1]/IMG"); String path = null; for (int i = 0; i < nodeList.getLength(); i++) { Element el... | BujintMojo extends AbstractMojo { String getImagePath(String str) throws Exception { DOMParser parser = new DOMParser(); parser.parse(new InputSource(new StringReader(str))); NodeList nodeList = XPathAPI.selectNodeList(parser.getDocument(), "/HTML/BODY/TABLE/TR/TH[1]/IMG"); String path = null; for (int i = 0; i < nodeL... | BujintMojo extends AbstractMojo { String getImagePath(String str) throws Exception { DOMParser parser = new DOMParser(); parser.parse(new InputSource(new StringReader(str))); NodeList nodeList = XPathAPI.selectNodeList(parser.getDocument(), "/HTML/BODY/TABLE/TR/TH[1]/IMG"); String path = null; for (int i = 0; i < nodeL... | BujintMojo extends AbstractMojo { String getImagePath(String str) throws Exception { DOMParser parser = new DOMParser(); parser.parse(new InputSource(new StringReader(str))); NodeList nodeList = XPathAPI.selectNodeList(parser.getDocument(), "/HTML/BODY/TABLE/TR/TH[1]/IMG"); String path = null; for (int i = 0; i < nodeL... | BujintMojo extends AbstractMojo { String getImagePath(String str) throws Exception { DOMParser parser = new DOMParser(); parser.parse(new InputSource(new StringReader(str))); NodeList nodeList = XPathAPI.selectNodeList(parser.getDocument(), "/HTML/BODY/TABLE/TR/TH[1]/IMG"); String path = null; for (int i = 0; i < nodeL... |
@Test public void testGetFittingImage() throws Exception { BujintMojo target = new BujintMojo(); BufferedImage image = target.getFittingImage(target.nowTimeImageUrl()); ImageIO.write(image, "jpg", new File("test.jpg")); } | BufferedImage getFittingImage(String url) throws Exception { DefaultHttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = buildDefaultHttpMessage(new HttpGet(url)); httpget.setHeader("Referer", "http: HttpResponse response = httpclient.execute(httpget); BufferedImage image = ImageIO.read(response.getEntity... | BujintMojo extends AbstractMojo { BufferedImage getFittingImage(String url) throws Exception { DefaultHttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = buildDefaultHttpMessage(new HttpGet(url)); httpget.setHeader("Referer", "http: HttpResponse response = httpclient.execute(httpget); BufferedImage image... | BujintMojo extends AbstractMojo { BufferedImage getFittingImage(String url) throws Exception { DefaultHttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = buildDefaultHttpMessage(new HttpGet(url)); httpget.setHeader("Referer", "http: HttpResponse response = httpclient.execute(httpget); BufferedImage image... | BujintMojo extends AbstractMojo { BufferedImage getFittingImage(String url) throws Exception { DefaultHttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = buildDefaultHttpMessage(new HttpGet(url)); httpget.setHeader("Referer", "http: HttpResponse response = httpclient.execute(httpget); BufferedImage image... | BujintMojo extends AbstractMojo { BufferedImage getFittingImage(String url) throws Exception { DefaultHttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = buildDefaultHttpMessage(new HttpGet(url)); httpget.setHeader("Referer", "http: HttpResponse response = httpclient.execute(httpget); BufferedImage image... |
@Test public void testExecute() throws Exception { BujintMojo target = new BujintMojo(); target.execute(); } | public void execute() throws MojoExecutionException { try { String imgUrl = nowTimeImageUrl(); if (imgUrl == null) { return; } getLog().info("\n" + getAsciiArt(getFittingImage(imgUrl))); } catch (Exception e) { e.printStackTrace(); throw new MojoExecutionException("なんかエラー", e); } } | BujintMojo extends AbstractMojo { public void execute() throws MojoExecutionException { try { String imgUrl = nowTimeImageUrl(); if (imgUrl == null) { return; } getLog().info("\n" + getAsciiArt(getFittingImage(imgUrl))); } catch (Exception e) { e.printStackTrace(); throw new MojoExecutionException("なんかエラー", e); } } } | BujintMojo extends AbstractMojo { public void execute() throws MojoExecutionException { try { String imgUrl = nowTimeImageUrl(); if (imgUrl == null) { return; } getLog().info("\n" + getAsciiArt(getFittingImage(imgUrl))); } catch (Exception e) { e.printStackTrace(); throw new MojoExecutionException("なんかエラー", e); } } } | BujintMojo extends AbstractMojo { public void execute() throws MojoExecutionException { try { String imgUrl = nowTimeImageUrl(); if (imgUrl == null) { return; } getLog().info("\n" + getAsciiArt(getFittingImage(imgUrl))); } catch (Exception e) { e.printStackTrace(); throw new MojoExecutionException("なんかエラー", e); } } vo... | BujintMojo extends AbstractMojo { public void execute() throws MojoExecutionException { try { String imgUrl = nowTimeImageUrl(); if (imgUrl == null) { return; } getLog().info("\n" + getAsciiArt(getFittingImage(imgUrl))); } catch (Exception e) { e.printStackTrace(); throw new MojoExecutionException("なんかエラー", e); } } vo... |
@Test public void test() throws Exception { XLSXSample target = new XLSXSample(); target.makeXlsxFile(); } | public void makeXlsxFile() throws Exception { String fileName = "test.xlsx"; FileOutputStream fileOut = new FileOutputStream(fileName); Workbook wb = new XSSFWorkbook(); Sheet sheet = wb.createSheet("test"); Row row = sheet.createRow((short)0); Cell cell = row.createCell(0); cell.setCellValue("日本語は通る?"); wb.write(fileO... | XLSXSample { public void makeXlsxFile() throws Exception { String fileName = "test.xlsx"; FileOutputStream fileOut = new FileOutputStream(fileName); Workbook wb = new XSSFWorkbook(); Sheet sheet = wb.createSheet("test"); Row row = sheet.createRow((short)0); Cell cell = row.createCell(0); cell.setCellValue("日本語は通る?"); w... | XLSXSample { public void makeXlsxFile() throws Exception { String fileName = "test.xlsx"; FileOutputStream fileOut = new FileOutputStream(fileName); Workbook wb = new XSSFWorkbook(); Sheet sheet = wb.createSheet("test"); Row row = sheet.createRow((short)0); Cell cell = row.createCell(0); cell.setCellValue("日本語は通る?"); w... | XLSXSample { public void makeXlsxFile() throws Exception { String fileName = "test.xlsx"; FileOutputStream fileOut = new FileOutputStream(fileName); Workbook wb = new XSSFWorkbook(); Sheet sheet = wb.createSheet("test"); Row row = sheet.createRow((short)0); Cell cell = row.createCell(0); cell.setCellValue("日本語は通る?"); w... | XLSXSample { public void makeXlsxFile() throws Exception { String fileName = "test.xlsx"; FileOutputStream fileOut = new FileOutputStream(fileName); Workbook wb = new XSSFWorkbook(); Sheet sheet = wb.createSheet("test"); Row row = sheet.createRow((short)0); Cell cell = row.createCell(0); cell.setCellValue("日本語は通る?"); w... |
@Test public void testSimple() throws Exception { DatabaseAccess da = new DatabaseAccess(); da.dbSelect(); } | public void dbSelect() throws Exception { Class.forName("org.postgresql.Driver"); String url = "jdbc:postgresql: Connection con = DriverManager.getConnection(url, "np", "npnpnp"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(getPlainSQL()); rs.close(); stmt.close(); con.close(); } | DatabaseAccess { public void dbSelect() throws Exception { Class.forName("org.postgresql.Driver"); String url = "jdbc:postgresql: Connection con = DriverManager.getConnection(url, "np", "npnpnp"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(getPlainSQL()); rs.close(); stmt.close(); con.clos... | DatabaseAccess { public void dbSelect() throws Exception { Class.forName("org.postgresql.Driver"); String url = "jdbc:postgresql: Connection con = DriverManager.getConnection(url, "np", "npnpnp"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(getPlainSQL()); rs.close(); stmt.close(); con.clos... | DatabaseAccess { public void dbSelect() throws Exception { Class.forName("org.postgresql.Driver"); String url = "jdbc:postgresql: Connection con = DriverManager.getConnection(url, "np", "npnpnp"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(getPlainSQL()); rs.close(); stmt.close(); con.clos... | DatabaseAccess { public void dbSelect() throws Exception { Class.forName("org.postgresql.Driver"); String url = "jdbc:postgresql: Connection con = DriverManager.getConnection(url, "np", "npnpnp"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(getPlainSQL()); rs.close(); stmt.close(); con.clos... |
@Mock(target = SampleLogic.class, pointcut = "plus", returnValue = "new Integer(10)") @Test public void testInsertData() throws Exception { target.insertData(); DataTable actual = dataAccessor.readDbByTable("emp"); DataSet expected = testContext.getExpected(); assertEquals(expected.getTable("emp"), actual); } | public void insertData() { Connection con = null; Statement stmt = null; try { con = ds.getConnection(); stmt = con.createStatement(); int count = sampleLogic.plus(1, 5); for (int i = 0; i < count; i++) { stmt.executeUpdate("INSERT INTO EMP (id, name) values (" + i + ", 'test')"); } } catch (Exception e) { throw new Ru... | DataAccessSampleLogic { public void insertData() { Connection con = null; Statement stmt = null; try { con = ds.getConnection(); stmt = con.createStatement(); int count = sampleLogic.plus(1, 5); for (int i = 0; i < count; i++) { stmt.executeUpdate("INSERT INTO EMP (id, name) values (" + i + ", 'test')"); } } catch (Exc... | DataAccessSampleLogic { public void insertData() { Connection con = null; Statement stmt = null; try { con = ds.getConnection(); stmt = con.createStatement(); int count = sampleLogic.plus(1, 5); for (int i = 0; i < count; i++) { stmt.executeUpdate("INSERT INTO EMP (id, name) values (" + i + ", 'test')"); } } catch (Exc... | DataAccessSampleLogic { public void insertData() { Connection con = null; Statement stmt = null; try { con = ds.getConnection(); stmt = con.createStatement(); int count = sampleLogic.plus(1, 5); for (int i = 0; i < count; i++) { stmt.executeUpdate("INSERT INTO EMP (id, name) values (" + i + ", 'test')"); } } catch (Exc... | DataAccessSampleLogic { public void insertData() { Connection con = null; Statement stmt = null; try { con = ds.getConnection(); stmt = con.createStatement(); int count = sampleLogic.plus(1, 5); for (int i = 0; i < count; i++) { stmt.executeUpdate("INSERT INTO EMP (id, name) values (" + i + ", 'test')"); } } catch (Exc... |
@Test public void testGetEmpAllRecord() throws Exception { List<EmpDto> actual = target.getEmpAllRecord(); assertEquals(10, actual.size()); } | public List<EmpDto> getEmpAllRecord() { Connection con = null; Statement stmt = null; ResultSet rs = null; try { con = ds.getConnection(); stmt = con.createStatement(); rs = stmt.executeQuery("SELECT * FROM EMP"); List<EmpDto> list = new ArrayList<EmpDto>(); while (rs.next()) { EmpDto dto = new EmpDto(); dto.id = rs.ge... | DataAccessSampleLogic { public List<EmpDto> getEmpAllRecord() { Connection con = null; Statement stmt = null; ResultSet rs = null; try { con = ds.getConnection(); stmt = con.createStatement(); rs = stmt.executeQuery("SELECT * FROM EMP"); List<EmpDto> list = new ArrayList<EmpDto>(); while (rs.next()) { EmpDto dto = new ... | DataAccessSampleLogic { public List<EmpDto> getEmpAllRecord() { Connection con = null; Statement stmt = null; ResultSet rs = null; try { con = ds.getConnection(); stmt = con.createStatement(); rs = stmt.executeQuery("SELECT * FROM EMP"); List<EmpDto> list = new ArrayList<EmpDto>(); while (rs.next()) { EmpDto dto = new ... | DataAccessSampleLogic { public List<EmpDto> getEmpAllRecord() { Connection con = null; Statement stmt = null; ResultSet rs = null; try { con = ds.getConnection(); stmt = con.createStatement(); rs = stmt.executeQuery("SELECT * FROM EMP"); List<EmpDto> list = new ArrayList<EmpDto>(); while (rs.next()) { EmpDto dto = new ... | DataAccessSampleLogic { public List<EmpDto> getEmpAllRecord() { Connection con = null; Statement stmt = null; ResultSet rs = null; try { con = ds.getConnection(); stmt = con.createStatement(); rs = stmt.executeQuery("SELECT * FROM EMP"); List<EmpDto> list = new ArrayList<EmpDto>(); while (rs.next()) { EmpDto dto = new ... |
@Test public void testDefaultFormat() { DIMACSExporter<String, DefaultWeightedEdge> exporter = new DIMACSExporter<>(); assertEquals(DIMACSFormat.MAX_CLIQUE, exporter.getFormat()); } | public DIMACSFormat getFormat() { return format; } | DIMACSExporter extends AbstractBaseExporter<V, E> implements GraphExporter<V, E> { public DIMACSFormat getFormat() { return format; } } | DIMACSExporter extends AbstractBaseExporter<V, E> implements GraphExporter<V, E> { public DIMACSFormat getFormat() { return format; } DIMACSExporter(); DIMACSExporter(ComponentNameProvider<V> vertexIDProvider); DIMACSExporter(ComponentNameProvider<V> vertexIDProvider, DIMACSFormat format); } | DIMACSExporter extends AbstractBaseExporter<V, E> implements GraphExporter<V, E> { public DIMACSFormat getFormat() { return format; } DIMACSExporter(); DIMACSExporter(ComponentNameProvider<V> vertexIDProvider); DIMACSExporter(ComponentNameProvider<V> vertexIDProvider, DIMACSFormat format); @Override void exportGraph(... | DIMACSExporter extends AbstractBaseExporter<V, E> implements GraphExporter<V, E> { public DIMACSFormat getFormat() { return format; } DIMACSExporter(); DIMACSExporter(ComponentNameProvider<V> vertexIDProvider); DIMACSExporter(ComponentNameProvider<V> vertexIDProvider, DIMACSFormat format); @Override void exportGraph(... |
@Test public void testNonExistantVertex() { SimpleGraph<String, DefaultEdge> g = new SimpleGraph<>(DefaultEdge.class); g.addVertex("a"); VertexScoringAlgorithm<String, Integer> pr = new Coreness<>(g); try { pr.getVertexScore("unknown"); fail("No!"); } catch (IllegalArgumentException e) { } } | @Override public Integer getVertexScore(V v) { if (!g.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } lazyRun(); return scores.get(v); } | Coreness implements VertexScoringAlgorithm<V, Integer> { @Override public Integer getVertexScore(V v) { if (!g.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } lazyRun(); return scores.get(v); } } | Coreness implements VertexScoringAlgorithm<V, Integer> { @Override public Integer getVertexScore(V v) { if (!g.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } lazyRun(); return scores.get(v); } Coreness(Graph<V, E> g); } | Coreness implements VertexScoringAlgorithm<V, Integer> { @Override public Integer getVertexScore(V v) { if (!g.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } lazyRun(); return scores.get(v); } Coreness(Graph<V, E> g); @Override Map<V, Integer> getScores(); @Override ... | Coreness implements VertexScoringAlgorithm<V, Integer> { @Override public Integer getVertexScore(V v) { if (!g.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } lazyRun(); return scores.get(v); } Coreness(Graph<V, E> g); @Override Map<V, Integer> getScores(); @Override ... |
@Test public void testWikiExampleSymmetric4Cities() { SimpleWeightedGraph<String, DefaultWeightedEdge> g = new SimpleWeightedGraph<>(DefaultWeightedEdge.class); g.addVertex("A"); g.addVertex("B"); g.addVertex("C"); g.addVertex("D"); g.setEdgeWeight(g.addEdge("A", "B"), 20d); g.setEdgeWeight(g.addEdge("A", "C"), 42d); g... | @Override public GraphPath<V, E> getTour(Graph<V, E> graph) { if (!graph.getType().isUndirected()) { throw new IllegalArgumentException("Graph must be undirected"); } if (!GraphTests.isComplete(graph)) { throw new IllegalArgumentException("Graph is not complete"); } if (graph.vertexSet().isEmpty()) { throw new IllegalA... | TwoApproxMetricTSP implements TSPAlgorithm<V, E> { @Override public GraphPath<V, E> getTour(Graph<V, E> graph) { if (!graph.getType().isUndirected()) { throw new IllegalArgumentException("Graph must be undirected"); } if (!GraphTests.isComplete(graph)) { throw new IllegalArgumentException("Graph is not complete"); } if... | TwoApproxMetricTSP implements TSPAlgorithm<V, E> { @Override public GraphPath<V, E> getTour(Graph<V, E> graph) { if (!graph.getType().isUndirected()) { throw new IllegalArgumentException("Graph must be undirected"); } if (!GraphTests.isComplete(graph)) { throw new IllegalArgumentException("Graph is not complete"); } if... | TwoApproxMetricTSP implements TSPAlgorithm<V, E> { @Override public GraphPath<V, E> getTour(Graph<V, E> graph) { if (!graph.getType().isUndirected()) { throw new IllegalArgumentException("Graph must be undirected"); } if (!GraphTests.isComplete(graph)) { throw new IllegalArgumentException("Graph is not complete"); } if... | TwoApproxMetricTSP implements TSPAlgorithm<V, E> { @Override public GraphPath<V, E> getTour(Graph<V, E> graph) { if (!graph.getType().isUndirected()) { throw new IllegalArgumentException("Graph must be undirected"); } if (!GraphTests.isComplete(graph)) { throw new IllegalArgumentException("Graph is not complete"); } if... |
@Test public void testComplete() { final int maxSize = 50; for (int i = 1; i < maxSize; i++) { SimpleGraph<Object, DefaultEdge> g = new SimpleGraph<>(DefaultEdge.class); CompleteGraphGenerator<Object, DefaultEdge> generator = new CompleteGraphGenerator<>(i); generator.generateGraph(g, new ClassBasedVertexFactory<>(Obje... | @Override public GraphPath<V, E> getTour(Graph<V, E> graph) { if (!graph.getType().isUndirected()) { throw new IllegalArgumentException("Graph must be undirected"); } if (!GraphTests.isComplete(graph)) { throw new IllegalArgumentException("Graph is not complete"); } if (graph.vertexSet().isEmpty()) { throw new IllegalA... | TwoApproxMetricTSP implements TSPAlgorithm<V, E> { @Override public GraphPath<V, E> getTour(Graph<V, E> graph) { if (!graph.getType().isUndirected()) { throw new IllegalArgumentException("Graph must be undirected"); } if (!GraphTests.isComplete(graph)) { throw new IllegalArgumentException("Graph is not complete"); } if... | TwoApproxMetricTSP implements TSPAlgorithm<V, E> { @Override public GraphPath<V, E> getTour(Graph<V, E> graph) { if (!graph.getType().isUndirected()) { throw new IllegalArgumentException("Graph must be undirected"); } if (!GraphTests.isComplete(graph)) { throw new IllegalArgumentException("Graph is not complete"); } if... | TwoApproxMetricTSP implements TSPAlgorithm<V, E> { @Override public GraphPath<V, E> getTour(Graph<V, E> graph) { if (!graph.getType().isUndirected()) { throw new IllegalArgumentException("Graph must be undirected"); } if (!GraphTests.isComplete(graph)) { throw new IllegalArgumentException("Graph is not complete"); } if... | TwoApproxMetricTSP implements TSPAlgorithm<V, E> { @Override public GraphPath<V, E> getTour(Graph<V, E> graph) { if (!graph.getType().isUndirected()) { throw new IllegalArgumentException("Graph must be undirected"); } if (!GraphTests.isComplete(graph)) { throw new IllegalArgumentException("Graph is not complete"); } if... |
@Test public void testStar() { SimpleWeightedGraph<String, DefaultWeightedEdge> g = new SimpleWeightedGraph<>(DefaultWeightedEdge.class); g.addVertex("1"); g.addVertex("2"); g.addVertex("3"); g.addVertex("4"); g.addVertex("5"); g.addVertex("6"); g.setEdgeWeight(g.addEdge("1", "2"), 1d); g.setEdgeWeight(g.addEdge("1", "... | @Override public GraphPath<V, E> getTour(Graph<V, E> graph) { if (!graph.getType().isUndirected()) { throw new IllegalArgumentException("Graph must be undirected"); } if (!GraphTests.isComplete(graph)) { throw new IllegalArgumentException("Graph is not complete"); } if (graph.vertexSet().isEmpty()) { throw new IllegalA... | TwoApproxMetricTSP implements TSPAlgorithm<V, E> { @Override public GraphPath<V, E> getTour(Graph<V, E> graph) { if (!graph.getType().isUndirected()) { throw new IllegalArgumentException("Graph must be undirected"); } if (!GraphTests.isComplete(graph)) { throw new IllegalArgumentException("Graph is not complete"); } if... | TwoApproxMetricTSP implements TSPAlgorithm<V, E> { @Override public GraphPath<V, E> getTour(Graph<V, E> graph) { if (!graph.getType().isUndirected()) { throw new IllegalArgumentException("Graph must be undirected"); } if (!GraphTests.isComplete(graph)) { throw new IllegalArgumentException("Graph is not complete"); } if... | TwoApproxMetricTSP implements TSPAlgorithm<V, E> { @Override public GraphPath<V, E> getTour(Graph<V, E> graph) { if (!graph.getType().isUndirected()) { throw new IllegalArgumentException("Graph must be undirected"); } if (!GraphTests.isComplete(graph)) { throw new IllegalArgumentException("Graph is not complete"); } if... | TwoApproxMetricTSP implements TSPAlgorithm<V, E> { @Override public GraphPath<V, E> getTour(Graph<V, E> graph) { if (!graph.getType().isUndirected()) { throw new IllegalArgumentException("Graph must be undirected"); } if (!GraphTests.isComplete(graph)) { throw new IllegalArgumentException("Graph is not complete"); } if... |
@Test(expected = IllegalArgumentException.class) public void testInvalidInstanceDirected() { Graph<String, DefaultEdge> g = new SimpleDirectedGraph<>(DefaultEdge.class); g.addVertex("A"); new TwoApproxMetricTSP<String, DefaultEdge>().getTour(g); } | @Override public GraphPath<V, E> getTour(Graph<V, E> graph) { if (!graph.getType().isUndirected()) { throw new IllegalArgumentException("Graph must be undirected"); } if (!GraphTests.isComplete(graph)) { throw new IllegalArgumentException("Graph is not complete"); } if (graph.vertexSet().isEmpty()) { throw new IllegalA... | TwoApproxMetricTSP implements TSPAlgorithm<V, E> { @Override public GraphPath<V, E> getTour(Graph<V, E> graph) { if (!graph.getType().isUndirected()) { throw new IllegalArgumentException("Graph must be undirected"); } if (!GraphTests.isComplete(graph)) { throw new IllegalArgumentException("Graph is not complete"); } if... | TwoApproxMetricTSP implements TSPAlgorithm<V, E> { @Override public GraphPath<V, E> getTour(Graph<V, E> graph) { if (!graph.getType().isUndirected()) { throw new IllegalArgumentException("Graph must be undirected"); } if (!GraphTests.isComplete(graph)) { throw new IllegalArgumentException("Graph is not complete"); } if... | TwoApproxMetricTSP implements TSPAlgorithm<V, E> { @Override public GraphPath<V, E> getTour(Graph<V, E> graph) { if (!graph.getType().isUndirected()) { throw new IllegalArgumentException("Graph must be undirected"); } if (!GraphTests.isComplete(graph)) { throw new IllegalArgumentException("Graph is not complete"); } if... | TwoApproxMetricTSP implements TSPAlgorithm<V, E> { @Override public GraphPath<V, E> getTour(Graph<V, E> graph) { if (!graph.getType().isUndirected()) { throw new IllegalArgumentException("Graph must be undirected"); } if (!GraphTests.isComplete(graph)) { throw new IllegalArgumentException("Graph is not complete"); } if... |
@Test(expected = IllegalArgumentException.class) public void testInvalidInstanceNotComplete() { SimpleWeightedGraph<String, DefaultWeightedEdge> g = new SimpleWeightedGraph<>(DefaultWeightedEdge.class); g.addVertex("A"); g.addVertex("B"); g.addVertex("C"); g.setEdgeWeight(g.addEdge("A", "B"), 20d); g.setEdgeWeight(g.ad... | @Override public GraphPath<V, E> getTour(Graph<V, E> graph) { if (!graph.getType().isUndirected()) { throw new IllegalArgumentException("Graph must be undirected"); } if (!GraphTests.isComplete(graph)) { throw new IllegalArgumentException("Graph is not complete"); } if (graph.vertexSet().isEmpty()) { throw new IllegalA... | TwoApproxMetricTSP implements TSPAlgorithm<V, E> { @Override public GraphPath<V, E> getTour(Graph<V, E> graph) { if (!graph.getType().isUndirected()) { throw new IllegalArgumentException("Graph must be undirected"); } if (!GraphTests.isComplete(graph)) { throw new IllegalArgumentException("Graph is not complete"); } if... | TwoApproxMetricTSP implements TSPAlgorithm<V, E> { @Override public GraphPath<V, E> getTour(Graph<V, E> graph) { if (!graph.getType().isUndirected()) { throw new IllegalArgumentException("Graph must be undirected"); } if (!GraphTests.isComplete(graph)) { throw new IllegalArgumentException("Graph is not complete"); } if... | TwoApproxMetricTSP implements TSPAlgorithm<V, E> { @Override public GraphPath<V, E> getTour(Graph<V, E> graph) { if (!graph.getType().isUndirected()) { throw new IllegalArgumentException("Graph must be undirected"); } if (!GraphTests.isComplete(graph)) { throw new IllegalArgumentException("Graph is not complete"); } if... | TwoApproxMetricTSP implements TSPAlgorithm<V, E> { @Override public GraphPath<V, E> getTour(Graph<V, E> graph) { if (!graph.getType().isUndirected()) { throw new IllegalArgumentException("Graph must be undirected"); } if (!GraphTests.isComplete(graph)) { throw new IllegalArgumentException("Graph is not complete"); } if... |
@Test(expected = InvalidGraphWalkException.class) public void testInvalidPath3() { Graph<Integer, DefaultEdge> graph = new SimpleGraph<>(DefaultEdge.class); graph.addVertex(0); GraphWalk<Integer, DefaultEdge> gw = new GraphWalk<>(graph, 0, 0, Arrays.asList(0, 0), null, 0); gw.verify(); } | public void verify() { if (isEmpty()) return; if (vertexList != null && !vertexList.isEmpty()) { if (!startVertex.equals(vertexList.get(0))) throw new InvalidGraphWalkException( "The start vertex must be the first vertex in the vertex list"); if (!endVertex.equals(vertexList.get(vertexList.size() - 1))) throw new Inval... | GraphWalk implements GraphPath<V, E> { public void verify() { if (isEmpty()) return; if (vertexList != null && !vertexList.isEmpty()) { if (!startVertex.equals(vertexList.get(0))) throw new InvalidGraphWalkException( "The start vertex must be the first vertex in the vertex list"); if (!endVertex.equals(vertexList.get(v... | GraphWalk implements GraphPath<V, E> { public void verify() { if (isEmpty()) return; if (vertexList != null && !vertexList.isEmpty()) { if (!startVertex.equals(vertexList.get(0))) throw new InvalidGraphWalkException( "The start vertex must be the first vertex in the vertex list"); if (!endVertex.equals(vertexList.get(v... | GraphWalk implements GraphPath<V, E> { public void verify() { if (isEmpty()) return; if (vertexList != null && !vertexList.isEmpty()) { if (!startVertex.equals(vertexList.get(0))) throw new InvalidGraphWalkException( "The start vertex must be the first vertex in the vertex list"); if (!endVertex.equals(vertexList.get(v... | GraphWalk implements GraphPath<V, E> { public void verify() { if (isEmpty()) return; if (vertexList != null && !vertexList.isEmpty()) { if (!startVertex.equals(vertexList.get(0))) throw new InvalidGraphWalkException( "The start vertex must be the first vertex in the vertex list"); if (!endVertex.equals(vertexList.get(v... |
@Test(expected = InvalidGraphWalkException.class) public void testInvalidPath4() { Graph<Integer, DefaultEdge> graph = new SimpleGraph<>(DefaultEdge.class); Graphs.addAllVertices(graph, Arrays.asList(0, 1, 2, 3)); graph.addEdge(0, 1); graph.addEdge(1, 2); graph.addEdge(2, 3); GraphWalk<Integer, DefaultEdge> gw = new Gr... | public void verify() { if (isEmpty()) return; if (vertexList != null && !vertexList.isEmpty()) { if (!startVertex.equals(vertexList.get(0))) throw new InvalidGraphWalkException( "The start vertex must be the first vertex in the vertex list"); if (!endVertex.equals(vertexList.get(vertexList.size() - 1))) throw new Inval... | GraphWalk implements GraphPath<V, E> { public void verify() { if (isEmpty()) return; if (vertexList != null && !vertexList.isEmpty()) { if (!startVertex.equals(vertexList.get(0))) throw new InvalidGraphWalkException( "The start vertex must be the first vertex in the vertex list"); if (!endVertex.equals(vertexList.get(v... | GraphWalk implements GraphPath<V, E> { public void verify() { if (isEmpty()) return; if (vertexList != null && !vertexList.isEmpty()) { if (!startVertex.equals(vertexList.get(0))) throw new InvalidGraphWalkException( "The start vertex must be the first vertex in the vertex list"); if (!endVertex.equals(vertexList.get(v... | GraphWalk implements GraphPath<V, E> { public void verify() { if (isEmpty()) return; if (vertexList != null && !vertexList.isEmpty()) { if (!startVertex.equals(vertexList.get(0))) throw new InvalidGraphWalkException( "The start vertex must be the first vertex in the vertex list"); if (!endVertex.equals(vertexList.get(v... | GraphWalk implements GraphPath<V, E> { public void verify() { if (isEmpty()) return; if (vertexList != null && !vertexList.isEmpty()) { if (!startVertex.equals(vertexList.get(0))) throw new InvalidGraphWalkException( "The start vertex must be the first vertex in the vertex list"); if (!endVertex.equals(vertexList.get(v... |
@Test(expected = InvalidGraphWalkException.class) public void testInvalidPath5() { Graph<Integer, DefaultEdge> graph = new SimpleGraph<>(DefaultEdge.class); Graphs.addAllVertices(graph, Arrays.asList(0, 1, 2, 3)); DefaultEdge e1 = graph.addEdge(0, 1); graph.addEdge(1, 2); DefaultEdge e3 = graph.addEdge(2, 3); GraphWalk... | public void verify() { if (isEmpty()) return; if (vertexList != null && !vertexList.isEmpty()) { if (!startVertex.equals(vertexList.get(0))) throw new InvalidGraphWalkException( "The start vertex must be the first vertex in the vertex list"); if (!endVertex.equals(vertexList.get(vertexList.size() - 1))) throw new Inval... | GraphWalk implements GraphPath<V, E> { public void verify() { if (isEmpty()) return; if (vertexList != null && !vertexList.isEmpty()) { if (!startVertex.equals(vertexList.get(0))) throw new InvalidGraphWalkException( "The start vertex must be the first vertex in the vertex list"); if (!endVertex.equals(vertexList.get(v... | GraphWalk implements GraphPath<V, E> { public void verify() { if (isEmpty()) return; if (vertexList != null && !vertexList.isEmpty()) { if (!startVertex.equals(vertexList.get(0))) throw new InvalidGraphWalkException( "The start vertex must be the first vertex in the vertex list"); if (!endVertex.equals(vertexList.get(v... | GraphWalk implements GraphPath<V, E> { public void verify() { if (isEmpty()) return; if (vertexList != null && !vertexList.isEmpty()) { if (!startVertex.equals(vertexList.get(0))) throw new InvalidGraphWalkException( "The start vertex must be the first vertex in the vertex list"); if (!endVertex.equals(vertexList.get(v... | GraphWalk implements GraphPath<V, E> { public void verify() { if (isEmpty()) return; if (vertexList != null && !vertexList.isEmpty()) { if (!startVertex.equals(vertexList.get(0))) throw new InvalidGraphWalkException( "The start vertex must be the first vertex in the vertex list"); if (!endVertex.equals(vertexList.get(v... |
@Test public void testValidPaths() { Graph<Integer, DefaultEdge> graph = new SimpleGraph<>(DefaultEdge.class); graph.addVertex(0); GraphWalk<Integer, DefaultEdge> gw1 = new GraphWalk<>(graph, null, null, Collections.emptyList(), Collections.emptyList(), 0); gw1.verify(); GraphWalk<Integer, DefaultEdge> gw2 = new GraphW... | public void verify() { if (isEmpty()) return; if (vertexList != null && !vertexList.isEmpty()) { if (!startVertex.equals(vertexList.get(0))) throw new InvalidGraphWalkException( "The start vertex must be the first vertex in the vertex list"); if (!endVertex.equals(vertexList.get(vertexList.size() - 1))) throw new Inval... | GraphWalk implements GraphPath<V, E> { public void verify() { if (isEmpty()) return; if (vertexList != null && !vertexList.isEmpty()) { if (!startVertex.equals(vertexList.get(0))) throw new InvalidGraphWalkException( "The start vertex must be the first vertex in the vertex list"); if (!endVertex.equals(vertexList.get(v... | GraphWalk implements GraphPath<V, E> { public void verify() { if (isEmpty()) return; if (vertexList != null && !vertexList.isEmpty()) { if (!startVertex.equals(vertexList.get(0))) throw new InvalidGraphWalkException( "The start vertex must be the first vertex in the vertex list"); if (!endVertex.equals(vertexList.get(v... | GraphWalk implements GraphPath<V, E> { public void verify() { if (isEmpty()) return; if (vertexList != null && !vertexList.isEmpty()) { if (!startVertex.equals(vertexList.get(0))) throw new InvalidGraphWalkException( "The start vertex must be the first vertex in the vertex list"); if (!endVertex.equals(vertexList.get(v... | GraphWalk implements GraphPath<V, E> { public void verify() { if (isEmpty()) return; if (vertexList != null && !vertexList.isEmpty()) { if (!startVertex.equals(vertexList.get(0))) throw new InvalidGraphWalkException( "The start vertex must be the first vertex in the vertex list"); if (!endVertex.equals(vertexList.get(v... |
@Test public void testGraph1b() throws UnsupportedEncodingException, ExportException, ImportException { Graph<Integer, DefaultEdge> orig= NamedGraphGenerator.petersenGraph(); String res = exportGraph(orig, Graph6Sparse6Exporter.Format.GRAPH6); Graph<Integer, DefaultEdge> g = importGraph(res); this.compare(orig, g); } | @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or multiple edges."); List<V> vertices = new ArrayList<>(g.ver... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... |
@Test(expected = InvalidGraphWalkException.class) public void testReverseInvalidPathDirected() { Graph<Integer, DefaultEdge> graph = new SimpleDirectedGraph<>(DefaultEdge.class); Graphs.addAllVertices(graph, Arrays.asList(0, 1, 2, 3)); graph.addEdge(0, 1); graph.addEdge(1, 2); graph.addEdge(2, 3); GraphWalk<Integer, De... | public GraphWalk<V, E> reverse() { return this.reverse(null); } | GraphWalk implements GraphPath<V, E> { public GraphWalk<V, E> reverse() { return this.reverse(null); } } | GraphWalk implements GraphPath<V, E> { public GraphWalk<V, E> reverse() { return this.reverse(null); } GraphWalk(Graph<V, E> graph, V startVertex, V endVertex, List<E> edgeList, double weight); GraphWalk(Graph<V, E> graph, List<V> vertexList, double weight); GraphWalk(
Graph<V, E> graph, V startVertex, V endV... | GraphWalk implements GraphPath<V, E> { public GraphWalk<V, E> reverse() { return this.reverse(null); } GraphWalk(Graph<V, E> graph, V startVertex, V endVertex, List<E> edgeList, double weight); GraphWalk(Graph<V, E> graph, List<V> vertexList, double weight); GraphWalk(
Graph<V, E> graph, V startVertex, V endV... | GraphWalk implements GraphPath<V, E> { public GraphWalk<V, E> reverse() { return this.reverse(null); } GraphWalk(Graph<V, E> graph, V startVertex, V endVertex, List<E> edgeList, double weight); GraphWalk(Graph<V, E> graph, List<V> vertexList, double weight); GraphWalk(
Graph<V, E> graph, V startVertex, V endV... |
@Test public void testUnmodifiable() { Graph<Integer, DefaultEdge> g = new Pseudograph<>(DefaultEdge.class); assertFalse(new MaskSubgraph<>(g, v -> v.equals(5), e -> false).getType().isModifiable()); } | @Override public GraphType getType() { return baseType.asUnmodifiable(); } | MaskSubgraph extends AbstractGraph<V, E> implements Serializable { @Override public GraphType getType() { return baseType.asUnmodifiable(); } } | MaskSubgraph extends AbstractGraph<V, E> implements Serializable { @Override public GraphType getType() { return baseType.asUnmodifiable(); } MaskSubgraph(Graph<V, E> base, Predicate<V> vertexMask, Predicate<E> edgeMask); } | MaskSubgraph extends AbstractGraph<V, E> implements Serializable { @Override public GraphType getType() { return baseType.asUnmodifiable(); } MaskSubgraph(Graph<V, E> base, Predicate<V> vertexMask, Predicate<E> edgeMask); @Override E addEdge(V sourceVertex, V targetVertex); @Override boolean addEdge(V sourceVertex, V t... | MaskSubgraph extends AbstractGraph<V, E> implements Serializable { @Override public GraphType getType() { return baseType.asUnmodifiable(); } MaskSubgraph(Graph<V, E> base, Predicate<V> vertexMask, Predicate<E> edgeMask); @Override E addEdge(V sourceVertex, V targetVertex); @Override boolean addEdge(V sourceVertex, V t... |
@Test public void testTopoIterationOrderLinearGraph() { DirectedAcyclicGraph<Long, DefaultEdge> dag = new DirectedAcyclicGraph<>(DefaultEdge.class); LinearGraphGenerator<Long, DefaultEdge> graphGen = new LinearGraphGenerator<>(100); graphGen.generateGraph(dag, new LongVertexFactory(), null); Iterator<Long> internalTopo... | public Iterator<V> iterator() { return new TopoIterator(); } | DirectedAcyclicGraph extends SimpleDirectedGraph<V, E> implements Iterable<V> { public Iterator<V> iterator() { return new TopoIterator(); } } | DirectedAcyclicGraph extends SimpleDirectedGraph<V, E> implements Iterable<V> { public Iterator<V> iterator() { return new TopoIterator(); } DirectedAcyclicGraph(Class<? extends E> edgeClass); DirectedAcyclicGraph(Class<? extends E> edgeClass, boolean weighted); DirectedAcyclicGraph(EdgeFactory<V, E> ef); DirectedAc... | DirectedAcyclicGraph extends SimpleDirectedGraph<V, E> implements Iterable<V> { public Iterator<V> iterator() { return new TopoIterator(); } DirectedAcyclicGraph(Class<? extends E> edgeClass); DirectedAcyclicGraph(Class<? extends E> edgeClass, boolean weighted); DirectedAcyclicGraph(EdgeFactory<V, E> ef); DirectedAc... | DirectedAcyclicGraph extends SimpleDirectedGraph<V, E> implements Iterable<V> { public Iterator<V> iterator() { return new TopoIterator(); } DirectedAcyclicGraph(Class<? extends E> edgeClass); DirectedAcyclicGraph(Class<? extends E> edgeClass, boolean weighted); DirectedAcyclicGraph(EdgeFactory<V, E> ef); DirectedAc... |
@Test public void testTopoIterationOrderComplexGraph() { for (int seed = 0; seed < 20; seed++) { DirectedAcyclicGraph<Long, DefaultEdge> dag = new DirectedAcyclicGraph<>(DefaultEdge.class); RepeatableRandomGraphGenerator<Long, DefaultEdge> graphGen = new RepeatableRandomGraphGenerator<>(100, 500, seed); graphGen.genera... | public Iterator<V> iterator() { return new TopoIterator(); } | DirectedAcyclicGraph extends SimpleDirectedGraph<V, E> implements Iterable<V> { public Iterator<V> iterator() { return new TopoIterator(); } } | DirectedAcyclicGraph extends SimpleDirectedGraph<V, E> implements Iterable<V> { public Iterator<V> iterator() { return new TopoIterator(); } DirectedAcyclicGraph(Class<? extends E> edgeClass); DirectedAcyclicGraph(Class<? extends E> edgeClass, boolean weighted); DirectedAcyclicGraph(EdgeFactory<V, E> ef); DirectedAc... | DirectedAcyclicGraph extends SimpleDirectedGraph<V, E> implements Iterable<V> { public Iterator<V> iterator() { return new TopoIterator(); } DirectedAcyclicGraph(Class<? extends E> edgeClass); DirectedAcyclicGraph(Class<? extends E> edgeClass, boolean weighted); DirectedAcyclicGraph(EdgeFactory<V, E> ef); DirectedAc... | DirectedAcyclicGraph extends SimpleDirectedGraph<V, E> implements Iterable<V> { public Iterator<V> iterator() { return new TopoIterator(); } DirectedAcyclicGraph(Class<? extends E> edgeClass); DirectedAcyclicGraph(Class<? extends E> edgeClass, boolean weighted); DirectedAcyclicGraph(EdgeFactory<V, E> ef); DirectedAc... |
@Test public void testWhenVertexIsNotInGraph_Then_ThowException() { DirectedAcyclicGraph<Long, DefaultEdge> dag = new DirectedAcyclicGraph<>(DefaultEdge.class); try { dag.addEdge(1l, 2l); } catch (IllegalArgumentException e) { return; } fail("No exception 'IllegalArgumentException' catched"); } | @Override public E addEdge(V sourceVertex, V targetVertex) { assertVertexExist(sourceVertex); assertVertexExist(targetVertex); E result; try { updateDag(sourceVertex, targetVertex); result = super.addEdge(sourceVertex, targetVertex); } catch (CycleFoundException e) { throw new IllegalArgumentException(EDGE_WOULD_INDUCE... | DirectedAcyclicGraph extends SimpleDirectedGraph<V, E> implements Iterable<V> { @Override public E addEdge(V sourceVertex, V targetVertex) { assertVertexExist(sourceVertex); assertVertexExist(targetVertex); E result; try { updateDag(sourceVertex, targetVertex); result = super.addEdge(sourceVertex, targetVertex); } catc... | DirectedAcyclicGraph extends SimpleDirectedGraph<V, E> implements Iterable<V> { @Override public E addEdge(V sourceVertex, V targetVertex) { assertVertexExist(sourceVertex); assertVertexExist(targetVertex); E result; try { updateDag(sourceVertex, targetVertex); result = super.addEdge(sourceVertex, targetVertex); } catc... | DirectedAcyclicGraph extends SimpleDirectedGraph<V, E> implements Iterable<V> { @Override public E addEdge(V sourceVertex, V targetVertex) { assertVertexExist(sourceVertex); assertVertexExist(targetVertex); E result; try { updateDag(sourceVertex, targetVertex); result = super.addEdge(sourceVertex, targetVertex); } catc... | DirectedAcyclicGraph extends SimpleDirectedGraph<V, E> implements Iterable<V> { @Override public E addEdge(V sourceVertex, V targetVertex) { assertVertexExist(sourceVertex); assertVertexExist(targetVertex); E result; try { updateDag(sourceVertex, targetVertex); result = super.addEdge(sourceVertex, targetVertex); } catc... |
@Test public void testZeroNodes() { GraphGenerator<Integer, DefaultEdge, Integer> gen = new GnmRandomBipartiteGraphGenerator<>(0, 0, 10); Graph<Integer, DefaultEdge> g = new DirectedPseudograph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(), null); assertEquals(0, g.vertexSet().size()); assertEqu... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i = 0; i < n1; i++) { V v = vertexFactory.createVertex(); target.addVer... | GnmRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnmRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnmRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnmRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... |
@Test public void testDirectedGraphGnm1() { GraphGenerator<Integer, DefaultEdge, Integer> gen = new GnmRandomBipartiteGraphGenerator<>(4, 4, 20, SEED); Graph<Integer, DefaultEdge> g = new DirectedPseudograph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(1), null); int[][] edges = { { 3, 5 }, { 6, ... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i = 0; i < n1; i++) { V v = vertexFactory.createVertex(); target.addVer... | GnmRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnmRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnmRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnmRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... |
@Test public void testUndirectedGraphGnm1() { GraphGenerator<Integer, DefaultEdge, Integer> gen = new GnmRandomBipartiteGraphGenerator<>(4, 4, 10, SEED); Graph<Integer, DefaultEdge> g = new SimpleGraph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(1), null); int[][] edges = { { 3, 5 }, { 1, 7 }, {... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i = 0; i < n1; i++) { V v = vertexFactory.createVertex(); target.addVer... | GnmRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnmRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnmRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnmRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... |
@Test public void testGnmEdgesLimit() { try { GraphGenerator<Integer, DefaultEdge, Integer> gen = new GnmRandomBipartiteGraphGenerator<>(4, 4, 17, SEED); Graph<Integer, DefaultEdge> g = new SimpleGraph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(), null); fail("More edges than permitted"); } cat... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i = 0; i < n1; i++) { V v = vertexFactory.createVertex(); target.addVer... | GnmRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnmRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnmRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnmRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... |
@Test public void testZeroNodes() { GraphGenerator<Integer, DefaultEdge, Integer> gen = new GnpRandomBipartiteGraphGenerator<>(0, 0, 0.5); Graph<Integer, DefaultEdge> g = new DirectedPseudograph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(1), null); assertEquals(0, g.vertexSet().size()); assertE... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i = 0; i < n1; i++) { V v = vertexFactory.createVertex(); target.addVer... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... |
@Test public void testGraph2b() throws UnsupportedEncodingException, ExportException, ImportException { Graph<Integer, DefaultEdge> orig= NamedGraphGenerator.ellinghamHorton78Graph(); String res = exportGraph(orig, Graph6Sparse6Exporter.Format.GRAPH6); Graph<Integer, DefaultEdge> g = importGraph(res); this.compare(orig... | @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or multiple edges."); List<V> vertices = new ArrayList<>(g.ver... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... |
@Test public void testDirectedGraphGnp1() { GraphGenerator<Integer, DefaultEdge, Integer> gen = new GnpRandomBipartiteGraphGenerator<>(4, 4, 0.5, SEED); Graph<Integer, DefaultEdge> g = new DirectedPseudograph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(1), null); int[][] edges = { { 5, 1 }, { 1,... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i = 0; i < n1; i++) { V v = vertexFactory.createVertex(); target.addVer... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... |
@Test public void testDirectedGraphGnp2() { GraphGenerator<Integer, DefaultEdge, Integer> gen = new GnpRandomBipartiteGraphGenerator<>(4, 4, 1.0, SEED); Graph<Integer, DefaultEdge> g = new DirectedPseudograph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(1), null); assertEquals(4 + 4, g.vertexSet(... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i = 0; i < n1; i++) { V v = vertexFactory.createVertex(); target.addVer... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... |
@Test public void testDirectedGraphGnp3() { GraphGenerator<Integer, DefaultEdge, Integer> gen = new GnpRandomBipartiteGraphGenerator<>(4, 4, 0.1, SEED); Graph<Integer, DefaultEdge> g = new DirectedPseudograph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(1), null); int[][] edges = { { 5, 1 }, { 7,... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i = 0; i < n1; i++) { V v = vertexFactory.createVertex(); target.addVer... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... |
@Test public void testUndirectedGraphGnp1() { GraphGenerator<Integer, DefaultEdge, Integer> gen = new GnpRandomBipartiteGraphGenerator<>(4, 4, 0.5, SEED); Graph<Integer, DefaultEdge> g = new SimpleGraph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(1), null); int[][] edges = { { 1, 6 }, { 1, 7 }, ... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i = 0; i < n1; i++) { V v = vertexFactory.createVertex(); target.addVer... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... |
@Test public void testUndirectedGraphGnp2() { GraphGenerator<Integer, DefaultEdge, Integer> gen = new GnpRandomBipartiteGraphGenerator<>(4, 4, 1.0, SEED); Graph<Integer, DefaultEdge> g = new SimpleGraph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(1), null); assertEquals(4 + 4, g.vertexSet().size... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i = 0; i < n1; i++) { V v = vertexFactory.createVertex(); target.addVer... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... |
@Test public void testUndirectedGraphGnp3() { GraphGenerator<Integer, DefaultEdge, Integer> gen = new GnpRandomBipartiteGraphGenerator<>(4, 4, 0.0, SEED); Graph<Integer, DefaultEdge> g = new SimpleGraph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(1), null); assertEquals(4 + 4, g.vertexSet().size... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i = 0; i < n1; i++) { V v = vertexFactory.createVertex(); target.addVer... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... | GnpRandomBipartiteGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n1 + n2 == 0) { return; } int previousVertexSetSize = target.vertexSet().size(); partitionA = new LinkedHashMap<>(n1); for (int i... |
@Test public void testZeroNodes() { GraphGenerator<Integer, DefaultEdge, Integer> gen = new GnmRandomGraphGenerator<>(0, 0); Graph<Integer, DefaultEdge> g = new DirectedPseudograph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(), null); assertEquals(0, g.vertexSet().size()); assertEquals(0, g.edge... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, E> abg = (AbstractBaseGraph<V, E>) target; if (!abg.isAllowin... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... |
@Test public void testZeroEdge() { GraphGenerator<Integer, DefaultEdge, Integer> gen = new GnmRandomGraphGenerator<>(10, 0); Graph<Integer, DefaultEdge> g = new DirectedPseudograph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(), null); assertEquals(10, g.vertexSet().size()); assertEquals(0, g.edg... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, E> abg = (AbstractBaseGraph<V, E>) target; if (!abg.isAllowin... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... |
@Test public void testDirectedGraphGnp1() { GraphGenerator<Integer, DefaultEdge, Integer> gen = new GnmRandomGraphGenerator<>(6, 18, SEED); Graph<Integer, DefaultEdge> g = new DirectedPseudograph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(1), null); int[][] edges = { { 6, 5 }, { 1, 6 }, { 5, 6 ... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, E> abg = (AbstractBaseGraph<V, E>) target; if (!abg.isAllowin... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... |
@Test public void testDirectedGraphGnp1WithLoops() { GraphGenerator<Integer, DefaultEdge, Integer> gen = new GnmRandomGraphGenerator<>(6, 18, SEED, true, false); Graph<Integer, DefaultEdge> g = new DirectedPseudograph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(1), null); int[][] edges = { { 6, ... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, E> abg = (AbstractBaseGraph<V, E>) target; if (!abg.isAllowin... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... |
@Test public void testGraph3b() throws UnsupportedEncodingException, ExportException, ImportException { Graph<Integer, DefaultEdge> orig= NamedGraphGenerator.klein3RegularGraph(); String res = exportGraph(orig, Graph6Sparse6Exporter.Format.GRAPH6); Graph<Integer, DefaultEdge> g = importGraph(res); this.compare(orig, g)... | @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or multiple edges."); List<V> vertices = new ArrayList<>(g.ver... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... |
@Test public void testDirectedGraphGnp1WithMultipleEdges() { GraphGenerator<Integer, DefaultEdge, Integer> gen = new GnmRandomGraphGenerator<>(6, 18, SEED, false, true); Graph<Integer, DefaultEdge> g = new DirectedPseudograph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(1), null); int[][] edges =... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, E> abg = (AbstractBaseGraph<V, E>) target; if (!abg.isAllowin... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... |
@Test public void testDirectedGraphGnp1WithLoopsAndMultipleEdges() { GraphGenerator<Integer, DefaultEdge, Integer> gen = new GnmRandomGraphGenerator<>(6, 18, SEED, true, true); Graph<Integer, DefaultEdge> g = new DirectedPseudograph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(1), null); int[][] ... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, E> abg = (AbstractBaseGraph<V, E>) target; if (!abg.isAllowin... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... |
@Test public void testUndirectedGraphGnp1() { GraphGenerator<Integer, DefaultEdge, Integer> gen = new GnmRandomGraphGenerator<>(6, 15, SEED); Graph<Integer, DefaultEdge> g = new Pseudograph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(1), null); int[][] edges = { { 6, 5 }, { 1, 6 }, { 3, 4 }, { 6... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, E> abg = (AbstractBaseGraph<V, E>) target; if (!abg.isAllowin... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... |
@Test public void testUndirectedGraphGnp1WithLoops() { GraphGenerator<Integer, DefaultEdge, Integer> gen = new GnmRandomGraphGenerator<>(6, 15, SEED, true, false); Graph<Integer, DefaultEdge> g = new Pseudograph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(1), null); int[][] edges = { { 6, 5 }, {... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, E> abg = (AbstractBaseGraph<V, E>) target; if (!abg.isAllowin... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... |
@Test public void testNotAllowedLoopsOrMultipleEdges() { try { GraphGenerator<Integer, DefaultEdge, Integer> gen = new GnmRandomGraphGenerator<>(6, 18, SEED, true, false); Graph<Integer, DefaultEdge> g = new SimpleDirectedGraph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(), null); fail("Exceptio... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, E> abg = (AbstractBaseGraph<V, E>) target; if (!abg.isAllowin... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... |
@Test public void testEdgeLimitsDirected() { try { GraphGenerator<Integer, DefaultEdge, Integer> gen1 = new GnmRandomGraphGenerator<>(5, 21, SEED, false, false); Graph<Integer, DefaultEdge> g1 = new SimpleDirectedGraph<>(DefaultEdge.class); gen1.generateGraph(g1, new IntegerVertexFactory(), null); fail("Exception expec... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, E> abg = (AbstractBaseGraph<V, E>) target; if (!abg.isAllowin... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... |
@Test public void testEdgeLimitsUndirected() { try { GraphGenerator<Integer, DefaultEdge, Integer> gen1 = new GnmRandomGraphGenerator<>(5, 11, SEED, false, false); Graph<Integer, DefaultEdge> g1 = new SimpleGraph<>(DefaultEdge.class); gen1.generateGraph(g1, new IntegerVertexFactory(), null); fail("Exception expected");... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, E> abg = (AbstractBaseGraph<V, E>) target; if (!abg.isAllowin... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... |
@Test public void testMaximumAllowedEdges() { boolean isDirected = false; assertEquals( 0, GnmRandomGraphGenerator.computeMaximumAllowedEdges(0, isDirected, false, false)); assertEquals( 0, GnmRandomGraphGenerator.computeMaximumAllowedEdges(0, isDirected, false, true)); assertEquals( 0, GnmRandomGraphGenerator.computeM... | static <V, E> int computeMaximumAllowedEdges( int n, boolean isDirected, boolean createLoops, boolean createMultipleEdges) { if (n == 0) { return 0; } int maxAllowedEdges; try { if (isDirected) { maxAllowedEdges = Math.multiplyExact(n, n - 1); } else { if (n % 2 == 0) { maxAllowedEdges = Math.multiplyExact(n / 2, n - 1... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { static <V, E> int computeMaximumAllowedEdges( int n, boolean isDirected, boolean createLoops, boolean createMultipleEdges) { if (n == 0) { return 0; } int maxAllowedEdges; try { if (isDirected) { maxAllowedEdges = Math.multiplyExact(n, n - 1); } else { if (n ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { static <V, E> int computeMaximumAllowedEdges( int n, boolean isDirected, boolean createLoops, boolean createMultipleEdges) { if (n == 0) { return 0; } int maxAllowedEdges; try { if (isDirected) { maxAllowedEdges = Math.multiplyExact(n, n - 1); } else { if (n ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { static <V, E> int computeMaximumAllowedEdges( int n, boolean isDirected, boolean createLoops, boolean createMultipleEdges) { if (n == 0) { return 0; } int maxAllowedEdges; try { if (isDirected) { maxAllowedEdges = Math.multiplyExact(n, n - 1); } else { if (n ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { static <V, E> int computeMaximumAllowedEdges( int n, boolean isDirected, boolean createLoops, boolean createMultipleEdges) { if (n == 0) { return 0; } int maxAllowedEdges; try { if (isDirected) { maxAllowedEdges = Math.multiplyExact(n, n - 1); } else { if (n ... |
@Test public void testCannotGuessGraphType() { try { GraphGenerator<Integer, DefaultEdge, Integer> gen1 = new GnmRandomGraphGenerator<>(5, 11, SEED, false, false); GraphDelegator<Integer, DefaultEdge> g1 = new GraphDelegator<>(new SimpleGraph<>(DefaultEdge.class)); gen1.generateGraph(g1, new IntegerVertexFactory(), nul... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, E> abg = (AbstractBaseGraph<V, E>) target; if (!abg.isAllowin... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... |
@Test public void testBadVertexFactory() { GraphGenerator<String, DefaultEdge, String> randomGen = new GnmRandomGraphGenerator<>(10, 3); Graph<String, DefaultEdge> graph = new SimpleDirectedGraph<>(DefaultEdge.class); try { randomGen.generateGraph(graph, new ClassBasedVertexFactory<>(String.class), null); fail("Illegal... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, E> abg = (AbstractBaseGraph<V, E>) target; if (!abg.isAllowin... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... | GnmRandomGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } boolean createLoops = loops; if (createLoops) { if (target instanceof AbstractBaseGraph<?, ?>) { AbstractBaseGraph<V, ... |
@Test public void testRandomGraphsG6() throws UnsupportedEncodingException, ExportException, ImportException { GnpRandomGraphGenerator<Integer, DefaultEdge> gnp=new GnpRandomGraphGenerator<>(40, .55, 0); for(int i=0; i<20; i++){ Graph<Integer, DefaultEdge> orig=new SimpleGraph<>(DefaultEdge.class); gnp.generateGraph(or... | @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or multiple edges."); List<V> vertices = new ArrayList<>(g.ver... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... | Graph6Sparse6Exporter implements GraphExporter<V, E> { @Override public void exportGraph(Graph<V, E> g, Writer writer) throws ExportException { GraphTests.requireUndirected(g); if(format == Format.GRAPH6 && !GraphTests.isSimple(g)) throw new ExportException("Graphs exported in graph6 format cannot contain loops or mult... |
@Test public void testCubicalGraph() { Graph<Integer, DefaultEdge> g = new SimpleGraph<>(DefaultEdge.class); GeneralizedPetersenGraphGenerator<Integer, DefaultEdge> gpgg = new GeneralizedPetersenGraphGenerator<>(4, 1); gpgg.generateGraph(g, new IntegerVertexFactory(), null); this.validateBasics(g, 8, 12, 3, 3, 4); asse... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, List<V>> resultMap) { List<V> verticesU = new ArrayList<>(n); List<V> verticesV = new ArrayList<>(n); for (int i = 0; i < n; i++) { verticesU.add(vertexFactory.createVertex()); verticesV.add(vertexFactory.createVertex()... | GeneralizedPetersenGraphGenerator implements GraphGenerator<V, E, List<V>> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, List<V>> resultMap) { List<V> verticesU = new ArrayList<>(n); List<V> verticesV = new ArrayList<>(n); for (int i = 0; i < n; i++) { verticesU.... | GeneralizedPetersenGraphGenerator implements GraphGenerator<V, E, List<V>> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, List<V>> resultMap) { List<V> verticesU = new ArrayList<>(n); List<V> verticesV = new ArrayList<>(n); for (int i = 0; i < n; i++) { verticesU.... | GeneralizedPetersenGraphGenerator implements GraphGenerator<V, E, List<V>> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, List<V>> resultMap) { List<V> verticesU = new ArrayList<>(n); List<V> verticesV = new ArrayList<>(n); for (int i = 0; i < n; i++) { verticesU.... | GeneralizedPetersenGraphGenerator implements GraphGenerator<V, E, List<V>> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, List<V>> resultMap) { List<V> verticesU = new ArrayList<>(n); List<V> verticesV = new ArrayList<>(n); for (int i = 0; i < n; i++) { verticesU.... |
@Test public void test4RegularNoRewiring() { final long seed = 5; GraphGenerator<Integer, DefaultEdge, Integer> gen = new WattsStrogatzGraphGenerator<>(6, 4, 0.0, seed); Graph<Integer, DefaultEdge> g = new SimpleGraph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(), null); assertEquals(6, g.vertex... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Map<V, List<E>> adj = new LinkedHashMap<>(n); for (int i = 0; i < n... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... |
@Test public void test4RegularSomeRewiring() { final long seed = 5; GraphGenerator<Integer, DefaultEdge, Integer> gen = new WattsStrogatzGraphGenerator<>(6, 4, 0.5, seed); Graph<Integer, DefaultEdge> g = new SimpleGraph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(), null); assertEquals(6, g.vert... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Map<V, List<E>> adj = new LinkedHashMap<>(n); for (int i = 0; i < n... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... |
@Test public void test4RegularMoreRewiring() { final long seed = 5; GraphGenerator<Integer, DefaultEdge, Integer> gen = new WattsStrogatzGraphGenerator<>(6, 4, 0.8, seed); Graph<Integer, DefaultEdge> g = new SimpleGraph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(), null); assertEquals(6, g.vert... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Map<V, List<E>> adj = new LinkedHashMap<>(n); for (int i = 0; i < n... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... |
@Test public void test4RegularAddShortcutInsteadOfRewiring() { final long seed = 5; GraphGenerator<Integer, DefaultEdge, Integer> gen = new WattsStrogatzGraphGenerator<>(6, 4, 0.5, true, new Random(seed)); Graph<Integer, DefaultEdge> g = new SimpleGraph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactor... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Map<V, List<E>> adj = new LinkedHashMap<>(n); for (int i = 0; i < n... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... |
@Test public void test6RegularNoRewiring() { final long seed = 5; GraphGenerator<Integer, DefaultEdge, Integer> gen = new WattsStrogatzGraphGenerator<>(12, 6, 0.0, seed); Graph<Integer, DefaultEdge> g = new SimpleGraph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(), null); assertEquals(12, g.vert... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Map<V, List<E>> adj = new LinkedHashMap<>(n); for (int i = 0; i < n... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... |
@Test public void test6RegularSomeRewiring() { final long seed = 5; GraphGenerator<Integer, DefaultEdge, Integer> gen = new WattsStrogatzGraphGenerator<>(12, 6, 0.7, seed); Graph<Integer, DefaultEdge> g = new SimpleGraph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(), null); assertEquals(12, g.ve... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Map<V, List<E>> adj = new LinkedHashMap<>(n); for (int i = 0; i < n... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... |
@Test public void test4RegularNoRewiringDirected() { final long seed = 5; GraphGenerator<Integer, DefaultEdge, Integer> gen = new WattsStrogatzGraphGenerator<>(6, 4, 0.0, seed); Graph<Integer, DefaultEdge> g = new SimpleDirectedGraph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(), null); assertEq... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Map<V, List<E>> adj = new LinkedHashMap<>(n); for (int i = 0; i < n... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... | WattsStrogatzGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { if (n == 0) { return; } else if (n == 1) { target.addVertex(vertexFactory.createVertex()); return; } List<V> ring = new ArrayList<>(n); Ma... |
@Test(expected = IllegalArgumentException.class) public void testMultiGraph() { final long seed = 5; GraphGenerator<Integer, DefaultEdge, Integer> gen = new LinearizedChordDiagramGraphGenerator<>(10, 2, seed); Graph<Integer, DefaultEdge> g = new Multigraph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFac... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (!target.addVertex(vt)) { throw new IllegalArgumentException("Invalid vertex factory"); }... | LinearizedChordDiagramGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (!target.addVer... | LinearizedChordDiagramGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (!target.addVer... | LinearizedChordDiagramGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (!target.addVer... | LinearizedChordDiagramGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (!target.addVer... |
@Test(expected = IllegalArgumentException.class) public void testSimpleGraph() { final long seed = 5; GraphGenerator<Integer, DefaultEdge, Integer> gen = new LinearizedChordDiagramGraphGenerator<>(10, 2, seed); Graph<Integer, DefaultEdge> g = new SimpleGraph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexF... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (!target.addVertex(vt)) { throw new IllegalArgumentException("Invalid vertex factory"); }... | LinearizedChordDiagramGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (!target.addVer... | LinearizedChordDiagramGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (!target.addVer... | LinearizedChordDiagramGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (!target.addVer... | LinearizedChordDiagramGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (!target.addVer... |
@Test public void testNotSupportedGraph() { String input = "graph [ node [ id 1 ] " + "edge [ source 1 target 1 ] ]"; Graph<String, DefaultEdge> g = new SimpleGraph<>(DefaultEdge.class); VertexProvider<String> vp = (label, attributes) -> label; EdgeProvider<String, DefaultEdge> ep = (from, to, label, attributes) -> g.g... | @Override public void importGraph(Graph<V, E> graph, Reader input) throws ImportException { try { ThrowingErrorListener errorListener = new ThrowingErrorListener(); GmlLexer lexer = new GmlLexer(new ANTLRInputStream(input)); lexer.removeErrorListeners(); lexer.addErrorListener(errorListener); GmlParser parser = new Gml... | GmlImporter extends AbstractBaseImporter<V, E> implements GraphImporter<V, E> { @Override public void importGraph(Graph<V, E> graph, Reader input) throws ImportException { try { ThrowingErrorListener errorListener = new ThrowingErrorListener(); GmlLexer lexer = new GmlLexer(new ANTLRInputStream(input)); lexer.removeErr... | GmlImporter extends AbstractBaseImporter<V, E> implements GraphImporter<V, E> { @Override public void importGraph(Graph<V, E> graph, Reader input) throws ImportException { try { ThrowingErrorListener errorListener = new ThrowingErrorListener(); GmlLexer lexer = new GmlLexer(new ANTLRInputStream(input)); lexer.removeErr... | GmlImporter extends AbstractBaseImporter<V, E> implements GraphImporter<V, E> { @Override public void importGraph(Graph<V, E> graph, Reader input) throws ImportException { try { ThrowingErrorListener errorListener = new ThrowingErrorListener(); GmlLexer lexer = new GmlLexer(new ANTLRInputStream(input)); lexer.removeErr... | GmlImporter extends AbstractBaseImporter<V, E> implements GraphImporter<V, E> { @Override public void importGraph(Graph<V, E> graph, Reader input) throws ImportException { try { ThrowingErrorListener errorListener = new ThrowingErrorListener(); GmlLexer lexer = new GmlLexer(new ANTLRInputStream(input)); lexer.removeErr... |
@Test(expected = IllegalArgumentException.class) public void testDirectedMultiGraph() { final long seed = 5; GraphGenerator<Integer, DefaultEdge, Integer> gen = new LinearizedChordDiagramGraphGenerator<>(10, 2, seed); Graph<Integer, DefaultEdge> g = new DirectedMultigraph<>(DefaultEdge.class); gen.generateGraph(g, new ... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (!target.addVertex(vt)) { throw new IllegalArgumentException("Invalid vertex factory"); }... | LinearizedChordDiagramGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (!target.addVer... | LinearizedChordDiagramGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (!target.addVer... | LinearizedChordDiagramGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (!target.addVer... | LinearizedChordDiagramGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (!target.addVer... |
@Test(expected = IllegalArgumentException.class) public void testDirectedSimpleGraph() { final long seed = 5; GraphGenerator<Integer, DefaultEdge, Integer> gen = new LinearizedChordDiagramGraphGenerator<>(10, 2, seed); Graph<Integer, DefaultEdge> g = new SimpleDirectedGraph<>(DefaultEdge.class); gen.generateGraph(g, ne... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (!target.addVertex(vt)) { throw new IllegalArgumentException("Invalid vertex factory"); }... | LinearizedChordDiagramGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (!target.addVer... | LinearizedChordDiagramGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (!target.addVer... | LinearizedChordDiagramGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (!target.addVer... | LinearizedChordDiagramGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (!target.addVer... |
@Test public void testUndirected() { final long seed = 5; GraphGenerator<Integer, DefaultEdge, Integer> gen = new LinearizedChordDiagramGraphGenerator<>(20, 1, seed); Graph<Integer, DefaultEdge> g = new Pseudograph<>(DefaultEdge.class); gen.generateGraph(g, new IntegerVertexFactory(), null); assertEquals(20, g.vertexSe... | @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (!target.addVertex(vt)) { throw new IllegalArgumentException("Invalid vertex factory"); }... | LinearizedChordDiagramGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (!target.addVer... | LinearizedChordDiagramGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (!target.addVer... | LinearizedChordDiagramGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (!target.addVer... | LinearizedChordDiagramGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (!target.addVer... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.