method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
991e9206-ea84-4a93-8aec-39c4ab1701b6 | 0 | @Test
public void compareHands_HighCardHandsHaveSameCards_HandsAreEqual() {
Hand p1 = Hand.HighCard(Rank.King, Rank.Jack, Rank.Nine, Rank.Six, Rank.Five);
Hand p2 = Hand.HighCard(Rank.King, Rank.Jack, Rank.Nine, Rank.Six, Rank.Five);
assertTrue(p1.compareTo(p2) == 0);
} |
55132457-4d4c-4992-83e4-d291bf2b3e79 | 4 | private void btnExportarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExportarActionPerformed
String NombreArchivo = tfNombreArchivo.getText();
if(!NombreArchivo.equals("")){
//ORIGEN Y GRUPO NO DEBEN ESTAR VACIOS
if(selectOrigen.getSelectedIndex()!=0 || s... |
43bd3e00-2b92-4a8c-a2aa-86c8b9505c63 | 6 | private static Vector3i loadTexture(String fileName, int minFilter, int magFilter)
{
String path = "res" + File.separator + "textures" + File.separator + fileName;
try
{
System.out.println("Loading Texture: " + fileName);
BufferedImage bimg = null;
try{
bimg = ImageIO.read(new FileInput... |
d4bded43-c4ae-4f36-8eb9-c1b898bd4c5f | 9 | public void renderSprite(int xp, int yp, int scale, int color, Sprite sprite){
int size = sprite.size;
for(int y = 0; y < size * scale; y++){
int ya = y + yp;
for(int x = 0; x < size * scale; x++){
int xa = x + xp;
if(xa < 0 || ya < 0 || xa >= width || ya >= height) continue;
int col = sprite.pixe... |
d7677fa0-badf-417e-9059-7b035bd38fd3 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Ensemble other = (Ensemble) obj;
if (members == null) {
if (other.members != null)
return false;
} else if (!members.equals(other.member... |
81a5e325-fbe3-4455-bef8-f0ce824648f0 | 3 | public boolean isDone()
{
//Iterate through the list of restrictions
//Check to see if it's empty
if(restrictions.size() > 0)
{
boolean allRestrictionsDone = true;
for(int i=0; i<restrictions.size(); i++)
{
if(!restrictions.get(i).done)
allRestrictionsDone= false;
}
//If even a singl... |
6ad5fa30-cb51-4e3f-ac8e-45d6e67aaed1 | 0 | public void SetDirection(char newDirection)
{
this.direction = newDirection;
} |
9ae34278-22d7-49e2-8c8f-46e8175dda5a | 4 | public void calcFine(){
int total = 0;
int minOver = minutesParked - minutesPuchased;
int hour = minOver / 60;
int partOfHour = minOver % 60;
boolean firstTime = true;
if(hour > 0){
total += 25;
--hour;
firstTime = false;
... |
bfc73eb7-9253-4341-80e9-9f3241bfe506 | 3 | public static void loadFont(String key, String ref) {
if(fonts.get(ref) == null) {
if(fonts.isEmpty())
fonts.put("DEFAULT", new GameFont(ref));
if(!key.matches("DEFAULT")) {
fonts.put(key, new GameFont(ref));
}
}
} |
51e8b1b5-604c-47a5-aa7e-533e8b804132 | 7 | public static String toUTF8(String str){
if(str == null){
return null;
}
StringBuffer sb = new StringBuffer();
for (int i=0; i< str.length(); i++) {
char c = str.charAt(i);
if(c >= 0 && c <= 256){
sb.append(c);
}
else{
try{
byte[] b = Character.toString(c).getBytes("UTF-8");
for... |
19a2e6fe-61d3-49d6-96aa-5b7e1cc27309 | 5 | @Override
public void move() {
updateCounter = (updateCounter + 1) % (rotationSpeedLimiter - speedOfRotation);
if(!isOnScreen)
return;
y += speed;
if(y >= SpaceWarrior.HEIGHT) {
isOnScreen = false;
}
if(updateCounter % 10 == 0) {
if(currentImage == 7)
y += (height * 0.2);
currentImage = (cu... |
2bbc0c40-cd58-4c39-b342-74e43e52328d | 2 | @Override
public void run() {
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
if (this.plugin.getNCDatabase().hasHIV(player.getName())) {
EffectFactory.getInstance().applyHivEffect(player);
player.sendMessage("You have HIV.");
}
}
} |
93f48025-2677-49be-835d-75d434080df3 | 2 | public V get(Object key) {
CachedValue<V> val = cache.get((K)key);
if (val == null) {
return null;
}
if (val.isExpired()) {
cache.remove((K)key);
return null;
}
return val.get();
} |
99aa8fc6-a1fa-4162-aa2f-1ffe8b4feb47 | 0 | public CheckResultMessage checkTotal4(int i){
return checkReport1.checkTotal4(i);
} |
c98f1a94-fecc-4abd-85c2-16e235b8ab76 | 0 | @Override
public void handleProgressNotification(ProgressNotification pn) {
loading.update(pn.getProgress());
} |
875f4c10-fd71-4e89-aeaf-9136bdf413ed | 3 | public void stopPlaying()
{
try {
if(stream != null)
{
lg.logD("AudioPlayer: Try to stop the audio player with the stream: "+stream.name);
}
mainGui.setTitleForAudioPlayer(stream.name ,"",false);
outStream.write("stop\n");
outStream.flush();
if(stream != null)
{
lg.logD... |
e668bdec-35dc-4f89-8246-b2faabcbcaed | 9 | public int getValue(){
if(this.v_code.charAt(0) == 'A') return 1;
if(this.v_code.charAt(0) == '2') return 2;
if(this.v_code.charAt(0) == '3') return 3;
if(this.v_code.charAt(0) == '4') return 4;
if(this.v_code.charAt(0) == '5') return 5;
if(this.v_code.charAt(0) == '6') return 6;
if(this.v_code.charAt(0) ... |
f9d583b9-9a4c-4122-90ea-8fff10c9198e | 5 | public static void sort(int[] source) {
int len = source.length;
if (len == 0 || len == 1) {
System.out.println("\nEmpty or only one element!");
return;
}
for (int i = 0; i < source.length - 1; i++) {
int minIndex = i;
for (int j = i + 1; j < source.length; j++) {
if (source[j] < source[minIn... |
7ddf4f88-9283-4b07-b146-15a7fb478412 | 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 fe... |
5232a8f8-cf61-4f3e-9a64-181548fb4f0e | 3 | public static void main(String[] args)
{
String filename = args[0];
String delim = args[1];
StringGraph sg = new StringGraph(filename, delim);
System.out.println(filename + " : Key in your Query");
Graph G = sg.G();
while (StdIn.hasNextLine())
{
String s = StdIn.readLine();
if (sg.contains(s))
... |
b31664d4-c0c7-4588-9d65-69093c4bf304 | 6 | public String getTamanhoIntuitivo() {
final int KB = 1024;
final int MB = 1024 * 1024;
final int GB = 1024 * 1024 * 1024;
String str = new String();
double tam = tamanho;
if(tamanho < KB) {
str = Long.toString(tamanho) + " bytes";
}
else if... |
8b051108-ec8a-4f40-9e78-336f5efef275 | 6 | public static void main(String[] args) {
final String[] strings = {"7 6 5 9 8 4 3 2 1 0",
"3 2 1 0 4 5 6 7 8 9", "2 3 1 5 0 6 7 4 8 9", "0 1 2 4 3 6 5 9 8 7", "0 1 2 4 5 6 7 9 3 8"};
for (String string : strings) {
final String[] split = string.split(" ");
int[] o... |
4aec3f29-473f-4e8e-bb5d-2714eca85199 | 2 | @Override
public double escapeTime(Complex point, Complex seed) {
// Keep iterating until either n is reached or divergence is found
int i = 0;
while (point.modulusSquared() < escapeSquared && i < iterations) {
// Z(i+1) = (|ReZ(i)| * i|ImZ(i)|) + c
double newReal = M... |
6fcc2eac-8dd5-47ea-afb1-f4ded4306e11 | 0 | public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
} |
877bbb65-c550-454d-8d45-487446e1fc3e | 5 | public static void main(String[] args) {
if (args.length < 2){
System.out.println("need two args - letter and filename");
}
String letter = args[0];
String filename = args[1];
BukvoReader r = new BukvoReader(letter);
List<Word> result = r.doRead(filename);
... |
0fbce869-f21e-45bf-8f1e-d4de23f3ad66 | 5 | public static DynamicArray<String> generateSmoother(int size) {
DynamicArray<String> array = new DynamicArray();
for (int i = 0; i < size; i++) {
String line = "";
int l = 0;
for (int j = 0; j < size; j++) {
if (j < i + 4) {
line +=... |
3aa2ec9c-4d62-4a15-98a8-c5704ab97e4c | 9 | public static double phi(double z)///phi(z), see [3] P439
{
if(z<=0 || z>1)
return -1;
if(z<0.5)
return -1*phi(1-z);
for(int i=1;i<normalTable.length;i++){
if(normalTable[i-1]<=z && z<=normalTable[i]){
double n1 = 0.1*((int)(i-1)/10)+0.01*((int)(i-1)%10);
double n2 = n1 + 0.01;
if(i+1<normalTable.len... |
0837b0b3-3c43-4873-aaad-3705194ce69a | 6 | public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
if (value instanceof Boolean) {
setSelected(((Boolean)value).booleanValue());
if(column == 3) {
if(PigeonSDK.Mouse1TileID == Integer.parseInt(table.getValueAt(row, 2).toStr... |
9d03ca3c-fb70-4676-9d5d-dfcf9967596d | 1 | public Player createPlayer(int hp, int level, String name)
{
Player newPlayer = new Player(playerCanvas);
Sprite newSprite = new Sprite();
URL spriteURL = null;
try
{
spriteURL = this.getClass().getClassLoader().getResource("sprites/sprite_fr1.png");
newSprite._setSpriteImage(spriteURL);
}
catch(... |
3a760724-5fda-428d-800a-d383ddd81a62 | 2 | private static Device getDefaultDevice ()
throws IOException
{
Vector devices = getDevices ();
switch (devices.size ()) {
case 1:
return (Device) devices.elementAt (0);
case 0:
System.err.println ("no de FX2 devices");
break;
default:
System.err.println ("which FX2 device?");
list... |
46c63a80-05c9-44fc-baf5-8dbdb23c0e7b | 9 | public boolean replaceSubExpression(Expression original, Expression replacement) {
boolean found = false;
if (select == original) {
select = replacement;
found = true;
}
for (int i = 0; i < sortKeyDefinitions.length; i++) {
if (sortKeyDefinitions[i].ge... |
9067d0d9-9743-41b2-b5ae-d4fdc6dea86a | 2 | @Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
boolean isFocused, int row, int column) {
Component cell = super.getTableCellRendererComponent(table, value, isSelected, isFocused, row, column);
if (!isSelected && !isFocused) {
... |
cc8006e4-a41f-421e-838e-916830b09003 | 2 | public void setProperty(String name, String value)
{
if(!new File(PROP_FILE).exists())
{
PROP_FILE = "/usr/share/tomcat7/.jenkins/jobs/PlagiatsJaeger/workspace/WebContent/WEB-INF/classes/config.properties";
}
Properties prop = new Properties();
try
{
prop.load(new FileInputStream(PROP_FILE));
... |
e4311ad9-2c7b-40d8-9586-dc41dfa1b936 | 7 | protected String getChannelsValue(final HTTPRequest httpReq, final String index)
{
final String name=httpReq.getUrlParameter("CHANNEL_"+index+"_NAME");
final String mask=httpReq.getUrlParameter("CHANNEL_"+index+"_MASK");
final String colors=httpReq.getUrlParameter("CHANNEL_"+index+"_COLORS");
if((name!=null)&&... |
b42dcca9-dce0-4562-bd6d-e361327f7414 | 1 | private void createSong() {
try {
String title;
String artist;
String categoryId;
String filename;
System.out.println("Enter title: ");
title = Keyboard.readString();
System.out.println("Enter artist: ");
... |
8bb4cab3-df59-4455-b217-7a0a52291438 | 8 | public static void main(String[] args) {
//Initialize objects
Random randObj = new Random();
//Initialize constants
final double side = 6;
//Initialize radius and number of trials with command-line arguments
double radius = Integer.parseInt(args[0]);
int trials = Integer.parseInt(args[1]);
//Choose li... |
2240d7c0-379a-4c4e-96ae-3351edbded86 | 5 | @Override
public void keyPressed(int i, char c) {
if (i == Input.KEY_DOWN){
selection++;
} else if (i == Input.KEY_UP){
selection--;
} else if (i == Input.KEY_ENTER) {
MenuButton.buttonAction(selection, container, menu);
}
if (sel... |
8146d073-6214-4a17-9bcb-65f3621927f8 | 7 | public void stateChanged(ChangeEvent e) {
final JSlider source = (JSlider)e.getSource();
if (e.getSource() == sliderLaser1 && ready) {
valueSliderLaser1 = (int)source.getValue();
labelSliderLaser1.setText("Power L1 : " + valueSliderLaser1 + " %");
process.laserManu(valueSliderLaser... |
02fd68f3-9bc7-4f4a-8496-5f48b6f772f6 | 4 | private void awaitAsyncRollback(Future<?> async) throws ProcessRollbackException {
try {
async.get();
} catch (ExecutionException ex) {
// thread returned an exception
if (ex.getCause() instanceof ProcessRollbackException) {
throw (ProcessRollbackException) ex.getCause();
}
} catch (Exception ex)... |
f2039473-18ad-4c1e-8811-fc34e027bc30 | 4 | public boolean prompt() {
System.out.print("Would you like to begin a new adventure? <y/n>\n==========================================\n You:");
BufferedReader input =
new BufferedReader( new InputStreamReader(System.in) );
String response = "";
//Reads input. If response is not y or n, ask again.
try {
... |
2b25de44-fc7a-4fa4-8959-9290b1d227c0 | 2 | private void findfocus() {
/* XXX: Might need to check subwidgets recursively */
focused = null;
for (Widget w = lchild; w != null; w = w.prev) {
if (w.autofocus) {
focused = w;
focused.hasfocus = true;
w.gotfocus();
break;
}
}
} |
bf92017c-6c04-41de-96ac-f2d5ff3ec5b7 | 9 | public float getRightAngleOrientation() {
float theta = getOrientation();
float pi = (float)Math.PI;
if (theta > 2 * pi) theta -= 2 * pi;
if (theta >= 0 && theta < pi * 0.25) {
return 0;
} else if (theta >= pi * 0.25 && theta < pi * 0.75) {
return pi * 0.5f;
} else if (theta >= pi * 0.75 && theta < pi... |
15c60d88-eaa1-45e3-872f-8b2fc2adbf6b | 0 | public String getName() {
return name;
} |
d20d1e65-1f95-4dd5-aeee-ff97fc434912 | 5 | @Override
public boolean containsKey(K key) {
if (key == null) {
return false;
}
for (Entry entry : this.array) {
if (entry != null && key.equals(entry.key) && !entry.isDeleted) {
return true;
}
}
return false;
} |
e929ebe9-ac1b-42b6-9674-b29468676dad | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
OrderItem other = (OrderItem) obj;
if (count != other.count)
return false;
if (id != other.id)
return false;
if (item == null) {
if ... |
6d2af663-b04e-4507-904e-735575025a97 | 6 | private void agregarAnuncio(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_agregarAnuncio
cal.add(Calendar.DATE, Integer.parseInt(jComboBox2.getSelectedItem().toString().replace(" días", "")));
boolean nuevo = true;
if (buttonGroup2.getSelection() == jRadioButton4) {
nuevo = fals... |
32154197-d3be-44c1-a875-e796f2c8d2a3 | 0 | public UnrestrictedTreeNode(String text) {
super(text);
this.text = text;
} |
c534cd20-06fe-4baf-b6cc-3a1a52397fd9 | 7 | public void actionPerformed(ActionEvent event) {
Object target = event.getSource();
if (target == fJoinButton || target == fDeleteButton || target == fRoomName) {
if (fRoomName.getText().length() > 0) {
setVisible(false);
if (fJoinButton != null)
... |
204f41d6-7936-4d81-9035-4b90f4cd7f61 | 8 | public int compare(String o1, String o2)
{
String s1 = (String)o1;
String s2 = (String)o2;
int thisMarker = 0;
int thatMarker = 0;
int s1Length = s1.length();
int s2Length = s2.length();
while (thisMarker < s1Length && thatMarker < s2Length)
{
... |
64434aed-93e0-4c6f-ae57-c2ec0723d1a6 | 5 | public static String getTokenName(int tokenType) {
// Get all the fields of the lexical analyser - will be the token type
// variables
Field[] fields = EsperLexer.class.getFields();
// Iterate through the fields
for (Field field : fields) {
if (field.getType() == int.class) {
try {
// If the fiel... |
797cbc7b-893b-4b1a-9985-eed7c8e29881 | 7 | public boolean logIn() throws UnknownHostException, IOException {
String message;
String total = "";
@SuppressWarnings("resource")
Scanner us = new Scanner(System.in);
try {
String userInput;
System.out.print("Username: ");
String userSend = us.next();
out.println(userSend);
System.out.print(... |
e00af5c7-a4fa-4ec8-b9e1-6807afe829d3 | 2 | public ArrayList<String> traerListaDeptos(int codEdif){
conn = Conector.conectorBd();
String sql = "select * from departamento where codedi="+codEdif+"";
try {
pst = conn.prepareStatement(sql);
ArrayList<String> ls = new ArrayList<String>();
... |
20cc4887-ff52-4423-a4cb-89bab2416acb | 3 | public void setValues(String[] itemInfo) {
if (labels == null) return;
if (values == null)
values = new String[labels.length];
int numItems = Math.min(values.length, itemInfo.length);
for(int i = 0; i < numItems; i++) {
values[i] = itemInfo[i];
}
} |
c2cbe923-b369-4825-81cc-9d4e319ce94f | 3 | public Configuration loadEmbeddedConfig(final String resource) {
final YamlConfiguration config = new YamlConfiguration();
final InputStream defaults = this.getResource(resource);
if (defaults == null) return config;
final InputStreamReader reader = new InputStreamReader(defaults, Custo... |
f5424490-504f-4e0e-a30e-9ecc8bf17984 | 6 | @Override
public void mouseEntered(MouseEvent e) {
if(e.getSource()==recordBut){
recordBut.setIcon(recordOverIcon);
}else if(e.getSource()==playBut){
playBut.setIcon(playOverIcon);
}else if(e.getSource()==stopBut){
stopBut.setIcon(stopOverIcon);
}else if(e.getSource()==saveBut){
saveBut.setIcon(sav... |
935da9c1-e747-469b-aa1c-c8131956ca6f | 9 | private static SpeechNBestList buildSpeechNBestList(List<String> correctSentence, BufferedReader wordReader, BufferedReader scoreReader, Set vocabulary) throws IOException {
List<Double> scoreList = readScores(scoreReader);
List<List<String>> sentenceList = readSentences(wordReader);
List<List<String>... |
0e04cafc-0a37-4ed4-bee6-d6686b51d1b9 | 0 | public int getChannelAccess()
{
return channelAccess;
} |
7bee7e4c-6491-498e-8523-bae35ad9bea5 | 1 | private boolean checkCardForUnique (String motherLangWord, String translation) throws SQLException {
Connection conn = null;
ResultSet resSet = null;
try {
conn = DriverManager.getConnection(Utils.DB_URL);
PreparedStatement pStat = conn.prepareStatement("SELECT id FROM wo... |
311561b0-66fe-49f9-b8ae-965e027c58a0 | 0 | public static void main(String[] args) throws IOException {
loadFromFile();
writeToFile(Scheduler.getUsers().values());
} |
ede928fe-ff68-4ebe-a77d-89b02b941aee | 8 | public void DFS(int[] state, int m, int n) {
if (state[0] == m-1 && state[1] == n-1) {
pathcount++;
return;
} else if (state[0] == m) {
return;
} else if (state[1] == n) {
return;
} else if (state[0] == m-1 && state[1] < n-1) {
... |
50085af2-14ae-4cf1-8b97-be4bcbbf7ee9 | 7 | void readZrlePackedPixels(int tw, int th, int[] palette, int palSize)
throws Exception {
int bppp = ((palSize > 16) ? 8 : ((palSize > 4) ? 4
: ((palSize > 2) ? 2 : 1)));
int ptr = 0;
for (int i = 0; i < th; i++) {
int eol = ptr + tw;
int b = 0;
int nbits = 0;
while (ptr < eol) {
if (nbit... |
7717d981-04dd-4533-9c89-3d659326f99e | 0 | public GUISignup() {
setResizable(false);
portServer = 2223;
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 378, 249);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
txtUserName = new JText... |
5def91b8-db60-4043-82dd-1c9db873b3ac | 5 | private void removeDropTransfer(Transfer transfer){
if (dropTypes.length == 1) {
dropTypes = new Transfer[0];
} else {
int index = -1;
for(int i = 0; i < dropTypes.length; i++) {
if (dropTypes[i] == transfer) {
index = i;
break;
}
}
if (index == -1) return;
Transfer[] newTypes = new Transfer... |
d495c49c-4ada-4ca4-99e0-f8e0353d2944 | 3 | public static void main(String[] args) {
for (String input : Arrays.asList("0", "50", "-10", "1000", "x", null)) {
String output;
try {
Integer out = LIMIT_FIELD.validate(input);
output = out == null ? null : out.toString();
} catch (ValidationException e) {
output = "ERRO... |
1e8d9fd8-d76a-45e6-817f-02b6a29eb802 | 5 | public void print_resultSet(ResultSet rs){
if (rs != null){
ResultSetMetaData md = null;
int nombreColumns = 0;
try {
md = rs.getMetaData();
nombreColumns = md.getColumnCount();
String[] nomColumns = new String[nombreColumns];
... |
bff7b1ab-e421-4ded-a0f8-f8ca8ff94e76 | 3 | public PastMeeting getPastMeeting(int id) {
PastMeeting returner = null;
for (int i = 0; i < pastMeetingList.size(); i++) {
if (pastMeetingList.get(i).getID() == id) {
returner = (PastMeeting) pastMeetingList.get(i);
}
}
if (returner == null) {
System.out.println("There is no such past meeting")... |
f0a10ba4-50ce-4043-870c-a8236aafe825 | 9 | public void tick(World w)
{
if(life <= 0)
return;
if(vel.x > this.maxPositiveVX)
{
vel.x = this.maxPositiveVX;
}
if(vel.x < this.maxNegativeVX)
{
vel.x = this.maxNegativeVX;
}
if(vel.y > this.maxPositiveVY)
... |
5dc97df4-2ec9-44c3-b2e6-21bfdccb4192 | 2 | public void writeMap(String fn) throws IOException {
FileOutputStream fout = new FileOutputStream(fn);
DataOutputStream out = new DataOutputStream(fout);
out.writeInt(_map[0].length-1);
out.writeInt(_map.length-1);
out.writeFloat(_map.length-1);
out.writeFloat(_map[0].length-1);
out.writeFloat(_map.length... |
44e2b47b-d4cc-4145-8d0f-7715fc25196e | 1 | public UserFollowers get(Integer key) {
UserFollowers res = hashMap.get(key);
if (res == null)
missCnt.incrementAndGet();
total.incrementAndGet();
return res;
} |
bf7769bd-5b9b-45f9-9fa8-ce807a66a527 | 9 | public String toString()
{
final StringBuilder sql = new StringBuilder(1024);
// first off if there are no entries in the where column list AND
// there is NO additional freeform where clause short circuit the logic
// and just return an empty string since there is nothing to proces... |
6304d4f7-bdb4-4d59-8a00-dc350a29988c | 9 | public String format(String pattern) {
SimpleDateFormat parser;
String buffer;
String temp;
int n;
if(pattern == null) return "Invalid pattern";
if(pattern.charAt(0) == 'B') { // Special case - binary seconds from reference year
int year;
long seconds;
long milli;
long diff;
if... |
89b83c65-991a-44bc-8a94-8022861cba98 | 6 | public final Pino etsiPolku(int alkuX, int alkuY, int loppuX, int loppuY) {
kaymattomatNoodit = new Keko(11);
kaydytNoodit = new LinkedList<T>();
kaymattomatNoodit.lisaa(noodit[alkuX][alkuY]);
valmis = false;
T valittu;
while (!valmis) {
/** Ha... |
1b148e15-f547-48b2-8580-59e203d773f3 | 3 | @Override
public void addWord(String s) {
// Equivalent of rho function
int nbTrailingZeros = Integer.numberOfTrailingZeros(func.hashString(s));
// Consider only words whose hash value begins with more than b zeros.
if (nbTrailingZeros >= b) {
LinkedList<Occurrence> l = strTab.get(nb... |
9adb8feb-04b3-489e-a724-97488d61ab58 | 8 | private boolean r_factive() {
int among_var;
// (, line 132
// [, line 133
ket = cursor;
// substring, line 133
among_var = find_among_b(a_7, 2);
if (among_var == 0)
{
... |
83c19a66-2c32-4112-8201-c062b9deaf2b | 3 | public void keyPressed(int key, char c){
if(key == Input.KEY_UP){
startMenu.movePointer(Utility.Direction.UP);
}else if(key == Input.KEY_DOWN){
startMenu.movePointer(Utility.Direction.DOWN);
}else if(key == Input.KEY_ENTER){
startMenu.performAction();
}
} |
86c2a917-152f-4419-8267-7495bf836220 | 4 | private boolean isConnectedTo(LightTrailPart that) {
final List<LightTrailPart> lightTrailParts = lightTrail.getLightTrailParts();
final int index = lightTrailParts.indexOf(this);
if ((index > 0 && lightTrailParts.get(index - 1).equals(that)) || (index < lightTrailParts.size() - 1 && lightTrailParts.get(index + 1... |
79520e6b-65a8-454a-b0d9-f35ba96189dc | 5 | public final synchronized void mouseReleased(MouseEvent mouseevent) {
anInt7428++;
int button = getMouseButton(mouseevent);
if ((button & buttonMask ^ 0xffffffff) == -1)
button = buttonMask;
if ((button & 0x1 ^ 0xffffffff) != -1)
addEvent(3, mouseevent.getY(), mouseevent.getX(), mouseevent.getClickCount()... |
af45183a-0a31-4a42-8541-41252e970a2d | 9 | private static int decodeByte(byte b) {
if (b >= 'A' && b <= 'Z') {
return b - 'A';
} else if (b >= 'a' && b <= 'z') {
return b - 'a' + 26;
} else if (b >= '0' && b <= '9') {
return b - '0' + 52;
} else if (b == '+') {
return 62;
} ... |
aa71ba57-c35b-4a28-84a1-919a000a5ac4 | 8 | public void put(Telegram telegram) throws InterruptedException {
if(_closed) return;
final int length = telegram.getSize();
if(length <= 0) throw new IllegalArgumentException("Telegrammlänge muss größer 0 sein, ist aber " + length + ": " + telegram);
final byte priority = telegram.getPriority();
synchronized(... |
c6611f86-ea90-4d81-9f49-1b336f8a811a | 8 | protected void alterneigh(int rad, int i, int b, int g, int r) {
int j, k, lo, hi, a, m;
int[] p;
lo = i - rad;
if (lo < -1)
lo = -1;
hi = i + rad;
if (hi > netsize)
hi = netsize;
j = i + 1;
k = i - 1;
m = 1;
while ((j < hi) || (k > lo)) {
a = radpower[m++];
if (j < hi) {
p = netw... |
51fbef39-92e9-4745-b9ec-91c835a7eeda | 2 | public SignatureVisitor visitInterface() {
if (state != SUPER) {
throw new IllegalStateException();
}
SignatureVisitor v = sv == null ? null : sv.visitInterface();
return new CheckSignatureAdapter(TYPE_SIGNATURE, v);
} |
2e39b148-cad5-465e-b53f-4d5ba20f7ed8 | 6 | public static int getPort(String vncServerName) {
int colonPos = vncServerName.lastIndexOf(':');
while (colonPos > 0 && vncServerName.charAt(colonPos - 1) == ':')
colonPos--;
if (colonPos == -1 || colonPos == vncServerName.length() - 1)
return 5900;
if (vncServerName.charAt(colonPos + 1) == ... |
79a33c3b-589b-4893-a3e4-2bd214afce77 | 6 | public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
config = plugin.getConfig();
if (args.length == 1 ){
if (sender instanceof Player) {
if (sender.hasPermission("darkcommand.bitchslap")){
if (commandLabel.equalsIgnoreCase("bitchslap")){
Player player ... |
2fcfa530-3c31-4837-812b-bac9939a393a | 6 | public static void main(String[] args) {
int op;
do{
System.out.println("1- Agregar plan");
System.out.println("2- Pagar");
System.out.println("3- Editar Email");
System.out.println("4- Agregar Amigo");
System.out.println(... |
afffe626-b8fd-4689-a213-6d74f4aded29 | 4 | public byte getTileID(int x, int y) {
if (x < 0 | x >= getWidth()) {
return LevelTexture.CENTER;
} else if (y < 0) {
return LevelTexture.AIR;
} else if (y >= getHeight()) {
if (tileSet[x][getHeight() - 1] == LevelTexture.AIR) {
return tileSet[x][0];
} else {
return LevelTexture.CENTER;
}
... |
00ead177-010a-41b9-994b-cb04781b4c78 | 5 | public void createControlPanel(Composite parent) {
super.createControlPanel(parent);
if (nextNumber < 1)
nextNumber = startNumber;
// add selection listener to reset nextNumber after
// the sequence has completed
playItem.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event)... |
e1a13662-f605-42f8-b830-9d3b8bfeae49 | 7 | @SuppressWarnings("unchecked")
public void handle(HttpExchange exchange) throws IOException {
long start = System.currentTimeMillis();
Map<String, Object> params = (Map<String, Object>)exchange.getAttribute("parameters");
Map<String, String[]> headers = (Map<String,String[]>)exchange.getAttribute("headers");
S... |
6f947901-e7d1-4052-ae05-454e34e5c890 | 1 | public Integer[] nextIntArray() throws Exception {
String[] line = reader.readLine().trim().split(" ");
Integer[] out = new Integer[line.length];
for (int i = 0; i < line.length; i++) {
out[i] = Integer.valueOf(line[i]);
}
return out;
} |
378a2e8a-5d88-446c-abc3-56e4b3f86d93 | 7 | public void printAmbiguousTemporalConclusions(Map<Literal, TreeMap<Temporal, Map<ConclusionType, Set<String>>>> conclusions[]) {
if (null == conclusions) return;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < conclusions.length; i++) {
String str = getAmbiguousTemporalConclusionString("ambiguous t... |
61c9fd2e-b90c-457d-9048-85bf551ecb58 | 4 | public int getTileID(int x, int y){
if(x < 0 || y < 0 || x >= worldWidth || y >= worldHeight) return -1;
return mapData.get((y * worldWidth) + x);
} |
b2d6009b-20c3-4458-ac94-b82af26089e1 | 1 | public void visit_dneg(final Instruction inst) {
stackHeight -= 2;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 2;
} |
767fcbe7-fcb2-453c-a4eb-85fcd1955231 | 0 | public Logon(String name, String pwd) {
username = name;
password = pwd;
} |
c63ad26b-3d3e-4a77-bed2-d1a1ea04e3ab | 8 | private void IntervenantsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_IntervenantsActionPerformed
// TODO add your handling code here:
switch(etat){
case Debut:
donner1.frame_Intervenant();
this.donner1.setVisible(true);
... |
0c335478-3b99-4007-9d7f-dfe4d16a666f | 1 | public boolean offer(Position p){
boolean notfull = super.offer(p);
if (notfull){
this.clear();
super.offer(p);
}
return true;
} |
9c8e9c58-79ac-4cb9-9a3d-c99887138f07 | 8 | final public Temporal temporalStamp() throws ParseException {
Token startNegation=null, endNegation=null;
Token startTime=null,endTime=null;
Token negInf=null;
jj_consume_token(TEMPORAL_START);
if (jj_2_35(7)) {
if (jj_2_34(7)) {
startNegation = jj_consume_token(MINUS);
} else {
;... |
0c0ea336-bc52-461f-88a3-d43d7d9c5ccc | 5 | public ISOCountry( String id2, String id3, String shortName, String ext )
{
if ( id2 != null )
{
iso = id2.toUpperCase() ; // 2 letter iso
}
else
{
iso = "" ;
}
iso3 = id3 ; // 3 letter iso
name = shortName ;
if ( ext == null )
{
extension = "" ;
}
... |
b266a0ee-89c1-4548-9c34-46cf526bdfb9 | 0 | public static SettingsDialog getInstance()
{
return instance;
} |
a828632e-fa5d-468a-abb7-d27d7ae5bf5f | 0 | public GregorianCalendar getDate() {
return date;
} |
f4924e6b-7019-43df-8d83-c27e870c3578 | 1 | public void checkProduction(Production production) {
if (!ProductionChecker.isRestrictedOnLHS(production)){
javax.swing.JOptionPane.showMessageDialog(null,
"Your production is unrestricted on the left hand side.");
throw new IllegalArgumentException(
"The production is unrestri... |
8a7bb7ed-4d29-42db-9bee-142512e4ba59 | 6 | @CanReturnNull
public static Command getCommandByName(String commandName)
{
Command toRet = null;
ArrayList<Class<?>> availableCommands = (ArrayList<Class<?>>) ReflectionHelper.getCommandClasses();
for(Class<?> comm:availableCommands)
{
try
{
Command currComm = (Command)comm.newInstance();
if(cu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.