method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
c0430ea8-78bd-496a-b033-963b1dc95bb9 | 8 | @Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
double rotation = 0;
if (orientation == ARROW_NORTH) rotation = 0;
else if (orientation == ARROW_NORTHEAST) rotation = Math.PI / 4;
else if (orienta... |
c1fc7b45-a7c6-459b-9860-886078629bb5 | 3 | public void onlyOneElimination()
{
simpleElimination();
ArrayList<Integer> singleInstances = getSingleInstances();
for(int i=0; i<9; i++)
{
for(int j=0; j<singleInstances.size(); j++)
{
if(cells[i].getPosNumbers().indexOf(singleInstances.get(j)... |
fd060a98-994c-4d1a-a1c7-d617f77c1790 | 7 | public static UnitOfWork create(Class<?> workClass,TransactionPolicy policyGraph){
UnitOfWork u = null;
try {
Constructor<?> c = workClass.getDeclaredConstructor();
c.setAccessible(true);
u = (UnitOfWork) c.newInstance();
for(Transaction t:policyGraph.getTransaction()){
if(workClass.getName().equals... |
d8b5898b-a7d2-4694-88c7-437e44857cb6 | 0 | private void setDefaultImportFileFormat(OpenFileFormat aFileFormat) {
defaultImportFileFormat = aFileFormat;
} |
96925e0e-e7d3-4944-852a-3084331ec45e | 7 | protected float adjust(float f){
switch(type.active_type){
case SVDType.LINEAR : break;
case SVDType.SIGMOID_L2 :
case SVDType.SIGMOID_LIKELIHOOD :
f = (float) (1.0 / (1.0+Math.exp(-1.0*f)));
break;
case SVDType.SIGMOID_RANK:
case SVDType.HINGE_SMOOTH:
case SVDType.HINGE_L2:
case SVDType.SIGMOID_Q... |
cf29b120-cbe7-4445-bd2a-921fad96798f | 3 | @Override
public Manutencao listById(int id_manutencao) {
Connection conn = null;
PreparedStatement pstm = null;
ResultSet rs = null;
Manutencao m = new Manutencao();
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(LISTBYID)... |
07c4f811-c8b9-40db-a68f-37e0003e736f | 8 | public static BookmarkReader predictSample(String filename, int trainSize, int sampleSize, boolean predictTags, boolean userBased, boolean resBased, boolean allResources, int beta, boolean bll, Features features) {
//filename += "_res";
//int size = 0;
//if (predictTags) {
// size = trainSize;
//}
Bookma... |
05452765-639d-489a-9c9b-be67aace5c8e | 2 | @Override
public boolean isRoomInInventory() {
for (int i = 0; i < contains.length; i++){
if (contains[i] == null){
return true;
}
}
return false;
} |
087faa9f-5e95-48ad-bb67-97fa846cfe66 | 8 | public static String readContent(String filename) throws IOException, FileNotFoundException{
FileChannel fileChannel = null;
RandomAccessFile file = null;
FileLock lock = null;
try {
file = new RandomAccessFile(filename, "rw");
fileChannel = file.getChannel();
StringBuilder b= new StringBuilder();
... |
1fb4927f-0062-44f2-a265-5b2889c9183c | 9 | @Override
public void logicUpdate(GameTime gameTime) {
// checking if the mouse has moved within the bounds of the shown
// map, so we can update the debug information
if (mouseEventHandler.mousePosX < (tileWidth * tileWeights[0].length)
&& mouseEventHandler.mouseClickPosY < (tileHeight * tileWeights.le... |
5a95f16f-d62b-44e2-b0bc-da7e8271ae21 | 3 | private static void selectionSort(ListItem[] items) {
for (int pass = 0; pass < items.length-1; pass++) {
// System.out.println(pass + "-" + items[pass]);
int indexOfTarget = pass;
int indexOfSmallest = indexOfTarget;
for (int j = indexOfTarget+1; j < items.length; j++) {
if (items[j].getName().compa... |
a36f6f15-0292-44cc-adae-20d381c9367b | 1 | public static void main(String[] args) {
try {
final String input = System.getenv("input"); //getting input
ICalculator calc = new CalculatorRPN();
float result = calc.calculate(input);
String formattedResult = formatResult(result);
System.out.println... |
31510cf8-97df-4301-8a7e-6a9cd5410688 | 4 | public Shirt(int shirtID, String description, char colorCode, double price, int quantityInStock){
this.shirtID=shirtID;
this.description=description;
this.price=price;
this.quantityInStock=quantityInStock;
if(colorCode=='U' ||colorCode=='R'||colorCode=='G'||colorCode=='B'){
this.colorCode=colorCode;
}... |
23adfff4-4186-47f1-8286-c5824d707c42 | 5 | @Test
public void TestaaTyhjaOikeaYlanurkkaVasenAlanurkka() {
rakentaja = new Kartanrakentaja(10, 6);
char[][] kartta = rakentaja.getKartta();
Solmu aloitus = new Solmu(0, kartta[0].length-1);
Solmu maali = new Solmu(kartta.length-1, 0);
Reitinhaku haku = new Reitinhaku(kartt... |
acca060e-8804-41dd-83e1-e237e0f57266 | 2 | public void close() {
if (out != null) {
try {
out.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
} |
6cfd4a94-4611-4db8-9d9e-62cbf6434141 | 7 | private static int executeBatch(PreparedStatement stmt) throws SQLException {
int[] results = stmt.executeBatch();
int resultCount = 0;
int noInfoCount = 0;
int failedCount = 0;
for (int i = 0; i < results.length; i++) {
int result = results[i];
switch (re... |
0c5a3ff8-227c-4113-a9eb-42e3fbc475d8 | 3 | public void disconnect() {
logout(null);
if (socket != null && !socket.isClosed()) {
try {
socket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
} |
f70e67b6-1618-418c-8098-2b326b4d5ac5 | 7 | public boolean action(Event event, Object arg) {
if (event.target == okButton) {
ok = true;
if (cb != null) cb.getOptions();
endDialog();
} else if (event.target == cancelButton) {
ok = false;
endDialog();
} else if (event.target == autoSelect) {
zrle.setEnabled(!autoSele... |
f87a9cd2-c80d-4577-b0ed-6e7f35715ddc | 9 | @Override
public Double documentRank(List<String> document, List<String> query) {
if(document.isEmpty() && query.isEmpty()) return 1.0;
if(document.isEmpty() && !query.isEmpty()) return 0.0;
if(query.isEmpty() && !document.isEmpty()) return 0.0;
HashSet<String> unio... |
98588d30-8e20-4b93-b80d-a474e6111b6d | 7 | @Override
public void processCommand(String... args) throws SystemCommandException {
String matriculation = args[0];
String result = "";
Student student = facade.selectStudent(matriculation);
if (student != null){
result +=
"Matriculation:\t"+student.getMatriculation()+"\n"+
"Name:\t" + stud... |
2a9b6889-0802-42d9-911a-b01de5e76494 | 5 | String []permuting(String str){
int i = 0, j = 0, l, m , n, p, a, b;
String []fables = new String[str.length()];
for (int k = 0; k < str.length() ; k++) {
i = (int)(Math.random()*str.length()-1);
do {
j = (int)(Math.random()*str.length());
... |
11a0a50a-c6c7-4fae-9ff6-59a5e71d961b | 3 | public static void deleteAward(Bean bean) {
try{
String query1="select * from awardstudent where studentid='"+bean.getStudentid()+"'";
String query="delete from awardstudent where studentid='"+bean.getStudentid()+"'";
con=DBConnection.getConnection();
pt=con.prepareStatement(query1);
rs=pt.executeQuer... |
2a59abe4-709e-48a7-b2c4-f4f5b2f6a155 | 0 | public int getS1() {
return this.state;
} |
ed79105b-86e2-4a67-b7c0-20dd13da96ad | 4 | private static byte[] convertAudioBytes( byte[] audio_bytes,
boolean two_bytes_data )
{
ByteBuffer dest = ByteBuffer.allocateDirect( audio_bytes.length );
dest.order( ByteOrder.nativeOrder() );
ByteBuffer src = ByteBuffer.wrap( audio_bytes );
... |
f007dd89-d436-4dbe-8765-dfcfa417ba44 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Player other = (Player) obj;
if (currentDungeon =... |
66761d9e-fdc0-449b-92dd-05363dce4f95 | 4 | public void mousePressed(MouseEvent e){
if(SwingUtilities.isLeftMouseButton(e)){
last_x = e.getX();
last_y = e.getY();
if(sel != -1){
FigureColoree fc = figures[sel];
fc.deSelectionne();
sel = -1;
}
for(int i = 0; i < nbf; i++){
FigureColoree fc = figures[i];
if (fc.estD... |
ba856bd7-252e-430f-895f-d6c98cf7cca4 | 4 | @Override
public void handle(HttpExchange exchange) throws IOException {
System.out.println("In build settlement handler");
String responseMessage = "";
if(exchange.getRequestMethod().toLowerCase().equals("post")) {
try {
//TODO verify cookie method
String unvalidatedCookie = exchange.getRequestH... |
3d9ad015-05b3-4a55-b929-e3d316ba51de | 6 | public T getExtension(String name) {
if (name == null || name.length() == 0)
throw new IllegalArgumentException("Extension name is null");
if ("default".equals(name)) {
return getDefaultExtension();
}
Holder<T> holder = cachedInstances.get(name);
if (holder == null) {
cachedInstances.putIfAbsent(name... |
51b6e77a-9242-4d9b-9206-d380be55c957 | 3 | public void randomize() {
SquareColor[] colors = SquareColor.values();
Random rand = new Random();
for (int row = 0; row < board.getHeight(); row++) {
for (int col = 0; col < board.getWidth(); col++) {
if (rand.nextInt(5) == 0) {
board.setSquare(r... |
61afc123-3638-4085-b7a3-adcc3866de01 | 1 | public static Tex getgrid(final String nm) {
return (AccessController.doPrivileged(new PrivilegedAction<Tex>() {
public Tex run() {
synchronized (grids) {
if (grids.containsKey(nm)) {
return (grids.get(nm));
} else {
loader.req(nm);
return (null);
}
}
}
}));
} |
e221b725-aac7-4256-8b9e-c35aad7d6bf4 | 3 | public int do100baudFFT (CircularDataBuffer circBuf,WaveData waveData,int start) {
// Get the data from the circular buffer
double samData[]=circBuf.extractDataDouble(start,80);
double datar[]=new double[FFT_160_SIZE];
// Run the data through a Blackman window
int a;
for (a=0;a<datar.length;a++) {
if ((a... |
df8f2b13-3043-4ba8-85f7-3a8f2852b730 | 3 | public PacienteDAO getPaciente(){
try{
EntityManager em = conexao();
if (em!=null){
String consulta = "SELECT p FROM Paciente p WHERE p.idPaciente="+id;
System.out.println(consulta);
Query q = em.createQuery(consulta);
List<... |
4aca4574-680e-4b86-8622-2acbd23f8ef7 | 4 | public static void main(String[] args) {
Scanner stdin = new Scanner(System.in);
Fraction f1, f2;
f1 = promptAndReadFraction(stdin, 1);
System.out.println("Should Fraction 2 to refer to " +
"the same object? (yes/no):");
String response = stdin.nextLine();
if (response.equals("yes"))
f2 = f1;
else
... |
1b61dbfa-1a73-447f-bbac-a17b18eff964 | 0 | public Usuario getUsuarioidUsuario() {
return usuarioidUsuario;
} |
7a9f73e3-d1f8-491c-b694-b0878e155cd5 | 9 | public boolean delete(String key) {
final boolean[] delete = new boolean[] { false };
final Visitor<T> visitor = new Visitor<T>() {
public void visit(String key, Tree<RadixData<T>> node) {
final Tree<RadixData<T>> parent = node.getParent();
if (parent == null)
return;
final RadixData<T> data ... |
ad9ee130-64b3-4fce-a6d4-71b6bba79a2d | 5 | public String sayHello(PersonInterface person) throws Exception{
String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
/* save all arguments into an array */
Object[] args = new Object[]{person};
Class<?>[] argsType = new Class<?>[]{PersonInterface.class};
String ret = null;
try ... |
72302f15-59a8-485f-b05a-9e0d5e2466b2 | 0 | @AfterClass
public static void tearDownClass() throws Exception {
} |
7ab9b065-5529-4bb2-aa80-459e79ebbc02 | 0 | private void writeObject(java.io.ObjectOutputStream out)
throws java.io.IOException {
// Force the reference to be resolved, and invalidated.
asString();
// Now we may call the defauult writer.
out.defaultWriteObject();
} |
79a6c416-7318-484b-bf20-7dc475f87ef2 | 5 | public void chercheEnnemi(camp adverse) {
vaisseau allie;
vaisseau ennemi;
for (int h = 0; h < flotte.size(); h++) {
allie = flotte.get(h);
if (allie.isAlive()) {
for (int i = 0; i < adverse.flotte.size(); i++) {
ennemi= adverse.flotte.... |
8bbae033-a0fe-4bd7-82b6-2f7336470ca8 | 8 | private void showAlarms()
{
int valg = -1;
while(valg != 0)
{
ArrayList<Alarm> alarms = user.getAlarms();
System.out.println("=========Showing your alarms=========");
if (alarms.size() > 0)
for (int i = 0; i < alarms.size(); i++)
System.out.println((i+1) + ": " + alarms.get(i));
else
Sys... |
8a5c9948-e060-42c2-af10-5b6e5f032b99 | 5 | public void moveProjectile(boolean gameOver, Projectile projectile) {
if (gameOver) return;
projectile.setX(projectile.getX() + projectile.getXSpeed()) ;
projectile.setY(projectile.getY() + projectile.getYSpeed()) ;
//Check if out of bounds... Not sure if its correct bounds but its pretty close
if(proje... |
3e3f790f-230c-4e74-8cd8-40c2e898da1d | 2 | public void useReserve() {
if(reserves >= 1) {
if(tank.isEmpty()) {
dead = false;
}
tank.setFuelLevel(tank.getFuelCapacity());
reserves--;
}
} |
042b49b5-f830-4fa8-a554-fe3563fa37c3 | 4 | public double get_next_time_double_cpu(Event e) {
switch (e) {
case ARRIVAL: return this.getTempoArrivo();
case CPU1: return this.getTempoCPU1();
case CPU2: return this.getTempoCPU2();
case IO: return this.getTempoIO();
}
return 0;
} |
2f464e32-9db4-4f06-9cf7-2974dd8dd41e | 8 | protected void partialTag(Hmm hmm, SequenceInput input,
SequenceOutput partiallyLabeledOutput,
SequenceOutput predictedOutput) {
// Example length.
int numberOfStates = hmm.getNumberOfStates();
int lenExample = input.size();
// Best partial-path weights.
double[][] delta = new double[lenExample][number... |
cd5d092e-08ba-4186-8ef2-8489b960a125 | 5 | public boolean isMaterialInBB(AxisAlignedBB var1, Material var2) {
int var3 = MathHelper.floor_double(var1.minX);
int var4 = MathHelper.floor_double(var1.maxX + 1.0D);
int var5 = MathHelper.floor_double(var1.minY);
int var6 = MathHelper.floor_double(var1.maxY + 1.0D);
int var7 = ... |
c4af87e6-4707-4030-941d-8f091896250c | 3 | public void reselect() {
if (lastClassName != null) {
TreePath lastPath = (hierarchyTree ? hierModel
.getPath(lastClassName) : packModel.getPath(lastClassName));
if (lastPath != null) {
classTree.setSelectionPath(lastPath);
classTree.scrollPathToVisible(lastPath);
}
}
} |
daa9ba07-a521-43d5-9aa8-4a4f64a6a3de | 6 | public static void startupHtmlDescribeObject() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/ONTOSAURUS", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$... |
cf03ae17-f511-45f3-9085-d26a630a2a9a | 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... |
ed04b904-d2d6-4e51-a425-651c8e64aabb | 4 | public int moveByString(String direction){
int moved = 0;
direction.toLowerCase();
switch(direction.charAt(0)){
case 'u': moved=this.up();
break;
case 'd': moved=this.down();
break;
case 'l': moved=this.left();
break;
case 'r': moved=this.right();
... |
72df12a3-0b94-4769-b2c8-94765e548aa9 | 7 | private SessionState sessionRead(String cookie_vals, HttpServletRequest req){
SessionState state = null;
String[] sTemp = cookie_vals.split("\\^");
String sID = sTemp[0];
int ver = Integer.parseInt(sTemp[1]);
String ipP = sTemp[2].split(":")[0];
int portP = Integer.parseInt(sTemp[2].... |
f31a2eb0-480f-4d72-b55b-d3451b77a18e | 6 | private void sortRookKnightBishop(int i, boolean tm) {
for (int j = 0; j < 2; j++) {
int indv = 0; // 1st place
if (j > 0) {
indv = 7; // 2nd place
}
Rooks[i + j] = new Rook(tm, indv);
}
for (int j = 0; j < 2; j++) {
int indv = 1;
if (j > 0) {
indv = 6;
}
Knights[i + j] = new Knig... |
2277f7e1-729e-4180-880d-f2f811d1eedc | 6 | public static void main(String[] args) {
BeanDBAccessCSV csv = new BeanDBAccessCSV();
try {
csv.Initialize();
csv.Connect();
Statement stmt = csv.NewStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM 'prices.csv'");
for (in... |
e0430aec-593f-4895-93cf-3962fe0e3995 | 2 | private static void readMagicItemsFromFileToList(String fileName,
ItemList lm) {
File myFile = new File(fileName);
try {
Scanner input = new Scanner(myFile);
while (input.hasNext()) {
// Read a line from the fil... |
4fbb2652-fb95-4268-b5de-081919b80b33 | 8 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if((affected==null)||(!(affected instanceof MOB)))
return super.okMessage(myHost,msg);
final MOB mob=(MOB)affected;
if(msg.amISource(invoker)
&&(msg.amITarget(mob))
&&(msg.targetMinor()==CMMsg.TYP_DAMAGE)
&&(msg.tool()=... |
ecb09a30-008f-41a5-b18d-73198aa986d6 | 0 | public static Date addYear(Date date, int year) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.YEAR, year);
return calendar.getTime();
} |
802d53df-d127-4a9f-85c4-6300168d57d4 | 9 | public static final void nbest_sign(final float[] in,
final int offset,
final float[] codebook,
final int len,
final int entries,
... |
7baa2376-0b43-40df-8e4b-663847641ace | 1 | public Double getDoubleItem(String... names) throws ReaderException {
try {
return Double.parseDouble(getItem(names).toString());
} catch (NumberFormatException e) {
throw new ReaderException("No key exists with this type, keys: " + _parseMessage(names) + ". In file: " + ConfigurationManager.config_file_path... |
9fdf9627-b264-4043-95c4-dfdb5ad0231d | 6 | @Override
public void onRender(Graphics g, Level level) {
if(level.selectedShip!=null){
if(level.selectedShip.intValue()==id){
Point2D.Double lastLocation = location;
Point2D.Double lastVelocity = velocity;
Entity e=this;
double timeStep =0.004;
Entity fastest=this;
Entity slowest=this;
... |
fe54d570-d340-42a2-9e92-c25f6169a2d0 | 4 | public void test_06() {
for (int numInts = 10; numInts < 1000; numInts *= 2) {
// Create 'original' intervals
Markers intervals = randomIntervals(numInts, maxLen, 20, 2);
// Create forest (one tree per chromosome)
IntervalForest forest = new IntervalForest(intervals);
if (verbose) {
intervals.so... |
1028f1d1-c7f7-4441-a548-666b72b88098 | 9 | private List<String> print_content(HttpsURLConnection con, String filename) {
List<String> allTweetText = new ArrayList<String>();
if (con != null) {
try {
System.out.println("****** Content of the URL ********");
BufferedReader br = new BufferedReader(new InputStreamReader(
con.getInputStream... |
531441ad-b18a-4dd5-b6cb-40092b68b8c9 | 1 | public InstrInfo remove() {
if (first == LAST)
throw new NoSuchElementException();
InstrInfo result = first;
first = result.nextTodo;
result.nextTodo = null;
return result;
} |
52d18e0e-9d2a-4b94-8bc0-359c147cff7e | 1 | public static void main(String[] args) {
Map<Integer, Employee> empMap =new HashMap<Integer, Employee>();
empMap.put(2, new Employee(101, "Atul", 01));
empMap.put(5, new Employee(104, "Ram", 03));
empMap.put(1, new Employee(102, "John", 02));
empMap.put(3, new Employee(105, "Smith", 02));
empMap.put(4, new... |
ffa46d1d-b103-437e-be2a-31f8ff53f28d | 8 | public void mouseClicked(MouseEvent e) throws NullPointerException {
if (buttonPane.addVar == true) { //If user wants to add a class
//If left mouse button is being clicked
if(SwingUtilities.isLeftMouseButton(e)) {
//Display AddClassDialog window with link to CanvasPanel and mouse position coordina... |
1c3aa32e-5af1-468d-ad73-e8054bf17cf2 | 5 | public UsuarioSistema Abrir(int id) throws Exception{
UsuarioSistema usuario_sistema = null;
try{
PreparedStatement comando = banco.getConexao()
.prepareStatement("select p.id as Id_Usuarios_Sistema,p.id as"
+"Id_Pessoa,p.nome,p.cpf,p.rg,p... |
af6fa8a8-f1cc-496f-8210-1bcbce153eb8 | 2 | public EmotionalSentiment () {
positiveHashMap = new HashMap();
negativeHashMap = new HashMap();
for ( int i = 0 ; i < positiveList.length ; i++ ) {
positiveHashMap.put(positiveList[i],"*");
}
for ( int i = 0 ; i < negativeList.length ; i++ ) {
negativeH... |
2b200ee2-0e89-4675-a9d7-4af1a2e1336d | 5 | private void process() {
boolean[][] ncells = new boolean[cheight][cwidth];
for (int y = 0; y < cheight; y++) {
for (int x = 0; x < cwidth; x++) {
int nei = neighbours(x, y);
if (nei < 3) {
unset(ncells, x, y);
} else {
... |
d5e2d281-ab8c-4b4e-b4a6-076c8b3b0f3e | 1 | @Override
public double sample() {
double u = ThreadLocalRandom.current().nextDouble();
if (u < fc) {
return min + Math.sqrt(u * (max - min) * (likely - min));
} else {
return max - Math.sqrt((1 - u) * (max - min) * (max - likely));
}
} |
102a7c91-e421-487c-b760-40cfd5587222 | 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... |
956c2136-6680-43b6-ac17-576b5942f772 | 3 | public void makeMaxMin() {
max = Default_Value;
max = Default_Value;
for (Map.Entry<Integer, Integer> token : rand.entrySet()) {
if (max < token.getValue()) {
max = token.getValue();
}
if (min > token.getValue()) {
max = token.g... |
df2e3afb-6767-4460-8063-cee76fabd3e6 | 9 | @Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof Book)) {
return false;
}
final Book other = (Book) obj;
if (author == null) {
if (other.author != null) {
return false;
}
} else if (!author... |
49f84a99-e5ef-4958-9f3c-e4a677e6de0c | 8 | public void driveTo(Minecart minecart, String to) {
Location loc = minecart.getLocation();
if (to.equalsIgnoreCase("N") || to.equalsIgnoreCase("North")) {
loc.setZ(loc.getBlockZ() - 1);
minecart.setVelocity(new Vector(0, 0, -minecart.getVelocity().length()));
} else if (t... |
708b0fb4-193a-48ee-8651-3fd8e4174f36 | 7 | public static String timeUntil(Long sec) {
if (sec < 120L) {
Integer buf = Math.round((float) sec);
return buf + " second" + (buf == 1 ? "" : "s");
}
if (sec < 7200L) {
Integer buf = Math.round((float) (sec / 60L));
return buf + " minute" + (buf ==... |
40fb1b24-28eb-48b5-b0d7-927681bb0208 | 1 | private String sendRequest(String requestLink) throws IOException {
URL requestUrl = new URL(requestLink);
HttpURLConnection con = (HttpURLConnection) requestUrl.openConnection();
con.setRequestMethod(HTTP_GET);
con.setDoOutput(true);
con.connect();
int responseCode = con... |
ea6ce5d3-98aa-4598-b67f-5327a4635886 | 7 | public void save(T entity,String tableName) throws Exception{
String realTableName = "".equals(Util.nullToString(tableName)) ?
entity.getClass().getSimpleName().toLowerCase() : tableName.toLowerCase();
//SQL语句,insert into table name (
String sql = "insert into " + realTableName +... |
6d3c18d6-89f4-4f2d-974d-1b1b0d182746 | 0 | @Override
public void mouseExited(MouseEvent e)
{
Game.gui.update(false);
Game.gui.update(0, 0);
} |
521f0360-86ca-4e78-93e8-4ed05a19bcb8 | 1 | public Boolean isSingleGlyphSelection(){
return (this.startRow == this.endRow) && (this.startCol == this.endCol);
} |
a489360a-a861-467f-8e75-a3ad07cc418f | 0 | private static void easyInitialize()
{
allPatterns.add(new Pattern("*,*,c"));
allPatterns.add(new Pattern("A,*,B,*,C"));
allPatterns.add(new Pattern("users"));
allPatterns.add(new Pattern("users,*"));
allPatterns.add(new Pattern("*,b,*"));
allPatterns.add(new Pattern("users,*,purchases"));
allPatterns.ad... |
a52bb8cf-85ef-42be-9ec1-e260cbaa6a1d | 1 | @Override
public void actionPerformed(ActionEvent e) {
String url = BmTestManager.getInstance().getTestUrl();
if (url != null) {
GuiUtils.navigate(url);
} else {
JMeterUtils.reportErrorToUser("Test is not selected. Nothing to open.");
}
} |
a510d2b1-1c26-4953-b1d9-8fd6f5c35c64 | 7 | private static MarkupSelectorItem.IndexCondition parseIndex(final String indexGroup) {
// Look for the 'even()' and 'odd()' selectors
if (MarkupSelectorItem.ODD_SELECTOR.equals(indexGroup.toLowerCase())) {
return MarkupSelectorItem.IndexCondition.INDEX_CONDITION_ODD;
}
if (M... |
a1ae4618-5629-4e1f-9f50-13f17ef7106f | 8 | public void handleXmlDeclaration(
final char[] buffer,
final int keywordOffset, final int keywordLen,
final int keywordLine, final int keywordCol,
final int versionOffset, final int versionLen,
final int versionLine, final int versionCol,
final int... |
58aa196e-9908-417e-a7d3-ab0baefba040 | 1 | private void createForceFields(ForceFieldGenerator forceFieldGenerator, Entry<ForceFieldGenerator, Direction> neighbour) {
Position posCurFFG = getGrid().getElementPosition(this);
Position posOtherFFG = getGrid().getElementPosition(neighbour.getKey());
// Place ForceFields between the 2 forcefieldgenerators
Li... |
476fff72-c733-487c-8e8b-a38fcb6bd333 | 3 | public void loadwait() {
boolean i = false;
synchronized (loadwaited) {
loadwaited.add(this);
}
synchronized (this) {
boostprio(10);
while (loading) {
try {
wait();
} catch (InterruptedException e) {
i = true;
}
}
}
if (i)
Thread.currentThread().interrupt();
} |
a729cbcd-9808-431e-951a-f748ad517522 | 0 | @Override
public Object getValue() {
return this.playCounter;
} |
e402c502-91ae-4628-a099-be3fa876ce66 | 3 | private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
Transferable clipboardContent = getToolkit().getSystemClipboard().getContents(this);
if ((clipboardContent != null)
&& (clipboardContent.isDataFlavorSupported(DataFlavor.strin... |
7048fbf7-9b85-4386-bcc9-a8be03ca76c3 | 0 | @Before
public void setUp() {
} |
4543c999-cd3b-44cb-a10c-9df9f4b17381 | 7 | public void convert(Root root) {
try {
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
doc = docBuilder.newDocument();
Element rootElement = doc.createElement(root.getLabel(... |
dcabb447-8dea-409e-888f-d979f16f4699 | 5 | private List<File> find(String start, String extensionPattern)
{
final List<File> files = new ArrayList<File>(1024);
final Stack<File> dirs = new Stack<File>();
final File startdir = new File(start);
final Pattern p = Pattern.compile(extensionPattern,
Pattern.CASE_INSENSITIVE);
if (startdir.isDirectory... |
15270944-8f41-46aa-8d8a-416173b9ee27 | 2 | public void printAnalysisResultsSummary() {
String string = "";
for (int i = 0; i < consumptionEnergyPoints.length; i++)
string += "\t\tFR" + (i + 1) + ": " + consumptionEnergyPoints[i] + "EP\n";
string += "\n";
for (int i = 0; i < consumptionWatt.length; i++)
string += "\t\tFR" + (i + 1) + ": " + consump... |
fb1c2a47-ec2d-49af-9122-7a208b97ef3f | 3 | @Override
public boolean removeAll(Collection<?> c) {
boolean b = false;
for (Iterator<T> iterator = this.iterator(); iterator.hasNext(); ) {
T t = iterator.next();
if (c.contains(t)) {
iterator.remove();
b = true;
}
}
return b;
} |
558b1c66-987a-4b75-8dcd-97dea3051204 | 8 | public void buildPredictionChart(RetailSystemDriver driver){
this.driver = driver;
Calendar rightNow = Calendar.getInstance();
/*creating timeSeriesCollection*/
// Calendar c = Calendar.getInstance();
int month = rightNow.get(Calendar.MONTH);
TimeSeriesCollection dataset = new TimeSeriesCollection();
... |
2bbf0b20-e498-4698-8c53-0109e1daa1e2 | 5 | @Override
protected void onMessage(String channel, String sender, String login, String hostname, String message)
{
super.onMessage(channel, sender, login, hostname, message);
if(channel == null)
{
Main.gui.tabs.get(servertab).addMessage(sender, message);
}
else
{
int targettab = 0;
int i = 0;
... |
eb11101d-0d0e-4385-9fa4-725510f0eff5 | 1 | public void interrupt() {
Thread t = threadVar.get();
if (t != null) {
t.interrupt();
}
threadVar.clear();
} |
15e2a2c2-5043-457a-9f51-3658fdfb46c2 | 1 | @FXML
private void handleBtnDeleteAction(ActionEvent event) {
int selectedIndex = table.getSelectionModel().getSelectedIndex();
if (selectedIndex > -1) {
ItemSaleModel model = table.getItems().remove(selectedIndex);
sumTotalAmount(Integer.parseInt(model.getAmount()) * -1);
... |
442896fc-394c-45bc-a315-9858f96da9ad | 0 | public void setMajor(String major) {
this.major = major;
} |
4eafa8af-cfe9-4998-a520-9ea5184f0193 | 3 | public static ArrayList<bAssistecConsulta> getSintomas(
String arg_prod,
String cod_comp,
String arg_serial,
String arg_dt1,
String arg_dt2) throws SQLException, ClassNotFoundException {
ResultSet rs;
ArrayList<bAssistecConsulta> sts = new Arr... |
982b8397-dfe4-4482-8de6-234f019f08fb | 6 | public void resetTempItems(){
synchronized(c) {
int itemCount = 0;
for (int i = 0; i < c.playerItems.length; i++) {
if (c.playerItems[i] > -1) {
itemCount=i;
}
}
c.getOutStream().createFrameVarSizeWord(53);
c.getOutStream().writeWord(5064);
c.getOutStream().writeWord(itemCount+1);
f... |
2f697cc2-b934-415c-9577-87b21c0a9a79 | 3 | public void searchControle() {
facesContext = FacesContext.getCurrentInstance();
List<Controle> listControle;
try {
searchProcedimento();
listControle = genericDAO.searchObject(Controle.class,"controle",
null, null,
new String[]{"exame"}, new Object[]{procedimento})... |
a7adb325-bf22-4135-81b2-2c4f1b253bba | 5 | @Override
public int hashCode() {
int result = name != null ? name.hashCode() : 0;
result = 31 * result + (description != null ? description.hashCode() : 0);
result = 31 * result + (startTime != null ? startTime.hashCode() : 0);
result = 31 * result + (endTime != null ? endTime.hashC... |
dcd9219e-6a17-43f6-9951-900b5e689cc3 | 1 | public void lisaaTiedote(Tiedote t) throws DAOPoikkeus {
// Lisätään tiedote tietokantaan
try {
TiedoteDAO tDao = new TiedoteDAO();
tDao.lisaaTiedote(t);
} catch (DAOPoikkeus p) {
// virheen tapahtuessa heitetään poikkeus.
throw new DAOPoikkeus("... |
af4c654c-b41c-4de0-b6fe-6f8264d15aae | 0 | ValueFormatType(String v) {
value = v;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.