text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void testGetValue() {
MonthDay test = new MonthDay();
assertEquals(6, test.getValue(0));
assertEquals(9, test.getValue(1));
try {
test.getValue(-1);
} catch (IndexOutOfBoundsException ex) {}
try {
test.getValue(2);
} catch (IndexOutO... | 2 |
public static synchronized Integer getValue(Object layout,
String key, int type) {
Integer ret = null;
boolean cont = true;
for (int i = LAYOUTS.size() - 1; i >= 0;
i--) {
Object l = LAYOUTS.get(i).get();
if (ret == null && l == layout) {
... | 9 |
public void process() {
if (properTimer > 0) {
properTimer--;
return;
} else {
properTimer = 4;
}
if (gameStartTimer > 0) {
gameStartTimer--;
updateWaitRoom();
}
if (gameStartTimer == 0) {
startGame();
}
if (gameTime > 0) {
gameTime--;
if (playersRemaining == 1)
endPitsGame(... | 6 |
public String sample_frequency_string () {
switch (h_sample_frequency) {
case THIRTYTWO:
if (h_version == MPEG1)
return "32 kHz";
else if (h_version == MPEG2_LSF)
return "16 kHz";
else
// SZD
return "8 kHz";
case FOURTYFOUR_POINT_ONE:
if (h_version == MPEG1)
return "44.1 kHz";
e... | 9 |
public void keyPressed(int key) {
if(key == Input.KEY_UP) {
this.setCurOption(curOption - 1);
if(curOption < 0) this.setCurOption(options.get(curPage).length - 1);
} else if(key == Input.KEY_DOWN) {
this.setCurOption(curOption + 1);
if(curOption == options... | 4 |
public Person getNextPerson(final Person person) {
if (person != null) {
logger.debug("(getNextPerson) Looking for Person with ID > " + person.getId());
for (final Map.Entry<Long, Person> map : personStorage.entrySet()) {
if (person.getId() == null || map.getKey() > person.getId()) {
// ohne id wird d... | 5 |
public float getXAxisDeadZone() {
if (xaxis == -1) {
return 0;
}
return getDeadZone(xaxis);
} | 1 |
@Override
protected void decode( ChannelHandlerContext ctx, ByteBuf in, List<Object> out ) throws Exception
{
int byteSize = in.readableBytes();
if(byteSize == 0 || !ctx.channel().isOpen())
return;
int id = Utils.readVarInt(in);
if (id != 0)
{
in.skipBytes(in.readableBytes());
throw new Il... | 4 |
public ListNode mergeTwoLists(ListNode l1, ListNode l2) {
if(l1 == null) return l2;
if(l2 == null) return l1;
ListNode res = null;
ListNode head = null;
while(l1 != null && l2 !=null)
{
if(l1.val<l2.val)
{
if(res == null)
{
res = l1;
he... | 9 |
public ResultSet browseFamilyHistory(String familyname) throws SQLException{
try{
databaseConnector=myConnector.getConnection();
stmnt=(Statement) databaseConnector.createStatement();
SQLQuery="SELECT * FROM familydoctor.patienthistory WHERE Family Name="+familyname;
... | 3 |
private static void syncDocumentToDocInfo(OutlinerDocument doc, int mode) {
DocumentInfo docInfo = doc.getDocumentInfo();
// Update DocumentSettings
doc.settings.getLineEnd().def = PropertyContainerUtil.getPropertyAsString(docInfo, DocumentInfo.KEY_LINE_ENDING);
doc.settings.getLineEnd().restoreCurrentToDefa... | 2 |
public static Matrix random(int M, int N) {
Matrix A = new Matrix(M, N);
for (int i = 0; i < M; i++) {
for (int j = 0; j < N; j++) {
A.data[i][j] = Math.random();
}
}
return A;
} | 2 |
public void mouseEntered(MouseEvent e) {
} | 0 |
public void find(Object... objs) throws IllegalArgumentException, IllegalAccessException, SQLException {
Class<?> clz = objs[0].getClass();
Field[] fields = clz.getDeclaredFields();
for (Field field : fields) {
ORMColumn oc = field.getAnnotation(ORMColumn.class);
if (oc != null && oc.physicalPkFld() && oc.a... | 7 |
public World()
{
this.lifetime = 0;
this.tiles = new int[SIZE][SIZE];
this.entities = new ArrayList<Entity>();
this.random = Game.instance.random;
this.generate();
int x = SIZE/2, y = SIZE/2;
while(!Tile.tiles.get(this.tiles[x][y]).isWalkable())
{
x = this.random.nextInt(SIZE);
y = this.random... | 5 |
public void setRightScore(int rightScore)
{
this.rightScore = rightScore;
notifyListeners();
} | 0 |
private void moveCursorRight(boolean shiftDown) {
int length = textField.getText().length();
if (shiftDown) {
int end = textField.getSelectionEnd();
if (end < length) {
textField.setSelectionEnd(end + 1);
}
} else {
int pos = textField.getCaretPosition();
if (pos < length)
textFie... | 3 |
public Complex harmonicMean_as_Complex() {
Complex mean = Complex.zero();
switch (type) {
case 1:
double[] dd = this.getArray_as_double();
mean = new Complex(Stat.harmonicMean(dd));
break;
case 12:
BigDecimal[] bd = this.getArray_as_BigDecimal();
mean = new Complex((Stat.harmonicMean(bd)).double... | 3 |
private void paintInfo(Graphics2D g2) {
final int margin = 10;
final int standardSpacing = 30;
int tmpX = GlobalPositioning.getXPixel(1);
g2.setColor(Color.BLACK);
g2.drawString("HP", 0, margin);
for ( Enemy currentEnemy : board.getAllEnemiesInCurrentWave()) {
... | 5 |
private void formScreen(String action,
Connection database,
HttpSession session,
HttpServletRequest request,
PrintWriter webPageOutput)
{
int collegeNumber=0;
String collegeName="";
... | 7 |
private void updateDevice_fastbootButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateDevice_fastbootButtonActionPerformed
String serial = deviceManager.getSelectedFastbootDevice();
if (serial == null || serial.equals("")) {
logger.log(Level.ERROR, "No device was f... | 4 |
public final String getCancelView() {
// Default to successView if cancelView is invalid
if (this.cancelView == null || this.cancelView.length() == 0) {
return getSuccessView();
}
return this.cancelView;
} | 2 |
public static int bfs(){
int where;
// queue Q
Queue<Integer> Q = new LinkedList<Integer>();
// push source to Q
Q.add(sour);
// mark source as visited
boolean v [] = new boolean[n];
v[sour] = true;
// keep an array from with the semnification: from[x] is the
// previous vertex visited in ... | 8 |
@Override
public void run() {
try {
p.play();
} catch (JavaLayerException ex) {
m_errorState = false;
m_errorMessage = ex.getMessage();
}
} | 1 |
private static Image getImage(String filename) {
// to read from file
ImageIcon icon = new ImageIcon(filename);
// try to read from URL
if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) {
try {
URL url = new URL(filename);
... | 6 |
public vaisseau containAndRetrieve(int x, int y) {
vaisseau tmp;
boolean trouve = false;
for (int i = 0; i < flotte.size(); i++) {
tmp = flotte.get(i);
if (tmp.isAlive()) {
if (!trouve && x > tmp.posx && x < (tmp.posx + tmp.taillex) && y > tmp.posy && y < ... | 7 |
public DrawableItem duplicate() {
return canvas.addItem(new Panel(this));
} | 0 |
public static void main(String[] args) {
int port = 9090;
String ip = "localhost";
if (args.length == 2) {
port = Integer.parseInt(args[0]);
ip = args[1];
}
try {
ChatClient tester = new ChatClient();
tester.registerEchoListener(new... | 3 |
private boolean upToDate (File verFile) {
boolean result = true;
try {
if (!verFile.exists()) {
verFile.getParentFile().mkdirs();
verFile.createNewFile();
result = false;
}
BufferedReader in = new BufferedReader(new File... | 6 |
@Override
public void writeExternal(ObjectOutput out) throws IOException
{
out.writeObject(this.getText());
if (this.getIcon() == Utils.getUnknownIcon())
out.writeObject(null);
else
out.writeObject(this.getIcon());
out.writeObject(medias);
out.writeObject(getImdbInfos());
} | 1 |
public static void main(String[] args) {
Useful[] x = { new Useful(), new MoreUseful() };
x[0].f();
x[1].g();
// Compile time: method not found in Useful:
// ! x[1].u();
((MoreUseful) x[1]).u(); // Downcast/RTTI
// ((MoreUseful) x[0]).u(); // Exception thrown
} | 0 |
final synchronized int method3623(int i, int i_3_, int i_4_, int i_5_) {
if (i != anInt7461) {
int i_6_ = User32.GetWindowLong(i, -4);
return User32.CallWindowProc(i_6_, i, i_3_, i_4_, i_5_);
}
if (i_3_ == 32) {
int i_7_ = 0xffff & i_5_;
if (i_7_ == 1) {
User32.SetCursor(aBoolean7460 ? anInt746... | 7 |
public de.unihannover.sim.labysim.model.graph.Labyrinth getGraphLabyrinth(){
HashMap<Integer, de.unihannover.sim.labysim.model.graph.Node> _nodes = new HashMap<Integer, de.unihannover.sim.labysim.model.graph.Node>();
LinkedList<de.unihannover.sim.labysim.model.graph.Edge> _edges = new LinkedList<de.unihannover.sim.... | 3 |
public boolean handleEvent(Event event) {
if (event.id != event.ACTION_EVENT) {
return super.handleEvent(event);
} else if(event.target==engineOn) {
car.engineOn();
control.engineOn();
return true;
} else if (event.target == engineOff) {
... | 8 |
public final void renderInternal(Graphics g) {
// Perform the actual rendering.
render(g);
// Perform the debug rendering.
if (SHOW_BOUNDING_BOX) {
// Store the current color.
Color color = g.getColor();
g.setColor(Color.magenta);
g.drawRect(x, y, getWidth(), getHeight());
// Restore the ... | 1 |
private static void merge(In[] streams)
{
int N = streams.length;
IndexMinPQ<String> pq = new IndexMinPQ<String>(N);
for (int i = 0; i < N; i++)
if (!streams[i].isEmpty())
pq.insert(i, streams[i].readString());
while (!pq.isEmpty())
{
System.out.print(pq.min() + " ");
int i = pq.delMin();
... | 4 |
public void load(String name) {
clearAll();
try {
coordToName.clear();
graph.clear();
FileInputStream fis = new FileInputStream(name);
ObjectInput ois = new ObjectInputStream(fis);
List<SerializableVertex> l = (List<SerializableVertex>) ois.r... | 5 |
@Override
public void executeCommand(String c) {
if (c.equals("" + this.getCommandChar())) {
this.insertChar(c.charAt(0));
return;
}
int i = 0;
while (i < this.commands.size() && !this.commands.get(i).match(c)) {
i++;
}
if (i >= this.commands.size())
throw new CommandNotFoundException(c);
els... | 4 |
public void generateBalancedBudget()
{
Player dummy = new PlayerCPU("dummy", getColor());
int rgold = 0, rwood = 0, rore = 0;
Cost cost;
for (Castle c: getCastles()) {
c.generateWeeklyRequirements(dummy);
cost = c.getWeeklyRequirements();
rgold += cost.gold;
rwood += cost.wood;
rore += cos... | 2 |
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
log.info("WANcostResummingServlet1h Got a GET...");
caches.reload();
link[][] linkArr = new link[caches.lSources.size()][caches.lDestinations.size()];
for (int i = 0; i < caches.lSources.size(); i++)
for (int j = ... | 9 |
@Override
public Class<?> getColumnClass(int columnIndex) {
// Returns the class of each column
if (columnIndex == columnNames.indexOf(ACTIVITY_COLUMN)) {
return Integer.class;
} else if (columnIndex == columnNames.indexOf(START_TIME_COLUMN)) {
return Timestamp.class;... | 6 |
* @return Cons
*/
public Cons remove(Stella_Object value) {
{ Cons self = this;
{ Cons cons = self;
Cons previouscons = null;
if (!(cons == Stella.NIL)) {
if (!(cons.rest == Stella.NIL)) {
previouscons = cons;
cons = cons.rest;
while (!(cons... | 6 |
private List<MorrisLineAdjacent> getSkewDownLineAdjacent() {
List<MorrisLineAdjacent> lines = new ArrayList<MorrisLineAdjacent>();
boolean bslu = this.hasSkewLeftUp();
boolean bsrd = this.hasSkewRightDown();
MorrisLineAdjacent oneLine = null;
if (bslu && bsrd) { //this is in the middle
oneLine = new Morris... | 6 |
private void doFireWork(final Player player) {
plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
@Override
public void run() {
Firework firework = player.getWorld().spawn(player.getLocation(), Firework.class);
ItemStack ... | 2 |
public boolean hasRole(String role) {
if (role != null && roles != null) {
for (Role r : roles) {
if (r != null && r.name != null && r.name.toLowerCase().equalsIgnoreCase(role.toLowerCase())) {
return true;
}
}
}
return ... | 6 |
public void shoot() {
double cooling = baseCooldown;
double agility = 0;
String[] sprites;
if (isPlayer())
sprites = new String[]{"bullet/blue/long"};
else
sprites = new String[]{"bullet/purple/long"};
for (GunUpgrade up : gunUpgrades) {
... | 4 |
public static void main(String[] args) {
int[] A = new int[2500];
for(int i = 2500; i >= 1; --i){
A[2500-i] = i;
}
// int [] A = new int[]{1,2};
System.out.println(new Jump_Game_II().jump(A));
} | 1 |
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... | 6 |
private float[] getPoint(Vector<Integer> Row)
{
//Funktion bekommt eine Reihe von ganzen Zahlen als Argument, gibt die Position, für die die letzte Zahl steht, zurück
//Bsp.: 012: 0=Anfang(0. Element der 0. Tiefe) 1= 2. element der 1. Tiefe, 2= 3. Element der 2. Tiefe
//Vector verweist auf gefundene Punk... | 2 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Cost cost = (Cost) o;
if (!this.getId().equals(cost.getId())) return false;
if (!this.getService().equals(cost.getService())) return false;
... | 9 |
@Override
public int filterRGB(int x, int y, int rgb) {
return (rgb & 0xff000000) | amount;
} | 0 |
private void btn_aceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_aceptarActionPerformed
if (lab_modo.getText().equals("Alta")){
if (camposCompletos()){
ocultar_Msj();
insertarCta();
camposEditables(false);
... | 8 |
public DefaultBox<?> getSourceItem() {
return sourceItem;
} | 1 |
public static JMenu findMenuByName(JMenuBar bar, String name) {
if (bar != null) {
int count = bar.getMenuCount();
for (int i = 0; i < count; i++) {
JMenu menu = bar.getMenu(i);
if (name.equals(menu.getName())) {
return menu;
}
}
}
return null;
} | 3 |
private void pattern_Button1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pattern_Button1ActionPerformed
try {
PrintWriter writer = new PrintWriter(this.jTextField_Parser.getText().substring(0, this.jTextField_Parser.getText().length() - 3) + "jsca", "UTF-8");
for (i... | 9 |
public List<User> findUser(Role role) throws Exception {
try {
session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
Query q = session.getNamedQuery(getNamedQueryToFindUser());
q.setInteger("role", (role.getId()));
... | 1 |
@Override
public void mouseDragged(MouseEvent e) {
if (this.isDrawing) {
//graphics2d.fillArc(e.getX(), e.getY(), 8, 8, 0, 360);
graphics2d.drawLine(this.x0, this.y0, e.getX(), e.getY());
this.getView().repaint();
this.x0 = e.getX();
this.y0 = e.getY();
}
if (this.isSelecting) {
int wid... | 3 |
public String intercept(ActionInvocation ai) throws Exception {
//取得请求的URL
String url = ServletActionContext.getRequest().getRequestURL().toString();
String prim = null;
User user = null;
int index = 0;
//验证Session是否过期
if(!ServletActionContext.getRequest().isRequestedSessionIdValid()){
return "tologin"... | 4 |
public void testConstructor_Object6() throws Throwable {
IntervalConverter oldConv = ConverterManager.getInstance().getIntervalConverter(new Interval(0L, 0L));
IntervalConverter conv = new IntervalConverter() {
public boolean isReadableInterval(Object object, Chronology chrono) {
... | 1 |
public static void startit(int num){
if (num==1){server1=new Thread (new GosLink(1));server1.start();}
else{server2=new Thread (new GosLink(2));server2.start();}
} | 1 |
@RequestMapping("query")
public String query(String orderNumber) {
orderNumber = orderNumber.trim();
BaseAction.getHttpServletRequest().setAttribute("orderNumber",
orderNumber);
Map<String, Object> map = new HashMap<>();
map.put("orderNumber", orderNumber);
List<ConsignmentEntity> list = this.consignment... | 1 |
public void drawLights(Graphics g, int camX, int camY, float alpha){
int x = camX - 20;
int y = camY - 20;
int maxX = camX + 60;
int maxY = camY + 60;
if (x < 0){
x = 0;
}
if (maxX >= getWidth()){
maxX = getWidth() - 1;
}
if (y < 0){
y = 0;
}
if (maxY >= getHeight()){
maxY = getHeight(... | 7 |
public void set(String key, Object value, int objectSize, int expInSec) throws CacheException {
if(QuickCached.DEBUG) logger.log(Level.FINE, "set key: {0}; objectsize: {1};",
new Object[]{key, objectSize});
cmdSets++;
try {
setToCache(key, value, objectSize, expInSec);
totalItems++;
if(Com... | 6 |
public void registerHabitat(Cuboid c, HabitatType type, String owner, String tenant, double worth, boolean buyable, double rental, boolean rentable, Map<Upgrade, Integer> upgrades) {
if (existsHabitat(c.getID()) || existsHabitat(c.getName()) || getHabitatByOwner(owner) != null || getHabitatByTenant(tenant) != null) r... | 5 |
private void drawLinks(Graphics2D g, String ode) {
Visode O = access.find(ode);
if (O == null)
return;
for (String parent : access.findParents(ode)) {
Visode P = access.find(parent);
if (P == null) {
System.err.println("Graph is missing parents (" + parent + ")");
continue;
}
bool... | 8 |
static final Object method1344(boolean flag, byte abyte0[]) {
if (abyte0 == null) {
return null;
}
if (abyte0.length > 136 && !Class142_Sub8_Sub6.aBoolean4005) {
try {
Class131 class131 = (Class131) Class.forName("Class131_Sub1").newInstance();
... | 5 |
public void endDialog() {
super.endDialog();
if (ret == false && win != null) {
win.setAlwaysOnTop(true);
win = null;
}
} | 2 |
void searchResult(String tth, User u) {
if (u == null || tth.equals(""))
return;
if (tth.startsWith("TTH:"))
tth = tth.substring(4);
synchronized (toDownload) {
for (Download d : toDownload) {
String file = d.due.file();
if (file.startsWith("TTH/"))
file = file.substring(4);
if (d.isHash ... | 7 |
public HistorialclinicoFacade() {
super(Historialclinico.class);
} | 0 |
public Node addNode(Node node) {
// this.nodes.add(node);
// CHANGED from this.getNode(0).getNode(0) TO this
// if current node has children
if (this.getNodes().size() != 0) {
node.parent = this.getNode(0).getNode(0);
node.index = node.getParent().getNodes().size();
}
else{
node.index = 0;
}
if ... | 7 |
public static void sort(String[] a, int W) {
// ͨǰWַa[]
int N = a.length;
int R = 256;
String aux[] = new String[N];
// ݴҵdַüW
for (int d = W - 1; d >= 0; d--) {
// һֵƵ
int[] count = new int[R + 1];
for (int i = 0; i < N; i++) {
count[a[i].charAt(d) + 1]++;
}
// ڶƵת
for (int r = 0... | 5 |
public boolean equalsExpr(final Expr other) {
return (other != null) && (other instanceof CastExpr)
&& ((CastExpr) other).castType.equals(castType)
&& ((CastExpr) other).expr.equalsExpr(expr);
} | 3 |
public static void balanced_brackets(String s) {
Stack<Boolean> stack = new Stack<>();
boolean open = true;
for (int i = 0; i < s.length(); i++) {
if(s.charAt(i) == '(') {
stack.push(open);
} else {
if (stack.empty()) {
... | 3 |
private ArrayList<Integer> selectRandomIndexesFromList (Integer number, List<?> list) {
ArrayList<Integer> selected = new ArrayList<Integer>();
Integer needed = number;
Integer available = list.size();
Random rand = new Random();
while (selected.size() < number) {
if( rand.nextDouble() < needed.doubleVal... | 3 |
@EventHandler
public void onMove(PlayerMoveEvent event){
for (CuboidAction action : actions) {
if(action.getCuboid().intersects(event.getTo()) || action.getCuboid().intersects(event.getFrom())){
action.onAction(event.getPlayer(), event.getFrom(), event.getTo());
}
... | 3 |
public void addHiddenLayer(int nodes){
int layer_count = layers.size();
Node[] last = layers.get(layer_count-2),
output = layers.get(layer_count-1);
//Create hidden layer
Node[] hidden = new Node[nodes+1];
for (int i=0; i<nodes; i++)
hidden[i] = new Node(false);
//Bias weight
hidden[nodes] = new No... | 5 |
public Skellam(double mu1, double mu2) throws ParameterException {
if (mu1 <= 0 || mu2 <= 0) {
throw new ParameterException("Skellam parameters mu1, mu2 > 0.");
} else {
this.mu1 = mu1;
this.mu2 = mu2;
pois1 = new Poisson(mu1);
pois2 = new Poisson(mu2);
}
} | 2 |
private void generateYieldPoint(Node node, boolean exprContext) {
// save stack state
int top = cfw.getStackTop();
maxStack = maxStack > top ? maxStack : top;
if (cfw.getStackTop() != 0) {
generateGetGeneratorStackState();
for (int i = 0; i < top; i++) {
... | 7 |
public Enumeration listOptions() {
Vector result;
Enumeration enm;
String param;
SelectedTag tag;
int i;
result = new Vector();
enm = super.listOptions();
while (enm.hasMoreElements())
result.addElement(enm.nextElement());
param = "";
for (i = 0; i < TAGS_ALGORITHM... | 7 |
public RandomSkipIterable(IRandomAccessor2<T> accessor, int count)
{
this._accessor = accessor;
this._count = count;
} | 0 |
public ArrayList<MedicineData> parse(String pathName){
ArrayList<MedicineData> medicines = new ArrayList<MedicineData>();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder db = dbf.newDocumentBuilder();
Document docum... | 5 |
private void addCard(){
EMenuChoices userChoice = EMenuChoices.NONE;
do{
System.out.println("What is the type of the card you want to add ?");
System.out.println("1 - Energy card");
System.out.println("2 - Trainer card");
System.out.println("3 - Pokemon card");
this.typedChoice = sc.nextLine();
... | 4 |
protected void loadJarURLs() throws Exception {
this.urlList = new URL[gameFiles.length + 1];
URL path = new URL("http://s3.amazonaws.com/MinecraftDownload/");
for (int i = 0; i < gameFiles.length; i++) {
this.urlList[i] = new URL(path, gameFiles[i]);
}
String osName = System.getProperty("... | 7 |
@Override
public void actionPerformed(ActionEvent e) {
OutlinerDocument doc = (OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched();
OutlinerCellRendererImpl textArea = doc.panel.layout.getUIComponent(doc.tree.getEditingNode());
if (textArea == null) {
return;
}
Node node = textArea.n... | 3 |
private IChromosome setupChromosome(final int[] set) throws InvalidConfigurationException {
subsetGenes = new Gene[k];
int minElementValue = Integer.MAX_VALUE;
int maxElementValue = Integer.MIN_VALUE;
for (final int element : set) {
minElementValue = Math.min(element, minElem... | 3 |
private Map<String, String> generate(boolean finish) {
Map<String, String> vars = new LinkedHashMap<String, String>();
Double percent = Double.valueOf(0);
if (max > 0) {
percent = round((double) current / max, 1);
}
if (formatVars.containsKey("bar")) {
i... | 9 |
public UserBean login(String login, String password){
if(login == null || password == null || login.length() == 0 || password.length() == 0){
return null;
}
UserDAO userDAO = new UserDAO(Connector.getInstance());
return userDAO.getUserByLoginPassword(login, password);
} | 4 |
public static Model loadModel(LibraryModel lmodel)
{
try
{
File file = lmodel.file;
if (file.exists())
{
JsonModel jmodel = FileUtils.readJson(file, JsonModel.class);
Model model = new Model(lmodel);
model.allocateLevels(jmodel.info.levels+1);
... | 4 |
private void borrarJuego(){
final Juego juego = ((Juego)listJuegos.getSelectedValue());
if(juego!=null){
int seguro = JOptionPane.showConfirmDialog(this
,"¿Estás seguro de querer eliminar"
+ "\nla partida '"+juego.getNombre().toUpperCase()+"'?"
... | 2 |
private static Document getConfigDocument() throws ReaderConfigException {
//拼出配置文件的路径
String configFilePath = System.getProperty("user.dir") + System.getProperty("file.separator") + "SourceSwitcher.xml";
try {
if (!new File(configFilePath).exists())
throw new ReaderConfigException("File \"SourceSwitcher.x... | 4 |
public boolean hasCollided(int xa, int ya)
{
int xMin = 0;
int xMax = 7;
int yMin = 3;
int yMax = 7;
for (int x = xMin; x < xMax; x++)
{
if (isSolidTile(xa, ya, x, yMin))
{
return true;
}
}
for (int x = xMin; x < xMax; x++)
{
if (isSolidTile(xa, ya, x, yMax))
{
return true;
... | 8 |
protected Element call(List<Element> params) {
//if the arity and param list correspond in size
if((null == params && arity == 0) || (null != params && params.size() == arity) || arity == -1) {
if(null == params) {
return apply(new ArrayList<Element>());
} else if(!special) {
List<Element> evaluatedPa... | 9 |
public boolean contains(final Object o) {
if(o instanceof MimeType) {
return hashSet.contains(o);
} else if(o instanceof Collection) {
return containsAll((Collection)o);
} else if(o instanceof String) {
String [] parts = ((String) o).split(",");
for(int i = 0; i < parts.length; i++) {
if(!contains... | 9 |
public boolean valid() {
return access != null && (scoped(SCOPE_NON_EXPIRING) || refresh != null);
} | 2 |
private void method63() {
SceneObject object = (SceneObject) aClass19_1179.getFront();
for (; object != null; object = (SceneObject) aClass19_1179.getNext()) {
if (object.anInt1294 == -1) {
object.anInt1302 = 0;
method89(object);
} else {
... | 2 |
@Override
public TexasHoldemWorker build()
{
if (super.getRounds() <= 0) {
throw new IllegalStateException("The number of rounds must be a strictly positive number");
} else if (super.getProfiles() == null || super.getProfiles().size() < 2) {
throw... | 8 |
private void listAllTeams()
{
clear();
System.out.println("Show all teams:");
System.out.println();
try
{
printShowHeader();
ArrayList<Team> teams = teammgr.listAll();
for (Team t : teams)
{
System.out.println(... | 2 |
@Override
public void render() {
if (getScreen() != null) {
glClear(GL_COLOR_BUFFER_BIT);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH);
getScreen().render(drawer);
if (!screenShotA... | 5 |
public AIBoard (int width, int height, String diff, User u) {
pencilMode_ON_OFF = false;
user = u;
difficulty = diff;
this.setBackground(Color.WHITE);
this.setLayout(new BorderLayout());
JTextPane titleMessage = new JTextPane();
JPanel title = new JPanel();
title.setBackground(Color.WHITE);
title.setL... | 7 |
public static void escribirFichero(Cliente x){
float aux_cuenta_corriente=0, aux_cuenta_ahorro=0, aux_penalizacion=0;
try{
if(x.getCunetacorriente()==null){
aux_cuenta_corriente=-1;
}else{
aux_cuenta_corriente=x.getCunetacorriente().consultar();
}
if(x.getCunetaahorro()==null){
aux_cuenta_ahorro=-1... | 4 |
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.