method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
5676ae88-0ec5-4753-a679-d7e6787b0dee | 8 | private void unfilterPaeth(byte[] curLine, byte[] prevLine) {
final int bpp = this.bytesPerPixel;
int i;
for(i=1 ; i<=bpp ; ++i) {
curLine[i] += prevLine[i];
}
for(int n=curLine.length ; i<n ; ++i) {
int a = curLine[i - bpp] & 255;
int b = pre... |
bf1fef80-1d34-4cc6-a36f-bce90e5fc362 | 5 | @Override
public void handleMessage(String[] msg){
super.handleMessage(msg);
boolean willDie = Boolean.parseBoolean(msg[3]);
int playerToheal = Integer.parseInt(msg[6]);
if(willDie){
if(playerToheal != 0){
Tank player = null;
if(playerToheal == 1){
player = level.getPlayers().get(0);
... |
177ebb99-0ece-43ec-8545-dbf0ff30be99 | 5 | private void checkName(final String name) {
if ((name == null) || name.trim().length() == 0) {
throw new IllegalArgumentException("Cannot create table! Wrong name!");
}
if (name.matches("[" + '"' + "'\\/:/*/?/</>/|/.\\\\]+") || name.contains(File.separator)
|| name.c... |
63dc052f-eb0d-46da-a212-864b2d0fc669 | 7 | public String getErrorInfo() {
if (!specialConstructor) {
try {
return super.getMessage() + " at column " + currentToken.next.beginColumn + ".";
}
catch (Exception e) {
return super.getMessage();
}
}
int maxSize = 0;
for (int i = 0; i < expectedTokenSequences.length; i++) {
if (maxSize < ... |
d5660846-ed8e-4b0f-92ee-8d94df237692 | 9 | public void WriteSave()
{
int Year = Calendar.getInstance().get(Calendar.YEAR);
int Month = Calendar.getInstance().get(Calendar.MONTH);
int Day = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
int Hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
int Minute = Calendar.getInstance().get(Calendar.MI... |
54c2161e-bfd0-4040-ba42-98a729bf8651 | 1 | public void addItem(Item item){
try{
session.beginTransaction();
session.save(item);
session.getTransaction().commit();
}
catch(HibernateException e){
Main.getFrame().showError("A hozzáadás sikertelen volt: "+e.getMessage());
}
} |
39107c14-6943-4b48-bf85-acc087fd2f1e | 6 | private void findButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_findButtonActionPerformed
String searchTerm = findField.getText().toLowerCase();
symbolDataArea.requestFocusInWindow();
if (searchTerm != null && searchTerm.length() > 0) {
Document do... |
1144141f-c095-4607-a214-de9b9a297274 | 3 | @Override
public void setValueAt(Object value, int row, int col)
{
switch (col)
{
case 0:
dataSwitch[row] = (boolean) value;
break;
case 2:
data[row].quantity = (double) value;
break;
case 3:
data[row].price = (int) Math.round(100.0 * ((double) value));
break;
}
fireTableCellUpdated(ro... |
4eee087d-3759-4476-962b-82a98622e7ed | 4 | static void swap2max(ArrayList<Integer> input, int k) {
if (input.size() < 2) {
System.out.println("invalid input");
}
int maxNum[];
maxNum=new int[input.size()];
maxNum[0]= Integer.MIN_VALUE;
ArrayList<Integer> maxVec = new ArrayList<Integer>(input.size());
//maxVec=deepCopyLi... |
699128e3-d5d2-4984-890e-e69ccb535247 | 4 | public static <T extends Comparable<? super T>> void sort(T[] array) {
T saved;
//Index of the element we're pulling out (as saved)
int gap;
//Loop over each index starting at 1
//(we can assume the first one is already inserted)
for (int i = 1; i < array.length; i++) {... |
067dcbe4-ee5e-4871-8d54-3667b7e72c02 | 5 | public void open(String filename,int auIndex) {
int EXTERNAL_BUFFER_SIZE = 524288;
URL soundFile = this.getClass().getClassLoader()
.getResource("Sound/"+filename);
AudioInputStream audioInputStream = null;
try {
audioInputStream = AudioSystem.getAudioInputStream(soundFile);
} catch ... |
2110c632-2154-46c2-b4db-42c6f0728e6b | 2 | @Override
public boolean isDeletable(){
return !(getName().equals(Balances.YEAR_BALANCE) || getName().equals(Balances.RESULT_BALANCE) || getName().equals(Balances.RELATIONS_BALANCE));
} |
543cf871-1ef6-4240-a5fc-1bd896ba7b73 | 0 | @Test
public void testGetHight() {
System.out.println("geHight");
assertEquals(1.5, new Tetrahedron(1.5,2,3.5,12).getHig(), 0.0001);
} |
825ab61d-b6b7-4205-b546-2a9cc02febc5 | 2 | protected void readAndCheckFirstByte(InputStream inputStream) throws IOException, InvalidFormatException {
int firstByte = inputStream.read();
if(firstByte < 0 || firstByte != getPrefix()) {
throw new InvalidFormatException();
}
} |
eb2ef0cc-6f56-4245-ae3c-d6cd8890866f | 9 | public String mergeFiles(String file1, String file2, String outputFile) throws IOException {
DistributedInputStream is1 = new DistributedInputStream(file1, nameNode), is2 = new DistributedInputStream(
file2, nameNode);
DistributedOutputStream os = new DistributedOutputStream(outputFile, nameNode);
... |
13e51f91-1210-4cba-899b-64d794b0b8a8 | 3 | public static JSONObject toJSONObject(String string) throws JSONException {
String name;
JSONObject jo = new JSONObject();
Object value;
JSONTokener x = new JSONTokener(string);
jo.put("name", x.nextTo('='));
x.next('=');
jo.put("value", x.next... |
f6f99393-1450-465a-b36e-a7548e3e4715 | 5 | public TreeNode flattenRec(TreeNode root){// return the link tail
if(root == null) return null;
if(root.left == null && root.right == null){
return root;
}else if(root.left == null){
return flattenRec(root.right);
}else if(root.right == null){
TreeNode... |
f1c71c15-cb79-416f-8303-3f07852f3b16 | 1 | public String toString() {
StringBuilder s = new StringBuilder("peer://")
.append(this.ip).append(":").append(this.port)
.append("/");
if (this.hasPeerId()) {
//s.append(this.hexPeerId.substring(this.hexPeerId.length()-6));
s.append(this.hexPeerId);
} else {
s.append("?");
}
return s.toString... |
2e0dcb04-7d2f-4f46-a232-55496ecb23dd | 6 | @Override
public void delClasa(String clasaDeSters) {
BufferedReader fisier;
try {
fisier = new BufferedReader(new FileReader("clase"));
BufferedWriter fisier_nou;
ArrayList<String> vector = new ArrayList<>();
for(String line; (line = fisier.re... |
0dc8b827-7fe7-440a-ae90-57f185415e87 | 3 | public boolean accept (Champion c) {
if (searchPosition != null)
if (c.hasPosition (searchPosition)) return true;
if (c.getName().toLowerCase().contains (searchString)) return true;
return false;
} |
287cbc99-be94-4f29-8cc1-05a6f93b6892 | 0 | public void setInhusa(Integer inhusa) {
this.inhusa = inhusa;
} |
f546459a-750f-4dcd-8e3e-d654aff30ceb | 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;
... |
a19172e7-683b-45a7-ae92-3a2594b622c4 | 6 | @Override
public void actionOnPChoice(int choice, int player) {
switch(choice){
case PlayersChoices.REMOVE_FOOT :
territories[getPlaceOnTrack(player)].getTroup().rmToop(0, 1, 0, 0);
units[getPlaceOnTrack(player)]--;
break;
case PlayersChoices.REMOVE_KNIGHT :
territories[getPlaceOnTrack(player)]... |
bb361ef1-1e7c-4793-9323-d42b0b6dd0f3 | 8 | public Boolean isValid() {
if (this.url.length() < 5 || this.url.length() > 64) {
return false;
}
/*
* Walidacja dozwolonych GTLD
*/
Boolean bFound = false;
for (String gtld : Link.allowedGtld) {
if (this.urlObject.getHost().endsWith(gtld)) {
bFound = true;
break;
}
}
if (!(bFoun... |
cf364e08-a0e2-4523-8f85-16fdb0b3a6e4 | 1 | public ArrayList<Collider> getColliders()
{
for ( Collider collider : colliders )
collider.setPos( getTransform().getPos() );
return colliders;
} |
3921897d-125b-42da-8597-67a27ea154ef | 5 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// OK button
if (file == null){JOptionPane.showMessageDialog(null, "No file selected!"); return;}
if (jCheckBox2.isSelected()){
resetList(newlist);
}
dispose();
Tester<Word> test = new SimpleTest<Word>(newlist)... |
1b111645-7f57-440f-9ecc-b70f329f9cbe | 2 | public static void kickAll( String sender, String message ) {
if ( message.equals( "" ) ) {
message = Messages.DEFAULT_KICK_MESSAGE;
}
message = Messages.KICK_PLAYER_MESSAGE.replace( "{message}", message ).replace( "{sender}", sender );
for ( ProxiedPlayer p : ProxyServer.ge... |
f8e38968-7cdb-48e3-80c8-f1051b7c1de9 | 9 | long getDuration() {
// TODO: how should this really be done??
if (debugFlag)
debugPrintln("JSChannel:getDuration");
if (ais == null || audioFormat == null ) {
if (debugFlag)
debugPrintln("JSChannel: Internal Error getDuration");
retur... |
6a9f20e4-1eaa-45a2-8b69-27b7d19a7daa | 7 | public EquipmentType[] getEquipment(Specification specification) {
List<EquipmentType> equipment = new ArrayList<EquipmentType>();
switch(role) {
case PIONEER:
EquipmentType tools = specification.getEquipmentType("model.equipment.tools");
for (int count = 0; count < tools... |
c3722341-82f7-4dcb-8e13-52e9cbf68fc9 | 5 | private static File buscarArchivoPrj(File directorio) {
File[] contenidos = directorio.listFiles();
for (File archivo: contenidos) {
if (archivo.isDirectory()){
File buscado = buscarArchivoPrj(archivo);
if (buscado != null) {
return buscado;
}
}
if (archivo.isFile() && archivo.getName(... |
b07dbc12-a95a-45cf-9ab7-e4a70aab99ba | 1 | public static void main(String[] args)
{
LazyPrimMST mst = new LazyPrimMST(
new EdgeWeightedGraph(new In(args[0])));
System.out.println("Minimum spanning tree of " + args[0]);
for (WeightedEdge e : mst.edges())
System.out.println(e);
System.out.println("Weight : " + mst.weight());
} |
67338d59-752b-4a71-9c25-97a4b4f66a64 | 8 | public static Stella_Object yieldTypeSpecTree(StandardObject self) {
{ Surrogate testValue000 = Stella_Object.safePrimaryType(self);
if (Surrogate.subtypeOfSurrogateP(testValue000)) {
{ Surrogate self000 = ((Surrogate)(self));
return (Symbol.internSymbolInModule(self000.symbolName, ((Modul... |
2ec8eaf9-91b4-44db-90df-8bd00d453611 | 1 | @Override public void paintComponent(Graphics g) {
super.paintComponent(g); // paints background
if (dFAPainter != null)
dFAPainter.updateGraphics((Graphics2D)g);
} |
85dfc016-875a-45d4-9e16-3369fd535bba | 4 | public void writeValue(String incoming) {
writeFile(FilePaths.getValuePath(pinNumber), incoming);
try {
String readVal = readValue();
if (!readVal.equals(incoming)) {
throw new RuntimeException("Tried to change pin " + pinNumber +
" but failed to write: " +... |
9e740186-8cd8-4ba9-9b52-c437828886b3 | 8 | private void avaaViereiset(int x, int y) {
for (int i = -1; i < 2; i++) {
for (int j = -1; j < 2; j++) {
if ((i == 0 && j == 0)) {
//tarkistetaan että ruutu on kentän sisällä
} else if ((x + i) > -1 && (y + j) > -1 && (x + i) < this.kentta.getLevey... |
6d072373-4a85-4f4c-bde0-5fa99980c92d | 0 | public NodeSet() {} |
1435cdb3-c0bc-45e6-8e60-633703678185 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Segment other = (Segment) obj;
if (p1 == null) {
if (other.p1 != null)
return false;
} else if (!p1.equals(other.p1))
return false;
... |
b5b15e05-2c8d-4576-bb83-fd608f5b0529 | 3 | public void addAll(TileSet aTiles)
{
if (mProbability)
{
final byte nothing = mField.getMasks().getNothing().getId();
for (int tile : aTiles)
mTiles.put(tile, mField.getMask(tile) == nothing);
}
else for (int tile : aTiles)
mTiles.put(tile, false);
} |
ab98c939-1d1f-4188-9958-fb82af1ab7f0 | 3 | public void retrieveURLfromfile(String fileLoc) throws IOException {
String uRL = "";
try {
File file = new File(fileLoc);
Scanner scanner = new Scanner(file);
while (scanner.hasNextLine()) {
uRL = scanner.nextLine();
}
scanner.close();
} catch (FileNotFoundException e) {
e.printStackTrace()... |
7a8b83ce-d0a5-4b4f-a818-20257b4f0b60 | 5 | private H2Driver(Plugin p, HashMap<String, String> c) {
plugin = p;
this.db = c.get("database");
this.prefix = c.get("prefix");
this.user = c.get("user");
this.pass = c.get("password");
this.dbg = (c.containsKey("debug")) ? this.parseBool(c.get("debug"), false) : false;
String dbPath = "jdbc:h2:" + pl... |
20bdf038-23c9-43c4-bfdd-b0408ca74fa7 | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ImageAttributes other = (ImageAttributes) obj;
if (imgHeight != other.imgHeight)
return false;
if (imgWidth != other.imgWidth)
return fal... |
7ed1f469-f2e3-4404-8d9b-ff3bdcf36964 | 7 | public static void evaporateVirgin(Description self) {
{ List parentimplies = List.newList();
List childimplies = List.newList();
Description parent = null;
Description child = null;
Proposition bridgeprop = null;
{ Proposition p = null;
Iterator iter000 = Logic.unfilteredDepe... |
392140c7-0c44-4f4d-9226-cbe965326506 | 2 | public int getInDocumentFrequency(String document){
for(Occurrence occ: docsList.toArray()){
if(occ.getDocName().compareTo(document) == 0){
return occ.getTermFrequency();
}
}
return -1;
} |
c97f2843-d729-4ff9-80d4-cc95b5a356df | 1 | @Override
public void run() {
for (int count = 0; count < myUniverse.getShapeList().size(); count++) {
System.out.println("Shape " + String.valueOf(count));
System.out.println(String.valueOf((myUniverse.getShapeList().get(count).getPosition().getComponent(0))));
System.out.println(String.valueOf((myUniverse... |
5cb90f97-3800-4b1a-a243-3d0a50f4c25a | 5 | private void finishParse(Vector methods, Object root, Object handler) {
if (methods != null) for (int i = 0; i < methods.size(); i += 3) {
Object component = methods.elementAt(i);
Object[] definition = (Object[]) methods.elementAt(i + 1);
String value = (String) methods.elementAt(i + 2);
if ("method" ... |
87aa123c-3756-4cc7-8f9b-1f52d4b1c710 | 9 | void paintImage(PaintEvent event) {
GC gc = event.gc;
Image paintImage = image;
/* If the user wants to see the transparent pixel in its actual color,
* then temporarily turn off transparency.
*/
int transparentPixel = imageData.transparentPixel;
if (transparentPixel != -1 && !transparent) {
image... |
0275cb91-bcac-4c13-b06e-9fd0fcc862b8 | 5 | private void updateTabla(){
//** pido los datos a la tabla
Object[][] vcta = this.getDatos();
//** se colocan los datos en la tabla
DefaultTableModel datos = new DefaultTableModel();
tabla.setModel(datos); ... |
1e2bf858-300d-442b-a007-a0914ea53d91 | 6 | public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6)
{
this.bipedHead.rotateAngleY = par4 / (180F / (float)Math.PI);
this.bipedHead.rotateAngleX = par5 / (180F / (float)Math.PI);
this.bipedHeadwear.rotateAngleY = this.bipedHead.rotateAngleY;
... |
c3f06f68-e6a6-4f73-a1ba-c96d33dc07c2 | 0 | public int getRsrceQuantity() {
return rsrceQuantity;
} |
8f72c8db-8ce9-4987-9015-19c2f791a691 | 7 | private void searchGuestButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchGuestButtonActionPerformed
guestModel.clear();
String firstName = searchFirstNameField.getText();
String lastName = searchLastNameField.getText();
ArrayList<Guest> foundGuests = new Arr... |
56df5eda-a156-46e5-924e-da572f6e4ff8 | 4 | void createExampleWidgets () {
/* Compute the widget style */
int style = getDefaultStyle();
if (dropDownButton.getSelection ()) style |= SWT.DROP_DOWN;
if (readOnlyButton.getSelection ()) style |= SWT.READ_ONLY;
if (simpleButton.getSelection ()) style |= SWT.SIMPLE;
/* Create the example widgets */
... |
69b73b10-e520-49e4-ab37-fa2765521680 | 2 | @Override
public String getOne(String strTabla, String strCampo, int id) throws Exception {
Statement oStatement;
ResultSet oResultSet;
try {
oStatement = (Statement) oConexionMySQL.createStatement();
String strSQL = "SELECT " + strCampo + " FROM " + strTabla + " WHER... |
9533e527-af1c-440c-bc4a-adafbba72947 | 1 | public void criarDiretor(Usuario Diretor) throws SQLException {
UsuarioDAO userDAO = new UsuarioDAO();
Usuario userExistente = userDAO.selectDiretor();
if (userExistente == null) {
userDAO.criaUSER(Diretor);
}
} |
a105a0b3-683b-4f0d-b8f5-44eec15b0911 | 5 | public boolean ordenar()
{
for (int i=1; i<this.capacidade - 1; i++)
{
if(this.aContas[i] != null)
{
ContaCorrente k = this.aContas[i];
int kn = this.aContas[i].getNumero();
int j = i;
while(j > 0 && this.aConta... |
9b7e7244-fdab-4765-88b1-a3072afda746 | 5 | public boolean isFilled() {
boolean test = false;
if (test || m_test) {
System.out.println("Coordinate :: isFilled() BEGIN");
}
if (test || m_test) {
System.out.println("Coordinate :: isFilled() END");
}
return (m_Value == Game.PlayerTurn.PLAYER1 || m_Value ==
... |
fa24fe8f-f6c1-4795-ae4f-bce00d4981d9 | 0 | @Override
public int compareTo(Shape shape) {
return new Integer(getCorners()).compareTo(shape.getCorners());
} |
84a9170d-1dfa-4f48-98a6-63c8de69d857 | 4 | public void applyForceOfGravity(List<? extends SpaceObject> spaceObjects, double dt) {
double fX = 0;
double fY = 0;
for (SpaceObject spaceObj : spaceObjects) {
if (this != spaceObj) {
double x2 = spaceObj.getX();
double y2 = spaceObj.getY();
double r = MathUtils.distance(x, y, x2, y2);
... |
0d57b85f-61cf-4a8b-8fb5-9cd675de33f7 | 0 | public void addComment(String text)
{
comments.add(text);
} |
9c8653c8-9ac4-4549-af8a-268e9828f0d6 | 4 | public boolean execute() throws SQLException {
PreparedStatement ps;
if (columns != null || columns.length() != 0) {
columns.setCharAt(columns.lastIndexOf(","), ')');
if (values != null || values.length() != 0) {
values.setCharAt(values.lastIndexOf(","), ')');
}
builder.append(columns).append(va... |
98e24c16-59cd-4986-95b3-3961a121910a | 6 | public HoughCircleDialog(final Panel panel) {
setTitle("Hough Circle");
setBounds(1, 1, 300, 200);
Dimension size = getToolkit().getScreenSize();
setLocation(size.width / 3 - getWidth() / 3, size.height / 3
- getHeight() / 3);
this.setResizable(false);
setLayout(null);
JPanel pan = new JPanel();
p... |
2c81f45b-5055-4c86-a74e-bde1147b3873 | 0 | public void setUrlModified(boolean urlModified) {
this.urlModified = urlModified;
} |
7f6c0632-d5e4-48e9-b906-ffbf79f9d2b5 | 9 | public double[] getDoubleArrayArgument(String name, boolean required){
if(M.containsKey(name))
{
String a = M.get(name).trim();
if("dD".indexOf(a.charAt(0)) == -1){illFormedArray(a," expected double array: d[a:b:c]");}
if(a.charAt(1) != '[' || a.charAt(a.length()-1) !... |
1bb73704-57a2-4bbc-9b1f-29b8a7bd96a1 | 8 | public List<SiteParser> createParsers() {
List<SiteParser> result = new ArrayList<SiteParser>();
List<SiteParser> parsers;
ClassLoader cl = getClass().getClassLoader();
GroovyClassLoader gcl = new GroovyClassLoader(cl);
/*
try {
Enumeration<URL> parsersUrl = g... |
4f56c878-bc74-46fc-880e-46ddb1ad19c5 | 5 | private String readHeader() {
String s = null;
holdPos = pos;
int i = line.indexOf( ']' );
if ( i != -1 ) {
s = line.substring( pos, ( i + 1 ) );
lastPos = pos;
pos = pos + ( ( i - pos ) + 1 );
checkPos();
int e = s.length() ... |
22c35ba6-3e30-4d70-bed3-eecd0a2d3f24 | 1 | private JMenu makeSizeMenu() {
JMenu size = new JMenu("Size");
for (int i = 0; i < sizeChoices.length; i++) {
final int r = sizeChoices[i][0];
final int c = sizeChoices[i][1];
JMenuItem item = new JMenuItem(r + "-by-" + c);
item.addActionListener( new ActionListener() {
... |
5cdd35b3-d365-4216-8b40-a5889f0af5fb | 6 | public static final void UseReturnScroll(final SeekableLittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
if (!chr.isAlive()) {
c.getSession().write(MaplePacketCreator.enableActions());
return;
}
slea.skip(4);
final byte slot = (byte) slea... |
09e744fb-26c4-48f8-9b34-57f691ef8c4e | 8 | final public void IfExp() throws ParseException {/*@bgen(jjtree) IfExp */
SimpleNode jjtn000 = (SimpleNode)SimpleNode.jjtCreate(this, JJTIFEXP);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
try {
jj_consume_token(IF);
Expression();
jj_consume_token(THEN);
Expression();
... |
a635e838-f524-4927-b2fa-ca064f8f87d8 | 8 | public static double ddot_j (int n, double dx[], int incx, double
dy[], int incy) {
double ddot;
int i,ix,iy,m;
ddot = 0.0;
if (n <= 0) return ddot;
if ((incx == 1) && (incy == 1)) {
// both increments equal to 1
m = n%5;
for (i = 0; i < m; ... |
fcb1f679-65e4-4c8f-8ed7-7d760b349149 | 7 | public void update() throws MaltChainedException {
parentFeature.update();
FunctionValue value = parentFeature.getFeatureValue();
if (value instanceof SingleFeatureValue) {
String symbol = ((SingleFeatureValue)value).getSymbol();
if (((FeatureValue)value).isNullValue()) {
multipleFeatureValue.addFeature... |
9500dc56-b8e4-488d-ab2e-ddd87c043924 | 6 | private boolean validarDatos() {
//unicamente valido el numero de cuenta
boolean valido = false;
Validaciones val = new Validaciones();
if (jTextField1.getText().equals("") || jTextField2.getText().equals("")){
mensajeError("Ingrese un rango de Asientos (1 .. 99).");... |
e331fb01-6a08-4556-9ab1-e9d56a0842d3 | 8 | public void destroy(Integer id) throws NonexistentEntityException {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
Motor motor;
try {
motor = em.getReference(Motor.class, id);
motor.getC... |
cfdc4bee-6fbe-4b6a-a6e6-ff1d22d112c4 | 6 | private static String getValidWebpage(String url) throws TvDbException {
// Count the number of times we download the web page
int retryCount = 0;
// Is the web page valid
boolean valid = false;
DigestedResponse webPage;
while (!valid && (retryCount < RETRY_COUNT)) {
... |
848fa5d2-9a6a-4c17-a69f-df00b324448c | 3 | @Override
public void draw(Graphics2D graphics) {
FontMetrics metrics = graphics.getFontMetrics();
Tile loc = context.players.getLocalPlayer().getLocation();
for (int x = loc.getX() - 20; x < loc.getX() + 20; x++) {
for (int y = loc.getY() - 20; y < loc.getY() + 20; y++) {
Tile t = new Tile(x, y);
if ... |
ba3f078a-b5d4-4c08-8484-eae3c0608107 | 5 | @Test(dataProvider = DATA_PROVIDER)
public void wrongPasswordAndValidAccountEmail(DriverGenerator dg){
// boiler plate
WebDriver wd = dg.generate();
ParallelPrepHelper pph = new ParallelPrepHelper(wd);
// setup
boolean madeItToPage = pph.goToURL(AMAZON_HOME_PAGE);
boolean clickOnSignIn = pph.clickOnVisible... |
35784cd1-28bd-4027-ae66-e3acc90d0081 | 4 | private void writeArray(YamlFile yamlFile, String key, Class<?> parameterType)
{
String className = parameterType.getComponentType().getName();
if(implementsConfigurationSerializable(parameterType.getComponentType()))
{
ConfigurationSerializable serializable = getSerializable(parame... |
74239f15-25a3-47db-a296-535d7f7acf1e | 4 | public static void main(String args[])
{
Scanner S = new Scanner(System.in);
String choice;
String breakf;
System.out.println("User is Hungry");
System.out.println("Get in Line");
System.out.println("Buy Lunch");
System.out.println("Are You thirsty?");
System.out.print("press Y for Yes or N fo... |
d123e453-f266-4444-a7c7-912aa15f9aa4 | 7 | public static void printBest(){
Deck best = Zegana.currentGen[0];
float bestP = Zegana.performance[0];
for(int i=1; i<Zegana.performance.length; i++){
if(Zegana.performance[i]>bestP){
bestP = Zegana.performance[i];
best = Zegana.currentGen[i];
}
}
if((bestP < Zegana.elitePerf) && (Zegana.env == 'f'... |
4402fbcf-ca98-434e-aa6f-76a55632bfad | 6 | public boolean onPlayerRightClick(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack, int par4, int par5, int par6, int par7)
{
if (par3ItemStack != null &&
par3ItemStack.getItem() != null &&
par3ItemStack.getItem().onItemUseFirst(par3ItemStack, par1EntityPlaye... |
2d5b8fbe-89be-487e-9704-c64f11d92672 | 7 | public void performRequest(String request) {
if (request.compareTo("Show preview") == 0) {
showPreview();
return;
}
// first grab the index if any
if (request.indexOf(":") < 0) {
return;
}
String tempI = request.substring(0, request.indexOf(':'));
int index = Integer.parseI... |
71501c16-4551-4b36-a5b7-7c92ee1f6ce6 | 5 | Class187(GameMode class230, int i, IndexLoader class45) {
do {
try {
aClass45_2498 = class45;
if (aClass45_2498 == null)
break;
aClass45_2498.getAmountChildEntries(35);
} catch (RuntimeException runtimeexception) {
throw Class348_Sub17.method2929(runtimeexception,
("qga.<init>("
+ ... |
8652f250-7c59-458f-9635-5ba03bc0e0de | 3 | public void checkwildy()
{
if ((absY <= 10112 && absY >= 3970) || (absY <= 3672))
{
inwildy = true;
}
else
{
inwildy = true;
}
} |
82f415f8-5704-40ce-8fb4-dc2147fffd51 | 4 | public boolean ajouterStation(Station st) {
if (st instanceof ArretDeBus && this.getNbArretDeBus() <= NOMBRE_MAX_ARRETDEBUS) {
return this.stations.add((ArretDeBus) st);
} else if (st instanceof StationTaxis && this.getNbStationTaxi() <= NOMBRE_MAX_STATIONTAXI) {
return this.stat... |
23e689cf-e1c4-451b-b315-00842503874d | 3 | public static Action defaultAction(EntityType type) {
Action action = null;
switch (type) {
case OBJ_TREE:
action = Action.OPEN_CLOSE;
break;
case OBJ_DOOR_WOOD:
action = Action.OPEN_CLOSE;
break;
case E... |
4b6edab8-6117-42e1-bb21-d5edb17532d7 | 0 | public void setPrpMoaConsec(Integer prpMoaConsec) {
this.prpMoaConsec = prpMoaConsec;
} |
af73cf62-2def-4036-82d2-c101932bb151 | 6 | public boolean postMortem(PostMortem pm) {
Keep that = (Keep) pm;
if (this.length != that.length) {
JSONzip.log(this.length + " <> " + that.length);
return false;
}
for (int i = 0; i < this.length; i += 1) {
boolean b;
if (this.list[i] inst... |
85676eeb-86c1-40d3-922e-78c3e8a23c80 | 1 | public void test_getMillis_long() {
assertEquals(0L, iField.getMillis(0L));
assertEquals(1234000L, iField.getMillis(1234L));
assertEquals(-1234000L, iField.getMillis(-1234L));
try {
iField.getMillis(LONG_MAX);
fail();
} catch (ArithmeticException ex) {}
... |
a0817e4d-f430-4880-aa81-556a184c5d5f | 1 | @Override
public Set<Class<?>> getClasses()
{
return super.getClasses();
} |
f0148357-33c6-4508-b573-5a93e49ced34 | 3 | private void processHits()
{
ByteBuffer pixel = ByteBuffer.allocateDirect(16);
GL11.glReadPixels(Mouse.getX(), Mouse.getY(), 1, 1, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, pixel);
int gotId = Utility.glColorToId(new byte[]{pixel.get(0),pixel.get(1),pixel.get(2),pixel.get(3)}, false);
d2.setColor(pixel.get(0),pixel... |
cb69b18d-d7e6-493c-94d2-3687549fc828 | 2 | @Override
public List<Person> meetCriteria(List<Person> persons) {
List<Person> marriedPersons = new ArrayList<>();
for (Person person : persons) {
if (person.getMaritalStatus().equalsIgnoreCase("Married")) {
marriedPersons.add(person);
}
}
return marriedPersons;
} |
5cc74b9c-e6e6-41f1-8868-33e8004b2c39 | 2 | @POST
@Produces(MediaType.TEXT_HTML)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public void newPerson(@FormParam("uid") String id, @FormParam("summary") String summary, @FormParam("description") String description,
@Context HttpServletResponse servletResponse) throws IOException, NumberFor... |
1d968c03-0588-4a8c-bb86-31946ce00098 | 2 | public void print()
{
Nodo<?> nodo = head;
do {
out.println(nodo.getData());
nodo = nodo.getNext();
} while (nodo != null);
} |
8c1cfe3a-647b-4f52-85d8-7014e03cd1f9 | 4 | @Override
public void actionPerformed(ActionEvent e) {
updateCollisionRange();
checkCollision();
if (!jump) {
for (int i = 0; i < collisionRange.size(); i++) {
if (!getRectangle().intersects(collisionRange.get(i))
&& i == collisionRange.size() - 1)
FallDown();
}
} else {
jump();
}
} |
e00d9d68-71dc-4e52-ab0b-585b92ae5a9e | 5 | public void init()
{
try
{
this.ButtonTitle = getParameter("ButtonTitle");
if (this.ButtonTitle == null) {
this.ButtonTitle = "Start Game";
}
String str1 = getParameter("BaseURL");
if (str1 != null)
this.BaseURL = new URL(str1);
else {
this.BaseURL ... |
8c80e895-7ced-486e-af93-8e4bcb0efaae | 3 | public static String getName(File folder, File file) {
String path = folder.getAbsolutePath();
String name = file.getAbsolutePath();
if (name.startsWith(path)) name = name.substring(path.length() + 1);
if (name.endsWith(".gz")) name = name.substring(0, name.length() - 3);
if (nam... |
4a71d4a5-0dd6-4f16-a0fb-d3ea76f4e53d | 7 | public static String timeIntervalToString(long millis) {
StringBuffer sb = new StringBuffer();
if (millis < 10 * Constants.SECOND) {
sb.append(millis);
sb.append("ms");
} else {
boolean force = false;
String stop = null;
for (int ix = 0... |
141af1ed-376e-49cd-864c-c6ec85bb85a0 | 2 | private boolean executeSqlFile(String path){
try{
BufferedReader br = new BufferedReader(new FileReader(path));
String str;
StringBuilder sb = new StringBuilder();
while ((str = br.readLine()) != null) {
sb.append(str + "\n ");
}
... |
41596435-045f-46e6-87e8-c7467085c2a1 | 7 | @Override
public void store(final Document document, Reader reader) {
final String documentId = document.getId();
LOGGER.info(String.format("store document '%s'", documentId));
KeyHolder keyHolder = new GeneratedKeyHolder();
delete(documentId);
LOGGER.debug(String.format(... |
1b64498e-48fb-4dcb-a475-2fd92ac4ac0c | 9 | public void randomlyInitializeParams()
{
//initializes the initial state parameters
double dsum = 0;
probinit = new double[numstates];
for (int ni = 0; ni < probinit.length; ni++)
{
probinit[ni] = theRandom.nextDouble();
dsum += probinit[ni];
}
for (int ni = 0; ni < probinit.length; ni++)
{
... |
47341e49-1684-4ac5-a45e-dd45df9b44b9 | 1 | public static void invokeMain(String className, String[] args) {
try {
Class.forName(className)
.getMethod("main", new Class[] {String[].class})
.invoke(null, new Object[] {args});
} catch (Exception e) {
InternalError error = new InternalError("Failed to ... |
203bbc13-291c-49e9-b14b-b3bf4be1d8ff | 4 | public static ConsolidationFunctionType get(String s) {
if (s.equalsIgnoreCase(STR_AVERAGE)) {
return AVERAGE;
} else if (s.equalsIgnoreCase(STR_MIN)) {
return MIN;
} else if (s.equalsIgnoreCase(STR_MAX)) {
return MAX;
} else if (s.equalsIgnoreCase(STR_LAST)) {
return LAST;
} else {
throw new ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.