method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
2d0bfff2-b14a-4444-84f6-35191cf02c9c | 8 | public String register(String username, String password, String name,
String creditCard, String address, String phone) throws SQLException {
if (username.isEmpty()) {
return "Please enter a username.";
}
if (password.isEmpty()) {
return "Please enter a password.";
}
PreparedSt... |
92e5cfa3-3010-4549-bfeb-0e33279b5b11 | 7 | private String getMetricsLink(String taskDetailsJsp, boolean isMapper) {
Document mapDetails = HtmlFetcher.getHtml(taskDetailsJsp);
Element tr = null;
if(useHistory) {
tr = mapDetails.getElementsByTag("tbody").first().child(1);
}
else {
for(Element elem : mapDetails.getElementsByTag("tbody").firs... |
9d0c3c9c-95df-4266-a8a4-b09f556467bd | 5 | public String multiply(String num1, String num2) {
int l1 = num1.length();
int l2 = num2.length();
char [] res = new char[l1+l2];
Arrays.fill(res, '0');
for(int i = l2 - 1; i >= 0; --i){
int carry = 0;
int n2 = num2.charAt(i) - '0';
int j = l1... |
ac437e0c-e7a9-4411-964b-25e9dd846a36 | 0 | public Long getId() {
return delegate.getId();
} |
6bd8e427-ec56-4694-bbdf-42d197fc5097 | 7 | public void finishGame(final GameResult pGameResult) {
ScreenManager.getInstance().getBaseGameActivity().getEngine().registerUpdateHandler(new TimerHandler(0.5f, new ITimerCallback() {
@Override
public void onTimePassed(TimerHandler pTimerHandler) {
ScreenManager.getInst... |
5e725307-dfad-465e-b00a-854f698664e8 | 8 | @SuppressWarnings("unchecked")
public static <T> T[] toArray(String string, T[] a) {
if (string.length() == 0) {
return a;
}
String[] stringObjs = string.replace(";;", "\u1024").split(";");
T[] r = a;
if (stringObjs.length > r.length) {
r = (T[]) Array.newInstance(a.getClass().getComponentType(),
... |
c317e596-2a24-4e4c-9a90-55e86652cf7a | 2 | @Override
public void setValueAt(Object uusi, int rivi, int sarake) {
if (sarake >= 0 && sarake < sarakeNimet.length)
{
henkilolista.paivita(uusi, rivi, sarake);
// ilmoittaa datan muutoksesta JTable-komponentille
fireTableCellUpdated(rivi, sarake);
... |
dfe10cb8-e9f5-4979-8065-bfe0bf002294 | 6 | public CreateInvoiceResponse(Map<String, String> map, String prefix) {
if( map.containsKey(prefix + "responseEnvelope" + ".timestamp") ) {
String newPrefix = prefix + "responseEnvelope" + '.';
this.responseEnvelope = new ResponseEnvelope(map, newPrefix);
}
if( map.containsKey(prefix + "invoiceID") ) {
... |
a9ae6ef5-29bb-47bc-b6c4-7d761195bdff | 1 | public void testForFields_null() {
try {
ISODateTimeFormat.forFields((Collection) null, true, true);
fail();
} catch (IllegalArgumentException ex) {}
} |
d1a54fbd-3dfc-4dbf-8131-e056f6b95bd7 | 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... |
06b109eb-4753-4b62-8987-f150f122fdd6 | 4 | private Method[] setters(String fieldName) {
String set = "set" + Strings.capitalize(fieldName);
List<Method> setters = new LinkedList<Method>();
for (Method m : clazz.getMethods()) {
if (!Modifier.isStatic(m.getModifiers()) && m.getParameterTypes().length == 1 && m.getName().equals(set)) {
setters.add(m)... |
eb9c0610-06bc-49d2-bc56-e30277cec13d | 0 | public static void main(String[] args) {
// Working with Objects, Classes, and Methods
String myString = "This is a string";
int lenght = myString.length();
System.out.println(lenght);
} |
90a71c07-d4cf-4fc6-a270-1b16ca7e1196 | 2 | private String convert(String input) {
String[] temp = input.split(":");
Integer hour = Integer.parseInt(temp[0]);
String minute = temp[1];
if (hour > 12) {
// pm
return (hour - 12) + ":" + minute + " PM";
} else {
return (hour.equals(0) ? "12... |
d739fe9d-2c51-4bcc-a32b-320b965b6602 | 1 | @Override
public void setCorrectAnswer() {
int numberOfAnswers = InputHandler.getInt("How many answers are correct? ");
for (int i=0; i<numberOfAnswers; i++){
answers.add(InputHandler.getString("Enter a correct choice: "));
}
} |
45971710-979a-44a8-9421-53dd1a7275c8 | 8 | @Override
public int addValue(int value) {
for (Entity e : getBodyParts())
value = e.addValue(value);
if (value > 0) {
value -= 50;
Vector<Entity> fats = getBodyParts();
Entity last = fats.get(fats.size() - 1);
if (fats.size() < MAX_FATS) {
Fat fat = new Fat();
fat.setAngle(last.getAngle());
fat.s... |
b06f1e57-426c-41c1-a9a8-7785847d0fa7 | 0 | public String getTerminalID() {
return terminalID;
} |
31e5f4f0-d8c4-4f5b-ae29-7a5888cc9b9c | 8 | private byte[] take(int indexOfStream) {
// Es werden soviele Nutzdaten angefordert, bis <code>_bufferSizeStream</code> erreicht wird, dann wird
// das große Paket (mit den vielen kleinen Nutzdatenpaketen als Inhalt) verschickt.
// Hier werden alle Informationen für das große Paket gespeichert. Dies wird später... |
0fe5f36c-dc74-4392-94dd-ec6b6ca00514 | 7 | public void izvrsi(HttpServletRequest req, HttpServletResponse res){
KorisnikBean kb=(KorisnikBean)session.getAttribute("korisnik");
try{
ArrayList<ProizvodBean> proizvodi=(ArrayList<ProizvodBean>)session.getAttribute("proizvodi");
for(int i=0;i<proizvodi.size();i++){
... |
8b85361f-aac9-4263-bfa0-f2e2f5c91197 | 0 | public ContactIterator(Iterator<T> s1, Iterator<T> s2)
{
this._s1 = s1;
this._s2 = s2;
} |
5c48a6a6-63ef-42ea-a101-1abcc327d065 | 5 | private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException {
boolean isValueNumeric = false;
try {
if (value.equals("0") || !value.endsWith("0")) {
Double.parseDouble(value);
isValueNumeric = true;
... |
6f3ce739-d7db-42be-b929-23bfc61659bb | 1 | @Override
public void draw(Graphics2D gc, TreePanel panel, TreeRow row, int position, int top, int left, int width, boolean selected, boolean active) {
left += HMARGIN;
width -= HMARGIN + HMARGIN;
StdImage icon = getIcon(row);
if (icon != null) {
gc.drawImage(icon, left, top + VMARGIN, null);
int iconSiz... |
0001c7ec-7d87-49c0-9d11-9f3c1c79cd3f | 6 | private static Point getCornerPoint(Corner cor, int width, int length) {
final int mw = width - (width % 2 == 0 ? 1 : 0);
final int ml = length - (length % 2 == 0 ? 1 : 0);
Point p;
switch (cor) {
case NE:
p = new Point(1, 1);
break;
... |
a2b1cf16-9e5a-44c0-9755-ded162879a5e | 0 | @Override
public boolean getScrollableTracksViewportHeight() {
//System.out.println("getScrollableTracksViewportHeight");
return false;
} |
e125dd54-5919-4b64-b809-37e75425001c | 1 | private int hash(String input) {
int output = 0;
for(int i = 0; i < input.length(); i++) {
output += (int)input.charAt(i);
}
output %= this.size;
return output;
} |
9c28f7a8-dbdb-4330-9503-ec8a88e8d2fc | 1 | public T completeStylesWith(Element<?> element) {
Map<String, String> elementStyles = element.getStyles();
getStyles().putAll(elementStyles);
return (T)this;
} |
568f3a3b-ac05-4f3d-b67f-7f195558f216 | 1 | public AutomatonDrawer(Automaton automaton) {
this.automaton = automaton;
DrawerListener listener = new DrawerListener();
getAutomaton().addStateListener(listener);
getAutomaton().addTransitionListener(listener);
/*
* Use a moore state drawer if it is a Moore machine.
* This d... |
56244cf9-7ac5-4a34-9bf7-32ce47b4d9d5 | 4 | private void createAsteroids(Dimension size) {
// the center region is used to restrict asteroid positions
// they can not be added to the center region
// because that is where the ship is located
MoveableObject noGoRegion = new MoveableObject();
noGoRegion.width = size.width / (difficultyFactor + 1);
noGo... |
82f3f821-d099-427e-b706-7c2a6ede7e21 | 8 | public void propertyChange(PropertyChangeEvent evt) {
Object source = evt.getSource();
if (source instanceof JFormattedTextField
&& evt.getPropertyName().equals("value")
&& (((JFormattedTextField) evt.getSource()).getValue() != null)) {
Number newValue = null;
Number value ... |
1179a97d-d277-4fdc-9e89-de491030c5fd | 8 | int[] inc() {
if (k < 1 || k > n) {
return null;
}
if (indices[k - 1] == n - 1) {
int i;
for (i = k - 2; i >= 0; i--) {
if (indices[i] + 1 < indices[i + 1]) {
++indices[i++];
while (i < k) {
... |
8c438c5f-92f0-4dd3-bf65-30962fdafbbe | 2 | @Override
public void desconexion() throws Exception {
try {
if (oConexionMySQL != null) {
oConexionMySQL.close();
}
} catch (SQLException e) {
throw new Exception("MySQL.CerrarConexion: Error al cerrar la conexion" + e.getMessage());
}
... |
e446a5ab-d382-4b93-b69e-ab937250d2cb | 8 | public void cleanCursors( boolean force ){
int sz = _deadCursorIds.size();
if ( sz == 0 || ( ! force && sz < NUM_CURSORS_BEFORE_KILL))
return;
Bytes.LOGGER.info( "going to kill cursors : " + sz );
Map<ServerAddress,List<Long>> m = new HashMap<ServerAddress,List<Long>>();
... |
b67f094a-0c86-450d-b621-20287b502fa6 | 9 | public static TribeRank getRank(int code) {
if (code == 1) {
return Cooker;
}
if (code == 2) {
return Soldier;
}
if (code == 3) {
return Treasurer;
}
... |
51e5a374-e156-45a7-8fb1-eb1f078a275f | 9 | public static boolean checkPlusAssign(Type p1, Type p2) {
if (p1 == null || p2 == null) {
return false;
}
return p1 == Type.Fixed && p2 == Type.Integer || p1 == Type.Fixed && p2 == Type.Fixed || p1 == Type.Integer && p2 == Type.Integer || p1 == Type.String && p2 == Type.String;
} |
89e3d4c8-678b-4609-a98a-c1e3fe2535b0 | 4 | private boolean checkValid(String command, String method) {
if(command.isEmpty()) {
Bukkit.getLogger().warning("[CommandHelper] No command supplied for the method " + method);
return false;
} else if(commandLookup.contains(command)) {
Bukkit.getLogger().warning("[CommandHelper] Method " + method+ " tried t... |
4c47eb84-8343-4969-a8f5-be643db36b4a | 0 | public int getA_data(){
return a_data;
} |
8651323d-bf9e-4c6f-bbaa-9ed48514dfe8 | 3 | public static void moviesToFile(String infilename, String outfilename) {
File file = new File(outfilename);
String str = readData(infilename);
FileWriter fw = null;
try {
fw = new FileWriter(file);
fw.append(str);
fw.flush();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (fw !... |
3aea4ba5-0a55-4e73-81eb-68203cbc39ad | 1 | public void run() {
System.out.println("Starting at " + c.getCount());
for (int i = 0; i < 1000; i++) {c.increase();}
System.out.println("Stopping at " + c.getCount());
}
}
class Counter {
private int n = 0;
public void increase() {
n++;
}
public i... |
277fa8b0-2fa2-46d4-8921-d9a521286b8f | 5 | public void analisiPedinaBianca(boolean tur) //controlla le mosse semplici per i pezzi bianchi.
{
boolean vicini=false;
try
{
if(damiera.getPosizione(riga-1, colonna+1).vuota())
listaMosse.add(new Mossa(damiera.getPosizione(riga, colonna), damiera.getPosizione(riga-1, colonna+1), null, 0));
else
... |
e6f921c0-2959-4c83-b5ce-e6bcf8098caa | 1 | public SignatureVisitor visitParameterType() {
endFormals();
if (seenParameter) {
declaration.append(", ");
} else {
seenParameter = true;
declaration.append('(');
}
startType();
return this;
} |
675dd0b3-7ba5-4698-80b7-16aa5b6dd562 | 2 | public void setValueTable(JTable table, int[][] data) {
for (int i = 0; i < data.length; i++) {
for (int j = 1; j < data[0].length; j++) {
table.setValueAt(data[i][j-1], i, j);
}
}
} |
5fb48d06-90be-475c-b667-a566f1bdd2ee | 8 | private void exitActionPerformed(java.awt.event.ActionEvent evt) {
if (size14.isSelected()) {
Maze.gridSize = 14;
Maze.afterChoose();
this.dispose();
} else if(size19.isSelected()) {
Maze.gridSize = 19;
Maze.afterChoose();
this.dispose();
} else if(size20.isSelected()) {
Maze.gridSize = 20;
... |
17c1790e-3b7b-4a8d-af28-8bb3eb9bb929 | 3 | public static void main(String[] args) {
ListNode node1 = new ListNode(1);
ListNode node = node1;
for(int i=2;i< 10;i++){
node.next = new ListNode(i);
node = node.next;
}
node = node1;
while(node != null){
System.out.print(" " +node.... |
3b41a64d-1518-49a8-b3f7-07a7e4a4b675 | 2 | public static boolean invokeRemote(InetAddress ip, String session){
try {
Socket s = new Socket();
s.setReuseAddress(true);
s.setSoLinger(true, 0);
s.bind(null);
s.connect(new InetSocketAddress(ip,DefaultNetworkVariables.DEFAULT_FTP_PORT));
InputStream is = s.getInputStream();
OutputStream os... |
1559e2cf-358e-4800-a300-4e6a1572151c | 2 | public void appendToFile(Object d, Object c) {
if (file == null) return;
try(PrintWriter output = new PrintWriter(new FileWriter(file, true)))
{
output.printf("%s\r\n", d);
output.printf("%s\r\n", c);
}
catch (Exception e) {}
} |
6c34f2ef-7f92-4aa1-8a7e-177c7ad2c5ea | 6 | public boolean action(Event e, Object o) {
if (e.target == ok) {
hide();
dispose();
}
return true;
} |
9106613b-e477-4209-ae98-d13be20a7866 | 6 | public static void startupKifOut() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$, ((Modul... |
4f966273-779b-43b2-9b97-ce8e659ccac5 | 1 | public FileType addTagConfig(Class<? extends MediaTag> tagNodeClass,MediaProperty tagProp,String tagOpt) {
this.tagInfo.add(new TagConfig(tagNodeClass,tagProp,tagOpt));
return this;
} |
b9d89220-3d2c-41b0-9f92-8ba451ec887a | 5 | final String method1561(String string, int i, int i_36_) {
try {
anInt2751++;
if (((ItemDefinition) this).aClass356_2757 == null)
return string;
if (i_36_ != -1511086397)
method1569(25, null);
StringNode class348_sub50
= ((StringNode)
((ItemDefinition) this).aClass356_2757
.get(... |
498329f7-8afd-4ad3-bc47-e08115d163cd | 6 | @Override
public boolean execute(RuleExecutorParam param) {
Rule rule = param.getRule();
List<String> values = Util.getValue(param, rule);
if (values == null || values.isEmpty()) {
return false;
}
boolean retValue = true;
for (String value : values) {
String compareValue = rule.getValue();
if (rul... |
8f3e0262-b7a7-47f3-ad7d-42e7bc70bbb2 | 6 | public int getResult() {
this.toPostfix();
Stack<Element> tempStack = new Stack<Element>();
for (Element e : elements) {
if (e.type == Element.TYPE_NUMBER) {
tempStack.push(e);
} else {
Element tempElement;
int rightValue = tempStack.pop().value;
int leftValue = tempStack.pop().va... |
66809f05-02ea-49a3-9e75-e46fa52e27c9 | 1 | public void inject(Packet p) { // Injects the poison on the network
try {
sender = JpcapSender.openDevice(devices[deviceIndex]);
sender.sendPacket(p);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
3dc44ead-5ff2-40cb-8ac0-4209620222d3 | 4 | public String accesoUsuario(){
String dir="";
Usuario u = manager.findByNick(nick);
if(u.getPass().equals(pass)){
String rol = u.getTipousr().getTipo();
if(rol.equals("Administrador")){
dir="administrador";
}else if(rol.equals("Supervisor")){
dir="supervisor";
}
... |
20664af1-1303-4952-882e-369c26a6b345 | 1 | public String getString() { // readString
int i = offset;
while (payload[offset++] != 10) {
;
}
return new String(payload, i, offset - i - 1);
} |
007dc989-8657-4ea5-b9e8-d7d97aaa4935 | 2 | public boolean foundLateral(Coord3d coord) {
for (int j = 0; j < lateralView3DCoordinates.size(); j++) {
if (coord.equals(lateralView3DCoordinates.get(j))) {
return true;
}
}
return false;
} |
9526a83a-61b5-4fd3-8c77-219d4caf5da4 | 7 | public static void main(final String[] args) throws Exception {
if (args.length < 2) {
showUsage();
return;
}
int inRepresentation = getRepresentation(args[0]);
int outRepresentation = getRepresentation(args[1]);
InputStream is = System.in;
OutputStream os = new BufferedOutputStream(System.out);
... |
0d96f893-3dc7-47b0-a486-bcf0a20f4dce | 9 | public void buildReport(final JStackMeta stackMeta) {
Map<String, Integer> stateCountMap = new HashMap<String, Integer>();
Map<String, Integer> messageCountMap = new TreeMap<String, Integer>(); // Sorted
Map<JStackEntry, Integer> entryCountMap = new TreeMap<JStackEntry, Integer>(); // Sorted
... |
9a66d828-d0ed-4630-93a1-22d81702f0e6 | 1 | @Override
public double arvo() {
if (!super.argumenttiAsetettu()) {
throw new IllegalStateException();
}
return Math.sin(super.getArgumentti().arvo());
} |
4e974957-45c3-4d1a-9c71-dc82a1f7ae03 | 1 | public void moveRight() {
/* Critical Region */
synchronized (this) {
xPosition += PADDLE_VELOCITY;
// We might need to snap to an acceptable position.
if (xPosition > PADDLE_MAX_X) {
xPosition = PADDLE_MAX_X;
}
}
} |
1b4a39fe-fcc1-4ed1-bd0f-89bf91039f21 | 1 | public TrainingDataManager() {
trainingFileDir = new File(trainingPath);
if (!trainingFileDir.isDirectory()) {
throw new IllegalArgumentException("error path : " + trainingPath);
}
this.trainingFileString = trainingFileDir.list();
} |
5adf4769-c01d-4031-9bff-60a0bb907441 | 0 | public void execute() {
this.from.removePiece(this.piece);
this.to.addPiece(this.piece);
this.capturedPawnField.removePiece(this.capturedPawn);
this.piece.increaseMoveCount();
} |
fe22ec30-f9c2-438e-99d0-ce8b11e2382e | 0 | @Test
public void testAddBlackMarker() {
System.out.println("addBlackMarker");
Cell instance = new Cell(0,0);
instance.addBlackMarker(0);
instance.addBlackMarker(1);
instance.addBlackMarker(2);
instance.addBlackMarker(3);
instance.addBlackMarker(4);
in... |
5d2cb062-cb34-496a-9b59-7820315df254 | 3 | public String getConfigValue(String... args) {
String value = ChatColor.translateAlternateColorCodes('&', LANG.getString(this.path, this.def));
if (args == null)
return value;
else {
if (args.length == 0)
return value;
for (int i = 0; i < args.length; i++) {
value = value.replace("{" + i + "}",... |
06be2510-6577-47cd-bbcb-86a6b946d5d6 | 2 | public void validateChecksum() throws IOException {
if (cis == null) {
readRawInt32();
} else {
int calculatedChecksum = (int) cis.getChecksum().getValue();
int checksumFromStream = (int) readRawInt32();
if (calculatedChecksum != checksumFromStream) {
... |
a3e954fd-162b-40ec-bcb1-06d4743825f8 | 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... |
f8ef662b-79d9-4d4c-848a-2b0eee84fe47 | 9 | public void tick() {
int xa = 0;
int ya = 0;
if (input.up.isPressed()) {
ya--;
}
if (input.down.isPressed()) {
ya++;
}
if (input.left.isPressed()) {
xa--;
}
if (input.right.isPressed()) {
xa++;
}
if (xa != 0 || ya != 0) {
move(xa, ya);
isMoving = true;
} else {
isMoving = ... |
578775ee-f6ec-4079-8efb-1345278f1aae | 4 | private synchronized void interpretRawSensorData() {
int sensorDataIndex = 0;
rawSensorData.remove(0); //The header
rawSensorData.remove(0); //The n-bytes field
for (SensorPacket s : sensorPacketsRequested) {
rawSensorData.remove(0); //The packet ID field
sensorDa... |
6878ae47-5077-401e-b24d-8e46f6502958 | 6 | public static List<String> paragraphDetector(List<String> content)
throws ParseException {
List<String> paragraphs = new LinkedList<String>();
StringBuilder sb = new StringBuilder();
String endOfParagraphRegex = properties
.getString("regex.paragraph.separator");
String emptyLineRegex = properties.getStr... |
128de37a-8e34-48ec-96d5-2edc13839d01 | 4 | public synchronized void applyUpdates()
{
//apply all new updates in the buffer
while (nextSlotToDisplay != nextSlotAvailable){
Font lFont;
//if the label pointer is not null, then that label needs to be updated
if (updateInfos[nextSlotToDisplay].label != null){
//only u... |
9ee2412a-5454-4ae2-b6d6-63fbb6afd08d | 0 | @EventHandler
public void onVotifierEvent(VotifierEvent event){
} |
8baf9f03-3302-4a5d-9709-045a2f308c87 | 4 | public List<Aula> verificarAulasPerdidasNoPeriodo(Periodo periodoAusencia) {
int diasEntre = this.diasEntre(periodoAusencia);
Calendar data = periodoAusencia.getLimiteInferior();
Calendar finalAusencia = periodoAusencia.getLimiteSuperior();
finalAusencia.set(Ca... |
0e13b820-a737-4444-89b4-431f57bbf116 | 0 | public void fire(boolean fire) {
this.firing = fire;
} |
29d3ede5-c14a-4013-be9f-8b0457eadf8b | 9 | public final void updateMonsterController(final MapleMonster monster) {
if (!monster.isAlive()) {
return;
}
if (monster.getController() != null) {
if (monster.getController().getMap() != this) {
monster.getController().stopControllingMonster(monster);
... |
2a387fdb-af94-40a9-9492-785a5f183351 | 2 | public ImageObject(int x, int y, int zIndex, boolean collision, String filename) {
// Call the constructor of the parent class.
super(x, y, zIndex, collision);
// Check if the provided file name makes sense.
if (filename == null) {
throw new IllegalArgumentException("The filename may not be null!");
... |
2d522f09-0fab-427b-b2d4-3671837ee2a8 | 9 | @Override
public Expression simplify() {
// TODO Auto-generated method stub
System.out.println("exp化简");
Expression newLeft = left.simplify();
Expression newRight = right.simplify();
ConstantExpression leftConst =null;
ConstantExpression rightConst =null;
try {
leftConst ... |
1e667e9b-6313-4afe-bfc3-476b852db88a | 0 | public Collection<OperatingSeat> getSeats() {
return this._seats;
} |
d0cb6d78-ab62-49f7-8996-663ef23f5ca5 | 7 | public void loadMap(int levelID)
{
URL file = Game.class.getClass().getResource("/maps/map_" + levelID + ".map");
int playerX = 0;
int playerY = 0;
try
{
Scanner scanner = new Scanner(file.openStream());
Log.info("Loading map_" + levelID + " for: " + world.getLabel());
while(scanner.hasNext())... |
600e34da-400e-41aa-abe4-8f7e7d313bba | 1 | public static byte[][][] generateForNDes(String key, int nDes) {
// hash the master key to create longer keys and to minimalize the chance
// of weak keys and as a consequence a weak encryption
byte[] hash = createHash(key);
// nDes cannot be too big
// every generation of... |
176f7146-d192-46e0-9c15-5c14cc67df79 | 7 | public static int cantidadOcurrencias(int[] v, int a, int b, int c) {
if (a == b) {
if (v[a] == c) return 1;
else return 0;
} else {
if (a < b) {
while (a < b) {
if (v[a] == c) return 1 + cantidadOcurrencias(v, a + 1, b, c);
else return cantidadOcurrencias(v, a + 1, b, c);
}
} else {
... |
21c64e31-1bf6-4430-9062-4445a05c689b | 0 | private Distance() {
this.distance = new MinkowskiDistance(2);
} |
c96decfc-aa64-479c-b0d6-6a89144d50d9 | 7 | private void zoomInButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_zoomInButtonActionPerformed
diagramPanel.getScaleRatio()[0] += 0.25;
diagramPanel.getScaleRatio()[1] += 0.25;
int minX = Integer.MAX_VALUE;
int minY = Integer.MAX_VALUE;
int maxX = 0;
... |
79cccf20-9308-4520-b09d-fbc794e872a7 | 2 | public Client ChercherClient(String login) {
try {
String sql = "SELECT * FROM User WHERE login='" + login + "' AND role='Client'";
ResultSet rs = crud.exeRead(sql);
Client c = new Client();
while (rs.next()) {
c.setLogin(rs.getString("login"));
... |
49573b49-ed4a-4ed6-a413-ec31d520e2d2 | 5 | private String getLatestNewsUrl() {
String s = "";
BufferedReader reader = getWebsite(DHBW_URL); //go tho the dhbw-homepage
try {
while (s != null & !s.contains(DHBW_MORE_TAG)) { //this tag is used to display news items
s = reader.readLine();
}
... |
c387dfad-44ff-4a94-9be2-7463f07ed953 | 2 | @Override
public Converter put(String key, Converter value) {
Converter v = super.put(key, value);
if (v != null) {
throw new IllegalArgumentException("Duplicate Converter for "
+ key);
}
return v;
} |
7affa963-d319-4aa2-92bd-397995074f95 | 7 | public int getHeuristicCost(GridState child, GridState goal) {
char[][] gridArray = new char[3][3];
char[][] goalArray = new char[3][3];
int index = 0;
int hCost = 0;
/*
* To calculate the heuristic cost, in this case the Manhattan distance,
* we need to know t... |
939578fb-1820-4134-8f83-94ffc638a24e | 5 | public StatistikZusammenfassung<Spieler> getStatistikZusammenfassung(String spielerName) {
Spieler spieler = eloPersistence
.createQuery("select distinct s from Spieler s join fetch s.punktzahlHistorie where s.name = :spielerName", Spieler.class)
.setParameter("spielerName", spielerName).getSingleResult();
... |
ba995d27-1085-4f7c-83f4-e085674ab16f | 2 | @EventHandler
public void onPlayerLogin(PlayerLoginEvent event) {
Player player = event.getPlayer();
if (!plugin.getDataHandler().isStored(player.getName())) {
// Store new player
plugin.getDataHandler().setLives(player, plugin.getConfigHandler().getStartingLives());
} else {
// Check already exis... |
d08be2f6-2f81-4110-91d4-3485ee1e70bb | 8 | public static Pair<Integer> traverse_spiral(int cur_row,int cur_col,int square_len)
{
//int col_bound=square_len-1-cur_row;
//int row_bound=square_len-1-cur_col;
int midpoint=(square_len-1)/2;
int next_col=cur_col;
int next_row=cur_row;
if(cur_row==square_len/2 && cur_col==midpoint)
{
next_col=-1;
... |
d758e32f-eb73-46d3-8f50-e2f0f9f907b4 | 0 | public int getWidth() {
return this.w;
} |
588bc405-2538-468c-a5de-aeb734a81f52 | 7 | private void updateMinMax(Instance ex) {
Instances insts = ex.relationalValue(1);
for (int j = 0;j < m_Dimension; j++) {
if (insts.attribute(j).isNumeric()){
for(int k=0; k < insts.numInstances(); k++){
Instance ins = insts.instance(k);
if(!ins.isMissing(j)){
if (D... |
d02ec5aa-777e-4b91-a3cc-26a089b78cec | 0 | public int getWidth() {
return width;
} |
6b216915-9ab9-45e0-8d9d-b87d386b8b20 | 1 | public void testFactory_FromCalendarFields_Calendar() throws Exception {
GregorianCalendar cal = new GregorianCalendar(1970, 1, 3, 4, 5, 6);
cal.set(Calendar.MILLISECOND, 7);
LocalTime expected = new LocalTime(4, 5, 6, 7);
assertEquals(expected, LocalTime.fromCalendarFields(cal));
... |
a3ab2798-4626-42db-8e9a-3f9e87d46129 | 4 | public static void set(String filePath, Map<String, Object> json) {
if (! filePath.endsWith(".json")) {
filePath += ".json";
}
try {
FileOutputStream output = new FileOutputStream(filePath); // Open the file we are saving to.
String content = generator.generateJson(json);
output.write(conten... |
bae3a08d-fd2c-4bc9-ad73-72300b5bdc61 | 6 | protected Boolean tryCheckVLine4(boolean remove) {
for (int i = 0; i < 6; i++) {
for (int j = 0; j < 6; j++) {
int count = (gemArray[i][j]);
if (j + 2 <= 5) {
if (count == gemArray[i][j + 1] && count == gemArray[i][j + 2]) {
... |
4e45d757-8296-4d98-a929-7c7f34a9a882 | 5 | @Override
public void mouseReleased(MouseEvent arg0) {
if(arg0.getComponent() == updateItem){
System.out.println("Clicked Update");
if (Desktop.isDesktopSupported()) {
try {
Desktop.getDesktop().browse(new URI(parent.newerVersionLink));
} catch (IOException... |
b11849a7-7b22-44f0-8cec-ba030849c82f | 5 | private void pop(char c) throws JSONException {
if (this.top <= 0) {
throw new JSONException("Nesting error.");
}
char m = this.stack[this.top - 1] == null ? 'a' : 'k';
if (m != c) {
throw new JSONException("Nesting error.");
}
this.top -= 1;
... |
799b3d6b-4640-4b43-b730-766af0aafbcf | 4 | public static void setCellStyles(mxIGraphModel model, Object[] cells,
String key, String value)
{
if (cells != null && cells.length > 0)
{
model.beginUpdate();
try
{
for (int i = 0; i < cells.length; i++)
{
if (cells[i] != null)
{
String style = setStyle(model.getStyle(cells[i])... |
766086cf-5d04-44d0-9088-8e945a878793 | 4 | public void delete(int id) throws NotExistException {
ListElement current = this.getHead();
ListElement previous = this.head;
// delete element
while (current != null) {
if (current.getId() == id) {
current = current.getNext();
previous.setNext... |
9c23a04a-0657-4d7c-84cc-023668c01982 | 2 | @Override
public boolean reachesDestination(Packet p) {
// TODO Auto-generated method stub
Iterator<Edge> edgeIt = p.origin.outgoingConnections.iterator();
EdgeEtx e;
while(edgeIt.hasNext()){
e = (EdgeEtx) edgeIt.next();
if(e.endNode.equals(p.destination)){
etxLink = e.getEtx();
}
}
double ... |
e18d1276-71a5-4892-8321-67134da3474f | 5 | @Override
public String process(JsonElement element) {
JsonObject obj = element.getAsJsonObject();
int frameType = obj.get("frameType").getAsInt();
switch(frameType) {
case 4: return "Gem";
case 5: return "Currency";
}
if (obj.get("typeLine").getAsStr... |
2e0cfd15-df59-484e-b219-de0d3d7bdd74 | 1 | public static void main(String[] args) {
Console c = System.console();
System.out.println(c);
System.out.println("Read User..:");
String user = c.readLine("%s", "input?: ");
System.out.println("Read Password..:");
char[] arrayPassword = c.readPassword("%s", "arrayPassword: ");
System.out.println("Use... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.