id stringlengths 36 36 | text stringlengths 1 1.25M |
|---|---|
43ccbff8-2092-4988-8a48-41a0b318f154 | @GET
@Path("/{id}")
public Response getContact(@PathParam("id") int id, @Auth Boolean isAuthenticated) {
// retrieve information about the contact with the provided id
Contact contact = contactDao.getContactById(id);
return Response
.ok(contact)
.build();
... |
e488b5f5-d80e-4da8-9e64-be2fa755641d | @POST
public Response createContact(Contact contact, @Auth Boolean isAuthenticated) throws URISyntaxException {
// Validate the contact's data
Set<ConstraintViolation<Contact>> violations = validator.validate(contact);
// Are there any constraint violations?
if (violations.size() > 0... |
239b3939-38eb-4f44-8742-0570b45673ac | @DELETE
@Path("/{id}")
public Response deleteContact(@PathParam("id") int id, @Auth Boolean isAuthenticated) {
// delete the contact with the provided id
contactDao.deleteContact(id);
return Response.noContent().build();
} |
b2c8809d-69ff-49ec-aee8-129537f85d71 | @PUT
@Path("/{id}")
public Response updateContact(@PathParam("id") int id, Contact contact, @Auth Boolean isAuthenticated) {
// Validate the updated data
Set<ConstraintViolation<Contact>> violations = validator.validate(contact);
// Are there any constraint violations?
if (violat... |
2ee01c7b-9109-47ee-9c35-68a1366d35f9 | public ContactView(Contact contact) {
super("/views/contact.mustache");
this.contact = contact;
} |
82badecc-a6ea-458f-bb6e-37f08aa1fe1c | public Contact getContact() {
return contact;
} |
32049a01-dd0f-4d89-a2bd-52790b4ae712 | public Rabbit()
{
} |
caa6a76d-e907-4e89-a164-e5d1d560bb9e | public Randomize(int x, int y)
{
} |
9a624ea4-1887-4271-bb44-91a80cacaf68 | public SnakeGame()
{
this.rabbitCount = 0;
gameField = new GameField();
gameField.setVisible(true);
gameField.setBackground(Color.WHITE);
gameField.setLayout(null);
this.add(gameField);
this.setAutoRequestFocus(true);
this.addKeyListener(this);
... |
cf08799d-e358-4085-bf79-1283f26a54b9 | @Override
public void actionPerformed(ActionEvent e) {
} |
46d33c2d-c927-473f-93df-9a4271825fae | @Override
public void keyTyped(KeyEvent e) {
} |
9163f437-b555-437d-9822-29815a04d5f8 | @Override
public void keyPressed(KeyEvent e)
{
if(e.getKeyCode() == KeyEvent.VK_UP)
{
Snake snake = gameField.getSnake();
Rabbit rabbit = gameField.getRabbit();
int snakeX = snake.getX();
int snakeY = snake.getY();
snake.setLocation(s... |
4597ebd7-34c7-4338-afe0-205f88302e4b | @Override
public void keyReleased(KeyEvent e) {
} |
47e18dbd-45e4-4936-84e4-d8c1e479ead6 | public void recreateRabbit(Rabbit rabbit)
{
gameField.remove(rabbit);
gameField.createRabbit();
gameField.repaint();
this.rabbitCount++;
this.setTitle("Rabbits: " + Integer.toString(this.rabbitCount));
} |
b8c02f1d-e1c4-4f7d-9a48-beeeebbb6ec9 | public GameField()
{
this.createSnake();
this.createRabbit();
} |
3ef80d95-6d12-44d6-a8b5-0f14f4823255 | public void createSnake()
{
snake = new Snake();
int x_AppearSnake = RandomX();
int y_AppearSnake = RandomY();
snake.setText("S");
snake.setSize(45,45 );
snake.setVisible(true);
snake.setLocation(x_AppearSnake,y_AppearSnake);
snake.setEnabled(false);... |
aa068647-c2ac-439d-9175-4c7c347675f7 | public void createRabbit()
{
rabbit = new Rabbit();
int x_AppearRabbit = RandomX();
int y_AppearRabbit = RandomY();
rabbit.setSize(45,45);
rabbit.setLocation(x_AppearRabbit, y_AppearRabbit);
rabbit.setText("R");
rabbit.setEnabled(false);
this.add(r... |
73fd3d75-e233-48ca-98da-d2d2f6c8f7da | public int RandomX()
{
Random random = new Random();
return random.nextInt(1000-51);
} |
7aa5f7cb-6fd6-4bcd-aab0-6fd616c27e6e | public int RandomY()
{
Random random = new Random();
return random.nextInt(700-74);
} |
470cae08-4bb2-48d3-939f-c7a83bb825be | public Rabbit getRabbit()
{
return rabbit;
} |
afc498b3-3f36-4650-9ebe-4097baa1f038 | public Snake getSnake()
{
return snake;
} |
e0a01a0f-fac3-4d92-85ee-fb477c2f84cf | public boolean isCrashed(Snake snake,Rabbit rabbit)
{
int sp1x,sp1y,sp2x,sp2y,sp3x,sp3y,sp4x,sp4y;
int rp1x,rp1y,rp2x,rp2y,rp3x,rp3y,rp4x,rp4y;
sp1x = snake.getX();
sp2x = snake.getX()+45;
sp3x = snake.getX();
sp4x = snake.getX()+45;
sp1y = snake.getY();
... |
7f82abac-8811-4932-8f69-a4f6e920cfba | public boolean isBorder(Snake snake, KeyEvent keyEvent)
{
int sp2x = snake.getX()+60;
int sp4y = snake.getY()+45;
int sp1x = snake.getX();
if(sp2x >= 985 && keyEvent.getKeyCode() == KeyEvent.VK_RIGHT)
return true;
if(sp4y > 665 && keyEvent.getKeyCode() == KeyE... |
57578add-2cda-41a1-9e96-19f03e1f3f8c | public static void main(String[] args)
{
SnakeGame snakeGame = new SnakeGame();
snakeGame.setVisible(true);
snakeGame.setSize(1000,700);
snakeGame.setTitle("Rabbits: 0");
snakeGame.setDefaultCloseOperation(snakeGame.EXIT_ON_CLOSE);
} |
710cb765-4d89-4883-a2ac-5a89a3e9cd83 | public Snake()
{
} |
1609f32e-fb1f-4779-ad8d-447cadc5fe93 | @Test
/* Very basic test to see if we can put in valid input and subsequently get that input back out.
*/
public void testGetValue() throws InvalidSuitException, InvalidFaceValueException {
Card card = new Card('c', '3');
assertEquals(card.getValue(), "c3");
card = new Card("H4");
... |
1a28c0a9-760d-499c-a2a7-b2511f230630 | @Test
/* Test the overridden equals operator. If two cards have the same suit and face value, they should
* be considered equal. If not, they shouldn't.
*/
public void testEquals() throws InvalidSuitException, InvalidFaceValueException {
Card card = new Card('c', '5');
assertTrue(car... |
b60dec45-b617-4d5e-928b-a2af29d40d55 | @Test
/* Very basic test to see if we can put in valid input and subsequently get that input back out.
*/
public void testGetSuit() throws InvalidSuitException {
Suit suit = new Suit('H');
assertEquals('H', suit.getSuit());
} |
fd69333f-82a4-4b8c-b0d8-23b612a688a8 | @Test(expected = com.mergermarket.exception.InvalidSuitException.class)
/* Test that bad input to the constructor results in an exception.
*/
public void testInvalidConstructorInput() throws InvalidSuitException {
Suit suit = new Suit('X');
} |
b8fab1d9-aebb-4db7-9165-6927bd34eabc | @Test
/* Test that isValid does the right thing with both valid and invalid input.
*/
public void testIsValid() {
Suit suit = new Suit();
// Test with valid input
assertEquals(true, suit.isValid('D'));
// Test with invalid input
assertEquals(false, suit.isValid('S'... |
be6740e9-86ef-42b8-9937-68ec532c9d09 | @Test
/* Test that getValidInputs returns the expected list of chars.
*/
public void testGetValidInputs() {
char[] expectedValidInputs = { 'D', 'H', 'c', 's' };
assertArrayEquals(expectedValidInputs, Suit.getValidInputs());
} |
460e501e-53f2-406d-8e36-ec02a0fa14fd | @Test
/* Very basic test to see if we can put in valid input and subsequently get that input back out.
*/
public void testGetFaceValue() throws InvalidFaceValueException {
// Test with a letter
FaceValue faceValue = new FaceValue('T');
assertEquals('T', faceValue.getFaceValue());
... |
3a2db962-8918-4681-88af-7ac022ac2d4a | @Test(expected = com.mergermarket.exception.InvalidFaceValueException.class)
/* Test that bad input to the constructor results in an exception.
*/
public void testInvalidConstructorInput() throws InvalidFaceValueException {
FaceValue faceValue = new FaceValue('B');
} |
5825a32b-6a81-496c-b0a5-412fda62492c | @Test
/* Test that isValid does the right thing with both valid and invalid input.
*/
public void testIsValid() {
FaceValue faceValue = new FaceValue();
// Test with valid input
assertEquals(true, faceValue.isValid('3'));
// Test with invalid input
assertEquals(fal... |
1bd3d448-7cc8-42b8-811c-5fde23e24f1b | @Test
/* Test that getValidInputs returns the expected list of chars.
*/
public void testGetValidInputs() {
char[] expectedValidInputs = { 'A', '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K' };
assertArrayEquals(expectedValidInputs, FaceValue.getValidInputs());
} |
6abd8a60-968f-445a-a443-28a87171a208 | @Test
/* Very basic test to see that we can create and then access the required number of cards.
*/
public void testGetCards() throws InvalidSuitException, InvalidFaceValueException {
int numValidSuits = Suit.getValidInputs().length;
int numValidFaceValues = FaceValue.getValidInputs().lengt... |
45ae186e-6e4d-4230-ae3e-be1a606a1fbe | @Test
/* Test that shuffle changes the order of the cards.
*/
public void testShuffle() throws InvalidSuitException, InvalidFaceValueException {
Deck deck = new Deck();
// Make a copy of the cards before shuffling.
List<Card> unshuffled = new ArrayList<>();
for (Card c : de... |
09f2e0a3-8692-45b1-9bd4-798d22f9f488 | @BeforeClass
/** Set up the deck of cards and, for convenience, put all the cards into a Set that
* we can then use as a lookup table for checking if a card is a 'real' card.
*/
public static void setUp() throws InvalidSuitException, InvalidFaceValueException {
deck = new Deck();
car... |
f3531eab-9fc3-4afe-b534-3365bc89d33e | @Before
public void before() throws InvalidGameStateException {
layout = new Layout(deck);
} |
ba288c33-fd54-4050-be22-ece5f2c504f5 | @Test
/** Test that the constructor sets up the initial state of the game correctly.
* This is a bit tricky because of:
* - the randomness element of shuffling the cards
* - the fact that the class's contract with the outside world is just via
* text output (we could use reflection... |
ce71376f-1366-4c8a-ba60-b164bbe1ceca | @Test(expected = com.mergermarket.exception.InvalidGameStateException.class)
/** Test that the game won't start if the deck doesn't meet the requirements for this game.
*/
public void testWrongNumberOfCardsInDeck() throws InvalidFaceValueException, InvalidSuitException, InvalidGameStateException {
... |
00675cae-14be-4266-ab85-8afb3d3984d5 | @Test
/** Test that processMove returns false if the given move is not allowed (not to be confused
* with invalid due to the state of the game).
*/
public void testProcessMoveWithDisallowedInput() throws InvalidGameStateException, InvalidFaceValueException, InvalidSuitException {
assertFalse(l... |
0ef37116-a0d6-490c-a938-7c8dbe5a7b24 | @Test
/** Test that starting a new game causes the cards to be re-shuffled.
*/
public void testStartingNewGame() throws InvalidGameStateException, InvalidFaceValueException, InvalidSuitException {
List<String> firstState = layout.print();
assertTrue(layout.processMove("N"));
List<... |
d11e067b-2bf8-43c7-a0f7-0d819932aa8c | @Test
/** Test turning over cards with the draw stack in various states.
*/
public void testTurningDrawStack() throws InvalidFaceValueException, InvalidSuitException, InvalidGameStateException {
Layout layout = createUnshuffledLayout();
// Test basic card turning, hitting the end of the dr... |
af23e54d-3662-4253-93d2-14fca22dba61 | @Test
/** Test moving cards in various ways:
* - from draw stack to a column
* - from draw stack to a discard pile
* - from column to another column
* - from column to discard pile
*/
public void testMoveCard() throws InvalidFaceValueException, InvalidSuitException, InvalidGameS... |
e958f5c9-1e64-44f9-9227-144fbf727352 | private String getTopDrawStackCard(final List<String> state) {
return state.get(2).substring(19,21);
} |
bee126c3-269a-49e5-84be-3021fc59b652 | private Layout createUnshuffledLayout() throws InvalidFaceValueException, InvalidSuitException, InvalidGameStateException {
Deck deck = createUnshufflableDeck();
return new Layout(deck);
} |
89710582-dd7c-472a-ac7f-d7cd383e0afb | private Deck createUnshufflableDeck() throws InvalidFaceValueException, InvalidSuitException {
List<Card> cards = new ArrayList<>();
char[] suits = { 'D', 'H', 'c', 's' };
char[] faceValues = { 'A', '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K' };
for (char suit : suits) {... |
bb2f6b69-dd07-4565-a717-ce02f2dd3a3a | public static void main(String[] args) {
// write your code here
} |
5d772817-c5a9-4a06-97f6-fce2e60230a6 | public Card() {
} |
2b18529c-5541-435b-93e2-65ad40e0738c | public Card(final char suit, final char faceValue) throws InvalidSuitException, InvalidFaceValueException {
this.suit = new Suit(suit);
this.faceValue = new FaceValue(faceValue);
this.faceUp = false;
} |
9f725284-dec5-4f56-b6be-c2d086d074b6 | public Card(final String cardValue) throws InvalidSuitException, InvalidFaceValueException {
char suit = cardValue.charAt(0);
char faceValue = cardValue.charAt(1);
this.suit = new Suit(suit);
this.faceValue = new FaceValue(faceValue);
this.faceUp = false;
} |
df87d760-fe79-4c6a-a5d2-b69beedfb33d | public String getValue() {
return String.valueOf(suit.getSuit()) + String.valueOf(faceValue.getFaceValue());
} |
a585792d-6e46-4f58-a96e-a335208baf53 | @Override
/**
* Useful shorthand for determining if one Card is the same as another. Two cards
* are considered the same if they have the same value (suit + face value).
* @return true if the cards are the same, false if not.
*/
public boolean equals(Object o) {
if (this == o) retu... |
a7ae5233-ebbf-4ac6-aa83-b8b73a8e7b3d | public boolean isFaceUp() {
return faceUp;
} |
e10b9753-4165-42c1-9b98-6ae419147861 | public void setFaceUp(boolean faceUp) {
this.faceUp = faceUp;
} |
e7a88fc1-31d5-4290-a9db-4a67adba1b9e | public FaceValue() {
} |
ba665048-7fd0-4d8e-9055-d13a91c1a7ef | public FaceValue(final char input) throws InvalidFaceValueException {
if (isValid(input)) {
setFaceValue(input);
}
else {
throw new InvalidFaceValueException("Invalid face value " + input + " passed to FaceValue constructor");
}
} |
b549e3c9-e823-4080-b928-1d021875536f | public boolean isValid(final char input) {
return isValid(input, validInputs);
} |
ef841bfc-7b7a-47b0-9b1e-3c6e52684148 | public static char[] getValidInputs() {
return validInputs;
} |
ecd83bc3-6f98-4ddc-a7df-f60c388e8105 | public char getFaceValue() {
return faceValue;
} |
487d7758-8abc-4fc1-9e90-1ba67299f7eb | public void setFaceValue(final char faceValue) {
this.faceValue = faceValue;
} |
7fbec9cf-1f53-4ca0-9e4a-0bd12c9ceb51 | public Suit() {
} |
9c3cb842-90a8-4a0d-b499-2fa1cede4d72 | public Suit(final char input) throws InvalidSuitException {
if (isValid(input)) {
setSuit(input);
}
else {
throw new InvalidSuitException("Invalid suit " + input + " passed to Suit constructor");
}
} |
bb668ddc-a4bb-4f6c-aea2-05971f2d9301 | public boolean isValid(final char input) {
return isValid(input, validInputs);
} |
f713b711-f5e4-4e6a-a412-be63dd69f190 | public static char[] getValidInputs() {
return validInputs;
} |
f98d5728-ff22-44a2-8cd8-f2d11a365547 | public char getSuit() {
return suit;
} |
775a6fe6-96e3-4604-b323-86f8b421c540 | public void setSuit(final char suit) {
this.suit = suit;
} |
792b21d5-3c4a-4451-972a-3f07a50d0da1 | public boolean isValid(final char input, final char[] validInputs) {
/* We could implement binary search here instead of just linearly
iterating through the array, but because we expect the number of items
in the array to be relatively small, any performance boost would be minimal.
... |
7923a80a-e2df-4610-a1ad-6b85606639d9 | public Deck() throws InvalidSuitException, InvalidFaceValueException {
cards = new ArrayList<Card>();
for (char suit : Suit.getValidInputs()) {
for (char faceValue : FaceValue.getValidInputs()) {
cards.add(new Card(suit, faceValue));
}
}
} |
c1ea768b-f045-4c1f-a900-c9e467b18941 | public void shuffle() {
Collections.shuffle(cards);
} |
8abab053-5313-4b86-b2a8-6286a50f59f8 | public List<Card> getCards() {
return cards;
} |
28274d0d-ebab-4565-9d60-6ef4478c11c8 | public Layout(Deck deck) throws InvalidGameStateException {
this.deck = deck;
initialise();
} |
3467ae0b-379f-4ec5-bf15-b6a3a5d01c5c | public void initialise() throws InvalidGameStateException {
// Put everything in the draw stack to begin with.
deck.shuffle();
drawStack = new ArrayList<>();
for (Card c : deck.getCards()) {
drawStack.add(c);
}
// Make sure that the deck has the right number ... |
845f0c8c-9112-431a-88f8-1a19836c3f21 | public boolean processMove(final String move) throws InvalidGameStateException, InvalidFaceValueException, InvalidSuitException {
if (!isAllowedMove(move)) {
return false;
}
if (move.equals(NEW_GAME)) {
initialise();
return true;
}
if (move.e... |
d9f37d6b-8d55-40d5-b0e9-cd1425defe2f | private boolean moveColumn(final Card card, final String where) {
// Figure out if the destination is a numbered column or a discard pile.
boolean goingToDiscardPile = false;
int column = 0;
String suit = "";
try {
column = Integer.parseInt(where);
}
... |
f1818417-7ca1-4faa-9954-c840cfb09f4a | private void turnDrawStack() {
int size = drawStack.size();
int lastIndex = size - 1;
// Check that there's something in the draw stack to turn.
if (size == 0) {
return;
}
// If we're at the very end of the stack, go back to the beginning
// and pro... |
3f656784-213c-4c51-be01-c8d82784f813 | private boolean isAllowedMove(final String move) {
return (move.equals(NEW_GAME) ||
move.equals(TURN) ||
isAllowedColumnMove(move));
} |
ee6f71b4-dd9f-4d60-815c-b70c7bea8200 | private boolean isAllowedColumnMove(final String move) {
// We expect a two-character card value, a space, then a column number.
String cardValue, column;
try {
cardValue = move.substring(0, 2);
column = move.substring(3);
}
catch (StringIndexOutOfBoundsEx... |
fdaf92d1-498a-49d8-a632-4fdd3f8e2ef7 | public List<String> print() {
String header = "ColumnNames S[T]ack ";
for (int i = 1; i <= NUM_COLUMNS; i++) {
header += "[" + i + "] ";
}
for (char s : Suit.getValidInputs()) {
header += "[" + s + "] ";
}
String separator = "";
f... |
cd377d00-96cd-4b88-aaa6-6d6a1682a797 | private String getColumnsSlice(final int index) {
String result = "";
for (int i = 0; i < NUM_COLUMNS; i++) {
List<Card> column = columns.get(i);
if (column.size() > index) {
Card c = column.get(index);
result += c.isFaceUp() ? c.getValue() : FACE... |
2e6baace-7db6-4d2b-b0d0-df09fe02edc0 | private int longestColumnLength() {
int max = 0;
for (List<Card> column : columns) {
int thisSize = column.size();
if (thisSize > max) {
max = thisSize;
}
}
return max;
} |
eba4c39f-c6d5-4e31-8297-e3c1a90cc0f2 | public InvalidFaceValueException(final String message) {
super(message);
} |
1569d82d-3f87-4530-9955-6ab38a484e46 | public InvalidSuitException(final String message) {
super(message);
} |
c376d2e0-ca19-4532-ad80-cd1c9f8513bd | public InvalidGameStateException(final String message) {
super(message);
} |
ea6cb03d-bc76-45c6-a999-926d7283a4d5 | public static void main(String[] args)
{
GraphicalUserInterface GUI = new GraphicalUserInterface();
GUI.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
GUI.setSize((System.getProperty("os.name").contains("Windows"))?(WIDTH + 4):WIDTH, (System.getProperty("os.name").contains("Windows"))?(HEIGHT + 5):HEIGHT);
G... |
9c8b3dd3-82bf-407a-881d-d898714d0687 | public GraphicalUserInterface()
{
super("Liuizer (" + Resources.VERSION_NUMBER + " - " + Resources.VERSION_CODENAME + ") - The All-In-One ECE 489 Solver");
FlowLayout fl = new FlowLayout();
fl.setAlignment(FlowLayout.LEFT);
setLayout(fl);
createPanes();
setupTabs();
} |
c4a1b5e8-ff74-4daf-9a78-90ba05357a85 | private void createPanes()
{
createCaesarPane();
createDESPane();
createRSAPane();
} |
2a73a0d3-dedd-4c5f-b201-386476e46d42 | private void createCaesarPane()
{
// Input Panel
caesarInputPanel.add(new JLabel(Resources.ccInputString + ":"));
JTextField jTFInput = new JTextField();
jTFInput.setPreferredSize(new Dimension(jTP_WIDTH-24, 25));
caesarInputPanel.add(jTFInput);
JLabel jL = new JLabel(Resources.ccSpinnerString + ":");
jL... |
e30f41cc-1344-4896-86af-593b3d57d3d7 | private void createDESPane()
{
// Input Panel
desInputPanel.add(new JLabel(Resources.desInputString + ":"));
JTextField jTFInput = new JTextField();
jTFInput.setPreferredSize(new Dimension(jTP_WIDTH-24, 25));
desInputPanel.add(jTFInput);
desInputPanel.add(new JLabel(Resources.desKeyString + ":"));
JTextF... |
fd3d9023-ad4b-4c6e-8f24-09707ab6b4ab | private void createRSAPane()
{
// Input Panel
rsaInputPanel.add(new JLabel(Resources.rsaInputP + ":"));
JTextField jTFInputP = new JTextField();
jTFInputP.setPreferredSize(new Dimension(jTP_WIDTH-24, 25));
rsaInputPanel.add(jTFInputP);
rsaInputPanel.add(new JLabel(Resources.rsaInputQ + ":"));
JTextField ... |
dbbf67f2-98e4-4f01-8d07-25efb5785d4c | private void setupTabs()
{
jTP.setPreferredSize(new Dimension(jTP_WIDTH, jTP_HEIGHT));
jTP.addTab("Caesar Cipher", pane_caesar);
jTP.addTab("DES Encryption", pane_DES);
jTP.addTab("RSA Encryption", pane_RSA);
add(jTP);
} |
f831d292-609e-41a3-a79d-bca26d88a4e1 | @Override
public void actionPerformed(ActionEvent e)
{
if(e.getSource() == caesarShiftButton)
{
String inputString = ((JTextField)caesarInputPanel.getComponent(1)).getText();
int[] charSteps = new int[caesarSpinnerPanel.getComponentCount()];
for(int i = 0; i < charSteps.length; i++)
charSteps[i] = (i... |
c1ba6856-6d4a-4f21-a51a-47a85268be0d | public SpreadSheet(String[][] data)
{
super(new GridLayout(1,0));
String[] emptyLabels = new String[data[0].length];
for(int i = 0; i < emptyLabels.length; i++)
emptyLabels[i] = " ";
jT = new JTable(data, emptyLabels);
TableModel model = new DefaultTableModel(data, emptyLabels)
{
public boolean isCe... |
23903e3c-df88-4775-a434-dbf882fcddb4 | public boolean isCellEditable(int row, int column)
{
return false;
} |
afc16029-7252-47a7-96ca-f5e5b0659952 | public static String shift(String inputString, int[] steps, boolean right)
{
String shiftedString = "";
for(int i = 0; i < inputString.length(); i++)
shiftedString += addAndCheckWrap(inputString.charAt(i), (i+1), steps, right);
return shiftedString;
} |
be148dc1-6b9e-4c28-809e-5b5a277cd979 | private static char addAndCheckWrap(char c, int currentChar, int[] steps, boolean right)
{
int C = ((int)c);
int loop;
int mod = (currentChar % steps.length);
if(mod == 0)
loop = steps[steps.length-1];
else
loop = steps[(mod-1)];
if(isAlphaNumericCharacter(c))
{
if(right)
{
for(int i = ... |
42bc4a10-1b8a-4a87-9eac-c8ac80741fd9 | private static boolean isAlphaNumericCharacter(char c)
{
if((c >= ((int)'A') && c <= ((int)'Z')) || (c >= ((int)'a') && c <= ((int)'z')) || (c >= ((int)'0') && c <= ((int)'9')))
return true;
return false;
} |
6f2eb0f9-50f9-4798-a5e4-a2ad8aa9e12b | public static ArrayList<String> encrypt(BigInteger p, BigInteger q, BigInteger e, BigInteger M)
{
ArrayList<String> output = new ArrayList<String>();
BigInteger n = p.multiply(q);
BigInteger z = (p.subtract(BigInteger.valueOf(1))).multiply(q.subtract(BigInteger.valueOf(1)));
output.add("p = " + p);
outpu... |
49b0fcfa-7def-4c45-999e-7ece078ebabe | public static ArrayList<String> encrypt(String key, String message)
{
keyBin = convert(key);
messageBin = convert(message);
generateKey();
generateMessage();
return generateList();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.