text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public JSONObject main(Map<String, String> params, Session session)
throws Exception {
JSONObject rtn = new JSONObject();
long targetUserId = Long.parseLong(params.get("id"));
User targetUser = User.findById(targetUserId);
if(targetUser == null) {
rtn.put("rtnCode", this.getRtnCode(406));... | 9 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Departamento other = (Departamento) obj;
if (this.id != other.id) {
return false;
}
... | 4 |
public void showFileSelectDialog() {
File f = new File("outgoing" + File.separatorChar);
JFileChooser chooser = new JFileChooser(f);
chooser.setCurrentDirectory(f);
javax.swing.filechooser.FileFilter filter = new javax.swing.filechooser.FileFilter() {
@Override
public boolean accept(File pathname) {
... | 8 |
product[] readdata(String fn) {
File ifile = new File(fn);
FileInputStream f_in = null;
BufferedInputStream b_in = null;
DataInputStream d_in = null;
boolean eof = false;
product[] pr = new product[50];
try {
f_in = new FileInputStream(ifile);
b_in = new BufferedInputStream(f_in)... | 6 |
protected void installListeners() {
super.installListeners();
if (AbstractLookAndFeel.getTheme().doShowFocusFrame()) {
focusListener = new FocusListener() {
public void focusGained(FocusEvent e) {
if (getComponent() != null) {
orgB... | 6 |
public Server_Socket(Core core, int port)
{
this.core = core;
try {
serv_socket = new java.net.ServerSocket(port);
if (t == null) {
t = new Thread(this);
t.start();
}
//int newPort = 50000 - n... | 2 |
@Override
public void run() {
final ArrayList<Integer> keys = new ArrayList<Integer>(count.keySet());
Collections.shuffle(keys);
for (Integer key : keys) {
final Integer clicksRemaining = this.count.get(key);
if (clicksRemaining == 0) {
continue;
}
int clicksToDo = Random.nextInt(0, clicksRemai... | 9 |
public void fireChatEventToListeners(ChatEvent chatEvent) {
chatEvent = formatChatMessage(chatEvent);
for (MessageListener messageListener : messageListeners) {
if (chatEvent.getReceipient() == messageListener.getReceipient() || messageListener.getReceipient() == Receipient.GLOBAL)
messageListener.onChatEven... | 3 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
super.tick(ticking,tickID);
if(canAct(ticking,tickID))
{
if(ticking instanceof MOB)
assistMOB((MOB)ticking);
else
if(ticking instanceof Room)
for(int i=0;i<((Room)ticking).numInhabitants();i++)
assistMOB(((Room)ticking).fetchInh... | 7 |
private Method findMethodWith( Class<? extends Annotation> type, boolean isOptional )
{
Method[] methods = process.getClass().getMethods();
for( Method method : methods )
{
if( method.getAnnotation( type ) == null )
continue;
int modifiers = method.getModifiers();
if( Modi... | 7 |
public void update(Stage stage) {
if(source != null) {
setCenterPosition(source.getX(), source.getY());
}
} | 1 |
public int getHandValue()
{
int total = 0;
int aces = 0;
for (Card c : cards)
{
if (c.getValue().getValue() == 11)
{
aces++;
}
else
{
total += c.getValue().getValue();
}
}
... | 4 |
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new FileReader("C:\\Users\\aawor_000\\workspace\\TCPServer\\src\\Users\\Adam.txt"));
try {
StringBuilder sb = new StringBuilder();
String line = br.readLine();
while (line != null) {
... | 1 |
public ArrayList<Administrador> getByNombre(Administrador admin){
PreparedStatement ps;
ArrayList<Administrador> admins = new ArrayList<>();
try {
ps = mycon.prepareStatement("SELECT * FROM Administradores WHERE userName LIKE ?");
ps.setString(1, "%"+admin.getNombre()+"%"... | 4 |
private boolean execEstimate(VectorMap queryParam, StringBuffer respBody, DBAccess dbAccess) {
try {
int clntIdx = queryParam.qpIndexOfKeyNoCase("clnt");
String clientName = (String) queryParam.getVal(clntIdx);
int ftrsIdx = queryParam.qpIndexOfKeyNoCase("ftrs");
... | 9 |
public void runAssert() {
// need to get the object we will run the assertions on.
final Object object;
try {
object = callable.call();
} catch (final Exception e) {
final String message = (name == null) ? "Could not retrieve object." :
"Could ... | 7 |
public void setPin(String pin) {
this.pin = pin;
} | 0 |
public static boolean warpNextMap_Agent(final MapleCharacter c, final boolean fromResting) {
final int currentmap = c.getMapId();
final int thisStage = (currentmap - baseAgentMapId) / 100;
MapleMap map = c.getMap();
if (map.getSpawnedMonstersOnMap() > 0) {
return false;
}
if (!fromResting) {
clearMap(m... | 6 |
private Combination<Colors> generateAttemptCombination4() {
List<Token<Colors>> attemptTokens = new ArrayList<Token<Colors>>();
attemptTokens.add(new Token<Colors>(Colors.G));
attemptTokens.add(new Token<Colors>(Colors.Y));
attemptTokens.add(new Token<Colors>(Colors.P));
attemptTokens.add(new Token<... | 0 |
public static void addInserDzien(int ID)
{
boolean flaga=true;
for (int i=0 ; i<DniInsert[0] ; i++)
{
if(ID==DniInsert[i+2])
{
flaga=false;
break;
}
}
if(flaga)
{
// Count ArraySize
if (DniInsert[0]+2 >=DniInsert[1])
{
int[] tempArray = new int[DniInsert[1]];
for (in... | 6 |
private int jjMoveStringLiteralDfa10_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjMoveNfa_0(0, 9);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
return jjMoveNfa_0(0, 9);
}
switch(curChar)
{
case 66:
return jjMoveStringLiteral... | 6 |
@Override
/**
* This method will be used by the table component to get
* value of a given cell at [row, column]
*/
public Object getValueAt(int rowIndex, int columnIndex) {
Object value = null;
Contestant contestant = contestants.get(rowIndex);
switch (columnIndex) {
case COLUMN_USERNAME:
value = c... | 2 |
public void resetGame(int boardSize, int handicap, Player player1, Player player2) {
if (computerMatch != null) {
computerMatch.requestStop();
}
gameOver = false;
this.player1 = player1;
this.player2 = player2;
board = new Board(boardSize, handicap);
analyzerPanel.analyze(board);
activeMove = new ... | 3 |
public AnnotationVisitor visitAnnotation(final String desc,
final boolean visible) {
if (!ClassReader.ANNOTATIONS) {
return null;
}
ByteVector bv = new ByteVector();
// write type, and reserve space for values count
bv.putShort(cw.newUTF8(desc)).putShort(0);
AnnotationWriter aw = new AnnotationWriter(... | 2 |
public boolean removeBook(String title)
{
boolean delete = false;
if (aBookIndex.containsKey(title)) {
Item tempBook = aBookIndex.remove(title);
authorIndex.remove(((Book)tempBook).getAuthor());
for (String s: tempBook.keywords) {
keywordIndex.get(s).... | 2 |
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
System.out.println("Insert a bunch of numbers separated by coma bitch");
String[] array1 = input.nextLine().split(",");
int length = array1.length;
int[] array2 = new int[length];
f... | 9 |
public void setTokenizerProperties(TokenizerProperties props) throws NullPointerException {
if (props == null) {
throw new NullPointerException();
}
// set properties
if (_properties != null) {
_properties.removeTokenizerPropertyListener(this);
}
_properties = props;
_properties... | 8 |
@Override
public String onSkillSee(L2Npc npc, L2PcInstance caster, L2Skill skill, L2Object[] targets, boolean isPet)
{
if (npc instanceof L2ChestInstance)
{
// This behavior is only run when the target of skill is the passed npc.
if (!Util.contains(targets, npc))
return super.onSkillSee(npc, caster, ski... | 8 |
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String accion = request.getParameter("accion");
if (accion != null) {
response.sendRedirect("http://www.unac.edu.co");
} else {
Stri... | 7 |
public void ProcessInPacketBuffer() {// process a packet for distance updates
BlastPacket bpkt, BlastPktNext;
DataPacket dpkt, DataPktNext;
while (!BlastPacketInBuf.isEmpty()) {
bpkt = BlastPacketInBuf.removeFirst(); // if (TempPkt instanceof BlastPacket) { } ?
BlastPktNext = ProcessBlastPacket(... | 5 |
public boolean sendScreenCaptures(String[] cmd, String screenImgSavePath, String fileNameWithoutExtension)
{
try
{
ArrayList alToSend = CaptureScreen.captureScreens(screenImgSavePath, fileNameWithoutExtension);
if ((alToSend == null) || (alToSend.size() < 1))
{
return false;
}... | 9 |
private void refreshCalendar(int month, int year) {
int nod, som; // Number Of Days, Start Of Month
prevMonth.setEnabled(true);// enable button
nextMonth.setEnabled(true);// enable button
if (month == 0 && year == actualYear) {
prevMonth.setEnabled(false);
} // disable button as already pass
if (month ==... | 7 |
public static Entry[] mergeSortAndPopulate(int[] list) { //For testing only
Entry[] input = new Entry[list.length];
for(int i = 0; i < list.length; i++) {
input[i] = new Entry(list[i], randomName());
}
return mergeSort(input);
} | 1 |
public Children(Entity... childs) {
// Create a list list with the size of child's array
children = new ArrayList<Entity>(childs.length);
for (Entity child : childs) {
Spatial childSpatialComponent = child.getComponent(Spatial.class);
Equipment childEquipmentComponent = child.getComponent(Equipment.class);... | 3 |
public void setVerboseLevel(int level) {
this.verbose_level = level;
} | 0 |
private static double compare(String alg1, String alg2, int N, int T,
String inputType, String dataType)
{
Comparable[] a = new Comparable[N];
Comparable[] b = new Comparable[N];
try
{
SortHelper.class.getMethod("put" + inputType + "Input",
Comparable[].class).invoke(null, (Object) a);
}
catch ... | 2 |
public static EnumTemperature getFromValue(float rawTemp) {
if (rawTemp > 1.00f) {
return HOT;
}
else if (rawTemp > 0.85f) {
return WARM;
}
else if (rawTemp > 0.35f) {
return NORMAL;
}
else if (rawTemp > 0.0f) {
return COLD;
}
else {
return ICY;
}
} | 4 |
public NondeterminismPane(AutomatonPane ap) {
super(new BorderLayout());
ap.addMouseListener(new ArrowDisplayOnlyTool(ap, ap.getDrawer()));
add(ap, BorderLayout.CENTER);
add(new JLabel("Nondeterministic states are highlighted."),
BorderLayout.NORTH);
} | 0 |
@RequestMapping(value = "/game/requests/response/", method = RequestMethod.POST)
public String checkResponseRequestPage(IdForm idForm, ModelMap model){
if (!idForm.getId().equals("")) {
int id = Integer.parseInt(idForm.getId());
String state = idForm.getState();
try {
... | 5 |
public void setXVal(Double[] newXVal) {
if (newXVal == null) {
this.xVal = new Double[0];
} else {
this.xVal = Arrays.copyOf(newXVal, newXVal.length);
}
} | 1 |
@Override
public void onKeyPressed(char key, int keyCode, boolean coded)
{
// Tests the functions of the wavsound
if (!coded)
{
// On d plays the sound
if (key == 'd')
{
this.testsound.play(null);
System.out.println("Plays a sound");
}
// On e loops the sound
else if (key == 'e')
{
... | 6 |
public MoviePathSearcher(Model m) {
this.m = m;
pathsToMovies = new Path[100];
matcher = new PathMatcher[100];
pathIndex = 0;
int i = 0;
for (String s : m.getSearchKeywords()) {
matcher[i++] = FileSystems.getDefault().getPathMatcher("glob:" + s);
}
} | 1 |
private static void mergeMaps(Map<String,Integer> map1, Map<String,Integer> map2){
Objects.requireNonNull(map2);
for (Map.Entry<String, Integer> e : Objects.requireNonNull(map1).entrySet()) {
if (e != null) {
int val = 0;
if (map2.get(e.getKey()) != null) val = map2.get(e.getKey());
if (val != 0) {
... | 4 |
private void displayMiddleBorder() {
System.out.print(B_HEAD);
boolean dec = false;
for (int i=0; i < this.size; i++) {
int size = this.size;
while (size > 0) {
System.out.print("-");
size -= (dec ? 1 : 0);
dec=(!dec);
}
System.out.print((i < this.size-1 ? "-+" : ""));
}
... | 4 |
Physics() {
this.totalForce = new SimpleVector();
this.location = new SimpleVector();
} | 0 |
private static <E extends Enum<E>> E valueOf(final Class<E> type, final int ordinal) {
final E[] enums = type.getEnumConstants();
return (ordinal >= 0 && ordinal < enums.length ? enums[ordinal] : null);
} | 2 |
@Test
public void shouldSortProvidedArray2() throws Exception {
Integer[] array = new Integer[]{4, 2, 4, 1, 3, 45, 23, 424, 3};
sort.sort(array);
for (int i : array) {
System.out.println(i);
}
} | 1 |
public boolean removeAllEdges(Object origin, Object destination)
{
// retrieve the origin and destination vertices
Vertex o = (Vertex)theItems.get(origin);
Vertex d = (Vertex)theItems.get(destination);
if (o == null || d == null)
{
// one of the vertices does not exist
return false;
}
// remo... | 5 |
@Test
public void getWidth(){
Tile[][] tiles = new Tile[15][10];
for (int x = 0; x < tiles.length; x++){
for(int y = 0; y < tiles[0].length; y++){
tiles[x][y] = new Tile(new Position(x, y), 0);
}
}
World w = new World(tiles);
assertTrue(w.getWidth() == 15);
} | 2 |
public void run(){
while(true){
String line = scan.next();
if ( line.equals("next")) next();
if ( line.equals("previous")) previous();
if ( line.equals("stop")) stopMusic();
if ( line.equals("pause")) pause();
if ( line.equals("play")) play();
if ( line.equals("random")) randomize();
if ( line... | 8 |
public int numDistinct(String S, String T) {
if (S == null || T == null) {
return 0;
}
int[][] nums = new int[S.length() + 1][T.length() + 1];
for (int i = 0; i < S.length(); i++) {
nums[i][0] = 1;
}
for (int i = 1; i <= S.length(); i++) {
for (int j = 1; j <= T.length(); j++) {
nums[i][j] = ... | 6 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if(mob.fetchEffect(this.ID())!=null)
{
Ability A=mob.fetchEffect(ID());
if(A!=null)
A.unInvoke();
A=mob.fetchEffect(ID());
if(A!=null)
mob.tell(L("You are already hiding in plain ... | 8 |
@Override
protected String toString(int indent) {
String str = toString(indent, "IfStatementNode\n");
if(exp1 != null)
str += exp1.toString(indent+1) + "\n";
if(stateSeq1 != null)
str += stateSeq1.toString(indent+1) + "\n";
if(elseIfs != null)
str += elseIfs.toS... | 4 |
private void fireConnectEvent(ConnectEvent evt) {
fireClientConnectEvent(evt);
} | 0 |
public void stop() {
timer.cancel();
timer = null;
tick = 0;
elapseTime = 0;
state = EnumStopWatchState.STOP;
log.info("stop stopwatch, it's state:" + state + ", elapseTime:"
+ elapseTime);
} | 0 |
public EasyDate setTimeZoneOffset(int minutes) {
StringBuilder timeZoneID = new StringBuilder().append("GMT").append((minutes > 0 ? '+' : '-')).append(minutes / 60);
int min = minutes % 60;
if (min > 0) {
timeZoneID.append(':');
if (min < 10) {
timeZoneID.append('0');
}
timeZoneID.append(min);
}... | 3 |
private void updateFromModel()
{
if (enabledButton != null) {
enabledButton.setSelected(valueFilledIn);
enabledButton.setEnabled(enabled);
}
if ((timeClock != null) && (timeClock.isVisible())) {
timeClock.setEnabled(valueFilledIn && enabled);
}
if ((dateClock != null) && (date... | 7 |
private void nextpoints(int alg) {
for (int i = 0; i < points; i++) {
double xf = Math.random();
double yf = Math.random();
int xi = (int) Math.floor(ximlen * xf);
int yi = (int) Math.floor(yimlen * yf);
doCalculation(xf, yf, xi, yi);
}
runtotal += points;
if (quad < 1.001) {
quad = 1;
} el... | 4 |
public String version_string()
{
switch (h_version)
{
case MPEG1:
return "MPEG-1";
case MPEG2_LSF:
return "MPEG-2 LSF";
case MPEG25_LSF: // SZD
return "MPEG-2.5 LSF";
}
return(null);
} | 3 |
public static HttpURLConnection getValidConnection(URL url) {
HttpURLConnection httpurlconnection = null;
try {
URLConnection urlconnection = url.openConnection();
urlconnection.addRequestProperty("User-Agent", "Mozilla/4.0(compatible;MSIE 5.0;Windows NT;DigExt)");
... | 6 |
public static void main(String[] args) {
if (args.length < 2) {
System.err.println("Verwendung: <Akteurdatei> <Szenendatei>");
System.exit(-1);
}
File acteurs = new File(args[0]);
File scene = new File(args[1]);
if (!acteurs.exists() || acteurs.isDirectory()) {
System.err.println("Die Akteurdatei ... | 5 |
private void selectionMouseCursor(Page currentPage, Point mouseLocation) {
if (currentPage != null &&
currentPage.isInitiated()) {
// get page text
PageText pageText = currentPage.getViewText();
if (pageText != null) {
// get page transform, s... | 6 |
private CollectionUtils() {} | 0 |
private void checkCollision() {
if(r.intersects(StartingClass.hb.getHeliBoy1())){
visible = false;
StartingClass.score += 1;
}
if (r.intersects(StartingClass.hb2.getHeliBoy2())){
visible = false;
StartingClass.score += 1;
}
} | 2 |
public void clickedUnit(Unit unit) {
reset();
clickedName.setText(unit.getName());
clickedName.setOpaque(false);
gameIconPanel.add(clickedName);
if (unit.getName().equals("Tank") || unit.getName().equals("Marine")) {
String path = "/imgs/units/" + unit.getName() + ".png";
if (unit.getName() == "Mari... | 5 |
@Test
public void testGetRoot() {
QuickUnion spy = Mockito.spy(new QuickUnion(5));
assertThat(spy.getRoot(0), is(0));
assertThat(spy.getRoot(1), is(1));
assertThat(spy.getRoot(2), is(2));
assertThat(spy.getRoot(3), is(3));
assertThat(spy.getRoot(4), is(4));
spy.union(0, 1);
assertThat(spy.getRoot... | 0 |
public static boolean writeCSV(RosterDB rosterDB, String absolutePath) {
// create output file
FileWriter outputStream = null;
try {
outputStream = new FileWriter(absolutePath);
outputStream.write("Name,Vorname,Handy,Aspirant\n");
for (Roster r: rosterDB.getRosters()) {
outputSt... | 4 |
@Override
public String getSex() {
return super.getSex();
} | 0 |
private void mouseHelper(int codeNeg, int codePos,
int amount)
{
GameAction gameAction;
if (amount < 0) {
gameAction = mouseActions[codeNeg];
}
else {
gameAction = mouseActions[codePos];
}
if (gameAction != null) {
gameActio... | 2 |
@EventHandler(priority=EventPriority.HIGH)
public void onPlayerInteract(PlayerInteractEvent e)
{
if(e == null)
return;
Player p = e.getPlayer();
if(e.getClickedBlock() == null)
return;
Location l = e.getClickedBlock().getLocation();
if(l == null || TreasureManager.currentTreasureLocation =... | 7 |
public Cliente getCliente(String nome) throws ExceptionGerentePessoa{
for (Cliente c : clientes) {
if (c.getNome().equalsIgnoreCase(nome)) {
return c;
}
}
throw new ExceptionGerentePessoa("Cliente n��o cadastrado");
} | 2 |
public List<String> getArguments() {
List<String> arguments = new ArrayList<>();
for (CmdLineData one : mData) {
if (!one.isOption()) {
arguments.add(one.getArgument());
}
}
return arguments;
} | 2 |
public void sizeColumnToFit(TreeColumn column) {
int width = getPreferredColumnWidth(column);
if (width != column.getWidth()) {
column.setWidth(width);
invalidateAllRowHeights();
run();
repaint();
}
} | 1 |
private static void lagNode(Node node, String ord, int len, int index) {
while (len > index) {
char c = ord.charAt(index);
if (node != null){
HashMap<Character, Node> tempMap = node.barn;
if (!tempMap.containsKey(c) && tempMap.containsKey('?'))
tempMap.put(c, new Node());
if (len == index + 1) ... | 8 |
public int getIceResistance(){
int value = 0;
for (Armor armor : armorList) {
if(armor != null) value += armor.getStats().getIceResistance();
}
return value;
} | 2 |
public void createSons(){ // Tested
SimulatedPlanetWars simpw = this.getSim();
for (Planet myPlanet: simpw.MyPlanets()){
//avoid planets with only one ship
if (myPlanet.NumShips() <= 1)
continue;
// We create a son for each of the possible situations
for (Planet notMyPlanet: simpw.NotMyPlane... | 4 |
@Override
public int compare(Person o1, Person o2) {
if (o1.getFirstName().equals(o2.getFirstName())
&& o1.getSecondName().equals(o2.getSecondName())
&& o1.getMail().equals(o2.getMail())
&& o1.getPhone().equals(o2.getPhone()))
return 0;
if ... | 5 |
private double medianOfMedians(ArrayList<double[]> puntos, int axis,int start,int end){
switch (end-start+1){
case 1: return puntos.get(start)[axis];
case 2: return (puntos.get(start)[axis]+puntos.get(start+1)[axis])/2;
case 3: return medianOfThree(puntos, axis,start);
case 4: return medianOfFour(puntos, axis... | 6 |
@Override
public void onCommand(POP3Session session, String argument1,
String argument2) throws POP3Exception {
// 检查会话状态是否合法
if (session.getState() != POP3State.TRANSACTION) {
throw new POP3Exception("-ERR auth first");
}
User user = session.getUser();
List<Email> emailList = user.getEmailList();
/... | 9 |
public void watch(String dirPath) {
Path dirToMonitor = Paths.get(dirPath);
try {
watcher = dirToMonitor.getFileSystem().newWatchService();
// Register create, modify and delete watchers
dirToMonitor.register(watcher,
StandardWatchEventKinds.ENTRY_CREATE,
StandardWatchEventKinds.ENTRY_DELETE,
... | 9 |
@Override
public void run() {
boolean done = false;
int waitTime = 500;
try {
Packet pack = new Packet("PUTCHUNK", "1.0", chunk, null);
DistributedBackupSystem.cManager.sendPacket(pack, CommunicationManager.Channels.MDB);
do {
int storedCount = 0;
try {
Thread.sleep(waitTime);
} catch... | 9 |
private boolean validateCardType(String cardNumber, CreditCardType cardType) {
CodeValidator apacheCardValidator;
switch (cardType) {
case VISA:
apacheCardValidator = org.apache.commons.validator.routines.CreditCardValidator.VISA_VALIDATOR;
break;
case AMERICAN_EXPRESS:
apacheCardValidator = org.apache... | 4 |
private void drawtracking(GOut g) {
g.chcolor(255, 0, 255, 128);
Coord oc = viewoffset(sz, mc);
for (int i = 0; i < TrackingWnd.instances.size(); i++) {
TrackingWnd wnd = TrackingWnd.instances.get(i);
if (wnd.pos == null) {
continue;
}
Coord c = m2s(wnd.pos).add(oc);
g.fellipse(c, new Coord(100... | 2 |
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
Date now = new Date();
String username = request.getParameter("username");
String emailAddress = request.getParameter("emailAddress");
String hashedPassword... | 8 |
public JSONObject accumulate(
String key,
Object value
) throws JSONException {
testValidity(value);
Object object = opt(key);
if (object == null) {
put(key, value instanceof JSONArray ?
new JSONArray().put(value) : value);
} else if (... | 3 |
public void verteile_neu_ohne(Spieler zuentfernenderspieler, Spieler[] andereSpieler){
/*
sag mal codest du mit dem editor??
wie gesagt , ja - und ich finde fuer Editor programmieren hab ich relativ wenig falsch gemacht.
und vlt. pfuscht du in zukunft nicht so rum, dass... | 4 |
private void render(Graphics g) {
OpSolution sol = solution;
g.setColor(Color.black);
g.fillRect(0, 0, width, height);
// render the ideal solution
int y = 0;
g.setColor(Color.cyan);
for (Double c : sol.ideal) {
int x = (int) (c * width);
g.drawLine(x, y, x, y + 8);
}
y+=9;
// render the ... | 8 |
private void onTranslate(final String mode) {
new Thread() {
public void run() {
try {
copyMarkedText();
final String text = getClipboardData();
if(text != null) {
translator = createSelectedTranslator();
if(translator == null) return;
translator.setFrom(gui.getComboFrom(... | 7 |
private static void editarMusica()
{
boolean salir;
String nombre, codigo;
Integer idMusica;
Musica musica;
do
{
try
{
System.out.print( "Introduce el Id del producto msica: ");
idMusica = Integer.parseInt( scanner.nextLine());
if ((musica = Musica.buscar( idMusica)) == null)
... | 6 |
private void moveListElement(int increment)
{
Object mover = jListLocations.getSelectedValue();
int oldIndex = jListLocations.getSelectedIndex();
int newIndex = oldIndex + increment;
if(oldIndex < 0 || newIndex > jListLocations.getModel().getSize() - 1)
return;
if... | 4 |
public void addBook(Book book) {
Connection con = null;
PreparedStatement pstmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDATABASE_URL(),
dbCo... | 4 |
public static String getDefaultNickname()
{
configLocation = System.getProperty("user.home") + File.separator + "." + title.toLowerCase() + File.separator;
try
{
FileInputStream fis = new FileInputStream(configLocation + "defaultnick");
BufferedReader br = new BufferedReader(new FileReader(new File(config... | 7 |
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h)
{
if (c instanceof AbstractButton == false)
{
super.paintBorder(c, g, x, y, w, h);
return;
}
AbstractButton button = (AbstractButton) c;
ButtonModel model = button.getModel();
if (model.isEnabled())
{
boolean isPressed... | 8 |
public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double)o).isInfinite() || ((Double)o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... | 7 |
protected void initNewDebateComponents() {
createDebateJfme = new JFrame();
createDebateJpel = new JPanel();
createDebateJfme.add(createDebateJpel);
titleCDJlbl = new JLabel("Title:");
titleCDJlbl.setFont(new Font("Tahoma", 1, 16));
maxTurnsCDJlbl = new JLabel("Max Turns");
maxTurnsCDJlbl.setFont(new Font... | 3 |
public boolean findAtNE(int piece, int x, int y){
if(x==0 || y==7 || b.get(x-1,y+1)==EMPTY_PIECE) return false;
else if(b.get(x-1,y+1)==piece) return true;
else return findAtNE(piece,x-1,y+1); // there is an opponent
} // end findAtNE | 4 |
public List<Chromosome> select(List<Chromosome> population,
int targetPopulationSize) {
List<Chromosome> survivors = new LinkedList<Chromosome>();
List<Double> absoluteFitnesess = new LinkedList<Double>();
double totalFitness=0;
for(Chromosome c : population) {
double valor = Math.abs(f.calculate(d... | 6 |
private Node higherNode(T k) {
Node x = root;
while (x != NULL) {
if (k.compareTo(x.key) <0) {
if(x.left != NULL){
x = x.left;
}else{
return x;
}
} else {
if(x.right != NULL){
x = x.right;
}else{
Node current = x;
while(current.parent != NULL && curr... | 6 |
public int getNbCoupMax(){
return Integer.parseInt(propriete.getProperty("nb_coups"));
} | 0 |
public void actionPerformed (ActionEvent event)
{
if (event.getSource() == begin)
{
int i = 0;
double d = 0.00;
String nump = NumProducts.getText();
String dprice = DesiredPrice.getText();
String s = OptionalAdditions.getText();
output.setText(" ");
errlabel1.setFore... | 8 |
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.