text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void setInitialResizePoint(Point initialResizePoint) {
this.initialResizePoint = initialResizePoint;
} | 0 |
private ArrayList<String> createPrintables() {
ArrayList<String> printables = new ArrayList<String>();
// Title
printables.add("Graph: " + numNodes + " nodes");
String separationLine = "";
for (int i = 0; i <= 2 * numNodes; i++)
separationLine += "-";
printables.add(separationLine);
// Matrix
for (... | 9 |
private void deviceListComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_deviceListComboBoxItemStateChanged
//this gets triggered whenever the list of items is changed, like when refreshing
//don't do anything then
if (!refreshing && evt.getStateChange() == java.awt.event... | 2 |
private boolean isTrueSNP(VariantCandidate v) {
if (v.val("max.qual.minor") >= 58.341 && v.val("max.qual.major") >= 46.184 && v.val("total.depth") < 47.256) {
return true;
} else if(v.val("max.qual.minor") <= 58.933 || v.val("max.qual.major") < 48.921 || v.val("total.depth") >= 63.330) {
... | 6 |
@SuppressWarnings("unused")
@Pointcut("execution(public String demo.spring.aop..*(..))") //public 戻りString demoサブ階層 doが含まれるメソッド名
private void anyPublicOperation() {} | 0 |
public void destroy() {
if (frames == null)
return;
for (ZFrame f : frames) {
f.destroy();
}
frames.clear();
frames = null;
} | 2 |
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((brandName == null) ? 0 : brandName.hashCode());
result = prime * result + ((originalPrice == null) ? 0 : originalPrice.hashCode());
result = prime * result + ((percentOff == nu... | 9 |
public MOB determineMonster(MOB caster, int level)
{
final MOB newMOB=CMClass.getMOB("GenMOB");
newMOB.basePhyStats().setAbility(7);
newMOB.basePhyStats().setLevel(level);
newMOB.basePhyStats().setRejuv(PhyStats.NO_REJUV);
newMOB.baseCharStats().setStat(CharStats.STAT_GENDER,'M');
final int choice=CMLib.d... | 9 |
public void setFunCedula(long funCedula) {
this.funCedula = funCedula;
} | 0 |
public int size()//Accessor method
{
return manyItems;
} | 0 |
@Override
public void fire() {
InviteMessage msg = new InviteMessage();
refreshCounter--;
if(refreshCounter <= 0) {
((Antenna) this.node).resetNeighborhood();
msg.requireSubscription = true;
refreshCounter = refreshRate; // reset the counter
}
this.node.broadcast(msg);
double time = dist.nextSa... | 2 |
public ArrayList<Meeting> getAllMeetingsFromDatabase(){
ArrayList<Meeting> meetings = new ArrayList<>();
ArrayList<HashMap<String, String>> meetings_raw = mySQLQuery.getAllRows("Meeting");
for(HashMap<String, String> meeting_raw : meetings_raw){
int meetingID = Integer.parseInt(meet... | 6 |
public static void main(String[] args) {
System.out.println("Enter number of dice to toss");
Scanner s = new Scanner(System.in);
int diceCount = s.nextInt();
SevenTally t = new SevenTally(diceCount);
int experiments = 1000000;
// int experiments = 1;
int wins = 0;
for(int j = 0... | 2 |
private BaseDO makeObjectPersistent(final BaseDO baseDO) {
return getEntityManager().merge(baseDO);
} | 0 |
public void cargarComboCargo(){
Usuario u = new Usuario();
ArrayList<String> listado = u.listarCargos();
if(listado !=null){
for (int i = 0; i < listado.size(); i++) {
Cargo.addItem(listado.get(i));
}
... | 2 |
public void wallOut() {
if (mySpringies.getKey(JGEngine.KeyDown) & BoardSetup.wall_margin > 0) {
for (Wall w : myBoardSetup.getWalls()) {
w.remove();
}
BoardSetup.changeMargin(-1* WALLCHANGE);
myBoardSetup.setWalls(myEnvForces.getWallMags(), myEnvForces.getWallMags());
mySpringies.clearKey(JGEngine... | 2 |
private boolean bit() throws JSONException {
boolean value;
try {
value = this.bitreader.bit();
if (probe) {
log(value ? 1 : 0);
}
return value;
} catch (Throwable e) {
throw new JSONException(e);
}
} | 3 |
public int getY() {
return y;
} | 0 |
public boolean canFall(){
// Parcours les coordonnées du jeu
for(int x=0; x <= coordonneJeu.getNombreColonne()-1; x++)
for(int y=0; y <= coordonneJeu.getNombreRangee()-1; y++)
// Si un Tetrominoe est présent vérifie la position du desous
if(!tetrominoes.get(t... | 6 |
public Nodo<E> mostrarElementoAzar(){ //muestra solamente
int posicionAzar = (int )(Math.random() * talla);
Nodo datoEscogido = cabeza;
for (int cont = 0; cont < posicionAzar; cont++) {
datoEscogido = datoEscogido.siguiente;
}
Nodo <E> tmp2 = d... | 1 |
public void render(Graphics2D g) {
g.setColor(new Color(0,0,0,125));
g.fillOval(colBox.x-5, colBox.y, colBox.width+5, colBox.height+5);
if (dir == 2) {
g.drawImage(animRight.getCurrentImage(), (int) x, (int) y, width, height, null);
}
else if (dir == 1) {
g.drawImage(animUp.getCurrentImage(), (int) x, (... | 4 |
private void jButton1MouseMouseClicked(MouseEvent event) {
ChooseFrame cf = new ChooseFrame();
cf.setDefaultCloseOperation(ChooseFrame.EXIT_ON_CLOSE);
cf.setTitle("ChooseOpration");
cf.getContentPane().setPreferredSize(cf.getSize());
cf.pack();
cf.setLocationRelativeTo(null);
cf.setVisible(true);
this.d... | 0 |
public void cambiarPosicionJugado2(){
for(int x=0;x<8;x++){
for(int y=0;y<8;y++){
if(pd.mapa_jugador2[x][y].equals(codigo))
pd.mapa_jugador2[x][y]="";
}
}
int x=rd.nextInt(0)+7;
int y=rd.nextInt(0)+7;
cam... | 3 |
public static Boolean[] getCaseFancyMap(String strToMap) {
Boolean[] map = new Boolean[strToMap.length()];
for (int i = 0; i < strToMap.length(); i++) {
if (Character.isUpperCase(strToMap.charAt(i))) {
map[i] = true;
} else if (Character.isLowerCase(strToMap.charAt(i))) {
map[i] = false;
}
}
... | 3 |
public LinkedHashMap<Integer, Persona> leerPersonaJAXB(String rutaFichero) {
rutaFichero = rutaFichero + ".xml";
LinkedHashMap<Integer, Persona> personas = new LinkedHashMap<>();
try {
JAXBContext jaxbContext = JAXBContext.newInstance(MapPersona.class);
Unmarshaller jaxbU... | 2 |
public void filter(byte[] samples, int offset, int length) {
for (int i=offset; i<offset+length; i+=2) {
// update the sample
short oldSample = getSample(samples, i);
short newSample = (short)(oldSample + decay *
delayBuffer[delayBufferPos]);
setS... | 2 |
@Override
public void renderControl(Graphics2D g) {
if(this.isEnable())
{
// create control bitmap
BufferedImage Control = new BufferedImage(this.getSize().getWidth(), this.getSize().getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = (Graphics2D) Control... | 4 |
private void field_localidadFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_field_localidadFocusLost
boolean es_componente=false;
// voy a preguntar si la componente que me saco el foco es algun campo del panel de datos de asientos
int i=0;
... | 7 |
public boolean conflict(ValueIndexPair in) {
return index1 == in.index1 || index1 == in.index2 || index2 == in.index1
|| index2 == in.index2;
} | 3 |
private int walkthrough()
{
int result = 0;
for (Position whiteKingPos : Position.getAllPositions())
{
for (Position blackKingPos : Position.getAllPositions())
{
if (whiteKingPos == blackKingPos) {
continue;
}
for (Position blackRookPos : Position.getAllPositions())
{
if (... | 8 |
public static boolean hasAlpha(final Image image) {
// If buffered image, the color model is readily available
if (image instanceof BufferedImage) {
BufferedImage bimage = (BufferedImage) image;
return bimage.getColorModel().hasAlpha();
}
// Use a pixel grabber to retrieve the image's color model;
// g... | 2 |
@Test
public void sequentialFigurePlacement() {
FiguresPlacement figuresPlacement = new BishopsPlacement();
Set<String> boards = figuresPlacement.placeFigureOnBoard(BISHOP.getFigure(), EMPTY_BOARD_SIZE_6);
assertThat("board is different", boards.contains("b.....\n" +
... | 6 |
@SuppressWarnings({ "rawtypes", "unchecked" })
protected int testCompareTo(Comparable o1, Comparable o2) {
int res = 0;
Map<String, Object> fields1 = getMineAndParentFields(
ForCompareTo.class, o1);
Map<String, Object> fields2 = getMineAndParentFields(
ForCompareTo.class, o2);
if (!isEmpty(fields1) && ... | 9 |
public BeeperStack(int x, int y, int beepers) {
super(x, y);
if (beepers < 1 && beepers != Display.INFINITY) {
Debug.printWarning("Invalid amount of beepers: "
+ beepers + "... Setting to 1...");
beepers = 1;
}
numBeepers = beepers;
} | 2 |
public boolean isActive(int id) {
if (!plugin.getConfig().getBoolean("registration.activation"))
return true;
Connection conn = plugin.getDbCtrl().getConnection();
PreparedStatement ps = null;
ResultSet rs = null;
try {
String sql = String.format("SELECT `active` FROM `%s` WHERE `id` = ?",
plugin... | 3 |
public void close()
{
loggedIn = false;
if (out != null)
{
// And attempt to logout, but don't care if we fail
try
{
int id = invoke("loginService", "logout", new Object[] { authToken });
join(id);
}
catch (IOException e)
{
// Ignored
}
}
super.close();
} | 2 |
public DefaultSurfaceModel getModel() {
return model;
} | 0 |
public Sound(byte[] samples) {
this.samples = samples;
} | 0 |
public Train firstComeTrain(Double humpTime){
double minTime = humpTime;
int trackNo=-1; //最先來火車的火車軌道
int i=0;
for(ReceivingTrack rt : receivingTrack){
if(rt.isEmpty==false && rt.existTrain.currentTime<minTime){ //track有火車且最先來
minTime = rt.existTrain.currentTime;
trackNo = i; //設定最先來的火車軌道是第幾個 ... | 5 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!PositionType.class.isAssignableFrom(obj.getClass()))
return false;
PositionType other = (PositionType) obj;
return row == other.getRow() && col == other.getCol();
} | 4 |
public void run() {
if(this.resultFilePath == null || this.resultFilePath == ""){
this.resultFilePath = createFileName();
}
search(this.resultFilePath);
} | 2 |
@Override
public void teardownTest(JavaSamplerContext context) {
super.teardownTest(context);
try {
if (table != null) {
table.flushCommits();
table.close();
table = null ;
}
} catch (IOException e) {
System.out.println("teardown error");
}
} | 2 |
public void loadConfigFiles() {
try {
board.loadConfigFiles();
board.calcAdjacencies();
loadPlayers();
loadCards();
board.setPlayers(players);
//called here after the cards are loaded
notes.setUpNotes(cards);
accuse.setUpComboBoxes(cards);
suggest.setUpComboBoxes(cards);
} catch(BadCon... | 1 |
public ArithmeticEncoder(BitOutputStream out) {
super();
if (out == null)
throw new NullPointerException();
output = out;
underflow = 0;
} | 1 |
private void getSelectedDownloads() {
toDownload = new ArrayList<>();
ArrayList<Object> selections;
for (int i = 0, l = table.getRowCount(); i < l; i++) {
selections = table.isSelected(i);
if ((boolean) selections.get(0)) {
toDownload.add(new Resource(i, lectures.get(i)));
//System.out.println(lectu... | 8 |
public int[] getArrayForNumberOfBreakpoints() throws IOException {
FileInputStream fileInputStream = new FileInputStream(pathToFile);
DataInputStream in = new DataInputStream(fileInputStream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
Stri... | 3 |
public int getNumberOfSamples() {
if (vcfFileIterator == null) return 0;
VcfHeader vh = vcfFileIterator.getVcfHeader();
if (vh == null) return 0;
return vh.getNumberOfSamples();
} | 2 |
public boolean isFlipD() {
switch (tileFlip) {
case D:
case HD:
case VD:
case HVD:
return true;
default:
return false;
}
} | 4 |
String typeOf(String st) throws Exception
{
//handle define, the word after it is a procedure
//to ensure that everything after define is still procedure
if (reservedWords.contains(st))
{
return "RESERVED WORD";
}
else if (Character.isDigit(st.charAt(0)))
{
... | 3 |
@Cacheable(cacheName = "findAllBlogCache")
public List<Blog> getBlogs() {
return this.blogModelDao.findAll();
} | 0 |
public int getX() {
return x;
} | 0 |
String checkSecurity(int iLevel, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request){
try {
Object o1 = session.getAttribute("UserID");
Object o2 = session.getAttribute("UserRights");
boolean bRedirect = false;
... | 7 |
public Draw(int a, int b, int c, boolean v) {
int[] p = new int[] { a + 1, b + 1, c + 1 };
if (v) {
boolean asc, desc;
for (int i = 0; i <= 2; i++) {
asc = desc = true;
for (int j = 0; j <= 1; j++)
if (p[(i + j + 1) % 3] > p[(i + j) % 3])
desc = false;
else if (p[(i + j + 1) %... | 7 |
public static void subpermute(List<List<Integer>> res, List<Integer> l, int[] num) {
if (0 == num.length) {
List<Integer> t = new ArrayList<Integer>(l);
res.add(t);
return;
}
else {
for (int i = 0; i < num.length; i++) {
if (i > 0 && num[i] == num[i - 1]) continue;
l.add(num[i]);
int[] t... | 6 |
public void doLoad(List<String> codes, List<String> years, List<String> publishers) throws XMPPException {
StringCollection reg = new StringCollection();
reg.setType(IQ.Type.GET);
reg.setTo(connection.getServiceName());
PacketFilter filter = new AndFilter(new PacketIDFilter(reg.getPacket... | 9 |
private void refreshRemoteUsersList(){
for(Object clients:userOnLineL){
InterClient client=(InterClient) clients;
try {
client.refreshClient();
} catch (RemoteException ex) {
Logger.getLogger(ServeurLegede.class.getName()).log(Level.SEVERE, nul... | 2 |
public static String toText(byte [] bytes) {
StringWriter sw = new StringWriter();
int length = bytes.length;
if(length > 0) {
for(int i = 0; i < length; i++) {
byte b = bytes [i];
if(b > 64 && b < 91 || b > 96 && b < 123)
sw.write((char)b);
}
}
return(sw.toStr... | 6 |
@Override
public <T extends OAuthResponse> T execute(Request request,
Class<T> responseClass)
{
String responseBody = null;
URLConnection c = null;
int responseCode = 0;
try
{
URL url = new URL(request.getLocationUri());
c = url.openConnection();
responseCode = -1;
if (c instanceof HttpURLCo... | 8 |
protected void generateWorld() {
if(!Game.Online) {
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
int tile = r.nextInt(Tile.dirtId);
tiles[y][x] = Tile.createTile(tile, x, y, this);
}
}
... | 3 |
private void performTask(){
long start = System.nanoTime();
switch(this.action){
case HASHFUNCTIONS:
performHashFunctionTests();
break;
case HYPERLOGLOG:
performHyperLogLog();
break;
case SIMILARITIES:
performSimilarities();
break;
case SLIDINGWINDOW:
performSlidingWindow();
break... | 8 |
public IVPBoolean ivpNotEqualTo(IVPValue num, Context c, HashMap map, DataFactory factory) {
IVPBoolean result = factory.createIVPBoolean();
map.put(result.getUniqueID(), result);
boolean resultBoolean = false;
if(getValueType().equals(IVPValue.INTEGER_TYPE) && num.getValueType().equals(IVPValue.INTEGER_TYPE)){... | 5 |
public void hit(int damage) {
if(dead || flinching) return;
health -= damage;
if(health < 0) health = 0;
if(health == 0) dead = true;
flinching = true;
flinchTimer = System.nanoTime();
} | 4 |
public int getHp(int npc) {
switch (npc) {
case 2627:
return 10;
case 2630:
return 20;
case 2631:
return 40;
case 2741:
return 80;
case 2743:
return 150;
case 2745:
return 2500;
}
return 100;
} | 6 |
public static void main( String[] args ) throws IOException
{
String myFile = "/home/abu/Desktop/1.txt";
FileReader myFileReader = new FileReader( myFile );
BufferedReader myFileBuffer = new BufferedReader( myFileReader );
String text = myFileBuffer.readLine();
while ( text ... | 1 |
public boolean addUser(String username, String password) {
boolean succes = false;
try {
crs = qb.selectFrom("users").where("username", "=", username).executeQuery();
if(crs.next()) {
succes = false;
} else {
String[] fields = {"username", "password"};
String[] values = {username, password};
... | 3 |
public HipPacket handleClose(byte[] src, byte[] dst, HipPacket close,
HipSadb sadb, SignatureAlgo sigAlgo, HostIdentityTag hit) {
SaEntry __entry = null;
HMACParameter __hmacParam = null;
HipPacket __closeAck = null;
SignatureParameter __sigParameter = null;
byte[] __signature = null;
byte[] __hmac = nul... | 7 |
public StudentInfoEditor(StudentsListTab window, Student student)
{
this.window = window;
this.student = student;
this.setTitle(student.getFirstName() + " " + student.getLastName());
this.tabs = new JTabbedPane();
this.avoidingTable = makeTable(student);
this.scrollbar = new JScrollPane(this.avoiding... | 7 |
public static void test_2(){
try{
System.out.println("\n\nTestCase-2\n\n");
TestNetwork n=new TestNetwork(4,4,2);
Paxos p=new Paxos(n);
p.runPaxos();
n.change_DPmode(-1,1);
for(int i=0;i<10;i++) //Block the channel of all processes
n.block_channel(i, 1);
Thread.sleep(500);
fo... | 4 |
@Override
public void unInvoke()
{
if(!(affected instanceof MOB))
return;
final MOB mob=(MOB)affected;
if(canBeUninvoked())
{
if(!mob.amDead())
{
if((invoker!=null)&&(invoker.location()==mob.location())&&(!invoker.amDead()))
invoker.tell(invoker,mob,null,L("You are no longer distracting <T-N... | 8 |
public static final String trim4Html(Object obj) {
String str;
return obj != null && (str = obj.toString().trim()).length() > 0 ? str : " ";
} | 2 |
public void setProperty(String property, int value) {
switch (property) {
case "resolution": setResolution(value); break;
case "tolerance": setTolerance(value/100d); break;
case "blurRadius": setBlurRadius(value); break;
case "temperature": setTemperature(value/100d); break;
case "brightness": setBrightness... | 9 |
private void Ok()
{
if(loginTextField.getText().length() == 0)
{
JOptionPane.showMessageDialog(rf, "Enter login");
return;
}
if(loginTextField.getText().length() < 4)
{
JOptionPane.showMessageDialog(rf, "Login is to short, it should be longer then 3 characters");
return;
}
if(passTextField.ge... | 8 |
private WarMachine platziereWarMachine(WarMachine newWarMachine) {
boolean invalidInput = true;
String input = null;
Koordinate platzKoordinate = null;
Ausrichtung platzAusrichtung = null;
while (invalidInput) {
try {
input = client.getPlayerInput();
} catch (Exception e) {
e.printStackTrace()... | 5 |
public String getThreeOfAKind()
{
String stt = "0";
//search for groups of 3 neighbouring cards that have the same rank
if (cards[0].getRank() == cards[1].getRank() && cards[1].getRank() == cards[2].getRank()) {
stt = Character.toString (cards[0].getCharCard()) + cards[3].getCh... | 6 |
public List<IrcClient> getAllClients(){ return AllClients; } | 0 |
public void setCurrentCells(boolean[] currentCells) {
this.currentCells = currentCells;
} | 0 |
public boolean[] getCurrentCells() {
return currentCells;
} | 0 |
public int firstMissingPositive(int[] A) {
for (int i = 0; i < A.length; i++) {
while(A[i] != i+1){
if(A[i] <= 0 || A[i] > A.length || A[i] == A[A[i]-1]) break;
int tmp = A[i];
A[i] = A[tmp-1];
A[tmp-1] = tmp;
}
}
for (int i = 0; i < A.length; i++) {
if (A[i] != i + 1)
return i + 1;
... | 7 |
@Override
public CellSpace newSubCellSpace( int i )
{
// We need to describe the corners of the two cubes on the lo-hi
// diagonal. There are 13 new points to create.
// T top / B bottom
// L left / R right
// F front / B back
if( C == null )
{
double cx = lo.x + ( hi.x - lo.x ) / 2;
double ... | 9 |
@Override
public String readFromBomberman() throws IOException {
Scanner scan = new Scanner(System.in);
System.out.print("Please input your command: ");
String command = scan.nextLine();
clientSideWriter.append(command).append("\n").flush();
return serverSideReader.readLine()... | 0 |
private boolean isAdjacent(int currentIndex, int newIndex, RoomCell.DoorDirection directionOut, RoomCell.DoorDirection directionIn) {
// If your new cell is a walkway and you're not in a room, return true
if (cells.get(newIndex).isWalkway() && !cells.get(currentIndex).isRoom())
return true;
// If the curre... | 8 |
private void getPheno()
{
if(Character.isUpperCase(allel1)){pheno = allel1;}
if(Character.isUpperCase(allel2)){pheno = allel2;}
if(Character.isLowerCase(allel1)&&Character.isLowerCase(allel2)){pheno = allel1;}
} | 4 |
public synchronized final
void saveToCache () {
if (getCache() == null)
return;
// absolutely required field
if (getTitle()==null) return;
//1. Compose this one and childrefs
Element e = getSpecificDataXML();
if (e==null) return; // element is corrupt and should not be cached
e.setAttribute("title", ... | 5 |
private int sum(int[] a) {
int sum = 0;
for (int i = 0; i < a.length; i++) {
sum += a[i];
}
return sum;
} | 1 |
private void notifyListeners() {
if(!listeners.isEmpty())
for(Listener listener : listeners)
listener.update();
} | 2 |
@Test
public void testConnection6() throws Throwable {
final LoopHandle loop = new LoopHandle();
if (!UDPHandleTest.isIPv6Enabled(loop)) {
return;
}
final AtomicInteger serverSendCount = new AtomicInteger(0);
final AtomicInteger clientSendCount = new AtomicIntege... | 7 |
public List<Deal> ListerDeals() {
PrestataireDeServiceDAO psdao = new PrestataireDeServiceDAO();
try {
String sql = "SELECT * FROM Deal ";
ResultSet rs = crud.exeRead(sql);
List<Deal> liste = new ArrayList<Deal>();
while (rs.next()) {
... | 2 |
@Test
public void testDeleteAcademy() {
System.out.println("deleteAcademy");
String nameId = "CPH";
int ispresent = amock.getAcademysAsJson().contains(nameId) ? 1 : 0;
BusinessAcademy a = amock.deleteAcademy(nameId);
if (ispresent == 1 && a.getName().equals(nameId)) {
... | 3 |
@Override
public void run() {
String responseData = null;
HttpClient httpClient = new HttpClient();
int statusCode = -1;
try {
statusCode = httpClient.executeMethod(mHttpMedthod);
if (statusCode != HttpStatus.SC_OK) {
System.err.println("HttpMethod failed: "
+ mHttpMedthod.getStatusLin... | 6 |
public void run(){
try (
/*ServerSocket serverSocket = new ServerSocket(portNumber);
Socket clientSocket = serverSocket.accept();*/
PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
) {
System.o... | 5 |
public boolean matchesAddress(String address, int port) {
if(address == null)
return (clientAddress == null && port == clientPort);
return (address.equals(clientAddress) && port == clientPort);
} | 3 |
public U fold(U u, Queue<T> ts, Function2<T, U, U> function)
{
// The recursive implementation will overflow the stack for
// any data set of real size, your job is to implement a
// non-recursive solution
// return fold(function.apply(ts.poll(), u), ts, function);
... | 5 |
public static void main(String[] args) {
int port;
if (args.length < 1) {
port = 6727;
} else {
port = Integer.parseInt(args[0]);
}
try {
serverSocket = new ServerSocket(port);
} catch (IOException ex) {
Logger.getLogger(Cl... | 4 |
protected static float complexToFloat(int complex)
{
return (complex&(COMPLEX_MANTISSA_MASK << COMPLEX_MANTISSA_SHIFT))
* RADIX_MULTS[(complex>>COMPLEX_RADIX_SHIFT) & COMPLEX_RADIX_MASK];
} | 0 |
public Set<AndroidMethod> getSources() {
return sources;
} | 0 |
public String toString() {
StringBuilder sb = new StringBuilder();
for (Card card : cards) {
sb.append(card.toString());
}
return sb.toString();
} | 1 |
public EqualDivisionNormalDistributedDemandGenerator(
int numberOfForerunPeriods, int offSet) {
if (numberOfForerunPeriods < 0 || offSet < 0) throw new IllegalArgumentException();
this.forerun = numberOfForerunPeriods;
this.offSet = offSet;
} | 2 |
@Override
public void mouseClicked(MouseEvent click) {
for (int j = 0; j < components.getLength(); j++) {
Componente component = components.get(j);
if (component.contains(click.getPoint())) {
if (SwingUtilities.isLeftMouseButton(click)) {
if (comp... | 5 |
private static void writeTableAssignmentByTable(String fileName) {
EasyWriter tableByTable = new EasyWriter(fileName + "_byTable.txt"); // "table_assignment_by_table.txt");
if (tableByTable.bad()) {
System.err.println("Error creating " + fileName + "_byTable.txt\n");
}
for (int i = 0; i < DiningRoom.size();... | 3 |
private String currentCategory() {
if (places[currentPlayer] == 0) return "Pop";
if (places[currentPlayer] == 4) return "Pop";
if (places[currentPlayer] == 8) return "Pop";
if (places[currentPlayer] == 1) return "Science";
if (places[currentPlayer] == 5) return "Science";
if (places[currentPlayer] == 9) ret... | 9 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.