method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
c7d049df-cc00-4d2d-a295-cc1eebba1691 | 1 | public static void main (String [] args){
int mark=50;
System.out.println("The mark is " + mark);
if (mark>=50){
System.out.println("PASS");
}else{
System.out.println("FAIL");
}
} |
9062f61f-a54c-4787-99f9-256a76b494a0 | 9 | private void jButtonSaveOrderActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButtonSaveOrderActionPerformed
{//GEN-HEADEREND:event_jButtonSaveOrderActionPerformed
if (jTextFieldCustomerNo.getText().isEmpty())
{
JOptionPane.showMessageDialog(null, "Der mangler et kunde n... |
b985cc21-0c05-4364-af0d-a8ca7871a8f1 | 3 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource().equals(timer)) {
if (ballMovement) {
updateStatus();
ai.moveAi(ball.x, ball.y, ball.width, ball.height);
moveBall();
repaint();
}
} else if... |
5d954d0e-ea64-4d25-91a6-ce6e8205a762 | 4 | public int clear() {
System.out.print("Distribution: ");
for (int i = 0; i < 4; ++i){
System.out.print(distribution[i] + ", ");
distribution[i] = 0;
}
System.out.println();
String response;
for (SocketClient sClient : sClients){
try{
... |
fe840cf2-4d33-4383-9716-7ec940e68008 | 2 | private void editAmount() {
setVisible(false);
ArrayList<Booking> bookings = table.getSelectedObjects();
for (Booking booking : bookings) {
Transaction transaction = booking.getTransaction();
Account account = booking.getAccount();
//TODO: or JournalGUI.table ... |
3801652e-fff9-4db9-a51f-37458d58d892 | 9 | public void recalc_matches() {
try {
int non_matches_map = 0;
int non_matches_file = 0;
int map_index = comboBoxMapLayer.getSelectedIndex();
int file_index = comboBoxFileLinkColumn.getSelectedIndex();
if( map_index < 0 || file_index < 0) {
System.out.println("recalc: bad index");
return;
}
... |
c2f39514-12d1-4a39-91a6-1c16efdb4153 | 0 | @Override
public String getDesc() {
return "FrostDiver";
} |
70e8c499-0fad-42ba-a6ae-730c958fe35d | 0 | public void resume() {isPaused = false;} |
46e675d1-7ef4-4d81-8d06-dd862bbd2904 | 4 | @Override
public void update(GameContainer gc, StateBasedGame sb, int delta) {
float rotation = owner.getRotation();
float scale = owner.getScale();
Vector2f position = owner.getPosition();
Input input = gc.getInput();
if(input.isKeyDown(Input.KEY_A)) {
rotation -= 0.2f * delta;
}
if(input.isKey... |
315a832e-2ee8-4440-854a-ce9d7069c330 | 9 | protected static Ptg calcErf( Ptg[] operands ) throws FunctionNotSupportedException
{
if( operands.length < 1 )
{
return new PtgErr( PtgErr.ERROR_VALUE );
}
try
{
double lower_limit = operands[0].getDoubleVal();
double upper_limit = Double.NaN; //lower_limit;
if( operands.length == 2 )
{
... |
c8190e2e-d91b-4cf9-9458-c5c03a65fcc7 | 1 | public JPanel getSecOptMenu() {
if (!isInitialized()) {
IllegalStateException e = new IllegalStateException("Call init first!");
throw e;
}
return this.secOptMenu;
} |
94c9a813-7c64-4a73-8a88-cd7068aec233 | 7 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource().equals(this.imageMenuItem)){
this.onInsertImageMenuItemClick(e);
}
else if (e.getSource().equals(this.scrollMenuItem)){
this.handleScrolling();
}
else if (e.getSource().equals(this.spellCheckMenuItem)){
this.handleSpellChecki... |
350bb277-9b2e-41c5-ae75-b082a472e46a | 4 | void drawLoadingText(int percentage, String s) {
while (gameGraphics == null) {
gameGraphics = getGameComponent().getGraphics();
try {
getGameComponent().repaint();
} catch (Exception _ex) {
}
try {
Thread.sleep(1000L);
} catch (Exception _ex) {
}
}
Font helveticaBold = new Font("Helv... |
11ba53b2-b433-4bc4-8355-ae9de55e416c | 5 | public void loadTag() throws Exception{
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(decompressedData));
byte tagType = stream.readByte();
if (tagType != NbtTag.TAG_COMPOUND) {
throw new Exception("Top tag wasn't a compound!");
}
tag = new NbtTagCompound();
tag.readName(stream);
... |
51b2e099-8600-4f9e-9def-c57c2b58e5dc | 4 | public void remove(int key) {
HashPrinter.tryRemove(key);
/** Run along the array */
int runner = 0;
int hash = (key % TABLE_INITIAL_SIZE);
while (table[hash] != null && runner < TABLE_INITIAL_SIZE) {
if (table[hash].getKey() == key) {
break;
}
runner++;
hash = ((key + runner) % TABLE... |
62921a04-75db-45ee-96c6-0a7e15d04453 | 3 | public void setNumeroReal(TNumeroReal node)
{
if(this._numeroReal_ != null)
{
this._numeroReal_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node... |
b714cf8c-39a7-4f98-92ec-72895beecdb2 | 5 | public MageView()
{
for (int j = 0; j < 4; j++)
{
String direction = "";
if (j == 0)
{
direction = "left";
}
if (j == 1)
{
direction = "right";
}
if (j == 2)
{
direction = "down";
}
if (j == 3)
{
direction = "up";
}
String f... |
d7f78caa-99e2-4ee1-9a80-5de2ac13da00 | 5 | private void setRect(double minLat, double minLng, double maxLat, double maxLng)
{
if (!(minLat < maxLat))
{
throw new IllegalArgumentException("GeoBounds is not valid - minLat must be less that maxLat.");
}
if (!(minLng < maxLng))
{
if (minLng > 0 && minLng < 180 && maxLng < 0)
{
rects = new Re... |
359e9875-6949-4c7e-bbfd-b24e38f25805 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof CategoriaChamado)) {
return false;
}
CategoriaChamado other = (CategoriaChamado) object;
if ((this.getId() == n... |
af1f9eae-e8e0-442e-9f80-dcda7d710352 | 1 | void prepare() {
System.out.println("Preparing " + name);
System.out.println("Tossing dough...");
System.out.println("Adding sauce...");
System.out.println("Adding toppings: ");
for (int i = 0; i < toppings.size(); i++) {
System.out.println(" " + toppings.get(i));
}
} |
d83cdbaa-6f88-4ced-94f7-05a3f3624628 | 6 | private String getType(String extension)
{
switch(extension)
{
case "gif":
return "image/gif";
case "html":
return "text/html";
case "jpeg":
return "image/jpeg";
case "jpg":
retu... |
950dab8d-e887-4282-a157-d94ed799297c | 5 | protected static String getCheckSum(File file) {
MessageDigest messageDigest;
try {
messageDigest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new InternalError("MD5 not supported!");
}
FileInputStream fis;
try {... |
cac6809a-c2ce-4fd2-963c-3b7b76a0b265 | 7 | public void paint(Graphics g) {
super.paint(g);
Graphics2D g2 = (Graphics2D)g;
g2.setStroke(new BasicStroke(2));
for (int i = 0; i < next; i++)
{
if (RightObjects.get(i).getClass().equals(TickerPanel.class))
g2.setColor((((TickerPanel)RightObject... |
b924b39a-f93f-4df5-9d66-2aae99b3689b | 1 | public void loadImage(File file, int place) {
System.out.println("loading image into [" + place + "]");
try {
imageView[place] = ImageIO.read(file);
imageArrays[place] = convertTo2D(imageView[place]);
filterBody(imageArrays[place], place); // 1, 2, 3
imagePaths[place] = file.getPath();
System.out.pr... |
dc9bc286-99b5-44dc-a9fb-1f0da7ac1a8d | 7 | public String getFrameScore(){
String score="";
String thirdPoint;
checkS();
// ์ธ๋ฒ์งธ ๊ณต์ ๋์ง์ง ์์์ ๋, ๋ถ๋ชจ ํด๋์ค์ ์ ์ํ ๋ฐํ์ ์ฌ์ฉํ๋ค.
if(pins.size()!=3)
return super.getFrameScore();
// ์ธ๋ฒ์งธ ๊ณต์ ๋์ก์ ๋, ์คํธ๋ผ์ดํฌ ํน์ ๊ฑฐํฐ ์ฌ๋ถ๋ฅผ ํ์ธํ๋ค.
if(pins.get(2)==10)
thirdPoint="X";
else if(pins.get(2)==0)
thirdPoint="-";
els... |
945cbb4e-d41c-44d0-aec4-2cc01e5e9ffa | 5 | public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException
{
resp.setContentType("text/plain");
PrintWriter writer = resp.getWriter();
ResultStatus status = new ResultStatus();
Gson gson = new Gson();
String command = req.getParameter("command");
Stri... |
378906ae-6324-4edd-bea5-2ed77749ea9a | 2 | public void printRAM() throws Exception
{
for(int i = 0; i < jList.size(); ++i)
{
Job tempJob = jList.get(i);
System.out.println("ID: " + tempJob.getID());
System.out.println("Priority: " + tempJob.getPri());
System.out.println("Number of Instructions: " + tempJob.getJobs());
for(int j = 0; j < temp... |
20541522-4a08-4dda-a173-33f5be514d40 | 8 | public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
int msj_p, msj_c, num, num2, tmp1, tmp2, tmp3, tmp4, aux;
boolean continua;
do{
continua = false;
System.out.println("Ingrese un numero entero de 4 digitos: ");
msj_p = entrada.nextInt();
if(msj_p < 1000 || msj_p ... |
0cb6ccd6-4af7-4ade-9d6f-18da9bc27ad2 | 9 | private void showTeachingPlan() {
content = null;
head = null;
Object fb = logic.showTPHead();
if (fb instanceof Feedback) {
JOptionPane.showMessageDialog(null, ((Feedback) fb).getContent());
} else if (fb instanceof String[]) {
head = (String[]) fb;
fb = logic.showTPContent();
if ((fb instanceof... |
3b05e8f1-007f-41ea-a0dc-6cf213952b33 | 5 | public Player winner() {
Player p = null;
Player owner = null;
Player owner1 = null;
for(CityImpl c : this.game.getAllCities()) {
if(Player.RED == c.getOwner()) {
owner = c.getOwner();
}
if(Player.BLUE == c.getOwner()) {
owner1 = c.getOwner();
}
}
if(owner == null) {
p = Player.BLU... |
f46c21c1-2f9f-4dab-857e-6af7968c7fbd | 7 | private List<DbTableRecord> getRecords(String sourceDB,
DbDefinition dbDefinition, DbTableDefinition tableDefinition) {
List<DbTableRecord> allRecords = new ArrayList<DbTableRecord>();
if (sourceDB.equals(AppConstants.CONN_STRING_BASELINE_DB)) {
try {
if (null == dbConnectionBaseline
|| dbConnecti... |
0f85c47d-0ae6-4787-83dc-dd4b97047d15 | 7 | protected void readImage() {
ix = readShort(); // (sub)image position & size
iy = readShort();
iw = readShort();
ih = readShort();
int packed = read();
lctFlag = (packed & 0x80) != 0; // 1 - local color table flag
interlace = (packed & 0x40) != 0; // 2 - inte... |
d0976079-38ac-4508-8f34-29e108f6b8e3 | 7 | public void selectAttributesCVSplit(Instances split) throws Exception {
double[][] attributeRanking = null;
// if the train instances are null then set equal to this split.
// If this is the case then this function is more than likely being
// called from outside this class in order to obtain CV statis... |
a4a4f415-a73c-48da-a93c-04e08549b126 | 8 | @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof KeyedValues)) {
return false;
}
KeyedValues that = (KeyedValues) obj;
int count = getItemCount();
if (count != that.getItemCount()) {... |
307011b0-e641-443f-a0c7-79be492e8bcd | 8 | private String toRules(){
if (numInstances() == 0)
return "No Rules (Empty Exemplar)";
String s = "", sep = "";
for(int i = 0; i < numAttributes(); i++){
if(i == classIndex())
continue;
if(attribute(i).isNumeric()){
if(m_MaxBorder[i] != m_MinBorder[i]){
s += sep + m_MinBo... |
cb248140-8505-4901-b6e8-20ceed49d0e9 | 1 | private static int check(int value, int maxBits) throws NumberFormatException {
if (value > (1 << maxBits) - 1) {
throw new NumberFormatException(INVALID_VERSION_FORMAT);
}
return value;
} |
a7c992c7-3e17-4006-9fbc-360d5451d3ab | 8 | * @Description: TODO
* @param: @param data_set
* @param: @return
* @return: SplitPair
* @throws
* @author UncleLee
*/
private SplitPair chooseBestFeature(List<DataEntry<double[], Double>> data_set, double error_sum){
int m = data_set.size();
if(m <= DEFAULT_MIN_NUM... |
9ad88483-f0dd-430d-9217-d6b1797b6021 | 5 | public void setSourceText(String sourceText) {
if( !sourceText.equals(AlchemyAPI_NamedEntityParams.CLEANED) && !sourceText.equals(AlchemyAPI_NamedEntityParams.CLEANED_OR_RAW)
&& !sourceText.equals(AlchemyAPI_NamedEntityParams.RAW) && !sourceText.equals(AlchemyAPI_NamedEntityParams.CQUERY)
&& !sourceText.e... |
9fd794d6-72a2-4bc2-ace3-b0be31be06cf | 7 | public void togglePalettes() {
if (hiddenFrames.isEmpty()) {
for (CPPaletteFrame frame : paletteFrames) {
if (frame.isVisible()) {
for (CPPalette pal : frame.getPalettesList()) {
showPalette(pal, false);
}
hiddenFrames.add(frame);
}
}
} else {
for (CPPaletteFrame frame : hidden... |
3f0bfbea-b4f2-4a61-9a90-976ad6f857e0 | 9 | private Dimension getHeadingSize() {
Dimension s = new Dimension();
int c = getComponentCount();
for (int i = 0; i < c; i++) {
Component comp = getComponent(i);
TabWrapper tab = (TabWrapper) tabs.get(comp);
if (tab != null) {
int thw =
(HORIZONTAL_GAP * 2)
+... |
79e11ec7-b744-42b0-b5aa-e11d058b1be3 | 7 | @SuppressWarnings ("unchecked" )
@Override
public Collection<?> get( ByteBuffer in )
{
Integer size = Compress.getIntUnsignedNullable( in );
if (size == null)
{
return null;
}
Integer flag = Integer.valueOf( in.get() & 0xFF );
Constructor<?> cons... |
18296062-f086-46bd-b870-ec80b1fb1023 | 8 | private void makeSymbolTable( )
{
for( SemanticAction def: startNode.getBranches() )
{
String defName = def.getName();
if( defName.equals("print") ){
System.out.println( "User-defined print function not allowed." );
} else if( defName.equals("main") ){
mainCounter++;
}
... |
b6056552-9f71-4022-ba42-d5462f7c4a12 | 1 | public static String getCPI(String date, String state)
{
DB db = _mongo.getDB(DATABASE_NAME);
DBCollection coll = db.getCollection(COLLECTION_CPI);
BasicDBObject query = new BasicDBObject();
query.put("year", "" + getYear(date));
query.put("quarter", "" + ((getMonth(date) % 4) + 1));
DBCu... |
a5cf6b54-9d4c-419e-bb87-d325635b5fd3 | 8 | void invoke(Page page) {
pageTextBox.setPage(page);
page.deselect();
createContentPane();
if (needNewDialog(dialog, page)) {
dialog = ModelerUtilities.getChildDialog(page, true);
String s = Modeler.getInternationalText("CustomizeTextBoxDialogTitle");
dialog.setTitle(s != null ? s : "Customize text bo... |
6459ad2b-cb4f-4739-91e5-e6a49df58ddb | 1 | private AbstractNode createHigherLevels(List boundablesOfALevel, int level) {
Assert.isTrue(!boundablesOfALevel.isEmpty());
List parentBoundables = createParentBoundables(boundablesOfALevel, level + 1);
if (parentBoundables.size() == 1) {
return (AbstractNode) parentBoundables.get(0);
}
return... |
1aaa2d76-5da8-42e6-bfd9-b98580e4b881 | 3 | public ByteBuffer getData() {
int size = getLength();
ByteBuffer buf = ByteBuffer.allocate(size);
// write the offsets
for (int i = 0; i < glyphs.length; i++) {
Object o = glyphs[i];
if (o == null) {
continue;
}
ByteBuf... |
2532832e-aa19-46b4-9572-cbb91aac1fe1 | 2 | @Override
public void putAll(Map<? extends String, ? extends Competicao> m) {
throw new UnsupportedOperationException("Not supported yet.");
} |
e5ee2ca3-8cce-4002-b058-36e0aafed7d8 | 2 | public void escribirFichero(ArrayList<clsPersona> personas){
try{
FileWriter fichero = new FileWriter(rutaPrincipal);
PrintWriter pw = new PrintWriter(fichero);
for(clsPersona p : personas){
pw.println(p.getCodigo()+","+p.getNombre()+","+p.getTelefonoFijo()+",... |
27208c1c-ae27-4642-8553-1da1e1bee758 | 1 | public Iterator getAttributes() {
if (unknownAttributes != null)
return unknownAttributes.values().iterator();
return Collections.EMPTY_SET.iterator();
} |
e4394846-1010-4a6a-bd0d-88cbafc8f741 | 1 | public static Class infoClass(Class cmp) {
Class info = null;
try {
info = Class.forName(cmp.getName() + "CompInfo");
} catch (ClassNotFoundException E) { // there is no info class,
info = cmp;
}
return info;
} |
23d0015e-8581-4415-8aa8-f56a437023ec | 4 | public void broadcastEvent(String eventName) {
HashMap<Object, String> eventCallbacks = this.eventMap.get(eventName);
try {
if(eventCallbacks != null) {
Set<Object> keys = eventCallbacks.keySet();
Iterator<Object> it = keys.iterator();
while (it.hasNext()){
Object objReference = it.next();
... |
0fcb0c75-2ab5-438c-b651-a58e955aeb49 | 9 | private Object readArgument(char type) {
switch (type) {
case 'i' :
return readInteger();
case 'h' :
return readBigInteger();
case 'f' :
return readFloat();
case 'd' :
return readDouble();
case 's' :
return readString();
case 'c' :
return readChar();
case 'T' :
return ... |
aee6aba1-5a75-4885-90e9-f804650dae2a | 0 | protected JComponent initTreePanel() {
treePanel=new SelectableUnrestrictedTreePanel(this);
return treePanel;
} |
7792152e-96bd-4319-bf34-138b7ff00e68 | 7 | public void computeBoundingBox() {
// TODO: Compute the bounding box and store the result in
// averagePosition, minBound, and maxBound.
// Hint: The bounding box is not the same as just minPt and maxPt, because
// this object can be transformed by a transformation matrix.
Point3 p1,p2,p3,p4,p5,p6,p7,... |
fbebdfd0-539f-49df-84ec-60d2574e2fb1 | 3 | public static void main(String[] args) {
//Please input the value of "String[] args" from the settings of Java application.
TypeDesc desc = new TypeDesc();
for(String name : args){
try {
Class<?> startClass = Class.forName(name);
desc.printType(startClass, 0, basic);
} catch (ClassNotFoundException ... |
37e8d95c-6705-405e-9d31-7d9bb97a3f6d | 3 | public static void count_digits(String s) {
int count = 0;
for (int i = 0; i < s.length(); i++) {
char ch = s.charAt(i);
if (ch >= '0' && ch <= '9') count++;
}
System.out.println(count);
} |
bdf67afb-0480-4e6e-826c-e1ce3395a6ed | 4 | public static int getEndOfBrackets(String function, int posActuelle) {
int nbrBracketsOpened = 0;
int nbrBracketsClosed = 0;
int endPosition = 0;
for (int j = posActuelle; j < function.length(); j++) {
if (function.charAt(j) == '(')
nbrBracketsOpened++;
else if (function.charAt(j) == ')')
nbrBrac... |
b0275642-d68c-49fd-b1f6-5de3dfc89fc3 | 3 | @Override
public void actionPerformed(GuiButton button)
{
if(button.id == 0)
holder.closeWindow(this);
else if(button.id == 1 && holder instanceof GuiEditor)
{
GuiEditor editor = (GuiEditor)holder;
editor.confirmOperation(new OperationSaveMap(editor,textField.text));
}
} |
21efa387-9e30-44af-b8b4-84e30adcd4be | 6 | @EventHandler
public void SlimeMiningFatigue(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getSlimeConfig().getDouble("Slime.Mini... |
b7177ca9-0185-44c1-9329-09f46349b2bd | 0 | public String getName() {
return name;
} |
6126f9ae-ac44-4485-9d52-ef00b00a278a | 1 | private void onDownload(FileDownloadEvent event){
for(FileDownloadListener listener : listeners){
listener.onProgressChanged(event);
}
} |
dbd2bd21-e30e-472e-a8ae-187235c2a0b0 | 5 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int max = 0;
String input = sc.nextLine().toLowerCase();
String[] words = input.split("\\W+");
TreeMap<String, Integer> wordsMap = new TreeMap<>();
for (int i = 0; i < words.length; i++) {
if(!wordsMap.containsKey(words[i])... |
55328adb-6756-4028-baaf-ef621fb5aa5f | 2 | public static ArrayList<Customer> showAll() {
ArrayList<Customer> customers = new ArrayList<Customer>();
Database db = dbconnect();
try {
db.prepare("SELECT * FROM customer WHERE bDeleted = 0 ORDER BY CID");
ResultSet rs = db.executeQuery();
while(rs.next()) {
... |
deda4b11-f425-4c77-a00f-b5b032df5983 | 3 | public void onEnable() {
sessions = new LinkedList<CTFSession>();
CTFPlugin.plugin = this;
CTFPlugin.weplugin = (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit");
Bukkit.getPluginManager().registerEvents(this, this);
CTFTypes.registerType(NoEditSession.class);
CTFTypes.registerType(EditS... |
4af31ba3-9e29-470f-9347-d2978d5405ca | 8 | static final void method449(String string, String string_1_, boolean bool,
int i, boolean bool_2_) {
do {
try {
anInt849++;
BufferedPacket class348_sub47 = Class203.method1478(true);
((BufferedPacket) class348_sub47).buffer
.putByte
(((HandshakePacket) Class178.aClass29_2348).opcode);
((Bu... |
281ebc8a-b869-4595-ac79-ced212aa0873 | 8 | public void run() {
try {
out = new PrintWriter(socket.getOutputStream(), true);
in = new BufferedReader( new InputStreamReader(socket.getInputStream()));
String inputLine = "" , outputLine;
// Do the login name
outputLine = "Please enter a username" ;
out.p... |
cc200e6d-ad8b-4024-b844-00078be6cbef | 5 | public void handleClassThatIsAttribute(ClassMeta c) {
System.out.println("Handling: " + c.name);
for(AssociationEndMeta ae : EntityMeta.all_association_ends.values()) {
if(ae.target_id.equals(c.id)) {
System.out.println("found an ae");
AssociationMeta assoc = EntityMeta.all_associations.get(ae.assoc_i... |
05ed7698-e3c1-4545-af40-0c404cf1e11d | 6 | public static void outputDisplay(List<Flight> SearchedFlights, FlightDTO dto) {
if (SearchedFlights == null) {
System.out.println("No Flights found for given Locations");
} else if (SearchedFlights.size() == 0) {
System.out
.println("Sorry No flight for this combination of Date and Class");
} else {
... |
26c936cf-ba22-45fc-9060-47cdc09338a3 | 3 | private Boolean find_driver()
{
try
{
if (driver_class == null)
driver_class = Class.forName(driver_name);
if (driver_class == null)
driver_class = Class.forName(driver_name, true, ClassLoader.getSystemClassLoader());
return true;
}
catch (Exception ex)
{
... |
e73b5100-e9a1-439e-a204-03fba8d7b8a1 | 5 | public void tick(boolean preview)
{
if(System.currentTimeMillis()-startTime < systemLength || systemLength == -1)
{
for(int x=0;x<maxSpawnRate;x++)
spawnParticle();
}
for(int x=0;x<particles.size();x++)
{
boolean despawn = !particles.get(x).tick(map);
if(despawn)
{
particles.remove(x);... |
d5a54b3b-a1aa-4b45-ad8f-7c70b68a8909 | 1 | public World(int numWater, int xMin, int yMin, int xMax, int yMax, int yMid)
{
this.xMin = xMin;
this.yMin = yMin;
this.xMax = xMax;
this.yMax = yMax;
this.yMid = yMid;
// no need to generate air molecules, because that is adjusted every tick based on the temperature
// generate Water molecules
f... |
69bd5d2a-9c8b-4fd2-9fdf-793dd6660350 | 7 | public static void PROVJERI_naredba_grananja(){
String linija = mParser.ParsirajNovuLiniju(); // ucitaj KR_IF
UniformniZnak uz_kr_if = UniformniZnak.SigurnoStvaranje(linija);
linija = mParser.ParsirajNovuLiniju(); // ucitaj L_ZAGRADA
UniformniZnak uz_l_zagrada = UniformniZnak.SigurnoStvaranje(linija);
linija ... |
daeca40d-c581-45a2-946c-cc07772d1229 | 1 | public void selectHero(Object hero)
{
System.out.println("?! "+heroesSelected);
WidgetChooserButton button = (WidgetChooserButton)(heroesInner.itemAt(heroesSelected).widget());
if (hero != heroes.get(heroesSelected)) {
heroesSelected = heroes.indexOf(hero);
button.setChecked(false);
} else {
button.se... |
13733801-9d5e-42ab-a51a-beb2a4ead053 | 3 | public void create(Fornecedor fornecedor) throws PreexistingEntityException, Exception {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
em.persist(fornecedor);
em.getTransaction().commit();
} catch (Exception e... |
c7772d49-56d5-490b-bacc-ffa12958d98e | 1 | private void preenceTabela(List<FormasPagamento> lista){
this.modelo = new DefaultTableModel();
modelo.addColumn("id");
modelo.addColumn("Nome");
for(FormasPagamento f : lista){
Vector valores = new Vector();
valores.add(0,f.getId())... |
aca2b897-c229-4a1b-8bea-97d0f8fb3487 | 4 | public void loadOrder(){
orderDataAccesor dataAccessOrder=new orderDataAccesor();
List<order> orderList=new ArrayList();
DefaultTableModel orderDataTable=new DefaultTableModel();
Object[ ] columnNames=new Object[5];
Object[ ] fieldValues=new Object[5];
//Patien... |
e4532266-974b-4d88-9658-b159b1a3196e | 2 | public static void ChooseAllen ()
{
if (Game.characterChoice == 1)
{
Game.CharacterOne = "Allen";
Game.CharacterOneHP = CharacterStats.AllenHP;
Game.CharacterOneAttack = CharacterStats.AllenAttack;
Game.CharacterOneMana = CharacterStats.AllenMana;
Game.CharacterOneRegen = CharacterStats.A... |
202c3fd1-9917-4973-8220-bdd32074e8d9 | 6 | public SecuredTaskTriggerBean execute(SecuredTaskTriggerBean task) throws GranException {
//String clientDataUDFName = KernelManager.getFind().findUdf(INCIDENT_CLIENTDATA_UDFID).getCaption();
String client = task.getUdfValue(INCIDENT_CLIENT_UDF);
introduceNewClient(task, client);
Secu... |
8777c2a2-80b8-48ad-8df4-a6531582ea14 | 8 | public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
{
if (averageGroundLevel < 0)
{
averageGroundLevel = getAverageGroundLevel(par1World, par3StructureBoundingBox);
if (averageGroundLevel < 0)
{
... |
626c4f28-ccb8-4590-b6d9-479a920dade9 | 1 | @Test(expected = PersistencyException.class)
public void WhenLoadingFromFileWithInvalidAddress_ExpectPersistencyException() throws PersistencyException {
RoutingTable routingTable = new RoutingTable();
try {
persistenceDelegate_.load(INVALID_ADDRESS_FILE, routingTable);
} catch (... |
38529a3e-9551-45d5-ba06-5a1fb1c29619 | 2 | public static String toString( double[][] matrix )
{
String retVal = "";
int m = matrix.length;
int n = matrix[0].length;
for ( int i = 0; i < m; ++i )
{
for ( int j = 0; j < n; ++j )
{
retVal += fillString(Double.toString(matrix[i][j]), 24);
}
retVal += "\n";
}
return(retVal);
} |
a318ca7c-f923-40e7-9874-f6c378225dcf | 9 | public static Change add(final CourseRec course, final OffRec offering) {
offering.setCourse(course);
Change change = new Change(course.getSource(), Change.ADD, offering) {
@Override
public String getDescription() {
return "Offering";
}
@Override
public Object getTarget() {
return "[" + cour... |
0675e31e-8723-4292-a3d2-ecdcda4178e3 | 9 | static void skykid_draw_sprites(osd_bitmap bitmap)
{
int offs;
for (offs = 0; offs < spriteram_size[0]; offs += 2){
int number = spriteram.read(offs) | ((spriteram_3.read(offs) & 0x80) << 1);
int color = (spriteram.read(offs+1) & 0x3f);
int sx = 256 - ((spriteram_2.read(offs+1)) + 0x100*(spriteram_3.rea... |
1ecdf201-d1c8-4cd3-82d3-43856ed2ac63 | 9 | public int getParameter(String paramname){
if(paramname == "HoodSize"){return map.getBrushLength();}
if(paramname == "NextX"){return map.getNextX();}
if(paramname == "NextY"){return map.getNextY();}
if(paramname == "Age"){ return age;}
if(paramname == "Fade"){ return fade;}
if(paramname == "MirrX... |
88856169-0e1f-451a-afd9-7d92d178becf | 1 | @Override
public int hashCode() {
int hash = 0;
hash += (idLaptop != null ? idLaptop.hashCode() : 0);
return hash;
} |
51d97efd-6f2a-4ebc-9fc0-ecd3efe5c1b9 | 6 | public static String escape(String string) {
char c;
String s = string.trim();
StringBuffer sb = new StringBuffer();
int length = s.length();
for (int i = 0; i < length; i += 1) {
c = s.charAt(i);
if (c < ' ' || c == '+' || c == '%' ... |
382c0ee5-ec0c-4f1b-9fe6-ef03bf35f59c | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final MapleMessengerCharacter other = (MapleMessengerCharacter) obj;
if (name == null) {
if (other.name != null)
return false;
} else if... |
c67cf4f9-c209-46ff-ad47-7b8c5e99bdfd | 6 | public void resize(double scaleFactor){
scaleFactor = (double)(Gui.getSlidePanel().getWidth())
/ (double)slideDimension.width;
if (Debug.video) System.out.println("VideoPlayer -> resize -> resize called");
if ((null != player) && (realizeComplete) && (!Gui.isVideoFullScreenOn())){
// Calculate the new sca... |
e3fe72a0-ba6e-4ae8-8f9b-da642728f9c7 | 1 | @Test
public void testCreatingPhoneNumberWithNullNumberShouldFail() {
try {
new PhoneNumber("home", null);
fail("Was expecting an Exception when no country code is provided.");
} catch (IllegalArgumentException iae) {
Assert.assertEquals("Please provide a value for Number as it is a non-nullable field.", ... |
328eb497-4376-470a-ba0e-382d8a609569 | 0 | public int getID() {
return this.id;
} |
a545b93c-0f3d-4b42-818e-918124d78dba | 2 | public E dequeue(){
if(total == 0) throw new NoSuchElementException();
E e = first.e;
first = first.next;
if(--total == 0) last = null;
return e;
} |
c8707b61-f4a1-4374-9dff-568a0558c686 | 0 | public boolean load(){
return false;
} |
c4dd5256-71ac-4547-a8ca-9718795b683a | 8 | public static void main(String[] args) throws Exception {
if (args.length != 8) {
System.err
.print("Syntax error. Correct syntax:\n"
+ " <trainfile_supervised> <trainfile_semisupervised> "
+ "<supervised_weight> <observation_feature> <state_feature> "
+ "<modelfile> <numiterations> <see... |
350340eb-c9b1-4eef-a8c7-1f7ae150f9f1 | 6 | public AmmoPackItem retrieveAmmoPack(BulletType bulletType) {
List<Item> list = inventory.getAll("ammopack.");
AmmoPackItem ap = null;
for (Item i : list) {
AmmoPackItem pack = (AmmoPackItem) i;
if (pack.getBulletType() == bulletType) {
if ((ap == null || pack.getAmount() > ap.getAmount()) && pack.ge... |
ad94f553-efe7-4060-bc82-499d5f1bb6dd | 6 | @Override
protected void initConstraint()
{
if ( Theme.list == null )
{
Theme.list = new HashSet<String>();
String jarPath = Window.class.getResource("game").getPath();
jarPath = jarPath.substring(5, jarPath.indexOf("!"));
JarFile jar = null;
... |
edd51456-5f30-4b2e-bef5-26eb3b83e26d | 9 | public static void rangeCheck(Object comp, boolean in, boolean out) throws Exception {
ComponentAccess cp = new ComponentAccess(comp);
Collection<Access> acc = new ArrayList<Access>();
if (in) {
acc.addAll(cp.inputs());
}
if (out) {
acc.addAll(cp.outputs()... |
07733efe-f1f0-40cd-a2a1-1356aa3c7721 | 5 | @Override
public void deserialize(Buffer buf) {
super.deserialize(buf);
year = buf.readShort();
if (year < 0)
throw new RuntimeException("Forbidden value on year = " + year + ", it doesn't respect the following condition : year < 0");
month = buf.readShort();
if (... |
37cb34d8-7550-419c-a466-113bbac6140f | 4 | public boolean tjekLogind(String brugernavn, String kode) {
boolean tjek = false;
ResultSet rs = null;
PreparedStatement pst = null;
String SQLString1 =
"SELECT * from BRUGER_LOGIN_TBL WHERE BRUGERNAVN=? AND KODEORD=?";
try{
pst = con.prep... |
f08e1628-5e41-4939-a123-1c216c53474a | 0 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + day;
result = prime * result + hour;
result = prime * result + minute;
result = prime * result + month;
result = prime * result + second;
result = prime * result + year;
return result;
} |
bc067e0d-56d4-4f30-bcb8-48231d569383 | 0 | private void initComponents() {
setLayout(new GroupLayout());
add(getJLabel0(), new Constraints(new Leading(105, 10, 10), new Leading(22, 10, 10)));
add(getJLabel1(), new Constraints(new Leading(70, 208, 12, 12), new Leading(89, 10, 10)));
add(getJButton0(), new Constraints(new Leading(59, 10, 10), new Leading(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.