text stringlengths 14 410k | label int32 0 9 |
|---|---|
private void ShowQuizChoice()
{
JPanel qcPanel = new JPanel();
qcPanel.setSize(600, 600);
qcPanel.setLayout(null);
TimeLbl.setVisible(false);
qnumLbl.setVisible(false);
NextBtn.setVisible(false);
PrevBtn.setVisible(false);
Quiz[] availableQuiz... | 2 |
public SubmitJob(String[] args) throws ParseException {
CommandLineParser parser = new PosixParser();
CommandLine commandLine = parser.parse(getOptions(), args);
if(commandLine.hasOption("loop")) {
numIterations_ = Integer.parseInt(commandLine.getOptionValue("loop"));
} else {
numIterations... | 8 |
public void setWorkSpace(WorkSpace workSpace)
{
if (workSpace == null
|| ! (workSpace instanceof CommandPanelWorkSpace) ||
( (CommandPanelWorkSpace) workSpace).getLoginTable() == null ||
( (CommandPanelWorkSpace) workSpace).getLoginTable().size() ==
0)
{
... | 4 |
public void warAddtoPlayer1(int s, ArrayList p1, ArrayList p2)
{
//Adds card to the player 1 pile
for(int i=0; i<s; i++)
{
if(i<p1.size())
{
Object obj1 = p1.get(0);
Card c1 = (Card)obj1;
player1.addCard(0,c1);
}
if(i... | 3 |
public boolean getRedoEnabled() {
return this instanceof UndoInterface && redoEnabled;
} | 1 |
private void listagemProf() {
final Main m = new Main();
JLabel NomeCom = new JLabel("Professores:", JLabel.CENTER);
String[] v5 = new String[m.professores.size() + 1];
v5[0] = " ";
for (int i = 1; i < m.professores.size() + 1; i++) {
v5[i] = m.professores.get(i - 1)... | 8 |
public void keyPressed(KeyEvent e)
{
int key = e.getKeyCode();
if(key >= 48 && key <= 57) newMass = (key - 48)*100;
else if(key == KeyEvent.VK_Z)
{
game.GUI.offsetX += game.getWidth()*.05 + game.GUI.offsetX*.1;
game.GUI.offsetY += game.getHeight()*.05 + game.GUI.offsetY*.1;
game.GUI.scale *= 1.1;
}
... | 9 |
public void keyPressed(KeyEvent e)
{
if (e.getKeyChar() == 'w')
{
keyPressedW = true;
move = true;
}
if (e.getKeyChar() == 's')
{
keyPressedS = true;
move = true;
}
if (e.getKeyChar() == 'a')
{
keyPressedA = true;
move = true;
}
if (e.getKeyChar() == 'd')
{
keyPressedD = true... | 5 |
public boolean update(double[] data, boolean classifier) {
double sum = 0;
//create a new data vector to encompass all data points plus classifier
double[] vector = new double[data.length+1];
double norm = 1;
for (int i = 0; i < data.length; i++) {
vector[i] = data[i];
norm += data[i]*data[i];
}
... | 7 |
public void drawMe(Graphics2D g) {
if (!general)
drawPercentComparisonLines(g);
int J = 0;
for (Rectangle2D.Float bar : bars) {
if (general) {
if (minMaxHisto.x == J || minMaxHisto.y == J)
g.setColor(COLOR_HISTOGRAM_BAR_THIS);
else
g.setColor(COLOR_HISTOGRAM_BAR);
} else {
g.setColo... | 7 |
public void removeLocallyDeclareable(Set set) {
if (type == FOR && initInstr instanceof StoreInstruction) {
StoreInstruction storeOp = (StoreInstruction) initInstr;
if (storeOp.getLValue() instanceof LocalStoreOperator) {
LocalInfo local = ((LocalStoreOperator) storeOp.getLValue())
.getLocalInfo();
... | 3 |
public short tileToShort(Tile t)
{
short res = 0;
if (t.tileNum != -1)
res |= (short) ((t.tileNum + tileOffset) & 0x3FF);
res |= (short) ((t.hflip ? 1 : 0) << 10);
res |= (short) ((t.vflip ? 1 : 0) << 11);
res |= (short) (((t.palNum + paletteOffset) & 0x00F) << 1... | 3 |
private MessageBox getMessageBox() {
return (MessageBox) root.getScene().getWindow();
} | 0 |
private boolean combinedStringArrays(TupleDesc td1, TupleDesc td2, TupleDesc combined) {
for (int i = 0; i < td1.numFields(); i++) {
if (!(((td1.getFieldName(i) == null) && (combined.getFieldName(i) == null)) ||
td1.getFieldName(i).equals(combined.getFieldName(i)))) {
... | 8 |
protected void checkTypeOfOperands (List<Expression> operands)
{
List<Class<?>> expectedOperandTypes = getOperandTypes();
if (expectedOperandTypes == null) return;
boolean statusCheck = true;
for (int i = 0; i < operands.size(); i++)
{
statusCheck =
... | 5 |
private boolean verifyChapPassword(String plaintext)
throws RadiusException {
if (plaintext == null || plaintext.length() == 0)
throw new IllegalArgumentException("plaintext must not be empty");
if (chapChallenge == null || chapChallenge.length != 16)
throw new RadiusException("CHAP challenge must be 16 byt... | 8 |
public LinkedList<Vertex> createPlan(int start, int stop, int color, boolean intekrock) {
LinkedList<Vertex> path;
Graph graph = new Graph(nodes, edges);
DijkstraAlgorithm dijkstra = new DijkstraAlgorithm(graph, ds);
// Compute shortest path
dijkstra.execute(nodes.get(start - 1))... | 6 |
@Override
public boolean register(Game g, Rack r) {
super.register(g, r);
if (g.rack_size != 5)
return false;
for (Model m: ensemble){
if (!m.register(g, r))
return false;
}
return true;
} | 3 |
public JTextField getjTextFieldNumRapport() {
return jTextFieldNumRapport;
} | 0 |
public void delReservation(int resid){
Connection con = null;
Statement stmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDATABASE_URL(),
... | 4 |
public static Float getMasterOutputVolume() {
Line line = getMasterOutputLine();
if (line == null) return null;
boolean opened = open(line);
try {
FloatControl control = getVolumeControl(line);
if (control == null) return null;
return control.getValue();
} finally {
if (opened) line.close();
}
... | 3 |
public Configuration[] getInitialConfigurations(String input) {
State init = myAutomaton.getInitialState();
State[] closure = ClosureTaker.getClosure(init, myAutomaton);
Configuration[] configs = new Configuration[closure.length];
for (int k = 0; k < closure.length; k++) {
configs[k] = new FSAConfiguration(c... | 1 |
public Cartoon() {
System.out.println("Cartoon constructor");
} | 0 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Clientes)) {
return false;
}
Clientes other = (Clientes) object;
if ((this.id == null && other.id != null) || (... | 5 |
@Override
public void getInput() {
int selection = -1;
boolean isValid = false;
do {
this.displayMenu();
Scanner input = SnakeWithPartner.getInFile();
do {
try {
selection = input.nextInt();
isValid ... | 8 |
public int getCalled0Raised1OrFolded(MOB player)
{
if(!pot.contains(player))
return -1;
final Double inPot=(Double)pot.elementAt(pot.indexOf(player),2);
int numHigherThanPlayer=0;
int numEqualToPlayer=0;
for(int p=0;p<pot.size();p++)
if(pot.elementAt(p,1)!=player)
{
final Double potAmount=(Doubl... | 7 |
public static String[][] run(String train, String test) {
int k = 3;
// read the train file
//String inputtrainf="IrisTrain.csv";
//String inputtestf="IrisTest.csv";
String inputtrainf=train;
String inputtestf=test;
ArrayList<String> trainList = getFile(inputtrain... | 6 |
private static void insertRecordIntoDbUserTable(ArrayList<String> xmlList) throws SQLException {
// generates rows in table, each with file name and one keyword
Connection dbConnection = null;
PreparedStatement statement = null;
try {
dbConnection = getDBConnection();
statement = dbConnection.prepa... | 8 |
private static URL __getWsdlLocation() {
if (BOOKSERVICESOAPSERVICEIMPLSERVICE_EXCEPTION!= null) {
throw BOOKSERVICESOAPSERVICEIMPLSERVICE_EXCEPTION;
}
return BOOKSERVICESOAPSERVICEIMPLSERVICE_WSDL_LOCATION;
} | 1 |
@Override
public void takeTurn(GameBoard currentBoard) {
boolean inputInvalid = true;
Scanner sc = Main.Scan;
String invalidRowInputMessage = this.Name
+ ", that input is invalid.\n Please select a row by entering its number.";
String rowPrompt = currentBoard.toString() + "\n\n" + Name
+ ", select a r... | 6 |
public static void find(HousePetList hpArray)
{
HousePet housepet = new HousePet();
int aChipID = 0;
@SuppressWarnings("resource")
Scanner console = new Scanner(System.in);
String consoleOutMsg = "";
boolean containsHousePet = true;
System.out.println... | 5 |
public void onQuery(Player player, ReplicatedPermissionsContainer query)
{
if (query != null)
{
if (!this.playerModInfo.containsKey(player.getName()))
{
this.plugin.getLogger().warning("Received query from unregistered player " + player.getName());
this.playerModInfo.put(player.getName(), new Hashtab... | 5 |
public int executeCommits(ArrayList<String> c){
Statement s;
for (int i = 0; i < c.size(); i++) {
try {
s = StatusController.connection.createStatement();
s.executeUpdate(c.get(i));
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return -1;
}
}
r... | 2 |
public static String join(String[] lines, String glue) {
if (lines.length == 1) {
return lines[0];
}
StringBuilder out = new StringBuilder();
for (int i = 0; i < lines.length - 1; i++) {
out.append(lines[i]).append(glue);
}
out.append(lines[lines.l... | 2 |
private double calculateClosestBruteForce(Point[] sortedByX) {
double minDistance = Double.MAX_VALUE;
for (int i = 0; i < sortedByX.length; i++) {
for (int j = 1; j < sortedByX.length; j++) {
//we don't want to calculate distance between the same point
if (i !... | 4 |
public void onMessage(JSONObject msg, Callback cb) {
// TODO call the callback obj in case of callback. If not send call the
// method!
String methodName = msg.optString("method", null);
JSONObject data = msg.optJSONObject("data");
if (methodName == null) {
System.err... | 7 |
private boolean BookFieldCheck(String booklistString){
boolean isbn = false;
boolean bookdate = false;
Scanner analysisbooklist = new Scanner(booklistString);
while (analysisbooklist.hasNext()){
String getstring = analysisbooklist.next();
if(this.BooklistISBNCheck(getstring)){
isbn = true;
}
els... | 5 |
private int evaluateValueofBoardForBlack(Board board) {
int bValue = 0;
if (board.isBlackWinner()) {
bValue -= POINT_WON;
return bValue;
} else {
bValue = WhiteBlackPiecesDifferencePoints(board);
// bValue += BoardPositionPoints(board);
... | 1 |
public static void main(String[] arg) {
String input = arg[0];
String output = (arg.length > 1 ? arg[1] : null);
InputStream in = null;
try {
in = new FileInputStream(input);
} catch (Exception e) {
System.out.println(e);
}
State foo = new... | 6 |
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int N = in.nextInt();
int[] cardCounts = new int[N];
for (int i = 0; i < N; i++)
cardCounts[i] = in.nextInt();
long straights = 0L;
LinkedList<ArrayList<Integer>> bounds = new LinkedList<ArrayList<Integer>>();
bounds.add(... | 9 |
public static void Build(int n, String filename) throws FileNotFoundException{
// generate Board
int [][] Board = new int[n][n];
boolean[] numberUsed = new boolean[n*n]; // each index needs to appear on board. the value at that array position is true if on board, false if not
for (int i=0; i<n*n; i++){
numb... | 8 |
private boolean outputResults(String zOutputFile, Vector vResults)
{
try
{
// create the output stream
BufferedWriter outWriter = new BufferedWriter(new FileWriter(zOutputFile));
// go through each point in the grid and diagram the path
// Use X for obstacle squares o for clear squares that aren't ... | 9 |
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
if (super.equals(o)) {
return true;
}
orgataxe.entity.Model model = (orgataxe.entity... | 7 |
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(args.length == 0) {
Messenger.sendMessage("NicksRequest written by codermason v1.0", sender);
Messenger.sendMessage("Use /nicks help for help!", sender);
}else{
if(args[0].equalsIgnoreCase("help")) {
n... | 7 |
public String getOutputKeyword() {
Dialog currentDialog = DialogManager.giveDialogManager().getCurrentDialog();
switch ((Start)getCurrentState()) {
case S_ENTRY:
setQuestion(false);
return "<" + currentDialog.getCurrentSession().getCurrentRobot().getRobotData().getRobotName() + ">";
case S_EXIT:
setQue... | 9 |
public void destroy(Long id) throws NonexistentEntityException {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
Usuario usuario;
try {
usuario = em.getReference(Usuario.class, id);
usuar... | 2 |
public static void setup(ExtendedEntityType mob, ValueChance<Ability> abilityChances, List<Object> optList)
{
Iterator<Object> it = optList.iterator();
while (it.hasNext())
{
Map<String, Object> optMap = MiscUtil.getConfigMap(it.next());
if (optMap == null)
continue;
int chance = MiscUtil... | 5 |
@Override
public String toString() {
return type;
} | 0 |
private boolean isValidInput(final String s) {
return s.matches("[0-9]{1,}");
} | 0 |
public double getMaxTime (){
double maxTime = 0;
for(int i = 0; i<time.length; i++){
if(time[i]>maxTime)
maxTime = time[i];
}
return maxTime;
} | 2 |
public int getPrevIncompleteIndex(int row, int col)
{
boolean notFound = true ;
int len = translations.size() ;
int t = row ;
int back = -1 ;
while ( (t >= 0) && notFound)
{
TMultiLanguageEntry dummy = (TMultiLanguageEntry) translations.get(t) ;
String str = dummy.getTransl... | 4 |
public boolean logUser(User usertemp){
if(userList.indexOf(usertemp) == -1)
return false;
else{
user = usertemp;
return true;
}
} | 1 |
public static void led_branch(String num, String filepath, String sn, Scanner scanner){
String line="", result = "";
int item=0;
System.out.println("Please choose the LED light you want to test: 1=white led, 2=rgb led, 0=return:");
line=scanner.nextLine();
while (!(line.equals("0"))){
while ((!(line.equ... | 7 |
@Override
public String toString() {
Field[] fields = this.getClass().getDeclaredFields();
StringBuilder sb = new StringBuilder();
sb.append('[');
for (Field f : fields) {
if (Modifier.isStatic(f.getModifiers())
|| Modifier.isFinal(f.getModifiers()))
continue;
Object value = null;
try {
f... | 6 |
@Override
public void run() {
while (alive){
//We keep consuming jobs while they are available
IJob job = null;
synchronized (jobQueue){
if (jobs.size() > 0)
job = jobs.remove(0);
else
alive = false;
}
//Make sure not to hog the synchronization of the queue when we don't ... | 8 |
private void addAttack(int x, int y, int minRange, int maxRange)
{
int nX, nY;
for(int i = -maxRange; i <= maxRange; i++) {
for(int j = Math.abs(i) - maxRange; j <= maxRange - Math.abs(i); j++) {
nX = x + i;
nY = y + j;
if(nX >= 0 && nX < G... | 8 |
public MapPanel(Map map, Game game) {
this.game = game;
// Scrolling movement timer
timer.scheduleAtFixedRate(new TimerTask() {
public void run() {
if (mapImage_Scaled != null && viewPort != null
&& mouseInsidePanel) {
moveIfInBounds(checkIfInBounds(mousePoint));
}
}
}, 1000, 25);
//... | 4 |
private void quickSort(int left, int right) {
int l = left; // index of left-to-right scan
int r = right; // index of right-to-left scan
if (right - left >= 1)
{
int pivot = table[left];
while (r > l)
{
while (table[l] <= pivot && l <= right && r > l)
l++; // element greater than the pivot... | 9 |
@Test
public void WhenUpdatingUnknownHost_ExpectNothing()
throws UnknownHostException {
int level = localhost_.getHostPath().length();
RoutingTable table = new RoutingTable();
table.setLocalhost(localhost_);
Assert.assertTrue(table.uniqueHostsNumber() == 0);
Hos... | 1 |
public String logUpload(String appKey, String userKey, String testId, String fileName, String dataType) {
try {
appKey = URLEncoder.encode(appKey, "UTF-8");
userKey = URLEncoder.encode(userKey, "UTF-8");
testId = URLEncoder.encode(testId, "UTF-8");
fileName = URLE... | 1 |
private void checkArithmeticExpression() throws Exception {
List<Token> expression = new ArrayList<Token>();
while(iterator < tokenList.size() && isValidArithmeticElement(tokenList.get(iterator))) {
expression.add(tokenList.get(iterator));
iterator++;
}
ShuntingYard shuntingYard = new ShuntingYard(exp... | 2 |
public int doStartTag() throws JspException {
try {
JspWriter out = pageContext.getOut();
if (command == null) { // This is a "CANTHAPPEN" since the TLD defines it as required
throw new JspException("CommandOutputTag: command attribute is required");
}
Process p = Runtime.getRuntime().exec(comman... | 6 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
private boolean isInSomeUSet(Integer s) {
for (AcceptingPair pair : acceptanceCondition) {
if (pair.U.contains(s)) {
return true;
}
}
return false;
} | 2 |
public static Animation bulletAnimationRight(){
Animation anim = new Animation();
anim.addFrame(getMirrorImage(loadImage("bullet1.png")), 50);
anim.addFrame(getMirrorImage(loadImage("bullet2.png")), 50);
anim.addFrame(getMirrorImage(loadImage("bullet3.png")), 50);
... | 0 |
public void visitIfZeroStmt(final IfZeroStmt stmt) {
if (CodeGenerator.DEBUG) {
System.out.println("code for " + stmt);
}
final Block t = stmt.trueTarget();
final Block f = stmt.falseTarget();
if (f == next) {
// Fall through to the false branch.
genIfZeroStmt(stmt);
} else if (t == next) {
//... | 3 |
public static void main(String[] args){
Set<Integer> tri = new HashSet<Integer>();
for(int i=1;i<1000;i++){
tri.add(i*(i+1)/2);
}
Scanner in = new Scanner(System.in);
int count=0;
while(in.hasNext()){
String s = in.next();
String[] prewords = s.split(",");
for(String w : prewords){
if(isTri(... | 4 |
public void deleteVertex(String id) {
increaseAccess();
Node node = nodeMap.get(id);
if (node != null) {
for(Map.Entry<String, Edge> entrySet : this.edgeMap.entrySet()) {
Edge edge = entrySet.getValue();
/**
*/
if ((edge.getNode1().equals(node))
|| (edge.getNode2().equals(node)... | 4 |
private int buildJump(int xo, int maxLength)
{
int js = random.nextInt(4) + 2;
int jl = random.nextInt(2) + 2;
int length = js * 2 + jl;
boolean hasStairs = random.nextInt(3) == 0;
int floor = height - 1 - random.nextInt(4);
for (int x = xo; x < xo + length; x++)
... | 9 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Main other = (Main) obj;
if (city == null) {
if (other.city != null)
return false;
} else if (!city.equals(other.city))
return false;... | 7 |
public boolean isLegalMoveTwo(int pieceNumber){
if (board[pieceNumber].getPieceType()==1 || board[pieceNumber].getPieceType()==2){
if (board[pieceNumber].getX()==(BOARDSIZE-board[pieceNumber].getLength()+1))
return false;
}
else{
if (board[pieceNumber].getY()==(BOARDSIZE-board[pieceNumber].get... | 8 |
public static boolean moveOneBoxToClosestGoalGreedyBFS(Vector<State> inOutStatesVector, int pBoxIndex){
//Set the comparator for this serach:
oneBoxMoveComp.setBoxToClosestGoal(pBoxIndex);
//Create a search queue;
PriorityQueue<State> open = new PriorityQueue<State>(100, oneBoxMoveComp);
//"Local" HashS... | 8 |
public static boolean setFechaDeLlegada(Paquete paquete)
{
Document doc;
Long identificadorPaquete;
Element root,child;
List <Element> rootChildrens;
boolean found = false;
int pos = 0;
SAXBuilder builder = ne... | 6 |
public boolean isOptOut() {
synchronized (optOutLock) {
try {
// Reload the metrics file
configuration.load(getConfigFile());
} catch (IOException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.g... | 4 |
private void unflashol() {
for (int i = 0; i < visol.length; i++) {
if ((olflash & (1 << i)) != 0)
visol[i]--;
}
olflash = 0;
olftimer = 0;
} | 2 |
@Override
public Administratie load() throws IOException {
if (!isCorrectlyConfigured()) {
throw new RuntimeException("Serialization mediator isn't initialized correctly.");
}
ObjectInputStream in = null;
FileInputStream stream = null;
Administratie admin... | 5 |
public static void computeBoundingRect(ArrayList<Point> points) {
double minX = points.get(0).getX();
double maxX = minX;
double minY = points.get(0).getY();
double maxY = minY;
for (Point p:points) {
if (p.getX() < minX) minX = p.getX();
... | 6 |
public ArrayList<HashMap<String, String>> read(File file) {
ArrayList<HashMap<String, String>> addressList = new ArrayList<>();
ICsvMapReader mapReader = null;
try {
mapReader = new CsvMapReader(new FileReader(file), CsvPreference.TAB_PREFERENCE);
// the header columns a... | 7 |
public String tryJoinClub(int cid, int uid) {
// if that guy already existed in the club's member list
for (int existedMember : this.userDao.clubMembersUid(cid)) {
if (uid == existedMember)
return "member";
}
// if that guy already sent out an join_club_apply
for (Object obj : this.userDao.clubJoinAppl... | 8 |
public void newGame() {
money = 1000;
name = JOptionPane.showInputDialog(this, "Please enter your name:");
if (name == null) {
return;
}
File savegame = new File(PATH + name + ".csg");
if (savegame.exists()) {
Object[] options = { "Yes", "No" };
int option = JOptionPane.showOptionDialog(this,
... | 4 |
public String getToolTip() {
return "Deleter";
} | 0 |
public void requireSanity(State s) {
boolean sane = true;
if (s.players().length != players.length) {
System.err.println("inconsistent belief: number of players changed");
sane = false;
}
if (!s.deck.containsAll(known_deck_cards)) {
CardBag surplus = known_deck_cards.clone();
surplus.removeAll... | 8 |
public static String readTextFromJar(String s) {
InputStream is = null;
BufferedReader br = null;
String line;
String list="";
try {
is = misc.class.getResourceAsStream(s);
br = new BufferedReader(new InputStreamReader(is));
while (null != (line = br... | 5 |
public static void startupJavaTranslate() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$);
Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
... | 6 |
@Override
public String toString() {
return rank + " of " + suit;
} | 0 |
public static List<String> getStrings(Language path, Object... args) {
// Gets the messages for the path submitted
List list = language.getList(path.getPath());
List<String> message = new ArrayList<String>();
if (list == null) {
Logging.warning("Missing language for: " + pat... | 3 |
public static void updateDescriptors(ArrayList<PathDescriptor> currentDescriptors, ArrayList<PathDescriptor> newDescriptors) {
System.out.println("Before Update");
System.out.println(currentDescriptors.toString());
int currentSize = currentDescriptors.size();
for (int i = 0; i < currentS... | 8 |
private static byte lengthOfMonth(byte month, int year) {
if (month == 4 || month == 6 || month == 9 || month == 11)
return 30;
if (month == 2)
if (year%4 == 0 && (year%100 != 0 || year%400 == 0))
return 29;
else return 28;
return 31;
} | 8 |
public String question(String request) {
// TODO priority vs timer (all async)
for (Brain brain : brains) {
String response = brain.question(request);
if (null != response)
return response;
}
return null;
} | 2 |
public String getAuthor(SQLconnection connection,int id)
{
String query="select author from dblpauthor where paperid="+id;
ResultSet authorSet=connection.Query(query);
String author="";
try {
while(authorSet.next())
{
author+=authorSet.getString("author")+",";
}
authorSet.close();
} catch (SQ... | 2 |
public void input() {
float moveAmt = (float) (10 * Time.getDelta());
float rotAmt = (float) (100 * Time.getDelta());
if (Input.getKey(Input.KEY_W))
move(getForward(), moveAmt);
if (Input.getKey(Input.KEY_S))
move(getForward(), -moveAmt);
if (Input.getKey... | 8 |
@Override
public String toString() {
return "[filePath=" + filePath + ", fieldLineIndex=" + fieldLineIndex
+ ", skipLines=" + skipLines + ", dataTypeLineIndex="
+ dataTypeLineIndex + ", ignoreColumnIndex="
+ Arrays.toString(ignoreColumnIndex) + "]";
} | 0 |
void checkin() {
if (!Modeler.directMW)
return;
StringBuffer sb = new StringBuffer();
String os = System.getProperty("os.name") + " " + System.getProperty("os.version");
String user = ModelerUtilities.getUnicode(System.getProperty("user.name"));
try {
sb.append("os=" + URLEncoder.encode(os, "UTF-8"));... | 9 |
public boolean not_left_value(String val,int size){
if(in_function == 1)
{
if(func_array_var.containsKey(val)){
array_info temp = func_array_var.get(val);
if(temp.dim != size-1)
return true;
}
}
else {
... | 5 |
public static void toggleEditableForSingleNode(Node node, CompoundUndoable undoable) {
int oldValue = node.getEditableState();
int newValue = Node.EDITABLE_INHERITED;
boolean isEditable = node.isEditable();
if (oldValue == Node.EDITABLE_FALSE) {
node.setEditableState(Node.EDITABLE_TRUE);
newValue = Nod... | 3 |
static final public void facteur() throws ParseException {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case VRAI:
case FAUX:
case entier:
case ident:
case 54:
primaire();
break;
case NON:
case SUBNEG:
opNeg();
primaire();
expression.testNeg();
exp... | 8 |
private void rmBus (Object busname)
{
USB bus = (USB) busses.get (busname);
if (trace)
System.err.println ("rmBus " + bus);
for (int i = 0; i < listeners.size (); i++) {
USBListener listener;
listener = (USBListener) listeners.elementAt (i);
try { listener.busRemoved (bus); }
catch (Exceptio... | 3 |
public void thinkAndPlay() throws BadBoardException, BadMoveException, BadPartialMoveException {
System.out.println("computer is thinking...");
if (myGame.getCurrentPlayer( ) != myColor) {
throw new BadBoardException("AI can't move now, it's not AI's turn!");
}
if ( ! myGame.... | 7 |
public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (this.isOptOut()) {
return false;
}
// Is metrics already running?
if (taskId >= 0) {
return true;
}
// Begin hitting t... | 5 |
public Personnage selectionPersonnage()
{
JFileChooser fc = new JFileChooser("./src/jars/sauvegarde");
int returnVal = fc.showOpenDialog(this);
if(returnVal == JFileChooser.APPROVE_OPTION)
{
File file = fc.getSelectedFile();
if(file.getName().contains(".data")... | 3 |
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.