hexsha
stringlengths
40
40
size
int64
8
1.04M
content
stringlengths
8
1.04M
avg_line_length
float64
2.24
100
max_line_length
int64
4
1k
alphanum_fraction
float64
0.25
0.97
2f7a6062f0a8e73deaa9cb0b894fdcd8600348bb
1,071
package bean; public class AddressDealBean { private int userId; private int addressId; private boolean flag; private String address1; private String address2; private String contact; private String phone; public String getAddress1() { return address1; } public void setAddress1(String address1) { this.address1 = address1; } public String getAddress2() { return address2; } public void setAddress2(String address2) { this.address2 = address2; } public String getContact() { return contact; } public void setContact(String contact) { this.contact = contact; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public int getUserId() { return userId; } public void setUserId(int userId) { this.userId = userId; } public int getAddressId() { return addressId; } public void setAddressId(int addressId) { this.addressId = addressId; } public boolean isFlag() { return flag; } public void setFlag(boolean flag) { this.flag = flag; } }
13.909091
43
0.699346
a6d8eb36b64ecae386b888ae6cc7b1e2c65151d9
823
package jts; import io.dropwizard.Application; import io.dropwizard.setup.Bootstrap; import io.dropwizard.setup.Environment; import io.dropwizard.forms.MultiPartBundle; public class JTSApplication extends Application<JTSConfiguration> { public static void main(final String[] args) throws Exception { new JTSApplication().run(args); } @Override public String getName() { return "jts-server"; } @Override public void initialize(final Bootstrap<JTSConfiguration> bootstrap) { bootstrap.addBundle(new MultiPartBundle()); } @Override public void run(final JTSConfiguration configuration, final Environment env) { env.jersey().register(new FixGeometryResource()); env.jersey().register(new ConcaveHullResource()); } }
23.514286
73
0.696233
ba700d4f0f2a86d5d2fa6b0d0c025e33b2b8ebd6
21,993
package ai.elimu.launcher.ui; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.res.Resources; import android.database.Cursor; import android.graphics.Point; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.text.TextUtils; import android.util.DisplayMetrics; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.GridLayout; import android.widget.ImageView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.fragment.app.Fragment; import androidx.viewpager2.adapter.FragmentStateAdapter; import androidx.viewpager2.widget.ViewPager2; import com.afollestad.materialdialogs.DialogAction; import com.afollestad.materialdialogs.GravityEnum; import com.afollestad.materialdialogs.MaterialDialog; import com.afollestad.materialdialogs.Theme; import com.matthewtamlin.sliding_intro_screen_library.indicators.DotIndicator; import java.util.ArrayList; import java.util.List; import java.util.Locale; import ai.elimu.launcher.BuildConfig; import ai.elimu.launcher.R; import ai.elimu.launcher.util.CursorToApplicationConverter; import ai.elimu.model.v2.enums.content.LiteracySkill; import ai.elimu.model.v2.enums.content.NumeracySkill; import ai.elimu.model.v2.gson.application.ApplicationGson; import timber.log.Timber; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; public class HomeScreensActivity extends AppCompatActivity { private static final String APPSTORE_DOWNLOAD_URL = "https://github.com/elimu-ai/appstore/releases"; public static final double WIDTH_INCREMENT = 0.1; private SectionsPagerAdapter mSectionsPagerAdapter; private View background; private ViewPager2 viewPager; private DotIndicator dotIndicator; private static List<ApplicationGson> applications; private boolean isRightToLeft; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home_screens); getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); // Check if the elimu.ai Appstore is already installed checkIfAppstoreIsInstalled(); // Create the adapter that will return a fragment for each of the primary sections of the activity. mSectionsPagerAdapter = new SectionsPagerAdapter(this); // Set up the ViewPager with the sections adapter. viewPager = findViewById(R.id.container); viewPager.setAdapter(mSectionsPagerAdapter); dotIndicator = findViewById(R.id.dotIndicator); background = findViewById(R.id.background); isRightToLeft = TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL; //Increase the width of the background image to apply the parallax effect updateBackgroundImageWidth(); final int pageTranslation = (int) (getDisplayWidth() * WIDTH_INCREMENT / (mSectionsPagerAdapter.getItemCount() -1)); viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { Timber.i("onPageScrolled"); if (positionOffset >= -1 && positionOffset <= 1) { int translationX = - (int) ((position + positionOffset) * pageTranslation); if (isRightToLeft) { translationX = - (int) (translationX + getDisplayWidth() * WIDTH_INCREMENT); } background.setTranslationX(translationX); } } @Override public void onPageSelected(int position) { Timber.i("onPageSelected"); if (isRightToLeft) { dotIndicator.setSelectedItem(dotIndicator.getNumberOfItems() - 1 - position, true); } else { dotIndicator.setSelectedItem(position, true); } } @Override public void onPageScrollStateChanged(int state) { Timber.i("onPageScrollStateChanged"); } }); // Fetch Applications from the Appstore's ContentProvider applications = new ArrayList<>(); Uri uri = Uri.parse("content://" + BuildConfig.APPSTORE_APPLICATION_ID + ".provider.application_provider/applications"); Timber.i("uri: " + uri); Cursor cursor = getContentResolver().query(uri, null, null, null, null); if (cursor != null) { Timber.i("cursor.getCount(): " + cursor.getCount()); if (cursor.getCount() > 0) { boolean isLast = false; while (!isLast) { cursor.moveToNext(); // Convert from database row to Gson ApplicationGson application = CursorToApplicationConverter.getApplication(cursor); applications.add(application); isLast = cursor.isLast(); } Timber.i("cursor.isClosed(): " + cursor.isClosed()); cursor.close(); } else { Toast.makeText(getApplicationContext(), "cursor.getCount() == 0", Toast.LENGTH_LONG).show(); } } else { Toast.makeText(getApplicationContext(), "cursor == null", Toast.LENGTH_LONG).show(); } Timber.i("applications.size(): " + applications.size()); } private void checkIfAppstoreIsInstalled() { try { PackageInfo packageInfoAppstore = getPackageManager().getPackageInfo(BuildConfig.APPSTORE_APPLICATION_ID, 0); Timber.i("packageInfoAppstore.versionCode: " + packageInfoAppstore.versionCode); } catch (PackageManager.NameNotFoundException e) { Timber.w(null, e); new MaterialDialog.Builder(this) .content(getResources().getString(R.string.appstore_needed) + BuildConfig.APPSTORE_APPLICATION_ID) .positiveText(getResources().getString(R.string.download)) .onPositive(new MaterialDialog.SingleButtonCallback() { @Override public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(APPSTORE_DOWNLOAD_URL)); startActivity(intent); } }) .show(); } } private void updateBackgroundImageWidth() { int backgroundWidth = (int) (getDisplayWidth() * (1 + WIDTH_INCREMENT)); ConstraintLayout.LayoutParams layoutParams = new ConstraintLayout.LayoutParams(backgroundWidth, MATCH_PARENT); background.setLayoutParams(layoutParams); if (isRightToLeft) { background.setTranslationX(-(float) (getDisplayWidth() * WIDTH_INCREMENT)); } } private int getDisplayWidth() { Point displaySize = new Point(); getWindowManager().getDefaultDisplay().getSize(displaySize); return displaySize.x; } public static class PlaceholderFragment extends Fragment { private static final String ARG_SECTION_NUMBER = "section_number"; // Skill: Tablet navigation private ConstraintLayout tabletNavigationContainer; private ImageView tabletNavigationImageView; // Skills: EGRA private ConstraintLayout egraOralVocabularyContainer; private ImageView egraOralVocabularyImageView; private ConstraintLayout egraPhonemicAwarenessContainer; private ImageView egraPhonemicAwarenessImageView; private ConstraintLayout egraLetterIdentificationContainer; private ImageView egraLetterIdentificationImageView; private ConstraintLayout egraSyllableNamingContainer; private ImageView egraSyllableNamingImageView; // Skills: EGMA private ConstraintLayout egmaOralCountingContainer; private ImageView egmaOralCountingImageView; private ConstraintLayout egmaNumberIdentificationContainer; private ImageView egmaNumberIdentificationImageView; private ConstraintLayout egmaMissingNumberContainer; private ImageView egmaMissingNumberImageView; public PlaceholderFragment() { } public static PlaceholderFragment newInstance(int sectionNumber) { PlaceholderFragment fragment = new PlaceholderFragment(); Bundle args = new Bundle(); args.putInt(ARG_SECTION_NUMBER, sectionNumber); fragment.setArguments(args); return fragment; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Timber.i("onCreateView"); int sectionNumber = getArguments().getInt(ARG_SECTION_NUMBER); Timber.i("sectionNumber: " + sectionNumber); int layoutIdentifier = getResources().getIdentifier("fragment_home_screen" + String.valueOf(sectionNumber), "layout", getActivity().getPackageName()); View rootView = inflater.inflate(layoutIdentifier, container, false); if (sectionNumber == 1) { // 1. Tablet navigation tabletNavigationContainer = rootView.findViewById(R.id.tabletNavigationContainer); tabletNavigationImageView = rootView.findViewById(R.id.tabletNavigationImageView); tabletNavigationImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Timber.i("tabletNavigationImageView onClick"); // Tablet Navigation // initializeDialog(null, null); initializeDialog(null, NumeracySkill.SHAPE_IDENTIFICATION); } }); // 2. EGRA skills egraOralVocabularyContainer = rootView.findViewById(R.id.egraOralVocabularyContainer); egraOralVocabularyImageView = rootView.findViewById(R.id.egraOralVocabularyImageView); egraOralVocabularyImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Timber.i("egraOralVocabularyImageView onClick"); // Oral Vocabulary and Listening Comprehension // TODO: include LiteracySkill.LISTENING_COMPREHENSION initializeDialog(LiteracySkill.ORAL_VOCABULARY, null); } }); egraPhonemicAwarenessContainer = rootView.findViewById(R.id.egraPhonemicAwarenessContainer); egraPhonemicAwarenessImageView = rootView.findViewById(R.id.egraPhonemicAwarenessImageView); egraPhonemicAwarenessImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Timber.i("egraPhonemicAwarenessImageView onClick"); // Phonemic Awareness initializeDialog(LiteracySkill.PHONEMIC_AWARENESS, null); } }); egraLetterIdentificationContainer = rootView.findViewById(R.id.egraLetterIdentificationContainer); egraLetterIdentificationImageView = rootView.findViewById(R.id.egraLetterIdentificationImageView); egraLetterIdentificationImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Timber.i("egraLetterIdentificationImageView onClick"); // Letter Identification initializeDialog(LiteracySkill.LETTER_IDENTIFICATION, null); } }); // 3. EGMA skills egmaOralCountingContainer = rootView.findViewById(R.id.egmaOralCountingContainer); egmaOralCountingImageView = rootView.findViewById(R.id.egmaOralCountingImageView); egmaOralCountingImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Timber.i("egmaOralCountingImageView onClick"); // Oral Counting initializeDialog(null, NumeracySkill.ORAL_COUNTING); } }); egmaNumberIdentificationContainer = rootView.findViewById(R.id.egmaNumberIdentificationContainer); egmaNumberIdentificationImageView = rootView.findViewById(R.id.egmaNumberIdentificationImageView); egmaNumberIdentificationImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Timber.i("egmaNumberIdentificationImageView onClick"); // Number Identification initializeDialog(null, NumeracySkill.NUMBER_IDENTIFICATION); } }); egmaMissingNumberContainer = rootView.findViewById(R.id.egmaMissingNumberContainer); egmaMissingNumberImageView = rootView.findViewById(R.id.egmaMissingNumberImageView); egmaMissingNumberImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Timber.i("egmaMissingNumberImageView onClick"); // Missing Number and Quantity Discrimination initializeDialog(null, NumeracySkill.MISSING_NUMBER); } }); } else if (sectionNumber == 2) { // 1. EGRA skills egraSyllableNamingContainer = rootView.findViewById(R.id.egraSyllableNamingContainer); egraSyllableNamingImageView = rootView.findViewById(R.id.egraSyllableNamingImageView); egraSyllableNamingImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Timber.i("egraSyllableNamingImageView onClick"); // Syllable Naming and Familiar Word Reading initializeDialog(LiteracySkill.FAMILIAR_WORD_READING, null); } }); // 2. EGMA skills // TODO } else if (sectionNumber == 3) { // TODO } else if (sectionNumber == 4) { // TODO } return rootView; } private void initializeDialog(LiteracySkill literacySkill, NumeracySkill numeracySkill) { Timber.i("initializeDialog"); String dialogTitle = null; if (false) { // TODO dialogTitle = "TABLET_NAVIGATION"; // TODO } else if (literacySkill != null) { dialogTitle = literacySkill.toString(); } else if (numeracySkill != null) { dialogTitle = numeracySkill.toString(); } MaterialDialog materialDialog = new MaterialDialog.Builder(getContext()) .customView(R.layout.dialog_apps, true) .theme(Theme.DARK) .title(dialogTitle) .titleGravity(GravityEnum.CENTER) .show(); View customView = materialDialog.getCustomView(); GridLayout appGridLayout = customView.findViewById(R.id.appGridLayout); for (final ApplicationGson application : applications) { Timber.i("application.getPackageName(): " + application.getPackageName()); boolean isTabletNavigationSkill = false; // TODO Timber.i("isTabletNavigationSkill: " + isTabletNavigationSkill); boolean isLiteracySkill = application.getLiteracySkills().contains(literacySkill); Timber.i("isLiteracySkill: " + isLiteracySkill); boolean isNumeracySkill = application.getNumeracySkills().contains(numeracySkill); Timber.i("isNumeracySkill: " + isNumeracySkill); if (isTabletNavigationSkill || isLiteracySkill || isNumeracySkill) { // Add Application to dialog // Check if the Application is already installed. If not, skip it. try { PackageInfo packageInfoAppstore = getContext().getPackageManager().getPackageInfo(application.getPackageName(), 0); Timber.i( "packageInfoAppstore.versionCode: " + packageInfoAppstore.versionCode); } catch (PackageManager.NameNotFoundException e) { Timber.i(e, "The Application has not been installed: " + application.getPackageName()); continue; } View appView = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_apps_app_view, appGridLayout, false); // Set app icon ImageView appIconImageView = appView.findViewById(R.id.appIconImageView); final PackageManager packageManager = getActivity().getPackageManager(); try { ApplicationInfo applicationInfo = packageManager.getApplicationInfo(application.getPackageName(), PackageManager.GET_META_DATA); Resources resources = packageManager.getResourcesForApplication(application.getPackageName()); Drawable icon = resources.getDrawableForDensity(applicationInfo.icon, DisplayMetrics.DENSITY_XXHIGH, null); appIconImageView.setImageDrawable(icon); } catch (PackageManager.NameNotFoundException e) { Timber.e(e); } // Open Application when pressing app icon appIconImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Timber.i("appIconImageView onClick"); Intent intent = packageManager.getLaunchIntentForPackage(application.getPackageName()); intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); startActivity(intent); // EventTracker.reportApplicationOpenedEvent(getContext(), activityInfo.packageName); } }); appGridLayout.addView(appView); } } } @Override public void onStart() { Timber.i("onCreateView"); super.onStart(); } @Override public void onResume() { Timber.i("onResume"); super.onResume(); // Add subtle movements to the space ships ObjectAnimator objectAnimatorEGRA = ObjectAnimator.ofFloat(egraOralVocabularyContainer, "rotation", 2 + ((int) Math.random() * 3)); objectAnimatorEGRA.setDuration(1000 + ((int) Math.random() * 1000)); objectAnimatorEGRA.setRepeatCount(ValueAnimator.INFINITE); objectAnimatorEGRA.setRepeatMode(ValueAnimator.REVERSE); objectAnimatorEGRA.start(); ObjectAnimator objectAnimatorEgmaPhonemicAwareness = ObjectAnimator.ofFloat(egraPhonemicAwarenessContainer, "rotation", 2 + ((int) Math.random() * 3)); objectAnimatorEgmaPhonemicAwareness.setDuration(1000 + ((int) Math.random() * 1000)); objectAnimatorEgmaPhonemicAwareness.setRepeatCount(ValueAnimator.INFINITE); objectAnimatorEgmaPhonemicAwareness.setRepeatMode(ValueAnimator.REVERSE); objectAnimatorEgmaPhonemicAwareness.start(); ObjectAnimator objectAnimatorEGMA = ObjectAnimator.ofFloat(egmaOralCountingContainer, "rotation", 2 + ((int) Math.random() * 3)); objectAnimatorEGMA.setDuration(1000 + ((int) Math.random() * 1000)); objectAnimatorEGMA.setRepeatCount(ValueAnimator.INFINITE); objectAnimatorEGMA.setRepeatMode(ValueAnimator.REVERSE); objectAnimatorEGMA.start(); } } public static class SectionsPagerAdapter extends FragmentStateAdapter { public SectionsPagerAdapter(AppCompatActivity activity) { super(activity); } @NonNull @Override public Fragment createFragment(int position) { return PlaceholderFragment.newInstance(position + 1); } @Override public int getItemCount() { return 4; } } @Override public void onBackPressed() { Timber.i("onBackPressed"); // Do nothing } }
42.955078
163
0.623926
fa7356bdf234a536c4d71f7ab2dc74ed4887e64d
8,712
package org.firstinspires.ftc.teamcode.match; import com.qualcomm.robotcore.eventloop.opmode.Autonomous; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.hardware.CRServo; import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.hardware.DcMotorSimple; import com.qualcomm.robotcore.hardware.Servo; @Autonomous public class RedDuckSquare extends LinearOpMode { private DcMotor rightFront; private DcMotor rightRear; private DcMotor leftFront; private DcMotor leftRear; private CRServo flipper; private Servo bucket; private DcMotor duck; //private DcMotor liftMotor; //add arm and arm2 and private DcMotor arm; @Override public void runOpMode() { leftFront = hardwareMap.get(DcMotor.class, "leftFront"); leftRear = hardwareMap.get(DcMotor.class, "leftRear"); rightFront = hardwareMap.get(DcMotor.class, "rightFront"); rightRear = hardwareMap.get(DcMotor.class, "rightRear"); flipper = hardwareMap.get(CRServo.class,"flipper"); bucket = hardwareMap.get(Servo.class,"bucket"); arm = hardwareMap.get(DcMotor.class, "arm"); duck = hardwareMap.get(DcMotor.class, "duck"); // liftMotor = hardwareMap.get(DcMotor.class,"liftMotor"); rightFront.setDirection(DcMotorSimple.Direction.REVERSE); rightRear.setDirection(DcMotorSimple.Direction.REVERSE); waitForStart(); telemetry.addData("Status", "Resetting Encoders"); // telemetry.update(); // Robot go vroom vroom while (opModeIsActive()) { //set motors to move to shipping tower. //straightRedDuck //raise arm arms(-3000); //move off wall movefast(-450,-450,-450,-450); //turn toward goal movefast(350,350,-350,-350); //move forward to goal movefast(-550,-550,-550,-550); score(); //back away from goal movefast(500,500,500,500); //turn back straight movefast(-350,-350,350,350); //back to wall move(600,600,600,600); bucket.setPosition(.25); down(); sleep(5); //move off wall movefast(-100, -100, -100, -100); //turn movefast(925, 925, -1000, -1000); //move to duck wheel move(1200,1200,1200,1200); sleep(200); moveslow(100,100,100,100); moveslow(-50,-50,50,50); duck(4500); //move() move(-200,-200,-200,-200); move(1000,1000,-1000,-1000); move(-400,-400,-400,-400); flipper.setPower(1); movefast(-450, 450, 450, -450); movefast(450, -450, -450, 450); movefast(-250, 250, 250, -250); movefast(250, -250, -250, 250); bucket.setPosition(0.0); flipper.setPower(0); movefast(-1200,1200,1200,-1200); move(300,300,300,300); arms(-6000); movefast(450,450,450,450); //turn toward goal movefast(350,350,-350,-350); //move forward to goal movefast(550,550,550,550); flipper.setPower(1); //back away from goal sleep(13000); //move(-1000,-1000,-1000,-1000); } } //=================movefast public void movefast(int rf, int rb, int lf, int lb) { rightFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); leftFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); rightRear.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); leftRear.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); rightFront.setTargetPosition(rf); rightRear.setTargetPosition(rb); leftFront.setTargetPosition(lf); leftRear.setTargetPosition(lb); rightFront.setMode(DcMotor.RunMode.RUN_TO_POSITION); leftFront.setMode(DcMotor.RunMode.RUN_TO_POSITION); rightRear.setMode(DcMotor.RunMode.RUN_TO_POSITION); leftRear.setMode(DcMotor.RunMode.RUN_TO_POSITION); rightRear.setPower(0.7); rightFront.setPower(0.7); leftFront.setPower(0.7); leftRear.setPower(0.7); while (leftFront.isBusy() && leftRear.isBusy() && rightFront.isBusy() && rightRear.isBusy()) { sleep(50); } rightFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); leftFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); rightRear.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); leftRear.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); rightRear.setPower(0); leftFront.setPower(0); rightFront.setPower(0); leftRear.setPower(0); } //----------------------------encoder----------------- public void move(int rf, int rb, int lf, int lb) { rightFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); leftFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); rightRear.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); leftRear.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); rightFront.setTargetPosition(rf); rightRear.setTargetPosition(rb); leftFront.setTargetPosition(lf); leftRear.setTargetPosition(lb); rightFront.setMode(DcMotor.RunMode.RUN_TO_POSITION); leftFront.setMode(DcMotor.RunMode.RUN_TO_POSITION); rightRear.setMode(DcMotor.RunMode.RUN_TO_POSITION); leftRear.setMode(DcMotor.RunMode.RUN_TO_POSITION); rightRear.setPower(0.5); rightFront.setPower(0.5); leftFront.setPower(0.5); leftRear.setPower(0.5); while (leftFront.isBusy() && leftRear.isBusy() && rightFront.isBusy() && rightRear.isBusy()) { sleep(50); } rightFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); leftFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); rightRear.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); leftRear.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); rightRear.setPower(0); leftFront.setPower(0); rightFront.setPower(0); leftRear.setPower(0); } //==========================duck public void duck(int time){ duck.setPower(-.4); sleep(time); duck.setPower(0); } //----------------------ARMS------------ public void arms(int encod) { // arm.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); arm.setTargetPosition(encod); arm.setMode(DcMotor.RunMode.RUN_TO_POSITION); arm.setPower(1); while (arm.isBusy()) { sleep(50); } } //================Score public void score() { bucket.setPosition(0.4); flipper.setPower(-1); sleep(1200); flipper.setPower(0); bucket.setPosition(0.0); } //===================down public void down(){ arm.setTargetPosition(-50); arm.setMode(DcMotor.RunMode.RUN_TO_POSITION); arm.setPower(-.5); while (arm.isBusy()) { sleep(50); } } //----------------------------MOVESLOW----------------- public void moveslow(int rf, int rb, int lf, int lb) { rightFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); leftFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); rightRear.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); leftRear.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); rightFront.setTargetPosition(rf); rightRear.setTargetPosition(rb); leftFront.setTargetPosition(lf); leftRear.setTargetPosition(lb); rightFront.setMode(DcMotor.RunMode.RUN_TO_POSITION); leftFront.setMode(DcMotor.RunMode.RUN_TO_POSITION); rightRear.setMode(DcMotor.RunMode.RUN_TO_POSITION); leftRear.setMode(DcMotor.RunMode.RUN_TO_POSITION); rightRear.setPower(0.3); rightFront.setPower(0.3); leftFront.setPower(0.3); leftRear.setPower(0.3); while (leftFront.isBusy() && leftRear.isBusy() && rightFront.isBusy() && rightRear.isBusy()) { sleep(50); } rightFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); leftFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); rightRear.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); leftRear.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); rightRear.setPower(0); leftFront.setPower(0); rightFront.setPower(0); leftRear.setPower(0); } }
28.470588
102
0.613522
20772ff739864bf478569aee368a9c14ae3c8820
5,448
package de.tud.nhd.petimo.view.fragments; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.LinearLayout; import de.tud.nhd.petimo.R; import de.tud.nhd.petimo.view.activities.EditBlockActivity; import de.tud.nhd.petimo.view.activities.EditTasksActivity; import de.tud.nhd.petimo.view.activities.MainActivity; import de.tud.nhd.petimo.view.activities.SettingsActivity; import de.tud.nhd.petimo.view.activities.StatisticsActivity; public class DrawerFragment extends Fragment { public static final String TAG = "DRAWER_FRAGMENT"; private static final String ARG_ACTIVITY = "ARG_ACTIVITY"; private String parentActivityTag; private OnFragmentInteractionListener mListener; View currentContainer; LinearLayout itemMonitor; LinearLayout itemMonitoredTasks; LinearLayout itemStatistics; LinearLayout itemManageTasks; LinearLayout itemSettings; public DrawerFragment() { } /** * * @param parentActivityTag Parameter 1. * @return A new instance of fragment DrawerFragment. */ public static DrawerFragment newInstance(String parentActivityTag) { DrawerFragment fragment = new DrawerFragment(); Bundle args = new Bundle(); args.putString(ARG_ACTIVITY, parentActivityTag); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) parentActivityTag = getArguments().getString(ARG_ACTIVITY); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_drawer, container, false); } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); itemMonitor = (LinearLayout) view.findViewById(R.id.item_monitor); itemMonitoredTasks = (LinearLayout) view.findViewById(R.id.item_monitored_tasks); itemStatistics = (LinearLayout) view.findViewById(R.id.item_statistics); itemManageTasks = (LinearLayout) view.findViewById(R.id.item_manage_tasks); itemSettings = (LinearLayout) view.findViewById(R.id.item_settings); itemMonitor.setOnClickListener( genOnclickListener(MainActivity.TAG, MainActivity.class)); itemMonitoredTasks.setOnClickListener( genOnclickListener(EditBlockActivity.TAG, EditBlockActivity.class)); itemStatistics.setOnClickListener(genOnclickListener( StatisticsActivity.TAG, StatisticsActivity.class)); itemManageTasks.setOnClickListener( genOnclickListener(EditTasksActivity.TAG, EditTasksActivity.class)); itemSettings.setOnClickListener( genOnclickListener(SettingsActivity.TAG, SettingsActivity.class)); } @Override public void onResume() { super.onResume(); initBackground(); } @Override public void onAttach(Context context) { super.onAttach(context); if (!(getActivity() instanceof OnFragmentInteractionListener)) throw new IllegalStateException( "Parent activity must implement OnFragmentInteractionListener!"); else this.mListener = (OnFragmentInteractionListener) getActivity(); } @Override public void onDetach() { super.onDetach(); } private void initBackground(){ setContainerBackground(itemMonitor, MainActivity.TAG); setContainerBackground(itemMonitoredTasks, EditBlockActivity.TAG); setContainerBackground(itemStatistics, StatisticsActivity.TAG); setContainerBackground(itemManageTasks, EditTasksActivity.TAG); setContainerBackground(itemSettings, SettingsActivity.TAG); } private View.OnClickListener genOnclickListener( final String activityTag, final Class activityClass) { return new View.OnClickListener() { @Override public void onClick(View v) { if (!activityTag.equals(parentActivityTag)) { currentContainer.setBackgroundColor(android.graphics.Color.TRANSPARENT); v.setBackgroundColor( getActivity().getResources().getColor(R.color.colorPrimary)); mListener.onItemClick(); Intent intent = new Intent(getActivity(), activityClass); getActivity().startActivity(intent); } } }; } private void setContainerBackground(View view, final String activityTag){ if (!activityTag.equals(parentActivityTag)) view.setBackgroundColor(android.graphics.Color.TRANSPARENT); else { currentContainer = view; view.setBackgroundColor( getActivity().getResources().getColor(R.color.colorPrimary)); } } public interface OnFragmentInteractionListener{ public void onItemClick(); } }
36.07947
92
0.691446
80ed740f624a9a5b01c9dac8334b4eb0b2ce1d8d
3,518
package de.andrews.digsitevisualization.calculation; import de.andrews.digsitevisualization.data.Triangle; import de.andrews.digsitevisualization.data.Vertex; import io.github.jdiemke.triangulation.DelaunayTriangulator; import io.github.jdiemke.triangulation.NotEnoughPointsException; import io.github.jdiemke.triangulation.Triangle2D; import io.github.jdiemke.triangulation.Vector2D; import java.util.ArrayList; import java.util.List; public class SurfaceCalculator { /** Triangulate the delaunay representation of a given list of points and return a list of triangles. **/ public List<Triangle> calculateSurface(List<Vertex> pointList, boolean isProfile) throws NotEnoughPointsException { List<Vector2D> pointSet; if (isProfile) { pointSet = prepareProfilePointSet(pointList); } else { pointSet = preparePointSet(pointList); } DelaunayTriangulator delaunayTriangulator = new DelaunayTriangulator(pointSet); delaunayTriangulator.shuffle(); delaunayTriangulator.triangulate(); List<Triangle2D> triangleSoup = delaunayTriangulator.getTriangles(); return formatConnections(triangleSoup); } /** Convert 3D vertices into 2D points by ignoring the z axis. **/ private List<Vector2D> preparePointSet(List<Vertex> pointList) { List<Vector2D> pointSet = new ArrayList<>(); for (Vertex p : pointList) { Vector2D point2D = new Vector2D(p.getIndex(), p.getX(), p.getY()); pointSet.add(point2D); } return pointSet; } /** Convert 3D vertices into 2D points by checking if the x or the y axis has the higher variance and ignoring the axis with the lower variance. **/ private List<Vector2D> prepareProfilePointSet(List<Vertex> pointList) { List<Vector2D> pointSet = new ArrayList<>(); //Calculate variance for X and Y values double sumX = 0.0; double sumY = 0.0; for (Vertex p : pointList) { sumX += p.getX(); sumY += p.getY(); } double meanX = sumX / pointList.size(); double meanY = sumY / pointList.size(); double numeratorX = 0.0; double numeratorY = 0.0; for (Vertex p : pointList) { numeratorX += Math.pow(p.getX() - meanX, 2); numeratorY += Math.pow(p.getY() - meanY, 2); } double varianceX = numeratorX / pointList.size(); double varianceY = numeratorY / pointList.size(); //Calculate the Profile on the axis with the higher variance if (varianceX > varianceY) { for (Vertex p : pointList) { Vector2D point2D = new Vector2D(p.getIndex(), p.getX(), p.getZ()); pointSet.add(point2D); } } else { for (Vertex p : pointList) { Vector2D point2D = new Vector2D(p.getIndex(), p.getY(), p.getZ()); pointSet.add(point2D); } } return pointSet; } /** Extract the indices of 2D points from the 2D triangles and create 3D triangles from them. **/ private List<Triangle> formatConnections(List<Triangle2D> triangleSoup) { List<Triangle> connections = new ArrayList<>(); for (Triangle2D triangle : triangleSoup) { Triangle connection = new Triangle(triangle.a.id, triangle.b.id, triangle.c.id); connections.add(connection); } return connections; } }
35.18
152
0.636441
597ab2b6222fbab862a503ef76ceae257a5ba8eb
1,571
package gl.servlet; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; @WebServlet(name = "AlertServlet", urlPatterns = "/AlertServlet") public class AlertServlet extends HttpServlet { private static final long serialVersionUID = 1L; @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.getWriter().append("Served at: ").append(request.getContextPath()); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Date currentDate = new Date(); DateFormat dateFormat = new SimpleDateFormat("YYYY-MM-dd"); String stringDate = dateFormat.format(currentDate); String authorMail = request.getParameter("studentMail"); String reason = request.getParameter("reason"); String comment = request.getParameter("alertContent"); String idUniversity = request.getParameter("id_university"); try { DbDao.insertAlert(stringDate, authorMail, reason, comment, idUniversity); response.sendRedirect("/"); } catch (Exception exObj) { exObj.printStackTrace(); } finally { DbDao.disconnectDb(); } } }
34.152174
119
0.728199
21caaf5a3637b6096063e82b38088483f3ed8929
1,414
import de.craften.plugins.mobjar.persistence.serialization.SerializedWolf; import org.bukkit.Bukkit; import org.bukkit.DyeColor; import org.bukkit.entity.Wolf; import org.junit.Test; import org.junit.runner.RunWith; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.verify; import static org.powermock.api.mockito.PowerMockito.mock; import static org.powermock.api.mockito.PowerMockito.when; @RunWith(PowerMockRunner.class) @PrepareForTest({Bukkit.class}) public class SerializedWolfTest { @Test public void testSerializeWolf() { Wolf wolf = givenAWolf(); SerializedWolf serializedWolf = new SerializedWolf(wolf); wolf = mock(Wolf.class); serializedWolf.applyOn(wolf); verifyEqualsGivenWolf(wolf); } private Wolf givenAWolf() { Wolf wolf = mock(Wolf.class); when(wolf.getCustomName()).thenReturn("Some wild wolf"); when(wolf.isCustomNameVisible()).thenReturn(true); when(wolf.getCollarColor()).thenReturn(DyeColor.GREEN); return wolf; } private void verifyEqualsGivenWolf(Wolf wolf) { verify(wolf).setCustomName(eq("Some wild wolf")); verify(wolf).setCustomNameVisible(eq(true)); verify(wolf).setCollarColor(eq(DyeColor.GREEN)); } }
32.136364
74
0.72843
4ce540a60ec88e81b08b16edeaed8e42f521a22a
460
package com.fields.weather.fieldsweather.repository; import com.fields.weather.fieldsweather.Model.WeatherPolygon; import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.data.mongodb.repository.Query; public interface WeatherRepository extends MongoRepository<WeatherPolygon, String> { @Query("{'WeatherPolygon' :{'$ref' : 'Field' , '$id' : ?0}}") WeatherPolygon findWeatherPolygonByFieldid(String fieldid); }
41.818182
84
0.8
e4d2fcc65289f92f9b6ab3c74f1e094eb7deaad5
2,635
package com.example.john.simulatesms.dialog; import android.content.Context; import android.view.View; import android.widget.Button; import android.widget.TextView; import com.example.john.simulatesms.R; import com.example.john.simulatesms.interfaces.OnConfirmListener; /** * Created by John on 2016/11/27. */ public class ConfirmDialog extends BaseDialog { private TextView tvTitle; private TextView tvMsg; private Button btnOk; private Button btnCancel; private OnConfirmListener onConfirmListener; private String title; private String msg; public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public static void showConfirmDialog(Context context, String title, String msg, OnConfirmListener onConfirmListener) { ConfirmDialog confirmDialog = new ConfirmDialog(context); confirmDialog.setOnConfirmListener(onConfirmListener); confirmDialog.setTitle(title); confirmDialog.setMsg(msg); confirmDialog.show(); } public ConfirmDialog(Context context) { super(context, R.style.ConfirmDialogStyle); } @Override public void initView() { setContentView(R.layout.layout_confirm_dialog); tvTitle = (TextView) findViewById(R.id.confirm_dialog_tv_title); tvMsg = (TextView) findViewById(R.id.confirm_dialog_tv_msg); btnOk = (Button) findViewById(R.id.confirm_dialog_btn_ok); btnCancel = (Button) findViewById(R.id.confirm_dialog_btn_cancel); } @Override public void initData() { tvTitle.setText(title); tvMsg.setText(msg); } @Override public void initListener() { btnOk.setOnClickListener(this); btnCancel.setOnClickListener(this); } @Override public void handleClickEvent(View view) { switch (view.getId()) { case R.id.confirm_dialog_btn_ok: if (onConfirmListener != null) { this.dismiss(); onConfirmListener.onOk(); } break; case R.id.confirm_dialog_btn_cancel: if (onConfirmListener != null) { onConfirmListener.onCancel(); this.dismiss(); } break; } } public void setOnConfirmListener(OnConfirmListener onConfirmListener) { this.onConfirmListener = onConfirmListener; } }
26.089109
122
0.63833
f84fee6d92e031c6c0e59bd1fc05d4a873956365
2,745
/* * Copyright 2019 Australian e-Health Research Centre, CSIRO * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package au.csiro.spiatofhir.fhir; import au.csiro.spiatofhir.loinc.Loinc; import au.csiro.spiatofhir.spia.Refset; import au.csiro.spiatofhir.ucum.Ucum; import au.csiro.spiatofhir.utils.Strings; import java.util.Date; import org.hl7.fhir.dstu3.model.ConceptMap; import org.hl7.fhir.dstu3.model.Identifier; import org.hl7.fhir.dstu3.model.Resource; import org.hl7.fhir.dstu3.model.UriType; /** * @author John Grimes */ public class MicrobiologySerologyMolecularUnitMap extends SpiaFhirConceptMap { @Override public Resource transform(Refset refset, Date publicationDate) { ConceptMap conceptMap = new ConceptMap(); conceptMap.setVersion("1.1.0"); conceptMap.setId( "spia-microbiology-unit-map-" + Strings.majorVersionFromSemVer(conceptMap.getVersion())); conceptMap.setUrl("https://www.rcpa.edu.au/fhir/ConceptMap/" + conceptMap.getId()); Identifier oid = new Identifier(); oid.setSystem("urn:ietf:rfc:3986"); oid.setValue("urn:oid:1.2.36.1.2001.1004.300.100.1005"); conceptMap.setIdentifier(oid); conceptMap.setTitle("RCPA - SPIA Microbiology Serology Molecular Unit Map"); conceptMap.setName("spia-microbiology-unit-map"); conceptMap.setDescription("Map between the SPIA Microbiology Reference Set (v3.1) and the " + "corresponding RCPA preferred units (v1.1) for each code."); conceptMap.setPurpose("Resolving RCPA specified units for members of the SPIA Microbiology " + "Serology Molecular Reference Set."); conceptMap.setDate(publicationDate); SpiaFhirConceptMap.addCommonElementsToConceptMap(conceptMap); conceptMap .setSource(new UriType("https://www.rcpa.edu.au/fhir/ValueSet/spia-microbiology-refset-1")); conceptMap.setTarget( new UriType("https://www.rcpa.edu.au/fhir/ValueSet/spia-preferred-units-refset-1")); ConceptMap.ConceptMapGroupComponent group = SpiaFhirConceptMap .buildPreferredUnitGroupFromEntries(refset.getRefsetEntries()); group.setSource(Loinc.SYSTEM_URI); group.setTarget(Ucum.SYSTEM_URI); conceptMap.getGroup().add(group); return conceptMap; } }
40.970149
100
0.746084
24a0e9eb0c22a092c17704b84a4be0ef4f0c1634
658
package me.prester.remindmail.main; import android.content.Context; import androidx.lifecycle.ViewModel; import me.prester.remindmail.backend.Repository; public class MainViewModel extends ViewModel { private Repository repository; MainViewModel(Repository repository) { this.repository = repository; } public void sendEmail(Context context, String text) { repository.sendEmail(context, text); } void initDefaultPreferenceValues(Context context) { repository.initDefaultPreferenceValues(context); } void initNotification(Context context) { repository.initNotification(context); } }
23.5
57
0.735562
2e3e002688721ca36caa684ee0f819d53edcd896
1,798
/* * Copyright 2018 Red Hat, Inc. and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.kie.workbench.common.stunner.core.preferences; import org.uberfire.preferences.shared.annotations.Property; import org.uberfire.preferences.shared.annotations.WorkbenchPreference; import org.uberfire.preferences.shared.bean.BasePreference; @WorkbenchPreference(identifier = "StunnerPreferences", bundleKey = "StunnerPreferences.Label") public class StunnerPreferences implements BasePreference<StunnerPreferences>, Cloneable { @Property(bundleKey = "StunnerPreferences.StunnerDiagramEditorPreferences") StunnerDiagramEditorPreferences diagramEditorPreferences; @Override public StunnerPreferences defaultValue(final StunnerPreferences defaultValue) { defaultValue.diagramEditorPreferences.setAutoHidePalettePanel(false); defaultValue.diagramEditorPreferences.setCanvasWidth(2800); defaultValue.diagramEditorPreferences.setCanvasHeight(1400); defaultValue.diagramEditorPreferences.setEnableHiDPI(false); return defaultValue; } public StunnerDiagramEditorPreferences getDiagramEditorPreferences() { return diagramEditorPreferences; } }
41.813953
83
0.764182
868b72d4f86a24e4d74236bab242178a845b7716
3,699
/* * Copyright (c) 2013, Timothy Stack * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ''AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.sqlite.driver; import org.junit.Test; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.Statement; import java.sql.Types; import static org.junit.Assert.*; public class SqliteResultSetMetadataTest extends SqliteTestHelper { //#if mvn.project.property.sqlite.enable.column.metadata == "true" @Test public void testColumnType() throws Exception { try (Statement stmt = conn.createStatement()) { try (ResultSet rs = stmt.executeQuery("SELECT * FROM type_table")) { ResultSetMetaData rsm = rs.getMetaData(); assertEquals(5, rsm.getColumnCount()); assertEquals("main", rsm.getCatalogName(1)); assertEquals("type_table", rsm.getTableName(1)); assertFalse(rsm.isAutoIncrement(1)); assertEquals(ResultSetMetaData.columnNullable, rsm.isNullable(1)); assertEquals("name", rsm.getColumnLabel(1)); assertEquals("name", rsm.getColumnName(1)); assertEquals(Types.VARCHAR, rsm.getColumnType(1)); assertFalse(rs.next()); assertEquals(Types.VARCHAR, rsm.getColumnType(1)); rs.close(); assertEquals(Types.VARCHAR, rsm.getColumnType(1)); } try (ResultSet rs = stmt.executeQuery("SELECT name as namelabel, width FROM type_table")) { ResultSetMetaData rsm = rs.getMetaData(); assertEquals(2, rsm.getColumnCount()); assertEquals("main", rsm.getCatalogName(1)); assertEquals("type_table", rsm.getTableName(1)); assertFalse(rsm.isAutoIncrement(1)); assertEquals(ResultSetMetaData.columnNullable, rsm.isNullable(1)); assertEquals("namelabel", rsm.getColumnLabel(1)); assertEquals("name", rsm.getColumnName(1)); assertEquals(Types.VARCHAR, rsm.getColumnType(1)); assertTrue(rsm.isSigned(2)); } } } @Test public void testNoTable() throws Exception { try (Statement stmt = conn.createStatement()) { try (ResultSet rs = stmt.executeQuery("SELECT 1")) { ResultSetMetaData rsm = rs.getMetaData(); assertEquals(1, rsm.getColumnCount()); assertEquals("", rsm.getCatalogName(1)); assertEquals("", rsm.getTableName(1)); assertFalse(rsm.isAutoIncrement(1)); assertEquals(ResultSetMetaData.columnNullable, rsm.isNullable(1)); assertEquals("1", rsm.getColumnLabel(1)); assertEquals("1", rsm.getColumnName(1)); assertEquals(Types.OTHER, rsm.getColumnType(1)); } } } //#endif }
36.623762
94
0.735604
53ca7036dfc3c3c409f8d80e21b68bb1664d4c5c
46,377
package util; import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Scanner; import java.util.Set; import java.util.TreeSet; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; import org.deckfour.xes.model.XAttributeMap; import org.deckfour.xes.model.XLog; import org.processmining.plugins.DataConformance.Alignment; import org.processmining.plugins.DataConformance.framework.ExecutionStep; import org.processmining.plugins.DataConformance.visualization.DataAwareStepTypes; import org.processmining.plugins.DeclareConformance.Alignstep; import org.processmining.plugins.DeclareConformance.ViolationIdentifier; import org.processmining.plugins.dataawaredeclarereplayer.gui.AnalysisSingleResult; import org.processmining.plugins.declareminer.enumtypes.DeclareTemplate; import org.processmining.plugins.declareminer.visualizing.DeclareMap; import controller.TraceViewController; import graph.ArrowProperty; import graph.Arrows; import graph.Font; import graph.Smooth; import graph.VisEdge; import graph.VisGraph; import graph.VisNode; import javafx.scene.control.Slider; import javafx.stage.Screen; import minerful.MinerFulOutputManagementLauncher; import minerful.concept.ProcessModel; import minerful.io.params.OutputModelParameters; import view.Browser; public class GraphGenerator { public static Browser browserify(List<XAttributeMap> activityListInTrace, Set<Integer> fulfillments, Set<Integer> violations) { VisGraph graph = new VisGraph(); List<VisNode> nodes = new ArrayList<VisNode>(); List<VisEdge> edges = new ArrayList<VisEdge>(); int id = 0; for(XAttributeMap xmap : activityListInTrace) { VisNode node = new VisNode(id,"("+(id+1)+") "+xmap.get("concept:name").toString(),null); StringBuilder sb = new StringBuilder(); sb.append("Event attributes<br>"); xmap.forEach((k,v) -> { sb.append(k+" = "+v.toString()+"<br>"); }); if(fulfillments.contains(id)) { node.setColor("#00ff00"); node.setTitle("This activity is a fulfillment"+"<br>"+sb.toString()); } else if(violations.contains(id)) { node.setColor("red"); node.setTitle("This activity is a violation"+"<br>"+sb.toString()); } else { node.setTitle(sb.toString()); } nodes.add(node); id++; } for(int i = 0; i<nodes.size()-1; i++) { VisEdge edge = new VisEdge(nodes.get(i),nodes.get(i+1),null,null,null); edges.add(edge); } VisNode[] nodeArr = (VisNode[]) nodes.toArray(new VisNode[nodes.size()]); VisEdge[] edgeArr = (VisEdge[]) edges.toArray(new VisEdge[edges.size()]); graph.addEdges(edgeArr); graph.addNodes(nodeArr); return new Browser(graph,Screen.getPrimary().getVisualBounds().getHeight()*0.9,Screen.getPrimary().getVisualBounds().getWidth()*0.6,"baseGraph3.html"); } public static TraceViewController getTraceView(List<XAttributeMap> activityListInTrace, Set<Integer> fulfillments, Set<Integer> violations) { List<TraceElement> list = new ArrayList<TraceElement>(); int id = 0; for(XAttributeMap xmap : activityListInTrace) { TraceElement element = new TraceElement(); element.setText(xmap.get("concept:name").toString()); List<String> attributes = new ArrayList<String>(); xmap.forEach((k,v) -> { attributes.add(k+" = "+v.toString()+"\n"); }); if(fulfillments.contains(id)) { attributes.add(0,"This activity is a fulfillment\n"); attributes.add(1,"\nEvent Attributes\n"); element.setColor("#00ff00"); element.setAttributes(attributes); list.add(element); } else if(violations.contains(id)) { attributes.add(0,"This activity is a violation\n"); attributes.add(1,"\nEvent Attributes\n"); element.setColor("red"); element.setAttributes(attributes); list.add(element); } else { attributes.add(0,"Event Attributes\n"); element.setColor("white"); element.setAttributes(attributes); list.add(element); } id++; } return new TraceViewController(list,Screen.getPrimary().getVisualBounds().getHeight()*0.9,Screen.getPrimary().getVisualBounds().getWidth()*0.56); } public static Browser browserify(AnalysisSingleResult asr) { VisGraph graph = new VisGraph(); List<VisNode> nodes = new ArrayList<VisNode>(); List<VisEdge> edges = new ArrayList<VisEdge>(); Set<Integer> s1 = asr.getMovesInBoth(); Set<Integer> s2 = asr.getMovesInBothDiffData(); Set<Integer> s3 = asr.getMovesInLog(); Set<Integer> s4 = asr.getMovesInModel(); List<ExecutionStep> l = asr.getAlignment().getLogTrace(); List<ExecutionStep> l2 = asr.getAlignment().getProcessTrace(); for(int i=0; i<l.size(); i++) { ExecutionStep es = l.get(i); ExecutionStep es2 = l2.get(i); String name = (es.getActivity() != null) ? es.getActivity() : es2.getActivity(); String color = ""; String title = null; if(s1.contains(i)) { color = "#00d200"; title = "This is a move in log and model"; } if(s2.contains(i)) { color = "#ffffff"; title = "This is a move in log and model with different data"; } if(s3.contains(i)) { color = "#ffff00"; title = "This is a move in log"; } if(s4.contains(i)) { color = "#e0b0ff"; title = "This is a move in model"; } if(!es.isEmpty()) { title += "<p><b>Trace Attributes</b><br>"; for(String s: es.keySet()) { String logValue = es.get(s).toString(); String processValue = es2.get(s).toString(); if(processValue.equals(logValue)) { title += s + " = " + logValue + "<br>"; } else { title += s + " = " + processValue + " &#8800; " + logValue + "<br>"; } } title += "</p>"; } VisNode node = new VisNode(i,name,title); node.setColor(color); nodes.add(node); } for(int i=0; i<nodes.size()-1; i++) { VisEdge edge = new VisEdge(nodes.get(i),nodes.get(i+1),null,null,null); edges.add(edge); } VisNode[] nodeArr = (VisNode[]) nodes.toArray(new VisNode[nodes.size()]); VisEdge[] edgeArr = (VisEdge[]) edges.toArray(new VisEdge[edges.size()]); graph.addEdges(edgeArr); graph.addNodes(nodeArr); return new Browser(graph,Screen.getPrimary().getVisualBounds().getHeight()*0.6,Screen.getPrimary().getVisualBounds().getWidth()*0.73,"baseGraph3.html"); } public static TraceViewController getTraceView(AnalysisSingleResult asr, XLog traces) { List<TraceElement> list = new ArrayList<TraceElement>(); Set<Integer> s1 = asr.getMovesInBoth(); Set<Integer> s2 = asr.getMovesInBothDiffData(); Set<Integer> s3 = asr.getMovesInLog(); Set<Integer> s4 = asr.getMovesInModel(); List<ExecutionStep> l = asr.getAlignment().getLogTrace(); List<ExecutionStep> l2 = asr.getAlignment().getProcessTrace(); for(int i=0; i<l.size(); i++) { ExecutionStep es = l.get(i); ExecutionStep es2 = l2.get(i); String name = (es.getActivity() != null) ? es.getActivity() : es2.getActivity(); String color = ""; TraceElement te = new TraceElement(); List<String> attributes = new ArrayList<String>(); te.setText(name); if(s1.contains(i)) { te.setColor("#00ff00"); attributes.add("This is a move in log and model"); } if(s2.contains(i)) { te.setColor("#ffffff"); attributes.add("This is a move in log and model with different data"); } if(s3.contains(i)) { te.setColor("#ffff00"); attributes.add("This is a move in log"); } if(s4.contains(i)) { te.setColor("#a020f0"); attributes.add("This is a move in model"); } if(!es.isEmpty() && !es2.isEmpty()) { for(String s: es.keySet()) { String logValue = es.get(s).toString(); String processValue = es2.get(s).toString(); if(processValue.equals(logValue)) { attributes.add(s + " = " + logValue + "\n"); } else { attributes.add(s + " = " + logValue + " replaced by " + processValue + "\n"); } } } Optional<List<String>> opt = Optional.empty(); if(es.getActivity() != null) { opt = EventFinder.getEventAttributes(traces, asr.getAlignment().getTraceName(), i); } if(opt.isPresent()) { List<String> ea = opt.get(); if(!ea.isEmpty()) attributes.add("\nEvent Attributes:\n"); for(String str: ea) { attributes.add(str); } } te.setAttributes(attributes); list.add(te); } return new TraceViewController(list,Screen.getPrimary().getVisualBounds().getHeight()*0.9,Screen.getPrimary().getVisualBounds().getWidth()*0.5); } public static Browser browserify(Alignment alignment,DeclareMap model) { VisGraph graph = new VisGraph(); List<VisNode> nodes = new ArrayList<VisNode>(); List<VisEdge> edges = new ArrayList<VisEdge>(); List<DataAwareStepTypes> steps = alignment.getStepTypes(); ViolationIdentifier vid=null; try { vid = new ViolationIdentifier(alignment.getLogTrace(),alignment.getProcessTrace(),model); } catch (Exception e) { e.printStackTrace(); } for(int i=0; i<steps.size(); i++) { String step = steps.get(i).toString(); if(step.endsWith("Log")) { String contribution = "<p>"+new Alignstep(alignment.getLogTrace().get(i).getActivity(),vid,i,steps.get(i)).getToolTipText()+"</p>"; VisNode node = new VisNode(i,alignment.getLogTrace().get(i).getActivity(),"This is a move in log"+contribution); node.setColor("#ffff00"); nodes.add(node); } else if(step.endsWith("Model")) { String contribution = "<p>"+new Alignstep(alignment.getLogTrace().get(i).getActivity(),vid,i,steps.get(i)).getToolTipText()+"</p>"; VisNode node = new VisNode(i,alignment.getProcessTrace().get(i).getActivity(),"This is a move in model"+contribution); node.setColor("#e0b0ff"); nodes.add(node); } else if(step.endsWith("Both")) { VisNode node = new VisNode(i,alignment.getLogTrace().get(i).getActivity(),"This is a move in log and model"); node.setColor("#00d200"); nodes.add(node); } } for(int i=0; i<nodes.size()-1; i++) { VisEdge edge = new VisEdge(nodes.get(i),nodes.get(i+1),null,null,null); edges.add(edge); } VisNode[] nodeArr = (VisNode[]) nodes.toArray(new VisNode[nodes.size()]); VisEdge[] edgeArr = (VisEdge[]) edges.toArray(new VisEdge[edges.size()]); graph.addEdges(edgeArr); graph.addNodes(nodeArr); return new Browser(graph,Screen.getPrimary().getVisualBounds().getHeight()*0.6,Screen.getPrimary().getVisualBounds().getWidth()*0.73,"baseGraph3.html"); } private static String[] getContributeArray(Alignstep alignstep) { String[] contributed=alignstep.getContributedToSolve(); String[] solved=alignstep.getSolved(); if (contributed.length+solved.length==0) return null; String[] contributed2=new String[contributed.length+solved.length]; int j=0; for(String x : contributed) contributed2[j++]=x; for(String x : solved) contributed2[j++]=x; return contributed2; } public static TraceViewController getTraceView(Alignment alignment,DeclareMap model,XLog traces) { List<TraceElement> list = new ArrayList<TraceElement>(); List<DataAwareStepTypes> steps = alignment.getStepTypes(); ViolationIdentifier vid=null; try { vid = new ViolationIdentifier(alignment.getLogTrace(),alignment.getProcessTrace(),model); } catch (Exception e) { e.printStackTrace(); } for(int i=0; i<steps.size(); i++) { String step = steps.get(i).toString(); TraceElement te = new TraceElement(); if(step.endsWith("Log")) { Alignstep alignstep = new Alignstep(alignment.getLogTrace().get(i).getActivity(),vid,i,steps.get(i)); String[] contributes = getContributeArray(alignstep); List<String> attributes = new ArrayList<String>(); attributes.add("This is a move in log\n"); if(contributes != null) { attributes.add("\nContributes to solve: \n"); for(String s: contributes) { attributes.add(s+"\n"); } } Optional<List<String>> opt = EventFinder.getEventAttributes(traces, alignment.getTraceName(), i); if(opt.isPresent()) { List<String> la = opt.get(); if(!la.isEmpty()) { attributes.add("\nEvent Attributes:\n"); for(String s: la) { attributes.add(s); } } } te.setAttributes(attributes); te.setText(alignment.getLogTrace().get(i).getActivity()); te.setColor("#ffff00"); list.add(te); } else if(step.endsWith("Model")) { Alignstep alignstep = new Alignstep(alignment.getLogTrace().get(i).getActivity(),vid,i,steps.get(i)); String[] contributes = getContributeArray(alignstep); List<String> attributes = new ArrayList<String>(); attributes.add("This is a move in model\n"); if(contributes != null) { attributes.add("\nContributes to solve: \n"); for(String s: contributes) { attributes.add(s+"\n"); } } te.setAttributes(attributes); te.setText(alignment.getProcessTrace().get(i).getActivity()); te.setColor("#a020f0"); list.add(te); } else if(step.endsWith("Both")) { List<String> attributes = new ArrayList<String>(); attributes.add("This is a move in log and model\n"); Optional<List<String>> opt = EventFinder.getEventAttributes(traces, alignment.getTraceName(), i); if(opt.isPresent()) { List<String> la = opt.get(); if(!la.isEmpty()) { attributes.add("\nEvent Attributes:\n"); for(String s: la) { attributes.add(s); } } } te.setAttributes(attributes); te.setText(alignment.getLogTrace().get(i).getActivity()); te.setColor("#00ff00"); list.add(te); } } return new TraceViewController(list,Screen.getPrimary().getVisualBounds().getHeight()*0.9,Screen.getPrimary().getVisualBounds().getWidth()*0.56); } private static String getForTitle(String str1, String str2) { // TODO Auto-generated method stub Matcher m1 = Pattern.compile("\\{(.*)=(.*)\\}").matcher(str1); Matcher m2 = Pattern.compile("\\{(.*)=(.*)\\}").matcher(str2); if(m1.find() && m2.find()) { return m1.group(1)+" = "+m2.group(2)+" &#8800; "+m1.group(2); } return ""; } public static Browser browserify(HashMap<Integer,String> actL, HashMap<Integer,List<String>> cspL, HashMap<Integer,String> tL, List<String> cL, Slider zoom) { Map<Integer,Boolean> isDrawnMap = new HashMap<Integer,Boolean>(); Map<String,String> nodesMap = new HashMap<String,String>(); cspL.keySet().forEach(k -> isDrawnMap.put(k, false)); StringBuilder sb = new StringBuilder("digraph \"\" {"); //sb.append("size = \"6\""); //sb.append("ratio = \"fill\""); //sb.append("rankdir = \"LR\""); sb.append("ranksep = \"1\""); sb.append("nodesep = \".5\""); List<String> nodes = new ArrayList<String>(); List<String> edges = new ArrayList<String>(); cspL.forEach((k,v) -> { if(!isDrawnMap.get(k) && v.size() == 2) { String a = v.get(0); String b = v.get(1); List<String> allUnaryForA = findAllUnaryFor(a,cspL,tL,cL,isDrawnMap); List<String> allUnaryForB = findAllUnaryFor(b,cspL,tL,cL,isDrawnMap); int ka = getKeyFor(a,actL); int kb = getKeyFor(b,actL); String nodeA = "node"+ka; String nodeB = "node"+kb; if(nodesMap.get(nodeA) == null) { nodesMap.put(nodeA, buildNodeString(nodeA,a,allUnaryForA,-1)); } if(nodesMap.get(nodeB) == null) { nodesMap.put(nodeB, buildNodeString(nodeB,b,allUnaryForB,-1)); } edges.add(buildEdgeString(nodeA,nodeB,tL.get(k),getLabelFromConstraint(cL.get(k)))); isDrawnMap.put(k, true); } if(!isDrawnMap.get(k) && v.size() == 1) { String a = v.get(0); List<String> allUnaryForA = findAllUnaryFor(a,cspL,tL,cL,isDrawnMap); int ka = getKeyFor(a,actL); String nodeA = "node"+ka; if(nodesMap.get(nodeA) == null) { nodesMap.put(nodeA, buildNodeString(nodeA,a,allUnaryForA,-1)); } //nodes.add(buildNodeString(nodeA,a,allUnaryForA)); isDrawnMap.put(k, true); } }); sb.append("node [style=\"filled\", shape=box, fontsize=\"8\", fontname=\"Helvetica\"]"); sb.append("edge [fontsize=\"8\", fontname=\"Helvetica\" arrowsize=\".5\"]"); for(String s: nodesMap.values()) { sb.append(s); } for(String s: edges) { sb.append(s); } sb.append("}"); return new Browser(Screen.getPrimary().getVisualBounds().getHeight()*0.76,Screen.getPrimary().getVisualBounds().getWidth() * 1,sb.toString(),zoom); } private static String findAllExistenceConstraints(HashMap<Integer,List<String>> constraintParameters,HashMap<Integer,String> templates, String activity, Set<Integer> picked, HashMap<Integer,Boolean> isDrawn, List<String> cL) { List<String> list = Arrays.asList(activity); List<Integer> keys = new ArrayList<Integer>(); constraintParameters.forEach((k,v) -> { if(v.equals(list) && picked.contains(k) && !isDrawn.get(k)) keys.add(k); }); String existence = ""; List<String> templateList = new ArrayList<String>(); for(int k: keys) { if(!isDrawn.get(k)) { isDrawn.put(k,true); templateList.add(templates.get(k)+"\n"+getLabelFromConstraint(cL.get(k))); //existence += templates.get(k) + "\n"; } } Set<String> templateSet = new HashSet<String>(templateList); for(String s: templateSet) { existence += s + "\n"; } if(existence.equals("")) return existence; else return existence+"\n"; } private static String getLabelFromConstraint(String c) { Matcher mBinary = Pattern.compile(".*\\[.*\\] \\|(.*) \\|(.*) \\|(.*)").matcher(c); Matcher mUnary = Pattern.compile(".*\\[.*\\] \\|(.*) \\|(.*)").matcher(c); if(mBinary.find()) { return "[" + mBinary.group(1) + "]" + "[" + mBinary.group(2) + "]" + "[" + mBinary.group(3) + "]"; } if(mUnary.find()) { return "[" + mUnary.group(1) + "]" + "[" + mUnary.group(2) + "]"; } return ""; } private static VisEdge getCorrespondingEdge(VisNode start, VisNode end, DeclareTemplate template, String c) { int last = start.getLabel().lastIndexOf('\n'); String startActivity = start.getLabel().substring(last+1); last = end.getLabel().lastIndexOf('\n'); String endActivity = end.getLabel().substring(last+1); int diff = Math.abs(start.getId()-end.getId()); String constraint = template.name() + "[" +startActivity+", "+endActivity+"]"; String label = getLabelFromConstraint(c); if(template == DeclareTemplate.Responded_Existence) { Smooth smooth = new Smooth(true, "dynamic"); VisEdge edge = new VisEdge(start,end,null,smooth,constraint);//,diff*400*Math.pow(1.25, offset)); edge.setLabel(label); return edge; } if(template == DeclareTemplate.Response) { ArrowProperty to = new ArrowProperty(true,"arrow"); ArrowProperty from = new ArrowProperty(true,"circle"); Arrows arrows = new Arrows(to,null,from); Smooth smooth = new Smooth(true,"dynamic"); VisEdge edge = new VisEdge(start,end,arrows,smooth,constraint);//diff*400*Math.pow(1.25, offset)); edge.setLabel(label); return edge; } if(template == DeclareTemplate.Alternate_Response) { ArrowProperty to = new ArrowProperty(true,"arrow"); ArrowProperty from = new ArrowProperty(true,"circle"); Arrows arrows = new Arrows(to,null,from); Smooth smooth = new Smooth(true,"doubleDynamic"); VisEdge edge = new VisEdge(start,end,arrows,smooth,constraint);//diff*400*Math.pow(1.25, offset)); edge.setLabel(label); Font f = new Font("#000000"); f.setVadjust(-5); edge.setFont(f); return edge; } if(template == DeclareTemplate.Chain_Response) { ArrowProperty to = new ArrowProperty(true,"arrow"); ArrowProperty from = new ArrowProperty(true,"circle"); Arrows arrows = new Arrows(to,null,from); Smooth smooth = new Smooth(true,"tripleDynamic"); VisEdge edge = new VisEdge(start,end,arrows,smooth,constraint);//diff*400*Math.pow(1.25, offset)); edge.setLabel(label); Font f = new Font("#000000"); f.setVadjust(-5); edge.setFont(f); return edge; } if(template == DeclareTemplate.Not_Chain_Response) { ArrowProperty to = new ArrowProperty(true,"arrow"); ArrowProperty middle = new ArrowProperty(true,"bar"); ArrowProperty from = new ArrowProperty(true,"circle"); Arrows arrows = new Arrows(to,middle,from); Smooth smooth = new Smooth(true,"tripleDynamic"); VisEdge edge = new VisEdge(start,end,arrows,smooth,constraint);//diff*400*Math.pow(1.25, offset)); edge.setLabel(label); Font f = new Font("#000000"); f.setVadjust(-15); edge.setFont(f); return edge; } if(template == DeclareTemplate.Not_Response) { ArrowProperty to = new ArrowProperty(true,"arrow"); ArrowProperty middle = new ArrowProperty(true,"bar"); ArrowProperty from = new ArrowProperty(true,"circle"); Arrows arrows = new Arrows(to,middle,from); Smooth smooth = new Smooth(true,"dynamic"); VisEdge edge = new VisEdge(start,end,arrows,smooth,constraint);//diff*400*Math.pow(1.25, offset)); edge.setLabel(label); Font f = new Font("#000000"); f.setVadjust(-15); edge.setFont(f); return edge; } if(template == DeclareTemplate.Precedence) { ArrowProperty to = new ArrowProperty(true,"circlearrow"); Arrows arrows = new Arrows(to,null,null); Smooth smooth = new Smooth(true,"dynamic"); VisEdge edge = new VisEdge(start,end,arrows,smooth,constraint);//diff*400*Math.pow(1.25, offset)); edge.setLabel(label); return edge; } if(template == DeclareTemplate.Alternate_Precedence) { ArrowProperty to = new ArrowProperty(true,"circlearrow"); Arrows arrows = new Arrows(to,null,null); Smooth smooth = new Smooth(true,"doubleDynamic"); VisEdge edge = new VisEdge(start,end,arrows,smooth,constraint);//diff*400*Math.pow(1.25, offset)); edge.setLabel(label); Font f = new Font("#000000"); f.setVadjust(-5); edge.setFont(f); return edge; } if(template == DeclareTemplate.Chain_Precedence) { ArrowProperty to = new ArrowProperty(true,"circlearrow"); Arrows arrows = new Arrows(to,null,null); Smooth smooth = new Smooth(true,"tripleDynamic"); VisEdge edge = new VisEdge(start,end,arrows,smooth,constraint);//diff*400*Math.pow(1.25, offset)); edge.setLabel(label); Font f = new Font("#000000"); f.setVadjust(-5); edge.setFont(f); return edge; } if(template == DeclareTemplate.Not_Chain_Precedence) { ArrowProperty to = new ArrowProperty(true,"circlearrow"); ArrowProperty middle = new ArrowProperty(true, "bar"); Arrows arrows = new Arrows(to,middle,null); Smooth smooth = new Smooth(true,"tripleDynamic"); VisEdge edge = new VisEdge(start,end,arrows,smooth,constraint);//diff*400*Math.pow(1.25, offset)); edge.setLabel(label); Font f = new Font("#000000"); f.setVadjust(-15); edge.setFont(f); return edge; } if(template == DeclareTemplate.Not_Precedence) { ArrowProperty to = new ArrowProperty(true,"circlearrow"); ArrowProperty middle = new ArrowProperty(true, "bar"); Arrows arrows = new Arrows(to,middle,null); Smooth smooth = new Smooth(true,"dynamic"); VisEdge edge = new VisEdge(start,end,arrows,smooth,constraint);//diff*400*Math.pow(1.25, offset)); edge.setLabel(label); Font f = new Font("#000000"); f.setVadjust(-15); edge.setFont(f); return edge; } if(template == DeclareTemplate.CoExistence) { ArrowProperty to = new ArrowProperty(true,"circle"); ArrowProperty from = new ArrowProperty(true,"circle"); Arrows arrows = new Arrows(to,null,from); Smooth smooth = new Smooth(true,"dynamic"); VisEdge edge = new VisEdge(start,end,arrows,smooth,constraint);//diff*400*Math.pow(1.25, offset)); edge.setLabel(label); return edge; } if(template == DeclareTemplate.Not_CoExistence) { ArrowProperty to = new ArrowProperty(true,"circle"); ArrowProperty middle = new ArrowProperty(true,"bar"); ArrowProperty from = new ArrowProperty(true,"circle"); Arrows arrows = new Arrows(to,middle,from); Smooth smooth = new Smooth(true,"dynamic"); VisEdge edge = new VisEdge(start,end,arrows,smooth,constraint);//diff*400*Math.pow(1.25, offset)); edge.setLabel(label); Font f = new Font("#000000"); f.setVadjust(-15); edge.setFont(f); return edge; } if(template == DeclareTemplate.Succession) { ArrowProperty to = new ArrowProperty(true,"circlearrow"); ArrowProperty from = new ArrowProperty(true,"circle"); Arrows arrows = new Arrows(to,null,from); Smooth smooth = new Smooth(true,"dynamic"); VisEdge edge = new VisEdge(start,end,arrows,smooth,constraint);//diff*400*Math.pow(1.25, offset)); edge.setLabel(label); return edge; } if(template == DeclareTemplate.Not_Succession) { ArrowProperty to = new ArrowProperty(true,"circlearrow"); ArrowProperty middle = new ArrowProperty(true,"bar"); ArrowProperty from = new ArrowProperty(true,"circle"); Arrows arrows = new Arrows(to,middle,from); Smooth smooth = new Smooth(true,"dynamic"); VisEdge edge = new VisEdge(start,end,arrows,smooth,constraint);//diff*400*Math.pow(1.25, offset)); edge.setLabel(label); Font f = new Font("#000000"); f.setVadjust(-15); edge.setFont(f); return edge; } if(template == DeclareTemplate.Alternate_Succession) { ArrowProperty to = new ArrowProperty(true,"circlearrow"); ArrowProperty from = new ArrowProperty(true,"circle"); Arrows arrows = new Arrows(to,null,from); Smooth smooth = new Smooth(true,"doubleDynamic"); VisEdge edge = new VisEdge(start,end,arrows,smooth,constraint);//diff*400*Math.pow(1.25, offset)); edge.setLabel(label); Font f = new Font("#000000"); f.setVadjust(-5); edge.setFont(f); return edge; } if(template == DeclareTemplate.Chain_Succession) { ArrowProperty to = new ArrowProperty(true,"circlearrow"); ArrowProperty from = new ArrowProperty(true,"circle"); Arrows arrows = new Arrows(to,null,from); Smooth smooth = new Smooth(true,"tripleDynamic"); VisEdge edge = new VisEdge(start,end,arrows,smooth,constraint);//diff*400*Math.pow(1.25, offset)); edge.setLabel(label); Font f = new Font("#000000"); f.setVadjust(-5); edge.setFont(f); return edge; } if(template == DeclareTemplate.Not_Chain_Succession) { ArrowProperty to = new ArrowProperty(true,"circlearrow"); ArrowProperty middle = new ArrowProperty(true,"bar"); ArrowProperty from = new ArrowProperty(true,"circle"); Arrows arrows = new Arrows(to,middle,from); Smooth smooth = new Smooth(true,"tripleDynamic"); VisEdge edge = new VisEdge(start,end,arrows,smooth,constraint);//diff*400*Math.pow(1.25, offset)); edge.setLabel(label); Font f = new Font("#000000"); f.setVadjust(-15); edge.setFont(f); return edge; } VisEdge edge = new VisEdge(start,end,null,null,constraint);//diff*400*Math.pow(1.25, offset)); edge.setLabel(label); return edge; } private static List<String> findAllUnaryFor(String s, Map<Integer,List<String>> cpM, Map<Integer,String> tM, Map<Integer,Boolean> idM) { List<String> l = new ArrayList<String>(); cpM.forEach((k,v) -> { if(!idM.get(k) && v.size() == 1 && v.get(0).equals(s)) { l.add(tM.get(k)); idM.put(k, true); } }); return l; } private static List<String> findAllUnaryFor(String s, Map<Integer,List<String>> cpM, Map<Integer,String> tL, List<String> cL, Map<Integer,Boolean> idM) { List<String> l = new ArrayList<String>(); cpM.forEach((k,v) -> { if(!idM.get(k) && v.size() == 1 && v.get(0).equals(s)) { String constraint = cL.get(k); String insertIt = tL.get(k)+getLabelFromConstraint(constraint); l.add(insertIt.replace("<", "&lt;").replace(">","&gt;").replace("||","\\|\\|")); idM.put(k, true); } }); return l; } private static int getKeyFor(String s, Map<Integer,String> aM) { for(int k: aM.keySet()) { if(aM.get(k).equals(s)) return k; } return -1; } private static String getHexValue(long value) { long b1 = value / 16; long b2 = value % 16; String s = ""; if(b1 == 0) s = "0"; if(b1 == 1) s = "1"; if(b1 == 2) s = "2"; if(b1 == 3) s = "3"; if(b1 == 4) s = "4"; if(b1 == 5) s = "5"; if(b1 == 6) s = "6"; if(b1 == 7) s = "7"; if(b1 == 8) s = "8"; if(b1 == 9) s = "9"; if(b1 == 10) s = "a"; if(b1 == 11) s = "b"; if(b1 == 12) s = "c"; if(b1 == 13) s = "d"; if(b1 == 14) s = "e"; if(b1 == 15) s = "f"; if(b2 == 0) s += "0"; if(b2 == 1) s += "1"; if(b2 == 2) s += "2"; if(b2 == 3) s += "3"; if(b2 == 4) s += "4"; if(b2 == 5) s += "5"; if(b2 == 6) s += "6"; if(b2 == 7) s += "7"; if(b2 == 8) s += "8"; if(b2 == 9) s += "9"; if(b2 == 10) s += "a"; if(b2 == 11) s += "b"; if(b2 == 12) s += "c"; if(b2 == 13) s += "d"; if(b2 == 14) s += "e"; if(b2 == 15) s += "f"; return s; } private static String getColorFrom(double supp,int size) { double res = 51 + 26 * (1-supp) * 27.46; double portion = 1.5 / (size+1.5); String color = ""; if(res > 255) { long remaining = Math.round((res - 255) / 2); color = "#"+getHexValue(remaining)+getHexValue(remaining)+"ff"; } else { color = "#0000"+getHexValue(Math.round(res)); } String fc = "#e6e600"; return "fillcolor=\""+color+";"+portion+":#808080\" gradientangle=90 fontcolor=\""+fc+"\""; } private static String buildNodeString(String n, String s, List<String> ls, double supp) { String color = ""; String ss = ""; if(supp != -1) { color = getColorFrom(supp,ls.size()); ss = String.format("%.1f%%", supp*100); } if(supp == -1) { double portion = 1.0 / (ls.size()+1); color = "#0000ff"; String fc= "#ffffff"; color = "fillcolor=\""+color+";"+portion+":#000000\" gradientangle=90 fontcolor=\""+fc+"\""; } if(ls.isEmpty()) { return n + " [label=" + "\"" + s + "\\\\n" + ss +"\"" + color +" tooltip=\""+s+"\"]"; } else { String unaryRep = "\"{"; for(String u : ls) { unaryRep += u + "|"; } unaryRep += s + "\\\\n" + ss + "}\""; //System.out.println(n + " [shape=\"record\" label="+ unaryRep +" "+color+"]"); return n + " [shape=\"record\" label="+ unaryRep +" "+color+" tooltip=\""+s+"\"]"; } } private static String getStyleForTemplate(String template, String label) { String supp = label; String penwidth = ""; if(template.equals("Co-Existence")) { return "[dir=\"both\", edgetooltip=\"CoExistence\", labeltooltip=\"CoExistence\", arrowhead=\"dot\", arrowtail=\"dot\", label=\""+supp+"\","+penwidth+"]"; } if(template.equals("Not_Co-Existence")) { return "[dir=\"both\", edgetooltip=\"Not CoExistence\", labeltooltip=\"Not CoExistence\", arrowhead=\"dot\", arrowtail=\"dot\", style=\"dashed\", label=\""+supp+"\","+penwidth+"]"; } DeclareTemplate dt = DeclareTemplate.valueOf(template); switch(dt) { case Responded_Existence: return "[dir=\"both\",edgetooltip=\"Responded Existence\",labeltooltip=\"Responded Existence\",arrowhead=\"none\",arrowtail=\"dot\", label=\""+supp+"\","+penwidth+"]"; case Response: return "[dir=\"both\", edgetooltip=\"Response\",labeltooltip=\"Response\",arrowhead=\"normal\", arrowtail=\"dot\", label=\""+supp+"\","+penwidth+"]"; case Alternate_Response: return "[color=\"black:black\", edgetooltip=\"Alternate Response\",labeltooltip=\"Alternate Response\",dir=\"both\", arrowhead=\"normal\", arrowtail=\"dot\", label=\""+supp+"\","+penwidth+"]"; case Chain_Response: return "[color=\"black:black:black\", edgetooltip=\"Chain Response\", labeltooltip=\"Chain Response\", dir=\"both\", arrowhead=\"normal\", arrowtail=\"dot\", label=\""+supp+"\","+penwidth+"]"; case Precedence: return "[arrowhead=\"dotnormal\", edgetooltip=\"Precedence\", labeltooltip=\"Precedence\", label=\""+supp+"\","+penwidth+"]"; case Alternate_Precedence: return "[arrowhead=\"dotnormal\", edgetooltip=\"Alternate Precedence\", labeltooltip=\"Alternate Precedence\", color=\"black:black\", label=\""+supp+"\","+penwidth+"]"; case Chain_Precedence: return "[arrowhead=\"dotnormal\", edgetooltip=\"Chain Precedence\", labeltooltip=\"Chain Precedence\",color=\"black:black:black\", label=\""+supp+"\","+penwidth+"]"; case Succession: return "[dir=\"both\", edgetooltip=\"Succession\", labeltooltip=\"Succession\", arrowhead=\"dotnormal\", arrowtail=\"dot\", label=\""+supp+"\","+penwidth+"]"; case Alternate_Succession: return "[dir=\"both\", edgetooltip=\"Alternate Succession\", labeltooltip=\"Alternate Succession\", arrowhead=\"dotnormal\", arrowtail=\"dot\", color=\"black:black\", label=\""+supp+"\","+penwidth+"]"; case Chain_Succession: return "[dir=\"both\", edgetooltip=\"Chain Succession\", labeltooltip=\"Chain Succession\", arrowhead=\"dotnormal\", arrowtail=\"dot\", color=\"black:black:black\", label=\""+supp+"\","+penwidth+"]"; case CoExistence: return "[dir=\"both\", edgetooltip=\"CoExistence\", labeltooltip=\"CoExistence\", arrowhead=\"dot\", arrowtail=\"dot\", label=\""+supp+"\","+penwidth+"]"; case Not_Chain_Precedence: return "[arrowhead=\"dotnormal\", edgetooltip=\"Not Chain Precedence\", labeltooltip=\"Not Chain Precedence\", color=\"black:black:black\", style=\"dashed\", label=\""+supp+"\","+penwidth+"]"; case Not_Chain_Response: return "[dir=\"both\", edgetooltip=\"Not Chain Response\", labeltooltip=\"Not Chain Response\", arrowhead=\"normal\", arrowtail=\"dot\", style=\"dashed\", label=\""+supp+"\","+penwidth+"]"; case Not_Chain_Succession: return "[dir=\"both\", edgetooltip=\"Not Chain Succession\", labeltooltip=\"Not Chain Succession\", arrowhead=\"dotnormal\", arrowtail=\"dot\", color=\"black:black:black\", style=\"dashed\", label=\""+supp+"\","+penwidth+"]"; case Not_CoExistence: return "[dir=\"both\", edgetooltip=\"Not CoExistence\", labeltooltip=\"Not CoExistence\", arrowhead=\"dot\", arrowtail=\"dot\", style=\"dashed\", label=\""+supp+"\","+penwidth+"]"; case Not_Precedence: return "[arrowhead=\"dotnormal\", edgetooltip=\"Not Precedence\", labeltooltip=\"Not Precedence\", style=\"dashed\", label=\""+supp+"\","+penwidth+"]"; case Not_Responded_Existence: return "[dir=\"both\",arrowtail=\"dot\", arrowhead=\"none\", edgetooltip=\"Not Responded Existence\", labeltooltip=\"Not Responded Existence\", style=\"dashed\", label=\""+supp+"\","+penwidth+"]"; case Not_Response: return "[dir=\"both\", edgetooltip=\"Not Response\", labeltooltip=\"Not Response\", arrowhead=\"normal\", arrowtail=\"dot\", style=\"dashed\", label=\""+supp+"\","+penwidth+"]"; case Not_Succession: return "[dir=\"both\", edgetooltip=\"Not Succession\", labeltooltip=\"Not Succession\", arrowhead=\"dotnormal\", arrowtail=\"dot\", style=\"dashed\", label=\""+supp+"\","+penwidth+"]"; default: return ""; } } private static String getStyleForTemplate(String template, double s) { String supp = String.format("%.1f%%", s*100); String penwidth = "penwidth="+String.format("%.1f", 0.5+s); if(template.equals("Co-Existence")) { return "[dir=\"both\", edgetooltip=\"CoExistence\", labeltooltip=\"CoExistence\", arrowhead=\"dot\", arrowtail=\"dot\", label=\""+supp+"\","+penwidth+"]"; } if(template.equals("Not Co-Existence")) { return "[dir=\"both\", edgetooltip=\"Not CoExistence\", labeltooltip=\"Not CoExistence\", arrowhead=\"dot\", arrowtail=\"dot\", style=\"dashed\", label=\""+supp+"\","+penwidth+"]"; } DeclareTemplate dt = DeclareTemplate.valueOf(template); switch(dt) { case Responded_Existence: return "[dir=\"both\", edgetooltip=\"Responded Existence\", labeltooltip=\"Responded Existence\",arrowhead=\"none\",arrowtail=\"dot\", label=\""+supp+"\","+penwidth+"]"; case Response: return "[dir=\"both\", edgetooltip=\"Response\", labeltooltip=\"Response\", arrowhead=\"normal\", arrowtail=\"dot\", label=\""+supp+"\","+penwidth+"]"; case Alternate_Response: return "[color=\"black:black\", edgetooltip=\"Alternate Response\", labeltooltip=\"Alternate Response\", dir=\"both\", arrowhead=\"normal\", arrowtail=\"dot\", label=\""+supp+"\","+penwidth+"]"; case Chain_Response: return "[color=\"black:black:black\", edgetooltip=\"Chain Response\", labeltooltip=\"Chain Response\", dir=\"both\", arrowhead=\"normal\", arrowtail=\"dot\", label=\""+supp+"\","+penwidth+"]"; case Precedence: return "[arrowhead=\"dotnormal\", edgetooltip=\"Precedence\", labeltooltip=\"Precedence\", label=\""+supp+"\","+penwidth+"]"; case Alternate_Precedence: return "[arrowhead=\"dotnormal\", edgetooltip=\"Alternate Precedence\", labeltooltip=\"Alternate Precedence\", color=\"black:black\", label=\""+supp+"\","+penwidth+"]"; case Chain_Precedence: return "[arrowhead=\"dotnormal\", edgetooltip=\"Chain Precedence\", labeltooltip=\"Chain Precedence\", color=\"black:black:black\", label=\""+supp+"\","+penwidth+"]"; case Succession: return "[dir=\"both\", edgetooltip=\"Succession\", labeltooltip=\"Succession\", arrowhead=\"dotnormal\", arrowtail=\"dot\", label=\""+supp+"\","+penwidth+"]"; case Alternate_Succession: return "[dir=\"both\", edgetooltip=\"Alternate Succession\", labeltooltip=\"Alternate Succession\", arrowhead=\"dotnormal\", arrowtail=\"dot\", color=\"black:black\", label=\""+supp+"\","+penwidth+"]"; case Chain_Succession: return "[dir=\"both\", edgetooltip=\"Chain Succession\", labeltooltip=\"Chain Succession\", arrowhead=\"dotnormal\", arrowtail=\"dot\", color=\"black:black:black\", label=\""+supp+"\","+penwidth+"]"; case CoExistence: return "[dir=\"both\", edgetooltip=\"CoExistence\", labeltooltip=\"CoExistence\", arrowhead=\"dot\", arrowtail=\"dot\", label=\""+supp+"\","+penwidth+"]"; case Not_Chain_Precedence: return "[arrowhead=\"dotnormal\", edgetooltip=\"Not Chain Precedence\", labeltooltip=\"Not Chain Precedence\", color=\"black:black:black\", style=\"dashed\", label=\""+supp+"\","+penwidth+"]"; case Not_Chain_Response: return "[dir=\"both\", arrowhead=\"normal\", edgetooltip=\"Not Chain Response\", labeltooltip=\"Not Chain Response\", arrowtail=\"dot\", style=\"dashed\", label=\""+supp+"\","+penwidth+"]"; case Not_Chain_Succession: return "[dir=\"both\", arrowhead=\"dotnormal\", edgetooltip=\"Not Chain Succession\", labeltooltip=\"Not Chain Succession\",arrowtail=\"dot\", color=\"black:black:black\", style=\"dashed\", label=\""+supp+"\","+penwidth+"]"; case Not_CoExistence: return "[dir=\"both\", edgetooltip=\"Not CoExistence\", labeltooltip=\"Not CoExistence\", arrowhead=\"dot\", arrowtail=\"dot\", style=\"dashed\", label=\""+supp+"\","+penwidth+"]"; case Not_Precedence: return "[arrowhead=\"dotnormal\", edgetooltip=\"Not Precedence\", labeltooltip=\"Not Precedence\", style=\"dashed\", label=\""+supp+"\","+penwidth+"]"; case Not_Responded_Existence: return "[dir=\"both\", arrowtail=\"dot\", arrowhead=\"none\", edgetooltip=\"Not Responded Existence\", labeltooltip=\"Not Responded Existence\", style=\"dashed\", label=\""+supp+"\","+penwidth+"]"; case Not_Response: return "[dir=\"both\", edgetooltip=\"Not Response\", labeltooltip=\"Not Response\", arrowhead=\"normal\", arrowtail=\"dot\", style=\"dashed\", label=\""+supp+"\","+penwidth+"]"; case Not_Succession: return "[dir=\"both\", edgetooltip=\"Not Succession\", labeltooltip=\"Not Succession\", arrowhead=\"dotnormal\", arrowtail=\"dot\", style=\"dashed\", label=\""+supp+"\","+penwidth+"]"; default: return ""; } } private static String buildEdgeString(String nodeA, String nodeB, String template, double supp) { String style = getStyleForTemplate(template,supp); return nodeA + " -> " + nodeB + " " + style; } private static String buildEdgeString(String nodeA, String nodeB, String template, String label) { String style = getStyleForTemplate(template,label); return nodeA + " -> " + nodeB + " " + style; } public static String getDotRepresentation(ProcessModel pm) { OutputModelParameters outParams = new OutputModelParameters(); File output_dot_file = new File("automaton.dot"); outParams.fileToSaveDotFileForAutomaton = output_dot_file; new MinerFulOutputManagementLauncher().manageOutput(pm, outParams); Scanner s; try { s = new Scanner(output_dot_file); StringBuilder sb = new StringBuilder(); while(s.hasNextLine()) { sb.append(s.nextLine()); } s.close(); return sb.toString(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); return ""; } } public static Browser browserify(Map<Integer,String> activitiesMap, Map<Integer,Double> actSuppMap, Map<Integer,String> templatesMap, Map<Integer,List<String>> constraintParametersMap, Map<Integer,Double> constraintSuppMap, Slider zoom, String view, String supportFor) { if(view.equals("Declare")) { System.out.println("Preparing Declare view..."); Map<Integer,Boolean> isDrawnMap = new HashMap<Integer,Boolean>(); Map<String,String> nodesMap = new HashMap<String,String>(); constraintParametersMap.keySet().forEach(k -> isDrawnMap.put(k, false)); StringBuilder sb = new StringBuilder("digraph \"\" {"); //sb.append("size = \"6\""); //sb.append("ratio = \"fill\""); //sb.append("center = \"true\""); sb.append("ranksep = \"1\""); sb.append("nodesep = \".5\""); List<String> nodes = new ArrayList<String>(); List<String> edges = new ArrayList<String>(); constraintParametersMap.forEach((k,v) -> { if(!isDrawnMap.get(k) && v.size() == 2) { String a = v.get(0); String b = v.get(1); List<String> allUnaryForA = findAllUnaryFor(a,constraintParametersMap,templatesMap,isDrawnMap); List<String> allUnaryForB = findAllUnaryFor(b,constraintParametersMap,templatesMap,isDrawnMap); int ka = getKeyFor(a,activitiesMap); int kb = getKeyFor(b,activitiesMap); String nodeA = "node"+ka; String nodeB = "node"+kb; if(nodesMap.get(nodeA) == null) { nodesMap.put(nodeA, buildNodeString(nodeA,a,allUnaryForA,actSuppMap.get(ka))); } if(nodesMap.get(nodeB) == null) { nodesMap.put(nodeB, buildNodeString(nodeB,b,allUnaryForB,actSuppMap.get(kb))); } edges.add(buildEdgeString(nodeA,nodeB,templatesMap.get(k),constraintSuppMap.get(k))); isDrawnMap.put(k, true); } if(!isDrawnMap.get(k) && v.size() == 1) { String a = v.get(0); List<String> allUnaryForA = findAllUnaryFor(a,constraintParametersMap,templatesMap,isDrawnMap); int ka = getKeyFor(a,activitiesMap); String nodeA = "node"+ka; if(nodesMap.get(nodeA) == null) { nodesMap.put(nodeA, buildNodeString(nodeA,a,allUnaryForA,actSuppMap.get(ka))); } //nodes.add(buildNodeString(eA,a,allUnaryForA)); isDrawnMap.put(k, true); } }); sb.append("node [style=\"filled\", shape=box, fontsize=\"8\", fontname=\"Helvetica\"]"); sb.append("edge [fontsize=\"8\", fontname=\"Helvetica\" arrowsize=\".5\"]"); for(String s: nodesMap.values()) { sb.append(s); } for(String s: edges) { //System.out.println(s); sb.append(s); } sb.append("}"); System.out.println("Dot string is ready..."); Browser browser = new Browser(Screen.getPrimary().getVisualBounds().getHeight()*0.79,Screen.getPrimary().getVisualBounds().getWidth() * 0.75,sb.toString(),zoom); browser.setActivitiesMap(activitiesMap); browser.setActSuppMap(actSuppMap); browser.setTemplatesMap(templatesMap); browser.setConstraintParametersMap(constraintParametersMap); browser.setConstraintSuppMap(constraintSuppMap); return browser; } if(view.equals("Automaton")) { ProcessModel pm = ProcessModelGenerator.obtainProcessModel (activitiesMap, templatesMap, constraintParametersMap); String dotRep = getDotRepresentation(pm); Browser browser = new Browser(Screen.getPrimary().getVisualBounds().getHeight()*0.79,Screen.getPrimary().getVisualBounds().getWidth() * 0.75,dotRep,zoom); browser.setActivitiesMap(activitiesMap); browser.setActSuppMap(actSuppMap); browser.setTemplatesMap(templatesMap); browser.setConstraintParametersMap(constraintParametersMap); browser.setConstraintSuppMap(constraintSuppMap); return browser; } StringBuilder sbActivity = new StringBuilder(); StringBuilder sbConstraint = new StringBuilder(); int index = 1; List<Integer> la = activitiesMap.keySet().stream().sorted((i1,i2) -> { double s1 = actSuppMap.get(i1); double s2 = actSuppMap.get(i2); if(s2 > s1) return 1; else if(s1 > s2) return -1; else return 0; }).collect(Collectors.toList()); for(int k:la) { double s = actSuppMap.get(k); String act = activitiesMap.get(k); String addIt = String.format("%d) %s : Exists in %.2f%% of traces in the log\\n", index, act, s*100); sbActivity.append(addIt); index++; } index = 1; List<Integer> lc = templatesMap.keySet().stream().sorted((i1,i2) -> { double s1 = constraintSuppMap.get(i1); double s2 = constraintSuppMap.get(i2); if(s2 > s1) return 1; else if(s1 > s2) return -1; else return 0; }).collect(Collectors.toList()); for(int k:lc) { double s = constraintSuppMap.get(k); List<String> params = constraintParametersMap.get(k); String template = templatesMap.get(k); String[] p = (String[]) params.toArray(new String[params.size()]); String exp = TemplateDescription.get(templatesMap.get(k), p); if(template.startsWith("AtMostOne") || template.startsWith("Participation") || template.startsWith("Init") || template.startsWith("End")) { String addIt = String.format("%d) In %.2f%% of %s in the log, %s\\n", index, s*100, "traces", exp); sbConstraint.append(addIt); } else { String addIt = String.format("%d) In %.2f%% of %s in the log, %s\\n", index, s*100, supportFor, exp); sbConstraint.append(addIt); } index++; } Browser browser = new Browser(Screen.getPrimary().getVisualBounds().getHeight()*0.79,Screen.getPrimary().getVisualBounds().getWidth() * 0.75,sbActivity.toString(),sbConstraint.toString(),zoom); //System.out.println("Activities: "+sbActivity.toString()); //System.out.println("Constraints: "+sbConstraint.toString()); browser.setActivitiesMap(activitiesMap); browser.setActSuppMap(actSuppMap); browser.setTemplatesMap(templatesMap); browser.setConstraintParametersMap(constraintParametersMap); browser.setConstraintSuppMap(constraintSuppMap); return browser; } }
42.547706
271
0.662807
4fb125b0fe0a00c454d1e6f8388d3c0777815a76
73
package Nouyau ; public class Commandeheurexception extends Exception{ }
18.25
53
0.835616
2a50d56d6d4d88d672f41e27f8c92e37b632ae2f
738
// https://leetcode.com/problems/merge-strings-alternately/ class Solution { public String mergeAlternately(String word1, String word2) { StringBuilder merged = new StringBuilder(); int loopEndIndex = Math.min(word1.length(), word2.length()) - 1; for (int i = 0; i <= loopEndIndex; ++i) { merged.append( word1.charAt(i) ); merged.append( word2.charAt(i) ); } if (word1.length() < word2.length()) { merged.append( word2.substring(word1.length()) ); } else if (word1.length() > word2.length()) { merged.append( word1.substring(word2.length()) ); } return merged.toString(); } }
29.52
72
0.550136
f02303a86eb7efe754fac208409dde1317ccab94
645
/* * @author : Jagepard <jagepard@yandex.ru> * @license https://mit-license.org/ MIT */ package Behavioral.Iterator; import java.util.List; public class Iterator implements IteratorInterface{ private final List<ItemInterface> bucket; public Iterator(List<ItemInterface> bucket) { this.bucket = bucket; } @Override public String iterateItems() { StringBuilder output = new StringBuilder(); for (ItemInterface item : bucket) { output.append(String.format("%s %s %s\n", item.getName(), item.getPrice(), item.getDescription())); } return output.toString(); } }
22.241379
111
0.646512
05767d8781067dc3c8acf66c5f0afcd3b0c9e64b
903
package org.kie.remote.services.ws.sei.process; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ProcessInstanceIdAndSignalRequest", propOrder = { "deploymentId", "processInstanceId", "type", "event" }) public class ProcessInstanceIdAndSignalRequest { @XmlElement(required=true) @XmlSchemaType(name="string") private String deploymentId; @XmlElement(required=false) @XmlSchemaType(name="string") private Long processInstanceId; @XmlElement(required=true) @XmlSchemaType(name="string") private String type; @XmlAnyElement private Object event; }
25.8
66
0.756368
47bb7b3b9fa47003e9c62073d268c573aa28cfd6
1,408
package quark_ffi_signatures_md; public class classes_test_substring extends quark.reflect.Class implements io.datawire.quark.runtime.QObject { public static quark.reflect.Class singleton = new classes_test_substring(); public classes_test_substring() { super("classes.test_substring"); (this).name = "classes.test_substring"; (this).parameters = new java.util.ArrayList(java.util.Arrays.asList(new Object[]{})); (this).fields = new java.util.ArrayList(java.util.Arrays.asList(new Object[]{new quark.reflect.Field("quark.String", "what"), new quark.reflect.Field("quark.int", "start"), new quark.reflect.Field("quark.int", "end")})); (this).methods = new java.util.ArrayList(java.util.Arrays.asList(new Object[]{new classes_test_substring_that_Method(), new classes_test_substring_does_Method(), new classes_test_substring_check_Method()})); (this).parents = new java.util.ArrayList(java.util.Arrays.asList(new Object[]{"classes.string_test"})); } public Object construct(java.util.ArrayList<Object> args) { return new classes.test_substring((String) ((args).get(0))); } public Boolean isAbstract() { return false; } public String _getClass() { return (String) (null); } public Object _getField(String name) { return null; } public void _setField(String name, Object value) {} }
52.148148
228
0.700994
88daa1add255e1c422cbf17fdebc0be869aee280
292
package ru.vetclinic.clinic.Streams; import java.io.IOException; /** * Входящий поток данных * Created by Djony on 10.07.2016. */ public interface InputStream { /** * Возвращает введенную строку * @return Введенная строка */ String getNext() throws IOException; }
18.25
40
0.681507
8dd4599f8c55bfb3739c679b92686336c8844d69
2,056
/* * Copyright 2018-2019 Karakun AG. * Copyright 2015-2018 Canoo Engineering AG. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package dev.rico.server.spi; import dev.rico.core.Configuration; import org.apiguardian.api.API; import java.util.List; import java.util.Map; import static org.apiguardian.api.API.Status.EXPERIMENTAL; /** * A provider for configuration properties. This can be used to define the default values for all the properties of a module. * * @author Hendrik Ebbers * * @see Configuration */ @API(since = "0.x", status = EXPERIMENTAL) public interface ConfigurationProvider { /** * Returns a map of property value pairs. All values are string based. * @return a map of property value pairs */ Map<String, String> getStringProperties(); /** * Returns a map of property value pairs. All values are a list of string values. * @return a map of property value pairs */ Map<String, List<String>> getListProperties(); /** * Returns a map of property value pairs. All values are boolean based. * @return a map of property value pairs */ Map<String, Boolean> getBooleanProperties(); /** * Returns a map of property value pairs. All values are int based. * @return a map of property value pairs */ Map<String, Integer> getIntegerProperties(); /** * Returns a map of property value pairs. All values are long based. * @return a map of property value pairs */ Map<String, Long> getLongProperties(); }
30.235294
125
0.698444
9177588f48b08b0a93610987af382710de88e1ee
12,280
package breakout; import brick.BlockCreator; import brick.Brick; import brick.RegularBrick; import displayImage.Scorebar; import gameObjects.Ball; import gameObjects.Paddle; import gameObjects.Pinball; import gameObjects.ScoreMultiplier; import javafx.scene.Group; import javafx.scene.input.KeyCode; import powerup.*; import screen.LoseScreen; import screen.Screen; import screen.WinScreen; import java.io.InputStream; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Scanner; /** * This represents a level in the game. The level is read in from an input file and then handles all interactions * between objects present in the level. * Depends on Game, Paddle, Brick, Powerup, Ball, Scoremultiplier, Scorebar, and Pinball. * @author Muthu Arivoli */ public class Level implements Screen { public static final int GRANT_BALL_HOLDING_SCORE = 10000; private Game myGame; private String inputFile; private Paddle myPaddle; private List<Brick> myBricks = new ArrayList<>(); private List<Powerup> allPowerups = new ArrayList<>(); private List<Powerup> activePowerups = new ArrayList<>(); private List<Ball> myBalls = new ArrayList<>(); private int myLevel; private ScoreMultiplier myScoreMultiplier = new ScoreMultiplier(1); private Scorebar myScorebar; private Pinball myPinball; /** * Creates a new level * @param myGame the game that the level is being played in * @param inputFile the inputFile for the initial state of the level * @param myLevel the number of the level */ public Level(Game myGame,String inputFile,int myLevel){ this.myGame = myGame; this.inputFile = inputFile; this.myLevel = myLevel; } /** * Initialize the level by creating all relevant objects and reading in the original configuration of blocks from * the input file * @param root Group that contains the elements that are currently being displayed on the screen */ @Override public void initialize(Group root) { myBalls.add(new Ball()); myBalls.get(0).initialize(root); myPaddle = new Paddle(root); myScorebar = new Scorebar(root); myPinball = new Pinball(root); try { InputStream is = getClass().getResourceAsStream(inputFile); Scanner f = new Scanner(is); int r,c; r = f.nextInt(); c = f.nextInt(); for(int i = 0;i < r;i++){ for(int k = 0;k < c; k++){ int in = f.nextInt(); int xpos = k * (Game.LENGTH / c); int ypos = (RegularBrick.BRICK_HEIGHT + 1) * i + RegularBrick.BRICK_OFFSET; if(in==4){ Powerup newPowerup = createPowerup(in,xpos,ypos,c); allPowerups.add(newPowerup); myBricks.add(BlockCreator.createBlock(in,xpos,ypos,c,root,newPowerup)); } else if(in==5){ Ball myNewSecondaryBall = new Ball(); myBalls.add(myNewSecondaryBall); myBricks.add(BlockCreator.createBlock(in,xpos,ypos,c,root,myNewSecondaryBall)); } else if (in!=0){ myBricks.add(BlockCreator.createBlock(in, xpos, ypos, c, root)); } } } f.close(); } catch (Exception e) { e.printStackTrace(); } } private Powerup createPowerup(int in, int xpos, int ypos, int width){ if(in==4){ return new PaddleLengthPowerup(xpos,ypos,width,myPaddle); } else if(in==5){ return new PaddleSpeedPowerup(xpos,ypos,width,myPaddle); } else if(in==6){ return new BallSpeedPowerup(xpos,ypos,width,myBalls.get(0)); } else{ return new ScoreMultiplierPowerup(xpos,ypos,width,myScoreMultiplier); } } /** * Update the current state of the level by updating locations and handling collisions. Also determines if the level * needs to change * @param elapsedTime amount of time that has elapsed since last frame */ @Override public void update(double elapsedTime) { updateLocations(elapsedTime); updateActivePowerups(elapsedTime); updateScorebar(); handleBallPaddleCollision(); handleBallBrickCollision(); handleBallPinballCollision(); handlePaddlePowerupCollision(); handleBallDeath(); handleChangeLevel(); } private void updateLocations(double elapsedTime){ for(Ball b:myBalls) { b.updateLocation(elapsedTime); } for(Powerup p:allPowerups){ p.updateLocation(); } } /** * Updates time that each active powerup still has and removes any powerups that have expired * @param elapsedTime amount of time that has elapsed */ private void updateActivePowerups(double elapsedTime){ Iterator<Powerup> itr = activePowerups.iterator(); while(itr.hasNext()){ Powerup activePowerup = itr.next(); activePowerup.setTimeToExpire(activePowerup.getTimeToExpire() - elapsedTime); System.out.println(activePowerup.getTimeToExpire() - elapsedTime); if(activePowerup.getTimeToExpire()<=0){ activePowerup.deactivatePowerup(); itr.remove(); } } } private void updateScorebar(){ myScorebar.setMyDisplay(myGame.getScore(),myGame.getLives()); } private void handleBallPaddleCollision(){ for(Ball myBall:myBalls) { if (myBall.getMyBallImage().getBounds().intersects(myPaddle.getMyPaddleImage().getBounds())) { if(myGame.getScore()> GRANT_BALL_HOLDING_SCORE){ myBall.resetLocation(); myPaddle.resetLocation(); destroySecondaryBalls(); return; } else { myBall.setyVelocity(-1 * myBall.getyVelocity()); if (myBall.getMyBallImage().getX() < myPaddle.getMyPaddleImage().getX() + Paddle.PADDLE_WIDTH / 3.0 && myBall.getxVelocity() > 0) { myBall.setxVelocity(-1 * myBall.getxVelocity()); } else if (myBall.getMyBallImage().getX() > myPaddle.getMyPaddleImage().getX() + 2 * Paddle.PADDLE_WIDTH / 3.0 && myBall.getxVelocity() < 0) { myBall.setxVelocity(-1 * myBall.getxVelocity()); } } } } } private void handleBallBrickCollision(){ for(Ball myBall:myBalls) { if (myBall.isInPlay()) { for (int i = 0; i < myBricks.size(); i++) { if (myBricks.get(i).getMyBrickImage().getBounds().intersects(myBall.getMyBallImage().getBounds())) { myBricks.get(i).setHitsToBreak(myBricks.get(i).getHitsToBreak() - 1); if (myBall.getMyBallImage().getMaxX() >= myBricks.get(i).getMyBrickImage().getX() && myBall.getMyBallImage().getX() <= myBricks.get(i).getMyBrickImage().getMaxX()) { myBall.setyVelocity(-1 * myBall.getyVelocity()); } if (myBall.getMyBallImage().getY() >= myBricks.get(i).getMyBrickImage().getMaxY() && myBall.getMyBallImage().getMaxY() <= myBricks.get(i).getMyBrickImage().getY()) { myBall.setxVelocity(-1 * myBall.getxVelocity()); } if (myBricks.get(i).getHitsToBreak() == 0) { myGame.setScore(myGame.getScore() + myBricks.get(i).getScore() * myScoreMultiplier.getValue()); myBricks.get(i).destroy(myGame.getRoot()); myBricks.remove(i); } break; } } } } } private void handleBallPinballCollision(){ for(Ball myBall:myBalls) { if(myBall.getMyBallImage().getBounds().intersects(myPinball.getMyLeftPinballImage().getBounds())){ handleAngledCollision(myPinball.getLeftAngle(),myBall); } if(myBall.getMyBallImage().getBounds().intersects(myPinball.getMyRightPinballImage().getBounds())){ handleAngledCollision(myPinball.getRightAngle(),myBall); } } } private void handleAngledCollision(double normal, Ball myBall){ double angle = 2*normal - Math.toDegrees(Math.atan2(myBall.getyVelocity(), myBall.getxVelocity())); double mag = Math.hypot(myBall.getxVelocity(), myBall.getyVelocity()); myBall.setxVelocity(Math.cos(Math.toRadians(angle))*mag); myBall.setyVelocity(Math.sin(Math.toRadians(angle))*mag); } private void handlePaddlePowerupCollision(){ Iterator<Powerup> itr = allPowerups.iterator(); while(itr.hasNext()){ Powerup myPowerup = itr.next(); if(myPowerup.getMyPowerupImage().getBounds().intersects(myPaddle.getMyPaddleImage().getBounds())){ myPowerup.activatePowerup(); myPowerup.getMyPowerupImage().destroyImage(myGame.getRoot()); activePowerups.add(myPowerup); itr.remove(); } } } private void handleBallDeath() { for (Ball b : myBalls){ if (b.getMyBallImage().atBottom()) { myGame.setLives(myGame.getLives() - 1); myPaddle.resetLocation(); myBalls.get(0).resetLocation(); destroySecondaryBalls(); return; } } } private void destroySecondaryBalls() { Iterator <Ball> itr = myBalls.listIterator(1); while(itr.hasNext()){ Ball myBall = itr.next(); if(myBall.isInPlay()) { myBall.getMyBallImage().destroyImage(myGame.getRoot()); itr.remove(); } } } private void handleChangeLevel(){ if(myBricks.isEmpty()){ if(myLevel != Game.NUM_LEVELS) { myGame.setCurrScreen(myGame.getLevel(myLevel+1)); } else{ myGame.setCurrScreen(new WinScreen(myGame)); } } if(myGame.getLives()==0){ myGame.setCurrScreen(new LoseScreen(myGame)); } } /** * Handles any user input through the keyboard by which the user interacts with the game * @param code the key that the user has pressed */ @Override public void handleKeyInput(KeyCode code) { if (code == KeyCode.RIGHT) { myPaddle.moveRight(); myBalls.get(0).moveCoupledRight(); } else if (code == KeyCode.LEFT) { myPaddle.moveLeft(); myBalls.get(0).moveCoupledLeft(); } else if (code == KeyCode.UP) { myPinball.moveUp(); } else if (code == KeyCode.DOWN) { myPinball.moveDown(); } else if (code == KeyCode.SPACE){ myBalls.get(0).uncouple(); } else if (code == KeyCode.L){ myGame.setLives(myGame.getLives()+1); } else if (code == KeyCode.R){ myBalls.get(0).resetLocation(); destroySecondaryBalls(); myPaddle.resetLocation(); } else if (code == KeyCode.T){ myBricks.get(0).destroy(myGame.getRoot()); myBricks.remove(0); } else if (code == KeyCode.DIGIT1){ myGame.setCurrScreen(myGame.getLevel(1)); } else if (code == KeyCode.DIGIT2){ myGame.setCurrScreen(myGame.getLevel(2)); } else if (code.isDigitKey()){ myGame.setCurrScreen(myGame.getLevel(3)); } else if (code == KeyCode.U){ myGame.setScore(myGame.getScore()+GRANT_BALL_HOLDING_SCORE); } } }
38.984127
189
0.57215
82c0dc6cc23ec01d191387076dc4eab0dfeb527a
17,277
package controllers; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.JsonNodeFactory; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.inject.Inject; import de.htwg.battleship.controller.HumanController; import de.htwg.battleship.model.Position; import de.htwg.battleship.model.Ship; import de.htwg.battleship.model.ship.Destructor; import de.htwg.battleship.model.ship.Flattop; import de.htwg.battleship.model.ship.Rowboat; import javafx.util.Pair; import models.PlayBattleshipHuman; import models.User; import play.Logger; import play.mvc.Controller; import play.mvc.Http; import play.mvc.WebSocket; import redis.clients.jedis.JedisPool; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicLong; import java.util.stream.Collectors; public class OnlineController extends Controller { // TODO: players can only play one game at a time private static final int NUM_THREADS = 8; @Inject private static JedisPool jedisPool; private static Random rnd = new Random(); private static ExecutorService executor = Executors.newFixedThreadPool(NUM_THREADS); private static AtomicLong gameSequence = new AtomicLong(); private static ConcurrentMap<WebSocket.Out<JsonNode>, User> onlineUsers = new ConcurrentHashMap<>(); private static ConcurrentMap<Long, Pair<User, User>> requestedGames = new ConcurrentHashMap<>(); private static ConcurrentMap<Long, PlayBattleshipController> ongoingGames = new ConcurrentHashMap<>(); public WebSocket<JsonNode> socket() { final Http.Session session = session(); final User currentUser = Application.getLocalUser(session()); return new WebSocket<JsonNode>() { @Override public void onReady(In<JsonNode> in, Out<JsonNode> out) { try { User u = Application.getLocalUser(session); //Logger.debug("User " + u.id + " connected"); // Add the new user to the data structures boolean alreadyOnline = onlineUsers.containsValue(u); onlineUsers.put(out, u); /*try (Jedis j = jedisPool.getResource()) { j.sadd("online_users", Long.toString(u.id)); }*/ // Notify logged users about the new player if (!alreadyOnline) { ObjectMapper mapper = new ObjectMapper(); ObjectNode notification = JsonNodeFactory.instance.objectNode(); notification.put("action", "newuser"); notification.put("newuser", mapper.writeValueAsString(currentUser)); broadcastMessage(notification, new HashSet<User>() {{ add(u); }}); } } catch (RuntimeException e) { //Logger.debug("Unknown user connected"); } catch (JsonProcessingException e) { Logger.error(e.getMessage(), e); } in.onMessage((data) -> { Logger.debug(currentUser.id + " - " + data.toString()); String action = data.findPath("action").textValue(); switch (action) { // TODO: add error handling case "newgame": onNewGameResponse(data, currentUser); break; case "ready": onUserReady(data, currentUser); break; case "setrowboat": onSetShip(data, currentUser, new Rowboat()); break; case "setdestructor": onSetShip(data, currentUser, new Destructor()); break; case "setflattop": onSetShip(data, currentUser, new Flattop()); break; case "shoot": onShoot(data, currentUser); break; case "userleaves": onUserLeaves(data, currentUser); break; case "getOnlineUsers": onGetOnlineUsers(data, currentUser); break; default: } }); in.onClose(() -> { User u = onlineUsers.get(out); if (u != null) { //Logger.debug("User " + u.id + " disconnected"); // Remove user from the data structures onlineUsers.remove(out); // Wait for 100 ms to see if the user connects through another websocket //Thread.sleep(100); boolean stillOnline = onlineUsers.containsValue(u); /*try (Jedis j = jedisPool.getResource()) { j.srem("online_users", Long.toString(u.id)); }*/ // Notify logged users about the leaving player if (!stillOnline) { try { ObjectMapper mapper = new ObjectMapper(); ObjectNode notification = JsonNodeFactory.instance.objectNode(); notification.put("action", "userleaves"); notification.put("leavinguser", mapper.writeValueAsString(currentUser)); broadcastMessage(notification, new HashSet<User>() {{ add(u); }}); } catch (JsonProcessingException e) { Logger.error(e.getMessage(), e); } } } else { //Logger.debug("Unknown user disconnected"); } }); } }; } public static Set<User> getOnlineUsers() { return new HashSet<>(onlineUsers.values()); } public static boolean isOnline(User user) { return onlineUsers.containsValue(user); } public static void notifyNewGame(User currentUser, User user) { try { ObjectMapper mapper = new ObjectMapper(); ObjectNode gameRequest = JsonNodeFactory.instance.objectNode(); gameRequest.put("action", "newgame"); gameRequest.put("opponent", mapper.writeValueAsString(currentUser)); //long gameId = gameSequence.addAndGet((long) rnd.nextInt()); // TODO: randomize long gameId = gameSequence.incrementAndGet(); gameRequest.put("gameid", gameId); requestedGames.put(gameId, new Pair<>(currentUser, user)); sendMessage(user, gameRequest); } catch (JsonProcessingException e) { Logger.error(e.getMessage(), e); } } private static void onNewGameResponse(JsonNode data, User askedUser) { boolean response = data.findPath("response").asBoolean(); long gameId = data.findPath("gameid").asLong(); if (requestedGames.containsKey(gameId)) { User askingUser = requestedGames.remove(gameId).getKey(); if (response) { // Setup the controller and start the game PlayBattleshipHuman askingPlayer = new PlayBattleshipHuman(askingUser); PlayBattleshipHuman askedPlayer = new PlayBattleshipHuman(askedUser); PlayBattleshipController gameController = new PlayBattleshipController(askingPlayer, askedPlayer); ongoingGames.put(gameId, gameController); executor.submit(() -> { try { gameController.ready.acquire(2); gameController.startGame(); ongoingGames.remove(gameId); User user1 = gameController.getPlayers().getKey().getUser(); User user2 = gameController.getPlayers().getValue().getUser(); try { // Broadcast to the rest of users ObjectMapper mapper = new ObjectMapper(); ObjectNode notPlayingAnymore = JsonNodeFactory.instance.objectNode(); notPlayingAnymore.put("action", "not_playing_anymore"); notPlayingAnymore.put("user1", mapper.writeValueAsString(user1)); notPlayingAnymore.put("user2", mapper.writeValueAsString(user2)); broadcastMessage(notPlayingAnymore, new HashSet<User>() {{ add(user1); add(user2); }}); } catch (JsonProcessingException e) { Logger.error(e.getMessage(), e); } } catch (InterruptedException e) { Logger.error(e.getMessage(), e); } }); // Notify to the user who started the game ObjectNode gameAccepted = JsonNodeFactory.instance.objectNode(); gameAccepted.put("action", "newgame_response"); gameAccepted.put("response", true); gameAccepted.put("gameid", gameId); sendMessage(askingUser, gameAccepted); // TODO: extract code to reuse try { // Broadcast to the rest of users ObjectMapper mapper = new ObjectMapper(); ObjectNode currentlyPlaying = JsonNodeFactory.instance.objectNode(); currentlyPlaying.put("action", "currently_playing"); currentlyPlaying.put("user1", mapper.writeValueAsString(askedUser)); currentlyPlaying.put("user2", mapper.writeValueAsString(askingUser)); broadcastMessage(currentlyPlaying, new HashSet<User>() {{ add(askedUser); }}); } catch (JsonProcessingException e) { Logger.error(e.getMessage(), e); } } else { // Notify to the user who started the game ObjectNode gameRejected = JsonNodeFactory.instance.objectNode(); gameRejected.put("action", "newgame_response"); gameRejected.put("response", false); sendMessage(askingUser, gameRejected); } } else { // TODO: return error } } private static void onUserReady(JsonNode data, User currentUser) { long gameId = data.findPath("gameid").asLong(); PlayBattleshipController gameController = ongoingGames.get(gameId); if (gameController != null) { gameController.ready.release(); } else { // TODO: return error } } private static void onGetOnlineUsers(JsonNode data, User currentUser) { Set<User> users = getOnlineUsers(); ObjectNode msg = JsonNodeFactory.instance.objectNode(); ArrayNode userList = JsonNodeFactory.instance.arrayNode(); for (User u : users) { ObjectNode user = JsonNodeFactory.instance.objectNode(); user.put("id", u.id); user.put("name", u.name); user.put("currentGame", u.getCurrentGame()); if (!u.name.equals(currentUser.name)) { userList.add(user); } } msg.put("action", "onlineUsers_response"); msg.put("response", userList); sendMessage(currentUser, msg); } private static void onSetShip(JsonNode data, User currentUser, Ship s) { long gameId = data.findPath("gameid").asLong(); PlayBattleshipController gameController = ongoingGames.get(gameId); if (gameController != null) { int row = data.findPath("row").asInt(); int col = data.findPath("col").asInt(); Position p = new Position(row, col); boolean horizontal = data.findPath("horizontal").asBoolean(); HumanController playerController = gameController.getPlayer(currentUser).getController(); playerController.placeShip(s, p, horizontal); } else { // TODO: throw error } } private static void onShoot(JsonNode data, User currentUser) { long gameId = data.findPath("gameid").asLong(); PlayBattleshipController gameController = ongoingGames.get(gameId); if (gameController != null) { int row = data.findPath("row").asInt(); int col = data.findPath("col").asInt(); Position p = new Position(row, col); HumanController playerController = gameController.getPlayer(currentUser).getController(); playerController.shoot(p); } } public static void onUserLeaves(JsonNode data, User currentUser) { long gameId = data.findPath("gameid").asLong(); PlayBattleshipController gameController = ongoingGames.get(gameId); if (gameController != null) { ongoingGames.remove(gameId); User opponent = gameController.getOpponent(currentUser).getUser(); ObjectNode notification = JsonNodeFactory.instance.objectNode(); notification.put("action", "opponentleft"); sendMessage(opponent, notification); try { // Broadcast to the rest of users ObjectMapper mapper = new ObjectMapper(); ObjectNode notPlayingAnymore = JsonNodeFactory.instance.objectNode(); notPlayingAnymore.put("action", "not_playing_anymore"); notPlayingAnymore.put("user1", mapper.writeValueAsString(currentUser)); notPlayingAnymore.put("user2", mapper.writeValueAsString(opponent)); broadcastMessage(notPlayingAnymore, new HashSet<User>() {{ add(currentUser); }}); } catch (JsonProcessingException e) { Logger.error(e.getMessage(), e); } } } public static Pair<PlayBattleshipHuman, PlayBattleshipHuman> getPlayers(long gameId) { PlayBattleshipController controller = ongoingGames.get(gameId); if (controller != null) { return controller.getPlayers(); } else { return null; } } protected static void sendMessage(User u, JsonNode msg) { Logger.debug("Sending to " + u.id + " - " + msg.toString()); Set<WebSocket.Out<JsonNode>> sockets = getUserSockets(u); for (WebSocket.Out<JsonNode> out : sockets) { out.write(msg); } } protected static void broadcastMessage(JsonNode msg, Set<User> excluded) { // TODO: untested if (excluded.isEmpty()) { Logger.debug("Broadcasting " + msg.toString()); } else { Logger.debug(excluded .stream() .map(u -> u.id.toString()) .collect(Collectors.joining(", ", "Broadcasting except to {", "} - " + msg.toString()))); } Set<WebSocket.Out<JsonNode>> targets = onlineUsers .entrySet() .stream() .filter(entry -> !excluded.contains(entry.getValue())) .map(Map.Entry::getKey) .collect(Collectors.toSet()); for (WebSocket.Out<JsonNode> out : targets) { out.write(msg); } } /** * Returns a list of sockets that belong to the given user. * @param u The user connected to the sockets. * @return A list of sockets liked to the user. */ private static Set<WebSocket.Out<JsonNode>> getUserSockets(User u) { Set<WebSocket.Out<JsonNode>> sockets = onlineUsers .entrySet() .stream() .filter(entry -> Objects.equals(entry.getValue(), u)) .map(Map.Entry::getKey) .collect(Collectors.toSet()); return sockets; } /** * Checks if a User is currently playing. * @param u The user. * @return The ID of the game he's currently playing or null if the user isn't playing any game. */ public static Long getCurrentGame(User u) { Map.Entry<Long, PlayBattleshipController> entry = ongoingGames .entrySet() .stream() .filter(e -> e.getValue().getPlayer(u) != null) .findFirst() .orElse(null); return entry == null ? null : entry.getKey(); } }
45.109661
115
0.554205
71423f0550eefaaf7275d72c6f78c88f9ceca688
2,534
package org.joverseer.engine.orders; import org.joverseer.domain.NationRelations; import org.joverseer.domain.NationRelationsEnum; import org.joverseer.domain.Order; import org.joverseer.engine.ErrorException; import org.joverseer.engine.ExecutingOrder; import org.joverseer.engine.Randomizer; import org.joverseer.game.Game; import org.joverseer.game.Turn; import org.joverseer.game.TurnElementsEnum; import org.joverseer.metadata.domain.Nation; import org.joverseer.metadata.domain.NationAllegianceEnum; public class ChangeRelationsOrder extends ExecutingOrder { public ChangeRelationsOrder(Order order) { super(order); } @Override public void doExecute(Game game, Turn turn) throws ErrorException { int nationNo = getParameterInt(0); String command = getOrderNo() == 180 ? "upgrade" : "downgrade"; Nation n = game.getMetadata().getNationByNum(nationNo); addMessage("{char} was ordered to " + command + " our relations with " + n.getName() + "."); NationRelations nr = (NationRelations)turn.getContainer(TurnElementsEnum.NationRelation).findFirstByProperty("nationNo", getNationNo()); NationRelationsEnum nre = nr.getRelationsFor(nationNo); if (!isCommander()) { return; } if (!loadPopCenter(turn) || !isAtCapital()) { addMessage("{char} could not complete the order because {gp} was not at the capital."); return; } int roll = Randomizer.roll(getCharacter().getCommandTotal() + 30); //TODO handle allegiances and stuff if (getOrderNo() == 180) { if (nre.equals(NationRelationsEnum.Friendly)) { addMessage("{char} was unable to upgrade our relations with " + n.getName() + " because our relations were already friendly."); return; } if (nre.equals(NationRelationsEnum.Tolerated)) { nre = NationRelationsEnum.Friendly; } else if (nre.equals(NationRelationsEnum.Neutral)) { nre = NationRelationsEnum.Tolerated; } } else if (getOrderNo() == 185) { if (nre.equals(NationRelationsEnum.Hated)) { addMessage("{char} was unable to upgrade our relations with " + n.getName() + " because our relations were already hated."); return; } if (nre.equals(NationRelationsEnum.Disliked)) { nre = NationRelationsEnum.Hated; } else if (nre.equals(NationRelationsEnum.Neutral)) { nre = NationRelationsEnum.Disliked; } } nr.setRelationsFor(nationNo, nre); addMessage("Our relations to " + n.getName() + " were changed to " + nre + "."); } }
34.712329
139
0.703236
9c96861aeee899b74fc121f56be849d6703f36d3
2,401
/** * Copyright 2016 Yurii Rashkovskii * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and */ package graphql.annotations.processor.util; import java.util.regex.Pattern; public class NamingKit { private final static Pattern VALID_NAME = Pattern.compile("[_A-Za-z][_0-9A-Za-z]*"); private final static Pattern VALID_START = Pattern.compile("[_A-Za-z]"); private final static Pattern VALID_CHAR = Pattern.compile("[_0-9A-Za-z]"); /** * Graphql 3.x has valid names of [_A-Za-z][_0-9A-Za-z]* and hence Java generated names like Class$Inner wont work * so we make a unique name from it * * @param name the name to ensure * * @return a valid name */ public static String toGraphqlName(String name) { if (VALID_NAME.matcher(name).matches()) { return name; } StringBuilder sb = new StringBuilder(); for (int i = 0; i < name.length(); i++) { char c = name.charAt(i); String sChar = new String(new char[]{c}); // check start character differently if (i == 0) { if (!VALID_START.matcher(sChar).matches()) { replace(sb, c); } else { sb.append(c); } } else { if (!VALID_CHAR.matcher(sChar).matches()) { replace(sb, c); } else { sb.append(c); } } } return sb.toString(); } private static void replace(StringBuilder sb, char c) { // the most common in Java class land is . and $ so for readability we make them // just _ if (c == '.' || c == '$') { sb.append('_'); } else { sb.append("_"); Integer iChar = (int) c; sb.append(iChar.toString()); sb.append("_"); } } }
33.347222
118
0.55935
d7dd9ca46bfdd9f56649229a706df4f2f12cf1c9
1,915
package com.game.gairun.interfaces; import com.game.gairun.Game; import java.awt.*; public class Blocks { private final Texture tex; private BlockType blockType; private float x; private float y; private final Game game; // public Blocks(BlockType blockType) { // this.blockType = blockType; // } public Blocks(float x, float y, Texture tex, BlockType blockType, Game game) { this.x = x; this.y = y; this.tex = tex; this.blockType = blockType; this.game = game; } public void render(Graphics g) { if (x < game.getCamera().getX() + (float) (Game.WIDTH/2) && x > game.getCamera().getX() - (float) (Game.WIDTH/2) && y < game.getCamera().getY() + (float) (Game.HEIGHT/2) && y > game.getCamera().getY() - (float) (Game.HEIGHT/2)) { float xRender = x + (float) Game.WIDTH / 2; float yRender = -y + (float) Game.HEIGHT / 2; g.drawImage(tex.getTexture(), (int) xRender, (int) yRender, null); if (game.getCamera().isDebug()) { g.setColor(Color.red); g.drawRect((int) xRender, (int) yRender, tex.getTexture().getWidth(), tex.getTexture().getHeight()); } } } public void tick() { tex.runAnimation(); } public Rectangle getHitbox() { // TODO: custom hitbox size return new Rectangle((int) x, (int) y + tex.getTexture().getHeight(), tex.getTexture().getWidth(), tex.getTexture().getHeight()); } public BlockType getBlockType() { return blockType; } public void setBlockType(BlockType blockType) { this.blockType = blockType; } public float getX() { return x; } public void setX(float x) { this.x = x; } public float getY() { return y; } public void setY(float y) { this.y = y; } }
26.971831
237
0.566057
5e5753251ca5cc7641538a2eac2692a33fe54c17
3,465
package ru.stqa.pft.addressbook.appmanager; import org.openqa.selenium.*; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.ie.InternetExplorerDriver; import org.openqa.selenium.remote.BrowserType; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.net.URL; import java.util.Properties; import java.util.concurrent.TimeUnit; public class ApplicationManager { private Properties properties; WebDriver wd; private SessionHelper sessionHelper; private NavigationHelper navigationHelper; private GroupHelper groupHelper; private ContactHelper contactHelper; private String browser; private DbHelper dbHelper; public ApplicationManager(String browser) { this.browser = browser; } public void init() throws IOException { String target = System.getProperty("target", "local"); properties = new Properties(); properties.load(new FileReader(new File(String.format("src/test/resources/config/%s.properties", target)))); String baseUrl = properties.getProperty("web.baseUrl"); String seleniumGrid = properties.getProperty("selenium.server"); String adminLogin = properties.getProperty("web.adminLogin"); String adminPassword = properties.getProperty("web.adminPassword"); String geckoDriverPath = properties.getProperty("web.geckoDriverPath"); String chromeDriverPath = properties.getProperty("web.chromeDriverPath"); String ieDriverPath = properties.getProperty("web.ieDriverPath"); dbHelper = new DbHelper(); if ("".equals(seleniumGrid)) { switch (browser) { case BrowserType.CHROME: setDriverPath("webdriver.chrome.driver", chromeDriverPath); wd = new ChromeDriver(); break; case BrowserType.FIREFOX: setDriverPath("webdriver.gecko.driver", geckoDriverPath); wd = new FirefoxDriver(); break; case BrowserType.IE: setDriverPath("webdriver.ie.driver", ieDriverPath); wd = new InternetExplorerDriver(); break; default: throw new IOException("Unrecognized browser: " + browser); } } else { DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setBrowserName(browser); capabilities.setPlatform(Platform.fromString(System.getProperty("platform", "WINDOWS"))); wd = new RemoteWebDriver(new URL(seleniumGrid), capabilities); } wd.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS); wd.get(baseUrl); groupHelper = new GroupHelper(wd); contactHelper = new ContactHelper(wd); navigationHelper = new NavigationHelper(wd); sessionHelper = new SessionHelper(wd); sessionHelper.login(adminLogin, adminPassword); } private void setDriverPath(String driver, String path) { System.setProperty(String.format("webdriver.%s.driver", driver), path); } public void stop() { wd.quit(); } public GroupHelper group() { return groupHelper; } public NavigationHelper goTo() { return navigationHelper; } public ContactHelper contact() { return contactHelper; } public DbHelper db() { return dbHelper; } public byte[] takeScreenshot() { return ((TakesScreenshot) wd).getScreenshotAs(OutputType.BYTES); } }
32.083333
112
0.719192
f97bf73fa178e0137f406c7b6519b779a1e56df8
10,210
/* * Copyright (c) 2017, University of Oslo * * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * Neither the name of the HISP project nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.hisp.dhis.android.core.dataset; import android.database.Cursor; import android.database.sqlite.SQLiteStatement; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import com.gabrielittner.auto.value.cursor.ColumnAdapter; import com.gabrielittner.auto.value.cursor.ColumnName; import com.google.auto.value.AutoValue; import org.hisp.dhis.android.core.common.BaseNameableObjectModel; import org.hisp.dhis.android.core.common.ModelFactory; import org.hisp.dhis.android.core.common.PeriodType; import org.hisp.dhis.android.core.common.StatementBinder; import org.hisp.dhis.android.core.data.database.DbPeriodTypeColumnAdapter; import org.hisp.dhis.android.core.utils.Utils; import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; @AutoValue @SuppressWarnings("PMD") public abstract class DataSetModel extends BaseNameableObjectModel implements StatementBinder { public static final String TABLE = "DataSet"; public static class Columns extends BaseNameableObjectModel.Columns { public static final String PERIOD_TYPE = "periodType"; public static final String CATEGORY_COMBO = "categoryCombo"; public static final String MOBILE = "mobile"; public static final String VERSION = "version"; public static final String EXPIRY_DAYS = "expiryDays"; public static final String TIMELY_DAYS = "timelyDays"; public static final String NOTIFY_COMPLETING_USER = "notifyCompletingUser"; public static final String OPEN_FUTURE_PERIODS = "openFuturePeriods"; public static final String FIELD_COMBINATION_REQUIRED = "fieldCombinationRequired"; public static final String VALID_COMPLETE_ONLY = "validCompleteOnly"; public static final String NO_VALUE_REQUIRES_COMMENT = "noValueRequiresComment"; public static final String SKIP_OFFLINE = "skipOffline"; public static final String DATA_ELEMENT_DECORATION = "dataElementDecoration"; public static final String RENDER_AS_TABS = "renderAsTabs"; public static final String RENDER_HORIZONTALLY = "renderHorizontally"; public static String[] all() { return Utils.appendInNewArray(BaseNameableObjectModel.Columns.all(), PERIOD_TYPE, CATEGORY_COMBO, MOBILE, VERSION, EXPIRY_DAYS, TIMELY_DAYS, NOTIFY_COMPLETING_USER, OPEN_FUTURE_PERIODS, FIELD_COMBINATION_REQUIRED, VALID_COMPLETE_ONLY, NO_VALUE_REQUIRES_COMMENT, SKIP_OFFLINE, DATA_ELEMENT_DECORATION, RENDER_AS_TABS, RENDER_HORIZONTALLY); } } static DataSetModel create(Cursor cursor) { return AutoValue_DataSetModel.createFromCursor(cursor); } public static final ModelFactory<DataSetModel, DataSet> factory = new ModelFactory<DataSetModel, DataSet>() { @Override public DataSetModel fromCursor(Cursor cursor) { return create(cursor); } @Override public DataSetModel fromPojo(DataSet dataSet) { return DataSetModel.builder() .uid(dataSet.uid()) .code(dataSet.code()) .name(dataSet.name()) .displayName(dataSet.displayName()) .created(dataSet.created()) .lastUpdated(dataSet.lastUpdated()) .shortName(dataSet.shortName()) .displayShortName(dataSet.displayShortName()) .description(dataSet.description()) .displayDescription(dataSet.displayDescription()) .periodType(dataSet.periodType()) .categoryCombo(dataSet.categoryComboUid()) .mobile(dataSet.mobile()) .version(dataSet.version()) .expiryDays(dataSet.expiryDays()) .timelyDays(dataSet.timelyDays()) .notifyCompletingUser(dataSet.notifyCompletingUser()) .openFuturePeriods(dataSet.openFuturePeriods()) .fieldCombinationRequired(dataSet.fieldCombinationRequired()) .validCompleteOnly(dataSet.validCompleteOnly()) .noValueRequiresComment(dataSet.noValueRequiresComment()) .skipOffline(dataSet.skipOffline()) .dataElementDecoration(dataSet.dataElementDecoration()) .renderAsTabs(dataSet.renderAsTabs()) .renderHorizontally(dataSet.renderHorizontally()) .build(); } }; public static Builder builder() { return new $AutoValue_DataSetModel.Builder(); } @Nullable @ColumnName(Columns.PERIOD_TYPE) @ColumnAdapter(DbPeriodTypeColumnAdapter.class) public abstract PeriodType periodType(); @Nullable @ColumnName(Columns.CATEGORY_COMBO) public abstract String categoryCombo(); @Nullable @ColumnName(Columns.MOBILE) public abstract Boolean mobile(); @Nullable @ColumnName(Columns.VERSION) public abstract Integer version(); @Nullable @ColumnName(Columns.EXPIRY_DAYS) public abstract Integer expiryDays(); @Nullable @ColumnName(Columns.TIMELY_DAYS) public abstract Integer timelyDays(); @Nullable @ColumnName(Columns.NOTIFY_COMPLETING_USER) public abstract Boolean notifyCompletingUser(); @Nullable @ColumnName(Columns.OPEN_FUTURE_PERIODS) public abstract Integer openFuturePeriods(); @Nullable @ColumnName(Columns.FIELD_COMBINATION_REQUIRED) public abstract Boolean fieldCombinationRequired(); @Nullable @ColumnName(Columns.VALID_COMPLETE_ONLY) public abstract Boolean validCompleteOnly(); @Nullable @ColumnName(Columns.NO_VALUE_REQUIRES_COMMENT) public abstract Boolean noValueRequiresComment(); @Nullable @ColumnName(Columns.SKIP_OFFLINE) public abstract Boolean skipOffline(); @Nullable @ColumnName(Columns.DATA_ELEMENT_DECORATION) public abstract Boolean dataElementDecoration(); @Nullable @ColumnName(Columns.RENDER_AS_TABS) public abstract Boolean renderAsTabs(); @Nullable @ColumnName(Columns.RENDER_HORIZONTALLY) public abstract Boolean renderHorizontally(); @Override public void bindToStatement(@NonNull SQLiteStatement sqLiteStatement) { super.bindToStatement(sqLiteStatement); sqLiteBind(sqLiteStatement, 11, periodType()); sqLiteBind(sqLiteStatement, 12, categoryCombo()); sqLiteBind(sqLiteStatement, 13, mobile()); sqLiteBind(sqLiteStatement, 14, version()); sqLiteBind(sqLiteStatement, 15, expiryDays()); sqLiteBind(sqLiteStatement, 16, timelyDays()); sqLiteBind(sqLiteStatement, 17, notifyCompletingUser()); sqLiteBind(sqLiteStatement, 18, openFuturePeriods()); sqLiteBind(sqLiteStatement, 19, fieldCombinationRequired()); sqLiteBind(sqLiteStatement, 20, validCompleteOnly()); sqLiteBind(sqLiteStatement, 21, noValueRequiresComment()); sqLiteBind(sqLiteStatement, 22, skipOffline()); sqLiteBind(sqLiteStatement, 23, dataElementDecoration()); sqLiteBind(sqLiteStatement, 24, renderAsTabs()); sqLiteBind(sqLiteStatement, 25, renderHorizontally()); } @AutoValue.Builder public static abstract class Builder extends BaseNameableObjectModel.Builder<Builder> { public abstract Builder periodType(PeriodType periodType); public abstract Builder categoryCombo(String categoryCombo); public abstract Builder mobile(Boolean mobile); public abstract Builder version(Integer version); public abstract Builder expiryDays(Integer expiryDays); public abstract Builder timelyDays(Integer timelyDays); public abstract Builder notifyCompletingUser(Boolean notifyCompletingUser); public abstract Builder openFuturePeriods(Integer openFuturePeriods); public abstract Builder fieldCombinationRequired(Boolean fieldCombinationRequired); public abstract Builder validCompleteOnly(Boolean validCompleteOnly); public abstract Builder noValueRequiresComment(Boolean noValueRequiresComment); public abstract Builder skipOffline(Boolean skipOffline); public abstract Builder dataElementDecoration(Boolean dataElementDecoration); public abstract Builder renderAsTabs(Boolean renderAsTabs); public abstract Builder renderHorizontally(Boolean renderHorizontally); public abstract DataSetModel build(); } }
41.844262
106
0.714496
75d2b502a875725f1e8654d6df2a36b87f257782
1,085
package de.hackathondd.dvblive.application; import java.util.HashSet; import java.util.Set; import java.util.stream.Collectors; import de.hackathondd.dvblive.domain.Haltestelle; import de.hackathondd.dvblive.domain.Journey; public class HaltestelleTo { private String triasCode; private String latitude; private String longitude; private Set<Journey> journeys = new HashSet<>(); public HaltestelleTo(Haltestelle haltestelle, String linienfilter) { this.triasCode = haltestelle.getTriasCode(); this.latitude = haltestelle.getLatitude(); this.longitude = haltestelle.getLongitude(); this.journeys = haltestelle.getJourneys().stream() .filter(journey -> journey.getLinie().equals(linienfilter)).collect(Collectors.toSet()); ; } public String getTriasCode() { return triasCode; } public String getLatitude() { return latitude; } public String getLongitude() { return longitude; } public Set<Journey> getJourneys() { return journeys; } }
26.463415
104
0.682949
22ceb2e0177abcc730123bb2f7d804e78b1b21ab
2,022
package com.yummynoodlebar.web.controller; import java.util.UUID; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.yummynoodlebar.core.services.OrderService; import com.yummynoodlebar.events.orders.OrderDetailsEvent; import com.yummynoodlebar.events.orders.OrderStatusEvent; import com.yummynoodlebar.events.orders.RequestOrderDetailsEvent; import com.yummynoodlebar.events.orders.RequestOrderStatusEvent; import com.yummynoodlebar.web.domain.OrderStatus; @Controller @RequestMapping("/order/{orderId}") public class OrderStatusController { private static final Logger LOG = LoggerFactory.getLogger(OrderStatusController.class); @Autowired private OrderService orderService; @RequestMapping(method = RequestMethod.GET) public String orderStatus(@ModelAttribute("orderStatus") OrderStatus orderStatus) { LOG.debug("Get order status for order id {} customer {}", orderStatus.getOrderId(), orderStatus.getName()); return "/order"; } @ModelAttribute("orderStatus") public OrderStatus getOrderStatus(@PathVariable("orderId") String orderId) { OrderDetailsEvent orderDetailsEvent = orderService.requestOrderDetails(new RequestOrderDetailsEvent(UUID.fromString(orderId))); OrderStatusEvent orderStatusEvent = orderService.requestOrderStatus(new RequestOrderStatusEvent(UUID.fromString(orderId))); if(orderDetailsEvent.isEntityFound()) { OrderStatus status = new OrderStatus(); status.setName(orderDetailsEvent.getOrderDetails().getName()); status.setOrderId(orderDetailsEvent.getId()); status.setStatus(orderStatusEvent.getOrderStatus().getStatus()); return status; } else { return null; } } }
38.150943
129
0.816024
0789a53cbd498656e05018819e73a4713aa1ea71
410
package com.iliev.peter.kata.utils; public class ArrayComparer { private ArrayComparer() { } public static <T extends Comparable<T>> boolean areEqualArrays(T[] a, T[] b) { if (a == null || b == null) { return false; } if (a.length != b.length) { return false; } for(int i = 0; i < a.length; i++) { if (a[i].compareTo(b[i]) != 0) { return false; } } return true; } }
16.4
79
0.568293
2b2bf757c760e6d3fc6e0c590cdb81636b62fe5c
3,242
package com.zkyyo.www.web.controller; import com.zkyyo.www.service.UserService; import com.zkyyo.www.web.Access; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.net.URLEncoder; /** * 该Servlet用于处理更新用户状态的请求 */ @WebServlet( name = "UserManageServlet", urlPatterns = {"/user_manage.do"} ) public class UserManageServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String userId = request.getParameter("userId"); //用户ID String status = request.getParameter("status"); //请求更新的用户状态 //保存此时的搜索状态, 用于重定向 String statusSearch = request.getParameter("statusSearch"); //查询用户状态 String search = request.getParameter("search"); //查询内容 String order = request.getParameter("order"); //排序依据 String page = request.getParameter("page"); //请求页数 String isReverse = request.getParameter("isReverse"); //是否倒序 UserService userService = (UserService) getServletContext().getAttribute("userService"); //判断请求更新的状态是否合法 if (userService.isValidStatus(status)) { //判断用户是否存在 if (userService.isValidUserId(userId) && userService.isUserExisted(Integer.valueOf(userId))) { int uStatus = Integer.valueOf(status); int id = Integer.valueOf(userId); //代码层防止管理员对自己的账号进行操作 Access access = (Access) request.getSession().getAttribute("access"); if (access.getUserId() == id) { response.sendRedirect("admin_index.jsp"); return; } //search = new String(search.getBytes("UTF-8"), "ISO-8859-1"); search = URLEncoder.encode(search, "UTF-8"); String url = "user_manage_info.do?search=" + search + "&order=" + order + "&page=" + page + "&isReverse=" + isReverse + "&statusSearch=" + statusSearch; //判断请求更新的状态类型 if (uStatus == UserService.STATUS_NORMAL) { userService.updateStatus(id, UserService.STATUS_NORMAL); response.sendRedirect(url); return; } else if (uStatus == UserService.STATUS_NOT_APPROVED) { userService.updateStatus(id, UserService.STATUS_NOT_APPROVED); response.sendRedirect(url); return; } else if (uStatus == UserService.STATUS_FORBIDDEN) { userService.updateStatus(id, UserService.STATUS_FORBIDDEN); response.sendRedirect(url); return; } else { response.sendRedirect("admin_index.jsp"); return; } } } response.sendRedirect("admin_index.jsp"); } }
42.103896
122
0.610734
694d4ee1938b02dba99d507e94d7126edabf70a4
2,105
package csparksfly; import csparksfly.gradle.Dependency; import csparksfly.gradle.MavenModule; import org.jgrapht.Graph; import org.jgrapht.graph.DefaultEdge; import org.jgrapht.io.ComponentNameProvider; import org.jgrapht.io.DOTExporter; import org.jgrapht.io.ExportException; import org.jgrapht.io.GraphExporter; import java.io.IOException; import java.io.StringWriter; import java.io.Writer; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; public class GraphExport { public static void Dot(Graph<MavenModule, DefaultEdge> graph, String filename) throws ExportException, IOException { // adhering to the DOT language restrictions ComponentNameProvider<MavenModule> vertexIdProvider = new ComponentNameProvider<MavenModule>() { public String getName(MavenModule module) { //return name.replace('.', '_').replace(":","_"); return ""+module.hashCode(); } }; ComponentNameProvider<MavenModule> vertexLabelProvider = new ComponentNameProvider<MavenModule>() { public String getName(MavenModule module) { return module.getFullModuleSpec(); } }; GraphExporter<MavenModule, DefaultEdge> exporter = new DOTExporter<>(vertexIdProvider, vertexLabelProvider, null); Writer writer = new StringWriter(); exporter.exportGraph(graph, writer); Path path = Paths.get(filename); byte[] strToBytes = writer.toString().getBytes(); Files.write(path, strToBytes); System.out.println(writer.toString()); } public static void main(String[] args) throws Exception{ List<Dependency> dependencies = Dependency.FromFile("src/test/resources/deps2.txt"); Graph<MavenModule, DefaultEdge> graph = Dependency.Create(dependencies); GraphExport.Dot(graph, "src/test/resources/sample.dot" ); //dot -Tpng src/test/resources/sample.dot -o src/test/resources/sample.png } }
32.384615
120
0.678385
d36d4892ebd220941e4fae7a106171fa08e763df
1,293
package com.github.soap2jms.test; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class SlowServlet extends HttpServlet { private static final Logger LOGGER = LoggerFactory.getLogger(SlowServlet.class); /** * */ private static final long serialVersionUID = -7552592324501939896L; public SlowServlet() { } @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { final String queryString = request.getQueryString(); LOGGER.debug("Call received " + request.getPathInfo() + ",query string [" + queryString + "]"); String sb = request.getPathInfo(); if (StringUtils.isBlank(queryString) || !"wsdl".equalsIgnoreCase(queryString)) { LOGGER.debug("Call slow down " + request.getPathInfo()); try { Thread.sleep(3000); } catch (InterruptedException e) { } } RequestDispatcher rdisp = request.getServletContext().getRequestDispatcher(sb); rdisp.forward(request, response); } }
28.733333
97
0.763341
344c9bf6d01655c7bfd50eddcafecf4cdbda60c1
6,639
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.axiom.truth.xml; import java.util.HashMap; import java.util.Map; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import org.apache.axiom.truth.xml.spi.Event; import org.apache.axiom.truth.xml.spi.Traverser; import org.w3c.dom.Attr; import org.w3c.dom.DocumentType; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.ProcessingInstruction; import org.w3c.dom.Text; import com.google.common.base.Strings; final class DOMTraverser implements Traverser { private final Node root; private final boolean dom3; private final boolean expandEntityReferences; private Node node; private boolean descend; DOMTraverser(Node root, boolean dom3, boolean expandEntityReferences) { this.root = root; this.dom3 = dom3; this.expandEntityReferences = expandEntityReferences; if (root.getNodeType() == Node.DOCUMENT_NODE) { node = root; descend = true; } } @Override public Event next() { while (true) { boolean visited; if (node == null) { node = root; visited = false; } else if (descend) { Node firstChild = node.getFirstChild(); if (firstChild != null) { node = firstChild; visited = false; } else { visited = true; } } else { Node nextSibling = node.getNextSibling(); if (node == root) { return null; } else if (nextSibling != null) { node = nextSibling; visited = false; } else { node = node.getParentNode(); visited = true; } } switch (node.getNodeType()) { case Node.DOCUMENT_NODE: return null; case Node.DOCUMENT_TYPE_NODE: descend = false; return Event.DOCUMENT_TYPE; case Node.ELEMENT_NODE: if (!visited) { descend = true; return Event.START_ELEMENT; } else { descend = false; return Event.END_ELEMENT; } case Node.TEXT_NODE: descend = false; return dom3 && ((Text)node).isElementContentWhitespace() ? Event.WHITESPACE : Event.TEXT; case Node.ENTITY_REFERENCE_NODE: if (expandEntityReferences) { descend = !visited; break; } else { descend = false; return Event.ENTITY_REFERENCE; } case Node.COMMENT_NODE: descend = false; return Event.COMMENT; case Node.CDATA_SECTION_NODE: descend = false; return Event.CDATA_SECTION; case Node.PROCESSING_INSTRUCTION_NODE: descend = false; return Event.PROCESSING_INSTRUCTION; default: throw new IllegalStateException(); } } } @Override public String getRootName() { return ((DocumentType)node).getName(); } @Override public String getPublicId() { return ((DocumentType)node).getPublicId(); } @Override public String getSystemId() { return ((DocumentType)node).getSystemId(); } private static QName getQName(Node node) { String localName = node.getLocalName(); if (localName == null) { return new QName(node.getNodeName()); } else { return new QName(node.getNamespaceURI(), node.getLocalName(), Strings.nullToEmpty(node.getPrefix())); } } @Override public QName getQName() { return getQName(node); } @Override public Map<QName,String> getAttributes() { Map<QName,String> result = null; NamedNodeMap attributes = node.getAttributes(); for (int i=0; i<attributes.getLength(); i++) { Attr attr = (Attr)attributes.item(i); if (!XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(attr.getNamespaceURI())) { if (result == null) { result = new HashMap<>(); } result.put(getQName(attr), attr.getValue()); } } return result; } @Override public Map<String,String> getNamespaces() { Map<String,String> result = null; NamedNodeMap attributes = node.getAttributes(); for (int i=0; i<attributes.getLength(); i++) { Attr attr = (Attr)attributes.item(i); if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(attr.getNamespaceURI())) { if (result == null) { result = new HashMap<>(); } String prefix = attr.getPrefix(); result.put(XMLConstants.XMLNS_ATTRIBUTE.equals(prefix) ? attr.getLocalName() : "", attr.getValue()); } } return result; } @Override public String getText() { return node.getNodeValue(); } @Override public String getEntityName() { return node.getNodeName(); } @Override public String getPITarget() { return ((ProcessingInstruction)node).getTarget(); } @Override public String getPIData() { return ((ProcessingInstruction)node).getData(); } }
32.544118
116
0.546468
b3b71acbef36031ef3e0182f3d550c6d8986b24e
487
package com.uncos.wechatboot.feedback.message; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; /** * 包含视频消息媒体id的消息 * Created by xuwen on 2016/1/16. */ public class MediaMessage extends IdMessage { protected String mediaId; // 视频消息媒体id,可以调用多媒体文件下载接口拉取数据 @JacksonXmlProperty(localName = "MediaId") public String getMediaId() { return mediaId; } public void setMediaId(String mediaId) { this.mediaId = mediaId; } }
22.136364
74
0.714579
cfc289aa0438f25789da5d5bc0a2784a7b582600
2,220
/* * Copyright 2017 jiajunhui<junhui_jia@163.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.kk.taurus.uiframe.u; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import static android.content.Context.CONNECTIVITY_SERVICE; /** * Created by Taurus on 2017/9/30. */ public class Utils { public static boolean isNetworkConnected(Context context) { ConnectivityManager mConnectivityManager = (ConnectivityManager) context.getSystemService(CONNECTIVITY_SERVICE); NetworkInfo mNetworkInfo = mConnectivityManager.getActiveNetworkInfo(); if (mNetworkInfo != null) { return mNetworkInfo.isAvailable(); } return false; } public static boolean isWifi(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager)context.getSystemService(CONNECTIVITY_SERVICE); NetworkInfo activeNetInfo = connectivityManager.getActiveNetworkInfo(); if (activeNetInfo != null && activeNetInfo.getType() == ConnectivityManager.TYPE_WIFI) { return true; } return false; } /** * 根据手机的分辨率从 dp 的单位 转成为 px(像素) */ public static int dip2px(Context context, float dpValue) { final float scale = context.getResources().getDisplayMetrics().density; return (int) (dpValue * scale + 0.5f); } /** * 根据手机的分辨率从 px(像素) 的单位 转成为 dp */ public static int px2dip(Context context, float pxValue) { final float scale = context.getResources().getDisplayMetrics().density; return (int) (pxValue / scale + 0.5f); } }
33.134328
120
0.686937
7499aaa7c28aca7fdd5dc127a8157ce82d0c16a5
374
package net.wolftail.api; import java.util.Map; import java.util.Set; import java.util.UUID; public interface SubPlayContextManager { RootPlayContextManager rootManager(); UniversalPlayerType type(); ServerPlayContext contextFor(UUID playId); int currentLoad(); Map<UUID, ServerPlayContext> asMap(); Set<ServerPlayContext> asSet(); }
17.809524
44
0.721925
c7e3f3f06556b4c838aa1ee8747d5f8790f2a612
434
package org.springframework.samples.petclinic.navershorturl; public interface ShortUrlDAO { ShortUrlEntity saveShortUrl(ShortUrlEntity shortUrlEntity); ShortUrlEntity getShortUrl(String originalUrl); ShortUrlEntity getOriginalUrl(String shortUrl); ShortUrlEntity updateShortUrl(ShortUrlEntity newShortUrlEntity); void deleteByShortUrl(String shortUrl); void deleteByOriginalUrl(String originalUrl); }
22.842105
68
0.808756
27db013e22c24c6f511339c1fe3816999c701b39
16,743
package com.logginghub.logging.messaging; import com.logginghub.logging.DefaultLogEvent; import com.logginghub.logging.LogEvent; import com.logginghub.logging.messages.PartialMessageException; import com.logginghub.utils.ExpandingByteBuffer; import com.logginghub.utils.FormattedRuntimeException; import com.logginghub.utils.logging.Logger; import com.logginghub.utils.logging.LoggerPerformanceInterface.EventContext; import java.nio.BufferOverflowException; import java.nio.BufferUnderflowException; import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; public class LogEventCodex extends AbstractCodex { private static final Logger logger = Logger.getLoggerFor(LogEventCodex.class); private final static byte versionOne = 1; private final static int lengthPlaceHolder = 0; /** * If we get asked to decode anything bigger than this then assume something has gone wrong... */ private static final int stringSizeCutoff = Integer.getInteger("logEventCodex.stringSizeCutoff", 10 * 1024 * 1024); public static LogEvent decode(ByteBuffer buffer) throws PartialMessageException { logger.finer("Attempting to decode log event from buffer '{}'", buffer); DefaultLogEvent event = null; buffer.mark(); try { byte b = buffer.get(); int version = b; if (version == versionOne) { int length = buffer.getInt(); int payloadStart = buffer.position(); logger.finer("Length decoded '{}', buffer state is '{}'", length, buffer); BufferDebugger bd = new BufferDebugger(buffer); if (length == 0) { throw new RuntimeException(String.format("Invalid event size '%d'", length)); } if (buffer.remaining() >= length) { event = new DefaultLogEvent(); int decodeProgress = 0; try { event.setLevel(buffer.getShort()); decodeProgress = 1; event.setMessage(decodeString(buffer)); decodeProgress = 2; event.setLocalCreationTimeMillis(buffer.getLong()); decodeProgress = 3; event.setSourceApplication(decodeString(buffer)); decodeProgress = 4; event.setFormattedException(decodeString(buffer)); decodeProgress = 5; event.setFormattedObject(decodeStringArray(buffer)); decodeProgress = 6; event.setLoggerName(decodeString(buffer)); decodeProgress = 7; event.setSequenceNumber(buffer.getLong()); decodeProgress = 8; event.setSourceClassName(decodeString(buffer)); decodeProgress = 9; event.setSourceHost(decodeString(buffer)); decodeProgress = 10; event.setSourceAddress(decodeString(buffer)); decodeProgress = 11; event.setSourceMethodName(decodeString(buffer)); decodeProgress = 12; event.setThreadName(decodeString(buffer)); // Read optional fields - pid int progress = buffer.position() - payloadStart; if (progress < length) { event.setPid(buffer.getInt()); decodeProgress = 14; } // Read optional fields - channel progress = buffer.position() - payloadStart; if (progress < length) { event.setChannel(decodeString(buffer)); decodeProgress = 15; } // Read optional fields - metadata progress = buffer.position() - payloadStart; if (progress < length) { byte hasMetadata = buffer.get(); if (hasMetadata == 0) { event.setMetadata(null); } else { short count = buffer.getShort(); Map<String, String> metadata = new HashMap<String, String>(count); for (int i = 0; i < count; i++) { String key = decodeString(buffer); String value = decodeString(buffer); metadata.put(key, value); } event.setMetadata(metadata); } decodeProgress = 16; } decodeProgress = 17; // Skip anything we dont support at the end of the // message int toSkip = length - (buffer.position() - payloadStart); buffer.position(buffer.position() + toSkip); decodeProgress = 18; } catch (RuntimeException re) { throw new FormattedRuntimeException(re, "Decoding failed at position {} (decode progress {}) : {}", buffer.position(), decodeProgress, re.getMessage()); } } else { buffer.reset(); throw new PartialMessageException(); } } else { throw new RuntimeException("Unknown encoding version number " + version); } } catch (BufferUnderflowException bufferUnderflowException) { // This is ok, it just means the entire event isn't in the buffer // yet. buffer.reset(); throw new PartialMessageException(); } logger.finer("Log event '{}' decoded, buffer state is now '{}'", event, buffer); return event; } public static EventContext decode(ByteBuffer buffer, EventContext flyweight) throws PartialMessageException { logger.finer("Attempting to decode log event context from buffer '{}'", buffer); buffer.mark(); try { byte b = buffer.get(); int version = b; if (version == versionOne) { int length = buffer.getInt(); int payloadStart = buffer.position(); logger.finer("Length decoded '{}', buffer state is '{}'", length, buffer); BufferDebugger bd = new BufferDebugger(buffer); if (length == 0) { throw new RuntimeException(String.format("Invalid event size '%d'", length)); } if (buffer.remaining() >= length) { int decodeProgress = 0; try { flyweight.level(buffer.getShort()); flyweight.pattern(buffer.getInt()); flyweight.time(buffer.getLong()); int bufferLength = buffer.getInt(); flyweight.setBuffer(ByteBuffer.wrap(buffer.array(), buffer.position(), bufferLength)); buffer.position(buffer.position() + bufferLength); flyweight.sourceClass(decodeString(buffer)); flyweight.sourceMethod(decodeString(buffer)); // Skip anything we dont support at the end of the // message int toSkip = length - (buffer.position() - payloadStart); buffer.position(buffer.position() + toSkip); } catch (RuntimeException re) { throw new FormattedRuntimeException(re, "Decoding failed at position {} (decode progress {}) : {}", buffer.position(), decodeProgress, re.getMessage()); } } else { buffer.reset(); throw new PartialMessageException(); } } else { throw new RuntimeException("Unknown encoding version number " + version); } } catch (BufferUnderflowException bufferUnderflowException) { // This is ok, it just means the entire event isn't in the buffer // yet. buffer.reset(); throw new PartialMessageException(); } logger.finer("Log event '{}' decoded, buffer state is now '{}'", flyweight, buffer); return flyweight; } public static void encode(ExpandingByteBuffer buffer, LogEvent event) { logger.finer("Attempting to encode log event '{}' into buffer '{}'", event, buffer); boolean done = false; while (!done) { try { encodeInternal_version1_with_channel_and_pid_and_metadata(buffer, event); done = true; } catch (BufferOverflowException blow) { buffer.doubleSize(); buffer.clear(); done = false; } } } public static void encodeInternal_version1_with_channel_and_pid_and_metadata(ExpandingByteBuffer buffer, LogEvent event) { buffer.put(versionOne); int lengthPosition = buffer.position(); buffer.putInt(lengthPlaceHolder); int contentPosition = buffer.position(); buffer.putShort((short) event.getLevel()); encodeString(buffer, event.getMessage()); buffer.putLong(event.getOriginTime()); encodeString(buffer, event.getSourceApplication()); encodeString(buffer, event.getFormattedException()); encodeStringArray(buffer, event.getFormattedObject()); encodeString(buffer, event.getLoggerName()); buffer.putLong(event.getSequenceNumber()); encodeString(buffer, event.getSourceClassName()); encodeString(buffer, event.getSourceHost()); encodeString(buffer, event.getSourceAddress()); encodeString(buffer, event.getSourceMethodName()); encodeString(buffer, event.getThreadName()); buffer.putInt(event.getPid()); encodeString(buffer, event.getChannel()); Map<String, String> metadata = event.getMetadata(); if (metadata == null || metadata.isEmpty()) { buffer.put((byte) 0); } else { buffer.put((byte) 1); buffer.putShort((short) metadata.size()); for (Entry<String, String> entry : metadata.entrySet()) { encodeString(buffer, entry.getKey()); encodeString(buffer, entry.getValue()); } } int endPosition = buffer.position(); int length = endPosition - contentPosition; buffer.position(lengthPosition); buffer.putInt(length); buffer.position(endPosition); } public static void encodeEventContext(ExpandingByteBuffer buffer, EventContext event) { buffer.put(versionOne); int lengthPosition = buffer.position(); buffer.putInt(lengthPlaceHolder); int contentPosition = buffer.position(); buffer.putShort((short) event.getLevel()); buffer.putInt(event.getPatternId()); buffer.putLong(event.getTime()); buffer.putInt(event.getBuffer().remaining()); buffer.put(event.getBuffer()); encodeString(buffer, event.getSourceClassName()); encodeString(buffer, event.getSourceMethodName()); int endPosition = buffer.position(); int length = endPosition - contentPosition; buffer.position(lengthPosition); buffer.putInt(length); buffer.position(endPosition); } public static void encodeInternal_version1(ExpandingByteBuffer buffer, LogEvent event) { buffer.put(versionOne); int lengthPosition = buffer.position(); buffer.putInt(lengthPlaceHolder); int contentPosition = buffer.position(); buffer.putShort((short) event.getLevel()); encodeString(buffer, event.getMessage()); buffer.putLong(event.getOriginTime()); encodeString(buffer, event.getSourceApplication()); encodeString(buffer, event.getFormattedException()); encodeStringArray(buffer, event.getFormattedObject()); encodeString(buffer, event.getLoggerName()); buffer.putLong(event.getSequenceNumber()); encodeString(buffer, event.getSourceClassName()); encodeString(buffer, event.getSourceHost()); encodeString(buffer, event.getSourceAddress()); encodeString(buffer, event.getSourceMethodName()); encodeString(buffer, event.getThreadName()); int endPosition = buffer.position(); int length = endPosition - contentPosition; buffer.position(lengthPosition); buffer.putInt(length); buffer.position(endPosition); } public static void encodeInternal_version1_with_channel_and_pid(ExpandingByteBuffer buffer, LogEvent event) { buffer.put(versionOne); int lengthPosition = buffer.position(); buffer.putInt(lengthPlaceHolder); int contentPosition = buffer.position(); buffer.putShort((short) event.getLevel()); encodeString(buffer, event.getMessage()); buffer.putLong(event.getOriginTime()); encodeString(buffer, event.getSourceApplication()); encodeString(buffer, event.getFormattedException()); encodeStringArray(buffer, event.getFormattedObject()); encodeString(buffer, event.getLoggerName()); buffer.putLong(event.getSequenceNumber()); encodeString(buffer, event.getSourceClassName()); encodeString(buffer, event.getSourceHost()); encodeString(buffer, event.getSourceAddress()); encodeString(buffer, event.getSourceMethodName()); encodeString(buffer, event.getThreadName()); buffer.putInt(event.getPid()); encodeString(buffer, event.getChannel()); int endPosition = buffer.position(); int length = endPosition - contentPosition; buffer.position(lengthPosition); buffer.putInt(length); buffer.position(endPosition); } public static void encodeInternal_version1_with_pid(ExpandingByteBuffer buffer, LogEvent event) { buffer.put(versionOne); int lengthPosition = buffer.position(); buffer.putInt(lengthPlaceHolder); int contentPosition = buffer.position(); buffer.putShort((short) event.getLevel()); encodeString(buffer, event.getMessage()); buffer.putLong(event.getOriginTime()); encodeString(buffer, event.getSourceApplication()); encodeString(buffer, event.getFormattedException()); encodeStringArray(buffer, event.getFormattedObject()); encodeString(buffer, event.getLoggerName()); buffer.putLong(event.getSequenceNumber()); encodeString(buffer, event.getSourceClassName()); encodeString(buffer, event.getSourceHost()); encodeString(buffer, event.getSourceAddress()); encodeString(buffer, event.getSourceMethodName()); encodeString(buffer, event.getThreadName()); buffer.putInt(event.getPid()); int endPosition = buffer.position(); int length = endPosition - contentPosition; buffer.position(lengthPosition); buffer.putInt(length); buffer.position(endPosition); } }
41.649254
127
0.543093
5249d9883b5dbf2bc1f3cb0543724ac3b44e5354
34,715
package com.topjohnwu.signing; import java.nio.BufferUnderflowException; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.security.DigestException; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.KeyFactory; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.PublicKey; import java.security.Signature; import java.security.SignatureException; import java.security.cert.CertificateEncodingException; import java.security.cert.X509Certificate; import java.security.spec.AlgorithmParameterSpec; import java.security.spec.InvalidKeySpecException; import java.security.spec.MGF1ParameterSpec; import java.security.spec.PSSParameterSpec; import java.security.spec.X509EncodedKeySpec; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; /** * APK Signature Scheme v2 signer. * * <p>APK Signature Scheme v2 is a whole-file signature scheme which aims to protect every single * bit of the APK, as opposed to the JAR Signature Scheme which protects only the names and * uncompressed contents of ZIP entries. */ public abstract class ApkSignerV2 { /* * The two main goals of APK Signature Scheme v2 are: * 1. Detect any unauthorized modifications to the APK. This is achieved by making the signature * cover every byte of the APK being signed. * 2. Enable much faster signature and integrity verification. This is achieved by requiring * only a minimal amount of APK parsing before the signature is verified, thus completely * bypassing ZIP entry decompression and by making integrity verification parallelizable by * employing a hash tree. * * The generated signature block is wrapped into an APK Signing Block and inserted into the * original APK immediately before the start of ZIP Central Directory. This is to ensure that * JAR and ZIP parsers continue to work on the signed APK. The APK Signing Block is designed for * extensibility. For example, a future signature scheme could insert its signatures there as * well. The contract of the APK Signing Block is that all contents outside of the block must be * protected by signatures inside the block. */ public static final int SIGNATURE_RSA_PSS_WITH_SHA256 = 0x0101; public static final int SIGNATURE_RSA_PSS_WITH_SHA512 = 0x0102; public static final int SIGNATURE_RSA_PKCS1_V1_5_WITH_SHA256 = 0x0103; public static final int SIGNATURE_RSA_PKCS1_V1_5_WITH_SHA512 = 0x0104; public static final int SIGNATURE_ECDSA_WITH_SHA256 = 0x0201; public static final int SIGNATURE_ECDSA_WITH_SHA512 = 0x0202; public static final int SIGNATURE_DSA_WITH_SHA256 = 0x0301; public static final int SIGNATURE_DSA_WITH_SHA512 = 0x0302; /** * {@code .SF} file header section attribute indicating that the APK is signed not just with * JAR signature scheme but also with APK Signature Scheme v2 or newer. This attribute * facilitates v2 signature stripping detection. * * <p>The attribute contains a comma-separated set of signature scheme IDs. */ public static final String SF_ATTRIBUTE_ANDROID_APK_SIGNED_NAME = "X-Android-APK-Signed"; public static final String SF_ATTRIBUTE_ANDROID_APK_SIGNED_VALUE = "2"; private static final int CONTENT_DIGEST_CHUNKED_SHA256 = 0; private static final int CONTENT_DIGEST_CHUNKED_SHA512 = 1; private static final int CONTENT_DIGESTED_CHUNK_MAX_SIZE_BYTES = 1024 * 1024; private static final byte[] APK_SIGNING_BLOCK_MAGIC = new byte[] { 0x41, 0x50, 0x4b, 0x20, 0x53, 0x69, 0x67, 0x20, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x20, 0x34, 0x32, }; private static final int APK_SIGNATURE_SCHEME_V2_BLOCK_ID = 0x7109871a; private ApkSignerV2() {} /** * Signer configuration. */ public static final class SignerConfig { /** Private key. */ public PrivateKey privateKey; /** * Certificates, with the first certificate containing the public key corresponding to * {@link #privateKey}. */ public List<X509Certificate> certificates; /** * List of signature algorithms with which to sign (see {@code SIGNATURE_...} constants). */ public List<Integer> signatureAlgorithms; } /** * Signs the provided APK using APK Signature Scheme v2 and returns the signed APK as a list of * consecutive chunks. * * <p>NOTE: To enable APK signature verifier to detect v2 signature stripping, header sections * of META-INF/*.SF files of APK being signed must contain the * {@code X-Android-APK-Signed: true} attribute. * * @param inputApk contents of the APK to be signed. The APK starts at the current position * of the buffer and ends at the limit of the buffer. * @param signerConfigs signer configurations, one for each signer. * * @throws ApkParseException if the APK cannot be parsed. * @throws InvalidKeyException if a signing key is not suitable for this signature scheme or * cannot be used in general. * @throws SignatureException if an error occurs when computing digests of generating * signatures. */ public static ByteBuffer[] sign( ByteBuffer inputApk, List<SignerConfig> signerConfigs) throws ApkParseException, InvalidKeyException, SignatureException { // Slice/create a view in the inputApk to make sure that: // 1. inputApk is what's between position and limit of the original inputApk, and // 2. changes to position, limit, and byte order are not reflected in the original. ByteBuffer originalInputApk = inputApk; inputApk = originalInputApk.slice(); inputApk.order(ByteOrder.LITTLE_ENDIAN); // Locate ZIP End of Central Directory (EoCD), Central Directory, and check that Central // Directory is immediately followed by the ZIP End of Central Directory. int eocdOffset = ZipUtils.findZipEndOfCentralDirectoryRecord(inputApk); if (eocdOffset == -1) { throw new ApkParseException("Failed to locate ZIP End of Central Directory"); } if (ZipUtils.isZip64EndOfCentralDirectoryLocatorPresent(inputApk, eocdOffset)) { throw new ApkParseException("ZIP64 format not supported"); } inputApk.position(eocdOffset); long centralDirSizeLong = ZipUtils.getZipEocdCentralDirectorySizeBytes(inputApk); if (centralDirSizeLong > Integer.MAX_VALUE) { throw new ApkParseException( "ZIP Central Directory size out of range: " + centralDirSizeLong); } int centralDirSize = (int) centralDirSizeLong; long centralDirOffsetLong = ZipUtils.getZipEocdCentralDirectoryOffset(inputApk); if (centralDirOffsetLong > Integer.MAX_VALUE) { throw new ApkParseException( "ZIP Central Directory offset in file out of range: " + centralDirOffsetLong); } int centralDirOffset = (int) centralDirOffsetLong; int expectedEocdOffset = centralDirOffset + centralDirSize; if (expectedEocdOffset < centralDirOffset) { throw new ApkParseException( "ZIP Central Directory extent too large. Offset: " + centralDirOffset + ", size: " + centralDirSize); } if (eocdOffset != expectedEocdOffset) { throw new ApkParseException( "ZIP Central Directory not immeiately followed by ZIP End of" + " Central Directory. CD end: " + expectedEocdOffset + ", EoCD start: " + eocdOffset); } // Create ByteBuffers holding the contents of everything before ZIP Central Directory, // ZIP Central Directory, and ZIP End of Central Directory. inputApk.clear(); ByteBuffer beforeCentralDir = getByteBuffer(inputApk, centralDirOffset); ByteBuffer centralDir = getByteBuffer(inputApk, eocdOffset - centralDirOffset); // Create a copy of End of Central Directory because we'll need modify its contents later. byte[] eocdBytes = new byte[inputApk.remaining()]; inputApk.get(eocdBytes); ByteBuffer eocd = ByteBuffer.wrap(eocdBytes); eocd.order(inputApk.order()); // Figure which which digests to use for APK contents. Set<Integer> contentDigestAlgorithms = new HashSet<>(); for (SignerConfig signerConfig : signerConfigs) { for (int signatureAlgorithm : signerConfig.signatureAlgorithms) { contentDigestAlgorithms.add( getSignatureAlgorithmContentDigestAlgorithm(signatureAlgorithm)); } } // Compute digests of APK contents. Map<Integer, byte[]> contentDigests; // digest algorithm ID -> digest try { contentDigests = computeContentDigests( contentDigestAlgorithms, new ByteBuffer[] {beforeCentralDir, centralDir, eocd}); } catch (DigestException e) { throw new SignatureException("Failed to compute digests of APK", e); } // Sign the digests and wrap the signatures and signer info into an APK Signing Block. ByteBuffer apkSigningBlock = ByteBuffer.wrap(generateApkSigningBlock(signerConfigs, contentDigests)); // Update Central Directory Offset in End of Central Directory Record. Central Directory // follows the APK Signing Block and thus is shifted by the size of the APK Signing Block. centralDirOffset += apkSigningBlock.remaining(); eocd.clear(); ZipUtils.setZipEocdCentralDirectoryOffset(eocd, centralDirOffset); // Follow the Java NIO pattern for ByteBuffer whose contents have been consumed. originalInputApk.position(originalInputApk.limit()); // Reset positions (to 0) and limits (to capacity) in the ByteBuffers below to follow the // Java NIO pattern for ByteBuffers which are ready for their contents to be read by caller. // Contrary to the name, this does not clear the contents of these ByteBuffer. beforeCentralDir.clear(); centralDir.clear(); eocd.clear(); // Insert APK Signing Block immediately before the ZIP Central Directory. return new ByteBuffer[] { beforeCentralDir, apkSigningBlock, centralDir, eocd, }; } private static Map<Integer, byte[]> computeContentDigests( Set<Integer> digestAlgorithms, ByteBuffer[] contents) throws DigestException { // For each digest algorithm the result is computed as follows: // 1. Each segment of contents is split into consecutive chunks of 1 MB in size. // The final chunk will be shorter iff the length of segment is not a multiple of 1 MB. // No chunks are produced for empty (zero length) segments. // 2. The digest of each chunk is computed over the concatenation of byte 0xa5, the chunk's // length in bytes (uint32 little-endian) and the chunk's contents. // 3. The output digest is computed over the concatenation of the byte 0x5a, the number of // chunks (uint32 little-endian) and the concatenation of digests of chunks of all // segments in-order. int chunkCount = 0; for (ByteBuffer input : contents) { chunkCount += getChunkCount(input.remaining(), CONTENT_DIGESTED_CHUNK_MAX_SIZE_BYTES); } final Map<Integer, byte[]> digestsOfChunks = new HashMap<>(digestAlgorithms.size()); for (int digestAlgorithm : digestAlgorithms) { int digestOutputSizeBytes = getContentDigestAlgorithmOutputSizeBytes(digestAlgorithm); byte[] concatenationOfChunkCountAndChunkDigests = new byte[5 + chunkCount * digestOutputSizeBytes]; concatenationOfChunkCountAndChunkDigests[0] = 0x5a; setUnsignedInt32LittleEngian( chunkCount, concatenationOfChunkCountAndChunkDigests, 1); digestsOfChunks.put(digestAlgorithm, concatenationOfChunkCountAndChunkDigests); } int chunkIndex = 0; byte[] chunkContentPrefix = new byte[5]; chunkContentPrefix[0] = (byte) 0xa5; // Optimization opportunity: digests of chunks can be computed in parallel. for (ByteBuffer input : contents) { while (input.hasRemaining()) { int chunkSize = Math.min(input.remaining(), CONTENT_DIGESTED_CHUNK_MAX_SIZE_BYTES); final ByteBuffer chunk = getByteBuffer(input, chunkSize); for (int digestAlgorithm : digestAlgorithms) { String jcaAlgorithmName = getContentDigestAlgorithmJcaDigestAlgorithm(digestAlgorithm); MessageDigest md; try { md = MessageDigest.getInstance(jcaAlgorithmName); } catch (NoSuchAlgorithmException e) { throw new DigestException( jcaAlgorithmName + " MessageDigest not supported", e); } // Reset position to 0 and limit to capacity. Position would've been modified // by the preceding iteration of this loop. NOTE: Contrary to the method name, // this does not modify the contents of the chunk. chunk.clear(); setUnsignedInt32LittleEngian(chunk.remaining(), chunkContentPrefix, 1); md.update(chunkContentPrefix); md.update(chunk); byte[] concatenationOfChunkCountAndChunkDigests = digestsOfChunks.get(digestAlgorithm); int expectedDigestSizeBytes = getContentDigestAlgorithmOutputSizeBytes(digestAlgorithm); int actualDigestSizeBytes = md.digest( concatenationOfChunkCountAndChunkDigests, 5 + chunkIndex * expectedDigestSizeBytes, expectedDigestSizeBytes); if (actualDigestSizeBytes != expectedDigestSizeBytes) { throw new DigestException( "Unexpected output size of " + md.getAlgorithm() + " digest: " + actualDigestSizeBytes); } } chunkIndex++; } } Map<Integer, byte[]> result = new HashMap<>(digestAlgorithms.size()); for (Map.Entry<Integer, byte[]> entry : digestsOfChunks.entrySet()) { int digestAlgorithm = entry.getKey(); byte[] concatenationOfChunkCountAndChunkDigests = entry.getValue(); String jcaAlgorithmName = getContentDigestAlgorithmJcaDigestAlgorithm(digestAlgorithm); MessageDigest md; try { md = MessageDigest.getInstance(jcaAlgorithmName); } catch (NoSuchAlgorithmException e) { throw new DigestException(jcaAlgorithmName + " MessageDigest not supported", e); } result.put(digestAlgorithm, md.digest(concatenationOfChunkCountAndChunkDigests)); } return result; } private static int getChunkCount(int inputSize, int chunkSize) { return (inputSize + chunkSize - 1) / chunkSize; } private static void setUnsignedInt32LittleEngian(int value, byte[] result, int offset) { result[offset] = (byte) (value & 0xff); result[offset + 1] = (byte) ((value >> 8) & 0xff); result[offset + 2] = (byte) ((value >> 16) & 0xff); result[offset + 3] = (byte) ((value >> 24) & 0xff); } private static byte[] generateApkSigningBlock( List<SignerConfig> signerConfigs, Map<Integer, byte[]> contentDigests) throws InvalidKeyException, SignatureException { byte[] apkSignatureSchemeV2Block = generateApkSignatureSchemeV2Block(signerConfigs, contentDigests); return generateApkSigningBlock(apkSignatureSchemeV2Block); } private static byte[] generateApkSigningBlock(byte[] apkSignatureSchemeV2Block) { // FORMAT: // uint64: size (excluding this field) // repeated ID-value pairs: // uint64: size (excluding this field) // uint32: ID // (size - 4) bytes: value // uint64: size (same as the one above) // uint128: magic int resultSize = 8 // size + 8 + 4 + apkSignatureSchemeV2Block.length // v2Block as ID-value pair + 8 // size + 16 // magic ; ByteBuffer result = ByteBuffer.allocate(resultSize); result.order(ByteOrder.LITTLE_ENDIAN); long blockSizeFieldValue = resultSize - 8; result.putLong(blockSizeFieldValue); long pairSizeFieldValue = 4 + apkSignatureSchemeV2Block.length; result.putLong(pairSizeFieldValue); result.putInt(APK_SIGNATURE_SCHEME_V2_BLOCK_ID); result.put(apkSignatureSchemeV2Block); result.putLong(blockSizeFieldValue); result.put(APK_SIGNING_BLOCK_MAGIC); return result.array(); } private static byte[] generateApkSignatureSchemeV2Block( List<SignerConfig> signerConfigs, Map<Integer, byte[]> contentDigests) throws InvalidKeyException, SignatureException { // FORMAT: // * length-prefixed sequence of length-prefixed signer blocks. List<byte[]> signerBlocks = new ArrayList<>(signerConfigs.size()); int signerNumber = 0; for (SignerConfig signerConfig : signerConfigs) { signerNumber++; byte[] signerBlock; try { signerBlock = generateSignerBlock(signerConfig, contentDigests); } catch (InvalidKeyException e) { throw new InvalidKeyException("Signer #" + signerNumber + " failed", e); } catch (SignatureException e) { throw new SignatureException("Signer #" + signerNumber + " failed", e); } signerBlocks.add(signerBlock); } return encodeAsSequenceOfLengthPrefixedElements( new byte[][] { encodeAsSequenceOfLengthPrefixedElements(signerBlocks), }); } private static byte[] generateSignerBlock( SignerConfig signerConfig, Map<Integer, byte[]> contentDigests) throws InvalidKeyException, SignatureException { if (signerConfig.certificates.isEmpty()) { throw new SignatureException("No certificates configured for signer"); } PublicKey publicKey = signerConfig.certificates.get(0).getPublicKey(); byte[] encodedPublicKey = encodePublicKey(publicKey); V2SignatureSchemeBlock.SignedData signedData = new V2SignatureSchemeBlock.SignedData(); try { signedData.certificates = encodeCertificates(signerConfig.certificates); } catch (CertificateEncodingException e) { throw new SignatureException("Failed to encode certificates", e); } List<Pair<Integer, byte[]>> digests = new ArrayList<>(signerConfig.signatureAlgorithms.size()); for (int signatureAlgorithm : signerConfig.signatureAlgorithms) { int contentDigestAlgorithm = getSignatureAlgorithmContentDigestAlgorithm(signatureAlgorithm); byte[] contentDigest = contentDigests.get(contentDigestAlgorithm); if (contentDigest == null) { throw new RuntimeException( getContentDigestAlgorithmJcaDigestAlgorithm(contentDigestAlgorithm) + " content digest for " + getSignatureAlgorithmJcaSignatureAlgorithm(signatureAlgorithm) + " not computed"); } digests.add(Pair.create(signatureAlgorithm, contentDigest)); } signedData.digests = digests; V2SignatureSchemeBlock.Signer signer = new V2SignatureSchemeBlock.Signer(); // FORMAT: // * length-prefixed sequence of length-prefixed digests: // * uint32: signature algorithm ID // * length-prefixed bytes: digest of contents // * length-prefixed sequence of certificates: // * length-prefixed bytes: X.509 certificate (ASN.1 DER encoded). // * length-prefixed sequence of length-prefixed additional attributes: // * uint32: ID // * (length - 4) bytes: value signer.signedData = encodeAsSequenceOfLengthPrefixedElements(new byte[][] { encodeAsSequenceOfLengthPrefixedPairsOfIntAndLengthPrefixedBytes(signedData.digests), encodeAsSequenceOfLengthPrefixedElements(signedData.certificates), // additional attributes new byte[0], }); signer.publicKey = encodedPublicKey; signer.signatures = new ArrayList<>(); for (int signatureAlgorithm : signerConfig.signatureAlgorithms) { Pair<String, ? extends AlgorithmParameterSpec> signatureParams = getSignatureAlgorithmJcaSignatureAlgorithm(signatureAlgorithm); String jcaSignatureAlgorithm = signatureParams.getFirst(); AlgorithmParameterSpec jcaSignatureAlgorithmParams = signatureParams.getSecond(); byte[] signatureBytes; try { Signature signature = Signature.getInstance(jcaSignatureAlgorithm); signature.initSign(signerConfig.privateKey); if (jcaSignatureAlgorithmParams != null) { signature.setParameter(jcaSignatureAlgorithmParams); } signature.update(signer.signedData); signatureBytes = signature.sign(); } catch (InvalidKeyException e) { throw new InvalidKeyException("Failed sign using " + jcaSignatureAlgorithm, e); } catch (NoSuchAlgorithmException | InvalidAlgorithmParameterException | SignatureException e) { throw new SignatureException("Failed sign using " + jcaSignatureAlgorithm, e); } try { Signature signature = Signature.getInstance(jcaSignatureAlgorithm); signature.initVerify(publicKey); if (jcaSignatureAlgorithmParams != null) { signature.setParameter(jcaSignatureAlgorithmParams); } signature.update(signer.signedData); if (!signature.verify(signatureBytes)) { throw new SignatureException("Signature did not verify"); } } catch (InvalidKeyException e) { throw new InvalidKeyException("Failed to verify generated " + jcaSignatureAlgorithm + " signature using public key from certificate", e); } catch (NoSuchAlgorithmException | InvalidAlgorithmParameterException | SignatureException e) { throw new SignatureException("Failed to verify generated " + jcaSignatureAlgorithm + " signature using public key from certificate", e); } signer.signatures.add(Pair.create(signatureAlgorithm, signatureBytes)); } // FORMAT: // * length-prefixed signed data // * length-prefixed sequence of length-prefixed signatures: // * uint32: signature algorithm ID // * length-prefixed bytes: signature of signed data // * length-prefixed bytes: public key (X.509 SubjectPublicKeyInfo, ASN.1 DER encoded) return encodeAsSequenceOfLengthPrefixedElements( new byte[][] { signer.signedData, encodeAsSequenceOfLengthPrefixedPairsOfIntAndLengthPrefixedBytes( signer.signatures), signer.publicKey, }); } private static final class V2SignatureSchemeBlock { private static final class Signer { public byte[] signedData; public List<Pair<Integer, byte[]>> signatures; public byte[] publicKey; } private static final class SignedData { public List<Pair<Integer, byte[]>> digests; public List<byte[]> certificates; } } private static byte[] encodePublicKey(PublicKey publicKey) throws InvalidKeyException { byte[] encodedPublicKey = null; if ("X.509".equals(publicKey.getFormat())) { encodedPublicKey = publicKey.getEncoded(); } if (encodedPublicKey == null) { try { encodedPublicKey = KeyFactory.getInstance(publicKey.getAlgorithm()) .getKeySpec(publicKey, X509EncodedKeySpec.class) .getEncoded(); } catch (NoSuchAlgorithmException | InvalidKeySpecException e) { throw new InvalidKeyException( "Failed to obtain X.509 encoded form of public key " + publicKey + " of class " + publicKey.getClass().getName(), e); } } if ((encodedPublicKey == null) || (encodedPublicKey.length == 0)) { throw new InvalidKeyException( "Failed to obtain X.509 encoded form of public key " + publicKey + " of class " + publicKey.getClass().getName()); } return encodedPublicKey; } public static List<byte[]> encodeCertificates(List<X509Certificate> certificates) throws CertificateEncodingException { List<byte[]> result = new ArrayList<>(); for (X509Certificate certificate : certificates) { result.add(certificate.getEncoded()); } return result; } private static byte[] encodeAsSequenceOfLengthPrefixedElements(List<byte[]> sequence) { return encodeAsSequenceOfLengthPrefixedElements( sequence.toArray(new byte[sequence.size()][])); } private static byte[] encodeAsSequenceOfLengthPrefixedElements(byte[][] sequence) { int payloadSize = 0; for (byte[] element : sequence) { payloadSize += 4 + element.length; } ByteBuffer result = ByteBuffer.allocate(payloadSize); result.order(ByteOrder.LITTLE_ENDIAN); for (byte[] element : sequence) { result.putInt(element.length); result.put(element); } return result.array(); } private static byte[] encodeAsSequenceOfLengthPrefixedPairsOfIntAndLengthPrefixedBytes( List<Pair<Integer, byte[]>> sequence) { int resultSize = 0; for (Pair<Integer, byte[]> element : sequence) { resultSize += 12 + element.getSecond().length; } ByteBuffer result = ByteBuffer.allocate(resultSize); result.order(ByteOrder.LITTLE_ENDIAN); for (Pair<Integer, byte[]> element : sequence) { byte[] second = element.getSecond(); result.putInt(8 + second.length); result.putInt(element.getFirst()); result.putInt(second.length); result.put(second); } return result.array(); } /** * Relative <em>get</em> method for reading {@code size} number of bytes from the current * position of this buffer. * * <p>This method reads the next {@code size} bytes at this buffer's current position, * returning them as a {@code ByteBuffer} with start set to 0, limit and capacity set to * {@code size}, byte order set to this buffer's byte order; and then increments the position by * {@code size}. */ private static ByteBuffer getByteBuffer(ByteBuffer source, int size) { if (size < 0) { throw new IllegalArgumentException("size: " + size); } int originalLimit = source.limit(); int position = source.position(); int limit = position + size; if ((limit < position) || (limit > originalLimit)) { throw new BufferUnderflowException(); } source.limit(limit); try { ByteBuffer result = source.slice(); result.order(source.order()); source.position(limit); return result; } finally { source.limit(originalLimit); } } private static Pair<String, ? extends AlgorithmParameterSpec> getSignatureAlgorithmJcaSignatureAlgorithm(int sigAlgorithm) { switch (sigAlgorithm) { case SIGNATURE_RSA_PSS_WITH_SHA256: return Pair.create( "SHA256withRSA/PSS", new PSSParameterSpec( "SHA-256", "MGF1", MGF1ParameterSpec.SHA256, 256 / 8, 1)); case SIGNATURE_RSA_PSS_WITH_SHA512: return Pair.create( "SHA512withRSA/PSS", new PSSParameterSpec( "SHA-512", "MGF1", MGF1ParameterSpec.SHA512, 512 / 8, 1)); case SIGNATURE_RSA_PKCS1_V1_5_WITH_SHA256: return Pair.create("SHA256withRSA", null); case SIGNATURE_RSA_PKCS1_V1_5_WITH_SHA512: return Pair.create("SHA512withRSA", null); case SIGNATURE_ECDSA_WITH_SHA256: return Pair.create("SHA256withECDSA", null); case SIGNATURE_ECDSA_WITH_SHA512: return Pair.create("SHA512withECDSA", null); case SIGNATURE_DSA_WITH_SHA256: return Pair.create("SHA256withDSA", null); case SIGNATURE_DSA_WITH_SHA512: return Pair.create("SHA512withDSA", null); default: throw new IllegalArgumentException( "Unknown signature algorithm: 0x" + Long.toHexString(sigAlgorithm & 0xffffffff)); } } private static int getSignatureAlgorithmContentDigestAlgorithm(int sigAlgorithm) { switch (sigAlgorithm) { case SIGNATURE_RSA_PSS_WITH_SHA256: case SIGNATURE_RSA_PKCS1_V1_5_WITH_SHA256: case SIGNATURE_ECDSA_WITH_SHA256: case SIGNATURE_DSA_WITH_SHA256: return CONTENT_DIGEST_CHUNKED_SHA256; case SIGNATURE_RSA_PSS_WITH_SHA512: case SIGNATURE_RSA_PKCS1_V1_5_WITH_SHA512: case SIGNATURE_ECDSA_WITH_SHA512: case SIGNATURE_DSA_WITH_SHA512: return CONTENT_DIGEST_CHUNKED_SHA512; default: throw new IllegalArgumentException( "Unknown signature algorithm: 0x" + Long.toHexString(sigAlgorithm & 0xffffffff)); } } private static String getContentDigestAlgorithmJcaDigestAlgorithm(int digestAlgorithm) { switch (digestAlgorithm) { case CONTENT_DIGEST_CHUNKED_SHA256: return "SHA-256"; case CONTENT_DIGEST_CHUNKED_SHA512: return "SHA-512"; default: throw new IllegalArgumentException( "Unknown content digest algorthm: " + digestAlgorithm); } } private static int getContentDigestAlgorithmOutputSizeBytes(int digestAlgorithm) { switch (digestAlgorithm) { case CONTENT_DIGEST_CHUNKED_SHA256: return 256 / 8; case CONTENT_DIGEST_CHUNKED_SHA512: return 512 / 8; default: throw new IllegalArgumentException( "Unknown content digest algorthm: " + digestAlgorithm); } } /** * Indicates that APK file could not be parsed. */ public static class ApkParseException extends Exception { private static final long serialVersionUID = 1L; public ApkParseException(String message) { super(message); } public ApkParseException(String message, Throwable cause) { super(message, cause); } } /** * Pair of two elements. */ private static class Pair<A, B> { private final A mFirst; private final B mSecond; private Pair(A first, B second) { mFirst = first; mSecond = second; } public static <A, B> Pair<A, B> create(A first, B second) { return new Pair<>(first, second); } public A getFirst() { return mFirst; } public B getSecond() { return mSecond; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((mFirst == null) ? 0 : mFirst.hashCode()); result = prime * result + ((mSecond == null) ? 0 : mSecond.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } @SuppressWarnings("rawtypes") Pair other = (Pair) obj; if (mFirst == null) { if (other.mFirst != null) { return false; } } else if (!mFirst.equals(other.mFirst)) { return false; } if (mSecond == null) { return other.mSecond == null; } else return mSecond.equals(other.mSecond); } } }
44.909444
100
0.617543
0fc15adb73c73aca6c0b86e51d8aa0b3d7784839
912
package com.paulfang.java.multithread; /** * Example for 1.7.5 * * stop() 方法已经被废止,如果强制线程停止则可能使一些清理性工作得不到完成,另外就是对锁定的对象进行了解锁, * 导致数据得不到同步的处理,出现数据不一致的问题 */ public class ViolenceStopThreadTest { public static void main(String[] args) { try{ counterWorker counterThread = new counterWorker(); counterThread.start(); Thread.sleep(3000); counterThread.stop(); }catch(InterruptedException e){ System.out.println("Main Thread catched exception ..."); e.printStackTrace(); } } } class counterWorker extends Thread{ @Override public void run(){ System.out.println("counterWorker started ..."); for(int i=0;i<999; i++){ System.out.println("counterWorker : " + i); try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }
19.404255
60
0.633772
88468b0dbaef3deea7230cf09817aa9ffb69f3ba
2,463
package htsjdk.samtools.cram.build; import htsjdk.samtools.cram.common.Version; import htsjdk.samtools.cram.io.CountingInputStream; import htsjdk.samtools.cram.structure.Container; import htsjdk.samtools.cram.structure.ContainerIO; import htsjdk.samtools.cram.structure.CramHeader; import java.io.InputStream; import java.util.Iterator; /** * An iterator of CRAM containers read from an {@link java.io.InputStream}. */ public class CramContainerIterator implements Iterator<Container> { private CramHeader cramHeader; private CountingInputStream countingInputStream; private Container nextContainer; private boolean eof = false; private long offset = 0; public CramContainerIterator(final InputStream inputStream) { this.countingInputStream = new CountingInputStream(inputStream); cramHeader = CramIO.readCramHeader(countingInputStream); this.offset = countingInputStream.getCount(); } void readNextContainer() { nextContainer = containerFromStream(cramHeader.getVersion(), countingInputStream); final long containerSizeInBytes = countingInputStream.getCount() - offset; nextContainer.offset = offset; offset += containerSizeInBytes; if (nextContainer.isEOF()) { eof = true; nextContainer = null; } } /** * Consume the entirety of the next container from the stream. * @param cramVersion * @param countingStream * @return The next Container from the stream. */ protected Container containerFromStream(final Version cramVersion, final CountingInputStream countingStream) { return ContainerIO.readContainer(cramHeader.getVersion(), countingStream); } @Override public boolean hasNext() { if (eof) return false; if (nextContainer == null) readNextContainer(); return !eof; } @Override public Container next() { final Container result = nextContainer; nextContainer = null; return result; } @Override public void remove() { throw new RuntimeException("Read only iterator."); } public CramHeader getCramHeader() { return cramHeader; } public void close() { nextContainer = null; cramHeader = null; //noinspection EmptyCatchBlock try { countingInputStream.close(); } catch (final Exception e) { } } }
29.321429
114
0.680471
73a423f590947173477e78aaa7312561a17ef22f
1,113
package com.maxpowa.helper; import java.util.regex.Matcher; import java.util.regex.Pattern; import com.maxpowa.WikiUtil.ArticleParser; @Deprecated public class MCWikiParser extends ArticleParser { @Override public String parse(String title, String input) { int i = 0; while (i < input.length() / 6) { input = input.replaceFirst("'''", "\u00a7l"); input = input.replaceFirst("'''", "\u00a7r"); input = input.replaceFirst("''", "\u00a7o"); input = input.replaceFirst("''", "\u00a7r"); i++; } Matcher m = Pattern.compile("(\\{\\|(?:.|\\n)*?\\|\\})", Pattern.DOTALL | Pattern.MULTILINE).matcher(input); for (int t = 0; t < 10 && m.find(); t++) { new WikiTableParser(title + "#" + (t), m.group(1)).parse(); } input = m.replaceAll(""); input = input.replaceAll("\\{\\{cleanup\\}\\}\\n", "").replaceAll("\\{\\{[mM]inecraft\\}\\}\\n", "").replaceAll("\\[\\[(?=[^FILE])", "\u00a73").replaceAll("\\[\\[", "").replaceAll("\\]\\]", "\u00a7f"); return input; } }
33.727273
209
0.527403
f640d1e66077ed9a736c0cb98bc0325d935204fe
3,228
package controller; import forwarder.Salesperson; import controller.Parser; import controller.Cycle; import java.util.ArrayDeque; public class GrrProgrammer extends controller.Parser { private static final boolean synX82boolean = false; private static final int synX81int = 0; private static final boolean synX80boolean = true; private static final int synX79int = 1; private static final int synX78int = 2; private static final int synX77int = 0; private static final boolean synX76boolean = true; private static final int synX75int = 1; private static final int synX74int = 810323999; private static final double synX73double = 0.32002893226067064; private static final String synX72String = "NRR:"; private static final double synX71double = 0.33372967718458435; public controller.GrrProcedure grrProcedure; public int hoursRetaining; public java.util.ArrayDeque<GrrProcedure> wantGlue; static final String maximal = "hexs9D56CW5qW3Ngd"; public GrrProgrammer() { this.wantGlue = (new java.util.ArrayDeque<>()); hoursRetaining = (Parser.PeriodQualitative); } public synchronized String organizerList() { double higherRestricts; higherRestricts = (synX71double); return synX72String; } public synchronized void weapMark() { double ultimateAcross; ultimateAcross = (synX73double); if (grrProcedure != null) synx3(); if (this.variWaving && latestOperation == null) synx4(); else synx5(); } public synchronized void formalitiesImpending(Cycle proceedings) { int minuteBreadth; minuteBreadth = (synX74int); wantGlue.add(new controller.GrrProcedure(proceedings)); } private synchronized void synx3() { grrProcedure.fixGoingThing(grrProcedure.becomeContinualOpportunity() + synX75int); hoursRetaining--; if (grrProcedure.becomeContinualOpportunity() == grrProcedure.takeExecutionsDiameter()) { grrProcedure.settledReleasePeriods(this.fetchPresentRicky()); this.concludedPractices.addLast(grrProcedure); grrProcedure = (null); this.variWaving = (synX76boolean); } if (hoursRetaining == synX77int && grrProcedure != null) { if (wantGlue.isEmpty()) { hoursRetaining = (grrProcedure.receiveMomentAmounts()); } else { if (grrProcedure.receiveMomentAmounts() > synX78int) { grrProcedure.settledPeriodsGigantic(grrProcedure.receiveMomentAmounts() - synX79int); } wantGlue.addLast(grrProcedure); grrProcedure = (null); this.variWaving = (synX80boolean); } } } private synchronized void synx4() { this.lingeringInedThing--; if (lingeringInedThing == synX81int) { this.variWaving = (synX82boolean); this.lingeringInedThing = (Salesperson.MailAmount); } } private synchronized void synx5() { if (grrProcedure == null && !wantGlue.isEmpty()) { grrProcedure = (wantGlue.removeFirst()); lodePhase(grrProcedure); grrProcedure.prepareOffsetNow(this.fetchPresentRicky()); hoursRetaining = (grrProcedure.receiveMomentAmounts()); } } private synchronized void synx6(int i) { poisedBottleneck[i] = (new java.util.ArrayDeque<>()); } }
31.038462
95
0.714064
b7612889a931a8c546d54a03813f7bc3c3a31c60
1,247
package com.packtpub.springsecurity.repository; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest @DataJpaTest public class EventRepositoryTests { @Autowired private TestEntityManager entityManager; /* @Autowired private UserRepository repository; @Test public void findByUsernameShouldReturnUser() { this.entityManager.persist(new User("sboot", "123")); User user = this.repository.findByUsername("sboot"); assertThat(user.getUsername()).isEqualTo("sboot"); assertThat(user.getVin()).isEqualTo("123"); } */ @Autowired private EventRepository repository; @Test public void validateUser_Event() { int userId = 0; // List<Event> events = repository.findForUser(userId); // assertThat(events.get(0).getSummary()).isEqualTo("Birthday Party"); } }
29.690476
77
0.734563
adb3b897abd9d0b980403f19a4549cc0351222ce
731
package io.geovaneshimizu.starwiki.character.swapi; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import com.github.benmanes.caffeine.cache.Cache; import com.github.benmanes.caffeine.cache.Caffeine; import io.geovaneshimizu.starwiki.character.ResourceId; @Configuration class SwApiCacheConfiguration { @Bean Cache<ResourceId, Object> characterCache() { return Caffeine .newBuilder() .maximumSize(100L) .build(); } @Bean Cache<ResourceId, Object> filmCache() { return Caffeine .newBuilder() .maximumSize(10L) .build(); } }
24.366667
60
0.655267
d3e624b6a6083b2263000d6dd2f305b5393d7415
1,571
package com.gildedrose; /** * Common functions used by all items (inside the package com.gildedrose.items) */ public abstract class BaseItem { public Item item; public static final int MAX_QUAILITY_FOR_AN_ITEM = 50; public BaseItem() {} public BaseItem(Item item) { this.item=item; } /** * Check if item is expired * * @return true, false */ protected boolean itemHasExpired() { boolean condition; if (item.sellIn < 0) { condition = true; } else { condition = false; } return condition; } /** * Increase quality for each item * * @param factor, number to increase quality */ protected void increaseQualityBy(int factor) { item.quality += factor; qualityOfAnItemIsNotMoreThan(MAX_QUAILITY_FOR_AN_ITEM); } /** * Decrease quality for each item * * @param factor, number to decrease quality */ protected void decreaseQualityBy(int factor) { item.quality -= factor; qualityOfAnItemIsNeverNegative(); } /** * Quality can never be increased above a limit * * @param limit, max item quality */ private void qualityOfAnItemIsNotMoreThan(int limit) { if (item.quality > limit) { item.quality = limit; } } /** * Quality can never be negative */ private void qualityOfAnItemIsNeverNegative() { if (item.quality < 0) { item.quality = 0; } } }
21.819444
79
0.576703
351d25ba9eb9ff3640d07ff764bd84942e51cdfb
2,430
package stargatetech2.api.bus; import java.util.LinkedList; public abstract class BusPacket<R>{ private LinkedList<R> responses; private final short sender; private final short target; private final boolean hasLIP; /** * @param sender The address of the Device that is sending this packet. * @param target The address of the Device(s) that should receive this packet. * @param hasLIP Whether or not this packet supports being converted to a plain text (LIP) format. */ protected BusPacket(short sender, short target, boolean hasLIP){ this.responses = new LinkedList(); this.sender = sender; this.target = target; this.hasLIP = hasLIP; } /** * @return The address of the device that sent this packet. */ public final short getSender(){ return sender; } /** * @return The address of the device(s) that should receive this packet. */ public final short getTarget(){ return target; } /** * @return The ID of the protocol this packet corresponds to. */ public final int getProtocolID(){ return BusProtocols.getProtocolID(this.getClass()); } /** * @return A plain text (LIP) version of this packet, if it has one. */ public final BusPacketLIP getPlainText(){ if(this instanceof BusPacketLIP){ return (BusPacketLIP) this; }else if(hasLIP){ BusPacketLIP lip = new BusPacketLIP(sender, target); fillPlainText(lip); lip.finish(); return lip; } return null; } /** * Used by subclasses to convert themselves to plain text format. * * @param lip The Lazy Intercom Protocol (LIP) packet we're filling with our data. */ protected abstract void fillPlainText(BusPacketLIP lip); /** * @return Whether or not this packet supports conversion to the LIP format. */ public final boolean hasPlainText(){ return hasLIP; } /** * Adds a response to this packet that to give the sender some feedback. * The object type depends on the packet subclass. * * Note that clients converting the packet to LIP format * lose the ability to send feedback. * * @param response The response to add. */ public final void addResponse(R response){ if(response == null) throw new IllegalArgumentException("A Response cannot be null!"); responses.add(response); } /** * @return All the responses other clients added to this packet. */ public final LinkedList<R> getResponses(){ return new LinkedList<R>(responses); } }
25.851064
99
0.70535
2fbe98a56102d8f66a674b1b86c5ed738aa2ec28
8,705
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.beam.sdk.extensions.protobuf; import static org.apache.beam.sdk.extensions.protobuf.ProtoByteBuddyUtils.getProtoGetter; import static org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Preconditions.checkArgument; import com.google.protobuf.DynamicMessage; import com.google.protobuf.Message; import java.io.IOException; import java.lang.reflect.Method; import java.util.List; import java.util.Map; import org.apache.beam.sdk.annotations.Experimental; import org.apache.beam.sdk.annotations.Experimental.Kind; import org.apache.beam.sdk.extensions.protobuf.ProtoByteBuddyUtils.ProtoTypeConversionsFactory; import org.apache.beam.sdk.schemas.FieldValueGetter; import org.apache.beam.sdk.schemas.FieldValueTypeInformation; import org.apache.beam.sdk.schemas.GetterBasedSchemaProvider; import org.apache.beam.sdk.schemas.Schema; import org.apache.beam.sdk.schemas.Schema.Field; import org.apache.beam.sdk.schemas.SchemaUserTypeCreator; import org.apache.beam.sdk.schemas.logicaltypes.OneOfType; import org.apache.beam.sdk.schemas.utils.FieldValueTypeSupplier; import org.apache.beam.sdk.schemas.utils.JavaBeanUtils; import org.apache.beam.sdk.schemas.utils.ReflectUtils; import org.apache.beam.sdk.transforms.SerializableFunction; import org.apache.beam.sdk.transforms.SimpleFunction; import org.apache.beam.sdk.values.Row; import org.apache.beam.sdk.values.TypeDescriptor; import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Lists; import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Maps; import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Multimap; import org.checkerframework.checker.nullness.qual.Nullable; @Experimental(Kind.SCHEMAS) @SuppressWarnings({ "nullness", // TODO(https://issues.apache.org/jira/browse/BEAM-10402) "rawtypes" // TODO(https://issues.apache.org/jira/browse/BEAM-10556) }) public class ProtoMessageSchema extends GetterBasedSchemaProvider { private static final class ProtoClassFieldValueTypeSupplier implements FieldValueTypeSupplier { @Override public List<FieldValueTypeInformation> get(Class<?> clazz) { throw new RuntimeException("Unexpected call."); } @Override public List<FieldValueTypeInformation> get(Class<?> clazz, Schema schema) { Multimap<String, Method> methods = ReflectUtils.getMethodsMap(clazz); List<FieldValueTypeInformation> types = Lists.newArrayListWithCapacity(schema.getFieldCount()); for (Field field : schema.getFields()) { if (field.getType().isLogicalType(OneOfType.IDENTIFIER)) { // This is a OneOf. Look for the getters for each OneOf option. OneOfType oneOfType = field.getType().getLogicalType(OneOfType.class); Map<String, FieldValueTypeInformation> oneOfTypes = Maps.newHashMap(); for (Field oneOfField : oneOfType.getOneOfSchema().getFields()) { Method method = getProtoGetter(methods, oneOfField.getName(), oneOfField.getType()); oneOfTypes.put( oneOfField.getName(), FieldValueTypeInformation.forGetter(method).withName(field.getName())); } // Add an entry that encapsulates information about all possible getters. types.add( FieldValueTypeInformation.forOneOf( field.getName(), field.getType().getNullable(), oneOfTypes) .withName(field.getName())); } else { // This is a simple field. Add the getter. Method method = getProtoGetter(methods, field.getName(), field.getType()); types.add(FieldValueTypeInformation.forGetter(method).withName(field.getName())); } } return types; } } @Override public <T> @Nullable Schema schemaFor(TypeDescriptor<T> typeDescriptor) { checkForDynamicType(typeDescriptor); return ProtoSchemaTranslator.getSchema((Class<Message>) typeDescriptor.getRawType()); } @Override public List<FieldValueGetter> fieldValueGetters(Class<?> targetClass, Schema schema) { return ProtoByteBuddyUtils.getGetters( targetClass, schema, new ProtoClassFieldValueTypeSupplier(), new ProtoTypeConversionsFactory()); } @Override public List<FieldValueTypeInformation> fieldValueTypeInformations( Class<?> targetClass, Schema schema) { return JavaBeanUtils.getFieldTypes(targetClass, schema, new ProtoClassFieldValueTypeSupplier()); } @Override public SchemaUserTypeCreator schemaTypeCreator(Class<?> targetClass, Schema schema) { SchemaUserTypeCreator creator = ProtoByteBuddyUtils.getBuilderCreator( targetClass, schema, new ProtoClassFieldValueTypeSupplier()); if (creator == null) { throw new RuntimeException("Cannot create creator for " + targetClass); } return creator; } // Other modules are not allowed to use non-vendored Message class @SuppressWarnings({ "rawtypes", // TODO(https://issues.apache.org/jira/browse/BEAM-10556) "unchecked" }) public static <T> SimpleFunction<byte[], Row> getProtoBytesToRowFn(Class<T> clazz) { checkForMessageType(clazz); return new ProtoBytesToRowFn(clazz); } private static class ProtoBytesToRowFn<T extends Message> extends SimpleFunction<byte[], Row> { private final ProtoCoder<T> protoCoder; private final SerializableFunction<T, Row> toRowFunction; public ProtoBytesToRowFn(Class<T> clazz) { this.protoCoder = ProtoCoder.of(clazz); this.toRowFunction = new ProtoMessageSchema().toRowFunction(TypeDescriptor.of(clazz)); } @Override public Row apply(byte[] bytes) { try { T message = protoCoder.getParser().parseFrom(bytes); return toRowFunction.apply(message); } catch (IOException e) { throw new IllegalArgumentException("Could not decode row from proto payload.", e); } } } // Other modules are not allowed to use non-vendored Message class @SuppressWarnings({ "rawtypes", // TODO(https://issues.apache.org/jira/browse/BEAM-10556) "unchecked" }) public static <T> SimpleFunction<Row, byte[]> getRowToProtoBytesFn(Class<T> clazz) { checkForMessageType(clazz); return new RowToProtoBytesFn(clazz); } private static class RowToProtoBytesFn<T extends Message> extends SimpleFunction<Row, byte[]> { private final SerializableFunction<Row, T> toMessageFunction; private final Schema protoSchema; public RowToProtoBytesFn(Class<T> clazz) { ProtoMessageSchema messageSchema = new ProtoMessageSchema(); TypeDescriptor<T> typeDescriptor = TypeDescriptor.of(clazz); this.toMessageFunction = messageSchema.fromRowFunction(typeDescriptor); this.protoSchema = messageSchema.schemaFor(typeDescriptor); } @Override public byte[] apply(Row row) { if (!protoSchema.equivalent(row.getSchema())) { row = switchFieldsOrder(row); } Message message = toMessageFunction.apply(row); return message.toByteArray(); } private Row switchFieldsOrder(Row row) { Row.Builder convertedRow = Row.withSchema(protoSchema); protoSchema .getFields() .forEach(field -> convertedRow.addValue(row.getValue(field.getName()))); return convertedRow.build(); } } private <T> void checkForDynamicType(TypeDescriptor<T> typeDescriptor) { if (typeDescriptor.getRawType().equals(DynamicMessage.class)) { throw new RuntimeException( "DynamicMessage is not allowed for the standard ProtoSchemaProvider, use ProtoDynamicMessageSchema instead."); } } private static <T> void checkForMessageType(Class<T> clazz) { checkArgument( Message.class.isAssignableFrom(clazz), "%s is not a subtype of %s", clazz.getName(), Message.class.getSimpleName()); } }
41.255924
121
0.728891
5101c3cbe3a642b882d66aff88ef46088ad15382
161
package ru.job4j.inheritance; public class Predator extends Animal { public Predator() { super(); System.out.println("Predators"); } }
16.1
40
0.627329
3633250a701d9dae8391c77f1cad42e77427116f
3,886
package view.event; import javafx.collections.FXCollections; import javafx.fxml.FXML; import javafx.event.ActionEvent; import javafx.fxml.Initializable; import javafx.scene.control.*; import javafx.stage.Stage; import org.controlsfx.dialog.ExceptionDialog; import schedule.Schedule; import util.AlarmQueue; import util.FileManager; import util.HomeworkSyncManager; import view.stageBuilder.ScheduleEditorStageBuilder; import java.io.IOException; import java.net.URL; import java.text.SimpleDateFormat; import java.util.*; /** * Created by Donghwan on 2015-12-03. * * 하루 일정 창에 달린 이벤트 리스너 */ public class DayScheduleListController extends AbstactNotificationController implements Initializable{ @FXML private Label dateLabel; @FXML private TableView<Schedule> scheduleTableView; @SuppressWarnings("unused") @FXML private TableColumn timeColumn; @FXML private Button addButton; @FXML private Button editButton; @FXML private Button deleteButton; private Date currentDate; // 현재 리스트를 일정에 저장함 // 지금은 창 종료 이벤트가 호출함 @SuppressWarnings("unchecked") public boolean saveList(){ try { Calendar calendar = new GregorianCalendar(); calendar.setTime(currentDate); return FileManager.writeScheduleFile(scheduleTableView.getItems(), calendar); }catch(IOException ioe){ ExceptionDialog exceptionDialog = new ExceptionDialog(ioe); exceptionDialog.show(); return false; } } public void loadScheduleList(Date currentDate) throws ClassNotFoundException { SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd"); this.currentDate = currentDate; dateLabel.setText(dateFormat.format(this.currentDate)); Calendar dateToLoad = new GregorianCalendar(); dateToLoad.setTime(this.currentDate); try { for (Schedule schedule : FileManager.readScheduleFile(dateToLoad)){ scheduleTableView.getItems().add(schedule); } }catch(IOException ioe){ ExceptionDialog exceptionDialog = new ExceptionDialog(ioe); exceptionDialog.show(); } } @FXML protected void handleAddButtonAction(@SuppressWarnings("UnusedParameters") ActionEvent event) throws Exception{ addButton.setDisable(true); Stage stage = ScheduleEditorStageBuilder.getInstance().newAddingScheduleEditor(currentDate, scheduleTableView.getItems()); stage.show(); addButton.setDisable(false); } @FXML protected void handleEditButtonAction(@SuppressWarnings("UnusedParameters") ActionEvent event) throws Exception{ editButton.setDisable(true); Schedule focusedItem; if((focusedItem = scheduleTableView.getFocusModel().getFocusedItem()) != null){ Stage stage = ScheduleEditorStageBuilder.getInstance().newEditingScheduleEditor(focusedItem); stage.show(); } editButton.setDisable(false); } @FXML protected void handleDeleteButtonAction(@SuppressWarnings("UnusedParameters") ActionEvent event){ deleteButton.setDisable(true); Schedule focusedItem; if((focusedItem = scheduleTableView.getFocusModel().getFocusedItem()) != null){ scheduleTableView.getItems().remove(focusedItem); AlarmQueue.alarmQueue.remove(focusedItem); } deleteButton.setDisable(false); } @Override @SuppressWarnings("unchecked") public void initialize(URL location, ResourceBundle resources) { // GUI 창을 띄우기 직전에 해야할 작업(일종의 GUI 창 생성자) scheduleTableView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); scheduleTableView.setItems(FXCollections.observableArrayList(HomeworkSyncManager.homeworkSyncManager.getHomeworkList())); } }
32.932203
130
0.702007
82137516f64c8cf28662f070361b3aa08ded55c6
3,810
package org.indiarose.lib.model.xml; /* * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/. */ import org.indiarose.lib.PathData; import org.indiarose.lib.model.Indiagram; import org.indiarose.lib.model.xml.transformer.CategoryPathTransformer; import org.indiarose.lib.model.xml.transformer.IndiagramPathTransformer; import storm.xmlbinder.XmlElement; import storm.xmlbinder.binder.ContentBinder; import storm.xmlbinder.binder.ObjectBinder; import storm.xmlbinder.transformer.StringTransformer; /** * This class convert org.indiarose.lib.model.Indiagram to Xml and vice-versa * * @author Julien Mialon <mialon.julien@gmail.com> */ final class IndiagramXmlConverter extends AbstractXmlConverter<Indiagram> { /** * The unique instance of the IndiagramXmlConverter */ protected static IndiagramXmlConverter s_instance = null; /** * Constructor of the class, initialize xml rules. */ protected IndiagramXmlConverter() { StringTransformer stringTransformer = new StringTransformer(); XmlElement indiagram = new XmlElement("indiagram", new ObjectBinder("", "org.indiarose.lib.model.Indiagram")); XmlElement text = new XmlElement("text", new ContentBinder("text", stringTransformer)); XmlElement image = new XmlElement("picture", new ContentBinder("imagePath", stringTransformer)); XmlElement sound = new XmlElement("sound", new ContentBinder("soundPath", stringTransformer)); indiagram.addChild(text); indiagram.addChild(image); indiagram.addChild(sound); this.m_rootElement = indiagram; } /** * Retrieve the unique instance of the class. * @return the instance of the IndiagramXmlConverter class. */ public static IndiagramXmlConverter getInstance() { if(IndiagramXmlConverter.s_instance == null) { synchronized (IndiagramXmlConverter.class) { if(IndiagramXmlConverter.s_instance == null) { IndiagramXmlConverter.s_instance = new IndiagramXmlConverter(); } } } return IndiagramXmlConverter.s_instance; } /* * (non-Javadoc) * @see org.indiarose.lib.model.xml.AbstractXmlConverter#read(java.lang.String) */ @Override public Indiagram read(String _filename) throws Exception { CategoryPathTransformer.basePath = PathData.XML_DIRECTORY; IndiagramPathTransformer.basePath = PathData.XML_DIRECTORY; Indiagram result = super.read(_filename); result.filePath = _filename; return result; } /* * (non-Javadoc) * @see org.indiarose.lib.model.xml.AbstractXmlConverter#write(java.lang.Object, java.lang.String) */ @Override public void write(Indiagram _data, String _filename) throws Exception { _data.filePath = _filename; super.write(_data, _filename); } /** * Write a category to xml file _prefix + _filename * @param _data : the object to write into xml file. * @param _filename : the name of the file. * @param _prefix : the prefix where to write files. * @throws Exception */ public void write(Indiagram _data, String _filename, String _prefix) throws Exception { CategoryPathTransformer.basePath = _prefix; IndiagramPathTransformer.basePath = _prefix; _data.filePath = _filename; super.write(_data, _prefix + _filename); } /** * Read a category from the xml file _prefix + _filename * @param _filename : the filename * @param _prefix : the path prefix * @return Category object * @throws Exception */ public Indiagram read(String _filename, String _prefix) throws Exception { CategoryPathTransformer.basePath = _prefix; IndiagramPathTransformer.basePath = _prefix; Indiagram result = super.read(_prefix + _filename); result.filePath = _filename; return result; } }
30.238095
116
0.750394
9e1912bda521a9e8a68d1cfbc83b9d10e62fa3de
669
package com.mrpc.core.serializer; import com.mrpc.core.message.IMessage; import java.io.IOException; /** * 序列化器 * * @author mark.z */ public interface ISerializer { /** * 反序列化 * * @param bytes 序列化数据 * @param messageClass 序列化对象类型 * @return 序列化对象 * @throws IOException 异常 * @throws ClassNotFoundException 异常 */ <T extends IMessage> T encoder(byte[] bytes, Class<T> messageClass) throws IOException, ClassNotFoundException; /** * 序列化ß * * @param message 序列化对象 * @return 序列化数据 * @throws IOException 异常 */ byte[] decoder(IMessage message) throws IOException; }
19.676471
115
0.61435
92ba52c16341e62ca2b66d65c7007e330754a54b
606
/* * Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. */ package de.hybris.platform.integrationbackoffice.widgets.providers; import de.hybris.platform.catalog.model.classification.ClassAttributeAssignmentModel; /** * Provides full qualifier for classification attribute. */ public interface ClassificationAttributeQualifierProvider { /** * Provides full qualifier for given attribute assignment * * @param assignment * @return string which represents full qualifier for given attribute assignment */ String provide(ClassAttributeAssignmentModel assignment); }
27.545455
85
0.792079
2c841eb37b368ba704b0616d6e106a63196d4a66
1,664
package pattern.other.strategyAndTemplate; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import java.util.Objects; /** * 活动抽象类,抽取公共方法, * 把订单是否符合奖励的判断之后发送奖励的公共逻辑在此处实现, * 订单具体条件的判断延迟由子类去实现. * 策略和模板模式组合使用 * * @author Sam * @date 2020/11/26 * @since 1.7.3 */ @Slf4j @Component public abstract class AbstractActiveHandleStrategy implements IActiveHandleStrategy { /** * 其他抽象方法 */ public abstract void otherMethod(); public final void otherMethod1() { System.out.println("其他公用方法"); } @Override public final boolean isTypeMatch(String categoryDetail) { return Objects.equals(categoryDetail, this.getCategoryDetail()); } /** * 外部真正要调用的方法 * * @param temporaryOrderDto 订单 */ public final boolean handle(ActiveOrderDto temporaryOrderDto, ActiveDto activeDto) { // 调用接口中需要子类实现的方法 boolean result = checkOrder(temporaryOrderDto, activeDto); if (!result) { log.error("订单 {} 不符合活动 {} 的奖励发放条件", temporaryOrderDto.getOrderNo(), activeDto.getId()); return false; } return sendReward(temporaryOrderDto, temporaryOrderDto.getMemberId(), activeDto); } /** * 统一的发送奖励的方法 * * @param temporaryOrderDto 订单 * @param memberId 用户ID * @param activeDto 活动 */ protected final boolean sendReward(ActiveOrderDto temporaryOrderDto, Long memberId, ActiveDto activeDto) { AbstractRewardSendStrategy impl = RewardSendStrategyFactory.getImpl(activeDto.getRewardType()); impl.sendReward(memberId); return true; } }
25.212121
110
0.667067
24903f22bb0685362198a190b51293dcaa2bcf1a
875
package br.edu.ifsc.mello.dummyuafclient.fidouaflib; public enum TCDEnum { TRANSACTION_CONFIRMATION_DISPLAY_ANY((short) 0x01), TRANSACTION_CONFIRMATION_DISPLAY_PRIVILEGED_SOFTWARE((short) 0x02), TRANSACTION_CONFIRMATION_DISPLAY_TEE((short) 0x04), TRANSACTION_CONFIRMATION_DISPLAY_HARDWARE((short) 0x08), TRANSACTION_CONFIRMATION_DISPLAY_REMOTE((short) 0x10); private final short VALUE; TCDEnum(short value) { this.VALUE = value; } public static TCDEnum getByValue(final short value) { for (final TCDEnum tcdEnum : values()) { if (tcdEnum.getValue() == value) { return tcdEnum; } } throw new IllegalArgumentException("Invalid TRANSACTION_CONFIRMATION_DISPLAY value: " + Short.toString(value)); } public short getValue() { return VALUE; } }
27.34375
119
0.68
d3c0d66746f69369accd1f7981182adf2a97276f
781
package cn.glogs.activeauth.iamcore.domain; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import javax.persistence.*; @Data @Entity @NoArgsConstructor @AllArgsConstructor public class AuthorizationPolicyGrantRow { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @ManyToOne(cascade = CascadeType.REMOVE) private AuthenticationPrincipal granter; @ManyToOne(cascade = CascadeType.REMOVE) private AuthenticationPrincipal grantee; @ManyToOne(cascade = CascadeType.REMOVE) private AuthorizationPolicy policy; private AuthorizationPolicy.PolicyEffect policyEffect; private String policyAction; private String policyResource; private boolean revoked = false; }
22.314286
58
0.77977
96b8aa3e5801e47454730d73aa74ae24b3d3f74c
1,678
package msifeed.mc.more.commands; import msifeed.mc.commons.logs.ExternalLogs; import msifeed.mc.extensions.chat.SpeechatRpc; import msifeed.mc.extensions.chat.formatter.MiscFormatter; import msifeed.mc.more.More; import msifeed.mc.more.crabs.rolls.Dices; import msifeed.mc.sys.cmd.PlayerExtCommand; import msifeed.mc.sys.utils.ChatUtils; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.IChatComponent; import net.minecraft.util.MathHelper; public class RollCommand extends PlayerExtCommand { @Override public String getCommandName() { return "roll"; } @Override public String getCommandUsage(ICommandSender sender) { return "/roll coin | <sides>"; } @Override public void processCommand(ICommandSender sender, String[] args) { if (args.length == 0 || !(sender instanceof EntityPlayerMP)) return; final int sides; if (args[0].equals("coin")) { sides = 2; } else { try { sides = MathHelper.clamp_int(Integer.parseInt(args[0]), 2, 1000); } catch (NumberFormatException e) { return; } } final int range = More.DEFINES.get().chat.rollRadius; final EntityPlayerMP player = (EntityPlayerMP) sender; final String name = ChatUtils.getPrettyName(player); final int roll = Dices.dice(sides); final IChatComponent cc = MiscFormatter.formatRoll(name, sides, roll); SpeechatRpc.sendRaw(player, range, cc); ExternalLogs.log(player, "dice", cc.getUnformattedText()); } }
31.660377
81
0.668057
d0e830dc2d2402e72449b7c11f2a67657e386e63
1,537
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jadice.jpeg2000.internal.marker; import javax.imageio.stream.ImageInputStream; import javax.imageio.stream.ImageOutputStream; import org.jadice.jpeg2000.JPEG2000Exception; import org.jadice.jpeg2000.internal.codestream.Codestream; import java.io.IOException; public interface MarkerSegment { Marker getMarker(); MarkerKey getMarkerKey(); void read(ImageInputStream source, Codestream codestream, boolean validate) throws IOException, JPEG2000Exception; void read(ImageInputStream source, boolean validate) throws IOException, JPEG2000Exception; void write(ImageOutputStream sink, Codestream codestream, boolean validate) throws IOException, JPEG2000Exception; }
38.425
117
0.76838
a5d1dc5bb1bec7729dfede9cdfd686a0394d6787
686
package io.github.fatihbozik.ch3.searchandsorting; import java.util.Set; import java.util.TreeSet; class Duck { private String name; public Duck(String name) { this.name = name; } } class UseTreeSet { static class Rabbit { int id; public int getId() { return id; } } public static void main(String[] args) { Set<Duck> ducks = new TreeSet<>(); ducks.add(new Duck("Puddles")); Set<Rabbit> rabbit = new TreeSet<>(); rabbit.add(new Rabbit()); // throws an exception Set<Rabbit> rabbit2 = new TreeSet<>((r1, r2) -> r1.id - r2.id); rabbit2.add(new Rabbit()); } }
19.6
71
0.568513
b1b4c5cbe8aaf94429f5ff2d75856b1ac37dbbe2
6,172
package utils; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import objects.JSONParsingObject; import objects.Jury; import objects.TFE; public class SolverReport { private int time; private int nbrSessions; private int nbrJury; private int nbrTFE; private int nbrTFEAssigned; private int nbrTFEImpossible; private List<String> impossibleTFE; private Map<Jury, List<Integer>> juryParallel; private Map<Integer,List<TFE>> map; private JSONParsingObject jsonParsingObject; public SolverReport(JSONParsingObject jsonParsingObject) { this.jsonParsingObject = jsonParsingObject; this.map = getSessionMap(); } public void write(String path) throws IOException{ File file = new File(path); if (!file.exists()) { file.createNewFile(); } FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); writeStats(bw); writeConflicts(bw); writeAssigned(bw); writeNotDisponible(bw); writeParallel(bw); bw.close(); } private void writeStats(BufferedWriter bw) throws IOException{ bw.write("Statistics :\n"); bw.write("\t- Solution found in : "+time+"min\n"); bw.write("\t- Sessions allocated : "+map.size()+"\n"); bw.write("\t- Jury : "+nbrJury+"\n"); bw.write("\t- TFE : "+nbrTFE+"\n"); bw.write("\t- TFE impossible : "+nbrTFEImpossible+"\n"); bw.write("\t- TFE assigned : "+nbrTFEAssigned+"\n"); bw.write("\t ratio : "+(((float)nbrTFEAssigned)/nbrTFE)*100+"%\n"); } private void writeNotDisponible(BufferedWriter bw) throws IOException{ bw.write("Not disponible :\n"); boolean isNotDisponible = false; for(Entry<Integer, List<TFE>> entry : map.entrySet()) { if(entry.getKey() != -1){ for(TFE t : entry.getValue()){ for(Jury j : t.getJuryList()){ if(!j.getDisponibilities().get(entry.getKey()%12)){ isNotDisponible = true; bw.write("\t-"+j.getEmail()+" for "+t.getCode()+" session "+entry.getKey()+"\n"); } } } } } if(!isNotDisponible) bw.write("\t Everyone can attend\n"); } private void writeParallel(BufferedWriter bw) throws IOException{ bw.write("Parallel sessions :\n"); boolean isParallel = false; for(Entry<Jury, List<Integer>> entry : getJuryMap().entrySet()){ List<Integer> impactedSessions = getParallelSessions(entry.getValue()); if(!impactedSessions.isEmpty()){ isParallel = true; bw.write("\t-"+entry.getKey().getEmail()+" for "+impactedSessions.toString()+"\n"); } } if(!isParallel) bw.write("\t No parallel sessions\n"); } private List<Integer> getParallelSessions(List<Integer> sessions){ List<Integer> impactedSessions = new ArrayList<Integer>(); for(int i = 0 ; i < sessions.size() ; i++){ for(int j = 0 ; j < sessions.size() ; j++){ if(i!=j && (sessions.get(i)%12 == sessions.get(j)%12)){ impactedSessions.add(sessions.get(i)); } } } return impactedSessions; } private void writeConflicts(BufferedWriter bw) throws IOException{ bw.write("Conflicts :\n"); boolean isConflicts = false; for (Entry<Integer, List<TFE>> entry : map.entrySet()) { List<TFE> value = entry.getValue(); if(value.size() > 3 && entry.getKey() != -1){ isConflicts = true; bw.write("\t- Session "+entry.getKey()+" :\n"); for(TFE t : value) bw.write("\t\t - "+t.getCode()+"\n"); } } if(!isConflicts) bw.write("\t No conflicts\n"); } private void writeAssigned(BufferedWriter bw) throws IOException{ bw.write("Not assigned :\n"); boolean notAssigned = false; for (Entry<Integer, List<TFE>> entry : map.entrySet()) { List<TFE> value = entry.getValue(); if(entry.getKey() == -1){ notAssigned = true; for(TFE t : value){ if(impossibleTFE.contains(t.getCode())) bw.write("\t - "+t.getCode()+" (impossible)\n"); else bw.write("\t - "+t.getCode()+"\n"); } } } if(!notAssigned) bw.write("\t Every TFE is assigned\n"); } private Map<Integer,List<TFE>> getSessionMap(){ Map<Integer,List<TFE>> map = new HashMap<Integer,List<TFE>>(); for(TFE tfe : jsonParsingObject.getTfes()){ if(map.containsKey(tfe.getFixedSession())){ map.get(tfe.getFixedSession()).add(tfe); } else{ List<TFE> newList = new ArrayList<TFE>(); newList.add(tfe); map.put(tfe.getFixedSession(), newList); } } return map; } private Map<Jury, List<Integer>> getJuryMap(){ Map<Jury, List<Integer>> map = new HashMap<Jury, List<Integer>>(); for(TFE tfe : jsonParsingObject.getTfes()){ for(Jury j : tfe.getJuryList()){ if(map.containsKey(j)){ if(!map.get(j).contains(tfe.getFixedSession())) map.get(j).add(tfe.getFixedSession()); } else{ List<Integer> newList = new ArrayList<Integer>(); newList.add(tfe.getFixedSession()); map.put(j, newList); } } } return map; } public int getTime() { return time; } public void setTime(int time) { this.time = time; } public int getNbrSessions() { return nbrSessions; } public void setNbrSessions(int nbrSessions) { this.nbrSessions = nbrSessions; } public int getNbrJury() { return nbrJury; } public void setNbrJury(int nbrJury) { this.nbrJury = nbrJury; } public int getNbrTFE() { return nbrTFE; } public void setNbrTFE(int nbrTFE) { this.nbrTFE = nbrTFE; } public int getNbrTFEAssigned() { return nbrTFEAssigned; } public void setNbrTFEAssigned(int nbrTFEAssigned) { this.nbrTFEAssigned = nbrTFEAssigned; } public int getNbrTFEImpossible() { return nbrTFEImpossible; } public void setNbrTFEImpossible(int nbrTFEImpossible) { this.nbrTFEImpossible = nbrTFEImpossible; } public List<String> getImpossibleTFE() { return impossibleTFE; } public void setImpossibleTFE(List<String> impossibleTFE) { this.impossibleTFE = impossibleTFE; } public Map<Jury, List<Integer>> getJuryParallel() { return juryParallel; } public void setJuryParallel(Map<Jury, List<Integer>> juryParallel) { this.juryParallel = juryParallel; } }
27.801802
88
0.670933
e20be70f0d8bde8bf22c21c5e957c12fb1e7f362
313
package com.trainingserver.soap.operations; public class GetFilmsActors extends OperationsTemplate { public GetFilmsActors() { this.setLink("getFilmsActors"); this.setup(); } public void setFilmId(String filmId) { setRequestNodeValueByXPath("/Envelope/Body/getFilmsActorsRequest/film_id", filmId); } }
26.083333
85
0.782748
01a2a6c43e90c456018f69b6adda123ee59ba730
3,622
/******************************************************************************* * Copyright (c) 2001, 2015 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this * distribution and is available at https://www.eclipse.org/legal/epl-2.0/ * or the Apache License, Version 2.0 which accompanies this distribution and * is available at https://www.apache.org/licenses/LICENSE-2.0. * * This Source Code may also be made available under the following * Secondary Licenses when the conditions for such availability set * forth in the Eclipse Public License, v. 2.0 are satisfied: GNU * General Public License, version 2 with the GNU Classpath * Exception [1] and GNU General Public License, version 2 with the * OpenJDK Assembly Exception [2]. * * [1] https://www.gnu.org/software/classpath/license.html * [2] http://openjdk.java.net/legal/assembly-exception.html * * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception *******************************************************************************/ package com.ibm.j9ddr.vm29.pointer.helper; import java.lang.ref.WeakReference; import java.util.Iterator; import java.util.Map; import java.util.TreeMap; import com.ibm.j9ddr.CorruptDataException; import com.ibm.j9ddr.corereaders.osthread.IOSThread; import com.ibm.j9ddr.vm29.j9.DataType; import com.ibm.j9ddr.vm29.pointer.VoidPointer; import com.ibm.j9ddr.vm29.pointer.generated.J9ThreadPointer; import com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer; import com.ibm.j9ddr.vm29.pointer.generated.OMR_VMThreadPointer; import com.ibm.j9ddr.vm29.types.UDATA; public class J9ThreadHelper { private static WeakReference<Map<Long, IOSThread>> cachedThreads = null; public static VoidPointer getTLS(J9ThreadPointer threadPointer, UDATA key) throws CorruptDataException { return VoidPointer.cast(threadPointer.tlsEA().at(key.sub(1))); } public static J9VMThreadPointer getVMThread(J9ThreadPointer threadPointer) throws CorruptDataException { J9VMThreadPointer vmThread = null; OMR_VMThreadPointer omrVmThread = OMR_VMThreadPointer.cast(getTLS(threadPointer, J9RASHelper.getVM(DataType.getJ9RASPointer()).omrVM()._vmThreadKey())); if (omrVmThread.isNull()) { vmThread = J9VMThreadPointer.NULL; } else { vmThread = J9VMThreadPointer.cast(omrVmThread._language_vmthread()); } return vmThread; } public static IOSThread getOSThread(J9ThreadPointer threadPointer) throws CorruptDataException { return getOSThread(threadPointer.tid().longValue()); } public static IOSThread getOSThread(long tid) throws CorruptDataException { Map<Long, IOSThread> threadMap = getThreadMap(); return threadMap.get(tid); } public static Iterator<IOSThread> getOSThreads() throws CorruptDataException { Map<Long, IOSThread> threadMap = getThreadMap(); return threadMap.values().iterator(); } private static Map<Long, IOSThread> getThreadMap() throws CorruptDataException { Map<Long, IOSThread> thrMap = null; if (cachedThreads != null) { thrMap = cachedThreads.get(); } if (thrMap != null) { return thrMap; } /* * There was no cache of threads, populate a new one while we find the * thread the caller wanted. */ thrMap = new TreeMap<Long, IOSThread>(); for (IOSThread thread : DataType.getProcess().getThreads()) { thrMap.put(thread.getThreadId(), thread); } cachedThreads = new WeakReference<Map<Long, IOSThread>>(thrMap); return thrMap; } }
38.126316
154
0.728879
bc818b3a05621e2328c84b5de71ccb7e055093b0
1,467
import com.ll.entity.User; import com.ll.mapper.UserMapper; import com.ll.utils.MybatisUtils; import org.apache.ibatis.session.SqlSession; import org.junit.Test; /** * @ClassName: DemoTest * @Description: TODO 类描述 * @Author: LQH * @Date: 2020/07/11 * @Version: 1.0 **/ public class DemoTest { @Test public void queryUser() { SqlSession sqlSession = MybatisUtils.getSqlSession(); UserMapper mapper = sqlSession.getMapper(UserMapper.class); User user = mapper.queryUser(1); System.out.println(user); // mapper.updateUser(new User(2, "ddddddd", "ssssss")); // 手动清理缓存 sqlSession.clearCache(); System.out.println("====================================="); User user2 = mapper.queryUser(1); System.out.println(user2); System.out.println(user == user2); sqlSession.close(); } @Test public void queryUser2() { SqlSession sqlSession1 = MybatisUtils.getSqlSession(); SqlSession sqlSession2 = MybatisUtils.getSqlSession(); UserMapper mapper1 = sqlSession1.getMapper(UserMapper.class); UserMapper mapper2 = sqlSession2.getMapper(UserMapper.class); User user1 = mapper1.queryUser(1); System.out.println(user1); sqlSession1.close(); User user2 = mapper2.queryUser(1); System.out.println(user2); System.out.println(user1 == user2); sqlSession2.close(); } }
26.196429
69
0.623722
be8cd1d46cb4c0193f452d308df88d344a3d0869
11,907
package vn.edu.vtc.pl; import vn.edu.vtc.bl.OrderBL; import vn.edu.vtc.bl.ProductBL; import vn.edu.vtc.persistance.Account; import vn.edu.vtc.persistance.Order; import vn.edu.vtc.persistance.Product; import java.sql.SQLException; import java.text.NumberFormat; import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.Scanner; public class OrderService { public static void createOrder(Account account) { ProductBL productBL=new ProductBL(); OrderBL orderBL=new OrderBL(); Order order=new Order(); System.out.println("| Create Order |"); System.out.println("| ------ Add product ------ |"); System.out.println("| |"); do { //input productID int productId=-1; do try { System.out.print(" 1. Input product ID: "); productId = new Scanner(System.in).nextInt(); if (productBL.getById(productId)!=null){ break; }else { System.out.println("This product id doesn't exist!"); } } catch (Exception e) { System.out.println("Wrong!"); }while (true); int quantity=0; boolean check=false; for (Product p:order.getProductList()) { if (p.getProductId()==productId){ //input product quantity do try { System.out.print(" 2. Input quantity: "); quantity = new Scanner(System.in).nextInt(); if (p.getLeftQuantity()==0){ System.out.println("No product to select!"); } if (quantity<0){ System.out.println("New quantity must greater than 0"); } if (quantity>p.getLeftQuantity()){ System.out.println("Wrong!"); } if (quantity>0&&quantity<p.getLeftQuantity()){ p.setAmount(p.getAmount()+quantity); break; } } catch (Exception e) { System.err.println("Wrong!"); }while (true); check=true; } } if (!check){ Product product=productBL.getById(productId); do try { System.out.print(" 2. Input quantity: "); quantity = new Scanner(System.in).nextInt(); if (quantity<0){ System.out.println("New quantity must greater than 0"); } if (quantity>product.getLeftQuantity()){ System.out.println("Wrong!"); } if (quantity!=0&&(product.getLeftQuantity()>quantity)) { product.setAmount(quantity); break; } } catch (Exception e) { System.err.println("Wrong!"); }while (true); order.addProduct(product); } System.out.println("Continue add product?(Y/N): "); String continued = new Scanner(System.in).nextLine(); if (continued.equalsIgnoreCase("N")){ System.out.println("Checkout(Y/N): "); String checkout = new Scanner(System.in).nextLine(); if (checkout.equalsIgnoreCase("Y")) { order.setStaff_id(account.getStaff_id()); order.setStore_id(1); order=orderBL.createOrder(order); printOrder(order); return; }else { return; } } }while (true); } public static boolean refund() throws SQLException { //input order-id //set value at refund_order column at 0 (0:true ; 1: false) System.out.println("|--------------------------------|"); System.out.println("| Update order |"); System.out.println("| Input order ID |"); int orderId=-1; do try { orderId= new Scanner(System.in).nextInt(); break; } catch (Exception e) { System.out.println("Wrong!"); }while (true); OrderBL orderBL=new OrderBL(); if (orderId!=-1){ return orderBL.refundOrder(orderId); } return false; } public static Order refundProduct(){ //case1: decrease amount of product in order //case2: refund product (refund_quantity==product.amount) /* * step 1: input order_id * step 2: show detail * step 3: input product was refunded * step 4: input new quantity * step 5: if: * +quantity<product.amount = > decrease * +quantity=product.amount = > refund product { - set value of "refunded" column at 0 (0:true 1:false) * - increase quantity product on db} * +quantity>product.amount => false * */ OrderBL orderBL=new OrderBL(); Order newOrder = new Order(); boolean check=false; System.out.println("Input order Id: "); int orderId; do try { orderId=new Scanner(System.in).nextInt(); if (orderId >0){ break; } if (orderId!=0){ System.out.println("Something wrong, try again!"); } }catch (Exception e){ System.out.println("Something wrong, try again!"); }while (true); Order order = orderBL.getbyId(orderId); //show detail if (order==null) { System.out.println("Couldn't found this order!"); return null; } printOrder(order); //input refund product in order List<Product> refundProducts=new ArrayList<>(); do { System.out.println("Input product id to refund : "); int productId; do try { productId=new Scanner(System.in).nextInt(); if (productId >0){ break; } if (productId!=0){ System.out.println("Something wrong, try again!"); } }catch (Exception e){ System.out.println("Something wrong, try again!"); }while (true); for (Product product:order.getProductList()) { if (product.getProductId()==productId){ check=true; do try { System.out.println("Input new quantity : "); int newQuantity=new Scanner(System.in).nextInt(); if (newQuantity==0){ product.setAmount(newQuantity); product.setRefundedInOrder(0); refundProducts.add(product); break; } if (newQuantity<product.getAmount()&&newQuantity!=0){ product.setAmount(product.getAmount()-newQuantity); refundProducts.add(product); break; } System.out.println("Something wrong ,Try again"); }catch (Exception e){ System.out.println("Something wrong, try again!"); }while (true); } } if (!check){ System.out.println("couldn't found this id in order!"); System.out.println("Try again?(Y/N)"); String continues=new Scanner(System.in).nextLine(); if (continues.equalsIgnoreCase("exit")){ return null; } if (continues.equalsIgnoreCase("N")){ return null; } } if (check){ System.out.println("Refund more?(Y/N)"); String continues=new Scanner(System.in).nextLine(); if (continues.equalsIgnoreCase("N")){ System.out.println("Press any key to finish...."); String finish=new Scanner(System.in).nextLine(); break; } } }while (true); //send to BL if (check) { order = orderBL.refundProduct(refundProducts, order.getId()); } return order; } public static void printOrder(Order order){ // NumberFormat nf = NumberFormat.getInstance(new Locale("vi", "VN")); System.out.println("\n"); System.out.println("|-----------------------------------------------------------------------------------------------|"); System.out.print("| "+order.getStore_name()); System.out.print(" Address: " +order.getAddress()); System.out.println(" |"); System.out.println("|-----------------------------------------------------------------------------------------------|"); System.out.println("| -------ORDER------- |"); System.out.print("| Date: " +order.getDate()); System.out.print(" ID: " +order.getId()); System.out.println(" |"); System.out.println("|-----------------------------------------------------------------------------------------------|"); System.out.println( "| ID | Name | Price | Discount | Amount | Total | "); System.out.println("|-----------------------------------------------------------------------------------------------|"); for (Product product : order.getProductList()) { System.out.format( "|%5d |%11s |%12.2f |%11.2f |%7d |%13.2f |\n",product.getProductId(), product.getName(),product.getPrice(), product.getDiscounted(), product.getAmount(), product.Total()); // System.out.println("\n"); } System.out.println("|-----------------------------------------------------------------------------------------------|"); System.out.print("| TỔNG TIỀN PHẢI THANH TOÁN: "+totalOrder(order)); System.out.print(" |"); System.out.println("|-----------------------------------------------------------------------------------------------|"); System.out.println("| Cảm ơn quý khách và hẹn gặp lại! |"); System.out.println("| Hotline:1800 1000 Website: vtc.edu.vn |"); System.out.println("|-----------------------------------------------------------------------------------------------|"); } public static Double totalOrder(Order order) { Double totalOrder = 0.; for (Product product : order.getProductList()) { totalOrder += product.Total(); } return totalOrder; } }
43.775735
220
0.420845
5bab2f17e7f5c5af217ead026fe2ca30115d2dd0
7,925
package seedu.address.logic.parser.expenseparsers; import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT; import static seedu.address.commons.core.Messages.MESSAGE_REPEATED_PREFIX_COMMAND; import static seedu.address.logic.commands.CommandTestUtil.AMOUNT_DESC_EXPENSE; import static seedu.address.logic.commands.CommandTestUtil.CATEGORY_DESC_EXPENSE; import static seedu.address.logic.commands.CommandTestUtil.DATE_DESC_EXPENSE; import static seedu.address.logic.commands.CommandTestUtil.INVALID_AMOUNT_DESC; import static seedu.address.logic.commands.CommandTestUtil.INVALID_CATEGORY_DESC; import static seedu.address.logic.commands.CommandTestUtil.INVALID_DATE_DESC_FORMAT; import static seedu.address.logic.commands.CommandTestUtil.INVALID_NAME_DESC; import static seedu.address.logic.commands.CommandTestUtil.NAME_DESC_EXPENSE; import static seedu.address.logic.commands.CommandTestUtil.REMARKS_DESC_EXPENSE; import static seedu.address.logic.commands.CommandTestUtil.VALID_AMOUNT_EXPENSE; import static seedu.address.logic.commands.CommandTestUtil.VALID_CATEGORY_EXPENSE; import static seedu.address.logic.commands.CommandTestUtil.VALID_DATE_EXPENSE; import static seedu.address.logic.commands.CommandTestUtil.VALID_NAME_EXPENSE; import static seedu.address.logic.commands.CommandTestUtil.VALID_REMARKS_EXPENSE; import static seedu.address.logic.parser.CommandParserTestUtil.assertParseFailure; import static seedu.address.logic.parser.CommandParserTestUtil.assertParseSuccess; import static seedu.address.testutil.TypicalIndexes.INDEX_FIRST_EXPENSE; import static seedu.address.testutil.TypicalIndexes.INDEX_SECOND_EXPENSE; import static seedu.address.testutil.TypicalIndexes.INDEX_THIRD_EXPENSE; import org.junit.Test; import seedu.address.commons.core.index.Index; import seedu.address.logic.commands.expensecommands.EditExpenseCommand; import seedu.address.model.attributes.Amount; import seedu.address.model.attributes.Category; import seedu.address.model.attributes.Date; import seedu.address.model.attributes.Name; import seedu.address.testutil.EditExpenseDescriptorBuilder; public class EditExpenseCommandParserTest { private static final String MESSAGE_INVALID_FORMAT = String.format(MESSAGE_INVALID_COMMAND_FORMAT, EditExpenseCommand.MESSAGE_USAGE); private EditExpenseCommandParser parser = new EditExpenseCommandParser(); @Test public void parse_missingParts_failure() { // no index specified assertParseFailure(parser, VALID_NAME_EXPENSE, MESSAGE_INVALID_FORMAT); // no field specified assertParseFailure(parser, "1", EditExpenseCommand.MESSAGE_NOT_EDITED); // no index and no field specified assertParseFailure(parser, "", MESSAGE_INVALID_FORMAT); } @Test public void parse_invalidPreamble_failure() { // negative index assertParseFailure(parser, "-5" + NAME_DESC_EXPENSE, MESSAGE_INVALID_FORMAT); // zero index assertParseFailure(parser, "0" + NAME_DESC_EXPENSE, MESSAGE_INVALID_FORMAT); // invalid arguments being parsed as preamble assertParseFailure(parser, "1 some random string", MESSAGE_INVALID_FORMAT); // invalid prefix being parsed as preamble assertParseFailure(parser, "1 i/ string", MESSAGE_INVALID_FORMAT); } @Test public void parse_invalidValue_failure() { assertParseFailure(parser, "1" + INVALID_NAME_DESC, Name.MESSAGE_CONSTRAINTS); // invalid name assertParseFailure(parser, "1" + INVALID_AMOUNT_DESC, Amount.MESSAGE_CONSTRAINTS); // invalid phone assertParseFailure(parser, "1" + INVALID_CATEGORY_DESC, Category.MESSAGE_CONSTRAINTS); // invalid category assertParseFailure(parser, "1" + INVALID_DATE_DESC_FORMAT, Date.MESSAGE_CONSTRAINTS); // invalid date //Deadline not required for editexpense command //assertParseFailure(parser, "1" + INVALID_DEADLINE_DESC, Date.MESSAGE_CONSTRAINTS); // invalid tag // multiple invalid values, but only the first invalid value is captured assertParseFailure(parser, "1" + INVALID_NAME_DESC + INVALID_CATEGORY_DESC + VALID_DATE_EXPENSE + VALID_AMOUNT_EXPENSE, Name.MESSAGE_CONSTRAINTS); } @Test public void parse_necessaryFieldsSpecified_success() { Index targetIndex = INDEX_SECOND_EXPENSE; String userInput = targetIndex.getOneBased() + AMOUNT_DESC_EXPENSE + CATEGORY_DESC_EXPENSE + DATE_DESC_EXPENSE + NAME_DESC_EXPENSE + REMARKS_DESC_EXPENSE; EditExpenseCommand.EditExpenseDescriptor descriptor = new EditExpenseDescriptorBuilder().withName( VALID_NAME_EXPENSE).withAmount(VALID_AMOUNT_EXPENSE).withCategory(VALID_CATEGORY_EXPENSE).withDate( VALID_DATE_EXPENSE).withRemarks(VALID_REMARKS_EXPENSE).build(); EditExpenseCommand expectedCommand = new EditExpenseCommand(targetIndex, descriptor); assertParseSuccess(parser, userInput, expectedCommand); } @Test public void parse_someFieldsSpecified_success() { Index targetIndex = INDEX_FIRST_EXPENSE; String userInput = targetIndex.getOneBased() + AMOUNT_DESC_EXPENSE + CATEGORY_DESC_EXPENSE; EditExpenseCommand.EditExpenseDescriptor descriptor = new EditExpenseDescriptorBuilder() .withAmount(VALID_AMOUNT_EXPENSE).withCategory(VALID_CATEGORY_EXPENSE).build(); EditExpenseCommand expectedCommand = new EditExpenseCommand(targetIndex, descriptor); assertParseSuccess(parser, userInput, expectedCommand); } @Test public void parse_oneFieldSpecified_success() { // name Index targetIndex = INDEX_THIRD_EXPENSE; String userInput = targetIndex.getOneBased() + NAME_DESC_EXPENSE; EditExpenseCommand.EditExpenseDescriptor descriptor = new EditExpenseDescriptorBuilder() .withName(VALID_NAME_EXPENSE).build(); EditExpenseCommand expectedCommand = new EditExpenseCommand(targetIndex, descriptor); assertParseSuccess(parser, userInput, expectedCommand); // phone userInput = targetIndex.getOneBased() + AMOUNT_DESC_EXPENSE; descriptor = new EditExpenseDescriptorBuilder().withAmount(VALID_AMOUNT_EXPENSE).build(); expectedCommand = new EditExpenseCommand(targetIndex, descriptor); assertParseSuccess(parser, userInput, expectedCommand); // email userInput = targetIndex.getOneBased() + CATEGORY_DESC_EXPENSE; descriptor = new EditExpenseDescriptorBuilder().withCategory(VALID_CATEGORY_EXPENSE).build(); expectedCommand = new EditExpenseCommand(targetIndex, descriptor); assertParseSuccess(parser, userInput, expectedCommand); // address userInput = targetIndex.getOneBased() + DATE_DESC_EXPENSE; descriptor = new EditExpenseDescriptorBuilder().withDate(VALID_DATE_EXPENSE).build(); expectedCommand = new EditExpenseCommand(targetIndex, descriptor); assertParseSuccess(parser, userInput, expectedCommand); // tags userInput = targetIndex.getOneBased() + REMARKS_DESC_EXPENSE; descriptor = new EditExpenseDescriptorBuilder().withRemarks(VALID_REMARKS_EXPENSE).build(); expectedCommand = new EditExpenseCommand(targetIndex, descriptor); assertParseSuccess(parser, userInput, expectedCommand); } @Test public void parse_multipleRepeatedFields_failure() { Index targetIndex = INDEX_FIRST_EXPENSE; String userInput = targetIndex.getOneBased() + AMOUNT_DESC_EXPENSE + DATE_DESC_EXPENSE + CATEGORY_DESC_EXPENSE + REMARKS_DESC_EXPENSE + AMOUNT_DESC_EXPENSE + DATE_DESC_EXPENSE + CATEGORY_DESC_EXPENSE + REMARKS_DESC_EXPENSE; assertParseFailure(parser, userInput, MESSAGE_REPEATED_PREFIX_COMMAND); } }
50.477707
118
0.766309
d971ee3c0a574830bc7e10d429b3f508e2e2debe
685
package ru.job4j.set; /** * @author vsokolov * @version $Id$ * @since 0.1 */ public class HashTableSet<E> { private MyHashTable<E> data; public HashTableSet(MyHashTable data) { this.data = data; } /** * Method adds an entry to the beginning of list. * @param e */ public void add(E e) { data.add(e); } /** * Method checks whether the list contains a given element. * @param e */ public boolean contains(E e) { return data.contains(e); } /** * Method deletes a given element from the table. * @param e */ public void remove(E e) { data.remove(e); } }
17.125
63
0.544526
9974b9c74d592ea8769a9a7ecd2e82c534b0d4ec
4,186
package uk.gov.hmcts.reform.finrem.caseorchestration.controllers; import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.Before; import org.junit.Test; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.MediaType; import uk.gov.hmcts.reform.ccd.client.model.CallbackRequest; import uk.gov.hmcts.reform.finrem.caseorchestration.service.ConsentOrderService; import uk.gov.hmcts.reform.finrem.caseorchestration.service.IdamService; import java.io.File; import java.io.IOException; import java.net.URISyntaxException; import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static uk.gov.hmcts.reform.finrem.caseorchestration.OrchestrationConstants.AUTHORIZATION_HEADER; import static uk.gov.hmcts.reform.finrem.caseorchestration.TestConstants.AUTH_TOKEN; @WebMvcTest(ConsentOrderController.class) public class ConsentOrderControllerTest extends BaseControllerTest { private static final String UPDATE_LATEST_CONSENT_ORDER_JSON = "/case-orchestration/update-latest-consent-order"; private static final String AMEND_CONSENT_ORDER_BY_SOL_JSON = "/fixtures/latestConsentedConsentOrder/amend-consent-order-by-solicitor.json"; @MockBean private ConsentOrderService consentOrderService; @MockBean private IdamService idamService; @Before public void setUp() { super.setUp(); try { doRequestSetUp(); } catch (Exception e) { fail(e.getMessage()); } } @Test public void shouldUpdateCaseDataWithLatestConsentOrder() throws Exception { when(consentOrderService.getLatestConsentOrderData(any(CallbackRequest.class))).thenReturn(getCaseDocument()); when(idamService.isUserRoleAdmin(any())).thenReturn(true); mvc.perform(post(UPDATE_LATEST_CONSENT_ORDER_JSON) .content(requestContent.toString()) .header(AUTHORIZATION_HEADER, AUTH_TOKEN) .contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(status().isOk()) .andDo(print()) .andExpect(jsonPath("$.data.latestConsentOrder").exists()) .andExpect(jsonPath("$.data.applicantRepresented").doesNotExist()) .andExpect(jsonPath("$.warnings").doesNotExist()); } @Test public void shouldUpdateCaseDataWithApplicantRepresented() throws Exception { when(consentOrderService.getLatestConsentOrderData(any(CallbackRequest.class))).thenReturn(getCaseDocument()); when(idamService.isUserRoleAdmin(any())).thenReturn(false); mvc.perform(post(UPDATE_LATEST_CONSENT_ORDER_JSON) .content(requestContent.toString()) .header(AUTHORIZATION_HEADER, AUTH_TOKEN) .contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(status().isOk()) .andDo(print()) .andExpect(jsonPath("$.data.latestConsentOrder").exists()) .andExpect(jsonPath("$.data.applicantRepresented").value("Yes")) .andExpect(jsonPath("$.warnings").doesNotExist()); } @Test public void shouldThrowHttpError400() throws Exception { mvc.perform(post(UPDATE_LATEST_CONSENT_ORDER_JSON) .content("kwuilebge") .header(AUTHORIZATION_HEADER, AUTH_TOKEN) .contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(status().isBadRequest()); } private void doRequestSetUp() throws IOException, URISyntaxException { ObjectMapper objectMapper = new ObjectMapper(); requestContent = objectMapper.readTree(new File(getClass() .getResource(AMEND_CONSENT_ORDER_BY_SOL_JSON).toURI())); } }
44.531915
118
0.737936
3e68e3227fecf323b74af246a4b0d14700b07700
3,358
/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.wso2.andes.client; import org.wso2.andes.AMQException; import org.wso2.andes.client.state.AMQState; import org.wso2.andes.framing.ProtocolVersion; import org.wso2.andes.jms.ConnectionURL; import org.wso2.andes.jms.BrokerDetails; import org.wso2.andes.url.URLSyntaxException; import java.io.IOException; public class MockAMQConnection extends AMQConnection { public MockAMQConnection(String broker, String username, String password, String clientName, String virtualHost) throws AMQException, URLSyntaxException { super(broker, username, password, clientName, virtualHost); } public MockAMQConnection(String broker, String username, String password, String clientName, String virtualHost, SSLConfiguration sslConfig) throws AMQException, URLSyntaxException { super(broker, username, password, clientName, virtualHost, sslConfig); } public MockAMQConnection(String host, int port, String username, String password, String clientName, String virtualHost) throws AMQException, URLSyntaxException { super(host, port, username, password, clientName, virtualHost); } public MockAMQConnection(String host, int port, String username, String password, String clientName, String virtualHost, SSLConfiguration sslConfig) throws AMQException, URLSyntaxException { super(host, port, username, password, clientName, virtualHost, sslConfig); } public MockAMQConnection(String host, int port, boolean useSSL, String username, String password, String clientName, String virtualHost, SSLConfiguration sslConfig) throws AMQException, URLSyntaxException { super(host, port, useSSL, username, password, clientName, virtualHost, sslConfig); } public MockAMQConnection(String connection) throws AMQException, URLSyntaxException { super(connection); } public MockAMQConnection(String connection, SSLConfiguration sslConfig) throws AMQException, URLSyntaxException { super(connection, sslConfig); } public MockAMQConnection(ConnectionURL connectionURL, SSLConfiguration sslConfig) throws AMQException { super(connectionURL, sslConfig); } @Override public ProtocolVersion makeBrokerConnection(BrokerDetails brokerDetail) throws IOException { _connected = true; _protocolHandler.getStateManager().changeState(AMQState.CONNECTION_OPEN); return null; } }
37.311111
168
0.736152
a7bedc48620906e096dff8e3accf0d43fc835b0d
968
/* * Copyright 2017 The Depan Project Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.devtools.depan.view_doc.layout.model; import com.google.devtools.depan.view_doc.layout.LayoutContext; import com.google.devtools.depan.view_doc.layout.LayoutRunner; /** * @author <a href="leeca@pnambic.com">Lee Carver</a> */ public interface LayoutPlan { String buildSummary(); LayoutRunner buildLayout(LayoutContext context); }
31.225806
75
0.754132
634a8024fade20cfb916912b3fb0ae8af63d9f10
410
package com.ramon.pereira.hermes; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import java.util.TimeZone; @SpringBootApplication public class HermesApplication { public static void main(String[] args) { TimeZone.setDefault(TimeZone.getTimeZone("America/Sao_Paulo")); SpringApplication.run(HermesApplication.class, args); } }
25.625
68
0.817073
a7eb438489f9ce6018c1345f22efb8d214f94a65
45,941
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.lucene.codecs.lucene90.blocktree; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Objects; import org.apache.lucene.codecs.BlockTermState; import org.apache.lucene.codecs.CodecUtil; import org.apache.lucene.codecs.FieldsConsumer; import org.apache.lucene.codecs.NormsProducer; import org.apache.lucene.codecs.PostingsWriterBase; import org.apache.lucene.index.FieldInfo; import org.apache.lucene.index.FieldInfos; import org.apache.lucene.index.Fields; import org.apache.lucene.index.IndexFileNames; import org.apache.lucene.index.IndexOptions; import org.apache.lucene.index.SegmentWriteState; import org.apache.lucene.index.Terms; import org.apache.lucene.index.TermsEnum; import org.apache.lucene.store.ByteArrayDataOutput; import org.apache.lucene.store.ByteBuffersDataOutput; import org.apache.lucene.store.DataOutput; import org.apache.lucene.store.IndexOutput; import org.apache.lucene.util.ArrayUtil; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRefBuilder; import org.apache.lucene.util.FixedBitSet; import org.apache.lucene.util.IOUtils; import org.apache.lucene.util.IntsRefBuilder; import org.apache.lucene.util.StringHelper; import org.apache.lucene.util.compress.LZ4; import org.apache.lucene.util.compress.LowercaseAsciiCompression; import org.apache.lucene.util.fst.ByteSequenceOutputs; import org.apache.lucene.util.fst.BytesRefFSTEnum; import org.apache.lucene.util.fst.FST; import org.apache.lucene.util.fst.FSTCompiler; import org.apache.lucene.util.fst.Util; /* TODO: - Currently there is a one-to-one mapping of indexed term to term block, but we could decouple the two, ie, put more terms into the index than there are blocks. The index would take up more RAM but then it'd be able to avoid seeking more often and could make PK/FuzzyQ faster if the additional indexed terms could store the offset into the terms block. - The blocks are not written in true depth-first order, meaning if you just next() the file pointer will sometimes jump backwards. For example, block foo* will be written before block f* because it finished before. This could possibly hurt performance if the terms dict is not hot, since OSs anticipate sequential file access. We could fix the writer to re-order the blocks as a 2nd pass. - Each block encodes the term suffixes packed sequentially using a separate vInt per term, which is 1) wasteful and 2) slow (must linear scan to find a particular suffix). We should instead 1) make random-access array so we can directly access the Nth suffix, and 2) bulk-encode this array using bulk int[] codecs; then at search time we can binary search when we seek a particular term. */ /** * Block-based terms index and dictionary writer. * * <p>Writes terms dict and index, block-encoding (column stride) each term's metadata for each set * of terms between two index terms. * * <p>Files: * * <ul> * <li><code>.tim</code>: <a href="#Termdictionary">Term Dictionary</a> * <li><code>.tmd</code>: <a href="#Termmetadata">Term Metadata</a> * <li><code>.tip</code>: <a href="#Termindex">Term Index</a> * </ul> * * <p><a id="Termdictionary"></a> * * <h2>Term Dictionary</h2> * * <p>The .tim file contains the list of terms in each field along with per-term statistics (such as * docfreq) and per-term metadata (typically pointers to the postings list for that term in the * inverted index). * * <p>The .tim is arranged in blocks: with blocks containing a variable number of entries (by * default 25-48), where each entry is either a term or a reference to a sub-block. * * <p>NOTE: The term dictionary can plug into different postings implementations: the postings * writer/reader are actually responsible for encoding and decoding the Postings Metadata and Term * Metadata sections. * * <ul> * <li>TermsDict (.tim) --&gt; Header, FieldDict<sup>NumFields</sup>, Footer * <li>FieldDict --&gt; <i>PostingsHeader</i>, NodeBlock<sup>NumBlocks</sup> * <li>NodeBlock --&gt; (OuterNode | InnerNode) * <li>OuterNode --&gt; EntryCount, SuffixLength, Byte<sup>SuffixLength</sup>, StatsLength, &lt; * TermStats &gt;<sup>EntryCount</sup>, MetaLength, * &lt;<i>TermMetadata</i>&gt;<sup>EntryCount</sup> * <li>InnerNode --&gt; EntryCount, SuffixLength[,Sub?], Byte<sup>SuffixLength</sup>, StatsLength, * &lt; TermStats ? &gt;<sup>EntryCount</sup>, MetaLength, &lt;<i>TermMetadata ? * </i>&gt;<sup>EntryCount</sup> * <li>TermStats --&gt; DocFreq, TotalTermFreq * <li>Header --&gt; {@link CodecUtil#writeHeader CodecHeader} * <li>EntryCount,SuffixLength,StatsLength,DocFreq,MetaLength --&gt; {@link DataOutput#writeVInt * VInt} * <li>TotalTermFreq --&gt; {@link DataOutput#writeVLong VLong} * <li>Footer --&gt; {@link CodecUtil#writeFooter CodecFooter} * </ul> * * <p>Notes: * * <ul> * <li>Header is a {@link CodecUtil#writeHeader CodecHeader} storing the version information for * the BlockTree implementation. * <li>DocFreq is the count of documents which contain the term. * <li>TotalTermFreq is the total number of occurrences of the term. This is encoded as the * difference between the total number of occurrences and the DocFreq. * <li>PostingsHeader and TermMetadata are plugged into by the specific postings implementation: * these contain arbitrary per-file data (such as parameters or versioning information) and * per-term data (such as pointers to inverted files). * <li>For inner nodes of the tree, every entry will steal one bit to mark whether it points to * child nodes(sub-block). If so, the corresponding TermStats and TermMetaData are omitted. * </ul> * * <p><a id="Termmetadata"></a> * * <h2>Term Metadata</h2> * * <p>The .tmd file contains the list of term metadata (such as FST index metadata) and field level * statistics (such as sum of total term freq). * * <ul> * <li>TermsMeta (.tmd) --&gt; Header, NumFields, &lt;FieldStats&gt;<sup>NumFields</sup>, * TermIndexLength, TermDictLength, Footer * <li>FieldStats --&gt; FieldNumber, NumTerms, RootCodeLength, Byte<sup>RootCodeLength</sup>, * SumTotalTermFreq?, SumDocFreq, DocCount, MinTerm, MaxTerm, IndexStartFP, FSTHeader, * <i>FSTMetadata</i> * <li>Header,FSTHeader --&gt; {@link CodecUtil#writeHeader CodecHeader} * <li>TermIndexLength, TermDictLength --&gt; {@link DataOutput#writeLong Uint64} * <li>MinTerm,MaxTerm --&gt; {@link DataOutput#writeVInt VInt} length followed by the byte[] * <li>NumFields,FieldNumber,RootCodeLength,DocCount --&gt; {@link DataOutput#writeVInt VInt} * <li>NumTerms,SumTotalTermFreq,SumDocFreq,IndexStartFP --&gt; {@link DataOutput#writeVLong * VLong} * <li>Footer --&gt; {@link CodecUtil#writeFooter CodecFooter} * </ul> * * <p>Notes: * * <ul> * <li>FieldNumber is the fields number from {@link FieldInfos}. (.fnm) * <li>NumTerms is the number of unique terms for the field. * <li>RootCode points to the root block for the field. * <li>SumDocFreq is the total number of postings, the number of term-document pairs across the * entire field. * <li>DocCount is the number of documents that have at least one posting for this field. * <li>MinTerm, MaxTerm are the lowest and highest term in this field. * </ul> * * <a id="Termindex"></a> * * <h2>Term Index</h2> * * <p>The .tip file contains an index into the term dictionary, so that it can be accessed randomly. * The index is also used to determine when a given term cannot exist on disk (in the .tim file), * saving a disk seek. * * <ul> * <li>TermsIndex (.tip) --&gt; Header, FSTIndex<sup>NumFields</sup>Footer * <li>Header --&gt; {@link CodecUtil#writeHeader CodecHeader} * <!-- TODO: better describe FST output here --> * <li>FSTIndex --&gt; {@link FST FST&lt;byte[]&gt;} * <li>Footer --&gt; {@link CodecUtil#writeFooter CodecFooter} * </ul> * * <p>Notes: * * <ul> * <li>The .tip file contains a separate FST for each field. The FST maps a term prefix to the * on-disk block that holds all terms starting with that prefix. Each field's IndexStartFP * points to its FST. * <li>It's possible that an on-disk block would contain too many terms (more than the allowed * maximum (default: 48)). When this happens, the block is sub-divided into new blocks (called * "floor blocks"), and then the output in the FST for the block's prefix encodes the leading * byte of each sub-block, and its file pointer. * </ul> * * @see Lucene90BlockTreeTermsReader * @lucene.experimental */ public final class Lucene90BlockTreeTermsWriter extends FieldsConsumer { /** * Suggested default value for the {@code minItemsInBlock} parameter to {@link * #Lucene90BlockTreeTermsWriter(SegmentWriteState,PostingsWriterBase,int,int)}. */ public static final int DEFAULT_MIN_BLOCK_SIZE = 25; /** * Suggested default value for the {@code maxItemsInBlock} parameter to {@link * #Lucene90BlockTreeTermsWriter(SegmentWriteState,PostingsWriterBase,int,int)}. */ public static final int DEFAULT_MAX_BLOCK_SIZE = 48; // public static boolean DEBUG = false; // public static boolean DEBUG2 = false; // private final static boolean SAVE_DOT_FILES = false; private final IndexOutput metaOut; private final IndexOutput termsOut; private final IndexOutput indexOut; final int maxDoc; final int minItemsInBlock; final int maxItemsInBlock; final PostingsWriterBase postingsWriter; final FieldInfos fieldInfos; private final List<ByteBuffersDataOutput> fields = new ArrayList<>(); /** * Create a new writer. The number of items (terms or sub-blocks) per block will aim to be between * minItemsPerBlock and maxItemsPerBlock, though in some cases the blocks may be smaller than the * min. */ public Lucene90BlockTreeTermsWriter( SegmentWriteState state, PostingsWriterBase postingsWriter, int minItemsInBlock, int maxItemsInBlock) throws IOException { validateSettings(minItemsInBlock, maxItemsInBlock); this.minItemsInBlock = minItemsInBlock; this.maxItemsInBlock = maxItemsInBlock; this.maxDoc = state.segmentInfo.maxDoc(); this.fieldInfos = state.fieldInfos; this.postingsWriter = postingsWriter; final String termsName = IndexFileNames.segmentFileName( state.segmentInfo.name, state.segmentSuffix, Lucene90BlockTreeTermsReader.TERMS_EXTENSION); termsOut = state.directory.createOutput(termsName, state.context); boolean success = false; IndexOutput metaOut = null, indexOut = null; try { CodecUtil.writeIndexHeader( termsOut, Lucene90BlockTreeTermsReader.TERMS_CODEC_NAME, Lucene90BlockTreeTermsReader.VERSION_CURRENT, state.segmentInfo.getId(), state.segmentSuffix); final String indexName = IndexFileNames.segmentFileName( state.segmentInfo.name, state.segmentSuffix, Lucene90BlockTreeTermsReader.TERMS_INDEX_EXTENSION); indexOut = state.directory.createOutput(indexName, state.context); CodecUtil.writeIndexHeader( indexOut, Lucene90BlockTreeTermsReader.TERMS_INDEX_CODEC_NAME, Lucene90BlockTreeTermsReader.VERSION_CURRENT, state.segmentInfo.getId(), state.segmentSuffix); // segment = state.segmentInfo.name; final String metaName = IndexFileNames.segmentFileName( state.segmentInfo.name, state.segmentSuffix, Lucene90BlockTreeTermsReader.TERMS_META_EXTENSION); metaOut = state.directory.createOutput(metaName, state.context); CodecUtil.writeIndexHeader( metaOut, Lucene90BlockTreeTermsReader.TERMS_META_CODEC_NAME, Lucene90BlockTreeTermsReader.VERSION_CURRENT, state.segmentInfo.getId(), state.segmentSuffix); postingsWriter.init(metaOut, state); // have consumer write its format/header this.metaOut = metaOut; this.indexOut = indexOut; success = true; } finally { if (!success) { IOUtils.closeWhileHandlingException(metaOut, termsOut, indexOut); } } } /** Throws {@code IllegalArgumentException} if any of these settings is invalid. */ public static void validateSettings(int minItemsInBlock, int maxItemsInBlock) { if (minItemsInBlock <= 1) { throw new IllegalArgumentException("minItemsInBlock must be >= 2; got " + minItemsInBlock); } if (minItemsInBlock > maxItemsInBlock) { throw new IllegalArgumentException( "maxItemsInBlock must be >= minItemsInBlock; got maxItemsInBlock=" + maxItemsInBlock + " minItemsInBlock=" + minItemsInBlock); } if (2 * (minItemsInBlock - 1) > maxItemsInBlock) { throw new IllegalArgumentException( "maxItemsInBlock must be at least 2*(minItemsInBlock-1); got maxItemsInBlock=" + maxItemsInBlock + " minItemsInBlock=" + minItemsInBlock); } } @Override public void write(Fields fields, NormsProducer norms) throws IOException { // if (DEBUG) System.out.println("\nBTTW.write seg=" + segment); String lastField = null; for (String field : fields) { assert lastField == null || lastField.compareTo(field) < 0; lastField = field; // if (DEBUG) System.out.println("\nBTTW.write seg=" + segment + " field=" + field); Terms terms = fields.terms(field); if (terms == null) { continue; } TermsEnum termsEnum = terms.iterator(); TermsWriter termsWriter = new TermsWriter(fieldInfos.fieldInfo(field)); while (true) { BytesRef term = termsEnum.next(); // if (DEBUG) System.out.println("BTTW: next term " + term); if (term == null) { break; } // if (DEBUG) System.out.println("write field=" + fieldInfo.name + " term=" + // brToString(term)); termsWriter.write(term, termsEnum, norms); } termsWriter.finish(); // if (DEBUG) System.out.println("\nBTTW.write done seg=" + segment + " field=" + field); } } static long encodeOutput(long fp, boolean hasTerms, boolean isFloor) { assert fp < (1L << 62); return (fp << 2) | (hasTerms ? Lucene90BlockTreeTermsReader.OUTPUT_FLAG_HAS_TERMS : 0) | (isFloor ? Lucene90BlockTreeTermsReader.OUTPUT_FLAG_IS_FLOOR : 0); } private static class PendingEntry { public final boolean isTerm; protected PendingEntry(boolean isTerm) { this.isTerm = isTerm; } } private static final class PendingTerm extends PendingEntry { public final byte[] termBytes; // stats + metadata public final BlockTermState state; public PendingTerm(BytesRef term, BlockTermState state) { super(true); this.termBytes = new byte[term.length]; System.arraycopy(term.bytes, term.offset, termBytes, 0, term.length); this.state = state; } @Override public String toString() { return "TERM: " + brToString(termBytes); } } // for debugging @SuppressWarnings("unused") static String brToString(BytesRef b) { if (b == null) { return "(null)"; } else { try { return b.utf8ToString() + " " + b; } catch (Throwable t) { // If BytesRef isn't actually UTF8, or it's eg a // prefix of UTF8 that ends mid-unicode-char, we // fallback to hex: return b.toString(); } } } // for debugging @SuppressWarnings("unused") static String brToString(byte[] b) { return brToString(new BytesRef(b)); } private static final class PendingBlock extends PendingEntry { public final BytesRef prefix; public final long fp; public FST<BytesRef> index; public List<FST<BytesRef>> subIndices; public final boolean hasTerms; public final boolean isFloor; public final int floorLeadByte; public PendingBlock( BytesRef prefix, long fp, boolean hasTerms, boolean isFloor, int floorLeadByte, List<FST<BytesRef>> subIndices) { super(false); this.prefix = prefix; this.fp = fp; this.hasTerms = hasTerms; this.isFloor = isFloor; this.floorLeadByte = floorLeadByte; this.subIndices = subIndices; } @Override public String toString() { return "BLOCK: prefix=" + brToString(prefix); } public void compileIndex( List<PendingBlock> blocks, ByteBuffersDataOutput scratchBytes, IntsRefBuilder scratchIntsRef) throws IOException { assert (isFloor && blocks.size() > 1) || (isFloor == false && blocks.size() == 1) : "isFloor=" + isFloor + " blocks=" + blocks; assert this == blocks.get(0); assert scratchBytes.size() == 0; // TODO: try writing the leading vLong in MSB order // (opposite of what Lucene does today), for better // outputs sharing in the FST scratchBytes.writeVLong(encodeOutput(fp, hasTerms, isFloor)); if (isFloor) { scratchBytes.writeVInt(blocks.size() - 1); for (int i = 1; i < blocks.size(); i++) { PendingBlock sub = blocks.get(i); assert sub.floorLeadByte != -1; // if (DEBUG) { // System.out.println(" write floorLeadByte=" + // Integer.toHexString(sub.floorLeadByte&0xff)); // } scratchBytes.writeByte((byte) sub.floorLeadByte); assert sub.fp > fp; scratchBytes.writeVLong((sub.fp - fp) << 1 | (sub.hasTerms ? 1 : 0)); } } final ByteSequenceOutputs outputs = ByteSequenceOutputs.getSingleton(); final FSTCompiler<BytesRef> fstCompiler = new FSTCompiler.Builder<>(FST.INPUT_TYPE.BYTE1, outputs) .shouldShareNonSingletonNodes(false) .build(); // if (DEBUG) { // System.out.println(" compile index for prefix=" + prefix); // } // indexBuilder.DEBUG = false; final byte[] bytes = scratchBytes.toArrayCopy(); assert bytes.length > 0; fstCompiler.add(Util.toIntsRef(prefix, scratchIntsRef), new BytesRef(bytes, 0, bytes.length)); scratchBytes.reset(); // Copy over index for all sub-blocks for (PendingBlock block : blocks) { if (block.subIndices != null) { for (FST<BytesRef> subIndex : block.subIndices) { append(fstCompiler, subIndex, scratchIntsRef); } block.subIndices = null; } } index = fstCompiler.compile(); assert subIndices == null; /* Writer w = new OutputStreamWriter(new FileOutputStream("out.dot")); Util.toDot(index, w, false, false); System.out.println("SAVED to out.dot"); w.close(); */ } // TODO: maybe we could add bulk-add method to // Builder? Takes FST and unions it w/ current // FST. private void append( FSTCompiler<BytesRef> fstCompiler, FST<BytesRef> subIndex, IntsRefBuilder scratchIntsRef) throws IOException { final BytesRefFSTEnum<BytesRef> subIndexEnum = new BytesRefFSTEnum<>(subIndex); BytesRefFSTEnum.InputOutput<BytesRef> indexEnt; while ((indexEnt = subIndexEnum.next()) != null) { // if (DEBUG) { // System.out.println(" add sub=" + indexEnt.input + " " + indexEnt.input + " output=" // + indexEnt.output); // } fstCompiler.add(Util.toIntsRef(indexEnt.input, scratchIntsRef), indexEnt.output); } } } private final ByteBuffersDataOutput scratchBytes = ByteBuffersDataOutput.newResettableInstance(); private final IntsRefBuilder scratchIntsRef = new IntsRefBuilder(); static final BytesRef EMPTY_BYTES_REF = new BytesRef(); private static class StatsWriter { private final DataOutput out; private final boolean hasFreqs; private int singletonCount; StatsWriter(DataOutput out, boolean hasFreqs) { this.out = out; this.hasFreqs = hasFreqs; } void add(int df, long ttf) throws IOException { // Singletons (DF==1, TTF==1) are run-length encoded if (df == 1 && (hasFreqs == false || ttf == 1)) { singletonCount++; } else { finish(); out.writeVInt(df << 1); if (hasFreqs) { out.writeVLong(ttf - df); } } } void finish() throws IOException { if (singletonCount > 0) { out.writeVInt(((singletonCount - 1) << 1) | 1); singletonCount = 0; } } } class TermsWriter { private final FieldInfo fieldInfo; private long numTerms; final FixedBitSet docsSeen; long sumTotalTermFreq; long sumDocFreq; // Records index into pending where the current prefix at that // length "started"; for example, if current term starts with 't', // startsByPrefix[0] is the index into pending for the first // term/sub-block starting with 't'. We use this to figure out when // to write a new block: private final BytesRefBuilder lastTerm = new BytesRefBuilder(); private int[] prefixStarts = new int[8]; // Pending stack of terms and blocks. As terms arrive (in sorted order) // we append to this stack, and once the top of the stack has enough // terms starting with a common prefix, we write a new block with // those terms and replace those terms in the stack with a new block: private final List<PendingEntry> pending = new ArrayList<>(); // Reused in writeBlocks: private final List<PendingBlock> newBlocks = new ArrayList<>(); private PendingTerm firstPendingTerm; private PendingTerm lastPendingTerm; /** Writes the top count entries in pending, using prevTerm to compute the prefix. */ void writeBlocks(int prefixLength, int count) throws IOException { assert count > 0; // if (DEBUG2) { // BytesRef br = new BytesRef(lastTerm.bytes()); // br.length = prefixLength; // System.out.println("writeBlocks: seg=" + segment + " prefix=" + brToString(br) + " count=" // + count); // } // Root block better write all remaining pending entries: assert prefixLength > 0 || count == pending.size(); int lastSuffixLeadLabel = -1; // True if we saw at least one term in this block (we record if a block // only points to sub-blocks in the terms index so we can avoid seeking // to it when we are looking for a term): boolean hasTerms = false; boolean hasSubBlocks = false; int start = pending.size() - count; int end = pending.size(); int nextBlockStart = start; int nextFloorLeadLabel = -1; for (int i = start; i < end; i++) { PendingEntry ent = pending.get(i); int suffixLeadLabel; if (ent.isTerm) { PendingTerm term = (PendingTerm) ent; if (term.termBytes.length == prefixLength) { // Suffix is 0, i.e. prefix 'foo' and term is // 'foo' so the term has empty string suffix // in this block assert lastSuffixLeadLabel == -1 : "i=" + i + " lastSuffixLeadLabel=" + lastSuffixLeadLabel; suffixLeadLabel = -1; } else { suffixLeadLabel = term.termBytes[prefixLength] & 0xff; } } else { PendingBlock block = (PendingBlock) ent; assert block.prefix.length > prefixLength; suffixLeadLabel = block.prefix.bytes[block.prefix.offset + prefixLength] & 0xff; } // if (DEBUG) System.out.println(" i=" + i + " ent=" + ent + " suffixLeadLabel=" + // suffixLeadLabel); if (suffixLeadLabel != lastSuffixLeadLabel) { int itemsInBlock = i - nextBlockStart; if (itemsInBlock >= minItemsInBlock && end - nextBlockStart > maxItemsInBlock) { // The count is too large for one block, so we must break it into "floor" blocks, where // we record // the leading label of the suffix of the first term in each floor block, so at search // time we can // jump to the right floor block. We just use a naive greedy segmenter here: make a new // floor // block as soon as we have at least minItemsInBlock. This is not always best: it often // produces // a too-small block as the final block: boolean isFloor = itemsInBlock < count; newBlocks.add( writeBlock( prefixLength, isFloor, nextFloorLeadLabel, nextBlockStart, i, hasTerms, hasSubBlocks)); hasTerms = false; hasSubBlocks = false; nextFloorLeadLabel = suffixLeadLabel; nextBlockStart = i; } lastSuffixLeadLabel = suffixLeadLabel; } if (ent.isTerm) { hasTerms = true; } else { hasSubBlocks = true; } } // Write last block, if any: if (nextBlockStart < end) { int itemsInBlock = end - nextBlockStart; boolean isFloor = itemsInBlock < count; newBlocks.add( writeBlock( prefixLength, isFloor, nextFloorLeadLabel, nextBlockStart, end, hasTerms, hasSubBlocks)); } assert newBlocks.isEmpty() == false; PendingBlock firstBlock = newBlocks.get(0); assert firstBlock.isFloor || newBlocks.size() == 1; firstBlock.compileIndex(newBlocks, scratchBytes, scratchIntsRef); // Remove slice from the top of the pending stack, that we just wrote: pending.subList(pending.size() - count, pending.size()).clear(); // Append new block pending.add(firstBlock); newBlocks.clear(); } private boolean allEqual(byte[] b, int startOffset, int endOffset, byte value) { Objects.checkFromToIndex(startOffset, endOffset, b.length); for (int i = startOffset; i < endOffset; ++i) { if (b[i] != value) { return false; } } return true; } /** * Writes the specified slice (start is inclusive, end is exclusive) from pending stack as a new * block. If isFloor is true, there were too many (more than maxItemsInBlock) entries sharing * the same prefix, and so we broke it into multiple floor blocks where we record the starting * label of the suffix of each floor block. */ private PendingBlock writeBlock( int prefixLength, boolean isFloor, int floorLeadLabel, int start, int end, boolean hasTerms, boolean hasSubBlocks) throws IOException { assert end > start; long startFP = termsOut.getFilePointer(); boolean hasFloorLeadLabel = isFloor && floorLeadLabel != -1; final BytesRef prefix = new BytesRef(prefixLength + (hasFloorLeadLabel ? 1 : 0)); System.arraycopy(lastTerm.get().bytes, 0, prefix.bytes, 0, prefixLength); prefix.length = prefixLength; // if (DEBUG2) System.out.println(" writeBlock field=" + fieldInfo.name + " prefix=" + // brToString(prefix) + " fp=" + startFP + " isFloor=" + isFloor + " isLastInFloor=" + (end == // pending.size()) + " floorLeadLabel=" + floorLeadLabel + " start=" + start + " end=" + end + // " hasTerms=" + hasTerms + " hasSubBlocks=" + hasSubBlocks); // Write block header: int numEntries = end - start; int code = numEntries << 1; if (end == pending.size()) { // Last block: code |= 1; } termsOut.writeVInt(code); /* if (DEBUG) { System.out.println(" writeBlock " + (isFloor ? "(floor) " : "") + "seg=" + segment + " pending.size()=" + pending.size() + " prefixLength=" + prefixLength + " indexPrefix=" + brToString(prefix) + " entCount=" + (end-start+1) + " startFP=" + startFP + (isFloor ? (" floorLeadLabel=" + Integer.toHexString(floorLeadLabel)) : "")); } */ // 1st pass: pack term suffix bytes into byte[] blob // TODO: cutover to bulk int codec... simple64? // We optimize the leaf block case (block has only terms), writing a more // compact format in this case: boolean isLeafBlock = hasSubBlocks == false; // System.out.println(" isLeaf=" + isLeafBlock); final List<FST<BytesRef>> subIndices; boolean absolute = true; if (isLeafBlock) { // Block contains only ordinary terms: subIndices = null; StatsWriter statsWriter = new StatsWriter(this.statsWriter, fieldInfo.getIndexOptions() != IndexOptions.DOCS); for (int i = start; i < end; i++) { PendingEntry ent = pending.get(i); assert ent.isTerm : "i=" + i; PendingTerm term = (PendingTerm) ent; assert StringHelper.startsWith(term.termBytes, prefix) : term + " prefix=" + prefix; BlockTermState state = term.state; final int suffix = term.termBytes.length - prefixLength; // if (DEBUG2) { // BytesRef suffixBytes = new BytesRef(suffix); // System.arraycopy(term.termBytes, prefixLength, suffixBytes.bytes, 0, suffix); // suffixBytes.length = suffix; // System.out.println(" write term suffix=" + brToString(suffixBytes)); // } // For leaf block we write suffix straight suffixLengthsWriter.writeVInt(suffix); suffixWriter.append(term.termBytes, prefixLength, suffix); assert floorLeadLabel == -1 || (term.termBytes[prefixLength] & 0xff) >= floorLeadLabel; // Write term stats, to separate byte[] blob: statsWriter.add(state.docFreq, state.totalTermFreq); // Write term meta data postingsWriter.encodeTerm(metaWriter, fieldInfo, state, absolute); absolute = false; } statsWriter.finish(); } else { // Block has at least one prefix term or a sub block: subIndices = new ArrayList<>(); StatsWriter statsWriter = new StatsWriter(this.statsWriter, fieldInfo.getIndexOptions() != IndexOptions.DOCS); for (int i = start; i < end; i++) { PendingEntry ent = pending.get(i); if (ent.isTerm) { PendingTerm term = (PendingTerm) ent; assert StringHelper.startsWith(term.termBytes, prefix) : term + " prefix=" + prefix; BlockTermState state = term.state; final int suffix = term.termBytes.length - prefixLength; // if (DEBUG2) { // BytesRef suffixBytes = new BytesRef(suffix); // System.arraycopy(term.termBytes, prefixLength, suffixBytes.bytes, 0, suffix); // suffixBytes.length = suffix; // System.out.println(" write term suffix=" + brToString(suffixBytes)); // } // For non-leaf block we borrow 1 bit to record // if entry is term or sub-block, and 1 bit to record if // it's a prefix term. Terms cannot be larger than ~32 KB // so we won't run out of bits: suffixLengthsWriter.writeVInt(suffix << 1); suffixWriter.append(term.termBytes, prefixLength, suffix); // Write term stats, to separate byte[] blob: statsWriter.add(state.docFreq, state.totalTermFreq); // TODO: now that terms dict "sees" these longs, // we can explore better column-stride encodings // to encode all long[0]s for this block at // once, all long[1]s, etc., e.g. using // Simple64. Alternatively, we could interleave // stats + meta ... no reason to have them // separate anymore: // Write term meta data postingsWriter.encodeTerm(metaWriter, fieldInfo, state, absolute); absolute = false; } else { PendingBlock block = (PendingBlock) ent; assert StringHelper.startsWith(block.prefix, prefix); final int suffix = block.prefix.length - prefixLength; assert StringHelper.startsWith(block.prefix, prefix); assert suffix > 0; // For non-leaf block we borrow 1 bit to record // if entry is term or sub-block:f suffixLengthsWriter.writeVInt((suffix << 1) | 1); suffixWriter.append(block.prefix.bytes, prefixLength, suffix); // if (DEBUG2) { // BytesRef suffixBytes = new BytesRef(suffix); // System.arraycopy(block.prefix.bytes, prefixLength, suffixBytes.bytes, 0, suffix); // suffixBytes.length = suffix; // System.out.println(" write sub-block suffix=" + brToString(suffixBytes) + " // subFP=" + block.fp + " subCode=" + (startFP-block.fp) + " floor=" + block.isFloor); // } assert floorLeadLabel == -1 || (block.prefix.bytes[prefixLength] & 0xff) >= floorLeadLabel : "floorLeadLabel=" + floorLeadLabel + " suffixLead=" + (block.prefix.bytes[prefixLength] & 0xff); assert block.fp < startFP; suffixLengthsWriter.writeVLong(startFP - block.fp); subIndices.add(block.index); } } statsWriter.finish(); assert subIndices.size() != 0; } // Write suffixes byte[] blob to terms dict output, either uncompressed, compressed with LZ4 // or with LowercaseAsciiCompression. CompressionAlgorithm compressionAlg = CompressionAlgorithm.NO_COMPRESSION; // If there are 2 suffix bytes or less per term, then we don't bother compressing as suffix // are unlikely what // makes the terms dictionary large, and it also tends to be frequently the case for dense IDs // like // auto-increment IDs, so not compressing in that case helps not hurt ID lookups by too much. // We also only start compressing when the prefix length is greater than 2 since blocks whose // prefix length is // 1 or 2 always all get visited when running a fuzzy query whose max number of edits is 2. if (suffixWriter.length() > 2L * numEntries && prefixLength > 2) { // LZ4 inserts references whenever it sees duplicate strings of 4 chars or more, so only try // it out if the // average suffix length is greater than 6. if (suffixWriter.length() > 6L * numEntries) { if (compressionHashTable == null) { compressionHashTable = new LZ4.HighCompressionHashTable(); } LZ4.compress( suffixWriter.bytes(), 0, suffixWriter.length(), spareWriter, compressionHashTable); if (spareWriter.size() < suffixWriter.length() - (suffixWriter.length() >>> 2)) { // LZ4 saved more than 25%, go for it compressionAlg = CompressionAlgorithm.LZ4; } } if (compressionAlg == CompressionAlgorithm.NO_COMPRESSION) { spareWriter.reset(); if (spareBytes.length < suffixWriter.length()) { spareBytes = new byte[ArrayUtil.oversize(suffixWriter.length(), 1)]; } if (LowercaseAsciiCompression.compress( suffixWriter.bytes(), suffixWriter.length(), spareBytes, spareWriter)) { compressionAlg = CompressionAlgorithm.LOWERCASE_ASCII; } } } long token = ((long) suffixWriter.length()) << 3; if (isLeafBlock) { token |= 0x04; } token |= compressionAlg.code; termsOut.writeVLong(token); if (compressionAlg == CompressionAlgorithm.NO_COMPRESSION) { termsOut.writeBytes(suffixWriter.bytes(), suffixWriter.length()); } else { spareWriter.copyTo(termsOut); } suffixWriter.setLength(0); spareWriter.reset(); // Write suffix lengths final int numSuffixBytes = Math.toIntExact(suffixLengthsWriter.size()); spareBytes = ArrayUtil.growNoCopy(spareBytes, numSuffixBytes); suffixLengthsWriter.copyTo(new ByteArrayDataOutput(spareBytes)); suffixLengthsWriter.reset(); if (allEqual(spareBytes, 1, numSuffixBytes, spareBytes[0])) { // Structured fields like IDs often have most values of the same length termsOut.writeVInt((numSuffixBytes << 1) | 1); termsOut.writeByte(spareBytes[0]); } else { termsOut.writeVInt(numSuffixBytes << 1); termsOut.writeBytes(spareBytes, numSuffixBytes); } // Stats final int numStatsBytes = Math.toIntExact(statsWriter.size()); termsOut.writeVInt(numStatsBytes); statsWriter.copyTo(termsOut); statsWriter.reset(); // Write term meta data byte[] blob termsOut.writeVInt((int) metaWriter.size()); metaWriter.copyTo(termsOut); metaWriter.reset(); // if (DEBUG) { // System.out.println(" fpEnd=" + out.getFilePointer()); // } if (hasFloorLeadLabel) { // We already allocated to length+1 above: prefix.bytes[prefix.length++] = (byte) floorLeadLabel; } return new PendingBlock(prefix, startFP, hasTerms, isFloor, floorLeadLabel, subIndices); } TermsWriter(FieldInfo fieldInfo) { this.fieldInfo = fieldInfo; assert fieldInfo.getIndexOptions() != IndexOptions.NONE; docsSeen = new FixedBitSet(maxDoc); postingsWriter.setField(fieldInfo); } /** Writes one term's worth of postings. */ public void write(BytesRef text, TermsEnum termsEnum, NormsProducer norms) throws IOException { /* if (DEBUG) { int[] tmp = new int[lastTerm.length]; System.arraycopy(prefixStarts, 0, tmp, 0, tmp.length); System.out.println("BTTW: write term=" + brToString(text) + " prefixStarts=" + Arrays.toString(tmp) + " pending.size()=" + pending.size()); } */ BlockTermState state = postingsWriter.writeTerm(text, termsEnum, docsSeen, norms); if (state != null) { assert state.docFreq != 0; assert fieldInfo.getIndexOptions() == IndexOptions.DOCS || state.totalTermFreq >= state.docFreq : "postingsWriter=" + postingsWriter; pushTerm(text); PendingTerm term = new PendingTerm(text, state); pending.add(term); // if (DEBUG) System.out.println(" add pending term = " + text + " pending.size()=" + // pending.size()); sumDocFreq += state.docFreq; sumTotalTermFreq += state.totalTermFreq; numTerms++; if (firstPendingTerm == null) { firstPendingTerm = term; } lastPendingTerm = term; } } /** Pushes the new term to the top of the stack, and writes new blocks. */ private void pushTerm(BytesRef text) throws IOException { // Find common prefix between last term and current term: int prefixLength = Arrays.mismatch( lastTerm.bytes(), 0, lastTerm.length(), text.bytes, text.offset, text.offset + text.length); if (prefixLength == -1) { // Only happens for the first term, if it is empty assert lastTerm.length() == 0; prefixLength = 0; } // if (DEBUG) System.out.println(" shared=" + pos + " lastTerm.length=" + lastTerm.length); // Close the "abandoned" suffix now: for (int i = lastTerm.length() - 1; i >= prefixLength; i--) { // How many items on top of the stack share the current suffix // we are closing: int prefixTopSize = pending.size() - prefixStarts[i]; if (prefixTopSize >= minItemsInBlock) { // if (DEBUG) System.out.println("pushTerm i=" + i + " prefixTopSize=" + prefixTopSize + " // minItemsInBlock=" + minItemsInBlock); writeBlocks(i + 1, prefixTopSize); prefixStarts[i] -= prefixTopSize - 1; } } if (prefixStarts.length < text.length) { prefixStarts = ArrayUtil.grow(prefixStarts, text.length); } // Init new tail: for (int i = prefixLength; i < text.length; i++) { prefixStarts[i] = pending.size(); } lastTerm.copyBytes(text); } // Finishes all terms in this field public void finish() throws IOException { if (numTerms > 0) { // if (DEBUG) System.out.println("BTTW: finish prefixStarts=" + // Arrays.toString(prefixStarts)); // Add empty term to force closing of all final blocks: pushTerm(new BytesRef()); // TODO: if pending.size() is already 1 with a non-zero prefix length // we can save writing a "degenerate" root block, but we have to // fix all the places that assume the root block's prefix is the empty string: pushTerm(new BytesRef()); writeBlocks(0, pending.size()); // We better have one final "root" block: assert pending.size() == 1 && !pending.get(0).isTerm : "pending.size()=" + pending.size() + " pending=" + pending; final PendingBlock root = (PendingBlock) pending.get(0); assert root.prefix.length == 0; final BytesRef rootCode = root.index.getEmptyOutput(); assert rootCode != null; ByteBuffersDataOutput metaOut = new ByteBuffersDataOutput(); fields.add(metaOut); metaOut.writeVInt(fieldInfo.number); metaOut.writeVLong(numTerms); metaOut.writeVInt(rootCode.length); metaOut.writeBytes(rootCode.bytes, rootCode.offset, rootCode.length); assert fieldInfo.getIndexOptions() != IndexOptions.NONE; if (fieldInfo.getIndexOptions() != IndexOptions.DOCS) { metaOut.writeVLong(sumTotalTermFreq); } metaOut.writeVLong(sumDocFreq); metaOut.writeVInt(docsSeen.cardinality()); writeBytesRef(metaOut, new BytesRef(firstPendingTerm.termBytes)); writeBytesRef(metaOut, new BytesRef(lastPendingTerm.termBytes)); metaOut.writeVLong(indexOut.getFilePointer()); // Write FST to index root.index.save(metaOut, indexOut); // System.out.println(" write FST " + indexStartFP + " field=" + fieldInfo.name); /* if (DEBUG) { final String dotFileName = segment + "_" + fieldInfo.name + ".dot"; Writer w = new OutputStreamWriter(new FileOutputStream(dotFileName)); Util.toDot(root.index, w, false, false); System.out.println("SAVED to " + dotFileName); w.close(); } */ } else { assert sumTotalTermFreq == 0 || fieldInfo.getIndexOptions() == IndexOptions.DOCS && sumTotalTermFreq == -1; assert sumDocFreq == 0; assert docsSeen.cardinality() == 0; } } private final ByteBuffersDataOutput suffixLengthsWriter = ByteBuffersDataOutput.newResettableInstance(); private final BytesRefBuilder suffixWriter = new BytesRefBuilder(); private final ByteBuffersDataOutput statsWriter = ByteBuffersDataOutput.newResettableInstance(); private final ByteBuffersDataOutput metaWriter = ByteBuffersDataOutput.newResettableInstance(); private final ByteBuffersDataOutput spareWriter = ByteBuffersDataOutput.newResettableInstance(); private byte[] spareBytes = BytesRef.EMPTY_BYTES; private LZ4.HighCompressionHashTable compressionHashTable; } private boolean closed; @Override public void close() throws IOException { if (closed) { return; } closed = true; boolean success = false; try { metaOut.writeVInt(fields.size()); for (ByteBuffersDataOutput fieldMeta : fields) { fieldMeta.copyTo(metaOut); } CodecUtil.writeFooter(indexOut); metaOut.writeLong(indexOut.getFilePointer()); CodecUtil.writeFooter(termsOut); metaOut.writeLong(termsOut.getFilePointer()); CodecUtil.writeFooter(metaOut); success = true; } finally { if (success) { IOUtils.close(metaOut, termsOut, indexOut, postingsWriter); } else { IOUtils.closeWhileHandlingException(metaOut, termsOut, indexOut, postingsWriter); } } } private static void writeBytesRef(DataOutput out, BytesRef bytes) throws IOException { out.writeVInt(bytes.length); out.writeBytes(bytes.bytes, bytes.offset, bytes.length); } }
38.34808
337
0.638515
47e68ad1f47e14957d59b1446fc21c9fc3af2aff
370,809
/* * Copyright (c) 2020. MobilityData IO. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: gtfs_validation.proto package org.mobilitydata.gtfsvalidator.adapter.protos; public final class GtfsValidationOutputProto { private GtfsValidationOutputProto() { } public static void registerAllExtensions( com.google.protobuf.ExtensionRegistryLite registry) { } public static void registerAllExtensions( com.google.protobuf.ExtensionRegistry registry) { registerAllExtensions( (com.google.protobuf.ExtensionRegistryLite) registry); } public interface PointProtoOrBuilder extends // @@protoc_insertion_point(interface_extends:outputProto.PointProto) com.google.protobuf.MessageOrBuilder { /** * <code>optional fixed32 lat_e7 = 1;</code> * * @return Whether the latE7 field is set. */ boolean hasLatE7(); /** * <code>optional fixed32 lat_e7 = 1;</code> * * @return The latE7. */ int getLatE7(); /** * <code>optional fixed32 lng_e7 = 2;</code> * * @return Whether the lngE7 field is set. */ boolean hasLngE7(); /** * <code>optional fixed32 lng_e7 = 2;</code> * * @return The lngE7. */ int getLngE7(); } /** * <pre> * Points are represented as latitude-longitude pairs in the E7 * representation (degrees multiplied by 10**7 and rounded to the nearest * integer). Latitudes should be in the range +/- 90 degrees and longitude * should be in the range +/- 180 degrees (inclusive). * </pre> * <p> * Protobuf type {@code outputProto.PointProto} */ public static final class PointProto extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:outputProto.PointProto) PointProtoOrBuilder { private static final long serialVersionUID = 0L; // Use PointProto.newBuilder() to construct. private PointProto(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private PointProto() { } @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance( UnusedPrivateParameter unused) { return new PointProto(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private PointProto( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 13: { bitField0_ |= 0x00000001; latE7_ = input.readFixed32(); break; } case 21: { bitField0_ |= 0x00000002; lngE7_ = input.readFixed32(); break; } default: { if (!parseUnknownField( input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.internal_static_outputProto_PointProto_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.internal_static_outputProto_PointProto_fieldAccessorTable .ensureFieldAccessorsInitialized( org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.class, org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.Builder.class); } private int bitField0_; public static final int LAT_E7_FIELD_NUMBER = 1; private int latE7_; /** * <code>optional fixed32 lat_e7 = 1;</code> * * @return Whether the latE7 field is set. */ public boolean hasLatE7() { return ((bitField0_ & 0x00000001) != 0); } /** * <code>optional fixed32 lat_e7 = 1;</code> * * @return The latE7. */ public int getLatE7() { return latE7_; } public static final int LNG_E7_FIELD_NUMBER = 2; private int lngE7_; /** * <code>optional fixed32 lng_e7 = 2;</code> * * @return Whether the lngE7 field is set. */ public boolean hasLngE7() { return ((bitField0_ & 0x00000002) != 0); } /** * <code>optional fixed32 lng_e7 = 2;</code> * * @return The lngE7. */ public int getLngE7() { return lngE7_; } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (((bitField0_ & 0x00000001) != 0)) { output.writeFixed32(1, latE7_); } if (((bitField0_ & 0x00000002) != 0)) { output.writeFixed32(2, lngE7_); } unknownFields.writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream .computeFixed32Size(1, latE7_); } if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream .computeFixed32Size(2, lngE7_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto)) { return super.equals(obj); } org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto other = (org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto) obj; if (hasLatE7() != other.hasLatE7()) return false; if (hasLatE7()) { if (getLatE7() != other.getLatE7()) return false; } if (hasLngE7() != other.hasLngE7()) return false; if (hasLngE7()) { if (getLngE7() != other.getLngE7()) return false; } if (!unknownFields.equals(other.unknownFields)) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasLatE7()) { hash = (37 * hash) + LAT_E7_FIELD_NUMBER; hash = (53 * hash) + getLatE7(); } if (hasLngE7()) { hash = (37 * hash) + LNG_E7_FIELD_NUMBER; hash = (53 * hash) + getLngE7(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * <pre> * Points are represented as latitude-longitude pairs in the E7 * representation (degrees multiplied by 10**7 and rounded to the nearest * integer). Latitudes should be in the range +/- 90 degrees and longitude * should be in the range +/- 180 degrees (inclusive). * </pre> * <p> * Protobuf type {@code outputProto.PointProto} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:outputProto.PointProto) org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProtoOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.internal_static_outputProto_PointProto_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.internal_static_outputProto_PointProto_fieldAccessorTable .ensureFieldAccessorsInitialized( org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.class, org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.Builder.class); } // Construct using org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { } } @java.lang.Override public Builder clear() { super.clear(); latE7_ = 0; bitField0_ = (bitField0_ & ~0x00000001); lngE7_ = 0; bitField0_ = (bitField0_ & ~0x00000002); return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.internal_static_outputProto_PointProto_descriptor; } @java.lang.Override public org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto getDefaultInstanceForType() { return org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.getDefaultInstance(); } @java.lang.Override public org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto build() { org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto buildPartial() { org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto result = new org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) != 0)) { result.latE7_ = latE7_; to_bitField0_ |= 0x00000001; } if (((from_bitField0_ & 0x00000002) != 0)) { result.lngE7_ = lngE7_; to_bitField0_ |= 0x00000002; } result.bitField0_ = to_bitField0_; onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto) { return mergeFrom((org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto) other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto other) { if (other == org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.getDefaultInstance()) return this; if (other.hasLatE7()) { setLatE7(other.getLatE7()); } if (other.hasLngE7()) { setLngE7(other.getLngE7()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; private int latE7_; /** * <code>optional fixed32 lat_e7 = 1;</code> * * @return Whether the latE7 field is set. */ public boolean hasLatE7() { return ((bitField0_ & 0x00000001) != 0); } /** * <code>optional fixed32 lat_e7 = 1;</code> * * @return The latE7. */ public int getLatE7() { return latE7_; } /** * <code>optional fixed32 lat_e7 = 1;</code> * * @param value The latE7 to set. * @return This builder for chaining. */ public Builder setLatE7(int value) { bitField0_ |= 0x00000001; latE7_ = value; onChanged(); return this; } /** * <code>optional fixed32 lat_e7 = 1;</code> * * @return This builder for chaining. */ public Builder clearLatE7() { bitField0_ = (bitField0_ & ~0x00000001); latE7_ = 0; onChanged(); return this; } private int lngE7_; /** * <code>optional fixed32 lng_e7 = 2;</code> * * @return Whether the lngE7 field is set. */ public boolean hasLngE7() { return ((bitField0_ & 0x00000002) != 0); } /** * <code>optional fixed32 lng_e7 = 2;</code> * * @return The lngE7. */ public int getLngE7() { return lngE7_; } /** * <code>optional fixed32 lng_e7 = 2;</code> * * @param value The lngE7 to set. * @return This builder for chaining. */ public Builder setLngE7(int value) { bitField0_ |= 0x00000002; lngE7_ = value; onChanged(); return this; } /** * <code>optional fixed32 lng_e7 = 2;</code> * * @return This builder for chaining. */ public Builder clearLngE7() { bitField0_ = (bitField0_ & ~0x00000002); lngE7_ = 0; onChanged(); return this; } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:outputProto.PointProto) } // @@protoc_insertion_point(class_scope:outputProto.PointProto) private static final org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto(); } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto getDefaultInstance() { return DEFAULT_INSTANCE; } @java.lang.Deprecated public static final com.google.protobuf.Parser<PointProto> PARSER = new com.google.protobuf.AbstractParser<PointProto>() { @java.lang.Override public PointProto parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new PointProto(input, extensionRegistry); } }; public static com.google.protobuf.Parser<PointProto> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<PointProto> getParserForType() { return PARSER; } @java.lang.Override public org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } public interface GtfsProblemOrBuilder extends // @@protoc_insertion_point(interface_extends:outputProto.GtfsProblem) com.google.protobuf.MessageOrBuilder { /** * <code>optional .outputProto.GtfsProblem.Type type = 1;</code> * * @return Whether the type field is set. */ boolean hasType(); /** * <code>optional .outputProto.GtfsProblem.Type type = 1;</code> * * @return The type. */ org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Type getType(); /** * <code>optional .outputProto.GtfsProblem.Severity severity = 2;</code> * * @return Whether the severity field is set. */ boolean hasSeverity(); /** * <code>optional .outputProto.GtfsProblem.Severity severity = 2;</code> * * @return The severity. */ org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Severity getSeverity(); /** * <pre> * The name of the CSV file (eg. "stops.txt") where this problem occurred. * </pre> * * <code>optional string csv_file_name = 3;</code> * * @return Whether the csvFileName field is set. */ boolean hasCsvFileName(); /** * <pre> * The name of the CSV file (eg. "stops.txt") where this problem occurred. * </pre> * * <code>optional string csv_file_name = 3;</code> * * @return The csvFileName. */ java.lang.String getCsvFileName(); /** * <pre> * The name of the CSV file (eg. "stops.txt") where this problem occurred. * </pre> * * <code>optional string csv_file_name = 3;</code> * * @return The bytes for csvFileName. */ com.google.protobuf.ByteString getCsvFileNameBytes(); /** * <pre> * The name of a CSV key that is implicated in this problem. * </pre> * * <code>optional string csv_key_name = 4;</code> * * @return Whether the csvKeyName field is set. */ boolean hasCsvKeyName(); /** * <pre> * The name of a CSV key that is implicated in this problem. * </pre> * * <code>optional string csv_key_name = 4;</code> * * @return The csvKeyName. */ java.lang.String getCsvKeyName(); /** * <pre> * The name of a CSV key that is implicated in this problem. * </pre> * * <code>optional string csv_key_name = 4;</code> * * @return The bytes for csvKeyName. */ com.google.protobuf.ByteString getCsvKeyNameBytes(); /** * <pre> * The name of columns in the CSV file where this problem occurred. * </pre> * * <code>repeated string csv_column_name = 5;</code> * * @return A list containing the csvColumnName. */ java.util.List<java.lang.String> getCsvColumnNameList(); /** * <pre> * The name of columns in the CSV file where this problem occurred. * </pre> * * <code>repeated string csv_column_name = 5;</code> * * @return The count of csvColumnName. */ int getCsvColumnNameCount(); /** * <pre> * The name of columns in the CSV file where this problem occurred. * </pre> * * <code>repeated string csv_column_name = 5;</code> * * @param index The index of the element to return. * @return The csvColumnName at the given index. */ java.lang.String getCsvColumnName(int index); /** * <pre> * The name of columns in the CSV file where this problem occurred. * </pre> * * <code>repeated string csv_column_name = 5;</code> * * @param index The index of the value to return. * @return The bytes of the csvColumnName at the given index. */ com.google.protobuf.ByteString getCsvColumnNameBytes(int index); /** * <pre> * The name of an additional CSV file (eg. "routes.txt") that is related to * this problem. * </pre> * * <code>optional string other_csv_file_name = 15;</code> * * @return Whether the otherCsvFileName field is set. */ boolean hasOtherCsvFileName(); /** * <pre> * The name of an additional CSV file (eg. "routes.txt") that is related to * this problem. * </pre> * * <code>optional string other_csv_file_name = 15;</code> * * @return The otherCsvFileName. */ java.lang.String getOtherCsvFileName(); /** * <pre> * The name of an additional CSV file (eg. "routes.txt") that is related to * this problem. * </pre> * * <code>optional string other_csv_file_name = 15;</code> * * @return The bytes for otherCsvFileName. */ com.google.protobuf.ByteString getOtherCsvFileNameBytes(); /** * <pre> * The name of an additional CSV key that is related to this problem. * </pre> * * <code>optional string other_csv_key_name = 16;</code> * * @return Whether the otherCsvKeyName field is set. */ boolean hasOtherCsvKeyName(); /** * <pre> * The name of an additional CSV key that is related to this problem. * </pre> * * <code>optional string other_csv_key_name = 16;</code> * * @return The otherCsvKeyName. */ java.lang.String getOtherCsvKeyName(); /** * <pre> * The name of an additional CSV key that is related to this problem. * </pre> * * <code>optional string other_csv_key_name = 16;</code> * * @return The bytes for otherCsvKeyName. */ com.google.protobuf.ByteString getOtherCsvKeyNameBytes(); /** * <pre> * The name of additional columns in the alt CSV file that are related to * this problem. * </pre> * * <code>repeated string other_csv_column_name = 17;</code> * * @return A list containing the otherCsvColumnName. */ java.util.List<java.lang.String> getOtherCsvColumnNameList(); /** * <pre> * The name of additional columns in the alt CSV file that are related to * this problem. * </pre> * * <code>repeated string other_csv_column_name = 17;</code> * * @return The count of otherCsvColumnName. */ int getOtherCsvColumnNameCount(); /** * <pre> * The name of additional columns in the alt CSV file that are related to * this problem. * </pre> * * <code>repeated string other_csv_column_name = 17;</code> * * @param index The index of the element to return. * @return The otherCsvColumnName at the given index. */ java.lang.String getOtherCsvColumnName(int index); /** * <pre> * The name of additional columns in the alt CSV file that are related to * this problem. * </pre> * * <code>repeated string other_csv_column_name = 17;</code> * * @param index The index of the value to return. * @return The bytes of the otherCsvColumnName at the given index. */ com.google.protobuf.ByteString getOtherCsvColumnNameBytes(int index); /** * <pre> * The row number in a CSV file where this problem occurred. The first line * (includes the header) of a file should have an entity_row value of 1. * Typically, the first row of non-header data will have an entity_row value * of 2. * </pre> * * <code>optional uint32 entity_row = 6;</code> * * @return Whether the entityRow field is set. */ boolean hasEntityRow(); /** * <pre> * The row number in a CSV file where this problem occurred. The first line * (includes the header) of a file should have an entity_row value of 1. * Typically, the first row of non-header data will have an entity_row value * of 2. * </pre> * * <code>optional uint32 entity_row = 6;</code> * * @return The entityRow. */ int getEntityRow(); /** * <pre> * A human-readable name associated with the GTFS entity experiencing a * problem (eg. stop name). * </pre> * * <code>optional string entity_name = 7;</code> * * @return Whether the entityName field is set. */ boolean hasEntityName(); /** * <pre> * A human-readable name associated with the GTFS entity experiencing a * problem (eg. stop name). * </pre> * * <code>optional string entity_name = 7;</code> * * @return The entityName. */ java.lang.String getEntityName(); /** * <pre> * A human-readable name associated with the GTFS entity experiencing a * problem (eg. stop name). * </pre> * * <code>optional string entity_name = 7;</code> * * @return The bytes for entityName. */ com.google.protobuf.ByteString getEntityNameBytes(); /** * <pre> * A human-readable id associated with the GTFS entity experiencing a problem * (eg. stop id). * </pre> * * <code>optional string entity_id = 8;</code> * * @return Whether the entityId field is set. */ boolean hasEntityId(); /** * <pre> * A human-readable id associated with the GTFS entity experiencing a problem * (eg. stop id). * </pre> * * <code>optional string entity_id = 8;</code> * * @return The entityId. */ java.lang.String getEntityId(); /** * <pre> * A human-readable id associated with the GTFS entity experiencing a problem * (eg. stop id). * </pre> * * <code>optional string entity_id = 8;</code> * * @return The bytes for entityId. */ com.google.protobuf.ByteString getEntityIdBytes(); /** * <pre> * A human-readable value associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional string entity_value = 9;</code> * * @return Whether the entityValue field is set. */ boolean hasEntityValue(); /** * <pre> * A human-readable value associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional string entity_value = 9;</code> * * @return The entityValue. */ java.lang.String getEntityValue(); /** * <pre> * A human-readable value associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional string entity_value = 9;</code> * * @return The bytes for entityValue. */ com.google.protobuf.ByteString getEntityValueBytes(); /** * <pre> * Location information associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional .outputProto.PointProto entity_location = 21;</code> * * @return Whether the entityLocation field is set. */ boolean hasEntityLocation(); /** * <pre> * Location information associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional .outputProto.PointProto entity_location = 21;</code> * * @return The entityLocation. */ org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto getEntityLocation(); /** * <pre> * Location information associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional .outputProto.PointProto entity_location = 21;</code> */ org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProtoOrBuilder getEntityLocationOrBuilder(); /** * <pre> * The row number in a CSV file of an alternate GTFS entity that's in * conflict with the primary row. * </pre> * * <code>optional uint32 alt_entity_row = 10;</code> * * @return Whether the altEntityRow field is set. */ boolean hasAltEntityRow(); /** * <pre> * The row number in a CSV file of an alternate GTFS entity that's in * conflict with the primary row. * </pre> * * <code>optional uint32 alt_entity_row = 10;</code> * * @return The altEntityRow. */ int getAltEntityRow(); /** * <pre> * A human-readable name associated with an alternate GTFS entity that's in * conflict with the primary row (eg. conflicting stop name). * </pre> * * <code>optional string alt_entity_name = 11;</code> * * @return Whether the altEntityName field is set. */ boolean hasAltEntityName(); /** * <pre> * A human-readable name associated with an alternate GTFS entity that's in * conflict with the primary row (eg. conflicting stop name). * </pre> * * <code>optional string alt_entity_name = 11;</code> * * @return The altEntityName. */ java.lang.String getAltEntityName(); /** * <pre> * A human-readable name associated with an alternate GTFS entity that's in * conflict with the primary row (eg. conflicting stop name). * </pre> * * <code>optional string alt_entity_name = 11;</code> * * @return The bytes for altEntityName. */ com.google.protobuf.ByteString getAltEntityNameBytes(); /** * <pre> * A human-readable id associated with an alternate GTFS entity that's in * conflict with the primary row (eg. conflicting stop id). * </pre> * * <code>optional string alt_entity_id = 12;</code> * * @return Whether the altEntityId field is set. */ boolean hasAltEntityId(); /** * <pre> * A human-readable id associated with an alternate GTFS entity that's in * conflict with the primary row (eg. conflicting stop id). * </pre> * * <code>optional string alt_entity_id = 12;</code> * * @return The altEntityId. */ java.lang.String getAltEntityId(); /** * <pre> * A human-readable id associated with an alternate GTFS entity that's in * conflict with the primary row (eg. conflicting stop id). * </pre> * * <code>optional string alt_entity_id = 12;</code> * * @return The bytes for altEntityId. */ com.google.protobuf.ByteString getAltEntityIdBytes(); /** * <pre> * A human-readable value associated with the alernate GTFS entity * experiencing a problem. * </pre> * * <code>optional string alt_entity_value = 13;</code> * * @return Whether the altEntityValue field is set. */ boolean hasAltEntityValue(); /** * <pre> * A human-readable value associated with the alernate GTFS entity * experiencing a problem. * </pre> * * <code>optional string alt_entity_value = 13;</code> * * @return The altEntityValue. */ java.lang.String getAltEntityValue(); /** * <pre> * A human-readable value associated with the alernate GTFS entity * experiencing a problem. * </pre> * * <code>optional string alt_entity_value = 13;</code> * * @return The bytes for altEntityValue. */ com.google.protobuf.ByteString getAltEntityValueBytes(); /** * <pre> * Location information associated with the alternate GTFS entity * experiencing a problem. * </pre> * * <code>optional .outputProto.PointProto alt_entity_location = 22;</code> * * @return Whether the altEntityLocation field is set. */ boolean hasAltEntityLocation(); /** * <pre> * Location information associated with the alternate GTFS entity * experiencing a problem. * </pre> * * <code>optional .outputProto.PointProto alt_entity_location = 22;</code> * * @return The altEntityLocation. */ org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto getAltEntityLocation(); /** * <pre> * Location information associated with the alternate GTFS entity * experiencing a problem. * </pre> * * <code>optional .outputProto.PointProto alt_entity_location = 22;</code> */ org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProtoOrBuilder getAltEntityLocationOrBuilder(); /** * <pre> * The row number in a CSV file of a GTFS entity that's a parent to the * primary entity. * </pre> * * <code>optional uint32 parent_entity_row = 18;</code> * * @return Whether the parentEntityRow field is set. */ boolean hasParentEntityRow(); /** * <pre> * The row number in a CSV file of a GTFS entity that's a parent to the * primary entity. * </pre> * * <code>optional uint32 parent_entity_row = 18;</code> * * @return The parentEntityRow. */ int getParentEntityRow(); /** * <pre> * A human-readable name associated with the parent GTFS entity. * </pre> * * <code>optional string parent_entity_name = 19;</code> * * @return Whether the parentEntityName field is set. */ boolean hasParentEntityName(); /** * <pre> * A human-readable name associated with the parent GTFS entity. * </pre> * * <code>optional string parent_entity_name = 19;</code> * * @return The parentEntityName. */ java.lang.String getParentEntityName(); /** * <pre> * A human-readable name associated with the parent GTFS entity. * </pre> * * <code>optional string parent_entity_name = 19;</code> * * @return The bytes for parentEntityName. */ com.google.protobuf.ByteString getParentEntityNameBytes(); /** * <pre> * A human-readable id associated with the parent GTFS entity. * </pre> * * <code>optional string parent_entity_id = 20;</code> * * @return Whether the parentEntityId field is set. */ boolean hasParentEntityId(); /** * <pre> * A human-readable id associated with the parent GTFS entity. * </pre> * * <code>optional string parent_entity_id = 20;</code> * * @return The parentEntityId. */ java.lang.String getParentEntityId(); /** * <pre> * A human-readable id associated with the parent GTFS entity. * </pre> * * <code>optional string parent_entity_id = 20;</code> * * @return The bytes for parentEntityId. */ com.google.protobuf.ByteString getParentEntityIdBytes(); /** * <pre> * A value associated with the problem. This could be an invalid value * pulled from the GTFS directly or some other related value (eg "travel is * to too fast, a X kph", where X is replaced with 'value'). * </pre> * * <code>optional string value = 14;</code> * * @return Whether the value field is set. */ boolean hasValue(); /** * <pre> * A value associated with the problem. This could be an invalid value * pulled from the GTFS directly or some other related value (eg "travel is * to too fast, a X kph", where X is replaced with 'value'). * </pre> * * <code>optional string value = 14;</code> * * @return The value. */ java.lang.String getValue(); /** * <pre> * A value associated with the problem. This could be an invalid value * pulled from the GTFS directly or some other related value (eg "travel is * to too fast, a X kph", where X is replaced with 'value'). * </pre> * * <code>optional string value = 14;</code> * * @return The bytes for value. */ com.google.protobuf.ByteString getValueBytes(); /** * <pre> * An alternate value associated with the problem. Similar to 'value' field * in use, use 'value' and 'alt_value' when two values are associated with * the same primary entity. Use 'entity_value' and 'alt_entity_value' when * the two values are associated with separate entities in the same file. * </pre> * * <code>optional string alt_value = 23;</code> * * @return Whether the altValue field is set. */ boolean hasAltValue(); /** * <pre> * An alternate value associated with the problem. Similar to 'value' field * in use, use 'value' and 'alt_value' when two values are associated with * the same primary entity. Use 'entity_value' and 'alt_entity_value' when * the two values are associated with separate entities in the same file. * </pre> * * <code>optional string alt_value = 23;</code> * * @return The altValue. */ java.lang.String getAltValue(); /** * <pre> * An alternate value associated with the problem. Similar to 'value' field * in use, use 'value' and 'alt_value' when two values are associated with * the same primary entity. Use 'entity_value' and 'alt_entity_value' when * the two values are associated with separate entities in the same file. * </pre> * * <code>optional string alt_value = 23;</code> * * @return The bytes for altValue. */ com.google.protobuf.ByteString getAltValueBytes(); /** * <pre> * A value in the range [0.0, 1.0] (most important is 1.0), indicating the * importance of the problem based on the importance of the locations of the * geographical entities involved. * </pre> * * <code>optional double importance = 24;</code> * * @return Whether the importance field is set. */ boolean hasImportance(); /** * <pre> * A value in the range [0.0, 1.0] (most important is 1.0), indicating the * importance of the problem based on the importance of the locations of the * geographical entities involved. * </pre> * * <code>optional double importance = 24;</code> * * @return The importance. */ double getImportance(); } /** * <pre> * A specific GTFS validation problem. * </pre> * <p> * Protobuf type {@code outputProto.GtfsProblem} */ public static final class GtfsProblem extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:outputProto.GtfsProblem) GtfsProblemOrBuilder { private static final long serialVersionUID = 0L; // Use GtfsProblem.newBuilder() to construct. private GtfsProblem(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private GtfsProblem() { type_ = 1; severity_ = 1; csvFileName_ = ""; csvKeyName_ = ""; csvColumnName_ = com.google.protobuf.LazyStringArrayList.EMPTY; otherCsvFileName_ = ""; otherCsvKeyName_ = ""; otherCsvColumnName_ = com.google.protobuf.LazyStringArrayList.EMPTY; entityName_ = ""; entityId_ = ""; entityValue_ = ""; altEntityName_ = ""; altEntityId_ = ""; altEntityValue_ = ""; parentEntityName_ = ""; parentEntityId_ = ""; value_ = ""; altValue_ = ""; } @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance( UnusedPrivateParameter unused) { return new GtfsProblem(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private GtfsProblem( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 8: { int rawValue = input.readEnum(); @SuppressWarnings("deprecation") org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Type value = org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Type.valueOf(rawValue); if (value == null) { unknownFields.mergeVarintField(1, rawValue); } else { bitField0_ |= 0x00000001; type_ = rawValue; } break; } case 16: { int rawValue = input.readEnum(); @SuppressWarnings("deprecation") org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Severity value = org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Severity.valueOf(rawValue); if (value == null) { unknownFields.mergeVarintField(2, rawValue); } else { bitField0_ |= 0x00000002; severity_ = rawValue; } break; } case 26: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000004; csvFileName_ = bs; break; } case 34: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000008; csvKeyName_ = bs; break; } case 42: { com.google.protobuf.ByteString bs = input.readBytes(); if (!((mutable_bitField0_ & 0x00000010) != 0)) { csvColumnName_ = new com.google.protobuf.LazyStringArrayList(); mutable_bitField0_ |= 0x00000010; } csvColumnName_.add(bs); break; } case 48: { bitField0_ |= 0x00000040; entityRow_ = input.readUInt32(); break; } case 58: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000080; entityName_ = bs; break; } case 66: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000100; entityId_ = bs; break; } case 74: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000200; entityValue_ = bs; break; } case 80: { bitField0_ |= 0x00000800; altEntityRow_ = input.readUInt32(); break; } case 90: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00001000; altEntityName_ = bs; break; } case 98: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00002000; altEntityId_ = bs; break; } case 106: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00004000; altEntityValue_ = bs; break; } case 114: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00080000; value_ = bs; break; } case 122: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000010; otherCsvFileName_ = bs; break; } case 130: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000020; otherCsvKeyName_ = bs; break; } case 138: { com.google.protobuf.ByteString bs = input.readBytes(); if (!((mutable_bitField0_ & 0x00000080) != 0)) { otherCsvColumnName_ = new com.google.protobuf.LazyStringArrayList(); mutable_bitField0_ |= 0x00000080; } otherCsvColumnName_.add(bs); break; } case 144: { bitField0_ |= 0x00010000; parentEntityRow_ = input.readUInt32(); break; } case 154: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00020000; parentEntityName_ = bs; break; } case 162: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00040000; parentEntityId_ = bs; break; } case 170: { org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.Builder subBuilder = null; if (((bitField0_ & 0x00000400) != 0)) { subBuilder = entityLocation_.toBuilder(); } entityLocation_ = input.readMessage(org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(entityLocation_); entityLocation_ = subBuilder.buildPartial(); } bitField0_ |= 0x00000400; break; } case 178: { org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.Builder subBuilder = null; if (((bitField0_ & 0x00008000) != 0)) { subBuilder = altEntityLocation_.toBuilder(); } altEntityLocation_ = input.readMessage(org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(altEntityLocation_); altEntityLocation_ = subBuilder.buildPartial(); } bitField0_ |= 0x00008000; break; } case 186: { com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00100000; altValue_ = bs; break; } case 193: { bitField0_ |= 0x00200000; importance_ = input.readDouble(); break; } default: { if (!parseUnknownField( input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000010) != 0)) { csvColumnName_ = csvColumnName_.getUnmodifiableView(); } if (((mutable_bitField0_ & 0x00000080) != 0)) { otherCsvColumnName_ = otherCsvColumnName_.getUnmodifiableView(); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.internal_static_outputProto_GtfsProblem_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.internal_static_outputProto_GtfsProblem_fieldAccessorTable .ensureFieldAccessorsInitialized( org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.class, org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Builder.class); } /** * <pre> * The type of validation problem. * Next tag: 336 * </pre> * <p> * Protobuf enum {@code outputProto.GtfsProblem.Type} */ public enum Type implements com.google.protobuf.ProtocolMessageEnum { /** * <pre> * When an unknown CsvErrorProto::Type is encountered. * </pre> * * <code>TYPE_CSV_UNKNOWN_ERROR = 1;</code> */ TYPE_CSV_UNKNOWN_ERROR(1), /** * <pre> * The table file is missing. * </pre> * * <code>TYPE_CSV_MISSING_TABLE = 10;</code> */ TYPE_CSV_MISSING_TABLE(10), /** * <pre> * The input file is not a well-formed csv. See csvparser.h for * requirements (note that duplicate column names in the header line trigger * this error). * </pre> * * <code>TYPE_CSV_SPLITTING_ERROR = 20;</code> */ TYPE_CSV_SPLITTING_ERROR(20), /** * <pre> * The input file contained a null character ('&#92;0'). * </pre> * * <code>TYPE_CSV_CONTAINS_NULL_CHARACTER = 21;</code> */ TYPE_CSV_CONTAINS_NULL_CHARACTER(21), /** * <pre> * Deprecated - There was way for these to be generated as internal errors * in ConvertEncodingBufferToUTF8String are CHECKed as of 2007. * </pre> * * <code>TYPE_CSV_UTF8_CONVERSION_ERROR = 22 [deprecated = true];</code> */ @java.lang.Deprecated TYPE_CSV_UTF8_CONVERSION_ERROR(22), /** * <pre> * The specified lines have characters that are not valid UTF-8. * </pre> * * <code>TYPE_CSV_INVALID_UTF8 = 23;</code> */ TYPE_CSV_INVALID_UTF8(23), /** * <pre> * The input file CSV header has the same column name repeated. * </pre> * * <code>TYPE_CSV_DUPLICATE_COLUMN_NAME = 24;</code> */ TYPE_CSV_DUPLICATE_COLUMN_NAME(24), /** * <pre> * A row in the input file has a different number of values than specified * by the CSV header. * </pre> * * <code>TYPE_CSV_BAD_NUMBER_OF_VALUES = 25;</code> */ TYPE_CSV_BAD_NUMBER_OF_VALUES(25), /** * <pre> * The input file is corrupted and cannot be read properly. * </pre> * * <code>TYPE_CSV_FILE_CORRUPTED = 26;</code> */ TYPE_CSV_FILE_CORRUPTED(26), /** * <pre> * A file was in an unexpected location * </pre> * * <code>TYPE_CSV_UNEXPECTED_LOCATION = 27;</code> */ TYPE_CSV_UNEXPECTED_LOCATION(27), /** * <pre> * The column is missing in the input file, either the name cannot be found * in the header line, or the number is out of bound. * </pre> * * <code>TYPE_CSV_MISSING_COLUMN = 30;</code> */ TYPE_CSV_MISSING_COLUMN(30), /** * <pre> * The key was not properly added to its table, probably because one or more * of its columns are missing. * </pre> * * <code>TYPE_CSV_MISSING_KEY = 31;</code> */ TYPE_CSV_MISSING_KEY(31), /** * <pre> * The input rows are not properly sorted on the given key. * </pre> * * <code>TYPE_CSV_UNSORTED = 40;</code> */ TYPE_CSV_UNSORTED(40), /** * <pre> * The values in the given column of the input rows are not 1..n when * grouped on some key. * </pre> * * <code>TYPE_CSV_NON_CONTIGUOUS = 41;</code> */ TYPE_CSV_NON_CONTIGUOUS(41), /** * <pre> * The number of data rows of the table is not as required. * </pre> * * <code>TYPE_CSV_BAD_NUMBER_OF_ROWS = 42;</code> */ TYPE_CSV_BAD_NUMBER_OF_ROWS(42), /** * <pre> * The values in the given column of the input rows do not represent valid * values according to the column type, or have values that conflict with * others according to the requirements on the input. * </pre> * * <code>TYPE_CSV_VALUE_ERROR = 50;</code> */ TYPE_CSV_VALUE_ERROR(50), /** * <pre> * The values in the given column of the input rows do not match some * regular expression. * </pre> * * <code>TYPE_CSV_REGEXP_MISMATCH = 51;</code> */ TYPE_CSV_REGEXP_MISMATCH(51), /** * <pre> * The values in the given column of the input rows are out of range. * </pre> * * <code>TYPE_CSV_OUT_OF_RANGE = 52;</code> */ TYPE_CSV_OUT_OF_RANGE(52), /** * <pre> * The given column is null in the input rows, even though values are * required. * </pre> * * <code>TYPE_CSV_MISSING_VALUE = 53;</code> */ TYPE_CSV_MISSING_VALUE(53), /** * <pre> * The values of the given key and rows of one table cannot be found a * values of the given key in another table. This is the case when a foreign * key of one table references a non-existing value in its original table. * </pre> * * <code>TYPE_CSV_MISSING_FOREIGN_KEY_VALUE = 61;</code> */ TYPE_CSV_MISSING_FOREIGN_KEY_VALUE(61), /** * <pre> * The values of the given key and rows are duplicates. The first occurrence * of a value is not included in the duplicates list. * </pre> * * <code>TYPE_CSV_DUPLICATE_KEY_VALUE = 62;</code> */ TYPE_CSV_DUPLICATE_KEY_VALUE(62), /** * <pre> * The values of the given key and rows reference a table that does not * exist. * </pre> * * <code>TYPE_CSV_MISSING_KEY_TABLE = 63;</code> */ TYPE_CSV_MISSING_KEY_TABLE(63), /** * <pre> * The file size is too large to process (&gt;=4GiB). * </pre> * * <code>TYPE_CSV_FILE_TOO_LARGE = 64;</code> */ TYPE_CSV_FILE_TOO_LARGE(64), /** * <code>TYPE_AGENCIES_WITH_DIFFERENT_LANGUAGES = 249;</code> */ TYPE_AGENCIES_WITH_DIFFERENT_LANGUAGES(249), /** * <code>TYPE_AGENCIES_WITH_DIFFERENT_TIMEZONES = 231;</code> */ TYPE_AGENCIES_WITH_DIFFERENT_TIMEZONES(231), /** * <code>TYPE_AGENCY_LANG_AND_FEED_LANG_MISMATCH = 232;</code> */ TYPE_AGENCY_LANG_AND_FEED_LANG_MISMATCH(232), /** * <code>TYPE_AMBIGUOUS_STOP_STATION_TRANSFERS = 286;</code> */ TYPE_AMBIGUOUS_STOP_STATION_TRANSFERS(286), /** * <code>TYPE_BLOCK_TRIPS_WITH_INCONSISTENT_ROUTE_TYPES = 291;</code> */ TYPE_BLOCK_TRIPS_WITH_INCONSISTENT_ROUTE_TYPES(291), /** * <code>TYPE_BLOCK_TRIPS_WITH_OVERLAPPING_STOP_TIMES = 241;</code> */ TYPE_BLOCK_TRIPS_WITH_OVERLAPPING_STOP_TIMES(241), /** * <code>TYPE_CALENDAR_START_AND_END_DATE_OUT_OF_ORDER = 240;</code> */ TYPE_CALENDAR_START_AND_END_DATE_OUT_OF_ORDER(240), /** * <code>TYPE_CALENDAR_HAS_NO_ACTIVE_DAYS_OF_WEEK = 228;</code> */ TYPE_CALENDAR_HAS_NO_ACTIVE_DAYS_OF_WEEK(228), /** * <code>TYPE_LOCATION_WITHOUT_PARENT_STATION = 203;</code> */ TYPE_LOCATION_WITHOUT_PARENT_STATION(203), /** * <code>TYPE_FARE_ATTRIBUTES_INVALID_CURRENCY_TYPE = 220;</code> */ TYPE_FARE_ATTRIBUTES_INVALID_CURRENCY_TYPE(220), /** * <code>TYPE_FARE_ATTRIBUTES_AGENCY_ID_REQUIRED = 221;</code> */ TYPE_FARE_ATTRIBUTES_AGENCY_ID_REQUIRED(221), /** * <code>TYPE_FARE_RULE_WITH_BOTH_ROUTE_ID_REFERENCES = 290;</code> */ TYPE_FARE_RULE_WITH_BOTH_ROUTE_ID_REFERENCES(290), /** * <code>TYPE_FARES_WITH_AND_WITHOUT_RULES = 264;</code> */ TYPE_FARES_WITH_AND_WITHOUT_RULES(264), /** * <code>TYPE_FAST_TRAVEL_BETWEEN_CONSECUTIVE_STOPS = 256;</code> */ TYPE_FAST_TRAVEL_BETWEEN_CONSECUTIVE_STOPS(256), /** * <code>TYPE_FAST_TRAVEL_BETWEEN_FAR_STOPS = 297;</code> */ TYPE_FAST_TRAVEL_BETWEEN_FAR_STOPS(297), /** * <code>TYPE_FEED_EXPIRATION_DATE = 233;</code> */ TYPE_FEED_EXPIRATION_DATE(233), /** * <code>TYPE_FEED_FUTURE_SERVICE = 227;</code> */ TYPE_FEED_FUTURE_SERVICE(227), /** * <code>TYPE_FEED_HAS_NO_LANGUAGE = 266;</code> */ TYPE_FEED_HAS_NO_LANGUAGE(266), /** * <code>TYPE_FEED_HAS_NO_SERVICE_DATE_EXCEPTIONS = 225;</code> */ TYPE_FEED_HAS_NO_SERVICE_DATE_EXCEPTIONS(225), /** * <code>TYPE_FEED_HAS_NO_SERVICE_DATES = 224;</code> */ TYPE_FEED_HAS_NO_SERVICE_DATES(224), /** * <pre> * SUSPICIOUS * </pre> * * <code>TYPE_FEED_HAS_VERY_SHORT_SERVICE = 295;</code> */ TYPE_FEED_HAS_VERY_SHORT_SERVICE(295), /** * <pre> * ERROR * </pre> * * <code>TYPE_EXPIRED_FEED_HAS_VERY_SHORT_SERVICE = 333;</code> */ TYPE_EXPIRED_FEED_HAS_VERY_SHORT_SERVICE(333), /** * <code>TYPE_FEED_INFO_START_AND_END_DATE_OUT_OF_ORDER = 222;</code> */ TYPE_FEED_INFO_START_AND_END_DATE_OUT_OF_ORDER(222), /** * <code>TYPE_FEED_INFO_MORE_THAN_ONE_ENTRY = 223;</code> */ TYPE_FEED_INFO_MORE_THAN_ONE_ENTRY(223), /** * <pre> * SUSPICIOUS * </pre> * * <code>TYPE_FEED_INFO_EARLY_START = 296;</code> */ TYPE_FEED_INFO_EARLY_START(296), /** * <code>TYPE_FEED_SERVICE_DATE_GAP = 230;</code> */ TYPE_FEED_SERVICE_DATE_GAP(230), /** * <code>TYPE_FREQUENCY_HEADWAY_SECONDS_GREATER_THAN_INTERVAL = 280;</code> */ TYPE_FREQUENCY_HEADWAY_SECONDS_GREATER_THAN_INTERVAL(280), /** * <code>TYPE_FREQUENCY_HEADWAY_SECONDS_TOO_HIGH = 313;</code> */ TYPE_FREQUENCY_HEADWAY_SECONDS_TOO_HIGH(313), /** * <code>TYPE_FREQUENCY_START_AND_END_TIME_ARE_EQUAL = 261;</code> */ TYPE_FREQUENCY_START_AND_END_TIME_ARE_EQUAL(261), /** * <code>TYPE_FREQUENCY_START_AND_END_TIME_OUT_OF_ORDER = 262;</code> */ TYPE_FREQUENCY_START_AND_END_TIME_OUT_OF_ORDER(262), /** * <code>TYPE_FREQUENCY_BASED_TRIP_TO_TRIP_TRANSFER = 284;</code> */ TYPE_FREQUENCY_BASED_TRIP_TO_TRIP_TRANSFER(284), /** * <code>TYPE_INVALID_LANGUAGE_CODE = 242;</code> */ TYPE_INVALID_LANGUAGE_CODE(242), /** * <code>TYPE_INVALID_LATITUDE = 243;</code> */ TYPE_INVALID_LATITUDE(243), /** * <code>TYPE_INVALID_LONGITUDE = 244;</code> */ TYPE_INVALID_LONGITUDE(244), /** * <code>TYPE_INVALID_ROUTE_TYPE = 263;</code> */ TYPE_INVALID_ROUTE_TYPE(263), /** * <code>TYPE_INVALID_TIMEZONE = 245;</code> */ TYPE_INVALID_TIMEZONE(245), /** * <code>TYPE_INVALID_URL = 246;</code> */ TYPE_INVALID_URL(246), /** * <code>TYPE_MULTIPLE_FARES_WITHOUT_RULES = 265;</code> */ TYPE_MULTIPLE_FARES_WITHOUT_RULES(265), /** * <code>TYPE_OVERLAPPING_FREQUENCY = 201;</code> */ TYPE_OVERLAPPING_FREQUENCY(201), /** * <code>TYPE_OVERLAPPING_FREQUENCY_FOR_TRIP_DUPLICATES = 281;</code> */ TYPE_OVERLAPPING_FREQUENCY_FOR_TRIP_DUPLICATES(281), /** * <code>TYPE_PARENT_STATION_WITH_WRONG_LOCATION_TYPE = 289;</code> */ TYPE_PARENT_STATION_WITH_WRONG_LOCATION_TYPE(289), /** * <code>TYPE_POINT_NEAR_ORIGIN = 293;</code> */ TYPE_POINT_NEAR_ORIGIN(293), /** * <code>TYPE_POINT_NEAR_POLE = 294;</code> */ TYPE_POINT_NEAR_POLE(294), /** * <code>TYPE_ROUTE_COLOR_CONTRAST = 207;</code> */ TYPE_ROUTE_COLOR_CONTRAST(207), /** * <code>TYPE_ROUTE_NAME_REUSED = 226;</code> */ TYPE_ROUTE_NAME_REUSED(226), /** * <code>TYPE_ROUTE_SHORT_NAME_EQUALS_LONG_NAME = 209;</code> */ TYPE_ROUTE_SHORT_NAME_EQUALS_LONG_NAME(209), /** * <code>TYPE_ROUTE_SHORT_NAME_IS_CONTAINED_IN_LONG_NAME = 210;</code> */ TYPE_ROUTE_SHORT_NAME_IS_CONTAINED_IN_LONG_NAME(210), /** * <code>TYPE_ROUTE_SHORT_NAME_IS_TOO_LONG = 208;</code> */ TYPE_ROUTE_SHORT_NAME_IS_TOO_LONG(208), /** * <code>TYPE_ROUTE_SHORT_NAME_OR_LONG_NAME_REQUIRED = 211;</code> */ TYPE_ROUTE_SHORT_NAME_OR_LONG_NAME_REQUIRED(211), /** * <code>TYPE_ROUTE_BOTH_SHORT_NAME_AND_LONG_NAME_PRESENT = 314;</code> */ TYPE_ROUTE_BOTH_SHORT_NAME_AND_LONG_NAME_PRESENT(314), /** * <code>TYPE_ROUTE_LONG_NAME_HAS_ABBREVIATIONS = 315;</code> */ TYPE_ROUTE_LONG_NAME_HAS_ABBREVIATIONS(315), /** * <code>TYPE_ROUTE_NAME_NOT_CAPITALIZED = 316;</code> */ TYPE_ROUTE_NAME_NOT_CAPITALIZED(316), /** * <code>TYPE_ROUTE_NAME_HAS_SPECIAL_CHARACTERS = 321;</code> */ TYPE_ROUTE_NAME_HAS_SPECIAL_CHARACTERS(321), /** * <code>TYPE_SERVICE_ID_HAS_NO_ACTIVE_DAYS = 229;</code> */ TYPE_SERVICE_ID_HAS_NO_ACTIVE_DAYS(229), /** * <code>TYPE_SHAPE_WITH_PARTIAL_SHAPE_DIST_TRAVELED = 269;</code> */ TYPE_SHAPE_WITH_PARTIAL_SHAPE_DIST_TRAVELED(269), /** * <code>TYPE_STATION_UNUSED = 234;</code> */ TYPE_STATION_UNUSED(234), /** * <code>TYPE_STATION_WITH_PARENT_STATION = 202;</code> */ TYPE_STATION_WITH_PARENT_STATION(202), /** * <code>TYPE_LOCATION_WITH_STOP_TIME_OVERRIDES = 303;</code> */ TYPE_LOCATION_WITH_STOP_TIME_OVERRIDES(303), /** * <code>TYPE_LOCATION_WITH_STOP_TIMES = 235;</code> */ TYPE_LOCATION_WITH_STOP_TIMES(235), /** * <code>TYPE_STATIONS_TOO_CLOSE = 236;</code> */ TYPE_STATIONS_TOO_CLOSE(236), /** * <code>TYPE_STOP_HAS_TOO_MANY_MATCHES_FOR_SHAPE = 250;</code> */ TYPE_STOP_HAS_TOO_MANY_MATCHES_FOR_SHAPE(250), /** * <code>TYPE_STOP_TIME_OVERRIDES_CONFLICTING = 298;</code> */ TYPE_STOP_TIME_OVERRIDES_CONFLICTING(298), /** * <code>TYPE_STOP_TIME_OVERRIDES_NOT_SAME_PARENT_STATION = 299;</code> */ TYPE_STOP_TIME_OVERRIDES_NOT_SAME_PARENT_STATION(299), /** * <code>TYPE_STOP_TIME_OVERRIDES_NOT_USED = 300;</code> */ TYPE_STOP_TIME_OVERRIDES_NOT_USED(300), /** * <code>TYPE_STOP_TIME_OVERRIDES_WITH_UNKNOWN_SERVICE_ID = 301;</code> */ TYPE_STOP_TIME_OVERRIDES_WITH_UNKNOWN_SERVICE_ID(301), /** * <code>TYPE_STOP_TIME_OVERRIDES_WITH_UNKNOWN_STOP_SEQUENCE = 302;</code> */ TYPE_STOP_TIME_OVERRIDES_WITH_UNKNOWN_STOP_SEQUENCE(302), /** * <code>TYPE_STOP_TIMES_STOP_HEADSIGN_EQUALS_STOP_NAME = 260;</code> */ TYPE_STOP_TIMES_STOP_HEADSIGN_EQUALS_STOP_NAME(260), /** * <code>TYPE_STOP_TIMES_INCORRECT_STOP_HEADSIGN = 318;</code> */ TYPE_STOP_TIMES_INCORRECT_STOP_HEADSIGN(318), /** * <code>TYPE_STOP_TIMES_WITH_ARRIVAL_BEFORE_PREVIOUS_DEPARTURE_TIME = 283;</code> */ TYPE_STOP_TIMES_WITH_ARRIVAL_BEFORE_PREVIOUS_DEPARTURE_TIME(283), /** * <code>TYPE_STOP_TIMES_WITH_DEPARTURE_BEFORE_ARRIVAL_TIME = 275;</code> */ TYPE_STOP_TIMES_WITH_DEPARTURE_BEFORE_ARRIVAL_TIME(275), /** * <code>TYPE_STOP_TIMES_WITH_LONG_ARRIVAL_INTERVAL = 254;</code> */ TYPE_STOP_TIMES_WITH_LONG_ARRIVAL_INTERVAL(254), /** * <code>TYPE_STOP_TIMES_WITH_LONG_DEPARTURE_ARRIVAL_INTERVAL = 255;</code> */ TYPE_STOP_TIMES_WITH_LONG_DEPARTURE_ARRIVAL_INTERVAL(255), /** * <code>TYPE_STOP_TIMES_WITH_ONLY_ARRIVAL_OR_DEPARTURE_TIME_SPECIFIED = 273;</code> */ TYPE_STOP_TIMES_WITH_ONLY_ARRIVAL_OR_DEPARTURE_TIME_SPECIFIED(273), /** * <code>TYPE_STOP_TOO_CLOSE_TO_STATION = 237;</code> */ TYPE_STOP_TOO_CLOSE_TO_STATION(237), /** * <code>TYPE_STOP_TOO_FAR_FROM_PARENT_STATION = 253;</code> */ TYPE_STOP_TOO_FAR_FROM_PARENT_STATION(253), /** * <code>TYPE_STOP_TOO_FAR_FROM_SHAPE = 251;</code> */ TYPE_STOP_TOO_FAR_FROM_SHAPE(251), /** * <code>TYPE_STOP_TOO_FAR_FROM_SHAPE_USING_USER_DISTANCE = 292;</code> */ TYPE_STOP_TOO_FAR_FROM_SHAPE_USING_USER_DISTANCE(292), /** * <code>TYPE_STOP_UNUSED = 238;</code> */ TYPE_STOP_UNUSED(238), /** * <code>TYPE_STOP_WITH_PARENT_STATION_AND_TIMEZONE = 204;</code> */ TYPE_STOP_WITH_PARENT_STATION_AND_TIMEZONE(204), /** * <code>TYPE_STOP_WITH_SAME_NAME_AND_DESCRIPTION = 206;</code> */ TYPE_STOP_WITH_SAME_NAME_AND_DESCRIPTION(206), /** * <code>TYPE_STOP_NAME_HAS_STOP_CODE_OR_ID = 319;</code> */ TYPE_STOP_NAME_HAS_STOP_CODE_OR_ID(319), /** * <code>TYPE_STOP_NAME_HAS_SPECIAL_CHARACTERS = 320;</code> */ TYPE_STOP_NAME_HAS_SPECIAL_CHARACTERS(320), /** * <code>TYPE_STOP_HEADSIGN_HAS_SPECIAL_CHARACTERS = 322;</code> */ TYPE_STOP_HEADSIGN_HAS_SPECIAL_CHARACTERS(322), /** * <code>TYPE_STOPS_MATCH_SHAPE_OUT_OF_ORDER = 252;</code> */ TYPE_STOPS_MATCH_SHAPE_OUT_OF_ORDER(252), /** * <code>TYPE_STOPS_TOO_CLOSE = 239;</code> */ TYPE_STOPS_TOO_CLOSE(239), /** * <code>TYPE_STOP_NAME_NOT_CAPITALIZED = 317;</code> */ TYPE_STOP_NAME_NOT_CAPITALIZED(317), /** * <code>TYPE_PLATFORM_CODE_IS_MISSING = 332;</code> */ TYPE_PLATFORM_CODE_IS_MISSING(332), /** * <code>TYPE_TOO_MANY_CONSECUTIVE_STOP_TIMES_WITH_SAME_TIME = 257;</code> */ TYPE_TOO_MANY_CONSECUTIVE_STOP_TIMES_WITH_SAME_TIME(257), /** * <code>TYPE_TOO_MANY_ENTRIES = 305;</code> */ TYPE_TOO_MANY_ENTRIES(305), /** * <code>TYPE_TRANSFER_DISTANCE_IS_VERY_LARGE = 218;</code> */ TYPE_TRANSFER_DISTANCE_IS_VERY_LARGE(218), /** * <code>TYPE_TRANSFER_DUPLICATE = 258;</code> */ TYPE_TRANSFER_DUPLICATE(258), /** * <code>TYPE_TRANSFER_WALKING_SPEED_IS_TOO_FAST = 219;</code> */ TYPE_TRANSFER_WALKING_SPEED_IS_TOO_FAST(219), /** * <code>TYPE_TRANSFER_MIN_TRANSFER_TIME_AND_INVALID_TYPE = 282;</code> */ TYPE_TRANSFER_MIN_TRANSFER_TIME_AND_INVALID_TYPE(282), /** * <code>TYPE_TRANSFER_MIN_TRANSFER_TIME_IS_MISSING = 288;</code> */ TYPE_TRANSFER_MIN_TRANSFER_TIME_IS_MISSING(288), /** * <code>TYPE_TRANSFER_MIN_TRANSFER_TIME_IS_NEGATIVE = 216;</code> */ TYPE_TRANSFER_MIN_TRANSFER_TIME_IS_NEGATIVE(216), /** * <code>TYPE_TRANSFER_MIN_TRANSFER_TIME_IS_VERY_LARGE = 217;</code> */ TYPE_TRANSFER_MIN_TRANSFER_TIME_IS_VERY_LARGE(217), /** * <code>TYPE_TRANSFER_VIA_ENTRANCE = 285;</code> */ TYPE_TRANSFER_VIA_ENTRANCE(285), /** * <code>TYPE_TRANSFER_WITH_INVALID_ROUTE_AND_TRIP = 287;</code> */ TYPE_TRANSFER_WITH_INVALID_ROUTE_AND_TRIP(287), /** * <code>TYPE_TRIP_DUPLICATES = 276;</code> */ TYPE_TRIP_DUPLICATES(276), /** * <code>TYPE_TRIP_HEADSIGN_CONTAINS_ROUTE_LONG_NAME = 278;</code> */ TYPE_TRIP_HEADSIGN_CONTAINS_ROUTE_LONG_NAME(278), /** * <code>TYPE_TRIP_HEADSIGN_CONTAINS_ROUTE_SHORT_NAME = 277;</code> */ TYPE_TRIP_HEADSIGN_CONTAINS_ROUTE_SHORT_NAME(277), /** * <code>TYPE_TRIP_LENGTH_TOO_LONG = 309;</code> */ TYPE_TRIP_LENGTH_TOO_LONG(309), /** * <code>TYPE_TRIP_STARTS_LATE = 310;</code> */ TYPE_TRIP_STARTS_LATE(310), /** * <code>TYPE_TRIP_STARTS_TOO_LATE = 311;</code> */ TYPE_TRIP_STARTS_TOO_LATE(311), /** * <code>TYPE_TRIP_WITH_NO_TIME_FOR_FIRST_STOP_TIME = 212;</code> */ TYPE_TRIP_WITH_NO_TIME_FOR_FIRST_STOP_TIME(212), /** * <code>TYPE_TRIP_WITH_NO_TIME_FOR_LAST_STOP_TIME = 213;</code> */ TYPE_TRIP_WITH_NO_TIME_FOR_LAST_STOP_TIME(213), /** * <code>TYPE_TRIP_WITH_NO_USABLE_STOPS = 267;</code> */ TYPE_TRIP_WITH_NO_USABLE_STOPS(267), /** * <code>TYPE_TRIP_WITH_OUT_OF_ORDER_ARRIVAL_TIME = 214;</code> */ TYPE_TRIP_WITH_OUT_OF_ORDER_ARRIVAL_TIME(214), /** * <code>TYPE_TRIP_WITH_OUT_OF_ORDER_DEPARTURE_TIME = 215;</code> */ TYPE_TRIP_WITH_OUT_OF_ORDER_DEPARTURE_TIME(215), /** * <code>TYPE_TRIP_WITH_OUT_OF_ORDER_SHAPE_DIST_TRAVELED = 248;</code> */ TYPE_TRIP_WITH_OUT_OF_ORDER_SHAPE_DIST_TRAVELED(248), /** * <code>TYPE_TRIP_WITH_PARTIAL_SHAPE_DIST_TRAVELED = 270;</code> */ TYPE_TRIP_WITH_PARTIAL_SHAPE_DIST_TRAVELED(270), /** * <code>TYPE_TRIP_WITH_SHAPE_DIST_TRAVELED_BUT_NO_SHAPE = 271;</code> */ TYPE_TRIP_WITH_SHAPE_DIST_TRAVELED_BUT_NO_SHAPE(271), /** * <code>TYPE_TRIP_WITH_SHAPE_DIST_TRAVELED_BUT_NO_SHAPE_DISTANCES = 272;</code> */ TYPE_TRIP_WITH_SHAPE_DIST_TRAVELED_BUT_NO_SHAPE_DISTANCES(272), /** * <code>TYPE_TRIP_WITH_UNKNOWN_SERVICE_ID = 268;</code> */ TYPE_TRIP_WITH_UNKNOWN_SERVICE_ID(268), /** * <code>TYPE_TRIP_WITH_DUPLICATE_STOPS = 312;</code> */ TYPE_TRIP_WITH_DUPLICATE_STOPS(312), /** * <code>TYPE_TRIP_HEADSIGN_HAS_SPECIAL_CHARACTERS = 323;</code> */ TYPE_TRIP_HEADSIGN_HAS_SPECIAL_CHARACTERS(323), /** * <code>TYPE_UNKNOWN_COLUMN = 274;</code> */ TYPE_UNKNOWN_COLUMN(274), /** * <code>TYPE_UNKNOWN_FILE = 259;</code> */ TYPE_UNKNOWN_FILE(259), /** * <pre> * Impossible to open feed zip archive * </pre> * * <code>TYPE_ARCHIVE_CORRUPTED = 306;</code> */ TYPE_ARCHIVE_CORRUPTED(306), /** * <pre> * The current feed is identical to the last valid feed * </pre> * * <code>TYPE_DUPLICATE_FEED = 307;</code> */ TYPE_DUPLICATE_FEED(307), /** * <pre> * Feed doesn't contain stops. * </pre> * * <code>TYPE_EMPTY_STOPS = 308;</code> */ TYPE_EMPTY_STOPS(308), /** * <pre> * frequencies.txt contains mixed values of exact_times for a trip. * </pre> * * <code>TYPE_INCONSISTENT_EXACT_TIMES_FOR_TRIP = 324;</code> */ TYPE_INCONSISTENT_EXACT_TIMES_FOR_TRIP(324), /** * <pre> * Deprecated - pathway_id is always required and is checked by parser. * </pre> * * <code>TYPE_PATHWAY_MISSING_PATHWAY_ID = 325 [deprecated = true];</code> */ @java.lang.Deprecated TYPE_PATHWAY_MISSING_PATHWAY_ID(325), /** * <pre> * A reciprocal pathway is missing. * </pre> * * <code>TYPE_PATHWAY_MISSING_RECIPROCAL = 326;</code> */ TYPE_PATHWAY_MISSING_RECIPROCAL(326), /** * <pre> * A location (stop, entrance or generic node) has no pathway but some other * locations in the same parent station have pathways. * </pre> * * <code>TYPE_PATHWAY_DANGLING_LOCATION = 327;</code> */ TYPE_PATHWAY_DANGLING_LOCATION(327), /** * <pre> * A platform has pathways but is not connected to any entrance, even * indirectly. * </pre> * * <code>TYPE_PATHWAY_PLATFORM_WITHOUT_ENTRANCES = 328;</code> */ TYPE_PATHWAY_PLATFORM_WITHOUT_ENTRANCES(328), /** * <pre> * A platform which already has boarding areas may not have pathways. * </pre> * * <code>TYPE_PATHWAY_WRONG_PLATFORM_ENDPOINT = 329;</code> */ TYPE_PATHWAY_WRONG_PLATFORM_ENDPOINT(329), /** * <pre> * A column is missing from pathways.txt. This column is required by Core * GTFS-Pathways (2019) but not by the old spec (2010). * </pre> * * <code>TYPE_PATHWAY_MISSING_COLUMN = 330;</code> */ TYPE_PATHWAY_MISSING_COLUMN(330), /** * <pre> * A value is missing from pathways.txt. This value is required by Core * GTFS-Pathways (2019) but not by the old spec (2010). * </pre> * * <code>TYPE_PATHWAY_MISSING_VALUE = 331;</code> */ TYPE_PATHWAY_MISSING_VALUE(331), /** * <pre> * A column is missing from attributions.txt. * </pre> * * <code>TYPE_ATTRIBUTION_MISSING_COLUMN = 334;</code> */ TYPE_ATTRIBUTION_MISSING_COLUMN(334), /** * <pre> * A role value is missing from attributions.txt. * </pre> * * <code>TYPE_ATTRIBUTION_MISSING_ROLE = 335;</code> */ TYPE_ATTRIBUTION_MISSING_ROLE(335), ; /** * <pre> * When an unknown CsvErrorProto::Type is encountered. * </pre> * * <code>TYPE_CSV_UNKNOWN_ERROR = 1;</code> */ public static final int TYPE_CSV_UNKNOWN_ERROR_VALUE = 1; /** * <pre> * The table file is missing. * </pre> * * <code>TYPE_CSV_MISSING_TABLE = 10;</code> */ public static final int TYPE_CSV_MISSING_TABLE_VALUE = 10; /** * <pre> * The input file is not a well-formed csv. See csvparser.h for * requirements (note that duplicate column names in the header line trigger * this error). * </pre> * * <code>TYPE_CSV_SPLITTING_ERROR = 20;</code> */ public static final int TYPE_CSV_SPLITTING_ERROR_VALUE = 20; /** * <pre> * The input file contained a null character ('&#92;0'). * </pre> * * <code>TYPE_CSV_CONTAINS_NULL_CHARACTER = 21;</code> */ public static final int TYPE_CSV_CONTAINS_NULL_CHARACTER_VALUE = 21; /** * <pre> * Deprecated - There was way for these to be generated as internal errors * in ConvertEncodingBufferToUTF8String are CHECKed as of 2007. * </pre> * * <code>TYPE_CSV_UTF8_CONVERSION_ERROR = 22 [deprecated = true];</code> */ public static final int TYPE_CSV_UTF8_CONVERSION_ERROR_VALUE = 22; /** * <pre> * The specified lines have characters that are not valid UTF-8. * </pre> * * <code>TYPE_CSV_INVALID_UTF8 = 23;</code> */ public static final int TYPE_CSV_INVALID_UTF8_VALUE = 23; /** * <pre> * The input file CSV header has the same column name repeated. * </pre> * * <code>TYPE_CSV_DUPLICATE_COLUMN_NAME = 24;</code> */ public static final int TYPE_CSV_DUPLICATE_COLUMN_NAME_VALUE = 24; /** * <pre> * A row in the input file has a different number of values than specified * by the CSV header. * </pre> * * <code>TYPE_CSV_BAD_NUMBER_OF_VALUES = 25;</code> */ public static final int TYPE_CSV_BAD_NUMBER_OF_VALUES_VALUE = 25; /** * <pre> * The input file is corrupted and cannot be read properly. * </pre> * * <code>TYPE_CSV_FILE_CORRUPTED = 26;</code> */ public static final int TYPE_CSV_FILE_CORRUPTED_VALUE = 26; /** * <pre> * A file was in an unexpected location * </pre> * * <code>TYPE_CSV_UNEXPECTED_LOCATION = 27;</code> */ public static final int TYPE_CSV_UNEXPECTED_LOCATION_VALUE = 27; /** * <pre> * The column is missing in the input file, either the name cannot be found * in the header line, or the number is out of bound. * </pre> * * <code>TYPE_CSV_MISSING_COLUMN = 30;</code> */ public static final int TYPE_CSV_MISSING_COLUMN_VALUE = 30; /** * <pre> * The key was not properly added to its table, probably because one or more * of its columns are missing. * </pre> * * <code>TYPE_CSV_MISSING_KEY = 31;</code> */ public static final int TYPE_CSV_MISSING_KEY_VALUE = 31; /** * <pre> * The input rows are not properly sorted on the given key. * </pre> * * <code>TYPE_CSV_UNSORTED = 40;</code> */ public static final int TYPE_CSV_UNSORTED_VALUE = 40; /** * <pre> * The values in the given column of the input rows are not 1..n when * grouped on some key. * </pre> * * <code>TYPE_CSV_NON_CONTIGUOUS = 41;</code> */ public static final int TYPE_CSV_NON_CONTIGUOUS_VALUE = 41; /** * <pre> * The number of data rows of the table is not as required. * </pre> * * <code>TYPE_CSV_BAD_NUMBER_OF_ROWS = 42;</code> */ public static final int TYPE_CSV_BAD_NUMBER_OF_ROWS_VALUE = 42; /** * <pre> * The values in the given column of the input rows do not represent valid * values according to the column type, or have values that conflict with * others according to the requirements on the input. * </pre> * * <code>TYPE_CSV_VALUE_ERROR = 50;</code> */ public static final int TYPE_CSV_VALUE_ERROR_VALUE = 50; /** * <pre> * The values in the given column of the input rows do not match some * regular expression. * </pre> * * <code>TYPE_CSV_REGEXP_MISMATCH = 51;</code> */ public static final int TYPE_CSV_REGEXP_MISMATCH_VALUE = 51; /** * <pre> * The values in the given column of the input rows are out of range. * </pre> * * <code>TYPE_CSV_OUT_OF_RANGE = 52;</code> */ public static final int TYPE_CSV_OUT_OF_RANGE_VALUE = 52; /** * <pre> * The given column is null in the input rows, even though values are * required. * </pre> * * <code>TYPE_CSV_MISSING_VALUE = 53;</code> */ public static final int TYPE_CSV_MISSING_VALUE_VALUE = 53; /** * <pre> * The values of the given key and rows of one table cannot be found a * values of the given key in another table. This is the case when a foreign * key of one table references a non-existing value in its original table. * </pre> * * <code>TYPE_CSV_MISSING_FOREIGN_KEY_VALUE = 61;</code> */ public static final int TYPE_CSV_MISSING_FOREIGN_KEY_VALUE_VALUE = 61; /** * <pre> * The values of the given key and rows are duplicates. The first occurrence * of a value is not included in the duplicates list. * </pre> * * <code>TYPE_CSV_DUPLICATE_KEY_VALUE = 62;</code> */ public static final int TYPE_CSV_DUPLICATE_KEY_VALUE_VALUE = 62; /** * <pre> * The values of the given key and rows reference a table that does not * exist. * </pre> * * <code>TYPE_CSV_MISSING_KEY_TABLE = 63;</code> */ public static final int TYPE_CSV_MISSING_KEY_TABLE_VALUE = 63; /** * <pre> * The file size is too large to process (&gt;=4GiB). * </pre> * * <code>TYPE_CSV_FILE_TOO_LARGE = 64;</code> */ public static final int TYPE_CSV_FILE_TOO_LARGE_VALUE = 64; /** * <code>TYPE_AGENCIES_WITH_DIFFERENT_LANGUAGES = 249;</code> */ public static final int TYPE_AGENCIES_WITH_DIFFERENT_LANGUAGES_VALUE = 249; /** * <code>TYPE_AGENCIES_WITH_DIFFERENT_TIMEZONES = 231;</code> */ public static final int TYPE_AGENCIES_WITH_DIFFERENT_TIMEZONES_VALUE = 231; /** * <code>TYPE_AGENCY_LANG_AND_FEED_LANG_MISMATCH = 232;</code> */ public static final int TYPE_AGENCY_LANG_AND_FEED_LANG_MISMATCH_VALUE = 232; /** * <code>TYPE_AMBIGUOUS_STOP_STATION_TRANSFERS = 286;</code> */ public static final int TYPE_AMBIGUOUS_STOP_STATION_TRANSFERS_VALUE = 286; /** * <code>TYPE_BLOCK_TRIPS_WITH_INCONSISTENT_ROUTE_TYPES = 291;</code> */ public static final int TYPE_BLOCK_TRIPS_WITH_INCONSISTENT_ROUTE_TYPES_VALUE = 291; /** * <code>TYPE_BLOCK_TRIPS_WITH_OVERLAPPING_STOP_TIMES = 241;</code> */ public static final int TYPE_BLOCK_TRIPS_WITH_OVERLAPPING_STOP_TIMES_VALUE = 241; /** * <code>TYPE_CALENDAR_START_AND_END_DATE_OUT_OF_ORDER = 240;</code> */ public static final int TYPE_CALENDAR_START_AND_END_DATE_OUT_OF_ORDER_VALUE = 240; /** * <code>TYPE_CALENDAR_HAS_NO_ACTIVE_DAYS_OF_WEEK = 228;</code> */ public static final int TYPE_CALENDAR_HAS_NO_ACTIVE_DAYS_OF_WEEK_VALUE = 228; /** * <code>TYPE_LOCATION_WITHOUT_PARENT_STATION = 203;</code> */ public static final int TYPE_LOCATION_WITHOUT_PARENT_STATION_VALUE = 203; /** * <code>TYPE_FARE_ATTRIBUTES_INVALID_CURRENCY_TYPE = 220;</code> */ public static final int TYPE_FARE_ATTRIBUTES_INVALID_CURRENCY_TYPE_VALUE = 220; /** * <code>TYPE_FARE_ATTRIBUTES_AGENCY_ID_REQUIRED = 221;</code> */ public static final int TYPE_FARE_ATTRIBUTES_AGENCY_ID_REQUIRED_VALUE = 221; /** * <code>TYPE_FARE_RULE_WITH_BOTH_ROUTE_ID_REFERENCES = 290;</code> */ public static final int TYPE_FARE_RULE_WITH_BOTH_ROUTE_ID_REFERENCES_VALUE = 290; /** * <code>TYPE_FARES_WITH_AND_WITHOUT_RULES = 264;</code> */ public static final int TYPE_FARES_WITH_AND_WITHOUT_RULES_VALUE = 264; /** * <code>TYPE_FAST_TRAVEL_BETWEEN_CONSECUTIVE_STOPS = 256;</code> */ public static final int TYPE_FAST_TRAVEL_BETWEEN_CONSECUTIVE_STOPS_VALUE = 256; /** * <code>TYPE_FAST_TRAVEL_BETWEEN_FAR_STOPS = 297;</code> */ public static final int TYPE_FAST_TRAVEL_BETWEEN_FAR_STOPS_VALUE = 297; /** * <code>TYPE_FEED_EXPIRATION_DATE = 233;</code> */ public static final int TYPE_FEED_EXPIRATION_DATE_VALUE = 233; /** * <code>TYPE_FEED_FUTURE_SERVICE = 227;</code> */ public static final int TYPE_FEED_FUTURE_SERVICE_VALUE = 227; /** * <code>TYPE_FEED_HAS_NO_LANGUAGE = 266;</code> */ public static final int TYPE_FEED_HAS_NO_LANGUAGE_VALUE = 266; /** * <code>TYPE_FEED_HAS_NO_SERVICE_DATE_EXCEPTIONS = 225;</code> */ public static final int TYPE_FEED_HAS_NO_SERVICE_DATE_EXCEPTIONS_VALUE = 225; /** * <code>TYPE_FEED_HAS_NO_SERVICE_DATES = 224;</code> */ public static final int TYPE_FEED_HAS_NO_SERVICE_DATES_VALUE = 224; /** * <pre> * SUSPICIOUS * </pre> * * <code>TYPE_FEED_HAS_VERY_SHORT_SERVICE = 295;</code> */ public static final int TYPE_FEED_HAS_VERY_SHORT_SERVICE_VALUE = 295; /** * <pre> * ERROR * </pre> * * <code>TYPE_EXPIRED_FEED_HAS_VERY_SHORT_SERVICE = 333;</code> */ public static final int TYPE_EXPIRED_FEED_HAS_VERY_SHORT_SERVICE_VALUE = 333; /** * <code>TYPE_FEED_INFO_START_AND_END_DATE_OUT_OF_ORDER = 222;</code> */ public static final int TYPE_FEED_INFO_START_AND_END_DATE_OUT_OF_ORDER_VALUE = 222; /** * <code>TYPE_FEED_INFO_MORE_THAN_ONE_ENTRY = 223;</code> */ public static final int TYPE_FEED_INFO_MORE_THAN_ONE_ENTRY_VALUE = 223; /** * <pre> * SUSPICIOUS * </pre> * * <code>TYPE_FEED_INFO_EARLY_START = 296;</code> */ public static final int TYPE_FEED_INFO_EARLY_START_VALUE = 296; /** * <code>TYPE_FEED_SERVICE_DATE_GAP = 230;</code> */ public static final int TYPE_FEED_SERVICE_DATE_GAP_VALUE = 230; /** * <code>TYPE_FREQUENCY_HEADWAY_SECONDS_GREATER_THAN_INTERVAL = 280;</code> */ public static final int TYPE_FREQUENCY_HEADWAY_SECONDS_GREATER_THAN_INTERVAL_VALUE = 280; /** * <code>TYPE_FREQUENCY_HEADWAY_SECONDS_TOO_HIGH = 313;</code> */ public static final int TYPE_FREQUENCY_HEADWAY_SECONDS_TOO_HIGH_VALUE = 313; /** * <code>TYPE_FREQUENCY_START_AND_END_TIME_ARE_EQUAL = 261;</code> */ public static final int TYPE_FREQUENCY_START_AND_END_TIME_ARE_EQUAL_VALUE = 261; /** * <code>TYPE_FREQUENCY_START_AND_END_TIME_OUT_OF_ORDER = 262;</code> */ public static final int TYPE_FREQUENCY_START_AND_END_TIME_OUT_OF_ORDER_VALUE = 262; /** * <code>TYPE_FREQUENCY_BASED_TRIP_TO_TRIP_TRANSFER = 284;</code> */ public static final int TYPE_FREQUENCY_BASED_TRIP_TO_TRIP_TRANSFER_VALUE = 284; /** * <code>TYPE_INVALID_LANGUAGE_CODE = 242;</code> */ public static final int TYPE_INVALID_LANGUAGE_CODE_VALUE = 242; /** * <code>TYPE_INVALID_LATITUDE = 243;</code> */ public static final int TYPE_INVALID_LATITUDE_VALUE = 243; /** * <code>TYPE_INVALID_LONGITUDE = 244;</code> */ public static final int TYPE_INVALID_LONGITUDE_VALUE = 244; /** * <code>TYPE_INVALID_ROUTE_TYPE = 263;</code> */ public static final int TYPE_INVALID_ROUTE_TYPE_VALUE = 263; /** * <code>TYPE_INVALID_TIMEZONE = 245;</code> */ public static final int TYPE_INVALID_TIMEZONE_VALUE = 245; /** * <code>TYPE_INVALID_URL = 246;</code> */ public static final int TYPE_INVALID_URL_VALUE = 246; /** * <code>TYPE_MULTIPLE_FARES_WITHOUT_RULES = 265;</code> */ public static final int TYPE_MULTIPLE_FARES_WITHOUT_RULES_VALUE = 265; /** * <code>TYPE_OVERLAPPING_FREQUENCY = 201;</code> */ public static final int TYPE_OVERLAPPING_FREQUENCY_VALUE = 201; /** * <code>TYPE_OVERLAPPING_FREQUENCY_FOR_TRIP_DUPLICATES = 281;</code> */ public static final int TYPE_OVERLAPPING_FREQUENCY_FOR_TRIP_DUPLICATES_VALUE = 281; /** * <code>TYPE_PARENT_STATION_WITH_WRONG_LOCATION_TYPE = 289;</code> */ public static final int TYPE_PARENT_STATION_WITH_WRONG_LOCATION_TYPE_VALUE = 289; /** * <code>TYPE_POINT_NEAR_ORIGIN = 293;</code> */ public static final int TYPE_POINT_NEAR_ORIGIN_VALUE = 293; /** * <code>TYPE_POINT_NEAR_POLE = 294;</code> */ public static final int TYPE_POINT_NEAR_POLE_VALUE = 294; /** * <code>TYPE_ROUTE_COLOR_CONTRAST = 207;</code> */ public static final int TYPE_ROUTE_COLOR_CONTRAST_VALUE = 207; /** * <code>TYPE_ROUTE_NAME_REUSED = 226;</code> */ public static final int TYPE_ROUTE_NAME_REUSED_VALUE = 226; /** * <code>TYPE_ROUTE_SHORT_NAME_EQUALS_LONG_NAME = 209;</code> */ public static final int TYPE_ROUTE_SHORT_NAME_EQUALS_LONG_NAME_VALUE = 209; /** * <code>TYPE_ROUTE_SHORT_NAME_IS_CONTAINED_IN_LONG_NAME = 210;</code> */ public static final int TYPE_ROUTE_SHORT_NAME_IS_CONTAINED_IN_LONG_NAME_VALUE = 210; /** * <code>TYPE_ROUTE_SHORT_NAME_IS_TOO_LONG = 208;</code> */ public static final int TYPE_ROUTE_SHORT_NAME_IS_TOO_LONG_VALUE = 208; /** * <code>TYPE_ROUTE_SHORT_NAME_OR_LONG_NAME_REQUIRED = 211;</code> */ public static final int TYPE_ROUTE_SHORT_NAME_OR_LONG_NAME_REQUIRED_VALUE = 211; /** * <code>TYPE_ROUTE_BOTH_SHORT_NAME_AND_LONG_NAME_PRESENT = 314;</code> */ public static final int TYPE_ROUTE_BOTH_SHORT_NAME_AND_LONG_NAME_PRESENT_VALUE = 314; /** * <code>TYPE_ROUTE_LONG_NAME_HAS_ABBREVIATIONS = 315;</code> */ public static final int TYPE_ROUTE_LONG_NAME_HAS_ABBREVIATIONS_VALUE = 315; /** * <code>TYPE_ROUTE_NAME_NOT_CAPITALIZED = 316;</code> */ public static final int TYPE_ROUTE_NAME_NOT_CAPITALIZED_VALUE = 316; /** * <code>TYPE_ROUTE_NAME_HAS_SPECIAL_CHARACTERS = 321;</code> */ public static final int TYPE_ROUTE_NAME_HAS_SPECIAL_CHARACTERS_VALUE = 321; /** * <code>TYPE_SERVICE_ID_HAS_NO_ACTIVE_DAYS = 229;</code> */ public static final int TYPE_SERVICE_ID_HAS_NO_ACTIVE_DAYS_VALUE = 229; /** * <code>TYPE_SHAPE_WITH_PARTIAL_SHAPE_DIST_TRAVELED = 269;</code> */ public static final int TYPE_SHAPE_WITH_PARTIAL_SHAPE_DIST_TRAVELED_VALUE = 269; /** * <code>TYPE_STATION_UNUSED = 234;</code> */ public static final int TYPE_STATION_UNUSED_VALUE = 234; /** * <code>TYPE_STATION_WITH_PARENT_STATION = 202;</code> */ public static final int TYPE_STATION_WITH_PARENT_STATION_VALUE = 202; /** * <code>TYPE_LOCATION_WITH_STOP_TIME_OVERRIDES = 303;</code> */ public static final int TYPE_LOCATION_WITH_STOP_TIME_OVERRIDES_VALUE = 303; /** * <code>TYPE_LOCATION_WITH_STOP_TIMES = 235;</code> */ public static final int TYPE_LOCATION_WITH_STOP_TIMES_VALUE = 235; /** * <code>TYPE_STATIONS_TOO_CLOSE = 236;</code> */ public static final int TYPE_STATIONS_TOO_CLOSE_VALUE = 236; /** * <code>TYPE_STOP_HAS_TOO_MANY_MATCHES_FOR_SHAPE = 250;</code> */ public static final int TYPE_STOP_HAS_TOO_MANY_MATCHES_FOR_SHAPE_VALUE = 250; /** * <code>TYPE_STOP_TIME_OVERRIDES_CONFLICTING = 298;</code> */ public static final int TYPE_STOP_TIME_OVERRIDES_CONFLICTING_VALUE = 298; /** * <code>TYPE_STOP_TIME_OVERRIDES_NOT_SAME_PARENT_STATION = 299;</code> */ public static final int TYPE_STOP_TIME_OVERRIDES_NOT_SAME_PARENT_STATION_VALUE = 299; /** * <code>TYPE_STOP_TIME_OVERRIDES_NOT_USED = 300;</code> */ public static final int TYPE_STOP_TIME_OVERRIDES_NOT_USED_VALUE = 300; /** * <code>TYPE_STOP_TIME_OVERRIDES_WITH_UNKNOWN_SERVICE_ID = 301;</code> */ public static final int TYPE_STOP_TIME_OVERRIDES_WITH_UNKNOWN_SERVICE_ID_VALUE = 301; /** * <code>TYPE_STOP_TIME_OVERRIDES_WITH_UNKNOWN_STOP_SEQUENCE = 302;</code> */ public static final int TYPE_STOP_TIME_OVERRIDES_WITH_UNKNOWN_STOP_SEQUENCE_VALUE = 302; /** * <code>TYPE_STOP_TIMES_STOP_HEADSIGN_EQUALS_STOP_NAME = 260;</code> */ public static final int TYPE_STOP_TIMES_STOP_HEADSIGN_EQUALS_STOP_NAME_VALUE = 260; /** * <code>TYPE_STOP_TIMES_INCORRECT_STOP_HEADSIGN = 318;</code> */ public static final int TYPE_STOP_TIMES_INCORRECT_STOP_HEADSIGN_VALUE = 318; /** * <code>TYPE_STOP_TIMES_WITH_ARRIVAL_BEFORE_PREVIOUS_DEPARTURE_TIME = 283;</code> */ public static final int TYPE_STOP_TIMES_WITH_ARRIVAL_BEFORE_PREVIOUS_DEPARTURE_TIME_VALUE = 283; /** * <code>TYPE_STOP_TIMES_WITH_DEPARTURE_BEFORE_ARRIVAL_TIME = 275;</code> */ public static final int TYPE_STOP_TIMES_WITH_DEPARTURE_BEFORE_ARRIVAL_TIME_VALUE = 275; /** * <code>TYPE_STOP_TIMES_WITH_LONG_ARRIVAL_INTERVAL = 254;</code> */ public static final int TYPE_STOP_TIMES_WITH_LONG_ARRIVAL_INTERVAL_VALUE = 254; /** * <code>TYPE_STOP_TIMES_WITH_LONG_DEPARTURE_ARRIVAL_INTERVAL = 255;</code> */ public static final int TYPE_STOP_TIMES_WITH_LONG_DEPARTURE_ARRIVAL_INTERVAL_VALUE = 255; /** * <code>TYPE_STOP_TIMES_WITH_ONLY_ARRIVAL_OR_DEPARTURE_TIME_SPECIFIED = 273;</code> */ public static final int TYPE_STOP_TIMES_WITH_ONLY_ARRIVAL_OR_DEPARTURE_TIME_SPECIFIED_VALUE = 273; /** * <code>TYPE_STOP_TOO_CLOSE_TO_STATION = 237;</code> */ public static final int TYPE_STOP_TOO_CLOSE_TO_STATION_VALUE = 237; /** * <code>TYPE_STOP_TOO_FAR_FROM_PARENT_STATION = 253;</code> */ public static final int TYPE_STOP_TOO_FAR_FROM_PARENT_STATION_VALUE = 253; /** * <code>TYPE_STOP_TOO_FAR_FROM_SHAPE = 251;</code> */ public static final int TYPE_STOP_TOO_FAR_FROM_SHAPE_VALUE = 251; /** * <code>TYPE_STOP_TOO_FAR_FROM_SHAPE_USING_USER_DISTANCE = 292;</code> */ public static final int TYPE_STOP_TOO_FAR_FROM_SHAPE_USING_USER_DISTANCE_VALUE = 292; /** * <code>TYPE_STOP_UNUSED = 238;</code> */ public static final int TYPE_STOP_UNUSED_VALUE = 238; /** * <code>TYPE_STOP_WITH_PARENT_STATION_AND_TIMEZONE = 204;</code> */ public static final int TYPE_STOP_WITH_PARENT_STATION_AND_TIMEZONE_VALUE = 204; /** * <code>TYPE_STOP_WITH_SAME_NAME_AND_DESCRIPTION = 206;</code> */ public static final int TYPE_STOP_WITH_SAME_NAME_AND_DESCRIPTION_VALUE = 206; /** * <code>TYPE_STOP_NAME_HAS_STOP_CODE_OR_ID = 319;</code> */ public static final int TYPE_STOP_NAME_HAS_STOP_CODE_OR_ID_VALUE = 319; /** * <code>TYPE_STOP_NAME_HAS_SPECIAL_CHARACTERS = 320;</code> */ public static final int TYPE_STOP_NAME_HAS_SPECIAL_CHARACTERS_VALUE = 320; /** * <code>TYPE_STOP_HEADSIGN_HAS_SPECIAL_CHARACTERS = 322;</code> */ public static final int TYPE_STOP_HEADSIGN_HAS_SPECIAL_CHARACTERS_VALUE = 322; /** * <code>TYPE_STOPS_MATCH_SHAPE_OUT_OF_ORDER = 252;</code> */ public static final int TYPE_STOPS_MATCH_SHAPE_OUT_OF_ORDER_VALUE = 252; /** * <code>TYPE_STOPS_TOO_CLOSE = 239;</code> */ public static final int TYPE_STOPS_TOO_CLOSE_VALUE = 239; /** * <code>TYPE_STOP_NAME_NOT_CAPITALIZED = 317;</code> */ public static final int TYPE_STOP_NAME_NOT_CAPITALIZED_VALUE = 317; /** * <code>TYPE_PLATFORM_CODE_IS_MISSING = 332;</code> */ public static final int TYPE_PLATFORM_CODE_IS_MISSING_VALUE = 332; /** * <code>TYPE_TOO_MANY_CONSECUTIVE_STOP_TIMES_WITH_SAME_TIME = 257;</code> */ public static final int TYPE_TOO_MANY_CONSECUTIVE_STOP_TIMES_WITH_SAME_TIME_VALUE = 257; /** * <code>TYPE_TOO_MANY_ENTRIES = 305;</code> */ public static final int TYPE_TOO_MANY_ENTRIES_VALUE = 305; /** * <code>TYPE_TRANSFER_DISTANCE_IS_VERY_LARGE = 218;</code> */ public static final int TYPE_TRANSFER_DISTANCE_IS_VERY_LARGE_VALUE = 218; /** * <code>TYPE_TRANSFER_DUPLICATE = 258;</code> */ public static final int TYPE_TRANSFER_DUPLICATE_VALUE = 258; /** * <code>TYPE_TRANSFER_WALKING_SPEED_IS_TOO_FAST = 219;</code> */ public static final int TYPE_TRANSFER_WALKING_SPEED_IS_TOO_FAST_VALUE = 219; /** * <code>TYPE_TRANSFER_MIN_TRANSFER_TIME_AND_INVALID_TYPE = 282;</code> */ public static final int TYPE_TRANSFER_MIN_TRANSFER_TIME_AND_INVALID_TYPE_VALUE = 282; /** * <code>TYPE_TRANSFER_MIN_TRANSFER_TIME_IS_MISSING = 288;</code> */ public static final int TYPE_TRANSFER_MIN_TRANSFER_TIME_IS_MISSING_VALUE = 288; /** * <code>TYPE_TRANSFER_MIN_TRANSFER_TIME_IS_NEGATIVE = 216;</code> */ public static final int TYPE_TRANSFER_MIN_TRANSFER_TIME_IS_NEGATIVE_VALUE = 216; /** * <code>TYPE_TRANSFER_MIN_TRANSFER_TIME_IS_VERY_LARGE = 217;</code> */ public static final int TYPE_TRANSFER_MIN_TRANSFER_TIME_IS_VERY_LARGE_VALUE = 217; /** * <code>TYPE_TRANSFER_VIA_ENTRANCE = 285;</code> */ public static final int TYPE_TRANSFER_VIA_ENTRANCE_VALUE = 285; /** * <code>TYPE_TRANSFER_WITH_INVALID_ROUTE_AND_TRIP = 287;</code> */ public static final int TYPE_TRANSFER_WITH_INVALID_ROUTE_AND_TRIP_VALUE = 287; /** * <code>TYPE_TRIP_DUPLICATES = 276;</code> */ public static final int TYPE_TRIP_DUPLICATES_VALUE = 276; /** * <code>TYPE_TRIP_HEADSIGN_CONTAINS_ROUTE_LONG_NAME = 278;</code> */ public static final int TYPE_TRIP_HEADSIGN_CONTAINS_ROUTE_LONG_NAME_VALUE = 278; /** * <code>TYPE_TRIP_HEADSIGN_CONTAINS_ROUTE_SHORT_NAME = 277;</code> */ public static final int TYPE_TRIP_HEADSIGN_CONTAINS_ROUTE_SHORT_NAME_VALUE = 277; /** * <code>TYPE_TRIP_LENGTH_TOO_LONG = 309;</code> */ public static final int TYPE_TRIP_LENGTH_TOO_LONG_VALUE = 309; /** * <code>TYPE_TRIP_STARTS_LATE = 310;</code> */ public static final int TYPE_TRIP_STARTS_LATE_VALUE = 310; /** * <code>TYPE_TRIP_STARTS_TOO_LATE = 311;</code> */ public static final int TYPE_TRIP_STARTS_TOO_LATE_VALUE = 311; /** * <code>TYPE_TRIP_WITH_NO_TIME_FOR_FIRST_STOP_TIME = 212;</code> */ public static final int TYPE_TRIP_WITH_NO_TIME_FOR_FIRST_STOP_TIME_VALUE = 212; /** * <code>TYPE_TRIP_WITH_NO_TIME_FOR_LAST_STOP_TIME = 213;</code> */ public static final int TYPE_TRIP_WITH_NO_TIME_FOR_LAST_STOP_TIME_VALUE = 213; /** * <code>TYPE_TRIP_WITH_NO_USABLE_STOPS = 267;</code> */ public static final int TYPE_TRIP_WITH_NO_USABLE_STOPS_VALUE = 267; /** * <code>TYPE_TRIP_WITH_OUT_OF_ORDER_ARRIVAL_TIME = 214;</code> */ public static final int TYPE_TRIP_WITH_OUT_OF_ORDER_ARRIVAL_TIME_VALUE = 214; /** * <code>TYPE_TRIP_WITH_OUT_OF_ORDER_DEPARTURE_TIME = 215;</code> */ public static final int TYPE_TRIP_WITH_OUT_OF_ORDER_DEPARTURE_TIME_VALUE = 215; /** * <code>TYPE_TRIP_WITH_OUT_OF_ORDER_SHAPE_DIST_TRAVELED = 248;</code> */ public static final int TYPE_TRIP_WITH_OUT_OF_ORDER_SHAPE_DIST_TRAVELED_VALUE = 248; /** * <code>TYPE_TRIP_WITH_PARTIAL_SHAPE_DIST_TRAVELED = 270;</code> */ public static final int TYPE_TRIP_WITH_PARTIAL_SHAPE_DIST_TRAVELED_VALUE = 270; /** * <code>TYPE_TRIP_WITH_SHAPE_DIST_TRAVELED_BUT_NO_SHAPE = 271;</code> */ public static final int TYPE_TRIP_WITH_SHAPE_DIST_TRAVELED_BUT_NO_SHAPE_VALUE = 271; /** * <code>TYPE_TRIP_WITH_SHAPE_DIST_TRAVELED_BUT_NO_SHAPE_DISTANCES = 272;</code> */ public static final int TYPE_TRIP_WITH_SHAPE_DIST_TRAVELED_BUT_NO_SHAPE_DISTANCES_VALUE = 272; /** * <code>TYPE_TRIP_WITH_UNKNOWN_SERVICE_ID = 268;</code> */ public static final int TYPE_TRIP_WITH_UNKNOWN_SERVICE_ID_VALUE = 268; /** * <code>TYPE_TRIP_WITH_DUPLICATE_STOPS = 312;</code> */ public static final int TYPE_TRIP_WITH_DUPLICATE_STOPS_VALUE = 312; /** * <code>TYPE_TRIP_HEADSIGN_HAS_SPECIAL_CHARACTERS = 323;</code> */ public static final int TYPE_TRIP_HEADSIGN_HAS_SPECIAL_CHARACTERS_VALUE = 323; /** * <code>TYPE_UNKNOWN_COLUMN = 274;</code> */ public static final int TYPE_UNKNOWN_COLUMN_VALUE = 274; /** * <code>TYPE_UNKNOWN_FILE = 259;</code> */ public static final int TYPE_UNKNOWN_FILE_VALUE = 259; /** * <pre> * Impossible to open feed zip archive * </pre> * * <code>TYPE_ARCHIVE_CORRUPTED = 306;</code> */ public static final int TYPE_ARCHIVE_CORRUPTED_VALUE = 306; /** * <pre> * The current feed is identical to the last valid feed * </pre> * * <code>TYPE_DUPLICATE_FEED = 307;</code> */ public static final int TYPE_DUPLICATE_FEED_VALUE = 307; /** * <pre> * Feed doesn't contain stops. * </pre> * * <code>TYPE_EMPTY_STOPS = 308;</code> */ public static final int TYPE_EMPTY_STOPS_VALUE = 308; /** * <pre> * frequencies.txt contains mixed values of exact_times for a trip. * </pre> * * <code>TYPE_INCONSISTENT_EXACT_TIMES_FOR_TRIP = 324;</code> */ public static final int TYPE_INCONSISTENT_EXACT_TIMES_FOR_TRIP_VALUE = 324; /** * <pre> * Deprecated - pathway_id is always required and is checked by parser. * </pre> * * <code>TYPE_PATHWAY_MISSING_PATHWAY_ID = 325 [deprecated = true];</code> */ public static final int TYPE_PATHWAY_MISSING_PATHWAY_ID_VALUE = 325; /** * <pre> * A reciprocal pathway is missing. * </pre> * * <code>TYPE_PATHWAY_MISSING_RECIPROCAL = 326;</code> */ public static final int TYPE_PATHWAY_MISSING_RECIPROCAL_VALUE = 326; /** * <pre> * A location (stop, entrance or generic node) has no pathway but some other * locations in the same parent station have pathways. * </pre> * * <code>TYPE_PATHWAY_DANGLING_LOCATION = 327;</code> */ public static final int TYPE_PATHWAY_DANGLING_LOCATION_VALUE = 327; /** * <pre> * A platform has pathways but is not connected to any entrance, even * indirectly. * </pre> * * <code>TYPE_PATHWAY_PLATFORM_WITHOUT_ENTRANCES = 328;</code> */ public static final int TYPE_PATHWAY_PLATFORM_WITHOUT_ENTRANCES_VALUE = 328; /** * <pre> * A platform which already has boarding areas may not have pathways. * </pre> * * <code>TYPE_PATHWAY_WRONG_PLATFORM_ENDPOINT = 329;</code> */ public static final int TYPE_PATHWAY_WRONG_PLATFORM_ENDPOINT_VALUE = 329; /** * <pre> * A column is missing from pathways.txt. This column is required by Core * GTFS-Pathways (2019) but not by the old spec (2010). * </pre> * * <code>TYPE_PATHWAY_MISSING_COLUMN = 330;</code> */ public static final int TYPE_PATHWAY_MISSING_COLUMN_VALUE = 330; /** * <pre> * A value is missing from pathways.txt. This value is required by Core * GTFS-Pathways (2019) but not by the old spec (2010). * </pre> * * <code>TYPE_PATHWAY_MISSING_VALUE = 331;</code> */ public static final int TYPE_PATHWAY_MISSING_VALUE_VALUE = 331; /** * <pre> * A column is missing from attributions.txt. * </pre> * * <code>TYPE_ATTRIBUTION_MISSING_COLUMN = 334;</code> */ public static final int TYPE_ATTRIBUTION_MISSING_COLUMN_VALUE = 334; /** * <pre> * A role value is missing from attributions.txt. * </pre> * * <code>TYPE_ATTRIBUTION_MISSING_ROLE = 335;</code> */ public static final int TYPE_ATTRIBUTION_MISSING_ROLE_VALUE = 335; public final int getNumber() { return value; } /** * @param value The numeric wire value of the corresponding enum entry. * @return The enum associated with the given numeric wire value. * @deprecated Use {@link #forNumber(int)} instead. */ @java.lang.Deprecated public static Type valueOf(int value) { return forNumber(value); } /** * @param value The numeric wire value of the corresponding enum entry. * @return The enum associated with the given numeric wire value. */ public static Type forNumber(int value) { switch (value) { case 1: return TYPE_CSV_UNKNOWN_ERROR; case 10: return TYPE_CSV_MISSING_TABLE; case 20: return TYPE_CSV_SPLITTING_ERROR; case 21: return TYPE_CSV_CONTAINS_NULL_CHARACTER; case 22: return TYPE_CSV_UTF8_CONVERSION_ERROR; case 23: return TYPE_CSV_INVALID_UTF8; case 24: return TYPE_CSV_DUPLICATE_COLUMN_NAME; case 25: return TYPE_CSV_BAD_NUMBER_OF_VALUES; case 26: return TYPE_CSV_FILE_CORRUPTED; case 27: return TYPE_CSV_UNEXPECTED_LOCATION; case 30: return TYPE_CSV_MISSING_COLUMN; case 31: return TYPE_CSV_MISSING_KEY; case 40: return TYPE_CSV_UNSORTED; case 41: return TYPE_CSV_NON_CONTIGUOUS; case 42: return TYPE_CSV_BAD_NUMBER_OF_ROWS; case 50: return TYPE_CSV_VALUE_ERROR; case 51: return TYPE_CSV_REGEXP_MISMATCH; case 52: return TYPE_CSV_OUT_OF_RANGE; case 53: return TYPE_CSV_MISSING_VALUE; case 61: return TYPE_CSV_MISSING_FOREIGN_KEY_VALUE; case 62: return TYPE_CSV_DUPLICATE_KEY_VALUE; case 63: return TYPE_CSV_MISSING_KEY_TABLE; case 64: return TYPE_CSV_FILE_TOO_LARGE; case 249: return TYPE_AGENCIES_WITH_DIFFERENT_LANGUAGES; case 231: return TYPE_AGENCIES_WITH_DIFFERENT_TIMEZONES; case 232: return TYPE_AGENCY_LANG_AND_FEED_LANG_MISMATCH; case 286: return TYPE_AMBIGUOUS_STOP_STATION_TRANSFERS; case 291: return TYPE_BLOCK_TRIPS_WITH_INCONSISTENT_ROUTE_TYPES; case 241: return TYPE_BLOCK_TRIPS_WITH_OVERLAPPING_STOP_TIMES; case 240: return TYPE_CALENDAR_START_AND_END_DATE_OUT_OF_ORDER; case 228: return TYPE_CALENDAR_HAS_NO_ACTIVE_DAYS_OF_WEEK; case 203: return TYPE_LOCATION_WITHOUT_PARENT_STATION; case 220: return TYPE_FARE_ATTRIBUTES_INVALID_CURRENCY_TYPE; case 221: return TYPE_FARE_ATTRIBUTES_AGENCY_ID_REQUIRED; case 290: return TYPE_FARE_RULE_WITH_BOTH_ROUTE_ID_REFERENCES; case 264: return TYPE_FARES_WITH_AND_WITHOUT_RULES; case 256: return TYPE_FAST_TRAVEL_BETWEEN_CONSECUTIVE_STOPS; case 297: return TYPE_FAST_TRAVEL_BETWEEN_FAR_STOPS; case 233: return TYPE_FEED_EXPIRATION_DATE; case 227: return TYPE_FEED_FUTURE_SERVICE; case 266: return TYPE_FEED_HAS_NO_LANGUAGE; case 225: return TYPE_FEED_HAS_NO_SERVICE_DATE_EXCEPTIONS; case 224: return TYPE_FEED_HAS_NO_SERVICE_DATES; case 295: return TYPE_FEED_HAS_VERY_SHORT_SERVICE; case 333: return TYPE_EXPIRED_FEED_HAS_VERY_SHORT_SERVICE; case 222: return TYPE_FEED_INFO_START_AND_END_DATE_OUT_OF_ORDER; case 223: return TYPE_FEED_INFO_MORE_THAN_ONE_ENTRY; case 296: return TYPE_FEED_INFO_EARLY_START; case 230: return TYPE_FEED_SERVICE_DATE_GAP; case 280: return TYPE_FREQUENCY_HEADWAY_SECONDS_GREATER_THAN_INTERVAL; case 313: return TYPE_FREQUENCY_HEADWAY_SECONDS_TOO_HIGH; case 261: return TYPE_FREQUENCY_START_AND_END_TIME_ARE_EQUAL; case 262: return TYPE_FREQUENCY_START_AND_END_TIME_OUT_OF_ORDER; case 284: return TYPE_FREQUENCY_BASED_TRIP_TO_TRIP_TRANSFER; case 242: return TYPE_INVALID_LANGUAGE_CODE; case 243: return TYPE_INVALID_LATITUDE; case 244: return TYPE_INVALID_LONGITUDE; case 263: return TYPE_INVALID_ROUTE_TYPE; case 245: return TYPE_INVALID_TIMEZONE; case 246: return TYPE_INVALID_URL; case 265: return TYPE_MULTIPLE_FARES_WITHOUT_RULES; case 201: return TYPE_OVERLAPPING_FREQUENCY; case 281: return TYPE_OVERLAPPING_FREQUENCY_FOR_TRIP_DUPLICATES; case 289: return TYPE_PARENT_STATION_WITH_WRONG_LOCATION_TYPE; case 293: return TYPE_POINT_NEAR_ORIGIN; case 294: return TYPE_POINT_NEAR_POLE; case 207: return TYPE_ROUTE_COLOR_CONTRAST; case 226: return TYPE_ROUTE_NAME_REUSED; case 209: return TYPE_ROUTE_SHORT_NAME_EQUALS_LONG_NAME; case 210: return TYPE_ROUTE_SHORT_NAME_IS_CONTAINED_IN_LONG_NAME; case 208: return TYPE_ROUTE_SHORT_NAME_IS_TOO_LONG; case 211: return TYPE_ROUTE_SHORT_NAME_OR_LONG_NAME_REQUIRED; case 314: return TYPE_ROUTE_BOTH_SHORT_NAME_AND_LONG_NAME_PRESENT; case 315: return TYPE_ROUTE_LONG_NAME_HAS_ABBREVIATIONS; case 316: return TYPE_ROUTE_NAME_NOT_CAPITALIZED; case 321: return TYPE_ROUTE_NAME_HAS_SPECIAL_CHARACTERS; case 229: return TYPE_SERVICE_ID_HAS_NO_ACTIVE_DAYS; case 269: return TYPE_SHAPE_WITH_PARTIAL_SHAPE_DIST_TRAVELED; case 234: return TYPE_STATION_UNUSED; case 202: return TYPE_STATION_WITH_PARENT_STATION; case 303: return TYPE_LOCATION_WITH_STOP_TIME_OVERRIDES; case 235: return TYPE_LOCATION_WITH_STOP_TIMES; case 236: return TYPE_STATIONS_TOO_CLOSE; case 250: return TYPE_STOP_HAS_TOO_MANY_MATCHES_FOR_SHAPE; case 298: return TYPE_STOP_TIME_OVERRIDES_CONFLICTING; case 299: return TYPE_STOP_TIME_OVERRIDES_NOT_SAME_PARENT_STATION; case 300: return TYPE_STOP_TIME_OVERRIDES_NOT_USED; case 301: return TYPE_STOP_TIME_OVERRIDES_WITH_UNKNOWN_SERVICE_ID; case 302: return TYPE_STOP_TIME_OVERRIDES_WITH_UNKNOWN_STOP_SEQUENCE; case 260: return TYPE_STOP_TIMES_STOP_HEADSIGN_EQUALS_STOP_NAME; case 318: return TYPE_STOP_TIMES_INCORRECT_STOP_HEADSIGN; case 283: return TYPE_STOP_TIMES_WITH_ARRIVAL_BEFORE_PREVIOUS_DEPARTURE_TIME; case 275: return TYPE_STOP_TIMES_WITH_DEPARTURE_BEFORE_ARRIVAL_TIME; case 254: return TYPE_STOP_TIMES_WITH_LONG_ARRIVAL_INTERVAL; case 255: return TYPE_STOP_TIMES_WITH_LONG_DEPARTURE_ARRIVAL_INTERVAL; case 273: return TYPE_STOP_TIMES_WITH_ONLY_ARRIVAL_OR_DEPARTURE_TIME_SPECIFIED; case 237: return TYPE_STOP_TOO_CLOSE_TO_STATION; case 253: return TYPE_STOP_TOO_FAR_FROM_PARENT_STATION; case 251: return TYPE_STOP_TOO_FAR_FROM_SHAPE; case 292: return TYPE_STOP_TOO_FAR_FROM_SHAPE_USING_USER_DISTANCE; case 238: return TYPE_STOP_UNUSED; case 204: return TYPE_STOP_WITH_PARENT_STATION_AND_TIMEZONE; case 206: return TYPE_STOP_WITH_SAME_NAME_AND_DESCRIPTION; case 319: return TYPE_STOP_NAME_HAS_STOP_CODE_OR_ID; case 320: return TYPE_STOP_NAME_HAS_SPECIAL_CHARACTERS; case 322: return TYPE_STOP_HEADSIGN_HAS_SPECIAL_CHARACTERS; case 252: return TYPE_STOPS_MATCH_SHAPE_OUT_OF_ORDER; case 239: return TYPE_STOPS_TOO_CLOSE; case 317: return TYPE_STOP_NAME_NOT_CAPITALIZED; case 332: return TYPE_PLATFORM_CODE_IS_MISSING; case 257: return TYPE_TOO_MANY_CONSECUTIVE_STOP_TIMES_WITH_SAME_TIME; case 305: return TYPE_TOO_MANY_ENTRIES; case 218: return TYPE_TRANSFER_DISTANCE_IS_VERY_LARGE; case 258: return TYPE_TRANSFER_DUPLICATE; case 219: return TYPE_TRANSFER_WALKING_SPEED_IS_TOO_FAST; case 282: return TYPE_TRANSFER_MIN_TRANSFER_TIME_AND_INVALID_TYPE; case 288: return TYPE_TRANSFER_MIN_TRANSFER_TIME_IS_MISSING; case 216: return TYPE_TRANSFER_MIN_TRANSFER_TIME_IS_NEGATIVE; case 217: return TYPE_TRANSFER_MIN_TRANSFER_TIME_IS_VERY_LARGE; case 285: return TYPE_TRANSFER_VIA_ENTRANCE; case 287: return TYPE_TRANSFER_WITH_INVALID_ROUTE_AND_TRIP; case 276: return TYPE_TRIP_DUPLICATES; case 278: return TYPE_TRIP_HEADSIGN_CONTAINS_ROUTE_LONG_NAME; case 277: return TYPE_TRIP_HEADSIGN_CONTAINS_ROUTE_SHORT_NAME; case 309: return TYPE_TRIP_LENGTH_TOO_LONG; case 310: return TYPE_TRIP_STARTS_LATE; case 311: return TYPE_TRIP_STARTS_TOO_LATE; case 212: return TYPE_TRIP_WITH_NO_TIME_FOR_FIRST_STOP_TIME; case 213: return TYPE_TRIP_WITH_NO_TIME_FOR_LAST_STOP_TIME; case 267: return TYPE_TRIP_WITH_NO_USABLE_STOPS; case 214: return TYPE_TRIP_WITH_OUT_OF_ORDER_ARRIVAL_TIME; case 215: return TYPE_TRIP_WITH_OUT_OF_ORDER_DEPARTURE_TIME; case 248: return TYPE_TRIP_WITH_OUT_OF_ORDER_SHAPE_DIST_TRAVELED; case 270: return TYPE_TRIP_WITH_PARTIAL_SHAPE_DIST_TRAVELED; case 271: return TYPE_TRIP_WITH_SHAPE_DIST_TRAVELED_BUT_NO_SHAPE; case 272: return TYPE_TRIP_WITH_SHAPE_DIST_TRAVELED_BUT_NO_SHAPE_DISTANCES; case 268: return TYPE_TRIP_WITH_UNKNOWN_SERVICE_ID; case 312: return TYPE_TRIP_WITH_DUPLICATE_STOPS; case 323: return TYPE_TRIP_HEADSIGN_HAS_SPECIAL_CHARACTERS; case 274: return TYPE_UNKNOWN_COLUMN; case 259: return TYPE_UNKNOWN_FILE; case 306: return TYPE_ARCHIVE_CORRUPTED; case 307: return TYPE_DUPLICATE_FEED; case 308: return TYPE_EMPTY_STOPS; case 324: return TYPE_INCONSISTENT_EXACT_TIMES_FOR_TRIP; case 325: return TYPE_PATHWAY_MISSING_PATHWAY_ID; case 326: return TYPE_PATHWAY_MISSING_RECIPROCAL; case 327: return TYPE_PATHWAY_DANGLING_LOCATION; case 328: return TYPE_PATHWAY_PLATFORM_WITHOUT_ENTRANCES; case 329: return TYPE_PATHWAY_WRONG_PLATFORM_ENDPOINT; case 330: return TYPE_PATHWAY_MISSING_COLUMN; case 331: return TYPE_PATHWAY_MISSING_VALUE; case 334: return TYPE_ATTRIBUTION_MISSING_COLUMN; case 335: return TYPE_ATTRIBUTION_MISSING_ROLE; default: return null; } } public static com.google.protobuf.Internal.EnumLiteMap<Type> internalGetValueMap() { return internalValueMap; } private static final com.google.protobuf.Internal.EnumLiteMap< Type> internalValueMap = new com.google.protobuf.Internal.EnumLiteMap<Type>() { public Type findValueByNumber(int number) { return Type.forNumber(number); } }; public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { return getDescriptor().getValues().get(ordinal()); } public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { return getDescriptor(); } public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { return org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.getDescriptor().getEnumTypes().get(0); } private static final Type[] VALUES = values(); public static Type valueOf( com.google.protobuf.Descriptors.EnumValueDescriptor desc) { if (desc.getType() != getDescriptor()) { throw new java.lang.IllegalArgumentException( "EnumValueDescriptor is not for this type."); } return VALUES[desc.getIndex()]; } private final int value; private Type(int value) { this.value = value; } // @@protoc_insertion_point(enum_scope:outputProto.GtfsProblem.Type) } /** * <pre> * The severity of the validation problem. * </pre> * <p> * Protobuf enum {@code outputProto.GtfsProblem.Severity} */ public enum Severity implements com.google.protobuf.ProtocolMessageEnum { /** * <pre> * A warning indicates that something is not quite right but most GTFS * consumers will still be able to handle the feed. * </pre> * * <code>WARNING = 1;</code> */ WARNING(1), /** * <pre> * An error indicates that something is broken in such as a way that most * GTFS consumers will not be able to handle the feed. * </pre> * * <code>ERROR = 2;</code> */ ERROR(2), /** * <pre> * The feed has something that is potentially very broken. It should be * blocked until manually reviewed. * </pre> * * <code>SUSPICIOUS_WARNING = 3;</code> */ SUSPICIOUS_WARNING(3), ; /** * <pre> * A warning indicates that something is not quite right but most GTFS * consumers will still be able to handle the feed. * </pre> * * <code>WARNING = 1;</code> */ public static final int WARNING_VALUE = 1; /** * <pre> * An error indicates that something is broken in such as a way that most * GTFS consumers will not be able to handle the feed. * </pre> * * <code>ERROR = 2;</code> */ public static final int ERROR_VALUE = 2; /** * <pre> * The feed has something that is potentially very broken. It should be * blocked until manually reviewed. * </pre> * * <code>SUSPICIOUS_WARNING = 3;</code> */ public static final int SUSPICIOUS_WARNING_VALUE = 3; public final int getNumber() { return value; } /** * @param value The numeric wire value of the corresponding enum entry. * @return The enum associated with the given numeric wire value. * @deprecated Use {@link #forNumber(int)} instead. */ @java.lang.Deprecated public static Severity valueOf(int value) { return forNumber(value); } /** * @param value The numeric wire value of the corresponding enum entry. * @return The enum associated with the given numeric wire value. */ public static Severity forNumber(int value) { switch (value) { case 1: return WARNING; case 2: return ERROR; case 3: return SUSPICIOUS_WARNING; default: return null; } } public static com.google.protobuf.Internal.EnumLiteMap<Severity> internalGetValueMap() { return internalValueMap; } private static final com.google.protobuf.Internal.EnumLiteMap< Severity> internalValueMap = new com.google.protobuf.Internal.EnumLiteMap<Severity>() { public Severity findValueByNumber(int number) { return Severity.forNumber(number); } }; public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { return getDescriptor().getValues().get(ordinal()); } public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { return getDescriptor(); } public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { return org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.getDescriptor().getEnumTypes().get(1); } private static final Severity[] VALUES = values(); public static Severity valueOf( com.google.protobuf.Descriptors.EnumValueDescriptor desc) { if (desc.getType() != getDescriptor()) { throw new java.lang.IllegalArgumentException( "EnumValueDescriptor is not for this type."); } return VALUES[desc.getIndex()]; } private final int value; private Severity(int value) { this.value = value; } // @@protoc_insertion_point(enum_scope:outputProto.GtfsProblem.Severity) } private int bitField0_; public static final int TYPE_FIELD_NUMBER = 1; private int type_; /** * <code>optional .outputProto.GtfsProblem.Type type = 1;</code> * * @return Whether the type field is set. */ public boolean hasType() { return ((bitField0_ & 0x00000001) != 0); } /** * <code>optional .outputProto.GtfsProblem.Type type = 1;</code> * * @return The type. */ public org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Type getType() { @SuppressWarnings("deprecation") org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Type result = org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Type.valueOf(type_); return result == null ? org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Type.TYPE_CSV_UNKNOWN_ERROR : result; } public static final int SEVERITY_FIELD_NUMBER = 2; private int severity_; /** * <code>optional .outputProto.GtfsProblem.Severity severity = 2;</code> * * @return Whether the severity field is set. */ public boolean hasSeverity() { return ((bitField0_ & 0x00000002) != 0); } /** * <code>optional .outputProto.GtfsProblem.Severity severity = 2;</code> * * @return The severity. */ public org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Severity getSeverity() { @SuppressWarnings("deprecation") org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Severity result = org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Severity.valueOf(severity_); return result == null ? org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Severity.WARNING : result; } public static final int CSV_FILE_NAME_FIELD_NUMBER = 3; private volatile java.lang.Object csvFileName_; /** * <pre> * The name of the CSV file (eg. "stops.txt") where this problem occurred. * </pre> * * <code>optional string csv_file_name = 3;</code> * * @return Whether the csvFileName field is set. */ public boolean hasCsvFileName() { return ((bitField0_ & 0x00000004) != 0); } /** * <pre> * The name of the CSV file (eg. "stops.txt") where this problem occurred. * </pre> * * <code>optional string csv_file_name = 3;</code> * * @return The csvFileName. */ public java.lang.String getCsvFileName() { java.lang.Object ref = csvFileName_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { csvFileName_ = s; } return s; } } /** * <pre> * The name of the CSV file (eg. "stops.txt") where this problem occurred. * </pre> * * <code>optional string csv_file_name = 3;</code> * * @return The bytes for csvFileName. */ public com.google.protobuf.ByteString getCsvFileNameBytes() { java.lang.Object ref = csvFileName_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); csvFileName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int CSV_KEY_NAME_FIELD_NUMBER = 4; private volatile java.lang.Object csvKeyName_; /** * <pre> * The name of a CSV key that is implicated in this problem. * </pre> * * <code>optional string csv_key_name = 4;</code> * * @return Whether the csvKeyName field is set. */ public boolean hasCsvKeyName() { return ((bitField0_ & 0x00000008) != 0); } /** * <pre> * The name of a CSV key that is implicated in this problem. * </pre> * * <code>optional string csv_key_name = 4;</code> * * @return The csvKeyName. */ public java.lang.String getCsvKeyName() { java.lang.Object ref = csvKeyName_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { csvKeyName_ = s; } return s; } } /** * <pre> * The name of a CSV key that is implicated in this problem. * </pre> * * <code>optional string csv_key_name = 4;</code> * * @return The bytes for csvKeyName. */ public com.google.protobuf.ByteString getCsvKeyNameBytes() { java.lang.Object ref = csvKeyName_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); csvKeyName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int CSV_COLUMN_NAME_FIELD_NUMBER = 5; private com.google.protobuf.LazyStringList csvColumnName_; /** * <pre> * The name of columns in the CSV file where this problem occurred. * </pre> * * <code>repeated string csv_column_name = 5;</code> * * @return A list containing the csvColumnName. */ public com.google.protobuf.ProtocolStringList getCsvColumnNameList() { return csvColumnName_; } /** * <pre> * The name of columns in the CSV file where this problem occurred. * </pre> * * <code>repeated string csv_column_name = 5;</code> * * @return The count of csvColumnName. */ public int getCsvColumnNameCount() { return csvColumnName_.size(); } /** * <pre> * The name of columns in the CSV file where this problem occurred. * </pre> * * <code>repeated string csv_column_name = 5;</code> * * @param index The index of the element to return. * @return The csvColumnName at the given index. */ public java.lang.String getCsvColumnName(int index) { return csvColumnName_.get(index); } /** * <pre> * The name of columns in the CSV file where this problem occurred. * </pre> * * <code>repeated string csv_column_name = 5;</code> * * @param index The index of the value to return. * @return The bytes of the csvColumnName at the given index. */ public com.google.protobuf.ByteString getCsvColumnNameBytes(int index) { return csvColumnName_.getByteString(index); } public static final int OTHER_CSV_FILE_NAME_FIELD_NUMBER = 15; private volatile java.lang.Object otherCsvFileName_; /** * <pre> * The name of an additional CSV file (eg. "routes.txt") that is related to * this problem. * </pre> * * <code>optional string other_csv_file_name = 15;</code> * * @return Whether the otherCsvFileName field is set. */ public boolean hasOtherCsvFileName() { return ((bitField0_ & 0x00000010) != 0); } /** * <pre> * The name of an additional CSV file (eg. "routes.txt") that is related to * this problem. * </pre> * * <code>optional string other_csv_file_name = 15;</code> * * @return The otherCsvFileName. */ public java.lang.String getOtherCsvFileName() { java.lang.Object ref = otherCsvFileName_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { otherCsvFileName_ = s; } return s; } } /** * <pre> * The name of an additional CSV file (eg. "routes.txt") that is related to * this problem. * </pre> * * <code>optional string other_csv_file_name = 15;</code> * * @return The bytes for otherCsvFileName. */ public com.google.protobuf.ByteString getOtherCsvFileNameBytes() { java.lang.Object ref = otherCsvFileName_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); otherCsvFileName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int OTHER_CSV_KEY_NAME_FIELD_NUMBER = 16; private volatile java.lang.Object otherCsvKeyName_; /** * <pre> * The name of an additional CSV key that is related to this problem. * </pre> * * <code>optional string other_csv_key_name = 16;</code> * * @return Whether the otherCsvKeyName field is set. */ public boolean hasOtherCsvKeyName() { return ((bitField0_ & 0x00000020) != 0); } /** * <pre> * The name of an additional CSV key that is related to this problem. * </pre> * * <code>optional string other_csv_key_name = 16;</code> * * @return The otherCsvKeyName. */ public java.lang.String getOtherCsvKeyName() { java.lang.Object ref = otherCsvKeyName_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { otherCsvKeyName_ = s; } return s; } } /** * <pre> * The name of an additional CSV key that is related to this problem. * </pre> * * <code>optional string other_csv_key_name = 16;</code> * * @return The bytes for otherCsvKeyName. */ public com.google.protobuf.ByteString getOtherCsvKeyNameBytes() { java.lang.Object ref = otherCsvKeyName_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); otherCsvKeyName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int OTHER_CSV_COLUMN_NAME_FIELD_NUMBER = 17; private com.google.protobuf.LazyStringList otherCsvColumnName_; /** * <pre> * The name of additional columns in the alt CSV file that are related to * this problem. * </pre> * * <code>repeated string other_csv_column_name = 17;</code> * * @return A list containing the otherCsvColumnName. */ public com.google.protobuf.ProtocolStringList getOtherCsvColumnNameList() { return otherCsvColumnName_; } /** * <pre> * The name of additional columns in the alt CSV file that are related to * this problem. * </pre> * * <code>repeated string other_csv_column_name = 17;</code> * * @return The count of otherCsvColumnName. */ public int getOtherCsvColumnNameCount() { return otherCsvColumnName_.size(); } /** * <pre> * The name of additional columns in the alt CSV file that are related to * this problem. * </pre> * * <code>repeated string other_csv_column_name = 17;</code> * * @param index The index of the element to return. * @return The otherCsvColumnName at the given index. */ public java.lang.String getOtherCsvColumnName(int index) { return otherCsvColumnName_.get(index); } /** * <pre> * The name of additional columns in the alt CSV file that are related to * this problem. * </pre> * * <code>repeated string other_csv_column_name = 17;</code> * * @param index The index of the value to return. * @return The bytes of the otherCsvColumnName at the given index. */ public com.google.protobuf.ByteString getOtherCsvColumnNameBytes(int index) { return otherCsvColumnName_.getByteString(index); } public static final int ENTITY_ROW_FIELD_NUMBER = 6; private int entityRow_; /** * <pre> * The row number in a CSV file where this problem occurred. The first line * (includes the header) of a file should have an entity_row value of 1. * Typically, the first row of non-header data will have an entity_row value * of 2. * </pre> * * <code>optional uint32 entity_row = 6;</code> * * @return Whether the entityRow field is set. */ public boolean hasEntityRow() { return ((bitField0_ & 0x00000040) != 0); } /** * <pre> * The row number in a CSV file where this problem occurred. The first line * (includes the header) of a file should have an entity_row value of 1. * Typically, the first row of non-header data will have an entity_row value * of 2. * </pre> * * <code>optional uint32 entity_row = 6;</code> * * @return The entityRow. */ public int getEntityRow() { return entityRow_; } public static final int ENTITY_NAME_FIELD_NUMBER = 7; private volatile java.lang.Object entityName_; /** * <pre> * A human-readable name associated with the GTFS entity experiencing a * problem (eg. stop name). * </pre> * * <code>optional string entity_name = 7;</code> * * @return Whether the entityName field is set. */ public boolean hasEntityName() { return ((bitField0_ & 0x00000080) != 0); } /** * <pre> * A human-readable name associated with the GTFS entity experiencing a * problem (eg. stop name). * </pre> * * <code>optional string entity_name = 7;</code> * * @return The entityName. */ public java.lang.String getEntityName() { java.lang.Object ref = entityName_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { entityName_ = s; } return s; } } /** * <pre> * A human-readable name associated with the GTFS entity experiencing a * problem (eg. stop name). * </pre> * * <code>optional string entity_name = 7;</code> * * @return The bytes for entityName. */ public com.google.protobuf.ByteString getEntityNameBytes() { java.lang.Object ref = entityName_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); entityName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int ENTITY_ID_FIELD_NUMBER = 8; private volatile java.lang.Object entityId_; /** * <pre> * A human-readable id associated with the GTFS entity experiencing a problem * (eg. stop id). * </pre> * * <code>optional string entity_id = 8;</code> * * @return Whether the entityId field is set. */ public boolean hasEntityId() { return ((bitField0_ & 0x00000100) != 0); } /** * <pre> * A human-readable id associated with the GTFS entity experiencing a problem * (eg. stop id). * </pre> * * <code>optional string entity_id = 8;</code> * * @return The entityId. */ public java.lang.String getEntityId() { java.lang.Object ref = entityId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { entityId_ = s; } return s; } } /** * <pre> * A human-readable id associated with the GTFS entity experiencing a problem * (eg. stop id). * </pre> * * <code>optional string entity_id = 8;</code> * * @return The bytes for entityId. */ public com.google.protobuf.ByteString getEntityIdBytes() { java.lang.Object ref = entityId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); entityId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int ENTITY_VALUE_FIELD_NUMBER = 9; private volatile java.lang.Object entityValue_; /** * <pre> * A human-readable value associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional string entity_value = 9;</code> * * @return Whether the entityValue field is set. */ public boolean hasEntityValue() { return ((bitField0_ & 0x00000200) != 0); } /** * <pre> * A human-readable value associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional string entity_value = 9;</code> * * @return The entityValue. */ public java.lang.String getEntityValue() { java.lang.Object ref = entityValue_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { entityValue_ = s; } return s; } } /** * <pre> * A human-readable value associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional string entity_value = 9;</code> * * @return The bytes for entityValue. */ public com.google.protobuf.ByteString getEntityValueBytes() { java.lang.Object ref = entityValue_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); entityValue_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int ENTITY_LOCATION_FIELD_NUMBER = 21; private org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto entityLocation_; /** * <pre> * Location information associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional .outputProto.PointProto entity_location = 21;</code> * * @return Whether the entityLocation field is set. */ public boolean hasEntityLocation() { return ((bitField0_ & 0x00000400) != 0); } /** * <pre> * Location information associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional .outputProto.PointProto entity_location = 21;</code> * * @return The entityLocation. */ public org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto getEntityLocation() { return entityLocation_ == null ? org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.getDefaultInstance() : entityLocation_; } /** * <pre> * Location information associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional .outputProto.PointProto entity_location = 21;</code> */ public org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProtoOrBuilder getEntityLocationOrBuilder() { return entityLocation_ == null ? org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.getDefaultInstance() : entityLocation_; } public static final int ALT_ENTITY_ROW_FIELD_NUMBER = 10; private int altEntityRow_; /** * <pre> * The row number in a CSV file of an alternate GTFS entity that's in * conflict with the primary row. * </pre> * * <code>optional uint32 alt_entity_row = 10;</code> * * @return Whether the altEntityRow field is set. */ public boolean hasAltEntityRow() { return ((bitField0_ & 0x00000800) != 0); } /** * <pre> * The row number in a CSV file of an alternate GTFS entity that's in * conflict with the primary row. * </pre> * * <code>optional uint32 alt_entity_row = 10;</code> * * @return The altEntityRow. */ public int getAltEntityRow() { return altEntityRow_; } public static final int ALT_ENTITY_NAME_FIELD_NUMBER = 11; private volatile java.lang.Object altEntityName_; /** * <pre> * A human-readable name associated with an alternate GTFS entity that's in * conflict with the primary row (eg. conflicting stop name). * </pre> * * <code>optional string alt_entity_name = 11;</code> * * @return Whether the altEntityName field is set. */ public boolean hasAltEntityName() { return ((bitField0_ & 0x00001000) != 0); } /** * <pre> * A human-readable name associated with an alternate GTFS entity that's in * conflict with the primary row (eg. conflicting stop name). * </pre> * * <code>optional string alt_entity_name = 11;</code> * * @return The altEntityName. */ public java.lang.String getAltEntityName() { java.lang.Object ref = altEntityName_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { altEntityName_ = s; } return s; } } /** * <pre> * A human-readable name associated with an alternate GTFS entity that's in * conflict with the primary row (eg. conflicting stop name). * </pre> * * <code>optional string alt_entity_name = 11;</code> * * @return The bytes for altEntityName. */ public com.google.protobuf.ByteString getAltEntityNameBytes() { java.lang.Object ref = altEntityName_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); altEntityName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int ALT_ENTITY_ID_FIELD_NUMBER = 12; private volatile java.lang.Object altEntityId_; /** * <pre> * A human-readable id associated with an alternate GTFS entity that's in * conflict with the primary row (eg. conflicting stop id). * </pre> * * <code>optional string alt_entity_id = 12;</code> * * @return Whether the altEntityId field is set. */ public boolean hasAltEntityId() { return ((bitField0_ & 0x00002000) != 0); } /** * <pre> * A human-readable id associated with an alternate GTFS entity that's in * conflict with the primary row (eg. conflicting stop id). * </pre> * * <code>optional string alt_entity_id = 12;</code> * * @return The altEntityId. */ public java.lang.String getAltEntityId() { java.lang.Object ref = altEntityId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { altEntityId_ = s; } return s; } } /** * <pre> * A human-readable id associated with an alternate GTFS entity that's in * conflict with the primary row (eg. conflicting stop id). * </pre> * * <code>optional string alt_entity_id = 12;</code> * * @return The bytes for altEntityId. */ public com.google.protobuf.ByteString getAltEntityIdBytes() { java.lang.Object ref = altEntityId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); altEntityId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int ALT_ENTITY_VALUE_FIELD_NUMBER = 13; private volatile java.lang.Object altEntityValue_; /** * <pre> * A human-readable value associated with the alernate GTFS entity * experiencing a problem. * </pre> * * <code>optional string alt_entity_value = 13;</code> * * @return Whether the altEntityValue field is set. */ public boolean hasAltEntityValue() { return ((bitField0_ & 0x00004000) != 0); } /** * <pre> * A human-readable value associated with the alernate GTFS entity * experiencing a problem. * </pre> * * <code>optional string alt_entity_value = 13;</code> * * @return The altEntityValue. */ public java.lang.String getAltEntityValue() { java.lang.Object ref = altEntityValue_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { altEntityValue_ = s; } return s; } } /** * <pre> * A human-readable value associated with the alernate GTFS entity * experiencing a problem. * </pre> * * <code>optional string alt_entity_value = 13;</code> * * @return The bytes for altEntityValue. */ public com.google.protobuf.ByteString getAltEntityValueBytes() { java.lang.Object ref = altEntityValue_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); altEntityValue_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int ALT_ENTITY_LOCATION_FIELD_NUMBER = 22; private org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto altEntityLocation_; /** * <pre> * Location information associated with the alternate GTFS entity * experiencing a problem. * </pre> * * <code>optional .outputProto.PointProto alt_entity_location = 22;</code> * * @return Whether the altEntityLocation field is set. */ public boolean hasAltEntityLocation() { return ((bitField0_ & 0x00008000) != 0); } /** * <pre> * Location information associated with the alternate GTFS entity * experiencing a problem. * </pre> * * <code>optional .outputProto.PointProto alt_entity_location = 22;</code> * * @return The altEntityLocation. */ public org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto getAltEntityLocation() { return altEntityLocation_ == null ? org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.getDefaultInstance() : altEntityLocation_; } /** * <pre> * Location information associated with the alternate GTFS entity * experiencing a problem. * </pre> * * <code>optional .outputProto.PointProto alt_entity_location = 22;</code> */ public org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProtoOrBuilder getAltEntityLocationOrBuilder() { return altEntityLocation_ == null ? org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.getDefaultInstance() : altEntityLocation_; } public static final int PARENT_ENTITY_ROW_FIELD_NUMBER = 18; private int parentEntityRow_; /** * <pre> * The row number in a CSV file of a GTFS entity that's a parent to the * primary entity. * </pre> * * <code>optional uint32 parent_entity_row = 18;</code> * * @return Whether the parentEntityRow field is set. */ public boolean hasParentEntityRow() { return ((bitField0_ & 0x00010000) != 0); } /** * <pre> * The row number in a CSV file of a GTFS entity that's a parent to the * primary entity. * </pre> * * <code>optional uint32 parent_entity_row = 18;</code> * * @return The parentEntityRow. */ public int getParentEntityRow() { return parentEntityRow_; } public static final int PARENT_ENTITY_NAME_FIELD_NUMBER = 19; private volatile java.lang.Object parentEntityName_; /** * <pre> * A human-readable name associated with the parent GTFS entity. * </pre> * * <code>optional string parent_entity_name = 19;</code> * * @return Whether the parentEntityName field is set. */ public boolean hasParentEntityName() { return ((bitField0_ & 0x00020000) != 0); } /** * <pre> * A human-readable name associated with the parent GTFS entity. * </pre> * * <code>optional string parent_entity_name = 19;</code> * * @return The parentEntityName. */ public java.lang.String getParentEntityName() { java.lang.Object ref = parentEntityName_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { parentEntityName_ = s; } return s; } } /** * <pre> * A human-readable name associated with the parent GTFS entity. * </pre> * * <code>optional string parent_entity_name = 19;</code> * * @return The bytes for parentEntityName. */ public com.google.protobuf.ByteString getParentEntityNameBytes() { java.lang.Object ref = parentEntityName_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); parentEntityName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int PARENT_ENTITY_ID_FIELD_NUMBER = 20; private volatile java.lang.Object parentEntityId_; /** * <pre> * A human-readable id associated with the parent GTFS entity. * </pre> * * <code>optional string parent_entity_id = 20;</code> * * @return Whether the parentEntityId field is set. */ public boolean hasParentEntityId() { return ((bitField0_ & 0x00040000) != 0); } /** * <pre> * A human-readable id associated with the parent GTFS entity. * </pre> * * <code>optional string parent_entity_id = 20;</code> * * @return The parentEntityId. */ public java.lang.String getParentEntityId() { java.lang.Object ref = parentEntityId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { parentEntityId_ = s; } return s; } } /** * <pre> * A human-readable id associated with the parent GTFS entity. * </pre> * * <code>optional string parent_entity_id = 20;</code> * * @return The bytes for parentEntityId. */ public com.google.protobuf.ByteString getParentEntityIdBytes() { java.lang.Object ref = parentEntityId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); parentEntityId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int VALUE_FIELD_NUMBER = 14; private volatile java.lang.Object value_; /** * <pre> * A value associated with the problem. This could be an invalid value * pulled from the GTFS directly or some other related value (eg "travel is * to too fast, a X kph", where X is replaced with 'value'). * </pre> * * <code>optional string value = 14;</code> * * @return Whether the value field is set. */ public boolean hasValue() { return ((bitField0_ & 0x00080000) != 0); } /** * <pre> * A value associated with the problem. This could be an invalid value * pulled from the GTFS directly or some other related value (eg "travel is * to too fast, a X kph", where X is replaced with 'value'). * </pre> * * <code>optional string value = 14;</code> * * @return The value. */ public java.lang.String getValue() { java.lang.Object ref = value_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { value_ = s; } return s; } } /** * <pre> * A value associated with the problem. This could be an invalid value * pulled from the GTFS directly or some other related value (eg "travel is * to too fast, a X kph", where X is replaced with 'value'). * </pre> * * <code>optional string value = 14;</code> * * @return The bytes for value. */ public com.google.protobuf.ByteString getValueBytes() { java.lang.Object ref = value_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); value_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int ALT_VALUE_FIELD_NUMBER = 23; private volatile java.lang.Object altValue_; /** * <pre> * An alternate value associated with the problem. Similar to 'value' field * in use, use 'value' and 'alt_value' when two values are associated with * the same primary entity. Use 'entity_value' and 'alt_entity_value' when * the two values are associated with separate entities in the same file. * </pre> * * <code>optional string alt_value = 23;</code> * * @return Whether the altValue field is set. */ public boolean hasAltValue() { return ((bitField0_ & 0x00100000) != 0); } /** * <pre> * An alternate value associated with the problem. Similar to 'value' field * in use, use 'value' and 'alt_value' when two values are associated with * the same primary entity. Use 'entity_value' and 'alt_entity_value' when * the two values are associated with separate entities in the same file. * </pre> * * <code>optional string alt_value = 23;</code> * * @return The altValue. */ public java.lang.String getAltValue() { java.lang.Object ref = altValue_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { altValue_ = s; } return s; } } /** * <pre> * An alternate value associated with the problem. Similar to 'value' field * in use, use 'value' and 'alt_value' when two values are associated with * the same primary entity. Use 'entity_value' and 'alt_entity_value' when * the two values are associated with separate entities in the same file. * </pre> * * <code>optional string alt_value = 23;</code> * * @return The bytes for altValue. */ public com.google.protobuf.ByteString getAltValueBytes() { java.lang.Object ref = altValue_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); altValue_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int IMPORTANCE_FIELD_NUMBER = 24; private double importance_; /** * <pre> * A value in the range [0.0, 1.0] (most important is 1.0), indicating the * importance of the problem based on the importance of the locations of the * geographical entities involved. * </pre> * * <code>optional double importance = 24;</code> * * @return Whether the importance field is set. */ public boolean hasImportance() { return ((bitField0_ & 0x00200000) != 0); } /** * <pre> * A value in the range [0.0, 1.0] (most important is 1.0), indicating the * importance of the problem based on the importance of the locations of the * geographical entities involved. * </pre> * * <code>optional double importance = 24;</code> * * @return The importance. */ public double getImportance() { return importance_; } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (((bitField0_ & 0x00000001) != 0)) { output.writeEnum(1, type_); } if (((bitField0_ & 0x00000002) != 0)) { output.writeEnum(2, severity_); } if (((bitField0_ & 0x00000004) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 3, csvFileName_); } if (((bitField0_ & 0x00000008) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 4, csvKeyName_); } for (int i = 0; i < csvColumnName_.size(); i++) { com.google.protobuf.GeneratedMessageV3.writeString(output, 5, csvColumnName_.getRaw(i)); } if (((bitField0_ & 0x00000040) != 0)) { output.writeUInt32(6, entityRow_); } if (((bitField0_ & 0x00000080) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 7, entityName_); } if (((bitField0_ & 0x00000100) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 8, entityId_); } if (((bitField0_ & 0x00000200) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 9, entityValue_); } if (((bitField0_ & 0x00000800) != 0)) { output.writeUInt32(10, altEntityRow_); } if (((bitField0_ & 0x00001000) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 11, altEntityName_); } if (((bitField0_ & 0x00002000) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 12, altEntityId_); } if (((bitField0_ & 0x00004000) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 13, altEntityValue_); } if (((bitField0_ & 0x00080000) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 14, value_); } if (((bitField0_ & 0x00000010) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 15, otherCsvFileName_); } if (((bitField0_ & 0x00000020) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 16, otherCsvKeyName_); } for (int i = 0; i < otherCsvColumnName_.size(); i++) { com.google.protobuf.GeneratedMessageV3.writeString(output, 17, otherCsvColumnName_.getRaw(i)); } if (((bitField0_ & 0x00010000) != 0)) { output.writeUInt32(18, parentEntityRow_); } if (((bitField0_ & 0x00020000) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 19, parentEntityName_); } if (((bitField0_ & 0x00040000) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 20, parentEntityId_); } if (((bitField0_ & 0x00000400) != 0)) { output.writeMessage(21, getEntityLocation()); } if (((bitField0_ & 0x00008000) != 0)) { output.writeMessage(22, getAltEntityLocation()); } if (((bitField0_ & 0x00100000) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 23, altValue_); } if (((bitField0_ & 0x00200000) != 0)) { output.writeDouble(24, importance_); } unknownFields.writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream .computeEnumSize(1, type_); } if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream .computeEnumSize(2, severity_); } if (((bitField0_ & 0x00000004) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, csvFileName_); } if (((bitField0_ & 0x00000008) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, csvKeyName_); } { int dataSize = 0; for (int i = 0; i < csvColumnName_.size(); i++) { dataSize += computeStringSizeNoTag(csvColumnName_.getRaw(i)); } size += dataSize; size += 1 * getCsvColumnNameList().size(); } if (((bitField0_ & 0x00000040) != 0)) { size += com.google.protobuf.CodedOutputStream .computeUInt32Size(6, entityRow_); } if (((bitField0_ & 0x00000080) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, entityName_); } if (((bitField0_ & 0x00000100) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(8, entityId_); } if (((bitField0_ & 0x00000200) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(9, entityValue_); } if (((bitField0_ & 0x00000800) != 0)) { size += com.google.protobuf.CodedOutputStream .computeUInt32Size(10, altEntityRow_); } if (((bitField0_ & 0x00001000) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(11, altEntityName_); } if (((bitField0_ & 0x00002000) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(12, altEntityId_); } if (((bitField0_ & 0x00004000) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(13, altEntityValue_); } if (((bitField0_ & 0x00080000) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(14, value_); } if (((bitField0_ & 0x00000010) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(15, otherCsvFileName_); } if (((bitField0_ & 0x00000020) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(16, otherCsvKeyName_); } { int dataSize = 0; for (int i = 0; i < otherCsvColumnName_.size(); i++) { dataSize += computeStringSizeNoTag(otherCsvColumnName_.getRaw(i)); } size += dataSize; size += 2 * getOtherCsvColumnNameList().size(); } if (((bitField0_ & 0x00010000) != 0)) { size += com.google.protobuf.CodedOutputStream .computeUInt32Size(18, parentEntityRow_); } if (((bitField0_ & 0x00020000) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(19, parentEntityName_); } if (((bitField0_ & 0x00040000) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(20, parentEntityId_); } if (((bitField0_ & 0x00000400) != 0)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(21, getEntityLocation()); } if (((bitField0_ & 0x00008000) != 0)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(22, getAltEntityLocation()); } if (((bitField0_ & 0x00100000) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(23, altValue_); } if (((bitField0_ & 0x00200000) != 0)) { size += com.google.protobuf.CodedOutputStream .computeDoubleSize(24, importance_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem)) { return super.equals(obj); } org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem other = (org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem) obj; if (hasType() != other.hasType()) return false; if (hasType()) { if (type_ != other.type_) return false; } if (hasSeverity() != other.hasSeverity()) return false; if (hasSeverity()) { if (severity_ != other.severity_) return false; } if (hasCsvFileName() != other.hasCsvFileName()) return false; if (hasCsvFileName()) { if (!getCsvFileName() .equals(other.getCsvFileName())) return false; } if (hasCsvKeyName() != other.hasCsvKeyName()) return false; if (hasCsvKeyName()) { if (!getCsvKeyName() .equals(other.getCsvKeyName())) return false; } if (!getCsvColumnNameList() .equals(other.getCsvColumnNameList())) return false; if (hasOtherCsvFileName() != other.hasOtherCsvFileName()) return false; if (hasOtherCsvFileName()) { if (!getOtherCsvFileName() .equals(other.getOtherCsvFileName())) return false; } if (hasOtherCsvKeyName() != other.hasOtherCsvKeyName()) return false; if (hasOtherCsvKeyName()) { if (!getOtherCsvKeyName() .equals(other.getOtherCsvKeyName())) return false; } if (!getOtherCsvColumnNameList() .equals(other.getOtherCsvColumnNameList())) return false; if (hasEntityRow() != other.hasEntityRow()) return false; if (hasEntityRow()) { if (getEntityRow() != other.getEntityRow()) return false; } if (hasEntityName() != other.hasEntityName()) return false; if (hasEntityName()) { if (!getEntityName() .equals(other.getEntityName())) return false; } if (hasEntityId() != other.hasEntityId()) return false; if (hasEntityId()) { if (!getEntityId() .equals(other.getEntityId())) return false; } if (hasEntityValue() != other.hasEntityValue()) return false; if (hasEntityValue()) { if (!getEntityValue() .equals(other.getEntityValue())) return false; } if (hasEntityLocation() != other.hasEntityLocation()) return false; if (hasEntityLocation()) { if (!getEntityLocation() .equals(other.getEntityLocation())) return false; } if (hasAltEntityRow() != other.hasAltEntityRow()) return false; if (hasAltEntityRow()) { if (getAltEntityRow() != other.getAltEntityRow()) return false; } if (hasAltEntityName() != other.hasAltEntityName()) return false; if (hasAltEntityName()) { if (!getAltEntityName() .equals(other.getAltEntityName())) return false; } if (hasAltEntityId() != other.hasAltEntityId()) return false; if (hasAltEntityId()) { if (!getAltEntityId() .equals(other.getAltEntityId())) return false; } if (hasAltEntityValue() != other.hasAltEntityValue()) return false; if (hasAltEntityValue()) { if (!getAltEntityValue() .equals(other.getAltEntityValue())) return false; } if (hasAltEntityLocation() != other.hasAltEntityLocation()) return false; if (hasAltEntityLocation()) { if (!getAltEntityLocation() .equals(other.getAltEntityLocation())) return false; } if (hasParentEntityRow() != other.hasParentEntityRow()) return false; if (hasParentEntityRow()) { if (getParentEntityRow() != other.getParentEntityRow()) return false; } if (hasParentEntityName() != other.hasParentEntityName()) return false; if (hasParentEntityName()) { if (!getParentEntityName() .equals(other.getParentEntityName())) return false; } if (hasParentEntityId() != other.hasParentEntityId()) return false; if (hasParentEntityId()) { if (!getParentEntityId() .equals(other.getParentEntityId())) return false; } if (hasValue() != other.hasValue()) return false; if (hasValue()) { if (!getValue() .equals(other.getValue())) return false; } if (hasAltValue() != other.hasAltValue()) return false; if (hasAltValue()) { if (!getAltValue() .equals(other.getAltValue())) return false; } if (hasImportance() != other.hasImportance()) return false; if (hasImportance()) { if (java.lang.Double.doubleToLongBits(getImportance()) != java.lang.Double.doubleToLongBits( other.getImportance())) return false; } if (!unknownFields.equals(other.unknownFields)) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasType()) { hash = (37 * hash) + TYPE_FIELD_NUMBER; hash = (53 * hash) + type_; } if (hasSeverity()) { hash = (37 * hash) + SEVERITY_FIELD_NUMBER; hash = (53 * hash) + severity_; } if (hasCsvFileName()) { hash = (37 * hash) + CSV_FILE_NAME_FIELD_NUMBER; hash = (53 * hash) + getCsvFileName().hashCode(); } if (hasCsvKeyName()) { hash = (37 * hash) + CSV_KEY_NAME_FIELD_NUMBER; hash = (53 * hash) + getCsvKeyName().hashCode(); } if (getCsvColumnNameCount() > 0) { hash = (37 * hash) + CSV_COLUMN_NAME_FIELD_NUMBER; hash = (53 * hash) + getCsvColumnNameList().hashCode(); } if (hasOtherCsvFileName()) { hash = (37 * hash) + OTHER_CSV_FILE_NAME_FIELD_NUMBER; hash = (53 * hash) + getOtherCsvFileName().hashCode(); } if (hasOtherCsvKeyName()) { hash = (37 * hash) + OTHER_CSV_KEY_NAME_FIELD_NUMBER; hash = (53 * hash) + getOtherCsvKeyName().hashCode(); } if (getOtherCsvColumnNameCount() > 0) { hash = (37 * hash) + OTHER_CSV_COLUMN_NAME_FIELD_NUMBER; hash = (53 * hash) + getOtherCsvColumnNameList().hashCode(); } if (hasEntityRow()) { hash = (37 * hash) + ENTITY_ROW_FIELD_NUMBER; hash = (53 * hash) + getEntityRow(); } if (hasEntityName()) { hash = (37 * hash) + ENTITY_NAME_FIELD_NUMBER; hash = (53 * hash) + getEntityName().hashCode(); } if (hasEntityId()) { hash = (37 * hash) + ENTITY_ID_FIELD_NUMBER; hash = (53 * hash) + getEntityId().hashCode(); } if (hasEntityValue()) { hash = (37 * hash) + ENTITY_VALUE_FIELD_NUMBER; hash = (53 * hash) + getEntityValue().hashCode(); } if (hasEntityLocation()) { hash = (37 * hash) + ENTITY_LOCATION_FIELD_NUMBER; hash = (53 * hash) + getEntityLocation().hashCode(); } if (hasAltEntityRow()) { hash = (37 * hash) + ALT_ENTITY_ROW_FIELD_NUMBER; hash = (53 * hash) + getAltEntityRow(); } if (hasAltEntityName()) { hash = (37 * hash) + ALT_ENTITY_NAME_FIELD_NUMBER; hash = (53 * hash) + getAltEntityName().hashCode(); } if (hasAltEntityId()) { hash = (37 * hash) + ALT_ENTITY_ID_FIELD_NUMBER; hash = (53 * hash) + getAltEntityId().hashCode(); } if (hasAltEntityValue()) { hash = (37 * hash) + ALT_ENTITY_VALUE_FIELD_NUMBER; hash = (53 * hash) + getAltEntityValue().hashCode(); } if (hasAltEntityLocation()) { hash = (37 * hash) + ALT_ENTITY_LOCATION_FIELD_NUMBER; hash = (53 * hash) + getAltEntityLocation().hashCode(); } if (hasParentEntityRow()) { hash = (37 * hash) + PARENT_ENTITY_ROW_FIELD_NUMBER; hash = (53 * hash) + getParentEntityRow(); } if (hasParentEntityName()) { hash = (37 * hash) + PARENT_ENTITY_NAME_FIELD_NUMBER; hash = (53 * hash) + getParentEntityName().hashCode(); } if (hasParentEntityId()) { hash = (37 * hash) + PARENT_ENTITY_ID_FIELD_NUMBER; hash = (53 * hash) + getParentEntityId().hashCode(); } if (hasValue()) { hash = (37 * hash) + VALUE_FIELD_NUMBER; hash = (53 * hash) + getValue().hashCode(); } if (hasAltValue()) { hash = (37 * hash) + ALT_VALUE_FIELD_NUMBER; hash = (53 * hash) + getAltValue().hashCode(); } if (hasImportance()) { hash = (37 * hash) + IMPORTANCE_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( java.lang.Double.doubleToLongBits(getImportance())); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * <pre> * A specific GTFS validation problem. * </pre> * <p> * Protobuf type {@code outputProto.GtfsProblem} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:outputProto.GtfsProblem) org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblemOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.internal_static_outputProto_GtfsProblem_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.internal_static_outputProto_GtfsProblem_fieldAccessorTable .ensureFieldAccessorsInitialized( org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.class, org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Builder.class); } // Construct using org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { getEntityLocationFieldBuilder(); getAltEntityLocationFieldBuilder(); } } @java.lang.Override public Builder clear() { super.clear(); type_ = 1; bitField0_ = (bitField0_ & ~0x00000001); severity_ = 1; bitField0_ = (bitField0_ & ~0x00000002); csvFileName_ = ""; bitField0_ = (bitField0_ & ~0x00000004); csvKeyName_ = ""; bitField0_ = (bitField0_ & ~0x00000008); csvColumnName_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000010); otherCsvFileName_ = ""; bitField0_ = (bitField0_ & ~0x00000020); otherCsvKeyName_ = ""; bitField0_ = (bitField0_ & ~0x00000040); otherCsvColumnName_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000080); entityRow_ = 0; bitField0_ = (bitField0_ & ~0x00000100); entityName_ = ""; bitField0_ = (bitField0_ & ~0x00000200); entityId_ = ""; bitField0_ = (bitField0_ & ~0x00000400); entityValue_ = ""; bitField0_ = (bitField0_ & ~0x00000800); if (entityLocationBuilder_ == null) { entityLocation_ = null; } else { entityLocationBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00001000); altEntityRow_ = 0; bitField0_ = (bitField0_ & ~0x00002000); altEntityName_ = ""; bitField0_ = (bitField0_ & ~0x00004000); altEntityId_ = ""; bitField0_ = (bitField0_ & ~0x00008000); altEntityValue_ = ""; bitField0_ = (bitField0_ & ~0x00010000); if (altEntityLocationBuilder_ == null) { altEntityLocation_ = null; } else { altEntityLocationBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00020000); parentEntityRow_ = 0; bitField0_ = (bitField0_ & ~0x00040000); parentEntityName_ = ""; bitField0_ = (bitField0_ & ~0x00080000); parentEntityId_ = ""; bitField0_ = (bitField0_ & ~0x00100000); value_ = ""; bitField0_ = (bitField0_ & ~0x00200000); altValue_ = ""; bitField0_ = (bitField0_ & ~0x00400000); importance_ = 0D; bitField0_ = (bitField0_ & ~0x00800000); return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.internal_static_outputProto_GtfsProblem_descriptor; } @java.lang.Override public org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem getDefaultInstanceForType() { return org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.getDefaultInstance(); } @java.lang.Override public org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem build() { org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem buildPartial() { org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem result = new org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) != 0)) { to_bitField0_ |= 0x00000001; } result.type_ = type_; if (((from_bitField0_ & 0x00000002) != 0)) { to_bitField0_ |= 0x00000002; } result.severity_ = severity_; if (((from_bitField0_ & 0x00000004) != 0)) { to_bitField0_ |= 0x00000004; } result.csvFileName_ = csvFileName_; if (((from_bitField0_ & 0x00000008) != 0)) { to_bitField0_ |= 0x00000008; } result.csvKeyName_ = csvKeyName_; if (((bitField0_ & 0x00000010) != 0)) { csvColumnName_ = csvColumnName_.getUnmodifiableView(); bitField0_ = (bitField0_ & ~0x00000010); } result.csvColumnName_ = csvColumnName_; if (((from_bitField0_ & 0x00000020) != 0)) { to_bitField0_ |= 0x00000010; } result.otherCsvFileName_ = otherCsvFileName_; if (((from_bitField0_ & 0x00000040) != 0)) { to_bitField0_ |= 0x00000020; } result.otherCsvKeyName_ = otherCsvKeyName_; if (((bitField0_ & 0x00000080) != 0)) { otherCsvColumnName_ = otherCsvColumnName_.getUnmodifiableView(); bitField0_ = (bitField0_ & ~0x00000080); } result.otherCsvColumnName_ = otherCsvColumnName_; if (((from_bitField0_ & 0x00000100) != 0)) { result.entityRow_ = entityRow_; to_bitField0_ |= 0x00000040; } if (((from_bitField0_ & 0x00000200) != 0)) { to_bitField0_ |= 0x00000080; } result.entityName_ = entityName_; if (((from_bitField0_ & 0x00000400) != 0)) { to_bitField0_ |= 0x00000100; } result.entityId_ = entityId_; if (((from_bitField0_ & 0x00000800) != 0)) { to_bitField0_ |= 0x00000200; } result.entityValue_ = entityValue_; if (((from_bitField0_ & 0x00001000) != 0)) { if (entityLocationBuilder_ == null) { result.entityLocation_ = entityLocation_; } else { result.entityLocation_ = entityLocationBuilder_.build(); } to_bitField0_ |= 0x00000400; } if (((from_bitField0_ & 0x00002000) != 0)) { result.altEntityRow_ = altEntityRow_; to_bitField0_ |= 0x00000800; } if (((from_bitField0_ & 0x00004000) != 0)) { to_bitField0_ |= 0x00001000; } result.altEntityName_ = altEntityName_; if (((from_bitField0_ & 0x00008000) != 0)) { to_bitField0_ |= 0x00002000; } result.altEntityId_ = altEntityId_; if (((from_bitField0_ & 0x00010000) != 0)) { to_bitField0_ |= 0x00004000; } result.altEntityValue_ = altEntityValue_; if (((from_bitField0_ & 0x00020000) != 0)) { if (altEntityLocationBuilder_ == null) { result.altEntityLocation_ = altEntityLocation_; } else { result.altEntityLocation_ = altEntityLocationBuilder_.build(); } to_bitField0_ |= 0x00008000; } if (((from_bitField0_ & 0x00040000) != 0)) { result.parentEntityRow_ = parentEntityRow_; to_bitField0_ |= 0x00010000; } if (((from_bitField0_ & 0x00080000) != 0)) { to_bitField0_ |= 0x00020000; } result.parentEntityName_ = parentEntityName_; if (((from_bitField0_ & 0x00100000) != 0)) { to_bitField0_ |= 0x00040000; } result.parentEntityId_ = parentEntityId_; if (((from_bitField0_ & 0x00200000) != 0)) { to_bitField0_ |= 0x00080000; } result.value_ = value_; if (((from_bitField0_ & 0x00400000) != 0)) { to_bitField0_ |= 0x00100000; } result.altValue_ = altValue_; if (((from_bitField0_ & 0x00800000) != 0)) { result.importance_ = importance_; to_bitField0_ |= 0x00200000; } result.bitField0_ = to_bitField0_; onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem) { return mergeFrom((org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem) other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem other) { if (other == org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.getDefaultInstance()) return this; if (other.hasType()) { setType(other.getType()); } if (other.hasSeverity()) { setSeverity(other.getSeverity()); } if (other.hasCsvFileName()) { bitField0_ |= 0x00000004; csvFileName_ = other.csvFileName_; onChanged(); } if (other.hasCsvKeyName()) { bitField0_ |= 0x00000008; csvKeyName_ = other.csvKeyName_; onChanged(); } if (!other.csvColumnName_.isEmpty()) { if (csvColumnName_.isEmpty()) { csvColumnName_ = other.csvColumnName_; bitField0_ = (bitField0_ & ~0x00000010); } else { ensureCsvColumnNameIsMutable(); csvColumnName_.addAll(other.csvColumnName_); } onChanged(); } if (other.hasOtherCsvFileName()) { bitField0_ |= 0x00000020; otherCsvFileName_ = other.otherCsvFileName_; onChanged(); } if (other.hasOtherCsvKeyName()) { bitField0_ |= 0x00000040; otherCsvKeyName_ = other.otherCsvKeyName_; onChanged(); } if (!other.otherCsvColumnName_.isEmpty()) { if (otherCsvColumnName_.isEmpty()) { otherCsvColumnName_ = other.otherCsvColumnName_; bitField0_ = (bitField0_ & ~0x00000080); } else { ensureOtherCsvColumnNameIsMutable(); otherCsvColumnName_.addAll(other.otherCsvColumnName_); } onChanged(); } if (other.hasEntityRow()) { setEntityRow(other.getEntityRow()); } if (other.hasEntityName()) { bitField0_ |= 0x00000200; entityName_ = other.entityName_; onChanged(); } if (other.hasEntityId()) { bitField0_ |= 0x00000400; entityId_ = other.entityId_; onChanged(); } if (other.hasEntityValue()) { bitField0_ |= 0x00000800; entityValue_ = other.entityValue_; onChanged(); } if (other.hasEntityLocation()) { mergeEntityLocation(other.getEntityLocation()); } if (other.hasAltEntityRow()) { setAltEntityRow(other.getAltEntityRow()); } if (other.hasAltEntityName()) { bitField0_ |= 0x00004000; altEntityName_ = other.altEntityName_; onChanged(); } if (other.hasAltEntityId()) { bitField0_ |= 0x00008000; altEntityId_ = other.altEntityId_; onChanged(); } if (other.hasAltEntityValue()) { bitField0_ |= 0x00010000; altEntityValue_ = other.altEntityValue_; onChanged(); } if (other.hasAltEntityLocation()) { mergeAltEntityLocation(other.getAltEntityLocation()); } if (other.hasParentEntityRow()) { setParentEntityRow(other.getParentEntityRow()); } if (other.hasParentEntityName()) { bitField0_ |= 0x00080000; parentEntityName_ = other.parentEntityName_; onChanged(); } if (other.hasParentEntityId()) { bitField0_ |= 0x00100000; parentEntityId_ = other.parentEntityId_; onChanged(); } if (other.hasValue()) { bitField0_ |= 0x00200000; value_ = other.value_; onChanged(); } if (other.hasAltValue()) { bitField0_ |= 0x00400000; altValue_ = other.altValue_; onChanged(); } if (other.hasImportance()) { setImportance(other.getImportance()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; private int type_ = 1; /** * <code>optional .outputProto.GtfsProblem.Type type = 1;</code> * * @return Whether the type field is set. */ public boolean hasType() { return ((bitField0_ & 0x00000001) != 0); } /** * <code>optional .outputProto.GtfsProblem.Type type = 1;</code> * * @return The type. */ public org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Type getType() { @SuppressWarnings("deprecation") org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Type result = org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Type.valueOf(type_); return result == null ? org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Type.TYPE_CSV_UNKNOWN_ERROR : result; } /** * <code>optional .outputProto.GtfsProblem.Type type = 1;</code> * * @param value The type to set. * @return This builder for chaining. */ public Builder setType(org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Type value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; type_ = value.getNumber(); onChanged(); return this; } /** * <code>optional .outputProto.GtfsProblem.Type type = 1;</code> * * @return This builder for chaining. */ public Builder clearType() { bitField0_ = (bitField0_ & ~0x00000001); type_ = 1; onChanged(); return this; } private int severity_ = 1; /** * <code>optional .outputProto.GtfsProblem.Severity severity = 2;</code> * * @return Whether the severity field is set. */ public boolean hasSeverity() { return ((bitField0_ & 0x00000002) != 0); } /** * <code>optional .outputProto.GtfsProblem.Severity severity = 2;</code> * * @return The severity. */ public org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Severity getSeverity() { @SuppressWarnings("deprecation") org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Severity result = org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Severity.valueOf(severity_); return result == null ? org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Severity.WARNING : result; } /** * <code>optional .outputProto.GtfsProblem.Severity severity = 2;</code> * * @param value The severity to set. * @return This builder for chaining. */ public Builder setSeverity(org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem.Severity value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; severity_ = value.getNumber(); onChanged(); return this; } /** * <code>optional .outputProto.GtfsProblem.Severity severity = 2;</code> * * @return This builder for chaining. */ public Builder clearSeverity() { bitField0_ = (bitField0_ & ~0x00000002); severity_ = 1; onChanged(); return this; } private java.lang.Object csvFileName_ = ""; /** * <pre> * The name of the CSV file (eg. "stops.txt") where this problem occurred. * </pre> * * <code>optional string csv_file_name = 3;</code> * * @return Whether the csvFileName field is set. */ public boolean hasCsvFileName() { return ((bitField0_ & 0x00000004) != 0); } /** * <pre> * The name of the CSV file (eg. "stops.txt") where this problem occurred. * </pre> * * <code>optional string csv_file_name = 3;</code> * * @return The csvFileName. */ public java.lang.String getCsvFileName() { java.lang.Object ref = csvFileName_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { csvFileName_ = s; } return s; } else { return (java.lang.String) ref; } } /** * <pre> * The name of the CSV file (eg. "stops.txt") where this problem occurred. * </pre> * * <code>optional string csv_file_name = 3;</code> * * @return The bytes for csvFileName. */ public com.google.protobuf.ByteString getCsvFileNameBytes() { java.lang.Object ref = csvFileName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); csvFileName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * The name of the CSV file (eg. "stops.txt") where this problem occurred. * </pre> * * <code>optional string csv_file_name = 3;</code> * * @param value The csvFileName to set. * @return This builder for chaining. */ public Builder setCsvFileName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; csvFileName_ = value; onChanged(); return this; } /** * <pre> * The name of the CSV file (eg. "stops.txt") where this problem occurred. * </pre> * * <code>optional string csv_file_name = 3;</code> * * @return This builder for chaining. */ public Builder clearCsvFileName() { bitField0_ = (bitField0_ & ~0x00000004); csvFileName_ = getDefaultInstance().getCsvFileName(); onChanged(); return this; } /** * <pre> * The name of the CSV file (eg. "stops.txt") where this problem occurred. * </pre> * * <code>optional string csv_file_name = 3;</code> * * @param value The bytes for csvFileName to set. * @return This builder for chaining. */ public Builder setCsvFileNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; csvFileName_ = value; onChanged(); return this; } private java.lang.Object csvKeyName_ = ""; /** * <pre> * The name of a CSV key that is implicated in this problem. * </pre> * * <code>optional string csv_key_name = 4;</code> * * @return Whether the csvKeyName field is set. */ public boolean hasCsvKeyName() { return ((bitField0_ & 0x00000008) != 0); } /** * <pre> * The name of a CSV key that is implicated in this problem. * </pre> * * <code>optional string csv_key_name = 4;</code> * * @return The csvKeyName. */ public java.lang.String getCsvKeyName() { java.lang.Object ref = csvKeyName_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { csvKeyName_ = s; } return s; } else { return (java.lang.String) ref; } } /** * <pre> * The name of a CSV key that is implicated in this problem. * </pre> * * <code>optional string csv_key_name = 4;</code> * * @return The bytes for csvKeyName. */ public com.google.protobuf.ByteString getCsvKeyNameBytes() { java.lang.Object ref = csvKeyName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); csvKeyName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * The name of a CSV key that is implicated in this problem. * </pre> * * <code>optional string csv_key_name = 4;</code> * * @param value The csvKeyName to set. * @return This builder for chaining. */ public Builder setCsvKeyName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; csvKeyName_ = value; onChanged(); return this; } /** * <pre> * The name of a CSV key that is implicated in this problem. * </pre> * * <code>optional string csv_key_name = 4;</code> * * @return This builder for chaining. */ public Builder clearCsvKeyName() { bitField0_ = (bitField0_ & ~0x00000008); csvKeyName_ = getDefaultInstance().getCsvKeyName(); onChanged(); return this; } /** * <pre> * The name of a CSV key that is implicated in this problem. * </pre> * * <code>optional string csv_key_name = 4;</code> * * @param value The bytes for csvKeyName to set. * @return This builder for chaining. */ public Builder setCsvKeyNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; csvKeyName_ = value; onChanged(); return this; } private com.google.protobuf.LazyStringList csvColumnName_ = com.google.protobuf.LazyStringArrayList.EMPTY; private void ensureCsvColumnNameIsMutable() { if (!((bitField0_ & 0x00000010) != 0)) { csvColumnName_ = new com.google.protobuf.LazyStringArrayList(csvColumnName_); bitField0_ |= 0x00000010; } } /** * <pre> * The name of columns in the CSV file where this problem occurred. * </pre> * * <code>repeated string csv_column_name = 5;</code> * * @return A list containing the csvColumnName. */ public com.google.protobuf.ProtocolStringList getCsvColumnNameList() { return csvColumnName_.getUnmodifiableView(); } /** * <pre> * The name of columns in the CSV file where this problem occurred. * </pre> * * <code>repeated string csv_column_name = 5;</code> * * @return The count of csvColumnName. */ public int getCsvColumnNameCount() { return csvColumnName_.size(); } /** * <pre> * The name of columns in the CSV file where this problem occurred. * </pre> * * <code>repeated string csv_column_name = 5;</code> * * @param index The index of the element to return. * @return The csvColumnName at the given index. */ public java.lang.String getCsvColumnName(int index) { return csvColumnName_.get(index); } /** * <pre> * The name of columns in the CSV file where this problem occurred. * </pre> * * <code>repeated string csv_column_name = 5;</code> * * @param index The index of the value to return. * @return The bytes of the csvColumnName at the given index. */ public com.google.protobuf.ByteString getCsvColumnNameBytes(int index) { return csvColumnName_.getByteString(index); } /** * <pre> * The name of columns in the CSV file where this problem occurred. * </pre> * * <code>repeated string csv_column_name = 5;</code> * * @param index The index to set the value at. * @param value The csvColumnName to set. * @return This builder for chaining. */ public Builder setCsvColumnName( int index, java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureCsvColumnNameIsMutable(); csvColumnName_.set(index, value); onChanged(); return this; } /** * <pre> * The name of columns in the CSV file where this problem occurred. * </pre> * * <code>repeated string csv_column_name = 5;</code> * * @param value The csvColumnName to add. * @return This builder for chaining. */ public Builder addCsvColumnName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureCsvColumnNameIsMutable(); csvColumnName_.add(value); onChanged(); return this; } /** * <pre> * The name of columns in the CSV file where this problem occurred. * </pre> * * <code>repeated string csv_column_name = 5;</code> * * @param values The csvColumnName to add. * @return This builder for chaining. */ public Builder addAllCsvColumnName( java.lang.Iterable<java.lang.String> values) { ensureCsvColumnNameIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll( values, csvColumnName_); onChanged(); return this; } /** * <pre> * The name of columns in the CSV file where this problem occurred. * </pre> * * <code>repeated string csv_column_name = 5;</code> * * @return This builder for chaining. */ public Builder clearCsvColumnName() { csvColumnName_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000010); onChanged(); return this; } /** * <pre> * The name of columns in the CSV file where this problem occurred. * </pre> * * <code>repeated string csv_column_name = 5;</code> * * @param value The bytes of the csvColumnName to add. * @return This builder for chaining. */ public Builder addCsvColumnNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } ensureCsvColumnNameIsMutable(); csvColumnName_.add(value); onChanged(); return this; } private java.lang.Object otherCsvFileName_ = ""; /** * <pre> * The name of an additional CSV file (eg. "routes.txt") that is related to * this problem. * </pre> * * <code>optional string other_csv_file_name = 15;</code> * * @return Whether the otherCsvFileName field is set. */ public boolean hasOtherCsvFileName() { return ((bitField0_ & 0x00000020) != 0); } /** * <pre> * The name of an additional CSV file (eg. "routes.txt") that is related to * this problem. * </pre> * * <code>optional string other_csv_file_name = 15;</code> * * @return The otherCsvFileName. */ public java.lang.String getOtherCsvFileName() { java.lang.Object ref = otherCsvFileName_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { otherCsvFileName_ = s; } return s; } else { return (java.lang.String) ref; } } /** * <pre> * The name of an additional CSV file (eg. "routes.txt") that is related to * this problem. * </pre> * * <code>optional string other_csv_file_name = 15;</code> * * @return The bytes for otherCsvFileName. */ public com.google.protobuf.ByteString getOtherCsvFileNameBytes() { java.lang.Object ref = otherCsvFileName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); otherCsvFileName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * The name of an additional CSV file (eg. "routes.txt") that is related to * this problem. * </pre> * * <code>optional string other_csv_file_name = 15;</code> * * @param value The otherCsvFileName to set. * @return This builder for chaining. */ public Builder setOtherCsvFileName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000020; otherCsvFileName_ = value; onChanged(); return this; } /** * <pre> * The name of an additional CSV file (eg. "routes.txt") that is related to * this problem. * </pre> * * <code>optional string other_csv_file_name = 15;</code> * * @return This builder for chaining. */ public Builder clearOtherCsvFileName() { bitField0_ = (bitField0_ & ~0x00000020); otherCsvFileName_ = getDefaultInstance().getOtherCsvFileName(); onChanged(); return this; } /** * <pre> * The name of an additional CSV file (eg. "routes.txt") that is related to * this problem. * </pre> * * <code>optional string other_csv_file_name = 15;</code> * * @param value The bytes for otherCsvFileName to set. * @return This builder for chaining. */ public Builder setOtherCsvFileNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000020; otherCsvFileName_ = value; onChanged(); return this; } private java.lang.Object otherCsvKeyName_ = ""; /** * <pre> * The name of an additional CSV key that is related to this problem. * </pre> * * <code>optional string other_csv_key_name = 16;</code> * * @return Whether the otherCsvKeyName field is set. */ public boolean hasOtherCsvKeyName() { return ((bitField0_ & 0x00000040) != 0); } /** * <pre> * The name of an additional CSV key that is related to this problem. * </pre> * * <code>optional string other_csv_key_name = 16;</code> * * @return The otherCsvKeyName. */ public java.lang.String getOtherCsvKeyName() { java.lang.Object ref = otherCsvKeyName_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { otherCsvKeyName_ = s; } return s; } else { return (java.lang.String) ref; } } /** * <pre> * The name of an additional CSV key that is related to this problem. * </pre> * * <code>optional string other_csv_key_name = 16;</code> * * @return The bytes for otherCsvKeyName. */ public com.google.protobuf.ByteString getOtherCsvKeyNameBytes() { java.lang.Object ref = otherCsvKeyName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); otherCsvKeyName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * The name of an additional CSV key that is related to this problem. * </pre> * * <code>optional string other_csv_key_name = 16;</code> * * @param value The otherCsvKeyName to set. * @return This builder for chaining. */ public Builder setOtherCsvKeyName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000040; otherCsvKeyName_ = value; onChanged(); return this; } /** * <pre> * The name of an additional CSV key that is related to this problem. * </pre> * * <code>optional string other_csv_key_name = 16;</code> * * @return This builder for chaining. */ public Builder clearOtherCsvKeyName() { bitField0_ = (bitField0_ & ~0x00000040); otherCsvKeyName_ = getDefaultInstance().getOtherCsvKeyName(); onChanged(); return this; } /** * <pre> * The name of an additional CSV key that is related to this problem. * </pre> * * <code>optional string other_csv_key_name = 16;</code> * * @param value The bytes for otherCsvKeyName to set. * @return This builder for chaining. */ public Builder setOtherCsvKeyNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000040; otherCsvKeyName_ = value; onChanged(); return this; } private com.google.protobuf.LazyStringList otherCsvColumnName_ = com.google.protobuf.LazyStringArrayList.EMPTY; private void ensureOtherCsvColumnNameIsMutable() { if (!((bitField0_ & 0x00000080) != 0)) { otherCsvColumnName_ = new com.google.protobuf.LazyStringArrayList(otherCsvColumnName_); bitField0_ |= 0x00000080; } } /** * <pre> * The name of additional columns in the alt CSV file that are related to * this problem. * </pre> * * <code>repeated string other_csv_column_name = 17;</code> * * @return A list containing the otherCsvColumnName. */ public com.google.protobuf.ProtocolStringList getOtherCsvColumnNameList() { return otherCsvColumnName_.getUnmodifiableView(); } /** * <pre> * The name of additional columns in the alt CSV file that are related to * this problem. * </pre> * * <code>repeated string other_csv_column_name = 17;</code> * * @return The count of otherCsvColumnName. */ public int getOtherCsvColumnNameCount() { return otherCsvColumnName_.size(); } /** * <pre> * The name of additional columns in the alt CSV file that are related to * this problem. * </pre> * * <code>repeated string other_csv_column_name = 17;</code> * * @param index The index of the element to return. * @return The otherCsvColumnName at the given index. */ public java.lang.String getOtherCsvColumnName(int index) { return otherCsvColumnName_.get(index); } /** * <pre> * The name of additional columns in the alt CSV file that are related to * this problem. * </pre> * * <code>repeated string other_csv_column_name = 17;</code> * * @param index The index of the value to return. * @return The bytes of the otherCsvColumnName at the given index. */ public com.google.protobuf.ByteString getOtherCsvColumnNameBytes(int index) { return otherCsvColumnName_.getByteString(index); } /** * <pre> * The name of additional columns in the alt CSV file that are related to * this problem. * </pre> * * <code>repeated string other_csv_column_name = 17;</code> * * @param index The index to set the value at. * @param value The otherCsvColumnName to set. * @return This builder for chaining. */ public Builder setOtherCsvColumnName( int index, java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureOtherCsvColumnNameIsMutable(); otherCsvColumnName_.set(index, value); onChanged(); return this; } /** * <pre> * The name of additional columns in the alt CSV file that are related to * this problem. * </pre> * * <code>repeated string other_csv_column_name = 17;</code> * * @param value The otherCsvColumnName to add. * @return This builder for chaining. */ public Builder addOtherCsvColumnName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureOtherCsvColumnNameIsMutable(); otherCsvColumnName_.add(value); onChanged(); return this; } /** * <pre> * The name of additional columns in the alt CSV file that are related to * this problem. * </pre> * * <code>repeated string other_csv_column_name = 17;</code> * * @param values The otherCsvColumnName to add. * @return This builder for chaining. */ public Builder addAllOtherCsvColumnName( java.lang.Iterable<java.lang.String> values) { ensureOtherCsvColumnNameIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll( values, otherCsvColumnName_); onChanged(); return this; } /** * <pre> * The name of additional columns in the alt CSV file that are related to * this problem. * </pre> * * <code>repeated string other_csv_column_name = 17;</code> * * @return This builder for chaining. */ public Builder clearOtherCsvColumnName() { otherCsvColumnName_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000080); onChanged(); return this; } /** * <pre> * The name of additional columns in the alt CSV file that are related to * this problem. * </pre> * * <code>repeated string other_csv_column_name = 17;</code> * * @param value The bytes of the otherCsvColumnName to add. * @return This builder for chaining. */ public Builder addOtherCsvColumnNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } ensureOtherCsvColumnNameIsMutable(); otherCsvColumnName_.add(value); onChanged(); return this; } private int entityRow_; /** * <pre> * The row number in a CSV file where this problem occurred. The first line * (includes the header) of a file should have an entity_row value of 1. * Typically, the first row of non-header data will have an entity_row value * of 2. * </pre> * * <code>optional uint32 entity_row = 6;</code> * * @return Whether the entityRow field is set. */ public boolean hasEntityRow() { return ((bitField0_ & 0x00000100) != 0); } /** * <pre> * The row number in a CSV file where this problem occurred. The first line * (includes the header) of a file should have an entity_row value of 1. * Typically, the first row of non-header data will have an entity_row value * of 2. * </pre> * * <code>optional uint32 entity_row = 6;</code> * * @return The entityRow. */ public int getEntityRow() { return entityRow_; } /** * <pre> * The row number in a CSV file where this problem occurred. The first line * (includes the header) of a file should have an entity_row value of 1. * Typically, the first row of non-header data will have an entity_row value * of 2. * </pre> * * <code>optional uint32 entity_row = 6;</code> * * @param value The entityRow to set. * @return This builder for chaining. */ public Builder setEntityRow(int value) { bitField0_ |= 0x00000100; entityRow_ = value; onChanged(); return this; } /** * <pre> * The row number in a CSV file where this problem occurred. The first line * (includes the header) of a file should have an entity_row value of 1. * Typically, the first row of non-header data will have an entity_row value * of 2. * </pre> * * <code>optional uint32 entity_row = 6;</code> * * @return This builder for chaining. */ public Builder clearEntityRow() { bitField0_ = (bitField0_ & ~0x00000100); entityRow_ = 0; onChanged(); return this; } private java.lang.Object entityName_ = ""; /** * <pre> * A human-readable name associated with the GTFS entity experiencing a * problem (eg. stop name). * </pre> * * <code>optional string entity_name = 7;</code> * * @return Whether the entityName field is set. */ public boolean hasEntityName() { return ((bitField0_ & 0x00000200) != 0); } /** * <pre> * A human-readable name associated with the GTFS entity experiencing a * problem (eg. stop name). * </pre> * * <code>optional string entity_name = 7;</code> * * @return The entityName. */ public java.lang.String getEntityName() { java.lang.Object ref = entityName_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { entityName_ = s; } return s; } else { return (java.lang.String) ref; } } /** * <pre> * A human-readable name associated with the GTFS entity experiencing a * problem (eg. stop name). * </pre> * * <code>optional string entity_name = 7;</code> * * @return The bytes for entityName. */ public com.google.protobuf.ByteString getEntityNameBytes() { java.lang.Object ref = entityName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); entityName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * A human-readable name associated with the GTFS entity experiencing a * problem (eg. stop name). * </pre> * * <code>optional string entity_name = 7;</code> * * @param value The entityName to set. * @return This builder for chaining. */ public Builder setEntityName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000200; entityName_ = value; onChanged(); return this; } /** * <pre> * A human-readable name associated with the GTFS entity experiencing a * problem (eg. stop name). * </pre> * * <code>optional string entity_name = 7;</code> * * @return This builder for chaining. */ public Builder clearEntityName() { bitField0_ = (bitField0_ & ~0x00000200); entityName_ = getDefaultInstance().getEntityName(); onChanged(); return this; } /** * <pre> * A human-readable name associated with the GTFS entity experiencing a * problem (eg. stop name). * </pre> * * <code>optional string entity_name = 7;</code> * * @param value The bytes for entityName to set. * @return This builder for chaining. */ public Builder setEntityNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000200; entityName_ = value; onChanged(); return this; } private java.lang.Object entityId_ = ""; /** * <pre> * A human-readable id associated with the GTFS entity experiencing a problem * (eg. stop id). * </pre> * * <code>optional string entity_id = 8;</code> * * @return Whether the entityId field is set. */ public boolean hasEntityId() { return ((bitField0_ & 0x00000400) != 0); } /** * <pre> * A human-readable id associated with the GTFS entity experiencing a problem * (eg. stop id). * </pre> * * <code>optional string entity_id = 8;</code> * * @return The entityId. */ public java.lang.String getEntityId() { java.lang.Object ref = entityId_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { entityId_ = s; } return s; } else { return (java.lang.String) ref; } } /** * <pre> * A human-readable id associated with the GTFS entity experiencing a problem * (eg. stop id). * </pre> * * <code>optional string entity_id = 8;</code> * * @return The bytes for entityId. */ public com.google.protobuf.ByteString getEntityIdBytes() { java.lang.Object ref = entityId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); entityId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * A human-readable id associated with the GTFS entity experiencing a problem * (eg. stop id). * </pre> * * <code>optional string entity_id = 8;</code> * * @param value The entityId to set. * @return This builder for chaining. */ public Builder setEntityId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000400; entityId_ = value; onChanged(); return this; } /** * <pre> * A human-readable id associated with the GTFS entity experiencing a problem * (eg. stop id). * </pre> * * <code>optional string entity_id = 8;</code> * * @return This builder for chaining. */ public Builder clearEntityId() { bitField0_ = (bitField0_ & ~0x00000400); entityId_ = getDefaultInstance().getEntityId(); onChanged(); return this; } /** * <pre> * A human-readable id associated with the GTFS entity experiencing a problem * (eg. stop id). * </pre> * * <code>optional string entity_id = 8;</code> * * @param value The bytes for entityId to set. * @return This builder for chaining. */ public Builder setEntityIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000400; entityId_ = value; onChanged(); return this; } private java.lang.Object entityValue_ = ""; /** * <pre> * A human-readable value associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional string entity_value = 9;</code> * * @return Whether the entityValue field is set. */ public boolean hasEntityValue() { return ((bitField0_ & 0x00000800) != 0); } /** * <pre> * A human-readable value associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional string entity_value = 9;</code> * * @return The entityValue. */ public java.lang.String getEntityValue() { java.lang.Object ref = entityValue_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { entityValue_ = s; } return s; } else { return (java.lang.String) ref; } } /** * <pre> * A human-readable value associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional string entity_value = 9;</code> * * @return The bytes for entityValue. */ public com.google.protobuf.ByteString getEntityValueBytes() { java.lang.Object ref = entityValue_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); entityValue_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * A human-readable value associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional string entity_value = 9;</code> * * @param value The entityValue to set. * @return This builder for chaining. */ public Builder setEntityValue( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000800; entityValue_ = value; onChanged(); return this; } /** * <pre> * A human-readable value associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional string entity_value = 9;</code> * * @return This builder for chaining. */ public Builder clearEntityValue() { bitField0_ = (bitField0_ & ~0x00000800); entityValue_ = getDefaultInstance().getEntityValue(); onChanged(); return this; } /** * <pre> * A human-readable value associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional string entity_value = 9;</code> * * @param value The bytes for entityValue to set. * @return This builder for chaining. */ public Builder setEntityValueBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000800; entityValue_ = value; onChanged(); return this; } private org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto entityLocation_; private com.google.protobuf.SingleFieldBuilderV3< org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto, org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.Builder, org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProtoOrBuilder> entityLocationBuilder_; /** * <pre> * Location information associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional .outputProto.PointProto entity_location = 21;</code> * * @return Whether the entityLocation field is set. */ public boolean hasEntityLocation() { return ((bitField0_ & 0x00001000) != 0); } /** * <pre> * Location information associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional .outputProto.PointProto entity_location = 21;</code> * * @return The entityLocation. */ public org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto getEntityLocation() { if (entityLocationBuilder_ == null) { return entityLocation_ == null ? org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.getDefaultInstance() : entityLocation_; } else { return entityLocationBuilder_.getMessage(); } } /** * <pre> * Location information associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional .outputProto.PointProto entity_location = 21;</code> */ public Builder setEntityLocation(org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto value) { if (entityLocationBuilder_ == null) { if (value == null) { throw new NullPointerException(); } entityLocation_ = value; onChanged(); } else { entityLocationBuilder_.setMessage(value); } bitField0_ |= 0x00001000; return this; } /** * <pre> * Location information associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional .outputProto.PointProto entity_location = 21;</code> */ public Builder setEntityLocation( org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.Builder builderForValue) { if (entityLocationBuilder_ == null) { entityLocation_ = builderForValue.build(); onChanged(); } else { entityLocationBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00001000; return this; } /** * <pre> * Location information associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional .outputProto.PointProto entity_location = 21;</code> */ public Builder mergeEntityLocation(org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto value) { if (entityLocationBuilder_ == null) { if (((bitField0_ & 0x00001000) != 0) && entityLocation_ != null && entityLocation_ != org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.getDefaultInstance()) { entityLocation_ = org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.newBuilder(entityLocation_).mergeFrom(value).buildPartial(); } else { entityLocation_ = value; } onChanged(); } else { entityLocationBuilder_.mergeFrom(value); } bitField0_ |= 0x00001000; return this; } /** * <pre> * Location information associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional .outputProto.PointProto entity_location = 21;</code> */ public Builder clearEntityLocation() { if (entityLocationBuilder_ == null) { entityLocation_ = null; onChanged(); } else { entityLocationBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00001000); return this; } /** * <pre> * Location information associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional .outputProto.PointProto entity_location = 21;</code> */ public org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.Builder getEntityLocationBuilder() { bitField0_ |= 0x00001000; onChanged(); return getEntityLocationFieldBuilder().getBuilder(); } /** * <pre> * Location information associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional .outputProto.PointProto entity_location = 21;</code> */ public org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProtoOrBuilder getEntityLocationOrBuilder() { if (entityLocationBuilder_ != null) { return entityLocationBuilder_.getMessageOrBuilder(); } else { return entityLocation_ == null ? org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.getDefaultInstance() : entityLocation_; } } /** * <pre> * Location information associated with the GTFS entity experiencing a * problem. * </pre> * * <code>optional .outputProto.PointProto entity_location = 21;</code> */ private com.google.protobuf.SingleFieldBuilderV3< org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto, org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.Builder, org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProtoOrBuilder> getEntityLocationFieldBuilder() { if (entityLocationBuilder_ == null) { entityLocationBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto, org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.Builder, org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProtoOrBuilder>( getEntityLocation(), getParentForChildren(), isClean()); entityLocation_ = null; } return entityLocationBuilder_; } private int altEntityRow_; /** * <pre> * The row number in a CSV file of an alternate GTFS entity that's in * conflict with the primary row. * </pre> * * <code>optional uint32 alt_entity_row = 10;</code> * * @return Whether the altEntityRow field is set. */ public boolean hasAltEntityRow() { return ((bitField0_ & 0x00002000) != 0); } /** * <pre> * The row number in a CSV file of an alternate GTFS entity that's in * conflict with the primary row. * </pre> * * <code>optional uint32 alt_entity_row = 10;</code> * * @return The altEntityRow. */ public int getAltEntityRow() { return altEntityRow_; } /** * <pre> * The row number in a CSV file of an alternate GTFS entity that's in * conflict with the primary row. * </pre> * * <code>optional uint32 alt_entity_row = 10;</code> * * @param value The altEntityRow to set. * @return This builder for chaining. */ public Builder setAltEntityRow(int value) { bitField0_ |= 0x00002000; altEntityRow_ = value; onChanged(); return this; } /** * <pre> * The row number in a CSV file of an alternate GTFS entity that's in * conflict with the primary row. * </pre> * * <code>optional uint32 alt_entity_row = 10;</code> * * @return This builder for chaining. */ public Builder clearAltEntityRow() { bitField0_ = (bitField0_ & ~0x00002000); altEntityRow_ = 0; onChanged(); return this; } private java.lang.Object altEntityName_ = ""; /** * <pre> * A human-readable name associated with an alternate GTFS entity that's in * conflict with the primary row (eg. conflicting stop name). * </pre> * * <code>optional string alt_entity_name = 11;</code> * * @return Whether the altEntityName field is set. */ public boolean hasAltEntityName() { return ((bitField0_ & 0x00004000) != 0); } /** * <pre> * A human-readable name associated with an alternate GTFS entity that's in * conflict with the primary row (eg. conflicting stop name). * </pre> * * <code>optional string alt_entity_name = 11;</code> * * @return The altEntityName. */ public java.lang.String getAltEntityName() { java.lang.Object ref = altEntityName_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { altEntityName_ = s; } return s; } else { return (java.lang.String) ref; } } /** * <pre> * A human-readable name associated with an alternate GTFS entity that's in * conflict with the primary row (eg. conflicting stop name). * </pre> * * <code>optional string alt_entity_name = 11;</code> * * @return The bytes for altEntityName. */ public com.google.protobuf.ByteString getAltEntityNameBytes() { java.lang.Object ref = altEntityName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); altEntityName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * A human-readable name associated with an alternate GTFS entity that's in * conflict with the primary row (eg. conflicting stop name). * </pre> * * <code>optional string alt_entity_name = 11;</code> * * @param value The altEntityName to set. * @return This builder for chaining. */ public Builder setAltEntityName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00004000; altEntityName_ = value; onChanged(); return this; } /** * <pre> * A human-readable name associated with an alternate GTFS entity that's in * conflict with the primary row (eg. conflicting stop name). * </pre> * * <code>optional string alt_entity_name = 11;</code> * * @return This builder for chaining. */ public Builder clearAltEntityName() { bitField0_ = (bitField0_ & ~0x00004000); altEntityName_ = getDefaultInstance().getAltEntityName(); onChanged(); return this; } /** * <pre> * A human-readable name associated with an alternate GTFS entity that's in * conflict with the primary row (eg. conflicting stop name). * </pre> * * <code>optional string alt_entity_name = 11;</code> * * @param value The bytes for altEntityName to set. * @return This builder for chaining. */ public Builder setAltEntityNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00004000; altEntityName_ = value; onChanged(); return this; } private java.lang.Object altEntityId_ = ""; /** * <pre> * A human-readable id associated with an alternate GTFS entity that's in * conflict with the primary row (eg. conflicting stop id). * </pre> * * <code>optional string alt_entity_id = 12;</code> * * @return Whether the altEntityId field is set. */ public boolean hasAltEntityId() { return ((bitField0_ & 0x00008000) != 0); } /** * <pre> * A human-readable id associated with an alternate GTFS entity that's in * conflict with the primary row (eg. conflicting stop id). * </pre> * * <code>optional string alt_entity_id = 12;</code> * * @return The altEntityId. */ public java.lang.String getAltEntityId() { java.lang.Object ref = altEntityId_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { altEntityId_ = s; } return s; } else { return (java.lang.String) ref; } } /** * <pre> * A human-readable id associated with an alternate GTFS entity that's in * conflict with the primary row (eg. conflicting stop id). * </pre> * * <code>optional string alt_entity_id = 12;</code> * * @return The bytes for altEntityId. */ public com.google.protobuf.ByteString getAltEntityIdBytes() { java.lang.Object ref = altEntityId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); altEntityId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * A human-readable id associated with an alternate GTFS entity that's in * conflict with the primary row (eg. conflicting stop id). * </pre> * * <code>optional string alt_entity_id = 12;</code> * * @param value The altEntityId to set. * @return This builder for chaining. */ public Builder setAltEntityId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00008000; altEntityId_ = value; onChanged(); return this; } /** * <pre> * A human-readable id associated with an alternate GTFS entity that's in * conflict with the primary row (eg. conflicting stop id). * </pre> * * <code>optional string alt_entity_id = 12;</code> * * @return This builder for chaining. */ public Builder clearAltEntityId() { bitField0_ = (bitField0_ & ~0x00008000); altEntityId_ = getDefaultInstance().getAltEntityId(); onChanged(); return this; } /** * <pre> * A human-readable id associated with an alternate GTFS entity that's in * conflict with the primary row (eg. conflicting stop id). * </pre> * * <code>optional string alt_entity_id = 12;</code> * * @param value The bytes for altEntityId to set. * @return This builder for chaining. */ public Builder setAltEntityIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00008000; altEntityId_ = value; onChanged(); return this; } private java.lang.Object altEntityValue_ = ""; /** * <pre> * A human-readable value associated with the alernate GTFS entity * experiencing a problem. * </pre> * * <code>optional string alt_entity_value = 13;</code> * * @return Whether the altEntityValue field is set. */ public boolean hasAltEntityValue() { return ((bitField0_ & 0x00010000) != 0); } /** * <pre> * A human-readable value associated with the alernate GTFS entity * experiencing a problem. * </pre> * * <code>optional string alt_entity_value = 13;</code> * * @return The altEntityValue. */ public java.lang.String getAltEntityValue() { java.lang.Object ref = altEntityValue_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { altEntityValue_ = s; } return s; } else { return (java.lang.String) ref; } } /** * <pre> * A human-readable value associated with the alernate GTFS entity * experiencing a problem. * </pre> * * <code>optional string alt_entity_value = 13;</code> * * @return The bytes for altEntityValue. */ public com.google.protobuf.ByteString getAltEntityValueBytes() { java.lang.Object ref = altEntityValue_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); altEntityValue_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * A human-readable value associated with the alernate GTFS entity * experiencing a problem. * </pre> * * <code>optional string alt_entity_value = 13;</code> * * @param value The altEntityValue to set. * @return This builder for chaining. */ public Builder setAltEntityValue( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00010000; altEntityValue_ = value; onChanged(); return this; } /** * <pre> * A human-readable value associated with the alernate GTFS entity * experiencing a problem. * </pre> * * <code>optional string alt_entity_value = 13;</code> * * @return This builder for chaining. */ public Builder clearAltEntityValue() { bitField0_ = (bitField0_ & ~0x00010000); altEntityValue_ = getDefaultInstance().getAltEntityValue(); onChanged(); return this; } /** * <pre> * A human-readable value associated with the alernate GTFS entity * experiencing a problem. * </pre> * * <code>optional string alt_entity_value = 13;</code> * * @param value The bytes for altEntityValue to set. * @return This builder for chaining. */ public Builder setAltEntityValueBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00010000; altEntityValue_ = value; onChanged(); return this; } private org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto altEntityLocation_; private com.google.protobuf.SingleFieldBuilderV3< org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto, org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.Builder, org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProtoOrBuilder> altEntityLocationBuilder_; /** * <pre> * Location information associated with the alternate GTFS entity * experiencing a problem. * </pre> * * <code>optional .outputProto.PointProto alt_entity_location = 22;</code> * * @return Whether the altEntityLocation field is set. */ public boolean hasAltEntityLocation() { return ((bitField0_ & 0x00020000) != 0); } /** * <pre> * Location information associated with the alternate GTFS entity * experiencing a problem. * </pre> * * <code>optional .outputProto.PointProto alt_entity_location = 22;</code> * * @return The altEntityLocation. */ public org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto getAltEntityLocation() { if (altEntityLocationBuilder_ == null) { return altEntityLocation_ == null ? org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.getDefaultInstance() : altEntityLocation_; } else { return altEntityLocationBuilder_.getMessage(); } } /** * <pre> * Location information associated with the alternate GTFS entity * experiencing a problem. * </pre> * * <code>optional .outputProto.PointProto alt_entity_location = 22;</code> */ public Builder setAltEntityLocation(org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto value) { if (altEntityLocationBuilder_ == null) { if (value == null) { throw new NullPointerException(); } altEntityLocation_ = value; onChanged(); } else { altEntityLocationBuilder_.setMessage(value); } bitField0_ |= 0x00020000; return this; } /** * <pre> * Location information associated with the alternate GTFS entity * experiencing a problem. * </pre> * * <code>optional .outputProto.PointProto alt_entity_location = 22;</code> */ public Builder setAltEntityLocation( org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.Builder builderForValue) { if (altEntityLocationBuilder_ == null) { altEntityLocation_ = builderForValue.build(); onChanged(); } else { altEntityLocationBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00020000; return this; } /** * <pre> * Location information associated with the alternate GTFS entity * experiencing a problem. * </pre> * * <code>optional .outputProto.PointProto alt_entity_location = 22;</code> */ public Builder mergeAltEntityLocation(org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto value) { if (altEntityLocationBuilder_ == null) { if (((bitField0_ & 0x00020000) != 0) && altEntityLocation_ != null && altEntityLocation_ != org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.getDefaultInstance()) { altEntityLocation_ = org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.newBuilder(altEntityLocation_).mergeFrom(value).buildPartial(); } else { altEntityLocation_ = value; } onChanged(); } else { altEntityLocationBuilder_.mergeFrom(value); } bitField0_ |= 0x00020000; return this; } /** * <pre> * Location information associated with the alternate GTFS entity * experiencing a problem. * </pre> * * <code>optional .outputProto.PointProto alt_entity_location = 22;</code> */ public Builder clearAltEntityLocation() { if (altEntityLocationBuilder_ == null) { altEntityLocation_ = null; onChanged(); } else { altEntityLocationBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00020000); return this; } /** * <pre> * Location information associated with the alternate GTFS entity * experiencing a problem. * </pre> * * <code>optional .outputProto.PointProto alt_entity_location = 22;</code> */ public org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.Builder getAltEntityLocationBuilder() { bitField0_ |= 0x00020000; onChanged(); return getAltEntityLocationFieldBuilder().getBuilder(); } /** * <pre> * Location information associated with the alternate GTFS entity * experiencing a problem. * </pre> * * <code>optional .outputProto.PointProto alt_entity_location = 22;</code> */ public org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProtoOrBuilder getAltEntityLocationOrBuilder() { if (altEntityLocationBuilder_ != null) { return altEntityLocationBuilder_.getMessageOrBuilder(); } else { return altEntityLocation_ == null ? org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.getDefaultInstance() : altEntityLocation_; } } /** * <pre> * Location information associated with the alternate GTFS entity * experiencing a problem. * </pre> * * <code>optional .outputProto.PointProto alt_entity_location = 22;</code> */ private com.google.protobuf.SingleFieldBuilderV3< org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto, org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.Builder, org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProtoOrBuilder> getAltEntityLocationFieldBuilder() { if (altEntityLocationBuilder_ == null) { altEntityLocationBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto, org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProto.Builder, org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.PointProtoOrBuilder>( getAltEntityLocation(), getParentForChildren(), isClean()); altEntityLocation_ = null; } return altEntityLocationBuilder_; } private int parentEntityRow_; /** * <pre> * The row number in a CSV file of a GTFS entity that's a parent to the * primary entity. * </pre> * * <code>optional uint32 parent_entity_row = 18;</code> * * @return Whether the parentEntityRow field is set. */ public boolean hasParentEntityRow() { return ((bitField0_ & 0x00040000) != 0); } /** * <pre> * The row number in a CSV file of a GTFS entity that's a parent to the * primary entity. * </pre> * * <code>optional uint32 parent_entity_row = 18;</code> * * @return The parentEntityRow. */ public int getParentEntityRow() { return parentEntityRow_; } /** * <pre> * The row number in a CSV file of a GTFS entity that's a parent to the * primary entity. * </pre> * * <code>optional uint32 parent_entity_row = 18;</code> * * @param value The parentEntityRow to set. * @return This builder for chaining. */ public Builder setParentEntityRow(int value) { bitField0_ |= 0x00040000; parentEntityRow_ = value; onChanged(); return this; } /** * <pre> * The row number in a CSV file of a GTFS entity that's a parent to the * primary entity. * </pre> * * <code>optional uint32 parent_entity_row = 18;</code> * * @return This builder for chaining. */ public Builder clearParentEntityRow() { bitField0_ = (bitField0_ & ~0x00040000); parentEntityRow_ = 0; onChanged(); return this; } private java.lang.Object parentEntityName_ = ""; /** * <pre> * A human-readable name associated with the parent GTFS entity. * </pre> * * <code>optional string parent_entity_name = 19;</code> * * @return Whether the parentEntityName field is set. */ public boolean hasParentEntityName() { return ((bitField0_ & 0x00080000) != 0); } /** * <pre> * A human-readable name associated with the parent GTFS entity. * </pre> * * <code>optional string parent_entity_name = 19;</code> * * @return The parentEntityName. */ public java.lang.String getParentEntityName() { java.lang.Object ref = parentEntityName_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { parentEntityName_ = s; } return s; } else { return (java.lang.String) ref; } } /** * <pre> * A human-readable name associated with the parent GTFS entity. * </pre> * * <code>optional string parent_entity_name = 19;</code> * * @return The bytes for parentEntityName. */ public com.google.protobuf.ByteString getParentEntityNameBytes() { java.lang.Object ref = parentEntityName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); parentEntityName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * A human-readable name associated with the parent GTFS entity. * </pre> * * <code>optional string parent_entity_name = 19;</code> * * @param value The parentEntityName to set. * @return This builder for chaining. */ public Builder setParentEntityName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00080000; parentEntityName_ = value; onChanged(); return this; } /** * <pre> * A human-readable name associated with the parent GTFS entity. * </pre> * * <code>optional string parent_entity_name = 19;</code> * * @return This builder for chaining. */ public Builder clearParentEntityName() { bitField0_ = (bitField0_ & ~0x00080000); parentEntityName_ = getDefaultInstance().getParentEntityName(); onChanged(); return this; } /** * <pre> * A human-readable name associated with the parent GTFS entity. * </pre> * * <code>optional string parent_entity_name = 19;</code> * * @param value The bytes for parentEntityName to set. * @return This builder for chaining. */ public Builder setParentEntityNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00080000; parentEntityName_ = value; onChanged(); return this; } private java.lang.Object parentEntityId_ = ""; /** * <pre> * A human-readable id associated with the parent GTFS entity. * </pre> * * <code>optional string parent_entity_id = 20;</code> * * @return Whether the parentEntityId field is set. */ public boolean hasParentEntityId() { return ((bitField0_ & 0x00100000) != 0); } /** * <pre> * A human-readable id associated with the parent GTFS entity. * </pre> * * <code>optional string parent_entity_id = 20;</code> * * @return The parentEntityId. */ public java.lang.String getParentEntityId() { java.lang.Object ref = parentEntityId_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { parentEntityId_ = s; } return s; } else { return (java.lang.String) ref; } } /** * <pre> * A human-readable id associated with the parent GTFS entity. * </pre> * * <code>optional string parent_entity_id = 20;</code> * * @return The bytes for parentEntityId. */ public com.google.protobuf.ByteString getParentEntityIdBytes() { java.lang.Object ref = parentEntityId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); parentEntityId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * A human-readable id associated with the parent GTFS entity. * </pre> * * <code>optional string parent_entity_id = 20;</code> * * @param value The parentEntityId to set. * @return This builder for chaining. */ public Builder setParentEntityId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00100000; parentEntityId_ = value; onChanged(); return this; } /** * <pre> * A human-readable id associated with the parent GTFS entity. * </pre> * * <code>optional string parent_entity_id = 20;</code> * * @return This builder for chaining. */ public Builder clearParentEntityId() { bitField0_ = (bitField0_ & ~0x00100000); parentEntityId_ = getDefaultInstance().getParentEntityId(); onChanged(); return this; } /** * <pre> * A human-readable id associated with the parent GTFS entity. * </pre> * * <code>optional string parent_entity_id = 20;</code> * * @param value The bytes for parentEntityId to set. * @return This builder for chaining. */ public Builder setParentEntityIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00100000; parentEntityId_ = value; onChanged(); return this; } private java.lang.Object value_ = ""; /** * <pre> * A value associated with the problem. This could be an invalid value * pulled from the GTFS directly or some other related value (eg "travel is * to too fast, a X kph", where X is replaced with 'value'). * </pre> * * <code>optional string value = 14;</code> * * @return Whether the value field is set. */ public boolean hasValue() { return ((bitField0_ & 0x00200000) != 0); } /** * <pre> * A value associated with the problem. This could be an invalid value * pulled from the GTFS directly or some other related value (eg "travel is * to too fast, a X kph", where X is replaced with 'value'). * </pre> * * <code>optional string value = 14;</code> * * @return The value. */ public java.lang.String getValue() { java.lang.Object ref = value_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { value_ = s; } return s; } else { return (java.lang.String) ref; } } /** * <pre> * A value associated with the problem. This could be an invalid value * pulled from the GTFS directly or some other related value (eg "travel is * to too fast, a X kph", where X is replaced with 'value'). * </pre> * * <code>optional string value = 14;</code> * * @return The bytes for value. */ public com.google.protobuf.ByteString getValueBytes() { java.lang.Object ref = value_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); value_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * A value associated with the problem. This could be an invalid value * pulled from the GTFS directly or some other related value (eg "travel is * to too fast, a X kph", where X is replaced with 'value'). * </pre> * * <code>optional string value = 14;</code> * * @param value The value to set. * @return This builder for chaining. */ public Builder setValue( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00200000; value_ = value; onChanged(); return this; } /** * <pre> * A value associated with the problem. This could be an invalid value * pulled from the GTFS directly or some other related value (eg "travel is * to too fast, a X kph", where X is replaced with 'value'). * </pre> * * <code>optional string value = 14;</code> * * @return This builder for chaining. */ public Builder clearValue() { bitField0_ = (bitField0_ & ~0x00200000); value_ = getDefaultInstance().getValue(); onChanged(); return this; } /** * <pre> * A value associated with the problem. This could be an invalid value * pulled from the GTFS directly or some other related value (eg "travel is * to too fast, a X kph", where X is replaced with 'value'). * </pre> * * <code>optional string value = 14;</code> * * @param value The bytes for value to set. * @return This builder for chaining. */ public Builder setValueBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00200000; value_ = value; onChanged(); return this; } private java.lang.Object altValue_ = ""; /** * <pre> * An alternate value associated with the problem. Similar to 'value' field * in use, use 'value' and 'alt_value' when two values are associated with * the same primary entity. Use 'entity_value' and 'alt_entity_value' when * the two values are associated with separate entities in the same file. * </pre> * * <code>optional string alt_value = 23;</code> * * @return Whether the altValue field is set. */ public boolean hasAltValue() { return ((bitField0_ & 0x00400000) != 0); } /** * <pre> * An alternate value associated with the problem. Similar to 'value' field * in use, use 'value' and 'alt_value' when two values are associated with * the same primary entity. Use 'entity_value' and 'alt_entity_value' when * the two values are associated with separate entities in the same file. * </pre> * * <code>optional string alt_value = 23;</code> * * @return The altValue. */ public java.lang.String getAltValue() { java.lang.Object ref = altValue_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { altValue_ = s; } return s; } else { return (java.lang.String) ref; } } /** * <pre> * An alternate value associated with the problem. Similar to 'value' field * in use, use 'value' and 'alt_value' when two values are associated with * the same primary entity. Use 'entity_value' and 'alt_entity_value' when * the two values are associated with separate entities in the same file. * </pre> * * <code>optional string alt_value = 23;</code> * * @return The bytes for altValue. */ public com.google.protobuf.ByteString getAltValueBytes() { java.lang.Object ref = altValue_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); altValue_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * An alternate value associated with the problem. Similar to 'value' field * in use, use 'value' and 'alt_value' when two values are associated with * the same primary entity. Use 'entity_value' and 'alt_entity_value' when * the two values are associated with separate entities in the same file. * </pre> * * <code>optional string alt_value = 23;</code> * * @param value The altValue to set. * @return This builder for chaining. */ public Builder setAltValue( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00400000; altValue_ = value; onChanged(); return this; } /** * <pre> * An alternate value associated with the problem. Similar to 'value' field * in use, use 'value' and 'alt_value' when two values are associated with * the same primary entity. Use 'entity_value' and 'alt_entity_value' when * the two values are associated with separate entities in the same file. * </pre> * * <code>optional string alt_value = 23;</code> * * @return This builder for chaining. */ public Builder clearAltValue() { bitField0_ = (bitField0_ & ~0x00400000); altValue_ = getDefaultInstance().getAltValue(); onChanged(); return this; } /** * <pre> * An alternate value associated with the problem. Similar to 'value' field * in use, use 'value' and 'alt_value' when two values are associated with * the same primary entity. Use 'entity_value' and 'alt_entity_value' when * the two values are associated with separate entities in the same file. * </pre> * * <code>optional string alt_value = 23;</code> * * @param value The bytes for altValue to set. * @return This builder for chaining. */ public Builder setAltValueBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00400000; altValue_ = value; onChanged(); return this; } private double importance_; /** * <pre> * A value in the range [0.0, 1.0] (most important is 1.0), indicating the * importance of the problem based on the importance of the locations of the * geographical entities involved. * </pre> * * <code>optional double importance = 24;</code> * * @return Whether the importance field is set. */ public boolean hasImportance() { return ((bitField0_ & 0x00800000) != 0); } /** * <pre> * A value in the range [0.0, 1.0] (most important is 1.0), indicating the * importance of the problem based on the importance of the locations of the * geographical entities involved. * </pre> * * <code>optional double importance = 24;</code> * * @return The importance. */ public double getImportance() { return importance_; } /** * <pre> * A value in the range [0.0, 1.0] (most important is 1.0), indicating the * importance of the problem based on the importance of the locations of the * geographical entities involved. * </pre> * * <code>optional double importance = 24;</code> * * @param value The importance to set. * @return This builder for chaining. */ public Builder setImportance(double value) { bitField0_ |= 0x00800000; importance_ = value; onChanged(); return this; } /** * <pre> * A value in the range [0.0, 1.0] (most important is 1.0), indicating the * importance of the problem based on the importance of the locations of the * geographical entities involved. * </pre> * * <code>optional double importance = 24;</code> * * @return This builder for chaining. */ public Builder clearImportance() { bitField0_ = (bitField0_ & ~0x00800000); importance_ = 0D; onChanged(); return this; } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:outputProto.GtfsProblem) } // @@protoc_insertion_point(class_scope:outputProto.GtfsProblem) private static final org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem(); } public static org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem getDefaultInstance() { return DEFAULT_INSTANCE; } @java.lang.Deprecated public static final com.google.protobuf.Parser<GtfsProblem> PARSER = new com.google.protobuf.AbstractParser<GtfsProblem>() { @java.lang.Override public GtfsProblem parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new GtfsProblem(input, extensionRegistry); } }; public static com.google.protobuf.Parser<GtfsProblem> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<GtfsProblem> getParserForType() { return PARSER; } @java.lang.Override public org.mobilitydata.gtfsvalidator.adapter.protos.GtfsValidationOutputProto.GtfsProblem getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } private static final com.google.protobuf.Descriptors.Descriptor internal_static_outputProto_PointProto_descriptor; private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_outputProto_PointProto_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_outputProto_GtfsProblem_descriptor; private static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_outputProto_GtfsProblem_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; } private static com.google.protobuf.Descriptors.FileDescriptor descriptor; static { java.lang.String[] descriptorData = { "\n\025gtfs_validation.proto\022\013outputProto\",\n\n" + "PointProto\022\016\n\006lat_e7\030\001 \001(\007\022\016\n\006lng_e7\030\002 \001" + "(\007\"\2117\n\013GtfsProblem\022+\n\004type\030\001 \001(\0162\035.outpu" + "tProto.GtfsProblem.Type\0223\n\010severity\030\002 \001(" + "\0162!.outputProto.GtfsProblem.Severity\022\025\n\r" + "csv_file_name\030\003 \001(\t\022\024\n\014csv_key_name\030\004 \001(" + "\t\022\027\n\017csv_column_name\030\005 \003(\t\022\033\n\023other_csv_" + "file_name\030\017 \001(\t\022\032\n\022other_csv_key_name\030\020 " + "\001(\t\022\035\n\025other_csv_column_name\030\021 \003(\t\022\022\n\nen" + "tity_row\030\006 \001(\r\022\023\n\013entity_name\030\007 \001(\t\022\021\n\te" + "ntity_id\030\010 \001(\t\022\024\n\014entity_value\030\t \001(\t\0220\n\017" + "entity_location\030\025 \001(\0132\027.outputProto.Poin" + "tProto\022\026\n\016alt_entity_row\030\n \001(\r\022\027\n\017alt_en" + "tity_name\030\013 \001(\t\022\025\n\ralt_entity_id\030\014 \001(\t\022\030" + "\n\020alt_entity_value\030\r \001(\t\0224\n\023alt_entity_l" + "ocation\030\026 \001(\0132\027.outputProto.PointProto\022\031" + "\n\021parent_entity_row\030\022 \001(\r\022\032\n\022parent_enti" + "ty_name\030\023 \001(\t\022\030\n\020parent_entity_id\030\024 \001(\t\022" + "\r\n\005value\030\016 \001(\t\022\021\n\talt_value\030\027 \001(\t\022\022\n\nimp" + "ortance\030\030 \001(\001\"\2321\n\004Type\022\032\n\026TYPE_CSV_UNKNO" + "WN_ERROR\020\001\022\032\n\026TYPE_CSV_MISSING_TABLE\020\n\022\034" + "\n\030TYPE_CSV_SPLITTING_ERROR\020\024\022$\n TYPE_CSV" + "_CONTAINS_NULL_CHARACTER\020\025\022&\n\036TYPE_CSV_U" + "TF8_CONVERSION_ERROR\020\026\032\002\010\001\022\031\n\025TYPE_CSV_I" + "NVALID_UTF8\020\027\022\"\n\036TYPE_CSV_DUPLICATE_COLU" + "MN_NAME\020\030\022!\n\035TYPE_CSV_BAD_NUMBER_OF_VALU" + "ES\020\031\022\033\n\027TYPE_CSV_FILE_CORRUPTED\020\032\022 \n\034TYP" + "E_CSV_UNEXPECTED_LOCATION\020\033\022\033\n\027TYPE_CSV_" + "MISSING_COLUMN\020\036\022\030\n\024TYPE_CSV_MISSING_KEY" + "\020\037\022\025\n\021TYPE_CSV_UNSORTED\020(\022\033\n\027TYPE_CSV_NO" + "N_CONTIGUOUS\020)\022\037\n\033TYPE_CSV_BAD_NUMBER_OF" + "_ROWS\020*\022\030\n\024TYPE_CSV_VALUE_ERROR\0202\022\034\n\030TYP" + "E_CSV_REGEXP_MISMATCH\0203\022\031\n\025TYPE_CSV_OUT_" + "OF_RANGE\0204\022\032\n\026TYPE_CSV_MISSING_VALUE\0205\022&" + "\n\"TYPE_CSV_MISSING_FOREIGN_KEY_VALUE\020=\022 " + "\n\034TYPE_CSV_DUPLICATE_KEY_VALUE\020>\022\036\n\032TYPE" + "_CSV_MISSING_KEY_TABLE\020?\022\033\n\027TYPE_CSV_FIL" + "E_TOO_LARGE\020@\022+\n&TYPE_AGENCIES_WITH_DIFF" + "ERENT_LANGUAGES\020\371\001\022+\n&TYPE_AGENCIES_WITH" + "_DIFFERENT_TIMEZONES\020\347\001\022,\n\'TYPE_AGENCY_L" + "ANG_AND_FEED_LANG_MISMATCH\020\350\001\022*\n%TYPE_AM" + "BIGUOUS_STOP_STATION_TRANSFERS\020\236\002\0223\n.TYP" + "E_BLOCK_TRIPS_WITH_INCONSISTENT_ROUTE_TY" + "PES\020\243\002\0221\n,TYPE_BLOCK_TRIPS_WITH_OVERLAPP" + "ING_STOP_TIMES\020\361\001\0222\n-TYPE_CALENDAR_START" + "_AND_END_DATE_OUT_OF_ORDER\020\360\001\022-\n(TYPE_CA" + "LENDAR_HAS_NO_ACTIVE_DAYS_OF_WEEK\020\344\001\022)\n$" + "TYPE_LOCATION_WITHOUT_PARENT_STATION\020\313\001\022" + "/\n*TYPE_FARE_ATTRIBUTES_INVALID_CURRENCY" + "_TYPE\020\334\001\022,\n\'TYPE_FARE_ATTRIBUTES_AGENCY_" + "ID_REQUIRED\020\335\001\0221\n,TYPE_FARE_RULE_WITH_BO" + "TH_ROUTE_ID_REFERENCES\020\242\002\022&\n!TYPE_FARES_" + "WITH_AND_WITHOUT_RULES\020\210\002\022/\n*TYPE_FAST_T" + "RAVEL_BETWEEN_CONSECUTIVE_STOPS\020\200\002\022\'\n\"TY" + "PE_FAST_TRAVEL_BETWEEN_FAR_STOPS\020\251\002\022\036\n\031T" + "YPE_FEED_EXPIRATION_DATE\020\351\001\022\035\n\030TYPE_FEED" + "_FUTURE_SERVICE\020\343\001\022\036\n\031TYPE_FEED_HAS_NO_L" + "ANGUAGE\020\212\002\022-\n(TYPE_FEED_HAS_NO_SERVICE_D" + "ATE_EXCEPTIONS\020\341\001\022#\n\036TYPE_FEED_HAS_NO_SE" + "RVICE_DATES\020\340\001\022%\n TYPE_FEED_HAS_VERY_SHO" + "RT_SERVICE\020\247\002\022-\n(TYPE_EXPIRED_FEED_HAS_V" + "ERY_SHORT_SERVICE\020\315\002\0223\n.TYPE_FEED_INFO_S" + "TART_AND_END_DATE_OUT_OF_ORDER\020\336\001\022\'\n\"TYP" + "E_FEED_INFO_MORE_THAN_ONE_ENTRY\020\337\001\022\037\n\032TY" + "PE_FEED_INFO_EARLY_START\020\250\002\022\037\n\032TYPE_FEED" + "_SERVICE_DATE_GAP\020\346\001\0229\n4TYPE_FREQUENCY_H" + "EADWAY_SECONDS_GREATER_THAN_INTERVAL\020\230\002\022" + ",\n\'TYPE_FREQUENCY_HEADWAY_SECONDS_TOO_HI" + "GH\020\271\002\0220\n+TYPE_FREQUENCY_START_AND_END_TI" + "ME_ARE_EQUAL\020\205\002\0223\n.TYPE_FREQUENCY_START_" + "AND_END_TIME_OUT_OF_ORDER\020\206\002\022/\n*TYPE_FRE" + "QUENCY_BASED_TRIP_TO_TRIP_TRANSFER\020\234\002\022\037\n" + "\032TYPE_INVALID_LANGUAGE_CODE\020\362\001\022\032\n\025TYPE_I" + "NVALID_LATITUDE\020\363\001\022\033\n\026TYPE_INVALID_LONGI" + "TUDE\020\364\001\022\034\n\027TYPE_INVALID_ROUTE_TYPE\020\207\002\022\032\n" + "\025TYPE_INVALID_TIMEZONE\020\365\001\022\025\n\020TYPE_INVALI" + "D_URL\020\366\001\022&\n!TYPE_MULTIPLE_FARES_WITHOUT_" + "RULES\020\211\002\022\037\n\032TYPE_OVERLAPPING_FREQUENCY\020\311" + "\001\0223\n.TYPE_OVERLAPPING_FREQUENCY_FOR_TRIP" + "_DUPLICATES\020\231\002\0221\n,TYPE_PARENT_STATION_WI" + "TH_WRONG_LOCATION_TYPE\020\241\002\022\033\n\026TYPE_POINT_" + "NEAR_ORIGIN\020\245\002\022\031\n\024TYPE_POINT_NEAR_POLE\020\246" + "\002\022\036\n\031TYPE_ROUTE_COLOR_CONTRAST\020\317\001\022\033\n\026TYP" + "E_ROUTE_NAME_REUSED\020\342\001\022+\n&TYPE_ROUTE_SHO" + "RT_NAME_EQUALS_LONG_NAME\020\321\001\0224\n/TYPE_ROUT" + "E_SHORT_NAME_IS_CONTAINED_IN_LONG_NAME\020\322" + "\001\022&\n!TYPE_ROUTE_SHORT_NAME_IS_TOO_LONG\020\320" + "\001\0220\n+TYPE_ROUTE_SHORT_NAME_OR_LONG_NAME_" + "REQUIRED\020\323\001\0225\n0TYPE_ROUTE_BOTH_SHORT_NAM" + "E_AND_LONG_NAME_PRESENT\020\272\002\022+\n&TYPE_ROUTE" + "_LONG_NAME_HAS_ABBREVIATIONS\020\273\002\022$\n\037TYPE_" + "ROUTE_NAME_NOT_CAPITALIZED\020\274\002\022+\n&TYPE_RO" + "UTE_NAME_HAS_SPECIAL_CHARACTERS\020\301\002\022\'\n\"TY" + "PE_SERVICE_ID_HAS_NO_ACTIVE_DAYS\020\345\001\0220\n+T" + "YPE_SHAPE_WITH_PARTIAL_SHAPE_DIST_TRAVEL" + "ED\020\215\002\022\030\n\023TYPE_STATION_UNUSED\020\352\001\022%\n TYPE_" + "STATION_WITH_PARENT_STATION\020\312\001\022+\n&TYPE_L" + "OCATION_WITH_STOP_TIME_OVERRIDES\020\257\002\022\"\n\035T" + "YPE_LOCATION_WITH_STOP_TIMES\020\353\001\022\034\n\027TYPE_" + "STATIONS_TOO_CLOSE\020\354\001\022-\n(TYPE_STOP_HAS_T" + "OO_MANY_MATCHES_FOR_SHAPE\020\372\001\022)\n$TYPE_STO" + "P_TIME_OVERRIDES_CONFLICTING\020\252\002\0225\n0TYPE_" + "STOP_TIME_OVERRIDES_NOT_SAME_PARENT_STAT" + "ION\020\253\002\022&\n!TYPE_STOP_TIME_OVERRIDES_NOT_U" + "SED\020\254\002\0225\n0TYPE_STOP_TIME_OVERRIDES_WITH_" + "UNKNOWN_SERVICE_ID\020\255\002\0228\n3TYPE_STOP_TIME_" + "OVERRIDES_WITH_UNKNOWN_STOP_SEQUENCE\020\256\002\022" + "3\n.TYPE_STOP_TIMES_STOP_HEADSIGN_EQUALS_" + "STOP_NAME\020\204\002\022,\n\'TYPE_STOP_TIMES_INCORREC" + "T_STOP_HEADSIGN\020\276\002\022@\n;TYPE_STOP_TIMES_WI" + "TH_ARRIVAL_BEFORE_PREVIOUS_DEPARTURE_TIM" + "E\020\233\002\0227\n2TYPE_STOP_TIMES_WITH_DEPARTURE_B" + "EFORE_ARRIVAL_TIME\020\223\002\022/\n*TYPE_STOP_TIMES" + "_WITH_LONG_ARRIVAL_INTERVAL\020\376\001\0229\n4TYPE_S" + "TOP_TIMES_WITH_LONG_DEPARTURE_ARRIVAL_IN" + "TERVAL\020\377\001\022B\n=TYPE_STOP_TIMES_WITH_ONLY_A" + "RRIVAL_OR_DEPARTURE_TIME_SPECIFIED\020\221\002\022#\n" + "\036TYPE_STOP_TOO_CLOSE_TO_STATION\020\355\001\022*\n%TY" + "PE_STOP_TOO_FAR_FROM_PARENT_STATION\020\375\001\022!" + "\n\034TYPE_STOP_TOO_FAR_FROM_SHAPE\020\373\001\0225\n0TYP" + "E_STOP_TOO_FAR_FROM_SHAPE_USING_USER_DIS" + "TANCE\020\244\002\022\025\n\020TYPE_STOP_UNUSED\020\356\001\022/\n*TYPE_" + "STOP_WITH_PARENT_STATION_AND_TIMEZONE\020\314\001" + "\022-\n(TYPE_STOP_WITH_SAME_NAME_AND_DESCRIP" + "TION\020\316\001\022\'\n\"TYPE_STOP_NAME_HAS_STOP_CODE_" + "OR_ID\020\277\002\022*\n%TYPE_STOP_NAME_HAS_SPECIAL_C" + "HARACTERS\020\300\002\022.\n)TYPE_STOP_HEADSIGN_HAS_S" + "PECIAL_CHARACTERS\020\302\002\022(\n#TYPE_STOPS_MATCH" + "_SHAPE_OUT_OF_ORDER\020\374\001\022\031\n\024TYPE_STOPS_TOO" + "_CLOSE\020\357\001\022#\n\036TYPE_STOP_NAME_NOT_CAPITALI" + "ZED\020\275\002\022\"\n\035TYPE_PLATFORM_CODE_IS_MISSING\020" + "\314\002\0228\n3TYPE_TOO_MANY_CONSECUTIVE_STOP_TIM" + "ES_WITH_SAME_TIME\020\201\002\022\032\n\025TYPE_TOO_MANY_EN" + "TRIES\020\261\002\022)\n$TYPE_TRANSFER_DISTANCE_IS_VE" + "RY_LARGE\020\332\001\022\034\n\027TYPE_TRANSFER_DUPLICATE\020\202" + "\002\022,\n\'TYPE_TRANSFER_WALKING_SPEED_IS_TOO_" + "FAST\020\333\001\0225\n0TYPE_TRANSFER_MIN_TRANSFER_TI" + "ME_AND_INVALID_TYPE\020\232\002\022/\n*TYPE_TRANSFER_" + "MIN_TRANSFER_TIME_IS_MISSING\020\240\002\0220\n+TYPE_" + "TRANSFER_MIN_TRANSFER_TIME_IS_NEGATIVE\020\330" + "\001\0222\n-TYPE_TRANSFER_MIN_TRANSFER_TIME_IS_" + "VERY_LARGE\020\331\001\022\037\n\032TYPE_TRANSFER_VIA_ENTRA" + "NCE\020\235\002\022.\n)TYPE_TRANSFER_WITH_INVALID_ROU" + "TE_AND_TRIP\020\237\002\022\031\n\024TYPE_TRIP_DUPLICATES\020\224" + "\002\0220\n+TYPE_TRIP_HEADSIGN_CONTAINS_ROUTE_L" + "ONG_NAME\020\226\002\0221\n,TYPE_TRIP_HEADSIGN_CONTAI" + "NS_ROUTE_SHORT_NAME\020\225\002\022\036\n\031TYPE_TRIP_LENG" + "TH_TOO_LONG\020\265\002\022\032\n\025TYPE_TRIP_STARTS_LATE\020" + "\266\002\022\036\n\031TYPE_TRIP_STARTS_TOO_LATE\020\267\002\022/\n*TY" + "PE_TRIP_WITH_NO_TIME_FOR_FIRST_STOP_TIME" + "\020\324\001\022.\n)TYPE_TRIP_WITH_NO_TIME_FOR_LAST_S" + "TOP_TIME\020\325\001\022#\n\036TYPE_TRIP_WITH_NO_USABLE_" + "STOPS\020\213\002\022-\n(TYPE_TRIP_WITH_OUT_OF_ORDER_" + "ARRIVAL_TIME\020\326\001\022/\n*TYPE_TRIP_WITH_OUT_OF" + "_ORDER_DEPARTURE_TIME\020\327\001\0224\n/TYPE_TRIP_WI" + "TH_OUT_OF_ORDER_SHAPE_DIST_TRAVELED\020\370\001\022/" + "\n*TYPE_TRIP_WITH_PARTIAL_SHAPE_DIST_TRAV" + "ELED\020\216\002\0224\n/TYPE_TRIP_WITH_SHAPE_DIST_TRA" + "VELED_BUT_NO_SHAPE\020\217\002\022>\n9TYPE_TRIP_WITH_" + "SHAPE_DIST_TRAVELED_BUT_NO_SHAPE_DISTANC" + "ES\020\220\002\022&\n!TYPE_TRIP_WITH_UNKNOWN_SERVICE_" + "ID\020\214\002\022#\n\036TYPE_TRIP_WITH_DUPLICATE_STOPS\020" + "\270\002\022.\n)TYPE_TRIP_HEADSIGN_HAS_SPECIAL_CHA" + "RACTERS\020\303\002\022\030\n\023TYPE_UNKNOWN_COLUMN\020\222\002\022\026\n\021" + "TYPE_UNKNOWN_FILE\020\203\002\022\033\n\026TYPE_ARCHIVE_COR" + "RUPTED\020\262\002\022\030\n\023TYPE_DUPLICATE_FEED\020\263\002\022\025\n\020T" + "YPE_EMPTY_STOPS\020\264\002\022+\n&TYPE_INCONSISTENT_" + "EXACT_TIMES_FOR_TRIP\020\304\002\022(\n\037TYPE_PATHWAY_" + "MISSING_PATHWAY_ID\020\305\002\032\002\010\001\022$\n\037TYPE_PATHWA" + "Y_MISSING_RECIPROCAL\020\306\002\022#\n\036TYPE_PATHWAY_" + "DANGLING_LOCATION\020\307\002\022,\n\'TYPE_PATHWAY_PLA" + "TFORM_WITHOUT_ENTRANCES\020\310\002\022)\n$TYPE_PATHW" + "AY_WRONG_PLATFORM_ENDPOINT\020\311\002\022 \n\033TYPE_PA" + "THWAY_MISSING_COLUMN\020\312\002\022\037\n\032TYPE_PATHWAY_" + "MISSING_VALUE\020\313\002\022$\n\037TYPE_ATTRIBUTION_MIS" + "SING_COLUMN\020\316\002\022\"\n\035TYPE_ATTRIBUTION_MISSI" + "NG_ROLE\020\317\002\"\006\010\367\001\020\367\001\"\006\010\227\002\020\227\002\"\006\010\260\002\020\260\002\":\n\010Se" + "verity\022\013\n\007WARNING\020\001\022\t\n\005ERROR\020\002\022\026\n\022SUSPIC" + "IOUS_WARNING\020\003BJ\n-org.mobilitydata.gtfsv" + "alidator.adapter.protosB\031GtfsValidationO" + "utputProto" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[]{ }); internal_static_outputProto_PointProto_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_outputProto_PointProto_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_outputProto_PointProto_descriptor, new java.lang.String[]{"LatE7", "LngE7",}); internal_static_outputProto_GtfsProblem_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_outputProto_GtfsProblem_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_outputProto_GtfsProblem_descriptor, new java.lang.String[]{"Type", "Severity", "CsvFileName", "CsvKeyName", "CsvColumnName", "OtherCsvFileName", "OtherCsvKeyName", "OtherCsvColumnName", "EntityRow", "EntityName", "EntityId", "EntityValue", "EntityLocation", "AltEntityRow", "AltEntityName", "AltEntityId", "AltEntityValue", "AltEntityLocation", "ParentEntityRow", "ParentEntityName", "ParentEntityId", "Value", "AltValue", "Importance",}); } // @@protoc_insertion_point(outer_class_scope) }
39.799184
419
0.511797
1fff35af48680a25818bc8cf53e689a284e7788d
1,081
package com.daesys.maven.training; import java.util.ArrayList; import java.util.List; import org.apache.commons.lang3.StringUtils; public class Application { public int countWord(String words){ int nbWords = 0; String[] wordSeparated = StringUtils.split(words,' '); nbWords = (wordSeparated == null) ? 0 : wordSeparated.length; return nbWords; } public void greet(){ List<String> greetings = new ArrayList<>(); greetings.add("Hello"); for (String greeting : greetings) { System.out.println("Greetings " + greeting); } } public Application() { System.out.println ("Inside Application"); } // method main(): ALWAYS the APPLICATION entry point public static void main (String[] args) { System.out.println ("Starting Application"); Application app = new Application(); app.greet(); int count = app.countWord("I have four words"); System.out.println("Count: " + count); } }
25.139535
69
0.592044
6dd51f5f3c417919101966760fbaadb6657d8ac9
2,442
package de.metas.document; /* * #%L * de.metas.adempiere.adempiere.base * %% * Copyright (C) 2015 metas GmbH * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. * #L% */ import org.adempiere.ad.dao.IQueryFilter; import org.adempiere.model.InterfaceWrapperHelper; import org.adempiere.util.lang.ImmutablePair; import de.metas.util.ISingletonService; /** * Generic service that allows us do add handlers (could also be called listeners for all I know) which add module specific aspects to the copying of records. * * @author ts * */ public interface ICopyHandlerBL extends ISingletonService { /** * Registers a copy handler and a filter for a given type. Note that handlers will be evaluated in the order of their registration. If a handler was already registered before, the method will do * nothing. * * @param <T> the type (like <code>I_C_Order</code> or <code>M_Product</code> we register the handler for). * @param filter the given implementation shall decide if the given handler handler is to be applied for a given record or not. * @param handler the given implementation will do some kind of copying. * @see InterfaceWrapperHelper#getTableNameOrNull(Class) */ <T> void registerCopyHandler(Class<T> clazz, IQueryFilter<ImmutablePair<T, T>> filter, ICopyHandler<? extends T> handler); /** * Invokes {@link ICopyHandler#copyPreliminaryValues(Object, Object)} for all applicable handlers, in the order of their registration. * * @param from * @param to */ <T> void copyPreliminaryValues(T from, T to); /** * Invokes {@link ICopyHandler#copyValues(Object, Object)} for all applicable handlers, in the order of their registration. * * @param from * @param to */ <T> void copyValues(T from, T to); <T> IDocLineCopyHandler<T> getNullDocLineCopyHandler(); }
34.885714
195
0.733825
676519c9eab07166cf1eeaa808b5de0928e1e5b0
24,569
package com.contrachequeUI.controller; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.List; import java.util.ResourceBundle; import org.apache.commons.io.FileUtils; import com.contrachequeUI.model.Integrante; import com.contrachequeUI.service.CapaService; import com.contrachequeUI.service.CriptografiaService; import com.contrachequeUI.service.EmailService; import com.contrachequeUI.service.ExtractPDFService; import com.contrachequeUI.service.MergeCapaService; import com.contrachequeUI.service.MergeContraChequeService; import com.contrachequeUI.service.SplitPDFService; import com.contrachequeUI.util.IntegrantesUtil; import com.contrachequeUI.util.LogUtil; import javafx.application.Platform; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.concurrent.Task; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Alert; import javafx.scene.control.Alert.AlertType; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.ProgressBar; import javafx.scene.control.Tab; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.TextArea; import javafx.scene.control.TextField; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.layout.AnchorPane; import javafx.stage.DirectoryChooser; import javafx.stage.FileChooser; import javafx.stage.StageStyle; public class FXMLTelaController implements Initializable { @FXML private Tab tab1; @FXML private AnchorPane mainPane; @FXML private Button btnSelectLote1; @FXML private Label labelLote1; @FXML private Label labelCSV; @FXML private Label labelFolderProc; @FXML private Button btnProcIndividual; @FXML private Button btnProcCompleto; @FXML private Button btnSelectCSV; @FXML private Button btnSelectFolderProc; @FXML private Button btnSelectLote2; @FXML private Button btnProcLotes; @FXML private Label labelLote2; @FXML private Button btnSelectLote3; @FXML private Label labelLote3; @FXML private Button btnSelectLote4; @FXML private Label labelLote4; @FXML private Label labelLote5; @FXML private Button btnSelectLote5; @FXML private Tab tab2; @FXML private Tab tab3; @FXML private TextArea txtAreaLog; @FXML private ProgressBar progressBar; @FXML private Button btnSair; @FXML private Button btnProcCriptografa; @FXML private Button btnEnviar; @FXML private Label labelProgress; @FXML private TableView<Integrante> tbVEmail; @FXML private Label labelQtdEmails; @FXML private Button btnProcExtract; @FXML private TextField txtPeriodo; private File lastDirectory; private File folderSemCapa; private File folderIndividual; private File folderCompleto; private File folderCapa; private File folderLoteMerge; private File folderCriptografado; private String folderProc; private String fileNameXlsx; private String fileNameXlsxOut; private String periodo; private String alertaMsg; private String fileNameLote1; private String fileNameLote2; private String fileNameLote3; private String fileNameLote4; private String fileNameLote5; private String fileNameLoteMerge; @Override public void initialize(URL location, ResourceBundle resources) { System.setOut(new LogUtil(System.out)); LogUtil.printLine("O usuário " + System.getProperty("user.name") + " abriu a aplicação"); LogUtil.fileLogOperations(); LogUtil.appendLog(); printLogTxtArea(); desabilitaBotoes(true); labelProgress.setVisible(false); } @FXML public void selecionarArquivo(ActionEvent event) { String btnId = ((Button) event.getSource()).getId(); try { if (btnId.equals("btnSelectFolderProc")) { DirectoryChooser dc = new DirectoryChooser(); dc.setTitle("Selecione a pasta de Processamento"); File file = dc.showDialog(null); lastDirectory = file; folderProc = file.getAbsolutePath(); labelFolderProc.setText(folderProc); LogUtil.printLine("Pasta de Processamento selecionada: " + folderProc); criarPastas(); } if (btnId.equals("btnSelectCSV")) { FileChooser fc = new FileChooser(); fc.setTitle("Selecione o arquivo Excel (.xlsx)"); fc.setInitialDirectory(lastDirectory); File file = fc.showOpenDialog(null); lastDirectory = file.getParentFile(); fileNameXlsx = file.getAbsolutePath(); labelCSV.setText(fileNameXlsx); LogUtil.printLine("Arquivo Excel selecionado: " + fileNameXlsx); if (!fileNameXlsx.contains(".xlsx") && !fileNameXlsx.contains(".XLSX")) { Alert alerta = new Alert(AlertType.ERROR); alerta.setContentText("O arquivo selecionado não é um Excel (.xlsx)"); showAlerta(alerta); labelCSV.setText(""); LogUtil.printLine(alerta.getContentText()); } } if (btnId.equals("btnSelectLote1")) { FileChooser fc = new FileChooser(); fc.setTitle("Selecione o arquivo PDF do Lote 1"); fc.setInitialDirectory(lastDirectory); File file = fc.showOpenDialog(null); lastDirectory = file.getParentFile(); fileNameLote1 = file.getAbsolutePath(); labelLote1.setText(fileNameLote1); LogUtil.printLine("Arquivo de Lote selecionado: " + fileNameLote1); if (!fileNameLote1.contains(".pdf") && !fileNameLote1.contains(".PDF")) { Alert alerta = new Alert(AlertType.ERROR); alerta.setContentText("O arquivo selecionado não é um PDF"); showAlerta(alerta); labelLote1.setText(""); LogUtil.printLine(alerta.getContentText()); } } if (btnId.equals("btnSelectLote2")) { FileChooser fc = new FileChooser(); fc.setTitle("Selecione o arquivo PDF do Lote 2"); fc.setInitialDirectory(lastDirectory); File file = fc.showOpenDialog(null); lastDirectory = file.getParentFile(); fileNameLote2 = file.getAbsolutePath(); labelLote2.setText(fileNameLote2); LogUtil.printLine("Arquivo de Lote selecionado: " + fileNameLote2); if (!fileNameLote2.contains(".pdf") && !fileNameLote2.contains(".PDF")) { Alert alerta = new Alert(AlertType.ERROR); alerta.setContentText("O arquivo selecionado não é um PDF"); showAlerta(alerta); labelLote2.setText(""); LogUtil.printLine(alerta.getContentText()); } } if (btnId.equals("btnSelectLote3")) { FileChooser fc = new FileChooser(); fc.setTitle("Selecione o arquivo PDF do Lote 3"); fc.setInitialDirectory(lastDirectory); File file = fc.showOpenDialog(null); lastDirectory = file.getParentFile(); fileNameLote3 = file.getAbsolutePath(); labelLote3.setText(fileNameLote3); LogUtil.printLine("Arquivo de Lote selecionado: " + fileNameLote3); if (!fileNameLote3.contains(".pdf") && !fileNameLote3.contains(".PDF")) { Alert alerta = new Alert(AlertType.ERROR); alerta.setContentText("O arquivo selecionado não é um PDF"); showAlerta(alerta); labelLote3.setText(""); LogUtil.printLine(alerta.getContentText()); } } if (btnId.equals("btnSelectLote4")) { FileChooser fc = new FileChooser(); fc.setTitle("Selecione o arquivo PDF do Lote 4"); fc.setInitialDirectory(lastDirectory); File file = fc.showOpenDialog(null); lastDirectory = file.getParentFile(); fileNameLote4 = file.getAbsolutePath(); labelLote4.setText(fileNameLote4); LogUtil.printLine("Arquivo de Lote selecionado: " + fileNameLote4); if (!fileNameLote4.contains(".pdf") && !fileNameLote4.contains(".PDF")) { Alert alerta = new Alert(AlertType.ERROR); alerta.setContentText("O arquivo selecionado não é um PDF"); showAlerta(alerta); labelLote4.setText(""); LogUtil.printLine(alerta.getContentText()); } } if (btnId.equals("btnSelectLote5")) { FileChooser fc = new FileChooser(); fc.setTitle("Selecione o arquivo PDF do Lote 5"); fc.setInitialDirectory(lastDirectory); File file = fc.showOpenDialog(null); lastDirectory = file.getParentFile(); fileNameLote5 = file.getAbsolutePath(); labelLote5.setText(fileNameLote5); LogUtil.printLine("Arquivo de Lote selecionado: " + fileNameLote5); if (!fileNameLote5.contains(".pdf") && !fileNameLote5.contains(".PDF")) { Alert alerta = new Alert(AlertType.ERROR); alerta.setContentText("O arquivo selecionado não é um PDF"); showAlerta(alerta); labelLote5.setText(""); LogUtil.printLine(alerta.getContentText()); } } } catch (Exception e) { Alert alerta = new Alert(AlertType.WARNING); alerta.setContentText("Você não selecionou nenhum arquivo ou pasta!"); showAlerta(alerta); LogUtil.printLine(alerta.getContentText()); LogUtil.printLine(e.getLocalizedMessage()); } LogUtil.appendLog(); printLogTxtArea(); } @FXML public void processaExtracao() { desabilitaTab(true); alertaMsg = new String(""); if (itensSelecionados()) { Task<Object> task = taskProcessaExtracao(); updateMensagemProgresso("Extraindo os números das páginas do Lote Único...", true); progressBar.progressProperty().bind(task.progressProperty()); progressBar.setVisible(true); new Thread(task).start(); } else { Alert alerta = new Alert(AlertType.ERROR); alerta.setContentText(alertaMsg); showAlerta(alerta); desabilitaTab(false); LogUtil.printLine(alertaMsg); LogUtil.appendLog(); } printLogTxtArea(); } @FXML public void processaLote() { desabilitaTab(true); alertaMsg = new String(""); if (itensSelecionados()) { Task<Object> task = taskProcessaLote(); updateMensagemProgresso("Processando os contracheques individuais sem capa", true); progressBar.progressProperty().bind(task.progressProperty()); progressBar.setVisible(true); new Thread(task).start(); } else { Alert alerta = new Alert(AlertType.ERROR); alerta.setContentText(alertaMsg); showAlerta(alerta); desabilitaTab(false); LogUtil.printLine(alertaMsg); LogUtil.appendLog(); } printLogTxtArea(); } @FXML public void processaIndividual() { desabilitaTab(true); alertaMsg = new String(""); updateMensagemProgresso("Processando os contracheques individuais com capa", true); Task<Object> task = taskProcessaIndividual(); progressBar.progressProperty().bind(task.progressProperty()); progressBar.setVisible(true); new Thread(task).start(); printLogTxtArea(); } @FXML public void processaCompleto() { desabilitaTab(true); alertaMsg = new String(""); updateMensagemProgresso("Processando o arquivo completo dos contracheques ordenados pelo Líder", true); Task<Object> task = taskProcessaCompleto(); progressBar.setVisible(true); progressBar.progressProperty().bind(task.progressProperty()); Thread thread = new Thread(task); thread.start(); printLogTxtArea(); } @FXML public void processaCriptografia() { desabilitaTab(true); alertaMsg = new String(""); updateMensagemProgresso("Criptografando os contracheques sem capa", true); Task<Object> task = taskProcessaCriptografia(); progressBar.setVisible(true); progressBar.progressProperty().bind(task.progressProperty()); Thread thread = new Thread(task); thread.start(); printLogTxtArea(); } @FXML public void processaEnvio() { desabilitaTab(true); alertaMsg = new String(""); updateMensagemProgresso("Enviando contracheques por e-mail para os integrantes...", true); Task<Object> task = taskProcessaEnvio(); progressBar.setVisible(true); progressBar.progressProperty().bind(task.progressProperty()); Thread thread = new Thread(task); thread.start(); printLogTxtArea(); } public Task<Object> taskProcessaExtracao() { return new Task<Object>() { @Override protected Object call() { try { criarPastas(); periodo = txtPeriodo.getText().replaceAll("[^a-zA-Z0-9\\.\\-]", "-"); MergeContraChequeService.processaMergeLotes(getFilesLotes(), folderLoteMerge.getAbsolutePath(), periodo); fileNameLoteMerge = folderLoteMerge.getAbsolutePath() + File.separator + "Lotes_" + periodo + ".pdf"; LogUtil.printLine("Arquivo dos Lotes criados com sucesso: " + fileNameLoteMerge); ExtractPDFService extractPDFS = new ExtractPDFService(); fileNameXlsxOut = folderProc + File.separator + "extractFromPeople_" + periodo + ".xlsx"; extractPDFS.extract(fileNameLoteMerge, fileNameXlsx, fileNameXlsxOut, periodo); Platform.runLater(new Runnable() { @Override public void run() { showMensagem("Números de páginas extraídos com sucesso!", AlertType.INFORMATION); btnProcExtract.setDisable(true); btnProcLotes.setDisable(false); } }); } catch (Exception e) { Platform.runLater(new Runnable() { @Override public void run() { showMensagem("Ocorreu um erro ao extrair os números das páginas: \n\n" + e.getMessage(), AlertType.ERROR); } }); } return null; } }; } public Task<Object> taskProcessaLote() { return new Task<Object>() { @Override protected Object call() { try { criarPastas(); SplitPDFService service = new SplitPDFService(fileNameLoteMerge, folderSemCapa.getAbsolutePath(), fileNameXlsxOut); service.splitPDF(); Platform.runLater(new Runnable() { @Override public void run() { showMensagem("Contracheques individuais sem capa processados com sucesso", AlertType.INFORMATION); btnProcLotes.setDisable(true); btnProcCriptografa.setDisable(false); } }); } catch (Exception e) { Platform.runLater(new Runnable() { @Override public void run() { showMensagem("Ocorreu um erro processando os lotes: \n\n" + e.getMessage(), AlertType.ERROR); } }); } return null; } }; } public Task<Object> taskProcessaIndividual() { return new Task<Object>() { @Override protected Object call() { try { new CapaService(fileNameXlsxOut, folderCapa.getAbsolutePath()); try { MergeCapaService.processarMerge(folderCapa.getAbsolutePath(), folderSemCapa.getAbsolutePath(), folderIndividual.getAbsolutePath()); Platform.runLater(new Runnable() { @Override public void run() { showMensagem("Contracheques individuais com capa processados com sucesso", AlertType.INFORMATION); btnProcIndividual.setDisable(true); btnProcCompleto.setDisable(false); } }); } catch (Exception e) { Platform.runLater(new Runnable() { @Override public void run() { showMensagem("Ocorreu um erro ao fazer o merge das capas + contracheques: \n\n" + e.getMessage(), AlertType.ERROR); } }); } } catch (Exception e) { Platform.runLater(new Runnable() { @Override public void run() { showMensagem("Ocorreu um erro ao processar as capas: \n\n" + e.getMessage(), AlertType.ERROR); } }); } return null; } }; } public Task<Object> taskProcessaCompleto() { return new Task<Object>() { @Override protected Object call() { try { MergeContraChequeService.processaMerge(folderIndividual.getAbsolutePath(), folderCompleto.getAbsolutePath(), fileNameXlsxOut, periodo); Platform.runLater(new Runnable() { @Override public void run() { showMensagem("Arquivo completo dos contracheques processados com sucesso!", AlertType.INFORMATION); btnProcCompleto.setDisable(true); } }); } catch (Exception e) { Platform.runLater(new Runnable() { @Override public void run() { showMensagem("Ocorreu um erro ao gerar o Contracheque completo: \n\n" + e.getMessage(), AlertType.ERROR); } }); } return null; } }; } public Task<Object> taskProcessaCriptografia() { return new Task<Object>() { @Override protected Object call() { String urlIntegrantes = "http://api-baseunica.net/api/pessoas?fields=cpf,idPeople,email&filter=.&limit=0"; try { CriptografiaService cps = new CriptografiaService(); cps.criptografaPdfs(folderSemCapa.getAbsolutePath(), folderCriptografado.getAbsolutePath(), fileNameXlsxOut, urlIntegrantes, "Pass@2018cc"); Platform.runLater(new Runnable() { @Override public void run() { setTableView(cps.getIntegrantesComEmail()); labelQtdEmails.setText("Quantidade de Integrantes: " + cps.getIntegrantesComEmail().size()); showMensagem( "Contracheques criptografados processados com sucesso! \n\n\n Vá para a aba Enviar Contracheques, para enviar por email para os Integrantes", AlertType.INFORMATION); btnEnviar.setDisable(false); btnProcCriptografa.setDisable(true); btnProcIndividual.setDisable(false); } }); } catch (Exception e) { Platform.runLater(new Runnable() { @Override public void run() { showMensagem("Ocorreu um erro ao criptografar os contracheques: \n\n" + e.getMessage(), AlertType.ERROR); } }); } return null; } }; } public Task<Object> taskProcessaEnvio() { return new Task<Object>() { @Override protected Object call() { String src = folderCriptografado.getAbsolutePath(); String urlIntegrantes = "http://api-baseunica.net/api/pessoas?fields=cpf,idPeople,email&filter=.&limit=0"; try { String emailRemetente = IntegrantesUtil.getEmail(System.getProperty("user.name")); EmailService.enviaEmail(urlIntegrantes, src, emailRemetente); Platform.runLater(new Runnable() { @Override public void run() { showMensagem("E-mails enviados com sucesso!", AlertType.INFORMATION); } }); } catch (Exception e) { Platform.runLater(new Runnable() { @Override public void run() { showMensagem("Ocorreu ao enviar os emails: \n\n" + e.getMessage(), AlertType.ERROR); } }); } return null; } }; } public List<InputStream> getFilesLotes() { List<InputStream> filesLotes = new ArrayList<InputStream>(); try { filesLotes.add(new FileInputStream(new File(fileNameLote1))); filesLotes.add(new FileInputStream(new File(fileNameLote2))); filesLotes.add(new FileInputStream(new File(fileNameLote3))); filesLotes.add(new FileInputStream(new File(fileNameLote4))); filesLotes.add(new FileInputStream(new File(fileNameLote5))); } catch (FileNotFoundException e) { LogUtil.printLine(e.getLocalizedMessage()); } return filesLotes; } public void desabilitaBotoes(boolean bool) { btnProcIndividual.setDisable(bool); btnProcCompleto.setDisable(bool); btnProcCriptografa.setDisable(bool); btnProcLotes.setDisable(bool); } public void desabilitaTab(boolean bool) { tab1.setDisable(bool); tab2.setDisable(bool); tab3.setDisable(bool); } public void criarPastas() throws Exception { folderSemCapa = new File(folderProc + File.separator + "sem_capa"); folderCapa = new File(folderProc + File.separator + "capa"); folderIndividual = new File(folderProc + File.separator + "individual"); folderCompleto = new File(folderProc + File.separator + "completo"); folderLoteMerge = new File(folderProc + File.separator + "lote"); folderCriptografado = new File(folderProc + File.separator + "criptografado"); folderSemCapa.mkdirs(); folderCapa.mkdirs(); folderIndividual.mkdirs(); folderCompleto.mkdirs(); folderLoteMerge.mkdirs(); folderCriptografado.mkdirs(); LogUtil.printLine("Pasta criada: " + folderSemCapa.getAbsolutePath()); LogUtil.printLine("Pasta criada: " + folderCapa.getAbsolutePath()); LogUtil.printLine("Pasta criada: " + folderIndividual.getAbsolutePath()); LogUtil.printLine("Pasta criada: " + folderCompleto.getAbsolutePath()); LogUtil.printLine("Pasta criada: " + folderLoteMerge.getAbsolutePath()); LogUtil.printLine("Pasta criada: " + folderCriptografado.getAbsolutePath()); LogUtil.appendLog(); printLogTxtArea(); } public void limparPastas() throws IOException { FileUtils.deleteDirectory(folderSemCapa); FileUtils.deleteDirectory(folderCapa); FileUtils.deleteDirectory(folderIndividual); FileUtils.deleteDirectory(folderCompleto); FileUtils.deleteDirectory(folderLoteMerge); } public void printLogTxtArea() { txtAreaLog.setText(LogUtil.getLog()); } public boolean itensSelecionados() { boolean validador = true; if (txtPeriodo.getText() == null || txtPeriodo.getText().equals("")) { alertaMsg += "\n ...informe o período de processamento"; validador = false; } if (labelFolderProc.getText() == null || labelFolderProc.getText().equals("")) { alertaMsg += "\n ...selecione a pasta de Processamento"; validador = false; } if (labelCSV.getText() == null || labelCSV.getText().equals("")) { alertaMsg += "\n ...selecione o arquivo Excel (.xlsx)"; validador = false; } if (labelLote1.getText() == null || labelLote1.getText().equals("")) { alertaMsg += "\n ...selecione o arquivo PDF do Lote 1"; validador = false; } if (labelLote2.getText() == null || labelLote2.getText().equals("")) { alertaMsg += "\n ...selecione o arquivo PDF do Lote 2"; validador = false; } if (labelLote3.getText() == null || labelLote3.getText().equals("")) { alertaMsg += "\n ...selecione o arquivo PDF do Lote 3"; validador = false; } if (labelLote4.getText() == null || labelLote4.getText().equals("")) { alertaMsg += "\n ...selecione o arquivo PDF do Lote 4"; validador = false; } if (labelLote5.getText() == null || labelLote5.getText().equals("")) { alertaMsg += "\n ...selecione o arquivo PDF do Lote 5"; validador = false; } return validador; } public void sair() throws Exception { System.out.println("O usuário " + System.getProperty("user.name") + " fechou a aplicação"); LogUtil.appendLog(); System.exit(0); } public void showAlerta(Alert alerta) { alerta.getDialogPane().getStylesheets() .add(getClass().getResource("/com/contrachequeUI/view/application.css").toExternalForm()); alerta.getDialogPane().setHeaderText(null); alerta.initStyle(StageStyle.UNDECORATED); alerta.show(); } public void updateMensagemProgresso(String mensagem, boolean bool) { labelProgress.setVisible(bool); labelProgress.setText(mensagem); } public void showMensagem(String mensagem, AlertType tipo) { updateMensagemProgresso(null, false); desabilitaTab(false); progressBar.setVisible(false); progressBar.progressProperty().unbind(); alertaMsg = mensagem; LogUtil.printLine(mensagem); LogUtil.appendLog(); printLogTxtArea(); Alert alerta = new Alert(tipo); alerta.setContentText(alertaMsg); showAlerta(alerta); } @SuppressWarnings("unchecked") public void setTableView(List<Integrante> integrantes) { tbVEmail.setPrefWidth(561); TableColumn<Integrante, String> col1 = new TableColumn<>("ID"); col1.setPrefWidth(70); col1.setCellValueFactory(new PropertyValueFactory<>("idPeople")); TableColumn<Integrante, String> col2 = new TableColumn<>("Nome"); col2.setPrefWidth(291); col2.setCellValueFactory(new PropertyValueFactory<>("nome")); TableColumn<Integrante, String> col3 = new TableColumn<>("E-mail"); col3.setPrefWidth(200); col3.setCellValueFactory(new PropertyValueFactory<>("email")); tbVEmail.getColumns().addAll(col1, col2, col3); ObservableList<Integrante> items = FXCollections.observableArrayList(integrantes); tbVEmail.setItems(items); } }
30.257389
151
0.683259
ebca94818aa6da9247693f0ffc1069c23fc5e8f3
1,873
package com.philpot.camera.util; import android.graphics.Bitmap; import android.os.Environment; import android.util.Log; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; public class CameraStorage { private static final String TAG = CameraStorage.class.getSimpleName(); private File getPicturesDirectory() { return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); } public File saveBitmap(Bitmap image, String fileName, File defaultDir) { File parentPath; if (isExternalStorageReadable() && isExternalStorageWritable()) { parentPath = getPicturesDirectory(); } else { parentPath = defaultDir; } File file = new File(parentPath, fileName); FileOutputStream out = null; try { out = new FileOutputStream(file); image.compress(Bitmap.CompressFormat.PNG, 100, out); } catch(Exception e) { Log.e(TAG, "failed compressing bitmap", e); } finally { try { if (out != null) out.close(); } catch(IOException e) { Log.e(TAG, "failed closing FileOutputStream", e); } } return file; } private boolean isExternalStorageReadable() { boolean retVal = false; String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state) || Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) { retVal = true; } return retVal; } private boolean isExternalStorageWritable() { boolean retVal = false; String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { retVal = true; } return retVal; } }
29.265625
107
0.624132
08c97378fa2217c40979bb416c4d98a63e1aa227
20,200
class rR2m8BsUmg { public static void D (String[] IRfqW) throws _MHNtoHTTE { return -!---new qrX().TjAb(); ; if ( --new boolean[ new eAC().d3NAmCp9].w1ceH2lgWU) return; boolean[][][][] wgUGs; } public static void X37 (String[] tsc6RabA) { null[ this[ new yhCY().ZKUfEFE0]]; void AY7; } public static void mFZYQ7 (String[] gr4OXoLF8H) throws qaw46VQTIrAAWg { RG Ik1RPagWifaR = !!-( Zsdc.TR6JMujI).JW(); while ( !true[ false[ -!new En0TN3BRLE8_l()[ new c7Ya1E1d().taFqCDBs24y0]]]) while ( this[ !new int[ --!!59117.LKlYoJblwd2A()].mBM6Rtig()]) { ; } { U6Og[] hHaF; void[] N; { while ( new oYP_eNTpYLu().PZ) { if ( !WxzhigJH().Ur_) return; } } int uhL7; while ( -new Zli61EGqb8KT().p05qVLxg4Q_bcy()) { boolean[] rhzFXwSrjHi; } A8 EiVytAIlj; int[] C_DYNUBH; } ; int[] VytgEDD41qj0 = !bfe3Nm_.RHxo = -!---!this[ !( -!957[ zNyseqj()[ !a7qNVJShIqIzol[ -41786328.IaX58jURgy3()]]])[ ---!false[ null.vi()]]]; fssa r2YlQHUvS = -924568.kqXckEH = new boolean[ KvJ0XfCe().p4dbhvjvbSb5()][ true.Y]; ; { boolean tP6bn; { int[] RWd_Dq3XxNie; } int[][][][][] S; int[][][] Zce1llqLZpCHb; void[] lJZBZmU; { boolean[] xXTNnWB48jrU; } return; return; return; if ( new mkp8nM[ this.HsXGptxNSe].cdh6()) { while ( false.tSe6XnyNFmONK) while ( -!-!!this.nLbzLBqe3Pki08()) { wQc6ESCtTBiXt().AA; } } ; { { while ( !false.XILe) ; } } if ( true[ 878[ UMX.nYmeul]]) if ( !--new nHy_LgJj5Psg4[ !true[ !!null.cgQwp()]].gq()) while ( null[ !NaDxs711lMf().rCJc7gf]) { while ( new void[ new int[ -!!!!lZmsio7m.yCez7dJ()][ new boolean[ !!false.Ce7oMBW2syHU]._A7]][ !ER9Ud5w0eHG.Vl0qcm6_Dkq4]) while ( -false.mnxoT1YeAxeirD) if ( -new G95k6z()[ !this.IQrv3Ei]) if ( -!!--false.Fa7ZcO) { boolean[][][][][][] oXefh2ztCyKz; } } } return new vuUcwI()[ null.LCmCYYwD3ZVRpv()]; void[] mmSW7V_4PfKD; if ( this[ !-!-new boolean[ 90163776.u][ Yc7yK0KU().Bv3aVh1S0ed4Q()]]) ; { -6143795.roiA3(); void[][][][] p; Z6ylePoe_[][][][][][] GhcyADW9zeJJ; !-this[ !new CV6BTRw3vEi().RI]; if ( null.GbHcEWNU3AZ()) return; ; void[] k5_; A6yToC hWEa4Ds7BVj; !-!sE3U57a().SDGW8x0yPkuFZ(); void UQIJAaPIo3f; void[] Bo44C6CECI; { return; } { if ( !false.p()) ; } boolean XpaZ; if ( !!!!-null.YmoonB9AsueXK) while ( 13944.mp) ; T ATzQMsn_P3aUf; return; if ( -!this.ZGN8()) { return; } int mcECIKaN7hjx4n; } boolean[] ql6ChEgzG; boolean[] V6VfKq343 = this[ ( !new Ptpn().XpImo())[ ---false[ -!l().m]]]; pGlbuiLksxHRA[][] YHR6Zl1w = -!-new AO7ZvS1U().yMnc9h40snce = -null[ !!this.bFTnNMry7QmrrI()]; N5WXNHM[][] q82qvXMXHpyOgN = -new oF0zRdP0kFt().nEFSDwIcuUlH; boolean[][][][] _hdKfurnik = -!null[ U2J7_0T0rUAaKD().CeK4_6APCk()]; } public static void q7kL_3abtXiy (String[] lb4kD81OZsad) { void k3_dnsSjwSFre = !!!-----!Dz3Q0hf8u.DbIyIYUC66Y; return; !true[ !!!new int[ new void[ true.Diqy0HO2sD()].Mjt_7t()][ true.RL1DR]]; ZtmFr0GQ[] e; while ( !-( -true.KE43ABmMlyc_)[ !eIKxt0YFrbHb()[ -!-!new yzL3()[ 1.K4h4]]]) return; if ( 794155899[ !!new KL6SO7rpn().CdbXA3]) ; return 044945.kRBZ1CnkD(); if ( -!!---true[ tF5I2B().uDa_()]) { int ozsHKP1; }else return; { { kYx46kLZ3 V8ULLRlRuax; } if ( -!f3.GaEPm) return; while ( -G1wC5.sHF5TE18nIT7p) return; while ( -this[ --null[ new BRcWTkMw9ZDcNK[ 63425.MqbceZ].LGo9uSngl65()]]) ; boolean VooBgDQ5QP; if ( false.Ulmgv3fh_sMx) return; Uh_CQQkpCCHnG YO5Q; if ( !null.YOMs()) ; return; int a_BsJWWZV; E[] Tl33u; while ( -!-null.WPsZ()) { -null._; } } if ( ( -new BhRhm9XszE().d1uZ99X6cFdaeR)[ null.Gfi1]) null.h; ; { boolean[][] xV83; ReNHdO7jMBPLp[] c5VUJmT7f; boolean[][] i39WweO; int Rq9OpN20j4IOT; ( ( ( -556249979.rwtH).fRna_4u7UrtFHy()).jKO)[ !( 93531.RAQGZVtiC())._i()]; } int t2TwFvVQ; while ( !!!false.B0pX()) { if ( -this[ -new YMqKH5myWOMLsQ()[ -vEwa()._qwnL40LcDDFhx()]]) if ( true.sn()) ; } while ( -Nu7Db[ ( -this.zGkugYup6iCw()).oKxwMpC]) if ( _eNaX0ohdtvUhb.k3iB6FO8RC()) !----null.dhtnF3wEkIutK; while ( this.WZeBLS5lIjHyM) if ( -null.k8e5c()) while ( -!!!-zB.lZyCBCf1) if ( -dP.cJszdVEpv9()) if ( --!82893.x7kUdrJJesYBG) { ; } null.bpupi(); void djYxe; n5Q8U9 EOCykdrgtN5; } public static void l (String[] isHolxnA6C) { int[] ylSI7Mu = !false.P9mL0_ZV = new HIuZUuiRQnavsg()[ BeWcYxfCfo.ZQWokd1X9Gwwuf()]; int E1s; !!!( RshvPAQKJmM[ !-null[ !this.hu1JRkoBtXEl]])[ -false[ true.Sxb8OktRYX]]; { while ( -gv1V_ER_3[ ( uDSMPSgl9Sd()[ ( !false[ nJMlSo.qZs2])[ new h[ !-!new int[ V7R4TGadqobHN.E].x].bLhp()]]).Sk2YXc9V4Rzg]) return; return; if ( !-!-null.YIc9wbK0ZYcb()) while ( !!!this[ -null[ true.zJ]]) { ; } return; if ( true[ ( null.Eq90Q5Wu()).GR3()]) ; boolean[] zJoyTTwgRApuph; TU9OI[][][][] znclDnwZ1jA; void MCZg92DBL; int QHoXzDbMfCo; this.IyXJQHMFnT; int ca; return; { pCE[][] Zil6fUJu; } return; int[][][] yY8DR; void[] GMlr; this[ jc7kzoddUHK.OZyGfM5M6NlNr]; void AZRnX8OQ; void[][][] JWJ; int[] iJ2xNH4hOTy; } ; if ( !false.q0FDIIKq8n3()) ;else return; boolean[] _gE3WsJ8cE3v; int _8JtkHX; A0B[] hxCG8QZIFHJQM = false[ --S11tL4B3YUN5w.JvJUM2XLgkalU()]; -false[ ( !!!!-!!!null.YQFO).j()]; S3HuMFteb REMe5SswhHBSuU = true.GNOtAb = !---!this.UHw141gdOuiVw_; if ( !-!new HE[ -!VgdEcES4LVP._559rVaXiWDHx()].JQ3J8bh6Kgi()) return; void HpEfnibv; -false.Bjs__kS_EAXIT(); while ( ( pA1zSUNyxgEHtf().VQ).r2tLU3sYo2N4C()) ( ( new boolean[ true.Bwem][ -new void[ -null[ ( --this[ !!EZSXMkncYzk74().yJN6J]).Zy7_4hjcn2wpg()]].r4wvT()])[ --!-this[ -!new int[ !-false[ this.sgVt]].qpUaaNvZA9]])[ !-!!!-!!F5().A3j]; O8ev zgv3g7MbfST = !!!-!null.w2xIUfX = 685.vSYIAtSko; } public int i; public void[][] lAI; public static void ZgXjHFl4Wm (String[] PZONAqughZO) { { if ( !!this.xsMse3_k_()) !-!!AIUdy2().UXebTpKq3YtFw(); ; ; return; void VHcOR2OM; ZHBKOV3i[][] mF; VhBlE8VfAov[][][][] M8R; { boolean N; } void[] ahDWWRfHr1Hxnq; ; CQKGo s6; ; int[] SpYbrNMvlUqY2; int LK_E0Cia3pMuOI; ulDg Y4syJb7v8; } int[] A7h = -!!false.i9OY2CkumqC = this.lwrxbAfQqvqyFl(); while ( !this[ !-!!--false.jXT8k()]) { boolean[][][][][][] _8h8hz15Xo; } void NPWLpg0P; ; } public MiucfvMi jPR5fR1v4s2jo; public static void Tm (String[] QBlkrHDJ7dh) { int W498zFWXt = --true.UChw09e = -true[ null[ false[ !true[ new xK().hjI6BFVgbn8()]]]]; ; while ( !!iFAY5C.rRY5H3yWn1an) -this[ -false.x1y3aVbIioqv()]; } public static void I28nByKmNhgOEJ (String[] GRXN9WbIYSZ) { return; return this.SQVxzK8kW; int[][][][][] dP8dHM9nH0E; NrEsDG5Cfdeiz7().ufObyoeizB; if ( new mQTZI70KCd62dY()[ !-null.NR]) null.sey5_D6p1;else return; return !false.KyV4fkFQ; boolean[] hCt2; while ( y.tNy1O7KRQ89u) ; int sTxqAASPb3U = new iEon().gkVJ5Jawn() = new XuaegQc1W[ !!this[ !( !new rDZ().ZS_kFJ0fRwO()).SF6VNcz4]].LpAdjz2I; int EYAfUrtqF; { boolean C6k676aa; if ( this.YCtkKE) while ( !-!!new wBoNMe7pu[ QThyOOmMHcUsk3[ this[ new On().YmnzVYrLitA]]].gywk7Nstw) if ( -----4562.DcZG1IjOuVkl5k()) ; ; while ( bmWr8KHMBFdJ[ false.f]) return; while ( -!!-em().a3RwxBykX593) { return; } K7gx ZtqgqiUlpynB5l; return; CDSq[] rW0RM1t; int[][][] IJmp3K; boolean zfqsy; void[][] z_nUT2Us; int[][][] lX; } ; } public static void WF (String[] kXcw5WrDa) { void sutVxZxM = -new boolean[ -true[ !DMMTYZkL0qw().DpfC()]].OBt_6i; m9QcflDgXt7G0[][] cYmoGtNdi; I77pHRxkeK MNY = !a76PeydJEJ().UDrcLS(); ZwSSBHtClR oBl8Mqis4o0U = xI0w9_z6[ 50.n()] = true.uk5vvOClW; if ( 31965.bK4_Wyksc1VU06()) ; return; void[] HWAllzspSGFA; { this[ -new boolean[ -!-new Y9EC_f().kWhF_()].U3JSIzrDWV()]; void[][][] gvcUprT1X2Cx; false.Cd99elb9(); return; } void WdJqDPd; int[] R35 = new G6xl[ -oA()[ !false.haxpMHkfpB]].XCd() = -true[ !--new Des[ !new ILjqIe5k5tKoJ()[ !new int[ new boolean[ x1Il9IbjgsrPM().fQ5p()].hziegkIeJA023].qhOBVdLQF]].HlVgk]; if ( --!new YD7Pdr2j().KrxyToyWjamf1) ;else null.xDasTxM8K; !null.uVNtkBju; void eI; boolean[] kd2XMN19gUOG3V = false[ ---!new boolean[ fntP7_EXriw[ !false[ null[ false.e_zC2JoB3XnDI]]]][ this[ --( ( -true.tWkiktoAU0j).jW())[ !!new int[ new int[ true[ --this.XQjwfkjeEvsSnO()]][ !-( 362[ null.JY3uSKrEWvu()]).rc6cs()]].zbUDGGhDIhTGP]]]]; return; while ( -null[ --new vGFCjdzXrSg()[ --!true[ td.bD6ER9OehsM]]]) while ( true[ !( -64815.dHWjOZa6sf()).sJcHradC()]) ; return null.kN(); } public hRUKbbtz v5P9aVfPtjG_Fo; } class H0q { public ININ[] wzhsrM67blvDB_ (boolean BD_C3, void d, LurQL2dBqvUR N, boolean tydPFrxalvcZNO, int[][] r0nDad, KWcUITp EUB, A_x72G9Co7f2BL GHkpK) throws PiK { if ( !-WZ()[ null.p()]) { int[][][] rpb1k36T53; }else while ( !!null.iqSWELGRy()) ; while ( !-907.yHta4vC3C4p8g) { new boolean[ --!!geRTod8wth7().RFQbKCMuI].wLuM; } ipYlvCAVY[] qMwxtRB0kLiREQ = -null.P391y9adRCzDHa(); void[] D2Bko9Sve = -!-!-!new boolean[ new nHvA9ObAZTR4v[ !false.XrIUlB][ null.WRK4GC4F]].YkDyB8ROaAy6IP = new boolean[ 9[ !!null[ -new e().bshPtrvTl()]]][ this.KDXOxai36pSr]; void wntmsFBd = A7RLeNXD4zKZ3.fjccFfOsHGocx = !-!---!uzBawa28wVXF6[ new cKOwL().qqieHZ3gKZQ44()]; void FOZfz = null[ -!-!( this[ rBK().hzVELIjoE]).gQbradtEl6wY()] = !-!-!-Q1aSIYHSnOS2r.UBQv4XpiD; ; boolean yUGpCRl_I; boolean[] LZIwnQ6r3itz = new s6[ true.i1Xv0br3_Po].B = -new zFmPMy9U5bP().nRZ9ev59dC057b; int XzUcV8; ; while ( !--null.WrIkjS8bVt) return; int cAFPEcS = !new sDG()[ -( false.H2RJT3gjxnVz)[ !false.LLhJUjeRKwA]] = 583551007.lrv8pXRSHGO(); !!--this[ !!true[ this[ ---!null.P()]]]; if ( ( ----new ZV()[ --new boolean[ new P2L30z().YD].BzTF5XtqtYEc55]).TH6UNQ59NYn()) return; { Dg[ this.dUrWJzey]; ; !_Hf4dA73hCfxiW()[ --null[ !false.pinXcuJn()]]; void wISve; int ZWBHW; new boolean[ -!7[ this.V0l4vTZSk]][ true.nM_]; } } public static void Zqk0x8 (String[] osrX3Ih) { return; while ( --this[ new jEI5_piFC7[ !!this.Vp26NWHB7oDSW].Kvu0LI5HqbCMU]) while ( this[ AFvIXHX1.u()]) while ( !new boolean[ new void[ !!( !!true[ true.NzIe()]).RQTzenDk2RrM()][ S()[ -true.Yug0yIP9KXIoXz()]]][ ---new VC7X7xAeOchE().nMcoEl4HUoZJP()]) ; int ToKSzrU9v = LsNjI.NE(); wNBy[] ezHoa; while ( -this[ !null[ !-!false.rYna_tltji()]]) ; boolean[][][] FcsYUg3UQl = ( -new void[ this.pvGQq][ new FfzFBUzdj3().Ot8TOSvPXOP])[ --!18879.Ahzm_PpVT2F()] = null.aB(); RAkPWnYeBYek[][][] yL5Vu = FO_P7()[ true.KP2KD()] = this.CqfREoqOr(); h[][][] T8KsZtl = new boolean[ --new boolean[ ( cJqF2n2NIZ_2()[ false._()]).KS()].KK5anRams()].i; boolean kFnmMaimHp4; boolean[] _B6NF5X = new K().YeMIUdrLi578Hf(); } public static void Xo_L7iXxf3YrH (String[] YtG) throws IVDq72I { kd_K[][] Vu4kknok8MBgpn = hn5PfuVgk4j().k5lAa8S8y() = -this.He6BU(); return new mRYKf()[ !-qC1rpITH4H.m()]; int[][] jo1ab2; ; while ( ( -( true[ -Gh.aupx6hYxSj()]).UmvW)[ new NxXYSBDkxXf().T]) if ( !true.tV6Rpx_cBFrl9) new VRvrxMoUOMm().VYDce(); boolean O2KG7Hdozf = false.c = true[ !true.b()]; SF_[][] ggmDLQ7evRo; boolean CWu_vf = !-!!JTprh38zw().FKr = -!!--null.ildLNSvZX(); if ( -uI[ new JPKwNsz2()[ -new O4niV().Tg0E]]) JjM9pjgSQRv().y6VLXUDTCGasD; while ( -null[ d.WNtiCBNyGqO2UQ()]) { Xr5BAqfUMmbW[] YB; } void[][] sjqkeD709k = new Zc0vXTvNe()[ C.Kq] = -true[ this[ rk8ms6[ !-new int[ -!-null.rC9Zf9BdY8NFx()].f8VT]]]; ; boolean[][] b9y2h0zogQx24R; return; boolean iX9 = !-!!!-true._F() = true[ ( !!!new UnVrNQst8LE4ZJ().eFrz17gqUmVc7()).UXZEeDcKLGW]; return -null.I46W; void xKIY3C; return; void[][][] CvuX; int[] fzvYVVt; } public void[][] ZpVgKjImwrmb; public Ev6[][][] Ggl; public boolean wglC (boolean Ass6gI8P3) throws w1320RkK1VtK { void[] wbvj6V3idlWRE; int XL1e; void bDasPDDT = Dpmw_FYLK6xlk.oW; if ( ommpOIplcA.nc1u93m) ;else ( -X()[ ( !B282y6J7o1().WCSK7i).fg8()]).H; !!new cGcsG6sUhOf8[ -true.xT6TzmREvgFa()][ ----!!!!!!null.cHU5KMvlATQcT]; } public static void VXZZDmkBs5W7z (String[] x9CizQ6) throws t { void[][][][][] L7pKuNiDjr = -Hx8SNZ2zRi2C4Z().AVB7mYPCKZ(); int[][][][][][] lJs8plKy2 = -true[ !!null.CKKBXxZm2gF()] = false[ !7[ !!--( ( this.Y_DhNX9RcWj)[ -this.fUV()])[ !!57003[ null.asJ()]]]]; if ( LPtblQHJCSWH.DGnP7mO1Zm()) ( new NnksFH().TL0m6Xg5Pc8z0U()).jUuXg1t1f5Vw; -new SP8hV5k567().x; while ( new ZcZ7kCXOSuYpV().hLp6w4) if ( ( this[ --new YA[ true.QlxZowbeX()].N()]).S) return; int[] _f1; FI V6jdr = !----!nyokFh585jhS().UMZIyz1euV; while ( ( null.PdtweG3)[ new uotFJUeiG[ !( -this.no()).a()].__l9c66L8CI8ka()]) { !!!-new Ya8().rsqP; } } public boolean[] JX38uaQoFSb3; public static void eyy36B3eWO (String[] UX9LM9poK3) throws TI { boolean nJoEGF8XkpE = !-this.YErb0NHTBqugth() = w2MuJ7.Q9fRdQHS(); void[][][] YQIg = new e_RFZBOoEdxU[ !k79JYuYgYnQpw().w2hTWL5XY4aZvv].LbA30Hw1nHB() = -false.heQPFw1l; while ( 3403649._()) ; void[] DpqK4; boolean h25CF = -true[ --!!-new void[ this[ !108878382.QTWWyCt()]].Gums()] = ( 929536.MBy7())[ !YQX().uEr1NTYl]; while ( -!null.B1oRCJ_rtI7bj6()) ; { if ( !-new NIYMziZKN()[ -947.gWAB52q9VJz]) if ( 546254._6Jv5Jk) !!!!false[ this[ this[ !-false[ -this.xG5c()]]]]; TzpmPkANbrtSHp.sgT1LysUD1uGM; ; while ( MPus_6wW9ClxZz.a7eJZpV()) if ( false.GHv2oNb2I2b) while ( true.oWN3YeIUNJ) if ( ---true.srKgo6xnGES) return; } boolean[] RLJ_We; while ( !----!!-Ag0n[ e2m().TngKYDWnVn()]) ; if ( new void[ -!null[ !--this.M]][ new int[ ( true.xQ7V0_QoO)[ !!!( true.wxP)[ this.axTx13BZ0VQoe]]].yNOFV]) ;else return; ; int[] KMi385b = ( !( !U().d6e).QeBVbdYbGam).xvY6Cq() = 524147.bJ6A; if ( !false[ this.lzSgdyWBCygw]) return; while ( !null.zd6d7V9Wp_gbcp()) while ( this.OW4NMsQ5hG) if ( !WUeDKdoCkyM6[ !!-064815[ !( 681.vJUCJYPu_()).Ytol8j]]) if ( !this[ !true.KQ]) if ( -!this.MqH6hHuPDy) while ( this[ -new boolean[ EtE().ihiN()].R5rKLp()]) if ( !-!!!F0woX.Pz()) w1pkdrQRB_().ukPDSub; } public static void TIJcBHf (String[] sZhV) { ; return true.S(); while ( null.koN()) ; SYrWqbqlkO0t[][][] Dkcsb1UMK; xMw2yf9k[][] C = true.XIn7T6hT; { boolean[] yOwRqeZ8f9j; BWie37ssKxZ_Y[] zHTsbsTDo; ---!new int[ ----true.Hxp7ooo8PgyjnK()].ag54p3l; if ( oP8().i()) if ( !akrO3356fKt8().pqKDmWYf0E) return; { return; } int Y6uRkDaul; { 87654[ ( --!this.yM2lKyxhX_()).RbCz5jYK_D4m2]; } -( -!-true[ !ssfhQl().j8Kh])[ new NinS().mmX5]; { while ( ----new lYLgC8h04D()[ new void[ -!new E3dNEfC2J9_pDS()[ !new boolean[ !!!false.a7GqzW][ F3JmA4sVEJnDeu().w]]][ true._()]]) ; } int[][] iyyNjnnw; } if ( eWEnF.kUsL()) return; boolean[][] NAHA28UX; RuU7OrADybMY()[ ---!CTUtpdjfG57zg[ this[ false.DsM3JEtdUe]]]; boolean[] zOz_f1f0; void[] xxTehan5KcvYEm = --!!--true.HBMqvnYcFBTw() = ( !true[ B4bLnNBQJHch.ipfg8dtUqy()]).YgbQEuWUaClP(); } public dbUGQQ6H_8[][][] Y1eM; public static void xiRcaiS7 (String[] qk) throws RrKOGpMRQ0a7 { void cGXQnWoKCpR = ( -true.TausMv64C68zv).pQmGbp(); !new H3().awzPf; return; int[] Sq4; { while ( zJvCkNn.v()) { { ; } } while ( null[ true.fNvWhEd3v]) while ( new int[ ApECk40RCy().Vg3C()][ false.qwhDpu18aIo]) { ; } void[][] HmgfKZL1; return; } { boolean[][][] p4P4; HIojqA2wl NMbDnchtpJ9; while ( true[ !7699437[ -MOOapXfpPhO()[ false.wIvSxtO7EZrt()]]]) true.rjTncDzlSHsp(); int[][] dbv40f; while ( !null[ JcVNI9q.xb]) { int WOBgI1lOV; } int eEghD7jVCe6v; S0IKGgD[ !!---98157.Hx7pEvt3HkW]; Lqr0KKBd[] dKo9XhgJx; int[] c89pemhJk; ; -l()[ 94429.NMzpBAXIQ]; boolean[][][] GlgJW; void Fn9; void yKZmI_c5dt6; void[] YAHUrZp; return; boolean[][][] EVn; !null.wCuARiHQvx(); KHQs3rEAxDI tcO12adS; } if ( false.wnwU44cfOI) { int mQXBjIAwE; } if ( true.nLFWu()) { boolean GAlkUAIFm; } { while ( zhUwN724gPV[ !-true[ false.vb()]]) if ( !null.IdS) while ( !!!null[ -!!false.M()]) ; } if ( e3sd4sZikvuXhF.WHw()) if ( !new void[ -hCv4ZKNTXrAuws().Ec()][ !-true[ !C.LWiyq_()]]) zCLza66Z()[ -!true.va5JGha9oquLOQ]; void S; dyHqTb9Z7sivH[] ScPzq58E8; int WPBNmz; ; while ( !this._6COvLYUGZtH) if ( !new cbhd().UQhv1()) null.HOlv3gLAtT(); ; if ( 49097100._()) { int sKZfPBwBzqf; } while ( !false[ new FwVt()[ null.FZLPFExUJp()]]) return; return; ZT5d v0ihWnnBN8NnJd; } }
41.14053
270
0.500792
4f107007f8e3f8dee018115f3e165ddec11476f8
619
package com.ym.gulimall.seckill.scheduled; import lombok.extern.slf4j.Slf4j; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @EnableAsync @Slf4j @Component @EnableScheduling public class HelloSchedule { @Async @Scheduled(cron = "* * * ? * 5") public void hello() throws InterruptedException { log.info("hello!"); Thread.sleep(3000); } }
23.807692
66
0.768982
40931ba6d9bed8ea5021f1d72db3233433fe74bb
749
package it.gualtierotesta.vertx.reactive; import io.reactivex.Completable; import io.vertx.core.DeploymentOptions; import io.vertx.core.Launcher; import io.vertx.reactivex.core.AbstractVerticle; import lombok.extern.slf4j.Slf4j; @Slf4j public class MainVerticle extends AbstractVerticle { public static void main(final String[] args) { Launcher.executeCommand("run", MainVerticle.class.getName()); } @Override public Completable rxStart() { vertx.rxDeployVerticle(new RestVerticle(), new DeploymentOptions()) .flatMap(x -> vertx.rxDeployVerticle(new OtherVerticle(), new DeploymentOptions())) .subscribe(); return Completable.complete(); } }
26.75
93
0.687583
af88818980f1f7881232101bdf803bfcd61f5788
19,446
/* * Copyright 2015 Red Hat, Inc. and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.kie.server.client.impl; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import org.kie.server.api.commands.CommandScript; import org.kie.server.api.commands.DescriptorCommand; import org.kie.server.api.model.KieServerCommand; import org.kie.server.api.model.ServiceResponse; import org.kie.server.api.model.Wrapped; import org.kie.server.api.model.instance.JobRequestInstance; import org.kie.server.api.model.instance.RequestInfoInstance; import org.kie.server.api.model.instance.RequestInfoInstanceList; import org.kie.server.client.JobServicesClient; import org.kie.server.client.KieServicesConfiguration; import static org.kie.server.api.rest.RestURI.*; public class JobServicesClientImpl extends AbstractKieServicesClientImpl implements JobServicesClient { public JobServicesClientImpl(KieServicesConfiguration config) { super(config); } public JobServicesClientImpl(KieServicesConfiguration config, ClassLoader classLoader) { super(config, classLoader); } @Override public Long scheduleRequest(JobRequestInstance jobRequest) { return scheduleRequest("", jobRequest); } @Override public Long scheduleRequest(String containerId, JobRequestInstance jobRequest) { Object result = null; if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); String queryString = ""; if (containerId != null && !containerId.isEmpty()) { queryString = "?containerId=" + containerId; } result = makeHttpPostRequestAndCreateCustomResponse( build(loadBalancer.getUrl(), JOB_URI, valuesMap) + queryString, jobRequest, Object.class); } else { if (containerId == null) { containerId = ""; } CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new DescriptorCommand( "JobService", "scheduleRequest", serialize(jobRequest), marshaller.getFormat().getType(), new Object[]{containerId}) ) ); ServiceResponse<String> response = (ServiceResponse<String>) executeJmsCommand( script, DescriptorCommand.class.getName(), "BPM" ).getResponses().get(0); throwExceptionOnFailure(response); if (shouldReturnWithNullResponse(response)) { return null; } result = deserialize(response.getResult(), Object.class); } if (result instanceof Wrapped) { return (Long) ((Wrapped) result).unwrap(); } return ((Number) result).longValue(); } @Override public void cancelRequest(long requestId) { cancelRequest(null, requestId); } @Override public void cancelRequest(String containerId, long requestId) { if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); valuesMap.put(JOB_ID, requestId); String queryString = ""; if (containerId != null && !containerId.isEmpty()) { queryString = "?containerId=" + containerId; } makeHttpDeleteRequestAndCreateCustomResponse( build(loadBalancer.getUrl(), JOB_URI + "/" + CANCEL_JOB_DEL_URI, valuesMap) + queryString, null); } else { CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new DescriptorCommand( "JobService", "cancelRequest", new Object[]{requestId}))); ServiceResponse<?> response = (ServiceResponse<?>) executeJmsCommand( script, DescriptorCommand.class.getName(), "BPM" ).getResponses().get(0); throwExceptionOnFailure(response); } } @Override public void updateRequestData(long requestId, String containerId, Map<String, Object> data) { if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); valuesMap.put(JOB_ID, requestId); String queryString = ""; if (containerId != null && !containerId.isEmpty()) { queryString = "?containerId=" + containerId; } makeHttpPostRequestAndCreateCustomResponse( build(loadBalancer.getUrl(), JOB_URI + "/" + UPDATE_JOB_DATA_POST_URI, valuesMap) + queryString, data, Object.class); } else { if (containerId == null) { containerId = ""; } CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new DescriptorCommand( "JobService", "updateRequestData", serialize(safeMap(data)), marshaller.getFormat().getType(), new Object[]{requestId, containerId}) ) ); ServiceResponse<String> response = (ServiceResponse<String>) executeJmsCommand( script, DescriptorCommand.class.getName(), "BPM" ).getResponses().get(0); throwExceptionOnFailure(response); } } @Override public void requeueRequest(long requestId) { requeueRequest(null, requestId); } @Override public void requeueRequest(String containerId, long requestId) { if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); valuesMap.put(JOB_ID, requestId); String queryString = ""; if (containerId != null && !containerId.isEmpty()) { queryString = "?containerId=" + containerId; } makeHttpPutRequestAndCreateCustomResponse( build(loadBalancer.getUrl(), JOB_URI + "/" + REQUEUE_JOB_PUT_URI, valuesMap) + queryString, "", String.class, new HashMap<String, String>()); } else { CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new DescriptorCommand( "JobService", "requeueRequest", new Object[]{requestId}))); ServiceResponse<?> response = (ServiceResponse<?>) executeJmsCommand( script, DescriptorCommand.class.getName(), "BPM" ).getResponses().get(0); throwExceptionOnFailure(response); } } @Override public List<RequestInfoInstance> getRequestsByStatus(List<String> statuses, Integer page, Integer pageSize) { RequestInfoInstanceList list = null; if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); String statusQuery = getAdditionalParams("", "status", statuses); String queryString = getPagingQueryString(statusQuery, page, pageSize); list = makeHttpGetRequestAndCreateCustomResponse( build(loadBalancer.getUrl(), JOB_URI, valuesMap) + queryString, RequestInfoInstanceList.class); } else { CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new DescriptorCommand( "JobService", "getRequestsByStatus", new Object[]{safeList(statuses), page, pageSize}) ) ); ServiceResponse<RequestInfoInstanceList> response = (ServiceResponse<RequestInfoInstanceList>) executeJmsCommand( script, DescriptorCommand.class.getName(), "BPM" ).getResponses().get(0); throwExceptionOnFailure(response); if (shouldReturnWithNullResponse(response)) { return null; } list = response.getResult(); } if (list != null && list.getRequestInfoInstances() != null) { return Arrays.asList(list.getRequestInfoInstances()); } return Collections.emptyList(); } @Override public List<RequestInfoInstance> getRequestsByBusinessKey(String businessKey, Integer page, Integer pageSize) { RequestInfoInstanceList list = null; if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); valuesMap.put(JOB_KEY, businessKey); String queryString = getPagingQueryString("", page, pageSize); list = makeHttpGetRequestAndCreateCustomResponse( build(loadBalancer.getUrl(), JOB_URI + "/" + JOB_INSTANCES_BY_KEY_GET_URI, valuesMap) + queryString, RequestInfoInstanceList.class); } else { CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new DescriptorCommand( "JobService", "getRequestsByBusinessKey", new Object[]{businessKey, page, pageSize}) ) ); ServiceResponse<RequestInfoInstanceList> response = (ServiceResponse<RequestInfoInstanceList>) executeJmsCommand( script, DescriptorCommand.class.getName(), "BPM" ).getResponses().get(0); throwExceptionOnFailure(response); if (shouldReturnWithNullResponse(response)) { return null; } list = response.getResult(); } if (list != null && list.getRequestInfoInstances() != null) { return Arrays.asList(list.getRequestInfoInstances()); } return Collections.emptyList(); } @Override public List<RequestInfoInstance> getRequestsByBusinessKey(String businessKey, List<String> statuses, Integer page, Integer pageSize) { RequestInfoInstanceList list = null; if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); valuesMap.put(JOB_KEY, businessKey); String statusQuery = getAdditionalParams("", "status", statuses); String queryString = getPagingQueryString(statusQuery, page, pageSize); list = makeHttpGetRequestAndCreateCustomResponse( build(loadBalancer.getUrl(), JOB_URI + "/" + JOB_INSTANCES_BY_KEY_GET_URI, valuesMap) + queryString, RequestInfoInstanceList.class); } else { CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new DescriptorCommand( "JobService", "getRequestsByBusinessKey", new Object[]{businessKey, safeList(statuses), page, pageSize}) ) ); ServiceResponse<RequestInfoInstanceList> response = (ServiceResponse<RequestInfoInstanceList>) executeJmsCommand( script, DescriptorCommand.class.getName(), "BPM" ).getResponses().get(0); throwExceptionOnFailure(response); if (shouldReturnWithNullResponse(response)) { return null; } list = response.getResult(); } if (list != null && list.getRequestInfoInstances() != null) { return Arrays.asList(list.getRequestInfoInstances()); } return Collections.emptyList(); } @Override public List<RequestInfoInstance> getRequestsByCommand(String command, Integer page, Integer pageSize) { RequestInfoInstanceList list = null; if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); valuesMap.put(JOB_CMD_NAME, command); String queryString = getPagingQueryString("", page, pageSize); list = makeHttpGetRequestAndCreateCustomResponse( build(loadBalancer.getUrl(), JOB_URI + "/" + JOB_INSTANCES_BY_CMD_GET_URI, valuesMap) + queryString, RequestInfoInstanceList.class); } else { CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new DescriptorCommand( "JobService", "getRequestsByCommand", new Object[]{command, page, pageSize}) ) ); ServiceResponse<RequestInfoInstanceList> response = (ServiceResponse<RequestInfoInstanceList>) executeJmsCommand( script, DescriptorCommand.class.getName(), "BPM" ).getResponses().get(0); throwExceptionOnFailure(response); if (shouldReturnWithNullResponse(response)) { return null; } list = response.getResult(); } if (list != null && list.getRequestInfoInstances() != null) { return Arrays.asList(list.getRequestInfoInstances()); } return Collections.emptyList(); } @Override public List<RequestInfoInstance> getRequestsByCommand(String command, List<String> statuses, Integer page, Integer pageSize) { RequestInfoInstanceList list = null; if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); valuesMap.put(JOB_CMD_NAME, command); String statusQuery = getAdditionalParams("", "status", statuses); String queryString = getPagingQueryString(statusQuery, page, pageSize); list = makeHttpGetRequestAndCreateCustomResponse( build(loadBalancer.getUrl(), JOB_URI + "/" + JOB_INSTANCES_BY_CMD_GET_URI, valuesMap) + queryString, RequestInfoInstanceList.class); } else { CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new DescriptorCommand( "JobService", "getRequestsByCommand", new Object[]{command, safeList(statuses), page, pageSize}) ) ); ServiceResponse<RequestInfoInstanceList> response = (ServiceResponse<RequestInfoInstanceList>) executeJmsCommand( script, DescriptorCommand.class.getName(), "BPM" ).getResponses().get(0); throwExceptionOnFailure(response); if (shouldReturnWithNullResponse(response)) { return null; } list = response.getResult(); } if (list != null && list.getRequestInfoInstances() != null) { return Arrays.asList(list.getRequestInfoInstances()); } return Collections.emptyList(); } @Override public List<RequestInfoInstance> getRequestsByContainer(String containerId, List<String> statuses, Integer page, Integer pageSize) { RequestInfoInstanceList list = null; if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); valuesMap.put(CONTAINER_ID, containerId); String statusQuery = getAdditionalParams("", "status", statuses); String queryString = getPagingQueryString(statusQuery, page, pageSize); list = makeHttpGetRequestAndCreateCustomResponse( build(loadBalancer.getUrl(), JOB_URI + "/" + JOB_INSTANCES_BY_CONTAINER_GET_URI, valuesMap) + queryString, RequestInfoInstanceList.class); } else { CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new DescriptorCommand( "JobService", "getRequestsByContainer", new Object[]{containerId, safeList(statuses), page, pageSize}) ) ); ServiceResponse<RequestInfoInstanceList> response = (ServiceResponse<RequestInfoInstanceList>) executeJmsCommand( script, DescriptorCommand.class.getName(), "BPM" ).getResponses().get(0); throwExceptionOnFailure(response); if (shouldReturnWithNullResponse(response)) { return null; } list = response.getResult(); } if (list != null && list.getRequestInfoInstances() != null) { return Arrays.asList(list.getRequestInfoInstances()); } return Collections.emptyList(); } @Override public List<RequestInfoInstance> getRequestsByProcessInstance(Long processInstanceId, List<String> statuses, Integer page, Integer pageSize) { RequestInfoInstanceList list = null; if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); valuesMap.put(PROCESS_INST_ID, processInstanceId); String statusQuery = getAdditionalParams("", "status", statuses); String queryString = getPagingQueryString(statusQuery, page, pageSize); list = makeHttpGetRequestAndCreateCustomResponse( build(loadBalancer.getUrl(), JOB_URI + "/" + JOB_INSTANCES_BY_PROCESS_INSTANCE_GET_URI, valuesMap) + queryString, RequestInfoInstanceList.class); } else { CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new DescriptorCommand( "JobService", "getRequestsByProcessInstance", new Object[]{processInstanceId, safeList(statuses), page, pageSize}) ) ); ServiceResponse<RequestInfoInstanceList> response = (ServiceResponse<RequestInfoInstanceList>) executeJmsCommand( script, DescriptorCommand.class.getName(), "BPM" ).getResponses().get(0); throwExceptionOnFailure(response); if (shouldReturnWithNullResponse(response)) { return null; } list = response.getResult(); } if (list != null && list.getRequestInfoInstances() != null) { return Arrays.asList(list.getRequestInfoInstances()); } return Collections.emptyList(); } @Override public RequestInfoInstance getRequestById(Long requestId, boolean withErrors, boolean withData) { return getRequestById(null, requestId, withErrors, withData); } @Override public RequestInfoInstance getRequestById(String containerId, Long requestId, boolean withErrors, boolean withData) { if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); valuesMap.put(JOB_ID, requestId); String queryString = ""; if (containerId != null && !containerId.isEmpty()) { queryString = "&containerId=" + containerId; } return makeHttpGetRequestAndCreateCustomResponse( build(loadBalancer.getUrl(), JOB_URI + "/" + JOB_INSTANCE_GET_URI, valuesMap) + "?withErrors=" + withErrors + "&withData=" + withData + queryString, RequestInfoInstance.class); } else { CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new DescriptorCommand( "JobService", "getRequestById", marshaller.getFormat().getType(), new Object[]{requestId, withErrors, withData} )) ); ServiceResponse<String> response = (ServiceResponse<String>) executeJmsCommand( script, DescriptorCommand.class.getName(), "BPM" ).getResponses().get(0); throwExceptionOnFailure(response); if (shouldReturnWithNullResponse(response)) { return null; } return deserialize(response.getResult(), RequestInfoInstance.class); } } }
45.647887
199
0.650314
2caa893f7018f2108c856e00f52ed4ec76003072
3,105
/* * Copyright (c) 2013 Intellectual Reserve, Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package cf.nats; import cf.nats.message.RouterGreet; import nats.client.Registration; import nats.client.Subscription; import cf.nats.message.RouterRegister; import cf.nats.message.RouterStart; import cf.nats.message.RouterUnregister; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; /** * @author Mike Heath <elcapo@gmail.com> */ public class RouterRegisterHandler implements AutoCloseable { private final CfNats cfNats; private final RouterRegister routerRegister; private final Subscription subscription; private long updateInterval = TimeUnit.SECONDS.toMillis(30); private Registration routerRegisterPublication; public RouterRegisterHandler(CfNats nats, String host, int port, String... uris) { this(nats, host, port, Arrays.asList(uris), null); } public RouterRegisterHandler(CfNats cfNats, String host, Integer port, List<String> uris, Map<String,String> tags) { this(cfNats, new RouterRegister(host, port, null, null, uris, tags)); } public RouterRegisterHandler(final CfNats cfNats, final RouterRegister routerRegister) { this.cfNats = cfNats; this.routerRegister = routerRegister; cfNats.request(new RouterGreet(), 1, TimeUnit.MINUTES, new RequestResponseHandler<RouterStart>() { @Override public void onResponse(Publication<RouterStart, Void> response) { updateRouterRegisterInterval(response.getMessageBody()); } }); subscription = cfNats.subscribe(RouterStart.class, new PublicationHandler<RouterStart, Void>() { @Override public void onMessage(Publication<RouterStart, Void> publication) { updateRouterRegisterInterval(publication.getMessageBody()); cfNats.publish(routerRegister); } }); publish(); } private void publish() { routerRegisterPublication = cfNats.publish(routerRegister, updateInterval, TimeUnit.MILLISECONDS); } private void updateRouterRegisterInterval(RouterStart routerStart) { if (routerStart.getMinimumRegisterIntervalInSeconds() == null) { return; } final long newInterval = TimeUnit.SECONDS.toMillis(routerStart.getMinimumRegisterIntervalInSeconds()); if (newInterval < updateInterval) { if (routerRegisterPublication != null) { routerRegisterPublication.remove(); } updateInterval = newInterval; publish(); } } @Override public void close() { cfNats.publish(new RouterUnregister(routerRegister)); subscription.close(); } }
32.684211
117
0.753623
72d0023938af82f4245e9f466c021b9cfcc24efc
4,265
package uk.co.quidos.gdsap.evaluation.calculate.input; import java.util.Collection; import java.util.HashMap; import java.util.Map; public class CalFuelBillData { private Collection<CalFuelPrice> communityFuelPriceList; private Collection<CalFuelPrice> mainGasFuelPriceList; private Collection<CalFuelPrice> electricityFuelPriceList; private Collection<CalFuelPrice> allFuelPriceList; private Map<String,CalFuelPrice> communityFuelPriceMap; private Map<String,CalFuelPrice> mainGasFuelPriceMap; private Map<String,CalFuelPrice> electricityFuelPriceMap; private Map<String,CalFuelPrice> allFuelPriceMap; public Collection<CalFuelPrice> getCommunityFuelPriceList() { return communityFuelPriceList; } public void setCommunityFuelPriceList( Collection<CalFuelPrice> communityFuelPriceList) { this.communityFuelPriceList = communityFuelPriceList; if(communityFuelPriceList != null && communityFuelPriceList.size() == 1) { Map<String, CalFuelPrice> communityFuelPriceMap = new HashMap<String, CalFuelPrice>(); communityFuelPriceMap.put(CalFuelType.community_energy, communityFuelPriceList.iterator().next()); this.setCommunityFuelPriceMap(communityFuelPriceMap); } } public Collection<CalFuelPrice> getMainGasFuelPriceList() { return mainGasFuelPriceList; } public void setMainGasFuelPriceList( Collection<CalFuelPrice> mainGasFuelPriceList) { this.mainGasFuelPriceList = mainGasFuelPriceList; if(mainGasFuelPriceList != null && mainGasFuelPriceList.size() == 1) { Map<String, CalFuelPrice> mainGasFuelPriceMap = new HashMap<String, CalFuelPrice>(); mainGasFuelPriceMap.put(CalFuelType.mains_gas, mainGasFuelPriceList.iterator().next()); this.setCommunityFuelPriceMap(mainGasFuelPriceMap); } } public Collection<CalFuelPrice> getElectricityFuelPriceList() { return electricityFuelPriceList; } public void setElectricityFuelPriceList( Collection<CalFuelPrice> electricityFuelPriceList) { this.electricityFuelPriceList = electricityFuelPriceList; if(electricityFuelPriceList != null && electricityFuelPriceList.size() == 1) { Map<String, CalFuelPrice> electricityFuelPriceMap = new HashMap<String, CalFuelPrice>(); electricityFuelPriceMap.put(CalFuelType.mains_gas, electricityFuelPriceList.iterator().next()); this.setCommunityFuelPriceMap(electricityFuelPriceMap); } } public Collection<CalFuelPrice> getAllFuelPriceList() { return allFuelPriceList; } public void setAllFuelPriceList(Collection<CalFuelPrice> allFuelPriceList) { this.allFuelPriceList = allFuelPriceList; if(allFuelPriceList != null && allFuelPriceList.size() > 0) { Map<String, CalFuelPrice> allFuelPriceMapMap = new HashMap<String, CalFuelPrice>(); for(CalFuelPrice cfp : allFuelPriceList) { if(include(cfp.getCalFuelType().getName(), CalFuelType.allFuelType)) { allFuelPriceMapMap.put(cfp.getCalFuelType().getName(), cfp); } } this.setAllFuelPriceMap(allFuelPriceMapMap); } } public Map<String, CalFuelPrice> getCommunityFuelPriceMap() { return communityFuelPriceMap; } public void setCommunityFuelPriceMap( Map<String, CalFuelPrice> communityFuelPriceMap) { this.communityFuelPriceMap = communityFuelPriceMap; } public Map<String, CalFuelPrice> getMainGasFuelPriceMap() { return mainGasFuelPriceMap; } public void setMainGasFuelPriceMap(Map<String, CalFuelPrice> mainGasFuelPriceMap) { this.mainGasFuelPriceMap = mainGasFuelPriceMap; } public Map<String, CalFuelPrice> getElectricityFuelPriceMap() { return electricityFuelPriceMap; } public void setElectricityFuelPriceMap( Map<String, CalFuelPrice> electricityFuelPriceMap) { this.electricityFuelPriceMap = electricityFuelPriceMap; } public Map<String, CalFuelPrice> getAllFuelPriceMap() { return allFuelPriceMap; } public void setAllFuelPriceMap(Map<String, CalFuelPrice> allFuelPriceMap) { this.allFuelPriceMap = allFuelPriceMap; } private boolean include(String val, String ...vals) { boolean include = false; for(String s : vals) { if(s.equalsIgnoreCase(val)) { include = true; return include; } } return include; } }
36.144068
102
0.765299
6775e4faee68fec8eb02fba99ed8358fe7eba635
5,152
package br.com.addr.repository; import br.com.addr.adapters.AddressRepository; import br.com.addr.exceptions.AddressException; import br.com.addr.model.Address; import br.com.addr.model.UpdateAddress; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataAccessException; import org.springframework.dao.DataRetrievalFailureException; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Component; import javax.sql.DataSource; import java.util.Optional; import java.util.UUID; @Component public class JDBCAddressRepository implements AddressRepository { private final DataSource dataSource; @Autowired public JDBCAddressRepository(DataSource dataSource) { this.dataSource = dataSource; } @Override public Optional<Address> findByCep(String cep) { JdbcTemplate template = new JdbcTemplate(dataSource); try { Address address = template.queryForObject( "SELECT STREET street, NEIGHBORHOOD neighborhood, CITY city, UF uf FROM PUBLIC.ADDRESS WHERE CEP = ? LIMIT 1", new Object[]{cep}, (rs, n) -> { String street = rs.getString("street"); String neighborhood = rs.getString("neighborhood"); String city = rs.getString("city"); String uf = rs.getString("uf"); return new Address(street, neighborhood, city, uf); } ); return Optional.of(address); } catch (DataRetrievalFailureException e) { return Optional.empty(); } } @Override public Optional<Address> findByID(String id) { JdbcTemplate template = new JdbcTemplate(dataSource); try { Address address = template.queryForObject( "SELECT STREET street," + " NUMBER number, " + "CEP cep, " + "NEIGHBORHOOD neighborhood," + " CITY city," + " UF uf," + " COMPLEMENT complement " + "FROM PUBLIC.ADDRESS WHERE ID = ?", new Object[]{id}, (rs, n) -> { String street = rs.getString("street"); Integer number = rs.getInt("number"); String cep = rs.getString("cep"); String neighborhood = rs.getString("neighborhood"); String city = rs.getString("city"); String uf = rs.getString("uf"); String complement = rs.getString("complement"); return new Address(street, number, cep, neighborhood, city, uf, complement); } ); return Optional.of(address); } catch (DataRetrievalFailureException e) { return Optional.empty(); } } @Override public String createNewAddress(Address newAddress) { JdbcTemplate template = new JdbcTemplate(dataSource); try { UUID newUUID = UUID.randomUUID(); template.update("INSERT INTO ADDRESS(ID, STREET, NUMBER, CEP, CITY, UF, NEIGHBORHOOD, COMPLEMENT) " + "VALUES (?, ?, ?, ?, ?, ?, ?, ?)", newUUID.toString(), newAddress.getStreet(), newAddress.getNumber(), newAddress.getCep(), newAddress.getCity(), newAddress.getUf(), newAddress.getNeighborhood(), newAddress.getComplement()); return newUUID.toString(); } catch (DataAccessException e) { throw new AddressException("Could not insert Address", e); } } @Override public void updateAddress(UpdateAddress updateAddress) { JdbcTemplate template = new JdbcTemplate(dataSource); Address addr = updateAddress.getAddress(); try { template.update("UPDATE ADDRESS SET STREET = ?, NUMBER= ?, CEP =?, CITY=?, UF=?, NEIGHBORHOOD=?, COMPLEMENT=?" + "WHERE ID=?", addr.getStreet(), addr.getNumber(), addr.getCep(), addr.getCity(), addr.getUf(), addr.getNeighborhood(), addr.getComplement(), updateAddress.getAddressID()); } catch (DataAccessException e) { throw new AddressException("Could not update Address", e); } } @Override public void deleteAddress(String id) { JdbcTemplate template = new JdbcTemplate(dataSource); try { template.update("DELETE FROM ADDRESS WHERE ID=?", id); } catch (DataAccessException e) { throw new AddressException("Could not delete Address", e); } } }
39.630769
130
0.537849
1428554284d65fb348836a13283fb05f28a05377
9,243
/* * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.web.servlet.config.annotation; import java.util.List; import org.springframework.core.convert.converter.Converter; import org.springframework.format.Formatter; import org.springframework.format.FormatterRegistry; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.lang.Nullable; import org.springframework.validation.MessageCodesResolver; import org.springframework.validation.Validator; import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.method.support.HandlerMethodReturnValueHandler; import org.springframework.web.servlet.DispatcherServlet; import org.springframework.web.servlet.HandlerExceptionResolver; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter; /** * Defines callback methods to customize the Java-based configuration for * Spring MVC enabled via {@code @EnableWebMvc}. * * <p>{@code @EnableWebMvc}-annotated configuration classes may implement * this interface to be called back and given a chance to customize the * default configuration. * * @author Rossen Stoyanchev * @author Keith Donald * @author David Syer * @since 3.1 */ public interface WebMvcConfigurer { /** * Helps with configuring HandlerMappings path matching options such as trailing slash match, * suffix registration, path matcher and path helper. * Configured path matcher and path helper instances are shared for: * <ul> * <li>RequestMappings</li> * <li>ViewControllerMappings</li> * <li>ResourcesMappings</li> * </ul> * @since 4.0.3 */ default void configurePathMatch(PathMatchConfigurer configurer) { } /** * Configure content negotiation options. */ default void configureContentNegotiation(ContentNegotiationConfigurer configurer) { } /** * Configure asynchronous request handling options. */ default void configureAsyncSupport(AsyncSupportConfigurer configurer) { } /** * Configure a handler to delegate unhandled requests by forwarding to the * Servlet container's "default" servlet. A common use case for this is when * the {@link DispatcherServlet} is mapped to "/" thus overriding the * Servlet container's default handling of static resources. */ default void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { } /** * Add {@link Converter Converters} and {@link Formatter Formatters} in addition to the ones * registered by default. */ default void addFormatters(FormatterRegistry registry) { } /** * Add Spring MVC lifecycle interceptors for pre- and post-processing of * controller method invocations. Interceptors can be registered to apply * to all requests or be limited to a subset of URL patterns. * <p><strong>Note</strong> that interceptors registered here only apply to * controllers and not to resource handler requests. To intercept requests for * static resources either declare a * {@link org.springframework.web.servlet.handler.MappedInterceptor MappedInterceptor} * bean or switch to advanced configuration mode by extending * {@link org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport * WebMvcConfigurationSupport} and then override {@code resourceHandlerMapping}. */ default void addInterceptors(InterceptorRegistry registry) { } /** * Add handlers to serve static resources such as images, js, and, css * files from specific locations under web application root, the classpath, * and others. */ default void addResourceHandlers(ResourceHandlerRegistry registry) { } /** * Configure cross origin requests processing. * @since 4.2 */ default void addCorsMappings(CorsRegistry registry) { } /** * Configure simple automated controllers pre-configured with the response * status code and/or a view to render the response body. This is useful in * cases where there is no need for custom controller logic -- e.g. render a * home page, perform simple site URL redirects, return a 404 status with * HTML content, a 204 with no content, and more. */ default void addViewControllers(ViewControllerRegistry registry) { } /** * Configure view resolvers to translate String-based view names returned from * controllers into concrete {@link org.springframework.web.servlet.View} * implementations to perform rendering with. * @since 4.1 */ default void configureViewResolvers(ViewResolverRegistry registry) { } /** * Add resolvers to support custom controller method argument types. * <p>This does not override the built-in support for resolving handler * method arguments. To customize the built-in support for argument * resolution, configure {@link RequestMappingHandlerAdapter} directly. * @param resolvers initially an empty list */ default void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) { } /** * Add handlers to support custom controller method return value types. * <p>Using this option does not override the built-in support for handling * return values. To customize the built-in support for handling return * values, configure RequestMappingHandlerAdapter directly. * @param handlers initially an empty list */ default void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> handlers) { } /** * Configure the {@link HttpMessageConverter HttpMessageConverters} to use for reading or writing * to the body of the request or response. If no converters are added, a * default list of converters is registered. * <p><strong>Note</strong> that adding converters to the list, turns off * default converter registration. To simply add a converter without impacting * default registration, consider using the method * {@link #extendMessageConverters(java.util.List)} instead. * @param converters initially an empty list of converters */ default void configureMessageConverters(List<HttpMessageConverter<?>> converters) { } /** * A hook for extending or modifying the list of converters after it has been * configured. This may be useful for example to allow default converters to * be registered and then insert a custom converter through this method. * @param converters the list of configured converters to extend. * @since 4.1.3 */ default void extendMessageConverters(List<HttpMessageConverter<?>> converters) { } /** * Configure exception resolvers. * <p>The given list starts out empty. If it is left empty, the framework * configures a default set of resolvers, see * {@link WebMvcConfigurationSupport#addDefaultHandlerExceptionResolvers(List)}. * Or if any exception resolvers are added to the list, then the application * effectively takes over and must provide, fully initialized, exception * resolvers. * <p>Alternatively you can use * {@link #extendHandlerExceptionResolvers(List)} which allows you to extend * or modify the list of exception resolvers configured by default. * @param resolvers initially an empty list * @see #extendHandlerExceptionResolvers(List) * @see WebMvcConfigurationSupport#addDefaultHandlerExceptionResolvers(List) */ default void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> resolvers) { } /** * Extending or modify the list of exception resolvers configured by default. * This can be useful for inserting a custom exception resolver without * interfering with default ones. * @param resolvers the list of configured resolvers to extend * @since 4.3 * @see WebMvcConfigurationSupport#addDefaultHandlerExceptionResolvers(List) */ default void extendHandlerExceptionResolvers(List<HandlerExceptionResolver> resolvers) { } /** * Provide a custom {@link Validator} instead of the one created by default. * The default implementation, assuming JSR-303 is on the classpath, is: * {@link org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean}. * Leave the return value as {@code null} to keep the default. */ @Nullable default Validator getValidator() { return null; } /** * Provide a custom {@link MessageCodesResolver} for building message codes * from data binding and validation error codes. Leave the return value as * {@code null} to keep the default. */ @Nullable default MessageCodesResolver getMessageCodesResolver() { return null; } }
39.5
99
0.749216
ed15c2cf7ca9682c8f719407b9433c561184e8d9
833
/* * Copyright (c) 2019, Salesforce.com, Inc. * All rights reserved. * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ package com.salesforce.reactivegrpc.common; import org.reactivestreams.Subscription; /** * This is interfaces which allows to access to fussed mode. * This class is used in {@link AbstractSubscriberAndProducer} in order to do * {@link Subscription} setup in one atomic action by providing a specific * {@link Subscription} decorator * * @see {@link com.salesforce.rxgrpc.stub.FusionAwareQueueSubscriptionAdapter} * @see {@link com.salesforce.reactorgrpc.stub.FusionAwareQueueSubscriptionAdapter} */ public interface FusionModeAwareSubscription extends Subscription { int mode(); }
33.32
113
0.761104
b164ef73d0fc6ac217d00f9506a3a19240fbdd71
902
package it.algos.vaad23.ui.dialog; import com.vaadin.flow.component.notification.*; import it.algos.vaad23.backend.enumeration.*; /** * Project vaadin23 * Created by Algos * User: gac * Date: mer, 30-mar-2022 * Time: 08:24 */ public class Avviso { public static Notification show(String text) { int durata = Pref.durataAvviso.getInt(); return Notification.show(text, durata > 0 ? durata : 2000, Notification.Position.BOTTOM_START); } public static Notification show1000(String text) { return Notification.show(text, 1000, Notification.Position.BOTTOM_START); } public static Notification show2000(String text) { return Notification.show(text, 2000, Notification.Position.BOTTOM_START); } public static Notification show3000(String text) { return Notification.show(text, 3000, Notification.Position.BOTTOM_START); } }
27.333333
103
0.707317
c0fa30a7d2e9a180079e1429853eb16cc707922a
446
/* * Copyright © 2010 www.myctu.cn. All rights reserved. */ package com.sirius.upns.server.node.queue; import com.sirius.upns.server.node.domain.model.Message; /** * User: pippo * Date: 13-11-28-13:49 */ public class APNSBroadcastTask extends TimelineUpdateTask { private static final long serialVersionUID = 858391282978425312L; public APNSBroadcastTask() { } public APNSBroadcastTask(Message message) { super(message); } }
17.153846
66
0.733184
042a29310182513fa28c434843d51f5c73b209a6
465
package ashley.tests; import ashley.signals.Listener; import ashley.signals.Signal; public class SignalTest { public static void main(String[] args){ Signal<String> signal = new Signal<String>(); Listener<String> listener = new Listener<String>() { @Override public void receive(Signal<String> signal, String object) { System.out.println("Received event: " + object); } }; signal.add(listener); signal.dispatch("Hello World!"); } }
22.142857
62
0.696774
041a97c224320fe64bf223552b02e1dc4a592801
589
package android.support.v4.view; import android.graphics.Paint; import android.view.View; import android.view.ViewParent; interface bc { int a(View view); void a(View view, int i, int i2, int i3, int i4); void a(View view, int i, Paint paint); void a(View view, Paint paint); void a(View view, a aVar); void a(View view, Runnable runnable); boolean a(View view, int i); void b(View view); void b(View view, int i); int c(View view); int d(View view); int e(View view); ViewParent f(View view); boolean g(View view); }
16.361111
53
0.634975
9469262471b1e833c718f40ca8fe61dbdf23084d
512
package assignment2.model; import java.util.HashSet; import java.util.Set; /** * A collection of events that can be used as the root of the JSON data. * * @author alessandro.adamou * */ public class EventContainer { /** * Event sorting is taken care of by the Timeline, so I'm better off with a * faster HashSet here. */ private Set<Event> events = new HashSet<>(); public Set<Event> getEvents() { return events; } public void setEvents(Set<Event> events) { this.events = events; } }
17.655172
76
0.683594
7478d8aedcccea50540ca38c4fd85c28d2fcea24
5,542
package com.softicar.platform.db.core.transaction; import com.softicar.platform.common.container.map.instance.ClassInstanceMap; import com.softicar.platform.common.core.exceptions.SofticarDeveloperException; import com.softicar.platform.common.date.DayTime; import com.softicar.platform.db.core.connection.IDbConnection; import com.softicar.platform.db.core.statement.DbStatement; import java.util.List; import java.util.Optional; import java.util.function.Consumer; import java.util.function.Supplier; import java.util.stream.Collectors; /** * Base implementation of {@link IDbTransaction}. * * @author Oliver Richers */ public abstract class AbstractDbTransaction implements IDbTransaction { private static final DbStatement BEGIN = new DbStatement("BEGIN"); private static final DbStatement COMMIT = new DbStatement("COMMIT"); private static final DbStatement ROLLBACK = new DbStatement("ROLLBACK"); protected final IDbConnection connection; protected final IDbTransactionHierarchy hierarchy; protected final Optional<IDbTransaction> parentTransaction; protected final DayTime begin; protected final int id; private boolean started; private boolean starting; private boolean closed; private ClassInstanceMap<Object> dataMap; protected AbstractDbTransaction(IDbConnection connection) { this.connection = connection; this.hierarchy = connection.getTransactionHierarchy(); this.parentTransaction = hierarchy.getCurrentTransaction(); this.id = hierarchy.registerTransaction(this); this.begin = parentTransaction.map(it -> it.getBegin()).orElse(DayTime.now()); this.started = false; this.starting = false; this.closed = false; this.dataMap = null; } // -------------------- simple getters -------------------- // @Override public int getId() { return id; } @Override public boolean isCurrentTransaction() { return hierarchy// .getCurrentTransaction() .map(transaction -> transaction == this) .orElse(false); } @Override public Optional<IDbTransaction> getParentTransaction() { return parentTransaction; } @Override public DayTime getBegin() { return begin; } // -------------------- start, commit and rollback -------------------- // @Override public void start() { if (!started && !starting) { try { this.starting = true; startTransaction(); this.started = true; } finally { this.starting = false; } } } /** * Commits the changes of this transaction. * <p> * If this transaction is nested within another transaction this will do * nothing. The changes will only be applied when the root transaction is * committed. */ @Override public void commit() { if (closed) { throw new SofticarDeveloperException("Tried to commit closed transaction #%s.", id); } else if (!isCurrentTransaction()) { throw new SofticarDeveloperException("A nested transaction was not closed before transaction #%s.", id); } notifyDataObjects(data -> data.beforeCommit(this)); if (started) { commitTransaction(); } notifyDataObjects(data -> data.afterCommit(this)); hierarchy.unregisterTransaction(this); closed = true; } /** * Cancels the changes of this transaction. */ @Override public void rollback() { if (closed) { throw new SofticarDeveloperException("Tried to rollback closed transaction #%s.", id); } hierarchy// .getChildTransaction(this) .ifPresent(IDbTransaction::rollback); notifyDataObjects(data -> data.beforeRollback(this)); if (started) { rollbackTransaction(); } notifyDataObjects(data -> data.afterRollback(this)); hierarchy.unregisterTransaction(this); closed = true; } @Override public void close() { if (!closed) { rollback(); } } public boolean isClosed() { return closed; } // -------------------- data -------------------- // @Override public <T> void putData(T data) { if (dataMap == null) { dataMap = new ClassInstanceMap<>(); } dataMap.putInstance(data); } @Override public <T> Optional<T> getData(Class<T> dataClass) { return dataMap != null? dataMap.getOptional(dataClass) : Optional.empty(); } @Override public <T> T getOrPutData(Class<T> dataClass, Supplier<T> dataFactory) { if (dataMap == null) { dataMap = new ClassInstanceMap<>(); } return dataMap.getOrPutInstance(dataClass, dataFactory); } private void notifyDataObjects(Consumer<IDbTransactionListener> callback) { if (dataMap != null) { // Please note that we need to extract all table listeners // into a separate list, because we could otherwise get a // concurrent modification exception on the data map if one // of the table listeners modifies the data map. List<IDbTransactionListener> listeners = dataMap// .getAll() .stream() .filter(IDbTransactionListener.class::isInstance) .map(IDbTransactionListener.class::cast) .collect(Collectors.toList()); // notify table listeners listeners.forEach(callback); } } // -------------------- protected -------------------- // protected void startTransaction() { if (isRootTransaction()) { connection.execute(BEGIN); } else { connection.executeUncached(new DbStatement("SAVEPOINT sp" + id)); } } protected void commitTransaction() { if (isRootTransaction()) { connection.execute(COMMIT); } } protected void rollbackTransaction() { if (isRootTransaction()) { connection.execute(ROLLBACK); } else { connection.executeUncached(new DbStatement("ROLLBACK TO SAVEPOINT sp" + id)); } } }
24.414097
107
0.699026
b213bed42fbb94c367eedd7f414c3575b35715b9
1,123
/* * Copyright 2021 Justin Kreikemeyer * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.justinnk.masonssa.evaluation.benchmarks; import org.openjdk.jmh.annotations.*; import sim.engine.SimState; @State(Scope.Thread) public abstract class BenchmarkSirsGrid { @Param({ "8", "256", "16", "1000", "24", "300", "768", "32", "48", "4", "64", "512", "96", "128", "160", "384" }) public int gridSize; public int currentIteration = 0; public SimState model; @TearDown(Level.Iteration) public void TearDown() { // System.out.println("finish model"); model.finish(); } }
28.794872
99
0.695459
d638a5dfe13ef2d759ee7b7894aa703c987d8463
7,088
package com.compositesw.services.system.admin.resource; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for portOperationProperty complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="portOperationProperty"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="operationName" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="operationStyle" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="operationSoapAction" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="operationMessageType" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="operationAckMode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="operationTimeout" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/> * &lt;element name="operationPriority" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> * &lt;element name="operationExpiry" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/> * &lt;element name="operationDelieveryMode" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "portOperationProperty", propOrder = { "operationName", "operationStyle", "operationSoapAction", "operationMessageType", "operationAckMode", "operationTimeout", "operationPriority", "operationExpiry", "operationDelieveryMode" }) public class PortOperationProperty { @XmlElement(required = true) protected String operationName; protected String operationStyle; protected String operationSoapAction; protected String operationMessageType; protected String operationAckMode; protected Long operationTimeout; protected Integer operationPriority; protected Long operationExpiry; protected Integer operationDelieveryMode; /** * Gets the value of the operationName property. * * @return * possible object is * {@link String } * */ public String getOperationName() { return operationName; } /** * Sets the value of the operationName property. * * @param value * allowed object is * {@link String } * */ public void setOperationName(String value) { this.operationName = value; } /** * Gets the value of the operationStyle property. * * @return * possible object is * {@link String } * */ public String getOperationStyle() { return operationStyle; } /** * Sets the value of the operationStyle property. * * @param value * allowed object is * {@link String } * */ public void setOperationStyle(String value) { this.operationStyle = value; } /** * Gets the value of the operationSoapAction property. * * @return * possible object is * {@link String } * */ public String getOperationSoapAction() { return operationSoapAction; } /** * Sets the value of the operationSoapAction property. * * @param value * allowed object is * {@link String } * */ public void setOperationSoapAction(String value) { this.operationSoapAction = value; } /** * Gets the value of the operationMessageType property. * * @return * possible object is * {@link String } * */ public String getOperationMessageType() { return operationMessageType; } /** * Sets the value of the operationMessageType property. * * @param value * allowed object is * {@link String } * */ public void setOperationMessageType(String value) { this.operationMessageType = value; } /** * Gets the value of the operationAckMode property. * * @return * possible object is * {@link String } * */ public String getOperationAckMode() { return operationAckMode; } /** * Sets the value of the operationAckMode property. * * @param value * allowed object is * {@link String } * */ public void setOperationAckMode(String value) { this.operationAckMode = value; } /** * Gets the value of the operationTimeout property. * * @return * possible object is * {@link Long } * */ public Long getOperationTimeout() { return operationTimeout; } /** * Sets the value of the operationTimeout property. * * @param value * allowed object is * {@link Long } * */ public void setOperationTimeout(Long value) { this.operationTimeout = value; } /** * Gets the value of the operationPriority property. * * @return * possible object is * {@link Integer } * */ public Integer getOperationPriority() { return operationPriority; } /** * Sets the value of the operationPriority property. * * @param value * allowed object is * {@link Integer } * */ public void setOperationPriority(Integer value) { this.operationPriority = value; } /** * Gets the value of the operationExpiry property. * * @return * possible object is * {@link Long } * */ public Long getOperationExpiry() { return operationExpiry; } /** * Sets the value of the operationExpiry property. * * @param value * allowed object is * {@link Long } * */ public void setOperationExpiry(Long value) { this.operationExpiry = value; } /** * Gets the value of the operationDelieveryMode property. * * @return * possible object is * {@link Integer } * */ public Integer getOperationDelieveryMode() { return operationDelieveryMode; } /** * Sets the value of the operationDelieveryMode property. * * @param value * allowed object is * {@link Integer } * */ public void setOperationDelieveryMode(Integer value) { this.operationDelieveryMode = value; } }
25.405018
114
0.587049
08cac58ff897157f278e7ab04f1c0c8c0fc4eeb5
2,703
/* * Part of the HexLands mod. * Licensed under MIT. See the project LICENSE.txt for details. */ package com.alcatrazescapee.hexlands; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import net.minecraft.core.Registry; import net.minecraft.data.worldgen.Features; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.Biomes; import net.minecraft.world.level.levelgen.GenerationStep; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.world.BiomeLoadingEvent; import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import com.alcatrazescapee.hexlands.util.HexLandsConfig; import com.alcatrazescapee.hexlands.world.HexBiomeSource; import com.alcatrazescapee.hexlands.world.HexChunkGenerator; import com.alcatrazescapee.hexlands.world.HexEndBiomeSource; import com.alcatrazescapee.hexlands.world.HexLandsWorldType; @Mod(HexLands.MOD_ID) public class HexLands { public static final String MOD_ID = "hexlands"; private static final Logger LOGGER = LogManager.getLogger(); public HexLands() { LOGGER.info("Wait, this isn't Catan..."); final IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus(); final IEventBus forgeBus = MinecraftForge.EVENT_BUS; HexLandsWorldType.WORLD_TYPES.register(modBus); modBus.addListener(this::setup); forgeBus.addListener(EventPriority.HIGH, this::onBiomeLoad); HexLandsConfig.init(); } private void setup(FMLCommonSetupEvent event) { event.enqueueWork(() -> { HexLandsWorldType.setDefault(); Registry.register(Registry.CHUNK_GENERATOR, new ResourceLocation(MOD_ID, "hexlands"), HexChunkGenerator.CODEC); Registry.register(Registry.BIOME_SOURCE, new ResourceLocation(MOD_ID, "hexlands"), HexBiomeSource.CODEC); Registry.register(Registry.BIOME_SOURCE, new ResourceLocation(MOD_ID, "end_hexlands"), HexEndBiomeSource.CODEC); }); } private void onBiomeLoad(BiomeLoadingEvent event) { if (HexLandsConfig.COMMON.addEndSpikesToEndBiomes.get() && event.getName() != null && event.getCategory() == Biome.BiomeCategory.THEEND && !Biomes.THE_END.location().equals(event.getName())) { event.getGeneration().addFeature(GenerationStep.Decoration.SURFACE_STRUCTURES, Features.END_SPIKE); } } }
39.173913
198
0.758417
dbd7c7d3fe24885dff8247239af05df8a1f572dc
718
package com.vu2rmk.fleetapp.services; import com.vu2rmk.fleetapp.models.State; import com.vu2rmk.fleetapp.repositories.StateRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class StateService { @Autowired private StateRepository stateRepository; public List<State> getStates(){ return stateRepository.findAll(); } public void save(State state){ stateRepository.save(state); } public State findById(Integer id){ return stateRepository.findById(id).get(); } public void delete(Integer id) { stateRepository.deleteById(id); } }
21.757576
62
0.724234
54e69233a8cd393ddf677c55cb8ca843adbc41b3
566
package i5.las2peer.services.codeGenerationService.traces.segments; /** * A special {@link i5.las2peer.services.codeGenerationService.traces.segments.CompositeSegment} * used for variable names holding multiple templates * * @author Thomas Winkler * */ public class AppendableVariableSegment extends CompositeSegment { public static final String TYPE = "appendableVariable"; public AppendableVariableSegment(String segmentId) { super(segmentId); } @Override public String getTypeString() { return AppendableVariableSegment.TYPE; } }
22.64
96
0.770318
3df9292e14d4029f97151d9e3618fc176cd6804b
1,234
package app.xml; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import java.util.List; import java.util.ArrayList; /** * Implementation of the SAX DefaultHandler * interface which is used to parse * the config.xml file for configuration * node instances. For each instance, * the handler will add the element's * id attribute to its configuration id * array. * * @author Brady Houseknecht */ public class XmlConfigurationHandler extends XmlConfigParseHandlerBaseClass { private List<String> m_arr_ids = null; /** * Ids array accessor. * * @return string value array */ public List<String> getIds() { return m_arr_ids; } /** {@inheritDoc} */ @Override public void startDocument() throws SAXException { this.m_arr_ids = new ArrayList<String>(); } /** {@inheritDoc} */ @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (qName.equalsIgnoreCase("configuration")) { String _id = attributes.getValue("id"); if (!this.m_arr_ids.contains(_id)) { this.m_arr_ids.add(_id); } } } }
24.68
117
0.65154