text stringlengths 14 410k | label int32 0 9 |
|---|---|
protected boolean computeCell(int col, int row)
{
boolean liveCell = getCell(col, row);
int neighbours = countNeighbours(col, row);
boolean nextCell = false;
if (neighbours < 2) nextCell = false;
if (liveCell && (neighbours == 2 || neighbours == 3)) nextCell = true;
if (liveCell && neighbours... | 8 |
public static ArrayList<bConsultaCompo> getPesquisaCompo(String prod, String data_in) throws SQLException, ClassNotFoundException {
ArrayList<bConsultaCompo> sts = new ArrayList<bConsultaCompo>();
Connection conPol = conMgr.getConnection("PD");
ResultSet rs;
if (conPol == null) {
... | 3 |
public String getEndConditionSummary() {
StringBuilder sb = new StringBuilder("This game ends when; ");
int i = 0;
if(nrOfFlips > 0) {
if(i++ > 0)
sb.append(" or ");
sb.append("the mode has flipped from building to battle: ").append(nrOfFlips).append(" times");
}
if(winningScore > 0) {
if(i++ > 0... | 8 |
public State hasChosenCharactersState() {
return hasChosenCharactersState;
} | 0 |
public static String saveDirectory() {
try(BufferedReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8)) {
prop.load(reader);
return prop.getProperty("saveDirectory");
} catch (IOException ex) {
try {
PropHandle.reset();
... | 3 |
public void draw(Bitmap render, int xOffset, int yOffset)
{
for(int y = 0; y < render.height; y++)
{
int yPix = y + yOffset;
if (yPix < 0 || yPix >= height)
continue;
for(int x = 0; x < render.width; x++)
{
int xPix = x + xOffset;
if (xPix < 0 || xPix >= width)
continu... | 6 |
public static void main(String[] args){
DecimalFormat df = new DecimalFormat("0.0#Hz");
String str;
Note myNote = new Note();
System.out.println("Note Length :"+myNote.getLength());
System.out.println("Note Value :" + myNote.getValue());
if(myNote.isNatural())
... | 3 |
public void setAvalie(PExpLogica node)
{
if(this._avalie_ != null)
{
this._avalie_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this)... | 3 |
public void poistaPalaute(Palaute p) throws DAOPoikkeus {
try {
PalauteDAO pDao = new PalauteDAO();
pDao.poistaPalaute(p.getPalauteID());
} catch (DAOPoikkeus po) {
throw new DAOPoikkeus("Tietokannasta poistaminen ei onnistunut", po);
}
} | 1 |
public void joinUserInChannel(ChatChannel chatChannel, User user){
try{
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
String url = "jdbc:derby:" + DBName;
Connection connection = DriverManager.getConnection(url);
Statement statement = connection.createStatement();
String selectUserFromChan... | 2 |
public void setUp()
{
// Get questions
List<Question> allQuestions = DbAccess.getAllQuestions(false);
// creates values for size of list
QuestionCount = allQuestions.size();
if(QuestionCount == 0)
{
// Set Values
QuestionText_t... | 2 |
public static Jeu creerJeu(Utilisateur utilisateur, String nom, String description, byte[] icone, String iconeType)
throws ChampInvalideException, ChampVideException{
if (utilisateur.getRole().getValeur() < Role.Utilisateur.getValeur())
throw new InterditException("Vous devez être connec... | 7 |
public void setCallgraphAlgorithm(CallgraphAlgorithm algorithm) {
this.callgraphAlgorithm = algorithm;
} | 0 |
void menuLoad() {
animate = false; // stop any animation in progress
// Get the user to choose an image file.
FileDialog fileChooser = new FileDialog(shell, SWT.OPEN);
if (lastPath != null)
fileChooser.setFilterPath(lastPath);
fileChooser.setFilterExtensions(OPEN_FILTER_EXTENSIONS);
fileChooser.setFil... | 5 |
@Override
public String lookup(String question) {
// Tjek om der er valgt et spil
if (currentgame == null) {
return null;
}
// Find spørgsmål
for (int i = 0; i < currentgame.getQuestions().size(); i++) {
if (currentgame.getQuestions().get(i).getQuesti... | 3 |
public void pickUpItem() {
float eps = (float) 1e-01;
float n = player.getTaille();
if((Math.abs(player.getY() - getY()) - (getHeight()/2 + player.getTaille()/2)) <eps){
float x_gauche = player.getX() - n / 2;
float x_droite = player.getX() + n / 2;
float p_gauche = getX() - getWidth() / 2;
float p_d... | 6 |
@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 Prioridade)) {
return false;
}
Prioridade other = (Prioridade) object;
if ((this.getId() == null && other.getId... | 5 |
static final boolean method2935(byte b, int i, int i_0_) {
anInt7520++;
if (i_0_ >= 1000 && (i ^ 0xffffffff) > -1001) {
return true;
}
if (i_0_ < 1000 && (i ^ 0xffffffff) > -1001) {
if (Node_Sub27.method2699(18, i)) {
return true;
}
if (Node_Sub27.method2699(18, i_0_)) {
return false;
}
... | 9 |
public boolean isSamePath(Room r1, Room r2) {
if (r1.getCenterX() == start.x && r1.getCenterY() == start.y) {
if (r2.getCenterX() == end.x && r2.getCenterY() == end.y)
return true;
} else if (r2.getCenterX() == start.x && r2.getCenterY() == start.y) {
if (r1.getCenterX() == end.x && r1.getCenterY() == end... | 8 |
public static Date strtotime(String input) {
if (input.startsWith("[") || input.startsWith("\"")) {
input = Functions.substr(input,1);
}
if (input.endsWith("[") || input.startsWith("\"")) {
input = Functions.substr(input,0,-1);
}
for (Matcher matcher : matchers) {
D... | 6 |
public static void main(String[] args) {
ArgParserTest test = new ArgParserTest();
ArgHolder<Boolean> bh = new ArgHolder<Boolean>(Boolean.class);
boolean[] b3 = new boolean[3];
ArgHolder<Character> ch = new ArgHolder<Character>(Character.class);
char[] c3 = new char[3];
ArgHolder<Integer> i... | 3 |
public void LoadContent() {
gameFrame.getContentPane().add(ContinueButton);
random1 = (int) (Math.random()*4 + 1);
do {
random2 = (int) (Math.random()*4 + 1);
} while (random1 == random2);
switch (random1) {
case 1:
disp1 = sora;
... | 9 |
public AIConnection[] getListInTurnOrderAndMoveToNextTurn(){
// TODO: Dead players are currently not purged anymore. Verify that works...
// purgeDeadPlayersFromRing();
// TODO: build in check here to skip over passing players
// TODO: test this code
while(true){
currentPlayer = currentPlayer.next;
if(c... | 5 |
private static int search(int[] table, int value)
{
int index = 0;
if (table[index + 32] <= value) {
index += 32;
}
if (table[index + 16] <= value) {
index += 16;
}
if (table[index ... | 9 |
@Override
public Roleschool addRoleFromGson(String json, long id) {
Roleschool role = null;
if (json.contains("Teacher")) {
role = gson.fromJson(json, Teacher.class);
}
if (json.contains("Student")) {
role = gson.fromJson(json, Student.class);
}
... | 5 |
@Override
public String toString() {
String name = getName();
String append = "";
if(name != null && !name.equals("")) {
append = "(\"" + this.getName() + "\")";
}
return "TAG_Long" + append + ": " + value;
} | 2 |
public void PassengersOnBoarding(BusStop busStop,OutputFile screen)
{
//set the current bus stop
currentBusStop = busStop;
//set the average persons for the bus stop
busStop.SetAverageNumberOfPersons();
//set the average person wait time
busStop.SetAveragePersonsWaitTime(this... | 4 |
public void play() {
System.out.println("Starting the game...");
for (double gameNumber = 0; gameNumber < mGames; gameNumber++) {
double x1 = mRandom.nextTrueDouble();
double x2 = mRandom.nextTrueDouble();
System.out.println("X1=" + x1 + "\nX2=" + x2);
for... | 8 |
public static Node treeDelete(Node root,Node z){
if(z.left == null){
root = transplant(root,z,z.right);
}
else if(z.right == null){
root = transplant(root,z,z.left);
}
else{
Node y = minimum(z.right);
if( y.p != z){
root = transplant(root,y,y.right);
y.right = z.right;
y.right.p = y;... | 3 |
public String toString(){
return Integer.toString(value) + "(" + Integer.toString(id) + ")";
} | 0 |
public void shift(int base_position){
int[] z = findZ(base_position);
System.out.println(String.format("z1, z2:%3d, %3d", z[0], z[1]));
System.out.println("Before shift:");this.print();
// (z[0] , base_position-1] 区间全部左移
for (int i = z[0]+1; i != base_position; ++i){
... | 4 |
public static int signingCost(Application app) {
//
// TODO: Signing cost is based on transport factors, attraction, no.
// already employed, etc. Implement all of that.
int transport = 0, incentive = 0, guildFees = 0 ;
guildFees += Background.HIRE_COSTS[app.position.standing] ;
if... | 5 |
@Test
public void testReleasePortNumberRunning() {
LOGGER.log(Level.INFO, "----- STARTING TEST testReleasePortNumberRunning -----");
try {
server1.startThread();
} catch (IOException | ServerSocketCloseException | FeatureNotUsedException e) {
exception = true;
... | 4 |
public void render(Graphics g) {
g.drawImage(image, map.mapXOffset + mapX, map.mapYOffset + mapY, null);
if (owned) { //if owned, a blue rectangle appears around it on sides where there is unowned land
g.setColor(Color.RED);
Point listPoint = map.getListLocation(this);
if (!map.tileIsOwned(listPoint... | 8 |
public final void CompleteTrade() {
for (final IItem item : exchangeItems) {
byte flag = item.getFlag();
if (ItemFlag.KARMA_EQ.check(flag)) {
item.setFlag((byte) (flag - ItemFlag.KARMA_EQ.getValue()));
} else if (ItemFlag.KARMA_USE.check(flag)) {
item.setFlag((byte) (flag - ItemFlag.KARMA_USE.getVa... | 5 |
private void dummy() {
} | 0 |
private static void sort(int[] array) {
for (int i = 0; i < array.length; i++) {
for (int j = i; j < array.length; j++) {
if (array[j] > array[i]) {
array[j] = array[i] ^ array[j];
array[i] = array[i] ^ array[j];
array[j] = ... | 3 |
public int verschilInMaanden(Datum d) {
int verschilInJaren = this.verschilInJaren(d);
if (this.kleinerDan(d) && this.getJaar() == d.getJaar()) {
int verschilMaanden = d.getMaand() - this.getMaand();
return verschilInJaren * 12 + verschilMaanden;
}
if (this.kleinerDan(d)) {
int overschotMaanden = 12 - ... | 6 |
public void addDataSet(DataSet set)
{
this.datasets.add(set);
} | 0 |
public String generate(Object argument)
{
final StringBuffer stringBuffer = new StringBuffer();
String header_guide =rpc.Helper.getIncludeGuide(rpc.Context.Get().getCurrentPackage(), rpc.Helper.PathType.eParamsHeader);
stringBuffer.append(TEXT_1);
stringBuffer.append(header_guide);
stringBuffer.... | 8 |
Map(String name, Tile[][] map) throws MapNotRectangularException {
//check if array is rectangular
{
int x = map.length;
int y = map[0].length;
int ytemp;
for(Tile[] array : map){
ytemp = array.length;
if(y != ytemp){
... | 4 |
@Override
public int attack(double agility, double luck) {
System.out.println("I tried to do a special attack but I haven't set it so I failed at this turn...");
return 0;
} | 0 |
final int[] method3042(int i, int i_75_) {
anInt9143++;
if (i_75_ != 255)
aClass348_Sub42_Sub12_9144 = null;
int[] is = ((Class348_Sub40) this).aClass191_7032.method1433(0, i);
if (((Class191) ((Class348_Sub40) this).aClass191_7032).aBoolean2570) {
int[] is_76_ = this.method3048((aBoolean9147
? C... | 5 |
@SuppressWarnings("unchecked")
public static JSONObject executeShScript(String cmd, JSONObject jsonResp){
log.info("starting shell script execution ... :" + cmd);
try {
Process process = Runtime.getRuntime().exec(cmd);
String outStr = "", s = "";
BufferedReader br = new BufferedReader(new In... | 5 |
public void update(float delta) {
setX(getX() + direction.x * delta);
setY(getY() + direction.y * delta);
animationTime += delta;
setRegion(direction.x < 0 ? left.getKeyFrame(animationTime) : direction.x > 0 ? right.getKeyFrame(animationTime) : direction.y < 0 ? down.getKeyFrame(animationTime) : direction.y > ... | 4 |
private static void loadWindowOptions() {
File inputFile = new File("windows.conf");
if (!inputFile.exists()) {
return;
}
try {
window_props.load(new FileInputStream(inputFile));
} catch (IOException e) {
System.out.println(e);
}
} | 2 |
public boolean setInputFormat(Instances instanceInfo) throws Exception {
Attribute att;
Attribute attNew;
Vector allLabels;
Enumeration enm;
int i;
FastVector values;
FastVector atts;
Instances instNew;
super.setInputFormat(instanceInfo);
m_AttIndex.setUpper(instanceInf... | 9 |
private SeedMenuItem()
{
super("From seed");
setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_DOWN_MASK));
addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e)... | 5 |
static void run(int number) {
try {
System.out.println("================================================");
DetailsLogger.startNewLog(detailsLogPrefix + "." + number + ".xml");
DetailsLogger.logParams(prop);
Individual sampleIndividual = new IntegerIndividual(we... | 7 |
public boolean equals(Vari vertailtava)
{
return punainen == vertailtava.punainen() &&
vihrea == vertailtava.vihrea() &&
sininen == vertailtava.sininen() &&
peittavyys == vertailtava.peittavyys();
} | 3 |
@Override
public Ingredient retrieveIngredient(String name) throws DataStoreException{
name = name.toLowerCase();
if( isIngredientCacheValid ){
for ( Ingredient ingredient : ingredientCache ) {
if( ingredient.getSingular().equals("name")){
return ing... | 6 |
public String getActualSql(Object[] args) {
String[] tableNames = null;
String sql;
if (genericIndexes != null) {
for (Integer index : genericIndexes) {
if (index != null) {
Object arg = args[index];
if (arg != null) {
tableNames = (String[]) ArrayHelper.add(tableNames, arg.toString());
... | 5 |
public FeatureVector predictExtract(GuideDecision decision) throws MaltChainedException {
if (decision instanceof SingleDecision) {
throw new GuideException("A branched decision model expect more than one decisions. ");
}
featureModel.update();
final SingleDecision singleDecision = ((MultipleDecision)decisio... | 7 |
private double traverseCost(Node node, Node newNode, Agent agent) {
if (agent == null) { // default agent
Location loc1 = node.location, loc2 = newNode.location;
int dx = Math.abs(loc1.x - loc2.x), dy = Math.abs(loc1.y - loc2.y);
return costs[grid[newNode.location.x][newNode.location.y]] + 0.1
* (dx + d... | 1 |
public static Player getPlayer(String name) {
for (World world : worlds)
for (Player cyclePlayer : world.getPlayers())
if (cyclePlayer.getUsername().equalsIgnoreCase(name))
return cyclePlayer;
return null;
} | 3 |
public void setREM(int REM) {
this.REM = REM;
if (REM==0)
CharInfo[15] = 0;
else if(REM==1)
CharInfo[15] = 1;
else if(REM==2)
CharInfo[15] = 2;
else if(REM==3)
CharInfo[15] = 3;
else
this.code.setValid(false);
} | 4 |
@SuppressWarnings("unchecked")
public FenetreFichier(final Portail p1, final Fichier fileModif,
final Groupe gp) {
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(100, 100, 379, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
... | 5 |
public String preferredGender() {
final boolean male = actor.traits.male() ;
if (actor.traits.hasTrait(ORIENTATION, "Heterosexual")) {
return male ? "Female" : "Male" ;
}
if (actor.traits.hasTrait(ORIENTATION, "Homosexual")) {
return male ? "Male" : "Female" ;
}
return Rand.yes() ? "... | 5 |
public synchronized void release() {
state = STATE_RELEASED;
} | 0 |
public void keyReleased(KeyEvent e) {
int key = e.getKeyCode();
switch(key) {
case KeyEvent.VK_CONTROL:
fire();
break;
case KeyEvent.VK_LEFT :
bL = false;
break;
case KeyEvent.VK_UP :
bU = false;
break;
case KeyEvent.VK_RIGHT :
bR = false;
break;
case KeyEvent.VK_DOWN :
bD = fal... | 6 |
public Rol buscarRol (String name){
Rol rol=null;
ArrayList<Rol> dbRol = tablaRoles();
for (Rol r : dbRol){
if(r.getNombre().equals(name)){
rol = r;
}
}
return rol;
} | 2 |
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String uniId = request.getParameter("uni_id");
HttpSession session = request.getSession(true);
session.setAttribute("uni_id", uniId);
UniDatabaseManager u... | 4 |
public int binarySearchTail (ArrayList<String> word, String key,int first, int last){
int mid = first + ((last-first)/2);
if (word.size() == 0){
return 0;
}
if (first>last){
return mid;
}
if (key.equals(word.get(mid))){
return mid;
... | 5 |
public IVPBoolean lessThanOrEqualTo(IVPNumber 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_TY... | 5 |
private void notifyConnectionClosed() {
if(_dataModelConnection != null){
// hierdurch werden laufende Operationen in der 2. Verbindung unterbrochen, die die folgenden Aktionen blockieren können.
// Deswegen am Anfang der Methode ausführen.
_dataModelConnection.disconnect(false, "");
}
List<DavConnection... | 8 |
@Override
public PermissionType getType() {
return PermissionType.CONSOLE;
} | 0 |
public Polynomial add(Polynomial P2) {
PolynomialImp result=new PolynomialImp("");
for(Term t1:this.terms){
boolean found=false;
for(Term t2:P2){
//sum if the second term is equal to the term in the first one, break
if(t1.getExponent()==t2.getExponent()){
found=true;
TermImp newTerm = new Te... | 8 |
public static void readFiniteAutomataFromFile(Set<String> states, Set<String> alphabet, List<Element> transitionFunction, StringBuilder startState, Set<String> finalStates) {
try {
FileInputStream fstream = new FileInputStream("D:\\IdeaProjects\\Compilatoare\\src\\Files\\2.finiteAutomata.txt");
... | 9 |
public DecisionTree parse(File f) throws FileNotFoundException, XMLStreamException {
DecisionTree result = null;
DecisionTreeNode root = null;
String[] labels = null;
//Open XML file
InputStream is = new FileInputStream(f);
XMLInputFactory factory = XMLInputFactory.newInstance();
XMLStreamReader reader... | 5 |
@Override
public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
world.render(0, 0);
for (GameObject item : items) {
item.render(gc, sbg, g);
}
player.render(gc, sbg, g);
cm.render(gc, sbg, g);
... | 9 |
@RequestMapping(value = "/{worldId}/{mapId}", method = RequestMethod.GET)
@ResponseBody
public List<Event> getEventsByWorldAndMap(@PathVariable int worldId, @PathVariable int mapId){
List<Event> result = new ArrayList<Event>();
List<Event> events = data.getEvents();
for(Event event : events) {
if(event.getWo... | 3 |
private String FTP_response(String data)
{
Pattern p1 = Pattern.compile("USER");
Matcher m1 = p1.matcher(data);
Pattern p2 = Pattern.compile("PUT");
Matcher m2 = p2.matcher(data);
if (data == null)
return "500 Unknown command\r\n";
else if (m1.find())
return "220 Welcome.\r\n";
else if (m2.f... | 3 |
private void checkMinMaxRelation(final Messager messager,
final AnnotationMirror mirror, final AnnotationValue valueMin,
final AnnotationValue valueMax) {
if (valueMin != null && valueMax != null) {
final SourcePosition srcPosition = mirror.getPosition();
final I... | 5 |
public void configureForSave(OutlinerDocument doc, String protocolName, String currentDirectory) {
lazyInstantiate();
// adjust title
setDialogTitle("Save: " + protocolName);
// adjust approve button
setApproveButtonToolTipText("Save file as named");
// Set the Accessory state
setAccessory(saveAc... | 2 |
@Override
public void parseArgs(String[] args) {
if (args.length < 1) usage(null);
// Parse command line arguments
for (int i = 0; i < args.length; i++) {
if (args[i].equals("-f")) {
// List in a file?
if ((i + 1) < args.length) fileName = args[++i];
else usage("Option '-f' without file argument"... | 9 |
public JSONObject toJSONObject(JSONArray names) throws JSONException {
if (names == null || names.length() == 0 || this.length() == 0) {
return null;
}
JSONObject jo = new JSONObject();
for (int i = 0; i < names.length(); i += 1) {
jo.put(names.getString(i), this.... | 4 |
public Map<Integer, Double> getRankedTagList(int userID, int resID) {
Map<Integer, Double> resultMap = new LinkedHashMap<Integer, Double>();
this.tagRecencies = new ArrayList<Map<Integer, Double>>();
// TODO: calculate your recommendations here and return the top-10 (=REC_LIMIT) tags with probability value
/... | 9 |
public Sound get(String fileName, double volume, double pitch,
boolean shouldLoop) throws IOException {
fileName = filePath + fileName;
SoftReference<SoundData> ref = loaded.get(fileName);
SoundData data = ref == null ? null : ref.get();
if (data == null) {
loaded.remove(fileName);
data = new SoundData... | 2 |
public boolean hasFinalState(State[] states, Automaton automaton) {
for (int k = 0; k < states.length; k++) {
if (automaton.isFinalState(states[k]))
return true;
}
return false;
} | 2 |
public void followBall() {
try {
if(!getMem().isObjVisible("ball")) {
turn(45);
return;
}
if(getMem().isObjVisible("ball")) {
ObjBall ball = getMem().getBall();
if((ball.getDirection() > 5.0) || (ball.getDirection() < -5.0)) {
turn(ball.getDirection() * (1 + (5 * getMem().getAmountOfS... | 7 |
public void draw() {
int leftBound = (int) Math.floor(GLGuru.getXDisplacement() / Object.TILE_SIZE);
int rightBound = (int) Math.ceil((GLGuru.getXDisplacement() + ChristmasCrashers.getWindowWidth()) / Object.TILE_SIZE);
int bottomBound = (int) Math.floor(GLGuru.getYDisplacement() / Object.TILE_SIZE);
int topBou... | 7 |
public static void main(String[] args) {
if (args.length == 0 || (args.length == 1 && args[0].equals("-i"))) {
Runnable task = new CalculatorInteractive();
task.run();
} else if (args.length == 1) {
Runnable task = new CalculatorBatch(new File(args[0]));
task.run();
}
} | 4 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (!(obj instanceof CoachCarriage))
return false;
CoachCarriage other = (CoachCarriage) obj;
if (coachNumber != other.coachNumber)
return false;
return true;
} | 4 |
@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 Departamento)) {
return false;
}
Departamento other = (Departamento) object;
if ((this.idDepartamento == null &... | 5 |
public void setMediator(Mediator mediator) {
this.mediator = mediator;
} | 0 |
public static void init(String username, String interfaceName)
{
instance = new ClientFinder(username, interfaceName);
} | 0 |
public static String[] sort(String[] a, int W) {
int N = a.length;
int R = 256; // extend ASCII alphabet size
String[] aux = new String[N];
for (int d = W-1; d >= 0; d--) {
// sort by key-indexed counting on dth character
// compute frequency counts
... | 5 |
protected void cleanUp() {
// signal to unpause
setPaused(false);
// close the mixer (stops any running sounds)
Mixer mixer = AudioSystem.getMixer(null);
if (mixer.isOpen()) {
mixer.close();
}
} | 1 |
@Override
public int[] getWindowIndices(int idx) {
Date beginning = getWindowBounds(idx)[0];
Date end = getWindowBounds(idx)[1];
int first = -1;
int last = -1;
if (current.get(0).getStart().after(end) || current.get(current.size() - 1).getStart().before(beginning))
... | 9 |
public static void recursiveZipDirectory(File sourceFolder, ZipOutputStream zipStream) throws IOException {
String[] dirList = sourceFolder.list();
byte[] readBuffer = new byte[2156];
int bytesIn = 0;
for (int i = 0; i < dirList.length; i++) {
File f = new File(sourceFolder, dirList[i]);
if (f.isDirectory... | 3 |
public static boolean transform(InstructionContainer ic,
StructuredBlock last) {
return transformNormal(ic, last) || transformJikesString(ic, last);
} | 1 |
private void setupUI() {
/* Creates a draw panel that has a background, we do all our drawing on here */ //http://stackoverflow.com/questions/10961023/move-a-jlabel-to-front
drawPanel = new DrawPanel();
drawPanel.setLayout(null);
try {
// Pretty much the cleanest way I've seen this done...
drawPanel.se... | 5 |
@Override
public void dec(Integer... a) {
// TODO Auto-generated method stub
} | 0 |
public boolean isSyncMark(int headerstring, int syncmode, int word)
{
boolean sync = false;
if (syncmode == INITIAL_SYNC)
{
//sync = ((headerstring & 0xFFF00000) == 0xFFF00000);
sync = ((headerstring & 0xFFE00000) == 0xFFE00000); // SZD: MPEG 2.5
}
else
{
sync = ((headerstring & 0xFFF80C00) ==... | 5 |
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
int origen = this.cbxeorigen.getSelectedIndex();
int simbolo = this.cbxsimbolo.getSelectedIndex();
int destino = this.cbxedestino.getSelectedIndex();
if (this.rbbefinal.isSelec... | 1 |
static public boolean readBoolean(String strPrompt) {
do {
try {
String strBool = readLineFromConsole(strPrompt).toLowerCase();
if (strBool.equals("s") || strBool.equals("y")) {
return true;
} else if (strBool.equals("n")) {
... | 5 |
public String extractConfigSudoku9(Map<String, String> allRequestParams){
Set<String> keys = allRequestParams.keySet();
String[][] orderedValues = new String[9][9];
for (String key: keys){
String value = allRequestParams.get(key);
//The strings are exp... | 7 |
public static int cal(int x){
if(x < 0){
return 0;
}else{
return x + cal(x);
}
} | 1 |
@Override
public Response list() throws IOException {
if(currentUser != null) {
return new ListResponse(proxyCli.getCombinedFileList());
}
return new MessageResponse("You have to login first to perform this action!");
} | 1 |
@Id
@GenericGenerator(name = "generator", strategy = "increment")
@GeneratedValue(generator = "generator")
@Column(name = "box_id")
public int getBoxId() {
return boxId;
} | 0 |
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.