method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
bc72efbf-40df-4075-90be-90cf908d2a50 | 1 | public static void main(String[] args) {
Random rand = new Random(47);
Set<Integer> intset = new HashSet<Integer>();
for (int i = 0; i < 10000; i++)
intset.add(rand.nextInt(30));
System.out.println(intset);
} |
c47256de-b433-4a1e-b478-61f20994974b | 7 | public SymbolGraph(String name, String delimiter) {
Scanner scn = null;
try {
scn = new Scanner(new File(name));
st = new ST<String, Integer>();
// reading the distinct vertices in ST
while (scn.hasNextLine()) {
String line = scn.nextLine();
String[] words = line.split(delimiter);
for(Strin... |
c240fb44-89ab-4f0e-9436-0605636034fa | 5 | private void assignHypotheses(final List<Expression> hypotheses, final Substituter substituter)
throws VerifyException {
final int size = hypotheses.size();
final int start = proofStack.size() - size;
if (start < 0) {
try {
feed.reject("Too few hypotheses on stack");
} catch (ScannerException ignored) ... |
4e3c2115-7b7e-41c0-8faf-1bcf309096c8 | 7 | static void test4()
throws HtmlException, IOException
{
Reader in = new StringReader(
"</html>\n"+
"<?XML version=\"1.0\" encoding=\"UTF8\" ?>\n"+
"<!DOCTYPE>\n"+
"<IMG/>\n"+
"<IMG src=a.gif / >\n"+
""
);
HtmlStreamTokenizer tok = new HtmlStreamTokenizer(in);
HtmlTag tag = new HtmlTag();
... |
b0ce73b5-3dd7-4aa6-ba0c-e70b9d0372c2 | 7 | public void suoritaKomento(Kortti kortti, Robotti robo) {
switch(kortti.getToiminto()){
case KAANNOSOIKEALLE: robo.setSuunta(robo.getSuunta()+1);
break;
case KAANNOSVASEMMALLE:robo.setSuunta(robo.getSuunta()+3);
... |
35e71940-9514-4618-84c9-08671b0a51d8 | 0 | public void setCantidad(int cantidad) {
this.cantidad = cantidad;
} |
f880d52d-3fb2-463b-aa20-6731aaf06c1e | 2 | @RequestMapping(value = {"/CuentasBancarias"}, method = RequestMethod.GET)
public void readAll(HttpServletRequest httpRequest, HttpServletResponse httpServletResponse) {
try {
ObjectMapper jackson = new ObjectMapper();
String json = jackson.writeValueAsString(cuentaBancariaDAO.findAl... |
7481e34f-7264-4e25-a5f6-2d3cf87230d4 | 2 | public Object get(int index) {
if( index >= size || first == -1 ) {
return null;
}
return getNode(index).value;
} |
4d84378a-d918-4ac4-86bc-9087098f8465 | 2 | private void changeTracks(JList jListSource, List<Track> trackSource, List<Track> trackTarget, DefaultListModel listSource, DefaultListModel listTarget) {
//Intercambia las pistas entre las listas de pistas mantenidendo
//la posicion de la seleccion y actualiza los titulos de las mismas.
int in... |
25fec0af-ca51-497f-9685-69f8dc4e2a99 | 3 | public boolean withdrawClaim(Claim c, String actionType) {
boolean flag = false;
Element claimE = (Element) document
.selectSingleNode("//" + actionType + "[@id='" + c.getId() + "']");
if (claimE != null) {
claimE.element("dialogState").setText(c.getDialogState());
System.out.println("withdraw" + c.getI... |
56618eb7-2e21-447c-90ef-5ec8702b8e6e | 6 | public boolean isAnimalFood(Material item){
if(item == Material.HAY_BLOCK || item == Material.SEEDS || item == Material.ROTTEN_FLESH || item == Material.RAW_BEEF || item == Material.PORK
|| item == Material.RAW_FISH){
return true;
}else{
return false;
}
} |
d7487f21-230b-4233-8d4f-2b554c0d1022 | 8 | @EventHandler
public void onBlockBreak(BlockBreakEvent e){
if (players.contains(e.getPlayer().getName())){
if (checkMode == CheckMode.MATERIAL){
if (listMode == ListMode.WHITELIST){
if (!materialList.contains(e.getBlock().getType())){
e.setCancelled(true);
this.pmModule.send(e.getPlayer(), th... |
3d5b0ca0-5a48-4cbc-a5d3-a752842105b9 | 1 | public String zero(int n){
String result ="";
for(int i=0; i< n;i++){
result += "0";
}
return result;
} |
68978c22-b08e-46cc-a06d-4677ccb60ba5 | 6 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MessageHistory that = (MessageHistory) o;
if (type != that.type) return false;
if (text != null ? !text.equals(that.text) : that.text != null) return false;
return true;
} |
9e403716-6641-4fdd-bc85-8ceb82a88f35 | 7 | protected synchronized boolean insert(SCollisionObject collisionObject){
if(collisionObject == null)
return false;
if(!contains(collisionObject)){
if(getParentNode() != null)
return getParentNode().insert(collisionObject);
System.err.println("QuadTreeNode.root : CollisionObject "+collisionObject... |
cc7df4b8-680a-46b8-9d01-78e8c6282b40 | 4 | @Override
public void received(Connection c, Object o){
if(o instanceof LoginDataPacket) {
LoginDataPacket packet = (LoginDataPacket) o;
if(packet.username.isEmpty() || packet.password.isEmpty())
{
Protocol.sendError(c, ERROR.WRONG_LOGIN_DATA);
... |
0a1c5be0-b644-401c-a665-fe6ae39e778b | 0 | public void windowClosing(WindowEvent event) {
close();
} |
e4b8227c-2aa5-4a39-a001-e54ca4b3dd7d | 3 | private void CofigureSimulator()
{
ConfigFile cfg = new ConfigFile();
if (FABRICTYPE.compareToIgnoreCase("Bus") == 0)
{
//create the fabric type, and pass input & output buffer
this.sFabric = new Bus(FABRICSPEED,inputBuffer,outputBuffer);
}
... |
98b6d00c-8b71-44f3-a632-f3880301c64e | 8 | @Override
public Map<String, JobStatus> getJobStatus(Collection<String> jobNames) {
Map<String, JobStatus> result = new HashMap<String, JobStatus>();
Document dom;
try {
dom = new SAXReader().read(url);
} catch (DocumentException e) {
logger.error("Failed to p... |
575afbd3-4ce3-438b-8d93-29c383f57706 | 3 | private int insert(Consulta p) {
//data_consulta, descricao, tipo_consulta, horario, codigo_paciente
Connection con = null;
PreparedStatement pstm = null;
int retorno = -1;
try {
con = ConnectionFactory.getConnection();
pstm = con.prepareStatement(INSERT, ... |
50d5b2cd-bdc2-4bf5-972d-61b7899b07ef | 6 | public static void quicksort(String terms[], int freqs[], int left, int right)
{
if (left == right)
return;
int loopLeft = left;
int loopRight = right;
int pivotIndex;
int mid = (left + right) / 2;
while(true)
{
pivotIndex = partition(terms, freqs, loopLeft, loopRight, mid);
if (pivotIndex... |
796ec66e-d6c3-441a-bdc3-49ebd9fa437b | 5 | public static String func_27185_a(String var0, String var1, Map var2) {
StringBuilder var3 = new StringBuilder();
StringBuilder var4 = new StringBuilder();
boolean var5 = true;
var3.append("{\r\n");
if (var0 != null && var1 != null) {
var3.append(" \"user\":{\r\n");
... |
398a2adf-d4e9-44cd-8978-1812cc9d8af1 | 8 | public Metadata readNextMetadata() throws IOException {
Metadata metadata = null;
boolean isLast = (bitStream.readRawUInt(Metadata.STREAM_METADATA_IS_LAST_LEN) != 0);
int type = bitStream.readRawUInt(Metadata.STREAM_METADATA_TYPE_LEN);
int length = bitStream.readRawUInt(Metadata... |
47fbb541-d80e-47c5-8493-2e6314266e13 | 6 | private static void rake(final Player player, final WorldObject object) {
if (!player.getInventory().containsItem(5341, 1)) {
player.getPackets().sendGameMessage("You'll need a rake to get rid of the weeds.");
return;
}
WorldTasksManager.schedule(new WorldTask() {
int loop;
int configValue;
@Overri... |
0adf4cf7-d321-4bbb-bad2-84ac1374b42f | 3 | private void readPLTE() throws IOException {
int paletteEntries = chunkLength / 3;
if(paletteEntries < 1 || paletteEntries > 256 || (chunkLength % 3) != 0) {
throw new IOException("PLTE chunk has wrong length");
}
palette = new byte[paletteEntries*3];
readChunk(palett... |
e1ccc209-a9d1-4032-8e8e-81c3f2f343e0 | 9 | @EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
// Drachen "Feuer" spucken lassen
if (((e.getAction() == Action.RIGHT_CLICK_AIR) || (e.getAction() == Action.RIGHT_CLICK_BLOCK))
&& (e.getPlayer().getVehicle() != null)
&& (e.getPlayer().getVehicle().getType() == EntityType.ENDER_DRAGON)) ... |
6f0ac5bb-c251-403f-8025-bce94e5a6183 | 3 | public int[] getX()
{
int[] array = new int[size];
if(start_x > stop_x)
{
int index = 0;
for(int x = start_x; x >= stop_x; x--)
{
array[index++] = x;
}
}
else
{
int index = 0;
for(int x = start_x; x <= stop_x; x++)
{
array[index++] = x;
}
}
return arra... |
9939fd68-55d7-45fd-beaa-894ff9bcae76 | 5 | public synchronized static Collection sellStock(String tickername,
User username, int no, ArrayList<User> users,
ArrayList<Stock> stocks) {
stocks = DataReader.getStocks();
users = DataReader.getUsers();
tickername = tickername.toUpperCase();
// initialize a collection to hold the updated values
Collect... |
007f52d4-7c45-4c8e-8972-5f7ea21b62b4 | 3 | @Override
public void start(StyledText outputText, String text, Button buts) throws IOException {
this.text = text;
this.but = buts;
phones.clear();
this.outputText = outputText;
if (files.size() == 0) {
print("请先添加号码文件");
Display.getDefault().asyncExec(new Runnable() {
@Override
public void r... |
0105d05d-577d-4474-889c-b241259c3cba | 3 | public void printGridletList(boolean history)
{
String name = super.get_name();
int size = list_.size();
Gridlet gridlet = null;
String indent = " ";
System.out.println();
System.out.println("========== OUTPUT for " + name + " ==========");
System.out.prin... |
7f808d12-5607-4374-bc46-e84be20f3a8b | 8 | public void printALl()
{
// Table print
System.out.print(" ");
for(int a=0; a < itemIds.length; a++)
{
if(itemIds[a] < 10)
System.out.print(itemIds[a]+" ");
else
System.out.print(itemIds[a]+" ");
}
S... |
32633233-c8ae-4096-8b9f-2f85d3c4eed4 | 0 | @Override
public ArrayList<Excel> getColoredExes() {
return coloredEx;
} |
827095db-350b-4c90-8a4f-ade0454e6bca | 4 | private void setup() {
this.imageData = new byte[this.tileWidth * this.tileWidth * 4];
this.compassIconImageData = new int[this.tileWidth * this.tileWidth];
this.tileImage = 1;
try {
BufferedImage ioexception = ImageIO.read(Minecraft.class.getResource(Minecraft.ITEMS_TEXTURE... |
5b124730-c71d-4829-b738-477f9490a0b3 | 5 | public void printNodesByLevel(ArrayList<ArrayList<Integer>> levelNodes) {
if (levelNodes == null)
return;
System.out.println("[");
for (int i = 0; i < levelNodes.size(); i++) { // each level
System.out.print("[");
for (int j = 0; j < levelNodes.get(i).size(); j++) {
if (j == 0)
System.out.print... |
524c0f6a-d88f-4689-9b6d-7ae4cd2267c2 | 5 | public double tan(int a){
//normalizing
if(a>360){
a %= 360;
}else if(a<0){
a += 360;
}
//return
if(a <= 90){
return tan[a];
}else if(a <= 180){
return -tan[a - 90];
}else if(a <= 270){
return tan[a - 180];
}else{
return -sin[a - 270];
}
} |
c2e8f902-3d40-4e09-9b57-a6ecce48b8d8 | 6 | * @param modulename
* @return Cons
*/
public static Cons getQuotedTree(String treeName, String modulename) {
{ MemoizationTable memoTable000 = null;
Cons memoizedEntry000 = null;
Stella_Object memoizedValue000 = null;
if (Stella.$MEMOIZATION_ENABLEDp$) {
memoTable000 = ((Memoizati... |
7b397fb5-2d34-471f-bf22-58ff73dc138c | 7 | public boolean eventGeneratable(String eventName) {
if (eventName.equals("configuration") && m_Filter != null) {
return true;
}
// can't generate the named even if we are not receiving it as an
// input!
if (!m_listenees.containsKey(eventName)) {
return false;
}
Object ... |
ff1048bc-5d40-40e3-a94b-6c0fa9073b57 | 4 | public void remove(int i) {
if (i < length) {
Node<T> ele = _head;
if (i == 0)
_head = ele.getNext();
else {
for (int x = 0; x < i - 1; x++)
ele = ele.getNext();
if (i == length - 1) {
ele... |
67282f3e-26b8-4541-bcea-aa6bb68ef192 | 7 | @Override
//TODO caching previous button that was clicked in checking it
public void actionPerformed(ActionEvent e) {
++totalClicks;
System.out.println("total clicks " + totalClicks);
Card cardClicked = (Card) e.getSource();
clickNumber++;
if(clickNumber == 1) {
... |
6e8a2286-99f6-4cd7-99bb-955b04b0eb5a | 8 | public static void main(String[] args)
{
System.out.println("Reading Array ...");
ArrayList<Long> array = readNumbersArrayFromFile();
System.out.println("Reading Array Completed ...");
//SORT THE ARRAY
Collections.sort(array);
System.out.println("Sorting Completed ..... |
3d927622-a2cf-45df-ad07-d45a28c30745 | 4 | private void checkEmployerID() {
if(employerField.getText().length() > 0) {
try {
int employerID = Integer.parseInt(employerField.getText());
if(employerID > 0) {
if(employerID < ReadFromFile.getNumberFromFile("company.txt")) {
Company [] checkCompany = ReadFromFile.findAllCompanyData();
e... |
9bec38df-56df-4aa3-8530-91df15e132c6 | 9 | public static int[] genomesIdListOfSubGroupFromJsonArray(JSONArray organizedJson, String key){
int len = organizedJson.length();
int i,j,k,l;
ArrayList<Integer> id_list = new ArrayList<Integer>();
boolean ok = false;
for(i = 0; i < len && !ok; i++)
{
JSONArray groups = organizedJson.getJSONObject(i).getJ... |
0ef0cddf-f802-4ab7-b8cc-752f40857bb7 | 0 | ServerCommand(int id, String name) {
this.id = id;
this.name = name.toLowerCase();
} |
2b70c48e-0fa5-4084-b283-db41433a8d20 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ReviewJournal other = (ReviewJournal) obj;
if (title == null) {
if (other.title != null)
return false;
} else if (!title.equals(other... |
063beb64-d006-410e-82d8-d9a929e4c50f | 0 | public int GetPersonNumber()
{
return personNumber;
} |
80afc91b-f5a0-4c60-a62f-a773748bc670 | 2 | public void mapGeneratedFields(ResultSet resultSet) throws ResultMapException {
if(instances != null && !instances.isEmpty()) {
queryResultMapper.mapGenerated(instances, resultSet);
}
} |
d1465f10-3a07-4e42-acc3-e57bac82e359 | 7 | public Graphics(float[][] objectMap) {
SimpleUniverse universe = new SimpleUniverse();
BranchGroup group = new BranchGroup();
float size = 30;
// X axis made of spheres
for (float x = .0f; x <= size; x = x + 1f) {
Sphere sphere = new Sphere(0.05f);
T... |
4741f4e6-4d1b-4ddb-8f59-d051fdc7ae83 | 5 | public boolean has(Vector v){
final int x = v.getBlockX(), y = v.getBlockY(), z = v.getBlockZ();
return x >= 0 && x < width && y >= 0 && y < height && z >= 0 && z < length;
} |
3c91a534-c271-4d18-94bf-8ca21190aff4 | 0 | public String getKind(){
return this.kind;
} |
e1fba991-0fa9-422e-991c-06e502baba67 | 7 | @Override
public String getSVG( HashMap<String, Double> chartMetrics, HashMap<String, Object> axisMetrics, ChartSeries s )
{
double x = chartMetrics.get( "x" ); // + (!yAxisReversed?0:w); // x is
// constant at x origin unless
// reversed
double y = chartMetrics.get( "y" );
double w = chartMetrics.get( "w" ... |
881201e9-df70-4213-b121-ad8c03cec0c6 | 4 | public static ArrayList<String> getRankbitHTML(String url)
throws MalformedURLException, IOException {
ArrayList<String> html = new ArrayList<String>();
BufferedReader r = new BufferedReader(new InputStreamReader(
new URL(url).openConnection().getInputStream()));
String ln = null;
boolean add = false;
... |
a64bb2ed-483e-4509-bc97-9d8da20aba0b | 1 | public Book createBookFromStringArray(String[] array){
Book book = null;
try {
book = new Book();
book.setId(Integer.parseInt(array[0]));
book.setTitle(array[1]);
book.setInd(Integer.parseInt(array[2]));
book.setNotes(array[3]);
} catch (NumberFormatException nfe){
logger.error("Error extr... |
4fc93b26-5c21-4a0a-b8b9-60b6ab67146b | 5 | public void draw(Graphics2D g2, int x, int y, int containerWidth, int containerHeight, String text){
g2.setFont(textFont);
String[] lines = text.split("\n");
String longest = "";
for(String line : lines)
{
if(line.length() > longest.length())
{
... |
a37bc119-df5e-4a86-9eed-4298c30591d7 | 9 | protected void closestTargets(Game game, boolean randomTarget)
{
targets.clear();
double bestDist = Double.MAX_VALUE;
int targetSpriteId = -1;
int numChasing = game.getNumSprites(itype1);
int numFleeing = game.getNumSprites(itype2);
if(numChasing > numFleeing)
... |
73bc2670-9c76-4f42-9d4e-1f724657b2d4 | 5 | private void initialize() throws Exception {
if (props.propertyNames().hasMoreElements()) {
String url = props.getProperty("db.url");
String user = props.getProperty("db.user");
String passwd = props.getProperty("db.passwd");
if (url != null && user != null && pa... |
bfa3e6a4-1b25-4a7b-981d-10396a37e16b | 2 | private void removeid(Widget wdg) {
if (rwidgets.containsKey(wdg)) {
int id = rwidgets.get(wdg);
widgets.remove(id);
rwidgets.remove(wdg);
}
for (Widget child = wdg.child; child != null; child = child.next)
removeid(child);
} |
c02342db-5852-4496-ad20-ba4de1bf961b | 0 | public int getTotalNumberOfMatches() {return totalNumberOfMatches;} |
4b4dbc9a-eb37-46a1-be74-8ecea754f8e4 | 0 | public double getPrice() {
return price;
} |
fe05ec8d-8cf9-47e5-be7e-efd7d34e8228 | 7 | public static String getLocalAddress() throws SocketException {
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
while (interfaces.hasMoreElements()){
NetworkInterface current = interfaces.nextElement();
Logger.finer("Found interface: " + current);
if (!current.i... |
3ead6446-72c3-4d33-837c-92deff081acf | 7 | public List getPendingBlockUpdates(Chunk par1Chunk, boolean par2)
{
ArrayList var3 = null;
ChunkCoordIntPair var4 = par1Chunk.getChunkCoordIntPair();
int var5 = var4.chunkXPos << 4;
int var6 = var5 + 16;
int var7 = var4.chunkZPos << 4;
int var8 = var7 + 16;
It... |
c21aacce-4cf8-48fc-bf5a-07d705aa016c | 2 | private void updateButtons(){
if(executionControl != null){
startStrategyButton.setEnabled(executionControl.isExecutionCanceled());
pauseButton.setEnabled(!executionControl.isExecutionPaused() && !executionControl.isExecutionCanceled());
cancelButton.setEnabled(!executionControl.isExecutionCanceled());
co... |
c0a08227-c807-4e67-9a0e-6893697ed8d4 | 3 | private static Plan readPlanFile(File planFile){
JAXBContext context = null;
try {
context = JAXBContext.newInstance("com.hesham.maven.virgo.jaxb.plan");
} catch (JAXBException e) {
e.printStackTrace();
}
Unmarshaller unmarshaller = null;
try {
unmarshaller = context.createUnmarshaller();
} catch... |
22d0e69e-a693-4e4f-8651-4ab84156ad9f | 3 | public ArrayList<HashMap<String, String>> getOdigous(){
/*
* epistrefei tous odigous ths vashs
*/
ArrayList<HashMap<String, String>> odigoi=new ArrayList<HashMap<String, String>>();
try {
pS = conn.prepareStatement("SELECT * FROM odigoi");
rs=pS.executeQuery();
while(rs.next()){
HashMap<Stri... |
b7ddb105-15c0-4d57-9fed-db0421a92586 | 4 | public void act()
{
// If "exposed to sun," behave like a tree
if(getGrid() != null || getContainer() != null && // in grid or in pot
getContainer().getGrid() != null) // its pot is in the grid (not in another container)
{
System.out.println(getName() + " is acting.");
attemptT... |
09a9cd15-bba2-4808-a327-207caa9d77af | 1 | public void load(ResultSet rs) throws Exception{
if(rs.next()){
setPersonID(rs.getInt("personid"));
setLastName(rs.getString("lastname"));
setFirstName(rs.getString("firstname"));
setEmail(rs.getString("email"));
setPersonType(rs.getString("persontype"... |
e20121bc-7b4c-4fe4-acef-345de9591b3a | 6 | protected void onMouseWheelScroll(Event event) {
int scrollStep = event.getMouseWheelVelocityY() * 5;
Element scrollTarget;
if (getCurrentTarget() != null) {
scrollTarget = getCurrentTarget().getElement();
} else {
scrollTarget = RootPanel.getBodyElement();
... |
9dfea564-54c4-4ece-9ab8-69cdb40bc868 | 4 | public boolean isWithinBounds(Locatable nd) {
if (nd.getX() < this.extent.getMinX() || nd.getX() > this.extent.getMaxX()) {
return false;
}
if (nd.getY() < this.extent.getMinY() || nd.getY() > this.extent.getMaxY()) {
return false;
}
... |
6364f4bd-e71c-48b6-946b-2e014754268e | 5 | public ArrayList<ArrayList<Integer>> combine(int n, int k) {
ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
//if n < k, will not fit the problem
if (n < k) {
return result;
}
result.add(new ArrayList<Integer>());
//set numbers int... |
631fc47d-d84d-4e82-9de4-2312297d9ff2 | 3 | private String whereRestriction(String dbColumnName, Object value) {
if (value instanceof Date) {
return dbColumnName + "='" + DaoUtils.DATE_FORMATTER.format(value)
+ "'";
} else if (value instanceof String) {
return dbColumnName + " LIKE '" + value + "'";
... |
b31a6239-aa07-4a47-afad-56da917b97c9 | 5 | public int findMaxFlow(int matrix[][], int source, int destination){
int a,d;
int flow = 0;
int path;
int[][] resteMatrix = new int[numberOfSommet+1][numberOfSommet+1];
for(int initSommet = 1; initSommet<=numberOfSommet; initSommet++){
for(int finalSommet = 1; finalSommet<=numberOfSommet; fi... |
4fcaba1d-3764-40fb-847d-bbb43a2dcb78 | 1 | public ModelBaltar() throws Exception{
String[] Filenames = BaltarFiles;
cylons = new ArrayList();
weights = new ArrayList();
for (String filename: Filenames){
FileReader in = new FileReader(filename);
BufferedReader buff = new BufferedReader(in);
weights.add( Double.parseDouble(buff.readLine()));
c... |
64c3193a-7a7c-4d0b-9430-2ef62d0305a9 | 3 | private double calculateNormalisedDeviationDistance(int elementIndex, double element, double[] array){
double distance = 0;
for(int i = 0; i < array.length; i++){
if(element == array[i]){
distance = elementIndex - i;
}
}
if(distance < 0){
distance = distance * -1;
}
return distance/array.length... |
474aa286-7d0a-4241-808d-7b910d7932df | 6 | @Override
public List<Livre> getByMotsClefs(List<String> motsClefs) throws Exception {
List<Livre> livres = new ArrayList<>();
this.getStatement();
Livre livre = null;
for (int i = 0; i < motsClefs.size(); i++) {
ResultSet rs = this.st.executeQuery("SELECT * FROM livres W... |
0e32adbd-ce28-4fe4-96a3-10a2d47433ce | 7 | public boolean repondreQuestion(int id_rep){
boolean trouver = false;
int i = 0;
while((!trouver ) && (i < this.catalogue.size())){
if( this.idQuestionActuelle == this.catalogue.get(i).getId())
trouver = true;
else
... |
3b77143c-0610-4a4e-8d21-6d2f70a34e89 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TestObject other = (TestObject) obj;
if (count !=... |
ed545d32-72e0-424d-aeb1-d8134617f214 | 9 | public static void main(String[] args) throws Exception {
// String fileName = "../Corpus/negativeTweets.txt";
String fileName = "../Corpus/#noob.txt";
String filteredFileName = fileName + "-filtered";
File filteredFile = new File(filteredFileName);
if(f... |
2eb99abd-1eeb-46d3-9cf9-dd361bb28c06 | 1 | public ArrayList getDoneDescriptions()
{
ArrayList ret = new ArrayList();
for(int i = 0; i < myDoneCases.size(); i++)
ret.add(myDoneCases.get(i).toString());
return ret;
} |
2ce85ae7-2cae-4cb6-a6d0-dfc160d20fa3 | 1 | protected AlberoBin<T> max(AlberoBin<T> a) {
while (a.des() != null) a = a.des();
return a;
} |
094e83a2-37e6-4be3-a0ab-50e28b0c111d | 2 | public static void cambiarNombreCanal() {
int canal = -1;
int subCanal = -1;
String position = frame.getSelectedNodePosition();
position = position.substring(1);
String[] numeros = position.split(":");
canal = Integer.parseInt(numeros[0]);
if (numeros.length > 1){
int numClientes = canales.get(canal).g... |
8dd554bb-a4b4-4fd5-a4be-cbc0ca72e1ae | 6 | private void saveUserPassword() {
String oldPasswordInput = new String(oldPassword.getPassword());
String newPasswordInput = new String(newPassword.getPassword());
String confirmInput = new String(confirmPw.getPassword());
String savedPassword = new DBConnect().loginCheck(user.getEmail()... |
519d6d73-109e-43ff-8c73-990c646b5a63 | 3 | public Region parcoursRegion(Region region, Entree e){
//On vérifie si l'entrée existe dans cette région
try{
System.out.println(e.getNom());
System.out.println(region);
//System.out.println(listeBloc);
if(listeBloc.get(region).containsKey(e))
retu... |
6f9c99e7-5523-4254-b45c-ab9e84eb1078 | 1 | @Override
public int attack(double agility, double luck) {
if(random.nextInt(100) < luck)
{
System.out.println("I just threw a venemous knife!");
return random.nextInt((int) agility) * 4;
}
return 0;
} |
ec92128d-69ba-42eb-aa45-dd5d86863cfd | 6 | private void saveContact() {
Pattern p = Pattern.compile("^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$");
Matcher m = p.matcher(textField_2.getText().trim());
if (ek != null && !(textField.getText().isEmpty())
&& !(textField_1.getText().isEmpty())
&& !(textField... |
bde3378a-54ae-445b-9aa6-50b79621eff0 | 2 | protected void trimScores(String[][] scores){
int n = scores.length;
int m = scores[0].length;
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
scores[i][j].trim();
}
}
} |
d0743cfa-0564-434a-967e-fd5e2b912682 | 4 | public void fill()
{
int x,y;
matrix[0][0][0]=0;
//System.out.println(matrix.length + ":" + matrix[1].length);
for(x=1;x<matrix[0].length;x++)
{
matrix[0][x][0]= matrix[0][x-1][0] +effort[1];
matrix[0][x][2]= 1;
}
for(y=1;y<matrix.length;y++)
{
matrix[y][0][0]= matrix[y-1][0][0] +effort[0];
... |
cff1af9a-608e-48c8-b74a-d83d895eee53 | 0 | public TicketQueryArgs newInstance() {
return new TicketQueryArgs();
} |
f418613e-7387-44a1-b2c5-a99caae5c96a | 1 | @SuppressWarnings("unchecked")
List<Operation> getFeedbackOperationContinue(String coderId, String guesserId, String feedback,
Map<String, Object> lastState) {
List<Operation> guessMove = new ArrayList<Operation>();
guessMove.add(new SetTurn(guesserId));
guessMove.add(new Set(CURRENTMOVE,GUESS));
... |
57d16a4e-0270-4f20-b220-57a9f6931de7 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Endereco other = (Endereco) obj;
if (this.idEndereco != other.idEndereco && (this.idEndereco == null || !... |
2a796f3a-365b-4461-811e-d83432474d78 | 1 | protected static void editState(State s)
{
MooreMachine m = (MooreMachine) (s.getAutomaton());
String output = (String) JOptionPane.showInputDialog(null, // I don't seem to need a parent component
"Enter output:", "Set Output", JOptionPane.QUESTION_MESSAGE, null, null, m.getOutput(s));
... |
7f9b4658-35f0-41f6-999c-050579c7555d | 0 | public void setOrderStatus(String orderStatus) {
this.orderStatus = orderStatus;
} |
509cb933-1f60-4a70-b29b-f85450cde18b | 4 | public void add( E element ) {
if ( element == null ) {
throw new NullPointerException();
}
// insert the new element as the new rightmost leaf
if ( size == heap.length ) {
resize();
}
heap[size] = element;
size++;
int child = size - 1;
int parent = ( child - 1 ) / 2;
... |
cd5784f8-14bf-4a21-8352-d40efe916310 | 2 | private String campos(int max, String[] camp) {
String str = "(";
for (int i = 0; i < max; i++) {
str += camp[i];
if (i != max - 1) {
str += ",";
}
}
return str;
} |
9587d608-7ffc-4d8e-941c-a4a831434143 | 3 | public double[] sugarGain() {
if(this.sugarGain[1]>0) {
return sugarGain;
}
double bestGain = 0.0;
double bestValue = 0.0;
for (Tea t : trainingSet) {
double tmpGain = gainForSugarValue(t.getSugar());
double tmpValue = t.getSugar();
if (tmpGain > bestGain) {
bestGain = tmp... |
8b5dc8dd-22d5-4612-a76c-49d0f891c741 | 9 | protected void updateNameTable(int suggestedPage) {
int tilePix[] = null;
int ySteps = currentPixelArrayWidth * PPUConstants.CHR_HEIGHT; // number of pixels to skip an entire level of horizontal tiles
int tileOffset = 0;
int pixOffset = 0;
int tilePixOffset = 0;
int ty = ... |
54b04114-8197-4f04-be54-abc472a61399 | 8 | private void editReservation() {
Object[] options = {"Edit Reservation", "Delete Reservation"};
JTextField phoneNumber = new JTextField();
JTextField cusID = new JTextField();
JPanel cusInput = new JPanel(new GridLayout(0,1));
cusInput.add(new JLabel("Cus... |
12979d91-b433-47d5-8aea-590d300e784b | 4 | public boolean canPerformBinding(EInterfaceAction binding) {
switch(binding) {
case Bind_InsertPaste:
case Bind_InsertReplace:
case Bind_InsertAfter:
case Bind_InsertBefore:
return true;
default:
break;
}
return false;
} |
f0786a81-1349-4c27-91cb-c98eb0e70719 | 1 | public void setVisible(boolean visible) {
if(frame == null) {
flyups = new FlyUpsManager();
buildGUI();
}
frame.setVisible(visible);
} |
10e6fb49-430a-41df-9485-5d6978b367a7 | 1 | private void loadPlateau(int nbJoueur) {
// TODO
try {
Icon plIm = new ImageIcon(ImageIO.read(Game.class.getResource("/res/maps/map2p.png")));
Plateau plateau = new Plateau(plIm);
partieEnCours.setPlateau(plateau);
}
catch (IOException e) {
e.printStackTrace();
}
} |
3df58859-0d17-42ce-a474-6d7d78c93fec | 2 | public static Id3PictureType getId3PictureType(int typeId) {
if(typeId < 0 || typeId>=getNumTypes()) {
// TODO: reevaluate... should this return null? throw out of bounds?
return types[defaultTypeId];
}
//else
return types[typeId];
} |
03ff79b0-643f-47b7-b4c6-fad1f9498f34 | 6 | public boolean isWithin(Location location) {
int x = location.getBlockX();
int y = location.getBlockY();
int z = location.getBlockZ();
if(x >= xmin && x <= xmax && y >= ymin && y <= ymax && z >= zmin && z <= zmax) {
return true;
}
return false;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.