method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
a1351a48-5a58-4258-93b1-51d80922637e | 5 | public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Coordonnees other = (Coordonnees) obj;
if (this.x != other.x)
return false;
if (this.y != other.y)
return false;
return true;
} |
4b8261ab-0695-432d-8113-f5eae99e0830 | 1 | public void show() {
for (String part : mParts) {
System.out.println(part);
}
} |
b3293bc6-6c95-4df1-a0a4-124153415fe0 | 1 | public static UUID randomUUID() {
SecureRandom ng = numberGenerator;
if (ng == null) {
numberGenerator = ng = new SecureRandom();
}
byte[] randomBytes = new byte[16];
ng.nextBytes(randomBytes);
randomBytes[6] &= 0x0f; /* clear version */
randomBytes[6] |= 0x40; /* set t... |
7b9cf3ee-14c5-4c82-82e2-72edab37097a | 6 | private static int getFractionalSecondsStorageSize(int fsp) {
switch (fsp) {
case 1:
case 2:
return 1;
case 3:
case 4:
return 2;
case 5:
case 6:
return 3;
default:
... |
66929eb3-fff4-4965-a401-8c53e3719cc6 | 8 | public String contorlDatabaseElementAndReplece(String strings_of_element,DataElementInterface DE) {
int i = 0;
String parse ="";
switch (DE.getType()) {
case DATE:
if(controlDate(strings_of_element))
return strings_of_element;
... |
a71108b3-5095-4a13-9b63-72622b0d3237 | 2 | @Override
public void createElection(String name, String typeID) {
if (context.getCurrentUser() != null
&& context.getCurrentUser().isElectionManager()) {
context.getAdminTools().createElection(
context.getCurrentUser(), name, typeID);
context.setCurrentElectionID(name);
} else
throw new RuntimeE... |
f539fd3b-f25c-49fd-88ad-23edbdaf5313 | 3 | public boolean equals( Quaternion r )
{
return x == r.getX() && y == r.getY() && z == r.getZ() && w == r.getW();
} |
57c59494-bdea-438f-ad92-99cd314296fc | 1 | public static void main(String[] args)
{
for(opConstant c : opConstant.values())
{
System.out.printf("%d,%s %n",c.ordinal(),c);
}
} |
6d7206da-0ea4-4d31-a342-456bf5db827f | 9 | @POST
@Path("entry")
@Produces("application/json")
@Consumes("application/json")
public long addTimeEntry(TimeEntry entry)
{
Date currentTime = new Date();
if(entry == null)
throw new IllegalArgumentException("Time entry data not formatted correctly");
if(em.contains(entry))
throw ne... |
ae868981-09d0-4da5-9cd0-7f33621a7961 | 3 | private static StructuredBlock skipFinExitChain(StructuredBlock block) {
StructuredBlock pred, result;
if (block instanceof ReturnBlock)
pred = getPredecessor(block);
else
pred = block;
result = null;
while (pred instanceof JsrBlock || getMonitorExitSlot(pred) >= 0) {
result = pred;
pred = getPre... |
f21fadb0-1e6b-4abe-b1bf-2ce727a5d1e0 | 7 | public void move (double xadd, double yadd)
{
//if (isColliding()) return;
if (xadd != 0 && yadd != 0) { move(xadd, 0); move(0, yadd); return; }
if (Math.abs(xadd) > 1) {
for (int xa = 0; xa < Math.abs(xadd); xa++) move(Math.signum(xadd), 0);
move(xadd % 1, 0);
... |
76d12a89-5576-486f-94eb-9f7db12c95b1 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Location location = (Location) o;
if (x != location.x) return false;
if (y != location.y) return false;
return true;
} |
14a788d3-7ba4-445a-81bd-c272b9eca312 | 9 | public void paintComponent(Graphics g){
super.paintComponent(g); //first draw the actual image
if (displayImage == null) // quit if there's no image to load...
return;
else
displayImage.setPanel(this);
int p_width = this.getWidth();
int p_height = this.getHeight();
int i_width = this.displayImage... |
4f89de6f-6a7d-4116-8fa2-8da774dc627c | 4 | public Reply fetchDataConnectionReply() throws FileNotFoundException,
IOException {
ReplyWorker worker = new ReplyWorker(getDataSocket(), this);
worker.start();
while (worker.getStatus() == ReplyWorker.UNKNOWN) {
try {
Thread.sleep(20);
} catch... |
caae5821-e5ae-468a-922b-fbeae0842c32 | 3 | * @return true if all the elements in c could have been inserted into the Bloom filter.
*/
public boolean containsAll(Collection<? extends E> c) {
for (E element : c)
if (!contains(element))
return false;
return true;
} |
14906ec2-8e20-4da2-b60e-14753fb738c3 | 1 | private void createCurrHotel(SessionRequestContent request) {
Hotel currHotel = (Hotel) request.getSessionAttribute(JSP_CURRENT_HOTEL);
if (currHotel == null) {
currHotel = new Hotel();
currHotel.setCity(new City());
currHotel.setDescription(new Description());
... |
e4293edf-d028-4abe-8319-e5e10ec37a57 | 6 | @Override
protected void onCollide(GameObject obj, int gravityDir, int colDir, Room room) {
// System.out.println("Colliding!");
if(obj.getClass() == Player.class){
obj.die(room);
}
if(!obj.flag.has(OBJECT_FLAG_GHOST)){
switch(colDir) {
case UP:
this.correctCollisionUp(obj);
this.y_speed = 0;... |
67b95f85-9207-4c62-b0bd-ba9af84b1bb4 | 2 | @Override
public void actionPerformed(ActionEvent e) {
String buttonString = e.getActionCommand();
if (buttonString.equals("Blue")) {
this.textDisplay.setBackground(Color.BLUE);
this.textDisplay.setForeground(Color.WHITE);
} else if (buttonString.equals("Black")) {
this.textDisplay.setBackgro... |
0a81be05-780a-4ecc-9957-1402632ca5bd | 6 | public static Model getModel(float[] args) {
int type= (int) args[0];
switch (type) {
case 0: return new AsteroidModel (args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
case 1: return new BulletModel (args[1], args[2], args[3], args[4], args[5], args[6], a... |
010af46c-e438-443b-979b-eb271a19024a | 7 | @Override
public void update(GameContainer gc, StateBasedGame sbg, int delta)
throws SlickException {
// gestion de la souris
Input input = gc.getInput();
sourisX = input.getMouseX();
sourisY = input.getMouseY();
// parcours les items des options, pour voir si on est dessus
for (int i = 0; i < itemVic... |
d859757d-21fd-40e6-85d8-12bbcb9d6480 | 4 | public static HashMap<String,String> parseKeyValue(String msg){
if(isBlank(msg)){
return null;
}
String values = null;
try{
values = URLDecoder.decode(msg, CoderUtils.UTF8);
}catch(UnsupportedEncodingException e){
throw new UnsupportedCharset... |
66aa7a8b-9d70-4c6b-a67a-bedddd911a68 | 7 | protected void execute() {
if(timesStarted < REPETITIONS) {
if(!commandToRepeat.isRunning() && needToStartCommand < START_COMMAND_THRESHOLD) {
needToStartCommand++;
button.setPressed(false);
}
if(!commandToRepeat.isRunning() && needToStartComma... |
c9b3d5a8-2b9e-43de-97c2-be90740d8be9 | 3 | public void deleteInventory(int slot, int qty) {
inventory.deleteInventory(slot, qty);
if (registry.getGameController().multiplayerMode != registry.getGameController().multiplayerMode.NONE && registry.getNetworkThread() != null) {
if (registry.getNetworkThread().readyForUpdates()) {
... |
8f5c2e4f-d9c1-4032-b9e0-c3e60a6f1841 | 9 | public short initialize(boolean setup_from_config)
{
if (is_init)
{
MsgDumperCmnDef.WriteErrorSyslog(__FILE__(), __LINE__(), "Library has been initialized");
return MsgDumperCmnDef.MSG_DUMPER_FAILURE_INCORRECT_OPERATION;
}
// Setup the parameters from the config file, overwrite the former parameter setting... |
bef53576-008e-47e2-81e9-b062340bae9b | 2 | public static final ByteBuffer getInfoBytes(byte[] torrent_file_bytes) throws BencodingException
{
Object[] vals = decodeDictionary(torrent_file_bytes,0);
if(vals.length != 3 || vals[2] == null)
throw new BencodingException("Exception: No info bytes found!");
return (ByteBuffer)v... |
37a6f3ff-8876-4cbc-a104-f93a54468661 | 9 | @Override
public void buttonA(boolean pressed) {
if(enabled) {
if(ses2 != null) {
setFlagsFalse();
if(future != null) {
future.cancel(true);
}
}
if(pressed == true) {
aFlag = true;
dllProc.dll_keyPressed(container.xgetCurrentPreset().xgetAAssignedKeyCode());
if(... |
2c1a93a7-f2bf-4778-9955-11350ad6a306 | 9 | public final void whileStmt() throws RecognitionException
{
AST ast1 = null, ast2 = null;
try {
// CPP.g:389:3: ( 'while' '(' expr ')' stmt )
// CPP.g:389:5: 'while' '(' expr ')' stmt
{
this.match(this.input, 48, FOLLOW_48_in_whil... |
7c406b3a-399f-4a32-9dba-1c7869eeffe7 | 2 | int maxBucket() {
int max = 0;
for (int i = 0; i < buckets(); i++) {
Bucket bucket = new Bucket(i);
if (bucket.value > max) {
max = (int)bucket.value;
}
}
return max;
} |
6010b7e7-01b9-4cf9-b6eb-fcbc911c042c | 9 | @SuppressWarnings("static-access")
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == Main.saveAs || e.getSource() == Main.save){
int value;
if(!(e.getSource() == Main.save && Main.fileSelected)) {value = Main.fc.showSaveDialog(Main.fc);}else{value = Main.fc.APPROVE_OPTION;}
if(valu... |
13d28324-dcb4-4c54-958f-20ace16a078f | 6 | public static int candy(int[] ratings) {
int len = ratings.length;
int n = 0;
int[] c = new int[len];
c[0] = 1;
for (int i = 1; i < len; i++) {
c[i] = ratings[i] > ratings[i - 1] ? c[i - 1] + 1 : 1;
}
for (int i = len - 2; i >= 0; i--) {
c[i] = (rat... |
9f6bd822-b4f4-4f0d-8f75-eebd6cbf5462 | 1 | public PropertyEditor getEditor(Class type)
{
PropertyEditor editor;
editor = defaultEditors.get(type);
if (editor != null)
return editor;
editor = PropertyEditorManager.findEditor(type);
return editor;
} |
bfd4a527-0468-4434-b72a-a7375cb57b3c | 3 | @Override
public List<String> searchRemote(String string) {
List<String> resultList = new ArrayList<String>();
IPaddress.clear();
getAllIP();
System.out.println("........................................STARTING COMMUNICATION");
Properties props = new Properties();
... |
cdfa4f7a-c3fe-48b8-a639-a7b353d6f299 | 5 | public static ArrayList<MediaCopy> getAllCopies() {
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
ArrayList<MediaCopy> mediaList = new Arr... |
5acde028-bebb-4d4f-a1fa-da455511f2e8 | 3 | private NoeudUF<E> getNodeOfData(E data) {
assert (data != null) : "l'élement spécifié ne peut être null";
NoeudUF<E> result = MISSING;
NoeudUF<E> temp;
int i = 0;
while (result == MISSING && i < nodes.size()) {
temp = nodes.get(i);
if (temp.data.equals(da... |
2b6043e0-bdcf-42c8-9361-e73f453c8a3d | 2 | public void setPasswordButtonMargin(int[] margin) {
if ((margin == null) || (margin.length != 4)) {
this.buttonPW_Margin = UIMarginInits.PW_BTN.getMargin();
} else {
this.buttonPW_Margin = margin;
}
somethingChanged();
} |
7593664d-1a6d-4baa-a0f6-d115b6bf41f7 | 6 | @Override
public void update() {
switch(this){
case START_LEVEL_ANIMATION:
if(System.currentTimeMillis() > end){
//animation complete
Game.state = State.PLAY_LEVEL;
Game.state.start();
}
break;
case END_LEVEL_ANIMATION:
if(System.currentTimeMillis() > end){
//animation complete
Ga... |
81965f1a-f4b7-4bd3-bb96-c33979aecd68 | 4 | private void readLabel() {
try {
BufferedReader labelIn = new BufferedReader(new FileReader(labelFile)); // Used to read in the labe & data
String line; // Holds the newly read line
String[] tmpLine; // Array used to hold the split line that was just reads
while ((line = labelIn.read... |
fd59fb0f-1cb9-4587-a787-b551053acbb3 | 8 | static float lpc_from_data(float[] data, float[] lpc, int n, int m){
float[] aut=new float[m+1];
float error;
int i, j;
// autocorrelation, p+1 lag coefficients
j=m+1;
while(j--!=0){
float d=0;
for(i=j; i<n; i++)
d+=data[i]*data[i-j];
aut[j]=d;
}
// Generate ... |
89983d85-82d9-4a30-9f75-9ab467551be5 | 4 | public void mouseDragged(MouseEvent e) {
if (documentViewController != null &&
documentViewController.getDocumentViewModel().getViewToolMode()
== DocumentViewModel.DISPLAY_TOOL_PAN) {
// Get data about the current view port position
Adjustable ver... |
60947872-22d1-4f26-8b06-5bdefef162e7 | 3 | private void cargarImagenes(){
for(Nave n: naves) n.cargarImagenes();
for(Escudo e: escudos) e.cargarImagenes();
for(Invasor i: invasores) i.cargarImagenes();
} |
7a19e191-ec76-4675-bc4d-89e321f3907b | 7 | public void gimp(BufferedImage image) {
int height = image.getHeight();
int width = image.getWidth();
int hstripes = height / 7;
int vstripes = width / 7;
// Calculate space between lines
int hspace = height / (hstripes + 1);
int vspace = width / (vstripes + 1);... |
26d3426c-8b5a-4bd8-a43d-a409890e39dd | 2 | @Override
public void execute() {
switch (Settings.location.getLocation()) {
case 1:
Constants.VARROCK_WEST_WALK_BANK.traverse();
break;
case 2:
Constants.VARROCK_EAST_WALK_BANK.traverse();
break;
default:
System.out.println("Something's wrong.");
break;
}
} |
fb49db33-3258-4ea5-bcf5-eef5cd34873f | 4 | public FrameOptions() {
propsFile = new File(MacroHelper.currentPath + "/config/config.txt");
int lastIndex = 0;
try {
if(!propsFile.exists())
propsFile.getParentFile().mkdirs();
propsFile.createNewFile();
props = PropertiesUtils.reloadProperties(propsFile);
if(props.getProperty("last-selected-op... |
309c0e4f-3a40-4472-b214-15d626ead3c5 | 5 | private void initAgencyInformation() {
agencyInfoResult = null;
ProcessAgencyInfo processAgencyInfo = new ProcessAgencyInfo() {
public void onComplete() {
if(getErrorCode() != null) {
TravelSDK.INSTANCE.processInit.setErrorCode(getErrorCode());
if (response != null && !response.isSuccess()) {
... |
26754ad8-472e-4373-bfc8-26fcb2b08e3b | 3 | public static void main(String args[]) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
}
//初始化闪屏Dialog时指定闪屏图片
final PreShow splashWindow = new PreShow();
//启动一个线程来加载数据
new Thread() { ... |
35ab2690-57c9-4a63-861a-bdc4435f38a0 | 8 | private boolean isBasicType(Object val) {
return val == null || val instanceof String || val instanceof Boolean
|| val instanceof Byte || val instanceof Character
|| val instanceof Long || val instanceof Double
|| val instanceof Float || val instanceof Integer;
} |
fd4e3220-ab9e-44c9-8450-bb91dfc16a7b | 0 | public boolean isHidden() {
return hidden;
} |
d8a9ce8b-a7ff-44be-aad5-c4b3d9170c6e | 8 | @Override
public boolean equals(Object other) {
if (other instanceof Pair) {
Pair otherPair = (Pair) other;
return
(( this.first == otherPair.first ||
( this.first != null && otherPair.first != null &&
this.first.equals(otherPair.first))) &&
( this.second == otherPair... |
0f0f54b6-0614-4684-a685-8a38b8140d5f | 4 | public static Sprite getSprite(String name) {
if (spritesheet == null)
load();
if (sprites == null)
sprites = new HashMap<String, Sprite>();
if (sprites.containsKey(name))
return sprites.get(name);
Rectangle rect = getRect(name);
if (rect == nu... |
edf42644-7f21-4ac1-8678-a590d5387eea | 3 | public void addFinal(Final fin){
boolean notFinded = true;
for(Final f : finals)
if(f.getValue().equals(fin.getValue()))
notFinded = false;
if(notFinded)
finals.add(fin);
} |
359a648a-c567-4fa9-88e3-584a8f3b5e25 | 0 | @Override
protected EntityManager getEntityManager() {
return em;
} |
74a49c47-a011-4ec5-a6a3-ed30f9d36705 | 0 | public FileNameLengthComparator() {} |
ec463654-f2d6-4738-8505-990fbf8b6a8e | 5 | private void initialize() throws IOException {
// Instantiate frame, set title/size/closeoperation/layout
frame = new JFrame();
frame.setTitle("ecp - Drum Machine");
frame.setBounds(100, 0, 845, 780);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(new BorderLayout());
// Boxes to ... |
0847308f-ec56-4549-97a4-3647465fb732 | 6 | public String determineAuctionResults() {
if (flightDirection.equals("One-Way")) {
if (buyerPrice > hiddenPrice) {
selectedFlight.fare = buyerPrice;
addReservation(accountNo, selectedFlight.airlineID, selectedFlight.flightNo, selectedFlight.seatClass, new Timestamp(ne... |
6db59205-400e-4296-81d7-6043c9807b82 | 1 | public void setBirdFlock(ArrayList<Bird> birds) {
ArrayList<BirdShape> shapeList = new ArrayList<BirdShape>();
for (Bird bird : birds) {
shapeList.add(bird.getBirdShape());
}
this.birdPanel.setBirdList(shapeList);
} |
98fba6df-700f-4d57-9870-934aac45e99b | 0 | public PDAStepWithClosureSimulator(Automaton automaton) {
super(automaton);
} |
27b30278-7a08-4838-a99f-403e92692fdb | 1 | public static System addSystem(String name) {
System system = null;
if(!listSystems.containsKey(name)) {
system = new System(name);
listSystems.put(name, system);
}
return system;
} |
c466299d-3562-43fc-aef1-03530fdc77e0 | 2 | private static HashMap<Integer, Integer> mapEdges(char[] state) {
HashMap<Integer, Integer> result = new HashMap<Integer, Integer>();
for (int i = 0; i < Cube.EDGES.length; i++) {
char[] needle = new char[Cube.EDGES[i].length];
for (int j = 0; j < Cube.EDGES[i].length; j++) {
needle[j] = state[Cube.EDGES[... |
b628df3c-8dea-4cbe-b4aa-749eaffaa3e2 | 5 | @RequestMapping(value = {"/Login"}, method = RequestMethod.POST)
public void login(HttpServletRequest httpRequest, HttpServletResponse httpServletResponse, @RequestBody String json) throws JsonProcessingException {
try {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.co... |
c3c6a011-a7f1-45e3-801b-2af2891f5b0c | 0 | public GameMachine() {
hasNotChosenCharactersState = new hasNotChosenCharactersState(this);
hasChosenCharactersState = new hasChosenCharactersState(this);
hasChosenItemsState = new hasChosenItemsState(this);
this.state = hasNotChosenCharactersState;
} |
397f0eeb-d8c0-48b1-8750-7a2dc870c546 | 3 | public void act(){
if (mob != null){
if (mob.getHp() > 0 && map.checkEnemy (mob)){
this.setLocation (mob.getX(), mob.getY()-20);
}
else{
mob = null;
map.resetDefaultUi ();
}
}
} |
ae2c2010-81e0-4890-98ae-8caf09e54ffe | 8 | public SoundBuffer read()
{
if( myAudioInputStream == null )
return null;
// Get the format for the audio data:
AudioFormat audioFormat = myAudioInputStream.getFormat();
// Check to make sure there is an audio format:
if( audioFormat == null )
{
... |
e57f19a6-8acd-41c8-a108-f5d0fc826bc2 | 5 | @Override
public void happen(int rollResult) {
// For testing purposes only
if(rollResult == 4){
Game.getInstance().getCurrentCharacter().incrementSanity();
} else if (rollResult == 3){
Game.getInstance().getCurrentCharacter().incrementKnowledge();
} else if (rollResult >= 1 && rollResult <=2){
Game.g... |
c7570fec-bdc3-46fe-b140-760e796c0b65 | 5 | public boolean getSpecificPortMappingEntry(int externalPort,
String protocol, final PortMappingEntry portMappingEntry)
throws IOException, SAXException {
portMappingEntry.setExternalPort(externalPort);
portMappingEntry.setProtocol(protocol);
... |
fd086703-4d89-4250-a9b1-b7786ebe1d95 | 7 | public CryptoAlgo getAlgo(AlgoType type) {
CryptoAlgo __proto = null;
switch (type) {
case DES:
__proto = new DESCrypto();
break;
case AES:
__proto = new AESCrypto();
break;
case RSA:
// __proto = new RSACrypto();
break;
case DSASHA1:
__proto = new DSASignature();
break;
case RSASI... |
7533dac8-6288-42e6-b5c4-1f5c5e959b91 | 4 | @Override
public void onMessage(String channel, String sender, String login, String hostname, String message) {
// check enabled state
if(m_Disabled)
{
if(message.toLowerCase().equals("!enable"))
{
m_Disabled = false;
}
return;... |
4bdfbc21-6ca4-4354-9f91-2a2b81dcc904 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
33166441-89b9-4a8d-9c1d-4608f343afaf | 1 | @Test
public void hyppy() {
laitetaasPariEstetta();
pe.setXY(new Piste(0, 0));
for (int i = 0; i < 55; i++) {
pe.eksistoi();
}
int y1 = pe.getY();
pe.aloitaHyppy();
pe.eksistoi();
assertTrue("Hahmo ei hypännyt :( y: "
+ pe.... |
542685e5-2284-49ee-9dd6-a0c5aa86366f | 9 | Rectangle getFocusBounds () {
int x = 0;
CTableColumn[] columns = parent.columns;
int[] columnOrder = parent.getColumnOrder ();
if ((parent.getStyle () & SWT.FULL_SELECTION) != 0) {
int col0index = columnOrder.length == 0 ? 0 : columnOrder [0];
if (col0index == 0) {
x = getTextX (0);
} else {
x = -paren... |
47c3d1fe-3e34-435e-bade-eb144f8ecf2d | 9 | public String getMessage() {
if (!specialConstructor) {
return super.getMessage();
}
StringBuffer expected = new StringBuffer();
int maxSize = 0;
for (int i = 0; i < expectedTokenSequences.length; i++) {
if (maxSize < expectedTokenSequences[i].length) {
maxSize = expectedTokenSeq... |
97604c73-bac2-4b9f-a489-136fec768434 | 9 | private boolean execEstimateBasedOnCfUsingFrequencies(VectorMap queryParam, StringBuffer respBody, DBAccess dbAccess) {
try {
int clntIdx = queryParam.qpIndexOfKeyNoCase("clnt");
String clientName = (String) queryParam.getVal(clntIdx);
int ftrsIdx = queryParam.qpIndexOfKeyNo... |
73a057f6-5c20-4b66-b45b-f92e991d3094 | 9 | public int designs(int maxHeight, int minWidth, int totalHeight, int totalWidth) {
List<Integer> risers = new ArrayList<Integer>();
//legal rises
for(int i=1; i <= totalHeight; i++){
if(totalHeight % i == 0 && i <= maxHeight){
risers.add(i);
}
}
//legal treads
List<Integer> treads = new ArrayLis... |
fa21fe37-13e9-4136-99ba-fcfbc6a82b66 | 5 | public void tickOnTrack(int trackX, int trackY, int trackZ) {
if (type == Type.USER && charge < capacity && clock % DRAW_INTERVAL == 0) {
IElectricGrid track = RailTools.getTrackObjectAt(minecart.worldObj, trackX, trackY, trackZ, IElectricGrid.class);
if (track != null) {
... |
35404219-3db1-41f6-a623-ae3fbb758ffd | 4 | public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer)
{
if(itemID == ArmorProperties.ScarecrowHelmet.itemID || itemID == ArmorProperties.ScarecrowChestplate.itemID)
{
return "costume's_mod:textures/models/armor/scarecrow_1.png";
}
if(itemID == ArmorProperties.ScarecrowLeggings.... |
f0768e43-bad5-4834-80b1-0057151466e6 | 1 | public void deleteAcc() throws IOException
{
Scanner in = new Scanner(System.in);
System.out.println("Which Account do you want to delete");
int ch = in.nextInt();
File x = new File(accDir+ch+".txt");
boolean delete = x.delete();
if(delete)
System.out.println("Deleted!");
else
System.out.println("Cannot Delete");
... |
d4279203-279a-41f5-a0ea-16111537d3e3 | 0 | public JTextField getjTextFieldNom() {
return jTextFieldNom;
} |
14faa330-411c-4c4e-adb4-a5cf46e1bf94 | 1 | @Test
public void testAnnouncement() {
ArrayList<Announcement> announcements = Announcement.getAllAnnouncements();
assertEquals(announcements.size(), 6);
for (int i = 0; i < announcements.size() - 1; i++) {
assertTrue(announcements.get(i).title.compareTo(announcements.get(i+1).title) < 0);
assertTrue(annou... |
672d7616-31e3-4701-9806-c42138e7cf29 | 9 | public String stwElimieren(String context){
ArrayList<Integer> spaceList = new ArrayList<Integer>();
ArrayList<String> newWortList = new ArrayList<String>();
int lastSpace = 0;
String newContext = "";
spaceList.add(0);
for(int i=1; i<context.length(); i++){
if(context.charAt(i) == ' ' || context.charAt(i... |
adad7e28-3c8e-4398-a7e1-89b5acd88aa2 | 3 | public static void find_missing_number(Integer[] v) {
boolean[] exists = new boolean[v.length + 1];
for (int i : v) exists[i - 1] = true;
for (int i = 0; i < exists.length; i++) {
if( !exists[i] ) {
System.out.println(i + 1);
break;
}
... |
9fa6a47d-1a8c-4d80-a104-3fee7c4608b7 | 5 | @SuppressWarnings("unchecked")
@Override
public void createNewDownload(Object rawDownloadData) throws InvalidRpcDataException {
this.rawDownloadData = rawDownloadData;
if (rawDownloadData == null) {
throw new InvalidRpcDataException("Got null when trying to parse raw Download data")... |
2acc13ca-4465-4876-93e2-aac5d2077fae | 8 | @EventHandler(priority = EventPriority.HIGHEST)
public void onEntityDeath(EntityDeathEvent event){
EntityDeathEvent entityDeathEvent = (EntityDeathEvent) event;
Entity killer = entityDeathEvent.getEntity().getKiller();
if(killer instanceof Player){
Player player = (Player) killer... |
9bb3fca5-1cc8-4165-b412-f297797cf529 | 0 | public void setAccountAcl(String accountAcl) {
this.accountAcl = accountAcl;
} |
039d3da1-c3bc-4c94-a3c8-3e135b29ee58 | 4 | void addClientToList(Socket sock) {
for(int i=0;i<clients.length;i++){
if(clients[i] == null){
clients[i] = sock;
try {
//set up buffer size
sock.setSendBufferSize(512);
streams[i] = new ObjectOutputStream(sock.getOutputStream());
newPlayer = i;
} catch (Exception e) {
... |
0b661da0-5217-4995-9d28-869ea8e00dfa | 7 | public void createB(){
switch (sides){
case 0:
setDirection(0);
doSide(sizeB - 1, 90);
break;
case 1:
doSide(sizeB / 2, 90);
break;
case 2:
doSide(1, 45);
... |
d128daee-6416-490c-a5ff-d29f870997d7 | 0 | public void setSuite(String value) {
this.suite = value;
} |
6d2252d8-1211-4a5b-be37-ecc0a56b13e3 | 6 | private void jButton6ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton6ActionPerformed
{//GEN-HEADEREND:event_jButton6ActionPerformed
if (!gameover) {
if (rule.turn()) {
if (rule.check(2, 1)) {
rule.pressed(2, 1);
if ... |
e0f3c350-330b-4fa8-9ed2-a6e490996844 | 4 | private void textSucursalKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textSucursalKeyTyped
// TODO add your handling code here:
if (!Character.isLetter(evt.getKeyChar()) && !Character.isISOControl(evt.getKeyChar()) && !Character.isWhitespace(evt.getKeyChar()))
{
Toolkit.g... |
be9f33cd-fe08-4ff6-a6e1-aa278f42219f | 7 | private void Build()
{
tinder = ps.getTinder();
sticks = ps.getSticks();
logs = ps.getLogs();
energy = ps.getEnergy();
Dialog.message("\nMaterials needed -- 5 Tinder, 6 sticks, 4 logs, and 30 energy.");
Dialog.message("Materials on hand -- " + tinder + " Tind... |
879bc2be-d7f9-49e0-b21f-5a9313430bb4 | 8 | public static long earliestLastDay(long endTime, int frequency,
long lastDay) {
if (frequency == Appointment.Frequency.ONCE)
{
return DateUtil.getStartOfDay(endTime);
} else if (lastDay == 0)
{
return Long.MAX_VALUE;
} else
{
lastDay = DateUtil.getStartOfDay(lastDay);
switch (frequency)
{
... |
ee5cb7fe-9131-4b9f-a90d-fd366e8cf01e | 4 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
String nymID = null;
if (jComboBox1.getSelectedIndex() > -1) {
nymID = ((String[]) nymMap.get((Integer) jComboBox1.getSelectedIndex()))[1];
}
System.out.println("I... |
924bd283-a6d7-42df-99bf-237f575510bc | 7 | public Elemento construir(Elemento no) {
Elemento no_a, no_b;
Random randomNumbers;
int valorCaracter;
no_b = new Elemento();
randomNumbers = new Random();
for (int i = 0; i < 10; i++) {
valorCaracter = 64 + randomNumbers.nextInt(15);
if ((valorCaracter == 65) || (valorCaracter == 69)... |
98c999be-355b-4139-981f-f2dd7582f121 | 4 | public Solve ExactAlg(){
formGraph();
HashSet<Integer> qp = new HashSet();
HashSet<Integer> qm = new HashSet();
for (int i = 0; i <size;i++)
qp.add(i);
Find(0,qp,qm);
for (HashSet<Integer> mas : sets){
for (int el : mas){
Sys... |
d9ebcbfb-5b18-40ea-a1f4-0c0530235edc | 5 | @Override
public void adjust() {
boolean enable = false;
Component comp = getFocusOwner();
if (comp instanceof JTextComponent && comp.isEnabled()) {
JTextComponent textComp = (JTextComponent) comp;
if (textComp.isEditable()) {
int selectionEnd = textComp.getSelectionEnd();
enable = textComp.getSele... |
657525b6-c8ec-4d08-ba2b-a318857cfcc5 | 3 | @SuppressWarnings("unused")
@Override
public void resetConnection() {
try {
this.comm.close();
this.comm = null;
this.comm = new NetworkCommunication(SYSTEM_TYPE, IP_ADDRESS, PORT, 0, PRIVATE_KEY, PROTOCOL_TYPE);
if (PROTOCOL_TYPE == ProtocolTypeEnum.HAI_OMNI_LINK_II) {
// Register a listener to rec... |
59fea6d1-56b1-4202-80d5-57552be57d24 | 0 | public void Listen(){ Listener.start(); } |
65d1b7ac-7556-4b75-8040-45ec4352b342 | 3 | public void method467() {
super.height = 0;
trimHeight = 0;
for (int i = 0; i < vertexCount; i++) {
int j = yVertex[i];
if (-j > super.height) {
super.height = -j;
}
if (j > trimHeight) {
trimHeight = j;
}
}
anInt1653 = (int) (Math.sqrt(anInt1650 * anInt1650 + super.height * super.heigh... |
c721cec5-010f-46c7-875b-2676200f61e7 | 2 | private void eliminarJugadorQueCedeLugar() {
for (Jugador inscripto : inscriptos) {
if(inscripto.dejaLugarAOtro()){
inscriptos.remove(inscripto);
return;
}
}
} |
576ad9dc-17cd-4a90-afa3-d4b88e318c4b | 1 | public String dekodeRC4(String result)
{
try
{
String text2Encrypt;
byte[] ciphertext1;
ab.system.libraries.security.ABSecurity.ControllEncRC4Engine s1 = new ab.system.libraries.security.ABSecurity.ControllEncRC4Engine();
text2Encrypt = result;
... |
da47b6ad-3460-4f98-adfb-2f91ce945fc0 | 9 | private static int getCountByLocation( Glacier location,
int totalPenguins,
GlacialOrder glacialOrder){
// How many penguins spawn at the glacier specified by 'location'?
// Per the rules, this depends on the GlacialOrder in a somewhat
// messy way.
if (totalPenguins == 0) return 0;
// Easy Case... |
28f68ffe-8ba9-4737-9c31-8417c9de84ed | 3 | private void initializeListeners() {
addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
if(isCtrlTabPressed(e))
selectionManager.selectNext();
if(isCtrlShiftTabPressed(e))
selectionManager.selectPrevious();
}
});
addControlListener(new ControlListener() {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.